From cc1df88787dcea2ae064de086fb448a9fa633323 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 2 Jul 2011 10:35:15 +0200 Subject: Insert back notification bars in webtab layout As Pierre pointed out, better insert bars inside layout to avoid usability loss. --- src/application.cpp | 8 +------- src/webtab.cpp | 20 +++++++++++++++++++- src/webtab.h | 2 ++ 3 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index a61c1ce3..40cfcffe 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -42,7 +42,6 @@ #include "iconmanager.h" #include "mainview.h" #include "mainwindow.h" -#include "messagebar.h" #include "opensearchmanager.h" #include "sessionmanager.h" #include "stackedurlbar.h" @@ -163,12 +162,7 @@ int Application::newInstance() if (isRekonqCrashed && isFirstLoad) { loadUrl(KUrl("about:closedTabs"), Rekonq::NewWindow); - MessageBar *msgBar = new MessageBar(i18n("It seems rekonq was not closed properly. Do you want " - "to restore the last saved session?") - , mainWindow()->currentTab()); - - connect(msgBar, SIGNAL(accepted()), sessionManager(), SLOT(restoreSession())); - msgBar->animatedShow(); + mainWindow()->currentTab()->showMessageBar(); } if (areThereArguments) diff --git a/src/webtab.cpp b/src/webtab.cpp index 386ad5dc..1493725b 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -40,7 +40,9 @@ #include "webpage.h" #include "webshortcutwidget.h" #include "application.h" +#include "sessionmanager.h" #include "opensearchmanager.h" +#include "messagebar.h" // KDE Includes #include @@ -140,11 +142,13 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url) { m_walletBar = new WalletBar(this); m_walletBar.data()->onSaveFormData(key, url); + qobject_cast(layout())->insertWidget(0, m_walletBar.data()); m_walletBar.data()->animatedShow(); } else { disconnect(wallet); + qobject_cast(layout())->insertWidget(0, m_walletBar.data()); m_walletBar.data()->animatedShow(); } @@ -160,6 +164,7 @@ void WebTab::createPreviewSelectorBar(int index) if (m_previewSelectorBar.isNull()) { m_previewSelectorBar = new PreviewSelectorBar(index, this); + qobject_cast(layout())->insertWidget(0, m_previewSelectorBar.data()); m_previewSelectorBar.data()->animatedShow(); } else @@ -172,7 +177,7 @@ void WebTab::createPreviewSelectorBar(int index) connect(page(), SIGNAL(loadStarted()), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection); connect(page(), SIGNAL(loadProgress(int)), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection); connect(page(), SIGNAL(loadFinished(bool)), m_previewSelectorBar.data(), SLOT(loadFinished()), Qt::UniqueConnection); - connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), m_previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection); + connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), m_previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection); } @@ -298,3 +303,16 @@ void WebTab::openSearchEngineAdded() disconnect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), this, SLOT(openSearchEngineAdded())); } + + +void WebTab::showMessageBar() +{ + MessageBar *msgBar = new MessageBar(i18n("It seems rekonq was not closed properly. Do you want " + "to restore the last saved session?") + , this); + + qobject_cast(layout())->insertWidget(0, msgBar); + msgBar->animatedShow(); + + connect(msgBar, SIGNAL(accepted()), rApp->sessionManager(), SLOT(restoreSession())); +} diff --git a/src/webtab.h b/src/webtab.h index ff347414..55c0dff4 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -89,6 +89,8 @@ public: } void setPart(KParts::ReadOnlyPart *p, const KUrl &u); + void showMessageBar(); + private Q_SLOTS: void updateProgress(int progress); void loadFinished(bool); -- cgit v1.2.1