mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
add a function to remove a list of bookmark belonging to the specified url
svn path=/trunk/KDE/kdegraphics/okular/; revision=1072132
This commit is contained in:
parent
4ee7112fe7
commit
c3f75f13c2
|
@ -337,6 +337,42 @@ int BookmarkManager::removeBookmark( const KUrl& referurl, const KBookmark& bm )
|
|||
return vp.pageNumber;
|
||||
}
|
||||
|
||||
void BookmarkManager::removeBookmarks( const KUrl& referurl, const KBookmark::List& list )
|
||||
{
|
||||
if ( !referurl.isValid() || list.isEmpty() )
|
||||
return;
|
||||
|
||||
KBookmarkGroup thebg;
|
||||
QHash<KUrl, QString>::iterator it = d->bookmarkFind( referurl, false, &thebg );
|
||||
if ( it == d->knownFiles.end() )
|
||||
return;
|
||||
|
||||
const QSet<int> oldUrlBookmarks = d->urlBookmarks;
|
||||
bool deletedAny = false;
|
||||
foreach ( const KBookmark & bm, list )
|
||||
{
|
||||
if ( bm.parentGroup() == thebg )
|
||||
{
|
||||
thebg.deleteBookmark( bm );
|
||||
deletedAny = true;
|
||||
if ( referurl == d->document->m_url )
|
||||
{
|
||||
d->urlBookmarks.remove( DocumentViewport( bm.url().htmlRef() ).pageNumber );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( referurl == d->document->m_url )
|
||||
{
|
||||
foreach ( int p, oldUrlBookmarks - d->urlBookmarks )
|
||||
{
|
||||
foreachObserver( notifyPageChanged( p, DocumentObserver::Bookmark ) );
|
||||
}
|
||||
}
|
||||
if ( deletedAny )
|
||||
d->manager->emitChanged( thebg );
|
||||
}
|
||||
|
||||
QList< QAction * > BookmarkManager::actionsForUrl( const KUrl& url ) const
|
||||
{
|
||||
QList< QAction * > ret;
|
||||
|
|
|
@ -73,6 +73,15 @@ class OKULAR_EXPORT BookmarkManager : public QObject
|
|||
*/
|
||||
int removeBookmark( const KUrl& referurl, const KBookmark& bm );
|
||||
|
||||
/**
|
||||
* Removes the bookmarks in @p list for the @p referurl specified.
|
||||
*
|
||||
* @note it will remove only the bookmarks which belong to @p referurl
|
||||
*
|
||||
* @since 0.11 (KDE 4.5)
|
||||
*/
|
||||
void removeBookmarks( const KUrl& referurl, const KBookmark::List& list );
|
||||
|
||||
/**
|
||||
* Returns whether the given @p page is bookmarked.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue