summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-08 02:53:38 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-08 02:53:38 +0200
commit43dc2695d62fd2e4fc01aff608bb2af3e8335040 (patch)
treee854bca16452965d5e4d38bc1d36459bf723355f /src/mainview.cpp
parentrekonq 0.4.59 (diff)
downloadrekonq-43dc2695d62fd2e4fc01aff608bb2af3e8335040.tar.xz
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
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp56
1 files changed, 33 insertions, 23 deletions
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<UrlBar *>(_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);
+}