From 5257a168febf317f90a6383373586fcb535393d1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Jun 2009 17:37:10 +0200 Subject: New Tab tool button --- src/mainview.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 6f3ad926..ce43cbc2 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -65,6 +65,7 @@ MainView::MainView(QWidget *parent) , m_recentlyClosedTabsMenu(new KMenu(this)) , m_urlBars(new StackedUrlBar(this)) , m_tabBar(new TabBar(this)) + , m_addTabButton(new QToolButton(this)) { // setting tabbar setTabBar(m_tabBar); @@ -97,6 +98,11 @@ MainView::~MainView() void MainView::postLaunch() { + m_addTabButton->setDefaultAction(Application::instance()->mainWindow()->actionByName("new_tab")); + m_addTabButton->setAutoRaise(true); + m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); + + // Recently Closed Tab Action connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); @@ -106,6 +112,37 @@ void MainView::postLaunch() } +void MainView::addTabButtonPosition() +{ + static bool ButtonInCorner = false; + + QSize s1 = frameSize(); + int tabWidgetWidth = s1.width(); + + QSize s2 = tabBar()->sizeHint(); + int newPos = s2.width(); + + if( newPos > tabWidgetWidth ) + { + if(ButtonInCorner) + return; + setCornerWidget(m_addTabButton); + ButtonInCorner = true; + } + else + { + if(ButtonInCorner) + { + setCornerWidget(0); + m_addTabButton->show(); + ButtonInCorner = false; + } + m_addTabButton->move(newPos, 0); + } + +} + + UrlBar *MainView::currentUrlBar() const { return urlBar(-1); @@ -387,6 +424,7 @@ WebView *MainView::newWebView(Rekonq::OpenType type) emit tabsChanged(); showTabBar(); + addTabButtonPosition(); return webView; } @@ -446,6 +484,7 @@ void MainView::slotCloseOtherTabs(int index) } showTabBar(); + addTabButtonPosition(); } @@ -460,6 +499,7 @@ void MainView::slotCloneTab(int index) tab->setUrl(webView(index)->url()); showTabBar(); + addTabButtonPosition(); } @@ -521,6 +561,7 @@ void MainView::slotCloseTab(int index) } showTabBar(); + addTabButtonPosition(); } -- cgit v1.2.1 From 0a8e7f56c426639dd140558dd685c72d24a22e79 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Jun 2009 18:33:59 +0200 Subject: Removed recently closed tabs history --- src/mainview.cpp | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index ce43cbc2..d6c97511 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -61,8 +61,6 @@ MainView::MainView(QWidget *parent) : KTabWidget(parent) - , m_recentlyClosedTabsAction(0) - , m_recentlyClosedTabsMenu(new KMenu(this)) , m_urlBars(new StackedUrlBar(this)) , m_tabBar(new TabBar(this)) , m_addTabButton(new QToolButton(this)) @@ -101,14 +99,6 @@ void MainView::postLaunch() m_addTabButton->setDefaultAction(Application::instance()->mainWindow()->actionByName("new_tab")); m_addTabButton->setAutoRaise(true); m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - - - // Recently Closed Tab Action - connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); - connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); - m_recentlyClosedTabsAction = new KAction(i18n("Recently Closed Tabs"), this); - m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); - m_recentlyClosedTabsAction->setEnabled(false); } @@ -173,12 +163,6 @@ int MainView::webViewIndex(WebView *webView) const } -KAction *MainView::recentlyClosedTabsAction() const -{ - return m_recentlyClosedTabsAction; -} - - void MainView::setMakeBackTab(bool b) { m_makeBackTab = b; @@ -284,8 +268,6 @@ void MainView::slotWebPaste() void MainView::clear() { - // clear the recently closed tabs - m_recentlyClosedTabs.clear(); // clear the line edit history for (int i = 0; i < m_urlBars->count(); ++i) { @@ -529,20 +511,6 @@ void MainView::slotCloseTab(int index) return; } hasFocus = tab->hasFocus(); - - m_recentlyClosedTabsAction->setEnabled(true); - m_recentlyClosedTabs.prepend(tab->url()); - - // don't add empty urls - if (tab->url().isValid()) - { - m_recentlyClosedTabs.prepend(tab->url()); - } - - if (m_recentlyClosedTabs.size() >= MainView::m_recentlyClosedTabsSize) - { - m_recentlyClosedTabs.removeLast(); - } } QWidget *urlBar = m_urlBars->urlBar(index); @@ -678,28 +646,6 @@ void MainView::webViewUrlChanged(const QUrl &url) } -void MainView::aboutToShowRecentTabsMenu() -{ - m_recentlyClosedTabsMenu->clear(); - for (int i = 0; i < m_recentlyClosedTabs.count(); ++i) - { - KAction *action = new KAction(m_recentlyClosedTabsMenu); - action->setData(m_recentlyClosedTabs.at(i)); - QIcon icon = Application::instance()->icon(m_recentlyClosedTabs.at(i)); - action->setIcon(icon); - action->setText(m_recentlyClosedTabs.at(i).prettyUrl()); - m_recentlyClosedTabsMenu->addAction(action); - } -} - - -void MainView::aboutToShowRecentTriggeredAction(QAction *action) -{ - KUrl url = action->data().toUrl(); - loadUrl(url); -} - - void MainView::loadUrl(const KUrl &url) { if (url.isEmpty()) -- cgit v1.2.1 From 8e094f1119d4073e78697052397c42a90c527601 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 21 Jun 2009 01:29:05 +0200 Subject: New notify system --- src/mainview.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index d6c97511..2db26988 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -371,7 +371,7 @@ WebView *MainView::newWebView(Rekonq::OpenType type) // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); - connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int))); +// connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); @@ -553,20 +553,20 @@ void MainView::webViewLoadStarted() } -void MainView::webViewLoadProgress(int progress) -{ - WebView *webView = qobject_cast(sender()); - int index = webViewIndex(webView); - if (index != currentIndex() || index < 0) - { - return; - } - - double totalBytes = static_cast(webView->page()->totalBytes() / 1024); - - QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB")); - emit showStatusBarMessage(message); -} +// void MainView::webViewLoadProgress(int progress) +// { +// WebView *webView = qobject_cast(sender()); +// int index = webViewIndex(webView); +// if (index != currentIndex() || index < 0) +// { +// return; +// } +// +// double totalBytes = static_cast(webView->page()->totalBytes() / 1024); +// +// QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB")); +// emit showStatusBarMessage(message); +// } void MainView::webViewLoadFinished(bool ok) -- cgit v1.2.1 From 554b30dd0101524d846df6c76a07db011d4d0c00 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 21 Jun 2009 12:17:36 +0200 Subject: Deleting popup in empty msg --- src/mainview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 2db26988..05a32e7d 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -303,7 +303,7 @@ void MainView::slotCurrentChanged(int index) WebView *oldWebView = this->webView(m_urlBars->currentIndex()); if (oldWebView) { - disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)), + disconnect(oldWebView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); @@ -311,7 +311,7 @@ void MainView::slotCurrentChanged(int index) this, SIGNAL(loadProgress(int))); } - connect(webView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); + connect(webView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); -- cgit v1.2.1 From 9501cf849628c5aeef669f12db87d43ed03c357a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 21 Jun 2009 22:11:39 +0200 Subject: New notifying system. Perhaps this should be default for rekonq 0.2. Anyway, there are a lot of improvements needed. We'll see.. --- src/mainview.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 05a32e7d..75154528 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -371,7 +371,6 @@ WebView *MainView::newWebView(Rekonq::OpenType type) // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); -// connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); @@ -553,22 +552,6 @@ void MainView::webViewLoadStarted() } -// void MainView::webViewLoadProgress(int progress) -// { -// WebView *webView = qobject_cast(sender()); -// int index = webViewIndex(webView); -// if (index != currentIndex() || index < 0) -// { -// return; -// } -// -// double totalBytes = static_cast(webView->page()->totalBytes() / 1024); -// -// QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB")); -// emit showStatusBarMessage(message); -// } - - void MainView::webViewLoadFinished(bool ok) { WebView *webView = qobject_cast(sender()); @@ -591,9 +574,9 @@ void MainView::webViewLoadFinished(bool ok) } if (ok) - emit showStatusBarMessage(i18n("Done")); + emit showStatusBarMessage(i18n("Done"), Rekonq::Success); else - emit showStatusBarMessage(i18n("Failed to load")); + emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error); } -- cgit v1.2.1