diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index b9d04fb6f..f466b3970 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -191,17 +191,10 @@ void BrowserWindow::postLaunch() else if (mApp->afterLaunch() == MainApplication::RestoreSession && mApp->restoreManager()) { addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData()); } - else { - // Restore pinned tabs also when not restoring session - m_tabWidget->restorePinnedTabs(); - } break; - case Qz::BW_MacFirstWindow: - m_tabWidget->restorePinnedTabs(); - // fallthrough - case Qz::BW_NewWindow: + case Qz::BW_MacFirstWindow: addTab = true; break; diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 1c5e425b9..3990f2471 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -702,14 +702,6 @@ void MainApplication::saveSession() } } - if (afterLaunch() != RestoreSession) { - // Pinned tabs are saved only for last window into pinnedtabs.dat - BrowserWindow* qupzilla_ = getWindow(); - if (qupzilla_ && m_windows.count() == 1) { - qupzilla_->tabWidget()->savePinnedTabs(); - } - } - QFile file(DataPaths::currentProfilePath() + QLatin1String("/session.dat")); file.open(QIODevice::WriteOnly); file.write(data); diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index 46c2a5912..b93727ddf 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -773,91 +773,6 @@ QList TabWidget::allTabs(bool withPinned) return allTabs; } -void TabWidget::savePinnedTabs() -{ - if (mApp->isPrivate()) { - return; - } - - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << Qz::sessionVersion; - - QStringList tabs; - QList tabsHistory; - for (int i = 0; i < count(); ++i) { - WebTab* tab = weTab(i); - if (!tab || !tab->isPinned()) { - continue; - } - - tabs.append(tab->url().toEncoded()); - tabsHistory.append(tab->historyData()); - } - - stream << tabs; - stream << tabsHistory; - - QFile file(DataPaths::currentProfilePath() + "/pinnedtabs.dat"); - file.open(QIODevice::WriteOnly); - file.write(data); - file.close(); -} - -void TabWidget::restorePinnedTabs() -{ - if (mApp->isPrivate()) { - return; - } - - QFile file(DataPaths::currentProfilePath() + "/pinnedtabs.dat"); - if (!file.open(QIODevice::ReadOnly)) - return; - - QByteArray sd = file.readAll(); - file.close(); - - QDataStream stream(&sd, QIODevice::ReadOnly); - if (stream.atEnd()) { - return; - } - - int version; - stream >> version; - if (version != Qz::sessionVersion && version != Qz::sessionVersionQt5) { - return; - } - - QStringList pinnedTabs; - stream >> pinnedTabs; - QList tabHistory; - stream >> tabHistory; - - for (int i = 0; i < pinnedTabs.count(); ++i) { - QUrl url = QUrl::fromEncoded(pinnedTabs.at(i).toUtf8()); - - QByteArray historyState = tabHistory.value(i); - int addedIndex; - - if (!historyState.isEmpty()) { - addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab, false, true); - weTab(addedIndex)->p_restoreTab(url, historyState, 6); - } - else { - addedIndex = addView(url, tr("New tab"), Qz::NT_SelectedTab, false, -1, true); - } - - WebTab* webTab = weTab(addedIndex); - - if (webTab) { - webTab->setPinned(true); - } - - m_tabBar->updatePinnedTabCloseButton(addedIndex); - } -} - QByteArray TabWidget::saveState() { QVector tabList; diff --git a/src/lib/tabwidget/tabwidget.h b/src/lib/tabwidget/tabwidget.h index 21a09e2e2..ea4f02dc8 100644 --- a/src/lib/tabwidget/tabwidget.h +++ b/src/lib/tabwidget/tabwidget.h @@ -75,9 +75,6 @@ public: bool restoreState(const QVector &tabs, int currentTab); void closeRecoveryTab(); - void savePinnedTabs(); - void restorePinnedTabs(); - void setCurrentIndex(int index); void nextTab();