Commit 4c3fee6d authored by Jan Grulich's avatar Jan Grulich
Browse files

Allow to have expanded more than one connection

parent 9c77198a
......@@ -82,7 +82,7 @@ Item {
id: connectionView;
property bool expandedItem: false;
property string previouslyExpandedItem: "";
property variant previouslyExpandedItems: [];
property bool activeExpanded: true;
property bool previousExpanded: true;
......@@ -126,24 +126,51 @@ Item {
}
delegate: ConnectionItem {
expanded: connectionView.expandedItem && connectionView.previouslyExpandedItem == itemUni;
expanded: connectionView.expandedItem && connectionView.containItem(itemUni);
onItemExpanded: {
if (itemExpanded) {
connectionView.expandedItem = true;
connectionView.previouslyExpandedItem = itemUni;;
connectionView.addItem(itemUni);
connectionView.currentIndex = index;
} else {
connectionView.expandedItem = false;
connectionView.previouslyExpandedItem = "";
connectionView.removeItem(itemUni);
if (connectionView.previouslyExpandedItems.length == 0) {
connectionView.expandedItem = false;
}
}
}
ListView.onRemove: {
if (ListView.isCurrentItem) {
connectionView.previouslyExpandedItem = "";
connectionView.removeItem(itemUni);
}
}
}
function addItem(item) {
var currentItems = previouslyExpandedItems;
currentItems[currentItems.length] = item;
previouslyExpandedItems = currentItems;
}
function removeItem(item) {
var tmpItems = [];
for (var i = 0; i < previouslyExpandedItems.length; i++) {
if (previouslyExpandedItems[i] != item) {
tmpItems[tmpItems.length] = previouslyExpandedItems[i];
}
}
previouslyExpandedItems = tmpItems;
}
function containItem(item) {
for (var i = 0; i < previouslyExpandedItems.length; i++) {
if (previouslyExpandedItems[i] == item) {
return true;
}
}
return false;
}
}
PlasmaCore.SvgItem {
......
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