1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-02-20 21:36:58 +00:00

Enable multiselection on source list (#596)

This commit is contained in:
XXXBold 2020-08-24 02:05:07 +00:00 committed by GitHub
parent ec374953e7
commit 677734e62a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -37,6 +37,9 @@
<height>0</height>
</size>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
<item>

View file

@ -51,8 +51,12 @@ def receive():
dialog.open(receive)
def source_remove(self):
item = self.sourceFilesWidget.takeItem(self.sourceFilesWidget.currentRow())
if item:
indexes = self.sourceFilesWidget.selectionModel().selectedIndexes()
# sort indexes, starting with lowest
indexes.sort()
# remove each selected entry, starting with highest index (otherways, higher indexes become invalid)
for index in reversed(indexes):
item = self.sourceFilesWidget.takeItem(index.row())
db_item = SourceFileModel.get(dir=item.text())
db_item.delete_instance()