kwallet Library API Documentation

kwallet.h

00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 2002-2003 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 <qstring.h>
00026 #include <qstringlist.h>
00027 #include <qobject.h>
00028 #include <dcopobject.h>
00029 
00030 class DCOPRef;
00031 
00032 namespace KWallet {
00033 
00044 class Wallet : public QObject, public DCOPObject {
00045     K_DCOP
00046     Q_OBJECT
00047     protected:
00054         Wallet(int handle, const QString& name);
00059         Wallet(const Wallet&);
00060 
00061     public:
00062         enum EntryType { Unknown=0, Password, Stream, Map, Unused=0xffff };
00063 
00067         virtual ~Wallet();
00068         
00074         static QStringList walletList();
00075 
00081         static bool isEnabled();
00082 
00088         static bool isOpen(const QString& name);
00089 
00099         static int closeWallet(const QString& name, bool force);
00100 
00107         static int deleteWallet(const QString& name);
00108 
00115         static bool disconnectApplication(const QString& wallet, const QCString& app);
00116 
00117         enum OpenType { Synchronous=0, Asynchronous, Path, OpenTypeUnused=0xff };
00118 
00135         static Wallet* openWallet(const QString& name, WId w = 0, OpenType ot = Synchronous);
00136 
00143         static QStringList users(const QString& wallet);
00144 
00148         static const QString LocalWallet();
00149 
00153         static const QString NetworkWallet();
00154 
00161         static const QString PasswordFolder();
00162 
00169         static const QString FormDataFolder();
00170 
00177         static void changePassword(const QString& name, WId w = 0);
00178 
00185         virtual int sync();
00186 
00192         virtual int lockWallet();
00193 
00197         virtual const QString& walletName() const;
00198 
00204         virtual bool isOpen() const;
00205 
00211         virtual void requestChangePassword(WId w = 0);
00212 
00217         virtual QStringList folderList();
00218 
00224         virtual bool hasFolder(const QString& f);
00225 
00233         virtual bool setFolder(const QString& f);
00234 
00240         virtual bool removeFolder(const QString& f);
00241 
00247         virtual bool createFolder(const QString& f);
00248 
00255         virtual const QString& currentFolder() const;
00256 
00262         virtual QStringList entryList();
00263 
00270         virtual int renameEntry(const QString& oldName, const QString& newName);
00271 
00281         virtual int readEntry(const QString& key, QByteArray& value);
00282 
00291         virtual int readMap(const QString& key, QMap<QString,QString>& value);
00292 
00301         virtual int readPassword(const QString& key, QString& value);
00302 
00313         virtual int writeEntry(const QString& key, const QByteArray& value, EntryType entryType);
00314 
00322         virtual int writeEntry(const QString& key, const QByteArray& value);
00323 
00330         virtual int writeMap(const QString& key, const QMap<QString,QString>& value);
00331 
00338         virtual int writePassword(const QString& key, const QString& value);
00339 
00345         virtual bool hasEntry(const QString& key);
00346 
00352         virtual int removeEntry(const QString& key);
00353 
00360         virtual EntryType entryType(const QString& key);
00361 
00372         static bool folderDoesNotExist(const QString& wallet, const QString& folder);
00373 
00385         static bool keyDoesNotExist(const QString& wallet, const QString& folder, 
00386                         const QString& key);
00387 
00388     signals:
00392         void walletClosed();
00393 
00398         void folderUpdated(const QString& folder);
00399 
00403         void folderListUpdated();
00404 
00409         void folderRemoved(const QString& folder);
00410 
00415         void walletOpened(bool success);
00416 
00417     private:
00418     k_dcop:
00423         ASYNC slotWalletClosed(int handle);
00424 
00429         ASYNC slotFolderUpdated(const QString& wallet, const QString& folder);
00430 
00435         ASYNC slotFolderListUpdated(const QString& wallet);
00436 
00441         ASYNC slotApplicationDisconnected(const QString& wallet, const QCString& application);
00442 
00447         ASYNC walletOpenResult(int rc);
00448 
00449     private slots:
00454         void slotAppUnregistered(const QCString&);
00455 
00456     private:
00457         class WalletPrivate;
00458         WalletPrivate *d;
00459         QString _name;
00460         QString _folder;
00461         int _handle;
00462         DCOPRef *_dcopRef;
00463 
00464     protected:
00468         virtual void virtual_hook(int id, void *data);
00469 };
00470 
00471 }
00472 
00473 #endif
00474 
KDE Logo
This file is part of the documentation for kwallet Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 14 09:16:53 2006 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003