Comparar commits
4 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 098b603879 | |||
| 7c3b3d648b | |||
| 778aca386c | |||
| 0758b2cf61 |
@@ -151,6 +151,11 @@ endif()
|
||||
|
||||
find_package(ZLIB)
|
||||
|
||||
find_package(LibsnoreQt5 0.6.0)
|
||||
if(LibsnoreQt5_FOUND)
|
||||
find_package(LibsnoreSettingsQt5)
|
||||
endif()
|
||||
|
||||
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
|
||||
|
||||
@@ -45,7 +45,7 @@ qt_wrap_ui(client_UI_SRCS ${client_UI})
|
||||
set(client_SRCS
|
||||
accountmanager.cpp
|
||||
accountsettings.cpp
|
||||
application.cpp
|
||||
ocapplication.cpp
|
||||
folder.cpp
|
||||
folderman.cpp
|
||||
folderstatusmodel.cpp
|
||||
@@ -212,6 +212,10 @@ if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND)
|
||||
list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
|
||||
include_directories(${QTKEYCHAIN_INCLUDE_DIR})
|
||||
endif()
|
||||
if(LibsnoreQt5_FOUND)
|
||||
add_definitions(-DHAVE_LIBSNORE)
|
||||
|
||||
endif()
|
||||
|
||||
# add executable icon on windows and osx
|
||||
include( AddAppIconMacro )
|
||||
@@ -289,6 +293,7 @@ target_link_libraries( ${APPLICATION_EXECUTABLE} ${QT_LIBRARIES} )
|
||||
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
|
||||
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
|
||||
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
|
||||
target_link_libraries( ${APPLICATION_EXECUTABLE} Snore::Libsnore Snore::LibsnoreSettings )
|
||||
|
||||
if(WITH_CRASHREPORTER)
|
||||
target_link_libraries( ${APPLICATION_EXECUTABLE} crashreporter-handler)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "folderstatusmodel.h"
|
||||
#include "folderstatusdelegate.h"
|
||||
#include "utility.h"
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
#include "configfile.h"
|
||||
#include "account.h"
|
||||
#include "accountstate.h"
|
||||
|
||||
@@ -41,7 +41,7 @@ class ActivityListModel;
|
||||
namespace Ui {
|
||||
class ActivityWidget;
|
||||
}
|
||||
class Application;
|
||||
class oCApplication;
|
||||
|
||||
/**
|
||||
* @brief The ActivityWidget class
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestFolderMan;
|
||||
|
||||
namespace OCC {
|
||||
|
||||
class Application;
|
||||
class oCApplication;
|
||||
class SyncResult;
|
||||
class SocketApi;
|
||||
class LockWatcher;
|
||||
@@ -255,7 +255,7 @@ private:
|
||||
|
||||
static FolderMan *_instance;
|
||||
explicit FolderMan(QObject *parent = 0);
|
||||
friend class OCC::Application;
|
||||
friend class OCC::oCApplication;
|
||||
friend class ::TestFolderMan;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "theme.h"
|
||||
#include "configfile.h"
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
#include "utility.h"
|
||||
#include "configfile.h"
|
||||
#include "owncloudsetupwizard.h"
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
#include "theme.h"
|
||||
#include "utility.h"
|
||||
#include "cocoainitializer.h"
|
||||
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
|
||||
#ifdef Q_OS_MAC
|
||||
Mac::CocoaInitializer cocoaInit; // RIIA
|
||||
#endif
|
||||
OCC::Application app(argc, argv);
|
||||
OCC::oCApplication app(argc, argv);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// The Windows style still has pixelated elements with Qt 5.6,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "theme.h"
|
||||
#include "configfile.h"
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
#include "utility.h"
|
||||
#include "configfile.h"
|
||||
#include "folderman.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -91,7 +91,7 @@ QString applicationTrPath()
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
Application::Application(int &argc, char **argv) :
|
||||
oCApplication::oCApplication(int &argc, char **argv) :
|
||||
SharedTools::QtSingleApplication(Theme::instance()->appName() ,argc, argv),
|
||||
_gui(0),
|
||||
_theme(Theme::instance()),
|
||||
@@ -202,7 +202,7 @@ Application::Application(int &argc, char **argv) :
|
||||
connect (this, SIGNAL(aboutToQuit()), SLOT(slotCleanup()));
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
oCApplication::~oCApplication()
|
||||
{
|
||||
// Make sure all folders are gone, otherwise removing the
|
||||
// accounts will remove the associated folders from the settings.
|
||||
@@ -214,7 +214,7 @@ Application::~Application()
|
||||
AccountManager::instance()->shutdown();
|
||||
}
|
||||
|
||||
void Application::slotAccountStateRemoved(AccountState *accountState)
|
||||
void oCApplication::slotAccountStateRemoved(AccountState *accountState)
|
||||
{
|
||||
if (_gui) {
|
||||
disconnect(accountState, SIGNAL(stateChanged(int)),
|
||||
@@ -237,7 +237,7 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
|
||||
}
|
||||
}
|
||||
|
||||
void Application::slotAccountStateAdded(AccountState *accountState)
|
||||
void oCApplication::slotAccountStateAdded(AccountState *accountState)
|
||||
{
|
||||
connect(accountState, SIGNAL(stateChanged(int)),
|
||||
_gui, SLOT(slotAccountStateChanged()));
|
||||
@@ -251,7 +251,7 @@ void Application::slotAccountStateAdded(AccountState *accountState)
|
||||
_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
|
||||
}
|
||||
|
||||
void Application::slotCleanup()
|
||||
void oCApplication::slotCleanup()
|
||||
{
|
||||
AccountManager::instance()->save();
|
||||
FolderMan::instance()->unloadAndDeleteAllFolders();
|
||||
@@ -263,7 +263,7 @@ void Application::slotCleanup()
|
||||
// FIXME: This is not ideal yet since a ConnectionValidator might already be running and is in
|
||||
// progress of timing out in some seconds.
|
||||
// Maybe we need 2 validators, one triggered by timer, one by network configuration changes?
|
||||
void Application::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf)
|
||||
void oCApplication::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf)
|
||||
{
|
||||
if (cnf.state() & QNetworkConfiguration::Active) {
|
||||
//qDebug() << "Trying fast reconnect";
|
||||
@@ -271,7 +271,7 @@ void Application::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf
|
||||
}
|
||||
}
|
||||
|
||||
void Application::slotCheckConnection()
|
||||
void oCApplication::slotCheckConnection()
|
||||
{
|
||||
auto list = AccountManager::instance()->accounts();
|
||||
foreach (const auto &accountState , list) {
|
||||
@@ -293,12 +293,12 @@ void Application::slotCheckConnection()
|
||||
}
|
||||
}
|
||||
|
||||
void Application::slotCrash()
|
||||
void oCApplication::slotCrash()
|
||||
{
|
||||
Utility::crash();
|
||||
}
|
||||
|
||||
void Application::slotownCloudWizardDone( int res )
|
||||
void oCApplication::slotownCloudWizardDone( int res )
|
||||
{
|
||||
AccountManager *accountMan = AccountManager::instance();
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
@@ -335,7 +335,7 @@ void Application::slotownCloudWizardDone( int res )
|
||||
}
|
||||
}
|
||||
|
||||
void Application::setupLogging()
|
||||
void oCApplication::setupLogging()
|
||||
{
|
||||
// might be called from second instance
|
||||
Logger::instance()->setLogFile(_logFile);
|
||||
@@ -352,12 +352,12 @@ void Application::setupLogging()
|
||||
|
||||
}
|
||||
|
||||
void Application::slotUseMonoIconsChanged(bool)
|
||||
void oCApplication::slotUseMonoIconsChanged(bool)
|
||||
{
|
||||
_gui->slotComputeOverallSyncStatus();
|
||||
}
|
||||
|
||||
void Application::slotParseMessage(const QString &msg, QObject*)
|
||||
void oCApplication::slotParseMessage(const QString &msg, QObject*)
|
||||
{
|
||||
if (msg.startsWith(QLatin1String("MSG_PARSEOPTIONS:"))) {
|
||||
const int lengthOfMsgPrefix = 17;
|
||||
@@ -375,7 +375,7 @@ void Application::slotParseMessage(const QString &msg, QObject*)
|
||||
}
|
||||
}
|
||||
|
||||
void Application::parseOptions(const QStringList &options)
|
||||
void oCApplication::parseOptions(const QStringList &options)
|
||||
{
|
||||
QStringListIterator it(options);
|
||||
// skip file name;
|
||||
@@ -455,7 +455,7 @@ static void displayHelpText(const QString &t)
|
||||
}
|
||||
#endif
|
||||
|
||||
void Application::showHelp()
|
||||
void oCApplication::showHelp()
|
||||
{
|
||||
setHelp();
|
||||
QString helpText;
|
||||
@@ -473,7 +473,7 @@ void Application::showHelp()
|
||||
displayHelpText(helpText);
|
||||
}
|
||||
|
||||
void Application::showVersion()
|
||||
void oCApplication::showVersion()
|
||||
{
|
||||
QString helpText;
|
||||
QTextStream stream(&helpText);
|
||||
@@ -485,7 +485,7 @@ void Application::showVersion()
|
||||
displayHelpText(helpText);
|
||||
}
|
||||
|
||||
void Application::showHint(std::string errorHint)
|
||||
void oCApplication::showHint(std::string errorHint)
|
||||
{
|
||||
static QString binName = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
|
||||
std::cerr << errorHint << std::endl;
|
||||
@@ -493,12 +493,12 @@ void Application::showHint(std::string errorHint)
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
bool Application::debugMode()
|
||||
bool oCApplication::debugMode()
|
||||
{
|
||||
return _debugMode;
|
||||
}
|
||||
|
||||
void Application::setHelp()
|
||||
void oCApplication::setHelp()
|
||||
{
|
||||
_helpOnly = true;
|
||||
}
|
||||
@@ -518,7 +518,7 @@ QString substLang(const QString &lang)
|
||||
return lang;
|
||||
}
|
||||
|
||||
void Application::setupTranslations()
|
||||
void oCApplication::setupTranslations()
|
||||
{
|
||||
QStringList uiLanguages;
|
||||
// uiLanguages crashes on Windows with 4.8.0 release builds
|
||||
@@ -582,21 +582,20 @@ void Application::setupTranslations()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Application::giveHelp()
|
||||
bool oCApplication::giveHelp()
|
||||
{
|
||||
return _helpOnly;
|
||||
}
|
||||
|
||||
bool Application::versionOnly()
|
||||
bool oCApplication::versionOnly()
|
||||
{
|
||||
return _versionOnly;
|
||||
}
|
||||
|
||||
void Application::showSettingsDialog()
|
||||
void oCApplication::showSettingsDialog()
|
||||
{
|
||||
_gui->slotShowSettings();
|
||||
}
|
||||
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef APPLICATION_H
|
||||
#define APPLICATION_H
|
||||
#ifndef OCAPPLICATION_H
|
||||
#define OCAPPLICATION_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPointer>
|
||||
@@ -49,12 +49,12 @@ class SslErrorDialog;
|
||||
* @brief The Application class
|
||||
* @ingroup gui
|
||||
*/
|
||||
class Application : public SharedTools::QtSingleApplication
|
||||
class oCApplication : public SharedTools::QtSingleApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Application(int &argc, char **argv);
|
||||
~Application();
|
||||
explicit oCApplication(int &argc, char **argv);
|
||||
~oCApplication();
|
||||
|
||||
bool giveHelp();
|
||||
void showHelp();
|
||||
+31
-13
@@ -11,7 +11,7 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "ocapplication.h"
|
||||
#include "owncloudgui.h"
|
||||
#include "theme.h"
|
||||
#include "folderman.h"
|
||||
@@ -47,7 +47,7 @@ namespace OCC {
|
||||
|
||||
const char propertyAccountC[] = "oc_account";
|
||||
|
||||
ownCloudGui::ownCloudGui(Application *parent) :
|
||||
ownCloudGui::ownCloudGui(oCApplication *parent) :
|
||||
QObject(parent),
|
||||
_tray(0),
|
||||
#if defined(Q_OS_MAC)
|
||||
@@ -96,10 +96,10 @@ ownCloudGui::ownCloudGui(Application *parent) :
|
||||
connect( AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)),
|
||||
SLOT(setupContextMenu()));
|
||||
|
||||
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
|
||||
SLOT(slotShowTrayMessage(QString,QString)));
|
||||
connect( Logger::instance(), SIGNAL(optionalGuiLog(QString,QString)),
|
||||
SLOT(slotShowOptionalTrayMessage(QString,QString)));
|
||||
connect( Logger::instance(), SIGNAL(guiLog(QString,QString, Logger::NotificationType)),
|
||||
SLOT(slotShowTrayMessage(QString,QString, Logger::NotificationType)));
|
||||
connect( Logger::instance(), SIGNAL(optionalGuiLog(QString,QString, Logger::NotificationType)),
|
||||
SLOT(slotShowOptionalTrayMessage(QString,QString,Logger::NotificationType)));
|
||||
connect( Logger::instance(), SIGNAL(guiMessage(QString,QString)),
|
||||
SLOT(slotShowGuiMessage(QString,QString)));
|
||||
|
||||
@@ -237,7 +237,8 @@ void ownCloudGui::slotTrayMessageIfServerUnsupported(Account* account)
|
||||
tr("The server on account %1 runs an old and unsupported version %2. "
|
||||
"Using this client with unsupported server versions is untested and "
|
||||
"potentially dangerous. Proceed at your own risk.")
|
||||
.arg(account->displayName(), account->serverVersion()));
|
||||
.arg(account->displayName(), account->serverVersion()),
|
||||
Logger::Critical );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,19 +536,36 @@ void ownCloudGui::setupContextMenu()
|
||||
}
|
||||
|
||||
|
||||
void ownCloudGui::slotShowTrayMessage(const QString &title, const QString &msg)
|
||||
void ownCloudGui::slotShowTrayMessage(const QString &title, const QString &msg, Logger::NotificationType type)
|
||||
{
|
||||
if( _tray )
|
||||
_tray->showMessage(title, msg);
|
||||
else
|
||||
if( _tray ) {
|
||||
QSystemTrayIcon::MessageIcon trayIcon = QSystemTrayIcon::NoIcon;
|
||||
switch( type ) {
|
||||
case Logger::NoIcon:
|
||||
break;
|
||||
case Logger::Information:
|
||||
trayIcon = QSystemTrayIcon::Information;
|
||||
break;
|
||||
case Logger::SoftError:
|
||||
trayIcon = QSystemTrayIcon::Warning;
|
||||
break;
|
||||
case Logger::Error:
|
||||
case Logger::Critical:
|
||||
trayIcon = QSystemTrayIcon::Critical;
|
||||
break;
|
||||
}
|
||||
|
||||
_tray->showMessage(title, msg, trayIcon);
|
||||
} else {
|
||||
qDebug() << "Tray not ready: " << msg;
|
||||
}
|
||||
}
|
||||
|
||||
void ownCloudGui::slotShowOptionalTrayMessage(const QString &title, const QString &msg)
|
||||
void ownCloudGui::slotShowOptionalTrayMessage(const QString &title, const QString &msg, Logger::NotificationType type)
|
||||
{
|
||||
ConfigFile cfg;
|
||||
if (cfg.optionalDesktopNotifications()) {
|
||||
slotShowTrayMessage(title, msg);
|
||||
slotShowTrayMessage(title, msg, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "systray.h"
|
||||
#include "connectionvalidator.h"
|
||||
#include "progressdispatcher.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
@@ -32,7 +33,7 @@ class Folder;
|
||||
class SettingsDialog;
|
||||
class SettingsDialogMac;
|
||||
class ShareDialog;
|
||||
class Application;
|
||||
class oCApplication;
|
||||
class LogBrowser;
|
||||
class AccountState;
|
||||
|
||||
@@ -44,7 +45,7 @@ class ownCloudGui : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ownCloudGui(Application *parent = 0);
|
||||
explicit ownCloudGui(oCApplication *parent = 0);
|
||||
|
||||
bool checkAccountExists(bool openSettings);
|
||||
|
||||
@@ -58,8 +59,8 @@ signals:
|
||||
public slots:
|
||||
void setupContextMenu();
|
||||
void slotComputeOverallSyncStatus();
|
||||
void slotShowTrayMessage(const QString &title, const QString &msg);
|
||||
void slotShowOptionalTrayMessage(const QString &title, const QString &msg);
|
||||
void slotShowTrayMessage(const QString &title, const QString &msg, Logger::NotificationType type);
|
||||
void slotShowOptionalTrayMessage(const QString &title, const QString &msg, Logger::NotificationType type);
|
||||
void slotFolderOpenAction( const QString& alias );
|
||||
void slotRebuildRecentMenus();
|
||||
void slotUpdateProgress(const QString &folder, const ProgressInfo& progress);
|
||||
@@ -122,7 +123,7 @@ private:
|
||||
QSignalMapper *_folderOpenActionMapper;
|
||||
QSignalMapper *_recentItemsMapper;
|
||||
|
||||
Application *_app;
|
||||
oCApplication *_app;
|
||||
};
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@@ -31,7 +31,7 @@ class SyncResult;
|
||||
namespace Ui {
|
||||
class ProtocolWidget;
|
||||
}
|
||||
class Application;
|
||||
class oCApplication;
|
||||
|
||||
/**
|
||||
* @brief The ProtocolWidget class
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Ui {
|
||||
class SettingsDialog;
|
||||
}
|
||||
class AccountSettings;
|
||||
class Application;
|
||||
class oCApplication;
|
||||
class FolderMan;
|
||||
class ownCloudGui;
|
||||
class ActivitySettings;
|
||||
|
||||
+53
-1
@@ -12,9 +12,15 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIBSNORE
|
||||
#include <libsnore/application.h>
|
||||
#include <libsnore/notification/icon.h>
|
||||
#endif
|
||||
|
||||
#include "systray.h"
|
||||
#include "theme.h"
|
||||
#include <QDebug>
|
||||
#include <QPointer>
|
||||
|
||||
#ifdef USE_FDO_NOTIFICATIONS
|
||||
#include <QDBusConnection>
|
||||
@@ -28,8 +34,54 @@
|
||||
|
||||
namespace OCC {
|
||||
|
||||
void Systray::showMessage(const QString & title, const QString & message, MessageIcon icon, int millisecondsTimeoutHint)
|
||||
Systray::Systray( )
|
||||
{
|
||||
#ifdef HAVE_LIBSNORE
|
||||
Snore::SnoreCore &snore = Snore::SnoreCore::instance();
|
||||
snore.loadPlugins( Snore::SnorePlugin::Backend | Snore::SnorePlugin::SecondaryBackend );
|
||||
snore.setDefaultSettingsValue("Silent", true, Snore::LocalSetting );
|
||||
|
||||
_application = Snore::Application( Theme::instance()->appName(), Theme::instance()->applicationIcon() );
|
||||
_application.hints().setValue( "use-markup", true );
|
||||
_application.hints().setValue( "windows-app-id", Theme::instance()->appName() );
|
||||
_application.hints().setValue( "desktop-entry", Theme::instance()->appNameGUI() );
|
||||
_application.hints().setValue( "tray-icon", qVariantFromValue(QPointer<QSystemTrayIcon>(this)));
|
||||
|
||||
// register the Alerts.
|
||||
Snore::Alert alert( Theme::instance()->appNameGUI(), QIcon() );
|
||||
_alerts.insert( QSystemTrayIcon::NoIcon, alert);
|
||||
_application.addAlert(alert);
|
||||
Snore::Alert alert2( Theme::instance()->appNameGUI(), Theme::instance()->syncStateIcon(SyncResult::Success, false ));
|
||||
_alerts.insert( QSystemTrayIcon::Information, alert2);
|
||||
_application.addAlert(alert2);
|
||||
Snore::Alert alert3( Theme::instance()->appNameGUI(), Theme::instance()->syncStateIcon(SyncResult::Problem, false ));
|
||||
_alerts.insert( QSystemTrayIcon::Warning, alert3);
|
||||
_application.addAlert(alert3);
|
||||
Snore::Alert alert4( Theme::instance()->appNameGUI(), Theme::instance()->syncStateIcon(SyncResult::Error, false ));
|
||||
_alerts.insert( QSystemTrayIcon::Critical, alert4);
|
||||
_application.addAlert(alert4);
|
||||
|
||||
snore.registerApplication( _application );
|
||||
snore.setDefaultApplication( _application );
|
||||
|
||||
// connect( &snore, SIGNAL( actionInvoked( Snore::Notification ) ), this, SLOT( slotActionInvoked( Snore::Notification ) ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void Systray::showMessage(const QString & title, const QString & message, MessageIcon icon,
|
||||
int millisecondsTimeoutHint)
|
||||
{
|
||||
#ifdef HAVE_LIBSNORE
|
||||
Snore::Alert a = _alerts[NoIcon];
|
||||
if( _alerts.contains(icon) ) {
|
||||
a = _alerts[icon];
|
||||
}
|
||||
|
||||
Snore::Notification n( _application , a, title, message, a.icon() );
|
||||
Snore::SnoreCore::instance().broadcastNotification( n );
|
||||
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FDO_NOTIFICATIONS
|
||||
if(QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) {
|
||||
|
||||
+15
-1
@@ -15,8 +15,13 @@
|
||||
#ifndef SYSTRAY_H
|
||||
#define SYSTRAY_H
|
||||
|
||||
#include "logger.h"
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#ifdef HAVE_LIBSNORE
|
||||
#include <libsnore/snore.h>
|
||||
#endif
|
||||
|
||||
class QIcon;
|
||||
|
||||
namespace OCC {
|
||||
@@ -34,8 +39,17 @@ class Systray : public QSystemTrayIcon
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void showMessage(const QString & title, const QString & message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
|
||||
explicit Systray();
|
||||
|
||||
void showMessage(const QString & title, const QString & message, MessageIcon icon = Information,
|
||||
int millisecondsTimeoutHint = 10000);
|
||||
void setToolTip(const QString &tip);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_LIBSNORE
|
||||
Snore::Application _application;
|
||||
QHash<QSystemTrayIcon::MessageIcon, Snore::Alert> _alerts;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@@ -74,14 +74,14 @@ Logger::~Logger() {
|
||||
}
|
||||
|
||||
|
||||
void Logger::postGuiLog(const QString &title, const QString &message)
|
||||
void Logger::postGuiLog(const QString &title, const QString &message, NotificationType type )
|
||||
{
|
||||
emit guiLog(title, message);
|
||||
emit guiLog(title, message, type);
|
||||
}
|
||||
|
||||
void Logger::postOptionalGuiLog(const QString &title, const QString &message)
|
||||
void Logger::postOptionalGuiLog(const QString &title, const QString &message, NotificationType type )
|
||||
{
|
||||
emit optionalGuiLog(title, message);
|
||||
emit optionalGuiLog(title, message, type);
|
||||
}
|
||||
|
||||
void Logger::postGuiMessage(const QString &title, const QString &message)
|
||||
|
||||
+12
-4
@@ -45,6 +45,14 @@ class OWNCLOUDSYNC_EXPORT Logger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum NotificationType {
|
||||
NoIcon = 0,
|
||||
Information,
|
||||
SoftError,
|
||||
Error,
|
||||
Critical
|
||||
};
|
||||
|
||||
|
||||
bool isNoop() const;
|
||||
void log(Log log);
|
||||
@@ -57,8 +65,8 @@ public:
|
||||
|
||||
static Logger* instance();
|
||||
|
||||
void postGuiLog(const QString& title, const QString& message);
|
||||
void postOptionalGuiLog(const QString& title, const QString& message);
|
||||
void postGuiLog(const QString& title, const QString& message, NotificationType type = Information);
|
||||
void postOptionalGuiLog(const QString& title, const QString& message, NotificationType type = Information);
|
||||
void postGuiMessage(const QString& title, const QString& message);
|
||||
|
||||
void setLogFile( const QString & name );
|
||||
@@ -68,9 +76,9 @@ public:
|
||||
|
||||
signals:
|
||||
void newLog(const QString&);
|
||||
void guiLog(const QString&, const QString&);
|
||||
void guiLog(const QString&, const QString&, Logger::NotificationType type);
|
||||
void guiMessage(const QString&, const QString&);
|
||||
void optionalGuiLog(const QString&, const QString&);
|
||||
void optionalGuiLog(const QString&, const QString&, Logger::NotificationType type);
|
||||
|
||||
public slots:
|
||||
void enterNextLogFile();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário