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