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

« back to all changes in this revision

Viewing changes to themes/userbar/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
 
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
21
20
import org.kde.plasma.components 0.1 as PlasmaComponents
22
21
import org.kde.plasma.core 0.1 as PlasmaCore
23
 
import MyLibrary 1.0 as LightDMPlasmaWidgets
24
22
 
25
23
Item {
26
24
    id: screen
31
29
 
32
30
    Image {
33
31
        fillMode: Image.PreserveAspectCrop
34
 
        source: plasmaTheme.wallpaperPath()
 
32
        source: config.readEntry("Background") ? config.readEntry("Background"): plasmaTheme.wallpaperPath();
35
33
        anchors.fill: parent
36
34
        visible: source != ""
 
35
        smooth: true
37
36
    }
38
37
 
39
38
    Connections {
197
196
            greeter.authenticate(username);
198
197
        }
199
198
    }
 
199
    
 
200
    function indexForUserName(name) {
 
201
        var index;
 
202
        for (index = 0; index < usersList.count; ++index) {
 
203
            if (usersList.contentItem.children[index].username == name) {
 
204
                return index;
 
205
            }
 
206
        }
 
207
        return 0;
 
208
    }
200
209
 
201
210
    ListView {
202
211
        id: usersList
207
216
        }
208
217
        width: parent.width
209
218
        height: userItemHeight
210
 
 
 
219
        currentIndex: indexForUserName(greeter.selectGuest ? guestLogin : greeter.selectUser)
211
220
        model: usersModel
212
221
 
213
222
        cacheBuffer: count * 80
271
280
            opacity: 1 - passwordInput.opacity
272
281
 
273
282
            iconSource: loginButton.iconSource
274
 
            text: "Login"
 
283
            text: i18n("Login")
275
284
            onClicked: startLogin();
276
285
 
277
286
            Behavior on opacity {
291
300
 
292
301
        model: sessionsModel
293
302
        dataRole: "key"
294
 
        currentIndex: indexForData(usersList.currentItem.usersession)
 
303
        currentIndex: {
 
304
            index = indexForData(usersList.currentItem.usersession)
 
305
            if (index >= 0) {
 
306
                return index;
 
307
            }
 
308
            index = indexForData(greeter.defaultSession)
 
309
            if (index >= 0) {
 
310
                return index;
 
311
            }
 
312
            return 0;
 
313
        }
295
314
    }
296
315
 
297
316
    // Bottom "Power" bar
340
359
                text: i18n("Shutdown")
341
360
                iconSource: "system-shutdown"
342
361
                enabled: power.canShutdown
343
 
                onClicked: power.shutDown();
 
362
                onClicked: power.shutdown();
344
363
            }
345
364
        }
346
365
    }