mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr2586'
This commit is contained in:
commit
f0f49e79f0
|
@ -741,52 +741,31 @@ void Widget::confirmExecutableOpen(const QFileInfo &file)
|
||||||
|
|
||||||
void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason)
|
void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
switch (reason)
|
if (reason == QSystemTrayIcon::Trigger)
|
||||||
{
|
{
|
||||||
case QSystemTrayIcon::Trigger:
|
if (isHidden() || isMinimized())
|
||||||
{
|
{
|
||||||
if (isHidden())
|
|
||||||
{
|
|
||||||
show();
|
|
||||||
activateWindow();
|
|
||||||
if (wasMaximized)
|
if (wasMaximized)
|
||||||
showMaximized();
|
showMaximized();
|
||||||
else
|
else
|
||||||
showNormal();
|
showNormal();
|
||||||
}
|
|
||||||
else if (isMinimized())
|
|
||||||
{
|
|
||||||
forceShow();
|
|
||||||
activateWindow();
|
|
||||||
if (wasMaximized)
|
|
||||||
showMaximized();
|
|
||||||
else
|
|
||||||
showNormal();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wasMaximized = isMaximized();
|
|
||||||
if (Settings::getInstance().getMinimizeToTray())
|
|
||||||
hide();
|
|
||||||
else
|
|
||||||
showMinimized();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
activateWindow();
|
||||||
|
}
|
||||||
|
else if (!isActiveWindow())
|
||||||
|
{
|
||||||
|
activateWindow();
|
||||||
}
|
}
|
||||||
case QSystemTrayIcon::MiddleClick:
|
|
||||||
wasMaximized = isMaximized();
|
|
||||||
if (Settings::getInstance().getMinimizeToTray())
|
|
||||||
hide();
|
|
||||||
else
|
else
|
||||||
showMinimized();
|
{
|
||||||
break;
|
wasMaximized = isMaximized();
|
||||||
case QSystemTrayIcon::Unknown:
|
hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (reason == QSystemTrayIcon::Unknown)
|
||||||
|
{
|
||||||
if (isHidden())
|
if (isHidden())
|
||||||
forceShow();
|
forceShow();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user