summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorDomrachev Alexandr <alexandr.domrachev@gmail.com>2009-06-20 14:40:50 +0400
committerDomrachev Alexandr <alexandr.domrachev@gmail.com>2009-06-20 14:40:50 +0400
commitb3c0db45efc83bfba6f02f00b769b2870f9c40ba (patch)
tree52aa989abe5312c492f5ebb73dba0610751e59e8 /src/mainview.cpp
parentApplication::icon() changed to static (diff)
parentrekonq 0.1.5: UI changes (diff)
downloadrekonq-b3c0db45efc83bfba6f02f00b769b2870f9c40ba.tar.xz
Merge branch 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git
* 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git: (23 commits) rekonq 0.1.5: UI changes Various Fixes RFC. History Menu Revisited. History Panel Action fix Removed unuseful history dialog. We use just history panel, from now on.. Removed recently closed tabs history No more Action Back Menu UI changes New Tab tool button Fixing webpage headers Restored Unsupport Content Handler (new 1st implementation) Fix forward declaration Cosmetic networkmanager changes SVN_SILENT made messages (.desktop file) Forgot to remove unuseful KDE IS VERSION check. Removed now.. bookmark toolbar displaying ALL the bookmarks. fixuifiles SVN_SILENT made messages (.desktop file) SVN_SILENT made messages (.desktop file) SVN_SILENT made messages (.desktop file, second try) ... Conflicts: src/mainview.cpp src/mainwindow.cpp
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp91
1 files changed, 39 insertions, 52 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index d15444ab..636a4812 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -61,10 +61,9 @@
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))
{
// setting tabbar
setTabBar(m_tabBar);
@@ -97,12 +96,40 @@ MainView::~MainView()
void MainView::postLaunch()
{
- // 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);
+ m_addTabButton->setDefaultAction(Application::instance()->mainWindow()->actionByName("new_tab"));
+ m_addTabButton->setAutoRaise(true);
+ m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+}
+
+
+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);
+ }
+
}
@@ -136,12 +163,6 @@ int MainView::webViewIndex(WebView *webView) const
}
-KAction *MainView::recentlyClosedTabsAction() const
-{
- return m_recentlyClosedTabsAction;
-}
-
-
void MainView::setMakeBackTab(bool b)
{
m_makeBackTab = b;
@@ -247,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)
{
@@ -387,6 +406,7 @@ WebView *MainView::newWebView(Rekonq::OpenType type)
emit tabsChanged();
showTabBar();
+ addTabButtonPosition();
return webView;
}
@@ -446,6 +466,7 @@ void MainView::slotCloseOtherTabs(int index)
}
showTabBar();
+ addTabButtonPosition();
}
@@ -460,6 +481,7 @@ void MainView::slotCloneTab(int index)
tab->setUrl(webView(index)->url());
showTabBar();
+ addTabButtonPosition();
}
@@ -488,20 +510,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);
@@ -520,6 +528,7 @@ void MainView::slotCloseTab(int index)
}
showTabBar();
+ addTabButtonPosition();
}
@@ -636,28 +645,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::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())