From 427dd1eb359072b3206ded3640182a6aadeefd69 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 15 Dec 2009 17:11:08 +0100 Subject: WalletWidget -> WalletBar --- src/CMakeLists.txt | 2 +- src/walletbar.cpp | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/walletbar.h | 68 ++++++++++++++++++++++++++++++ src/walletwidget.cpp | 116 --------------------------------------------------- src/walletwidget.h | 68 ------------------------------ src/webtab.cpp | 4 +- 6 files changed, 187 insertions(+), 187 deletions(-) create mode 100644 src/walletbar.cpp create mode 100644 src/walletbar.h delete mode 100644 src/walletwidget.cpp delete mode 100644 src/walletwidget.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3527a41..ede49328 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,7 @@ SET( rekonq_KDEINIT_SRCS clicktoflash.cpp networkaccessmanager.cpp webinspectordock.cpp - walletwidget.cpp + walletbar.cpp #---------------------------------------- history/autosaver.cpp history/historymanager.cpp diff --git a/src/walletbar.cpp b/src/walletbar.cpp new file mode 100644 index 00000000..c5d705e0 --- /dev/null +++ b/src/walletbar.cpp @@ -0,0 +1,116 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +// Self Includes +#include "walletbar.h" +#include "walletbar.moc" + +// KDE Includes +#include +#include + +// Qt Includes +#include +#include +#include +#include + + +WalletBar::WalletBar(QWidget *parent) + : QWidget(parent) + , m_label( new QLabel(this) ) +{ + m_label->setWordWrap(true); + + QToolButton *closeButton = new QToolButton(this); + closeButton->setAutoRaise(true); + closeButton->setIcon(KIcon("dialog-close")); + + QPushButton *rememberButton = new QPushButton(KIcon("document-save"), i18n("Remember"), this); + QPushButton *neverHereButton = new QPushButton(KIcon("process-stop"), i18n("Never for This Site"), this); + QPushButton *notNowButton = new QPushButton(KIcon("dialog-cancel"), i18n("Not Now"), this); + + connect(closeButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); + connect(rememberButton, SIGNAL(clicked()), this, SLOT(rememberData())); + connect(neverHereButton, SIGNAL(clicked()), this, SLOT(neverRememberData())); + connect(notNowButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); + + // layout + QGridLayout *layout = new QGridLayout(this); + layout->addWidget(closeButton,0,0); + layout->addWidget(m_label,0,1); + layout->addWidget(rememberButton,0,2); + layout->addWidget(neverHereButton,0,3); + layout->addWidget(notNowButton,0,4); + layout->setColumnStretch(1,100); + + setLayout(layout); +} + + +WalletBar::~WalletBar() +{ +} + + +void WalletBar::rememberData() +{ + emit saveFormDataAccepted(m_key); + destroy(); +} + + +void WalletBar::neverRememberData() +{ + // TODO: store site url (to remember never bother about) + notNowRememberData(); +} + + +void WalletBar::notNowRememberData() +{ + emit saveFormDataRejected (m_key); + destroy(); +} + + +void WalletBar::destroy() +{ + if (parentWidget() && parentWidget()->layout()) + { + parentWidget()->layout()->removeWidget(this); + } + this->deleteLater(); +} + + +void WalletBar::onSaveFormData(const QString &key, const QUrl &url) +{ + m_label->setText( i18n("Do you want rekonq to remember the password on %1?", url.host() ) ); + + m_key = key; + m_url = url; +} diff --git a/src/walletbar.h b/src/walletbar.h new file mode 100644 index 00000000..d2e39373 --- /dev/null +++ b/src/walletbar.h @@ -0,0 +1,68 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#ifndef WALLET_WIDGET_H +#define WALLET_WIDGET_H + + +// Qt Includes +#include +#include +#include +#include + + +class WalletBar : public QWidget +{ + Q_OBJECT + +public: + WalletBar(QWidget *parent); + ~WalletBar(); + +private slots: + + void rememberData(); + void neverRememberData(); + void notNowRememberData(); + +public slots: + void onSaveFormData(const QString &, const QUrl &); + +signals: + void saveFormDataAccepted(const QString &); + void saveFormDataRejected(const QString &); + +private: + void destroy(); + + QString m_key; + QUrl m_url; + + QLabel *m_label; +}; + +#endif // WALLET_WIDGET_H diff --git a/src/walletwidget.cpp b/src/walletwidget.cpp deleted file mode 100644 index c7100a4d..00000000 --- a/src/walletwidget.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "walletwidget.h" -#include "walletwidget.moc" - -// KDE Includes -#include -#include - -// Qt Includes -#include -#include -#include -#include - - -WalletWidget::WalletWidget(QWidget *parent) - : QWidget(parent) - , m_label( new QLabel(this) ) -{ - m_label->setWordWrap(true); - - QToolButton *closeButton = new QToolButton(this); - closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); - - QPushButton *rememberButton = new QPushButton(KIcon("document-save"), i18n("Remember"), this); - QPushButton *neverHereButton = new QPushButton(KIcon("process-stop"), i18n("Never for This Site"), this); - QPushButton *notNowButton = new QPushButton(KIcon("dialog-cancel"), i18n("Not Now"), this); - - connect(closeButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); - connect(rememberButton, SIGNAL(clicked()), this, SLOT(rememberData())); - connect(neverHereButton, SIGNAL(clicked()), this, SLOT(neverRememberData())); - connect(notNowButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); - - // layout - QGridLayout *layout = new QGridLayout(this); - layout->addWidget(closeButton,0,0); - layout->addWidget(m_label,0,1); - layout->addWidget(rememberButton,0,2); - layout->addWidget(neverHereButton,0,3); - layout->addWidget(notNowButton,0,4); - layout->setColumnStretch(1,100); - - setLayout(layout); -} - - -WalletWidget::~WalletWidget() -{ -} - - -void WalletWidget::rememberData() -{ - emit saveFormDataAccepted(m_key); - destroy(); -} - - -void WalletWidget::neverRememberData() -{ - // TODO: store site url (to remember never bother about) - notNowRememberData(); -} - - -void WalletWidget::notNowRememberData() -{ - emit saveFormDataRejected (m_key); - destroy(); -} - - -void WalletWidget::destroy() -{ - if (parentWidget() && parentWidget()->layout()) - { - parentWidget()->layout()->removeWidget(this); - } - this->deleteLater(); -} - - -void WalletWidget::onSaveFormData(const QString &key, const QUrl &url) -{ - m_label->setText( i18n("Do you want rekonq to remember the password on %1?", url.host() ) ); - - m_key = key; - m_url = url; -} diff --git a/src/walletwidget.h b/src/walletwidget.h deleted file mode 100644 index 3e5f6465..00000000 --- a/src/walletwidget.h +++ /dev/null @@ -1,68 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - - -#ifndef WALLET_WIDGET_H -#define WALLET_WIDGET_H - - -// Qt Includes -#include -#include -#include -#include - - -class WalletWidget : public QWidget -{ - Q_OBJECT - -public: - WalletWidget(QWidget *parent); - ~WalletWidget(); - -private slots: - - void rememberData(); - void neverRememberData(); - void notNowRememberData(); - -public slots: - void onSaveFormData(const QString &, const QUrl &); - -signals: - void saveFormDataAccepted(const QString &); - void saveFormDataRejected(const QString &); - -private: - void destroy(); - - QString m_key; - QUrl m_url; - - QLabel *m_label; -}; - -#endif // WALLET_WIDGET_H diff --git a/src/webtab.cpp b/src/webtab.cpp index 31dd1ca6..6698f961 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -38,7 +38,7 @@ #include "mainview.h" #include "webpage.h" #include "bookmarksmanager.h" -#include "walletwidget.h" +#include "walletbar.h" // KDE Includes #include @@ -159,7 +159,7 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url) KWebWallet *wallet = page()->wallet(); QWidget *messageBar = layout()->itemAt(0)->widget(); - WalletWidget *walletBar = new WalletWidget(messageBar); + WalletBar *walletBar = new WalletBar(messageBar); walletBar->onSaveFormData(key,url); messageBar->layout()->addWidget(walletBar); -- cgit v1.2.1