diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c1f7b8..f7c5c5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories( set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR} ) set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) + if (CMAKE_COMPILER_IS_GNUCXX) set (KDE4_ENABLE_EXCEPTIONS -fexceptions) # Select flags. @@ -39,6 +40,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX) + option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF) option(WITH_WEBINTERFACE "Buld with WebInterface" OFF) diff --git a/src/core/application.cpp b/src/core/application.cpp index 62d2282..cba03cc 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -17,8 +17,9 @@ #include "application.h" -Application::Application ( const QString &name ) : +Application::Application (const QString &name, const QString &icon) : _name ( name ), + _icon(icon), _initialized ( false ) { _alerts.insert ( "",new Alert ( "Default Alert","Default Alert" ) ); @@ -46,6 +47,11 @@ const QString &Application::name() const return _name; } +const QString &Application::icon()const +{ + return _icon; +} + const AlertList &Application::alerts() const { return _alerts; @@ -61,15 +67,10 @@ void Application::setInitialized ( bool b ) _initialized = b; } -Alert::Alert ( const QString &name,const QString &title ) : - _name ( name ), - _title ( title ), - _active ( true ) -{} - -Alert::Alert ( const QString &name,const QString &title,bool active ) : +Alert::Alert (const QString &name, const QString &title, const QString &icon, bool active) : _name ( name ), _title ( title ), + _icon(icon), _active ( active ) {} @@ -88,6 +89,11 @@ const QString &Alert::title() const return _title; } +const QString &Alert::icon() const +{ + return _icon; +} + bool Alert::isActive() const { return _active; diff --git a/src/core/application.h b/src/core/application.h index 37f2f87..647111a 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -27,11 +27,12 @@ class SNORE_EXPORT Application:public QObject { Q_OBJECT public: - Application ( const QString &name ); + Application ( const QString &name, const QString &icon = "" ); Application(); ~Application(); void addAlert ( Alert *alert ); const QString &name() const; + const QString &icon() const; const AlertList &alerts() const; bool isInitialized(); void setInitialized ( bool b ); @@ -39,6 +40,7 @@ public: private: QString _name; + QString _icon; AlertList _alerts; bool _initialized; @@ -48,16 +50,17 @@ class SNORE_EXPORT Alert:public QObject { Q_OBJECT public: - Alert ( const QString &name,const QString &title ); - Alert ( const QString &name,const QString &title,bool active ); + Alert ( const QString &name,const QString &title="",const QString &icon="",bool active=true ); Alert(); const QString &name() const; const QString &title() const; + const QString &icon() const; bool isActive() const; private: QString _name; QString _title; + QString _icon; bool _active; }; diff --git a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp index beef894..04815d2 100644 --- a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp +++ b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp @@ -87,8 +87,8 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl icon=getImagefromHint(image); } if(!snore()->aplications().contains(app_name)){ - Application *a = new Application(app_name); - a->addAlert(new Alert("DBus Alert","DBus Alert")); + Application *a = new Application(app_name,app_icon); + a->addAlert(new Alert("DBus Alert","DBus Alert",app_icon)); snore()->addApplication(a); snore()->applicationIsInitialized(a); } diff --git a/src/plugins/snarl/SnarlInterface.cpp b/src/plugins/snarl/SnarlInterface.cpp index 725391a..4e533e7 100644 --- a/src/plugins/snarl/SnarlInterface.cpp +++ b/src/plugins/snarl/SnarlInterface.cpp @@ -1,4 +1,4 @@ -// About: +// About: // Snarl C++ interface implementation // To understand what the different functions do and what they return, please // have a look at the API on http://www.fullphat.net/dev/api.htm. diff --git a/src/plugins/snarl/snarl_backend.cpp b/src/plugins/snarl/snarl_backend.cpp index b45abeb..92627e6 100644 --- a/src/plugins/snarl/snarl_backend.cpp +++ b/src/plugins/snarl/snarl_backend.cpp @@ -53,7 +53,8 @@ void Snarl_Backend::registerApplication(Application *application){ _applications.insert(application->name(),snarlInterface); wchar_t *appName = toWchar(application->name()); - snarlInterface->RegisterApp(appName,L"",L""); + wchar_t *icon = toWchar(application->icon()); + snarlInterface->RegisterApp(appName,icon,icon); foreach(Alert *alert,application->alerts()){ wchar_t *alertName = toWchar(alert->name()); @@ -61,6 +62,7 @@ void Snarl_Backend::registerApplication(Application *application){ delete [] alertName; } delete [] appName; + delete [] icon; } void Snarl_Backend::unregisterApplication(Application *application){ diff --git a/src/plugins/snarlnetwork/parser.cpp b/src/plugins/snarlnetwork/parser.cpp index e481145..8636d9d 100644 --- a/src/plugins/snarlnetwork/parser.cpp +++ b/src/plugins/snarlnetwork/parser.cpp @@ -30,9 +30,10 @@ #include #include -Parser::Parser(SnarlNetworkFrontend *snarl):snarl(snarl) +Parser::Parser(SnarlNetworkFrontend *snarl): + QObject(snarl), + snarl(snarl) { - setParent(snarl); getSnpType.insert("type",TYPE); getSnpType.insert("app",APP); getSnpType.insert("version",VERSION);