diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp
index e6b695031..8a3dd0536 100644
--- a/src/widget/form/settings/generalform.cpp
+++ b/src/widget/form/settings/generalform.cpp
@@ -52,6 +52,8 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
else
bodyUI->styleBrowser->setCurrentText("None");
+ bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime());
+
bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP());
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
int port = Settings::getInstance().getProxyPort();
@@ -73,6 +75,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
+ connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
}
GeneralForm::~GeneralForm()
@@ -107,6 +110,13 @@ void GeneralForm::onStyleSelected(QString style)
parent->setBodyHeadStyle(style);
}
+void GeneralForm::onAutoAwayChanged()
+{
+ int minutes = bodyUI->autoAwaySpinBox->value();
+ Settings::getInstance().setAutoAwayTime(minutes);
+ Widget::getInstance()->setIdleTimer(minutes);
+}
+
void GeneralForm::onSetStatusChange()
{
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked());
diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h
index 0efa6ce4a..31a73eb32 100644
--- a/src/widget/form/settings/generalform.h
+++ b/src/widget/form/settings/generalform.h
@@ -42,6 +42,8 @@ private slots:
void onUseProxyUpdated();
void onStyleSelected(QString style);
void onSetStatusChange();
+ void onAutoAwayChanged();
+
private:
Ui::GeneralSettings *bodyUI;
diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui
index f10025c52..da70efdae 100644
--- a/src/widget/form/settings/generalsettings.ui
+++ b/src/widget/form/settings/generalsettings.ui
@@ -7,7 +7,7 @@
0
0
527
- 397
+ 500
@@ -60,6 +60,42 @@
+ -
+
+
-
+
+
+ Provided in minutes
+
+
+ Qt::LeftToRight
+
+
+ Auto away after:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ minutes
+
+
+ 1
+
+
+ 600
+
+
+
+
+
diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp
index bbff4ad90..254256c9c 100644
--- a/src/widget/widget.cpp
+++ b/src/widget/widget.cpp
@@ -294,6 +294,11 @@ QString Widget::askProfiles()
return profile;
}
+void Widget::setIdleTimer(int minutes)
+{
+ idleTimer->start(minutes * 1000*60);
+}
+
QString Widget::getUsername()
{
return core->getUsername();
diff --git a/src/widget/widget.h b/src/widget/widget.h
index 602e8a889..98e664706 100644
--- a/src/widget/widget.h
+++ b/src/widget/widget.h
@@ -59,6 +59,7 @@ public:
bool getIsWindowMinimized();
static QList searchProfiles();
void clearContactsList();
+ void setIdleTimer(int minutes);
~Widget();
virtual void closeEvent(QCloseEvent *event);