summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp2
-rw-r--r--src/mainview.h1
-rw-r--r--src/walletwidget.cpp14
-rw-r--r--src/walletwidget.h4
-rw-r--r--src/webpage.cpp10
-rw-r--r--src/webpage.h5
-rw-r--r--src/webtab.cpp53
-rw-r--r--src/webtab.h2
-rw-r--r--src/webview.cpp13
9 files changed, 53 insertions, 51 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index c4ab5e0a..9f5b433e 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -318,7 +318,7 @@ WebTab *MainView::webTab(int index) const
WebTab *MainView::newWebTab(bool focused, bool nearParent)
{
- WebTab* webTab=new WebTab(this);
+ WebTab* webTab = new WebTab(this);
// connecting webview with mainview
connect(webTab->view(), SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
diff --git a/src/mainview.h b/src/mainview.h
index c5cabb00..23db69c0 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -144,6 +144,7 @@ private slots:
void windowCloseRequested();
void postLaunch();
+
protected:
virtual void resizeEvent(QResizeEvent *event);
diff --git a/src/walletwidget.cpp b/src/walletwidget.cpp
index 56188c95..c7100a4d 100644
--- a/src/walletwidget.cpp
+++ b/src/walletwidget.cpp
@@ -38,6 +38,7 @@
#include <QHBoxLayout>
#include <QString>
+
WalletWidget::WalletWidget(QWidget *parent)
: QWidget(parent)
, m_label( new QLabel(this) )
@@ -59,7 +60,6 @@ WalletWidget::WalletWidget(QWidget *parent)
// layout
QGridLayout *layout = new QGridLayout(this);
- layout->setMargin(0);
layout->addWidget(closeButton,0,0);
layout->addWidget(m_label,0,1);
layout->addWidget(rememberButton,0,2);
@@ -79,6 +79,7 @@ WalletWidget::~WalletWidget()
void WalletWidget::rememberData()
{
emit saveFormDataAccepted(m_key);
+ destroy();
}
@@ -92,6 +93,17 @@ void WalletWidget::neverRememberData()
void WalletWidget::notNowRememberData()
{
emit saveFormDataRejected (m_key);
+ destroy();
+}
+
+
+void WalletWidget::destroy()
+{
+ if (parentWidget() && parentWidget()->layout())
+ {
+ parentWidget()->layout()->removeWidget(this);
+ }
+ this->deleteLater();
}
diff --git a/src/walletwidget.h b/src/walletwidget.h
index 7b20ead5..3e5f6465 100644
--- a/src/walletwidget.h
+++ b/src/walletwidget.h
@@ -48,6 +48,8 @@ private slots:
void rememberData();
void neverRememberData();
void notNowRememberData();
+
+public slots:
void onSaveFormData(const QString &, const QUrl &);
signals:
@@ -55,6 +57,8 @@ signals:
void saveFormDataRejected(const QString &);
private:
+ void destroy();
+
QString m_key;
QUrl m_url;
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 5a7c5dc3..3fc0aac4 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -69,8 +69,6 @@
WebPage::WebPage(QObject *parent)
: KWebPage(parent, KWalletIntegration)
- , m_keyboardModifiers(Qt::NoModifier)
- , m_pressedButtons(Qt::NoButton)
{
// rekonq own classes integration
setNetworkAccessManager(new NetworkAccessManager(this));
@@ -101,14 +99,6 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
if(risp == KMessageBox::Cancel)
return false;
}
-
- if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
- {
- Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab);
- m_keyboardModifiers = Qt::NoModifier;
- m_pressedButtons = Qt::NoButton;
- return false;
- }
if (request.url().scheme() == QLatin1String("mailto"))
{
diff --git a/src/webpage.h b/src/webpage.h
index 887a4309..79d8e8e7 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -68,13 +68,8 @@ private slots:
void loadFinished(bool);
private:
- friend class WebView;
QString errorPage(QNetworkReply *);
- // keyboard/mouse modifiers
- Qt::KeyboardModifiers m_keyboardModifiers;
- Qt::MouseButtons m_pressedButtons;
-
QUrl m_requestedUrl;
};
diff --git a/src/webtab.cpp b/src/webtab.cpp
index f79e53d0..31dd1ca6 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -64,10 +64,10 @@ WebTab::WebTab(QWidget* parent)
, m_view( new WebView(parent) )
, m_progress(0)
{
- QVBoxLayout* l=new QVBoxLayout(this);
+ QVBoxLayout* l = new QVBoxLayout(this);
l->setMargin(0);
- QWidget* messageBar=new QWidget(this);
+ QWidget* messageBar = new QWidget(this);
l->addWidget(messageBar);
messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
@@ -77,34 +77,17 @@ WebTab::WebTab(QWidget* parent)
l->addWidget(m_view);
m_view->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
-
- // add kwallet bar
+
+ KWebWallet *wallet = page()->wallet();
+
+ if(wallet)
{
- WalletWidget *walletBar = new WalletWidget(messageBar);
- messageBar->layout()->addWidget(walletBar);
- walletBar->hide();
-
- KWebWallet *wallet = m_view->page()->wallet();
- if(wallet)
- {
- connect(wallet, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)),
- walletBar, SLOT(onSaveFormData(const QString &, const QUrl &)));
- connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)),
- wallet, SLOT(acceptSaveFormDataRequest(const QString &)));
- connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)),
- wallet, SLOT(rejectSaveFormDataRequest(const QString &)));
-
- connect(wallet, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)),
- walletBar, SLOT(show()));
- connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)),
- walletBar, SLOT(hide()));
- connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)),
- walletBar, SLOT(hide()));
-
- }
+ connect(wallet, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)),
+ this, SLOT(createWalletBar(const QString &, const QUrl &)));
}
- connect(m_view->page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&)));
+ connect(page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&)));
+
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
@@ -169,3 +152,19 @@ void WebTab::loadInNewTab(const KUrl &url)
{
Application::instance()->loadUrl(url, Rekonq::NewCurrentTab);
}
+
+
+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->onSaveFormData(key,url);
+ messageBar->layout()->addWidget(walletBar);
+
+ connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)),
+ wallet, SLOT(acceptSaveFormDataRequest(const QString &)));
+ connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)),
+ wallet, SLOT(rejectSaveFormDataRequest(const QString &)));
+}
diff --git a/src/webtab.h b/src/webtab.h
index bfe1efed..2eb8d733 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -59,6 +59,8 @@ private slots:
void loadInNewTab(const KUrl &url);
+ void createWalletBar(const QString &, const QUrl &);
+
private:
WebView *const m_view;
int m_progress;
diff --git a/src/webview.cpp b/src/webview.cpp
index 25de0a98..0ba04bc2 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -279,11 +279,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.exec(mapToGlobal(event->pos()));
}
+
void WebView::mousePressEvent(QMouseEvent *event)
{
- m_page->m_pressedButtons = event->buttons();
- m_page->m_keyboardModifiers = event->modifiers();
-
switch(event->button())
{
case Qt::XButton1:
@@ -293,7 +291,8 @@ void WebView::mousePressEvent(QMouseEvent *event)
triggerPageAction(KWebPage::Forward);
break;
default:
- QWebView::mousePressEvent(event);
+ KWebView::mousePressEvent(event);
+ break;
};
}
@@ -301,7 +300,7 @@ void WebView::mousePressEvent(QMouseEvent *event)
void WebView::mouseMoveEvent(QMouseEvent *event)
{
m_mousePos = event->pos();
- QWebView::mouseMoveEvent(event);
+ KWebView::mouseMoveEvent(event);
}
@@ -371,6 +370,6 @@ void WebView::keyPressEvent(QKeyEvent *event)
triggerPageAction(KWebPage::SelectAll);
return;
}
-
- QWebView::keyPressEvent(event);
+
+ KWebView::keyPressEvent(event);
}