| 22 #include <glib.h> |
22 #include <glib.h> |
| 23 #include <glib/gi18n-lib.h> |
23 #include <glib/gi18n-lib.h> |
| 24 |
24 |
| 25 #include <purple.h> |
25 #include <purple.h> |
| 26 |
26 |
| 27 #include <QCoreApplication> |
27 #include <QGuiApplication> |
| 28 |
28 |
| 29 #include <kwallet.h> |
29 #include <kwallet.h> |
| 30 |
30 |
| 31 #include "purplekwallet.h" |
31 #include "purplekwallet.h" |
| 32 |
32 |
| 33 /****************************************************************************** |
33 /****************************************************************************** |
| 34 * Globals |
34 * Globals |
| 35 *****************************************************************************/ |
35 *****************************************************************************/ |
| 36 static QCoreApplication *qCoreApp = NULL; |
36 static QGuiApplication *guiApp = NULL; |
| 37 static PurpleCredentialProvider *instance = NULL; |
37 static PurpleCredentialProvider *instance = NULL; |
| |
38 static char *argv[] = { |
| |
39 (char*)"purplekwallet", |
| |
40 }; |
| |
41 static int argc = G_N_ELEMENTS(argv); |
| 38 |
42 |
| 39 #define PURPLE_KWALLET_DOMAIN (g_quark_from_static_string("purple-kwallet")) |
43 #define PURPLE_KWALLET_DOMAIN (g_quark_from_static_string("purple-kwallet")) |
| 40 #define PURPLE_KWALLET_WALLET_NAME (KWallet::Wallet::NetworkWallet()) |
44 #define PURPLE_KWALLET_WALLET_NAME (KWallet::Wallet::NetworkWallet()) |
| 41 |
45 |
| 42 struct _PurpleKWalletProvider { |
46 struct _PurpleKWalletProvider { |
| 567 kwallet_load(GPluginPlugin *plugin, GError **error) { |
571 kwallet_load(GPluginPlugin *plugin, GError **error) { |
| 568 PurpleCredentialManager *manager = NULL; |
572 PurpleCredentialManager *manager = NULL; |
| 569 |
573 |
| 570 purple_kwallet_provider_register_type(G_TYPE_MODULE(plugin)); |
574 purple_kwallet_provider_register_type(G_TYPE_MODULE(plugin)); |
| 571 |
575 |
| 572 if(qCoreApp == NULL) { |
576 if(guiApp == NULL) { |
| 573 int argc = 0; |
577 guiApp = new QGuiApplication(argc, argv); |
| 574 qCoreApp = new QCoreApplication(argc, NULL); |
578 guiApp->setApplicationName(purple_kwallet_get_ui_name()); |
| 575 qCoreApp->setApplicationName(purple_kwallet_get_ui_name()); |
|
| 576 } |
579 } |
| 577 |
580 |
| 578 if(!KWallet::Wallet::isEnabled()) { |
581 if(!KWallet::Wallet::isEnabled()) { |
| 579 g_set_error(error, PURPLE_KWALLET_DOMAIN, 0, |
582 g_set_error(error, PURPLE_KWALLET_DOMAIN, 0, |
| 580 "KWallet service is disabled."); |
583 "KWallet service is disabled."); |