Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37403685
en ru br
Репозитории ALT

Группа :: Система/Библиотеки
Пакет: kf5-kwallet

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: alt-create-wallet.patch
Скачать


--- kwallet/src/runtime/kwalletd/kwalletd.cpp
+++ kwallet/src/runtime/kwalletd/kwalletd.cpp
@@ -704,8 +704,7 @@ int KWalletD::internalOpen(const QString
                 gpgKey = newWalletDlg->gpgKey();
             } else {
                 // user cancelled the dialog box
-                delete b;
-                return -1;
+                createWithEmptyPassword(b);
             }
 
             if (newWalletType == KWallet::BACKEND_CIPHER_GPG) {
@@ -761,6 +760,7 @@ int KWalletD::internalOpen(const QString
                                                 KWallet::Backend::openRCToString(rc)));
                         }
                     } else {
+                        createWithEmptyPassword(b);
                         break;
                     }
                 }
@@ -1861,6 +1861,27 @@ void KWalletD::activatePasswordDialog()
     checkActiveDialog();
 }
 
+void KWalletD::createWithEmptyPassword(KWallet::Backend *b)
+{
+    b->setCipherType(KWallet::BACKEND_CIPHER_BLOWFISH);
+    QString password = "";
+    int rc = b->open(password.toUtf8());
+    if (!rc) {
+        KNotification::event(KNotification::Warning,
+                             QString(),
+                             i18n("<qt>The wallet was created "
+                                  "with an <b>empty password</b>.</qt>"),
+                                  QApplication::activeWindow());
+    } else {
+        KNotification::event(KNotification::Error,
+                             QString(),
+                             i18n("Error creating the wallet. "
+                                  "Please try again. (Error code %1: %2)",
+                                  rc, KWallet::Backend::openRCToString(rc)),
+                                  QApplication::activeWindow());
+    }
+}
+
 int KWalletD::pamOpen(const QString &wallet, const QByteArray &passwordHash, int sessionTimeout)
 {
     if (_processing) {
--- kwallet/src/runtime/kwalletd/kwalletd.h
+++ kwallet/src/runtime/kwalletd/kwalletd.h
@@ -46,6 +46,9 @@ public:
     // Close and lock the wallet
     // Accepts "message" for working from other QDBusContexts
     int close(int handle, bool force, const QString &appid, const QDBusMessage &message);
+
+    void createWithEmptyPassword(KWallet::Backend *b);
+
 public Q_SLOTS:
 
     // Is the wallet enabled?  If not, all open() calls fail.
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin