diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index c20c10451..01233be79 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -367,7 +367,7 @@ void MainApplication::loadSettings() settings.endGroup(); m_websettings->setUserStyleSheetUrl(userStyleSheet); - m_websettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::fromTheme("text-plain").pixmap(16, 16)); + m_websettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::emptyWebIcon().pixmap(16, 16)); m_websettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap()); // Allows to load files from qrc: scheme in qupzilla: pages @@ -841,7 +841,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window) QDataStream stream(&file); QByteArray tabState; - QByteArray qMainWindowState; + QByteArray windowState; int version; int windowCount; @@ -852,21 +852,20 @@ bool MainApplication::restoreStateSlot(QupZilla* window) } stream >> windowCount; stream >> tabState; - stream >> qMainWindowState; + stream >> windowState; - window->tabWidget()->restoreState(tabState); - window->restoreState(qMainWindowState); + window->restoreWindowState(windowState, tabState); if (windowCount > 1) { for (int i = 1; i < windowCount; i++) { stream >> tabState; - stream >> qMainWindowState; + stream >> windowState; QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow); m_mainWindows.append(window); - window->tabWidget()->restoreState(tabState); - window->restoreState(qMainWindowState); + window->restoreWindowState(windowState, tabState); + window->show(); } } diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 30a6b954b..4e8789c86 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -92,6 +92,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) , m_historyMenuChanged(true) , m_bookmarksMenuChanged(true) , m_isClosing(false) + , m_isStarting(false) , m_startingUrl(startUrl) , m_startBehaviour(type) , m_menuBookmarksAction(0) @@ -106,6 +107,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("QupZilla")); + m_isStarting = true; m_activeProfil = mApp->getActiveProfilPath(); m_activeLanguage = mApp->getActiveLanguage(); @@ -118,6 +120,8 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) void QupZilla::postLaunch() { + setUpdatesEnabled(false); + loadSettings(); if (m_startBehaviour == Qz::BW_FirstAppWindow) { @@ -190,6 +194,11 @@ void QupZilla::postLaunch() mApp->plugins()->emitMainWindowCreated(this); emit startingCompleted(); + + m_isStarting = false; + setWindowTitle(m_lastWindowTitle); + + setUpdatesEnabled(true); } void QupZilla::setupUi() @@ -544,7 +553,6 @@ void QupZilla::loadSettings() //Browser Window settings settings.beginGroup("Browser-View-Settings"); - m_menuTextColor = settings.value("menuTextColor", QColor(Qt::black)).value(); bool showStatusBar = settings.value("showStatusBar", true).toBool(); bool showHomeIcon = settings.value("showHomeButton", true).toBool(); bool showBackForwardIcons = settings.value("showBackForwardButtons", true).toBool(); @@ -658,12 +666,18 @@ LocationBar* QupZilla::locationBar() const void QupZilla::setWindowTitle(const QString &t) { + QString title = t; + if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { - QMainWindow::setWindowTitle(t + tr(" (Private Browsing)")); + title.append(tr(" (Private Browsing)")); } - else { - QMainWindow::setWindowTitle(t); + + if (m_isStarting) { + m_lastWindowTitle = title; + return; } + + QMainWindow::setWindowTitle(title); } void QupZilla::receiveMessage(Qz::AppMessageType mes, bool state) @@ -1368,6 +1382,12 @@ void QupZilla::addDeleteOnCloseWidget(QWidget* widget) } } +void QupZilla::restoreWindowState(const QByteArray &window, const QByteArray &tabs) +{ + QMainWindow::restoreState(window); + m_tabWidget->restoreState(tabs); +} + void QupZilla::aboutQupZilla() { AboutDialog about(this); diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 3e104892e..969cb161f 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -63,9 +63,6 @@ public: explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl()); ~QupZilla(); - void refreshAddressBar(); - void addBookmark(const QUrl &url, const QString &title, const QIcon &icon); - void installTranslator(); void loadSettings(); void showNavigationWithFullscreen(); void saveSideBarWidth(); @@ -73,8 +70,11 @@ public: void currentTabChanged(); void updateLoadingActions(); + void addBookmark(const QUrl &url, const QString &title, const QIcon &icon); void addDeleteOnCloseWidget(QWidget* widget); + void restoreWindowState(const QByteArray &window, const QByteArray &tabs); + virtual QMenuBar* menuBar() const; TabbedWebView* weView() const; @@ -90,7 +90,6 @@ public: inline QString activeLanguage() { return m_activeLanguage; } inline QLabel* ipLabel() { return m_ipLabel; } inline AdBlockIcon* adBlockIcon() { return m_adblockIcon; } - inline QColor menuTextColor() { return m_menuTextColor; } inline QMenu* menuHelp() { return m_menuHelp; } inline QAction* actionRestoreTab() { return m_actionRestoreTab; } inline QAction* actionReload() { return m_actionReload; } @@ -205,6 +204,7 @@ private: bool m_historyMenuChanged; bool m_bookmarksMenuChanged; bool m_isClosing; + bool m_isStarting; QUrl m_startingUrl; QUrl m_homepage; Qz::BrowserWindow m_startBehaviour; @@ -263,7 +263,7 @@ private: QString m_activeProfil; QString m_activeLanguage; - QColor m_menuTextColor; + QString m_lastWindowTitle; int m_sideBarWidth; int m_webViewWidth;