• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

kwalletd.h

Go to the documentation of this file.
00001 // -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
00002 /*
00003    This file is part of the KDE libraries
00004 
00005    Copyright (c) 2002-2004 George Staikos <staikos@kde.org>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 
00022 */
00023 #ifndef _KWALLETD_H_
00024 #define _KWALLETD_H_
00025 
00026 #include <kdedmodule.h>
00027 #include <QtCore/QString>
00028 #include <QtGui/QImage>
00029 #include <QtCore/QHash>
00030 #include "kwalletbackend.h"
00031 #include <QtCore/QPointer>
00032 #include <time.h>
00033 #include <stdlib.h>
00034 #include <QtDBus/QtDBus>
00035 
00036 class KDirWatch;
00037 class KTimeout;
00038 
00039 // @Private
00040 class KWalletTransaction;
00041 class KWalletSyncTimer;
00042 
00043 class KWalletD : public QObject {
00044     Q_OBJECT
00045     
00046     public:
00047         KWalletD();
00048         virtual ~KWalletD();
00049     
00050     public Q_SLOTS:
00051         // Is the wallet enabled?  If not, all open() calls fail.
00052         bool isEnabled() const;
00053 
00054         // Open and unlock the wallet
00055         int open(const QString& wallet, qlonglong wId, const QString& appid, const QDBusMessage& msg);
00056 
00057         // Open and unlock the wallet with this path
00058         int openPath(const QString& path, qlonglong wId, const QString& appid);
00059 
00060         // Asynchronous open - must give the object to return the handle
00061         // to.
00062         // disabled -thiago
00063         //virtual void openAsynchronous(const QString& wallet, const QByteArray& returnObject, uint wId, const QString& appid);
00064 
00065         // Close and lock the wallet
00066         // If force = true, will close it for all users.  Behave.  This
00067         // can break applications, and is generally intended for use by
00068         // the wallet manager app only.
00069         int close(const QString& wallet, bool force);
00070         int close(int handle, bool force, const QString& appid);
00071 
00072         // Save to disk but leave open
00073         Q_NOREPLY void sync(int handle, const QString& appid);
00074 
00075         // Physically deletes the wallet from disk.
00076         int deleteWallet(const QString& wallet);
00077 
00078         // Returns true if the wallet is open
00079         bool isOpen(const QString& wallet);
00080         bool isOpen(int handle);
00081 
00082         // List the users of this wallet
00083         QStringList users(const QString& wallet) const;
00084 
00085         // Change the password of this wallet
00086         void changePassword(const QString& wallet, qlonglong wId, const QString& appid, const QDBusMessage& msg);
00087 
00088         // A list of all wallets
00089         QStringList wallets() const;
00090 
00091         // A list of all folders in this wallet
00092         QStringList folderList(int handle, const QString& appid);
00093 
00094         // Does this wallet have this folder?
00095         bool hasFolder(int handle, const QString& folder, const QString& appid);
00096 
00097         // Create this folder
00098         bool createFolder(int handle, const QString& folder, const QString& appid);
00099 
00100         // Remove this folder
00101         bool removeFolder(int handle, const QString& folder, const QString& appid);
00102 
00103         // List of entries in this folder
00104         QStringList entryList(int handle, const QString& folder, const QString& appid);
00105 
00106         // Read an entry.  If the entry does not exist, it just
00107         // returns an empty result.  It is your responsibility to check
00108         // hasEntry() first.
00109         QByteArray readEntry(int handle, const QString& folder, const QString& key, const QString& appid);
00110         QByteArray readMap(int handle, const QString& folder, const QString& key, const QString& appid);
00111         QString readPassword(int handle, const QString& folder, const QString& key, const QString& appid);
00112         QVariantMap readEntryList(int handle, const QString& folder, const QString& key, const QString& appid);
00113         QVariantMap readMapList(int handle, const QString& folder, const QString& key, const QString& appid);
00114         QVariantMap readPasswordList(int handle, const QString& folder, const QString& key, const QString& appid);
00115 
00116         // Rename an entry.  rc=0 on success.
00117         int renameEntry(int handle, const QString& folder, const QString& oldName, const QString& newName, const QString& appid);
00118 
00119         // Write an entry.  rc=0 on success.
00120         int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, int entryType, const QString& appid);
00121         int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, const QString& appid);
00122         int writeMap(int handle, const QString& folder, const QString& key, const QByteArray& value, const QString& appid);
00123         int writePassword(int handle, const QString& folder, const QString& key, const QString& value, const QString& appid);
00124 
00125         // Does the entry exist?
00126         bool hasEntry(int handle, const QString& folder, const QString& key, const QString& appid);
00127 
00128         // What type is the entry?
00129         int entryType(int handle, const QString& folder, const QString& key, const QString& appid);
00130 
00131         // Remove an entry.  rc=0 on success.
00132         int removeEntry(int handle, const QString& folder, const QString& key, const QString& appid);
00133 
00134         // Disconnect an app from a wallet
00135         bool disconnectApplication(const QString& wallet, const QString& application);
00136 
00137         void reconfigure();
00138 
00139         // Determine
00140         bool folderDoesNotExist(const QString& wallet, const QString& folder);
00141         bool keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key);
00142 
00143         void closeAllWallets();
00144 
00145         QString networkWallet();
00146 
00147         QString localWallet();
00148 
00149         void screenSaverChanged(bool);
00150 
00151     Q_SIGNALS:
00152         void walletListDirty();
00153         void walletCreated(const QString& wallet);
00154         void walletOpened(const QString& wallet);
00155         void walletDeleted(const QString& wallet);
00156         void walletClosed(const QString& wallet);
00157         void walletClosed(int handle);
00158         void allWalletsClosed();
00159         void folderListUpdated(const QString& wallet);
00160         void folderUpdated(const QString&, const QString&);
00161         void applicationDisconnected(const QString& wallet, const QString& application);
00162 
00163     private Q_SLOTS:
00164         void slotServiceUnregistered(const QString& name);
00165         void emitWalletListDirty();
00166         void timedOut(int);
00167         void notifyFailures();
00168         void processTransactions();
00169         void doTransactionSync(const QString& wallet);
00170 
00171     private:
00172         int internalOpen(const QString& appid, const QString& wallet, bool isPath, WId w, bool modal);
00173         bool isAuthorizedApp(const QString& appid, const QString& wallet, WId w);
00174         // This also validates the handle.  May return NULL.
00175         KWallet::Backend* getWallet(const QString& appid, int handle);
00176         // Generate a new unique handle.
00177         int generateHandle();
00178         // Invalidate a handle (remove it from the QMap)
00179         void invalidateHandle(int handle);
00180         // Emit signals about closing wallets
00181         void doCloseSignals(int,const QString&);
00182         void emitFolderUpdated(const QString&, const QString&);
00183         // Internal - close this wallet.
00184         int closeWallet(KWallet::Backend *w, int handle, bool force);
00185         // Implicitly allow access for this application
00186         bool implicitAllow(const QString& wallet, const QString& app);
00187         bool implicitDeny(const QString& wallet, const QString& app);
00188 
00189         void doTransactionChangePassword(const QString& appid, const QString& wallet, qlonglong wId);
00190         int doTransactionOpen(const QString& appid, const QString& wallet, qlonglong wId, bool modal);
00191         void initiateSync(const QString& wallet);
00192 
00193         void setupDialog( QWidget* dialog, WId wId, const QString& appid, bool modal );
00194         void checkActiveDialog();
00195 
00196         QPair<int, KWallet::Backend*> findWallet(const QString& walletName) const;
00197 
00198         typedef QHash<int, KWallet::Backend *> Wallets;
00199         Wallets _wallets;
00200         QHash<QString,QList<int> > _handles;
00201         QMap<QString,QByteArray> _passwords;
00202         KDirWatch *_dw;
00203         int _failed;
00204 
00205         bool _leaveOpen, _closeIdle, _launchManager, _enabled;
00206         bool _openPrompt, _firstUse, _showingFailureNotify;
00207         int _idleTime;
00208         QMap<QString,QStringList> _implicitAllowMap, _implicitDenyMap;
00209         KTimeout *_timeouts;
00210 
00211         QList<KWalletTransaction*> _transactions;
00212         QMap<QString,KWalletSyncTimer*> _synctimers;
00213         QPointer< QWidget > activeDialog;
00214 #ifdef Q_WS_X11
00215         QDBusInterface *screensaver;
00216 #endif
00217 };
00218 
00219 
00220 #endif

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal