| 5767 | } |
| 5768 | |
| 5769 | void EventBrowser::bookmarkContextMenu(QRClickToolButton *button, uint32_t EID) |
| 5770 | { |
| 5771 | QMenu contextMenu(this); |
| 5772 | |
| 5773 | QAction renameBookmark(tr("&Rename"), this); |
| 5774 | QAction deleteBookmark(tr("&Delete"), this); |
| 5775 | |
| 5776 | renameBookmark.setIcon(Icons::page_white_edit()); |
| 5777 | deleteBookmark.setIcon(Icons::del()); |
| 5778 | |
| 5779 | contextMenu.addAction(&renameBookmark); |
| 5780 | contextMenu.addAction(&deleteBookmark); |
| 5781 | |
| 5782 | QObject::connect(&deleteBookmark, &QAction::triggered, [this, EID]() { |
| 5783 | m_Ctx.RemoveBookmark(EID); |
| 5784 | repopulateBookmarks(); |
| 5785 | }); |
| 5786 | |
| 5787 | QObject::connect(&renameBookmark, &QAction::triggered, [this, button, EID]() { |
| 5788 | EventBookmark editedBookmark; |
| 5789 | for(const EventBookmark &bookmark : m_Ctx.GetBookmarks()) |
| 5790 | { |
| 5791 | if(bookmark.eventId == EID) |
| 5792 | { |
| 5793 | editedBookmark = bookmark; |
| 5794 | break; |
| 5795 | } |
| 5796 | } |
| 5797 | |
| 5798 | if(editedBookmark.eventId == EID) |
| 5799 | { |
| 5800 | bool ok; |
| 5801 | editedBookmark.text = |
| 5802 | QInputDialog::getText(this, lit("Rename"), lit("New name:"), QLineEdit::Normal, |
| 5803 | GetBookmarkDisplayText(editedBookmark), &ok); |
| 5804 | if(ok) |
| 5805 | { |
| 5806 | button->setText(GetBookmarkDisplayText(editedBookmark)); |
| 5807 | m_Ctx.SetBookmark(editedBookmark); |
| 5808 | } |
| 5809 | } |
| 5810 | }); |
| 5811 | |
| 5812 | RDDialog::show(&contextMenu, QCursor::pos()); |
| 5813 | } |
| 5814 | |
| 5815 | void EventBrowser::ExpandNode(QModelIndex idx) |
| 5816 | { |
nothing calls this directly
no test coverage detected