|
a/src/qtgui/preview/preview.ui.h |
|
b/src/qtgui/preview/preview.ui.h |
|
... |
|
... |
182 |
pvTab->removePage(tw);
|
182 |
pvTab->removePage(tw);
|
183 |
} else {
|
183 |
} else {
|
184 |
close();
|
184 |
close();
|
185 |
}
|
185 |
}
|
186 |
}
|
186 |
}
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
QTextEdit * Preview::addEditorTab()
|
|
|
190 |
{
|
|
|
191 |
QWidget *anon = new QWidget((QWidget *)pvTab);
|
|
|
192 |
QVBoxLayout *anonLayout = new QVBoxLayout(anon, 1, 1, "anonLayout");
|
|
|
193 |
QTextEdit *editor = new QTextEdit(anon, "pvEdit");
|
|
|
194 |
editor->setReadOnly( TRUE );
|
|
|
195 |
editor->setUndoRedoEnabled( FALSE );
|
|
|
196 |
anonLayout->addWidget(editor);
|
|
|
197 |
pvTab->addTab(anon, "Tab");
|
|
|
198 |
pvTab->showPage(anon);
|
|
|
199 |
return editor;
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
using std::string;
|
|
|
203 |
|
|
|
204 |
void Preview::setCurTabProps(const Rcl::Doc &doc)
|
|
|
205 |
{
|
|
|
206 |
QString title = QString::fromUtf8(doc.title.c_str(),
|
|
|
207 |
doc.title.length());
|
|
|
208 |
if (title.length() > 20) {
|
|
|
209 |
title = title.left(10) + "..." + title.right(10);
|
|
|
210 |
}
|
|
|
211 |
pvTab->changeTab(pvTab->currentPage(), title);
|
|
|
212 |
|
|
|
213 |
char datebuf[100];
|
|
|
214 |
datebuf[0] = 0;
|
|
|
215 |
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
|
|
|
216 |
time_t mtime = doc.dmtime.empty() ?
|
|
|
217 |
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
|
|
|
218 |
struct tm *tm = localtime(&mtime);
|
|
|
219 |
strftime(datebuf, 99, "%F %T", tm);
|
|
|
220 |
}
|
|
|
221 |
string tiptxt = doc.url + string("\n");
|
|
|
222 |
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
|
|
223 |
if (!doc.title.empty())
|
|
|
224 |
tiptxt += doc.title + "\n";
|
|
|
225 |
pvTab->setTabToolTip(pvTab->currentPage(),
|
|
|
226 |
QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
|
|
|
227 |
}
|