From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/kopetewalletmanager.h | 116 +++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 kopete/libkopete/kopetewalletmanager.h (limited to 'kopete/libkopete/kopetewalletmanager.h') diff --git a/kopete/libkopete/kopetewalletmanager.h b/kopete/libkopete/kopetewalletmanager.h new file mode 100644 index 00000000..fdd3a154 --- /dev/null +++ b/kopete/libkopete/kopetewalletmanager.h @@ -0,0 +1,116 @@ +/* + kopetewalletmanager.h - Kopete Wallet Manager + + Copyright (c) 2004 by Richard Smith + Kopete (c) 2002-2004 by the Kopete developers + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef KOPETEWALLETMANAGER_H +#define KOPETEWALLETMANAGER_H + +#include + +#include + +#include "kopete_export.h" + +namespace KWallet { class Wallet; } + +namespace Kopete +{ + +/** + * @author Richard Smith + * + * The Kopete::WalletManager class is a singleton, which looks after Kopete's + * KWallet connection. + */ +class KOPETE_EXPORT WalletManager : public QObject +{ + Q_OBJECT + +public: + /** + * Retrieve the wallet manager instance + */ + static WalletManager *self(); + ~WalletManager(); + + /** + * @brief Attempt to open the KWallet asyncronously, then signal an + * object to indicate the task is complete. + * + * @param object The object to call back to + * @param slot The slot on object to call; must have signature slot( KWallet::Wallet* ) + * The parameter to the slot will be the wallet that was opened if the call + * succeeded, or NULL if the wallet failed to open or the Kopete folder was + * inaccessible. + * + * For simplicity of client code, it is guaranteed that your slot + * will not be called during a call to this function. + */ + void openWallet( QObject *object, const char *slot ); + +public slots: + /** + * Close the connection to the wallet. Will cause walletLost() to be emitted. + */ + void closeWallet(); + +signals: + /** + * Emitted when the connection to the wallet is lost. + */ + void walletLost(); + +private slots: + /** + * Called by the stored wallet pointer when it is successfully opened or + * when it fails. + * + * Causes walletOpened to be emitted. + */ + void slotWalletChangedStatus(); + + /** + * Called by a singleShot timer in the event that we are asked for a + * wallet when we already have one open and ready. + */ + void slotGiveExistingWallet(); + +private: + void openWalletInner(); + void emitWalletOpened( KWallet::Wallet *wallet ); + + class Private; + Private *d; + + WalletManager(); +}; + +} + +/** + * @internal + */ +class KopeteWalletSignal : public QObject +{ + Q_OBJECT + friend class Kopete::WalletManager; +signals: + void walletOpened( KWallet::Wallet *wallet ); +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + -- cgit v1.2.1