Guest User

Untitled

a guest
May 16th, 2014
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.35 KB | None | 0 0
  1. /********************************************************************
  2.  KSld - the KDE Screenlocker Daemon
  3.  This file is part of the KDE project.
  4.  
  5. Copyright (C) 2011 Martin Gräßlin <[email protected]>
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program 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
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19. *********************************************************************/
  20. import QtQuick 1.1
  21. import org.kde.plasma.core 0.1 as PlasmaCore
  22. import org.kde.qtextracomponents 0.1
  23. import org.kde.kscreenlocker 1.0
  24. import org.kde.plasma.components 0.1 as PlasmaComponents
  25.  
  26. Item {
  27.     id: lockScreen
  28.     signal unlockRequested()
  29.     property alias capsLockOn: unlockUI.capsLockOn
  30.     property bool locked: false
  31.  
  32.     PlasmaCore.Theme {
  33.         id: theme
  34.     }
  35.  
  36.     // if there's no image, have a near black background
  37.     Rectangle {
  38.         width: parent.width
  39.         height: parent.height
  40.         color: "#111"
  41.     }
  42.  
  43.     Image {
  44.         id: background
  45.         anchors.fill: parent
  46.         source: theme.wallpaperPathForSize(parent.width, parent.height)
  47.     source: "1366x768.jpg"
  48.         smooth: true
  49.     }
  50.  
  51.     PlasmaCore.FrameSvgItem {
  52.         id: dialog
  53.         visible: lockScreen.locked
  54.         anchors.centerIn: parent
  55.         imagePath: "widgets/background"
  56.         width: mainStack.currentPage.implicitWidth + margins.left + margins.right
  57.         height: mainStack.currentPage.implicitHeight + margins.top + margins.bottom
  58.  
  59.         Behavior on height {
  60.             enabled: mainStack.currentPage != null
  61.             NumberAnimation {
  62.                 duration: 250
  63.             }
  64.         }
  65.         Behavior on width {
  66.             enabled: mainStack.currentPage != null
  67.             NumberAnimation {
  68.                 duration: 250
  69.             }
  70.         }
  71.         PlasmaComponents.PageStack {
  72.             id: mainStack
  73.             clip: true
  74.             anchors {
  75.                 fill: parent
  76.                 leftMargin: dialog.margins.left
  77.                 topMargin: dialog.margins.top
  78.                 rightMargin: dialog.margins.right
  79.                 bottomMargin: dialog.margins.bottom
  80.             }
  81.             initialPage: unlockUI
  82.         }
  83.     }
  84.  
  85.     Greeter {
  86.         id: unlockUI
  87.  
  88.         switchUserEnabled: userSessionsUI.switchUserSupported
  89.  
  90.         Connections {
  91.             onAccepted: lockScreen.unlockRequested()
  92.             onSwitchUserClicked: { mainStack.push(userSessionsUI); userSessionsUI.forceActiveFocus(); }
  93.         }
  94.     }
  95.  
  96.     function returnToLogin() {
  97.         mainStack.pop();
  98.         unlockUI.resetFocus();
  99.     }
  100.  
  101.     // TODO: loader
  102.     SessionSwitching {
  103.         id: userSessionsUI
  104.         visible: false
  105.  
  106.         Connections {
  107.             onCancel: returnToLogin()
  108.             onActivateSession: returnToLogin()
  109.             onStartNewSession: returnToLogin()
  110.         }
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment