~ubuntu-branches/ubuntu/precise/networkmanagement/precise-updates

« back to all changes in this revision

Viewing changes to qml/package/contents/code/main.qml

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl, Modestas Vainius, Michael Biebl
  • Date: 2011-05-27 12:18:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110527121825-vfufwquq3vy0k3zn
Tags: 0.1+git20110526.911025d-1
[ Modestas Vainius ]
* Use official KDE branding in the package descriptions.

[ Michael Biebl ]
* New upstream Git snapshot 911025d81fdfbe09b64705e94e5411f521c38e3e.
* debian/control
  - Bump Build-Depends on kdelibs5-dev and kdebase-workspace-dev to
    (>= 4:4.6.0).
  - Bump Build-Depends on network-manager-dev and libnm-util-dev to
    (>= 0.8.1).
  - Bump Depends on network-manager to (>= 0.8.1).

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
Item {
28
28
    width: 200
29
 
    height: 400
 
29
    height: 200
30
30
    anchors.fill: parent
31
31
 
32
32
    PlasmaCore.DataSource {
35
35
          interval: 0
36
36
          connectedSources: ["connections"]
37
37
          onDataChanged: {
38
 
              console.log("data changed...");
 
38
                console.log("data changed...")
39
39
          }
40
40
          onSourceAdded: {
 
41
            print ("source added:" + source);
41
42
             if (source != "networkStatus") {
42
 
                //console.log("QML addedd ......." + source)
 
43
                console.log("QML addedd ......." + source)
43
44
                connectSource(source)
44
45
             }
45
46
          }
60
61
    }
61
62
 
62
63
    PlasmaWidgets.Label {
63
 
        id: header
64
 
        text: i18n("Available Connections")
65
 
        font.pixelSize: 20
66
 
        anchors { top: parent.top; left: parent.left; right: parent.right; }
 
64
        anchors { top: parent.top; left: parent.left; right: parent.right }
 
65
        id: titleLabel
 
66
        text: i18n("<h2>Connect to the Internet</h2>")
 
67
        anchors.margins: 8
67
68
    }
68
69
 
69
70
    ListView {
70
71
        id: list
71
 
        //height: 200
72
 
        anchors { top: header.bottom; left: parent.left; right: parent.right; bottom: parent.bottom; margins: 8}
 
72
        //height: 300
 
73
 
 
74
        anchors.top: titleLabel.bottom
 
75
        anchors.left: parent.left
 
76
        anchors.right: parent.right
 
77
        anchors.bottom: statusText.top
 
78
        //anchors.fill: parent
73
79
        clip: true
74
80
        spacing: 10
75
81
 
80
86
        delegate: Item {
81
87
            property int collapsedHeight: 38
82
88
            property int expandedHeight: 72
83
 
            property string iconString: (typeof securityIcon != "undefined") ? securityIcon : "security-low"
84
 
            //property string iconString: "security-medium";
 
89
            //property string iconString: (typeof securityIcon != "undefined") ? securityIcon : "security-low"
 
90
            property string iconString: "security-medium";
85
91
 
86
92
            id: citem
87
93
            height: collapsedHeight
90
96
 
91
97
            PlasmaWidgets.Frame {
92
98
                id: itemFrame
93
 
                anchors.fill: parent
94
 
                //anchors.top: citem.top
95
 
                //anchors.bottom: citem.bottom
 
99
                anchors.top: citem.top
 
100
                anchors.bottom: citem.bottom
96
101
                height: citem.height
97
 
                //width: citem.width
 
102
                width: citem.width
98
103
            }
99
104
 
100
105
            PlasmaWidgets.IconWidget {
103
108
                width: collapsedHeight
104
109
                anchors.top: parent.top
105
110
                anchors.left: parent.left
106
 
                anchors.margins: 4
107
111
 
108
112
                Component.onCompleted: {
109
113
                    //if (typeof networkEngineSource.data[DataEngineSource]["securityIcon"] != "undefined") {
110
114
                    //    setIcon(networkEngineSource.data[DataEngineSource]["securityIcon"]);
111
115
                    //} else {
112
 
                        setIcon("network-wireless");
 
116
                        setIcon(iconName);
 
117
                        print ("XXXXX we're done");
113
118
                    //}
114
119
                }
115
120
                onClicked: citem.state = (citem.state == "expanded") ? "collapsed" : "expanded"
133
138
                Component.onCompleted: {
134
139
                    try {
135
140
                        //if (typeof networkEngineSource.data[DataEngineSource]["securityIcon"] != "undefined") {
136
 
                            //setIcon(networkEngineSource.data[DataEngineSource]["securityIcon"]);
137
 
                            setIcon(securityIcon);
 
141
                            setIcon(networkEngineSource.data[DataEngineSource]["securityIcon"]);
138
142
                        //}
139
143
                    } catch (TypeError) {
140
144
                        //print("oops");
141
145
                        print(" TypeError" + mainText.text);
142
146
                    } finally {
143
 
                        print(" Exception ignored in " + mainText.text);
 
147
                        //print(" Exception ignored in " + mainText.text);
144
148
                    }
145
149
                }
146
150
                onClicked: citem.state = (citem.state == "expanded") ? "collapsed" : "expanded"
147
151
 
148
152
            }
149
153
 
150
 
            PlasmaWidgets.Label {
 
154
            Text {
151
155
                id: mainText
152
156
                text: {
153
 
                    print(" Hmm ... " + activatableType);
154
 
                    if (activatableType != "" && isInterfaceConnection(activatableType)) {
155
 
                        print("ifaceconnnection :)");
156
 
                        if (connectionName) {
157
 
                            var t = connectionName;
158
 
                            //if (networkEngineSource.data[DataEngineSource]["activationState"] == "Activated") {
159
 
                            //    t = t + " (Connected)";
160
 
                            //}
161
 
                            return t;
162
 
                        } else {
163
 
                            return "empty";
 
157
                    if (isInterfaceConnection(activatableType)) {
 
158
                        //var t = networkEngineSource.data[DataEngineSource]["connectionName"];
 
159
                        var t = connectionName;
 
160
                        if (activationState == "Activated") {
 
161
                            t = t + " (Connected)";
164
162
                        }
 
163
                        return t;
165
164
                    } else if ("WirelessNetwork" == activatableType) {
166
 
                        //return citem.ssid;
167
 
                        return "ssid";
 
165
                        return ssid;
168
166
                    } else {
169
 
                        return citem.activatableType;
 
167
                        return activatableType;
170
168
                    }
171
 
                    return "empty";
172
169
                }
173
 
 
174
170
                anchors.top: parent.top
175
171
                anchors.left: strengthIconWidget.right
176
 
                anchors.right: parent.right
177
172
                //anchors.right: securityIconWidget.left
178
173
            }
179
 
            PlasmaWidgets.Label {
180
 
                id: infoText
 
174
            Text {
 
175
                id: infoText;
181
176
                text: {
182
177
                    if (isInterfaceConnection(activatableType)) {
183
 
                        //var conType = networkEngineSource.data[DataEngineSource]["connectionType"];
184
 
                        try {
185
 
                            var conType = connectionType;
186
 
                            // Wired, Wireless, Gsm, Cdma, Vpn or Pppoe
187
 
                            if (conType == "Wireless") {
188
 
                                return i18n("Remembered Wifi Connection");
189
 
                            } else if (conType == "Wired") {
190
 
                                return i18n("Wired Connection");
191
 
                            } else if (conType == "Gsm") {
192
 
                                return i18n("Mobile Broadband");
193
 
                            } else if (conType == "Cdma") {
194
 
                                return i18n("Mobile Internet");
195
 
                            } else if (conType == "Pppoe") {
196
 
                                return i18n("Modem Connection");
197
 
                            } else if (conType == "Vpn") {
198
 
                                return i18n("Virtual Private Network");
199
 
                            }
200
 
                        } catch (ReferenceError) {
201
 
                            print("Exception caught in infoText.Label connectionType");
 
178
                        // Wired, Wireless, Gsm, Cdma, Vpn or Pppoe
 
179
                        if (connectionType == "Wireless") {
 
180
                            return i18n("Remembered Wifi Connection");
 
181
                        } else if (connectionType == "Wired") {
 
182
                            return i18n("Wired Connection");
 
183
                        } else if (connectionType == "Gsm") {
 
184
                            return i18n("Mobile Broadband");
 
185
                        } else if (connectionType == "Cdma") {
 
186
                            return i18n("Mobile Internet");
 
187
                        } else if (connectionType == "Pppoe") {
 
188
                            return i18n("Modem Connection");
 
189
                        } else if (connectionType == "Vpn") {
 
190
                            return i18n("Virtual Private Network");
202
191
                        }
203
192
                    }
204
 
                    return "unknown type";
 
193
                    return "";
205
194
                }
206
195
                //text: connectionType
207
 
                font.pixelSize: 12
 
196
                font.pixelSize: mainText.font.pixelSize - 2
208
197
                opacity: 0.4
209
198
                anchors.top: mainText.bottom
210
199
                anchors.left: mainText.left
211
 
                anchors.right: parent.right
 
200
                //anchors.bottom: parent.top
212
201
            }
213
202
 
214
203
            PlasmaWidgets.PushButton {
215
204
                id: connectButton
216
 
                text: "Connect"
217
 
                z: 100
 
205
                text: i18n("Connect")
218
206
                height: 0
219
207
                //setIcon("kmail")
220
208
                anchors.top: infoText.bottom
229
217
            }
230
218
 
231
219
            Component.onCompleted: {
232
 
                //console.log("item completed" + mainText.text + "|" + index);
 
220
                console.log("XXXX item completed" + mainText.text + "|" + index);
233
221
            }
234
222
 
235
223
            states: [
307
295
                return "network-wireless-connnected-00";
308
296
            }
309
297
 
310
 
            function isInterfaceConnection(myType) {
 
298
            function isInterfaceConnection(activatableType) {
311
299
                var cons = ["InterfaceConnection", "WirelessInterfaceConnection", "VpnInterfaceConnection", "GsmInterfaceConnection"];
312
 
                //print("T:" + myType + " " + cons.indexOf(myType));
313
 
                return cons.indexOf(myType) >= 0;
 
300
                //print(activatableType);
 
301
                return cons.indexOf(activatableType) >= 0;
314
302
            }
315
 
 
316
303
        }
317
304
    }
318
305
 
 
306
    Rectangle {
 
307
        anchors.fill: list
 
308
        color: theme.backgroundColor
 
309
        radius: 12
 
310
        opacity: 0.4
 
311
        border.width: 1
 
312
        border.color: theme.backgroundColor
 
313
        //border.opacity: 0.1
 
314
    }
 
315
 
319
316
    PlasmaWidgets.Label {
320
317
        id: statusText
321
 
        text: "Connected to some.network."
322
 
        anchors.top: list.bottom
 
318
        text: "statuslabel ....."
 
319
        //anchors.top: list.bottom
323
320
        anchors.bottom: parent.bottom
324
321
        anchors.left: parent.left
325
322
        anchors.right: parent.right