1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Added option to show tabs on top.

You can change it in Menu View -> Toolbars

Closes #640
This commit is contained in:
nowrep 2013-02-09 13:00:45 +01:00
parent 732c1b533f
commit 83f3c90752
14 changed files with 171 additions and 49 deletions

View File

@ -5,6 +5,7 @@ Version 1.4.0
* QtWebKit 2.3 new features - caret browsing, animated scrolling * QtWebKit 2.3 new features - caret browsing, animated scrolling
* added support for FTP listing files and downloading * added support for FTP listing files and downloading
* added support for saving passwords of multiple users per site * added support for saving passwords of multiple users per site
* added support for showing tabs on top
* asking user whether to allow site to use notifications/geolocation * asking user whether to allow site to use notifications/geolocation
* option to set JavaScript privacy permissions * option to set JavaScript privacy permissions
* option to specify default search engine used in locationbar * option to specify default search engine used in locationbar
@ -28,6 +29,7 @@ Version 1.4.0
* X11: fixed Ctrl+Q shortcut for DEs other than KDE and Gnome * X11: fixed Ctrl+Q shortcut for DEs other than KDE and Gnome
* windows: improved installer allows registering as default web browser * windows: improved installer allows registering as default web browser
* windows: check and set as default browser from preferences * windows: check and set as default browser from preferences
* mac: fixed not working global menu after closing browser window
Version 1.3.5 Version 1.3.5
* released 16 September 2012 * released 16 September 2012

View File

