diff --git a/AppGrid.qml b/AppGrid.qml index d209be0..e9a28b3 100644 --- a/AppGrid.qml +++ b/AppGrid.qml @@ -13,6 +13,7 @@ LauncherPage { anchors.fill: parent property string textInput + property string favoritsLabel: "AAAA" property real labelPointSize: 16 property var appGroups: [] // QML elements with app grids @@ -116,7 +117,6 @@ LauncherPage { app.customCategory = filteredGroupNames[0] } }) - //appsAndShortcuts.sort(function(a, b) { return b["customCategory"] - a["customCategory"] }) createAppGroupsByCategory(appsAndShortcuts, groupedApps, true) } @@ -125,11 +125,11 @@ LauncherPage { function createAppGroupsByCategory(appsToGroup, groupedApps, useCustomGroups) { console.debug("AppGrid | createAppGroupsByCategory: ", appsToGroup.length, groupedApps.length, useCustomGroups) - var categoryKey = useCustomGroups ? "customCategory" : "category" + appsToGroup.sort(function(a, b) { - var aa = a[categoryKey] !== undefined ? a[categoryKey] : "" - var bb = b[categoryKey] !== undefined ? b[categoryKey] : "" + var aa = a[categoryKey] !== undefined ? a[categoryKey] : "ZZZZ" + var bb = b[categoryKey] !== undefined ? b[categoryKey] : "ZZZZ" if (aa > bb) return 1 else if (aa < bb) return -1 else return 0 @@ -205,7 +205,7 @@ LauncherPage { // console.debug(key, apps[i][key]); // }) // } - var app = apps.filter(e => e.appId === appToUpdate || (e.shortcutId !== undefined && e.shortcutId === appToUpdate))[0] + var app = apps.filter(e => e.package === appToUpdate || (e.shortcutId !== undefined && e.shortcutId === appToUpdate))[0] if (appGroupName !== undefined) { app.customCategory = appGroupName // Add to group @@ -604,12 +604,17 @@ LauncherPage { function createCustomGroupMenuItems() { var customGroups = settings.getCustomGroups() + + console.debug("AppGrid | Categories: " + JSON.stringify(customGroups)) + if (Object.keys(customGroups).indexOf(favoritsLabel) === -1) customGroups[favoritsLabel] = new Array + Object.keys(customGroups).forEach(key => { console.log("AppGrid | createCustomGroupMenuItems: Create custom group " + key) var component = Qt.createComponent("/AppGridMenuItem.qml", appContextMenu) + var appId = app.shortcutId !== undefined ? app.shortcutId : app.package var properties = { "height": appContextMenu.menuItemHeight, "innerSpacing" : mainView.innerSpacing, "labelPointSize" : appLauncher.labelPointSize, "labelWidth" : appContextMenu.menuWidth, - "appId" : app.itemId, "appGroup" : key, "appLauncher": appLauncher} + "appId" : appId, "appGroup" : key, "appLauncher": appLauncher} var object = component.createObject(appContextMenu, properties) appContextMenu.addItem(object) console.log("AppGrid | createCustomGroupMenuItems: Menu items " + appContextMenu.count) diff --git a/AppGridMenuItem.qml b/AppGridMenuItem.qml index bf7a466..33b66a3 100644 --- a/AppGridMenuItem.qml +++ b/AppGridMenuItem.qml @@ -15,7 +15,7 @@ MenuItem { font.pointSize: labelPointSize contentItem: Label { width: appGridMenuItem.labelWidth - text: qsTr("Add to ") + appGridMenuItem.appGroup + text: appGridMenuItem.appGroup === "AAAA" ? "★ " + qsTr("Add to ") + qsTr("Favorits") : qsTr("Add to ") + appGridMenuItem.appGroup font: appGridMenuItem.font horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap diff --git a/AppGroup.qml b/AppGroup.qml index a44a43e..5349c87 100644 --- a/AppGroup.qml +++ b/AppGroup.qml @@ -105,6 +105,7 @@ Item { topPadding: groupItem.groupIndex === 0 ? 0 : groupItem.groupIndex === 1 && groupItem.selectedGroupIndex === 0 ? groupItem.innerSpacing / 2 : groupItem.innerSpacing + Button { id: groupHeader visible: groupItem.isHeaderVisible @@ -112,7 +113,7 @@ Item { flat: true text: groupItem.groupLabel contentItem: Label { - text: groupHeader.text + text: groupHeader.text === "AAAA" ? qsTr("Favorits") : groupHeader.text padding: groupItem.innerSpacing / 2 color: Universal.foreground opacity: 0.5 @@ -130,7 +131,7 @@ Item { } onPressAndHold: { - groupItem.parent.openGroupContextMenu(groupHeader, groupGrid) + if (groupHeader.text !== "AAAA") groupItem.parent.openGroupContextMenu(groupHeader, groupGrid) } } diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 835a68c..5413732 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - +