Commit aa1c9268 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Merge branch 'Plasma/5.17'

parents be1eacc0 b6393382
......@@ -53,7 +53,7 @@ MouseArea {
property bool dragging: false
property string dragId
property string dragSwitchDesktopId
property int dragSwitchDesktopIndex: -1
property int wheelDelta: 0
......@@ -224,8 +224,8 @@ MouseArea {
id: dragTimer
interval: 1000
onTriggered: {
if (dragSwitchDesktopId !== -1 && dragSwitchDesktopId !== pagerModel.currentPage) {
pagerModel.changePage(dragSwitchDesktopId);
if (dragSwitchDesktopIndex !== -1 && dragSwitchDesktopIndex !== pagerModel.currentPage) {
pagerModel.changePage(dragSwitchDesktopIndex);
}
}
}
......@@ -390,16 +390,16 @@ MouseArea {
preventStealing: true
onDragEnter: {
root.dragSwitchDesktopId = desktop.desktopId;
root.dragSwitchDesktopIndex = index;
dragTimer.start();
}
onDragLeave: {
root.dragSwitchDesktopId = "";
root.dragSwitchDesktopIndex = -1;
dragTimer.stop();
}
onDrop: {
pagerModel.drop(event.mimeData, desktop.desktopId);
root.dragSwitchDesktopId = -1;
root.dragSwitchDesktopIndex = -1;
dragTimer.stop();
}
}
......
......@@ -59,17 +59,6 @@ Kirigami.Page {
value: searchField.text
}
// We need to manually keep track of the index as we store the sourceModel index
// and then use a proxy model to filter it. We don't get any QML change signals anywhere
// and ListView needs a currentIndex number
Connections {
target: kcm.filteredModel
onRowsRemoved: sourcesList.updateCurrentIndex()
onRowsInserted: sourcesList.updateCurrentIndex()
// TODO re-create model index if possible
onModelReset: appConfiguration.rootIndex = undefined
}
RowLayout {
id: rootRow
anchors.fill: parent
......@@ -120,26 +109,9 @@ Kirigami.Page {
}
}
// We need to manually keep track of the index when we filter
function updateCurrentIndex() {
if (!appConfiguration.rootIndex || !appConfiguration.rootIndex.valid) {
currentIndex = -1;
return;
}
var filteredIdx = kcm.filteredModel.mapFromSource(appConfiguration.rootIndex);
if (!filteredIdx.valid) {
currentIndex = -1;
return;
}
currentIndex = filteredIdx.row;
}
onCurrentIndexChanged: {
onCurrentItemChanged: {
var sourceIdx = kcm.filteredModel.mapToSource(kcm.filteredModel.index(sourcesList.currentIndex, 0));
appConfiguration.rootIndex = kcm.sourcesModel.makePersistentModelIndex(sourceIdx);
sourcesList.updateCurrentIndex();
}
delegate: QtControls.ItemDelegate {
......@@ -150,7 +122,6 @@ Kirigami.Page {
onClicked: {
sourcesList.forceActiveFocus();
sourcesList.currentIndex = index;
sourcesList.updateCurrentIndex();
}
contentItem: RowLayout {
......@@ -196,7 +167,6 @@ Kirigami.Page {
ApplicationConfiguration {
id: appConfiguration
anchors.fill: parent
onRootIndexChanged: sourcesList.updateCurrentIndex()
visible: typeof appConfiguration.rootIndex !== "undefined" && appConfiguration.rootIndex.valid
}
......
......@@ -74,9 +74,11 @@ SearchConfigModule::SearchConfigModule(QWidget* parent, const QVariantList& args
m_pluginSelector = new KPluginSelector(this);
//overload, can't use the new syntax
connect(m_pluginSelector, SIGNAL(changed(bool)),
this, SIGNAL(changed(bool)));
auto markAsChanged = [this] {
emit changed();
};
connect(m_pluginSelector, &KPluginSelector::changed, this, markAsChanged);
connect(m_pluginSelector, &KPluginSelector::configCommitted, this, markAsChanged);
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 67, 0)
connect(m_pluginSelector, &KPluginSelector::defaulted,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment