theshell/notificationdbus.h

77 lines
2.4 KiB
C
Raw Normal View History

2017-08-05 15:20:02 +10:00
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2017 Victor Tran
*
* 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 3 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* *************************************/
2016-03-17 19:46:40 +11:00
#ifndef NOTIFICATIONDBUS_H
#define NOTIFICATIONDBUS_H
#include <QObject>
#include <QDBusConnection>
2016-03-29 17:42:24 +11:00
#include <QDBusMessage>
2016-03-17 19:46:40 +11:00
#include <QApplication>
#include <QIcon>
2016-03-17 19:46:40 +11:00
#include "notificationdialog.h"
2016-03-29 17:42:24 +11:00
#include "notifications_adaptor.h"
#include "infopanedropdown.h"
2016-12-19 17:46:19 +11:00
#include "tutorialwindow.h"
2016-03-29 17:42:24 +11:00
class NotificationDialog;
2016-03-17 19:46:40 +11:00
2016-05-29 17:03:52 +10:00
class InfoPaneDropdown;
2016-03-17 19:46:40 +11:00
class NotificationDBus : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications")
public:
explicit NotificationDBus(QObject *parent = 0);
2016-05-29 17:03:52 +10:00
void setDropdownPane(InfoPaneDropdown* pane);
2016-03-17 19:46:40 +11:00
Q_SIGNALS:
2016-08-20 16:26:35 +10:00
Q_SCRIPTABLE void NotificationClosed(uint id, uint reason);
2016-03-29 17:42:24 +11:00
Q_SCRIPTABLE void ActionInvoked(uint id, QString action_key);
void newNotification(int id, QString summary, QString body, QIcon icon);
void removeNotification(int id);
2016-03-17 19:46:40 +11:00
public Q_SLOTS:
QStringList GetCapabilities();
uint Notify(QString app_name, uint replaces_id,
QString app_icon, QString summary,
QString body, QStringList actions,
QVariantMap hints, int expire_timeout);
2016-08-20 16:26:35 +10:00
void CloseNotification(uint id);
2016-03-29 17:42:24 +11:00
QString GetServerInformation(QString &vendor,
QString &version, QString &spec_version);
2016-08-20 16:26:35 +10:00
void invokeAction(uint id, QString key);
2016-03-17 19:46:40 +11:00
protected Q_SLOTS:
2016-03-29 17:42:24 +11:00
void sendCloseNotification(int id, int reason);
void CloseNotificationUserInitiated(int id);
2016-03-17 19:46:40 +11:00
private:
QList<NotificationDialog*> dialogs;
2017-01-12 01:00:27 +11:00
NotificationDialog* currentDialog = NULL;
2016-03-17 19:46:40 +11:00
int nextId = 1;
2016-05-29 17:03:52 +10:00
InfoPaneDropdown* dropdownPane = NULL;
QSettings settings;
2016-03-17 19:46:40 +11:00
};
#endif // NOTIFICATIONDBUS_H