MCPcopy Create free account
hub / github.com/comaps/comaps / OnDeleteClick

Method OnDeleteClick

qt/bookmark_dialog.cpp:196–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void BookmarkDialog::OnDeleteClick()
197{
198 auto & bm = m_framework.GetBookmarkManager();
199 for (auto const item : m_tree->selectedItems())
200 {
201 auto const categoryIt = m_categories.find(item);
202 if (categoryIt != m_categories.cend())
203 {
204 if (m_categories.size() == 1)
205 {
206 QMessageBox ask(this);
207 ask.setIcon(QMessageBox::Information);
208 ask.setText(tr("Could not delete the last category."));
209 ask.addButton(tr("OK"), QMessageBox::NoRole);
210 ask.exec();
211 }
212 else
213 {
214 bm.GetEditSession().DeleteBmCategory(categoryIt->second, true);
215 FillTree();
216 }
217 return;
218 }
219
220 auto const bookmarkIt = m_bookmarks.find(item);
221 if (bookmarkIt != m_bookmarks.cend())
222 {
223 bm.GetEditSession().DeleteBookmark(bookmarkIt->second);
224 FillTree();
225 return;
226 }
227
228 auto const trackIt = m_tracks.find(item);
229 if (trackIt != m_tracks.cend())
230 {
231 bm.GetEditSession().DeleteTrack(trackIt->second);
232 FillTree();
233 return;
234 }
235 }
236
237 QMessageBox ask(this);
238 ask.setIcon(QMessageBox::Warning);
239 ask.setText(tr("Select category, bookmark or track to delete."));
240 ask.addButton(tr("OK"), QMessageBox::NoRole);
241 ask.exec();
242}
243
244QTreeWidgetItem * BookmarkDialog::CreateTreeItem(std::string const & title, QTreeWidgetItem * parent)
245{

Callers

nothing calls this directly

Calls 8

setIconMethod · 0.80
DeleteBmCategoryMethod · 0.80
GetEditSessionMethod · 0.80
DeleteBookmarkMethod · 0.80
DeleteTrackMethod · 0.80
findMethod · 0.45
cendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected