Commit 63f1b860 authored by Heiko Becker's avatar Heiko Becker 🏃
Browse files

Make Prison a required dependency

7bd9bea0 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.
parent b79f44f4
......@@ -35,11 +35,12 @@ include(KDEPackageAppTemplates)
include(KDEClangFormat)
include(ECMConfiguredInstall)
include(ECMGenerateDBusServiceFile)
include(ECMQMLModules)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet
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(KF5NetworkManagerQt ${KF5_MIN_VERSION})
......@@ -153,6 +154,8 @@ set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine"
PURPOSE "Needed to build kfontinst, a simple font installer."
)
# Clipboard applet
ecm_find_qmlmodule(org.kde.prison 1.0)
include(ConfigureChecks.cmake)
......
include(ECMQMLModules)
ecm_find_qmlmodule(org.kde.plasma.core 2.0)
# 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)
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 )
ki18n_wrap_ui(libklipper_common_SRCS generalconfig.ui actionsconfig.ui editactiondialog.ui)
......@@ -51,6 +43,7 @@ target_link_libraries(kdeinit_klipper
KF5::KIOWidgets
KF5::Notifications
KF5::Service
KF5::Prison
KF5::TextWidgets
KF5::WindowSystem
KF5::WidgetsAddons
......@@ -61,9 +54,6 @@ target_link_libraries(kdeinit_klipper
if (X11_FOUND)
target_link_libraries(kdeinit_klipper XCB::XCB Qt5::X11Extras)
endif()
if (HAVE_PRISON)
target_link_libraries(kdeinit_klipper KF5::Prison)
endif ()
install(TARGETS kdeinit_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::Notifications
KF5::Service
KF5::Prison
KF5::TextWidgets # KTextEdit
KF5::WidgetsAddons # KMessageBox
KF5::WindowSystem
......@@ -96,9 +87,6 @@ target_link_libraries(plasma_engine_clipboard
if (X11_FOUND)
target_link_libraries(plasma_engine_clipboard XCB::XCB Qt5::X11Extras)
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(FILES plasma-dataengine-clipboard.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
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
setModel(s_clipboardSourceName, m_klipper->history()->model());
#ifdef HAVE_PRISON
setData(s_clipboardSourceName, s_barcodeKey, true);
#else
setData(s_clipboardSourceName, s_barcodeKey, false);
#endif
auto updateCurrent = [this]() {
setData(s_clipboardSourceName,
QStringLiteral("current"),
......
......@@ -27,9 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "klipper_debug.h"
#include <QIcon>
#ifdef HAVE_PRISON
#include <prison/Prison>
#endif
const static QString s_iconKey = QStringLiteral("icon");
const static QString s_previewKey = QStringLiteral("preview");
......@@ -82,7 +80,6 @@ void ClipboardJob::start()
m_klipper->editData(item);
return;
} else if (operation == QLatin1String("barcode")) {
#ifdef HAVE_PRISON
int pixelWidth = parameters().value(QStringLiteral("width")).toInt();
int pixelHeight = parameters().value(QStringLiteral("height")).toInt();
Prison::AbstractBarcode *code = nullptr;
......@@ -131,9 +128,6 @@ void ClipboardJob::start()
} else {
setResult(false);
}
#else
setResult(false);
#endif
} else if (operation == QLatin1String("action")) {
m_klipper->urlGrabber()->invokeAction(item);
setResult(true);
......
#cmakedefine HAVE_PRISON
#define KLIPPER_VERSION_STRING "${KLIPPER_VERSION_STRING}"
......@@ -54,9 +54,7 @@
#include "systemclipboard.h"
#ifdef HAVE_PRISON
#include <prison/Prison>
#endif
#include <config-X11.h>
#if HAVE_X11
......@@ -183,7 +181,6 @@ Klipper::Klipper(QObject* parent, const KSharedConfigPtr& config, KlipperMode mo
}
);
#ifdef HAVE_PRISON
// add barcode for mobile phones
m_showBarcodeAction = m_collection->addAction(QStringLiteral("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());
}
);
#endif
// Cycle through history
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_repeatAction );
m_popup->plugAction( m_editAction );
#ifdef HAVE_PRISON
m_popup->plugAction( m_showBarcodeAction );
#endif
m_popup->plugAction( m_quitAction );
}
......@@ -936,7 +930,6 @@ void Klipper::editData(const QSharedPointer< const HistoryItem > &item)
}
}
#ifdef HAVE_PRISON
class BarcodeLabel : public QLabel
{
public:
......@@ -1003,7 +996,6 @@ void Klipper::showBarcode(const QSharedPointer< const HistoryItem > &item)
dlg->open();
}
}
#endif //HAVE_PRISON
void Klipper::slotAskClearHistory()
{
......
......@@ -82,9 +82,7 @@ public:
}
void editData(const QSharedPointer<const HistoryItem> &item);
#ifdef HAVE_PRISON
void showBarcode(const QSharedPointer<const HistoryItem> &item);
#endif
public Q_SLOTS:
void saveSession();
......@@ -176,9 +174,7 @@ private:
QAction* m_clearHistoryAction;
QAction* m_repeatAction;
QAction* m_editAction;
#ifdef HAVE_PRISON
QAction* m_showBarcodeAction;
#endif
QAction* m_configureAction;
QAction* m_quitAction;
QAction* m_cycleNextAction;
......
Markdown is supported
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