| 282 | } |
| 283 | |
| 284 | void BookmarkList::contextMenuForFileItem(const QPoint p, FileItem *fItem) |
| 285 | { |
| 286 | Q_UNUSED(p); |
| 287 | if (!fItem) { |
| 288 | return; |
| 289 | } |
| 290 | |
| 291 | const QUrl itemurl = fItem->data(0, UrlRole).value<QUrl>(); |
| 292 | const bool thisdoc = itemurl == m_document->currentDocument(); |
| 293 | |
| 294 | QMenu menu(this); |
| 295 | const QAction *expandall = menu.addAction(i18n("Expand All")); |
| 296 | const QAction *collapseall = menu.addAction(i18n("Collapse All")); |
| 297 | QAction *open = nullptr; |
| 298 | if (!thisdoc) { |
| 299 | open = menu.addAction(i18nc("Opens the selected document", "Open Document")); |
| 300 | } |
| 301 | const QAction *editbm = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-rename")), i18n("Rename Bookmark")); |
| 302 | const QAction *removebm = menu.addAction(QIcon::fromTheme(QStringLiteral("bookmark-remove"), QIcon::fromTheme(QStringLiteral("edit-delete-bookmark"))), i18n("Remove all Bookmarks for this Document")); |
| 303 | const QAction *res = menu.exec(QCursor::pos()); |
| 304 | if (!res) { |
| 305 | return; |
| 306 | } |
| 307 | |
| 308 | if (res == expandall) { |
| 309 | m_tree->expandAll(); |
| 310 | } else if (res == collapseall) { |
| 311 | m_tree->collapseAll(); |
| 312 | } else if (res == open) { |
| 313 | Okular::GotoAction action(itemurl.toDisplayString(QUrl::PreferLocalFile), Okular::DocumentViewport()); |
| 314 | m_document->processAction(&action); |
| 315 | } else if (res == editbm) { |
| 316 | m_tree->editItem(fItem, 0); |
| 317 | } else if (res == removebm) { |
| 318 | KBookmark::List list; |
| 319 | for (int i = 0; i < fItem->childCount(); ++i) { |
| 320 | list.append(static_cast<BookmarkItem *>(fItem->child(i))->bookmark()); |
| 321 | } |
| 322 | m_document->bookmarkManager()->removeBookmarks(itemurl, list); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | void BookmarkList::slotBookmarksChanged(const QUrl &url) |
| 327 | { |
nothing calls this directly
no test coverage detected