summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Sitter <[email protected]>2015-10-05 12:07:00 +0200
committerHarald Sitter <[email protected]>2015-10-05 12:07:00 +0200
commit5134f3cac483fa8c1a8e27545ed74e3fea6e8e4b (patch)
tree01e5092a68852ea96af017ffcd860be2c40a8d90
parent85a5f54d97815fff2b4f90b5b0fe7b41c885ea0f (diff)
make packagekit fully optional as part of the SAMBA_INSTALL option
-rw-r--r--CMakeLists.txt12
-rw-r--r--samba/filepropertiesplugin/CMakeLists.txt5
-rw-r--r--samba/filepropertiesplugin/sambausershareplugin.cpp2
-rw-r--r--samba/filepropertiesplugin/sambausershareplugin.h6
4 files changed, 18 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 747b145..5be0214 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,11 +26,11 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
WidgetsAddons
)
-find_package(PackageKitQt5 0.9.5 REQUIRED)
+find_package(PackageKitQt5 0.9.5)
set_package_properties(PackageKitQt5
PROPERTIES DESCRIPTION "Software Manager integration"
TYPE OPTIONAL
- PURPOSE "Provides package management integration to the application launcher."
+ PURPOSE "Needed to automatically install the samba package."
)
include(CheckIncludeFile)
@@ -52,12 +52,14 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE5_INCLUDES})
option(SAMBA_INSTALL "Offer to install Samba for file sharing with PackageKit if it is not already installed, use -DSAMBA_INSTALL=off to disable, use -DSAMBA_PACKAGE_NAME= to set package name." ON)
set(SAMBA_PACKAGE_NAME "samba" CACHE STRING "Name of distribution package to install to get a functional samba stack.")
-add_feature_info("Samba Installation" SAMBA_INSTALL "Automatic installation of '${SAMBA_PACKAGE_NAME}' using PackageKit.")
-if(SAMBA_INSTALL)
+if(SAMBA_INSTALL AND PackageKitQt5_FOUND)
add_definitions(-DSAMBA_INSTALL)
add_definitions(-DSAMBA_PACKAGE_NAME=${SAMBA_PACKAGE_NAME})
-endif(SAMBA_INSTALL)
+else()
+ set(SAMBA_INSTALL false)
+endif()
+add_feature_info("Samba Installation" SAMBA_INSTALL "Automatic installation of '${SAMBA_PACKAGE_NAME}' using PackageKit.")
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kfileshare\")
diff --git a/samba/filepropertiesplugin/CMakeLists.txt b/samba/filepropertiesplugin/CMakeLists.txt
index 0213570..45cbc88 100644
--- a/samba/filepropertiesplugin/CMakeLists.txt
+++ b/samba/filepropertiesplugin/CMakeLists.txt
@@ -11,9 +11,12 @@ target_link_libraries(sambausershareplugin
KF5::I18n
KF5::KIOWidgets
KF5::WidgetsAddons
- PK::packagekitqt5
)
+if(SAMBA_INSTALL)
+ target_link_libraries(sambausershareplugin PK::packagekitqt5)
+endif()
+
target_include_directories(sambausershareplugin PUBLIC ${Qt5DBus_INCLUDE_DIRS})
install(TARGETS sambausershareplugin DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/samba/filepropertiesplugin/sambausershareplugin.cpp b/samba/filepropertiesplugin/sambausershareplugin.cpp
index ea786c6..7f19399 100644
--- a/samba/filepropertiesplugin/sambausershareplugin.cpp
+++ b/samba/filepropertiesplugin/sambausershareplugin.cpp
@@ -110,6 +110,7 @@ SambaUserSharePlugin::~SambaUserSharePlugin()
{
}
+#ifdef SAMBA_INSTALL
void SambaUserSharePlugin::installSamba()
{
//unsigned int xid = 0;
@@ -140,6 +141,7 @@ void SambaUserSharePlugin::packageInstall(PackageKit::Transaction::Info info,
Q_UNUSED(summary);
PackageKit::Daemon::installPackage(packageId);
}
+#endif // SAMBA_INSTALL
void SambaUserSharePlugin::setupModel()
{
diff --git a/samba/filepropertiesplugin/sambausershareplugin.h b/samba/filepropertiesplugin/sambausershareplugin.h
index bd525f9..3d283af 100644
--- a/samba/filepropertiesplugin/sambausershareplugin.h
+++ b/samba/filepropertiesplugin/sambausershareplugin.h
@@ -23,8 +23,10 @@
#include <QVariant>
#include <QComboBox>
+#ifdef SAMBA_INSTALL
#include <PackageKit/Daemon>
#include <PackageKit/Transaction>
+#endif // SAMBA_INSTALL
#include <kpropertiesdialog.h>
#include <klocalizedstring.h>
@@ -45,11 +47,13 @@ public:
private Q_SLOTS:
void load();
void toggleShareStatus(bool checked);
- void installSamba();
void checkShareName(const QString &name);
+#ifdef SAMBA_INSTALL
+ void installSamba();
void packageInstall(PackageKit::Transaction::Info info,
const QString &packageId,
const QString &summary);
+#endif // SAMBA_INSTALL
private:
QString m_url;