1 /* This file is part of the KDE project
3 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
4 * 1999-2001 Lars Knoll <knoll@kde.org>
5 * 1999-2001 Antti Koivisto <koivisto@kde.org>
6 * 2000-2001 Simon Hausmann <hausmann@kde.org>
7 * 2000-2001 Dirk Mueller <mueller@kde.org>
8 * 2000 Stefan Schimanski <1Stein@gmx.de>
9 * 2001-2003 George Staikos <staikos@kde.org>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
26 #if !defined khtml_wallet_p_h && !defined KHTML_NO_WALLET
27 #define khtml_wallet_p_h
30 #include <klibloader.h>
31 #include <kxmlguifactory.h>
33 #include <kparts/partmanager.h>
34 #include <kparts/statusbarextension.h>
35 #include <kparts/browserextension.h>
38 #include <QtCore/QPointer>
39 #include <QtCore/QMap>
40 #include <QtCore/QTimer>
42 class KHTMLWalletQueue
: public QObject
46 KHTMLWalletQueue(QObject
*parent
) : QObject(parent
) {
50 virtual ~KHTMLWalletQueue() {
55 KWallet::Wallet
*wallet
;
56 typedef QPair
<DOM::HTMLFormElementImpl
*, QPointer
<DOM::DocumentImpl
> > Caller
;
57 typedef QList
<Caller
> CallerList
;
59 QList
<QPair
<QString
, QMap
<QString
, QString
> > > savers
;
62 void walletOpened(KWallet::Wallet
*);
65 void walletOpened(bool success
) {
70 emit
walletOpened(wallet
);
72 if (!wallet
->hasFolder(KWallet::Wallet::FormDataFolder())) {
73 wallet
->createFolder(KWallet::Wallet::FormDataFolder());
75 for (CallerList::Iterator i
= callers
.begin(); i
!= callers
.end(); ++i
) {
76 if ((*i
).first
&& (*i
).second
) {
77 (*i
).first
->walletOpened(wallet
);
80 wallet
->setFolder(KWallet::Wallet::FormDataFolder());
81 for (QList
<QPair
<QString
, QMap
<QString
, QString
> > >::Iterator i
= savers
.begin(); i
!= savers
.end(); ++i
) {
82 wallet
->writeMap((*i
).first
, (*i
).second
);
87 wallet
= 0L; // gave it away