Make Prison a required dependency

7bd9bea072 started using Prison
unconditionally via QML import. So if Prison isn't installed the
clipboard applet stops working, complaining that "org.kde.prison is
not installed".
While it would certainly be possible to add another call to
"find_package(KF5Prison)" with TYPE RUNTIME, the result in
feature_summary would be very confusing, because OPTIONAL has a higher
priority and the runtime hint would vanish if you build with e.g.
-DCMAKE_DISABLE_FIND_PACKAGE_KF5Prison=TRUE.

(cherry picked from commit 63f1b86005)
wilder-portage-prov
Heiko Becker 5 years ago
parent 6d2ef8e256
commit 38ced5810c
  1. 5
      CMakeLists.txt
  2. 1
      kcms/translations/CMakeLists.txt
  3. 16
      klipper/CMakeLists.txt
  4. 4
      klipper/clipboardengine.cpp
  5. 6
      klipper/clipboardjob.cpp
  6. 1
      klipper/config-klipper.h.cmake
  7. 8
      klipper/klipper.cpp
  8. 4
      klipper/klipper.h

@ -33,11 +33,12 @@ include(ECMQueryQmake)
include(ECMInstallIcons) include(ECMInstallIcons)
include(KDEPackageAppTemplates) include(KDEPackageAppTemplates)
include(KDEClangFormat) include(KDEClangFormat)
include(ECMQMLModules)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet
IdleTime Declarative I18n KCMUtils TextWidgets KDELibs4Support Crash GlobalAccel IdleTime Declarative I18n KCMUtils TextWidgets KDELibs4Support Crash GlobalAccel
DBusAddons Wayland CoreAddons People ActivitiesStats Activities KIO) DBusAddons Wayland CoreAddons People ActivitiesStats Activities KIO Prison)
find_package(KDED CONFIG REQUIRED) find_package(KDED CONFIG REQUIRED)
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION}) find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
@ -151,6 +152,8 @@ set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine"
PURPOSE "Needed to build kfontinst, a simple font installer." PURPOSE "Needed to build kfontinst, a simple font installer."
) )
# Clipboard applet
ecm_find_qmlmodule(org.kde.prison 1.0)
include(ConfigureChecks.cmake) include(ConfigureChecks.cmake)

@ -1,4 +1,3 @@
include(ECMQMLModules)
ecm_find_qmlmodule(org.kde.plasma.core 2.0) ecm_find_qmlmodule(org.kde.plasma.core 2.0)
# KI18N Translation Domain for this library. # KI18N Translation Domain for this library.

