File indexing completed on 2024-05-19 05:55:47
0001 /* 0002 SPDX-FileCopyrightText: 2003, 2004 George Staikos <staikos@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KWALLETMANAGER_H 0008 #define KWALLETMANAGER_H 0009 0010 #include <KXmlGuiWindow> 0011 0012 #include <QObject> 0013 0014 class KWalletManagerWidget; 0015 class KStatusNotifierItem; 0016 class QListWidgetItem; 0017 class OrgKdeKWalletInterface; 0018 class QAction; 0019 class QCommandLineParser; 0020 0021 class KWalletManager : public KXmlGuiWindow 0022 { 0023 Q_OBJECT 0024 0025 Q_CLASSINFO("D-Bus Interface", "org.kde.kwallet.kwalletmanager") 0026 0027 public: 0028 explicit KWalletManager(QCommandLineParser *commandLineParser); 0029 ~KWalletManager() override; 0030 0031 void kwalletdLaunch(); 0032 bool hasUnsavedChanges(const QString& name = QString()) const; 0033 bool canIgnoreUnsavedChanges(); 0034 void handleActivate(const QStringList& arguments, const QString &workingDirectory); 0035 void handleOpen(const QList<QUrl>& urls); 0036 0037 public Q_SLOTS: 0038 void createWallet(); 0039 void deleteWallet(); 0040 void closeWallet(const QString &walletName); 0041 void changeWalletPassword(const QString &walletName); 0042 void openWallet(const QString &walletName); 0043 void openWalletFile(const QString &path); 0044 // void openWallet(QListWidgetItem *item); 0045 void contextMenu(const QPoint &pos); 0046 void walletCreated(const QString &walletName); 0047 0048 protected: 0049 bool queryClose() override; 0050 0051 private: 0052 public Q_SLOTS: //dbus 0053 Q_SCRIPTABLE void allWalletsClosed(); 0054 Q_SCRIPTABLE void updateWalletDisplay(); 0055 Q_SCRIPTABLE void aWalletWasOpened(); 0056 0057 private Q_SLOTS: 0058 void shuttingDown(); 0059 void possiblyQuit(); 0060 void editorClosed(KXmlGuiWindow *e); 0061 void possiblyRescan(const QString &app, const QString &, const QString &); 0062 void setupWallet(); 0063 void closeAllWallets(); 0064 void exportWallets(); 0065 void importWallets(); 0066 void beginConfiguration(); 0067 void configUI(); 0068 0069 private: 0070 void activateForStartLikeCall(bool showWindow); 0071 void tryOpenWalletFiles(const QStringList &localFiles); 0072 enum CommandLineOrigin { ProgramStart, RemoteCall }; 0073 void processParsedCommandLine(CommandLineOrigin commandLineOrigin); 0074 0075 private: 0076 QCommandLineParser * const _commandLineParser; 0077 KStatusNotifierItem *_tray = nullptr; 0078 bool _shuttingDown = false; 0079 KWalletManagerWidget *_managerWidget = nullptr; 0080 OrgKdeKWalletInterface *m_kwalletdModule = nullptr; 0081 QList<KXmlGuiWindow *> _windows; 0082 bool _kwalletdLaunch = false; 0083 QAction *_walletsExportAction = nullptr; 0084 }; 0085 0086 #endif