# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kwalletd.h

    00001 /*
    00002    This file is part of the KDE libraries
    00003
    00004    Copyright (c) 2002-2004 George Staikos <staikos@kde.org>
    00005
    00006    This library is free software; you can redistribute it and/or
    00007    modify it under the terms of the GNU Library General Public
    00008    License as published by the Free Software Foundation; either
    00009    version 2 of the License, or (at your option) any later version.
    00010
    00011    This library is distributed in the hope that it will be useful,
    00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014    Library General Public License for more details.
    00015
    00016    You should have received a copy of the GNU Library General Public License
    00017    along with this library; see the file COPYING.LIB.  If not, write to
    00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019    Boston, MA 02111-1307, USA.
    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 // @Private
    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         // Is the wallet enabled?  If not, all open() calls fail.
    00049         virtual bool isEnabled() const;
    00050
    00051         // Open and unlock the wallet
    00052         virtual int open(const QString& wallet, uint wId);
    00053
    00054         // Open and unlock the wallet with this path
    00055         virtual int openPath(const QString& path, uint wId);
    00056
    00057         // Asynchronous open - must give the object to return the handle
    00058         // to.
    00059         virtual void openAsynchronous(const QString& wallet, const QCString& returnObject, uint wId);
    00060
    00061         // Close and lock the wallet
    00062         // If force = true, will close it for all users.  Behave.  This
    00063         // can break applications, and is generally intended for use by
    00064         // the wallet manager app only.
    00065         virtual int close(const QString& wallet, bool force);
    00066         virtual int close(int handle, bool force);
    00067
    00068         // Save to disk but leave open
    00069         virtual ASYNC sync(int handle);
    00070
    00071         // Physically deletes the wallet from disk.
    00072         virtual int deleteWallet(const QString& wallet);
    00073
    00074         // Returns true if the wallet is open
    00075         virtual bool isOpen(const QString& wallet) const;
    00076         virtual bool isOpen(int handle);
    00077
    00078         // List the users of this wallet
    00079         virtual QStringList users(const QString& wallet) const;
    00080
    00081         // Change the password of this wallet
    00082         virtual void changePassword(const QString& wallet, uint wId);
    00083
    00084         // A list of all wallets
    00085         virtual QStringList wallets() const;
    00086
    00087         // A list of all folders in this wallet
    00088         virtual QStringList folderList(int handle);
    00089
    00090         // Does this wallet have this folder?
    00091         virtual bool hasFolder(int handle, const QString& folder);
    00092
    00093         // Create this folder
    00094         virtual bool createFolder(int handle, const QString& folder);
    00095
    00096         // Remove this folder
    00097         virtual bool removeFolder(int handle, const QString& folder);
    00098
    00099         // List of entries in this folder
    00100         virtual QStringList entryList(int handle, const QString& folder);
    00101
    00102         // Read an entry.  If the entry does not exist, it just
    00103         // returns an empty result.  It is your responsibility to check
    00104         // hasEntry() first.
    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         virtual QMap<QString, QByteArray> readEntryList(int handle, const QString& folder, const QString& key);
    00109         virtual QMap<QString, QByteArray> readMapList(int handle, const QString& folder, const QString& key);
    00110         virtual QMap<QString, QString> readPasswordList(int handle, const QString& folder, const QString& key);
    00111
    00112         // Rename an entry.  rc=0 on success.
    00113         virtual int renameEntry(int handle, const QString& folder, const QString& oldName, const QString& newName);
    00114
    00115         // Write an entry.  rc=0 on success.
    00116         virtual int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, int entryType);
    00117         virtual int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value);
    00118         virtual int writeMap(int handle, const QString& folder, const QString& key, const QByteArray& value);
    00119         virtual int writePassword(int handle, const QString& folder, const QString& key, const QString& value);
    00120
    00121         // Does the entry exist?
    00122         virtual bool hasEntry(int handle, const QString& folder, const QString& key);
    00123
    00124         // What type is the entry?
    00125         virtual int entryType(int handle, const QString& folder, const QString& key);
    00126
    00127         // Remove an entry.  rc=0 on success.
    00128         virtual int removeEntry(int handle, const QString& folder, const QString& key);
    00129
    00130         // Disconnect an app from a wallet
    00131         virtual bool disconnectApplication(const QString& wallet, const QCString& application);
    00132
    00133         virtual void reconfigure();
    00134
    00135         // Determine
    00136         virtual bool folderDoesNotExist(const QString& wallet, const QString& folder);
    00137         virtual bool keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key);
    00138
    00139         virtual void closeAllWallets();
    00140
    00141         virtual QString networkWallet();
    00142
    00143         virtual QString localWallet();
    00144
    00145     private slots:
    00146         void slotAppUnregistered(const QCString& app);
    00147         void emitWalletListDirty();
    00148         void timedOut(int);
    00149         void notifyFailures();
    00150         void processTransactions();
    00151
    00152     private:
    00153         int internalOpen(const QCString& appid, const QString& wallet, bool isPath = false, WId w = 0);
    00154         bool isAuthorizedApp(const QCString& appid, const QString& wallet, WId w);
    00155         // This also validates the handle.  May return NULL.
    00156         KWallet::Backend* getWallet(const QCString& appid, int handle);
    00157         // Generate a new unique handle.
    00158         int generateHandle();
    00159         // Invalidate a handle (remove it from the QMap)
    00160         void invalidateHandle(int handle);
    00161         // Emit signals about closing wallets
    00162         void doCloseSignals(int,const QString&);
    00163         void emitFolderUpdated(const QString&, const QString&);
    00164         // Internal - close this wallet.
    00165         int closeWallet(KWallet::Backend *w, int handle, bool force);
    00166         // Implicitly allow access for this application
    00167         bool implicitAllow(const QString& wallet, const QCString& app);
    00168         bool implicitDeny(const QString& wallet, const QCString& app);
    00169         QCString friendlyDCOPPeerName();
    00170
    00171         void doTransactionChangePassword(const QCString& appid, const QString& wallet, uint wId);
    00172         int doTransactionOpen(const QCString& appid, const QString& wallet, uint wId);
    00173
    00174         QIntDict<KWallet::Backend> _wallets;
    00175         QMap<QCString,QValueList<int> > _handles;
    00176         QMap<QString,QCString> _passwords;
    00177         KDirWatch *_dw;
    00178         int _failed;
    00179
    00180         bool _leaveOpen, _closeIdle, _launchManager, _enabled;
    00181             bool _openPrompt, _firstUse, _showingFailureNotify;
    00182         int _idleTime;
    00183         QMap<QString,QStringList> _implicitAllowMap, _implicitDenyMap;
    00184         KTimeout *_timeouts;
    00185
    00186         QPtrList<KWalletTransaction> _transactions;
    00187 };
    00188
    00189
    00190 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:06 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003