add optionsfield to set http port

This commit is contained in:
denk-mal 2015-06-22 14:11:15 +02:00
parent b03f54ffcd
commit fc74e16097
5 changed files with 47 additions and 9 deletions

View File

@ -126,6 +126,18 @@ void HttpSettings::setSupportKphFields(bool supportKphFields)
config()->set("Http/SupportKphFields", supportKphFields);
}
int HttpSettings::httpPort()
{
static const int PORT = 19455;
return config()->get("Http/Port", PORT).toInt();
}
void HttpSettings::setHttpPort(int port)
{
config()->set("Http/Port", port);
}
bool HttpSettings::passwordUseNumbers()
{
return config()->get("Http/generator/Numbers", true).toBool();

View File

@ -42,6 +42,8 @@ public:
static void setSearchInAllDatabases(bool searchInAllDatabases);
static bool supportKphFields();
static void setSupportKphFields(bool supportKphFields);
static int httpPort();
static void setHttpPort(int port);
static bool passwordUseNumbers();
static void setPasswordUseNumbers(bool useNumbers);

View File

@ -42,6 +42,7 @@ void OptionDialog::loadSettings()
ui->sortByUsername->setChecked(true);
else
ui->sortByTitle->setChecked(true);
ui->httpPort->setText(QString::number(settings.httpPort()));
/*
ui->checkBoxLower->setChecked(settings.passwordUseLowercase());
@ -68,6 +69,7 @@ void OptionDialog::saveSettings()
settings.setUnlockDatabase(ui->unlockDatabase->isChecked());
settings.setMatchUrlScheme(ui->matchUrlScheme->isChecked());
settings.setSortByUsername(ui->sortByUsername->isChecked());
settings.setHttpPort(ui->httpPort->text().toInt());
/*
settings.setPasswordUseLowercase(ui->checkBoxLower->isChecked());

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>463</width>
<width>531</width>
<height>354</height>
</rect>
</property>
@ -28,7 +28,7 @@ This is required for accessing keypass database from ChromeIPass or PassIfox</st
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -200,6 +200,33 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>HTTP Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="httpPort">
<property name="inputMask">
<string notr="true">d0000</string>
</property>
<property name="placeholderText">
<string>Default port: 19455</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -226,11 +253,6 @@ Only entries with the same scheme (http://, https://, ftp://, ...) are returned<
<header>http/HttpPasswordGeneratorWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PasswordEdit</class>
<extends>QLineEdit</extends>
<header>gui/PasswordEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -322,9 +322,9 @@ void Server::start(void)
{
if (m_started) return;
static const int PORT = 19455;
int port = HttpSettings::httpPort();
daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL,
daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
&this->request_handler_wrapper, this,
MHD_OPTION_NOTIFY_COMPLETED,
this->request_completed, NULL,