KHTML
khtml_wallet_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00004 * 1999-2001 Lars Knoll <knoll@kde.org> 00005 * 1999-2001 Antti Koivisto <koivisto@kde.org> 00006 * 2000-2001 Simon Hausmann <hausmann@kde.org> 00007 * 2000-2001 Dirk Mueller <mueller@kde.org> 00008 * 2000 Stefan Schimanski <1Stein@gmx.de> 00009 * 2001-2003 George Staikos <staikos@kde.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public License 00022 * along with this library; see the file COPYING.LIB. If not, write to 00023 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00024 * Boston, MA 02110-1301, USA. 00025 */ 00026 #if !defined khtml_wallet_p_h && !defined KHTML_NO_WALLET 00027 #define khtml_wallet_p_h 00028 00029 #include <kcursor.h> 00030 #include <kxmlguifactory.h> 00031 #include <kaction.h> 00032 #include <kparts/partmanager.h> 00033 #include <kparts/statusbarextension.h> 00034 #include <kparts/browserextension.h> 00035 #include <kwallet.h> 00036 00037 #include <QtCore/QPointer> 00038 #include <QtCore/QMap> 00039 #include <QtCore/QTimer> 00040 00041 class KHTMLWalletQueue : public QObject 00042 { 00043 Q_OBJECT 00044 public: 00045 KHTMLWalletQueue(QObject *parent) : QObject(parent) { 00046 wallet = 0L; 00047 } 00048 00049 virtual ~KHTMLWalletQueue() { 00050 delete wallet; 00051 wallet = 0L; 00052 } 00053 00054 KWallet::Wallet *wallet; 00055 typedef QPair<DOM::HTMLFormElementImpl*, QPointer<DOM::DocumentImpl> > Caller; 00056 typedef QList<Caller> CallerList; 00057 CallerList callers; 00058 QList<QPair<QString, QMap<QString, QString> > > savers; 00059 00060 Q_SIGNALS: 00061 void walletOpened(KWallet::Wallet*); 00062 00063 public Q_SLOTS: 00064 void walletOpened(bool success) { 00065 if (!success) { 00066 delete wallet; 00067 wallet = 0L; 00068 } 00069 emit walletOpened(wallet); 00070 if (wallet) { 00071 if (!wallet->hasFolder(KWallet::Wallet::FormDataFolder())) { 00072 wallet->createFolder(KWallet::Wallet::FormDataFolder()); 00073 } 00074 for (CallerList::Iterator i = callers.begin(); i != callers.end(); ++i) { 00075 if ((*i).first && (*i).second) { 00076 (*i).first->walletOpened(wallet); 00077 } 00078 } 00079 wallet->setFolder(KWallet::Wallet::FormDataFolder()); 00080 for (QList<QPair<QString, QMap<QString, QString> > >::Iterator i = savers.begin(); i != savers.end(); ++i) { 00081 wallet->writeMap((*i).first, (*i).second); 00082 } 00083 } 00084 callers.clear(); 00085 savers.clear(); 00086 wallet = 0L; // gave it away 00087 } 00088 }; 00089 00090 #endif
KDE 4.6 API Reference