Iterate KFilePlacesModel instead of using closestItem to remove SFTP entries
Fixes bug where we could miss entries due to `closestItem()` skipping hidden items. It is also more performant. BUG: 461872
This commit is contained in:
parent
643a1c9dc2
commit
d721f72a9b
1 changed files with 7 additions and 4 deletions
|
@ -49,10 +49,13 @@ void SftpPlugin::addToDolphin()
|
|||
void SftpPlugin::removeFromDolphin()
|
||||
{
|
||||
QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
|
||||
QModelIndex index = m_placesModel.closestItem(kioUrl);
|
||||
while (index.row() != -1) {
|
||||
m_placesModel.removePlace(index);
|
||||
index = m_placesModel.closestItem(kioUrl);
|
||||
for (int i = 0; i < m_placesModel.rowCount(); ++i) {
|
||||
QModelIndex index = m_placesModel.index(i, 0);
|
||||
QUrl url = m_placesModel.url(index);
|
||||
if (url == kioUrl) {
|
||||
m_placesModel.removePlace(index);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue