mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-04-26 06:28:24 -05:00
dbhub: When deleting last local database of a user, remove user too
When deleting the last local database of a user in the Local files view, remove the now empty user directory too. See issue #2349.
This commit is contained in:
@@ -178,5 +178,14 @@ bool RemoteLocalFilesModel::removeRows(int row, int count, const QModelIndex& pa
|
||||
}
|
||||
endRemoveRows();
|
||||
|
||||
// If parent node is empty, remove that one too. Make sure to not remove the root node
|
||||
if(parent.isValid() && !index(0, 0, parent).isValid())
|
||||
{
|
||||
beginRemoveRows(parent.parent(), 0, 0);
|
||||
auto item = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||
item->parent()->removeChild(item);
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user