mirror of
https://gitgud.io/wackyideas/aerothemeplasma.git
synced 2026-10-22 06:44:20 +00:00
Compare commits
1 commit
d7bf692ba1
...
6df7e92b6b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6df7e92b6b |
4 changed files with 6 additions and 93 deletions
|
|
@ -77,27 +77,14 @@ Item {
|
||||||
baseView.currentIndex = -1;
|
baseView.currentIndex = -1;
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: Plasmoid
|
target: kicker
|
||||||
|
|
||||||
function onExpandedChanged() {
|
function onExpandedChanged() {
|
||||||
if (!Plasmoid.expanded) {
|
if (!kicker.expanded) {
|
||||||
baseView.currentIndex = -1;
|
baseView.currentIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* The KSortFilterProxyModel has a nasty behavior (with this particular
|
|
||||||
* source model) where only the first row will be updated (twice instantly),
|
|
||||||
* which invalidates the index list. In that case, we want a full update
|
|
||||||
* instead of a partial update, so the filtering can update the index map.
|
|
||||||
*/
|
|
||||||
Timer {
|
|
||||||
id: refreshTimer
|
|
||||||
interval: 50
|
|
||||||
onTriggered: {
|
|
||||||
Qt.callLater(() => { recentUsageModel.refresh()});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KickoffListView {
|
KickoffListView {
|
||||||
id: baseView
|
id: baseView
|
||||||
|
|
@ -109,43 +96,25 @@ Item {
|
||||||
interactive: contentHeight > height
|
interactive: contentHeight > height
|
||||||
//model: recentUsageModel //rootModel.modelForRow(0)
|
//model: recentUsageModel //rootModel.modelForRow(0)
|
||||||
model: KItemModels.KSortFilterProxyModel {
|
model: KItemModels.KSortFilterProxyModel {
|
||||||
id: sortModel
|
|
||||||
sourceModel: recentUsageModel
|
sourceModel: recentUsageModel
|
||||||
property var favoritesModel: globalFavorites
|
property var favoritesModel: globalFavorites
|
||||||
property int favoritesCount: sourceModel.favoritesModel.count
|
property int favoritesCount: sourceModel.favoritesModel.count
|
||||||
property int favoritesFound: 0
|
property int favoritesFound: 0
|
||||||
/*
|
|
||||||
* Because the trigger function relies on the original model's
|
|
||||||
* index values, we need a way to map the index values from the filtered
|
|
||||||
* model to the values from the source model.
|
|
||||||
*/
|
|
||||||
property list<int> originalIndexList
|
|
||||||
onFavoritesCountChanged: Qt.callLater(() => { sourceModel.refresh()});
|
onFavoritesCountChanged: Qt.callLater(() => { sourceModel.refresh()});
|
||||||
onCountChanged: Qt.callLater(() => {
|
onCountChanged: Qt.callLater(() => {
|
||||||
if(count > Plasmoid.configuration.numberRows) sourceModel.refresh();
|
if(count > Plasmoid.configuration.numberRows) sourceModel.refresh();
|
||||||
})
|
})
|
||||||
function trigger(index, str, ptr) {
|
function trigger(index, str, ptr) {
|
||||||
if(typeof originalIndexList[index] !== "undefined") {
|
sourceModel.trigger(index, str, ptr);
|
||||||
sourceModel.trigger(originalIndexList[index], str, ptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
filterRowCallback: function(source_row, source_parent) {
|
filterRowCallback: function(source_row, source_parent) {
|
||||||
if(source_row == 0) {
|
if(source_row == 0) favoritesFound = 0;
|
||||||
refreshTimer.start();
|
|
||||||
originalIndexList.length = 0;
|
|
||||||
favoritesFound = 0;
|
|
||||||
} else {
|
|
||||||
refreshTimer.stop();
|
|
||||||
}
|
|
||||||
const FavoriteIdRole = sourceModel.KItemModels.KRoleNames.role("favoriteId");
|
const FavoriteIdRole = sourceModel.KItemModels.KRoleNames.role("favoriteId");
|
||||||
const favoriteId = sourceModel.data(sourceModel.index(source_row, 0, source_parent), FavoriteIdRole);
|
const favoriteId = sourceModel.data(sourceModel.index(source_row, 0, source_parent), FavoriteIdRole);
|
||||||
var hasFavorite = favoritesIds.idList.indexOf(favoriteId) === -1
|
var hasFavorite = favoritesIds.idList.indexOf(favoriteId) === -1
|
||||||
if(!hasFavorite) favoritesFound++;
|
if(!hasFavorite) favoritesFound++;
|
||||||
var shouldAccept = hasFavorite && source_row < (Plasmoid.configuration.numberRows+favoritesFound);
|
|
||||||
if(shouldAccept) {
|
return hasFavorite && source_row < (Plasmoid.configuration.numberRows+favoritesFound)// - sourceModel.favoritesModel.count;
|
||||||
originalIndexList.push(source_row);
|
|
||||||
}
|
|
||||||
return shouldAccept;// - sourceModel.favoritesModel.count;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,10 +147,6 @@
|
||||||
<label>Use drop shadows for icons on the desktop.</label>
|
<label>Use drop shadows for icons on the desktop.</label>
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="useTypeAhead" type="Bool">
|
|
||||||
<label>Select icons on the desktop by typing their names.</label>
|
|
||||||
<default>true</default>
|
|
||||||
</entry>
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group name="Watermark">
|
<group name="Watermark">
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ Item {
|
||||||
property alias cfg_iconShadows: iconShadows.checked
|
property alias cfg_iconShadows: iconShadows.checked
|
||||||
|
|
||||||
property alias cfg_selectionStyle: selectionStyle.currentIndex
|
property alias cfg_selectionStyle: selectionStyle.currentIndex
|
||||||
property alias cfg_useTypeAhead: typeAhead.checked
|
|
||||||
|
|
||||||
|
|
||||||
readonly property bool lockedByKiosk: !KAuthorized.authorize("editable_desktop_icons")
|
readonly property bool lockedByKiosk: !KAuthorized.authorize("editable_desktop_icons")
|
||||||
|
|
@ -315,7 +314,6 @@ Item {
|
||||||
text: i18n("Show selection markers")
|
text: i18n("Show selection markers")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: popups
|
id: popups
|
||||||
visible: !isPopup
|
visible: !isPopup
|
||||||
|
|
@ -363,11 +361,6 @@ Item {
|
||||||
i18nc("@item:inlistbox how the selection should be", "Classic"),
|
i18nc("@item:inlistbox how the selection should be", "Classic"),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
CheckBox {
|
|
||||||
id: typeAhead
|
|
||||||
text: i18n("Select items by typing on the desktop")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: previews
|
id: previews
|
||||||
|
|
|
||||||
|
|
@ -1017,12 +1017,6 @@ FocusScope {
|
||||||
Behavior on contentX { id: smoothX; enabled: false; SmoothedAnimation { velocity: 700 } }
|
Behavior on contentX { id: smoothX; enabled: false; SmoothedAnimation { velocity: 700 } }
|
||||||
Behavior on contentY { id: smoothY; enabled: false; SmoothedAnimation { velocity: 700 } }
|
Behavior on contentY { id: smoothY; enabled: false; SmoothedAnimation { velocity: 700 } }
|
||||||
|
|
||||||
property string searchString: ""
|
|
||||||
Timer {
|
|
||||||
id: typeAheadTimer
|
|
||||||
interval: 500 // Resets search string after 0.5 seconds of inactivity
|
|
||||||
onTriggered: searchString = ""
|
|
||||||
}
|
|
||||||
Keys.onReturnPressed: event => {
|
Keys.onReturnPressed: event => {
|
||||||
if (event.modifiers === Qt.AltModifier) {
|
if (event.modifiers === Qt.AltModifier) {
|
||||||
dir.openPropertiesDialog();
|
dir.openPropertiesDialog();
|
||||||
|
|
@ -1105,40 +1099,6 @@ FocusScope {
|
||||||
dir.refresh(true);
|
dir.refresh(true);
|
||||||
} else if (event.matches(StandardKey.SelectAll)) {
|
} else if (event.matches(StandardKey.SelectAll)) {
|
||||||
positioner.setRangeSelected(0, count - 1);
|
positioner.setRangeSelected(0, count - 1);
|
||||||
} else if ( (root.isPopup || Plasmoid.configuration.useTypeAhead) && event.text.length === 1 && event.modifiers === Qt.NoModifier) {
|
|
||||||
typeAheadTimer.restart();
|
|
||||||
const charPressed = event.text.toLowerCase();
|
|
||||||
|
|
||||||
if (searchString.length >= 1 && searchString.indexOf(charPressed) !== 0) {
|
|
||||||
searchString += charPressed;
|
|
||||||
} else if (searchString !== charPressed) {
|
|
||||||
searchString = charPressed;
|
|
||||||
}
|
|
||||||
|
|
||||||
let matches = [];
|
|
||||||
for (let i = 0; i < gridView.count; i++) {
|
|
||||||
const itemData = positioner.data(positioner.index(i, 0), Qt.DisplayRole);
|
|
||||||
if (itemData && itemData.toLowerCase().indexOf(searchString) === 0) {
|
|
||||||
matches.push(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matches.length > 0) {
|
|
||||||
let nextIdx = matches[0];
|
|
||||||
if (searchString.length === 1) {
|
|
||||||
for (let j = 0; j < matches.length; j++) {
|
|
||||||
if (matches[j] > gridView.currentIndex) {
|
|
||||||
nextIdx = matches[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentIndex = nextIdx;
|
|
||||||
dir.clearSelection();
|
|
||||||
dir.setSelected(positioner.map(nextIdx));
|
|
||||||
} else {
|
|
||||||
searchString = charPressed;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
event.accepted = false;
|
event.accepted = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1309,11 +1269,6 @@ FocusScope {
|
||||||
previewPlugins: Plasmoid.configuration.previewPlugins
|
previewPlugins: Plasmoid.configuration.previewPlugins
|
||||||
applet: Plasmoid
|
applet: Plasmoid
|
||||||
|
|
||||||
onSelectionChanged: {
|
|
||||||
if(gridView.currentIndex === -1) {
|
|
||||||
gridView.searchString = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onListingCompleted: {
|
onListingCompleted: {
|
||||||
if (!gridView.model && root.expanded) {
|
if (!gridView.model && root.expanded) {
|
||||||
gridView.model = positioner;
|
gridView.model = positioner;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue