kwallet Library API Documentation

kwallet.h

00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 2002-2004 George Staikos <staikos@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */ 
00020 
00021 
00022 #ifndef _KWALLET_H
00023 #define _KWALLET_H
00024 
00025 #include <qglobal.h>
00026 #ifdef Q_OS_UNIX
00027 
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030 #include <qobject.h>
00031 #include <dcopobject.h>
00032 
00033 class DCOPRef;
00034 
00035 namespace KWallet {
00036 
00047 class KIO_EXPORT Wallet : public QObject, public DCOPObject {
00048     K_DCOP
00049     Q_OBJECT
00050     protected:
00057         Wallet(int handle, const QString& name);
00062         Wallet(const Wallet&);
00063 
00064     public:
00065         enum EntryType { Unknown=0, Password, Stream, Map, Unused=0xffff };
00066 
00070         virtual ~Wallet();
00071         
00077         static QStringList walletList();
00078 
00084         static bool isEnabled();
00085 
00091         static bool isOpen(const QString& name);
00092 
00102         static int closeWallet(const QString& name, bool force);
00103 
00110         static int deleteWallet(const QString& name);
00111 
00118         static bool disconnectApplication(const QString& wallet, const QCString& app);
00119 
00120         enum OpenType { Synchronous=0, Asynchronous, Path, OpenTypeUnused=0xff };
00121 
00138         static Wallet* openWallet(const QString& name, WId w = 0, OpenType ot = Synchronous);
00139 
00146         static QStringList users(const QString& wallet);
00147 
00151         static const QString LocalWallet();
00152 
00156         static const QString NetworkWallet();
00157 
00164         static const QString PasswordFolder();
00165 
00172         static const QString FormDataFolder();
00173 
00180         static void changePassword(const QString& name, WId w = 0);
00181 
00188         virtual int sync();
00189 
00195         virtual int lockWallet();
00196 
00200         virtual const QString& walletName() const;
00201 
00207         virtual bool isOpen() const;
00208 
00214         virtual void requestChangePassword(WId w = 0);
00215 
00220         virtual QStringList folderList();
00221 
00227         virtual bool hasFolder(const QString& f);
00228 
00236         virtual bool setFolder(const QString& f);
00237 
00243         virtual bool removeFolder(const QString& f);
00244 
00250         virtual bool createFolder(const QString& f);
00251 
00258         virtual const QString& currentFolder() const;
00259 
00265         virtual QStringList entryList();
00266 
00273         virtual int renameEntry(const QString& oldName, const QString& newName);
00274 
00284         virtual int readEntry(const QString& key, QByteArray& value);
00285 
00294         virtual int readMap(const QString& key, QMap<QString,QString>& value);
00295 
00304         virtual int readPassword(const QString& key, QString& value);
00305 
00318         int readEntryList(const QString& key, QMap<QString, QByteArray>& value);
00319 
00331         int readMapList(const QString& key, QMap<QString, QMap<QString, QString> >& value);
00332 
00344         int readPasswordList(const QString& key, QMap<QString, QString>& value);
00345 
00356         virtual int writeEntry(const QString& key, const QByteArray& value, EntryType entryType);
00357 
00365         virtual int writeEntry(const QString& key, const QByteArray& value);
00366 
00373         virtual int writeMap(const QString& key, const QMap<QString,QString>& value);
00374 
00381         virtual int writePassword(const QString& key, const QString& value);
00382 
00388         virtual bool hasEntry(const QString& key);
00389 
00395         virtual int removeEntry(const QString& key);
00396 
00403         virtual EntryType entryType(const QString& key);
00404 
00415         static bool folderDoesNotExist(const QString& wallet, const QString& folder);
00416 
00428         static bool keyDoesNotExist(const QString& wallet, const QString& folder, 
00429                         const QString& key);
00430 
00431     signals:
00435         void walletClosed();
00436 
00441         void folderUpdated(const QString& folder);
00442 
00446         void folderListUpdated();
00447 
00452         void folderRemoved(const QString& folder);
00453 
00458         void walletOpened(bool success);
00459 
00460     private:
00461     k_dcop:
00466         ASYNC slotWalletClosed(int handle);
00467 
00472         ASYNC slotFolderUpdated(const QString& wallet, const QString& folder);
00473 
00478         ASYNC slotFolderListUpdated(const QString& wallet);
00479 
00484         ASYNC slotApplicationDisconnected(const QString& wallet, const QCString& application);
00485 
00490         ASYNC walletOpenResult(int rc);
00491 
00492     private slots:
00497         void slotAppUnregistered(const QCString&);
00498 
00499     private:
00500         class WalletPrivate;
00501         WalletPrivate *d;
00502         QString _name;
00503         QString _folder;
00504         int _handle;
00505         DCOPRef *_dcopRef;
00506 
00507     protected:
00511         virtual void virtual_hook(int id, void *data);
00512 };
00513 
00514 }
00515 
00516 #endif //Q_OS_UNIX
00517 
00518 #endif //_KWALLET_H
00519 
KDE Logo
This file is part of the documentation for kwallet Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Aug 2 12:04:49 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003