1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

[Regression] Fixed restoring session with pinned tabs.

Regression from adding tabs on top feature.
This commit is contained in:
nowrep 2013-02-15 22:18:46 +01:00
parent 8c9f09b17a
commit 7b3b4f9b94
4 changed files with 18 additions and 12 deletions

View File

@ -1058,7 +1058,6 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat
// Instead create new one and restore pinned tabs there // Instead create new one and restore pinned tabs there
QupZilla* newWin = makeNewWindow(Qz::BW_OtherRestoredWindow); QupZilla* newWin = makeNewWindow(Qz::BW_OtherRestoredWindow);
newWin->tabWidget()->restorePinnedTabs();
newWin->restoreWindowState(recoveryData.takeFirst()); newWin->restoreWindowState(recoveryData.takeFirst());
} }
else { else {

View File

@ -115,7 +115,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
, m_isClosing(false) , m_isClosing(false)
, m_isStarting(false) , m_isStarting(false)
, m_startingUrl(startUrl) , m_startingUrl(startUrl)
, m_startBehaviour(type) , m_windowType(type)
, m_menuBookmarksAction(0) , m_menuBookmarksAction(0)
, m_actionPrivateBrowsing(0) , m_actionPrivateBrowsing(0)
, m_sideBarManager(new SideBarManager(this)) , m_sideBarManager(new SideBarManager(this))
@ -157,10 +157,6 @@ void QupZilla::postLaunch()
loadSettings(); loadSettings();
if (m_startBehaviour == Qz::BW_FirstAppWindow) {
m_tabWidget->restorePinnedTabs();
}
Settings settings; Settings settings;
int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt(); int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
bool addTab = true; bool addTab = true;
@ -184,7 +180,7 @@ void QupZilla::postLaunch()
break; break;
} }
switch (m_startBehaviour) { switch (m_windowType) {
case Qz::BW_FirstAppWindow: case Qz::BW_FirstAppWindow:
if (mApp->isStartingAfterCrash()) { if (mApp->isStartingAfterCrash()) {
addTab = true; addTab = true;
@ -223,7 +219,7 @@ void QupZilla::postLaunch()
} }
} }
if (m_tabWidget->getTabBar()->normalTabsCount() <= 0 && m_startBehaviour != Qz::BW_OtherRestoredWindow) { if (m_tabWidget->getTabBar()->normalTabsCount() <= 0 && m_windowType != Qz::BW_OtherRestoredWindow) {
//Something went really wrong .. add one tab //Something went really wrong .. add one tab
QNetworkRequest request(m_homepage); QNetworkRequest request(m_homepage);
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
@ -268,7 +264,7 @@ void QupZilla::setupUi()
setGeometry(QRect(20, 20, 800, 550)); setGeometry(QRect(20, 20, 800, 550));
} }
if (m_startBehaviour == Qz::BW_NewWindow) { if (m_windowType == Qz::BW_NewWindow) {
// Moving window +40 x,y to be visible that this is new window // Moving window +40 x,y to be visible that this is new window
QPoint p = pos(); QPoint p = pos();
p.setX(p.x() + 40); p.setX(p.x() + 40);
@ -811,6 +807,11 @@ LocationBar* QupZilla::locationBar() const
return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget()); return qobject_cast<LocationBar*>(m_tabWidget->locationBars()->currentWidget());
} }
Qz::BrowserWindow QupZilla::windowType() const
{
return m_windowType;
}
QWidget* QupZilla::navigationContainer() const QWidget* QupZilla::navigationContainer() const
{ {
if (!qzSettings->tabsOnTop) { if (!qzSettings->tabsOnTop) {
@ -2257,7 +2258,7 @@ int QupZilla::getCurrentVirtualDesktop() const
void QupZilla::moveToVirtualDesktop(int desktopId) void QupZilla::moveToVirtualDesktop(int desktopId)
{ {
// Don't move when window is already visible or it is first app window // Don't move when window is already visible or it is first app window
if (desktopId < 0 || isVisible() || m_startBehaviour == Qz::BW_FirstAppWindow) { if (desktopId < 0 || isVisible() || m_windowType == Qz::BW_FirstAppWindow) {
return; return;
} }

View File

@ -91,6 +91,7 @@ public:
TabbedWebView* weView(int index) const; TabbedWebView* weView(int index) const;
LocationBar* locationBar() const; LocationBar* locationBar() const;
Qz::BrowserWindow windowType() const;
TabWidget* tabWidget() { return m_tabWidget; } TabWidget* tabWidget() { return m_tabWidget; }
BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; } BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; }
StatusBarMessage* statusBarMessage() { return m_statusBarMessage; } StatusBarMessage* statusBarMessage() { return m_statusBarMessage; }
@ -256,7 +257,7 @@ private:
bool m_isStarting; bool m_isStarting;
QUrl m_startingUrl; QUrl m_startingUrl;
QUrl m_homepage; QUrl m_homepage;
Qz::BrowserWindow m_startBehaviour; Qz::BrowserWindow m_windowType;
QVBoxLayout* m_mainLayout; QVBoxLayout* m_mainLayout;
QSplitter* m_mainSplitter; QSplitter* m_mainSplitter;

View File

@ -854,7 +854,6 @@ void TabWidget::restorePinnedTabs()
} }
m_tabBar->updatePinnedTabCloseButton(addedIndex); m_tabBar->updatePinnedTabCloseButton(addedIndex);
// m_tabBar->moveTab(addedIndex, i);
} }
m_isRestoringState = false; m_isRestoringState = false;
@ -892,6 +891,12 @@ bool TabWidget::restoreState(const QList<WebTab::SavedTab> &tabs, int currentTab
{ {
m_isRestoringState = true; m_isRestoringState = true;
Qz::BrowserWindow type = p_QupZilla->windowType();
if (type == Qz::BW_FirstAppWindow || type == Qz::BW_MacFirstWindow) {
restorePinnedTabs();
}
for (int i = 0; i < tabs.size(); ++i) { for (int i = 0; i < tabs.size(); ++i) {
WebTab::SavedTab tab = tabs.at(i); WebTab::SavedTab tab = tabs.at(i);