Skip to content

Commit 3377d35

Browse files
committed
Add Menu Position, Pinned items, recommended items, show description for all apps and runner model grid options
1 parent 99a703d commit 3377d35

File tree

5 files changed

+95
-38
lines changed

5 files changed

+95
-38
lines changed

contents/config/main.xml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,21 @@
7878
<label>The plugin id's of additional KRunner plugins to use. Only used if useExtraRunners is true.</label>
7979
<default>shell,bookmarks,baloosearch,locations</default>
8080
</entry>
81-
<entry name="centerMenu" type="Bool">
82-
<label>Whether to center the popup Menu.</label>
83-
<default>true</default>
81+
<entry name="menuPosition" type="Int">
82+
<label>The position of the menu: 0 = Center, 1 = Edge, 2 = Auto</label>
83+
<default>0</default>
84+
</entry>
85+
<entry name="favGridModel" type="Int">
86+
<label>The model for favorite grid / pinned apps grid: 0 = Favourite apps, 1 = Recent apps, 2 = Recent Documents</label>
87+
<default>0</default>
88+
</entry>
89+
<entry name="recentGridModel" type="Int">
90+
<label>The model for recent item grid / recommended grid: 0 = Recent Documents, 1 = Recent apps, 2 = Favourite apps, 3 = None</label>
91+
<default>0</default>
92+
</entry>
93+
<entry name="showDescription" type="Bool">
94+
<label>Whether to show the description for app and search items or not.</label>
95+
<default>false</default>
8496
</entry>
8597
<entry name="alwaysShowSearchBar" type="Bool">
8698
<label>Whether to always show the search bar on top of the menu or not.</label>