@ -60,6 +60,7 @@
#include "reloadstopbutton.h" #include "reloadstopbutton.h"
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "settings.h" #include "settings.h"
#include "qzsettings.h"
#include "webtab.h" #include "webtab.h"
#include "speeddial.h" #include "speeddial.h"
#include "qtwin.h" #include "qtwin.h"
@ -289,9 +290,16 @@ void QupZilla::setupUi()
m_navigationBar->setSplitterSizes(locationBarWidth, websearchBarWidth); m_navigationBar->setSplitterSizes(locationBarWidth, websearchBarWidth);
m_bookmarksToolbar = new BookmarksToolbar(this); m_bookmarksToolbar = new BookmarksToolbar(this);
m_navigationContainer = new QWidget(this);
QVBoxLayout* l = new QVBoxLayout(m_navigationContainer);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
l->addWidget(m_navigationBar);
l->addWidget(m_bookmarksToolbar);
m_navigationContainer->setLayout(l);
m_mainSplitter->addWidget(m_tabWidget); m_mainSplitter->addWidget(m_tabWidget);
m_mainLayout->addWidget(m_navigationBar); m_mainLayout->addWidget(m_navigationContainer);
m_mainLayout->addWidget(m_bookmarksToolbar);
m_mainLayout->addWidget(m_mainSplitter); m_mainLayout->addWidget(m_mainSplitter);
m_mainSplitter->setCollapsible(0, false); m_mainSplitter->setCollapsible(0, false);
@ -415,6 +423,9 @@ void QupZilla::setupMenu()
#else #else
m_menuEncoding = new QMenu(0); m_menuEncoding = new QMenu(0);
#endif #endif
m_actionTabsOnTop = new QAction(tr("&Tabs on Top"), MENU_RECEIVER);
m_actionTabsOnTop->setCheckable(true);
connect(m_actionTabsOnTop, SIGNAL(triggered(bool)), this, SLOT(triggerTabsOnTop(bool)));
m_actionShowFullScreen = new QAction(tr("&Fullscreen"), MENU_RECEIVER); m_actionShowFullScreen = new QAction(tr("&Fullscreen"), MENU_RECEIVER);
m_actionShowFullScreen->setCheckable(true); m_actionShowFullScreen->setCheckable(true);
m_actionShowFullScreen->setShortcut(QKeySequence("F11")); m_actionShowFullScreen->setShortcut(QKeySequence("F11"));
@ -444,6 +455,8 @@ void QupZilla::setupMenu()
#endif #endif
toolbarsMenu->addAction(m_actionShowToolbar); toolbarsMenu->addAction(m_actionShowToolbar);
toolbarsMenu->addAction(m_actionShowBookmarksToolbar); toolbarsMenu->addAction(m_actionShowBookmarksToolbar);
toolbarsMenu->addSeparator();
toolbarsMenu->addAction(m_actionTabsOnTop);
QMenu* sidebarsMenu = new QMenu(tr("Sidebars")); QMenu* sidebarsMenu = new QMenu(tr("Sidebars"));
m_sideBarManager->setSideBarMenu(sidebarsMenu); m_sideBarManager->setSideBarMenu(sidebarsMenu);
@ -791,6 +804,15 @@ LocationBar* QupZilla::locationBar() const
return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget()); return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget());
} }
QWidget* QupZilla::navigationContainer()
{
if (!qzSettings->tabsOnTop) {
return 0;
}
return m_navigationContainer;
}
void QupZilla::setWindowTitle(const QString &t) void QupZilla::setWindowTitle(const QString &t)
{ {
QString title = t; QString title = t;
@ -1066,6 +1088,7 @@ void QupZilla::aboutToShowViewMenu()
m_actionShowStatusbar->setChecked(statusBar()->isVisible()); m_actionShowStatusbar->setChecked(statusBar()->isVisible());
m_actionShowBookmarksToolbar->setChecked(m_bookmarksToolbar->isVisible()); m_actionShowBookmarksToolbar->setChecked(m_bookmarksToolbar->isVisible());
m_actionTabsOnTop->setChecked(qzSettings->tabsOnTop);
m_actionPageSource->setEnabled(true); m_actionPageSource->setEnabled(true);
@ -1307,7 +1330,7 @@ void QupZilla::reloadByPassCache()
weView()->triggerPageAction(QWebPage::ReloadAndBypassCache); weView()->triggerPageAction(QWebPage::ReloadAndBypassCache);
} }
void QupZilla::loadActionUrl(QObject *obj) void QupZilla::loadActionUrl(QObject* obj)
{ {
if (!obj) { if (!obj) {
obj = sender(); obj = sender();
@ -1526,6 +1549,18 @@ void QupZilla::showBookmarkImport()
b->show(); b->show();
} }
void QupZilla::triggerTabsOnTop(bool enable)
{
if (enable) {
m_tabWidget->showNavigationBar(m_navigationContainer);
}
else {
m_mainLayout->insertWidget(0, m_navigationContainer);
}
qzSettings->tabsOnTop = enable;
}
void QupZilla::refreshHistory() void QupZilla::refreshHistory()
{ {
m_navigationBar->refreshHistory(); m_navigationBar->refreshHistory();
@ -1610,10 +1645,11 @@ void QupZilla::webSearch()
void QupZilla::searchOnPage() void QupZilla::searchOnPage()
{ {
SearchToolBar* toolBar = searchToolBar(); SearchToolBar* toolBar = searchToolBar();
const int searchPos = qzSettings->tabsOnTop ? 1 : 2;
if (!toolBar) { if (!toolBar) {
toolBar = new SearchToolBar(weView(), this); toolBar = new SearchToolBar(weView(), this);
m_mainLayout->insertWidget(3, toolBar); m_mainLayout->insertWidget(searchPos, toolBar);
} }
toolBar->focusSearchLine(); toolBar->focusSearchLine();
@ -1995,9 +2031,10 @@ void QupZilla::closeEvent(QCloseEvent* event)
SearchToolBar* QupZilla::searchToolBar() SearchToolBar* QupZilla::searchToolBar()
{ {
SearchToolBar* toolBar = 0; SearchToolBar* toolBar = 0;
const int searchPos = qzSettings->tabsOnTop ? 1 : 2;
if (m_mainLayout->count() == 4) { if (m_mainLayout->count() == searchPos + 1) {
toolBar = qobject_cast<SearchToolBar*>(m_mainLayout->itemAt(3)->widget()); toolBar = qobject_cast<SearchToolBar*>(m_mainLayout->itemAt(searchPos)->widget());
} }
return toolBar; return toolBar;
@ -2242,11 +2279,9 @@ bool QupZilla::nativeEvent(const QByteArray &eventType, void* _message, long* re
m_sideBar.data()->installEventFilter(this); m_sideBar.data()->installEventFilter(this);
} }
if (m_mainLayout->count() == 4) { SearchToolBar* search = searchToolBar();
SearchToolBar* search = qobject_cast<SearchToolBar*>(m_mainLayout->itemAt(3)->widget()); if (search) {
if (search) { search->installEventFilter(this);
search->installEventFilter(this);
}
} }
if (m_webInspectorDock) { if (m_webInspectorDock) {
@ -2291,11 +2326,9 @@ void QupZilla::applyBlurToMainWindow(bool force)
topMargin += m_bookmarksToolbar->isVisible() ? m_bookmarksToolbar->height() : 0; topMargin += m_bookmarksToolbar->isVisible() ? m_bookmarksToolbar->height() : 0;
topMargin += m_tabWidget->getTabBar()->height(); topMargin += m_tabWidget->getTabBar()->height();
if (m_mainLayout->count() == 4) { SearchToolBar* search = searchToolBar();
SearchToolBar* search = qobject_cast<SearchToolBar*>(m_mainLayout->itemAt(3)->widget()); if (search) {
if (search) { bottomMargin += search->height();
bottomMargin += search->height();
}
} }
bottomMargin += statusBar()->isVisible() ? statusBar()->height() : 0; bottomMargin += statusBar()->isVisible() ? statusBar()->height() : 0;

View File

@ -87,21 +87,23 @@ public:
TabbedWebView* weView(int index) const; TabbedWebView* weView(int index) const;
LocationBar* locationBar() const; LocationBar* locationBar() const;
inline TabWidget* tabWidget() { return m_tabWidget; } TabWidget* tabWidget() { return m_tabWidget; }
inline BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; } BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; }
inline StatusBarMessage* statusBarMessage() { return m_statusBarMessage; } StatusBarMessage* statusBarMessage() { return m_statusBarMessage; }
inline NavigationBar* navigationBar() { return m_navigationBar; } NavigationBar* navigationBar() { return m_navigationBar; }
inline SideBarManager* sideBarManager() { return m_sideBarManager; } SideBarManager* sideBarManager() { return m_sideBarManager; }
inline ProgressBar* progressBar() { return m_progressBar; } ProgressBar* progressBar() { return m_progressBar; }
inline QLabel* ipLabel() { return m_ipLabel; } QLabel* ipLabel() { return m_ipLabel; }
inline AdBlockIcon* adBlockIcon() { return m_adblockIcon; } AdBlockIcon* adBlockIcon() { return m_adblockIcon; }
inline QMenu* menuHelp() { return m_menuHelp; } QMenu* menuHelp() { return m_menuHelp; }
inline QAction* actionRestoreTab() { return m_actionRestoreTab; } QAction* actionRestoreTab() { return m_actionRestoreTab; }
inline QAction* actionReload() { return m_actionReload; } QAction* actionReload() { return m_actionReload; }
inline QMenu* superMenu() { return m_superMenu; } QMenu* superMenu() { return m_superMenu; }
inline bool isClosing() { return m_isClosing; } QWidget* navigationContainer();
inline QUrl homepageUrl() { return m_homepage; }
bool isClosing() { return m_isClosing; }
QUrl homepageUrl() { return m_homepage; }
signals: signals:
void startingCompleted(); void startingCompleted();
@ -189,9 +191,10 @@ private slots:
void zoomOut(); void zoomOut();
void zoomReset(); void zoomReset();
void fullScreen(bool make); void fullScreen(bool make);
void changeEncoding(QObject *obj = 0); void changeEncoding(QObject* obj = 0);
void triggerCaretBrowsing(); void triggerCaretBrowsing();
void triggerTabsOnTop(bool enable);
void closeWindow(); void closeWindow();
bool quitApp(); bool quitApp();
@ -275,6 +278,7 @@ private:
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
QAction* m_actionShowMenubar; QAction* m_actionShowMenubar;
#endif #endif
QAction* m_actionTabsOnTop;
QAction* m_actionShowFullScreen; QAction* m_actionShowFullScreen;
QAction* m_actionShowBookmarksSideBar; QAction* m_actionShowBookmarksSideBar;
QAction* m_actionShowHistorySideBar; QAction* m_actionShowHistorySideBar;
@ -291,6 +295,7 @@ private:
AdBlockIcon* m_adblockIcon; AdBlockIcon* m_adblockIcon;
QPointer<WebInspectorDockWidget> m_webInspectorDock; QPointer<WebInspectorDockWidget> m_webInspectorDock;
QWidget* m_navigationContainer;
BookmarksToolbar* m_bookmarksToolbar; BookmarksToolbar* m_bookmarksToolbar;
TabWidget* m_tabWidget; TabWidget* m_tabWidget;
QPointer<SideBar> m_sideBar; QPointer<SideBar> m_sideBar;

View File

@ -446,7 +446,7 @@ win32 {
SOURCES += other/registerqappassociation.cpp SOURCES += other/registerqappassociation.cpp
} }
macx { mac {
HEADERS += other/macmenureceiver.h HEADERS += other/macmenureceiver.h
SOURCES += other/macmenureceiver.cpp SOURCES += other/macmenureceiver.cpp
} }

View File

@ -313,12 +313,15 @@ void MacMenuReceiver::changeEncoding(QObject* obj)
callSlot("changeEncoding", false, Q_ARG(QObject*, obj)); callSlot("changeEncoding", false, Q_ARG(QObject*, obj));
} }
void MacMenuReceiver::triggerCaretBrowsing() void MacMenuReceiver::triggerCaretBrowsing()
{ {
callSlot("triggerCaretBrowsing"); callSlot("triggerCaretBrowsing");
} }
void MacMenuReceiver::triggerTabsOnTop(bool enable)
{
callSlot("triggerTabsOnTop", false, Q_ARG(bool, enable));
}
void MacMenuReceiver::closeWindow() void MacMenuReceiver::closeWindow()
{ {
@ -330,7 +333,6 @@ void MacMenuReceiver::quitApp()
if (!callSlot("quitApp")) { if (!callSlot("quitApp")) {
mApp->quitApplication(); mApp->quitApplication();
} }
} }
void MacMenuReceiver::printPage(QWebFrame* frame) void MacMenuReceiver::printPage(QWebFrame* frame)

View File

@ -120,6 +120,7 @@ private slots:
void changeEncoding(QObject* obj = 0); void changeEncoding(QObject* obj = 0);
void triggerCaretBrowsing(); void triggerCaretBrowsing();
void triggerTabsOnTop(bool enable);
void closeWindow(); void closeWindow();
void quitApp(); void quitApp();

View File

@ -55,6 +55,7 @@ void QzSettings::loadSettings()
settings.beginGroup("Browser-Tabs-Settings"); settings.beginGroup("Browser-Tabs-Settings");
newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_SelectedTab : Qz::NT_NotSelectedTab; newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_SelectedTab : Qz::NT_NotSelectedTab;
tabsOnTop = settings.value("TabsOnTop", true).toBool();
settings.endGroup(); settings.endGroup();
} }
@ -62,10 +63,12 @@ void QzSettings::saveSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("Web-Browser-Settings");
settings.setValue("AutomaticallyOpenProtocols", autoOpenProtocols); settings.setValue("AutomaticallyOpenProtocols", autoOpenProtocols);
settings.setValue("BlockOpeningProtocols", blockedProtocols); settings.setValue("BlockOpeningProtocols", blockedProtocols);
settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings");
settings.setValue("TabsOnTop", tabsOnTop);
settings.endGroup(); settings.endGroup();
} }

