@@ -16,6 +16,15 @@ Kirigami.ScrollablePage {
|
|||||||
title: i18n("Settings")
|
title: i18n("Settings")
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
Kirigami.FormLayout {
|
||||||
|
QQC2.CheckBox {
|
||||||
|
Kirigami.FormData.label: i18nc("General settings:")
|
||||||
|
text: i18n("Close to sytem tray")
|
||||||
|
checked: Config.systemTray
|
||||||
|
onToggled: {
|
||||||
|
Config.systemTray = checked
|
||||||
|
Config.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
QQC2.CheckBox {
|
QQC2.CheckBox {
|
||||||
// TODO: When there are enough notification and timeline event
|
// TODO: When there are enough notification and timeline event
|
||||||
// settings, make 2 separate groups with FormData labels.
|
// settings, make 2 separate groups with FormData labels.
|
||||||
|
|||||||
@@ -55,15 +55,26 @@
|
|||||||
Controller::Controller(QObject *parent)
|
Controller::Controller(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
|
||||||
|
|
||||||
Connection::setRoomType<NeoChatRoom>();
|
Connection::setRoomType<NeoChatRoom>();
|
||||||
Connection::setUserType<NeoChatUser>();
|
Connection::setUserType<NeoChatUser>();
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
TrayIcon *trayIcon = new TrayIcon(this);
|
TrayIcon *trayIcon = new TrayIcon(this);
|
||||||
trayIcon->show();
|
if(NeoChatConfig::self()->systemTray()) {
|
||||||
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
|
trayIcon->show();
|
||||||
|
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
|
||||||
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
}
|
||||||
|
connect(NeoChatConfig::self(), &NeoChatConfig::SystemTrayChanged, this, [=](){
|
||||||
|
if(NeoChatConfig::self()->systemTray()) {
|
||||||
|
trayIcon->show();
|
||||||
|
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
|
||||||
|
} else {
|
||||||
|
trayIcon->hide();
|
||||||
|
disconnect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
|
||||||
|
}
|
||||||
|
QApplication::setQuitOnLastWindowClosed(!NeoChatConfig::self()->systemTray());
|
||||||
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [=] {
|
QTimer::singleShot(0, this, [=] {
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
<label>Show avatar update events in the timeline</label>
|
<label>Show avatar update events in the timeline</label>
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="SystemTray" type="bool">
|
||||||
|
<label>Close NeoChat to system tray</label>
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
</kcfg>
|
</kcfg>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user