Skip to content

Commit

Permalink
Github Issue #140: Fixed a bug where new files/folder could be create…
Browse files Browse the repository at this point in the history
…d at the root level of the vault.
  • Loading branch information
AngryFender committed Mar 8, 2024
1 parent d1bd3c6 commit 85c926f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions navigationview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ void NavigationView::addFile()
this->scrollTo(index);

const QList<QModelIndex> selections = this->selectedIndexes();
QModelIndex current = selections.first();
if(!selections.empty() && lastClickedIndex.isValid()){
index = selections.first();
}

QString fileName;
emit createFile(current, fileName);

lastClickedIndex = current;
emit createFile(index, fileName);
lastClickedIndex = index;
newEntryName = fileName;
}

Expand All @@ -151,12 +152,13 @@ void NavigationView::addFolder()
this->scrollTo(index);

const QList<QModelIndex> selections = this->selectedIndexes();
QModelIndex current = selections.first();
if(!selections.isEmpty() && lastClickedIndex.isValid()){
index = selections.first();
}

QString folderName;
emit createFolder(current, folderName);

lastClickedIndex = current;
emit createFolder(index, folderName);
lastClickedIndex = index;
newEntryName = folderName;
}

Expand Down

0 comments on commit 85c926f

Please sign in to comment.