Changeset View
Standalone View
part.h
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | |||||
110 | */ | 110 | */ | ||
111 | class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::DocumentObserver, public KDocumentViewer, public Okular::ViewerInterface | 111 | class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::DocumentObserver, public KDocumentViewer, public Okular::ViewerInterface | ||
112 | { | 112 | { | ||
113 | Q_OBJECT | 113 | Q_OBJECT | ||
114 | Q_CLASSINFO("D-Bus Interface", "org.kde.okular") | 114 | Q_CLASSINFO("D-Bus Interface", "org.kde.okular") | ||
115 | Q_INTERFACES(KDocumentViewer) | 115 | Q_INTERFACES(KDocumentViewer) | ||
116 | Q_INTERFACES(Okular::ViewerInterface) | 116 | Q_INTERFACES(Okular::ViewerInterface) | ||
117 | 117 | | |||
118 | friend class PartTest; | 118 | friend class PartTest; | ||
aacid: Do we really need to document a 1 line function? | |||||
openUrl() is the function which is usually used by Parts to open something. Someone (me) who wants to understand how documents are opened will want to know what will happen to a call to this function. It doesn’t need do be documentation of this function, just describing what will happen to the usual call is enough. In the documentation of this function, I consider the following approiate: davidhurka: openUrl() is the function which is usually used by Parts to open something. Someone (me) who… | |||||
the thing is, that's not true, calling openUrl is fine, it's what the okular shell does, no? aacid: the thing is, that's not true, calling openUrl is fine, it's what the okular shell does, no? | |||||
Yes and yes. The shell has an URL that doesn’t need to be tolerantly parsed. The purpose of openDocument(QUrl) is to be called by other applications, where the quality of the URL is not defined (only to be expected when Okular::Part is not used though the KPart interface), right? davidhurka: Yes and yes. The shell has an URL that doesn’t need to be tolerantly parsed.
The purpose of… | |||||
119 | 119 | | |||
120 | public: | 120 | public: | ||
121 | // Default constructor | 121 | // Default constructor | ||
aacid: Can you explain what you mean with that sentence about reload? | |||||
The Reload action (F5) also reloads the UI, but SaveAs doesn’t. It also reloads the document, so it is backed by the newly saved file. It uses swapInsteadOfOpening to achieve that. At least that is how I understand it. davidhurka: The Reload action (F5) also reloads the UI, but SaveAs doesn’t. It also reloads the document… | |||||
122 | /** | 122 | /** | ||
123 | * If one element of 'args' contains one of the strings "Print/Preview" or "ViewerWidget", | 123 | * @param parentWidget TODO | ||
aacid: original seems a strange word to use here | |||||
davidhurka: Ok, will change that. | |||||
124 | * @param parent The parent object. | ||||
aacid: parent is an object not a widget ;) | |||||
davidhurka: Oh, right. Changed that. | |||||
125 | * @param args If one element contains one of the strings "Print/Preview" or "ViewerWidget", | ||||
parentWidget is what will be a parent of the Part::widget(), so it can receive QEvents which are not used by the Part? Assuming that, a Part receives its QEvents through its widget(), right? davidhurka: parentWidget is what will be a parent of the Part::widget(), so it can receive QEvents which… | |||||
124 | * the part will be set up in the corresponding mode. Additionally, it is possible to specify | 126 | * the part will be set up in the corresponding mode. Additionally, it is possible to specify | ||
125 | * which config file should be used by adding a string containing "ConfigFileName=<file name>" | 127 | * which config file should be used by adding a string containing "ConfigFileName=\<file name\>" | ||
126 | * to 'args'. | 128 | * to 'args'. | ||
I'm really sorry but i don't see any value in this documentation here. You just described the calling flow. This is something anyone with a debugger or a nice IDE can do. And it is very easy this will get out of sync once someone renames a method. Please try to convince me why having this is useful. aacid: I'm really sorry but i don't see any value in this documentation here.
You just described the… | |||||
I needed this calling flow to understand how Okular handles document opening. For someone else (don’t know who that could be, someone of the future...), this could give an overview. And that is what I consider the purpose of documentation. People who prever a debugger or the capabilities of an IDE won’t neccessarily need that. I think it is save to document this, because many of these functions are exposed and probably won’t be renamend. doOpenFile() sounds a little strange, but is accurate. The following three functions will more likely be changed. And they are pretty trivial and simple to understand with a normal IDE, so I’m ok with removing this part. davidhurka: I needed this calling flow to understand how Okular handles document opening. For someone else… | |||||
127 | **/ | 129 | **/ | ||
128 | Part(QWidget* parentWidget, QObject* parent, const QVariantList& args); | 130 | Part(QWidget* parentWidget, QObject* parent, const QVariantList& args); | ||
129 | 131 | | |||
130 | // Destructor | 132 | // Destructor | ||
131 | ~Part(); | 133 | ~Part(); | ||
132 | 134 | | |||
133 | // inherited from DocumentObserver | 135 | // inherited from DocumentObserver | ||
134 | void notifySetup( const QVector< Okular::Page * > &pages, int setupFlags ) override; | 136 | void notifySetup( const QVector< Okular::Page * > &pages, int setupFlags ) override; | ||
135 | void notifyViewportChanged( bool smoothMove ) override; | 137 | void notifyViewportChanged( bool smoothMove ) override; | ||
136 | void notifyPageChanged( int page, int flags ) override; | 138 | void notifyPageChanged( int page, int flags ) override; | ||
137 | 139 | | |||
140 | // Reimplemented from KDocumentViewer | ||||
138 | bool openDocument(const QUrl &url, uint page) override; | 141 | bool openDocument(const QUrl &url, uint page) override; | ||
139 | void startPresentation() override; | 142 | void startPresentation() override; | ||
140 | QStringList supportedMimeTypes() const override; | 143 | QStringList supportedMimeTypes() const override; | ||
141 | 144 | | |||
145 | /** | ||||
davidhurka: What if the fragment of the URL contains a page number? | |||||
aacid: the parameter wins. | |||||
146 | * Returns the URL of the real document file, even if actually a temporary file was created and opened. | ||||
147 | * A temporary file will be created e. g. if the document needs to be decompressed before opening. | ||||
148 | */ | ||||
142 | QUrl realUrl() const; | 149 | QUrl realUrl() const; | ||
143 | 150 | | |||
151 | /** | ||||
152 | * TODO | ||||
153 | */ | ||||
144 | void showSourceLocation(const QString& fileName, int line, int column, bool showGraphically = true) override; | 154 | void showSourceLocation(const QString& fileName, int line, int column, bool showGraphically = true) override; | ||
This creates a GotoAction and lets m_document “process” it. I still don’t understand how (Goto)Action works and how source locations work. davidhurka: This creates a GotoAction and lets m_document “process” it.
I still don’t understand how… | |||||
145 | void clearLastShownSourceLocation() override; | 155 | void clearLastShownSourceLocation() override; | ||
146 | bool isWatchFileModeEnabled() const override; | 156 | bool isWatchFileModeEnabled() const override; | ||
147 | void setWatchFileModeEnabled(bool enable) override; | 157 | void setWatchFileModeEnabled(bool enable) override; | ||
148 | bool areSourceLocationsShownGraphically() const override; | 158 | bool areSourceLocationsShownGraphically() const override; | ||
149 | void setShowSourceLocationsGraphically(bool show) override; | 159 | void setShowSourceLocationsGraphically(bool show) override; | ||
150 | bool openNewFilesInTabs() const override; | 160 | bool openNewFilesInTabs() const override; | ||
151 | 161 | | |||
152 | public Q_SLOTS: // dbus | 162 | public Q_SLOTS: // dbus | ||
153 | Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page) override; | 163 | Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page) override; | ||
154 | Q_SCRIPTABLE Q_NOREPLY void openDocument( const QString &doc ); | 164 | Q_SCRIPTABLE Q_NOREPLY void openDocument( const QString &doc ); | ||
155 | Q_SCRIPTABLE uint pages(); | 165 | Q_SCRIPTABLE uint pages(); | ||
156 | Q_SCRIPTABLE uint currentPage(); | 166 | Q_SCRIPTABLE uint currentPage(); | ||
167 | | ||||
168 | /** | ||||
169 | * Returns the path to the actually opened file. | ||||
170 | * May be a temporary file, e. g. if the document needed to be decompressed. | ||||
171 | */ | ||||
157 | Q_SCRIPTABLE QString currentDocument(); | 172 | Q_SCRIPTABLE QString currentDocument(); | ||
173 | | ||||
174 | /** | ||||
175 | * Returns the metadata entry for the key @p metaData. | ||||
176 | * | ||||
177 | * @see DocumentInfo | ||||
178 | */ | ||||
158 | Q_SCRIPTABLE QString documentMetaData( const QString &metaData ) const; | 179 | Q_SCRIPTABLE QString documentMetaData( const QString &metaData ) const; | ||
180 | | ||||
181 | /** | ||||
182 | * Opens the viewer configuration dialog (i. e. not the backend configuration dialog). | ||||
183 | */ | ||||
159 | Q_SCRIPTABLE void slotPreferences(); | 184 | Q_SCRIPTABLE void slotPreferences(); | ||
185 | | ||||
186 | /** | ||||
187 | * Shows and focuses the incremental find bar. Also works in presentation mode. | ||||
188 | */ | ||||
160 | Q_SCRIPTABLE void slotFind(); | 189 | Q_SCRIPTABLE void slotFind(); | ||
190 | | ||||
191 | /** | ||||
192 | * Opens the print preview dialog. | ||||
193 | */ | ||||
161 | Q_SCRIPTABLE void slotPrintPreview(); | 194 | Q_SCRIPTABLE void slotPrintPreview(); | ||
162 | Q_SCRIPTABLE void slotPreviousPage(); | 195 | Q_SCRIPTABLE void slotPreviousPage(); | ||
163 | Q_SCRIPTABLE void slotNextPage(); | 196 | Q_SCRIPTABLE void slotNextPage(); | ||
164 | Q_SCRIPTABLE void slotGotoFirst(); | 197 | Q_SCRIPTABLE void slotGotoFirst(); | ||
165 | Q_SCRIPTABLE void slotGotoLast(); | 198 | Q_SCRIPTABLE void slotGotoLast(); | ||
199 | | ||||
200 | /** | ||||
201 | * Turns presentation mode on or off. | ||||
202 | */ | ||||
166 | Q_SCRIPTABLE void slotTogglePresentation(); | 203 | Q_SCRIPTABLE void slotTogglePresentation(); | ||
How to set the display used for presentation? It’s possible from the config dialog, but not from D-Bus? davidhurka: How to set the display used for presentation? It’s possible from the config dialog, but not… | |||||
204 | | ||||
205 | /** | ||||
206 | * Turns the Change Colors feature on or off. | ||||
207 | */ | ||||
167 | Q_SCRIPTABLE void slotToggleChangeColors(); | 208 | Q_SCRIPTABLE void slotToggleChangeColors(); | ||
209 | | ||||
210 | /** | ||||
211 | * Turns the Change Colors feature on or off. | ||||
212 | */ | ||||
168 | Q_SCRIPTABLE void slotSetChangeColors(bool active); | 213 | Q_SCRIPTABLE void slotSetChangeColors(bool active); | ||
214 | | ||||
215 | /** | ||||
216 | * Reloads the current document, if a document is opened. | ||||
217 | * Continuously tries to reload, if the first try fails. | ||||
218 | */ | ||||
169 | Q_SCRIPTABLE Q_NOREPLY void reload(); | 219 | Q_SCRIPTABLE Q_NOREPLY void reload(); | ||
220 | | ||||
221 | /** | ||||
222 | * Will show the print dialog when the document is loaded the next time. | ||||
223 | */ | ||||
170 | Q_SCRIPTABLE Q_NOREPLY void enableStartWithPrint(); | 224 | Q_SCRIPTABLE Q_NOREPLY void enableStartWithPrint(); | ||
225 | | ||||
226 | /** | ||||
227 | * Will exit when the print dialog is closed in any way. | ||||
228 | */ | ||||
171 | Q_SCRIPTABLE Q_NOREPLY void enableExitAfterPrint(); | 229 | Q_SCRIPTABLE Q_NOREPLY void enableExitAfterPrint(); | ||
230 | | ||||
231 | /** | ||||
232 | * Will open the find bar and search for the next occurence of @text, | ||||
233 | * when the document is loaded the next time. | ||||
234 | * Does not necessarily search from the beginning of the document. | ||||
235 | * Does not necessarily search case sensitive. | ||||
236 | * | ||||
237 | * @param text The text to search for. Must not be empty. | ||||
238 | */ | ||||
172 | Q_SCRIPTABLE Q_NOREPLY void enableStartWithFind(const QString &text); | 239 | Q_SCRIPTABLE Q_NOREPLY void enableStartWithFind(const QString &text); | ||
173 | 240 | | |||
174 | Q_SIGNALS: | 241 | Q_SIGNALS: | ||
242 | /** | ||||
243 | * This signal is emitted when the document changes, so it becomes printable or not. | ||||
244 | * Used to enable/disable the Print action in the File menu. | ||||
245 | */ | ||||
175 | void enablePrintAction(bool enable); | 246 | void enablePrintAction(bool enable); | ||
davidhurka: Why doesn’t Part handle the print action itself? | |||||
176 | void openSourceReference(const QString& absFileName, int line, int column); | 247 | void openSourceReference(const QString& absFileName, int line, int column); | ||
177 | void viewerMenuStateChange(bool enabled); | 248 | void viewerMenuStateChange(bool enabled); | ||
249 | | ||||
250 | /** | ||||
251 | * This signal is emitted when a document is loaded, so it can be closed. | ||||
252 | * Used to enable/disable the Close action in the File menu. | ||||
253 | */ | ||||
178 | void enableCloseAction(bool enable); | 254 | void enableCloseAction(bool enable); | ||
255 | | ||||
256 | /** | ||||
257 | * This signal is emitted when a document is loaded. | ||||
258 | * Used to set the tab icon according to the mime type. | ||||
259 | */ | ||||
179 | void mimeTypeChanged(QMimeType mimeType); | 260 | void mimeTypeChanged(QMimeType mimeType); | ||
261 | | ||||
262 | /** | ||||
263 | * This signal is emitted when URLs were dropped on the viewer widget, | ||||
264 | * and they are not handled by this Part itself. | ||||
265 | */ | ||||
180 | void urlsDropped( const QList<QUrl>& urls ); | 266 | void urlsDropped( const QList<QUrl>& urls ); | ||
267 | | ||||
268 | /** | ||||
269 | * This signal is emitted when the Fit Window to Page action is triggered. | ||||
270 | */ | ||||
181 | void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize ); | 271 | void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize ); | ||
What do pageViewPortSize and pageSize mean? Or why are these two important? I don’t understant the slot in Shell. davidhurka: What do `pageViewPortSize` and `pageSize` mean? Or why are //these// two important? I don’t… | |||||
pageViewPortSize is the current viewport size + visible scollbars, davidhurka: pageViewPortSize is the current viewport size + visible scollbars,
and pageSize is the size of… | |||||
182 | 272 | | |||
183 | protected: | 273 | protected: | ||
184 | // reimplemented from KParts::ReadWritePart | 274 | // reimplemented from KParts::ReadWritePart | ||
185 | bool openFile() override; | 275 | bool openFile() override; | ||
186 | bool openUrl(const QUrl &url) override; | 276 | bool openUrl(const QUrl &url) override; | ||
187 | void guiActivateEvent(KParts::GUIActivateEvent *event) override; | 277 | void guiActivateEvent(KParts::GUIActivateEvent *event) override; | ||
188 | void displayInfoMessage( const QString &message, KMessageWidget::MessageType messageType = KMessageWidget::Information, int duration = -1 ); | 278 | void displayInfoMessage( const QString &message, KMessageWidget::MessageType messageType = KMessageWidget::Information, int duration = -1 ); | ||
189 | public: | 279 | public: | ||
190 | bool queryClose() override; | 280 | bool queryClose() override; | ||
191 | bool closeUrl() override; | 281 | bool closeUrl() override; | ||
192 | bool closeUrl(bool promptToSave) override; | 282 | bool closeUrl(bool promptToSave) override; | ||
193 | void setReadWrite(bool readwrite) override; | 283 | void setReadWrite(bool readwrite) override; | ||
194 | bool saveAs(const QUrl & saveUrl) override; | 284 | bool saveAs(const QUrl & saveUrl) override; | ||
195 | 285 | | |||
196 | protected Q_SLOTS: | 286 | protected Q_SLOTS: | ||
197 | // connected to actions | 287 | // connected to actions | ||
What does this mean? Are these the functions which are called when the user clicks an action, and they will call the bunch of other open*(url) functions? davidhurka: What does this mean? Are these the functions which are called when the user clicks an action… | |||||
Already understand that they will call the bunch of other open*(url) functions, see Okular::Part Detailed Description. But I don’t see how they are connected to QActions, so I suggest to remove that line or clarify that these AreaToClick (ObjectRect) things in the Document are meant. davidhurka: Already understand that they will call the bunch of other open*(url) functions, see Okular… | |||||
198 | void openUrlFromDocument(const QUrl &url); | 288 | void openUrlFromDocument(const QUrl &url); | ||
199 | void openUrlFromBookmarks(const QUrl &url); | 289 | void openUrlFromBookmarks(const QUrl &url); | ||
200 | void handleDroppedUrls( const QList<QUrl>& urls ); | 290 | void handleDroppedUrls( const QList<QUrl>& urls ); | ||
201 | void slotGoToPage(); | 291 | void slotGoToPage(); | ||
202 | void slotHistoryBack(); | 292 | void slotHistoryBack(); | ||
203 | void slotHistoryNext(); | 293 | void slotHistoryNext(); | ||
204 | void slotAddBookmark(); | 294 | void slotAddBookmark(); | ||
205 | void slotRenameBookmarkFromMenu(); | 295 | void slotRenameBookmarkFromMenu(); | ||
206 | void slotRemoveBookmarkFromMenu(); | 296 | void slotRemoveBookmarkFromMenu(); | ||
207 | void slotRenameCurrentViewportBookmark(); | 297 | void slotRenameCurrentViewportBookmark(); | ||
Does this make sense? The parent application will loose control about the URL change. (Tried with KDevelop.) davidhurka: Does this make sense? The parent application will loose control about the URL change. (Tried… | |||||
Actually calls openUrl(), which informs the parent application. KDevelop just ignores that. Need to look how exactly that is done. davidhurka: Actually calls openUrl(), which informs the parent application. KDevelop just ignores that. | |||||
208 | void slotPreviousBookmark(); | 298 | void slotPreviousBookmark(); | ||
209 | void slotNextBookmark(); | 299 | void slotNextBookmark(); | ||
These slots use QObject::sender() and cast it to QAction* to extract the data, to convert it to a string and then to a DocumentViewport. davidhurka: These slots use QObject::sender() and cast it to QAction* to extract the data, to convert it to… | |||||
davidhurka: Will accept and ignore that for now. | |||||
210 | void slotFindNext(); | 300 | void slotFindNext(); | ||
211 | void slotFindPrev(); | 301 | void slotFindPrev(); | ||
212 | bool slotSaveFileAs(bool showOkularArchiveAsDefaultFormat = false); | 302 | bool slotSaveFileAs(bool showOkularArchiveAsDefaultFormat = false); | ||
213 | void slotGetNewStuff(); | 303 | void slotGetNewStuff(); | ||
214 | void slotNewConfig(); | 304 | void slotNewConfig(); | ||
215 | void slotShowMenu(const Okular::Page *page, const QPoint &point); | 305 | void slotShowMenu(const Okular::Page *page, const QPoint &point); | ||
216 | void slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint &point, const QString &title); | 306 | void slotShowTOCMenu(const Okular::DocumentViewport &vp, const QPoint &point, const QString &title); | ||
217 | void slotShowProperties(); | 307 | void slotShowProperties(); | ||
218 | void slotShowEmbeddedFiles(); | 308 | void slotShowEmbeddedFiles(); | ||
219 | void slotShowLeftPanel(); | 309 | void slotShowLeftPanel(); | ||
220 | void slotShowBottomBar(); | 310 | void slotShowBottomBar(); | ||
221 | void slotShowPresentation(); | 311 | void slotShowPresentation(); | ||
222 | void slotHidePresentation(); | 312 | void slotHidePresentation(); | ||
223 | void slotExportAs(QAction *); | 313 | void slotExportAs(QAction *); | ||
224 | bool slotImportPSFile(); | 314 | bool slotImportPSFile(); | ||
225 | void slotAboutBackend(); | 315 | void slotAboutBackend(); | ||
226 | void slotReload(); | 316 | void slotReload(); | ||
227 | void close(); | 317 | void close(); | ||
228 | void cannotQuit(); | 318 | void cannotQuit(); | ||
229 | void slotShowFindBar(); | 319 | void slotShowFindBar(); | ||
230 | void slotHideFindBar(); | 320 | void slotHideFindBar(); | ||
231 | void slotJobStarted(KIO::Job *job); | 321 | void slotJobStarted(KIO::Job *job); | ||
232 | void slotJobFinished(KJob *job); | 322 | void slotJobFinished(KJob *job); | ||
Sounds funny, but that is how it works... davidhurka: Sounds funny, but that is how it works...
Even calls FindBar::maybeHide(). ;) | |||||
233 | void loadCancelled(const QString &reason); | 323 | void loadCancelled(const QString &reason); | ||
234 | void setWindowTitleFromDocument(); | 324 | void setWindowTitleFromDocument(); | ||
235 | // can be connected to widget elements | 325 | // can be connected to widget elements | ||
236 | void updateViewActions(); | 326 | void updateViewActions(); | ||
Not really an idea what this means. And to which members does it belong? davidhurka: Not really an idea what this means. And to which members does it belong? | |||||
Belongs to updateViewActions() and enableTOC(bool). Connecting to widgets is not done and makes little sense, so I will remove that line. davidhurka: Belongs to updateViewActions() and enableTOC(bool). Connecting to widgets is not done and makes… | |||||
237 | void updateBookmarksActions(); | 327 | void updateBookmarksActions(); | ||
238 | void enableTOC(bool enable); | 328 | void enableTOC(bool enable); | ||
239 | void slotRebuildBookmarkMenu(); | 329 | void slotRebuildBookmarkMenu(); | ||
240 | void enableLayers( bool enable ); | 330 | void enableLayers( bool enable ); | ||
241 | void showSidebarSignaturesItem( bool show ); | 331 | void showSidebarSignaturesItem( bool show ); | ||
242 | 332 | | |||
243 | public Q_SLOTS: | 333 | public Q_SLOTS: | ||
244 | bool saveFile() override; | 334 | bool saveFile() override; | ||
245 | // connected to Shell action (and browserExtension), not local one | 335 | // connected to Shell action (and browserExtension), not local one | ||
246 | void slotPrint(); | 336 | void slotPrint(); | ||
247 | void slotFileDirty( const QString& ); | 337 | void slotFileDirty( const QString& ); | ||
248 | bool slotAttemptReload( bool oneShot = false, const QUrl &newUrl = QUrl() ); | 338 | bool slotAttemptReload( bool oneShot = false, const QUrl &newUrl = QUrl() ); | ||
249 | void psTransformEnded(int, QProcess::ExitStatus); | 339 | void psTransformEnded(int, QProcess::ExitStatus); | ||
250 | KConfigDialog * slotGeneratorPreferences(); | 340 | KConfigDialog * slotGeneratorPreferences(); | ||
251 | 341 | | |||
252 | void errorMessage( const QString &message, int duration = 0 ); | 342 | void errorMessage( const QString &message, int duration = 0 ); | ||
A duration of 0 milliseconds seems a bit short to me. Why is this default? davidhurka: A duration of 0 milliseconds seems a bit short to me. Why is this default? | |||||
It's a silly default, the nice thing is that it's never the default since this is conneected from document::error and that one requires for a value for duration, so this = 0 can be just removed without any issue. aacid: It's a silly default, the nice thing is that it's never the default since this is conneected… | |||||
253 | void warningMessage( const QString &message, int duration = -1 ); | 343 | void warningMessage( const QString &message, int duration = -1 ); | ||
254 | void noticeMessage( const QString &message, int duration = -1 ); | 344 | void noticeMessage( const QString &message, int duration = -1 ); | ||
255 | 345 | | |||
256 | void moveSplitter( const int sideWidgetSize ); | 346 | void moveSplitter( const int sideWidgetSize ); | ||
257 | 347 | | |||
258 | private: | 348 | private: | ||
259 | bool aboutToShowContextMenu(QMenu *menu, QAction *action, QMenu *contextMenu); | 349 | bool aboutToShowContextMenu(QMenu *menu, QAction *action, QMenu *contextMenu); | ||
This is a function, but sounds like a signal. How about “addBookmarkActions”? davidhurka: This is a function, but sounds like a signal. How about “addBookmarkActions”? | |||||
aacid: good point, it's a pretty terrible name | |||||
260 | void showMenu(const Okular::Page *page, const QPoint &point, const QString &bookmarkTitle = QString(), const Okular::DocumentViewport &vp = DocumentViewport(), bool showTOCActions = false); | 350 | void showMenu(const Okular::Page *page, const QPoint &point, const QString &bookmarkTitle = QString(), const Okular::DocumentViewport &vp = DocumentViewport(), bool showTOCActions = false); | ||
261 | bool eventFilter(QObject * watched, QEvent * event) override; | 351 | bool eventFilter(QObject * watched, QEvent * event) override; | ||
This opens a context menu for context menu items, or what? It accepts events of type ContextMenu, that’s clear. To open the context menu, it seems to need a QMenu as event source. davidhurka: This opens a context menu for context menu items, or what?
It accepts events of type… | |||||
Seems like it opens a context menu for bookmark entries in the Bookmarks menu, to rename or delete a single bookmark. But such a menu does not open in my Okular. davidhurka: Seems like it opens a context menu for bookmark entries in the Bookmarks menu, to rename or… | |||||
aacid: It's an event filter, this is a basic way of filtering events in Qt.
Are you looking at the… | |||||
Doesn’t work here. Other popup menus can open a context menu for action collection actions, but didn’t notice that in a menubar menu so far. So it opens a context menu for a menubar menu, almost guessed. davidhurka: Doesn’t work here. Other popup menus can open a context menu for action collection actions, but… | |||||
262 | Document::OpenResult doOpenFile(const QMimeType &mime, const QString &fileNameToOpen, bool *isCompressedFile); | 352 | Document::OpenResult doOpenFile(const QMimeType &mime, const QString &fileNameToOpen, bool *isCompressedFile); | ||
263 | bool openUrl( const QUrl &url, bool swapInsteadOfOpening ); | 353 | bool openUrl( const QUrl &url, bool swapInsteadOfOpening ); | ||
264 | 354 | | |||
Uh-oh, this is complicated. Would someone look over it? Yes, the language is not final. davidhurka: Uh-oh, this is complicated. Would someone look over it?
Yes, the language is not final. | |||||
davidhurka: Should be OK now, also improved language. | |||||
265 | void setupViewerActions(); | 355 | void setupViewerActions(); | ||
266 | void setViewerShortcuts(); | 356 | void setViewerShortcuts(); | ||
One view action is “Fit Width”. Unlike Fit Width from the menu bar, this Fit Width will not only set the zoom to Fit Width, but also set the view mode to Single Page, and center the viewport on page N. davidhurka: One view action is “Fit Width”. Unlike Fit Width from the menu bar, this Fit Width will not… | |||||
aacid: Yes, because this is "fit page N to width" | |||||
davidhurka: If that is intended, ok. | |||||
267 | void setupActions(); | 357 | void setupActions(); | ||
268 | 358 | | |||
359 | /* | ||||
360 | * Sets orientation and document title of @p printer to match the current document as good as possible. | ||||
361 | */ | ||||
269 | void setupPrint( QPrinter &printer ); | 362 | void setupPrint( QPrinter &printer ); | ||
363 | | ||||
364 | /** | ||||
365 | * Prints the document to the given @p printer. | ||||
366 | */ | ||||
270 | bool doPrint( QPrinter &printer ); | 367 | bool doPrint( QPrinter &printer ); | ||
368 | | ||||
369 | /** | ||||
370 | * Opens a temporary file and tries to decompress the file @p path points to. | ||||
371 | * | ||||
372 | * @param[out] destpath Path to the created temporary file (only at success) | ||||
373 | * @param path Path to the compressed file to read from | ||||
374 | * @param compressionType Compression type of the compressed file. | ||||
375 | * | ||||
376 | * @return Whether the file was decompressed successfully. | ||||
377 | */ | ||||
271 | bool handleCompressed(QString &destpath, const QString &path, KCompressionDevice::CompressionType compressionType ); | 378 | bool handleCompressed(QString &destpath, const QString &path, KCompressionDevice::CompressionType compressionType ); | ||
272 | void rebuildBookmarkMenu( bool unplugActions = true ); | 379 | void rebuildBookmarkMenu( bool unplugActions = true ); | ||
273 | void updateAboutBackendAction(); | 380 | void updateAboutBackendAction(); | ||
274 | void unsetDummyMode(); | 381 | void unsetDummyMode(); | ||
275 | void slotRenameBookmark( const DocumentViewport &viewport ); | 382 | void slotRenameBookmark( const DocumentViewport &viewport ); | ||
276 | void slotRemoveBookmark( const DocumentViewport &viewport ); | 383 | void slotRemoveBookmark( const DocumentViewport &viewport ); | ||
277 | void resetStartArguments(); | 384 | void resetStartArguments(); | ||
278 | void checkNativeSaveDataLoss(bool *out_wontSaveForms, bool *out_wontSaveAnnotations) const; | 385 | void checkNativeSaveDataLoss(bool *out_wontSaveForms, bool *out_wontSaveAnnotations) const; | ||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 527 | private Q_SLOTS: | |||
422 | void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled); | 529 | void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled); | ||
423 | }; | 530 | }; | ||
424 | 531 | | |||
425 | } | 532 | } | ||
426 | 533 | | |||
427 | #endif | 534 | #endif | ||
428 | 535 | | |||
429 | /* kate: replace-tabs on; indent-width 4; */ | 536 | /* kate: replace-tabs on; indent-width 4; */ | ||
537 | |
Do we really need to document a 1 line function?