Commit 5f4da8b5 authored by Ming Rui Zhang's avatar Ming Rui Zhang

settingswidget: add option for enabling or disabling running the application on startup

Change-Id: Ie8a9ed96b59c972c937037645c9972472fd32b16
parent efbfa72f
......@@ -234,6 +234,8 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(ui->closeOrMinCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetClosedOrMin);
connect(ui->applicationOnStartUpCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetRunOnStartUp);
connect(ui->downloadButton, &QAbstractButton::clicked, this, &SettingsWidget::openDownloadFolderSlot);
connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &SettingsWidget::checkForUpdateSlot);
......@@ -909,6 +911,7 @@ SettingsWidget::populateGeneralSettings()
Utils::setElidedText(ui->downloadButton, downloadPath);
ui->closeOrMinCheckBox->setChecked(settings.value(SettingsKey::closeOrMinimized).toBool());
ui->applicationOnStartUpCheckBox->setChecked(Utils::CheckStartupLink(L"Jami"));
auto notifs = settings.value(SettingsKey::enableNotifications).toBool();
ui->notificationCheckBox->setChecked(notifs);
......@@ -952,6 +955,18 @@ SettingsWidget::slotSetClosedOrMin(bool state)
settings.setValue(SettingsKey::closeOrMinimized, state);
}
void
SettingsWidget::slotSetRunOnStartUp(bool state)
{
if (Utils::CheckStartupLink(L"Jami")) {
if (!state) {
Utils::DeleteStartupLink(L"Jami");
}
} else if (state) {
Utils::CreateStartupLink(L"Jami");
}
}
void
SettingsWidget::checkForUpdateSlot()
{
......
......@@ -132,6 +132,7 @@ private slots:
void slotSetNotifications(bool state);
void checkForUpdateSlot();
void slotSetClosedOrMin(bool state);
void slotSetRunOnStartUp(bool state);
void openDownloadFolderSlot();
void openRecordFolderSlot();
void slotAlwaysRecordingClicked(bool state);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>919</width>
<height>690</height>
<width>890</width>
<height>656</height>
</rect>
</property>
<property name="windowTitle">
......@@ -39,8 +39,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>917</width>
<height>688</height>
<width>888</width>
<height>654</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
......@@ -668,6 +668,34 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="applicationOnStartUpLayout">
<item>
<widget class="ToggleSwitch" name="applicationOnStartUpCheckBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Run on Startup</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_22">
<property name="leftMargin">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment