~ubuntu-branches/ubuntu/vivid/lightdm-kde/vivid

« back to all changes in this revision

Viewing changes to themes/classic/main.qml

  • Committer: Package Import Robot
  • Author(s): Michal Zajac
  • Date: 2012-07-22 19:44:44 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120722194444-aaueaylu3ddnqcth
Tags: 0.2.1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
along with LightDM-KDE.  If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
19
import QtQuick 1.0
 
20
//TODO phase this out
20
21
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
21
22
import org.kde.plasma.components 0.1 as PlasmaComponents
 
23
import org.kde.qtextracomponents 0.1 as ExtraComponents
22
24
import org.kde.plasma.core 0.1 as PlasmaCore
 
25
 
23
26
import MyLibrary 1.0 as LightDMPlasmaWidgets
24
27
 
25
28
Item {
26
29
    width: screenSize.width;
27
30
    height: screenSize.height;
28
31
 
29
 
    Image {
30
 
        fillMode: Image.PreserveAspectCrop
31
 
        anchors.fill: parent
32
 
        //read from config, if there's no entry use plasma theme
33
 
        source: config.readEntry("Background") ? config.readEntry("Background"): plasmaTheme.wallpaperPath();
34
 
    }
 
32
    ScreenManager {
 
33
        id: screenManager
 
34
        delegate: Image {
 
35
            fillMode: Image.PreserveAspectCrop          
 
36
            //read from config, if there's no entry use plasma theme
 
37
            source: config.readEntry("Background") ? config.readEntry("Background"): plasmaTheme.wallpaperPath();
 
38
        }
 
39
    }
 
40
 
 
41
    Item { //recreate active screen at a sibling level which we can anchor in.
 
42
        id: activeScreen
 
43
        x: screenManager.activeScreen.x
 
44
        y: screenManager.activeScreen.y
 
45
        width: screenManager.activeScreen.width
 
46
        height: screenManager.activeScreen.height
 
47
    }
 
48
 
35
49
 
36
50
    Connections {
37
51
        target: greeter;
49
63
            }
50
64
            else {
51
65
                feedbackLabel.text = i18n("Sorry, incorrect password please try again.");
 
66
                passwordInput.selectAll()
 
67
                passwordInput.forceActiveFocus()
52
68
            }
53
69
        }
54
70
    }
