Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | #include <KStandardShortcut> | 55 | #include <KStandardShortcut> | ||
56 | #include <KToggleFullScreenAction> | 56 | #include <KToggleFullScreenAction> | ||
57 | #include <KUrlComboBox> | 57 | #include <KUrlComboBox> | ||
58 | #include <KUrlNavigator> | 58 | #include <KUrlNavigator> | ||
59 | #include <KToolBar> | 59 | #include <KToolBar> | ||
60 | #include <KToolBarPopupAction> | 60 | #include <KToolBarPopupAction> | ||
61 | #include <KXMLGUIFactory> | 61 | #include <KXMLGUIFactory> | ||
62 | #include <KDirLister> | 62 | #include <KDirLister> | ||
63 | #ifdef KF5Purpose_FOUND | ||||
63 | #include <PurposeWidgets/Menu> | 64 | #include <PurposeWidgets/Menu> | ||
64 | #include <Purpose/AlternativesModel> | 65 | #include <Purpose/AlternativesModel> | ||
66 | #endif | ||||
65 | 67 | | |||
66 | // Local | 68 | // Local | ||
67 | #include "configdialog.h" | 69 | #include "configdialog.h" | ||
68 | #include "documentinfoprovider.h" | 70 | #include "documentinfoprovider.h" | ||
69 | #include "viewmainpage.h" | 71 | #include "viewmainpage.h" | ||
70 | #include "fileopscontextmanageritem.h" | 72 | #include "fileopscontextmanageritem.h" | ||
71 | #include "folderviewcontextmanageritem.h" | 73 | #include "folderviewcontextmanageritem.h" | ||
72 | #include "fullscreencontent.h" | 74 | #include "fullscreencontent.h" | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 189 | #endif | |||
195 | QAction * mGoToNextAction; | 197 | QAction * mGoToNextAction; | ||
196 | QAction * mGoToFirstAction; | 198 | QAction * mGoToFirstAction; | ||
197 | QAction * mGoToLastAction; | 199 | QAction * mGoToLastAction; | ||
198 | KToggleAction* mToggleSideBarAction; | 200 | KToggleAction* mToggleSideBarAction; | ||
199 | QAction* mFullScreenAction; | 201 | QAction* mFullScreenAction; | ||
200 | QAction * mToggleSlideShowAction; | 202 | QAction * mToggleSlideShowAction; | ||
201 | KToggleAction* mShowMenuBarAction; | 203 | KToggleAction* mShowMenuBarAction; | ||
202 | KToggleAction* mShowStatusBarAction; | 204 | KToggleAction* mShowStatusBarAction; | ||
205 | #ifdef KF5Purpose_FOUND | ||||
203 | Purpose::Menu* mShareMenu; | 206 | Purpose::Menu* mShareMenu; | ||
204 | KToolBarPopupAction* mShareAction; | 207 | KToolBarPopupAction* mShareAction; | ||
208 | #endif | ||||
205 | #ifdef KIPI_FOUND | 209 | #ifdef KIPI_FOUND | ||
206 | KIPIExportAction* mKIPIExportAction; | 210 | KIPIExportAction* mKIPIExportAction; | ||
207 | #endif | 211 | #endif | ||
208 | 212 | | |||
209 | SortedDirModel* mDirModel; | 213 | SortedDirModel* mDirModel; | ||
210 | DocumentOnlyProxyModel* mThumbnailBarModel; | 214 | DocumentOnlyProxyModel* mThumbnailBarModel; | ||
211 | KLinkItemSelectionModel* mThumbnailBarSelectionModel; | 215 | KLinkItemSelectionModel* mThumbnailBarSelectionModel; | ||
212 | ContextManager* mContextManager; | 216 | ContextManager* mContextManager; | ||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Line(s) | 380 | { | |||
508 | 512 | | |||
509 | view->addAction(KStandardAction::ConfigureToolbars, q, | 513 | view->addAction(KStandardAction::ConfigureToolbars, q, | ||
510 | SLOT(configureToolbars())); | 514 | SLOT(configureToolbars())); | ||
511 | 515 | | |||
512 | #ifdef KIPI_FOUND | 516 | #ifdef KIPI_FOUND | ||
513 | mKIPIExportAction = new KIPIExportAction(q); | 517 | mKIPIExportAction = new KIPIExportAction(q); | ||
514 | #endif | 518 | #endif | ||
515 | 519 | | |||
520 | #ifdef KF5Purpose_FOUND | ||||
516 | mShareAction = new KToolBarPopupAction(QIcon::fromTheme("document-share"), "Share", q); | 521 | mShareAction = new KToolBarPopupAction(QIcon::fromTheme("document-share"), "Share", q); | ||
517 | mShareAction->setDelayed(false); | 522 | mShareAction->setDelayed(false); | ||
518 | actionCollection->addAction("share", mShareAction); | 523 | actionCollection->addAction("share", mShareAction); | ||
519 | mShareMenu = new Purpose::Menu(q); | 524 | mShareMenu = new Purpose::Menu(q); | ||
520 | mShareAction->setMenu(mShareMenu); | 525 | mShareAction->setMenu(mShareMenu); | ||
526 | #endif | ||||
521 | } | 527 | } | ||
522 | 528 | | |||
523 | void setupUndoActions() | 529 | void setupUndoActions() | ||
524 | { | 530 | { | ||
525 | // There is no KUndoGroup similar to KUndoStack. This code basically | 531 | // There is no KUndoGroup similar to KUndoStack. This code basically | ||
526 | // does the same as KUndoStack, but for the KUndoGroup actions. | 532 | // does the same as KUndoStack, but for the KUndoGroup actions. | ||
527 | QUndoGroup* undoGroup = DocumentFactory::instance()->undoGroup(); | 533 | QUndoGroup* undoGroup = DocumentFactory::instance()->undoGroup(); | ||
528 | QAction* action; | 534 | QAction* action; | ||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Line(s) | 714 | if (url.isValid()) { | |||
716 | } | 722 | } | ||
717 | } | 723 | } | ||
718 | 724 | | |||
719 | KActionCollection* actionCollection = q->actionCollection(); | 725 | KActionCollection* actionCollection = q->actionCollection(); | ||
720 | actionCollection->action("file_save")->setEnabled(canSave && isModified); | 726 | actionCollection->action("file_save")->setEnabled(canSave && isModified); | ||
721 | actionCollection->action("file_save_as")->setEnabled(canSave); | 727 | actionCollection->action("file_save_as")->setEnabled(canSave); | ||
722 | actionCollection->action("file_print")->setEnabled(isRasterImage); | 728 | actionCollection->action("file_print")->setEnabled(isRasterImage); | ||
723 | 729 | | |||
730 | #ifdef KF5Purpose_FOUND | ||||
724 | if (url.isEmpty()) { | 731 | if (url.isEmpty()) { | ||
725 | mShareAction->setEnabled(false); | 732 | mShareAction->setEnabled(false); | ||
726 | } else { | 733 | } else { | ||
727 | mShareAction->setEnabled(true); | 734 | mShareAction->setEnabled(true); | ||
728 | mShareMenu->model()->setInputData(QJsonObject{ | 735 | mShareMenu->model()->setInputData(QJsonObject{ | ||
729 | { QStringLiteral("mimeType"), MimeTypeUtils::urlMimeType(url) }, | 736 | { QStringLiteral("mimeType"), MimeTypeUtils::urlMimeType(url) }, | ||
730 | { QStringLiteral("urls"), QJsonArray{url.toString()} } | 737 | { QStringLiteral("urls"), QJsonArray{url.toString()} } | ||
731 | }); | 738 | }); | ||
732 | mShareMenu->model()->setPluginType( QStringLiteral("Export") ); | 739 | mShareMenu->model()->setPluginType( QStringLiteral("Export") ); | ||
733 | mShareMenu->reload(); | 740 | mShareMenu->reload(); | ||
734 | } | 741 | } | ||
742 | #endif | ||||
735 | } | 743 | } | ||
736 | 744 | | |||
737 | bool sideBarVisibility() const | 745 | bool sideBarVisibility() const | ||
738 | { | 746 | { | ||
739 | switch (mCurrentMainPageId) { | 747 | switch (mCurrentMainPageId) { | ||
740 | case StartMainPageId: | 748 | case StartMainPageId: | ||
741 | GV_WARN_AND_RETURN_VALUE(false, "Sidebar not implemented on start page"); | 749 | GV_WARN_AND_RETURN_VALUE(false, "Sidebar not implemented on start page"); | ||
742 | break; | 750 | break; | ||
▲ Show 20 Lines • Show All 1074 Lines • Show Last 20 Lines |