Commit a1b22448 authored by Jonathan Esk-Riddell's avatar Jonathan Esk-Riddell 🏄
Browse files

allow to be compiled without packagekit/appstream

parent 155c9903
......@@ -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})
......
......@@ -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)
......
......@@ -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
{
......
......@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment