From 2c11a95da6772a63d85905d4712a1a2d016a9e1e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 6 Feb 2010 01:49:54 +0100 Subject: FIx focus on browsing (FIRST STEP) and on findbar hiding --- src/mainview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index b26e7466..bc9d0bda 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -308,7 +308,7 @@ void MainView::currentChanged(int index) emit browserTabLoading(false); // set focus to the current webview - tab->setFocus(); + tab->view()->setFocus(); } @@ -507,8 +507,8 @@ void MainView::closeTab(int index) } removeTab(index); - updateTabBar(); // UI operation: do it ASAP!! - tab->deleteLater(); // webView is scheduled for deletion. + updateTabBar(); // UI operation: do it ASAP!! + tab->deleteLater(); // webView is scheduled for deletion. emit tabsChanged(); -- cgit v1.2.1 From 79ce24b2d2d50c5dd594c25200122d07bb0e232c Mon Sep 17 00:00:00 2001 From: matgic78 Date: Tue, 2 Feb 2010 18:42:19 +0100 Subject: Replace zoom setting submenu by a widget with a slider --- src/mainview.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index b26e7466..02823d3b 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -306,6 +306,10 @@ void MainView::currentChanged(int index) emit browserTabLoading(true); else emit browserTabLoading(false); + + // update zoom slider + if(!Application::instance()->mainWindowList().isEmpty()) + Application::instance()->mainWindow()->setZoomSliderFactor(tab->view()->zoomFactor()); // set focus to the current webview tab->setFocus(); -- cgit v1.2.1 From 067b99a053b6f8b1ccab507be8e828b2f72a1e43 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Feb 2010 10:57:57 +0100 Subject: Fix copyright for 0.4 beta release --- src/mainview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 57185fd2..8034563b 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -2,9 +2,10 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008-2009 by Andrea Diamantini +* Copyright (C) 2008-2010 by Andrea Diamantini * Copyright (C) 2009 by Paweł Prażak -* Copyright (C) 2009 by Lionel Chauvin +* Copyright (C) 2009-2010 by Lionel Chauvin +* Copyright (C) 2010 by Matthieu Gicquel * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1 From f364b998624e403a33dd1b79983f80b2d058da26 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 16 Feb 2010 02:12:45 +0100 Subject: Fixes focus && let Protocol handler to just load on demand the KDirLister class (and delete on finish) --- 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 8034563b..cf79ad9e 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -501,7 +501,7 @@ void MainView::closeTab(int index) } hasFocus = tab->hasFocus(); - //store close tab except homepage + // store close tab except homepage if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty()) { QString title = tab->view()->title(); @@ -513,7 +513,7 @@ void MainView::closeTab(int index) removeTab(index); updateTabBar(); // UI operation: do it ASAP!! - tab->deleteLater(); // webView is scheduled for deletion. + tab->deleteLater(); // tab is scheduled for deletion. emit tabsChanged(); -- cgit v1.2.1 From 0b8fccd40887dc0b37a7d4b8c44992a9fedb4502 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 18 Feb 2010 03:03:21 +0100 Subject: don't change stop/reload icon on not focused loading pages. BUG: 227277 --- src/mainview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index cf79ad9e..0db31c1a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -538,11 +538,10 @@ void MainView::webViewLoadStarted() } } - emit browserTabLoading(true); - if (index != currentIndex()) return; + emit browserTabLoading(true); emit showStatusBarMessage(i18n("Loading...")); } -- cgit v1.2.1 From 871fa5c3a2f0f85f7338171c3d7660167150c69d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 18 Feb 2010 03:26:42 +0100 Subject: half fixed (but half is not enough...) the favicon querelle.. --- src/mainview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 0db31c1a..940e1273 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -583,7 +583,7 @@ void MainView::webViewIconChanged() int index = indexOf( view->parentWidget() ); if (-1 != index) { - QIcon icon = Application::icon(view->url()); + KIcon icon = Application::icon(view->url()); QLabel *label = animatedLoading(index, false); QMovie *movie = label->movie(); delete movie; -- cgit v1.2.1 From b0ef8fdaa1f36f144980f9df30707deb7a076403 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Feb 2010 12:27:01 +0100 Subject: Save memory. One tabBar pointer less for each mainwindow --- src/mainview.cpp | 63 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 940e1273..98d8b0a6 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -63,15 +63,15 @@ MainView::MainView(MainWindow *parent) - : KTabWidget(parent) - , m_urlBar(new UrlBar(this)) - , m_tabBar(new TabBar(this)) - , m_addTabButton(new QToolButton(this)) - , m_currentTabIndex(0) - , m_parentWindow(parent) + : KTabWidget(parent) + , m_urlBar(new UrlBar(this)) + , m_addTabButton(new QToolButton(this)) + , m_currentTabIndex(0) + , m_parentWindow(parent) { // setting tabbar - setTabBar(m_tabBar); + TabBar *tabBar = new TabBar(this); + setTabBar(tabBar); // set mouse tracking for tab previews setMouseTracking(true); @@ -80,17 +80,17 @@ MainView::MainView(MainWindow *parent) m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng"); // connecting tabbar signals - connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); - connect(m_tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int))); - connect(m_tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab())); + connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)) ); + connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)) ); + connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()) ); - connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); - connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int))); - connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); - connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); - connect(m_tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int))); + connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)) ); + connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)) ); + connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)) ); + connect(tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()) ); + connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)) ); - connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); + connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)) ); // current page index changing connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); @@ -123,7 +123,7 @@ void MainView::updateTabButtonPosition() static bool ButtonInCorner = false; int tabWidgetWidth = frameSize().width(); - int tabBarWidth = m_tabBar->tabSizeHint(0).width()*m_tabBar->count(); + int tabBarWidth = tabBar()->tabSizeHint(0).width() * tabBar()->count(); if (tabBarWidth + m_addTabButton->width() > tabWidgetWidth) { @@ -143,7 +143,7 @@ void MainView::updateTabButtonPosition() // detecting X position int newPosX = tabBarWidth; - int tabWidthHint = m_tabBar->tabSizeHint(0).width(); + int tabWidthHint = tabBar()->tabSizeHint(0).width(); if (tabWidthHint < sizeHint().width()/4) newPosX = tabWidgetWidth - m_addTabButton->width(); @@ -164,7 +164,8 @@ QToolButton *MainView::addTabButton() const TabBar *MainView::tabBar() const { - return m_tabBar; + TabBar *tabBar = qobject_cast( KTabWidget::tabBar() ); + return tabBar; } @@ -182,13 +183,13 @@ WebTab *MainView::currentWebTab() const void MainView::updateTabBar() { - if (ReKonfig::alwaysShowTabBar()) + if( ReKonfig::alwaysShowTabBar() ) { if (!isTabBarHidden()) { - if (m_tabBar->isHidden()) + if (tabBar()->isHidden()) { - m_tabBar->show(); + tabBar()->show(); m_addTabButton->show(); } updateTabButtonPosition(); @@ -196,16 +197,16 @@ void MainView::updateTabBar() return; } - if (m_tabBar->count() == 1) + if( tabBar()->count() == 1 ) { - m_tabBar->hide(); + tabBar()->hide(); m_addTabButton->hide(); } - else if (!isTabBarHidden()) + else if( !isTabBarHidden() ) { - if (m_tabBar->isHidden()) + if ( tabBar()->isHidden() ) { - m_tabBar->show(); + tabBar()->show(); m_addTabButton->show(); } updateTabButtonPosition(); @@ -622,7 +623,7 @@ void MainView::webViewUrlChanged(const QUrl &url) int index = indexOf( view->parentWidget() ); if (-1 != index) { - m_tabBar->setTabData(index, url); + tabBar()->setTabData(index, url); } emit tabsChanged(); } @@ -651,7 +652,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie) if (index == -1) return 0; - QLabel *label = qobject_cast(m_tabBar->tabButton(index, QTabBar::LeftSide)); + QLabel *label = qobject_cast(tabBar()->tabButton(index, QTabBar::LeftSide)); if (!label) { label = new QLabel(this); @@ -663,8 +664,8 @@ QLabel *MainView::animatedLoading(int index, bool addMovie) label->setMovie(movie); movie->start(); } - m_tabBar->setTabButton(index, QTabBar::LeftSide, 0); - m_tabBar->setTabButton(index, QTabBar::LeftSide, label); + tabBar()->setTabButton(index, QTabBar::LeftSide, 0); + tabBar()->setTabButton(index, QTabBar::LeftSide, label); return label; } -- cgit v1.2.1 From cdb535abac3fed5893117acefaaac392f4209ad1 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 20 Feb 2010 12:52:20 +0100 Subject: The newTab button must be initialized after the tabBar. (Fix the regression introduced by b0ef8fdaa1f36f144980f9df30707deb7a076403) --- src/mainview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 98d8b0a6..cfce0fb0 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -65,12 +65,12 @@ MainView::MainView(MainWindow *parent) : KTabWidget(parent) , m_urlBar(new UrlBar(this)) - , m_addTabButton(new QToolButton(this)) , m_currentTabIndex(0) , m_parentWindow(parent) { // setting tabbar TabBar *tabBar = new TabBar(this); + m_addTabButton = new QToolButton(this); setTabBar(tabBar); // set mouse tracking for tab previews -- cgit v1.2.1 From 2700aa28cf109ff83f9b3619d5475f98a7b4b62b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 20 Feb 2010 15:04:24 +0100 Subject: Restored addTabButton ctor initialization --- src/mainview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index cfce0fb0..bad6999b 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -65,6 +65,7 @@ MainView::MainView(MainWindow *parent) : KTabWidget(parent) , m_urlBar(new UrlBar(this)) + , m_addTabButton(0) , m_currentTabIndex(0) , m_parentWindow(parent) { -- cgit v1.2.1 From ad14cf95df6e432f747ff1d144621523f837e2b1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 24 Feb 2010 16:11:08 +0100 Subject: Again and again.. :) Saving one QString for each tab.. --- src/mainview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index bad6999b..e2f9094f 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -294,15 +294,17 @@ void MainView::currentChanged(int index) connect(tab->view(), SIGNAL(loadFinished(bool)), urlBar(), SLOT(loadFinished(bool))); connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), urlBar(), SLOT(setUrl(const QUrl &))); - connect(tab->view()->page(), SIGNAL(statusBarMessage(const QString&)), + connect(tab->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); - connect(tab->view()->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), + connect(tab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); emit setCurrentTitle(tab->view()->title()); urlBar()->setUrl(tab->view()->url()); urlBar()->setProgress(tab->progress()); - emit showStatusBarMessage(tab->lastStatusBarText()); + + // clean up "status bar" + emit showStatusBarMessage( QString() ); // notify UI to eventually switch stop/reload button if(urlBar()->isLoading()) -- cgit v1.2.1 From 9f29a5eb7223ea2edd7a9f3ee39dd9285820affb Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 24 Feb 2010 19:04:05 +0100 Subject: Simpler is better :) removed doubled check --- src/mainview.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index e2f9094f..9693bb69 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -186,15 +186,12 @@ void MainView::updateTabBar() { if( ReKonfig::alwaysShowTabBar() ) { - if (!isTabBarHidden()) + if (tabBar()->isHidden()) { - if (tabBar()->isHidden()) - { - tabBar()->show(); - m_addTabButton->show(); - } - updateTabButtonPosition(); + tabBar()->show(); + m_addTabButton->show(); } + updateTabButtonPosition(); return; } @@ -203,7 +200,7 @@ void MainView::updateTabBar() tabBar()->hide(); m_addTabButton->hide(); } - else if( !isTabBarHidden() ) + else { if ( tabBar()->isHidden() ) { -- cgit v1.2.1 From 33962a25efb91befee681a9762330480f04db383 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 26 Feb 2010 01:15:07 +0100 Subject: Revert "Simpler is better :)" bacause it sometimes works worst :( This reverts commit 9f29a5eb7223ea2edd7a9f3ee39dd9285820affb. --- src/mainview.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 9693bb69..e2f9094f 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -186,12 +186,15 @@ void MainView::updateTabBar() { if( ReKonfig::alwaysShowTabBar() ) { - if (tabBar()->isHidden()) + if (!isTabBarHidden()) { - tabBar()->show(); - m_addTabButton->show(); + if (tabBar()->isHidden()) + { + tabBar()->show(); + m_addTabButton->show(); + } + updateTabButtonPosition(); } - updateTabButtonPosition(); return; } @@ -200,7 +203,7 @@ void MainView::updateTabBar() tabBar()->hide(); m_addTabButton->hide(); } - else + else if( !isTabBarHidden() ) { if ( tabBar()->isHidden() ) { -- cgit v1.2.1 From e846f0e8cc58036a6fc6455f8a40f621c636cbc5 Mon Sep 17 00:00:00 2001 From: pano Date: Sat, 6 Mar 2010 16:37:47 +0100 Subject: Replace "Yes/No" dialog code copied and pasted from Konqueror (konqmainwindow.cpp) and adapted to rekonq code by me --- src/mainview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index e2f9094f..fc4ddc6c 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -495,12 +495,12 @@ void MainView::closeTab(int index) { if (tab->view()->isModified()) { - int risp = KMessageBox::questionYesNo(this, + int risp = KMessageBox::warningContinueCancel(this, i18n("This tab contains changes that have not been submitted.\n" "Closing the tab will discard these changes.\n" "Do you really want to close this tab?\n"), - i18n("Closing Modified Tab")); - if (risp == KMessageBox::No) + i18n("Closing Modified Tab"), KGuiItem(i18n("&Discard Changes"),"view-refresh"), KStandardGuiItem::cancel()); + if (risp != KMessageBox::Continue) return; } hasFocus = tab->hasFocus(); -- cgit v1.2.1 From 87fabef6340c83c7c8746f37aa70b9d7a54b7d5e Mon Sep 17 00:00:00 2001 From: pano Date: Sat, 6 Mar 2010 16:46:55 +0100 Subject: Further changes to my last commit Change string and icon of the button --- src/mainview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index fc4ddc6c..f2152364 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -499,7 +499,7 @@ void MainView::closeTab(int index) i18n("This tab contains changes that have not been submitted.\n" "Closing the tab will discard these changes.\n" "Do you really want to close this tab?\n"), - i18n("Closing Modified Tab"), KGuiItem(i18n("&Discard Changes"),"view-refresh"), KStandardGuiItem::cancel()); + i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel()); if (risp != KMessageBox::Continue) return; } -- cgit v1.2.1 From 942c55b945443a2e6dd9a2d3660347fc2176630a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 29 Mar 2010 11:47:42 +0200 Subject: This commit merge all our work about new UrlBar. DISCLAIMER: this is far from perfect, but we finally have a good starting point to work on.. :) Jonas Gastal started working on it in the 0.3 times, startin from CompletionBase code .. .. I did some work on another idea, proposing (in code) a new "suggest engine" created from scratch... Lionel Chauvin finally merged our ideas and implemented what you are seeing (and improved it, too!).. - New suggestion items (Firefox style) - a mockup on the known urls (rekonq style) - for now, automatic Google and Wikipedia searches (more coming).. - a beautiful animation :) - quite all rough edges smoothed -------------------------------------------------------- Squashed commit of the following: commit d9cf43da421c7f6c71f78444ff1935c414468b98 commit 9dcb6e18f8a3e9ae8ef1cd1299d47d37393aa6e5 commit 6c4bf2b2040ea20c78c5703f20c6bc88b7e40169 commit 8488df67115d186489f34210b638c150c66f62d3 commit 066ab907661282b1ffa4cf640739c20b4c7b6556 commit c23e23cbca7ab3197c570651a95d3f8fea270d78 commit 60655b0a8685a76e2b8b7a457bfded974bc98b4c commit 9a8817db124b55f501c9e5d3415a975ee6f92d68 commit 61312b6b577a535a4d56758b3bd3ea38812d5139 commit b6a3f4ea12423a063eafa641cedd13b890b9d392 commit 5e8e2f851edb42bc2deed296c26c58c3d7570381 commit 2904d828f71ac8ff46a53e58da8f45b5aa16e7ef --------------------------------------------------------- --- src/mainview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index f2152364..6643becb 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -242,8 +242,7 @@ void MainView::clear() { // FIXME (the programmer, not the code) // What exactly do we need to clear here? - m_urlBar->clearHistory(); - m_urlBar->clear(); + m_urlBar->clear(); m_recentlyClosedTabs.clear(); } -- cgit v1.2.1 From 80b37fa28d6c4e148ac0c69e91e07c1679866c54 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Mar 2010 11:26:07 +0200 Subject: Cleaning urlbar API and improving animation WARNING: This is the best animation I could provide with the KComboBox class. In the KLineEdit derived it works perfectly. In the Combos there are some shadows on top :( Squashed commit of the following: commit 01e72a1996161028f8dbdc4e355daf00f954eace commit 8bc032d98a4987d3b01566ac520f5e8a1a095dd0 commit bc5cfd9f7d1b34f5af06dd7af6de8d3b2edb277b commit 73b4deac84d91fece407b9c700dcc61e36a34327 commit c55b753913b2619607c6aa11cabbf77ca3c84e3e commit b901fbe71b7539f65260c4fa9bbfb22f4ea997b9 commit 1de363d9614c1309ac1ac4a8eea7e70be7f2f3ed commit 76d6373f8b6c41f5c27b8404db2074f9bfc309c9 commit d741aa7109db016abc292d49fb45d15bb09e6c01 --- src/mainview.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index 6643becb..a00325fb 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -275,41 +275,31 @@ void MainView::currentChanged(int index) m_currentTabIndex = index; if (oldTab) - { - // disconnecting webview from urlbar - disconnect(oldTab->view(), SIGNAL(loadProgress(int)), urlBar(), SLOT(updateProgress(int))); - disconnect(oldTab->view(), SIGNAL(loadFinished(bool)), urlBar(), SLOT(loadFinished(bool))); - disconnect(oldTab->view(), SIGNAL(urlChanged(const QUrl &)), urlBar(), SLOT(setUrl(const QUrl &))); - + { // disconnecting webpage from mainview disconnect(oldTab->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); disconnect(oldTab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); } - - // connecting webview with urlbar - connect(tab->view(), SIGNAL(loadProgress(int)), urlBar(), SLOT(updateProgress(int))); - connect(tab->view(), SIGNAL(loadFinished(bool)), urlBar(), SLOT(loadFinished(bool))); - connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), urlBar(), SLOT(setUrl(const QUrl &))); connect(tab->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); connect(tab->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); - emit setCurrentTitle(tab->view()->title()); - urlBar()->setUrl(tab->view()->url()); - urlBar()->setProgress(tab->progress()); - + emit currentTitle(tab->view()->title()); + urlBar()->setCurrentTab(tab); + // clean up "status bar" emit showStatusBarMessage( QString() ); // notify UI to eventually switch stop/reload button - if(urlBar()->isLoading()) - emit browserTabLoading(true); - else + int progr = tab->progress(); + if(progr == 0) emit browserTabLoading(false); + else + emit browserTabLoading(true); // update zoom slider if(!Application::instance()->mainWindowList().isEmpty()) @@ -613,7 +603,7 @@ void MainView::webViewTitleChanged(const QString &title) } if (currentIndex() == index) { - emit setCurrentTitle(tabTitle); + emit currentTitle(tabTitle); } Application::historyManager()->updateHistoryEntry(view->url(), tabTitle); } -- cgit v1.2.1 From 352168759ea96b35296eaf33790fbe073b69f69b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 5 Apr 2010 01:31:13 +0200 Subject: This commit is the first implementation of a new new new urlbar Here are its features: - KLineEdit based - ability to easily add "icons" :) - SSL informations shown (a-la firefox) - smoother animation - cleaner code - data QString, not KUrl based (Users type string, not urls!!!) --- src/mainview.cpp | 68 +++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index a00325fb..b5829806 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -366,7 +366,7 @@ void MainView::newTab() w->load( KUrl("about:home") ); break; case 1: // blank page - urlBar()->setUrl(KUrl("")); + urlBar()->clear(); break; case 2: // homepage w->load( KUrl(ReKonfig::homePage()) ); @@ -452,16 +452,18 @@ void MainView::cloneTab(int index) // When index is -1 index chooses the current tab void MainView::closeTab(int index) { + urlBar()->clear(); + // open default homePage if just one tab is opened if (count() == 1) { WebView *w = currentWebTab()->view(); - urlBar()->setUrl(KUrl("")); switch(ReKonfig::newTabsBehaviour()) { case 0: // new tab page case 1: // blank page w->load( KUrl("about:home") ); + urlBar()->setFocus(); break; case 2: // homepage w->load( KUrl(ReKonfig::homePage()) ); @@ -469,7 +471,6 @@ void MainView::closeTab(int index) default: break; } - urlBar()->setFocus(); return; } @@ -478,43 +479,36 @@ void MainView::closeTab(int index) if (index < 0 || index >= count()) return; - bool hasFocus = false; WebTab *tab = webTab(index); - if (tab) - { - if (tab->view()->isModified()) - { - int risp = KMessageBox::warningContinueCancel(this, - i18n("This tab contains changes that have not been submitted.\n" - "Closing the tab will discard these changes.\n" - "Do you really want to close this tab?\n"), - i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel()); - if (risp != KMessageBox::Continue) - return; - } - hasFocus = tab->hasFocus(); - - // store close tab except homepage - if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty()) - { - QString title = tab->view()->title(); - QString url = tab->url().prettyUrl(); - HistoryItem item(url, QDateTime::currentDateTime(), title); - m_recentlyClosedTabs.removeAll(item); - m_recentlyClosedTabs.prepend(item); - } + if (!tab) + return; - removeTab(index); - updateTabBar(); // UI operation: do it ASAP!! - tab->deleteLater(); // tab is scheduled for deletion. - - emit tabsChanged(); + if (tab->view()->isModified()) + { + int risp = KMessageBox::warningContinueCancel(this, + i18n("This tab contains changes that have not been submitted.\n" + "Closing the tab will discard these changes.\n" + "Do you really want to close this tab?\n"), + i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel()); + if (risp != KMessageBox::Continue) + return; + } - if (hasFocus && count() > 0) - { - currentWebTab()->setFocus(); - } + // store close tab except homepage + if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty()) + { + QString title = tab->view()->title(); + QString url = tab->url().prettyUrl(); + HistoryItem item(url, QDateTime::currentDateTime(), title); + m_recentlyClosedTabs.removeAll(item); + m_recentlyClosedTabs.prepend(item); } + + removeTab(index); + updateTabBar(); // UI operation: do it ASAP!! + tab->deleteLater(); // tab is scheduled for deletion. + + emit tabsChanged(); } @@ -582,8 +576,6 @@ void MainView::webViewIconChanged() delete movie; label->setMovie(0); label->setPixmap(icon.pixmap(16, 16)); - - urlBar()->updateUrl(); } } -- cgit v1.2.1 From 43dc2695d62fd2e4fc01aff608bb2af3e8335040 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 8 Apr 2010 02:53:38 +0200 Subject: This is a really big commit, implementing the new urlbar - removed previous SSL animation, we have now a nice yellow lock :) - faster and cleaner animations - reenabled the old stacked widget, to avoid stupid refreshes and fix some regressions - implemented some "right icons": KGet, SSL, RSS. For now, just SSL is full featured - clean up the box :) Some old & unuseful files removed, some icons added - Pano's request: grey text shown everytime in the empty bar Again and again: this is not the first, but the second implementation of the new urlbar UI. About me this is clearly better than the first or the previous. But it needs love :D BUG: 230125 BUG: 231015 CCBUG: 228040 BUG: 227272 --- src/mainview.cpp | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index b5829806..d5c552f2 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -64,7 +64,7 @@ MainView::MainView(MainWindow *parent) : KTabWidget(parent) - , m_urlBar(new UrlBar(this)) + , _bars(new QStackedWidget(this)) , m_addTabButton(0) , m_currentTabIndex(0) , m_parentWindow(parent) @@ -92,6 +92,7 @@ MainView::MainView(MainWindow *parent) connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)) ); connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)) ); + connect(tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(movedTab(int, int)) ); // current page index changing connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); @@ -119,8 +120,6 @@ void MainView::postLaunch() void MainView::updateTabButtonPosition() { - kDebug() << "updating new tab button position.."; - static bool ButtonInCorner = false; int tabWidgetWidth = frameSize().width(); @@ -151,7 +150,6 @@ void MainView::updateTabButtonPosition() // Y position is fixed // Here I noticed with some emphiric valutations ( :D ) // that 2 look better than 0, just that.. - m_addTabButton->move(newPosX, 2); } } @@ -170,9 +168,15 @@ TabBar *MainView::tabBar() const } -UrlBar *MainView::urlBar() const +UrlBar *MainView::urlBar() const +{ + return qobject_cast(_bars->widget(m_currentTabIndex)); +} + + +QWidget *MainView::urlBarWidget() const { - return m_urlBar; + return _bars; } @@ -238,16 +242,6 @@ void MainView::webStop() } -void MainView::clear() -{ - // FIXME (the programmer, not the code) - // What exactly do we need to clear here? - m_urlBar->clear(); - - m_recentlyClosedTabs.clear(); -} - - // When index is -1 index chooses the current tab void MainView::reloadTab(int index) { @@ -289,7 +283,7 @@ void MainView::currentChanged(int index) this, SIGNAL(linkHovered(const QString&))); emit currentTitle(tab->view()->title()); - urlBar()->setCurrentTab(tab); + _bars->setCurrentIndex(index); // clean up "status bar" emit showStatusBarMessage( QString() ); @@ -326,7 +320,8 @@ WebTab *MainView::webTab(int index) const WebTab *MainView::newWebTab(bool focused, bool nearParent) { WebTab* tab = new WebTab(this); - + UrlBar *bar = new UrlBar(tab); + // connecting webview with mainview connect(tab->view(), SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); connect(tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); @@ -339,10 +334,15 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent) connect(tab->view()->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); if (nearParent) + { insertTab(currentIndex() + 1, tab, i18n("(Untitled)")); + _bars->insertWidget(currentIndex() + 1, bar); + } else + { addTab(tab, i18n("(Untitled)")); - + _bars->addWidget(bar); + } updateTabBar(); if (focused) @@ -374,7 +374,7 @@ void MainView::newTab() default: break; } - urlBar()->setFocus(); + urlBarWidget()->setFocus(); } @@ -452,8 +452,6 @@ void MainView::cloneTab(int index) // When index is -1 index chooses the current tab void MainView::closeTab(int index) { - urlBar()->clear(); - // open default homePage if just one tab is opened if (count() == 1) { @@ -463,7 +461,7 @@ void MainView::closeTab(int index) case 0: // new tab page case 1: // blank page w->load( KUrl("about:home") ); - urlBar()->setFocus(); + urlBarWidget()->setFocus(); break; case 2: // homepage w->load( KUrl(ReKonfig::homePage()) ); @@ -507,6 +505,10 @@ void MainView::closeTab(int index) removeTab(index); updateTabBar(); // UI operation: do it ASAP!! tab->deleteLater(); // tab is scheduled for deletion. + + QWidget *urlbar = _bars->widget(index); + _bars->removeWidget(urlbar); + urlbar->deleteLater(); emit tabsChanged(); } @@ -679,3 +681,11 @@ void MainView::detachTab(int index) Application::instance()->loadUrl(url, Rekonq::NewWindow); } + + +void MainView::movedTab(int from,int to) +{ + QWidget *bar = _bars->widget(from); + _bars->removeWidget(bar); + _bars->insertWidget(to, bar); +} -- cgit v1.2.1 From 23d65a3a5c1e6c0e2501d41ae0660c89085dbb84 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 10 Apr 2010 00:35:01 +0200 Subject: Fix focus problems and trim search strings (fix encodings problems, step 1) --- src/mainview.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index d5c552f2..a5eaa748 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -61,6 +61,9 @@ #include #include +// Defines +#define QL1S(x) QLatin1String(x) + MainView::MainView(MainWindow *parent) : KTabWidget(parent) @@ -300,7 +303,10 @@ void MainView::currentChanged(int index) Application::instance()->mainWindow()->setZoomSliderFactor(tab->view()->zoomFactor()); // set focus to the current webview - tab->view()->setFocus(); + if(tab->url().scheme() == QL1S("about")) + _bars->currentWidget()->setFocus(); + else + tab->view()->setFocus(); } @@ -374,7 +380,7 @@ void MainView::newTab() default: break; } - urlBarWidget()->setFocus(); + _bars->currentWidget()->setFocus(); } -- cgit v1.2.1 From 67f95af6b1649cd07ac2e3ba5a09ef1b7b875574 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 17 Apr 2010 23:33:31 +0200 Subject: Fix the url bar focus when the only tab is closed --- src/mainview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainview.cpp') diff --git a/src/mainview.cpp b/src/mainview.cpp index a5eaa748..cb2e3b11 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -467,7 +467,7 @@ void MainView::closeTab(int index) case 0: // new tab page case 1: // blank page w->load( KUrl("about:home") ); - urlBarWidget()->setFocus(); + urlBar()->setFocus(); break; case 2: // homepage w->load( KUrl(ReKonfig::homePage()) ); -- cgit v1.2.1