diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 56 | ||||
-rw-r--r-- | src/webview.cpp | 38 | ||||
-rw-r--r-- | src/webview.h | 6 |
3 files changed, 45 insertions, 55 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index b5f47679..9b5c2595 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -36,6 +36,7 @@ // Local Includes #include "tabbar.h" #include "urlbar.h" +#include "walletwidget.h" #include "sessionmanager.h" // KDE Includes @@ -48,6 +49,7 @@ #include <KStandardDirs> #include <KPassivePopup> #include <KLocalizedString> +#include <kwebwallet.h> // Qt Includes #include <QtCore/QTimer> @@ -330,25 +332,49 @@ WebView *MainView::webView(int index) const WebView *MainView::newWebView(bool focused, bool nearParent) { - QWidget* w = new QWidget; - QVBoxLayout* l = new QVBoxLayout; + QWidget* w=new QWidget(this); + + QVBoxLayout* l=new QVBoxLayout(w); l->setMargin(0); - - // this messageBar with its relative layout is useful to embed widget, - // like the wallet bar and so on - QWidget* messageBar = new QWidget; // should be deleted on tab close? // yes! - QVBoxLayout* l2 = new QVBoxLayout; - messageBar->setLayout(l2); - messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); - messageBar->hide(); - + + QWidget* messageBar=new QWidget(w); l->addWidget(messageBar); - - WebView *webView = new WebView(w, messageBar); // should be deleted on tab close? + messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); + + QVBoxLayout* l2 = new QVBoxLayout(messageBar); + l2->setMargin(0); + l2->setSpacing(0); + + WebView *webView = new WebView(w); l->addWidget(webView); webView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - w->setLayout(l); - + + // add kwallet bar + { + 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())); + + } + } + // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); diff --git a/src/webview.cpp b/src/webview.cpp index 97ec4984..b4b3cd70 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -38,7 +38,6 @@ #include "mainview.h" #include "webpage.h" #include "bookmarksmanager.h" -#include "walletwidget.h" // KDE Includes #include <KService> @@ -46,7 +45,6 @@ #include <KStandardShortcut> #include <KMenu> #include <KActionMenu> -#include <kwebwallet.h> // Qt Includes #include <QContextMenuEvent> @@ -58,15 +56,14 @@ #include <QLayout> -WebView::WebView(QWidget* parent, QWidget* messageWidget) +WebView::WebView(QWidget* parent) : KWebView(parent, false) , m_page( new WebPage(this) ) - , m_messageWidget(messageWidget) , m_progress(0) , m_mousePos(QPoint(0,0)) { setPage(m_page); - + connect(m_page, SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); @@ -76,32 +73,6 @@ WebView::WebView(QWidget* parent, QWidget* messageWidget) // download system connect(this, SIGNAL(linkShiftClicked(const KUrl &)), m_page, SLOT(downloadUrl(const KUrl &))); connect(m_page, SIGNAL(downloadRequested(const QNetworkRequest &)), m_page, SLOT(downloadRequest(const QNetworkRequest &))); - - if (messageWidget) - { - WalletWidget *walletBar = new WalletWidget(messageWidget); - messageWidget->layout()->addWidget(walletBar); - // kwallet - KWebWallet *w = m_page->wallet(); - if(w) - { - connect (w, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)), - walletBar, SLOT(onSaveFormData(const QString &, const QUrl &))); - connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)), - w, SLOT(acceptSaveFormDataRequest(const QString &))); - connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)), - w, SLOT(rejectSaveFormDataRequest(const QString &))); - - connect (w, SIGNAL(saveFormDataRequested(const QString &, const QUrl &)), - messageWidget, SLOT(show())); - connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)), - messageWidget, SLOT(hide())); - connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)), - messageWidget, SLOT(hide())); - - } - } - } @@ -112,11 +83,6 @@ WebView::~WebView() WebPage *WebView::page() { - if(!m_page) - { - m_page = new WebPage(this); - setPage(m_page); - } return m_page; } diff --git a/src/webview.h b/src/webview.h index 18ea66ad..2b3b97a4 100644 --- a/src/webview.h +++ b/src/webview.h @@ -37,7 +37,6 @@ // Forward Declarations class WebPage; -class WalletWidget; class WebView : public KWebView @@ -45,7 +44,7 @@ class WebView : public KWebView Q_OBJECT public: - explicit WebView(QWidget *parent = 0, QWidget *messageWidget = 0); + explicit WebView(QWidget *parent = 0); ~WebView(); WebPage *page(); @@ -75,8 +74,7 @@ private slots: void loadInNewTab(const KUrl &url); private: - WebPage *m_page; - QWidget *m_messageWidget; + WebPage *const m_page; int m_progress; QString m_statusBarText; QPoint m_mousePos; |