From 703a41c0f48b10c8c4677542563edc7a3a19e7c4 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Mon, 17 Sep 2012 14:59:08 +0430 Subject: [PATCH] Fixed showing 'Preferences' window without parent. -issue: 'Preferences::saveSettings()' doesn't work without parent. --- src/lib/preferences/preferences.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index e3524ac83..7df6ec089 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -118,9 +118,14 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) afterLaunchChanged(ui->afterLaunch->currentIndex()); connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int))); connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int))); - connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage())); - connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab())); - + if (p_QupZilla) { + connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage())); + connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab())); + } + else { + ui->useCurrentBut->setEnabled(false); + ui->newTabUseCurrent->setEnabled(false); + } //PROFILES m_actProfileName = mApp->currentProfilePath(); m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1); @@ -151,8 +156,14 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) m_themesManager = new ThemeManager(ui->themesWidget, this); settings.beginGroup("Browser-View-Settings"); ui->showStatusbar->setChecked(settings.value("showStatusBar", true).toBool()); - ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible()); - ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible()); + if (p_QupZilla) { + ui->showBookmarksToolbar->setChecked(p_QupZilla->bookmarksToolbar()->isVisible()); + ui->showNavigationToolbar->setChecked(p_QupZilla->navigationBar()->isVisible()); + } + else { + ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", true).toBool()); + ui->showNavigationToolbar->setChecked(settings.value("showNavigationToolbar", true).toBool()); + } ui->showHome->setChecked(settings.value("showHomeButton", true).toBool()); ui->showBackForward->setChecked(settings.value("showBackForwardButtons", true).toBool()); ui->showAddTabButton->setChecked(settings.value("showAddTabButton", false).toBool());