summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Riddell <jr@jriddell.org>2016-09-23 17:00:26 (GMT)
committerJonathan Riddell <jr@jriddell.org>2016-09-23 17:00:26 (GMT)
commita1b224482b4e870dbed9605d0bcab3e3dcd31929 (patch)
tree6fcf9343f256b8dfe52bb9f4629ec7801d0a3dc1
parent155c99030370dfcc2aaf44c834db353854c587ff (diff)
allow to be compiled without packagekit/appstream
-rw-r--r--CMakeLists.txt9
-rw-r--r--app/CMakeLists.txt4
-rw-r--r--app/kipiinterface.cpp16
-rw-r--r--app/kipiinterface.h5
4 files changed, 27 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab19f6f..be759f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,16 +107,21 @@ find_package(PackageKitQt5 0.9.5)
set_package_properties(PackageKitQt5
PROPERTIES DESCRIPTION "Software Manager integration"
TYPE OPTIONAL
- PURPOSE "Needed to automatically install the samba package."
+ PURPOSE "Needed to automatically install KIPI Plugins."
)
find_package(AppstreamQt 0.9.8)
set_package_properties(AppstreamQt
PROPERTIES DESCRIPTION "Appstream"
TYPE OPTIONAL
- PURPOSE "Needed to find KIPI plugins."
+ PURPOSE "Needed to find KIPI Plugins."
)
+if (KF5Kipi_FOUND AND PackageKitQt5_FOUND AND AppstreamQt_FOUND)
+ set(KIPI_INSTALLER true)
+ add_definitions(-DKIPI_INSTALLER)
+endif()
+
configure_file(config-gwenview.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gwenview.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index ac6b01d..281b80e 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -82,11 +82,11 @@ target_link_libraries(gwenview LINK_INTERFACE_LIBRARIES KF5::KIOCore Qt5::Core)
if (KF5Kipi_FOUND)
target_link_libraries(gwenview KF5::Kipi)
+endif()
- # TODO Add if (packagekit) and if (appstream)
+if (KIPI_INSTALLER)
target_link_libraries(gwenview PK::packagekitqt5)
target_link_libraries(gwenview AppstreamQt)
-
endif()
if (APPLE)
diff --git a/app/kipiinterface.cpp b/app/kipiinterface.cpp
index 2e5e1ff..789ba2b 100644
--- a/app/kipiinterface.cpp
+++ b/app/kipiinterface.cpp
@@ -339,15 +339,18 @@ void KIPIInterface::loadOnePlugin()
d->mPluginMenu->removeAction(d->mLoadingAction);
if (d->mPluginMenu->isEmpty()) {
d->mPluginMenu->addAction(d->mNoPluginAction);
+#ifdef KIPI_INSTALLER
d->mPluginMenu->addAction(d->mInstallPluginAction);
d->mInstallPluginAction->setEnabled(true);
QObject::connect(d->mInstallPluginAction, SIGNAL(triggered(bool)),
this, SLOT(slotInstallPlugins(bool)));
+#endif
}
loadingFinished();
}
+#ifdef KIPI_INSTALLER
void KIPIInterface::slotInstallPlugins(bool checked) {
Q_UNUSED(checked);
qDebug() << "slotInstallPlugins()" << endl;
@@ -382,13 +385,22 @@ void KIPIInterface::packageFinished(PackageKit::Transaction::Exit status, uint r
qDebug() << "packageFinished() status: " << status << endl;
qDebug() << "packageFinished() no of seconds: " << runtime << endl;
if (status == PackageKit::Transaction::Exit::ExitSuccess) {
- d->installDialog->setLabelText("installed!");
+ d->installDialog->setLabelText("Image plugins have been installed.");
+ d->installDialog->setAutoClose(false);
+ d->installDialog->setMaximum(100);
+ d->installDialog->setValue(100);
+ d->installDialog->setCancelButtonText("&Close");
d->mPluginLoader = 0;
loadPlugins();
+ d->mPluginMenu->removeAction(d->mInstallPluginAction);
+ d->mPluginMenu->removeAction(d->mNoPluginAction);
} else {
- d->installDialog->setLabelText("failed to install :(");
+ d->installDialog->setLabelText("Could not install plugins.");
+ d->installDialog->setMaximum(100);
+ d->installDialog->setCancelButtonText("&Close");
}
}
+#endif
QList<QAction*> KIPIInterface::pluginActions(KIPI::Category category) const
{
diff --git a/app/kipiinterface.h b/app/kipiinterface.h
index dbefaae..5ceacd0 100644
--- a/app/kipiinterface.h
+++ b/app/kipiinterface.h
@@ -28,9 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <kipi/plugin.h>
#include <libkipi_version.h>
-//TODO if packagekit
+#ifdef KIPI_INSTALLER
#include <PackageKit/Daemon>
#include <PackageKit/Transaction>
+#endif
class QAction;
@@ -92,9 +93,11 @@ public Q_SLOTS:
private Q_SLOTS:
void slotSelectionChanged();
void slotDirectoryChanged();
+#ifdef KIPI_INSTALLER
void slotInstallPlugins(bool checked);
void packageInstall(PackageKit::Transaction::Info, QString, QString);
void packageFinished(PackageKit::Transaction::Exit, uint);
+#endif
void init();
void loadOnePlugin();