plasmoid: Basic code cleanup
This commit is contained in:
parent
1f164e3860
commit
90946829bf
17 changed files with 456 additions and 336 deletions
|
@ -71,6 +71,19 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri)
|
||||||
"RemoteKeyboardDbusInterface",
|
"RemoteKeyboardDbusInterface",
|
||||||
QStringLiteral("You're not supposed to instantiate interfaces"));
|
QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
|
qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
|
qmlRegisterUncreatableType<BatteryDbusInterface>(uri, 1, 0, "BatteryDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
|
qmlRegisterUncreatableType<ConnectivityReportDbusInterface>(uri,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
"ConnectivityReportDbusInterface",
|
||||||
|
QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
|
qmlRegisterUncreatableType<SftpDbusInterface>(uri, 1, 0, "SftpDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
|
qmlRegisterUncreatableType<SmsDbusInterface>(uri, 1, 0, "SmsDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
|
qmlRegisterUncreatableType<VirtualmonitorDbusInterface>(uri,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
"VirtualmonitorDbusInterface",
|
||||||
|
QStringLiteral("You're not supposed to instantiate interfaces"));
|
||||||
qmlRegisterUncreatableType<RemoteCommandsDbusInterface>(uri,
|
qmlRegisterUncreatableType<RemoteCommandsDbusInterface>(uri,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -1,36 +1,43 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
|
* SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQml 2.2
|
pragma ComponentBehavior: Bound
|
||||||
import org.kde.kdeconnect 1.0
|
|
||||||
|
import QtQml
|
||||||
|
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: prop
|
id: prop
|
||||||
property QtObject object: null
|
|
||||||
property string read
|
|
||||||
property string change: read+"Changed"
|
|
||||||
|
|
||||||
Component.onCompleted: get();
|
property QtObject object
|
||||||
|
property string read
|
||||||
|
property string change: read + "Changed"
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
get();
|
||||||
|
}
|
||||||
|
|
||||||
onChangeChanged: {
|
onChangeChanged: {
|
||||||
if (object) {
|
if (object) {
|
||||||
var theSignal = object[change];
|
const signal = object[change];
|
||||||
if (theSignal) {
|
if (signal) {
|
||||||
theSignal.connect(valueReceived);
|
signal.connect(valueReceived);
|
||||||
} else {
|
} else {
|
||||||
console.warn("couldn't find signal", change, "for", object)
|
console.warn(`couldn't find signal ${change} for ${object}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function valueReceived(val) {
|
function valueReceived(value: var): void {
|
||||||
if (!val) {
|
if (!value) {
|
||||||
get();
|
get();
|
||||||
} else {
|
} else {
|
||||||
_value = val;
|
_value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,18 +45,26 @@ QtObject {
|
||||||
property var _value: defaultValue
|
property var _value: defaultValue
|
||||||
readonly property var value: _value
|
readonly property var value: _value
|
||||||
|
|
||||||
readonly property var v: DBusAsyncResponse {
|
readonly property KDEConnect.DBusAsyncResponse __response: KDEConnect.DBusAsyncResponse {
|
||||||
id: response
|
id: response
|
||||||
|
|
||||||
autoDelete: false
|
autoDelete: false
|
||||||
|
|
||||||
onSuccess: result => {
|
onSuccess: result => {
|
||||||
prop._value = result;
|
prop._value = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
onError: message => {
|
onError: message => {
|
||||||
console.warn("failed call", prop.object, prop.read, prop.change, message)
|
console.warn("failed call", prop.object, prop.read, prop.change, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get() {
|
function get(): void {
|
||||||
response.setPendingCall(object[read]());
|
if (object) {
|
||||||
|
const method = object[read];
|
||||||
|
if (method) {
|
||||||
|
response.setPendingCall(method());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +1,71 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
||||||
* SPDX-FileCopyrightText: 2016 David Kahles <david.kahles96@gmail.com>
|
* SPDX-FileCopyrightText: 2016 David Kahles <david.kahles96@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQml 2.2
|
pragma ComponentBehavior: Bound
|
||||||
import org.kde.kdeconnect 1.0
|
|
||||||
|
import QtQml
|
||||||
|
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: conn.target
|
property KDEConnect.DeviceDbusInterface device
|
||||||
property string pluginName: ""
|
property string pluginName
|
||||||
property bool available: false
|
property bool available
|
||||||
property string iconName: ""
|
property string iconName
|
||||||
|
|
||||||
readonly property Connections connection: Connections {
|
readonly property Connections connection: Connections {
|
||||||
id: conn
|
id: conn
|
||||||
function onPluginsChanged() {
|
|
||||||
|
target: root.device
|
||||||
|
|
||||||
|
function onPluginsChanged(): void {
|
||||||
root.pluginsChanged();
|
root.pluginsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: pluginsChanged()
|
Component.onCompleted: {
|
||||||
|
pluginsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var v: DBusAsyncResponse {
|
readonly property KDEConnect.DBusAsyncResponse __availableResponse: KDEConnect.DBusAsyncResponse {
|
||||||
id: availableResponse
|
id: availableResponse
|
||||||
|
|
||||||
autoDelete: false
|
autoDelete: false
|
||||||
onSuccess: (result) => { root.available = result; }
|
|
||||||
onError: () => { root.available = false }
|
onSuccess: result => {
|
||||||
|
root.available = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginsChanged() {
|
onError: message => {
|
||||||
availableResponse.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName))
|
root.available = false;
|
||||||
iconResponse.setPendingCall(device.pluginIconName("kdeconnect_" + pluginName))
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var vv: DBusAsyncResponse {
|
function pluginsChanged(): void {
|
||||||
|
if (device) {
|
||||||
|
availableResponse.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName));
|
||||||
|
iconResponse.setPendingCall(device.pluginIconName("kdeconnect_" + pluginName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property KDEConnect.DBusAsyncResponse __iconResponse: KDEConnect.DBusAsyncResponse {
|
||||||
id: iconResponse
|
id: iconResponse
|
||||||
|
|
||||||
autoDelete: false
|
autoDelete: false
|
||||||
onSuccess: (result) => { root.iconName = result; }
|
|
||||||
onError: () => { root.iconName = "" }
|
onSuccess: result => {
|
||||||
|
root.iconName = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
onError: message => {
|
||||||
|
root.iconName = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,102 +1,108 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2017 Holger Kaelberer <holger.k@elberer.de>
|
* SPDX-FileCopyrightText: 2017 Holger Kaelberer <holger.k@elberer.de>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.1
|
pragma ComponentBehavior: Bound
|
||||||
import org.kde.kdeconnect 1.0
|
|
||||||
import QtQuick.Controls 2.4
|
|
||||||
|
|
||||||
TextField {
|
import QtQuick
|
||||||
|
import QtQuick.Controls as QQC2
|
||||||
|
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
|
QQC2.TextField {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "remotekeyboard"
|
pluginName: "remotekeyboard"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property var remoteKeyboard: null
|
property KDEConnect.RemoteKeyboardDbusInterface remoteKeyboard
|
||||||
|
|
||||||
readonly property bool remoteState: available ? remoteKeyboard.remoteState : false
|
readonly property bool remoteState: available && remoteKeyboard ? remoteKeyboard.remoteState : false
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: remoteKeyboard
|
target: root.remoteKeyboard
|
||||||
function onKeyPressReceived() {
|
|
||||||
|
function onKeyPressReceived(key: string, specialKey: int, shift: bool, ctrl: bool, alt: bool): void {
|
||||||
//console.log("XXX received keypress key=" + key + " special=" + specialKey + " shift=" + shift + " ctrl=" + ctrl + " text=" + text + " cursorPos=" + cursorPosition);
|
//console.log("XXX received keypress key=" + key + " special=" + specialKey + " shift=" + shift + " ctrl=" + ctrl + " text=" + text + " cursorPos=" + cursorPosition);
|
||||||
// interpret some special keys:
|
// interpret some special keys:
|
||||||
if (specialKey == 12 || specialKey == 14) // Return/Esc -> clear
|
if (specialKey === 12 || specialKey === 14) { // Return/Esc -> clear
|
||||||
text = "";
|
text = "";
|
||||||
else if (specialKey == 4 // Left
|
} else if (specialKey === 4 // Left
|
||||||
&& cursorPosition > 0)
|
&& cursorPosition > 0) {
|
||||||
--cursorPosition;
|
--cursorPosition;
|
||||||
else if (specialKey == 6 // Right
|
} else if (specialKey === 6 // Right
|
||||||
&& cursorPosition < text.length)
|
&& cursorPosition < text.length) {
|
||||||
++cursorPosition;
|
++cursorPosition;
|
||||||
else if (specialKey == 1) { // Backspace -> delete left
|
} else if (specialKey === 1) { // Backspace -> delete left
|
||||||
var pos = cursorPosition;
|
const pos = cursorPosition;
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
text = text.substring(0, pos-1)
|
text = text.substring(0, pos - 1)
|
||||||
+ text.substring(pos, text.length);
|
+ text.substring(pos, text.length);
|
||||||
cursorPosition = pos - 1;
|
cursorPosition = pos - 1;
|
||||||
}
|
}
|
||||||
} else if (specialKey == 13) { // Delete -> delete right
|
} else if (specialKey === 13) { // Delete -> delete right
|
||||||
var pos = cursorPosition;
|
const pos = cursorPosition;
|
||||||
if (pos < text.length) {
|
if (pos < text.length) {
|
||||||
text = text.substring(0, pos)
|
text = text.substring(0, pos)
|
||||||
+ text.substring(pos+1, text.length);
|
+ text.substring(pos + 1, text.length);
|
||||||
cursorPosition = pos; // seems to be set to text.length automatically!
|
cursorPosition = pos; // seems to be set to text.length automatically!
|
||||||
}
|
}
|
||||||
} else if (specialKey == 10) // Home
|
} else if (specialKey === 10) { // Home
|
||||||
cursorPosition = 0;
|
cursorPosition = 0;
|
||||||
else if (specialKey == 11) // End
|
} else if (specialKey == 11) { // End
|
||||||
cursorPosition = text.length;
|
cursorPosition = text.length;
|
||||||
else {
|
} else {
|
||||||
// echo visible keys
|
// echo visible keys
|
||||||
var sanitized = "";
|
let sanitized = "";
|
||||||
for (var i = 0; i < key.length; i++) {
|
for (let i = 0; i < key.length; i++) {
|
||||||
if (key.charCodeAt(i) > 31)
|
if (key.charCodeAt(i) > 31) {
|
||||||
sanitized += key.charAt(i);
|
sanitized += key.charAt(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (sanitized.length > 0 && !ctrl && !alt) {
|
if (sanitized.length > 0 && !ctrl && !alt) {
|
||||||
// insert sanitized at current pos:
|
// insert sanitized at current pos:
|
||||||
var pos = cursorPosition;
|
const pos = cursorPosition;
|
||||||
text = text.substring(0, pos)
|
text = text.substring(0, pos)
|
||||||
+ sanitized
|
+ sanitized
|
||||||
+ text.substring(pos, text.length);
|
+ text.substring(pos, text.length);
|
||||||
cursorPosition = pos + 1; // seems to be set to text.length automatically!
|
cursorPosition = pos + 1; // seems to be set to text.length automatically!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log("XXX After received keypress key=" + key + " special=" + specialKey + " shift=" + shift + " ctrl=" + ctrl + " text=" + text + " cursorPos=" + cursorPosition);
|
// console.log("XXX After received keypress key=" + key + " special=" + specialKey + " shift=" + shift + " ctrl=" + ctrl + " text=" + text + " cursorPos=" + cursorPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendEvent(event: KeyEvent): void {
|
||||||
function sendEvent(event) {
|
|
||||||
if (remoteKeyboard) {
|
if (remoteKeyboard) {
|
||||||
var transEvent = JSON.parse(JSON.stringify(event)); // transform to anonymous object
|
const transEvent = JSON.parse(JSON.stringify(event)); // transform to anonymous object
|
||||||
remoteKeyboard.sendQKeyEvent(transEvent);
|
remoteKeyboard.sendQKeyEvent(transEvent);
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: event => {
|
||||||
if (available)
|
if (available) {
|
||||||
sendEvent(event);
|
sendEvent(event);
|
||||||
|
}
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available && device !== null) {
|
||||||
remoteKeyboard = RemoteKeyboardDbusInterfaceFactory.create(device.id());
|
remoteKeyboard = KDEConnect.RemoteKeyboardDbusInterfaceFactory.create(device.id());
|
||||||
//remoteKeyboard.keyPressReceived.connect(keyPressReceived);
|
|
||||||
remoteKeyboard.remoteStateChanged.connect(remoteStateChanged);
|
remoteKeyboard.remoteStateChanged.connect(remoteStateChanged);
|
||||||
} else {
|
} else {
|
||||||
remoteKeyboard = null
|
remoteKeyboard = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,80 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "battery"
|
pluginName: "battery"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool charging: battery ? battery.isCharging : false
|
readonly property bool charging: battery?.isCharging ?? false
|
||||||
property int charge: battery ? battery.charge : -1
|
readonly property int charge: battery?.charge ?? -1
|
||||||
property string displayString: (available && charge > -1) ? ((charging) ? (i18n("%1% charging", charge)) : (i18n("%1%", charge))) : i18n("No info")
|
|
||||||
property variant battery: null
|
readonly property string displayString: {
|
||||||
|
if (available && charge > -1) {
|
||||||
|
if (charging) {
|
||||||
|
return i18n("%1% charging", charge);
|
||||||
|
} else {
|
||||||
|
return i18n("%1%", charge);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return i18n("No info");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
property KDEConnect.BatteryDbusInterface battery
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suggests an icon name to use for the current battery level
|
* Suggests an icon name to use for the current battery level
|
||||||
*/
|
*/
|
||||||
readonly property string iconName: {
|
readonly property string iconName: {
|
||||||
charge < 0 ?
|
if (charge < 0) {
|
||||||
"battery-missing-symbolic" :
|
return "battery-missing-symbolic";
|
||||||
charge < 10 ?
|
} else if (charge < 10) {
|
||||||
charging ?
|
return charging
|
||||||
"battery-empty-charging-symbolic" :
|
? "battery-empty-charging-symbolic"
|
||||||
"battery-empty-symbolic" :
|
: "battery-empty-symbolic";
|
||||||
charge < 25 ?
|
} else if (charge < 25) {
|
||||||
charging ?
|
return charging
|
||||||
"battery-caution-charging-symbolic" :
|
? "battery-caution-charging-symbolic"
|
||||||
"battery-caution-symbolic" :
|
: "battery-caution-symbolic";
|
||||||
charge < 50 ?
|
} else if (charge < 50) {
|
||||||
charging ?
|
return charging
|
||||||
"battery-low-charging-symbolic" :
|
? "battery-low-charging-symbolic"
|
||||||
"battery-low-symbolic" :
|
: "battery-low-symbolic";
|
||||||
charge < 75 ?
|
} else if (charge < 75) {
|
||||||
charging ?
|
return charging
|
||||||
"battery-good-charging-symbolic" :
|
? "battery-good-charging-symbolic"
|
||||||
"battery-good-symbolic" :
|
: "battery-good-symbolic";
|
||||||
charging ?
|
} else {
|
||||||
"battery-full-charging-symbolic":
|
return charging
|
||||||
"battery-full-symbolic"
|
? "battery-full-charging-symbolic"
|
||||||
|
: "battery-full-symbolic";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available) {
|
||||||
battery = DeviceBatteryDbusInterfaceFactory.create(device.id())
|
battery = KDEConnect.DeviceBatteryDbusInterfaceFactory.create(device.id());
|
||||||
} else {
|
} else {
|
||||||
battery = null
|
battery = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2021 Yaman Qalieh <ybq987@gmail.com>
|
* SPDX-FileCopyrightText: 2021 Yaman Qalieh <ybq987@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "clipboard"
|
pluginName: "clipboard"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant clipboard: null
|
property KDEConnect.ClipboardDbusInterface clipboard
|
||||||
|
|
||||||
function sendClipboard() {
|
function sendClipboard(): void {
|
||||||
if (clipboard) {
|
if (clipboard) {
|
||||||
clipboard.sendClipboard();
|
clipboard.sendClipboard();
|
||||||
}
|
}
|
||||||
|
@ -30,9 +34,9 @@ QtObject {
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available) {
|
||||||
clipboard = ClipboardDbusInterfaceFactory.create(device.id())
|
clipboard = KDEConnect.ClipboardDbusInterfaceFactory.create(device.id());
|
||||||
} else {
|
} else {
|
||||||
clipboard = null
|
clipboard = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,44 @@
|
||||||
/*
|
/**
|
||||||
SPDX-FileCopyrightText: 2014-2015 Frederic St-Pierre <me@fredericstpierre.com>
|
* SPDX-FileCopyrightText: 2014-2015 Frederic St-Pierre <me@fredericstpierre.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
pragma ComponentBehavior: Bound
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.plasma.plasmoid
|
||||||
|
|
||||||
DropArea {
|
DropArea {
|
||||||
onEntered: {
|
id: root
|
||||||
|
|
||||||
|
required property PlasmoidItem plasmoidItem
|
||||||
|
|
||||||
|
onEntered: drag => {
|
||||||
if (drag.hasUrls) {
|
if (drag.hasUrls) {
|
||||||
root.expanded = true;
|
root.plasmoidItem.expanded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: kdeConnectMouseArea
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onClicked: {
|
property bool wasExpanded: false
|
||||||
root.expanded = !root.expanded;
|
|
||||||
|
onPressed: mouse => {
|
||||||
|
wasExpanded = root.plasmoidItem.expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: mouse => {
|
||||||
|
root.plasmoidItem.expanded = !root.plasmoidItem.expanded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
id: kdeConnectIcon
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: plasmoid.icon
|
source: Plasmoid.icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2021 David Shlemayev <david.shlemayev@gmail.com>
|
* SPDX-FileCopyrightText: 2021 David Shlemayev <david.shlemayev@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
readonly property alias available: checker.available
|
|
||||||
readonly property bool ready: connectivity
|
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "connectivity_report"
|
pluginName: "connectivity_report"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,20 +40,22 @@ QtObject {
|
||||||
* The parsing from Android values into these strings is handled in the
|
* The parsing from Android values into these strings is handled in the
|
||||||
* [ConnectivityReportPlugin.networkTypeToString method](https://invent.kde.org/network/kdeconnect-android/-/blob/master/src/org/kde/kdeconnect/Plugins/ConnectivityReportPlugin/ConnectivityReportPlugin.java#L82)
|
* [ConnectivityReportPlugin.networkTypeToString method](https://invent.kde.org/network/kdeconnect-android/-/blob/master/src/org/kde/kdeconnect/Plugins/ConnectivityReportPlugin/ConnectivityReportPlugin.java#L82)
|
||||||
*/
|
*/
|
||||||
readonly property string networkType: connectivity ? connectivity.cellularNetworkType : i18n("Unknown")
|
readonly property string networkType: connectivity?.cellularNetworkType ?? i18n("Unknown")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports a value between 0 and 4 (inclusive) which represents the strength of the cellular connection
|
* Reports a value between 0 and 4 (inclusive) which represents the strength of the cellular connection
|
||||||
*/
|
*/
|
||||||
readonly property int signalStrength: connectivity ? connectivity.cellularNetworkStrength : -1
|
readonly property int signalStrength: connectivity?.cellularNetworkStrength ?? -1
|
||||||
property string displayString: {
|
|
||||||
if (ready) {
|
readonly property string displayString: {
|
||||||
|
if (connectivity !== null) {
|
||||||
return `${networkType} ${signalStrength}/4`;
|
return `${networkType} ${signalStrength}/4`;
|
||||||
} else {
|
} else {
|
||||||
return i18n("No signal");
|
return i18n("No signal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property variant connectivity: null
|
|
||||||
|
property KDEConnect.ConnectivityReportDbusInterface connectivity
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suggests an icon name to use for the current signal level
|
* Suggests an icon name to use for the current signal level
|
||||||
|
@ -60,27 +65,27 @@ QtObject {
|
||||||
*/
|
*/
|
||||||
readonly property string iconName: {
|
readonly property string iconName: {
|
||||||
// Firstly, get the name prefix which represents the signal strength
|
// Firstly, get the name prefix which represents the signal strength
|
||||||
var signalStrengthIconName =
|
const signalStrengthIconName =
|
||||||
(signalStrength < 0 || !ready) ?
|
(signalStrength < 0 || connectivity === null) ?
|
||||||
// As long as the signal strength is nonsense or the plugin reports as non-ready,
|
// As long as the signal strength is nonsense or the plugin reports as non-ready,
|
||||||
// show us as disconnected
|
// show us as disconnected
|
||||||
"network-mobile-off" :
|
"network-mobile-off" :
|
||||||
(signalStrength == 0) ?
|
(signalStrength === 0) ?
|
||||||
"network-mobile-0" :
|
"network-mobile-0" :
|
||||||
(signalStrength == 1) ?
|
(signalStrength === 1) ?
|
||||||
"network-mobile-20" :
|
"network-mobile-20" :
|
||||||
(signalStrength == 2) ?
|
(signalStrength === 2) ?
|
||||||
"network-mobile-60" :
|
"network-mobile-60" :
|
||||||
(signalStrength == 3) ?
|
(signalStrength === 3) ?
|
||||||
"network-mobile-80" :
|
"network-mobile-80" :
|
||||||
(signalStrength == 4) ?
|
(signalStrength === 4) ?
|
||||||
"network-mobile-100" :
|
"network-mobile-100" :
|
||||||
// Since all possible values are enumerated above, this default case should never be hit.
|
// Since all possible values are enumerated above, this default case should never be hit.
|
||||||
// However, I need it in order for my ternary syntax to be valid!
|
// However, I need it in order for my ternary syntax to be valid!
|
||||||
"network-mobile-available"
|
"network-mobile-available";
|
||||||
|
|
||||||
// If we understand the network type, append to the icon name to show the type
|
// If we understand the network type, append to the icon name to show the type
|
||||||
var networkTypeSuffix =
|
const networkTypeSuffix =
|
||||||
(networkType === "5G") ?
|
(networkType === "5G") ?
|
||||||
// No icon for this case!
|
// No icon for this case!
|
||||||
"" :
|
"" :
|
||||||
|
@ -110,15 +115,16 @@ QtObject {
|
||||||
// GSconnect just uses the 2g icon
|
// GSconnect just uses the 2g icon
|
||||||
// No icon for this case!
|
// No icon for this case!
|
||||||
"" :
|
"" :
|
||||||
"" // We didn't recognize the network type. Don't append anything.
|
""; // We didn't recognize the network type. Don't append anything.
|
||||||
return signalStrengthIconName + networkTypeSuffix
|
|
||||||
|
return signalStrengthIconName + networkTypeSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available) {
|
||||||
connectivity = DeviceConnectivityReportDbusInterfaceFactory.create(device.id())
|
connectivity = KDEConnect.DeviceConnectivityReportDbusInterfaceFactory.create(device.id());
|
||||||
} else {
|
} else {
|
||||||
connectivity = null
|
connectivity = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.plasma.components as PlasmaComponents
|
|
||||||
import org.kde.kdeconnect
|
|
||||||
import QtQuick.Controls
|
|
||||||
import org.kde.kirigami as Kirigami
|
|
||||||
import org.kde.plasma.extras as PlasmaExtras
|
|
||||||
import QtQuick.Dialogs
|
|
||||||
import QtCore
|
import QtCore
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Dialogs as QtDialogs
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
PlasmaComponents.ItemDelegate
|
import org.kde.kdeconnect as KDEConnect
|
||||||
{
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.plasma.components as PlasmaComponents
|
||||||
|
import org.kde.plasma.core as PlasmaCore
|
||||||
|
import org.kde.plasma.extras as PlasmaExtras
|
||||||
|
|
||||||
|
PlasmaComponents.ItemDelegate {
|
||||||
id: root
|
id: root
|
||||||
readonly property QtObject device: DeviceDbusInterfaceFactory.create(model.deviceId)
|
|
||||||
|
readonly property KDEConnect.DeviceDbusInterface device: KDEConnect.DeviceDbusInterfaceFactory.create(model.deviceId)
|
||||||
|
|
||||||
hoverEnabled: false
|
hoverEnabled: false
|
||||||
down: false
|
down: false
|
||||||
|
@ -35,23 +36,10 @@ PlasmaComponents.ItemDelegate
|
||||||
id: fileDropArea
|
id: fileDropArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onDropped: {
|
onDropped: drop => {
|
||||||
if (drop.hasUrls) {
|
if (drop.hasUrls) {
|
||||||
|
const urls = new Set(drop.urls.map(url => url.toString()));
|
||||||
var urls = [];
|
urls.forEach(url => share.plugin.shareUrl(url));
|
||||||
|
|
||||||
for (var v in drop.urls) {
|
|
||||||
if (drop.urls[v] != null) {
|
|
||||||
if (urls.indexOf(drop.urls[v].toString()) == -1) {
|
|
||||||
urls.push(drop.urls[v].toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var i;
|
|
||||||
for (i = 0; i < urls.length; i++) {
|
|
||||||
share.plugin.shareUrl(urls[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
drop.accepted = true;
|
drop.accepted = true;
|
||||||
}
|
}
|
||||||
|
@ -68,8 +56,7 @@ PlasmaComponents.ItemDelegate
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
RowLayout
|
RowLayout {
|
||||||
{
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
@ -119,9 +106,10 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout
|
|
||||||
{
|
RowLayout {
|
||||||
id: connectionInformation
|
id: connectionInformation
|
||||||
|
|
||||||
visible: connectivity.available
|
visible: connectivity.available
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
@ -147,10 +135,10 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout
|
RowLayout {
|
||||||
{
|
|
||||||
id: batteryInformation
|
id: batteryInformation
|
||||||
visible: (battery.available && battery.charge > -1)
|
|
||||||
|
visible: battery.available && battery.charge > -1
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
|
@ -171,6 +159,7 @@ PlasmaComponents.ItemDelegate
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
PlasmaComponents.ToolButton {
|
||||||
id: overflowMenu
|
id: overflowMenu
|
||||||
|
|
||||||
icon.name: "application-menu"
|
icon.name: "application-menu"
|
||||||
checked: menu.status === PlasmaExtras.Menu.Open
|
checked: menu.status === PlasmaExtras.Menu.Open
|
||||||
|
|
||||||
|
@ -181,35 +170,35 @@ PlasmaComponents.ItemDelegate
|
||||||
visualParent: overflowMenu
|
visualParent: overflowMenu
|
||||||
placement: PlasmaExtras.Menu.BottomPosedLeftAlignedPopup
|
placement: PlasmaExtras.Menu.BottomPosedLeftAlignedPopup
|
||||||
|
|
||||||
//Share
|
// Share
|
||||||
PlasmaExtras.MenuItem
|
PlasmaExtras.MenuItem {
|
||||||
{
|
id: shareFile
|
||||||
property FileDialog data: FileDialog {
|
|
||||||
|
readonly property QtDialogs.FileDialog data: QtDialogs.FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
title: i18n("Please choose a file")
|
title: i18n("Please choose a file")
|
||||||
currentFolder: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
currentFolder: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
||||||
fileMode: FileDialog.OpenFiles
|
fileMode: QtDialogs.FileDialog.OpenFiles
|
||||||
onAccepted: fileDialog.selectedFiles.forEach(url => share.plugin.shareUrl(url))
|
onAccepted: fileDialog.selectedFiles.forEach(url => share.plugin.shareUrl(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
id: shareFile
|
|
||||||
icon: "document-share"
|
icon: "document-share"
|
||||||
visible: share.available
|
visible: share.available
|
||||||
text: i18n("Share file")
|
text: i18n("Share file")
|
||||||
onClicked: fileDialog.open()
|
onClicked: fileDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clipboard
|
// Clipboard
|
||||||
PlasmaExtras.MenuItem
|
PlasmaExtras.MenuItem {
|
||||||
{
|
id: sendclipboard
|
||||||
property Clipboard data: Clipboard {
|
|
||||||
|
readonly property Clipboard data: Clipboard {
|
||||||
id: clipboard
|
id: clipboard
|
||||||
device: root.device
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
id: sendclipboard
|
|
||||||
icon: "klipper"
|
icon: "klipper"
|
||||||
visible: clipboard.available && clipboard.clipboard.isAutoShareDisabled
|
visible: clipboard.clipboard?.isAutoShareDisabled ?? false
|
||||||
text: i18n("Send Clipboard")
|
text: i18n("Send Clipboard")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -218,15 +207,15 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Find my phone
|
// Find my phone
|
||||||
PlasmaExtras.MenuItem
|
PlasmaExtras.MenuItem {
|
||||||
{
|
id: ring
|
||||||
property FindMyPhone data: FindMyPhone {
|
|
||||||
|
readonly property FindMyPhone data: FindMyPhone {
|
||||||
id: findmyphone
|
id: findmyphone
|
||||||
device: root.device
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
id: ring
|
|
||||||
icon: "irc-voice"
|
icon: "irc-voice"
|
||||||
visible: findmyphone.available
|
visible: findmyphone.available
|
||||||
text: i18n("Ring my phone")
|
text: i18n("Ring my phone")
|
||||||
|
@ -236,15 +225,15 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SFTP
|
// SFTP
|
||||||
PlasmaExtras.MenuItem
|
PlasmaExtras.MenuItem {
|
||||||
{
|
id: browse
|
||||||
property Sftp data: Sftp {
|
|
||||||
|
readonly property Sftp data: Sftp {
|
||||||
id: sftp
|
id: sftp
|
||||||
device: root.device
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
id: browse
|
|
||||||
icon: "document-open-folder"
|
icon: "document-open-folder"
|
||||||
visible: sftp.available
|
visible: sftp.available
|
||||||
text: i18n("Browse this device")
|
text: i18n("Browse this device")
|
||||||
|
@ -254,10 +243,9 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SMS
|
// SMS
|
||||||
PlasmaExtras.MenuItem
|
PlasmaExtras.MenuItem {
|
||||||
{
|
readonly property SMS data: SMS {
|
||||||
property SMS data: SMS {
|
|
||||||
id: sms
|
id: sms
|
||||||
device: root.device
|
device: root.device
|
||||||
}
|
}
|
||||||
|
@ -274,7 +262,7 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//RemoteKeyboard
|
// RemoteKeyboard
|
||||||
PlasmaComponents.ItemDelegate {
|
PlasmaComponents.ItemDelegate {
|
||||||
visible: remoteKeyboard.remoteState
|
visible: remoteKeyboard.remoteState
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -288,7 +276,7 @@ PlasmaComponents.ItemDelegate
|
||||||
text: i18n("Remote Keyboard")
|
text: i18n("Remote Keyboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteKeyboard {
|
KDEConnect.RemoteKeyboard {
|
||||||
id: remoteKeyboard
|
id: remoteKeyboard
|
||||||
device: root.device
|
device: root.device
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -296,9 +284,9 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Notifications
|
// Notifications
|
||||||
PlasmaComponents.ItemDelegate {
|
PlasmaComponents.ItemDelegate {
|
||||||
visible: notificationsModel.count>0
|
visible: notificationsModel.count > 0
|
||||||
enabled: true
|
enabled: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
@ -314,19 +302,23 @@ PlasmaComponents.ItemDelegate
|
||||||
visible: notificationsModel.isAnyDimissable;
|
visible: notificationsModel.isAnyDimissable;
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
icon.name: "edit-clear-history"
|
icon.name: "edit-clear-history"
|
||||||
ToolTip.text: i18n("Dismiss all notifications")
|
PlasmaComponents.ToolTip.text: i18n("Dismiss all notifications")
|
||||||
onClicked: notificationsModel.dismissAll();
|
onClicked: notificationsModel.dismissAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: notificationsView
|
id: notificationsView
|
||||||
model: NotificationsModel {
|
|
||||||
|
model: KDEConnect.NotificationsModel {
|
||||||
id: notificationsModel
|
id: notificationsModel
|
||||||
deviceId: root.device.id()
|
deviceId: root.device.id()
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: PlasmaComponents.ItemDelegate {
|
delegate: PlasmaComponents.ItemDelegate {
|
||||||
id: listitem
|
id: listitem
|
||||||
|
|
||||||
enabled: true
|
enabled: true
|
||||||
onClicked: checked = !checked
|
onClicked: checked = !checked
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -349,7 +341,7 @@ PlasmaComponents.ItemDelegate
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: notificationLabel
|
id: notificationLabel
|
||||||
text: appName + ": " + (title.length>0 ? (appName==title?notitext:title+": "+notitext) : model.name)
|
text: appName + ": " + (title.length > 0 ? (appName == title ? notitext : title + ": " + notitext) : model.name)
|
||||||
elide: listitem.checked ? Text.ElideNone : Text.ElideRight
|
elide: listitem.checked ? Text.ElideNone : Text.ElideRight
|
||||||
maximumLineCount: listitem.checked ? 0 : 1
|
maximumLineCount: listitem.checked ? 0 : 1
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
@ -361,7 +353,7 @@ PlasmaComponents.ItemDelegate
|
||||||
visible: repliable
|
visible: repliable
|
||||||
enabled: repliable && !replying
|
enabled: repliable && !replying
|
||||||
icon.name: "mail-reply-sender"
|
icon.name: "mail-reply-sender"
|
||||||
ToolTip.text: i18n("Reply")
|
PlasmaComponents.ToolTip.text: i18n("Reply")
|
||||||
onClicked: { replying = true; replyTextField.forceActiveFocus(); }
|
onClicked: { replying = true; replyTextField.forceActiveFocus(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +363,7 @@ PlasmaComponents.ItemDelegate
|
||||||
enabled: dismissable
|
enabled: dismissable
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
icon.name: "window-close"
|
icon.name: "window-close"
|
||||||
ToolTip.text: i18n("Dismiss")
|
PlasmaComponents.ToolTip.text: i18n("Dismiss")
|
||||||
onClicked: dbusInterface.dismiss();
|
onClicked: dbusInterface.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,12 +393,12 @@ PlasmaComponents.ItemDelegate
|
||||||
placeholderText: i18nc("@info:placeholder", "Reply to %1…", appName)
|
placeholderText: i18nc("@info:placeholder", "Reply to %1…", appName)
|
||||||
wrapMode: TextEdit.Wrap
|
wrapMode: TextEdit.Wrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Keys.onPressed: {
|
Keys.onPressed: event => {
|
||||||
if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
|
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
|
||||||
replySendButton.clicked();
|
replySendButton.clicked();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
if (event.key == Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
replyCancelButton.clicked();
|
replyCancelButton.clicked();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
|
@ -431,13 +423,13 @@ PlasmaComponents.ItemDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteCommands {
|
RemoteCommands {
|
||||||
id: rc
|
id: remoteCommands
|
||||||
device: root.device
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
RowLayout {
|
RowLayout {
|
||||||
visible: rc.available
|
visible: remoteCommands.available
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
@ -446,25 +438,28 @@ PlasmaComponents.ItemDelegate
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents.Button
|
PlasmaComponents.Button {
|
||||||
{
|
|
||||||
id: addCommandButton
|
id: addCommandButton
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
ToolTip.text: i18n("Add command")
|
PlasmaComponents.ToolTip.text: i18n("Add command")
|
||||||
onClicked: rc.plugin.editCommands()
|
onClicked: remoteCommands.plugin.editCommands()
|
||||||
visible: rc.plugin && rc.plugin.canAddCommand
|
visible: remoteCommands.plugin?.canAddCommand ?? false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: commandsView
|
id: commandsView
|
||||||
visible: rc.available
|
|
||||||
model: RemoteCommandsModel {
|
visible: remoteCommands.available
|
||||||
|
|
||||||
|
model: KDEConnect.RemoteCommandsModel {
|
||||||
id: commandsModel
|
id: commandsModel
|
||||||
deviceId: rc.device.id()
|
deviceId: remoteCommands.device.id()
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: PlasmaComponents.ItemDelegate {
|
delegate: PlasmaComponents.ItemDelegate {
|
||||||
enabled: true
|
enabled: true
|
||||||
onClicked: rc.plugin.triggerCommand(key)
|
onClicked: remoteCommands.plugin?.triggerCommand(key)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
contentItem: PlasmaComponents.Label {
|
contentItem: PlasmaComponents.Label {
|
||||||
|
|
|
@ -1,28 +1,32 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "findmyphone"
|
pluginName: "findmyphone"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant findMyPhone: null
|
property KDEConnect.FindMyPhoneDbusInterface findMyPhone
|
||||||
|
|
||||||
function ring() {
|
function ring(): void {
|
||||||
if (findMyPhone) {
|
if (findMyPhone) {
|
||||||
findMyPhone.ring();
|
findMyPhone.ring();
|
||||||
}
|
}
|
||||||
|
@ -30,9 +34,9 @@ QtObject {
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available) {
|
||||||
findMyPhone = FindMyPhoneDbusInterfaceFactory.create(device.id())
|
findMyPhone = KDEConnect.FindMyPhoneDbusInterfaceFactory.create(device.id());
|
||||||
} else {
|
} else {
|
||||||
findMyPhone = null
|
findMyPhone = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,43 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls as QQC2
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import org.kde.config as KConfig
|
||||||
|
import org.kde.kcmutils as KCMUtils
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.plasma.components as PlasmaComponents3
|
import org.kde.plasma.components as PlasmaComponents3
|
||||||
import org.kde.plasma.extras as PlasmaExtras
|
import org.kde.plasma.extras as PlasmaExtras
|
||||||
import org.kde.kdeconnect as KdeConnect
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import org.kde.kquickcontrolsaddons
|
|
||||||
import org.kde.kirigami as Kirigami
|
|
||||||
import org.kde.kcmutils as KCMUtils
|
|
||||||
import org.kde.config as KConfig
|
|
||||||
|
|
||||||
PlasmaExtras.Representation {
|
PlasmaExtras.Representation {
|
||||||
id: kdeconnect
|
id: kdeconnect
|
||||||
|
|
||||||
property alias devicesModel: devicesView.model
|
property alias devicesModel: devicesView.model
|
||||||
|
|
||||||
collapseMarginsHint: true
|
collapseMarginsHint: true
|
||||||
|
|
||||||
KdeConnect.DevicesModel {
|
KDEConnect.DevicesModel {
|
||||||
id: allDevicesModel
|
id: allDevicesModel
|
||||||
}
|
}
|
||||||
KdeConnect.DevicesModel {
|
|
||||||
|
KDEConnect.DevicesModel {
|
||||||
id: pairedDevicesModel
|
id: pairedDevicesModel
|
||||||
displayFilter: KdeConnect.DevicesModel.Paired
|
displayFilter: KDEConnect.DevicesModel.Paired
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents3.ScrollView {
|
PlasmaComponents3.ScrollView {
|
||||||
id: dialogItem
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
id: devicesView
|
id: devicesView
|
||||||
|
|
||||||
spacing: Kirigami.Units.smallSpacing
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
delegate: DeviceDelegate {
|
delegate: DeviceDelegate {
|
||||||
|
@ -55,16 +58,16 @@ PlasmaExtras.Representation {
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
if (pairedDevicesModel.count >= 0) {
|
if (pairedDevicesModel.count >= 0) {
|
||||||
return pairedDevicesModel.count == 0 ? i18n("No paired devices") : i18np("Paired device is unavailable", "All paired devices are unavailable", pairedDevicesModel.count)
|
return pairedDevicesModel.count === 0 ? i18n("No paired devices") : i18np("Paired device is unavailable", "All paired devices are unavailable", pairedDevicesModel.count)
|
||||||
} else if (allDevicesModel.count == 0) {
|
} else if (allDevicesModel.count === 0) {
|
||||||
return i18n("Install KDE Connect on your Android device to integrate it with Plasma!")
|
return i18n("Install KDE Connect on your Android device to integrate it with Plasma!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
helpfulAction: Action {
|
helpfulAction: QQC2.Action {
|
||||||
text: i18n("Pair a Device…")
|
text: i18n("Pair a Device…")
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
onTriggered: KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect")
|
onTriggered: KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect")
|
||||||
enabled: pairedDevicesModel.count == 0 && KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
|
enabled: pairedDevicesModel.count === 0 && KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents3.Button {
|
PlasmaComponents3.Button {
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "remotecommands"
|
pluginName: "remotecommands"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant plugin: available ? RemoteCommandsDbusInterfaceFactory.create(device.id()) : null
|
property KDEConnect.RemoteCommandsDbusInterface plugin:
|
||||||
|
available ? KDEConnect.RemoteCommandsDbusInterfaceFactory.create(device.id()) : null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez <aleixpol@kde.org>
|
* SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "sms"
|
pluginName: "sms"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property variant plugin: available ? SmsDbusInterfaceFactory.create(device.id()) : null
|
readonly property KDEConnect.SmsDbusInterface plugin:
|
||||||
|
available ? KDEConnect.SmsDbusInterfaceFactory.create(device.id()) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,42 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "sftp"
|
pluginName: "sftp"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant sftp: null
|
property KDEConnect.SftpDbusInterface sftp
|
||||||
|
|
||||||
function browse() {
|
function browse(): void {
|
||||||
if (sftp)
|
if (sftp) {
|
||||||
sftp.startBrowsing();
|
sftp.startBrowsing();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onAvailableChanged: {
|
onAvailableChanged: {
|
||||||
if (available) {
|
if (available) {
|
||||||
sftp = SftpDbusInterfaceFactory.create(device.id())
|
sftp = KDEConnect.SftpDbusInterfaceFactory.create(device.id());
|
||||||
} else {
|
} else {
|
||||||
sftp = null
|
sftp = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias device: checker.device
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "share"
|
pluginName: "share"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant plugin: available ? ShareDbusInterfaceFactory.create(device.id()) : null
|
property KDEConnect.ShareDbusInterface plugin:
|
||||||
|
available ? KDEConnect.ShareDbusInterfaceFactory.create(device.id()) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2021 Aleix Pol i Gonzalez <aleixpol@kde.org>
|
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick
|
pragma ComponentBehavior: Bound
|
||||||
import org.kde.plasma.core as PlasmaCore
|
|
||||||
import org.kde.kdeconnect
|
import QtQuick
|
||||||
|
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property KDEConnect.DeviceDbusInterface device
|
||||||
|
|
||||||
QtObject
|
|
||||||
{
|
|
||||||
property alias device: checker.device
|
|
||||||
readonly property alias available: checker.available
|
readonly property alias available: checker.available
|
||||||
|
|
||||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
readonly property KDEConnect.PluginChecker pluginChecker: KDEConnect.PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
pluginName: "virtualmonitor"
|
pluginName: "virtualmonitor"
|
||||||
|
device: root.device
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject plugin: available ? VirtualmonitorDbusInterfaceFactory.create(device.id()) : null
|
readonly property KDEConnect.VirtualmonitorDbusInterface plugin:
|
||||||
|
available ? KDEConnect.VirtualmonitorDbusInterfaceFactory.create(device.id()) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,65 +1,61 @@
|
||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@kde.org>
|
* SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
|
import org.kde.config as KConfig
|
||||||
|
import org.kde.kcmutils as KCMUtils
|
||||||
|
import org.kde.kdeconnect as KDEConnect
|
||||||
|
import org.kde.kquickcontrolsaddons as KQuickControlsAddons
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.plasmoid
|
import org.kde.plasma.plasmoid
|
||||||
import org.kde.kquickcontrolsaddons
|
|
||||||
import org.kde.kdeconnect
|
|
||||||
import org.kde.kcmutils as KCMUtils
|
|
||||||
import org.kde.config as KConfig
|
|
||||||
|
|
||||||
PlasmoidItem
|
PlasmoidItem {
|
||||||
{
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge
|
readonly property bool inPanel: [
|
||||||
|| plasmoid.location == PlasmaCore.Types.RightEdge
|
PlasmaCore.Types.TopEdge,
|
||||||
|| plasmoid.location == PlasmaCore.Types.BottomEdge
|
PlasmaCore.Types.RightEdge,
|
||||||
|| plasmoid.location == PlasmaCore.Types.LeftEdge)
|
PlasmaCore.Types.BottomEdge,
|
||||||
|
PlasmaCore.Types.LeftEdge,
|
||||||
|
].includes(Plasmoid.location)
|
||||||
|
|
||||||
DevicesModel {
|
KDEConnect.DevicesModel {
|
||||||
id: connectDeviceModel
|
id: connectedDeviceModel
|
||||||
displayFilter: DevicesModel.Paired | DevicesModel.Reachable
|
displayFilter: KDEConnect.DevicesModel.Paired | KDEConnect.DevicesModel.Reachable
|
||||||
}
|
}
|
||||||
|
|
||||||
DevicesModel {
|
KDEConnect.DevicesModel {
|
||||||
id: pairedDeviceModel
|
id: pairedDeviceModel
|
||||||
displayFilter: DevicesModel.Paired
|
displayFilter: KDEConnect.DevicesModel.Paired
|
||||||
}
|
}
|
||||||
|
|
||||||
Plasmoid.icon: {
|
Plasmoid.icon: inPanel
|
||||||
let iconName = "kdeconnect-tray";
|
? "kdeconnect-tray-symbolic"
|
||||||
|
: "kdeconnect-tray"
|
||||||
|
|
||||||
if (inPanel) {
|
Plasmoid.status: connectedDeviceModel.count > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
|
||||||
return "kdeconnect-tray-symbolic";
|
|
||||||
}
|
|
||||||
|
|
||||||
return iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
Binding {
|
|
||||||
target: plasmoid
|
|
||||||
property: "status"
|
|
||||||
value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
fullRepresentation: FullRepresentation {
|
fullRepresentation: FullRepresentation {
|
||||||
devicesModel: connectDeviceModel
|
devicesModel: connectedDeviceModel
|
||||||
}
|
}
|
||||||
|
|
||||||
compactRepresentation: CompactRepresentation {
|
compactRepresentation: CompactRepresentation {
|
||||||
|
plasmoidItem: root
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.Action {
|
PlasmaCore.Action {
|
||||||
id: configureAction
|
id: configureAction
|
||||||
text: i18n("KDE Connect Settings…")
|
text: i18n("KDE Connect Settings…")
|
||||||
icon.name: "configure"
|
icon.name: "configure"
|
||||||
visible: KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect");
|
visible: KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
|
||||||
onTriggered: {
|
onTriggered: checked => {
|
||||||
KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect");
|
KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue