Commit a57ffdbd authored by Alexey Demennikov's avatar Alexey Demennikov Committed by Albert Astals Cid

added the "remove this bookmark" to bookmarks section

Summary:
**FEATURE**: 357626
Remove bookmark from popup menu added

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7848
parent 62ce3db9
......@@ -2166,6 +2166,26 @@ void Part::slotRenameBookmarkFromMenu()
}
}
void Part::slotRemoveBookmarkFromMenu()
{
QAction *action = dynamic_cast<QAction *>(sender());
Q_ASSERT( action );
if ( action )
{
DocumentViewport vp ( action->data().toString() );
slotRemoveBookmark( vp );
}
}
void Part::slotRemoveBookmark(const DocumentViewport &viewport)
{
Q_ASSERT(m_document->bookmarkManager()->isBookmarked( viewport ));
if ( m_document->bookmarkManager()->isBookmarked( viewport ) )
{
m_document->bookmarkManager()->removeBookmark( viewport );
}
}
void Part::slotRenameCurrentViewportBookmark()
{
slotRenameBookmark( m_document->viewport() );
......@@ -2181,6 +2201,9 @@ bool Part::aboutToShowContextMenu(QMenu * /*menu*/, QAction *action, QMenu *cont
QAction *renameAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename this Bookmark" ), this, SLOT(slotRenameBookmarkFromMenu()) );
renameAction->setData(ba->property("htmlRef").toString());
renameAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
QAction *deleteAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n("Remove this Bookmark"), this, SLOT(slotRemoveBookmarkFromMenu()));
deleteAction->setData(ba->property("htmlRef").toString());
deleteAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
}
return ba;
}
......
......@@ -189,6 +189,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
void slotHistoryNext();
void slotAddBookmark();
void slotRenameBookmarkFromMenu();
void slotRemoveBookmarkFromMenu();
void slotRenameCurrentViewportBookmark();
void slotPreviousBookmark();
void slotNextBookmark();
......@@ -256,6 +257,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
void updateAboutBackendAction();
void unsetDummyMode();
void slotRenameBookmark( const DocumentViewport &viewport );
void slotRemoveBookmark( const DocumentViewport &viewport );
void resetStartArguments();
static int numberOfParts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment