diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2009-12-14 21:50:39 +0100 |
---|---|---|
committer | megabigbug <megabigbug@arrakis.(none)> | 2009-12-14 21:50:39 +0100 |
commit | 2aaad7137a78b5eaff3d05891e2d830bdd2dae74 (patch) | |
tree | 5de3fa262c1538a70700b37d4917225666ad0a72 /src/mainview.cpp | |
parent | rekonq 0.3.21 (diff) | |
download | rekonq-2aaad7137a78b5eaff3d05891e2d830bdd2dae74.tar.xz |
create walletwidget only when necessary
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 9b5c2595..cf1aa7fd 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -336,6 +336,7 @@ WebView *MainView::newWebView(bool focused, bool nearParent) QVBoxLayout* l=new QVBoxLayout(w); l->setMargin(0); + l->setSpacing(0); QWidget* messageBar=new QWidget(w); l->addWidget(messageBar); @@ -349,32 +350,13 @@ WebView *MainView::newWebView(bool focused, bool nearParent) l->addWidget(webView); webView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - // add kwallet bar + KWebWallet *wallet = webView->page()->wallet(); + if(wallet) { - WalletWidget *walletBar = new WalletWidget(messageBar); - messageBar->layout()->addWidget(walletBar); - walletBar->hide(); - - KWebWallet *wallet = webView->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 &))); } - + // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); @@ -404,6 +386,21 @@ WebView *MainView::newWebView(bool focused, bool nearParent) } +void MainView::createWalletBar(const QString &key, const QUrl &url) +{ + KWebWallet *wallet = currentWebView()->page()->wallet(); + QWidget *messageBar=this->widget(currentIndex())->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 &))); +} + void MainView::newTab() { WebView *w = newWebView(); |