1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Another small startup behaviour changes.

This commit is contained in:
nowrep 2012-03-13 17:51:37 +01:00
parent f590ad1925
commit 9d6d5d1774
3 changed files with 36 additions and 17 deletions

View File

@ -367,7 +367,7 @@ void MainApplication::loadSettings()
settings.endGroup(); settings.endGroup();
m_websettings->setUserStyleSheetUrl(userStyleSheet); 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()); m_websettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap());
// Allows to load files from qrc: scheme in qupzilla: pages // Allows to load files from qrc: scheme in qupzilla: pages
@ -841,7 +841,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
QDataStream stream(&file); QDataStream stream(&file);
QByteArray tabState; QByteArray tabState;
QByteArray qMainWindowState; QByteArray windowState;
int version; int version;
int windowCount; int windowCount;
@ -852,21 +852,20 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
} }
stream >> windowCount; stream >> windowCount;
stream >> tabState; stream >> tabState;
stream >> qMainWindowState; stream >> windowState;
window->tabWidget()->restoreState(tabState); window->restoreWindowState(windowState, tabState);
window->restoreState(qMainWindowState);
if (windowCount > 1) { if (windowCount > 1) {
for (int i = 1; i < windowCount; i++) { for (int i = 1; i < windowCount; i++) {
stream >> tabState; stream >> tabState;
stream >> qMainWindowState; stream >> windowState;
QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow); QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow);
m_mainWindows.append(window); m_mainWindows.append(window);
window->tabWidget()->restoreState(tabState); window->restoreWindowState(windowState, tabState);
window->restoreState(qMainWindowState);
window->show(); window->show();
} }
} }

View File

@ -92,6 +92,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
, m_historyMenuChanged(true) , m_historyMenuChanged(true)
, m_bookmarksMenuChanged(true) , m_bookmarksMenuChanged(true)
, m_isClosing(false) , m_isClosing(false)
, m_isStarting(false)
, m_startingUrl(startUrl) , m_startingUrl(startUrl)
, m_startBehaviour(type) , m_startBehaviour(type)
, m_menuBookmarksAction(0) , m_menuBookmarksAction(0)
@ -106,6 +107,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(tr("QupZilla")); setWindowTitle(tr("QupZilla"));
m_isStarting = true;
m_activeProfil = mApp->getActiveProfilPath(); m_activeProfil = mApp->getActiveProfilPath();
m_activeLanguage = mApp->getActiveLanguage(); m_activeLanguage = mApp->getActiveLanguage();
@ -118,6 +120,8 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
void QupZilla::postLaunch() void QupZilla::postLaunch()
{ {
setUpdatesEnabled(false);
loadSettings(); loadSettings();
if (m_startBehaviour == Qz::BW_FirstAppWindow) { if (m_startBehaviour == Qz::BW_FirstAppWindow) {
@ -190,6 +194,11 @@ void QupZilla::postLaunch()
mApp->plugins()->emitMainWindowCreated(this); mApp->plugins()->emitMainWindowCreated(this);
emit startingCompleted(); emit startingCompleted();
m_isStarting = false;
setWindowTitle(m_lastWindowTitle);
setUpdatesEnabled(true);
} }
void QupZilla::setupUi() void QupZilla::setupUi()
@ -544,7 +553,6 @@ void QupZilla::loadSettings()
//Browser Window settings //Browser Window settings
settings.beginGroup("Browser-View-Settings"); settings.beginGroup("Browser-View-Settings");
m_menuTextColor = settings.value("menuTextColor", QColor(Qt::black)).value<QColor>();
bool showStatusBar = settings.value("showStatusBar", true).toBool(); bool showStatusBar = settings.value("showStatusBar", true).toBool();
bool showHomeIcon = settings.value("showHomeButton", true).toBool(); bool showHomeIcon = settings.value("showHomeButton", true).toBool();
bool showBackForwardIcons = settings.value("showBackForwardButtons", true).toBool(); bool showBackForwardIcons = settings.value("showBackForwardButtons", true).toBool();
@ -658,12 +666,18 @@ LocationBar* QupZilla::locationBar() const
void QupZilla::setWindowTitle(const QString &t) void QupZilla::setWindowTitle(const QString &t)
{ {
QString title = t;
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { 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) 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() void QupZilla::aboutQupZilla()
{ {
AboutDialog about(this); AboutDialog about(this);

View File

@ -63,9 +63,6 @@ public:
explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl()); explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl());
~QupZilla(); ~QupZilla();
void refreshAddressBar();
void addBookmark(const QUrl &url, const QString &title, const QIcon &icon);
void installTranslator();
void loadSettings(); void loadSettings();
void showNavigationWithFullscreen(); void showNavigationWithFullscreen();
void saveSideBarWidth(); void saveSideBarWidth();
@ -73,8 +70,11 @@ public:
void currentTabChanged(); void currentTabChanged();
void updateLoadingActions(); void updateLoadingActions();
void addBookmark(const QUrl &url, const QString &title, const QIcon &icon);
void addDeleteOnCloseWidget(QWidget* widget); void addDeleteOnCloseWidget(QWidget* widget);
void restoreWindowState(const QByteArray &window, const QByteArray &tabs);
virtual QMenuBar* menuBar() const; virtual QMenuBar* menuBar() const;
TabbedWebView* weView() const; TabbedWebView* weView() const;
@ -90,7 +90,6 @@ public:
inline QString activeLanguage() { return m_activeLanguage; } inline QString activeLanguage() { return m_activeLanguage; }
inline QLabel* ipLabel() { return m_ipLabel; } inline QLabel* ipLabel() { return m_ipLabel; }
inline AdBlockIcon* adBlockIcon() { return m_adblockIcon; } inline AdBlockIcon* adBlockIcon() { return m_adblockIcon; }
inline QColor menuTextColor() { return m_menuTextColor; }
inline QMenu* menuHelp() { return m_menuHelp; } inline QMenu* menuHelp() { return m_menuHelp; }
inline QAction* actionRestoreTab() { return m_actionRestoreTab; } inline QAction* actionRestoreTab() { return m_actionRestoreTab; }
inline QAction* actionReload() { return m_actionReload; } inline QAction* actionReload() { return m_actionReload; }
@ -205,6 +204,7 @@ private:
bool m_historyMenuChanged; bool m_historyMenuChanged;
bool m_bookmarksMenuChanged; bool m_bookmarksMenuChanged;
bool m_isClosing; bool m_isClosing;
bool m_isStarting;
QUrl m_startingUrl; QUrl m_startingUrl;
QUrl m_homepage; QUrl m_homepage;
Qz::BrowserWindow m_startBehaviour; Qz::BrowserWindow m_startBehaviour;
@ -263,7 +263,7 @@ private:
QString m_activeProfil; QString m_activeProfil;
QString m_activeLanguage; QString m_activeLanguage;
QColor m_menuTextColor; QString m_lastWindowTitle;
int m_sideBarWidth; int m_sideBarWidth;
int m_webViewWidth; int m_webViewWidth;