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
This commit is contained in:
parent
ea8ab89e8e
commit
1f324d8b27
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
set ( SnoreNotify_SRCS
|
||||
notification.cpp
|
||||
# notificationdata.cpp
|
||||
snoreserver.cpp
|
||||
application.cpp
|
||||
interface.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: "<<notification.id();
|
||||
return notification.id();
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -47,6 +47,7 @@ void FreedesktopNotification_Frontend::actionInvoked(Notification notification)
|
|||
void FreedesktopNotification_Frontend::notificationClosed(Notification notification) {
|
||||
|
||||
qDebug()<<"Closing Dbus notification"<<notification.id()<<"reason:"<<(int)notification.closeReason();
|
||||
activeNotifications.take(notification.id());
|
||||
emit NotificationClosed(notification.id(),notification.closeReason());
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,6 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
|
|||
const QStringList &actions, const QVariantMap &hints, int timeout)
|
||||
{
|
||||
qDebug()<<app_name<<summary<<body<<app_icon;
|
||||
qDebug()<<"Hints:"<<hints;
|
||||
QString icon;
|
||||
|
||||
if(hints.contains("image_data")){
|
||||
|
@ -83,15 +83,17 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
|
|||
for(int i = 0;i < actions.length(); i+=2){
|
||||
noti.addAction(new Action(actions.at(i).toInt(),actions.at(i+1)));
|
||||
}
|
||||
return snore()->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()
|
||||
|
|
|
@ -35,6 +35,9 @@ public:
|
|||
QStringList GetCapabilities();
|
||||
QString GetServerInformation(QString& vendor, QString& version, QString& specVersion);
|
||||
|
||||
private:
|
||||
QHash<uint,Notification> activeNotifications;
|
||||
|
||||
signals:
|
||||
void NotificationClosed( uint id, uint reason );
|
||||
void ActionInvoked( uint id, const QString& actionKey );
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -63,7 +63,9 @@ void Snarl_Backend::registerApplication(Application *application){
|
|||
_applications.insert(application->name(),snarlInterface);
|
||||
}
|
||||
qDebug()<<"Register with Snarl"<<application->name()<<application->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"<<notification.toString();
|
||||
qDebug()<<notification.id();
|
||||
qDebug()<<"recived a Snarl callback id:"<<notificationID<<"action:"<<action;
|
||||
qDebug()<<"data:"<<data;
|
||||
qDebug()<<"recived a Snarl callback id:"<<notificationID<<"action:"<<action<<"data:"<<data;
|
||||
Notification::closeReasons reason = Notification::NONE;
|
||||
switch(action){
|
||||
case SnarlEnums::CallbackInvoked:
|
||||
reason = Notification::CLOSED;
|
||||
break;
|
||||
case SnarlEnums::CallbackMenuSelected:
|
||||
case SnarlEnums::NotifyAction:
|
||||
reason = Notification::CLOSED;
|
||||
notification.setActionInvoked(data);
|
||||
_snarl->snore()->notificationActionInvoked(notification);
|
||||
|
|
Loading…
Reference in New Issue