on xenial help sign in
Removed deprecated Unity.IndicatorsLegacy plugin.

Approved by PS Jenkins bot, Michał Sawicz.

commit047ec1b82575bd356bcbdd1410fedc5af3565861 authorNick Dedekind <nicholas.dedekind@gmail.com> dateTue 1 Oct 2013, 18:17 (13 years ago) parentbfc301c4d86fb7
58 files changed+78−3495
Panel/Indicators/DatetimeIndicatorPage.qml−97 Panel/Indicators/DatetimeIndicatorWidget.qml−67 Panel/Indicators/DefaultIndicatorPage.qml+1−1 Panel/Indicators/DefaultIndicatorPage2.qml−25 Panel/Indicators/DefaultIndicatorWidget.qml+46−20 Panel/Indicators/DefaultIndicatorWidget2.qml−103 Panel/Indicators/MessagingIndicatorPage.qml−35 Panel/Indicators/MessagingIndicatorWidget.qml−25 Panel/Indicators/NetworkIndicatorPage.qml+2−3 Panel/Indicators/NetworkIndicatorPage2.qml−82 Panel/Indicators/NetworkIndicatorWidget.qml−112 Panel/Indicators/SoundIndicatorWidget.qml−26 Panel/Indicators/client/IndicatorsList.qml+12−9 Panel/IndicatorsDataModel.qml+9−23 plugins/Unity/CMakeLists.txt−1 plugins/Unity/Indicators/Messaging/qml/QuickReply.qml+1−1 plugins/Unity/Indicators/indicatorsmodel.cpp+5−3 plugins/Unity/IndicatorsLegacy/CMakeLists.txt−48 plugins/Unity/IndicatorsLegacy/Network/CMakeLists.txt−45 plugins/Unity/IndicatorsLegacy/Network/networkagent.cpp−146 plugins/Unity/IndicatorsLegacy/Network/networkagent.h−65 plugins/Unity/IndicatorsLegacy/Network/plugin.cpp−31 plugins/Unity/IndicatorsLegacy/Network/plugin.h−32 plugins/Unity/IndicatorsLegacy/Network/qml/AccessPoint.qml−68 plugins/Unity/IndicatorsLegacy/Network/qml/CMakeLists.txt−5 plugins/Unity/IndicatorsLegacy/Network/qml/PasswordPage.qml−88 plugins/Unity/IndicatorsLegacy/Network/qml/PasswordTextField.qml−68 plugins/Unity/IndicatorsLegacy/Network/qml/WifiSection.qml−34 plugins/Unity/IndicatorsLegacy/Network/qml/qmldir−9 plugins/Unity/IndicatorsLegacy/Network/secret-agent.c−382 plugins/Unity/IndicatorsLegacy/Network/secret-agent.h−102 plugins/Unity/IndicatorsLegacy/flatmenuproxymodel.cpp−288 plugins/Unity/IndicatorsLegacy/flatmenuproxymodel.h−93 plugins/Unity/IndicatorsLegacy/modelprinter.cpp−114 plugins/Unity/IndicatorsLegacy/modelprinter.h−50 plugins/Unity/IndicatorsLegacy/plugin.cpp−42 plugins/Unity/IndicatorsLegacy/plugin.h−32 plugins/Unity/IndicatorsLegacy/qml/BasicMenuItem.qml−48 plugins/Unity/IndicatorsLegacy/qml/ButtonMenuItem.qml−47 plugins/Unity/IndicatorsLegacy/qml/CMakeLists.txt−5 plugins/Unity/IndicatorsLegacy/qml/DivMenuItem.qml−26 plugins/Unity/IndicatorsLegacy/qml/HLine.qml−29 plugins/Unity/IndicatorsLegacy/qml/IndicatorBase.qml−59 plugins/Unity/IndicatorsLegacy/qml/IndicatorPage.qml−191 plugins/Unity/IndicatorsLegacy/qml/IndicatorWidget.qml−68 plugins/Unity/IndicatorsLegacy/qml/MenuAction.qml−86 plugins/Unity/IndicatorsLegacy/qml/MenuActionBinding.qml−106 plugins/Unity/IndicatorsLegacy/qml/MenuItem.qml−40 plugins/Unity/IndicatorsLegacy/qml/MenuItemFactory.qml−102 plugins/Unity/IndicatorsLegacy/qml/ProgressMenuItem.qml−65 plugins/Unity/IndicatorsLegacy/qml/RemoveBackground.qml−55 plugins/Unity/IndicatorsLegacy/qml/SectionMenuItem.qml−57 plugins/Unity/IndicatorsLegacy/qml/SliderMenuItem.qml−64 plugins/Unity/IndicatorsLegacy/qml/SwitchMenuItem.qml−43 plugins/Unity/IndicatorsLegacy/qml/qmldir−21 plugins/Unity/IndicatorsLegacy/resources/indicators.qrc−4 tests/autopilot/unity8/indicators_client/emulators/main_window.py+1−1 tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+1−3
Panel/Indicators/DatetimeIndicatorPage.qmldeleted−97
@@ -1,97 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Ubo Riboni <ugo.riboni@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−
24−Flickable {
25− id: page
26−
27− contentHeight: image.height
28−
29− Image {
30− id: image
31− anchors {
32− left: parent.left
33− right: parent.right
34− }
35− source: "../graphics/time_and_date@18.png"
36− fillMode: Image.PreserveAspectFit
37− }
38−
39− Item {
40− anchors {
41− top: parent.top
42− topMargin: units.gu(5)
43− left: parent.left
44− right: parent.right
45− }
46−
47− height: units.gu(30)
48−
49− Label {
50− id: timeLabel
51− anchors {
52− horizontalCenter: parent.horizontalCenter
53− verticalCenter: parent.verticalCenter
54− }
55−
56− text: ""
57− color: Theme.palette.selected.backgroundText
58− font.weight: Font.Light
59− font.pixelSize: units.gu(6)
60− }
61−
62− Label {
63− id: dateLabel
64−
65− anchors {
66− left: parent.left
67− leftMargin: units.gu(2)
68− bottom: parent.bottom
69− bottomMargin: units.gu(1.5)
70− }
71− text: ""
72− color: Theme.palette.selected.backgroundText
73− fontSize: "small"
74− }
75− }
76−
77− Timer {
78− interval: 1000 * 10 // 10 seconds
79− running: true
80− repeat: true
81− triggeredOnStart: true
82− onTriggered: updateTime();
83− }
84−
85− function updateTime() {
86− var dt = new Date();
87− var time = Qt.formatTime(dt);
88− var space = time.indexOf(" ");
89− timeLabel.text = time.substr(0, space > 0 ? space : 5);
90− dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM");
91− }
92−
93− // Make it compatible with the PluginItem interface
94− function start() {}
95− function stop() {}
96− function reset() {}
97−}
Panel/Indicators/DatetimeIndicatorWidget.qmldeleted−67
@@ -1,67 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.IndicatorsLegacy 0.1 as Indicators
23−
24−Indicators.IndicatorWidget {
25− id: indicatorWidget
26−
27− width: timeLabel.width + units.gu(1)
28− rootMenuType: "com.canonical.indicator.root.time"
29−
30− property alias label: timeLabel.text
31−
32− Label {
33− id: timeLabel
34− objectName: "timeLabel"
35− color: Theme.palette.selected.backgroundText
36− opacity: 0.8
37− font.family: "Ubuntu"
38− fontSize: "medium"
39− anchors.centerIn: parent
40− text: Qt.formatTime(timer.dateNow)
41− }
42−
43− Timer {
44− id: timer
45− interval: 1000 * 10
46− running: indicatorWidget.visible
47− repeat: true
48− triggeredOnStart: true
49− property date dateNow
50−
51− onTriggered: dateNow = new Date
52− }
53−
54− onActionStateChanged: {
55− if (action == undefined || !action.valid) {
56− enabled = false;
57− return;
58− }
59−
60− if (action.state == undefined) {
61− enabled = false;
62− return;
63− }
64−
65− enabled = action.state[3];
66− }
67−}
Panel/Indicators/DefaultIndicatorPage.qml+1−1
@@ -18,7 +18,7 @@
1818 */
1919
2020import QtQuick 2.0
21−import Unity.IndicatorsLegacy 0.1 as Indicators
21+import Unity.Indicators 0.1 as Indicators
2222
2323Indicators.IndicatorPage {
2424 anchors.fill: parent
Panel/Indicators/DefaultIndicatorPage2.qmldeleted−25
@@ -1,25 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Unity.Indicators 0.1 as Indicators
22−
23−Indicators.IndicatorPage {
24− anchors.fill: parent
25−}
Panel/Indicators/DefaultIndicatorWidget.qml+46−20
@@ -19,16 +19,16 @@
1919
2020import QtQuick 2.0
2121import Ubuntu.Components 0.1
22−import Unity.IndicatorsLegacy 0.1 as Indicators
22+import Unity.Indicators 0.1 as Indicators
2323
2424Indicators.IndicatorWidget {
2525 id: indicatorWidget
2626
27− enabled:true
2827 width: itemRow.width + units.gu(0.5)
2928
30− property alias label: itemLabel.text
31− property alias iconSource: itemImage.source
29+ property alias leftLabel: itemLeftLabel.text
30+ property alias rightLabel: itemRightLabel.text
31+ property var icons: undefined
3232
3333 Row {
3434 id: itemRow
@@ -40,19 +40,43 @@ Indicators.IndicatorWidget {
4040 }
4141 spacing: units.gu(0.5)
4242
43− // FIXME : Should us Ubuntu.Icon . results in low res images
44− Image {
45− id: itemImage
46− objectName: "itemImage"
47− visible: source != ""
48− height: indicatorWidget.iconSize
49− width: indicatorWidget.iconSize
43+ Label {
44+ id: itemLeftLabel
45+ objectName: "leftLabel"
46+ color: Theme.palette.selected.backgroundText
47+ opacity: 0.8
48+ font.family: "Ubuntu"
49+ fontSize: "medium"
5050 anchors.verticalCenter: parent.verticalCenter
51+ visible: text != ""
52+ }
53+
54+ Row {
55+ width: childrenRect.width
56+ anchors {
57+ top: parent.top
58+ bottom: parent.bottom
59+ }
60+ spacing: units.gu(0.5)
61+
62+ Repeater {
63+ model: indicatorWidget.icons
64+
65+ Image {
66+ id: itemImage
67+ objectName: "itemImage"
68+ visible: source != ""
69+ source: modelData
70+ height: indicatorWidget.iconSize
71+ width: indicatorWidget.iconSize
72+ anchors.verticalCenter: parent.verticalCenter
73+ }
74+ }
5175 }
5276
5377 Label {
54− id: itemLabel
55− objectName: "itemLabel"
78+ id: itemRightLabel
79+ objectName: "rightLabel"
5680 color: Theme.palette.selected.backgroundText
5781 opacity: 0.8
5882 font.family: "Ubuntu"
@@ -63,15 +87,17 @@ Indicators.IndicatorWidget {
6387 }
6488
6589 onActionStateChanged: {
66− if (action == undefined || !action.valid) {
67− return;
68− }
69−
70− if (action.state == undefined) {
90+ if (actionState == undefined) {
91+ leftLabel = "";
92+ rightLabel = "";
93+ icons = undefined;
94+ enabled = false;
7195 return;
7296 }
7397
74− label = action.state[Indicators.ActionState.Label];
75− iconSource = "image://theme/" + action.state[Indicators.ActionState.IconSource];
98+ leftLabel = actionState.leftLabel ? actionState.leftLabel : "";
99+ rightLabel = actionState.rightLabel ? actionState.rightLabel : "";
100+ icons = actionState.icons;
101+ enabled = actionState.visible;
76102 }
77103}
Panel/Indicators/DefaultIndicatorWidget2.qmldeleted−103
@@ -1,103 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.Indicators 0.1 as Indicators
23−
24−Indicators.IndicatorWidget {
25− id: indicatorWidget
26−
27− width: itemRow.width + units.gu(0.5)
28−
29− property alias leftLabel: itemLeftLabel.text
30− property alias rightLabel: itemRightLabel.text
31− property var icons: undefined
32−
33− Row {
34− id: itemRow
35− objectName: "itemRow"
36− anchors {
37− top: parent.top
38− bottom: parent.bottom
39− horizontalCenter: parent.horizontalCenter
40− }
41− spacing: units.gu(0.5)
42−
43− Label {
44− id: itemLeftLabel
45− objectName: "leftLabel"
46− color: Theme.palette.selected.backgroundText
47− opacity: 0.8
48− font.family: "Ubuntu"
49− fontSize: "medium"
50− anchors.verticalCenter: parent.verticalCenter
51− visible: text != ""
52− }
53−
54− Row {
55− width: childrenRect.width
56− anchors {
57− top: parent.top
58− bottom: parent.bottom
59− }
60− spacing: units.gu(0.5)
61−
62− Repeater {
63− model: indicatorWidget.icons
64−
65− Image {
66− id: itemImage
67− objectName: "itemImage"
68− visible: source != ""
69− source: modelData
70− height: indicatorWidget.iconSize
71− width: indicatorWidget.iconSize
72− anchors.verticalCenter: parent.verticalCenter
73− }
74− }
75− }
76−
77− Label {
78− id: itemRightLabel
79− objectName: "rightLabel"
80− color: Theme.palette.selected.backgroundText
81− opacity: 0.8
82− font.family: "Ubuntu"
83− fontSize: "medium"
84− anchors.verticalCenter: parent.verticalCenter
85− visible: text != ""
86− }
87− }
88−
89− onActionStateChanged: {
90− if (actionState == undefined) {
91− leftLabel = "";
92− rightLabel = "";
93− icons = undefined;
94− enabled = false;
95− return;
96− }
97−
98− leftLabel = actionState.leftLabel ? actionState.leftLabel : "";
99− rightLabel = actionState.rightLabel ? actionState.rightLabel : "";
100− icons = actionState.icons;
101− enabled = actionState.visible;
102− }
103−}
Panel/Indicators/MessagingIndicatorPage.qmldeleted−35
@@ -1,35 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.IndicatorsLegacy 0.1 as Indicators
23−
24−Indicators.IndicatorPage {
25− anchors.fill: parent
26−
27− highlightFollowsCurrentItem: false
28− emptyText: "You have no more outstanding messages."
29−
30− function stop() {
31− // never stops the service
32− // this will keep all objects in memory, consume more memory
33− // but will optimize the menu contruction on the screen
34− }
35−}
Panel/Indicators/MessagingIndicatorWidget.qmldeleted−25
@@ -1,25 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−
22−DefaultIndicatorWidget {
23− // default the icon so we have something to show when we don't have the bus.
24− iconSource: "image://theme/indicator-messages"
25−}
Panel/Indicators/NetworkIndicatorPage.qml+2−3
@@ -18,8 +18,8 @@
1818 */
1919
2020import QtQuick 2.0
21−import Unity.IndicatorsLegacy 0.1 as Indicators
22−import Unity.IndicatorsLegacy.Network 0.1 as ICNetwork
21+import Unity.Indicators 0.1 as Indicators
22+import Unity.Indicators.Network 0.1 as ICNetwork
2323import Ubuntu.Components 0.1
2424
2525PageStack {
@@ -32,7 +32,6 @@ PageStack {
3232
3333 property alias title: _mainPage.title
3434 property alias emptyText: pluginItem.emptyText
35− property alias busType: pluginItem.busType
3635 property alias busName: pluginItem.busName
3736 property alias actionsObjectPath : pluginItem.actionsObjectPath
3837 property alias menuObjectPaths : pluginItem.menuObjectPaths
Panel/Indicators/NetworkIndicatorPage2.qmldeleted−82
@@ -1,82 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Unity.Indicators 0.1 as Indicators
22−import Unity.Indicators.Network 0.1 as ICNetwork
23−import Ubuntu.Components 0.1
24−
25−PageStack {
26− id: networkPage
27− // Stops the search for a parent tree node.
28− // We don't want it going up to the indicator tabs.
29− // FIXME: need a better way of doing this.
30− // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211704
31− __propagated: null
32−
33− property alias title: _mainPage.title
34− property alias emptyText: pluginItem.emptyText
35− property alias busName: pluginItem.busName
36− property alias actionsObjectPath : pluginItem.actionsObjectPath
37− property alias menuObjectPaths : pluginItem.menuObjectPaths
38−
39− anchors.fill: parent
40−
41− Page {
42− id: _mainPage
43−
44− Indicators.IndicatorPage {
45− id: pluginItem
46− anchors.fill: parent
47− }
48− }
49−
50− Component {
51− id: passwordPageComponent
52−
53− ICNetwork.PasswordPage {
54− agent: networkAgent
55− }
56− }
57−
58− ICNetwork.NetworkAgent {
59− id: networkAgent
60−
61− onSecretRequested: {
62− networkPage.push(passwordPageComponent, {"token": token});
63− }
64− }
65−
66− function start()
67− {
68− push(_mainPage);
69− pluginItem.start();
70− }
71−
72− function stop()
73− {
74− clear();
75− pluginItem.stop();
76− }
77−
78− function reset()
79− {
80− pluginItem.reset();
81− }
82−}
Panel/Indicators/NetworkIndicatorWidget.qmldeleted−112
@@ -1,112 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.IndicatorsLegacy 0.1 as Indicators
23−
24−Indicators.IndicatorWidget {
25− id: indicatorWidget
26−
27− width: networkIcon.width + units.gu(0.5)
28−
29− property int signalStrength: 0
30− property int connectionState: Indicators.NetworkConnection.Initial
31− rootMenuType: "com.canonical.indicator.root.network"
32−
33− // FIXME : Should us Ubuntu.Icon . results in low res images
34− Image {
35− id: networkIcon
36− objectName: "itemImage"
37− source: get_icon_for_signal(connectionState, signalStrength)
38− visible: source != ""
39− height: indicatorWidget.iconSize
40− width: indicatorWidget.iconSize
41− anchors.centerIn: parent
42− }
43−
44− onActionStateChanged: {
45− if (action == undefined || !action.valid) {
46− enabled = false;
47− return;
48− }
49−
50− if (action.state == undefined) {
51− enabled = false;
52− connectionState = 0;
53− return;
54− }
55−
56− enabled = true;
57− connectionState = action.state[Indicators.NetworkActionState.Connection];
58− if (connectionState == Indicators.NetworkConnection.Activated) {
59− signalStrength = action.state[Indicators.NetworkActionState.SignalStrength];
60− }
61− }
62−
63− NumberAnimation {
64− id: activation_animation
65− target: indicatorWidget
66− property: "signalStrength"
67− from: 0
68− to: 100
69− duration: 2500 // 5 states in 2.5 seconds
70− loops: Animation.Infinite
71− }
72−
73− states: [
74− State {
75− name: "unknown"
76− when: connectionState < Indicators.NetworkConnection.Activating || connectionState > Indicators.NetworkConnection.Deactivating
77− PropertyChanges { target: activation_animation; running: false }
78− },
79− State {
80− name: "activating"
81− when: connectionState == Indicators.NetworkConnection.Activating
82− PropertyChanges { target: activation_animation; running: true }
83− },
84− State {
85− name: "activated"
86− when: connectionState == Indicators.NetworkConnection.Activated
87− PropertyChanges { target: activation_animation; running: false }
88− },
89− State {
90− name: "deactivating"
91− when: connectionState == Indicators.NetworkConnection.Deactivating
92− PropertyChanges { target: activation_animation; running: true }
93− }
94− ]
95−
96−
97− function get_icon_for_signal(con_state, value) {
98− if (con_state >= Indicators.NetworkConnection.Activating && con_state <= Indicators.NetworkConnection.Deactivating) {
99− if (value == 0) {
100− return "image://theme/nm-signal-00";
101− } else if (value <= 25) {
102− return "image://theme/nm-signal-25";
103− } else if (value <= 50) {
104− return "image://theme/nm-signal-50";
105− } else if (value <= 75) {
106− return "image://theme/nm-signal-75";
107− }
108− return "image://theme/nm-signal-100";
109− }
110− return "image://theme/wifi-none";
111− }
112−}
Panel/Indicators/SoundIndicatorWidget.qmldeleted−26
@@ -1,26 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−
22−DefaultIndicatorWidget {
23− // default the icon so we have something to show when we don't have the bus.
24− iconSource: "image://theme/audio-volume-high"
25− enabled: true
26−}
Panel/Indicators/client/IndicatorsList.qml+12−9
@@ -20,7 +20,7 @@
2020import QtQuick 2.0
2121import Ubuntu.Components 0.1
2222import Ubuntu.Components.ListItems 0.1 as ListItem
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
2424import "../.."
2525
2626Page {
@@ -38,18 +38,13 @@ Page {
3838 anchors.fill: parent
3939 model: indicatorsModel
4040
41− delegate: Indicators.MenuItem {
41+ delegate: Indicators.FramedMenuItem {
4242 anchors.left: parent.left
4343 anchors.right: parent.right
44− progression: isValid
44+ progression: true
4545 objectName: identifier
4646
47− Label {
48− anchors.left: parent.left
49− anchors.leftMargin: units.gu(0.5)
50− anchors.verticalCenter: parent.verticalCenter
51− text: title
52− }
47+ text: title
5348
5449 onClicked: {
5550 if (progression) {
@@ -57,6 +52,14 @@ Page {
5752 page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
5853 }
5954 }
55+
56+ Rectangle {
57+ id: background
58+
59+ anchors.fill: parent
60+ color: "#221e1c"
61+ z: -1
62+ }
6063 }
6164 }
6265}
Panel/IndicatorsDataModel.qml+9−23
@@ -29,51 +29,37 @@ Indicators.IndicatorsModel {
2929 indicatorData : {
3030 'indicator-location' : {
3131 'title': 'Location',
32− 'description' : '',
33− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
34− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
32+ 'description' : ''
3533 },
3634 'indicator-bluetooth' : {
3735 'title': 'Bluetooth',
38− 'description' : '',
39− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
40− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
36+ 'description' : ''
4137 },
4238 'indicator-messages' : {
4339 'title': 'Messaging',
44− 'description' : '',
45− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
46− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
40+ 'description' : ''
4741 },
4842 'indicator-sound' : {
4943 'title': 'Sound',
50− 'description' : '',
51− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
52− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
44+ 'description' : ''
5345 },
5446 'indicator-network' : {
5547 'title': 'Networks',
5648 'description' : '',
57− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
58− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage2.qml'
49+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget.qml',
50+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml'
5951 },
6052 'indicator-power' : {
6153 'title': 'Battery',
62− 'description' : '',
63− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
64− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
54+ 'description' : ''
6555 },
6656 'indicator-session' : {
6757 'title': 'Session',
68− 'description' : '',
69− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
70− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
58+ 'description' : ''
7159 },
7260 'indicator-datetime' : {
7361 'title': 'Date and Time',
74− 'description' : '',
75− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
76− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
62+ 'description' : ''
7763 }
7864 }
7965}
plugins/Unity/CMakeLists.txt−1
@@ -2,7 +2,6 @@
22include(Plugins)
33
44add_subdirectory(Indicators)
5−add_subdirectory(IndicatorsLegacy)
65
76# Dependencies
87include(FindPkgConfig)
plugins/Unity/Indicators/Messaging/qml/QuickReply.qml+1−1
@@ -20,7 +20,7 @@
2020
2121import QtQuick 2.0
2222import Ubuntu.Components 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
2424
2525Item {
2626 id: quickReply
plugins/Unity/Indicators/indicatorsmodel.cpp+5−3
@@ -228,9 +228,9 @@ QVariant IndicatorsModel::defaultData(Indicator::Ptr indicator, int role)
228228 case IndicatorsModelRole::Description:
229229 return "";
230230 case IndicatorsModelRole::WidgetSource:
231− return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget2.qml";
231+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
232232 case IndicatorsModelRole::PageSource:
233− return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage2.qml";
233+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
234234 }
235235 return QVariant();
236236}
@@ -284,7 +284,9 @@ QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& indicator, int rol
284284 if (indicator && m_parsed_indicator_data.contains(indicator->identifier()))
285285 {
286286 QVariantMap data = m_parsed_indicator_data[indicator->identifier()];
287− return data.value(roleNames()[role], QVariant());
287+ if (data.contains(roleNames()[role])) {
288+ return data[roleNames()[role]];
289+ };
288290 }
289291 return defaultData(indicator, role);
290292}
plugins/Unity/IndicatorsLegacy/CMakeLists.txtdeleted−48
@@ -1,48 +0,0 @@
1−# export_qmlplugin macro
2−include(Plugins)
3−
4−project(IndicatorsLegacyQml)
5−
6−pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
7−find_package(Qt5Core REQUIRED)
8−find_package(Qt5Quick REQUIRED)
9−
10−add_subdirectory(qml)
11−add_subdirectory(Network)
12−
13−include_directories(
14− ${CMAKE_CURRENT_SOURCE_DIR}
15− ${CMAKE_CURRENT_BINARY_DIR}
16− ${QMENUMODEL_INCLUDE_DIRS}
17− ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators
18−)
19−
20−set(IndicatorsLegacyQML_SOURCES
21− ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h
22− flatmenuproxymodel.cpp
23− modelprinter.cpp
24− plugin.cpp
25−)
26−add_definitions(-DUNITYINDICATORS_LIBRARY)
27−
28−set(IndicatorsLegacyQML_RESOURCES
29− resources/indicators.qrc
30−)
31−
32−qt5_add_resources(IndicatorsLegacyQML_RESOURCES_RCC
33− ${IndicatorsLegacyQML_RESOURCES}
34−)
35−
36−add_library(IndicatorsLegacyQml SHARED
37− ${IndicatorsLegacyQML_RESOURCES_RCC}
38− ${IndicatorsLegacyQML_SOURCES}
39−)
40−
41−target_link_libraries(IndicatorsLegacyQml
42− ${QMENUMODEL_LDFLAGS}
43−)
44−
45−qt5_use_modules(IndicatorsLegacyQml Core Qml Quick)
46−
47−# export the qmltypes and plugin files
48−export_qmlplugin(Unity.IndicatorsLegacy 0.1 Unity/IndicatorsLegacy TARGETS IndicatorsLegacyQml)
plugins/Unity/IndicatorsLegacy/Network/CMakeLists.txtdeleted−45
@@ -1,45 +0,0 @@
1−# export_qmlplugin macro
2−include(Plugins)
3−
4−project(IndicatorsLegacyNetworkQml)
5−
6−pkg_check_modules(GLIB glib-2.0>=2.32)
7−pkg_check_modules(LIBNM_GLIB libnm-glib>=0.9.6)
8−pkg_check_modules(LIBNM_UTIL libnm-util>=0.9.6)
9−
10−if(LIBNM_GLIB_FOUND AND LIBNM_UTIL_FOUND AND GLIB_FOUND)
11− set(INDICATORS_LEGACY_NETWORK_SRC
12− networkagent.cpp
13− plugin.cpp
14− secret-agent.c
15− )
16−
17− add_library(IndicatorsLegacyNetworkQml MODULE
18− ${INDICATORS_LEGACY_NETWORK_SRC}
19− )
20−
21− qt5_use_modules(IndicatorsLegacyNetworkQml Core Qml Widgets)
22−
23− set_target_properties(IndicatorsLegacyNetworkQml PROPERTIES COMPILE_FLAGS -fPIC)
24−
25− include_directories(
26− ${CMAKE_CURRENT_SOURCE_DIR}
27− ${GLIB_INCLUDE_DIRS}
28− ${LIBNM_GLIB_INCLUDE_DIRS}
29− ${LIBNM_UTIL_INCLUDE_DIRS}
30− )
31−
32− target_link_libraries(IndicatorsLegacyNetworkQml
33− ${GLIB_LIBRARIES}
34− ${LIBNM_GLIB_LIBRARIES}
35− ${LIBNM_UTIL_LIBRARIES}
36− )
37−
38− # export the qmltypes and plugin files
39− export_qmlplugin(Unity.IndicatorsLegacy.Network 0.1 Unity/IndicatorsLegacy/Network TARGETS IndicatorsLegacyNetworkQml)
40−
41−else()
42− message(WARNING "Missing glib or libnm dependency for the network plugin, not building")
43−endif()
44−
45−add_subdirectory(qml)
plugins/Unity/IndicatorsLegacy/Network/networkagent.cppdeleted−146
@@ -1,146 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Alberto Ruiz <alberto.ruiz@canonical.com>
18− * Renato Araujo Oliveira Filho <renato@canonical.com>
19− */
20−
21−#include "networkagent.h"
22−
23−#include <QVariant>
24−#include <QApplication>
25−#include <QDebug>
26−
27−class NetworkAgentToken
28−{
29−public:
30− NMConnection *connection;
31− NMSettingWirelessSecurity *wisec;
32− guint id;
33− QByteArray keyMgmt;
34−
35− NetworkAgentToken(NMConnection *connection,
36− NMSettingWirelessSecurity *wisec,
37− guint id,
38− QByteArray keyMgmt)
39− : connection(connection),
40− wisec(wisec),
41− id(id),
42− keyMgmt(keyMgmt)
43− {
44− if (connection) {
45− g_object_ref(connection);
46− } else {
47− qWarning() << "invalid connection object";
48− }
49− }
50−
51− ~NetworkAgentToken()
52− {
53− if (connection) {
54− g_object_unref(connection);
55− }
56− }
57−};
58−
59−NetworkAgent::NetworkAgent(QObject *parent)
60− : QObject(parent)
61−{
62− m_agent = unity_settings_secret_agent_new();
63− g_signal_connect(G_OBJECT(m_agent),
64− UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
65− G_CALLBACK(onSecretRequested),
66− this);
67−
68− g_signal_connect(G_OBJECT(m_agent),
69− UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
70− G_CALLBACK(onSecretRequestCancelled),
71− this);
72−}
73−
74−NetworkAgent::~NetworkAgent()
75−{
76− nm_secret_agent_unregister(NM_SECRET_AGENT(m_agent));
77− g_object_unref(m_agent);
78−}
79−
80−void NetworkAgent::authenticate(const QVariant &token, const QString &key)
81−{
82− NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
83− if (pToken == NULL) {
84− return;
85− }
86−
87− if ((pToken->keyMgmt == "wpa-none") || (pToken->keyMgmt == "wpa-psk")) {
88− g_object_set(G_OBJECT(pToken->wisec),
89− NM_SETTING_WIRELESS_SECURITY_PSK, qPrintable(key),
90− NULL);
91− } else if (pToken->keyMgmt == "none") {
92− g_object_set(G_OBJECT(pToken->wisec),
93− NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, qPrintable(key),
94− NULL);
95− }
96−
97− GHashTable *settings = nm_connection_to_hash(pToken->connection,
98− NM_SETTING_HASH_FLAG_ALL);
99−
100− unity_settings_secret_agent_provide_secret(m_agent,
101− pToken->id, settings);
102− g_hash_table_unref(settings);
103− delete pToken;
104−}
105−
106−void NetworkAgent::cancel(const QVariant &token)
107−{
108− NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
109− if (pToken != NULL) {
110− unity_settings_secret_agent_cancel_request(m_agent, pToken->id);
111− delete pToken;
112− }
113−}
114−
115−void NetworkAgent::onSecretRequested(UnitySettingsSecretAgent* /*agent*/,
116− guint id,
117− NMConnection* connection,
118− const char* /*setting_name*/,
119− const char** /*hints*/,
120− NMSecretAgentGetSecretsFlags /*flags*/,
121− NetworkAgent* self)
122−{
123− NetworkAgentToken *token = new NetworkAgentToken(connection,
124− NULL,
125− id,
126− NULL);
127−
128− token->wisec = nm_connection_get_setting_wireless_security(connection);
129− if (token->wisec) {
130− token->keyMgmt = nm_setting_wireless_security_get_key_mgmt(token->wisec);
131− }
132−
133− QVariant varToken = qVariantFromValue((void *) token);
134− Q_EMIT self->secretRequested(varToken);
135−}
136−
137−void NetworkAgent::onSecretRequestCancelled(UnitySettingsSecretAgent* /*agent*/,
138− guint /*id*/,
139− NMConnection* /*connection*/,
140− const char* /*setting_name*/,
141− const char** /*hints*/,
142− NMSecretAgentGetSecretsFlags /*flags*/,
143− NetworkAgent* /*self*/)
144−{
145− //Do nothing for now
146−}
plugins/Unity/IndicatorsLegacy/Network/networkagent.hdeleted−65
@@ -1,65 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Alberto Ruiz <alberto.ruiz@canonical.com>
18− * Renato Araujo Oliveira Filho <renato@canonical.com>
19− */
20−
21−#ifndef NETWORKAGENT_H
22−#define NETWORKAGENT_H
23−
24−#include "secret-agent.h"
25−
26−#include <QObject>
27−
28−class NetworkAgentToken;
29−
30−class NetworkAgent : public QObject
31−{
32− Q_OBJECT
33−public:
34− NetworkAgent(QObject *parent=0);
35− ~NetworkAgent();
36−
37− Q_INVOKABLE void authenticate(const QVariant &token, const QString &key);
38− Q_INVOKABLE void cancel(const QVariant &token);
39−
40−Q_SIGNALS:
41− void secretRequested(const QVariant &token);
42− void secretRequestCancelled();
43−
44−private:
45− UnitySettingsSecretAgent *m_agent;
46−
47− static void onSecretRequested(UnitySettingsSecretAgent *agent,
48− guint id,
49− NMConnection *connection,
50− const char *setting_name,
51− const char **hints,
52− NMSecretAgentGetSecretsFlags flags,
53− NetworkAgent *self);
54−
55− static void onSecretRequestCancelled(UnitySettingsSecretAgent *agent,
56− guint id,
57− NMConnection *connection,
58− const char *setting_name,
59− const char **hints,
60− NMSecretAgentGetSecretsFlags flags,
61− NetworkAgent *self);
62−
63−};
64−
65−#endif
plugins/Unity/IndicatorsLegacy/Network/plugin.cppdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Nick Dedekind <nick.dedekind@canonical.com>
17− */
18−
19−// Qt
20−#include <QtQml/qqml.h>
21−
22−// self
23−#include "plugin.h"
24−
25−// local
26−#include "networkagent.h"
27−
28−void IndicatorsNetworkPlugin::registerTypes(const char *uri)
29−{
30− qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent");
31−}
plugins/Unity/IndicatorsLegacy/Network/plugin.hdeleted−32
@@ -1,32 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Nick Dedekind <nick.dedekind@canonical.com>
17− */
18−
19−#ifndef INDICATORS_NETWORK_PLUGIN_H
20−#define INDICATORS_NETWORK_PLUGIN_H
21−
22−#include <QtQml/QQmlExtensionPlugin>
23−
24−class IndicatorsNetworkPlugin : public QQmlExtensionPlugin
25−{
26− Q_OBJECT
27− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28−public:
29− void registerTypes(const char *uri);
30−};
31−
32−#endif // INDICATORS_NETWORK_PLUGIN_H
plugins/Unity/IndicatorsLegacy/Network/qml/AccessPoint.qmldeleted−68
@@ -1,68 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−import Unity.IndicatorsLegacy 0.1 as Indicators
24−
25−Indicators.MenuItem {
26− id: accessPoint
27− property variant actionWifiApStrength : menu && actionGroup ? actionGroup.action(menu.extra.canonical_wifi_ap_strength_action) : null
28− property variant wifiApStrength : actionWifiApStrength && actionWifiApStrength.valid ? actionWifiApStrength.state : "0"
29−
30− function getNetworkIcon(data) {
31− var imageName = "nm-signal-100"
32− var signalStrength = parseInt(wifiApStrength)
33−
34− if (data.extra.canonical_wifi_ap_is_adhoc) {
35− imageName = "nm-adhoc";
36− } else if (signalStrength == 0) {
37− imageName = "nm-signal-00";
38− } else if (signalStrength <= 25) {
39− imageName = "nm-signal-25";
40− } else if (signalStrength <= 50) {
41− imageName = "nm-signal-50";
42− } else if (signalStrength <= 75) {
43− imageName = "nm-signal-75";
44− }
45−
46− if (data.extra.canonical_wifi_ap_is_secure) {
47− imageName += "-secure";
48− }
49−
50− return "image://theme/" + imageName;
51− }
52−
53− icon: menu && wifiApStrength ? getNetworkIcon(menu) : "image://theme/wifi-none"
54− iconFrame: false
55− control: CheckBox {
56− id: checkBoxActive
57− height: units.gu(4)
58− width: units.gu(4)
59− anchors.centerIn: parent
60− }
61−
62− Indicators.MenuActionBinding {
63− actionGroup: accessPoint.actionGroup
64− action: menu ? menu.action : ""
65− target: checkBoxActive
66− property: "checked"
67− }
68−}
plugins/Unity/IndicatorsLegacy/Network/qml/CMakeLists.txtdeleted−5
@@ -1,5 +0,0 @@
1−# export_qmlplugin macro
2−include(Plugins)
3−
4−# export the qmldir, *.qml files.
5−export_qmlfiles(Unity.IndicatorsLegacy.Network Unity/IndicatorsLegacy/Network)
plugins/Unity/IndicatorsLegacy/Network/qml/PasswordPage.qmldeleted−88
@@ -1,88 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−import Unity.IndicatorsLegacy 0.1 as Indicators
24−
25−Page {
26− id: pagePassword
27−
28− property variant agent
29− property variant token
30−
31− anchors.fill: parent
32− title: "Network Authentication"
33−
34− Column {
35− anchors {
36− left: parent.left
37− right: parent.right
38− }
39−
40− Indicators.SectionMenuItem {
41− label: "Authentication"
42− }
43−
44− Indicators.MenuItem {
45− implicitHeight: password.height + units.gu(1)
46−
47− PasswordTextField {
48− id: password
49− anchors {
50− left: parent.left
51− right: parent.right
52− margins: units.gu(3)
53− verticalCenter: parent.verticalCenter
54− }
55− }
56− }
57−
58− Indicators.MenuItem {
59− Row {
60− anchors {
61− right: parent.right
62− verticalCenter: parent.verticalCenter
63− margins: units.gu(3)
64− }
65−
66− spacing: units.gu(1)
67−
68− Button {
69− text: "Cancel"
70− width: units.gu(10)
71− onClicked: {
72− agent.cancel(token);
73− pageStack.pop();
74− }
75− }
76−
77− Button {
78− text: "OK"
79− width: units.gu(10)
80− onClicked: {
81− agent.authenticate(token, password.text);
82− pageStack.pop();
83− }
84− }
85− }
86− }
87− }
88−}
plugins/Unity/IndicatorsLegacy/Network/qml/PasswordTextField.qmldeleted−68
@@ -1,68 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Item {
24− id: textMenu
25−
26− property alias text: textField.text
27−
28− height: contentColumn.height
29−
30− Column {
31− id: contentColumn
32− spacing: units.gu(0.5)
33− anchors {
34− left: parent.left
35− right: parent.right
36− }
37−
38− TextField {
39− id: textField
40−
41− anchors {
42− left: parent.left
43− right: parent.right
44− }
45−
46− placeholderText: "Password"
47− echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
48− }
49−
50− Row {
51− anchors {
52− left: parent.left
53− right: parent.right
54− }
55−
56− spacing: units.gu(1)
57−
58− CheckBox {
59− id: showPassword
60− }
61−
62− Label {
63− text: "Show password"
64− anchors.verticalCenter: showPassword.verticalCenter
65− }
66− }
67− }
68−}
plugins/Unity/IndicatorsLegacy/Network/qml/WifiSection.qmldeleted−34
@@ -1,34 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.IndicatorsLegacy 0.1 as Indicators
23−
24−Indicators.SectionMenuItem {
25− id: wifiSectionMenu
26−
27− Indicators.MenuAction {
28− id: busyAction
29− actionGroup: wifiSectionMenu.actionGroup
30− action: menu ? menu.extra.canonical_busy_action : ""
31− }
32−
33− busy: busyAction.valid ? busyAction.state : false
34−}
plugins/Unity/IndicatorsLegacy/Network/qml/qmldirdeleted−9
@@ -1,9 +0,0 @@
1−module Unity.IndicatorsLegacy.Network
2−plugin IndicatorsLegacyNetworkQml
3−typeinfo plugin.qmltypes
4−
5−NetworkPage 0.1 NetworkPage.qml
6−AccessPoint 0.1 AccessPoint.qml
7−PasswordPage 0.1 PasswordPage.qml
8−PasswordTextField 0.1 PasswordTextField.qml
9−WifiSection 0.1 WifiSection.qml
plugins/Unity/IndicatorsLegacy/Network/secret-agent.cdeleted−382
@@ -1,382 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Alberto Ruiz <alberto.ruiz@canonical.com>
18− * Renato Araujo Oliveira Filho <renato@canonical.com>
19− */
20−
21−
22−#include <glib.h>
23−#include <glib-object.h>
24−#include <nm-secret-agent.h>
25−#include "secret-agent.h"
26−
27−#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
28−#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
29−#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
30−#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
31−#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
32−#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
33−#define UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentPrivate))
34−
35−#define AGENT_ID "com.canonical.settings.network.nm-agent"
36−
37−static gpointer unity_settings_secret_agent_parent_class = NULL;
38−
39−typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
40−
41−struct _UnitySettingsSecretAgentPrivate {
42− GQueue *requests;
43−};
44−
45−typedef struct _SecretRequest {
46− gint id;
47− NMSecretAgent *agent;
48− NMConnection *connection;
49− const char *connection_path;
50− const char *setting_name;
51− const char **hints;
52− NMSecretAgentGetSecretsFlags flags;
53− NMSecretAgentGetSecretsFunc callback;
54− gpointer callback_data;
55−} SecretRequest;
56−
57−GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
58−enum {
59− UNITY_SETTINGS_SECRET_AGENT_DUMMY_PROPERTY
60−};
61−
62−enum {
63− SECRET_REQUESTED,
64− REQUEST_CANCELLED,
65− LAST_SIGNAL
66−};
67−
68−static guint signals[LAST_SIGNAL] = { 0 };
69−
70−UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
71−UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
72−
73−int
74−secret_request_find (SecretRequest *req,
75− guint *id)
76−{
77− if (req->id > *id)
78− return -1;
79−
80− if (req->id < *id)
81− return 1;
82−
83− return 0;
84−}
85−
86−void
87−unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
88− guint request,
89− GHashTable *secrets)
90−{
91− GList *iter;
92− SecretRequest *req;
93− UnitySettingsSecretAgentPrivate *priv = agent->priv;
94−
95− iter = g_queue_find_custom (priv->requests,
96− &request,
97− (GCompareFunc)secret_request_find);
98−
99− if (iter == NULL || iter->data == NULL)
100− {
101− g_warning ("Secret request with id <%d> was not found", (int)request);
102− return;
103− }
104−
105− req = iter->data;
106−
107− req->callback (NM_SECRET_AGENT (agent),
108− req->connection,
109− secrets,
110− NULL,
111− req->callback_data);
112−
113− g_queue_remove_all (priv->requests, req);
114− g_free (req);
115− return;
116−}
117−
118−void
119−free_request (SecretRequest *req)
120−{
121− g_object_unref (req->connection);
122− g_free (req);
123−}
124−
125−void
126−unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
127− guint request)
128−{
129− GList *iter;
130− SecretRequest *req;
131− UnitySettingsSecretAgentPrivate *priv = agent->priv;
132− GError *error;
133−
134− iter = g_queue_find_custom (priv->requests,
135− &request,
136− (GCompareFunc)secret_request_find);
137−
138− if (iter == NULL || iter->data == NULL)
139− {
140− g_warning ("Secret request with id <%d> was not found", (int)request);
141− return;
142− }
143−
144− req = iter->data;
145− error = g_error_new (NM_SECRET_AGENT_ERROR,
146− NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
147− "This secret request was canceled by the user.");
148−
149− req->callback (NM_SECRET_AGENT (agent),
150− req->connection,
151− NULL,
152− error,
153− req->callback_data);
154−
155− g_queue_remove_all (priv->requests, req);
156− free_request (req);
157− return;
158−}
159−
160−static void
161−delete_secrets (NMSecretAgent *agent,
162− NMConnection *connection,
163− const char *connection_path,
164− NMSecretAgentDeleteSecretsFunc callback,
165− gpointer callback_data)
166−{
167− g_debug ("delete secrets");
168−}
169−
170−/* If it returns G_MAXUINT it's considered an error */
171−static guint
172−find_available_id (UnitySettingsSecretAgentPrivate *priv)
173−{
174− guint i = 0;
175− guint candidate = 0;
176−
177− if (g_queue_get_length (priv->requests) == G_MAXUINT)
178− return G_MAXUINT;
179−
180− while (i < g_queue_get_length (priv->requests))
181− {
182− SecretRequest *req = (SecretRequest*)g_queue_peek_nth (priv->requests, i);
183−
184− if (req->id == candidate)
185− {
186− candidate++;
187− i = 0;
188− }
189− else
190− {
191− i++;
192− }
193− }
194−
195− return i;
196−}
197−
198−static void
199−get_secrets (NMSecretAgent *agent,
200− NMConnection *connection,
201− const char *connection_path,
202− const char *setting_name,
203− const char **hints,
204− NMSecretAgentGetSecretsFlags flags,
205− NMSecretAgentGetSecretsFunc callback,
206− gpointer callback_data)
207−{
208− guint id;
209− UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
210− SecretRequest *req = NULL;
211−
212− if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
213− {
214− GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
215− NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
216− "No password found for this connection.");
217− callback (agent, connection, NULL, error, callback_data);
218− g_error_free (error);
219− return;
220− }
221−
222− id = find_available_id (priv);
223− if (id == G_MAXUINT)
224− {
225− GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
226− NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
227− "Reached maximum number of requests.");
228− callback (agent, connection, NULL, error, callback_data);
229− g_error_free (error);
230− return;
231− }
232−
233− /* Adding a request */
234− req = (SecretRequest*) g_malloc0 (sizeof (SecretRequest));
235− *req = ((SecretRequest)
236− { id,
237− agent,
238− connection,
239− connection_path,
240− setting_name,
241− hints,
242− flags,
243− callback,
244− callback_data });
245−
246− g_object_ref (connection);
247−
248− g_queue_push_tail (priv->requests, req);
249−
250− g_signal_emit_by_name (agent,
251− UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
252− id,
253− connection,
254− setting_name,
255− hints,
256− flags);
257−}
258−
259−static void
260−save_secrets (NMSecretAgent *agent,
261− NMConnection *connection,
262− const char *connection_path,
263− NMSecretAgentSaveSecretsFunc callback,
264− gpointer callback_data)
265−{
266− g_debug ("save secrets");
267−}
268−
269−static void
270−cancel_get_secrets (NMSecretAgent *agent,
271− const char *connection_path,
272− const char *setting_name)
273−{
274− g_debug ("cancel get secrets");
275−}
276−
277−UnitySettingsSecretAgent*
278−unity_settings_secret_agent_construct (GType object_type)
279−{
280− UnitySettingsSecretAgent * self = NULL;
281− self = (UnitySettingsSecretAgent*) g_object_new (object_type,
282− NM_SECRET_AGENT_IDENTIFIER, AGENT_ID,
283− NULL);
284− return self;
285−}
286−
287−
288−UnitySettingsSecretAgent*
289−unity_settings_secret_agent_new (void)
290−{
291− return unity_settings_secret_agent_construct (UNITY_SETTINGS_TYPE_SECRET_AGENT);
292−}
293−
294−static void
295−destroy_pending_request (gpointer data)
296−{
297− SecretRequest* req = (SecretRequest*)data;
298− /* Reporting the cancellation of all pending requests */
299− g_signal_emit_by_name (req->agent,
300− UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
301− req->id);
302−
303− free_request (req);
304−}
305−
306−static void
307−unity_settings_secret_agent_finalize (GObject *agent)
308−{
309− UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
310−
311− g_queue_free_full (priv->requests, destroy_pending_request);
312−}
313−
314−static void
315−unity_settings_secret_agent_class_init (UnitySettingsSecretAgentClass *klass)
316−{
317− unity_settings_secret_agent_parent_class = g_type_class_peek_parent (klass);
318− NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (klass);
319− parent_class->get_secrets = get_secrets;
320− parent_class->save_secrets = save_secrets;
321− parent_class->delete_secrets = delete_secrets;
322− parent_class->cancel_get_secrets = cancel_get_secrets;
323−
324− g_type_class_add_private (klass, sizeof(UnitySettingsSecretAgentPrivate));
325− G_OBJECT_CLASS (klass)->finalize = unity_settings_secret_agent_finalize;
326−
327−
328− signals[SECRET_REQUESTED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
329− G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
330− G_SIGNAL_RUN_FIRST,
331− G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, secret_requested),
332− NULL, NULL, NULL,
333− G_TYPE_NONE, 5,
334− G_TYPE_UINT, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT);
335−
336− signals[REQUEST_CANCELLED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
337− G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
338− G_SIGNAL_RUN_FIRST,
339− G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, request_cancelled),
340− NULL, NULL, NULL,
341− G_TYPE_NONE, 1,
342− G_TYPE_UINT);
343−}
344−
345−
346−static void
347−unity_settings_secret_agent_instance_init (UnitySettingsSecretAgent *self)
348−{
349− self->priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (self);
350− self->priv->requests = g_queue_new ();
351−}
352−
353−GType
354−unity_settings_secret_agent_get_type (void)
355−{
356− static volatile gsize unity_settings_secret_agent_type_id__volatile = 0;
357− if (g_once_init_enter (&unity_settings_secret_agent_type_id__volatile))
358− {
359− static const GTypeInfo g_define_type_info =
360− {
361− sizeof (UnitySettingsSecretAgentClass),
362− (GBaseInitFunc) NULL,
363− (GBaseFinalizeFunc) NULL,
364− (GClassInitFunc) unity_settings_secret_agent_class_init,
365− (GClassFinalizeFunc) NULL,
366− NULL,
367− sizeof (UnitySettingsSecretAgent),
368− 0,
369− (GInstanceInitFunc) unity_settings_secret_agent_instance_init,
370− NULL
371− };
372− GType unity_settings_secret_agent_type_id;
373− unity_settings_secret_agent_type_id = g_type_register_static (NM_TYPE_SECRET_AGENT,
374− "UnitySettingsSecretAgent",
375− &g_define_type_info,
376− 0);
377− g_once_init_leave (&unity_settings_secret_agent_type_id__volatile,
378− unity_settings_secret_agent_type_id);
379− }
380−
381− return unity_settings_secret_agent_type_id__volatile;
382−}
plugins/Unity/IndicatorsLegacy/Network/secret-agent.hdeleted−102
@@ -1,102 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Alberto Ruiz <alberto.ruiz@canonical.com>
18− * Renato Araujo Oliveira Filho <renato@canonical.com>
19− */
20−
21−#ifndef __SECRET_AGENT_H__
22−#define __SECRET_AGENT_H__
23−
24−#include <glib.h>
25−#include <glib-object.h>
26−#include <nm-secret-agent.h>
27−
28−/*
29− * This class is a basic implementation of the NetworkManager SecretAgent base class.
30− *
31− * The purpose of this class is to handle credential requests from the network,
32− * for example, from a WiFi hotspot or a VPN network.
33− *
34− * It queues requests objects (SecretRequest) on a GQueue in the private struct
35− * of the class. And notifies the consumer of the class through the "secret-request"
36− * and the "request-cancelled" signals with the following callback prototypes:
37− *
38− * void (*secret_requested) (UnitySettingsSecretAgent *self,
39− * guint id,
40− * NMConnection *connection,
41− * const char *setting_name,
42− * const char **hints,
43− * NMSecretAgentGetSecretsFlags flags,
44− * gpointer user_data);
45− *
46− * void (*request_cancelled) (UnitySettingsSecretAgent *self,
47− * guint id,
48− * gpointer user_data);
49− *
50− */
51−
52−
53−G_BEGIN_DECLS
54−
55−
56−#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
57−#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
58−#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
59−#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
60−#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
61−#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
62−
63−#define UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED "secret-requested"
64−#define UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED "request-cancelled"
65−
66−typedef struct _UnitySettingsSecretAgent UnitySettingsSecretAgent;
67−typedef struct _UnitySettingsSecretAgentClass UnitySettingsSecretAgentClass;
68−typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
69−
70−struct _UnitySettingsSecretAgent {
71− NMSecretAgent parent_instance;
72− UnitySettingsSecretAgentPrivate * priv;
73−};
74−
75−struct _UnitySettingsSecretAgentClass {
76− NMSecretAgentClass parent_class;
77−
78− void (*secret_requested) (UnitySettingsSecretAgent *self,
79− guint id,
80− NMConnection *connection,
81− const char *setting_name,
82− const char **hints,
83− NMSecretAgentGetSecretsFlags flags);
84−
85− void (*request_cancelled) (UnitySettingsSecretAgent *self,
86− guint id);
87−};
88−
89−
90−GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
91−UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
92−UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
93−
94−void unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
95− guint request,
96− GHashTable *secrets);
97−void unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
98− guint request);
99−
100−G_END_DECLS
101−
102−#endif
plugins/Unity/IndicatorsLegacy/flatmenuproxymodel.cppdeleted−288
@@ -1,288 +0,0 @@
1−/*
2− * Copyright 2012 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−extern "C" {
21−#include <gio/gio.h>
22−}
23−
24−#include "flatmenuproxymodel.h"
25−#include <QString>
26−#include <QStringList>
27−
28−FlatMenuProxyModel::FlatMenuProxyModel(QAbstractItemModel *source)
29− : QAbstractProxyModel(source),
30− m_rowCount(0)
31−{
32− m_model = new QDBusMenuModel;
33− setSourceModel(m_model);
34−}
35−
36−/*! \internal */
37−FlatMenuProxyModel::~FlatMenuProxyModel()
38−{
39− delete m_model;
40−}
41−
42−void FlatMenuProxyModel::setSourceModel(QAbstractItemModel *source)
43−{
44− if (sourceModel()) {
45− QAbstractItemModel *oldSource = sourceModel();
46− if (oldSource == source) {
47− return;
48− }
49−
50− oldSource->disconnect(this);
51− }
52−
53− QAbstractProxyModel::setSourceModel(source);
54−
55− if (source) {
56−
57− // FIXME - not working correctly with dynamic inserts/removes
58− // FIXME 2 - We're using Queud connections as a workaround to QTBUG-32859
59− // The signals from qmenumodel are coming straight off the glib event loop,
60− // which is not supported and has the effect of listview delegates not to be deleted.
61−
62− connect(source,
63− SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
64− SLOT(onModelAboutToBeReset()), Qt::QueuedConnection);
65− connect(source,
66− SIGNAL(rowsInserted(QModelIndex,int,int)),
67− SLOT(onModelReset()), Qt::QueuedConnection);
68−
69− connect(source,
70− SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
71− SLOT(onModelAboutToBeReset()), Qt::QueuedConnection);
72− connect(source,
73− SIGNAL(rowsRemoved(QModelIndex,int,int)),
74− SLOT(onModelReset()), Qt::QueuedConnection);
75−
76− connect(source,
77− SIGNAL(modelAboutToBeReset()),
78− SLOT(onModelAboutToBeReset()), Qt::QueuedConnection);
79− connect(source,
80− SIGNAL(modelReset()),
81− SLOT(onModelReset()), Qt::QueuedConnection);
82−
83− //Connection args
84− connect(source,
85− SIGNAL(busTypeChanged(DBusEnums::BusType)),
86− SIGNAL(busTypeChanged()));
87−
88− connect(source,
89− SIGNAL(busNameChanged(const QString&)),
90− SIGNAL(busNameChanged()));
91−
92− connect(source,
93− SIGNAL(objectPathChanged(const QString&)),
94− SIGNAL(objectPathChanged()));
95−
96− connect(source,
97− SIGNAL(statusChanged(DBusEnums::ConnectionStatus)),
98− SIGNAL(statusChanged()), Qt::QueuedConnection);
99−
100− // initiliaze rowCount
101− QModelIndex lastItem = source->index(source->rowCount() - 1, 0);
102− m_rowCount = recursiveRowCount(lastItem);
103− } else {
104− m_rowCount = 0;
105− }
106−
107− Q_EMIT countChanged();
108−}
109−
110−void FlatMenuProxyModel::setBusName(const QString &busName)
111−{
112− m_model->setBusName(busName);
113−}
114−
115−QString FlatMenuProxyModel::busName() const
116−{
117− return m_model->busName();
118−}
119−
120−void FlatMenuProxyModel::setObjectPath(const QString &busPath)
121−{
122− m_model->setObjectPath(busPath);
123−}
124−
125−QString FlatMenuProxyModel::objectPath() const
126−{
127− return m_model->objectPath();
128−}
129−
130−int FlatMenuProxyModel::status() const
131−{
132− return m_model->status();
133−}
134−
135−DBusEnums::BusType FlatMenuProxyModel::busType() const
136−{
137− return m_model->busType();
138−}
139−
140−void FlatMenuProxyModel::setIntBusType(int type)
141−{
142− m_model->setBusType((DBusEnums::BusType) type);
143−}
144−
145−void FlatMenuProxyModel::start()
146−{
147− m_model->start();
148−}
149−
150−void FlatMenuProxyModel::stop()
151−{
152− m_model->stop();
153−}
154−
155−QModelIndex FlatMenuProxyModel::mapFromSource(const QModelIndex &index) const
156−{
157− if (!index.isValid()) {
158− return QModelIndex();
159− }
160−
161− QModelIndex result = createIndex(rowOffsetOf(index, index.row()), 0);
162− return result;
163−}
164−
165−QModelIndex FlatMenuProxyModel::mapToSource(const QModelIndex &index) const
166−{
167− if (sourceModel() && m_indexCache.contains(index.row())) {
168− QString key = m_indexCache.value(index.row());
169− QStringList sections = key.split('.', QString::SkipEmptyParts);
170− QModelIndex sourceIndex = QModelIndex();
171− for(int i=0; i < sections.size(); i++) {
172− sourceIndex = sourceModel()->index(sections.at(i).toInt(), 9, sourceIndex);
173− }
174− return sourceIndex;
175− } else {
176− return QModelIndex();
177− }
178−}
179−
180−QModelIndex FlatMenuProxyModel::index(int row, int sectionRow, const QModelIndex &parent, const QString &key) const
181−{
182− for (int i = 0, count = 0; i < sourceModel()->rowCount(parent); i++) {
183− QModelIndex sourceIndex = sourceModel()->index(i, 0, parent);
184− int indexCount = recursiveRowCount(sourceIndex);
185−
186− if (count == sectionRow) {
187− QString sectionKey = key + "." + QString::number(i);
188− m_indexCache.insert(row, sectionKey);
189− return createIndex(row, 0);
190− } else if ((count + indexCount) >= sectionRow) {
191− count++;
192− return index(row, sectionRow - count, sourceIndex, key + "." + QString::number(i));
193− }
194−
195− count += indexCount + 1;
196− }
197− return QModelIndex();
198−}
199−
200−QModelIndex FlatMenuProxyModel::index(int row, int, const QModelIndex &) const
201−{
202− return index(row, row, QModelIndex(), "");
203−}
204−
205−QModelIndex FlatMenuProxyModel::parent(const QModelIndex &) const
206−{
207− return QModelIndex();
208−}
209−
210−int FlatMenuProxyModel::columnCount(const QModelIndex &) const
211−{
212− return 1;
213−}
214−
215−int FlatMenuProxyModel::rowCount(const QModelIndex &) const
216−{
217− return m_rowCount;
218−}
219−
220−int FlatMenuProxyModel::count() const
221−{
222− return rowCount(QModelIndex());
223−}
224−
225−void FlatMenuProxyModel::onModelAboutToBeReset()
226−{
227− beginResetModel();
228−}
229−
230−void FlatMenuProxyModel::onModelReset()
231−{
232− // initiliaze rowCount
233− m_rowCount = 0;
234− for (int i = 0, iMax = sourceModel()->rowCount(); i < iMax; i++) {
235− QModelIndex index = sourceModel()->index(i, 0);
236− m_rowCount += recursiveRowCount(index) + 1;
237− }
238− m_indexCache.clear();
239− endResetModel();
240− Q_EMIT countChanged();
241−}
242−
243−int FlatMenuProxyModel::recursiveRowCount(const QModelIndex &index) const
244−{
245− int size = sourceModel()->rowCount(index);
246− for (int i=0, iMax=size; i < iMax; i++) {
247− QModelIndex currentIndex = sourceModel()->index(i, 0, index);
248− size += recursiveRowCount(currentIndex);
249− }
250−
251− return size;
252−}
253−
254−int FlatMenuProxyModel::rowOffsetOf(const QModelIndex &index, int row, bool inclusive) const
255−{
256− int offset = 0;
257−
258− QModelIndex parent = index.parent();
259−
260− // Check row 0 offset
261− while(parent.isValid()) {
262− offset += 1;
263− for (int i = 0; i < parent.row(); i++) {
264− QModelIndex currentIndex = sourceModel()->index(i, 0, parent);
265− offset += recursiveRowCount(currentIndex) + 1;
266− }
267− parent = parent.parent();
268− }
269−
270− // Check index.row() offset
271− for(int i = 0; i < row; i++) {
272− QModelIndex currentIndex = sourceModel()->index(i, 0, index.parent());
273− offset += recursiveRowCount(currentIndex) + 1;
274− }
275−
276− if (inclusive) {
277− // itself
278− QModelIndex currentIndex = sourceModel()->index(row, 0, index.parent());
279− offset += recursiveRowCount(currentIndex);
280− }
281−
282− return offset;
283−}
284−
285−QVariant FlatMenuProxyModel::data(int row, int role) const
286−{
287− return QAbstractProxyModel::data(index(row, 0), role);
288−}
plugins/Unity/IndicatorsLegacy/flatmenuproxymodel.hdeleted−93
@@ -1,93 +0,0 @@
1−/*
2− * Copyright 2012 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−#ifndef FLATMENUPROXYMODEL_H
21−#define FLATMENUPROXYMODEL_H
22−
23−#include "unityindicatorsglobal.h"
24−
25−#include <QAbstractProxyModel>
26−#include <qdbusmenumodel.h>
27−
28−class SectionInfo;
29−
30−class UNITYINDICATORS_EXPORT FlatMenuProxyModel : public QAbstractProxyModel
31−{
32− Q_OBJECT
33− Q_PROPERTY(int count READ count NOTIFY countChanged)
34− Q_PROPERTY(int busType READ busType WRITE setIntBusType NOTIFY busTypeChanged)
35− Q_PROPERTY(QString busName READ busName WRITE setBusName NOTIFY busNameChanged)
36− Q_PROPERTY(QString objectPath READ objectPath WRITE setObjectPath NOTIFY objectPathChanged)
37− Q_PROPERTY(int status READ status NOTIFY statusChanged)
38−
39− Q_ENUMS(Roles)
40−public:
41− FlatMenuProxyModel(QAbstractItemModel *source=0);
42− ~FlatMenuProxyModel();
43−
44− void setSourceModel(QAbstractItemModel * sourceModel);
45−
46− Q_INVOKABLE QVariant data(int row, int role = Qt::DisplayRole) const;
47−
48− QModelIndex mapFromSource(const QModelIndex &index) const;
49− QModelIndex mapToSource(const QModelIndex &index) const;
50−
51− QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
52− QModelIndex parent(const QModelIndex &index) const;
53− int rowCount(const QModelIndex &parent = QModelIndex()) const;
54− int count() const;
55− int columnCount(const QModelIndex &parent) const;
56−
57− void setBusName(const QString &busName);
58− QString busName() const;
59−
60− void setObjectPath(const QString &busName);
61− QString objectPath() const;
62−
63− DBusEnums::BusType busType() const;
64− void setIntBusType(int type);
65−
66− int status() const;
67−
68−public Q_SLOTS:
69− void onModelAboutToBeReset();
70− void onModelReset();
71−
72− void start();
73− void stop();
74−
75−Q_SIGNALS:
76− void countChanged();
77−
78− void busTypeChanged();
79− void busNameChanged();
80− void objectPathChanged();
81− void statusChanged();
82−
83−private:
84− QDBusMenuModel *m_model;
85− mutable QMap<int, QString> m_indexCache;
86− int m_rowCount;
87−
88− int rowOffsetOf(const QModelIndex &index, int row, bool inclusive = false) const;
89− int recursiveRowCount(const QModelIndex &index) const;
90− QModelIndex index(int row, int rowCount, const QModelIndex &parent, const QString &key) const;
91−};
92−
93−#endif
plugins/Unity/IndicatorsLegacy/modelprinter.cppdeleted−114
@@ -1,114 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−// self
21−#include "modelprinter.h"
22−
23−// Qt
24−#include <QTextStream>
25−
26−ModelPrinter::ModelPrinter(QObject *parent)
27− : QObject(parent)
28− , m_model(NULL)
29−{
30−}
31−
32−void ModelPrinter::setSourceModel(QAbstractItemModel * sourceModel)
33−{
34− if (m_model != NULL) {
35− disconnect(m_model);
36− }
37− if (m_model != sourceModel) {
38− m_model = sourceModel;
39− Q_EMIT modelChanged();
40− Q_EMIT textChanged();
41− }
42− if (m_model != NULL) {
43− connect(m_model, SIGNAL(modelReset()), this, SIGNAL(textChanged()));
44− connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(textChanged()));
45− connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(textChanged()));
46− }
47−}
48−
49−QAbstractItemModel* ModelPrinter::sourceModel() const
50−{
51− return m_model;
52−}
53−
54−QString ModelPrinter::text(const QModelIndex& index) const
55−{
56− return recurseString(index, 0);
57−}
58−
59−QString tabify(int level) { QString str;
60− for (int i = 0; i < level; i++) {
61− str += " ";
62− }
63− return str;
64−}
65−
66−QString ModelPrinter::recurseString(const QModelIndex& index, int level) const
67−{
68− if (!m_model)
69− return "";
70−
71− QString str;
72− QTextStream stream(&str);
73−
74− QHash<int, QByteArray> roleNames = m_model->roleNames();
75− QList<int> roles = roleNames.keys();
76− qSort(roles);
77− Q_FOREACH(int role, roles) {
78− QVariant vData = m_model->data(index, role);
79− if (vData.canConvert(QMetaType::QVariantMap)) {
80− QMapIterator<QString, QVariant> iter(vData.toMap());
81− while (iter.hasNext()) {
82− iter.next();
83− stream << tabify(level)
84− << roleNames[role]
85− << "."
86− << iter.key()
87− << ": "
88− << iter.value().toString()
89− << endl;
90− }
91− }
92− else {
93− stream << tabify(level)
94− << roleNames[role]
95− << ": "
96− << vData.toString()
97− << endl;
98− }
99− }
100−
101− int rowCount = m_model->rowCount(index);
102− stream << tabify(level)
103− << "child count"
104− << ": "
105− << rowCount
106− << endl
107− << endl;
108−
109− for (int i = 0; i < rowCount; i++) {
110− QModelIndex child = m_model->index(i, 0, index);
111− str += recurseString(child, level+1);
112− }
113− return str;
114−}
plugins/Unity/IndicatorsLegacy/modelprinter.hdeleted−50
@@ -1,50 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−#ifndef MODELPRINTER_H
21−#define MODELPRINTER_H
22−
23−#include <QSortFilterProxyModel>
24−
25−// This class acts as a namespace only, with the addition that its enums
26−// are registered to be exposed on the QML side.
27−class ModelPrinter : public QObject
28−{
29− Q_OBJECT
30−
31− Q_PROPERTY(QAbstractItemModel* model READ sourceModel WRITE setSourceModel NOTIFY modelChanged)
32− Q_PROPERTY(QString text READ text NOTIFY textChanged)
33−public:
34− ModelPrinter(QObject* parent=0);
35−
36− void setSourceModel(QAbstractItemModel* sourceModel);
37− QAbstractItemModel* sourceModel() const;
38−
39− Q_INVOKABLE QString text(const QModelIndex& index = QModelIndex()) const;
40−
41−Q_SIGNALS:
42− void modelChanged();
43− void textChanged();
44−
45−private:
46− QString recurseString(const QModelIndex& index, int level) const;
47− QAbstractItemModel* m_model;
48−};
49−
50−#endif // MODELPRINTER_H
plugins/Unity/IndicatorsLegacy/plugin.cppdeleted−42
@@ -1,42 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Nick Dedekind <nick.dedekind@canonical.com>
17− */
18−
19−// Qt
20−#include <QtQml/qqml.h>
21−
22−// self
23−#include "plugin.h"
24−
25−// local
26−#include "flatmenuproxymodel.h"
27−#include "indicators.h"
28−#include "modelprinter.h"
29−
30−void IndicatorsPlugin::registerTypes(const char *uri)
31−{
32− Q_INIT_RESOURCE(indicators);
33−
34− qmlRegisterType<FlatMenuProxyModel>(uri, 0, 1, "FlatMenuProxyModel");
35− qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
36−
37− qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
38− qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
39− qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
40− qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
41− qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
42−}
plugins/Unity/IndicatorsLegacy/plugin.hdeleted−32
@@ -1,32 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Nick Dedekind <nick.dedekind@canonical.com>
17− */
18−
19−#ifndef INDICATORS_PLUGIN_H
20−#define INDICATORS_PLUGIN_H
21−
22−#include <QtQml/QQmlExtensionPlugin>
23−
24−class IndicatorsPlugin : public QQmlExtensionPlugin
25−{
26− Q_OBJECT
27− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28−public:
29− void registerTypes(const char *uri);
30−};
31−
32−#endif // INDICATORS_PLUGIN_H
plugins/Unity/IndicatorsLegacy/qml/BasicMenuItem.qmldeleted−48
@@ -1,48 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components.ListItems 0.1 as ListItem
22−
23−ListItem.Standard {
24− id: stdListItem
25−
26− property bool menuActivated: false
27− property QtObject menu
28− property QtObject actionGroup
29− property alias color: background.color
30−
31− signal activateMenu()
32− signal deactivateMenu()
33−
34− showDivider: false
35− __foregroundColor: "#e8e1d0"
36−
37− backgroundIndicator: RemoveBackground {
38− state: stdListItem.swipingState
39− }
40−
41− Rectangle {
42− id: background
43−
44− anchors.fill: parent
45− color: "#221e1c"
46− z: -1
47− }
48−}
plugins/Unity/IndicatorsLegacy/qml/ButtonMenuItem.qmldeleted−47
@@ -1,47 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−BasicMenuItem {
24− id: buttonMenu
25− color: "#221e1b"
26− implicitHeight: units.gu(7)
27−
28− Button {
29− id: button
30− enabled: menuAction.valid
31− text: menu ? menu.label : ""
32− anchors.centerIn: parent
33− height: units.gu(4)
34− width: units.gu(16)
35− color: "#1b1817"
36−
37− onClicked: {
38− menuAction.activate()
39− }
40− }
41−
42− MenuAction {
43− id: menuAction
44− actionGroup: buttonMenu.actionGroup
45− action: menu ? menu.action : ""
46− }
47−}
plugins/Unity/IndicatorsLegacy/qml/CMakeLists.txtdeleted−5
@@ -1,5 +0,0 @@
1−# export_qmlplugin macro
2−include(Plugins)
3−
4−# export the qmldir, *.qml files.
5−export_qmlfiles(Unity.IndicatorsLegacy Unity/IndicatorsLegacy)
plugins/Unity/IndicatorsLegacy/qml/DivMenuItem.qmldeleted−26
@@ -1,26 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Olivier Tilloy <olivier.tilloy@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Rectangle {
24− color: "#181514"
25− implicitHeight: units.gu(1)
26−}
plugins/Unity/IndicatorsLegacy/qml/HLine.qmldeleted−29
@@ -1,29 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Rectangle {
24− height: units.dp(1)
25− anchors {
26− left: parent.left
27− right: parent.right
28− }
29−}
plugins/Unity/IndicatorsLegacy/qml/IndicatorBase.qmldeleted−59
@@ -1,59 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import QMenuModel 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
24−
25−Item {
26− id: indicatorItem
27−
28− //const
29− property string title
30− property int busType
31− property string busName
32− property string actionsObjectPath
33− property var menuObjectPaths: undefined
34− readonly property string device: "phone"
35−
36− property string deviceMenuObjectPath: menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
37−
38− signal actionGroupUpdated()
39− signal modelUpdated()
40−
41− property var actionGroup: QDBusActionGroup {
42− busType: indicatorItem.busType
43− busName: indicatorItem.busName
44− objectPath: indicatorItem.actionsObjectPath
45−
46− onActionAppear: indicatorItem.actionGroupUpdated();
47− }
48−
49− property var proxyModel: Indicators.FlatMenuProxyModel {
50− busType: indicatorItem.busType
51− busName: indicatorItem.busName
52− objectPath: indicatorItem.deviceMenuObjectPath
53−
54− onStatusChanged: indicatorItem.modelUpdated();
55− onRowsInserted: indicatorItem.modelUpdated();
56− onRowsRemoved: indicatorItem.modelUpdated();
57− onDataChanged: indicatorItem.modelUpdated();
58− }
59−}
plugins/Unity/IndicatorsLegacy/qml/IndicatorPage.qmldeleted−191
@@ -1,191 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1 as Components
23−
24−IndicatorBase {
25− id: main
26−
27− //const
28− property alias emptyText: emptyLabel.text
29− property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
30− property bool __active: false
31−
32− ListView {
33− id: mainMenu
34−
35− property int visibleItems: 0
36−
37− model: proxyModel
38− anchors {
39− fill: parent
40− bottomMargin: Qt.inputMethod.visible ? (Qt.inputMethod.keyboardRectangle.height - main.anchors.bottomMargin) : 0
41−
42− Behavior on bottomMargin {
43− NumberAnimation {
44− duration: 175
45− easing.type: Easing.OutQuad
46− }
47− }
48− // TODO - does ever frame.
49− onBottomMarginChanged: {
50− mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
51− }
52− }
53−
54− // Ensure all delegates are cached in order to improve smoothness of scrolling
55− cacheBuffer: 10000
56−
57− // Only allow flicking if the content doesn't fit on the page
58− interactive: contentHeight > height
59−
60− currentIndex: -1
61− delegate: Item {
62− id: item
63− property bool ready: false
64− property alias empty: factory.empty
65−
66− anchors {
67− left: parent.left
68− right: parent.right
69− }
70− height: div.height + factory.implicitHeight
71− visible: height > 0
72−
73− Component.onCompleted: {
74− if (!item.empty) {
75− mainMenu.visibleItems += 1;
76− }
77− ready = true;
78− }
79− Component.onDestruction: {
80− if (!item.empty) {
81− mainMenu.visibleItems -= 1;
82− }
83− ready = false;
84− }
85−
86− onEmptyChanged: {
87− if (!ready) {
88− return;
89− }
90− if (empty) {
91− mainMenu.visibleItems -= 1;
92− } else {
93− mainMenu.visibleItems += 1;
94− }
95− }
96−
97− ListView.onRemove: {
98− if (!highlightFollowsCurrentItem) {
99− mainMenu.currentIndex = -1;
100− }
101− }
102−
103− Column {
104− id: contents
105−
106− anchors.fill: parent
107−
108− DivMenuItem {
109− id: div
110−
111− anchors.left: parent.left
112− anchors.right: parent.right
113− // only visible if is a root or a section header element and the factory is visible
114− height: {
115− // skipe first item
116− if (item.y == 0) {
117− return 0;
118− }
119− if (hasSection || ((depth == 0) && (!factory.empty))) {
120− return implicitHeight;
121− } else {
122− return 0;
123− }
124− }
125− }
126−
127− MenuItemFactory {
128− id: factory
129−
130− actionGroup: main.actionGroup
131− isCurrentItem: item.ListView.isCurrentItem
132− anchors {
133− left: parent.left
134− right: parent.right
135− }
136− menu: model
137−
138− Connections {
139− target : factory
140− onActivated: item.ListView.view.currentIndex = index
141− onDeactivated: item.ListView.view.currentIndex = -1
142− }
143− }
144− }
145− }
146− }
147−
148− Components.Label {
149− id: emptyLabel
150− visible: (mainMenu.visibleItems === 0)
151− anchors {
152− top: parent.top
153− left: parent.left
154− right: parent.right
155− topMargin: units.gu(2)
156− }
157− wrapMode: Text.WordWrap
158− horizontalAlignment: Text.AlignHCenter
159−
160− //style
161− color: "#e8e1d0"
162− fontSize: "medium"
163−
164− text: "Empty!"
165− }
166−
167− function start()
168− {
169− reset()
170− if (!__active) {
171− proxyModel.start();
172− actionGroup.start();
173− __active = true;
174− }
175− }
176−
177− function stop()
178− {
179− if (__active) {
180− __active = false;
181− proxyModel.stop();
182− actionGroup.stop();
183− }
184− }
185−
186− function reset()
187− {
188− mainMenu.currentIndex = -1;
189− mainMenu.positionViewAtBeginning();
190− }
191−}
plugins/Unity/IndicatorsLegacy/qml/IndicatorWidget.qmldeleted−68
@@ -1,68 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Unity.IndicatorsLegacy 0.1 as Indicators
22−
23−IndicatorBase {
24− id: indicatorWidget
25−
26− enabled: false
27− property var action: undefined
28− property bool started: (busType != 0) && (busName != "") && (deviceMenuObjectPath != "")
29− property int iconSize: height - units.gu(0.5)
30− property string rootMenuType: "com.canonical.indicator.root"
31−
32− signal actionStateChanged()
33−
34− onStartedChanged: {
35− if (started) {
36− proxyModel.start();
37− actionGroup.start();
38− } else {
39− proxyModel.stop();
40− actionGroup.stop();
41− }
42− }
43− onActionGroupUpdated: update_state()
44− onModelUpdated: update_state()
45−
46−
47− function update_state() {
48− var extra = proxyModel.data(0, Indicators.FlatMenuProxyModelRole.Extra);
49− if (extra == undefined) {
50− return;
51− }
52−
53− if (!extra.hasOwnProperty("canonical_type")) {
54− return;
55− }
56−
57− if (extra.canonical_type === rootMenuType) {
58− action = actionGroup.action(proxyModel.data(0, Indicators.FlatMenuProxyModelRole.Action));
59− actionStateChanged();
60− }
61− }
62−
63− Connections {
64− target: action == undefined ? null : action
65− onStateChanged: actionStateChanged()
66− onValidChanged: actionStateChanged()
67− }
68−}
plugins/Unity/IndicatorsLegacy/qml/MenuAction.qmldeleted−86
@@ -1,86 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−
22−/*!
23− \qmltype MenuAction
24− \inqmlmodule Indicators 0.1
25− \brief Helper class to connect to a qmenumodel action
26−
27− Example:
28− \qml
29− Button {
30− id: slide
31− onClick: { action.activate() }
32− }
33− MenuAction {
34− id: action
35− actionGroup: menuItem.actionGroup
36− action: "/ubuntu/sound/enabled"
37− }
38− \endqml
39−*/
40−
41−Item {
42− id: menuAction
43−
44− /*!
45− \preliminary
46− The dbus action name
47− */
48− property string action: ""
49−
50− /*!
51− \preliminary
52− The dbus action group object
53− */
54− property QtObject actionGroup: null
55−
56− /*!
57− \preliminary
58− This is a read-only property with the current validity of the action
59− */
60− readonly property bool valid: actionObject ? actionObject.valid : false
61−
62− readonly property var state: actionObject ? actionObject.state : undefined
63−
64− // internal
65− property QtObject actionObject: null
66−
67− function activate(param) {
68− if (valid) {
69− actionObject.activate(param);
70− }
71− }
72−
73− onActionGroupChanged: updateAction()
74− onActionChanged: updateAction()
75−
76− Connections {
77− target: menuAction.actionGroup != undefined ? menuAction.actionGroup : null
78− onActionAppear: menuAction.updateAction();
79− onActionVanish: menuAction.updateAction();
80− onStatusChanged: menuAction.updateAction();
81− }
82−
83− function updateAction() {
84− actionObject = action !== "" && actionGroup ? actionGroup.action(action) : null
85− }
86−}
plugins/Unity/IndicatorsLegacy/qml/MenuActionBinding.qmldeleted−106
@@ -1,106 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−
22−/*!
23− \qmltype MenuActionBinding
24− \inqmlmodule Indicators 0.1
25− \brief Helper class to connect a qmenumodel action state with a qml components property
26−
27− Example:
28− \qml
29− Slider {
30− id: slide
31− }
32− MenuActionBinding {
33− actionGroup: menuItem.actionGroup
34− action: "/ubuntu/sound/volume"
35− target: slider
36− property: "value"
37− }
38− \endqml
39−*/
40−
41−MenuAction {
42− id: menuAction
43−
44− /*!
45− \preliminary
46− The component which will have the property changed by action
47− */
48− property QtObject target: null
49−
50− /*!
51− \preliminary
52− The property name of \l target component which will be linked with action state
53− */
54− property string property
55−
56− /*!
57− \preliminary
58− Use this to enable or disable the action state propagation to component property.
59− */
60− property bool active: true
61−
62− Component.onCompleted: connectViewChanges()
63− onTargetChanged: connectViewChanges()
64− onPropertyChanged: connectViewChanges()
65−
66− Item {
67− id: d
68− property var currentTarget: undefined
69− property string currentSignal
70− }
71−
72− Binding {
73− id: propertyBinding
74− target: menuAction.target
75− property: menuAction.property
76− value: menuAction.state
77− when: menuAction.actionObject && menuAction.active
78− }
79−
80− // TODO - re-evaluate in c++
81− function connectViewChanges() {
82− if (d.currentTarget != undefined && d.currentSignal !== "") {
83− if (d.currentTarget[d.currentSignal] !== undefined) {
84− d.currentTarget[d.currentSignal].disconnect(onViewValueChanged);
85− }
86− }
87−
88− d.currentTarget = null;
89− d.currentSignal = "";
90− if (target) {
91− var signal = "on%1Changed".arg(property.charAt(0).toUpperCase() + property.slice(1));
92− if (target[signal] !== undefined) {
93− target[signal].connect(onViewValueChanged);
94− d.currentTarget = target;
95− d.currentSignal = signal;
96− }
97− }
98− }
99−
100− function onViewValueChanged() {
101− if (valid) {
102− var propertyValue = target[property];
103− actionObject.updateState(propertyValue);
104− }
105− }
106−}
plugins/Unity/IndicatorsLegacy/qml/MenuItem.qmldeleted−40
@@ -1,40 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−
24−BasicMenuItem {
25− objectName: menu ? menu.action : ""
26− progression: menu && (menu.linkSubMenu !== undefined)
27− text: menu && menu.label ? menu.label : ""
28− color: "#221e1c"
29− implicitHeight: units.gu(7)
30−
31− HLine {
32− anchors.top: parent.top
33− color: "#403b37"
34− }
35−
36− HLine {
37− anchors.bottom: parent.bottom
38− color: "#060606"
39− }
40−}
plugins/Unity/IndicatorsLegacy/qml/MenuItemFactory.qmldeleted−102
@@ -1,102 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Unity.IndicatorsLegacy 0.1 as Indicators
22−import Unity.IndicatorsLegacy.Network 0.1 as ICNetwork
23−
24−Item {
25− id: menuFactory
26−
27− property QtObject menu
28− property QtObject listView
29− property QtObject actionGroup
30− property bool isCurrentItem
31− readonly property bool empty: (loader.item !== undefined && loader.status == Loader.Ready) ? loader.item.state === "EMPTY" : true
32−
33− implicitHeight: loader.height
34−
35− signal activated()
36− signal deactivated()
37−
38− property var _map: {
39− "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
40− "unity.widgets.systemsettings.tablet.switch" : switchMenu,
41−
42− "com.canonical.indicator.button" : buttonMenu,
43− "com.canonical.indicator.div" : divMenu,
44− "com.canonical.indicator.section" : sectionMenu,
45− "com.canonical.indicator.progress" : progressMenu,
46− "com.canonical.indicator.slider" : sliderMenu,
47− "com.canonical.indicator.switch" : switchMenu,
48−
49− "unity.widget.systemsettings.tablet.sectiontitle" : wifiSection,
50− "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
51− "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
52− }
53−
54− Component { id: sliderMenu; Indicators.SliderMenuItem {} }
55− Component { id: switchMenu; Indicators.SwitchMenuItem {} }
56− Component { id: buttonMenu; Indicators.ButtonMenuItem {} }
57− Component { id: divMenu; Indicators.DivMenuItem {} }
58− Component { id: sectionMenu; Indicators.SectionMenuItem {} }
59− Component { id: progressMenu; Indicators.ProgressMenuItem {} }
60− Component { id: wifiSection; ICNetwork.WifiSection {} }
61− Component { id: accessPoint; ICNetwork.AccessPoint {} }
62− Component { id: indicatorMenu; Indicators.MenuItem {} }
63−
64− Loader {
65− id: loader
66− asynchronous: true
67−
68− anchors {
69− left: parent.left
70− right: parent.right
71− }
72−
73− sourceComponent: {
74− if (!menuFactory.menu || !menuFactory.menu.extra) {
75− return undefined;
76− }
77−
78− var widgetType = menuFactory.menu.extra.canonical_type;
79− if (widgetType) {
80− return _map[widgetType];
81− } else {
82− if (widgetType === "com.canonical.indicator.root") {
83− return undefined;
84− // Try discovery the item based on the basic properties
85− } else if (menu.hasSection) {
86− return sectionMenu;
87− } else {
88− return indicatorMenu;
89− }
90− }
91− }
92−
93− onLoaded: {
94− item.menuActivated = Qt.binding(function() { return isCurrentItem; });
95− item.actionGroup = Qt.binding(function() { return menuFactory.actionGroup; });
96− item.menu = Qt.binding(function() { return menuFactory.menu; });
97−
98− item.activateMenu.connect(function() { menuFactory.activated(); });
99− item.deactivateMenu.connect(function() { menuFactory.deactivated(); });
100− }
101− }
102−}
plugins/Unity/IndicatorsLegacy/qml/ProgressMenuItem.qmldeleted−65
@@ -1,65 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Michael Zanetti <michael.zanetti@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−MenuItem {
24− id: progressMenu
25− property alias value : progressBar.value
26−
27− // TODO: Replace this with the official ProgressBar component as soon as
28− // it is available. For now, this rebuilds the Mockup as close as possible.
29− UbuntuShape {
30− id: progressBar
31− anchors {
32− right: parent.right
33− rightMargin: units.gu(2)
34− left: parent.left
35− leftMargin: units.gu(2)
36− }
37− height: units.gu(4)
38− anchors.verticalCenter: parent.verticalCenter
39− color: "transparent"
40−
41− property int minimumValue: 0
42− property int maximumValue: 100
43− property int value: 50
44−
45− UbuntuShape {
46− anchors.fill: parent
47− anchors.rightMargin: parent.width - (parent.width * parent.value / parent.maximumValue)
48− color: "#c94212"
49− }
50−
51− Label {
52− anchors.centerIn: parent
53− text: parent.value + " %"
54− fontSize: "medium"
55− color: "#e8e1d0"
56− }
57− }
58−
59− MenuActionBinding {
60− actionGroup: progressMenu.actionGroup
61− action: menu ? menu.action : ""
62− target: progressBar
63− property: "value"
64− }
65−}
plugins/Unity/IndicatorsLegacy/qml/RemoveBackground.qmldeleted−55
@@ -1,55 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Rectangle {
21− anchors.fill: parent
22− color: "#333130"
23− Label {
24− id: backgroundText
25−
26− anchors.fill: parent
27− verticalAlignment: Text.AlignVCenter
28− text: "Clear"
29− fontSize: "medium"
30− color: "#e8e1d0"
31− font.bold: true
32− }
33−
34− states: [
35− State {
36− name: "SwipingRight"
37− PropertyChanges {
38− target: backgroundText
39− anchors.rightMargin: units.gu(3)
40− anchors.leftMargin: 0
41− horizontalAlignment: Text.AlignRight
42−
43− }
44− },
45− State {
46− name: "SwipingLeft"
47− PropertyChanges {
48− target: backgroundText
49− anchors.rightMargin: 0
50− anchors.leftMargin: units.gu(3)
51− horizontalAlignment: Text.AlignLeft
52− }
53− }
54− ]
55−}
plugins/Unity/IndicatorsLegacy/qml/SectionMenuItem.qmldeleted−57
@@ -1,57 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−
24−BasicMenuItem {
25− property string label: menu && menu.label ? menu.label : ""
26− property bool busy: false
27− property int count: menu && menu.linkSection ? menu.linkSection.count : 0
28−
29− color: "#221e1b"
30− implicitHeight: label !== "" ? __header.height : 0
31− state: count === 0 ? "EMPTY" : ""
32−
33− ListItem.Header {
34− id: __header
35−
36− text: label
37− height: units.gu(4)
38− anchors {
39− left: parent.left
40− right: parent.right
41− top: parent.top
42− }
43− visible: text != ""
44−
45− ActivityIndicator {
46− id: indicator
47− running: busy
48− anchors {
49− margins: units.gu(0.5)
50− right: parent.right
51− }
52− height: parent.height - (anchors.margins * 2)
53− width: height
54− anchors.verticalCenter: parent.verticalCenter
55− }
56− }
57−}
plugins/Unity/IndicatorsLegacy/qml/SliderMenuItem.qmldeleted−64
@@ -1,64 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−MenuItem {
24− id: _sliderMenu
25−
26− property alias minimumValue: slider.minimumValue
27− property alias maximumValue: slider.maximumValue
28− property alias value: slider.value
29−
30− control: Slider {
31− id: slider
32− enabled: menuAction.valid
33− width: _sliderMenu.text ? units.gu(20) : _sliderMenu.width - units.gu(4)
34− anchors.verticalCenter: parent.verticalCenter
35− live: false
36− // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
37− // reaching the boundaries (0.0 or 1.0), the value is converted
38− // to an integer when automatically wrapped in a variant when
39− // passed to QStateAction::updateState(…). The server chokes on
40− // those values, complaining that they’re not of the right type…
41− minimumValue: menu.extra.canonical_min ? menu.extra.canonical_min * 1.000001 : 0.0000001
42− maximumValue: {
43− var maximum = menu.extra.canonical_max ? menu.extra.canonical_max * 1.000001 : 0.9999999
44− if (maximum <= minimumValue) {
45− return minimumValue + 1;
46− }
47− return maximum;
48− }
49−
50− // FIXME - to be deprecated in Ubuntu.Components.
51− // Use this to disable the label, since there is not way to do it on the component.
52− function formatValue(v) {
53− return "";
54− }
55− }
56−
57− MenuActionBinding {
58− id: menuAction
59− actionGroup: _sliderMenu.actionGroup
60− action: menu ? menu.action : ""
61− target: slider
62− property: "value"
63− }
64−}
plugins/Unity/IndicatorsLegacy/qml/SwitchMenuItem.qmldeleted−43
@@ -1,43 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−MenuItem {
24− id: switchMenu
25−
26− property alias checked: switcher.checked
27−
28− control: Switch {
29− id: switcher
30− enabled: menuAction.valid
31−
32− anchors.verticalCenter: parent.verticalCenter
33− anchors.right: parent.right
34− }
35−
36− MenuActionBinding {
37− id: menuAction
38− actionGroup: switchMenu.actionGroup
39− action: menu ? menu.action : ""
40− target: switcher
41− property: "checked"
42− }
43−}
plugins/Unity/IndicatorsLegacy/qml/qmldirdeleted−21
@@ -1,21 +0,0 @@
1−module Unity.IndicatorsLegacy
2−plugin IndicatorsLegacyQml
3−typeinfo plugin.qmltypes
4−
5−BasicMenuItem 0.1 BasicMenuItem.qml
6−ButtonMenuItem 0.1 ButtonMenuItem.qml
7−DivMenuItem 0.1 DivMenuItem.qml
8−HLine 0.1 HLine.qml
9−IndicatorBase 0.1 IndicatorBase.qml
10−IndicatorPage 0.1 IndicatorPage.qml
11−IndicatorWidget 0.1 IndicatorWidget.qml
12−MenuItem 0.1 MenuItem.qml
13−MenuAction 0.1 MenuAction.qml
14−MenuActionBinding 0.1 MenuActionBinding.qml
15−MenuItemFactory 0.1 MenuItemFactory.qml
16−ProgressMenuItem 0.1 ProgressMenuItem.qml
17−SectionMenuItem 0.1 SectionMenuItem.qml
18−SliderMenuItem 0.1 SliderMenuItem.qml
19−SwitchMenuItem 0.1 SwitchMenuItem.qml
20−
21−internal RemoveBackground RemoveBackground.qml
plugins/Unity/IndicatorsLegacy/resources/indicators.qrcdeleted−4
@@ -1,4 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicators">
3− </qresource>
4−</RCC>
tests/autopilot/unity8/indicators_client/emulators/main_window.py+1−1
@@ -24,4 +24,4 @@ class MainWindow(object):
2424
2525 def get_battery_menu(self):
2626 """Get the battery menu from the list"""
27− return self.app.select_single("BasicMenuItem", objectName="indicator-battery");
27+ return self.app.select_single("BaseMenuItem", objectName="indicator-battery");
tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+1−3
@@ -69,11 +69,9 @@ private Q_SLOTS:
6969 QVariantMap map1; map1["title"] = "fake1";
7070 QVariantMap map2; map2["title"] = "fake2";
7171 QVariantMap map3; map3["title"] = "fake3";
72− QVariantMap map4; map4["title"] = "fake4";
7372 map["indicator-fake1"] = map1;
7473 map["indicator-fake2"] = map2;
7574 map["indicator-fake3"] = map3;
76− map["indicator-fake4"] = map4;
7775
7876 IndicatorsModel model;
7977 model.setIndicatorData(map);
@@ -88,7 +86,7 @@ private Q_SLOTS:
8886 QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
8987
9088 QCOMPARE(model.data(1, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake4"));
91− QCOMPARE(model.data(1, IndicatorsModelRole::Title).toString(), QString("fake4"));
89+ QCOMPARE(model.data(1, IndicatorsModelRole::Title).toString(), QString("indicator-fake4"));
9290 QCOMPARE(model.data(1, IndicatorsModelRole::Position).toInt(), 2);
9391 QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
9492