mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Wait up to 30 secs before complaining about missing systray
Conflicts: src/mirall/utility.cpp Fixes #949
This commit is contained in:
parent
74ec37f3c7
commit
f597f99198
3 changed files with 34 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();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#ifdef Q_OS_UNIX
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -37,6 +38,7 @@
|
|||
#elif defined(Q_OS_WIN)
|
||||
#include <shlobj.h>
|
||||
#include <winbase.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace Mirall {
|
||||
|
@ -366,4 +368,12 @@ QString Utility::toCSyncScheme(const QString &urlStr)
|
|||
return url.toString();
|
||||
}
|
||||
|
||||
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