Home
Phabricator
Search
Log In
Files
F2049744
kcm.patch
jgrulich (Jan Grulich)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Author
jgrulich
Created
Jan 16 2017, 8:18 AM
Size
13 KB
Mime Type
text/x-diff
Engine
blob
Format
Raw Data
Handle
1168329
Attached To
D4153: Network manager configuration model is unreadable
kcm.patch
View Options
diff --git a/kcm/CMakeLists.txt b/kcm/CMakeLists.txt
index 8de2c32..daaef06 100755
--- a/kcm/CMakeLists.txt
+++ b/kcm/CMakeLists.txt
@@ -38,6 +38,7 @@ install( FILES
qml/ConnectionItem.qml
qml/Dialog.qml
qml/Header.qml
+ qml/ListItem.qml
qml/main.qml
DESTINATION ${DATA_INSTALL_DIR}/kcm_networkmanagement/qml)
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index 5ddf132..4e052c8 100755
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -77,6 +77,11 @@ KCMNetworkmanagement::KCMNetworkmanagement(QWidget *parent, const QVariantList &
QVBoxLayout *layout = new QVBoxLayout(m_ui->connectionView);
layout->addWidget(widget);
+ m_quickView->rootContext()->setContextProperty("alternateBaseColor", mainWidget->palette().color(QPalette::Active, QPalette::AlternateBase));
+ m_quickView->rootContext()->setContextProperty("backgroundColor", mainWidget->palette().color(QPalette::Active, QPalette::Window));
+ m_quickView->rootContext()->setContextProperty("baseColor", mainWidget->palette().color(QPalette::Active, QPalette::Base));
+ m_quickView->rootContext()->setContextProperty("highlightColor", mainWidget->palette().color(QPalette::Active, QPalette::Highlight));
+ m_quickView->rootContext()->setContextProperty("textColor", mainWidget->palette().color(QPalette::Active, QPalette::Text));
m_quickView->setResizeMode(QQuickView::SizeRootObjectToView);
m_quickView->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kcm_networkmanagement/qml/main.qml"))));
diff --git a/kcm/qml/ConnectionItem.qml b/kcm/qml/ConnectionItem.qml
index 5217889..6667f1b 100644
--- a/kcm/qml/ConnectionItem.qml
+++ b/kcm/qml/ConnectionItem.qml
@@ -23,7 +23,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
-PlasmaComponents.ListItem {
+ListItem {
id: connectionItem
checked: mouseArea.containsMouse || ConnectionPath === connectionView.currentConnectionPath
@@ -39,7 +39,6 @@ PlasmaComponents.ListItem {
left: parent.left
right: parent.right
top: parent.top
- // Reset top margin from PlasmaComponents.ListItem
topMargin: -Math.round(units.gridUnit / 3)
}
height: Math.max(units.iconSizes.medium, connectionNameLabel.height + connectionStatusLabel.height) + Math.round(units.gridUnit / 2)
@@ -53,9 +52,10 @@ PlasmaComponents.ListItem {
}
height: units.iconSizes.medium; width: height
source: KcmConnectionIcon
+ usesPlasmaTheme: false
}
- PlasmaComponents.Label {
+ Text {
id: connectionNameLabel
anchors {
@@ -64,6 +64,7 @@ PlasmaComponents.ListItem {
leftMargin: Math.round(units.gridUnit / 2)
right: connectingIndicator.visible ? connectingIndicator.left : parent.right
}
+ color: textColor
height: paintedHeight
elide: Text.ElideRight
font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal
@@ -72,7 +73,7 @@ PlasmaComponents.ListItem {
textFormat: Text.PlainText
}
- PlasmaComponents.Label {
+ Text {
id: connectionStatusLabel
anchors {
@@ -81,6 +82,7 @@ PlasmaComponents.ListItem {
right: connectingIndicator.visible ? connectingIndicator.left : parent.right
top: connectionNameLabel.bottom
}
+ color: textColor
height: paintedHeight
elide: Text.ElideRight
font.pointSize: theme.smallestFont.pointSize
diff --git a/kcm/qml/Dialog.qml b/kcm/qml/Dialog.qml
index f647f52..815ca03 100644
--- a/kcm/qml/Dialog.qml
+++ b/kcm/qml/Dialog.qml
@@ -20,7 +20,7 @@
import QtQuick 2.3
import QtQuick.Dialogs 1.2
-import org.kde.plasma.components 2.0 as PlasmaComponents
+import QtQuick.Controls 1.2 as QtControls
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
@@ -39,10 +39,6 @@ Dialog {
id: connectionModel
}
- SystemPalette {
- id: palette
- }
-
Rectangle {
id: background
anchors.fill: parent
@@ -76,7 +72,7 @@ Dialog {
boundsBehavior: Flickable.StopAtBounds
section.property: "ConnectionTypeSection"
section.delegate: Header { text: section }
- delegate: PlasmaComponents.ListItem {
+ delegate: ListItem {
checked: mouseArea.containsMouse || view.currentlySelectedIndex == index
height: connectionTypeBase.height
@@ -103,7 +99,7 @@ Dialog {
source: ConnectionIcon
}
- PlasmaComponents.Label {
+ Text {
id: connectionNameLabel
anchors {
@@ -113,13 +109,14 @@ Dialog {
right: parent.right
verticalCenter: ConnectionType == 11 ? undefined : parent.verticalCenter
}
+ color: textColor
height: paintedHeight
elide: Text.ElideRight
text: ConnectionTypeName
textFormat: Text.PlainText
}
- PlasmaComponents.Label {
+ Text {
id: connectionDescriptionLabel
anchors {
@@ -128,6 +125,7 @@ Dialog {
right: parent.right
top: connectionNameLabel.bottom
}
+ color: textColor
height: visible ? paintedHeight : 0
elide: Text.ElideRight
font.pointSize: theme.smallestFont.pointSize
@@ -169,7 +167,7 @@ Dialog {
}
spacing: Math.round(units.gridUnit / 2)
- PlasmaComponents.Button {
+ QtControls.Button {
id: createButton
enabled: false
text: i18n("Create")
@@ -180,7 +178,7 @@ Dialog {
}
}
- PlasmaComponents.Button {
+ QtControls.Button {
id: closeButton
text: i18n("Close")
diff --git a/kcm/qml/Header.qml b/kcm/qml/Header.qml
index 3f9a34e..3364c0c 100644
--- a/kcm/qml/Header.qml
+++ b/kcm/qml/Header.qml
@@ -21,7 +21,7 @@
import QtQuick 2.2
import org.kde.plasma.components 2.0 as PlasmaComponents
-PlasmaComponents.ListItem {
+ListItem {
id: header
property alias text: headerLabel.text
@@ -30,10 +30,11 @@ PlasmaComponents.ListItem {
width: parent.width
sectionDelegate: true
- PlasmaComponents.Label {
+ Text {
id: headerLabel
anchors.centerIn: parent
+ color: textColor
height: paintedHeight
font.weight: Font.DemiBold
}
diff --git a/kcm/qml/ListItem.qml b/kcm/qml/ListItem.qml
new file mode 100644
index 0000000..3d5da48
--- /dev/null
+++ b/kcm/qml/ListItem.qml
@@ -0,0 +1,93 @@
+/*
+ Copyright 2010 Marco Martin <notmart@gmail.com>
+ Copyright 2016 Jan Grulich <jgrulich@redhat.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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 6 of version 3 of the license.
+
+ 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+import QtQuick 2.1
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+Item {
+ id: listItem
+
+ default property alias content: paddingItem.data
+ property alias containsMouse: itemMouse.containsMouse
+ property alias enabled: itemMouse.enabled
+ property bool checked: false
+ property bool sectionDelegate: false
+
+ signal clicked
+
+ width: parent ? parent.width : childrenRect.width
+ height: paddingItem.childrenRect.height + background.margins.top + background.margins.bottom
+
+ implicitHeight: paddingItem.childrenRect.height + Math.round(units.gridUnit / 2)
+
+ Connections {
+ target: listItem
+ onCheckedChanged: background.color = (listItem.checked ? highlightColor : baseColor)
+ onSectionDelegateChanged: background.color = (listItem.sectionDelegate ? alternateBaseColor : baseColor)
+ }
+
+ Rectangle {
+ id : background
+
+ anchors.fill: parent
+ visible: listItem.ListView.view ? listItem.ListView.view.highlight === null : true
+ opacity: itemMouse.containsMouse && !itemMouse.pressed ? 0.5 : 1
+ Component.onCompleted: {
+ color = (listItem.sectionDelegate ? alternateBaseColor : (listItem.checked ? highlightColor : baseColor))
+ }
+ Behavior on opacity { NumberAnimation { duration: units.longDuration } }
+ }
+
+ PlasmaCore.SvgItem {
+ svg: PlasmaCore.Svg {imagePath: "widgets/listitem"}
+ elementId: "separator"
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ }
+ height: naturalSize.height
+ visible: listItem.sectionDelegate || (typeof(index) != "undefined" && index > 0 && !listItem.checked && !itemMouse.pressed)
+ }
+
+ MouseArea {
+ id: itemMouse
+ property bool changeBackgroundOnPress: !listItem.checked && !listItem.sectionDelegate
+ anchors.fill: background
+ enabled: false
+
+ onClicked: listItem.clicked()
+ onPressAndHold: listItem.pressAndHold()
+ onPressed: if (changeBackgroundOnPress) background.prefix = "pressed"
+ onReleased: if (changeBackgroundOnPress) background.prefix = "normal"
+ onCanceled: if (changeBackgroundOnPress) background.prefix = "normal"
+
+ Item {
+ id: paddingItem
+ anchors {
+ fill: parent
+ margins: Math.round(units.gridUnit / 3)
+ }
+ }
+ }
+
+ Accessible.role: Accessible.ListItem
+}
diff --git a/kcm/qml/main.qml b/kcm/qml/main.qml
index aa9003c..ba8a311 100755
--- a/kcm/qml/main.qml
+++ b/kcm/qml/main.qml
@@ -20,8 +20,8 @@
import QtQuick 2.1
import QtQuick.Dialogs 1.1
+import QtQuick.Controls 1.2 as QtControls
import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
@@ -35,15 +35,11 @@ Item {
signal requestCreateConnection(int type, string vpnType, string specificType, bool shared)
signal requestExportConnection(string connection)
- SystemPalette {
- id: palette
- }
-
Rectangle {
id: background
anchors.fill: parent
focus: true
- color: palette.base
+ color: baseColor
}
PlasmaNM.Handler {
@@ -60,7 +56,7 @@ Item {
sourceModel: connectionModel
}
- PlasmaComponents.TextField {
+ QtControls.TextField {
id: searchField
anchors {
@@ -129,10 +125,10 @@ Item {
}
spacing: Math.round(units.gridUnit / 2)
- PlasmaComponents.ToolButton {
+ QtControls.ToolButton {
id: addConnectionButton
- iconSource: "list-add"
+ iconName: "list-add"
tooltip: i18n("Add new connection")
onClicked: {
@@ -140,11 +136,11 @@ Item {
}
}
- PlasmaComponents.ToolButton {
+ QtControls.ToolButton {
id: removeConnectionButton
enabled: connectionView.currentConnectionPath && connectionView.currentConnectionPath.length
- iconSource: "list-remove"
+ iconName: "list-remove"
tooltip: i18n("Remove selected connection")
onClicked: {
@@ -154,11 +150,11 @@ Item {
}
}
- PlasmaComponents.ToolButton {
+ QtControls.ToolButton {
id: exportConnectionButton
enabled: connectionView.currentConnectionExportable
- iconSource: "document-export"
+ iconName: "document-export"
tooltip: i18n("Export selected connection")
onClicked: {
Log In to Comment