install a .desktop

This commit is contained in:
Patrick von Reth 2011-08-02 17:50:07 +02:00
parent e348dd7f7c
commit 020ea2c4d2
12 changed files with 57 additions and 53 deletions

View File

@ -6,6 +6,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(KDE4)
if(MINGW)
SET (CMAKE_RC_COMPILER_INIT windres)
ENABLE_LANGUAGE (RC)
SET (CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -i <SOURCE> -o <OBJECT>")
endif(MINGW)
if(KDE4_FOUND)
add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS} -D_UNICODE)
include_directories(${KDE4_INCLUDES})

View File

@ -1,19 +1,16 @@
set(SNORE_RCS ${SNORE_RCS} ../data/snore.qrc PARENT_SCOPE)
if(WIN32)
set(ICON_NAME zzz)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${ICON_NAME}.ico ICON)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ICON_NAME}.rc "IDI_ICON1 ICON DISCARDABLE \"${ICON}\"\n")
if(MINGW)
find_program(WINDRES_EXECUTABLE NAMES windres)
if(WINDRES_EXECUTABLE)
exec_program(windres
ARGS "-i ${CMAKE_CURRENT_BINARY_DIR}/${ICON_NAME}.rc"
"-o ${CMAKE_CURRENT_BINARY_DIR}/${ICON_NAME}.o"
"--include-dir=${CMAKE_CURRENT_SOURCE_DIR}")
set(SNORENOTIFY_DEPS ${SNORENOTIFY_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/${ICON_NAME}.o PARENT_SCOPE)
endif(WINDRES_EXECUTABLE)
else(MINGW)
set(SNORENOTIFY_DEPS ${SNORENOTIFY_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/${ICON_NAME}.rc PARENT_SCOPE)
endif(MINGW)
endif(WIN32)
if(KDE4_FOUND)
install(FILES snore.png DESTINATION ${ICON_INSTALL_DIR}/hicolor/48x48/apps)
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
install(FILES snore.png DESTINATION /usr/share/pixmaps)
endif(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
endif(KDE4_FOUND)

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/root">
<file>zzz.png</file>
<file>snore.png</file>
</qresource>
<qresource prefix="/root/images">
<file>freedesktop-dbus.png</file>

View File

@ -7,3 +7,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Notifications.service
install(FILES FindLibsnore.cmake DESTINATION share/apps/cmake/modules)
if(KDE4_FOUND)
install(FILES snorenotify.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
endif(KDE4_FOUND)

10
share/snorenotify.desktop Normal file
View File

@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Version=0.15
Name=SnoreNotify
Comment=An application which redirects dbus notifications to a unifided notification backend
Icon=snore
Exec=snorenotify
Categories=Qt;System;
X-KDE-StartupNotify=true
X-DBUS-StartupType=Unique

View File

@ -28,7 +28,7 @@ class SNORE_EXPORT Application:public QObject
{
Q_OBJECT
public:
Application ( const QString &name, const SnoreIcon &icon = SnoreIcon(":/root/zzz.png"));
Application ( const QString &name, const SnoreIcon &icon = SnoreIcon(":/root/snore.png"));
Application();
~Application();
void addAlert ( Alert *alert );
@ -51,7 +51,7 @@ class SNORE_EXPORT Alert:public QObject
{
Q_OBJECT
public:
Alert ( const QString &name,const QString &title="",const SnoreIcon &icon = SnoreIcon(":/root/zzz.png"),bool active=true );
Alert ( const QString &name,const QString &title="",const SnoreIcon &icon = SnoreIcon(":/root/snore.png"),bool active=true );
Alert();
const QString &name() const;

View File

@ -35,25 +35,12 @@ QString const SnoreServer::snoreTMP(){
return tmp;
}
void SnoreServer::cleanupTMP(){
void SnoreServer::initTMP(){
QDir home ( snoreTMP() );
if ( home.exists() )
{
QStringList filetypes;
filetypes<<"*.png"<<"*.jpg";
QStringList toDell;
toDell=home.entryList ( filetypes );
foreach ( QString s,toDell )
{
home.remove ( s );
}
}
else{
if ( !home.exists() ){
home.cdUp();
home.mkdir("SnoreNotify");
}
}
SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) :

View File

@ -29,7 +29,7 @@ class SNORE_EXPORT SnoreServer:public QObject
public:
static const QString version();
static const QString snoreTMP();
static void cleanupTMP();
static void initTMP();
public:

View File

@ -7,7 +7,7 @@
#include <QDebug>
TrayIconNotifer::TrayIconNotifer ( SnoreServer *snore, QSystemTrayIcon *icon ) :
Notification_Backend ( "TrayiconNotifer",snore ),
Notification_Backend ( "SystemTray",snore ),
_trayIcon ( icon ),
_id ( 0 ),
_displayed(-1)

View File

@ -43,7 +43,7 @@ SnoreNotify::SnoreNotify()
{
_trayIcon = new TrayIcon();
_snore = new SnoreServer(_trayIcon->trayIcon());
_snore->cleanupTMP();
_snore->initTMP();
QDir pluginsDir ( qApp->applicationDirPath() +"/snoreplugins" );
foreach ( QString fileName, pluginsDir.entryList ( QDir::Files ) )

View File

@ -23,7 +23,7 @@
TrayIcon::TrayIcon()
{
_trayIcon = new QSystemTrayIcon(QIcon(":/root/zzz.png"));
_trayIcon = new QSystemTrayIcon(QIcon(":/root/snore.png"));
}
void TrayIcon::initConextMenu(SnoreServer *snore){