From 69e23fd13af5f0603be25ab4fe29038dd2273e72 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Tue, 27 Dec 2016 00:59:51 -0500 Subject: [PATCH] Save expanded group states --- src/BookmarkMgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/BookmarkMgr.cpp b/src/BookmarkMgr.cpp index b0efa06..5ae4c0d 100644 --- a/src/BookmarkMgr.cpp +++ b/src/BookmarkMgr.cpp @@ -28,6 +28,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn) { for (auto &bmd_i : bmData) { DataNode *group = modems->newChild("group"); *group->newChild("@name") = bmd_i.first; + *group->newChild("@expanded") = (getExpandState(bmd_i.first)?std::string("true"):std::string("false")); for (auto &bm_i : bmd_i.second ) { group->newChildCloneFrom("modem", bm_i->node); @@ -91,10 +92,15 @@ void BookmarkMgr::loadFromFile(std::string bookmarkFn) { DataNode *modems = s.rootNode()->getNext("modems"); while (modems->hasAnother("group")) { DataNode *group = modems->getNext("group"); + std::string expandState = "true"; std::string groupName = "Unnamed"; if (group->hasAnother("@name")) { groupName = group->getNext("@name")->element()->toString(); } + if (group->hasAnother("@expanded")) { + expandState = group->getNext("@expanded")->element()->toString(); + } + setExpandState(groupName, (expandState == "true")); while (group->hasAnother("modem")) { DataNode *modem = group->getNext("modem"); BookmarkEntry *be = nodeToBookmark("modem", modem);