Skip to content

Commit

Permalink
Cleanup and enable option to remember passwords (disabled by default)…
Browse files Browse the repository at this point in the history
…, references #832
  • Loading branch information
Emdek committed Oct 1, 2016
1 parent 39d7cf9 commit 4b12a1b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/core/SettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void SettingsManager::createInstance(const QString &path, QObject *parent)
registerOption(Backends_PasswordsOption, QLatin1String("file"), EnumerationType, QStringList(QLatin1String("file")));
registerOption(Backends_WebOption, QLatin1String("qtwebkit"), EnumerationType, QStringList(QLatin1String("qtwebkit")));
registerOption(Browser_AlwaysAskWhereToSaveDownloadOption, true, BooleanType);
registerOption(Browser_AskToSavePasswordOption, true, BooleanType);
registerOption(Browser_DelayRestoringOfBackgroundTabsOption, false, BooleanType);
registerOption(Browser_EnableFullScreenOption, QLatin1String("ask"), EnumerationType, QStringList({QLatin1String("ask"), QLatin1String("allow"), QLatin1String("disallow")}));
registerOption(Browser_EnableGeolocationOption, QLatin1String("ask"), EnumerationType, QStringList({QLatin1String("ask"), QLatin1String("allow"), QLatin1String("disallow")}));
Expand All @@ -93,7 +92,6 @@ void SettingsManager::createInstance(const QString &path, QObject *parent)
registerOption(Browser_EnableNotificationsOption, QLatin1String("ask"), EnumerationType, QStringList({QLatin1String("ask"), QLatin1String("allow"), QLatin1String("disallow")}));
registerOption(Browser_EnableOfflineStorageDatabaseOption, false, BooleanType);
registerOption(Browser_EnableOfflineWebApplicationCacheOption, false, BooleanType);
registerOption(Browser_EnablePasswordsManagerOption, true, BooleanType);
registerOption(Browser_EnablePluginsOption, QLatin1String("onDemand"), EnumerationType, QStringList({QLatin1String("enabled"), QLatin1String("onDemand"), QLatin1String("disabled")}));
registerOption(Browser_EnablePointerLockOption, QLatin1String("ask"), EnumerationType, QStringList({QLatin1String("ask"), QLatin1String("allow"), QLatin1String("disallow")}));
registerOption(Browser_EnableSingleKeyShortcutsOption, true, BooleanType);
Expand All @@ -114,6 +112,7 @@ void SettingsManager::createInstance(const QString &path, QObject *parent)
registerOption(Browser_OfflineWebApplicationCacheLimitOption, 10240, IntegerType);
registerOption(Browser_OpenLinksInNewTabOption, true, BooleanType);
registerOption(Browser_PrivateModeOption, false, BooleanType);
registerOption(Browser_RememberPasswordsOption, false, BooleanType);
registerOption(Browser_ReuseCurrentTabOption, false, BooleanType);
registerOption(Browser_ShowSelectionContextMenuOnDoubleClickOption, false, BooleanType);
registerOption(Browser_SpellCheckDictionaryOption, QString(), StringType);
Expand Down
3 changes: 1 addition & 2 deletions src/core/SettingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class SettingsManager : public QObject
Backends_PasswordsOption,
Backends_WebOption,
Browser_AlwaysAskWhereToSaveDownloadOption,
Browser_AskToSavePasswordOption,
Browser_DelayRestoringOfBackgroundTabsOption,
Browser_EnableFullScreenOption,
Browser_EnableGeolocationOption,
Expand All @@ -73,7 +72,6 @@ class SettingsManager : public QObject
Browser_EnableNotificationsOption,
Browser_EnableOfflineStorageDatabaseOption,
Browser_EnableOfflineWebApplicationCacheOption,
Browser_EnablePasswordsManagerOption,
Browser_EnablePluginsOption,
Browser_EnablePointerLockOption,
Browser_EnableSingleKeyShortcutsOption,
Expand All @@ -94,6 +92,7 @@ class SettingsManager : public QObject
Browser_OfflineWebApplicationCacheLimitOption,
Browser_OpenLinksInNewTabOption,
Browser_PrivateModeOption,
Browser_RememberPasswordsOption,
Browser_ReuseCurrentTabOption,
Browser_ShowSelectionContextMenuOnDoubleClickOption,
Browser_SpellCheckDictionaryOption,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void QtWebKitWebWidget::pageLoadFinished()
}
}

if (!SettingsManager::getValue(SettingsManager::Browser_EnablePasswordsManagerOption).toBool() || !SettingsManager::getValue(SettingsManager::Browser_AskToSavePasswordOption).toBool())
if (!SettingsManager::getValue(SettingsManager::Browser_RememberPasswordsOption).toBool())
{
return;
}
Expand Down
10 changes: 10 additions & 0 deletions src/ui/preferences/PreferencesPrivacyPageWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "PreferencesPrivacyPageWidget.h"
#include "CookiesExceptionsDialog.h"
#include "../ClearHistoryDialog.h"
#include "../../core/ActionsManager.h"
#include "../../core/SettingsManager.h"

#include "ui_PreferencesPrivacyPageWidget.h"
Expand Down Expand Up @@ -73,11 +74,14 @@ PreferencesPrivacyPageWidget::PreferencesPrivacyPageWidget(QWidget *parent) : QW
m_ui->clearHistoryCheckBox->setChecked(!m_clearHisorySettings.isEmpty());
m_ui->clearHistoryButton->setEnabled(!m_clearHisorySettings.isEmpty());

m_ui->rememberPasswordsCheckBox->setChecked(SettingsManager::getValue(SettingsManager::Browser_RememberPasswordsOption).toBool());

connect(m_ui->privateModeCheckBox, SIGNAL(toggled(bool)), m_ui->historyWidget, SLOT(setDisabled(bool)));
connect(m_ui->enableCookiesCheckBox, SIGNAL(toggled(bool)), m_ui->cookiesWidget, SLOT(setEnabled(bool)));
connect(m_ui->thirdPartyCookiesExceptionsButton, SIGNAL(clicked(bool)), this, SLOT(setupThirdPartyCookiesExceptions()));
connect(m_ui->clearHistoryCheckBox, SIGNAL(toggled(bool)), m_ui->clearHistoryButton, SLOT(setEnabled(bool)));
connect(m_ui->clearHistoryButton, SIGNAL(clicked()), this, SLOT(setupClearHistory()));
connect(m_ui->managePasswordsButton, SIGNAL(clicked()), this, SLOT(viewPasswords()));
}

PreferencesPrivacyPageWidget::~PreferencesPrivacyPageWidget()
Expand Down Expand Up @@ -123,6 +127,11 @@ void PreferencesPrivacyPageWidget::setupClearHistory()
m_ui->clearHistoryButton->setEnabled(!m_clearHisorySettings.isEmpty());
}

void PreferencesPrivacyPageWidget::viewPasswords()
{
ActionsManager::triggerAction(ActionsManager::PasswordsAction, this);
}

void PreferencesPrivacyPageWidget::save()
{
SettingsManager::setValue(SettingsManager::Network_DoNotTrackPolicyOption, m_ui->doNotTrackComboBox->currentData().toString());
Expand All @@ -135,6 +144,7 @@ void PreferencesPrivacyPageWidget::save()
SettingsManager::setValue(SettingsManager::Network_ThirdPartyCookiesAcceptedHostsOption, m_thirdPartyCookiesAcceptedHosts);
SettingsManager::setValue(SettingsManager::Network_ThirdPartyCookiesRejectedHostsOption, m_thirdPartyCookiesRejectedHosts);
SettingsManager::setValue(SettingsManager::History_ClearOnCloseOption, (m_ui->clearHistoryCheckBox->isChecked() ? m_clearHisorySettings : QStringList()));
SettingsManager::setValue(SettingsManager::Browser_RememberPasswordsOption, m_ui->rememberPasswordsCheckBox->isChecked());
}

}
1 change: 1 addition & 0 deletions src/ui/preferences/PreferencesPrivacyPageWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class PreferencesPrivacyPageWidget : public QWidget
protected slots:
void setupThirdPartyCookiesExceptions();
void setupClearHistory();
void viewPasswords();
void save();

private:
Expand Down
8 changes: 1 addition & 7 deletions src/ui/preferences/PreferencesPrivacyPageWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@
<layout class="QHBoxLayout" name="rememberPasswordsLayout">
<item>
<widget class="QCheckBox" name="rememberPasswordsCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remember passwords</string>
</property>
Expand All @@ -346,10 +343,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="rememberPasswordsButton">
<property name="enabled">
<bool>false</bool>
</property>
<widget class="QPushButton" name="managePasswordsButton">
<property name="text">
<string>Manage…</string>
</property>
Expand Down

0 comments on commit 4b12a1b

Please sign in to comment.