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

Method buildActionMenu

gui/traymenu.cpp:45–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void TrayMenu::buildActionMenu() {
46 for (int i=actions.size()-1; i>=0; i--) {
47 signalMapper->removeMappings(actions[i]);
48 pinnedMenu->removeAction(actions[i]);
49 recentlyUpdatedMenu->removeAction(actions[i]);
50 }
51 actions.clear();
52
53 QList< QPair< qint32, QString> > records;
54 NoteTable noteTable(global.db);
55 noteTable.getAllPinned(records);
56 buildMenu(pinnedMenu, records);
57 records.clear();;
58 noteTable.getRecentlyUpdated(records);
59 buildMenu(recentlyUpdatedMenu, records);
60
61 records.clear();
62 FavoritesTable ftable(global.db);
63 QList<qint32> lids;
64 ftable.getAll(lids);
65 for (int i=0; i<lids.size(); i++) {
66 FavoritesRecord record;
67 ftable.get(record, lids[i]);
68 if (record.type == FavoritesRecord::Note) {
69 QPair<qint32, QString> pair;
70 pair.first = record.target.toInt();
71 pair.second = record.displayName;
72 records.append(pair);
73 }
74 }
75 favoriteNotesMenu->clear();
76 buildMenu(favoriteNotesMenu, records);
77}
78
79
80void TrayMenu::buildMenu(QMenu *actionMenu, QList< QPair <qint32, QString> > records) {

Callers

nothing calls this directly

Calls 5

getAllPinnedMethod · 0.80
getRecentlyUpdatedMethod · 0.80
clearMethod · 0.45
getAllMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected