mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 05:25:37 +00:00
Merge pull request #6730 from Chocobo1/icontray
Fix double click on system tray icon causing program to open and minimize immediately
This commit is contained in:
commit
a2d5d48aff
@ -953,17 +953,17 @@ void MainWindow::notifyOfUpdate(QString)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Toggle Main window visibility
|
// Toggle Main window visibility
|
||||||
void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
if ((e == QSystemTrayIcon::Trigger) || (e == QSystemTrayIcon::DoubleClick)) {
|
switch (reason) {
|
||||||
|
case QSystemTrayIcon::Trigger: {
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
if (m_uiLocked) {
|
if (m_uiLocked && !unlockUI()) // Ask for UI lock password
|
||||||
// Ask for UI lock password
|
return;
|
||||||
if (!unlockUI())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Make sure the window is not minimized
|
// Make sure the window is not minimized
|
||||||
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||||
|
|
||||||
// Then show it
|
// Then show it
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
@ -972,6 +972,12 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
|||||||
else {
|
else {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
void showNotificationBaloon(QString title, QString msg) const;
|
void showNotificationBaloon(QString title, QString msg) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
|
void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger);
|
||||||
|
|
||||||
void balloonClicked();
|
void balloonClicked();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user