comparison ui/main.cpp @ 871:4efd6378c001

(issue51) Add fallback in case systemtray is unavailable. If no systemtray is available it will now show a message box as notification.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 Aug 2014 18:03:23 +0200
parents c9a31544aaab
children 0051cb07da28
comparison
equal deleted inserted replaced
870:e93ae5233217 871:4efd6378c001
13 #include "taskscheduler.h" 13 #include "taskscheduler.h"
14 #endif 14 #endif
15 15
16 #include <QApplication> 16 #include <QApplication>
17 #include <QFile> 17 #include <QFile>
18 #include <QSystemTrayIcon>
19 #include <QtPlugin> 18 #include <QtPlugin>
20 #include <QMessageBox> 19 #include <QMessageBox>
21 #include <QSettings> 20 #include <QSettings>
22 #include <QDebug> 21 #include <QDebug>
23 #include <QTranslator> 22 #include <QTranslator>
105 translator.load(":/l10n/trustbridge_" + QLocale::system().name()); 104 translator.load(":/l10n/trustbridge_" + QLocale::system().name());
106 qDebug() << "Loading translations for: " << "trustbridge_" + 105 qDebug() << "Loading translations for: " << "trustbridge_" +
107 QLocale::system().name(); 106 QLocale::system().name();
108 } 107 }
109 app.installTranslator(&translator); 108 app.installTranslator(&translator);
110 109 /*
111 if ((!QSystemTrayIcon::isSystemTrayAvailable() || 110 if ((!QSystemTrayIcon::isSystemTrayAvailable() ||
112 !QSystemTrayIcon::supportsMessages()) && trayMode) { 111 !QSystemTrayIcon::supportsMessages()) && trayMode) {
113 QMessageBox::critical(0, QString::fromLatin1(APPNAME), 112 QMessageBox::critical(0, QString::fromLatin1(APPNAME),
114 QObject::tr("Couldn't detect any system tray " 113 QObject::tr("Couldn't detect any system tray "
115 "on this system. This software can only " 114 "on this system. This software can only "
116 "be used in a desktop environment.")); 115 "be used in a desktop environment."));
117 return 1; 116 return 1;
118 } 117 }
119 118 */
120 #ifdef Q_OS_WIN 119 #ifdef Q_OS_WIN
121 { 120 {
122 TaskScheduler taskSched; 121 TaskScheduler taskSched;
123 qDebug() << " task sched done: " << taskSched.createDailyTask(QCoreApplication::applicationFilePath(), 122 qDebug() << " task sched done: " << taskSched.createDailyTask(QCoreApplication::applicationFilePath(),
124 QString::fromLatin1("--tray"), QTime::currentTime()); 123 QString::fromLatin1("--tray"), QTime::currentTime());

http://wald.intevation.org/projects/trustbridge/