pidgin/pidgin

Get the kwallet plugin compiling again

2019-09-26, Gary Kramlich
f977be37ebc0
Parents aa5f0b2be84b
Children 54be9746932e
Get the kwallet plugin compiling again
--- a/libpurple/plugins/keyrings/kwallet.cpp Tue Sep 17 02:35:09 2019 +0000
+++ b/libpurple/plugins/keyrings/kwallet.cpp Thu Sep 26 21:25:14 2019 -0500
@@ -28,13 +28,13 @@
#include "account.h"
#include "core.h"
#include "debug.h"
-#include "keyring.h"
#include "plugins.h"
#include "version.h"
#include <QQueue>
#include <QCoreApplication>
-#include <kwallet.h>
+
+#include "purplekwallet.h"
#define KWALLET_NAME N_("KWallet")
#define KWALLET_DESCRIPTION N_("This plugin will store passwords in KWallet.")
@@ -49,81 +49,6 @@
PurpleKeyring *keyring_handler = NULL;
QCoreApplication *qCoreApp = NULL;
-namespace KWalletPlugin {
-
-class request
-{
- public:
- virtual ~request();
- virtual void detailedAbort(enum PurpleKeyringError error) = 0;
- void abort();
- virtual void execute(KWallet::Wallet *wallet) = 0;
-
- protected:
- gpointer data;
- PurpleAccount *account;
- QString password;
- bool noPassword;
-};
-
-class engine : private QObject, private QQueue<request*>
-{
- Q_OBJECT
-
- public:
- engine();
- ~engine();
- void queue(request *req);
- void abortAll();
- static engine *instance(bool create);
- static void closeInstance(void);
-
- private slots:
- void walletOpened(bool opened);
- void walletClosed();
-
- private:
- static engine *pinstance;
-
- bool connected;
- bool failed;
- bool closing;
- bool externallyClosed;
- bool busy;
- bool closeAfterBusy;
-
- KWallet::Wallet *wallet;
-
- void reopenWallet();
- void executeRequests();
-};
-
-class save_request : public request
-{
- public:
- save_request(PurpleAccount *account, const char *password,
- PurpleKeyringSaveCallback cb, void *data);
- void detailedAbort(enum PurpleKeyringError error);
- void execute(KWallet::Wallet *wallet);
-
- private:
- PurpleKeyringSaveCallback callback;
-};
-
-class read_request : public request
-{
- public:
- read_request(PurpleAccount *account,
- PurpleKeyringReadCallback cb, void *data);
- void detailedAbort(enum PurpleKeyringError error);
- void execute(KWallet::Wallet *wallet);
-
- private:
- PurpleKeyringReadCallback callback;
-};
-
-}
-
static gboolean
kwallet_is_enabled(void)
{
@@ -572,5 +497,3 @@
PURPLE_PLUGIN_INIT(kwallet_keyring, plugin_query, plugin_load, plugin_unload);
} /* extern "C" */
-
-#include "kwallet.moc"
--- a/libpurple/plugins/keyrings/meson.build Tue Sep 17 02:35:09 2019 +0000
+++ b/libpurple/plugins/keyrings/meson.build Thu Sep 26 21:25:14 2019 -0500
@@ -21,10 +21,13 @@
endif
if enable_kwallet
- kwallet_moc = moc.process('kwallet.cpp')
+ kwallet_moc = qt5.preprocess(
+ moc_headers: 'purplekwallet.h',
+ dependencies: qt5_dep,
+ )
- kwallet_plugin = library('kwallet', 'kwallet.cpp', kwallet_moc,
- dependencies : [kwallet, qt4, libpurple_dep],
+ kwallet_plugin = library('kwallet', 'kwallet.cpp', 'purplekwallet.h', kwallet_moc,
+ dependencies : [kwallet, qt5_dep, libpurple_dep],
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/keyrings/purplekwallet.h Thu Sep 26 21:25:14 2019 -0500
@@ -0,0 +1,100 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program ; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+#include "internal.h"
+#include "keyring.h"
+
+#include <kwallet.h>
+#include <QQueue>
+
+namespace KWalletPlugin {
+
+class request
+{
+ public:
+ virtual ~request();
+ virtual void detailedAbort(enum PurpleKeyringError error) = 0;
+ void abort();
+ virtual void execute(KWallet::Wallet *wallet) = 0;
+
+ protected:
+ gpointer data;
+ PurpleAccount *account;
+ QString password;
+ bool noPassword;
+};
+
+class engine : private QObject, private QQueue<request*>
+{
+ Q_OBJECT
+
+ public:
+ engine();
+ ~engine();
+ void queue(request *req);
+ void abortAll();
+ static engine *instance(bool create);
+ static void closeInstance(void);
+
+ private slots:
+ void walletOpened(bool opened);
+ void walletClosed();
+
+ private:
+ static engine *pinstance;
+
+ bool connected;
+ bool failed;
+ bool closing;
+ bool externallyClosed;
+ bool busy;
+ bool closeAfterBusy;
+
+ KWallet::Wallet *wallet;
+
+ void reopenWallet();
+ void executeRequests();
+};
+
+class save_request : public request
+{
+ public:
+ save_request(PurpleAccount *account, const char *password,
+ PurpleKeyringSaveCallback cb, void *data);
+ void detailedAbort(enum PurpleKeyringError error);
+ void execute(KWallet::Wallet *wallet);
+
+ private:
+ PurpleKeyringSaveCallback callback;
+};
+
+class read_request : public request
+{
+ public:
+ read_request(PurpleAccount *account,
+ PurpleKeyringReadCallback cb, void *data);
+ void detailedAbort(enum PurpleKeyringError error);
+ void execute(KWallet::Wallet *wallet);
+
+ private:
+ PurpleKeyringReadCallback callback;
+};
+
+}
--- a/meson.build Tue Sep 17 02:35:09 2019 +0000
+++ b/meson.build Thu Sep 26 21:25:14 2019 -0500
@@ -690,76 +690,18 @@
#######################################################################
enable_kwallet = get_option('kwallet') and not IS_WIN32
-enable_kwallet = false
if enable_kwallet
# Ensure C++ compiler works
add_languages('cpp')
cxx_compiler = meson.get_compiler('cpp')
-
- qt4 = dependency('qt4', modules : 'Core', required : force_deps)
- enable_kwallet = qt4.found()
-endif
+ add_project_arguments('-DHAVE_CONFIG_H=1', language : 'cpp')
-if enable_kwallet
-# AC_MSG_CHECKING([for metaobject compiler])
-# MOC=`$PKG_CONFIG --variable=moc_location QtCore`
-# AC_SUBST(MOC)
-# AC_MSG_RESULT([$MOC])
-#
-# KWALLET_CXXFLAGS=''
-# KWALLET_LIBS=''
-# if test -z '$with_kwallet_includes' || test -z '$with_kwallet_libs'; then
-# AC_CHECK_PROG(KDE4_CONFIG, kde4-config, kde4-config, no)
-# if test 'x$KDE4_CONFIG' = 'xno'; then
-# enable_kwallet = false
-# if test 'x$force_deps' = 'xyes'; then
-# AC_MSG_ERROR([
-#kde4-config not found. $KDE4_CONFIG
-#Use -Dkwallet=false if you do not need KWallet support.
-#])
-# fi
-# fi
-# fi
-endif
+ qt5 = import('qt5')
-if enable_kwallet
-# if test 'x$KDE4_CONFIG' != 'xno'; then
-# KWALLET_CXXFLAGS='$QT4_CFLAGS -I`$KDE4_CONFIG --path include`'
-# fi
-# CPPFLAGS='$CPPFLAGS $KWALLET_CXXFLAGS'
-# AC_CHECK_HEADER([kwallet.h], , [
-# enable_kwallet = false
-# if test 'x$force_deps' = 'xyes'; then
-# AC_MSG_ERROR([
-#KWallet development headers not found.
-#Use -Dkwallet=false if you do not need KWallet support.
-#])
-# fi
-#])
-endif
+ qt5_dep = dependency('qt5', modules: ['Core'])
-if enable_kwallet
-# AC_MSG_CHECKING([for KWallet libraries])
-# if test 'x$KDE4_CONFIG' != 'xno'; then
-# KWALLET_LIBS='-L`$KDE4_CONFIG --install lib`/kde4/devel -lkdeui'
-# else
-# KWALLET_LIBS='-lkdeui'
-# fi
-# KWALLET_LIBS='$KWALLET_LIBS'
-# LIBS='$LIBS $KWALLET_LIBS $QT4_LIBS'
-# AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <kwallet.h>],
-# [KWallet::Wallet::LocalWallet();])], [AC_MSG_RESULT([yes])],
-# [
-# AC_MSG_RESULT(no)
-# enable_kwallet = false
-# if test 'x$force_deps' = 'xyes'; then
-# AC_MSG_ERROR([
-#KWallet development libraries not found.
-#Use -Dkwallet=false if you do not need KWallet support.
-#])
-# fi
-# ])
+ kwallet = dependency('KF5Wallet')
endif
#######################################################################