60
76
    PlasmaCore.FrameSvgItem {
61
77
        id: dialog;
62
78
        imagePath: "translucent/dialogs/background"
63
 
        anchors.centerIn: parent;
 
79
        anchors.centerIn: activeScreen;
64
80
 
65
 
        width: childrenRect.width + 80;
 
81
        width: childrenRect.width + 40;
66
82
        height: childrenRect.height + 40;
67
83
 
68
84
        Column {
87
103
            }
88
104
 
89
105
            Row {
90
 
                Image {
91
 
                    source: "image://icon/meeting-participant"
92
 
                    height: usernameInput.height;
93
 
                    fillMode: Image.PreserveAspectFit
94
 
 
95
 
                }
96
 
 
97
 
                //not actually a password!
98
 
                LightDMPlasmaWidgets.LineEdit {
99
 
                    id: usernameInput;
100
 
                    width: 250;
101
 
                    height: 30;
102
 
                    clickMessage: "Username";
103
 
                    clearButtonShown: true;
104
 
                    onReturnPressed: {
105
 
                        passwordInput.setFocus();
106
 
                    }
 
106
                spacing: 10
 
107
                width: childrenRect.width
 
108
                height: childRect.height
 
109
                
 
110
                Grid {
 
111
                    columns: 2
 
112
                    spacing: 5
107
113
                    
108
 
                     Component.onCompleted: {
109
 
                        usernameInput.setFocus();
110
 
                    }
111
 
                }
112
 
            }
113
 
 
114
 
 
115
 
            Row {
116
 
                Image {
117
 
                    source: "image://icon/object-locked.png"
118
 
                    height: passwordInput.height;
119
 
                    fillMode: Image.PreserveAspectFit
120
 
 
121
 
                }
122
 
 
123
 
                LightDMPlasmaWidgets.LineEdit {
124
 
                    id: passwordInput;
125
 
                    width: 250;
126
 
                    height: 30;
127
 
                    clickMessage: i18n("Password");
128
 
                    passwordMode: true;
129
 
                    onReturnPressed: {
130
 
                        login();
131
 
                    }
132
 
                }
133
 
            }
134
 
 
135
 
            Row {
136
 
                anchors.horizontalCenter: parent.horizontalCenter;
137
 
                spacing:10;
138
 
 
139
 
                PlasmaComponents.Button {
140
 
                    text: i18n("Login");
 
114
                    ExtraComponents.QIconItem {
 
115
                        icon: "meeting-participant"
 
116
                        height: passwordInput.height;
 
117
                        width: passwordInput.height;
 
118
                    }
 
119
 
 
120
                    /*PlasmaComponents.*/TextField {
 
121
                        id: usernameInput;
 
122
                        placeholderText: i18n("Username");
 
123
                        text: greeter.selectUser
 
124
                        onAccepted: {
 
125
                            passwordInput.focus = true;
 
126
                        }
 
127
                        
 
128
                        Component.onCompleted: {
 
129
                            //if the username field has text, focus the password, else focus the username
 
130
                            if (parent.text) {
 
131
                                passwordInput.focus = true
 
132
                            } else {
 
133
                                usernameInput.focus = true
 
134
                            }
 
135
                        }
 
136
                        
 
137
                        KeyNavigation.tab: passwordInput
 
138
                    }
 
139
 
 
140
                    ExtraComponents.QIconItem {
 
141
                        icon: "object-locked"
 
142
                        height: passwordInput.height;
 
143
                        width: passwordInput.height;
 
144
                    }
 
145
 
 
146
                    /*PlasmaComponents.*/TextField {
 
147
                        id: passwordInput
 
148
                        echoMode: TextInput.Password
 
149
                        placeholderText: i18n("Password")
 
150
                        onAccepted: {
 
151
                            login();
 
152
                        }
 
153
                        KeyNavigation.backtab: usernameInput
 
154
                        KeyNavigation.tab: loginButton
 
155
                    }
 
156
                }
 
157
                
 
158
                /*PlasmaComponents.*/ToolButton {
 
159
                    id: loginButton
 
160
                    anchors.verticalCenter: parent.verticalCenter
 
161
                    iconSource: "go-next"
141
162
                    onClicked: {
142
163
                        login();
143
164
                    }
 
165
                    KeyNavigation.backtab: passwordInput
 
166
                    KeyNavigation.tab: usernameInput
144
167
                }
 
168
            }
145
169
 
146
 
                PlasmaComponents.Button  {
147
 
                    text: i18n("Power");
 
170
            Item {
 
171
                height: 10
 
172
            }
 
173
            
 
174
            
 
175
            Row {               
 
176
                spacing: 5;
 
177
                  IconButton {
 
178
                    icon: "system-shutdown"                    
148
179
                    onClicked: {
149
180
                        if (powerDialog.opacity == 1) {
150
181
                            powerDialog.opacity = 0;
151
182
                        } else {
152
183
                            powerDialog.opacity = 1;
153
184
                        }
154
 
 
155
185
                        optionsDialog.opacity = 0;
156
186
                    }
157
187
                }
158
188
 
159
 
                PlasmaComponents.Button  {
160
 
                    text: i18n("Options");
 
189
                
 
190
                IconButton {
 
191
                    icon: "system-log-out"
161
192
                    onClicked: {
162
193
                        if (optionsDialog.opacity == 1) {
163
194
                            optionsDialog.opacity = 0;
164
195
                        } else {
165
196
                            optionsDialog.opacity = 1;
166
197
                        }
167
 
 
168
198
                        powerDialog.opacity = 0;
169
199
                    }
170
200
                }
171
 
 
172
201
            }
173
202
        }
174
203
    }
177
206
        id: powerDialog;
178
207
        anchors.top: dialog.bottom
179
208
        anchors.topMargin: 3
180
 
        anchors.horizontalCenter: parent.horizontalCenter
 
209
        anchors.horizontalCenter: activeScreen.horizontalCenter
181
210
        imagePath: "translucent/dialogs/background"
182
211
        opacity: 0
183
212
 
215
244
                text: i18n("Shutdown")
216
245
                icon: QIcon("system-shutdown")
217
246
                enabled: power.canShutdown;
218
 
                onClicked: {power.shutDown();}
 
247
                onClicked: {power.shutdown();}
219
248
            }     
220
249
        }
221
250
 
226
255
        id: optionsDialog;
227
256
        anchors.top: dialog.bottom
228
257
        anchors.topMargin: 3
229
 
        anchors.horizontalCenter: parent.horizontalCenter
 
258
        anchors.horizontalCenter: activeScreen.horizontalCenter
230
259
        imagePath: "translucent/dialogs/background"
231
260
        opacity: 0
232
261
 
251
280
                width: 200;
252
281
                Component.onCompleted : {
253
282
                    sessionCombo.currentIndex = sessionCombo.indexForData("", sessionsModel.key);
 
283
                    model.showLastUsedSession = true
254
284
                }
255
285
            }
256
 
 
257
 
            PlasmaComponents.Label {
258
 
                text: i18n("Language:")
259
 
                anchors.verticalCenter: parent.verticalCenter;
260
 
            }
261
 
 
262
 
            PlasmaWidgets.ComboBox {
263
 
                anchors.verticalCenter: parent.verticalCenter;
264
 
            }
265
 
 
266
286
        }
267
287
    }
268
288
}