diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2009-12-13 16:39:26 +0100 |
---|---|---|
committer | megabigbug <megabigbug@arrakis.(none)> | 2009-12-13 16:39:26 +0100 |
commit | c0d7804c239a15451a7ca61e902c1e80c5c22378 (patch) | |
tree | 9b8e658b4aa6b8470bd6dc3c3a414931c0dd61b1 /src/mainview.cpp | |
parent | Merge commit 'refs/merge-requests/64' of git://gitorious.org/rekonq/mainline (diff) | |
download | rekonq-c0d7804c239a15451a7ca61e902c1e80c5c22378.tar.xz |
walletwidget on top of the webview (not over)
add close button
add icons
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 4437936d..d2105dcd 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -59,7 +59,7 @@ #include <QtGui/QLabel> #include <QtGui/QMovie> #include <QtGui/QWidget> - +#include <QtGui/QVBoxLayout> MainView::MainView(MainWindow *parent) : KTabWidget(parent) @@ -182,8 +182,8 @@ WebView *MainView::currentWebView() const int MainView::webViewIndex(WebView *webView) const -{ - return indexOf(webView); +{ + return indexOf(webView->parentWidget()); } @@ -252,9 +252,7 @@ void MainView::reloadTab(int index) if (index < 0 || index >= count()) return; - QWidget *widget = this->widget(index); - if (WebView *tab = qobject_cast<WebView*>(widget)) - tab->reload(); + webView(index)->reload(); } @@ -314,10 +312,13 @@ void MainView::currentChanged(int index) WebView *MainView::webView(int index) const { - QWidget *widget = this->widget(index); - if (WebView *webView = qobject_cast<WebView*>(widget)) + if (this->widget(index) && this->widget(index)->layout() && this->widget(index)->layout()->itemAt(1)) //TODO: find why it crashes when closetab without that. { - return webView; + QWidget *widget = this->widget(index)->layout()->itemAt(1)->widget(); + if (WebView *webView = qobject_cast<WebView*>(widget)) + { + return webView; + } } kDebug() << "WebView with index " << index << "not found. Returning NULL." ; @@ -327,8 +328,20 @@ WebView *MainView::webView(int index) const WebView *MainView::newWebView(bool focused, bool nearParent) { - WebView *webView = new WebView; // should be deleted on tab close? - + QWidget* w=new QWidget; + QVBoxLayout* l=new QVBoxLayout(w); + l->setMargin(0); + QWidget* messageBar=new QWidget; // should be deleted on tab close? + QVBoxLayout* l2=new QVBoxLayout(messageBar); + l->addWidget(messageBar); + + messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); + messageBar->hide(); + + WebView *webView = new WebView(w,messageBar); // should be deleted on tab close? + l->addWidget(webView); + webView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); @@ -339,17 +352,17 @@ WebView *MainView::newWebView(bool focused, bool nearParent) // connecting webPage signals with mainview connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); - + if (nearParent) - insertTab(currentIndex() + 1, webView, i18n("(Untitled)")); + insertTab(currentIndex() + 1, w, i18n("(Untitled)")); else - addTab(webView, i18n("(Untitled)")); + addTab(w, i18n("(Untitled)")); updateTabBar(); if (focused) { - setCurrentWidget(webView); + setCurrentWidget(w); } emit tabsChanged(); @@ -384,11 +397,7 @@ void MainView::reloadAllTabs() { for (int i = 0; i < count(); ++i) { - QWidget *tabWidget = widget(i); - if (WebView *tab = qobject_cast<WebView*>(tabWidget)) - { - tab->reload(); - } + webView(i)->reload(); } } @@ -493,7 +502,7 @@ void MainView::closeTab(int index) } } - QWidget *webView = widget(index); + QWidget *webView = this->webView(index); removeTab(index); updateTabBar(); // UI operation: do it ASAP!! webView->deleteLater(); // webView is scheduled for deletion. |