Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
find_package(Qt6 COMPONENTS Quick)
|
||||
|
||||
add_executable(notificationtester notificationtester.cpp resources.qrc)
|
||||
|
||||
target_link_libraries(notificationtester Qt6::Quick KF6::Notifications)
|
||||
|
||||
add_executable(actiontest actiontest.cpp resources.qrc)
|
||||
|
||||
target_link_libraries(actiontest Qt6::Quick KF6::Notifications)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2023 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include <KNotification>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
KNotification *notification = new KNotification(QStringLiteral("notification"));
|
||||
notification->setComponentName(QStringLiteral("plasma_workspace"));
|
||||
notification->setText(QStringLiteral("Hello!"));
|
||||
notification->setTitle(QStringLiteral("Yo"));
|
||||
|
||||
KNotificationAction *action = notification->addAction(QStringLiteral("Open it"));
|
||||
QObject::connect(action, &KNotificationAction::activated, &app, [notification] {
|
||||
qWarning() << "action activated" << notification->xdgActivationToken();
|
||||
});
|
||||
|
||||
KNotificationAction *defaultAction = notification->addDefaultAction(QStringLiteral("Aaaa"));
|
||||
QObject::connect(defaultAction, &KNotificationAction::activated, &app, [notification] {
|
||||
qWarning() << "default action activated" << notification->xdgActivationToken();
|
||||
});
|
||||
|
||||
notification->sendEvent();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.kde.knotification.notificationtester"
|
||||
android:versionName="0.0.1"
|
||||
android:versionCode="1"
|
||||
android:installLocation="auto">
|
||||
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
|
||||
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="KNotification Tester">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.qt.android.bindings.QtActivity"
|
||||
android:label="KNotification"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTop"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="notificationtester"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
|
||||
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
|
||||
|
||||
<!-- Background running -->
|
||||
<meta-data android:name="android.app.background_running" android:value="false"/>
|
||||
|
||||
<!-- auto screen scale factor -->
|
||||
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <QObject>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
Q_DECL_EXPORT
|
||||
#endif
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
engine.load(QStringLiteral("qrc:/notificationtester.qml"));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import QtQuick.Window 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.11
|
||||
|
||||
import org.kde.notification 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
|
||||
width: 600
|
||||
height: 400
|
||||
visible: true
|
||||
|
||||
Component {
|
||||
id: notificationComponent
|
||||
Notification {
|
||||
componentName: Qt.platform.os === "android" ? "android_defaults" : "plasma_workspace"
|
||||
eventId: "notification"
|
||||
text: "Temporary notification we can create new instances of."
|
||||
autoDelete: true
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Notification {
|
||||
id: basicNotification
|
||||
componentName: Qt.platform.os === "android" ? "android_defaults" : "plasma_workspace"
|
||||
eventId: "notification"
|
||||
title: titleField.text
|
||||
text: textField.text
|
||||
iconName: "kde"
|
||||
|
||||
defaultAction: NotificationAction {
|
||||
label: "Default Action"
|
||||
onActivated: log.append("Default action activated.")
|
||||
}
|
||||
|
||||
actions: [
|
||||
NotificationAction {
|
||||
label: "Action 1"
|
||||
onActivated: log.append("Action 1 activated.")
|
||||
},
|
||||
NotificationAction {
|
||||
label: "Action 2"
|
||||
onActivated: log.append("Action 2 activated.")
|
||||
},
|
||||
NotificationAction {
|
||||
label: "Action 3"
|
||||
onActivated: log.append("Action 3 activated.")
|
||||
}
|
||||
]
|
||||
|
||||
flags: (persistentFlag.checked ? Notification.Persistent : Notification.CloseOnTimeout) | (skipGroupingFlag ? Notification.SkipGrouping : 0)
|
||||
urgency: urgencyCombo.currentValue
|
||||
|
||||
onClosed: log.append("Notification closed.")
|
||||
onIgnored: log.append("Notification ignored.")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "Title"
|
||||
}
|
||||
TextField {
|
||||
id: titleField
|
||||
text: "Test"
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "Text"
|
||||
}
|
||||
TextField {
|
||||
id: textField
|
||||
text: "Lorem ipsum dolor sit"
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: persistentFlag
|
||||
text: "Persistent"
|
||||
}
|
||||
CheckBox {
|
||||
id: skipGroupingFlag
|
||||
text: "Skip Grouping"
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: urgencyModel
|
||||
ListElement { name: "Default"; value: Notification.DefaultUrgency }
|
||||
ListElement { name: "Low"; value: Notification.LowUrgency }
|
||||
ListElement { name: "Normal"; value: Notification.NormalUrgency }
|
||||
ListElement { name: "High"; value: Notification.HighUrgency }
|
||||
ListElement { name: "Critical"; value: Notification.CriticalUrgency }
|
||||
}
|
||||
ComboBox {
|
||||
id: urgencyCombo
|
||||
model: urgencyModel
|
||||
textRole: "name"
|
||||
valueRole: "value"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Button {
|
||||
text: "Show"
|
||||
onClicked: basicNotification.sendEvent()
|
||||
}
|
||||
Button {
|
||||
text: "Close"
|
||||
onClicked: basicNotification.close()
|
||||
}
|
||||
}
|
||||
|
||||
Notification {
|
||||
id: replyNotification
|
||||
componentName: Qt.platform.os === "android" ? "android_defaults" : "plasma_workspace"
|
||||
eventId: "notification"
|
||||
title: titleField.text
|
||||
text: textField.text
|
||||
urgency: urgencyCombo.currentValue
|
||||
replyAction {
|
||||
label: "Reply"
|
||||
placeholderText: "Reply to chat group..."
|
||||
submitButtonText: "Send Reply"
|
||||
submitButtonIconName: "mail-reply-all"
|
||||
onReplied: log.append("Reply: " + text)
|
||||
onActivated: log.append("Reply action activated")
|
||||
}
|
||||
|
||||
onClosed: log.append("Reply notification closed.")
|
||||
onIgnored: log.append("Reply notification ignored.")
|
||||
}
|
||||
Button {
|
||||
text: "Inline Reply"
|
||||
onClicked: replyNotification.sendEvent()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Create New"
|
||||
property int count: 1
|
||||
onClicked: {
|
||||
var n = notificationComponent.createObject(parent, { title = "New Notification " + count });
|
||||
n.sendEvent()
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Request Permission"
|
||||
onClicked: NotificationPermission.requestPermission(success => { log.append("Permission request succeeded: " + success); })
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
TextArea {
|
||||
id: log
|
||||
wrapMode: TextEdit.Wrap
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: log.append("Has notification permission: " + NotificationPermission.checkPermission())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>notificationtester.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user