Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bart Ribbers
Plasma Bigscreen
Commits
0ac6c88c
Commit
0ac6c88c
authored
Apr 03, 2020
by
Aditya Mehra
Browse files
Add KDE Connect Indicator and KCM
parent
751dc14a
Changes
20
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
0ac6c88c
...
...
@@ -21,6 +21,7 @@
-
KIO
-
Wayland
-
WindowSystem
-
KDEConnect
-
QT Dependencies:
-
Quick
...
...
containments/homescreen/package/contents/ui/indicators/KdeConnect.qml
0 → 100644
View file @
0ac6c88c
import
QtQuick
2.9
import
QtQuick
.
Window
2.3
import
QtQuick
.
Layouts
1.3
import
QtQml
.
Models
2.2
import
QtQuick
.
Controls
2.2
as
Controls
import
org
.
kde
.
kirigami
2.11
as
Kirigami
import
org
.
kde
.
kdeconnect
1.0
as
KDEConnect
AbstractIndicator
{
id
:
connectionIcon
icon.name
:
"
kdeconnect
"
property
var
window
KDEConnect.DevicesModel
{
id
:
allDevicesModel
}
Repeater
{
model
:
allDevicesModel
delegate
:
Item
{
property
bool
pairingRequest
:
device
.
hasPairingRequests
onPairingRequestChanged
:
{
if
(
pairingRequest
)
{
var
component
=
Qt
.
createComponent
(
"
PairWindow.qml
"
);
if
(
component
.
status
!=
Component
.
Ready
)
{
if
(
component
.
status
==
Component
.
Error
)
{
console
.
debug
(
"
Error:
"
+
component
.
errorString
());
}
return
;
}
else
{
window
=
component
.
createObject
(
"
root
"
,
{
currentDevice
:
device
})
window
.
show
()
}
}
else
{
console
.
log
(
"
pairing request timedout/closed
"
)
window
.
close
()
}
}
}
}
onClicked
:
{
feedbackWindow
.
open
(
i18n
(
"
KDE Connect
"
),
"
kdeconnect
"
);
plasmoid
.
nativeInterface
.
executeCommand
(
"
plasma-settings -s -m kcm_mediacenter_kdeconnect
"
)
}
}
containments/homescreen/package/contents/ui/indicators/PairWindow.qml
0 → 100644
View file @
0ac6c88c
import
QtQuick
2.9
import
QtQuick
.
Window
2.3
import
QtQuick
.
Layouts
1.3
import
QtQuick
.
Controls
2.2
as
Controls
import
org
.
kde
.
kirigami
2.11
as
Kirigami
import
org
.
kde
.
kdeconnect
1.0
as
KDEConnect
Window
{
id
:
root
property
QtObject
currentDevice
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.8
)
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
Complementary
onVisibleChanged
:
{
if
(
visible
){
showMaximized
()
acceptButton
.
forceActiveFocus
()
}
}
Item
{
id
:
contentItem
anchors.fill
:
parent
ColumnLayout
{
id
:
pairingDialogLayout
anchors.centerIn
:
parent
Kirigami.Heading
{
level
:
3
text
:
"
Pairing Request From
"
+
currentDevice
.
name
}
RowLayout
{
Layout.fillWidth
:
true
Controls.Button
{
id
:
acceptButton
Layout.fillWidth
:
true
KeyNavigation.right
:
rejectButton
KeyNavigation.left
:
acceptButton
background
:
Rectangle
{
color
:
acceptButton
.
activeFocus
?
Kirigami
.
Theme
.
highlightColor
:
Kirigami
.
Theme
.
backgroundColor
}
contentItem
:
Item
{
RowLayout
{
anchors.centerIn
:
parent
Kirigami.Icon
{
Layout.preferredWidth
:
Kirigami
.
Units
.
iconSizes
.
small
Layout.preferredHeight
:
Kirigami
.
Units
.
iconSizes
.
small
source
:
"
dialog-ok
"
}
Controls.Label
{
text
:
i18n
(
"
Accept
"
)
}
}
}
onClicked
:
{
currentDevice
.
acceptPairing
()
root
.
close
()
}
Keys.onReturnPressed
:
{
clicked
()
}
}
Controls.Button
{
id
:
rejectButton
Layout.fillWidth
:
true
KeyNavigation.right
:
rejectButton
KeyNavigation.left
:
acceptButton
background
:
Rectangle
{
color
:
rejectButton
.
activeFocus
?
Kirigami
.
Theme
.
highlightColor
:
Kirigami
.
Theme
.
backgroundColor
}
contentItem
:
Item
{
RowLayout
{
anchors.centerIn
:
parent
Kirigami.Icon
{
Layout.preferredWidth
:
Kirigami
.
Units
.
iconSizes
.
small
Layout.preferredHeight
:
Kirigami
.
Units
.
iconSizes
.
small
source
:
"
dialog-canel
"
}
Controls.Label
{
text
:
i18n
(
"
Reject
"
)
}
}
}
onClicked
:
{
currentDevice
.
rejectPairing
()
root
.
close
()
}
Keys.onReturnPressed
:
{
clicked
()
}
}
}
}
}
}
containments/homescreen/package/contents/ui/main.qml
View file @
0ac6c88c
...
...
@@ -171,6 +171,17 @@ Item {
sourceComponent
:
MycroftIndicator
{}
}
Indicators.KdeConnect
{
id
:
kdeconnectIndicator
Layout.fillHeight
:
true
implicitWidth
:
height
KeyNavigation.down
:
launcher
KeyNavigation.right
:
volumeIndicator
KeyNavigation.tab
:
volumeIndicator
KeyNavigation.backtab
:
launcher
KeyNavigation.left
:
kdeconnectIndicator
}
Indicators.Volume
{
id
:
volumeIndicator
Layout.fillHeight
:
true
...
...
@@ -179,7 +190,7 @@ Item {
KeyNavigation.right
:
wifiIndicator
KeyNavigation.tab
:
wifiIndicator
KeyNavigation.backtab
:
launcher
KeyNavigation.left
:
volume
Indicator
KeyNavigation.left
:
kdeconnect
Indicator
}
Indicators.Wifi
{
...
...
kcms/CMakeLists.txt
View file @
0ac6c88c
add_subdirectory
(
audio-device-chooser
)
add_subdirectory
(
plasma-settings-shell
)
add_subdirectory
(
wifi
)
add_subdirectory
(
kdeconnect
)
kcms/kdeconnect/CMakeLists.txt
0 → 100644
View file @
0ac6c88c
include
(
ECMQMLModules
)
ecm_find_qmlmodule
(
org.kde.plasma.core 2.0
)
# KI18N Translation Domain for this library.
add_definitions
(
-DTRANSLATION_DOMAIN=\"kcm_mediacenter_kdeconnect\"
)
########### next target ###############
set
(
kcm_mediacenter_kdeconnect_PART_SRCS kdeconnect.cpp
)
add_library
(
kcm_mediacenter_kdeconnect MODULE
${
kcm_mediacenter_kdeconnect_PART_SRCS
}
)
target_link_libraries
(
kcm_mediacenter_kdeconnect
KF5::I18n
KF5::KCMUtils
KF5::QuickAddons
)
kcoreaddons_desktop_to_json
(
kcm_mediacenter_kdeconnect
"mediacenter_kdeconnect.desktop"
)
########### install files ###############
install
(
TARGETS kcm_mediacenter_kdeconnect DESTINATION
${
KDE_INSTALL_PLUGINDIR
}
/kcms
)
install
(
FILES mediacenter_kdeconnect.desktop DESTINATION
${
KDE_INSTALL_KSERVICES5DIR
}
)
kpackage_install_package
(
package kcm_mediacenter_kdeconnect kcms
)
kcms/kdeconnect/Messages.sh
0 → 100644
View file @
0ac6c88c
#! /usr/bin/env bash
$XGETTEXT
`
find
.
-name
\*
.cpp
-o
-name
\*
.qml
`
-o
$podir
/kcm_mediacenter_kdeconnect.pot
kcms/kdeconnect/kdeconnect.cpp
0 → 100644
View file @
0ac6c88c
/*
* Copyright (C) 2019 Marco MArtin <mart@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include
"kdeconnect.h"
#include
<KAboutData>
#include
<KLocalizedString>
#include
<KPluginFactory>
#include
<KSharedConfig>
static
const
QString
configFile
=
QStringLiteral
(
"plasma-localerc"
);
static
const
QString
lcLanguage
=
QStringLiteral
(
"LANGUAGE"
);
KdeConnect
::
KdeConnect
(
QObject
*
parent
,
const
QVariantList
&
args
)
:
KQuickAddons
::
ConfigModule
(
parent
,
args
)
{
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kcm_mediacenter_kdeconnect"
),
i18n
(
"Configure KDE Connect"
),
QStringLiteral
(
"2.0"
),
QString
(),
KAboutLicense
::
LGPL
);
setAboutData
(
about
);
setButtons
(
Apply
|
Default
);
}
KdeConnect
::~
KdeConnect
()
{
}
void
KdeConnect
::
load
()
{
}
void
KdeConnect
::
save
()
{
}
void
KdeConnect
::
defaults
()
{
}
K_PLUGIN_CLASS_WITH_JSON
(
KdeConnect
,
"mediacenter_kdeconnect.json"
)
#include
"kdeconnect.moc"
kcms/kdeconnect/kdeconnect.h
0 → 100644
View file @
0ac6c88c
/*
* Copyright (C) 2019 Marco MArtin <mart@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WIFI_H
#define WIFI_H
#include
<KQuickAddons/ConfigModule>
#include
<KConfigGroup>
class
KdeConnect
:
public
KQuickAddons
::
ConfigModule
{
Q_OBJECT
public:
explicit
KdeConnect
(
QObject
*
parent
=
nullptr
,
const
QVariantList
&
list
=
QVariantList
());
~
KdeConnect
()
override
;
public
Q_SLOTS
:
void
load
()
override
;
void
save
()
override
;
void
defaults
()
override
;
private:
};
#endif
kcms/kdeconnect/mediacenter_kdeconnect.desktop
0 → 100644
View file @
0ac6c88c
[Desktop Entry]
Exec=plasma-settings -s -m kcm_mediacenter_kdeconnect
Icon=kdeconnect
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/kdeconnect/index.html
X-KDE-Library=kcm_mediacenter_kdeconnect
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=hardware
X-KDE-Weight=40
X-KDE-FormFactors=mediacenter
Name=KDE Connect
Name[ca]=KDE Connect
Name[ca@valencia]=KDE Connect
Name[cs]=KDE Connect
Name[es]=KDE Connect
Name[et]=KDE Connect
Name[it]=KDE Connect
Name[nl]=KDE Connect
Name[pt]=KDE Connect
Name[sk]=KDE Connect
Name[sv]=KDE Connect
Name[uk]=KDE Connect
Name[x-test]=xxWifixx
Name[zh_TW]=Wi-Fi
Comment=Connect and sync your devices
Comment[ca]=Connecta a les xarxes Wi-Fi
Comment[ca@valencia]=Connecta a les xarxes Wi-Fi
Comment[es]=Conectar a redes Wifi
Comment[et]=Ühendumine WiFi võrkudega
Comment[it]=Connettiti alle reti senza fili
Comment[nl]=Met WiFi-netwerken verbinden
Comment[pt]=Ligar a redes Wi-Fi
Comment[sv]=Anslut till WIFI-nätverk
Comment[uk]=З'єднання із мережами Wi-Fi
Comment[x-test]=xxConnect to Wifi networksxx
Comment[zh_TW]=連線至 Wi-Fi 網路
Categories=Qt;KDE;X-KDE-settings-wifi;
kcms/kdeconnect/package/contents/ui/DeviceConnectionView.qml
0 → 100644
View file @
0ac6c88c
/*
* Copyright 2020 Aditya Mehra <aix.m@outlook.com>
* Copyright 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* 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 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <https://www.gnu.org/licenses/>.
*/
import
QtQuick
2.9
import
QtQuick
.
Layouts
1.3
import
QtQuick
.
Controls
2.3
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents2
import
org
.
kde
.
plasma
.
components
3.0
as
PlasmaComponents
import
org
.
kde
.
kirigami
2.11
as
Kirigami
import
org
.
kde
.
mycroft
.
bigscreen
1.0
as
BigScreen
import
org
.
kde
.
kdeconnect
1.0
import
QtGraphicalEffects
1.0
import
"
delegates
"
as
Delegates
Rectangle
{
id
:
deviceView
color
:
Kirigami
.
Theme
.
backgroundColor
property
QtObject
currentDevice
property
bool
hasPairingRequests
:
deviceView
.
currentDevice
.
hasPairingRequests
property
bool
isTrusted
:
deviceView
.
currentDevice
.
isTrusted
property
bool
isReachable
:
deviceView
.
currentDevice
.
isReachable
onCurrentDeviceChanged
:
checkCurrentStatus
()
onHasPairingRequestsChanged
:
{
if
(
hasPairingRequests
)
{
checkCurrentStatus
()
}
}
onIsTrustedChanged
:
checkCurrentStatus
()
onIsReachableChanged
:
checkCurrentStatus
()
onActiveFocusChanged
:
{
if
(
activeFocus
){
deviceStatView
.
forceActiveFocus
()
}
}
function
checkCurrentStatus
()
{
if
(
deviceView
.
currentDevice
.
hasPairingRequests
)
{
deviceStatView
.
currentIndex
=
1
}
else
if
(
deviceView
.
currentDevice
.
isReachable
)
{
if
(
deviceView
.
currentDevice
.
isTrusted
)
{
deviceIconStatus
.
source
=
deviceView
.
currentDevice
.
statusIconName
deviceStatView
.
currentIndex
=
2
}
else
{
deviceIconStatus
.
source
=
deviceView
.
currentDevice
.
iconName
deviceStatView
.
currentIndex
=
0
}
}
else
{
deviceStatView
.
currentIndex
=
3
}
}
ColumnLayout
{
id
:
colLayoutSettingsItem
anchors
{
top
:
parent
.
top
left
:
parent
.
left
right
:
parent
.
right
bottom
:
parent
.
bottom
margins
:
Kirigami
.
Units
.
largeSpacing
}
Item
{
Layout.fillWidth
:
true
Layout.preferredHeight
:
parent
.
height
/
3
Layout.alignment
:
Qt
.
AlignTop
RowLayout
{
id
:
headerAreaSettingsItem
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
backBtnSettingsItem
.
height
PlasmaComponents2.Button
{
id
:
backBtnSettingsItem
iconSource
:
"
arrow-left
"
Layout.alignment
:
Qt
.
AlignLeft
KeyNavigation.down
:
deviceStatView
PlasmaComponents2.Highlight
{
z
:
-
2
anchors.fill
:
parent
anchors.margins
:
-
Kirigami
.
Units
.
gridUnit
/
4
visible
:
backBtnSettingsItem
.
activeFocus
?
1
:
0
}
Keys.onReturnPressed
:
{
clicked
()
}
onClicked
:
{
connectionView
.
forceActiveFocus
()
}
}
Label
{
id
:
backbtnlabelHeading
text
:
"
Press the [←] Back button to return to device selection
"
wrapMode
:
Text
.
WordWrap
maximumLineCount
:
2
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignRight
}
}
Kirigami.Separator
{
id
:
headrSept
anchors.top
:
headerAreaSettingsItem
.
bottom
anchors.topMargin
:
Kirigami
.
Units
.
largeSpacing
*
2
width
:
parent
.
width
height
:
1
}
Rectangle
{
id
:
dIcon
anchors.top
:
headrSept
.
bottom
anchors.topMargin
:
Kirigami
.
Units
.
largeSpacing
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
Kirigami
.
Units
.
iconSizes
.
huge
height
:
width
radius
:
100
color
:
Kirigami
.
Theme
.
textColor
PlasmaCore.IconItem
{
id
:
deviceIconStatus
anchors.centerIn
:
parent
width
:
Kirigami
.
Units
.
iconSizes
.
large
height
:
width
source
:
currentDevice
.
iconName
}
}
Kirigami.Heading
{
id
:
label2
width
:
parent
.
width
anchors.top
:
dIcon
.
bottom
anchors.topMargin
:
Kirigami
.
Units
.
largeSpacing
horizontalAlignment
:
Text
.
AlignHCenter
wrapMode
:
Text
.
WordWrap
level
:
2
maximumLineCount
:
2
elide
:
Text
.
ElideRight
color
:
PlasmaCore
.
ColorScope
.
textColor
text
:
currentDevice
.
name
}
Kirigami.Separator
{
id
:
lblSept2
anchors.top
:
label2
.
bottom
anchors.topMargin
:
Kirigami
.
Units
.
smallSpacing
height
:
1
width
:
parent
.
width
}
StackLayout
{
id
:
deviceStatView
anchors.top
:
lblSept2
.
bottom
anchors.topMargin
:
Kirigami
.
Units
.
largeSpacing
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
currentIndex
:
0
onActiveFocusChanged
:
{
if
(
activeFocus
)
{
deviceStatView
.
itemAt
(
currentIndex
).
forceActiveFocus
();
}
}
Delegates.UnpairedView
{
id
:
unpairedView
}
Delegates.PairRequest
{
id
:
pairRequestView
}
Delegates.PairedView
{
id
:
pairedView
}
Delegates.Unreachable
{
id
:
unreachableView
}
}
}
}
}
kcms/kdeconnect/package/contents/ui/delegates/DeviceDelegate.qml
0 → 100644