31 #include <QMessageBox> 32 #include <QSignalMapper> 34 #include <QProgressDialog> 35 #include <QPushButton> 36 #include <QApplication> 38 #include <QDesktopServices> 44 #include <ui_klflibbrowser.h> 50 #if defined(Q_OS_WIN32)
59 u =
new Ui::KLFLibBrowser;
61 u->tabResources->setContextMenuPolicy(Qt::CustomContextMenu);
64 u->searchBar->registerShortcuts(
this);
69 pResourceMenu =
new QMenu(u->tabResources);
84 pResourceMenu->
addAction(u->aRenameSubRes);
101 pTabCornerButton =
new QPushButton(u->tabResources);
102 pTabCornerButton->
setMenu(pResourceMenu);
103 u->tabResources->setCornerWidget(pTabCornerButton);
114 restoreMenu->
addAction(u->aRestoreWithStyle);
115 restoreMenu->
addAction(u->aRestoreLatexOnly);
116 u->btnRestore->setMenu(restoreMenu);
120 connect(u->aDelete, SIGNAL(triggered()), u->btnDelete, SLOT(animateClick()));
124 pImportExportMenu =
new QMenu(
this);
125 pImportExportMenu->
addAction(u->aOpenAll);
126 pImportExportMenu->
addAction(u->aExport);
127 pImportExportMenu->
addAction(u->aExportSelection);
128 u->btnImportExport->setMenu(pImportExportMenu);
130 connect(u->aOpenAll, SIGNAL(triggered()),
this, SLOT(
slotOpenAll()));
131 connect(u->aExport, SIGNAL(triggered()),
this, SLOT(
slotExport()));
140 connect(u->wEntryEditor, SIGNAL(restoreStyle(
const KLFStyle&)),
146 connect(u->btnCreateRes, SIGNAL(clicked()),
this, SLOT(
slotResourceNew()));
165 u->retranslateUi(
this);
167 u->wEntryEditor->retranslateUi(alsoBaseUi);
169 pResourceMenu->setTitle(tr(
"Resource Actions",
"[[menu title]]"));
170 u->searchBar->setFocusOutText(
" "+tr(
"Hit Ctrl-F, Ctrl-S or / to search within the current resource"));
171 pTabCornerButton->setText(tr(
"Resource"));
180 for (k = 0; k < pLibViews.
size(); ++k) {
194 if (obj->
property(
"resourceTitleEditor").toBool() ==
true) {
195 if (ev->
type() == QEvent::FocusOut) {
199 if (ev->
type() == QEvent::KeyPress) {
201 if (ke->
key() == Qt::Key_Escape) {
208 if (ev->
type() == QEvent::Hide &&
209 obj->
property(
"klf_libbrowser_pdlg_want_hideautodelete").toBool() ==
true) {
211 klfDbg(
": progress dialog was hidden, deleting." ) ;
217 return QWidget::eventFilter(obj, ev);
225 return pLibViews.
indexOf(viewc);
231 if (i < 0 || i >= pLibViews.
size())
233 return pLibViews[i]->url();
241 for (k = 0; k < pLibViews.
size(); ++k) {
242 urls << pLibViews[k]->url();
260 return viewc->
view();
268 return viewc->
view();
284 for (k = 0; k < myurllist.
size(); ++k) {
287 qWarning()<<
"Should NOT HAPPEN! viewc is NULL in KLFLibBrowser::saveGuiState()! URL-List=\n" 292 urllist << QVariant::fromValue<QUrl>(myurllist[k]);
293 viewstatelist << QVariant::fromValue<QVariantMap>(viewState);
296 v[
"UrlList"] = QVariant::fromValue<QVariantList>(urllist);
297 v[
"ViewStateList"] = QVariant::fromValue<QVariantList>(viewstatelist);
298 v[
"ResourceRoleFlagsList"] = QVariant::fromValue<QVariantList>(resroleflagslist);
299 v[
"CurrentUrl"] = QVariant::fromValue<QUrl>(currenturl);
300 v[
"WidgetSize"] = QVariant::fromValue<QSize>(size());
305 QUrl currenturl = v[
"CurrentUrl"].toUrl();
308 QList<QVariant> resroleflagslist = v[
"ResourceRoleFlagsList"].toList();
309 QSize widgetsize = v[
"WidgetSize"].value<
QSize>();
311 for (k = 0; k < urllist.
size(); ++k) {
312 QUrl url = urllist[k].toUrl();
313 quint32 flags = resroleflagslist[k].
value<quint32>();
314 klfDbg(
"LibBrowser::loadGuiState: Opening url "<<url<<
" with flags="<<flags ) ;
315 QVariantMap viewState = viewstatelist[k].toMap();
324 qWarning()<<
"KLFLibBrowser::loadGuiState: Can't open resource "<<url<<
"! (flags=" 329 klfDbg(
"Almost finished loading gui state." ) ;
331 if (curviewc != NULL)
332 u->tabResources->setCurrentWidget(curviewc);
333 klfDbg(
"Loaded GUI state." ) ;
335 if (widgetsize.
width() > 0 && widgetsize.
height() > 0)
355 basestr =
QString(
"%1 - %2").arg(resource->
title(), subresourcetitle);
357 basestr = resource->
title();
360 basestr =
"# "+basestr;
370 klfDbg(
"\turl is "<<url ) ;
372 for (k = 0; k < pLibViews.
size(); ++k) {
373 klfDbg(
"\t\ttest lib view #"<<k) ;
374 klfDbg(
"\t\turl="<<pLibViews[k]->url() ) ;
392 for (k = 0; k < pLibViews.
size(); ++k)
393 if (pLibViews[k]->resourceEngine() == resource)
418 for (k = 0; k < pLibViews.
size(); ++k) {
419 if ((pLibViews[k]->resourceRoleFlags() & mask) == testflags) {
420 klfDbg(
"Adding #"<<k<<
": "<<pLibViews[k]<<
", url="<<pLibViews[k]->url()) ;
421 list << pLibViews[k];
430 const QString& viewTypeIdentifier)
437 const QString& viewTypeIdentifier)
440 klfDbg(
" url="<<url.
toString()<<
"; resroleflags="<<resourceRoleFlags
441 <<
"; vtypeidentifier="<<viewTypeIdentifier ) ;
444 if (openview != NULL) {
445 qDebug(
"KLFLibBrowser::openResource(%s,%u): This resource is already open.",
446 qPrintable(url.
toString()), resourceRoleFlags);
448 u->tabResources->setCurrentWidget(openview);
449 updateResourceRoleFlags(openview, resourceRoleFlags);
454 if ( factory == NULL ) {
459 if ( resource == NULL ) {
465 return openResource(resource, resourceRoleFlags, viewTypeIdentifier);
468 const QString& viewTypeIdentifier)
471 klfDbg(
"\topening resource url=" 477 "resource pointer is NULL! (flags="<<resourceRoleFlags<<
",vti="<<viewTypeIdentifier<<
")",
481 if (openview != NULL) {
482 qDebug(
"KLFLibBrowser::openResource(%p,%u): This resource is already open.",
483 resource, resourceRoleFlags);
485 u->tabResources->setCurrentWidget(openview);
486 updateResourceRoleFlags(openview, resourceRoleFlags);
492 klfDbgT(
": created resource. about to create view container.") ;
497 klfDbgT(
": adding tab page....") ;
499 int i = u->tabResources->addTab(viewc,
displayTitle(resource));
501 u->tabResources->setCurrentWidget(viewc);
505 setStyleSheet(styleSheet());
506 updateResourceRoleFlags(viewc, resourceRoleFlags);
513 connect(viewc, SIGNAL(moreCategorySuggestions(
const QStringList&)),
521 connect(viewc, SIGNAL(requestOpenUrl(
const QString&)),
526 connect(resource, SIGNAL(resourcePropertyChanged(
int)),
528 connect(resource, SIGNAL(subResourcePropertyChanged(
const QString&,
int)),
530 connect(resource, SIGNAL(defaultSubResourceChanged(
const QString&)),
541 connect(viewc, SIGNAL(viewContextMenuRequested(
const QPoint&)),
548 viewtypeident_try << viewTypeIdentifier;
557 viewtypeident_try << resource->
viewType();
565 klfDbgT(
": created resource. about to test view types.") ;
566 klfDbg(
"\tView types: "<<viewtypeident_try ) ;
570 for (k = 0; k < viewtypeident_try.size(); ++k) {
571 if (viewtypeident_try[k].isEmpty())
576 if (viewfactory == NULL) {
577 klfDbg(
"can't find view factory for view type identifier " 578 <<viewtypeident_try[k]<<
"!" ) ;
582 klfDbg(
"incompatible view type identifier "<<viewtypeident_try[k]
583 <<
"for resource "<<resource->
url()<<
"." ) ;
586 bool r = viewc->
openView(viewtypeident_try[k]);
588 klfDbg(
"can't create view! viewtypeident="<<viewtypeident_try[k]<<
"." ) ;
592 klfDbgT(
": found and instantiated good view type="<<viewtypeident_try[k]) ;
600 klfDbgT(
": requiring cat suggestions.") ;
606 if ((i = u->tabResources->indexOf(u->tabWelcome)) != -1)
607 u->tabResources->removeTab(i);
619 klfDbg(
"view-type-identifier is "<<vti<<
"; guiState is "<<guiState) ;
623 klfDbg(
"restoring gui state..") ;
625 KLF_ASSERT_NOT_NULL( viewc,
"can't find the view container we just opened!",
return false ) ;
653 resroleflags = resroleflags & ~
NowMask;
655 klfDbg(
"updating flags for resource="<<viewc->
url()<<
"; flags after mask=" 656 <<
klfFmtCC(
"%#010x", resroleflags)) ;
663 for (j = 0; exclusive_flag_list[j] != 0; ++j) {
664 uint xflag = exclusive_flag_list[j];
665 if (resroleflags & xflag) {
668 for (k = 0; k < pLibViews.
size(); ++k) {
669 if (pLibViews[k] == viewc)
671 uint fl = pLibViews[k]->resourceRoleFlags();
674 pLibViews[k]->setResourceRoleFlags(fl & ~xflag);
688 klfDbg(
"\t tabIndex="<<tabIndex ) ;
692 if (viewc == NULL || tabIndex < 0) {
698 u->searchBar->setSearchTarget(viewc);
700 klfDbg(
"setting up view type menu...") ;
704 QMenu *viewTypeMenu = u->aViewType->menu();
705 if (viewTypeMenu == NULL) {
706 viewTypeMenu =
new QMenu(
this);
707 u->aViewType->setMenu(viewTypeMenu);
708 KLF_DEBUG_WATCH_OBJECT(viewTypeMenu) ;
710 viewTypeMenu->
clear();
712 for (k = 0; k < actions.
size(); ++k) {
716 QMenu * openSubResMenu = u->aOpenSubRes->menu();
717 if (openSubResMenu == NULL) {
718 openSubResMenu =
new QMenu(
this);
719 u->aOpenSubRes->setMenu(openSubResMenu);
720 KLF_DEBUG_WATCH_OBJECT(openSubResMenu) ;
722 openSubResMenu->
clear();
724 for (k = 0; k < openSubResActions.
size(); ++k) {
725 openSubResMenu->
addAction(openSubResActions[k]);
727 if (openSubResActions.
size() > 0)
728 u->aOpenSubRes->setEnabled(
true);
730 u->aOpenSubRes->setEnabled(
false);
745 int tab = u->tabResources->getTabAtPoint(pos);
747 u->tabResources->setCurrentIndex(tab);
749 pResourceMenu->
popup(u->tabResources->mapToGlobal(pos));
763 klfDbg(
"renamingSubResource="<<renamingSubResource) ;
765 int tab = u->tabResources->currentIndex();
767 if (tab < 0 || viewc == NULL)
770 klfDbg(
": Rename! renamingSubResource="<<renamingSubResource ) ;
777 if ( renamingSubResource &&
786 editor->setGeometry(u->tabResources->getTabRect(tab));
788 if (!renamingSubResource)
789 editor->setText(res->
title());
794 editor->setProperty(
"tabURL", viewc->
url());
795 editor->setProperty(
"resourceTitleEditor",
true);
796 editor->setProperty(
"needsBackground",
true);
797 editor->setProperty(
"renamingSubResource", renamingSubResource);
798 editor->setStyleSheet(
"");
799 editor->installEventFilter(
this);
802 connect(u->tabResources, SIGNAL(currentChanged(
int)), editor, SLOT(deleteLater()));
811 if (editor == NULL) {
812 qWarning(
"KLFLibBrowser::slotResourceRenameFinished: no sender!");
815 bool isRenamingSubResource = editor->
property(
"renamingSubResource").toBool();
819 qWarning()<<
KLF_FUNC_NAME<<
": can't find the resource with URL "<<url;
824 if (!isRenamingSubResource)
828 QVariant::fromValue<QString>(text));
847 int tabindex = u->tabResources->indexOf(view);
849 qWarning(
"KLFLibBrowser::closeResource(url): can't find view in tab widget?!?\n" 850 "\turl=%s, viewwidget=%p", qPrintable(view->
url().
toString()), view);
856 QMessageBox::StandardButton btn =
858 QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
859 if (btn != QMessageBox::Yes)
863 u->tabResources->removeTab(tabindex);
864 int index = pLibViews.
indexOf(view);
871 if (u->tabResources->count() == 0)
872 u->tabResources->addTab(u->tabWelcome,
QIcon(
":/pics/library.png"), tr(
"Library Browser"));
883 qWarning(
"KLFLibBrowser::slotResourceProperties: NULL View!");
896 qWarning(
"KLFLibBrowser::slotResourceProperties: NULL View!");
909 klfDbg(
"KLFLibBrowser::slotRes.New.S.Res(): Create sub-resource named "<<name<<
", opening "<<url ) ;
928 "Sub-resources are not supported in resource "<<res->url()<<
"!" 929 " Cannot delete sub-resource!",
932 if (res->subResourceList().size() <= 1) {
934 tr(
"You may not delete the last remaining sub-resource of this resource."));
935 klfDbg(
"Attempted to delete last remaining sub-resource"<<res->defaultSubResource()<<
" of resource " 936 <<res->url()<<
". Not allowed.") ;
940 QString curSubResource = res->defaultSubResource();
941 QString curSubResTitle = curSubResource;
950 QMessageBox::StandardButton btn =
952 tr(
"Do you really want to delete the sub-resource <b>%1</b>, " 953 "with all its contents, from resource <b>%2</b>?")
955 QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Cancel);
956 if (btn != QMessageBox::Yes)
960 bool result = res->deleteSubResource(curSubResource);
965 tr(
"Deleting sub-resource failed."));
994 if (resource == NULL)
1021 if (viewc == NULL) {
1022 qWarning()<<
"KLFLibBrowser::slotResourceDataChanged: NULL sender or not KLFLibBro.ViewCont.!";
1029 qWarning()<<
"KLFLibBrowser::slotResourceDataChanged: NULL view !!";
1039 if (resource == NULL) {
1040 qWarning(
"KLFLibBrowser::slotResourcePropertyChanged: NULL sender or not resource!");
1049 klfDbg(
"res="<<resource<<
", propId="<<propId) ;
1055 qWarning()<<
"KLFLibBrowser::slotResourcePropertyChanged: can't find view for resource " 1056 <<resource<<
", url="<<resource->
url()<<
"!";
1061 u->tabResources->setTabText(u->tabResources->indexOf(view),
displayTitle(resource));
1064 u->tabResources->refreshTabReadOnly(u->tabResources->indexOf(view),
1075 Q_UNUSED(subResource) ;
1076 klfDbg(
"subResource="<<subResource<<
", propId="<<propId) ;
1079 if (resource == NULL) {
1080 qWarning(
"KLFLibBrowser::slotSubResourcePropertyChanged: NULL sender or not resource!");
1099 Q_UNUSED(subResource) ;
1100 klfDbg(
"subResource="<<subResource) ;
1103 if (resource == NULL) {
1104 qWarning(
"KLFLibBrowser::slotDefaultSubResourceChanged: NULL sender or not resource!");
1146 klfDbg(
"selected "<<sel.
size()<<
" items:" <<sel);
1151 QMessageBox::StandardButton res
1153 tr(
"Delete %n selected item(s) from resource \"%1\"?",
"", sel.
size())
1154 .arg(resource->
title()),
1155 QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Cancel);
1156 if (res != QMessageBox::Yes)
1166 bool master =
false;
1167 bool canrename =
false;
1168 bool canrenamesubres =
false;
1169 bool cansaveto =
false;
1170 bool cannewsubres =
false;
1171 bool candelsubres =
false;
1173 uint resfeatureflags = 0;
1176 if ( view != NULL ) {
1193 u->aRename->setEnabled(canrename);
1194 u->aRenameSubRes->setEnabled(canrenamesubres);
1195 u->aProperties->setEnabled(master);
1196 u->aNewSubRes->setEnabled(master && cannewsubres);
1197 u->aDelSubRes->setEnabled(master && candelsubres);
1198 u->aSaveTo->setEnabled(master && cansaveto);
1199 u->aNew->setEnabled(
true);
1200 u->aOpen->setEnabled(
true);
1209 klfDbg(
"(): "<<entries ) ;
1210 if (entries.
size()>=1)
1219 u->wEntryEditor->displayEntries(entries);
1221 u->btnDelete->setEnabled(entries.
size() > 0);
1222 u->aDelete->setEnabled(u->btnDelete->isEnabled());
1223 u->btnRestore->setEnabled(entries.
size() == 1);
1230 klfDbg(
"KLFLibBrowser: got category suggestions: "<<catlist ) ;
1231 u->wEntryEditor->addCategorySuggestions(catlist);
1244 QAction *a1 = menu->
addAction(
QIcon(
":/pics/restoreall.png"), tr(
"Restore latex formula and style"),
1245 view, SLOT(restoreWithStyle()));
1247 view, SLOT(restoreLatexOnly()));
1256 QKeySequence::Copy);
1258 QKeySequence::Paste);
1267 QAction *acopythere, *amovethere;
1268 int n_destinations = 0;
1269 for (k = 0; k < pLibViews.
size(); ++k) {
1270 if (pLibViews[k]->url() == view->
url())
1273 QUrl viewurl = pLibViews[k]->url();
1276 acopythere->setProperty(
"resourceViewUrl", viewurl);
1278 amovethere->setProperty(
"resourceViewUrl", viewurl);
1280 acopythere->setEnabled(
false);
1281 amovethere->setEnabled(
false);
1285 acopyto->setText(tr(
"Copy to"));
1286 acopyto->setIcon(
QIcon(
":/pics/copy.png"));
1288 amoveto->setText(tr(
"Move to"));
1289 amoveto->setIcon(
QIcon(
":/pics/move.png"));
1296 bool cancopy = (selected.
size() > 0) && n_destinations;
1297 bool canre = (selected.
size() == 1);
1300 a1->setEnabled(canre);
1301 a2->setEnabled(canre);
1302 adel->setEnabled(candel && selected.
size());
1303 acut->setEnabled(cancopy && candel);
1304 acopy->setEnabled(cancopy);
1305 apaste->setEnabled(canpaste);
1306 acopyto->setEnabled(cancopy);
1307 amoveto->setEnabled(cancopy && candel);
1312 if (viewActions.
size())
1314 for (k = 0; k < viewActions.
size(); ++k) {
1315 klfDbg(
"Added action "<<k<<
": "<<viewActions[k] ) ;
1328 QWidget *w = u->tabResources->currentWidget();
1330 if (wviewc == NULL) {
1331 qWarning(
"Current view is not a KLFLibBrowserViewContainer or no current tab widget!");
1339 if ( wview == NULL )
1346 for (k = 0; k < keys.
size(); ++k)
1347 values << props[keys[k]];
1351 tr(
"Failed to write meta-information!"));
1366 klfDbg(
"vHistory="<<vHistory<<
", vArchive="<<vArchive<<
", wviewc="<<wviewc) ;
1367 if (vHistory != NULL && vArchive != NULL && vHistory != vArchive &&
1368 vHistory == wviewc) {
1369 klfDbg(
"categorized formula in history. copying it to archive");
1377 if (archiveRes == NULL || archiveView == NULL) {
1378 qWarning()<<
KLF_FUNC_NAME<<
": archiveRes or archiveView is NULL ?!?";
1384 u->tabResources->setCurrentWidget(vArchive);
1408 QUrl destUrl = action->
property(
"resourceViewUrl").toUrl();
1410 qWarning()<<
"KLFLibBrowser::slotCopyMoveToResource(): bad sender property ! sender is a `" 1411 <<action->
metaObject()->className()<<
"'; expected QAction with 'resourceViewUrl' property set.";
1415 if (sourceView == NULL) {
1416 qWarning()<<
"KLFLibBrowser::slotCopyMoveToResource(): source view is NULL!";
1420 if (destViewC == NULL || destViewC->
view() == NULL) {
1421 qWarning()<<
"KLFLibBrowser::slotCopyMoveToResource(): can't find dest view url for URL="<<destUrl<<
" !";
1439 QString msg = move ? tr(
"Failed to move the selected items.")
1440 : tr(
"Failed to copy the selected items.");
1475 vprops[
"Url"] = view->
url();
1495 QMessageBox::critical(
this, tr(
"Error"), tr(
"The clipboard doesn't contain any appropriate data."));
1499 klfDbg(
": Pasting data! props="<<vprops ) ;
1516 for (k = 0; k < locfiletypes.
size(); ++k) {
1517 exportFilterList << locfiletypes[k].filter;
1518 filterlist << locfiletypes[k].filepattern;
1520 exportFilterList.prepend(tr(
"All Known Library Files (%1)").arg(filterlist.
join(
" ")));
1521 exportFilterList << tr(
"All Files (*)");
1522 exportFilter = exportFilterList.
join(
";;");
1531 int ifilter = exportFilterList.
indexOf(selectedFilter);
1534 if (ifilter >= 0 && ifilter < locfiletypes.
size()) {
1535 selectedScheme = locfiletypes[ifilter].scheme;
1540 qWarning()<<
KLF_FUNC_NAME<<
": The given file name is not readable: "<<fn;
1544 if (selectedScheme.
isEmpty()) {
1552 for (k = 0; k < subreslist.size(); ++k) {
1554 url.
addQueryItem(
"klfDefaultSubResource", subreslist[k]);
1567 if (exportRes == NULL) {
1571 .toString(Qt::DefaultLocaleShortDate)));
1573 klfDbg(
"Export: to resource "<<exportRes->
url().
toString()<<
". Export: "<<exportUrls);
1580 pdlg.setAutoClose(
false);
1581 pdlg.setAutoReset(
false);
1586 for (k = 0; k < exportUrls.
size(); ++k) {
1587 klfDbg(
"Exporting "<<exportUrls[k]<<
" ...");
1588 QUrl u = exportUrls[k];
1595 usr = u.
path().section(
'/', -1, -1, QString::SectionSkipEmpty);
1600 while (subresources.
contains(subres))
1606 qWarning()<<
KLF_FUNC_NAME<<
" exporting "<<u<<
" failed: can't create sub-resource "<<subres<<
"!";
1609 subresources.append(subres);
1613 qWarning()<<
KLF_FUNC_NAME<<
" can't find open resource="<<u<<
" !";
1618 title = res->
title();
1621 title = res->
title() +
": " +
1624 title = res->
title() +
": " + usr;
1629 pdlg.setDescriptiveText(tr(
"Exporting ... %3 (%1/%2)")
1630 .arg(k+1).arg(exportUrls.
size()).arg(title));
1637 for (j = 0; j < elistwid.
size(); ++j)
1638 elist << elistwid[j].entry;
1664 qWarning(
"KLFLibBrowser::slotResourceProperties: NULL View!");
1670 if (factory == NULL) {
1671 qWarning()<<
KLF_FUNC_NAME<<
": Can't create KLFLibLegacyEngineFactory object (\"klf+legacy\") ?!?";
1679 klfDbg(
"Canceled by user.");
1687 qWarning()<<
KLF_FUNC_NAME<<
": Can't overwrite file "<<fileName;
1692 klfDbg(
"Exporting to file "<<fileName);
1700 param[
"Filename"] = fileName;
1701 param[
"klfDefaultSubResource"] = tr(
"Export",
"[[export selection default sub-resource name]]");
1704 if (resource == NULL) {
1724 klfDbg(
": min,max="<<progressReporter->
min()<<
","<<progressReporter->
max()
1725 <<
"; text="<<text ) ;
1729 pdlg->startReportingProgress(progressReporter, text);
1731 pdlg->setProperty(
"klf_libbrowser_pdlg_want_hideautodelete",
QVariant(
true));
1732 pdlg->installEventFilter(
this);
1739 if (e->
type() == QEvent::KeyPress) {
1741 if (ke->
key() == Qt::Key_F8 && ke->modifiers() == 0) {
1752 QWidget::timerEvent(event);
1761 for (k = 0; k < pLibViews.
size(); ++k) {
1764 u->tabResources->refreshTabReadOnly(u->tabResources->indexOf(viewc),
1767 u->tabResources->setFocus();
These flags are not stored, they act upon the openResource() call only.
This resource is the Archive resource.
void slotResourceRenameSubResource()
Instructs not to raise the tab during this call of openResource()
QList< QUrl > openUrls() const
KLFLibResourceEngine * resourceEngine()
QVariantMap saveGuiState() const
#define KLF_ASSERT_CONDITION(expr, msg, failaction)
virtual bool canModifySubResourceProperty(const QString &subResource, int propId) const
static QUrl queryOpenResource(const QUrl &defaultlocation=QUrl(), QWidget *parent=0)
void slotUpdateForResourceProperty(KLFLibResourceEngine *resource, int propId)
virtual bool createSubResource(const QString &subResource, const QString &subResourceTitle)
Create a new sub-resource.
virtual QVariant subResourceProperty(const QString &subResource, int propId) const
void loadGuiState(const QVariantMap &v)
virtual bool canCreateLibView(const QString &viewTypeIdent, KLFLibResourceEngine *engine)=0
void slotCopyToResource()
KLFAbstractLibView * getView(const QUrl &url)
#define klfDbgT(streamableItems)
Sub-Resources may be assigned properties and values.
This resource is the History resource.
void slotStartProgress(KLFProgressReporter *progressReporter, const QString &text)
KLFLibResourceEngine * getOpenResource(const QUrl &url)
Resource 'Close' GUI button is disabled (grayed)
void slotDefaultSubResourceChanged(const QString &subResource)
contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive)
virtual bool setSubResourceProperty(const QString &subResource, int propId, const QVariant &value)
#define klfDbg(streamableItems)
QList< QAction * > openSubResourceActions()
virtual KLFLibResourceEngine * openResource(const QUrl &location, QObject *parent=NULL)=0
#define KLF_DEBUG_BLOCK(msg)
void slotEntriesSelected(const KLFLibEntryList &entries)
virtual bool setViewType(const QString &viewType)
static bool canDecodeMimeData(const QMimeData *mimeData)
virtual bool setTitle(const QString &title)
set a new resource title for this library resource
join(const QString &separator)
hasQueryItem(const QString &key)
Instructs to not set new flags for already-open resources.
bool openView(const QString &viewTypeIdent)
void requestRestore(const KLFLibEntry &entry, uint restoreFlags)
toString(FormattingOptions options=None)
bool slotResourceNewSubRes()
void slotMoveToResource()
KLFAbstractLibView * view()
void loadGuiState(const QVariantMap &state, bool openURLs=true)
#define KLF_ASSERT_NOT_NULL(ptr, msg, failaction)
virtual bool deleteSubResource(const QString &subResource)
static KLFLibViewFactory * findFactoryFor(const QString &viewTypeIdentifier)
replace(int position, int n, const QString &after)
virtual KLFLibEntryList selectedEntries() const =0
indexOf(const T &value, int from=0)
bool historyTagCopyToArchive
number(long n, int base=10)
void slotAddCategorySuggestions(const QStringList &catlist)
QUrl currentUrl()
Returns the URL of the current tab page.
bool slotResourceSaveTo()
virtual void restoreWithStyle()
void timerEvent(QTimerEvent *event)
KLFLibBrowser(QWidget *parent=NULL)
static KLFLibResourceEngine * createResource(const QString &defaultWtype, QObject *resourceParent, QWidget *parent=0)
property(const char *name)
int currentUrlIndex()
Returns the index of currentUrl() in openUrls()
question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void slotCopyMoveToResource(QObject *sender, bool move)
KLFLibBrowserViewContainer * findOpenUrl(const QUrl &url)
removeAllQueryItems(const QString &key)
#define KLF_DEBUG_ASSIGN_REF_INSTANCE(object, ref_instance)
Data can be stored in separate sub-resources.
setScheme(const QString &scheme)
void slotResourcePropertyChanged(int propId)
virtual void wantMoreCategorySuggestions()
void slotShowContextMenu(const QPoint &pos)
bool slotExportSelection()
A view widget to display a library resource's contents.
virtual KLFLibResourceEngine * createResource(const QString &scheme, const Parameters ¶meters, QObject *parent=NULL)
Create a new resource of given type and parameters.
void retranslateUi(bool alsoBaseUi=true)
void slotSubResourcePropertyChanged(const QString &subResource, int propId)
virtual bool canCreateSubResource() const
void slotResourceRenameFinished()
virtual bool deleteEntries(const QString &subResource, const QList< entryId > &idlist)=0
Delete some entries in this resource.
void slotTabResourceShown(int tabIndex)
virtual QString defaultSubResource() const
Add a query item for default sub-res. as "klfDefaultSubResource".
void libEntriesSelected(const KLFLibEntryList &entries)
#define KLF_DEBUG_TIME_BLOCK(msg)
KlfUrlCompareLessSpecific
virtual uint supportedFeatureFlags() const
List of features supported by this resource engine.
virtual bool canModifyData(const QString &subResource, ModifyType modifytype) const
KLFAbstractLibView * curLibView()
setParent(QObject *parent)
virtual QList< entryId > insertEntries(const QString &subResource, const KLFLibEntryList &entrylist)=0
Insert new entries in this resource.
void slotResourceProperties()
Tags about the equation (string)
virtual QString viewType() const
The (last) View Type used to display this resource.
virtual QString title() const
The human-set title of this resource.
void slotRestoreWithStyle()
virtual void restoreLatexOnly()
KLFLibBrowserViewContainer * curView()
static bool decodeMimeData(const QMimeData *mimeData, KLFLibEntryList *entryList, QVariantMap *metaData)
static QString createSubResourceIn(KLFLibResourceEngine *resource, QWidget *parent=0)
static QStringList listSubResources(const QUrl &url)
KLFLibBrowserViewContainer * findSpecialResource(uint specialResourceRoleFlag)
bool slotResourceDelSubRes()
virtual QString schemeTitle(const QString &scheme) const =0
QString lastFileDialogPath
void setResourceRoleFlags(uint flags)
void slotShowTabContextMenu(const QPoint &pos)
An entry (single formula) in the library.
bool closeResource(const QUrl &url)
bool openResourceFromGuiState(const QUrl &url, const QVariantMap &guiState)
bool slotResourceClose(KLFLibBrowserViewContainer *view=NULL, bool force=false)
static KLFLibEngineFactory * findFactoryFor(const QUrl &url)
static QString displayTitle(KLFLibResourceEngine *resource)
void slotDeleteSelected()
void slotRefreshResourceActionsEnabled()
virtual KLFLibResourceEngine * resourceEngine() const
getSaveFileName(QWidget *parent=0, const QString &caption=QString()
virtual bool changeEntries(const QString &subResource, const QList< entryId > &idlist, const QList< int > &properties, const QList< QVariant > &values)=0
Change some entries in this resource.
critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void requestRestoreStyle(const KLFStyle &style)
virtual QList< KLFLib::entryId > selectedEntryIds() const =0
virtual QList< KLFLibEntryWithId > allEntries(const QString &subResource, const QList< int > &wantedEntryProperties=QList< int >())=0
query all entries in this resource
KLFLibBrowserViewContainer * findOpenResource(KLFLibResourceEngine *resource)
addQueryItem(const QString &key, const QString &value)
warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
indexOf(const QRegExp &rx, int from=0)
static QString defaultViewTypeIdentifier()
static KLFLibResourceEngine * showExportDialogCreateResource(KLFLibBrowser *libbrowser, QList< QUrl > *exportUrls)
getOpenFileName(QWidget *parent=0, const QString &caption=QString()
virtual QUrl url(uint flags=0x0) const
query URL
QList< KLFLibBrowserViewContainer * > findByRoleFlags(uint flags, uint mask)
KLFLibBrowserViewContainer * viewForTabIndex(int tab)
virtual QString suggestedViewTypeIdentifier() const
An abstract resource engine.
virtual QList< QAction * > addContextMenuActions(const QPoint &pos)
struct KLFConfig::@4 LibraryBrowser
bool openResource(const QUrl &url, uint resourceRoleFlags=NoChangeFlag, const QString &viewTypeIdentifier=QString())
static QMimeData * createMimeData(const KLFLibEntryList &entryList, const QVariantMap &metaData)
Creates a QMetaData with all known registered encoding mime types.
void showEvent(QShowEvent *event)
Implements the saveTo() function.
void slotMetaInfoChanged(const QMap< int, QVariant > &props)
virtual bool canDeleteSubResource(const QString &subResource) const
void slotRestoreLatexOnly()
virtual bool canModifyProp(int propId) const
bool event(QEvent *event)
uint resourceRoleFlags() const
QVariantMap saveGuiState()
queryItemValue(const QString &key)
fromLocalFile(const QString &localFile)
virtual QUrl url() const =0
Display Resource URL. NOT exactly like KLFLibResourceEngine::url() !
virtual bool eventFilter(QObject *object, QEvent *event)
void resourceTabChanged(const QUrl ¤tUrl)
QList< QAction * > viewTypeActions() const
void slotResourceDataChanged(const QList< KLFLib::entryId > &entryIdList)
void slotResourceRename()
virtual bool selectEntries(const QList< KLFLib::entryId > &idList)=0