mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
Wait up to 30 secs before complaining about missing systray
This commit is contained in:
parent
1e7716abb4
commit
5639572ef3
3 changed files with 36 additions and 7 deletions
30
src/main.cpp
30
src/main.cpp
|
@ -14,8 +14,20 @@
|
|||
|
||||
#include "mirall/application.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/utility.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
void warnSystray()
|
||||
{
|
||||
QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"),
|
||||
qApp->translate("main.cpp", "%1 requires on a working system tray. "
|
||||
"If you are running XFCE, please follow "
|
||||
"<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
|
||||
"Otherwise, please install a system tray application such as 'trayer' and try again.")
|
||||
.arg(Mirall::Theme::instance()->appNameGUI()));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -39,13 +51,17 @@ int main(int argc, char **argv)
|
|||
}
|
||||
return 0;
|
||||
} else {
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") {
|
||||
QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"),
|
||||
qApp->translate("main.cpp", "%1 requires on a working system tray. "
|
||||
"If you are running XFCE, please follow "
|
||||
"<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
|
||||
"Otherwise, please install a system tray application such as 'trayer' and try again.")
|
||||
.arg(Mirall::Theme::instance()->appNameGUI()));
|
||||
int attempts = 0;
|
||||
forever {
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") {
|
||||
Mirall::Utility::sleep(1);
|
||||
attempts++;
|
||||
if (attempts < 30) continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
warnSystray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return app.exec();
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#ifdef Q_OS_UNIX
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -44,6 +45,7 @@
|
|||
#elif defined(Q_OS_WIN)
|
||||
#include <shlobj.h>
|
||||
#include <winbase.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace Mirall {
|
||||
|
@ -391,4 +393,14 @@ QString Utility::dataLocation()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Utility::sleep(int sec)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
::Sleep(sec*1000);
|
||||
#else
|
||||
::sleep(sec);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Mirall
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Mirall {
|
|||
|
||||
namespace Utility
|
||||
{
|
||||
void sleep(int sec);
|
||||
QString formatFingerprint( const QByteArray& );
|
||||
void setupFavLink( const QString &folder );
|
||||
QString octetsToString( qint64 octets );
|
||||
|
|
Loading…
Reference in a new issue