mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
Testing of KNotifications
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
c1c917575f
commit
529189d42c
@ -110,6 +110,9 @@ endif()
|
||||
# Mandatory: KIO
|
||||
find_package(KF6KIO ${KF_MIN_VERSION} REQUIRED)
|
||||
|
||||
# Mandatory: KNotifications
|
||||
find_package(KF6Notifications ${KF_DEP_VERSION} REQUIRED)
|
||||
|
||||
# Optional: GnomeKeyring
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
|
10
common/falkon.notifyrc
Normal file
10
common/falkon.notifyrc
Normal file
@ -0,0 +1,10 @@
|
||||
[Global]
|
||||
IconName=falkon
|
||||
Name=Falkon
|
||||
Comment=Falkon Web Browser
|
||||
DesktopEntry=falkon.desktop
|
||||
|
||||
[Event/newmail]
|
||||
Name=New E-Mail
|
||||
Comment=You have got a new email
|
||||
Action=Sound|Popup
|
@ -604,6 +604,7 @@ target_link_libraries(FalkonPrivate
|
||||
Qt6::Core5Compat
|
||||
KF6::Archive
|
||||
KF6::KIOGui
|
||||
KF6::Notifications
|
||||
${OPENSSL_CRYPTO_LIBRARY}
|
||||
)
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "browserwindow.h"
|
||||
#include "../config.h"
|
||||
|
||||
#include <KNotification>
|
||||
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
@ -85,6 +87,15 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
|
||||
m_desktopNotif.data()->show();
|
||||
break;
|
||||
case DesktopNative:
|
||||
KNotification *notification = new KNotification(QSL("contactOnline"));
|
||||
notification->setTitle(heading);
|
||||
notification->setText(text);
|
||||
notification->setPixmap(icon);
|
||||
// notification->setActions({tr("Open chat")});
|
||||
|
||||
// connect(notification, QOverload<unsigned int>::of(&KNotification::activated), contact, &Contact::slotOpenChat);
|
||||
|
||||
notification->sendEvent();
|
||||
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)
|
||||
QFile tmp(DataPaths::path(DataPaths::Temp) + QLatin1String("/falkon_notif.png"));
|
||||
tmp.open(QFile::WriteOnly);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QPointer>
|
||||
#include <QHash>
|
||||
|
||||
class QPixmap;
|
||||
class QDBusMessage;
|
||||
@ -36,6 +37,18 @@ class FALKON_EXPORT DesktopNotificationsFactory : public QObject
|
||||
|
||||
public:
|
||||
enum Type { DesktopNative, PopupWidget };
|
||||
enum EventType {
|
||||
General,
|
||||
Web,
|
||||
DownloadFinished,
|
||||
UpdateAvailable,
|
||||
OcsSupport,
|
||||
Plugins,
|
||||
Preview,
|
||||
GreaseMonkeyInstall,
|
||||
GreaseMonkeyScrips,
|
||||
KWalletDisabled
|
||||
};
|
||||
|
||||
explicit DesktopNotificationsFactory(QObject* parent = nullptr);
|
||||
|
||||
@ -59,6 +72,19 @@ private:
|
||||
|
||||
QPointer<DesktopNotification> m_desktopNotif;
|
||||
quint32 m_uint;
|
||||
|
||||
QHash<EventType, QString> KNotificationEvents = {
|
||||
{General, QSL("General")},
|
||||
{Web, QSL("Web")},
|
||||
{DownloadFinished, QSL("DownloadFinished")},
|
||||
{UpdateAvailable, QSL("UpdateAvailable")},
|
||||
{OcsSupport, QSL("OcsSupport")},
|
||||
{Plugins, QSL("Plugins")},
|
||||
{Preview, QSL("Preview")},
|
||||
{GreaseMonkeyInstall, QSL("GreaseMonkeyInstall")},
|
||||
{GreaseMonkeyScrips, QSL("GreaseMonkeyScrips")},
|
||||
{KWalletDisabled, QSL("KWalletDisabled")}
|
||||
};
|
||||
};
|
||||
|
||||
#endif // DESKTOPNOTIFICATIONSFACTORY_H
|
||||
|
Loading…
Reference in New Issue
Block a user