the expand/collapsed state settings for the note subfolder tree will now be removed if the note folder is removed

This commit is contained in:
Patrizio Bekerle 2016-07-14 06:56:50 +02:00
parent 624be35a29
commit dd88a86c17
4 changed files with 15 additions and 4 deletions

View file

@ -3,6 +3,8 @@
## 16.07.6
- more fixes for the duplicate file and subfolder listings problem under OS X
(for [Issue #242](https://github.com/pbek/QOwnNotes/issues/242))
- the expand/collapsed state settings for the note subfolder tree will now be
removed if the note folder is removed
## 16.07.5
- fixed a duplicate file and subfolder listings problem

View file

@ -1168,12 +1168,18 @@ void SettingsDialog::on_noteFolderRemoveButton_clicked()
0, 1) == 0) {
bool wasCurrent = _selectedNoteFolder.isCurrent();
// remove saved searches
QSettings settings;
// remove saved searches
QString settingsKey = "savedSearches/noteFolder-"
+ QString::number(_selectedNoteFolder.getId());
settings.remove(settingsKey);
// remove tree widget expand state setting
settingsKey = NoteSubFolder::treeWidgetExpandStateSettingsKey(
_selectedNoteFolder.getId());
settings.remove(settingsKey);
// remove the note folder from the database
_selectedNoteFolder.remove();

View file

@ -390,8 +390,11 @@ bool NoteSubFolder::treeWidgetExpandState() {
/**
* Returns the tree widget expand status settings key
*/
QString NoteSubFolder::treeWidgetExpandStateSettingsKey() {
int noteFolderId = NoteFolder::currentNoteFolderId();
QString NoteSubFolder::treeWidgetExpandStateSettingsKey(int noteFolderId) {
if (noteFolderId == 0) {
noteFolderId = NoteFolder::currentNoteFolderId();
}
return "MainWindow/noteSubFolderTreeWidgetExpandState-" +
QString::number(noteFolderId);
}

View file

@ -71,7 +71,7 @@ public:
bool treeWidgetExpandState();
static QString treeWidgetExpandStateSettingsKey();
static QString treeWidgetExpandStateSettingsKey(int noteFolderId = 0);
protected:
int id;