Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KLFLIBBROWSER_H
00026 #define KLFLIBBROWSER_H
00027
00028 #include <QWidget>
00029 #include <QMovie>
00030 #include <QMenu>
00031 #include <QPushButton>
00032 #include <QLabel>
00033
00034 #include <klflib.h>
00035
00036
00037 namespace Ui { class KLFLibBrowser; }
00038
00039 class KLFLibBrowserViewContainer;
00040 class KLFProgressReporter;
00041
00042 class KLFAbstractLibView;
00043
00044 class KLF_EXPORT KLFLibBrowser : public QWidget
00045 {
00046 Q_OBJECT
00047 public:
00048 KLFLibBrowser(QWidget *parent = NULL);
00049 virtual ~KLFLibBrowser();
00050
00051 enum ResourceRoleFlag {
00052 NoRoleFlag = 0x00000000,
00053
00054 NoCloseRoleFlag = 0x00000001,
00055
00056 HistoryRoleFlag = 0x00010000,
00057 ArchiveRoleFlag = 0x00020000,
00058 SpecialResourceRoleMask = 0x00ff0000,
00059
00060 NoChangeFlag = 0x01000000,
00061 OpenNoRaise = 0x02000000,
00062 NowMask = 0xff000000
00063 };
00064
00065 virtual bool eventFilter(QObject *object, QEvent *event);
00066
00067 QList<QUrl> openUrls() const;
00069 QUrl currentUrl();
00071 int currentUrlIndex();
00072
00078 KLFLibResourceEngine * getOpenResource(const QUrl& url);
00079
00083 KLFAbstractLibView * getView(const QUrl& url);
00084
00088 KLFAbstractLibView * getView(KLFLibResourceEngine *resource);
00089
00090 QVariantMap saveGuiState();
00091 void loadGuiState(const QVariantMap& state, bool openURLs = true);
00092
00093 static QString displayTitle(KLFLibResourceEngine *resource);
00094
00095 signals:
00096 void requestRestore(const KLFLibEntry& entry, uint restoreFlags);
00097 void requestRestoreStyle(const KLFStyle& style);
00098
00099 void resourceTabChanged(const QUrl& currentUrl);
00100 void libEntriesSelected(const KLFLibEntryList& entries);
00101
00102 public slots:
00115 bool openResource(const QUrl& url, uint resourceRoleFlags = NoChangeFlag,
00116 const QString& viewTypeIdentifier = QString());
00117
00121 bool openResource(const QString& url, uint resourceRoleFlags = NoChangeFlag,
00122 const QString& viewTypeIdentifier = QString());
00123
00131 bool openResource(KLFLibResourceEngine *resource, uint resourceRoleFlags = NoChangeFlag,
00132 const QString& viewTypeIdentifier = QString());
00133
00143 bool openResourceFromGuiState(const QUrl& url, const QVariantMap& guiState);
00144
00145 bool closeResource(const QUrl& url);
00146
00147 void retranslateUi(bool alsoBaseUi = true);
00148
00149 protected slots:
00150
00151 void slotRestoreWithStyle();
00152 void slotRestoreLatexOnly();
00153 void slotDeleteSelected();
00154
00155 void slotRefreshResourceActionsEnabled();
00156
00157 void slotTabResourceShown(int tabIndex);
00158 void slotShowTabContextMenu(const QPoint& pos);
00159
00160 void slotResourceRename();
00161 void slotResourceRenameSubResource();
00165 void slotResourceRename(bool renameSubResource);
00166 void slotResourceRenameFinished();
00167 bool slotResourceClose(KLFLibBrowserViewContainer *view = NULL, bool force = false);
00168 void slotResourceProperties();
00169 bool slotResourceNewSubRes();
00170 bool slotResourceDelSubRes();
00171 bool slotResourceOpen();
00172 bool slotResourceNew();
00173 bool slotResourceSaveTo();
00174
00176 void slotResourceDataChanged(const QList<KLFLib::entryId>& entryIdList);
00178 void slotResourcePropertyChanged(int propId);
00179 void slotUpdateForResourceProperty(KLFLibResourceEngine *resource, int propId);
00181 void slotSubResourcePropertyChanged(const QString& subResource, int propId);
00183 void slotDefaultSubResourceChanged(const QString& subResource);
00184
00185
00186 void slotEntriesSelected(const KLFLibEntryList& entries);
00187 void slotAddCategorySuggestions(const QStringList& catlist);
00188 void slotShowContextMenu(const QPoint& pos);
00189
00190 void slotMetaInfoChanged(const QMap<int,QVariant>& props);
00191
00193 void slotCopyToResource();
00195 void slotMoveToResource();
00197 void slotCopyMoveToResource(QObject *sender, bool move);
00198 void slotCopyMoveToResource(KLFAbstractLibView *dest, KLFAbstractLibView *source, bool move);
00199
00200 void slotCut();
00201 void slotCopy();
00202 void slotPaste();
00203
00204 void slotOpenAll();
00205 bool slotExport();
00206 bool slotExportSelection();
00207
00208 void slotStartProgress(KLFProgressReporter *progressReporter, const QString& text);
00209
00210
00211 protected:
00212 KLFLibBrowserViewContainer * findOpenUrl(const QUrl& url);
00213 KLFLibBrowserViewContainer * findOpenResource(KLFLibResourceEngine *resource);
00214 KLFLibBrowserViewContainer * curView();
00215 KLFAbstractLibView * curLibView();
00216 KLFLibBrowserViewContainer * viewForTabIndex(int tab);
00217
00218 QList<KLFLibBrowserViewContainer*> findByRoleFlags(uint flags, uint mask);
00219
00220 inline KLFLibBrowserViewContainer *findSpecialResource(uint specialResourceRoleFlag)
00221 { QList<KLFLibBrowserViewContainer*> l = findByRoleFlags(specialResourceRoleFlag, SpecialResourceRoleMask);
00222 if (l.isEmpty()) { return NULL; } return l[0]; }
00223
00224 bool event(QEvent *event);
00225 void showEvent(QShowEvent *event);
00226 void timerEvent(QTimerEvent *event);
00227
00228 private:
00229 Ui::KLFLibBrowser *u;
00230 QList<KLFLibBrowserViewContainer*> pLibViews;
00231
00232 QMenu *pResourceMenu;
00233 QMenu *pImportExportMenu;
00234
00235 QPushButton *pTabCornerButton;
00236
00237 private slots:
00238 void updateResourceRoleFlags(KLFLibBrowserViewContainer *view, uint flags);
00239 };
00240
00241
00242
00243
00244 #endif