Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/package/contents/ui/main.qml
Show All 37 Lines | 33 | Item { | |||
---|---|---|---|---|---|
38 | Layout.maximumWidth: Globals.PlasmoidWidth | 38 | Layout.maximumWidth: Globals.PlasmoidWidth | ||
39 | Layout.minimumHeight: wrapper.minimumHeight + wrapper.anchors.topMargin + wrapper.anchors.bottomMargin | 39 | Layout.minimumHeight: wrapper.minimumHeight + wrapper.anchors.topMargin + wrapper.anchors.bottomMargin | ||
40 | Layout.maximumHeight: Layout.minimumHeight | 40 | Layout.maximumHeight: Layout.minimumHeight | ||
41 | 41 | | |||
42 | function isBottomEdge() { | 42 | function isBottomEdge() { | ||
43 | return plasmoid.location == PlasmaCore.Types.BottomEdge; | 43 | return plasmoid.location == PlasmaCore.Types.BottomEdge; | ||
44 | } | 44 | } | ||
45 | 45 | | |||
46 | // The wrapper just exists for giving an appropriate top/bottom margin | | |||
47 | // when it is placed on the top/bottom edge of the screen | | |||
48 | Item { | 46 | Item { | ||
49 | id: wrapper | 47 | id: wrapper | ||
50 | 48 | | |||
51 | // | | |||
52 | // The +20 is so that the minimumHeight is always at least 20+. If the height | | |||
53 | // is too small then Plasma will ignore the fact that it is a PopupApplet | | |||
54 | // and put the SearchField directly in the panel. | | |||
55 | // | | |||
56 | property int minimumHeight: listView.count ? listView.contentHeight + searchField.height + 5 | 49 | property int minimumHeight: listView.count ? listView.contentHeight + searchField.height + 5 | ||
57 | : searchField.height + 20 | 50 | : searchField.height | ||
58 | property int maximumHeight: minimumHeight | 51 | property int maximumHeight: minimumHeight | ||
52 | anchors.fill: parent | ||||
59 | 53 | | |||
60 | anchors { | | |||
61 | fill: parent | | |||
62 | topMargin: isBottomEdge() ? 0 : 7 | | |||
63 | bottomMargin: isBottomEdge() ? 7 : 0 | | |||
64 | } | | |||
65 | 54 | | |||
66 | SearchField { | 55 | SearchField { | ||
67 | id: searchField | 56 | id: searchField | ||
68 | 57 | | |||
69 | anchors { | 58 | anchors { | ||
70 | left: parent.left | 59 | left: parent.left | ||
71 | right: parent.right | 60 | right: parent.right | ||
61 | verticalCenter: parent.height / 2 | ||||
72 | } | 62 | } | ||
73 | onSearchTextChanged: { | 63 | onSearchTextChanged: { | ||
74 | listView.setQueryString(text) | 64 | listView.setQueryString(text) | ||
75 | } | 65 | } | ||
76 | } | 66 | } | ||
77 | 67 | | |||
78 | Milou.ResultsView { | 68 | Milou.ResultsView { | ||
79 | id: listView | 69 | id: listView | ||
80 | //in case is expanded | 70 | //in case is expanded | ||
81 | clip: true | 71 | clip: true | ||
82 | 72 | | |||
83 | anchors { | 73 | anchors { | ||
84 | left: parent.left | 74 | left: parent.left | ||
85 | right: parent.right | 75 | right: parent.right | ||
86 | | ||||
87 | // vHanda: Random number - Is there some way to use consisten margins? | | |||
88 | // PlasmaCore.FrameSvg does have margins, but one needs to construct | | |||
89 | // a PlasmaCore.FrameSvg for that | | |||
90 | topMargin: isBottomEdge() ? 0 : 5 | | |||
91 | bottomMargin: isBottomEdge() ? 5 : 0 | | |||
92 | } | 76 | } | ||
93 | 77 | | |||
94 | reversed: isBottomEdge() | 78 | reversed: isBottomEdge() | ||
95 | onActivated: { | 79 | onActivated: { | ||
96 | plasmoid.hidePopup() | 80 | plasmoid.hidePopup() | ||
97 | } | 81 | } | ||
98 | } | 82 | } | ||
99 | 83 | | |||
Show All 24 Lines | 103 | Timer { | |||
124 | onTriggered: { | 108 | onTriggered: { | ||
125 | setTextFieldFocus(plasmoid.expanded) | 109 | setTextFieldFocus(plasmoid.expanded) | ||
126 | } | 110 | } | ||
127 | } | 111 | } | ||
128 | 112 | | |||
129 | function setTextFieldFocus(shown) { | 113 | function setTextFieldFocus(shown) { | ||
130 | searchField.setFocus(); | 114 | searchField.setFocus(); | ||
131 | searchField.selectAll(); | 115 | searchField.selectAll(); | ||
132 | | ||||
133 | //if (!shown) | | |||
134 | // listView.clearPreview(); | | |||
135 | } | 116 | } | ||
136 | 117 | | |||
137 | function loadSettings() { | 118 | function loadSettings() { | ||
138 | listView.loadSettings() | 119 | listView.loadSettings() | ||
139 | } | 120 | } | ||
140 | 121 | | |||
141 | Plasmoid.onExpandedChanged: { | 122 | Plasmoid.onExpandedChanged: { | ||
142 | setTextFieldFocus(plasmoid.expanded); | 123 | setTextFieldFocus(plasmoid.expanded); | ||
Show All 10 Lines |