contents/ui/ConfigGeneral.qml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ Kirigami.FormLayout {
5151
property alias cfg_showRecentContacts: showRecentContacts.checked
5252

5353
property alias cfg_useExtraRunners: useExtraRunners.checked
54-
property alias cfg_centerMenu: centerMenu.checked
54+
property alias cfg_menuPosition: menuPosition.currentIndex
55+
property alias cfg_favGridModel: favGridModel.currentIndex
56+
property alias cfg_recentGridModel: recentGridModel.currentIndex
5557
property alias cfg_reduceIconSizeFooter: reduceIconSizeFooter.checked
5658
property alias cfg_gridAllowTwoLines: gridAllowTwoLines.checked
5759
property alias cfg_defaultAllApps: defaultAllApps.checked
60+
property alias cfg_showDescription: showDescription.checked
5861

5962
property alias cfg_downIconsDocuments: downIconsDocuments.checked
6063
property alias cfg_downIconsDownloads: downIconsDownloads.checked
@@ -169,17 +172,45 @@ Kirigami.FormLayout {
169172
Kirigami.FormData.isSection: true
170173
}
171174

175+
ComboBox {
176+
id: menuPosition
172177

173-
CheckBox {
174-
id: centerMenu
178+
Kirigami.FormData.label: i18n("Menu Position:")
175179

176-
Kirigami.FormData.label: i18n("Panel Properties:")
180+
model: [i18n("Center"), i18n("On Edge"), i18n("Auto")]
181+
}
182+
183+
Item {
184+
Kirigami.FormData.isSection: true
185+
}
186+
187+
ComboBox {
188+
id: favGridModel
189+
190+
Kirigami.FormData.label: i18n("Pinned items:")
191+
192+
model: [i18n("Favourite apps"), i18n("Recent apps"), i18n("Recent Documents")]
193+
}
194+
195+
Item {
196+
Kirigami.FormData.isSection: true
197+
}
177198

178-
text: i18n("Center menu")
199+
ComboBox {
200+
id: recentGridModel
201+
202+
Kirigami.FormData.label: i18n("Recommended items:")
203+
204+
model: [i18n("Recent Documents"), i18n("Recent apps"), i18n("Favourite apps"), i18n("None")]
205+
}
206+
207+
Item {
208+
Kirigami.FormData.isSection: true
179209
}
180210

181211
CheckBox {
182212
id: defaultAllApps
213+
Kirigami.FormData.label: i18n("Panel Properties:")
183214
text: i18n("Show All Apps By Default")
184215
}
185216

@@ -193,6 +224,11 @@ Kirigami.FormLayout {
193224
text: i18n("Allow label to have two lines (Pinned)")
194225
}
195226

227+
CheckBox {
228+
id: showDescription
229+
text: i18n("Show Description for all apps and search items")
230+
}
231+
196232
Item {
197233
Kirigami.FormData.isSection: true
198234
}

contents/ui/ItemMultiGridView.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ PlasmaExtras.ScrollArea {
4141
signal keyNavDown()
4242

4343
property bool grabFocus: false
44+
property bool showDescriptions: false
4445
property int iconSize: units.iconSizes.medium
4546

4647
property alias model: repeater.model
@@ -134,7 +135,8 @@ PlasmaExtras.ScrollArea {
134135
top: gridViewLabel.bottom
135136
topMargin: units.smallSpacing
136137
}
137-
138+
showDescriptions: itemMultiGrid.showDescriptions
139+
increaseLeftSpacings: true
138140
//TODO >
139141
dragEnabled: false
140142
dropEnabled: false

contents/ui/MainColumnItem.qml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Item {
6363
signal newTextQuery(string text)
6464
property real mainColumnHeight: tileSide * 3
6565
property real favoritesColumnHeight: (units.iconSizes.medium + units.smallSpacing * 2) * 4
66-
66+
property var pinnedModel: plasmoid.configuration.favGridModel == 0 ? globalFavorites : plasmoid.configuration.favGridModel == 1 ? rootModel.modelForRow(0) : rootModel.modelForRow(1)
67+
property var recommendedModel: plasmoid.configuration.recentGridModel == 0 ? rootModel.modelForRow(1) : plasmoid.configuration.recentGridModel == 1 ? rootModel.modelForRow(0) : globalFavorites
68+
6769
function reset() {
6870
if (showRecents) resetPinned.start();
6971
searchField.clear()
@@ -137,8 +139,8 @@ Item {
137139
if (done) {
138140
return;
139141
}
140-
globalFavoritesGrid.model = globalFavorites
141-
documentsFavoritesGrid.model = rootModel.modelForRow(1);
142+
globalFavoritesGrid.model = pinnedModel
143+
documentsFavoritesGrid.model = recommendedModel
142144
allAppsGrid.model = rootModel.modelForRow(2);
143145
done = true;
144146
mainColumn.visible = true
@@ -292,7 +294,7 @@ Item {
292294
bottom: searching ? parent.bottom : showAllApps ? footer.top : undefined
293295
bottomMargin: showAllApps ? 5 : 0
294296
}
295-
height: searching || showAllApps ? parent.height : mainColumnHeight
297+
height: searching || showAllApps || plasmoid.configuration.recentGridModel == 3 ? parent.height : mainColumnHeight
296298
property Item visibleGrid: globalFavoritesGrid
297299
function tryActivate(row, col) {
298300
if (visibleGrid) {
@@ -302,9 +304,9 @@ Item {
302304

303305
ItemGridView {
304306
id: globalFavoritesGrid
305-
model: globalFavorites
307+
model: pinnedModel
306308
width: parent.width
307-
height: tileSide * 3
309+
height: plasmoid.configuration.recentGridModel == 3 ? parent.height : tileSide * 3
308310
cellWidth: tileSide
309311
cellHeight: tileSide
310312
square: true
@@ -332,6 +334,7 @@ Item {
332334
width: parent.width
333335
model: rootModel.modelForRow(2)
334336
opacity: showAllApps && !searching ? 1.0 : 0.0
337+
showDescriptions: plasmoid.configuration.showDescription
335338
anchors {
336339
leftMargin: units.largeSpacing * 1.6;
337340
}
@@ -349,6 +352,7 @@ Item {
349352
enabled: (opacity == 1.0) ? 1 : 0
350353
width: parent.width
351354
model: runnerModel
355+
showDescriptions: plasmoid.configuration.showDescription
352356
opacity: searching ? 1.0 : 0.0
353357
onOpacityChanged: {
354358
if (opacity == 1.0) {
@@ -409,6 +413,7 @@ Item {
409413
anchors.bottom: parent.bottom
410414
anchors.leftMargin: units.largeSpacing * 3
411415
anchors.rightMargin: units.largeSpacing
416+
visible: plasmoid.configuration.recentGridModel != 3
412417

413418
property int iconSize: 22
414419

@@ -471,7 +476,7 @@ Item {
471476
left: parent.left
472477
}
473478
x: -units.smallSpacing
474-
visible: !searching && !showAllApps && !showRecents
479+
visible: documentsFavoritesGrid.model.count > 6 && !searching && !showAllApps && !showRecents
475480
}
476481

477482
ItemGridView {
@@ -492,7 +497,7 @@ Item {
492497
cellWidth: parent.width * 0.4
493498
cellHeight: units.iconSizes.medium + units.smallSpacing * 5
494499
iconSize: units.iconSizes.medium
495-
model: rootModel.modelForRow(1);
500+
model: recommendedModel
496501
usesPlasmaTheme: false
497502

498503
onKeyNavUp: {

contents/ui/MenuRepresentation.qml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,37 @@ PlasmaCore.Dialog {
8585
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
8686
var x = offset;
8787
var y = screen.height - height - offset;
88-
var horizMidPoint; z
89-
var vertMidPoint;
90-
var appletTopLeft;
91-
if (plasmoid.configuration.centerMenu) {
92-
horizMidPoint = screen.x + (screen.width / 2);
93-
vertMidPoint = screen.y + (screen.height / 2);
94-
x = horizMidPoint - width / 2;
95-
//y = vertMidPoint - height / 2;
96-
y = plasmoid.location === PlasmaCore.Types.TopEdge ? parent.height + panelSvg.margins.bottom + offset + 6 : screen.height - height - offset - panelSvg.margins.top - 6;
88+
var horizMidPoint = screen.x + (screen.width / 2);
89+
var vertMidPoint = screen.y + (screen.height / 2);
90+
var appletTopLeft = parent.mapToGlobal(0, 0);
91+
var appletBottomLeft = parent.mapToGlobal(0, parent.height);
92+
if (plasmoid.configuration.menuPosition == 0) {
93+
x = plasmoid.location === PlasmaCore.Types.LeftEdge ? parent.width + panelSvg.margins.right + offset + 6 : plasmoid.location === PlasmaCore.Types.RightEdge ? appletTopLeft.x - panelSvg.margins.left - offset - width - 6 : horizMidPoint - width / 2;
94+
y = plasmoid.location === PlasmaCore.Types.TopEdge ? parent.height + panelSvg.margins.bottom + offset + 6 : plasmoid.location === PlasmaCore.Types.BottomEdge ? screen.height - height - offset - panelSvg.margins.top - 6 : vertMidPoint - height / 2;
9795
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
98-
horizMidPoint = screen.x + (screen.width / 2);
99-
appletTopLeft = parent.mapToGlobal(0, 0);
100-
x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset + 6 : (screen.x + screen.width) - width - offset - 6;
96+
if (plasmoid.configuration.menuPosition == 1)
97+
x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset + 6 : (screen.x + screen.width) - width - offset - 6;
98+
else
99+
x = appletTopLeft.x - width / 2
101100
y = screen.height - height - offset - panelSvg.margins.top - 6;
102101
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
103-
horizMidPoint = screen.x + (screen.width / 2);
104-
var appletBottomLeft = parent.mapToGlobal(0, parent.height);
105-
x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset + 6 : (screen.x + screen.width) - width - offset - 6;
102+
if (plasmoid.configuration.menuPosition == 1)
103+
x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset + 6 : (screen.x + screen.width) - width - offset - 6;
104+
else
105+
x = appletBottomLeft.x - width / 2
106106
y = parent.height + panelSvg.margins.bottom + offset + 6;
107107
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
108-
vertMidPoint = screen.y + (screen.height / 2);
109-
appletTopLeft = parent.mapToGlobal(0, 0);
110108
x = parent.width + panelSvg.margins.right + offset + 6;
111-
y = (appletTopLeft.y < vertMidPoint) ? screen.y + offset + 6 : (screen.y + screen.height) - height - offset - 6;
109+
if (plasmoid.configuration.menuPosition == 1)
110+
y = (appletTopLeft.y < vertMidPoint) ? screen.y + offset + 6 : (screen.y + screen.height) - height - offset - 6;
111+
else
112+
y = appletTopLeft.y - height / 2
112113
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
113-
vertMidPoint = screen.y + (screen.height / 2);
114-
appletTopLeft = parent.mapToGlobal(0, 0);
115114
x = appletTopLeft.x - panelSvg.margins.left - offset - width - 6;
116-
y = (appletTopLeft.y < vertMidPoint) ? screen.y + offset + 6 : (screen.y + screen.height) - height - offset - 6;
115+
if (plasmoid.configuration.menuPosition == 1)
116+
y = (appletTopLeft.y < vertMidPoint) ? screen.y + offset + 6 : (screen.y + screen.height) - height - offset - 6;
117+
else
118+
y = appletTopLeft.y - height / 2
117119
}
118120

119121
return Qt.point(x, y);

0 commit comments

Comments
 (0)