Merged in default (pull request #565)
kwallet updates
Approved-by: Elliott Sales de Andrade
Approved-by: John Bailey
--- a/libpurple/plugins/keyrings/kwallet.cpp Wed Oct 02 20:27:30 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,576 +0,0 @@
- * @file kwallet.cpp KWallet password storage
- * 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
- * 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 <QCoreApplication>
-#define KWALLET_NAME N_("KWallet")
-#define KWALLET_DESCRIPTION N_("This plugin will store passwords in KWallet.")
-#define KWALLET_AUTHORS { "QuLogic (qulogic[at]pidgin.im)", NULL }
-#define KWALLET_ID "keyring-kwallet"
-#define KWALLET_DOMAIN (g_quark_from_static_string(KWALLET_ID))
-#define KWALLET_WALLET_NAME KWallet::Wallet::NetworkWallet()
-#define KWALLET_APP_NAME "Libpurple"
-#define KWALLET_FOLDER_NAME "libpurple"
-PurpleKeyring *keyring_handler = NULL;
-QCoreApplication *qCoreApp = NULL;
-namespace KWalletPlugin {
- virtual void detailedAbort(enum PurpleKeyringError error) = 0;
- virtual void execute(KWallet::Wallet *wallet) = 0;
- PurpleAccount *account;
-class engine : private QObject, private QQueue<request*>
- void queue(request *req);
- static engine *instance(bool create);
- static void closeInstance(void);
- void walletOpened(bool opened);
- static engine *pinstance;
- KWallet::Wallet *wallet;
- void executeRequests();
-class save_request : public request
- save_request(PurpleAccount *account, const char *password,
- PurpleKeyringSaveCallback cb, void *data);
- void detailedAbort(enum PurpleKeyringError error);
- void execute(KWallet::Wallet *wallet);
- PurpleKeyringSaveCallback callback;
-class read_request : public request
- read_request(PurpleAccount *account,
- PurpleKeyringReadCallback cb, void *data);
- void detailedAbort(enum PurpleKeyringError error);
- void execute(KWallet::Wallet *wallet);
- PurpleKeyringReadCallback callback;
-kwallet_is_enabled(void)
- return KWallet::Wallet::isEnabled() ? TRUE : FALSE;
-KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL;
-KWalletPlugin::request::~request()
-KWalletPlugin::request::abort()
- detailedAbort(PURPLE_KEYRING_ERROR_CANCELLED);
-KWalletPlugin::engine::engine()
- externallyClosed = false;
- closeAfterBusy = false;
-KWalletPlugin::engine::reopenWallet()
- purple_debug_error("keyring-kwallet",
- "wallet is closing right now\n");
- externallyClosed = false;
- wallet = KWallet::Wallet::openWallet(KWALLET_WALLET_NAME, 0,
- KWallet::Wallet::Asynchronous);
- purple_debug_error("keyring-kwallet",
- "failed opening a wallet\n");
- failed |= !connect(wallet, SIGNAL(walletClosed()),
- failed |= !connect(wallet, SIGNAL(walletOpened(bool)),
- SLOT(walletOpened(bool)));
- purple_debug_error("keyring-kwallet",
- "failed connecting to wallet signal\n");
-KWalletPlugin::engine::~engine()
-KWalletPlugin::engine::abortAll()
- request *req = dequeue();
- if (abortedCount > 0) {
- purple_debug_info("keyring-kwallet", "aborted requests: %d\n",
-KWalletPlugin::engine::instance(bool create)
- if (pinstance == NULL && create)
- pinstance = new engine;
-KWalletPlugin::engine::closeInstance(void)
- if (pinstance->closing)
- purple_debug_misc("keyring-kwallet",
- "current instance is busy, will be freed later\n");
- pinstance->closeAfterBusy = true;
-KWalletPlugin::engine::walletOpened(bool opened)
- purple_debug_warning("keyring-kwallet",
- "failed to open a wallet\n");
- if (!wallet->hasFolder(KWALLET_FOLDER_NAME)) {
- if (!wallet->createFolder(KWALLET_FOLDER_NAME)) {
- purple_debug_error("keyring-kwallet",
- "couldn't create \"" KWALLET_FOLDER_NAME
- "\" folder in wallet\n");
- wallet->setFolder(KWALLET_FOLDER_NAME);
-KWalletPlugin::engine::walletClosed()
- purple_debug_info("keyring-kwallet",
- "wallet was externally closed\n");
- externallyClosed = true;
-KWalletPlugin::engine::queue(request *req)
-KWalletPlugin::engine::executeRequests()
- if (externallyClosed) {
- } else if (connected || failed) {
- request *req = dequeue();
- } else if (purple_debug_is_verbose()) {
- purple_debug_misc("keyring-kwallet", "not yet connected\n");
- purple_debug_misc("keyring-kwallet",
- "instance freed after being busy\n");
-KWalletPlugin::save_request::save_request(PurpleAccount *acc, const char *pw,
- PurpleKeyringSaveCallback cb, void *userdata)
- password = QString(pw);
- noPassword = (pw == NULL);
-KWalletPlugin::read_request::read_request(PurpleAccount *acc,
- PurpleKeyringReadCallback cb, void *userdata)
-KWalletPlugin::save_request::detailedAbort(enum PurpleKeyringError error)
- gerror = g_error_new(PURPLE_KEYRING_ERROR, error,
- _("Failed to save password."));
- callback(account, gerror, data);
-KWalletPlugin::read_request::detailedAbort(enum PurpleKeyringError error)
- gerror = g_error_new(PURPLE_KEYRING_ERROR, error,
- _("Failed to read password."));
- callback(account, NULL, gerror, data);
-kwallet_account_key(PurpleAccount *account)
- return QString(purple_account_get_protocol_id(account)) + ":" +
- purple_account_get_username(account);
-KWalletPlugin::read_request::execute(KWallet::Wallet *wallet)
- g_return_if_fail(wallet != NULL);
- result = wallet->readPassword(kwallet_account_key(account), password);
- purple_debug_warning("keyring-kwallet",
- "failed to read password, result was %d\n", result);
- purple_debug_misc("keyring-kwallet",
- "Got password for account %s (%s).\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
- callback(account, password.toUtf8().constData(), NULL, data);
-KWalletPlugin::save_request::execute(KWallet::Wallet *wallet)
- g_return_if_fail(wallet != NULL);
- result = wallet->removeEntry(kwallet_account_key(account));
- result = wallet->writePassword(kwallet_account_key(account),
- purple_debug_warning("keyring-kwallet",
- "failed to write password, result was %d\n", result);
- purple_debug_misc("keyring-kwallet",
- "Password %s for account %s (%s).\n",
- (noPassword ? "removed" : "saved"),
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
- callback(account, NULL, data);
-kwallet_read(PurpleAccount *account, PurpleKeyringReadCallback cb,
- KWalletPlugin::read_request *req =
- new KWalletPlugin::read_request(account, cb, data);
- if (KWallet::Wallet::keyDoesNotExist(KWALLET_WALLET_NAME,
- KWALLET_FOLDER_NAME, kwallet_account_key(account)))
- req->detailedAbort(PURPLE_KEYRING_ERROR_NOPASSWORD);
- KWalletPlugin::engine::instance(true)->queue(req);
-kwallet_save(PurpleAccount *account, const char *password,
- PurpleKeyringSaveCallback cb, gpointer data)
- if (password == NULL && KWallet::Wallet::keyDoesNotExist(
- KWALLET_WALLET_NAME, KWALLET_FOLDER_NAME,
- kwallet_account_key(account)))
- cb(account, NULL, data);
- KWalletPlugin::engine::instance(true)->queue(
- new KWalletPlugin::save_request(account, password, cb,
- KWalletPlugin::engine *instance =
- KWalletPlugin::engine::instance(false);
-kwallet_get_handle(void)
-static const char *kwallet_get_ui_name(void)
- const char *ui_name = NULL;
- ui_info = purple_core_get_ui_info();
- ui_name = (const char*)g_hash_table_lookup(ui_info, "name");
- ui_name = KWALLET_APP_NAME;
-static PurplePluginInfo *
-plugin_query(GError **error)
- const gchar * const authors[] = KWALLET_AUTHORS;
- return purple_plugin_info_new(
- "version", DISPLAY_VERSION,
- "category", N_("Keyring"),
- "summary", "KWallet Keyring Plugin",
- "description", KWALLET_DESCRIPTION,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL,
-plugin_load(PurplePlugin *plugin, GError **error)
- qCoreApp = new QCoreApplication(argc, NULL);
- qCoreApp->setApplicationName(kwallet_get_ui_name());
- if (!kwallet_is_enabled()) {
- g_set_error(error, KWALLET_DOMAIN, 0, "KWallet service is disabled.");
- purple_debug_info("keyring-kwallet",
- "KWallet service is disabled\n");
- keyring_handler = purple_keyring_new();
- purple_keyring_set_name(keyring_handler, _(KWALLET_NAME));
- purple_keyring_set_id(keyring_handler, KWALLET_ID);
- purple_keyring_set_read_password(keyring_handler, kwallet_read);
- purple_keyring_set_save_password(keyring_handler, kwallet_save);
- purple_keyring_set_cancel_requests(keyring_handler, kwallet_cancel);
- purple_keyring_set_close_keyring(keyring_handler,
- KWalletPlugin::engine::closeInstance);
- purple_keyring_register(keyring_handler);
-plugin_unload(PurplePlugin *plugin, GError **error)
- if (purple_keyring_get_inuse() == keyring_handler) {
- g_set_error(error, KWALLET_DOMAIN, 0, "The keyring is currently "
- purple_debug_warning("keyring-kwallet",
- "keyring in use, cannot unload\n");
- purple_signals_disconnect_by_handle(kwallet_get_handle());
- KWalletPlugin::engine::closeInstance();
- purple_keyring_unregister(keyring_handler);
- purple_keyring_free(keyring_handler);
- keyring_handler = NULL;
-PURPLE_PLUGIN_INIT(kwallet_keyring, plugin_query, plugin_load, plugin_unload);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/keyrings/kwallet/meson.build Fri Oct 04 03:36:29 2019 +0000
@@ -0,0 +1,13 @@
+ kwallet_moc = qt5.preprocess( + moc_headers: 'purplekwallet.h', + kwallet_plugin = library('purplekwallet', 'purplekwallet.cpp', 'purplekwallet.h', kwallet_moc, + dependencies : [kwallet, qt5_dep, libpurple_dep], + install : true, install_dir : PURPLE_PLUGINDIR) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/keyrings/kwallet/purplekwallet.cpp Fri Oct 04 03:36:29 2019 +0000
@@ -0,0 +1,500 @@
+ * @file kwallet.cpp KWallet password storage + * 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 + * 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 <QCoreApplication> +#include "purplekwallet.h" +#define KWALLET_NAME N_("KWallet") +#define KWALLET_DESCRIPTION N_("This plugin will store passwords in KWallet.") +#define KWALLET_AUTHORS { "QuLogic (qulogic[at]pidgin.im)", NULL } +#define KWALLET_ID "keyring-kwallet" +#define KWALLET_DOMAIN (g_quark_from_static_string(KWALLET_ID)) +#define KWALLET_WALLET_NAME KWallet::Wallet::NetworkWallet() +#define KWALLET_APP_NAME "Libpurple" +#define KWALLET_FOLDER_NAME "libpurple" +PurpleKeyring *keyring_handler = NULL; +QCoreApplication *qCoreApp = NULL; +kwallet_is_enabled(void) + return KWallet::Wallet::isEnabled() ? TRUE : FALSE; +KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL; +KWalletPlugin::request::~request() +KWalletPlugin::request::abort() + detailedAbort(PURPLE_KEYRING_ERROR_CANCELLED); +KWalletPlugin::engine::engine() + externallyClosed = false; + closeAfterBusy = false; +KWalletPlugin::engine::reopenWallet() + purple_debug_error("keyring-kwallet", + "wallet is closing right now\n"); + externallyClosed = false; + wallet = KWallet::Wallet::openWallet(KWALLET_WALLET_NAME, 0, + KWallet::Wallet::Asynchronous); + purple_debug_error("keyring-kwallet", + "failed opening a wallet\n"); + failed |= !connect(wallet, SIGNAL(walletClosed()), + failed |= !connect(wallet, SIGNAL(walletOpened(bool)), + SLOT(walletOpened(bool))); + purple_debug_error("keyring-kwallet", + "failed connecting to wallet signal\n"); +KWalletPlugin::engine::~engine() +KWalletPlugin::engine::abortAll() + request *req = dequeue(); + if (abortedCount > 0) { + purple_debug_info("keyring-kwallet", "aborted requests: %d\n", +KWalletPlugin::engine::instance(bool create) + if (pinstance == NULL && create) + pinstance = new engine; +KWalletPlugin::engine::closeInstance(void) + if (pinstance->closing) + purple_debug_misc("keyring-kwallet", + "current instance is busy, will be freed later\n"); + pinstance->closeAfterBusy = true; +KWalletPlugin::engine::walletOpened(bool opened) + purple_debug_warning("keyring-kwallet", + "failed to open a wallet\n"); + if (!wallet->hasFolder(KWALLET_FOLDER_NAME)) { + if (!wallet->createFolder(KWALLET_FOLDER_NAME)) { + purple_debug_error("keyring-kwallet", + "couldn't create \"" KWALLET_FOLDER_NAME + "\" folder in wallet\n"); + wallet->setFolder(KWALLET_FOLDER_NAME); +KWalletPlugin::engine::walletClosed() + purple_debug_info("keyring-kwallet", + "wallet was externally closed\n"); + externallyClosed = true; +KWalletPlugin::engine::queue(request *req) +KWalletPlugin::engine::executeRequests() + if (externallyClosed) { + } else if (connected || failed) { + request *req = dequeue(); + } else if (purple_debug_is_verbose()) { + purple_debug_misc("keyring-kwallet", "not yet connected\n"); + purple_debug_misc("keyring-kwallet", + "instance freed after being busy\n"); +KWalletPlugin::save_request::save_request(PurpleAccount *acc, const char *pw, + PurpleKeyringSaveCallback cb, void *userdata) + password = QString(pw); + noPassword = (pw == NULL); +KWalletPlugin::read_request::read_request(PurpleAccount *acc, + PurpleKeyringReadCallback cb, void *userdata) +KWalletPlugin::save_request::detailedAbort(enum PurpleKeyringError error) + gerror = g_error_new(PURPLE_KEYRING_ERROR, error, + _("Failed to save password.")); + callback(account, gerror, data); +KWalletPlugin::read_request::detailedAbort(enum PurpleKeyringError error) + gerror = g_error_new(PURPLE_KEYRING_ERROR, error, + _("Failed to read password.")); + callback(account, NULL, gerror, data); +kwallet_account_key(PurpleAccount *account) + return QString(purple_account_get_protocol_id(account)) + ":" + + purple_account_get_username(account); +KWalletPlugin::read_request::execute(KWallet::Wallet *wallet) + g_return_if_fail(wallet != NULL); + result = wallet->readPassword(kwallet_account_key(account), password); + purple_debug_warning("keyring-kwallet", + "failed to read password, result was %d\n", result); + purple_debug_misc("keyring-kwallet", + "Got password for account %s (%s).\n", + purple_account_get_username(account), + purple_account_get_protocol_id(account)); + callback(account, password.toUtf8().constData(), NULL, data); +KWalletPlugin::save_request::execute(KWallet::Wallet *wallet) + g_return_if_fail(wallet != NULL); + result = wallet->removeEntry(kwallet_account_key(account)); + result = wallet->writePassword(kwallet_account_key(account), + purple_debug_warning("keyring-kwallet", + "failed to write password, result was %d\n", result); + purple_debug_misc("keyring-kwallet", + "Password %s for account %s (%s).\n", + (noPassword ? "removed" : "saved"), + purple_account_get_username(account), + purple_account_get_protocol_id(account)); + callback(account, NULL, data); +kwallet_read(PurpleAccount *account, PurpleKeyringReadCallback cb, + KWalletPlugin::read_request *req = + new KWalletPlugin::read_request(account, cb, data); + if (KWallet::Wallet::keyDoesNotExist(KWALLET_WALLET_NAME, + KWALLET_FOLDER_NAME, kwallet_account_key(account))) + req->detailedAbort(PURPLE_KEYRING_ERROR_NOPASSWORD); + KWalletPlugin::engine::instance(true)->queue(req); +kwallet_save(PurpleAccount *account, const char *password, + PurpleKeyringSaveCallback cb, gpointer data) + if (password == NULL && KWallet::Wallet::keyDoesNotExist( + KWALLET_WALLET_NAME, KWALLET_FOLDER_NAME, + kwallet_account_key(account))) + cb(account, NULL, data); + KWalletPlugin::engine::instance(true)->queue( + new KWalletPlugin::save_request(account, password, cb, + KWalletPlugin::engine *instance = + KWalletPlugin::engine::instance(false); +kwallet_get_handle(void) +static const char *kwallet_get_ui_name(void) + const char *ui_name = NULL; + ui_info = purple_core_get_ui_info(); + ui_name = (const char*)g_hash_table_lookup(ui_info, "name"); + ui_name = KWALLET_APP_NAME; +static PurplePluginInfo * +plugin_query(GError **error) + const gchar * const authors[] = KWALLET_AUTHORS; + return purple_plugin_info_new( + "version", DISPLAY_VERSION, + "category", N_("Keyring"), + "summary", "KWallet Keyring Plugin", + "description", KWALLET_DESCRIPTION, + "website", PURPLE_WEBSITE, + "abi-version", PURPLE_ABI_VERSION, + "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL, +plugin_load(PurplePlugin *plugin, GError **error) + qCoreApp = new QCoreApplication(argc, NULL); + qCoreApp->setApplicationName(kwallet_get_ui_name()); + if (!kwallet_is_enabled()) { + g_set_error(error, KWALLET_DOMAIN, 0, "KWallet service is disabled."); + purple_debug_info("keyring-kwallet", + "KWallet service is disabled\n"); + keyring_handler = purple_keyring_new(); + purple_keyring_set_name(keyring_handler, _(KWALLET_NAME)); + purple_keyring_set_id(keyring_handler, KWALLET_ID); + purple_keyring_set_read_password(keyring_handler, kwallet_read); + purple_keyring_set_save_password(keyring_handler, kwallet_save); + purple_keyring_set_cancel_requests(keyring_handler, kwallet_cancel); + purple_keyring_set_close_keyring(keyring_handler, + KWalletPlugin::engine::closeInstance); + purple_keyring_register(keyring_handler); +plugin_unload(PurplePlugin *plugin, GError **error) + if (purple_keyring_get_inuse() == keyring_handler) { + g_set_error(error, KWALLET_DOMAIN, 0, "The keyring is currently " + purple_debug_warning("keyring-kwallet", + "keyring in use, cannot unload\n"); + purple_signals_disconnect_by_handle(kwallet_get_handle()); + KWalletPlugin::engine::closeInstance(); + purple_keyring_unregister(keyring_handler); + purple_keyring_free(keyring_handler); + keyring_handler = NULL; +PURPLE_PLUGIN_INIT(kwallet_keyring, plugin_query, plugin_load, plugin_unload); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/keyrings/kwallet/purplekwallet.h Fri Oct 04 03:36:29 2019 +0000
@@ -0,0 +1,100 @@
+ * 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 + * 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 +namespace KWalletPlugin { + virtual void detailedAbort(enum PurpleKeyringError error) = 0; + virtual void execute(KWallet::Wallet *wallet) = 0; + PurpleAccount *account; +class engine : private QObject, private QQueue<request*> + void queue(request *req); + static engine *instance(bool create); + static void closeInstance(void); + void walletOpened(bool opened); + static engine *pinstance; + KWallet::Wallet *wallet; + void executeRequests(); +class save_request : public request + save_request(PurpleAccount *account, const char *password, + PurpleKeyringSaveCallback cb, void *data); + void detailedAbort(enum PurpleKeyringError error); + void execute(KWallet::Wallet *wallet); + PurpleKeyringSaveCallback callback; +class read_request : public request + read_request(PurpleAccount *account, + PurpleKeyringReadCallback cb, void *data); + void detailedAbort(enum PurpleKeyringError error); + void execute(KWallet::Wallet *wallet); + PurpleKeyringReadCallback callback; --- a/libpurple/plugins/keyrings/meson.build Wed Oct 02 20:27:30 2019 -0400
+++ b/libpurple/plugins/keyrings/meson.build Fri Oct 04 03:36:29 2019 +0000
@@ -1,4 +1,6 @@
internalkeyring_plugin = library('internalkeyring', 'internalkeyring.c',
dependencies : [nettle, libpurple_dep],
@@ -19,13 +21,4 @@
install : true, install_dir : PURPLE_PLUGINDIR)
- kwallet_moc = moc.process('kwallet.cpp')
- kwallet_plugin = library('kwallet', 'kwallet.cpp', kwallet_moc,
- dependencies : [kwallet, qt4, libpurple_dep],
- install : true, install_dir : PURPLE_PLUGINDIR)
--- a/meson.build Wed Oct 02 20:27:30 2019 -0400
+++ b/meson.build Fri Oct 04 03:36:29 2019 +0000
@@ -690,76 +690,18 @@
#######################################################################
enable_kwallet = get_option('kwallet') and not IS_WIN32
# Ensure C++ compiler works
cxx_compiler = meson.get_compiler('cpp')
- qt4 = dependency('qt4', modules : 'Core', required : force_deps)
- enable_kwallet = qt4.found()
+ add_project_arguments('-DHAVE_CONFIG_H=1', language : 'cpp')
-# AC_MSG_CHECKING([for metaobject compiler])
-# MOC=`$PKG_CONFIG --variable=moc_location QtCore`
-# 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
-#kde4-config not found. $KDE4_CONFIG
-#Use -Dkwallet=false if you do not need KWallet support.
-# if test 'x$KDE4_CONFIG' != 'xno'; then
-# KWALLET_CXXFLAGS='$QT4_CFLAGS -I`$KDE4_CONFIG --path include`'
-# CPPFLAGS='$CPPFLAGS $KWALLET_CXXFLAGS'
-# AC_CHECK_HEADER([kwallet.h], , [
-# enable_kwallet = false
-# if test 'x$force_deps' = 'xyes'; then
-#KWallet development headers not found.
-#Use -Dkwallet=false if you do not need KWallet support.
+ qt5_dep = dependency('qt5', modules: ['Core'])
-# AC_MSG_CHECKING([for KWallet libraries])
-# if test 'x$KDE4_CONFIG' != 'xno'; then
-# KWALLET_LIBS='-L`$KDE4_CONFIG --install lib`/kde4/devel -lkdeui'
-# KWALLET_LIBS='-lkdeui'
-# 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])],
-# enable_kwallet = false
-# if test 'x$force_deps' = 'xyes'; then
-#KWallet development libraries not found.
-#Use -Dkwallet=false if you do not need KWallet support.
+ kwallet = dependency('KF5Wallet') #######################################################################