From 371250ff15b2cea00df75c16fa0a4ccf4bed1f49 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sun, 14 Jul 2013 22:29:47 +0200 Subject: [PATCH] Preferences: Load autofill page on-demand Don't ask for master password when preferences dialog is opened. Only ask for it when user actually enters autofill page. --- src/lib/preferences/preferences.cpp | 18 +++++++++++++++--- src/lib/preferences/preferences.h | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 23e49b95c..56c68bbff 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -60,15 +60,15 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) : QDialog(parent) , ui(new Ui::Preferences) , p_QupZilla(mainClass) + , m_autoFillManager(0) , m_pluginsList(0) + , m_autoFillEnabled(false) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); ui->languages->setLayoutDirection(Qt::LeftToRight); m_themesManager = new ThemeManager(ui->themesWidget, this); - m_autoFillManager = new AutoFillManager(this); - ui->autoFillFrame->addWidget(m_autoFillManager); m_pluginsList = new PluginsManager(this); ui->pluginsFrame->addWidget(m_pluginsList); @@ -497,9 +497,16 @@ void Preferences::showStackedPage(QListWidgetItem* item) ui->stackedWidget->setCurrentIndex(index); setNotificationPreviewVisible(index == 9); + if (index == 10) { m_pluginsList->load(); } + + if (index == 7 && !m_autoFillManager) { + m_autoFillManager = new AutoFillManager(this); + ui->autoFillFrame->addWidget(m_autoFillManager); + m_autoFillManager->setVisible(m_autoFillEnabled); + } } void Preferences::setNotificationPreviewVisible(bool state) @@ -730,7 +737,12 @@ void Preferences::reloadPacFileClicked() void Preferences::showPassManager(bool state) { - m_autoFillManager->setVisible(state); + if (m_autoFillManager) { + m_autoFillManager->setVisible(state); + } + else { + m_autoFillEnabled = state; + } } void Preferences::buttonClicked(QAbstractButton* button) diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h index 28e777f56..4d0a480af 100644 --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -109,6 +109,7 @@ private: int m_afterLaunch; int m_onNewTab; QPoint m_notifPosition; + bool m_autoFillEnabled; }; #endif // PREFERENCES_H