summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrius Štikonas <andrius@stikonas.eu>2016-06-03 15:13:24 (GMT)
committerAndrius Štikonas <andrius@stikonas.eu>2016-06-03 18:05:37 (GMT)
commit0744416d4e712b7e3281e04952db18059759d09d (patch)
tree189af1b9e1d7cd48a4358ca164e064d5b27a7705
parentac4be196c0fd21c4a8f6449c73e3c864b376797e (diff)
Inital port to frameworks.
Some code is commented out and marked with FIXME: KF5
-rw-r--r--CMakeLists.txt103
-rw-r--r--core/convert.cpp10
-rw-r--r--core/emailvalidator.cpp4
-rw-r--r--detailedconsole.cpp4
-rw-r--r--doc/CMakeLists.txt2
-rw-r--r--editor/kgpgeditor.cpp6
-rw-r--r--editor/kgpgeditor.h10
-rw-r--r--editor/kgpgmd5widget.cpp1
-rw-r--r--editor/kgpgtextedit.cpp1
-rw-r--r--gpgproc.cpp4
-rw-r--r--icons/CMakeLists.txt2
-rw-r--r--keysmanager.cpp41
-rw-r--r--keysmanager.h46
-rw-r--r--kgpg.cpp4
-rw-r--r--kgpgexternalactions.cpp14
-rw-r--r--kgpgoptions.cpp12
-rw-r--r--klinebufferedprocess.cpp59
-rw-r--r--klinebufferedprocess.h4
-rw-r--r--main.cpp4
-rw-r--r--selectpublickeydialog.cpp6
-rw-r--r--transactions/kgpgadduid.cpp4
-rw-r--r--transactions/kgpggeneratekey.cpp4
-rw-r--r--transactions/kgpgtransaction.cpp94
-rw-r--r--transactions/kgpgtransaction.h3
24 files changed, 163 insertions, 279 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 444b618..e5507d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,29 +1,47 @@
-cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
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/")
+
+include(ECMAddAppIcon)
+include(ECMInstallIcons)
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings NO_POLICY_SCOPE)
+include(FeatureSummary)
+include(ECMSetupVersion)
+include(ECMPackageConfigHelpers)
+
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
+ Core
+ Gui
+ Widgets
+)
-if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- find_package(KDE4)
- include( KDE4Defaults )
-
- add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
- add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
-
- # 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()
+# Load the frameworks we need
+find_package(KF5 REQUIRED
+ AkonadiContact
+ Archive
+ DocTools
+ I18n
+ IconThemes
+ Codecs
+ KIO
+ KDELibs4Support
+# KIOCore
+ Service
+ WidgetsAddons
+)
-find_package( KdepimLibs REQUIRED )
# only headers are used
-find_package( Gpgme REQUIRED )
+find_package(Gpgme REQUIRED)
add_subdirectory( icons )
-add_subdirectory( doc )
-include_directories( ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} )
+# add_subdirectory( doc )
+include_directories( ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} )
option(KGPG_DEBUG_TRANSACTIONS "show commands and results of gpg calls in debug log" Off)
@@ -65,6 +83,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
@@ -107,6 +126,7 @@ set(kgpg_SRCS ${core_SRCS} ${kgpg_editor_SRCS} ${kgpg_model_SRCS} ${kgpg_transac
kgpgtextinterface.cpp
gpgproc.cpp
klinebufferedprocess.cpp
+ klinebufferedprocessprivate.cpp
keyservers.cpp
detailedconsole.cpp
keyinfodialog.cpp
@@ -156,11 +176,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,29 +199,30 @@ 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}/hi*-app*-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}")
-endif (KGPG_DEBUG_TRANSACTIONS)
+# 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}")
+# endif (KGPG_DEBUG_TRANSACTIONS)
target_link_libraries(kgpg
- ${KDE4_KIO_LIBS}
- ${KDE4_KABC_LIBS}
- ${KDE4_KUTILS_LIBS}
- ${KDE4_KPIMUTILS_LIBRARY}
- ${KDE4_SOLID_LIBS}
- ${KDEPIMLIBS_AKONADI_CONTACT_LIBS}
+ KF5::Archive
+ KF5::Codecs
+ KF5::Contacts
+ KF5::KDELibs4Support
+ KF5::KIOCore
+ KF5::AkonadiContact
)
install(TARGETS kgpg ${INSTALL_TARGETS_DEFAULT_ARGS} )
@@ -217,4 +238,4 @@ install( FILES encryptfile.desktop encryptfolder.desktop viewdecrypted.desktop D
${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( ${ICON_INSTALL_DIR} )
diff --git a/core/convert.cpp b/core/convert.cpp
index eaa0e14..826dd50 100644
--- a/core/convert.cpp
+++ b/core/convert.cpp
@@ -21,7 +21,7 @@
#include "convert.h"
-#include <KDebug>
+#include <QDebug>
#include <gpgme.h>
#include "kgpgsettings.h"
@@ -189,7 +189,7 @@ KgpgSubKeyType toSubType(const QString& capString, bool upper)
KgpgSubKeyType ret;
foreach (const QChar &ch, capString) {
- switch (ch.toAscii()) {
+ switch (ch.toLatin1()) {
case 's':
case 'S':
if (upper != ch.isUpper())
@@ -217,9 +217,9 @@ KgpgSubKeyType toSubType(const QString& capString, bool upper)
case 'D': // disabled key
case '?': // unknown to GnuPG
continue;
- default:
- kDebug(2100) << "unknown capability letter" << ch
- << "in cap string" << capString;
+// default:
+// qDebug(2100) << "unknown capability letter" << ch
+// << "in cap string" << capString; // FIXME: KF5
}
}
diff --git a/core/emailvalidator.cpp b/core/emailvalidator.cpp
index b666563..14f8270 100644
--- a/core/emailvalidator.cpp
+++ b/core/emailvalidator.cpp
@@ -20,14 +20,14 @@
#include "emailvalidator.h"
-#include "kpimutils/email.h"
+#include <KEmailAddress>
namespace KgpgCore
{
QValidator::State EmailValidator::validate(QString &input, int &) const
{
- if (KPIMUtils::isValidSimpleAddress(input))
+ if (KEmailAddress::isValidSimpleAddress(input))
return QValidator::Acceptable;
else
return QValidator::Invalid;
diff --git a/detailedconsole.cpp b/detailedconsole.cpp
index 7aa93fb..113dcdc 100644
--- a/detailedconsole.cpp
+++ b/detailedconsole.cpp
@@ -31,6 +31,6 @@ KgpgDetailedInfo::KgpgDetailedInfo(QWidget *parent, const QString &boxLabel, con
setButtons(Details | Ok);
setDefaultButton(Ok);
setModal(true);
- KMessageBox::createKMessageBox(this, QMessageBox::Information, // krazy:exclude=qtclasses
- boxLabel, keysList, QString(), Q_NULLPTR, 0, errormessage);
+// KMessageBox::createKMessageBox(this, QMessageBox::Information, // krazy:exclude=qtclasses
+// boxLabel, keysList, QString(), Q_NULLPTR, 0, errormessage); FIXME:KF5
}
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index f06b01c..bf1ee37 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,3 +1,3 @@
########### install files ###############
#
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kgpg)
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kgpg)
diff --git a/editor/kgpgeditor.cpp b/editor/kgpgeditor.cpp
index 546a0aa..0f1e665 100644
--- a/editor/kgpgeditor.cpp
+++ b/editor/kgpgeditor.cpp
@@ -29,7 +29,7 @@
#include "transactions/kgpgverify.h"
#include <kgpgexternalactions.h>
-#include <KAction>
+#include <QAction>
#include <KActionCollection>
#include <KEncodingFileDialog>
#include <KFind>
@@ -181,7 +181,7 @@ void KgpgEditor::initActions()
m_recentfiles->loadEntries( KConfigGroup(KGlobal::config(), "Recent Files" ) );
m_recentfiles->setMaxItems(KGpgSettings::recentFiles());
- KAction *action = actionCollection()->addAction(QLatin1String("file_encrypt"), this, SLOT(slotFilePreEnc()));
+ QAction *action = actionCollection()->addAction(QLatin1String("file_encrypt"), this, SLOT(slotFilePreEnc()));
action->setIcon(KIcon( QLatin1String( "document-encrypt" )));
action->setText(i18n("&Encrypt File..."));
@@ -519,7 +519,7 @@ void KgpgEditor::slotFilePreDec()
{
QFile fgpg(newname);
if (fgpg.exists()) {
- QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(this, i18n("File Already Exists"), KUrl(), KUrl::fromPath(newname), KIO::M_OVERWRITE);
+ QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(this, i18n("File Already Exists"), QUrl(), QUrl::fromLocalFile(newname), KIO::RenameDialog_Overwrite);
if (over->exec() != QDialog::Accepted) {
delete over;
diff --git a/editor/kgpgeditor.h b/editor/kgpgeditor.h
index fc9fa21..c359898 100644
--- a/editor/kgpgeditor.h
+++ b/editor/kgpgeditor.h
@@ -24,7 +24,7 @@
#include <kgpgcompiler.h>
class KToggleAction;
-class KAction;
+class QAction;
class KFind;
class KgpgTextEdit;
@@ -118,10 +118,10 @@ private:
QString m_textencoding;
KToggleAction *m_encodingaction;
- KAction *m_editundo;
- KAction *m_editredo;
- KAction *m_editcopy;
- KAction *m_editcut;
+ QAction *m_editundo;
+ QAction *m_editredo;
+ QAction *m_editcopy;
+ QAction *m_editcut;
KFind *m_find;
KUrl m_docname;
diff --git a/editor/kgpgmd5widget.cpp b/editor/kgpgmd5widget.cpp
index 4c333dd..61b8883 100644
--- a/editor/kgpgmd5widget.cpp
+++ b/editor/kgpgmd5widget.cpp
@@ -15,6 +15,7 @@
#include <QFile>
#include <KApplication>
+#include <kmd5.h>
#include <KMessageBox>
#include <KLineEdit>
#include <KLocale>
diff --git a/editor/kgpgtextedit.cpp b/editor/kgpgtextedit.cpp
index 54fc55d..6bd6d57 100644
--- a/editor/kgpgtextedit.cpp
+++ b/editor/kgpgtextedit.cpp
@@ -32,6 +32,7 @@
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QFile>
+#include <QMimeData>
#include <QTextStream>
#include <kio/netaccess.h>
diff --git a/gpgproc.cpp b/gpgproc.cpp
index fa3ee3d..8402337 100644
--- a/gpgproc.cpp
+++ b/gpgproc.cpp
@@ -18,8 +18,10 @@
#include <KDebug>
#include <KProcess>
#include <KStandardDirs>
+
#include <QDir>
#include <QFileInfo>
+#include <QGlobalStatic>
#include <QStringList>
#include <QTextCodec>
@@ -161,7 +163,7 @@ bool GnupgBinary::supportsDebugLevel() const
return m_useDebugLevel;
}
-K_GLOBAL_STATIC(GnupgBinary, lastBinary)
+Q_GLOBAL_STATIC(GnupgBinary, lastBinary)
GPGProc::GPGProc(QObject *parent, const QString &binary)
: KLineBufferedProcess(parent)
diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt
index 492d3424..1477f4e 100644
--- a/icons/CMakeLists.txt
+++ b/icons/CMakeLists.txt
@@ -1 +1 @@
-kde4_install_icons( ${DATA_INSTALL_DIR}/kgpg/icons )
+ecm_install_icons( ${DATA_INSTALL_DIR}/kgpg/icons )
diff --git a/keysmanager.cpp b/keysmanager.cpp
index 3b95f5d..7b849d7 100644
--- a/keysmanager.cpp
+++ b/keysmanager.cpp
@@ -21,7 +21,7 @@
#include "core/kgpgkey.h"
#include "detailedconsole.h"
#include "groupedit.h"
-#include "keyadaptor.h"
+// #include "keyadaptor.h"
#include "keyexport.h"
#include "keyinfodialog.h"
#include "keyservers.h"
@@ -59,12 +59,13 @@
#include <akonadi/contact/contacteditor.h>
#include <akonadi/contact/contacteditordialog.h>
#include <akonadi/contact/contactsearchjob.h>
-#include <KAction>
+#include <QAction>
#include <KActionCollection>
#include <KDebug>
#include <KFileDialog>
#include <KIcon>
#include <KInputDialog>
+#include <KGlobal>
#include <KLineEdit>
#include <KLocale>
#include <KMenu>
@@ -98,8 +99,8 @@
#include <QProcess>
#include <QWidget>
#include <QDBusConnection>
-#include <kabc/addresseelist.h>
-// #include <kabc/key.h> TODO
+#include <kcontacts/addresseelist.h>
+// #include <kcontacts/key.h> TODO
#include <kio/global.h>
#include <kjobtrackerinterface.h>
#include <ktip.h>
@@ -116,7 +117,7 @@ KeysManager::KeysManager(QWidget *parent)
terminalkey(Q_NULLPTR),
m_trayicon(Q_NULLPTR)
{
- new KeyAdaptor(this);
+// new KeyAdaptor(this); FIXME: KF5
QDBusConnection::sessionBus().registerObject(QLatin1String( "/KeyInterface" ), this);
setAttribute(Qt::WA_DeleteOnClose, false);
@@ -148,7 +149,7 @@ KeysManager::KeysManager(QWidget *parent)
if (showTipOfDay)
installEventFilter(this);
- KAction *action;
+ QAction *action;
action = actionCollection()->addAction(QLatin1String("help_tipofday"), this, SLOT(slotTip()));
action->setIcon( KIcon( QLatin1String( "help-hint" )) );
@@ -180,7 +181,7 @@ KeysManager::KeysManager(QWidget *parent)
editKey->setText(i18n("Edit Key in &Terminal"));
editKey->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
- KAction *generateKey = actionCollection()->addAction(QLatin1String("key_gener"), this, SLOT(slotGenerateKey()));
+ QAction *generateKey = actionCollection()->addAction(QLatin1String("key_gener"), this, SLOT(slotGenerateKey()));
generateKey->setIcon(KIcon( QLatin1String( "key-generate-pair" )));
generateKey->setText(i18n("&Generate Key Pair..."));
generateKey->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::New));
@@ -189,7 +190,7 @@ KeysManager::KeysManager(QWidget *parent)
exportPublicKey->setIcon(KIcon( QLatin1String( "document-export-key" )));
exportPublicKey->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Copy));
- KAction *importKey = actionCollection()->addAction(QLatin1String("key_import"), this, SLOT(slotPreImportKey()));
+ QAction *importKey = actionCollection()->addAction(QLatin1String("key_import"), this, SLOT(slotPreImportKey()));
importKey->setIcon(KIcon( QLatin1String( "document-import-key" )));
importKey->setText(i18n("&Import Key..."));
importKey->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Paste));
@@ -430,10 +431,10 @@ KeysManager::KeysManager(QWidget *parent)
searchLayout->addWidget(m_listviewsearch);
searchLayout->addStretch();
- KAction *searchLineAction = new KAction(i18nc("Name of the action that is a search line, shown for example in the toolbar configuration dialog",
+ QAction *searchLineAction = new QAction(i18nc("Name of the action that is a search line, shown for example in the toolbar configuration dialog",
"Search Line"), this);
actionCollection()->addAction(QLatin1String( "search_line" ), searchLineAction);
- searchLineAction->setDefaultWidget(searchWidget);
+// searchLineAction->setDefaultWidget(searchWidget); FIXME: KF5
action = actionCollection()->addAction(QLatin1String("search_focus"), m_listviewsearch, SLOT(setFocus()));
action->setText(i18nc("Name of the action that gives the focus to the search line", "Focus Search Line"));
@@ -455,9 +456,9 @@ KeysManager::KeysManager(QWidget *parent)
iview->setColumnHidden(5, !KGpgSettings::showExpi());
iproxy->setOnlySecret(KGpgSettings::showSecret());
- KStatusBar *statusbar = statusBar();
- statusbar->insertPermanentFixedItem(KGpgItemModel::statusCountMessageString(9999, 999), 0);
- statusbar->changeItem(QString(), 0);
+ QStatusBar *statusbar = statusBar();
+// statusbar->insertPermanentFixedItem(KGpgItemModel::statusCountMessageString(9999, 999), 0); FIXME: KF5
+// statusbar->changeItem(QString(), 0); FIXME: KF5
cg = KConfigGroup(KGlobal::config().data(), "MainWindow");
setAutoSaveSettings(cg, true);
@@ -551,7 +552,7 @@ void KeysManager::changeMessage(const QString &msg, const bool keep)
void KeysManager::updateStatusCounter()
{
- statusBar()->changeItem(imodel->statusCountMessage(), 0);
+// statusBar()->changeItem(imodel->statusCountMessage(), 0); FIXME: KF5
}
void KeysManager::slotGenerateKeyDone(KJob *job)
@@ -1014,17 +1015,17 @@ void KeysManager::slotAddressbookSearchResult(KJob *job)
Akonadi::ContactSearchJob *searchJob = qobject_cast<Akonadi::ContactSearchJob*>(job);
Q_ASSERT(searchJob);
- const KABC::Addressee::List addresseeList = searchJob->contacts();
+ const KContacts::Addressee::List addresseeList = searchJob->contacts();
m_addIds.take(job);
Akonadi::ContactEditorDialog *dlg;
-// KABC::Key key; TODO
+// KContacts::Key key; TODO
if (!addresseeList.isEmpty()) {
dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::EditMode, this);
dlg->setContact(searchJob->items().at(0));
} else {
- KABC::Addressee addressee;
+ KContacts::Addressee addressee;
addressee.setNameFromString(nd->getName());
addressee.setEmails(QStringList(nd->getEmail()));
dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::CreateMode, this);
@@ -2674,7 +2675,7 @@ KeysManager::setupTrayIcon()
if (!newtray)
return;
- KMenu *conf_menu = m_trayicon->contextMenu();
+ QMenu *conf_menu = m_trayicon->contextMenu();
QAction *KgpgOpenManager = actionCollection()->addAction(QLatin1String("kgpg_manager"), this, SLOT(show()));
KgpgOpenManager->setIcon(KIcon( QLatin1String( "kgpg" )));
@@ -2714,7 +2715,7 @@ KeysManager::showTrayMessage(const QString &message)
KShortcut
KeysManager::goDefaultShortcut() const
{
- return goToDefaultKey->shortcut();
+ return KShortcut(goToDefaultKey->shortcut());
}
void
@@ -2728,7 +2729,7 @@ KeysManager::clipEncrypt()
return;
}
- QPointer<KgpgSelectPublicKeyDlg> dialog = new KgpgSelectPublicKeyDlg(this, imodel, goToDefaultKey->shortcut(), true);
+ QPointer<KgpgSelectPublicKeyDlg> dialog = new KgpgSelectPublicKeyDlg(this, imodel, KShortcut(goToDefaultKey->shortcut()), true);
if (dialog->exec() == KDialog::Accepted) {
KGpgEncrypt::EncryptOptions encOptions = KGpgEncrypt::AsciiArmored;
QStringList options;
diff --git a/keysmanager.h b/keysmanager.h
index 721be72..318c0fd 100644
--- a/keysmanager.h
+++ b/keysmanager.h
@@ -35,7 +35,7 @@ class QEvent;
class KSelectAction;
class KMenu;
class KLineEdit;
-class KAction;
+class QAction;
class KJob;
class KShortcut;
@@ -257,28 +257,28 @@ private:
KLineEdit *m_listviewsearch;
KDialog *addUidWidget;
- KAction *importSignatureKey;
- KAction *importAllSignKeys;
- KAction *signKey;
- KAction *signUid;
- KAction *signMailUid;
- KAction *refreshKey;
- KAction *editKey;
- KAction *setPrimUid;
- KAction *delUid;
- KAction *delSignKey;
- KAction *deleteKey;
- KAction *editCurrentGroup;
- KAction *delGroup;
- KAction *setDefaultKey;
- KAction *kserver;
- KAction *openEditor;
- KAction *goToDefaultKey;
- KAction *exportPublicKey;
- KAction *m_sendEmail;
- KAction *createGroup;
- KAction *m_groupRename;
- KAction *m_revokeKey;
+ QAction *importSignatureKey;
+ QAction *importAllSignKeys;
+ QAction *signKey;
+ QAction *signUid;
+ QAction *signMailUid;
+ QAction *refreshKey;
+ QAction *editKey;
+ QAction *setPrimUid;
+ QAction *delUid;
+ QAction *delSignKey;
+ QAction *deleteKey;
+ QAction *editCurrentGroup;
+ QAction *delGroup;
+ QAction *setDefaultKey;
+ QAction *kserver;
+ QAction *openEditor;
+ QAction *goToDefaultKey;
+ QAction *exportPublicKey;
+ QAction *m_sendEmail;
+ QAction *createGroup;
+ QAction *m_groupRename;
+ QAction *m_revokeKey;
bool showTipOfDay;
bool m_signuids;
diff --git a/kgpg.cpp b/kgpg.cpp
index 8796eb9..be586cf 100644
--- a/kgpg.cpp
+++ b/kgpg.cpp
@@ -18,13 +18,15 @@
#include "gpgproc.h"
#include "kgpgsettings.h"
#include "keysmanager.h"
-#include "kgpg_interface.h"
+// #include "kgpg_interface.h" FIXME: KF5
#include "kgpgexternalactions.h"
#include "kgpginterface.h"
#include "core/images.h"
#include "editor/kgpgeditor.h"
#include "transactions/kgpgimport.h"
+#include <QFile>
+
#include <KCmdLineArgs>
#include <KMessageBox>
#include <KWindowSystem>
diff --git a/kgpgexternalactions.cpp b/kgpgexternalactions.cpp
index 50c2cd3..ea7c169 100644
--- a/kgpgexternalactions.cpp
+++ b/kgpgexternalactions.cpp
@@ -36,7 +36,7 @@
#include <KActionCollection>
#include <KMessageBox>
#include <KTemporaryFile>
-#include <KToolInvocation>
+#include <KHelpClient>
#include <QFont>
#include <QProcess>
#include <QStringListModel>
@@ -197,12 +197,12 @@ void KGpgExternalActions::startFolderEncode()
if (dialog->getUntrusted())
encOptions |= KGpgEncrypt::AllowUntrustedEncryption;
- KUrl encryptedFile(KUrl::fromPath(urls.first().path(KUrl::RemoveTrailingSlash) + extension));
+ QUrl encryptedFile(KUrl::fromPath(urls.first().path(KUrl::RemoveTrailingSlash) + extension));
QFile encryptedFolder(encryptedFile.path());
dialog->hide();
if (encryptedFolder.exists()) {
QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(m_keysmanager, i18n("File Already Exists"),
- KUrl(), encryptedFile, KIO::M_OVERWRITE);
+ QUrl(), encryptedFile, KIO::RenameDialog_Overwrite);
if (over->exec() == QDialog::Rejected) {
dialog = Q_NULLPTR;
delete over;
@@ -360,11 +360,11 @@ void KGpgExternalActions::decryptFile(KUrl::List urls)
else
oldname.append(QLatin1String( ".clear" ));
- KUrl swapname(first.directory(KUrl::AppendTrailingSlash) + oldname);
+ QUrl swapname(first.directory(KUrl::AppendTrailingSlash) + oldname);
QFile fgpg(swapname.path());
if (fgpg.exists()) {
QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(m_keysmanager,
- i18n("File Already Exists"), KUrl(), swapname, KIO::M_OVERWRITE);
+ i18n("File Already Exists"), QUrl(), swapname, KIO::RenameDialog_Overwrite);
if (over->exec() != QDialog::Accepted) {
delete over;
urls.pop_front();
@@ -482,10 +482,10 @@ void KGpgExternalActions::slotSaveOptionsPath()
void KGpgExternalActions::help()
{
- KToolInvocation::invokeHelp(QString(), QLatin1String( "kgpg" ));
+ KHelpClient::invokeHelp(QString(), QLatin1String( "kgpg" ));
}
KShortcut KGpgExternalActions::goDefaultKey() const
{
- return qobject_cast<KAction *>(m_keysmanager->actionCollection()->action(QLatin1String( "go_default_key" )))->shortcut();
+ return KShortcut(qobject_cast<QAction *>(m_keysmanager->actionCollection()->action(QLatin1String( "go_default_key" )))->shortcut());
}
diff --git a/kgpgoptions.cpp b/kgpgoptions.cpp
index 57d1bf3..50112bf 100644
--- a/kgpgoptions.cpp
+++ b/kgpgoptions.cpp
@@ -95,7 +95,7 @@ kgpgOptions::kgpgOptions(QWidget *parent, KGpgItemModel *model)
m_mailUats = KGpgSettings::mailUats();
QVBoxLayout *fontlayout = new QVBoxLayout(m_page3->tabWidget3->widget(1));
- fontlayout->setSpacing(spacingHint());
+// fontlayout->setSpacing(spacingHint()); FIXME: KF5
m_fontchooser->setObjectName( QLatin1String("kcfg_Font" ));
fontlayout->addWidget(m_fontchooser);
@@ -222,13 +222,13 @@ void kgpgOptions::slotAddKeyServer()
m_serverModel->setStringList(m_serverModel->stringList() << newServer);
- enableButtonApply(true);
+// enableButtonApply(true); FIXME: KF5
}
void kgpgOptions::slotChangeEncryptTo()
{
bool enable = (m_page1->encrypt_to_always->isChecked() != m_encrypttoalways);
- enableButtonApply(enable);
+// enableButtonApply(enable); FIXME: KF5
}
void kgpgOptions::slotDelKeyServer()
@@ -236,7 +236,7 @@ void kgpgOptions::slotDelKeyServer()
QModelIndex cur = m_page6->ServerBox->selectionModel()->currentIndex();
m_serverModel->removeRows(cur.row(), 1);
- enableButtonApply(true);
+// enableButtonApply(true); FIXME: KF5
}
void kgpgOptions::slotEditKeyServer()
@@ -251,7 +251,7 @@ void kgpgOptions::slotEditKeyServer(const QModelIndex &index)
m_page6->ServerBox->edit(index);
- enableButtonApply(true);
+// enableButtonApply(true); FIXME: KF5
}
void kgpgOptions::slotDefaultKeyServer()
@@ -260,7 +260,7 @@ void kgpgOptions::slotDefaultKeyServer()
m_serverModel->setDefault(cur.row());
- enableButtonApply(true);
+// enableButtonApply(true); FIXME: KF5
}
void kgpgOptions::slotChangeKeyServerButtonEnable()
diff --git a/klinebufferedprocess.cpp b/klinebufferedprocess.cpp
index adca814..2c0b627 100644
--- a/klinebufferedprocess.cpp
+++ b/klinebufferedprocess.cpp
@@ -13,35 +13,6 @@
#include "klinebufferedprocess.h"
-class KLineBufferedProcessPrivate
-{
-public:
- KLineBufferedProcessPrivate(KLineBufferedProcess *parent);
-
-//private slot implementations
- void _k_receivedStdout();
- void _k_receivedStderr();
-
- QByteArray m_stdoutBuffer;
- QByteArray m_stderrBuffer;
- int m_newlineInStdout;
- int m_newlineInStderr;
- KLineBufferedProcess * const m_parent;
- const QByteArray m_lineEnd;
-};
-
-KLineBufferedProcessPrivate::KLineBufferedProcessPrivate(KLineBufferedProcess *parent)
- : m_newlineInStdout(-1),
- m_newlineInStderr(-1),
- m_parent(parent),
-#ifdef Q_OS_WIN32 //krazy:exclude=cpp
- m_lineEnd("\r\n")
-#else
- m_lineEnd("\n")
-#endif
-{
-}
-
KLineBufferedProcess::KLineBufferedProcess(QObject *parent)
: KProcess(parent),
d(new KLineBufferedProcessPrivate(this))
@@ -55,36 +26,6 @@ KLineBufferedProcess::~KLineBufferedProcess()
delete d;
}
-void KLineBufferedProcessPrivate::_k_receivedStdout()
-{
- QByteArray ndata = m_parent->readAllStandardOutput();
- int oldBufferSize = m_stdoutBuffer.size();
- m_stdoutBuffer.append(ndata);
-
- if (m_newlineInStdout < 0) {
- m_newlineInStdout = ndata.indexOf(m_lineEnd);
- if (m_newlineInStdout >= 0) {
- m_newlineInStdout += oldBufferSize;
- emit m_parent->lineReadyStandardOutput();
- }
- }
-}
-
-void KLineBufferedProcessPrivate::_k_receivedStderr()
-{
- QByteArray ndata = m_parent->readAllStandardError();
- int oldBufferSize = m_stderrBuffer.size();
- m_stderrBuffer.append(ndata);
-
- if (m_newlineInStderr < 0) {
- m_newlineInStderr = ndata.indexOf(m_lineEnd);
- if (m_newlineInStderr >= 0) {
- m_newlineInStderr += oldBufferSize;
- emit m_parent->lineReadyStandardError();
- }
- }
-}
-
bool KLineBufferedProcess::readLineStandardOutput(QByteArray *line)
{
if (d->m_newlineInStdout < 0) {
diff --git a/klinebufferedprocess.h b/klinebufferedprocess.h
index f1f4a26..2750d1f 100644
--- a/klinebufferedprocess.h
+++ b/klinebufferedprocess.h
@@ -16,10 +16,10 @@
#include <KProcess>
-#include <kgpgcompiler.h>
+#include "kgpgcompiler.h"
+#include "klinebufferedprocessprivate.h"
class QByteArray;
-class KLineBufferedProcessPrivate;
/**
* Read output of a process split into lines
diff --git a/main.cpp b/main.cpp
index 4d92b3b..55ee016 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,7 +15,7 @@
#include "kgpg.h"
-#include <KAboutData>
+#include <K4AboutData>
#include <KCmdLineArgs>
#include <KLocale>
#include <KUniqueApplication>
@@ -27,7 +27,7 @@ static const char version[] = "2.17.40";
int main(int argc, char *argv[])
{
- KAboutData about("kgpg", 0, ki18n("KGpg"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2003 Jean-Baptiste Mardelle"), KLocalizedString(), "http://utils.kde.org/projects/kgpg");
+ K4AboutData about("kgpg", 0, ki18n("KGpg"), version, ki18n(description), K4AboutData::License_GPL, ki18n("(C) 2003 Jean-Baptiste Mardelle"), KLocalizedString(), "http://utils.kde.org/projects/kgpg");
about.addAuthor(ki18n("Jean-Baptiste Mardelle"), ki18n("Author and former maintainer"), "bj@altern.org");
about.addAuthor(ki18n("Jimmy Gilles"), KLocalizedString(), "jimmygilles@gmail.com");
about.addAuthor(ki18n("Rolf Eike Beer"), ki18n("Maintainer"), "kde@opensource.sf-tec.de");
diff --git a/selectpublickeydialog.cpp b/selectpublickeydialog.cpp
index 5b2b61f..7711449 100644
--- a/selectpublickeydialog.cpp
+++ b/selectpublickeydialog.cpp
@@ -21,7 +21,7 @@
#include "model/kgpgitemmodel.h"
#include "model/selectkeyproxymodel.h"
-#include <KAction>
+#include <QAction>
#include <KActionCollection>
#include <KHBox>
#include <KLineEdit>
@@ -133,9 +133,9 @@ KgpgSelectPublicKeyDlg::KgpgSelectPublicKeyDlg(QWidget *parent, KGpgItemModel *m
}
KActionCollection *actcol = new KActionCollection(this);
- KAction *action = actcol->addAction(QLatin1String( "go_default_key" ));
+ QAction *action = actcol->addAction(QLatin1String( "go_default_key" ));
action->setText(i18n("&Go to Default Key"));
- action->setShortcut(goDefaultKey);
+// action->setShortcut(goDefaultKey); FIXME: KF5
connect(action, SIGNAL(triggered(bool)), SLOT(slotGotoDefaultKey()));
connect(m_cbsymmetric, SIGNAL(toggled(bool)), this, SLOT(slotSymmetric(bool)));
diff --git a/transactions/kgpgadduid.cpp b/transactions/kgpgadduid.cpp
index 70e7e46..f3c9dfa 100644
--- a/transactions/kgpgadduid.cpp
+++ b/transactions/kgpgadduid.cpp
@@ -13,7 +13,7 @@
#include "kgpgadduid.h"
-#include <kpimutils/email.h>
+#include <KEmailAddress>
KGpgAddUid::KGpgAddUid(QObject *parent, const QString &keyid, const QString &name, const QString &email, const QString &comment)
: KGpgEditKeyTransaction(parent, keyid, QLatin1String("adduid"), false, true)
@@ -33,7 +33,7 @@ KGpgAddUid::preStart()
if (!KGpgEditKeyTransaction::preStart())
return false;
- if (!m_email.isEmpty() && !KPIMUtils::isValidSimpleAddress(m_email)) {
+ if (!m_email.isEmpty() && !KEmailAddress::isValidSimpleAddress(m_email)) {
setSuccess(TS_INVALID_EMAIL);
return false;
}
diff --git a/transactions/kgpggeneratekey.cpp b/transactions/kgpggeneratekey.cpp
index 30cc355..d0eec59 100644
--- a/transactions/kgpggeneratekey.cpp
+++ b/transactions/kgpggeneratekey.cpp
@@ -16,7 +16,7 @@
#include "gpgproc.h"
#include <KLocale>
-#include <kpimutils/email.h>
+#include <KEmailAddress>
#include <QApplication>
KGpgGenerateKey::KGpgGenerateKey(QObject *parent, const QString &name, const QString &email, const QString &comment,
@@ -51,7 +51,7 @@ KGpgGenerateKey::~KGpgGenerateKey()
bool
KGpgGenerateKey::preStart()
{
- if (!m_email.isEmpty() && !KPIMUtils::isValidSimpleAddress(m_email)) {
+ if (!m_email.isEmpty() && !KEmailAddress::isValidSimpleAddress(m_email)) {
setSuccess(TS_INVALID_EMAIL);
return false;
}
diff --git a/transactions/kgpgtransaction.cpp b/transactions/kgpgtransaction.cpp
index adf2c5a..195cc14 100644
--- a/transactions/kgpgtransaction.cpp
+++ b/transactions/kgpgtransaction.cpp
@@ -30,92 +30,6 @@
#include <QWeakPointer>
#include <QWidget>
-class KGpgTransactionPrivate {
-public:
- KGpgTransactionPrivate(KGpgTransaction *parent, bool allowChaining);
- ~KGpgTransactionPrivate();
-
- KGpgTransaction *m_parent;
- GPGProc *m_process;
- KGpgTransaction *m_inputTransaction;
- KNewPasswordDialog *m_newPasswordDialog;
- KPasswordDialog *m_passwordDialog;
- int m_success;
- int m_tries;
- QString m_description;
- bool m_chainingAllowed;
-
- QStringList m_idhints;
-
- KUrl m_overwriteUrl; ///< the file to overwrite or it's new name
-
- void slotReadReady();
- void slotProcessExited();
- void slotProcessStarted();
- void slotInputTransactionDone(int result);
- void slotPassphraseEntered(const QString &passphrase);
- /**
- * @brief a slot to handle the case that the passphrase entry was aborted by the user
- *
- * This will delete the sender as well as do the internal passphrase aborted handling.
- */
- void slotPassphraseAborted();
- /**
- * @brief do the internal passphrase aborted handling
- */
- void handlePassphraseAborted();
-
- QList<int *> m_argRefs;
- bool m_inputProcessDone;
- int m_inputProcessResult;
- bool m_ownProcessFinished;
-
- /**
- * terminate GnuPG session
- */
- void sendQuit(void);
-
- void write(const QByteArray &a);
-
- static const QStringList &hintNames(void);
-
-private:
- void processDone();
-
- unsigned int m_quitTries; ///< how many times we tried to quit
- QStringList m_quitLines; ///< what we received after we tried to quit
-};
-
-KGpgTransactionPrivate::KGpgTransactionPrivate(KGpgTransaction *parent, bool allowChaining)
- : m_parent(parent),
- m_process(new GPGProc()),
- m_inputTransaction(Q_NULLPTR),
- m_newPasswordDialog(Q_NULLPTR),
- m_passwordDialog(Q_NULLPTR),
- m_success(KGpgTransaction::TS_OK),
- m_tries(3),
- m_chainingAllowed(allowChaining),
- m_inputProcessDone(false),
- m_inputProcessResult(KGpgTransaction::TS_OK),
- m_ownProcessFinished(false),
- m_quitTries(0)
-{
-}
-
-KGpgTransactionPrivate::~KGpgTransactionPrivate()
-{
- if (m_newPasswordDialog) {
- m_newPasswordDialog->close();
- m_newPasswordDialog->deleteLater();
- }
- if (m_process->state() == QProcess::Running) {
- m_process->closeWriteChannel();
- m_process->terminate();
- }
- delete m_inputTransaction;
- delete m_process;
-}
-
KGpgTransaction::KGpgTransaction(QObject *parent, const bool allowChaining)
: QObject(parent),
d(new KGpgTransactionPrivate(this, allowChaining))
@@ -187,8 +101,8 @@ KGpgTransactionPrivate::slotReadReady()
if ((answer == KGpgTransaction::BA_UNKNOWN) && !m_overwriteUrl.isEmpty()) {
QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(qobject_cast<QWidget *>(m_parent->parent()),
- i18n("File Already Exists"), KUrl(),
- m_overwriteUrl, KIO::M_OVERWRITE);
+ i18n("File Already Exists"), QUrl(),
+ m_overwriteUrl, KIO::RenameDialog_Overwrite);
m_overwriteUrl.clear();
@@ -435,7 +349,7 @@ KGpgTransaction::askNewPassphrase(const QString& text)
d->m_newPasswordDialog->setAllowEmptyPasswords(false);
connect(d->m_newPasswordDialog, SIGNAL(newPassword(QString)), SLOT(slotPassphraseEntered(QString)));
connect(d->m_newPasswordDialog, SIGNAL(rejected()), SLOT(slotPassphraseAborted()));
- connect(d->m_process, SIGNAL(processExited()), d->m_newPasswordDialog->button(KDialog::Cancel), SLOT(click()));
+// connect(d->m_process, SIGNAL(processExited()), d->m_newPasswordDialog->button(KDialog::Cancel), SLOT(click())); FIXME: KF5
d->m_newPasswordDialog->show();
}
@@ -645,7 +559,7 @@ KGpgTransaction::askPassphrase(const QString &message)
connect(d->m_passwordDialog, SIGNAL(gotPassword(QString,bool)), SLOT(slotPassphraseEntered(QString)));
connect(d->m_passwordDialog, SIGNAL(rejected()), SLOT(slotPassphraseAborted()));
- connect(d->m_process, SIGNAL(processExited()), d->m_passwordDialog->button(KDialog::Cancel), SLOT(click()));
+// connect(d->m_process, SIGNAL(processExited()), d->m_passwordDialog->button(KDialog::Cancel), SLOT(click())); // FIXME: KF5
} else {
// we already have a dialog, so this is a "bad passphrase" situation
--d->m_tries;
diff --git a/transactions/kgpgtransaction.h b/transactions/kgpgtransaction.h
index 1989871..4642d23 100644
--- a/transactions/kgpgtransaction.h
+++ b/transactions/kgpgtransaction.h
@@ -17,7 +17,8 @@
#include <QObject>
#include <QString>
-#include <kgpgcompiler.h>
+#include "kgpgcompiler.h"
+#include "kgpgtransactionprivate.h"
class GPGProc;
class KGpgSignTransactionHelper;