Commit fe847030 authored by Rolf Eike Beer's avatar Rolf Eike Beer

Merge branch 'frameworks'

KGpg will be KF5 based from KDE Applications 16.12 on.

CCMAIL:kde-utils-devel@kde.org
CCMAIL:release-team@kde.org
parents 4e930761 56b72f62
cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "16")
set (KDE_APPLICATIONS_VERSION_MINOR "07")
set (KDE_APPLICATIONS_VERSION_MICRO "70")
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
project(kgpg)
set(QT_MIN_VERSION "5.3.0")
find_package(ECM 5.21 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_package(KDE4)
include( KDE4Defaults )
include(ECMAddAppIcon)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(FeatureSummary)
include(ECMSetupVersion)
include(ECMPackageConfigHelpers)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
DBus
Gui
PrintSupport
Widgets
)
# Load the frameworks we need
find_package(KF5 5.23 REQUIRED
Archive
DocTools
Codecs
CoreAddons
Crash
DBusAddons
I18n
IconThemes
JobWidgets
KIO
Notifications
Service
TextWidgets
XmlGui
WidgetsAddons
WindowSystem
)
# If definitions like -D_GNU_SOURCE are needed for these checks they
# should be added to _KDE4_PLATFORM_DEFINITIONS when it is originally
# defined outside this file. Here we include these definitions in
# CMAKE_REQUIRED_DEFINITIONS so they will be included in the build of
# checks below.
set( CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS} )
endif()
# kdepimlibs
find_package(KF5 REQUIRED
AkonadiContact
Contacts
)
find_package( KdepimLibs REQUIRED )
# only headers are used
find_package( Gpgme REQUIRED )
find_package(Gpgme REQUIRED)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_subdirectory( icons )
add_subdirectory( doc )
include_directories( ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} )
include_directories( ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} )
option(KGPG_DEBUG_TRANSACTIONS "show commands and results of gpg calls in debug log" Off)
......@@ -65,6 +104,7 @@ set(kgpg_model_SRCS
set(kgpg_transaction_SRCS
transactions/kgpgtransaction.cpp
transactions/kgpgtransactionjob.cpp
transactions/kgpgtransactionprivate.cpp
transactions/kgpguidtransaction.cpp
transactions/kgpgeditkeytransaction.cpp
transactions/kgpgsigntransactionhelper.cpp
......@@ -101,12 +141,14 @@ set(kgpg_SRCS ${core_SRCS} ${kgpg_editor_SRCS} ${kgpg_model_SRCS} ${kgpg_transac
kgpgoptions.cpp
keysmanager.cpp
kgpg.cpp
kgpg_debug.cpp
main.cpp
kgpgkeygenerate.cpp
kgpginterface.cpp
kgpgtextinterface.cpp
gpgproc.cpp
klinebufferedprocess.cpp
klinebufferedprocessprivate.cpp
keyservers.cpp
detailedconsole.cpp
keyinfodialog.cpp
......@@ -148,6 +190,7 @@ set(kgpg_HDRS
kgpgoptions.h
kgpgrevokewidget.h
kgpgtextinterface.h
kgpg_debug.h
klinebufferedprocess.h
newkey.h
selectexpirydate.h
......@@ -156,11 +199,11 @@ set(kgpg_HDRS
sourceselect.h
)
qt4_add_dbus_adaptor( kgpg_SRCS org.kde.kgpg.Key.xml keysmanager.h KeysManager)
qt5_add_dbus_adaptor( kgpg_SRCS org.kde.kgpg.Key.xml keysmanager.h KeysManager)
QT4_ADD_DBUS_INTERFACE(kgpg_SRCS org.kde.kgpg.Key.xml kgpg_interface )
qt5_add_dbus_interface(kgpg_SRCS org.kde.kgpg.Key.xml kgpg_interface )
kde4_add_ui_files(kgpg_SRCS
ki18n_wrap_ui(kgpg_SRCS
adduid.ui
conf_gpg.ui
searchres.ui
......@@ -179,42 +222,63 @@ kde4_add_ui_files(kgpg_SRCS
sourceselect.ui
)
kde4_add_app_icon(kgpg_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/hi*-app*-kgpg.png")
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/*-apps-kgpg.png")
ecm_add_app_icon(kgpg_SRCS ICONS ${ICONS_SRCS})
kde4_add_kcfg_files(kgpg_SRCS kgpgsettings.kcfgc )
kconfig_add_kcfg_files(kgpg_SRCS kgpgsettings.kcfgc )
kde4_add_executable(kgpg ${kgpg_SRCS} ${kgpg_HDRS})
add_executable(kgpg ${kgpg_SRCS} ${kgpg_HDRS})
if (KGPG_DEBUG_TRANSACTIONS)
get_target_property(KGPG_FLAGS kgpg COMPILE_DEFINITIONS)
if (NOT KGPG_FLAGS)
# get rid of the NOTFOUND
set(KGPG_FLAGS)
endif (NOT KGPG_FLAGS)
list(APPEND KGPG_FLAGS KGPG_DEBUG_TRANSACTIONS)
set_target_properties(kgpg PROPERTIES COMPILE_DEFINITIONS "${KGPG_FLAGS}")
set_property(SOURCE ${kgpg_transaction_SRCS} APPEND PROPERTY COMPILE_DEFINITIONS "KGPG_DEBUG_TRANSACTIONS")
endif (KGPG_DEBUG_TRANSACTIONS)
set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS "KGPG_VERSION=\"${KDE_APPLICATIONS_VERSION}\"")
target_link_libraries(kgpg
${KDE4_KIO_LIBS}
${KDE4_KABC_LIBS}
${KDE4_KUTILS_LIBS}
${KDE4_KPIMUTILS_LIBRARY}
${KDE4_SOLID_LIBS}
${KDEPIMLIBS_AKONADI_CONTACT_LIBS}
KF5::AkonadiContact
KF5::Archive
KF5::Codecs
KF5::Contacts
KF5::CoreAddons
KF5::Crash
KF5::DBusAddons
KF5::I18n
KF5::IconThemes
KF5::JobWidgets
KF5::KIOCore
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::Notifications
KF5::Service
KF5::TextWidgets
KF5::XmlGui
KF5::WidgetsAddons
KF5::WindowSystem
Qt5::PrintSupport
)
install(TARGETS kgpg ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
install( FILES editor/kgpgeditor.rc keysmanager.rc tips DESTINATION ${DATA_INSTALL_DIR}/kgpg)
install( PROGRAMS kgpg.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install( FILES kgpg.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/ )
install( FILES editor/kgpgeditor.rc keysmanager.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kgpg)
install( FILES tips DESTINATION ${DATA_INSTALL_DIR}/kgpg)
install( PROGRAMS org.kde.kgpg.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install( FILES org.kde.kgpg.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install( FILES kgpg.kcfg DESTINATION ${KCFG_INSTALL_DIR})
install( FILES kgpg.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} )
install( FILES org.kde.kgpg.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} )
install( FILES encryptfile.desktop encryptfolder.desktop viewdecrypted.desktop DESTINATION
${SERVICES_INSTALL_DIR}/ServiceMenus)
install( FILES org.kde.kgpg.Key.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
kde4_install_icons( ${ICON_INSTALL_DIR} )
ecm_install_icons(ICONS
16-apps-kgpg.png
22-apps-kgpg.png
32-apps-kgpg.png
48-apps-kgpg.png
DESTINATION ${KDE_INSTALL_ICONDIR}
THEME hicolor
)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddUid</class>
<widget class="QWidget" name="AddUid" >
<property name="geometry" >
<widget class="QWidget" name="AddUid">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
......@@ -9,52 +10,52 @@
<height>283</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Name (minimum 5 characters):</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="kLineEdit1" />
<widget class="QLineEdit" name="qLineEdit1"/>
</item>
<item>
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>Email:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="kLineEdit2" />
<widget class="QLineEdit" name="qLineEdit2"/>
</item>
<item>
<widget class="QLabel" name="textLabel3" >
<property name="text" >
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>Comment (optional):</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="kLineEdit3" />
<widget class="QLineEdit" name="qLineEdit3"/>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
......@@ -62,15 +63,15 @@
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/*
* Copyright (C) 2009,2010,2012,2013,2014 Rolf Eike Beer <kde@opensource.sf-tec.de>
* Copyright (C) 2009,2010,2012,2013,2014,2015,2016 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
......@@ -14,6 +14,7 @@
#include "caff.h"
#include "caff_p.h"
#include "kgpg_debug.h"
#include "kgpginterface.h"
#include "kgpgsettings.h"
#include "core/KGpgKeyNode.h"
......@@ -25,13 +26,14 @@
#include "transactions/kgpgsignuid.h"
#include "gpgproc.h"
#include <KDebug>
#include <KLocale>
#include <KTempDir>
#include <KToolInvocation>
#include <KLocalizedString>
#include <KMessageBox>
#include <QDebug>
#include <QDesktopServices>
#include <QDir>
#include <QFileInfo>
#include <QTemporaryDir>
KGpgCaffPrivate::KGpgCaffPrivate(KGpgCaff *parent, const KGpgSignableNode::List &ids, const QStringList &signers,
const KGpgCaff::OperationFlags flags, const KGpgSignTransactionHelper::carefulCheck checklevel)
......@@ -84,13 +86,13 @@ KGpgCaffPrivate::reexportKey(const KGpgSignableNode *key)
return;
}
m_tempdir.reset(new KTempDir());
m_tempdir.reset(new QTemporaryDir());
if (m_gpgVersion >= 0x20100) {
/* see http://lists.gnupg.org/pipermail/gnupg-devel/2014-December/029296.html */
QFile seclink(m_secringdir);
if (!seclink.link(m_tempdir->name() + QLatin1String("private-keys-v1.d"))) {
if (!seclink.link(m_tempdir->path() + QLatin1String("private-keys-v1.d"))) {
KMessageBox::sorry(qobject_cast<QWidget *>(q->parent()),
i18n("This function is not available on this system. The symbolic link to the private GnuPG keys cannot be created."));
return;
......@@ -108,9 +110,9 @@ KGpgCaffPrivate::reexportKey(const KGpgSignableNode *key)
KGpgExport *exp = new KGpgExport(this, exportkeys, expOptions);
exp->setOutputTransaction(imp);
imp->setGnuPGHome(m_tempdir->name());
imp->setGnuPGHome(m_tempdir->path());
connect(imp, SIGNAL(done(int)), SLOT(slotReimportDone(int)));
connect(imp, &KGpgImport::done, this, &KGpgCaffPrivate::slotReimportDone);
imp->start();
}
......@@ -126,10 +128,10 @@ KGpgCaffPrivate::slotReimportDone(int result)
abortOperation(-1);
} else {
KGpgSignUid *signuid = new KGpgSignUid(this, m_signers.first(), m_allids.first(), false, m_checklevel);
signuid->setGnuPGHome(m_tempdir->name());
signuid->setGnuPGHome(m_tempdir->path());
if (m_gpgVersion < 0x20100)
signuid->setSecringFile(m_secringfile);
connect(signuid, SIGNAL(done(int)), SLOT(slotSigningFinished(int)));
connect(signuid, &KGpgSignUid::done, this, &KGpgCaffPrivate::slotSigningFinished);
signuid->start();
}
......@@ -143,7 +145,7 @@ KGpgCaffPrivate::abortOperation(int result)
{
Q_Q(KGpgCaff);
kDebug(2100) << "transaction" << sender() << "failed, result" << result;
qCDebug(KGPG_LOG_GENERAL) << "transaction" << sender() << "failed, result" << result;
m_tempdir.reset();
emit q->aborted();
......@@ -268,9 +270,9 @@ KGpgCaffPrivate::slotSigningFinished(int result)
KGpgDelUid *deluid = new KGpgDelUid(this, key, uidnum, removeMode);
deluid->setGnuPGHome(m_tempdir->name());
deluid->setGnuPGHome(m_tempdir->path());
connect(deluid, SIGNAL(done(int)), SLOT(slotDelUidFinished(int)));
connect(deluid, &KGpgDelUid::done, this, &KGpgCaffPrivate::slotDelUidFinished);
deluid->start();
}
......@@ -296,9 +298,9 @@ KGpgCaffPrivate::slotDelUidFinished(int result)
KGpgExport *exp = new KGpgExport(this, QStringList(key->getId()), expOptions);
exp->setGnuPGHome(m_tempdir->name());
exp->setGnuPGHome(m_tempdir->path());
connect(exp, SIGNAL(done(int)), SLOT(slotExportFinished(int)));
connect(exp, &KGpgExport::done, this, &KGpgCaffPrivate::slotExportFinished);
exp->start();
}
......@@ -329,9 +331,9 @@ KGpgCaffPrivate::slotExportFinished(int result)
// Set the home directory to make sure custom encrypt options
// as well as the "always encrypt to" setting are not honored.
enc->setGnuPGHome(m_tempdir->name());
enc->setGnuPGHome(m_tempdir->path());
connect(enc, SIGNAL(done(int)), SLOT(slotTextEncrypted(int)));
connect(enc, &KGpgEncrypt::done, this, &KGpgCaffPrivate::slotTextEncrypted);
enc->start();
}
......@@ -353,9 +355,9 @@ KGpgCaffPrivate::slotTextEncrypted(int result)
const QString email = uid->getEmail();
const QString keyid = uid->getKeyNode()->getId();
KToolInvocation::invokeMailer(email, QString(), QString(),
i18nc("%1 is 64 bit key id (in hex), text is used as email subject", "Your key %1", keyid),
text);
QDesktopServices::openUrl(QUrl(QLatin1String("mailto:") + email +
QLatin1String("?subject=") + i18nc("%1 is 64 bit key id (in hex), text is used as email subject", "Your key %1", keyid) +
QLatin1String("&body=") + text));
break;
}
default:
......
......@@ -23,16 +23,15 @@
#include <QString>
#include <QStringList>
class KTempDir;
class QTemporaryDir;
class KGpgCaffPrivate : public QObject {
Q_OBJECT
KGpgCaff * const q_ptr;
Q_DECLARE_PUBLIC(KGpgCaff)
Q_DISABLE_COPY(KGpgCaffPrivate)
QScopedPointer<KTempDir> m_tempdir;
QScopedPointer<QTemporaryDir> m_tempdir;
QStringList m_signers;
QString m_secringfile;
QString m_secringdir; ///< where GnuPG >=2.1 store their secret keyring information
......@@ -52,7 +51,7 @@ public:
KGpgSignableNode::const_List m_noEncIds; ///< keys without encryption capability that were skipped
KGpgSignableNode::const_List m_alreadyIds; ///< ids already signed
private slots:
private:
void slotSigningFinished(int result);
void slotDelUidFinished(int result);
void slotExportFinished(int result);
......
This diff is collapsed.
......@@ -23,7 +23,7 @@
<number>0</number>
</property>
<item row="1" column="0" >
<widget class="KLineEdit" name="kcfg_CustomDecrypt" >
<widget class="QLineEdit" name="kcfg_CustomDecrypt" >
<property name="enabled" >
<bool>true</bool>
</property>
......@@ -61,13 +61,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -20,9 +20,9 @@ Encryption::Encryption( QWidget* parent )
: QWidget( parent ), Ui_Encryption()
{
setupUi( this );
connect(kcfg_EncryptFilesTo, SIGNAL(toggled(bool)), this,SLOT(encrypt_files_to_toggled(bool)));
connect(kcfg_AllowCustomEncryptionOptions, SIGNAL(toggled(bool)), this, SLOT(allow_custom_option_toggled(bool)));
connect(encrypt_to_always, SIGNAL(toggled(bool)), this, SLOT(encrypt_to_always_toggled(bool)));
connect(kcfg_EncryptFilesTo, &QCheckBox::toggled, this, &Encryption::encrypt_files_to_toggled);
connect(kcfg_AllowCustomEncryptionOptions, &QCheckBox::toggled, this, &Encryption::allow_custom_option_toggled);
connect(encrypt_to_always, &QCheckBox::toggled, this, &Encryption::encrypt_to_always_toggled);
}
void Encryption::encrypt_to_always_toggled(bool isOn)
......
......@@ -22,12 +22,11 @@
class Encryption : public QWidget, public Ui_Encryption
{
Q_OBJECT
public:
explicit Encryption(QWidget* parent = Q_NULLPTR);
public slots:
public:
virtual void encrypt_to_always_toggled( bool );
virtual void encrypt_files_to_toggled( bool );
virtual void allow_custom_option_toggled( bool );
......
......@@ -74,14 +74,14 @@
</widget>
</item>
<item row="10" column="2">
<widget class="KLineEdit" name="kcfg_CustomEncryptionOptions">
<widget class="QLineEdit" name="kcfg_CustomEncryptionOptions">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="KComboBox" name="always_key">
<widget class="QComboBox" name="always_key">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -94,7 +94,7 @@
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="KComboBox" name="file_key">
<widget class="QComboBox" name="file_key">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -173,18 +173,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -55,7 +55,7 @@
<item>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="KLineEdit" name="gpg_home_path">
<widget class="QLineEdit" name="gpg_home_path">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -81,7 +81,7 @@
</spacer>
</item>
<item row="1" column="0">
<widget class="KLineEdit" name="gpg_conf_path">
<widget class="QLineEdit" name="gpg_conf_path">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -124,7 +124,7 @@
<item>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="KLineEdit" name="kcfg_GpgBinaryPath">
<widget class="QLineEdit" name="kcfg_GpgBinaryPath">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -176,13 +176,6 @@
</item>
</layout>