File indexing completed on 2024-11-24 03:41:05
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2013 Valentin Rusu <kde@rusu.info> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KNEWWALLETDIALOG_H 0009 #define KNEWWALLETDIALOG_H 0010 0011 #include <QWizard> 0012 0013 #include "ui_knewwalletdialoggpg.h" 0014 #include "ui_knewwalletdialogintro.h" 0015 0016 namespace GpgME 0017 { 0018 class Key; 0019 } 0020 0021 namespace KWallet 0022 { 0023 class KNewWalletDialogIntro; 0024 class KNewWalletDialogGpg; 0025 0026 class KNewWalletDialog : public QWizard 0027 { 0028 Q_OBJECT 0029 public: 0030 KNewWalletDialog(const QString &appName, const QString &walletName, QWidget *parent = nullptr); 0031 0032 bool isBlowfish() const; 0033 int gpgId() const 0034 { 0035 return _gpgId; 0036 } 0037 GpgME::Key gpgKey() const; 0038 0039 private: 0040 KNewWalletDialogIntro *_intro = nullptr; 0041 int _introId = 0; 0042 KNewWalletDialogGpg *_gpg = nullptr; 0043 int _gpgId = 0; 0044 }; 0045 0046 class KNewWalletDialogIntro : public QWizardPage 0047 { 0048 Q_OBJECT 0049 public: 0050 KNewWalletDialogIntro(const QString &appName, const QString &walletName, QWidget *parent = nullptr); 0051 bool isBlowfish() const; 0052 int nextId() const override; 0053 protected Q_SLOTS: 0054 void onBlowfishToggled(bool); 0055 0056 private: 0057 Ui_KNewWalletDialogIntro _ui; 0058 }; 0059 0060 class KNewWalletDialogGpg : public QWizardPage 0061 { 0062 Q_OBJECT 0063 public: 0064 explicit KNewWalletDialogGpg(QWidget *parent = nullptr); 0065 void initializePage() override; 0066 bool isComplete() const override; 0067 virtual bool validateCurrentPage(); 0068 protected Q_SLOTS: 0069 void onItemSelectionChanged(); 0070 0071 private: 0072 bool _alreadyInitialized = false; 0073 Ui_KNewWalletDialogGpg _ui; 0074 bool _complete = false; 0075 }; 0076 0077 } // namespace 0078 0079 #endif // KNEWWALLETDIALOG_H