set(CMAKE_BUILD_TYPE Release)
set(OXYGEN_ICONS "Builtin")
set(QUASSEL_ICONS "Builtin")
+ set(WITH_KDE OFF)
endif(STATIC)
# RPATH needs to be set correctly
# Define install locations. Using variables will allow overriding this by the KDE macros later.
set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
-set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/apps/quassel)
+set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/apps)
set(ICON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
set(XDG_APPS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/applications)
add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
set(HAVE_KDE 1)
set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_KDE)
- set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY})
+ set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} knotifyconfig)
set(OXYGEN_ICONS "External")
+ set(QUASSEL_ICONS "External")
else(KDE4_FOUND)
message(STATUS "KDE4 not found, disabling KDE integration")
endif(KDE4_FOUND)
if(WANT_MONO)
install(FILES quassel.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
endif(WANT_MONO)
+
+if(WANT_MONO OR WANT_QTCLIENT)
+ install(FILES quassel.notifyrc DESTINATION ${DATA_INSTALL_DIR}/quassel)
+endif(WANT_MONO OR WANT_QTCLIENT)
--- /dev/null
+[Global]
+IconName=quassel
+Comment=Quassel IRC
+
+[Event/Highlight]
+Name=Highlight
+Comment=A highlighted message has arrived
+Sound=KDE-Im-Highlight-Msg.ogg
+Action=Sound|Popup
settingspagedlg.ui
topicwidget.ui)
-IF(HAVE_DBUS)
- set(SOURCES ${SOURCES} desktopnotificationbackend.cpp)
- set(MOC_HDRS ${MOC_HDRS} desktopnotificationbackend.h)
- set(FORMS ${FORMS} desktopnotificationconfigwidget.ui)
- qt4_add_dbus_interface(DBUS ../../interfaces/org.freedesktop.Notifications.xml desktopnotificationinterface)
-ENDIF(HAVE_DBUS)
+if(HAVE_KDE)
+ set(SOURCES ${SOURCES} knotificationbackend.cpp)
+ set(MOC_HDRS ${MOC_HDRS} knotificationbackend.h)
+else(HAVE_KDE)
+ if(HAVE_DBUS)
+ set(SOURCES ${SOURCES} desktopnotificationbackend.cpp)
+ set(MOC_HDRS ${MOC_HDRS} desktopnotificationbackend.h)
+ set(FORMS ${FORMS} desktopnotificationconfigwidget.ui)
+ qt4_add_dbus_interface(DBUS ../../interfaces/org.freedesktop.Notifications.xml desktopnotificationinterface)
+ endif(HAVE_DBUS)
-IF(HAVE_PHONON)
- set(SOURCES ${SOURCES} phononnotificationbackend.cpp)
- set(MOC_HDRS ${MOC_HDRS} phononnotificationbackend.h)
- set(FORMS ${FORMS} phononnotificationconfigwidget.ui)
- include_directories(${PHONON_INCLUDES})
-ENDIF(HAVE_PHONON)
+ if(HAVE_PHONON)
+ set(SOURCES ${SOURCES} phononnotificationbackend.cpp)
+ set(MOC_HDRS ${MOC_HDRS} phononnotificationbackend.h)
+ set(FORMS ${FORMS} phononnotificationconfigwidget.ui)
+ include_directories(${PHONON_INCLUDES})
+ endif(HAVE_PHONON)
+endif(HAVE_KDE)
foreach(FORM ${FORMS})
set(FORMPATH ${FORMPATH} ui/${FORM})
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2005-08 by the Quassel Project *
+* devel@quassel-irc.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) version 3. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
+
+#include <QVBoxLayout>
+
+#include <KNotification>
+#include <KNotifyConfigWidget>
+
+#include "knotificationbackend.h"
+
+#include "client.h"
+#include "icon.h"
+#include "iconloader.h"
+#include "networkmodel.h"
+#include "qtui.h"
+
+KNotificationBackend::KNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent) {
+
+}
+
+void KNotificationBackend::notify(const Notification &n) {
+ //QString title = Client::networkModel()->networkName(n.bufferId) + " - " + Client::networkModel()->bufferName(n.bufferId);
+ QString message = QString("<b><%1></b> %2").arg(n.sender, n.message);
+ KNotification::event("Highlight", message, DesktopIcon("dialog-information"), QtUi::mainWindow(),
+ KNotification::Persistent|KNotification::RaiseWidgetOnActivation|KNotification::CloseWhenWidgetActivated);
+}
+
+void KNotificationBackend::close(uint notificationId) {
+ Q_UNUSED(notificationId);
+}
+
+SettingsPage *KNotificationBackend::createConfigWidget() const {
+ return new ConfigWidget();
+}
+
+/***************************************************************************/
+
+KNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "KNotification", parent) {
+ _widget = new KNotifyConfigWidget(this);
+ _widget->setApplication("quassel");
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->addWidget(_widget);
+
+ connect(_widget, SIGNAL(changed(bool)), SLOT(widgetChanged(bool)));
+}
+
+void KNotificationBackend::ConfigWidget::widgetChanged(bool changed) {
+ setChangedState(changed);
+}
+
+void KNotificationBackend::ConfigWidget::load() {
+ setChangedState(false);
+}
+
+void KNotificationBackend::ConfigWidget::save() {
+ _widget->save();
+ load();
+}
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2005-08 by the Quassel Project *
+* devel@quassel-irc.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) version 3. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
+
+#ifndef KNOTIFICATIONBACKEND_H_
+#define KNOTIFICATIONBACKEND_H_
+
+#include "abstractnotificationbackend.h"
+#include "settingspage.h"
+
+class KNotification;
+class KNotifyConfigWidget;
+
+class KNotificationBackend : public AbstractNotificationBackend {
+ Q_OBJECT
+
+public:
+ KNotificationBackend(QObject *parent = 0);
+
+ void notify(const Notification &);
+ void close(uint notificationId);
+ virtual SettingsPage *createConfigWidget() const;
+
+private:
+ class ConfigWidget;
+};
+
+class KNotificationBackend::ConfigWidget : public SettingsPage {
+ Q_OBJECT
+
+public:
+ ConfigWidget(QWidget *parent = 0);
+
+ void save();
+ void load();
+
+private slots:
+ void widgetChanged(bool);
+
+private:
+ KNotifyConfigWidget *_widget;
+};
+
+#endif
#ifdef HAVE_PHONON
# include "phononnotificationbackend.h"
#endif
+#ifdef HAVE_KDE
+# include "knotificationbackend.h"
+#endif
#include "systraynotificationbackend.h"
#include "taskbarnotificationbackend.h"
installEventFilter(new JumpKeyHandler(this));
- QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
- QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
-#ifdef HAVE_PHONON
- QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
-#endif
-#ifdef HAVE_DBUS
- QtUi::registerNotificationBackend(new DesktopNotificationBackend(this));
-#endif
+#ifndef HAVE_KDE
+ QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
+ QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
+# ifdef HAVE_PHONON
+ QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
+# endif
+# ifdef HAVE_DBUS
+ QtUi::registerNotificationBackend(new DesktopNotificationBackend(this));
+# endif
+
+#else /* HAVE_KDE */
+ QtUi::registerNotificationBackend(new KNotificationBackend(this));
+#endif /* HAVE_KDE */
QtUiApplication* app = qobject_cast<QtUiApplication*> qApp;
connect(app, SIGNAL(saveStateToSession(const QString&)), SLOT(saveStateToSession(const QString&)));
virtual void notify(const Notification &) = 0;
virtual void close(uint notificationId) { Q_UNUSED(notificationId); }
- //! factory to create a configuration widget suitable for a specific notification backend
+ //! Factory to create a configuration widget suitable for a specific notification backend
/**
- * AbstractNotification will not take owner ship of that configWidget!
- * in case you need to communicate with the configWidget directly, make your connections here
+ * AbstractNotification will not take ownership of that configWidget!
+ * In case you need to communicate with the configWidget directly, make your connections here
*/
virtual SettingsPage *createConfigWidget() const = 0;
};