diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ WindowSystem IconThemes Notifications + Purpose ) find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS Activities diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -79,6 +79,7 @@ target_link_libraries(gwenview KF5::ItemModels KF5::Notifications + KF5::PurposeWidgets gwenviewlib ) diff --git a/app/gwenviewui.rc b/app/gwenviewui.rc --- a/app/gwenviewui.rc +++ b/app/gwenviewui.rc @@ -1,6 +1,6 @@ - + @@ -106,7 +106,7 @@ - + diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -38,6 +38,8 @@ #ifdef Q_OS_OSX #include #endif +#include +#include // KDE #include @@ -57,6 +59,8 @@ #include #include #include +#include +#include // Local #include "configdialog.h" @@ -195,6 +199,8 @@ QAction * mToggleSlideShowAction; KToggleAction* mShowMenuBarAction; KToggleAction* mShowStatusBarAction; + Purpose::Menu* mShareMenu; + KToolBarPopupAction* mShareAction; #ifdef KIPI_FOUND KIPIExportAction* mKIPIExportAction; #endif @@ -504,8 +510,13 @@ #ifdef KIPI_FOUND mKIPIExportAction = new KIPIExportAction(q); - actionCollection->addAction("kipi_export", mKIPIExportAction); #endif + + mShareAction = new KToolBarPopupAction(QIcon::fromTheme("document-share"), "Share", q); + mShareAction->setDelayed(false); + actionCollection->addAction("share", mShareAction); + mShareMenu = new Purpose::Menu(q); + mShareAction->setMenu(mShareMenu); } void setupUndoActions() @@ -708,6 +719,18 @@ actionCollection->action("file_save")->setEnabled(canSave && isModified); actionCollection->action("file_save_as")->setEnabled(canSave); actionCollection->action("file_print")->setEnabled(isRasterImage); + + if (url.isEmpty()) { + mShareAction->setEnabled(false); + } else { + mShareAction->setEnabled(true); + mShareMenu->model()->setInputData(QJsonObject{ + { QStringLiteral("mimeType"), MimeTypeUtils::urlMimeType(url) }, + { QStringLiteral("urls"), QJsonArray{url.toString()} } + }); + mShareMenu->model()->setPluginType( QStringLiteral("Export") ); + mShareMenu->reload(); + } } bool sideBarVisibility() const