correct tab order for the settingspages
[quassel.git] / src / qtui / desktopnotificationbackend.cpp
index 45d18b5..1f633d3 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
-*   Copyright (C) 2005-08 by the Quassel Project                          *
+*   Copyright (C) 2005-09 by the Quassel Project                          *
 *   devel@quassel-irc.org                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
@@ -26,9 +26,9 @@
 #include "clientsettings.h"
 #include "networkmodel.h"
 
-DesktopNotificationBackend::DesktopNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent) {
-  _configWidget = new ConfigWidget();
-
+DesktopNotificationBackend::DesktopNotificationBackend(QObject *parent)
+  : AbstractNotificationBackend(parent)
+{
   _dbusInterface = new org::freedesktop::Notifications(
     "org.freedesktop.Notifications",
     "/org/freedesktop/Notifications",
@@ -59,10 +59,6 @@ DesktopNotificationBackend::DesktopNotificationBackend(QObject *parent) : Abstra
   notificationSettings.notify("DesktopNotification/QueueNotifications", this, SLOT(queueNotificationsChanged(const QVariant &)));
 }
 
-DesktopNotificationBackend::~DesktopNotificationBackend() {
-  delete _configWidget;
-}
-
 void DesktopNotificationBackend::enabledChanged(const QVariant &v) {
   _enabled = v.toBool();
 }
@@ -92,7 +88,7 @@ void DesktopNotificationBackend::useTimeoutChanged(const QVariant &v) {
 }
 
 void DesktopNotificationBackend::notify(const Notification &n) {
-  if(_enabled) {
+  if(_enabled && (n.type == Highlight || n.type == PrivMsg)) {
     QStringList actions;
     QMap<QString, QVariant> hints;
 
@@ -152,10 +148,11 @@ void DesktopNotificationBackend::desktopNotificationClosed(uint id, uint reason)
 
 void DesktopNotificationBackend::desktopNotificationInvoked(uint id, const QString & action) {
   Q_UNUSED(id); Q_UNUSED(action);
+  emit activated();
 }
 
-SettingsPage *DesktopNotificationBackend::configWidget() const {
-  return _configWidget;
+SettingsPage *DesktopNotificationBackend::createConfigWidget() const {
+  return new ConfigWidget();
 }
 
 /***************************************************************************/
@@ -203,7 +200,7 @@ void DesktopNotificationBackend::ConfigWidget::load() {
   NotificationSettings s;
   enabled = s.value("DesktopNotification/Enabled", false).toBool();
   useTimeout = s.value("DesktopNotification/UseTimeout", true).toBool();
-  timeout = s.value("DesktopNotification/Timeout", 10).toInt();
+  timeout = s.value("DesktopNotification/Timeout", 10000).toInt();
   useHints = s.value("DesktopNotification/UseHints", false).toBool();
   xHint = s.value("DesktopNotification/XHint", 0).toInt();
   yHint = s.value("DesktopNotification/YHint", 0).toInt();