Changeset View
Changeset View
Standalone View
Standalone View
sddm-theme/SessionButton.qml
Show All 16 Lines | |||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.2 | 20 | import QtQuick 2.2 | ||
21 | 21 | | |||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | 24 | | |||
25 | import QtQuick.Controls 1.3 as QQC | 25 | import QtQuick.Controls 2.8 | ||
ngraham: `import QtQuick.Controls 2.8 as QQC2` | |||||
26 | 26 | | |||
27 | PlasmaComponents.ToolButton { | 27 | PlasmaComponents.ToolButton { | ||
28 | id: root | 28 | id: root | ||
29 | property int currentIndex: -1 | 29 | property int currentIndex: -1 | ||
30 | 30 | | |||
31 | implicitWidth: minimumWidth | 31 | implicitWidth: minimumWidth | ||
32 | 32 | | |||
33 | visible: menu.items.length > 1 | 33 | visible: menu.items.length > 1 | ||
34 | 34 | | |||
35 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Desktop Session: %1", instantiator.objectAt(currentIndex).text || "") | 35 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Desktop Session: %1", instantiator.objectAt(currentIndex).text || "") | ||
36 | 36 | | |||
37 | font.pointSize: config.fontSize | 37 | font.pointSize: config.fontSize | ||
38 | 38 | | |||
39 | Component.onCompleted: { | 39 | Component.onCompleted: { | ||
40 | currentIndex = sessionModel.lastIndex | 40 | currentIndex = sessionModel.lastIndex | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | menu: QQC.Menu { | 43 | menu: Menu { | ||
44 | id: menu | 44 | id: menu | ||
45 | style: BreezeMenuStyle {} | 45 | style: BreezeMenuStyle {} | ||
46 | Instantiator { | 46 | Instantiator { | ||
47 | id: instantiator | 47 | id: instantiator | ||
48 | model: sessionModel | 48 | model: sessionModel | ||
49 | onObjectAdded: menu.insertItem(index, object) | 49 | onObjectAdded: menu.insertItem(index, object) | ||
50 | onObjectRemoved: menu.removeItem( object ) | 50 | onObjectRemoved: menu.removeItem( object ) | ||
51 | delegate: QQC.MenuItem { | 51 | delegate: MenuItem { | ||
52 | text: model.name | 52 | text: model.name | ||
53 | onTriggered: { | 53 | onTriggered: { | ||
54 | root.currentIndex = model.index | 54 | root.currentIndex = model.index | ||
55 | } | 55 | } | ||
56 | } | 56 | } | ||
57 | } | 57 | } | ||
58 | } | 58 | } | ||
59 | } | 59 | } |
import QtQuick.Controls 2.8 as QQC2