MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / buildSelection

Method buildSelection

gui/lineedit.cpp:72–110  ·  view source on GitHub ↗

This function is called when a user selects something within this tree. It also emits a signal that will be picked up by the main nixnote program.

Source from the content-addressed store, hash-verified

70 // be picked up by the main nixnote program.
71 //*************************************************************
72 void LineEdit::buildSelection() {
73 QLOG_TRACE() << "Inside LineEdit::buildSelection()";
74 savedText = text().trimmed();
75
76 // First, find out if we're already viewing history. If we are we
77 // chop off the end of the history & start a new one
78 if (global.filterPosition+1 < global.filterCriteria.size()) {
79 while (global.filterPosition+1 < global.filterCriteria.size())
80 global.filterCriteria.removeLast();
81 }
82
83 filterPosition++;
84 FilterCriteria *newFilter = new FilterCriteria();
85 global.filterCriteria.push_back(newFilter);
86 FilterCriteria *oldFilter = global.filterCriteria[global.filterPosition];
87 global.filterPosition++;
88
89 newFilter->setSearchString(text());
90 if (!global.getClearNotebookOnSearch() && oldFilter->isNotebookSet())
91 newFilter->setNotebook(*oldFilter->getNotebook());
92 if (!global.getClearTagsOnSearch() && oldFilter->isTagsSet()) {
93 QList<QTreeWidgetItem*> items = oldFilter->getTags();
94 newFilter->setTags(items);
95 }
96 newFilter->resetTags=true;
97 newFilter->resetNotebook=true;
98 newFilter->resetAttribute = true;
99 newFilter->resetFavorite = true;
100 newFilter->resetDeletedOnly = true;
101 newFilter->resetSavedSearch = true;
102 QList<qint32> oldLids;
103 oldFilter->getSelectedNotes(oldLids);
104 newFilter->setSelectedNotes(oldLids);
105 newFilter->setLid(oldFilter->getLid());
106
107 emit updateSelectionRequested();
108
109 QLOG_TRACE() << "Leaving LineEdit::buildSelection()";
110 }
111
112
113 //*************************************************************

Callers

nothing calls this directly

Calls 13

setSearchStringMethod · 0.80
isNotebookSetMethod · 0.80
getClearTagsOnSearchMethod · 0.80
isTagsSetMethod · 0.80
getSelectedNotesMethod · 0.80
setSelectedNotesMethod · 0.80
setNotebookMethod · 0.45
getNotebookMethod · 0.45
getTagsMethod · 0.45
setTagsMethod · 0.45
setLidMethod · 0.45

Tested by

no test coverage detected