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.
| 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 | //************************************************************* |
nothing calls this directly
no test coverage detected