00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _KWALLETD_H_
00023 #define _KWALLETD_H_
00024
00025 #include <kded/kdedmodule.h>
00026 #include <qintdict.h>
00027 #include <qstring.h>
00028 #include <qwidget.h>
00029 #include <qguardedptr.h>
00030 #include "kwalletbackend.h"
00031
00032 #include <time.h>
00033 #include <stdlib.h>
00034
00035 class KDirWatch;
00036 class KTimeout;
00037
00038
00039 class KWalletTransaction;
00040
00041 class KWalletD : public KDEDModule {
00042 Q_OBJECT
00043 K_DCOP
00044 public:
00045 KWalletD(const QCString &name);
00046 virtual ~KWalletD();
00047
00048 k_dcop:
00049
00050 virtual bool isEnabled() const;
00051
00052
00053 virtual int open(const QString& wallet, uint wId);
00054
00055
00056 virtual int openPath(const QString& path, uint wId);
00057
00058
00059
00060 virtual void openAsynchronous(const QString& wallet, const QCString& returnObject, uint wId);
00061
00062
00063
00064
00065
00066 virtual int close(const QString& wallet, bool force);
00067 virtual int close(int handle, bool force);
00068
00069
00070 virtual ASYNC sync(int handle);
00071
00072
00073 virtual int deleteWallet(const QString& wallet);
00074
00075
00076 virtual bool isOpen(const QString& wallet) const;
00077 virtual bool isOpen(int handle);
00078
00079
00080 virtual QStringList users(const QString& wallet) const;
00081
00082
00083 virtual void changePassword(const QString& wallet, uint wId);
00084
00085
00086 virtual QStringList wallets() const;
00087
00088
00089 virtual QStringList folderList(int handle);
00090
00091
00092 virtual bool hasFolder(int handle, const QString& folder);
00093
00094
00095 virtual bool createFolder(int handle, const QString& folder);
00096
00097
00098 virtual bool removeFolder(int handle, const QString& folder);
00099
00100
00101 virtual QStringList entryList(int handle, const QString& folder);
00102
00103
00104
00105
00106 virtual QByteArray readEntry(int handle, const QString& folder, const QString& key);
00107 virtual QByteArray readMap(int handle, const QString& folder, const QString& key);
00108 virtual QString readPassword(int handle, const QString& folder, const QString& key);
00109 virtual QMap<QString, QByteArray> readEntryList(int handle, const QString& folder, const QString& key);
00110 virtual QMap<QString, QByteArray> readMapList(int handle, const QString& folder, const QString& key);
00111 virtual QMap<QString, QString> readPasswordList(int handle, const QString& folder, const QString& key);
00112
00113
00114 virtual int renameEntry(int handle, const QString& folder, const QString& oldName, const QString& newName);
00115
00116
00117 virtual int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, int entryType);
00118 virtual int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value);
00119 virtual int writeMap(int handle, const QString& folder, const QString& key, const QByteArray& value);
00120 virtual int writePassword(int handle, const QString& folder, const QString& key, const QString& value);
00121
00122
00123 virtual bool hasEntry(int handle, const QString& folder, const QString& key);
00124
00125
00126 virtual int entryType(int handle, const QString& folder, const QString& key);
00127
00128
00129 virtual int removeEntry(int handle, const QString& folder, const QString& key);
00130
00131
00132 virtual bool disconnectApplication(const QString& wallet, const QCString& application);
00133
00134 virtual void reconfigure();
00135
00136
00137 virtual bool folderDoesNotExist(const QString& wallet, const QString& folder);
00138 virtual bool keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key);
00139
00140 virtual void closeAllWallets();
00141
00142 virtual QString networkWallet();
00143
00144 virtual QString localWallet();
00145
00146 private slots:
00147 void slotAppUnregistered(const QCString& app);
00148 void emitWalletListDirty();
00149 void timedOut(int);
00150 void notifyFailures();
00151 void processTransactions();
00152
00153 private:
00154 int internalOpen(const QCString& appid, const QString& wallet, bool isPath = false, WId w = 0, bool modal = false);
00155 bool isAuthorizedApp(const QCString& appid, const QString& wallet, WId w);
00156
00157 KWallet::Backend* getWallet(const QCString& appid, int handle);
00158
00159 int generateHandle();
00160
00161 void invalidateHandle(int handle);
00162
00163 void doCloseSignals(int,const QString&);
00164 void emitFolderUpdated(const QString&, const QString&);
00165
00166 int closeWallet(KWallet::Backend *w, int handle, bool force);
00167
00168 bool implicitAllow(const QString& wallet, const QCString& app);
00169 bool implicitDeny(const QString& wallet, const QCString& app);
00170 QCString friendlyDCOPPeerName();
00171
00172 void doTransactionChangePassword(const QCString& appid, const QString& wallet, uint wId);
00173 int doTransactionOpen(const QCString& appid, const QString& wallet, uint wId, bool modal);
00174
00175 void setupDialog( QWidget* dialog, WId wId, const QCString& appid, bool modal );
00176 void checkActiveDialog();
00177
00178 QIntDict<KWallet::Backend> _wallets;
00179 QMap<QCString,QValueList<int> > _handles;
00180 QMap<QString,QCString> _passwords;
00181 KDirWatch *_dw;
00182 int _failed;
00183
00184 bool _leaveOpen, _closeIdle, _launchManager, _enabled;
00185 bool _openPrompt, _firstUse, _showingFailureNotify;
00186 int _idleTime;
00187 QMap<QString,QStringList> _implicitAllowMap, _implicitDenyMap;
00188 KTimeout *_timeouts;
00189
00190 QPtrList<KWalletTransaction> _transactions;
00191 QGuardedPtr< QWidget > activeDialog;
00192 };
00193
00194
00195 #endif