View File

@ -58,6 +58,7 @@ public:
// Browser-Tabs-Settings // Browser-Tabs-Settings
Qz::NewTabPositionFlag newTabPosition; Qz::NewTabPositionFlag newTabPosition;
bool tabsOnTop;
}; };
#define qzSettings Settings::staticSettings() #define qzSettings Settings::staticSettings()

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -399,6 +399,8 @@ void TabBar::currentTabChanged(int index)
showCloseButton(index); showCloseButton(index);
hideCloseButton(m_tabWidget->lastTabIndex()); hideCloseButton(m_tabWidget->lastTabIndex());
m_tabWidget->currentTabChanged(index);
} }
void TabBar::bookmarkTab() void TabBar::bookmarkTab()
@ -482,6 +484,7 @@ void TabBar::tabRemoved(int index)
{ {
Q_UNUSED(index) Q_UNUSED(index)
m_tabWidget->showNavigationBar(p_QupZilla->navigationContainer());
showCloseButton(currentIndex()); showCloseButton(currentIndex());
} }

View File

@ -30,6 +30,7 @@
#include "locationbar.h" #include "locationbar.h"
#include "websearchbar.h" #include "websearchbar.h"
#include "settings.h" #include "settings.h"
#include "qzsettings.h"
#include <QMovie> #include <QMovie>
#include <QMenu> #include <QMenu>
@ -111,7 +112,6 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
m_tabBar = new TabBar(p_QupZilla, this); m_tabBar = new TabBar(p_QupZilla, this);
setTabBar(m_tabBar); setTabBar(m_tabBar);
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory())); connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory()));
connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
@ -429,12 +429,13 @@ void TabWidget::currentTabChanged(int index)
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
LocationBar* locBar = webTab->locationBar(); LocationBar* locBar = webTab->locationBar();
if (m_locationBars->indexOf(locBar) != -1) { if (locBar && m_locationBars->indexOf(locBar) != -1) {
m_locationBars->setCurrentWidget(locBar); m_locationBars->setCurrentWidget(locBar);
} }
webTab->setCurrentTab(); webTab->setCurrentTab();
p_QupZilla->currentTabChanged(); p_QupZilla->currentTabChanged();
showNavigationBar(p_QupZilla->navigationContainer());
} }
void TabWidget::tabMoved(int before, int after) void TabWidget::tabMoved(int before, int after)
@ -586,6 +587,25 @@ int TabWidget::lastTabIndex() const
return m_lastTabIndex; return m_lastTabIndex;
} }
void TabWidget::showNavigationBar(QWidget* bar)
{
WebTab* tab = weTab();
if (tab) {
tab->showNavigationBar(bar);
}
}
TabBar* TabWidget::getTabBar() const
{
return m_tabBar;
}
ClosedTabsManager* TabWidget::closedTabsManager() const
{
return m_closedTabsManager;
}
void TabWidget::reloadAllTabs() void TabWidget::reloadAllTabs()
{ {
for (int i = 0; i < count(); i++) { for (int i = 0; i < count(); i++) {
@ -687,11 +707,26 @@ void TabWidget::clearClosedTabsList()
m_closedTabsManager->clearList(); m_closedTabsManager->clearList();
} }
bool TabWidget::canRestoreTab() bool TabWidget::canRestoreTab() const
{ {
return m_closedTabsManager->isClosedTabAvailable(); return m_closedTabsManager->isClosedTabAvailable();
} }
QStackedWidget* TabWidget::locationBars() const
{
return m_locationBars;
}
ToolButton* TabWidget::buttonListTabs() const
{
return m_buttonListTabs;
}
AddTabButton* TabWidget::buttonAddTab() const
{
return m_buttonAddTab;
}
void TabWidget::aboutToShowClosedTabsMenu() void TabWidget::aboutToShowClosedTabsMenu()
{ {
if (!m_closedInsteadOpened) { if (!m_closedInsteadOpened) {

View File

@ -75,6 +75,7 @@ public:
void nextTab(); void nextTab();
void previousTab(); void previousTab();
void currentTabChanged(int index);
int normalTabsCount() const; int normalTabsCount() const;
int pinnedTabsCount() const; int pinnedTabsCount() const;
@ -82,13 +83,16 @@ public:
void showTabBar(); void showTabBar();
int lastTabIndex() const; int lastTabIndex() const;
TabBar* getTabBar() { return m_tabBar; } void showNavigationBar(QWidget* bar);
ClosedTabsManager* closedTabsManager() { return m_closedTabsManager; }
bool canRestoreTab(); TabBar* getTabBar() const;
ClosedTabsManager* closedTabsManager() const;
QList<WebTab*> allTabs(bool withPinned = true); QList<WebTab*> allTabs(bool withPinned = true);
QStackedWidget* locationBars() { return m_locationBars; } bool canRestoreTab() const;
ToolButton* buttonListTabs() { return m_buttonListTabs; }
AddTabButton* buttonAddTab() { return m_buttonAddTab; } QStackedWidget* locationBars() const;
ToolButton* buttonListTabs() const;
AddTabButton* buttonAddTab() const;
void disconnectObjects(); void disconnectObjects();
@ -122,7 +126,6 @@ public slots:
private slots: private slots:
void aboutToShowTabsMenu(); void aboutToShowTabsMenu();
void actionChangeIndex(); void actionChangeIndex();
void currentTabChanged(int index);
void tabMoved(int before, int after); void tabMoved(int before, int after);
private: private:
@ -142,6 +145,7 @@ private:
bool m_newTabAfterActive; bool m_newTabAfterActive;
bool m_newEmptyTabAfterActive; bool m_newEmptyTabAfterActive;
QUrl m_urlOnNewTab; QUrl m_urlOnNewTab;
QupZilla* p_QupZilla; QupZilla* p_QupZilla;
int m_lastTabIndex; int m_lastTabIndex;

View File

@ -70,6 +70,7 @@ QDataStream &operator >>(QDataStream &stream, WebTab::SavedTab &tab)
WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar) WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
: QWidget() : QWidget()
, p_QupZilla(mainClass) , p_QupZilla(mainClass)
, m_navigationContainer(0)
, m_locationBar(locationBar) , m_locationBar(locationBar)
, m_pinned(false) , m_pinned(false)
, m_inspectorVisible(false) , m_inspectorVisible(false)
@ -84,6 +85,7 @@ WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
m_layout->setSpacing(0); m_layout->setSpacing(0);
m_view = new TabbedWebView(p_QupZilla, this); m_view = new TabbedWebView(p_QupZilla, this);
m_view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
WebPage* page = new WebPage(p_QupZilla); WebPage* page = new WebPage(p_QupZilla);
m_view->setWebPage(page); m_view->setWebPage(page);
m_layout->addWidget(m_view); m_layout->addWidget(m_view);
@ -293,11 +295,13 @@ QPixmap WebTab::renderTabPreview()
void WebTab::showNotification(QWidget* notif) void WebTab::showNotification(QWidget* notif)
{ {
if (m_layout->count() > 1) { const int notifPos = m_navigationContainer ? 2 : 1;
if (m_layout->count() > notifPos) {
delete m_layout->itemAt(0)->widget(); delete m_layout->itemAt(0)->widget();
} }
m_layout->insertWidget(0, notif); m_layout->insertWidget(notifPos - 1, notif);
notif->show(); notif->show();
} }
@ -306,6 +310,18 @@ int WebTab::tabIndex() const
return m_view->tabIndex(); return m_view->tabIndex();
} }
void WebTab::showNavigationBar(QWidget* bar)
{
if (bar) {
m_navigationContainer = bar;
m_layout->insertWidget(0, m_navigationContainer);
// Needed to prevent flickering when closing tabs
m_navigationContainer->setUpdatesEnabled(true);
m_navigationContainer->show();
}
}
void WebTab::pinTab(int index) void WebTab::pinTab(int index)
{ {
TabWidget* tabWidget = p_QupZilla->tabWidget(); TabWidget* tabWidget = p_QupZilla->tabWidget();
@ -337,5 +353,16 @@ void WebTab::disconnectObjects()
WebTab::~WebTab() WebTab::~WebTab()
{ {
if (m_navigationContainer) {
m_layout->removeWidget(m_navigationContainer);
// Needed to prevent flickering when closing tabs
m_navigationContainer->setUpdatesEnabled(false);
m_navigationContainer->hide();
// Needed to prevent deleting m_navigationContainer in ~QWidget
m_navigationContainer->setParent(p_QupZilla);
}
delete m_locationBar.data(); delete m_locationBar.data();
} }

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -76,6 +76,7 @@ public:
void setPinned(bool state); void setPinned(bool state);
int tabIndex() const; int tabIndex() const;
void showNavigationBar(QWidget* bar);
void setLocationBar(LocationBar* bar); void setLocationBar(LocationBar* bar);
LocationBar* locationBar() const; LocationBar* locationBar() const;
@ -102,6 +103,7 @@ private:
QupZilla* p_QupZilla; QupZilla* p_QupZilla;
TabbedWebView* m_view; TabbedWebView* m_view;
QVBoxLayout* m_layout; QVBoxLayout* m_layout;
QWidget* m_navigationContainer;
QPointer<LocationBar> m_locationBar; QPointer<LocationBar> m_locationBar;
SavedTab m_savedTab; SavedTab m_savedTab;

View File

@ -3229,6 +3229,10 @@ Are you sure to quit QupZilla?</source>
<source>Enable &amp;Caret Browsing</source> <source>Enable &amp;Caret Browsing</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>&amp;Tabs on Top</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>QupZillaSchemeReply</name> <name>QupZillaSchemeReply</name>