try to fix problems with wrong detections of tray icon state
This commit is contained in:
parent
7b48ef358f
commit
682489a233
@ -87,15 +87,9 @@ void SystemTrayIcon::showPrivate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SystemTrayIcon::show() {
|
void SystemTrayIcon::show() {
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
// Show immediately.
|
// Show immediately.
|
||||||
qDebugNN << LOGSEC_GUI << "Showing tray icon immediately.";
|
qDebugNN << LOGSEC_GUI << "Showing tray icon immediately.";
|
||||||
showPrivate();
|
showPrivate();
|
||||||
#else
|
|
||||||
// Delay avoids race conditions and tray icon is properly displayed.
|
|
||||||
qDebugNN << LOGSEC_GUI << "Showing tray icon with 3000 ms delay.";
|
|
||||||
QTimer::singleShot(3000, this, &SystemTrayIcon::showPrivate);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTrayIcon::setNumber(int number, bool any_new_message) {
|
void SystemTrayIcon::setNumber(int number, bool any_new_message) {
|
||||||
|
@ -465,15 +465,29 @@ QIcon Application::desktopAwareIcon() const {
|
|||||||
void Application::showTrayIcon() {
|
void Application::showTrayIcon() {
|
||||||
// Display tray icon if it is enabled and available.
|
// Display tray icon if it is enabled and available.
|
||||||
if (SystemTrayIcon::isSystemTrayDesired()) {
|
if (SystemTrayIcon::isSystemTrayDesired()) {
|
||||||
#if !defined(Q_OS_LINUX)
|
qDebugNN << LOGSEC_GUI << "User wants to have tray icon.";
|
||||||
if (!SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
|
||||||
qWarningNN << LOGSEC_GUI << "Tray icon area is not available.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
qDebugNN << LOGSEC_GUI << "Showing tray icon.";
|
#if defined(Q_OS_WIN)
|
||||||
trayIcon()->show();
|
if (SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||||
|
qDebugNN << LOGSEC_GUI << "Tray icon is available, showing now.";
|
||||||
|
trayIcon()->show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_feedReader->feedsModel()->notifyWithCounts();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// Delay avoids race conditions and tray icon is properly displayed.
|
||||||
|
qWarningNN << LOGSEC_GUI << "Showing tray icon with 3000 ms delay.";
|
||||||
|
QTimer::singleShot(3000, this, [=]() {
|
||||||
|
if (SystemTrayIcon::isSystemTrayAreaAvailable()) {
|
||||||
|
qWarningNN << LOGSEC_GUI << "Tray icon is available, showing now.";
|
||||||
|
trayIcon()->show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_feedReader->feedsModel()->notifyWithCounts();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_feedReader->feedsModel()->notifyWithCounts();
|
m_feedReader->feedsModel()->notifyWithCounts();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user