/* This file is part of the KDE project * * Copyright (C) 1998, 1999 Torben Weis * 1999-2001 Lars Knoll * 1999-2001 Antti Koivisto * 2000-2001 Simon Hausmann * 2000-2001 Dirk Mueller * 2000 Stefan Schimanski <1Stein@gmx.de> * 2001-2003 George Staikos * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #if !defined khtml_wallet_p_h && !defined KHTML_NO_WALLET #define khtml_wallet_p_h #include #include #include #include #include #include #include #include #include #include class KHTMLWalletQueue : public QObject { Q_OBJECT public: KHTMLWalletQueue(QObject *parent) : QObject(parent) { wallet = 0L; } virtual ~KHTMLWalletQueue() { delete wallet; wallet = 0L; } KWallet::Wallet *wallet; typedef QPair > Caller; typedef QList CallerList; CallerList callers; QList > > savers; Q_SIGNALS: void walletOpened(KWallet::Wallet*); public Q_SLOTS: void walletOpened(bool success) { if (!success) { delete wallet; wallet = 0L; } emit walletOpened(wallet); if (wallet) { if (!wallet->hasFolder(KWallet::Wallet::FormDataFolder())) { wallet->createFolder(KWallet::Wallet::FormDataFolder()); } for (CallerList::Iterator i = callers.begin(); i != callers.end(); ++i) { if ((*i).first && (*i).second) { (*i).first->walletOpened(wallet); } } wallet->setFolder(KWallet::Wallet::FormDataFolder()); for (QList > >::Iterator i = savers.begin(); i != savers.end(); ++i) { wallet->writeMap((*i).first, (*i).second); } } callers.clear(); savers.clear(); wallet = 0L; // gave it away } }; #endif