Skip to content

Commit

Permalink
Delete removes folders correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
SimLV committed May 7, 2024
1 parent 45fcfcb commit ad5b0fb
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/NotepadNext/docks/FolderAsWorkspaceDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,13 @@ void FolderAsWorkspaceDock::onFileRenamed(const QString &path, const QString &ol

void FolderAsWorkspaceDock::on_actionDelete_triggered()
{
bool ret;
QString path(model->filePath(lastSelectedItem));
QMessageBox::StandardButton reply = QMessageBox::question(this, tr("Delete Item"),
tr("Are you sure you want to delete <b>%1</b>?").arg(path));

if (reply == QMessageBox::Yes)
{
if (model->isDir(lastSelectedItem)) {
ret = model->rmdir(lastSelectedItem);
}
else {
ret = model->remove(lastSelectedItem);
}
if (!ret)
if (!model->remove(lastSelectedItem))
{
qWarning("Unable to delete %s", path.toUtf8().constData());
}
Expand Down

0 comments on commit ad5b0fb

Please sign in to comment.