keepassxc/src/http/OptionDialog.cpp

98 lines
3.6 KiB
C++
Raw Normal View History

2013-04-17 13:19:07 -04:00
/**
***************************************************************************
* @file OptionDialog.cpp
*
* @brief
*
* Copyright (C) 2013
*
* @author Francois Ferrand
* @date 4/2013
***************************************************************************
*/
#include "OptionDialog.h"
#include "ui_OptionDialog.h"
#include "HttpSettings.h"
#include <QMessageBox>
2013-04-17 13:19:07 -04:00
OptionDialog::OptionDialog(QWidget *parent) :
QWidget(parent),
ui(new Ui::OptionDialog())
2013-04-17 13:19:07 -04:00
{
ui->setupUi(this);
connect(ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SIGNAL(removeSharedEncryptionKeys()));
connect(ui->removeStoredPermissions, SIGNAL(clicked()), this, SIGNAL(removeStoredPermissions()));
}
OptionDialog::~OptionDialog()
{
}
void OptionDialog::loadSettings()
{
HttpSettings settings;
ui->enableHttpServer->setChecked(settings.isEnabled());
ui->showNotification->setChecked(settings.showNotification());
ui->bestMatchOnly->setChecked(settings.bestMatchOnly());
ui->unlockDatabase->setChecked(settings.unlockDatabase());
ui->matchUrlScheme->setChecked(settings.matchUrlScheme());
if (settings.sortByUsername())
ui->sortByUsername->setChecked(true);
else
ui->sortByTitle->setChecked(true);
2015-06-22 08:11:15 -04:00
ui->httpPort->setText(QString::number(settings.httpPort()));
2013-04-17 13:19:07 -04:00
/*
2013-04-17 13:19:07 -04:00
ui->checkBoxLower->setChecked(settings.passwordUseLowercase());
ui->checkBoxNumbers->setChecked(settings.passwordUseNumbers());
ui->checkBoxUpper->setChecked(settings.passwordUseUppercase());
ui->checkBoxSpecialChars->setChecked(settings.passwordUseSpecial());
ui->checkBoxEnsureEvery->setChecked(settings.passwordEveryGroup());
ui->checkBoxExcludeAlike->setChecked(settings.passwordExcludeAlike());
ui->spinBoxLength->setValue(settings.passwordLength());
*/
2013-04-17 13:19:07 -04:00
ui->alwaysAllowAccess->setChecked(settings.alwaysAllowAccess());
ui->alwaysAllowUpdate->setChecked(settings.alwaysAllowUpdate());
ui->searchInAllDatabases->setChecked(settings.searchInAllDatabases());
2016-10-28 09:25:57 -04:00
ui->supportKphFields->setChecked(settings.supportKphFields());
2013-04-17 13:19:07 -04:00
}
void OptionDialog::saveSettings()
{
HttpSettings settings;
settings.setEnabled(ui->enableHttpServer->isChecked());
settings.setShowNotification(ui->showNotification->isChecked());
settings.setBestMatchOnly(ui->bestMatchOnly->isChecked());
settings.setUnlockDatabase(ui->unlockDatabase->isChecked());
settings.setMatchUrlScheme(ui->matchUrlScheme->isChecked());
settings.setSortByUsername(ui->sortByUsername->isChecked());
int port = ui->httpPort->text().toInt();
if (port < 1024) {
QMessageBox::warning(this, tr("Cannot bind to privileged ports"),
tr("Cannot bind to privileged ports below 1024!\nUsing default port 19455."));
port = 19455;
}
settings.setHttpPort(port);
2013-04-17 13:19:07 -04:00
/*
2013-04-17 13:19:07 -04:00
settings.setPasswordUseLowercase(ui->checkBoxLower->isChecked());
settings.setPasswordUseNumbers(ui->checkBoxNumbers->isChecked());
settings.setPasswordUseUppercase(ui->checkBoxUpper->isChecked());
settings.setPasswordUseSpecial(ui->checkBoxSpecialChars->isChecked());
settings.setPasswordEveryGroup(ui->checkBoxEnsureEvery->isChecked());
settings.setPasswordExcludeAlike(ui->checkBoxExcludeAlike->isChecked());
settings.setPasswordLength(ui->spinBoxLength->value());
*/
2013-04-17 13:19:07 -04:00
settings.setAlwaysAllowAccess(ui->alwaysAllowAccess->isChecked());
settings.setAlwaysAllowUpdate(ui->alwaysAllowUpdate->isChecked());
settings.setSearchInAllDatabases(ui->searchInAllDatabases->isChecked());
2016-10-28 09:25:57 -04:00
settings.setSupportKphFields(ui->supportKphFields->isChecked());
2013-04-17 13:19:07 -04:00
}