@ -25,14 +25,6 @@ set(libklipper_common_SRCS
ecm_qt_declare_logging_category(libklipper_common_SRCS HEADER klipper_debug.h IDENTIFIER KLIPPER_LOG CATEGORY_NAME org.kde.klipper) ecm_qt_declare_logging_category(libklipper_common_SRCS HEADER klipper_debug.h IDENTIFIER KLIPPER_LOG CATEGORY_NAME org.kde.klipper)
find_package(KF5Prison ${KF5_MIN_VERSION})
set_package_properties(KF5Prison PROPERTIES DESCRIPTION "Prison library"
URL "https://commits.kde.org/prison"
TYPE OPTIONAL
PURPOSE "Needed to create mobile barcodes from clipboard data"
)
set(HAVE_PRISON ${KF5Prison_FOUND})
configure_file(config-klipper.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-klipper.h ) configure_file(config-klipper.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-klipper.h )
ki18n_wrap_ui(libklipper_common_SRCS generalconfig.ui actionsconfig.ui editactiondialog.ui) ki18n_wrap_ui(libklipper_common_SRCS generalconfig.ui actionsconfig.ui editactiondialog.ui)
@ -51,6 +43,7 @@ target_link_libraries(kdeinit_klipper
KF5::KIOWidgets KF5::KIOWidgets
KF5::Notifications KF5::Notifications
KF5::Service KF5::Service
KF5::Prison
KF5::TextWidgets KF5::TextWidgets
KF5::WindowSystem KF5::WindowSystem
KF5::WidgetsAddons KF5::WidgetsAddons
@ -61,9 +54,6 @@ target_link_libraries(kdeinit_klipper
if (X11_FOUND) if (X11_FOUND)
target_link_libraries(kdeinit_klipper XCB::XCB Qt5::X11Extras) target_link_libraries(kdeinit_klipper XCB::XCB Qt5::X11Extras)
endif() endif()
if (HAVE_PRISON)
target_link_libraries(kdeinit_klipper KF5::Prison)
endif ()
install(TARGETS kdeinit_klipper ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kdeinit_klipper ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS klipper ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS klipper ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
@ -86,6 +76,7 @@ target_link_libraries(plasma_engine_clipboard
KF5::Plasma KF5::Plasma
KF5::Notifications KF5::Notifications
KF5::Service KF5::Service
KF5::Prison
KF5::TextWidgets # KTextEdit KF5::TextWidgets # KTextEdit
KF5::WidgetsAddons # KMessageBox KF5::WidgetsAddons # KMessageBox
KF5::WindowSystem KF5::WindowSystem
@ -96,9 +87,6 @@ target_link_libraries(plasma_engine_clipboard
if (X11_FOUND) if (X11_FOUND)
target_link_libraries(plasma_engine_clipboard XCB::XCB Qt5::X11Extras) target_link_libraries(plasma_engine_clipboard XCB::XCB Qt5::X11Extras)
endif() endif()
if (HAVE_PRISON)
target_link_libraries(plasma_engine_clipboard KF5::Prison)
endif ()
install(TARGETS plasma_engine_clipboard DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine) install(TARGETS plasma_engine_clipboard DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)
install(FILES plasma-dataengine-clipboard.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) install(FILES plasma-dataengine-clipboard.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(FILES org.kde.plasma.clipboard.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services) install(FILES org.kde.plasma.clipboard.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)

@ -32,11 +32,7 @@ ClipboardEngine::ClipboardEngine(QObject *parent, const QVariantList &args)
{ {
// TODO: use a filterproxymodel // TODO: use a filterproxymodel
setModel(s_clipboardSourceName, m_klipper->history()->model()); setModel(s_clipboardSourceName, m_klipper->history()->model());
#ifdef HAVE_PRISON
setData(s_clipboardSourceName, s_barcodeKey, true); setData(s_clipboardSourceName, s_barcodeKey, true);
#else
setData(s_clipboardSourceName, s_barcodeKey, false);
#endif
auto updateCurrent = [this]() { auto updateCurrent = [this]() {
setData(s_clipboardSourceName, setData(s_clipboardSourceName,
QStringLiteral("current"), QStringLiteral("current"),

@ -27,9 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "klipper_debug.h" #include "klipper_debug.h"
#include <QIcon> #include <QIcon>
#ifdef HAVE_PRISON
#include <prison/Prison> #include <prison/Prison>
#endif
const static QString s_iconKey = QStringLiteral("icon"); const static QString s_iconKey = QStringLiteral("icon");
const static QString s_previewKey = QStringLiteral("preview"); const static QString s_previewKey = QStringLiteral("preview");
@ -82,7 +80,6 @@ void ClipboardJob::start()
m_klipper->editData(item); m_klipper->editData(item);
return; return;
} else if (operation == QLatin1String("barcode")) { } else if (operation == QLatin1String("barcode")) {
#ifdef HAVE_PRISON
int pixelWidth = parameters().value(QStringLiteral("width")).toInt(); int pixelWidth = parameters().value(QStringLiteral("width")).toInt();
int pixelHeight = parameters().value(QStringLiteral("height")).toInt(); int pixelHeight = parameters().value(QStringLiteral("height")).toInt();
Prison::AbstractBarcode *code = nullptr; Prison::AbstractBarcode *code = nullptr;
@ -131,9 +128,6 @@ void ClipboardJob::start()
} else { } else {
setResult(false); setResult(false);
} }
#else
setResult(false);
#endif
} else if (operation == QLatin1String("action")) { } else if (operation == QLatin1String("action")) {
m_klipper->urlGrabber()->invokeAction(item); m_klipper->urlGrabber()->invokeAction(item);
setResult(true); setResult(true);

@ -1,2 +1 @@
#cmakedefine HAVE_PRISON
#define KLIPPER_VERSION_STRING "${KLIPPER_VERSION_STRING}" #define KLIPPER_VERSION_STRING "${KLIPPER_VERSION_STRING}"

@ -54,9 +54,7 @@
#include "systemclipboard.h" #include "systemclipboard.h"
#ifdef HAVE_PRISON
#include <prison/Prison> #include <prison/Prison>
#endif
#include <config-X11.h> #include <config-X11.h>
#if HAVE_X11 #if HAVE_X11
@ -183,7 +181,6 @@ Klipper::Klipper(QObject* parent, const KSharedConfigPtr& config, KlipperMode mo
} }
); );
#ifdef HAVE_PRISON
// add barcode for mobile phones // add barcode for mobile phones
m_showBarcodeAction = m_collection->addAction(QStringLiteral("show-barcode")); m_showBarcodeAction = m_collection->addAction(QStringLiteral("show-barcode"));
m_showBarcodeAction->setText(i18n("&Show Barcode...")); m_showBarcodeAction->setText(i18n("&Show Barcode..."));
@ -193,7 +190,6 @@ Klipper::Klipper(QObject* parent, const KSharedConfigPtr& config, KlipperMode mo
showBarcode(m_history->first()); showBarcode(m_history->first());
} }
); );
#endif
// Cycle through history // Cycle through history
m_cycleNextAction = m_collection->addAction(QStringLiteral("cycleNextAction")); m_cycleNextAction = m_collection->addAction(QStringLiteral("cycleNextAction"));
@ -220,9 +216,7 @@ Klipper::Klipper(QObject* parent, const KSharedConfigPtr& config, KlipperMode mo
m_popup->plugAction( m_configureAction ); m_popup->plugAction( m_configureAction );
m_popup->plugAction( m_repeatAction ); m_popup->plugAction( m_repeatAction );
m_popup->plugAction( m_editAction ); m_popup->plugAction( m_editAction );
#ifdef HAVE_PRISON
m_popup->plugAction( m_showBarcodeAction ); m_popup->plugAction( m_showBarcodeAction );
#endif
m_popup->plugAction( m_quitAction ); m_popup->plugAction( m_quitAction );
} }
@ -936,7 +930,6 @@ void Klipper::editData(const QSharedPointer< const HistoryItem > &item)
} }
} }
#ifdef HAVE_PRISON
class BarcodeLabel : public QLabel class BarcodeLabel : public QLabel
{ {
public: public:
@ -1003,7 +996,6 @@ void Klipper::showBarcode(const QSharedPointer< const HistoryItem > &item)
dlg->open(); dlg->open();
} }
} }
#endif //HAVE_PRISON
void Klipper::slotAskClearHistory() void Klipper::slotAskClearHistory()
{ {

@ -82,9 +82,7 @@ public:
} }
void editData(const QSharedPointer<const HistoryItem> &item); void editData(const QSharedPointer<const HistoryItem> &item);
#ifdef HAVE_PRISON
void showBarcode(const QSharedPointer<const HistoryItem> &item); void showBarcode(const QSharedPointer<const HistoryItem> &item);
#endif
public Q_SLOTS: public Q_SLOTS:
void saveSession(); void saveSession();
@ -176,9 +174,7 @@ private:
QAction* m_clearHistoryAction; QAction* m_clearHistoryAction;
QAction* m_repeatAction; QAction* m_repeatAction;
QAction* m_editAction; QAction* m_editAction;
#ifdef HAVE_PRISON
QAction* m_showBarcodeAction; QAction* m_showBarcodeAction;
#endif
QAction* m_configureAction; QAction* m_configureAction;
QAction* m_quitAction; QAction* m_quitAction;
QAction* m_cycleNextAction; QAction* m_cycleNextAction;

Loading…
Cancel
Save