From 1f324d8b27a508db908cb0cfb5c403082e70d41d Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Wed, 20 Jul 2011 00:57:41 +0200 Subject: [PATCH] fixed action menus in snarl backend, fixed register with snarl if app name contains spaces,version bump to 0.1.5,cleaned up,some improvements in the freedesktopfrontend --- CMakeLists.txt | 3 +-- src/CMakeLists.txt | 11 ++++++----- src/core/CMakeLists.txt | 1 - src/core/snoreserver.cpp | 4 +--- .../freedesktopnotificationfrontend.cpp | 12 +++++++----- .../freedesktopnotificationfrontend.h | 3 +++ src/plugins/growl/CMakeLists.txt | 2 +- src/plugins/snarl/snarl_backend.cpp | 11 +++++------ 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 063f415..93369d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,7 @@ include( ${QT_USE_FILE} ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} - ${QT_QTNETWORK_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/3party/gntp-send/headers) + ${QT_QTNETWORK_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}) if (CMAKE_COMPILER_IS_GNUCXX) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9b5748a..4737fb9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,19 +8,20 @@ add_subdirectory(core) QT4_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS}) set(SNORENOTIFY_DEPS ${SNORENOTIFY_DEPS} ${SNORENOTIFY_RCS}) -#if(WIN32) -# set(WIN32_SPECIFIC WIN32) -#else(WIN32) +if(WIN32) + set(WIN32_SPECIFIC WIN32) +else(WIN32) set(WIN32_SPECIFIC) -#endif(WIN32) +endif(WIN32) automoc4_add_executable( snorenotify ${WIN32_SPECIFIC} main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS}) target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} ) if(MSVC) -set_target_properties(snorenotify PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"") + set_target_properties(snorenotify PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"") endif(MSVC) + add_dependencies(snorenotify snorecore) install(TARGETS snorenotify RUNTIME DESTINATION bin diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d72fe66..74597ac 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,6 +1,5 @@ set ( SnoreNotify_SRCS notification.cpp - # notificationdata.cpp snoreserver.cpp application.cpp interface.cpp diff --git a/src/core/snoreserver.cpp b/src/core/snoreserver.cpp index 69b2953..8286111 100644 --- a/src/core/snoreserver.cpp +++ b/src/core/snoreserver.cpp @@ -28,7 +28,7 @@ QString const SnoreServer::version(){ - return "0.1"; + return "0.1.5"; } QString const SnoreServer::snoreTMP(){ @@ -143,9 +143,7 @@ int SnoreServer::broadcastNotification ( Notification notification ) emit notify ( notification ); if ( _notificationBackend!=NULL ) { - qDebug()<<"Broadcasting"; notification.setId(_notificationBackend->notify ( notification )); - qDebug()<<"Notification ID: "<broadcastNotification(noti); + + snore()->broadcastNotification(noti); + activeNotifications[noti.id()] = noti; + return noti.id(); } void FreedesktopNotification_Frontend::CloseNotification(uint id){ - //TODO: do something usefull here - Notification n(id); - snore()->closeNotification(n,Notification::NONE); + Notification noti = activeNotifications.take(id); + snore()->closeNotification(noti,Notification::TIMED_OUT); } QStringList FreedesktopNotification_Frontend::GetCapabilities() diff --git a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h index b2b698a..58d5cb5 100644 --- a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h +++ b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h @@ -35,6 +35,9 @@ public: QStringList GetCapabilities(); QString GetServerInformation(QString& vendor, QString& version, QString& specVersion); +private: + QHash activeNotifications; + signals: void NotificationClosed( uint id, uint reason ); void ActionInvoked( uint id, const QString& actionKey ); diff --git a/src/plugins/growl/CMakeLists.txt b/src/plugins/growl/CMakeLists.txt index 4d5ba7c..98511b6 100644 --- a/src/plugins/growl/CMakeLists.txt +++ b/src/plugins/growl/CMakeLists.txt @@ -1,6 +1,6 @@ if( WITH_GROWL_BACKEND ) if(CRYPTOPP_LIBRARIES AND Boost_SYSTEM_LIBRARY) - message( STATUS "Found libgrowl, adding libgrowl backend" ) + message( STATUS "Found Boost and Cryptopp, adding libgrowl backend" ) set( GROWL__SRC growl_backend.cpp ) diff --git a/src/plugins/snarl/snarl_backend.cpp b/src/plugins/snarl/snarl_backend.cpp index 74215fd..aa69a73 100644 --- a/src/plugins/snarl/snarl_backend.cpp +++ b/src/plugins/snarl/snarl_backend.cpp @@ -63,7 +63,9 @@ void Snarl_Backend::registerApplication(Application *application){ _applications.insert(application->name(),snarlInterface); } qDebug()<<"Register with Snarl"<name()<icon(); - snarlInterface->Register(application->name().toUtf8().constData(), + QString appName = application->name(); + appName = appName.replace(" ","_");//app sig must not contain spaces + snarlInterface->Register(appName.toUtf8().constData(), application->name().toUtf8().constData(), application->icon().toUtf8().constData(), 0,winIDWidget->winId(),SNORENOTIFIER_MESSAGE_ID); @@ -149,16 +151,13 @@ bool SnarlWidget::winEvent(MSG * msg, long * result){ uint notificationID = msg->lParam; qDebug()<<_snarl->activeNotifications.keys(); Notification notification(_snarl->activeNotifications[notificationID]); - qDebug()<<"arg"<snore()->notificationActionInvoked(notification);