Lang sync & fix build.
This commit is contained in:
parent
1fcc1d8503
commit
8fd5a06f96
@ -2250,10 +2250,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Povolit notifikace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Při začátku stahování otevírat správce stahování</translation>
|
||||
@ -2279,6 +2275,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2234,10 +2234,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>E-post</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2263,6 +2259,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2235,10 +2235,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2264,6 +2260,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2250,10 +2250,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -2279,6 +2275,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2233,10 +2233,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2262,6 +2258,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2245,10 +2245,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2274,6 +2270,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2233,10 +2233,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2262,6 +2258,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2251,10 +2251,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>E-mail</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Nyalakan notifikasi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Buka pengelola unduhan ketika penguduhan baru dimulai</translation>
|
||||
@ -2280,6 +2276,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2235,10 +2235,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2264,6 +2260,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2235,10 +2235,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>電子メール</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>通知を有効化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation type="unfinished"/>
|
||||
@ -2264,6 +2260,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2240,10 +2240,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Įjungti pranešimus</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Atverti atsiuntimų tvarkytuvę, kai pradedamas naujas atsiuntimas</translation>
|
||||
@ -2269,6 +2265,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2253,10 +2253,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>E-mail</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Meldingen aanzetten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Open de download manager wanneer een nieuwe download start</translation>
|
||||
@ -2282,6 +2278,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2251,10 +2251,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>E-mail</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Ativar notificações</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Abrir gerenciador de download ao iniciar um novo download</translation>
|
||||
@ -2280,6 +2276,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation>nenhum tema do ícone/tema do ícone do sistema</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -2252,10 +2252,6 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<source>E-mail</source>
|
||||
<translation>E-post</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable notifications</source>
|
||||
<translation>Aktivera aviseringar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open download manager when new download is started</source>
|
||||
<translation>Öppna nedladdningshanteraren när ny nedladdning startas</translation>
|
||||
@ -2281,6 +2277,10 @@ File filter for external e-mail selection dialog.</extracomment>
|
||||
<extracomment>Label for disabling icon theme.</extracomment>
|
||||
<translation>inget ikontema/systemikontema</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable popup baloon tooltips</source>
|
||||
<translation type="unfinished"/>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FormStandardCategoryDetails</name>
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "gui/dialogs/formbackupdatabasesettings.h"
|
||||
#include "gui/dialogs/formrestoredatabasesettings.h"
|
||||
#include "gui/dialogs/formaddaccount.h"
|
||||
#include "gui/notifications/notification.h"
|
||||
#include "services/abstract/serviceroot.h"
|
||||
#include "services/abstract/recyclebin.h"
|
||||
#include "services/standard/gui/formstandardimportexport.h"
|
||||
|
@ -88,7 +88,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pageGeneral">
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
@ -606,13 +606,6 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||
<string>Tray area && notifications</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_checkEnableNotifications">
|
||||
<property name="text">
|
||||
<string>Enable notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_grpTray">
|
||||
<property name="title">
|
||||
@ -625,20 +618,27 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
|
||||
<property name="text">
|
||||
<string>Hide main window when it is minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkHidden">
|
||||
<property name="text">
|
||||
<string>Start application hidden</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_checkEnableNotifications">
|
||||
<property name="text">
|
||||
<string>Enable popup baloon tooltips</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1,140 +0,0 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "gui/notifications/notification.h"
|
||||
|
||||
#include "gui/messagebox.h"
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/settings.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <QtDBus>
|
||||
#endif
|
||||
|
||||
|
||||
Notification::Notification(QObject *parent) : QObject(parent), m_title(QString()), m_text(QString()), m_icon(QPixmap()),
|
||||
m_timerId(0), m_clickTarget(NULL), m_clickSlot(NULL) {
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
m_dBusActiveNotification = 0;
|
||||
m_dBusInterface = new QDBusInterface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
QDBusConnection::sessionBus(), this);
|
||||
|
||||
if (m_dBusInterface->isValid()) {
|
||||
QDBusConnection conn = m_dBusInterface->connection();
|
||||
|
||||
if (!conn.connect("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications",
|
||||
"NotificationClosed",
|
||||
this, SLOT(notificationClosed(uint,uint)))) {
|
||||
qWarning("Failed to connect notifications to 'NotificationClosed' signal, last error: '%s'.",
|
||||
qPrintable(conn.lastError().name()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Notification::~Notification() {
|
||||
qDebug("Destroying Notification instance.");
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
bool Notification::areDBusNotificationsEnabled() {
|
||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Notification::areNotificationsEnabled() {
|
||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool();
|
||||
}
|
||||
|
||||
void Notification::notify(const QString &text, const QString &title, const QIcon &icon,
|
||||
QObject *invokation_target, const char *invokation_slot) {
|
||||
cancel();
|
||||
|
||||
// Set new values.
|
||||
m_clickTarget = invokation_target;
|
||||
m_clickSlot = invokation_slot;
|
||||
m_text = text;
|
||||
m_title = title;
|
||||
m_icon = icon.pixmap(NOTIFICATION_ICON_SIZE, NOTIFICATION_ICON_SIZE);
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
// On Linux, we try to send notification to session notification D-Bus service
|
||||
// if it exists.
|
||||
if (m_dBusInterface->isValid()) {
|
||||
QVariantMap hints;
|
||||
hints["image-path"] = ""; // "application-exit";
|
||||
|
||||
QList<QVariant> argument_list;
|
||||
argument_list << APP_NAME; // app_name
|
||||
argument_list << (uint)0; // replace_id
|
||||
argument_list << ""; // app_icon
|
||||
argument_list << title; // summary
|
||||
argument_list << text; // body
|
||||
argument_list << QStringList(); // actions
|
||||
argument_list << hints; // hints
|
||||
argument_list << (int)-1; // timeout in ms
|
||||
|
||||
QDBusMessage response = m_dBusInterface->callWithArgumentList(QDBus::AutoDetect, "Notify", argument_list);
|
||||
|
||||
if (response.arguments().size() == 1) {
|
||||
// Message was sent, notification should display.
|
||||
m_dBusActiveNotification = response.arguments().at(0).toUInt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Show it.
|
||||
m_timerId = startTimer(TRAY_ICON_BUBBLE_TIMEOUT);
|
||||
}
|
||||
|
||||
void Notification::notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon,
|
||||
QObject *invokation_target, const char *invokation_slot) {
|
||||
notify(text, title, MessageBox::iconForStatus((QMessageBox::Icon) icon), invokation_target, invokation_slot);
|
||||
}
|
||||
|
||||
void Notification::cancel() {
|
||||
m_clickSlot = NULL;
|
||||
m_clickTarget = NULL;
|
||||
|
||||
if (m_timerId != 0) {
|
||||
killTimer(m_timerId);
|
||||
}
|
||||
}
|
||||
|
||||
void Notification::timerEvent(QTimerEvent *event) {
|
||||
QObject::timerEvent(event);
|
||||
cancel();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
void Notification::notificationClosed(uint id, uint reason) {
|
||||
if (m_clickTarget != NULL && m_clickSlot != NULL && m_dBusActiveNotification == id && reason == 2) {
|
||||
QMetaObject::invokeMethod(m_clickTarget, m_clickSlot);
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,77 +0,0 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NOTIFICATION_H
|
||||
#define NOTIFICATION_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
class QDBusInterface;
|
||||
#endif
|
||||
|
||||
// Wraps D-Bus notifications.
|
||||
class Notification : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Constructors.
|
||||
explicit Notification(QObject *parent = 0);
|
||||
virtual ~Notification();
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
static bool areDBusNotificationsEnabled();
|
||||
#endif
|
||||
static bool areNotificationsEnabled();
|
||||
|
||||
public slots:
|
||||
// Main methods for using the netofication.
|
||||
void notify(const QString &text, const QString &title, const QIcon &icon,
|
||||
QObject *invokation_target = NULL, const char *invokation_slot = NULL);
|
||||
void notify(const QString &text, const QString &title, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information,
|
||||
QObject *invokation_target = NULL, const char *invokation_slot = NULL);
|
||||
|
||||
// Cancels display of the notification.
|
||||
void cancel();
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
public slots:
|
||||
void notificationClosed(uint id, uint reason);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
QPixmap m_icon;
|
||||
int m_timerId;
|
||||
|
||||
QObject *m_clickTarget;
|
||||
const char *m_clickSlot;
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QDBusInterface *m_dBusInterface;
|
||||
uint m_dBusActiveNotification;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_H
|
@ -91,6 +91,10 @@ bool SystemTrayIcon::isSystemTrayActivated() {
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool();
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::areNotificationsEnabled() {
|
||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool();
|
||||
}
|
||||
|
||||
void SystemTrayIcon::showPrivate() {
|
||||
// Make sure that application does not exit some window (for example
|
||||
// the settings window) gets closed. Behavior for main window
|
||||
|
@ -67,6 +67,9 @@ class SystemTrayIcon : public QSystemTrayIcon {
|
||||
// application settings.
|
||||
static bool isSystemTrayActivated();
|
||||
|
||||
// Determines whether baloon tips are enabled or not on tray icons.
|
||||
static bool areNotificationsEnabled();
|
||||
|
||||
public slots:
|
||||
void show();
|
||||
|
||||
|
@ -42,8 +42,7 @@ Application::Application(const QString &id, int &argc, char **argv)
|
||||
: QtSingleApplication(id, argc, argv),
|
||||
m_updateFeedsLock(NULL), m_feedServices(QList<ServiceEntryPoint*>()), m_userActions(QList<QAction*>()), m_mainForm(NULL),
|
||||
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
|
||||
m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL), m_shouldRestart(false),
|
||||
m_notification(NULL) {
|
||||
m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL), m_shouldRestart(false) {
|
||||
connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
|
||||
connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&)));
|
||||
connect(this, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(QSessionManager&)));
|
||||
@ -224,7 +223,7 @@ void Application::showGuiMessage(const QString &title, const QString &message,
|
||||
QSystemTrayIcon::MessageIcon message_type, QWidget *parent,
|
||||
bool show_at_least_msgbox, QObject *invokation_target,
|
||||
const char *invokation_slot) {
|
||||
if (Notification::areNotificationsEnabled() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||
if (SystemTrayIcon::areNotificationsEnabled() && SystemTrayIcon::isSystemTrayActivated()) {
|
||||
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot);
|
||||
}
|
||||
else if (show_at_least_msgbox) {
|
||||
@ -282,11 +281,6 @@ void Application::onAboutToQuit() {
|
||||
qDebug("Close lock timed-out.");
|
||||
}
|
||||
|
||||
if (m_notification != NULL) {
|
||||
m_notification->deleteLater();
|
||||
m_notification = NULL;
|
||||
}
|
||||
|
||||
// Now, we can check if application should just quit or restart itself.
|
||||
if (m_shouldRestart) {
|
||||
finish();
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "miscellaneous/databasefactory.h"
|
||||
#include "miscellaneous/iofactory.h"
|
||||
#include "gui/systemtrayicon.h"
|
||||
#include "gui/notifications/notification.h"
|
||||
#include "network-web/downloadmanager.h"
|
||||
#include "services/abstract/serviceentrypoint.h"
|
||||
|
||||
@ -76,14 +75,6 @@ class Application : public QtSingleApplication {
|
||||
return m_system;
|
||||
}
|
||||
|
||||
inline Notification *notification() {
|
||||
if (m_notification == NULL) {
|
||||
m_notification = new Notification();
|
||||
}
|
||||
|
||||
return m_notification;
|
||||
}
|
||||
|
||||
inline SkinFactory *skins() {
|
||||
if (m_skins == NULL) {
|
||||
m_skins = new SkinFactory(this);
|
||||
@ -208,7 +199,6 @@ class Application : public QtSingleApplication {
|
||||
DatabaseFactory *m_database;
|
||||
DownloadManager *m_downloadManager;
|
||||
bool m_shouldRestart;
|
||||
Notification *m_notification;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user