~ubuntu-branches/ubuntu/wily/plasma-nm/wily-proposed

« back to all changes in this revision

Viewing changes to applet/contents/ui/Toolbar.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Jonathan Riddell, Harald Sitter, Scarlett Clark
  • Date: 2014-10-01 16:14:15 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20141001161415-b3q27oqg8xqumbq7
Tags: 4:5.1.0.1-0ubuntu1
[ Jonathan Riddell ]
* New upstream release

[ Harald Sitter ]
* Drop ugly workaround to make a desktop file exectuable
  + This either should be done upstream or be lintian overridden (former
    seems more suitable). Upstream has been poked on IRC.
* Add lintian overrides
  + missing manpages: we don't care
  + package name doesn't match soname: we don't care for internal libraries
  + shlib-without-versioned-soname: we don't care for internal libraries
* Fix copyright short license for LGPL-KDEeV

[ Scarlett Clark ]
* Fix copyright short licence for LGPL-2.1-KDEeV 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Lesser General Public
 
6
    License as published by the Free Software Foundation; either
 
7
    version 2.1 of the License, or (at your option) version 3, or any
 
8
    later version accepted by the membership of KDE e.V. (or its
 
9
    successor approved by the membership of KDE e.V.), which shall
 
10
    act as a proxy defined in Section 6 of version 3 of the license.
 
11
 
 
12
    This library is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
    Lesser General Public License for more details.
 
16
 
 
17
    You should have received a copy of the GNU Lesser General Public
 
18
    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
19
*/
 
20
 
 
21
import QtQuick 2.2
 
22
import org.kde.plasma.components 2.0 as PlasmaComponents
 
23
import org.kde.plasma.core 2.0 as PlasmaCore
 
24
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
 
25
 
 
26
Item {
 
27
    id: toolbar;
 
28
 
 
29
    height: wifiSwitchButton.height;
 
30
 
 
31
    PlasmaNM.EnabledConnections {
 
32
        id: enabledConnections;
 
33
    }
 
34
 
 
35
    PlasmaNM.AvailableDevices {
 
36
        id: availableDevices;
 
37
    }
 
38
 
 
39
    PlasmaCore.Svg {
 
40
        id: lineSvg;
 
41
        imagePath: "widgets/line";
 
42
    }
 
43
 
 
44
    Row {
 
45
        anchors {
 
46
            bottom: parent.bottom;
 
47
            left: parent.left;
 
48
            top: parent.top;
 
49
        }
 
50
 
 
51
        SwitchButton {
 
52
            id: wifiSwitchButton;
 
53
 
 
54
            checked: enabled && enabledConnections.wirelessEnabled;
 
55
            enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled;
 
56
            icon: enabled ? "network-wireless-on" : "network-wireless-off";
 
57
            visible: availableDevices.wirelessDeviceAvailable;
 
58
 
 
59
            onClicked: {
 
60
                handler.enableWireless(checked);
 
61
            }
 
62
        }
 
63
 
 
64
        SwitchButton {
 
65
            id: wwanSwitchButton;
 
66
 
 
67
            checked: enabled && enabledConnections.wwanEnabled;
 
68
            enabled: enabledConnections.wwanHwEnabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled;
 
69
            icon: enabled ? "network-mobile-on" : "network-mobile-off";
 
70
            visible: availableDevices.modemDeviceAvailable;
 
71
 
 
72
            onClicked: {
 
73
                handler.enableWwan(checked);
 
74
            }
 
75
        }
 
76
 
 
77
        SwitchButton {
 
78
            id: planeModeSwitchButton;
 
79
 
 
80
            property bool airplaneModeEnabled: false;
 
81
 
 
82
            checked: airplaneModeEnabled;
 
83
            icon: airplaneModeEnabled ? "flightmode-on" : "flightmode-off";
 
84
 
 
85
            onClicked: {
 
86
                handler.enableAirplaneMode(checked);
 
87
                airplaneModeEnabled = !airplaneModeEnabled;
 
88
                console.log(airplaneModeEnabled);
 
89
            }
 
90
        }
 
91
    }
 
92
 
 
93
    PlasmaComponents.ToolButton {
 
94
        id: openEditorButton;
 
95
 
 
96
        anchors {
 
97
            right: parent.right;
 
98
            rightMargin: Math.round(units.gridUnit / 2);
 
99
            verticalCenter: parent.verticalCenter;
 
100
        }
 
101
 
 
102
        iconSource: "configure";
 
103
 
 
104
        onClicked: {
 
105
            handler.openEditor();
 
106
        }
 
107
    }
 
108
}