Skip to content

Commit

Permalink
Refresh O tree (Os which were changed by other views).
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Jan 6, 2024
1 parent e57b64d commit e56f7c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions lib/src/mind/mind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,12 +1032,19 @@ void Mind::outlinesMapSynchronize(Outline* outlinesMap)
Link* oLink = n->getLinkByName(LINK_NAME_OUTLINE_KEY);
if(oLink) {
string oKey{oLink->getUrl()};
if(findOutlineByKey(oKey)) {
Outline* o = findOutlineByKey(oKey);
if(o) {
// valid O in MF & map
MF_DEBUG(
" VALID : " << n->getName() << endl <<
" " << oKey << endl
);
// refresh N representing O (name, timestamps, ... may be changed by other views)
n->setName(o->getName());
n->setModified(o->getModified());
n->setModifiedPretty();
n->setRead(o->getRead());
n->setReadPretty();
mapOsKeys.push_back(oKey);
} else {
MF_DEBUG(" INVALID (no O for link): " << n->getName() << endl);
Expand Down Expand Up @@ -1433,18 +1440,18 @@ unique_ptr<vector<Outline*>> Mind::findOutlineByNameFts(const string& pattern) c
return result;
}

bool Mind::findOutlineByKey(const string& key) const
Outline* Mind::findOutlineByKey(const string& key) const
{
if(key.size()) {
vector<Outline*> outlines = memory.getOutlines();
for(Outline* outline:outlines) {
if(key.compare(outline->getKey()) == 0) {
return true;
return outline;
}
}
}

return false;
return nullptr;
}

} /* namespace */
2 changes: 1 addition & 1 deletion lib/src/mind/mind.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class Mind : public OntologyProvider
*/
std::unique_ptr<std::vector<Outline*>> findOutlineByNameFts(const std::string& pattern) const;
//std::vector<Note*>* findNoteByNameFts(const std::string& pattern) const;
bool findOutlineByKey(const std::string& key) const;
Outline* findOutlineByKey(const std::string& key) const;
std::vector<Note*>* findNoteFts(
const std::string& pattern,
const FtsSearch mode = FtsSearch::EXACT,
Expand Down

0 comments on commit e56f7c6

Please sign in to comment.