2006-12-27 16:04:49 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _OKULAR_BOOKMARK_MANAGER_H_
|
|
|
|
#define _OKULAR_BOOKMARK_MANAGER_H_
|
|
|
|
|
|
|
|
#include <kbookmark.h>
|
|
|
|
|
|
|
|
#include "okular_export.h"
|
|
|
|
|
2007-01-13 17:28:54 +00:00
|
|
|
class QAction;
|
2006-12-27 16:04:49 +00:00
|
|
|
class KUrl;
|
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
|
|
|
class Document;
|
2007-10-28 18:31:33 +00:00
|
|
|
class DocumentPrivate;
|
2006-12-27 16:04:49 +00:00
|
|
|
class DocumentViewport;
|
|
|
|
|
2007-01-20 14:51:43 +00:00
|
|
|
/**
|
|
|
|
* @brief Bookmarks manager utility.
|
|
|
|
*
|
|
|
|
* This class is responsible for loading and saving the bookmarks using the
|
|
|
|
* proper format, and for working with them (eg querying, adding, removing).
|
|
|
|
*/
|
2007-01-13 15:26:05 +00:00
|
|
|
class OKULAR_EXPORT BookmarkManager : public QObject
|
2006-12-27 16:04:49 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~BookmarkManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of documents with bookmarks.
|
|
|
|
*/
|
|
|
|
KUrl::List files() const;
|
|
|
|
/**
|
|
|
|
* Returns the list of bookmarks for the specified @p url.
|
|
|
|
*/
|
|
|
|
KBookmark::List bookmarks( const KUrl& url ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Forces to save the list of bookmarks.
|
|
|
|
*/
|
|
|
|
void save() const;
|
|
|
|
|
2007-10-28 18:31:33 +00:00
|
|
|
/**
|
|
|
|
* Adds a bookmark for the given @p page.
|
|
|
|
*/
|
|
|
|
void addBookmark( int page );
|
|
|
|
|
2006-12-27 16:04:49 +00:00
|
|
|
/**
|
|
|
|
* Adds a new bookmark for the @p referurl at the specified viewport @p vp,
|
|
|
|
* with an optional @p title.
|
|
|
|
*
|
|
|
|
* If no @p title is specified, then \em #n will be used.
|
|
|
|
*/
|
|
|
|
bool addBookmark( const KUrl& referurl, const Okular::DocumentViewport& vp, const QString& title = QString() );
|
|
|
|
|
2007-10-28 18:31:33 +00:00
|
|
|
/**
|
|
|
|
* Remove a bookmark for the given @p page.
|
|
|
|
*/
|
|
|
|
void removeBookmark( int page );
|
|
|
|
|
2006-12-27 16:04:49 +00:00
|
|
|
/**
|
|
|
|
* Removes the bookmark @p bm for the @p referurl specified.
|
|
|
|
*/
|
|
|
|
int removeBookmark( const KUrl& referurl, const KBookmark& bm );
|
|
|
|
|
2007-10-28 18:31:33 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the given @p page is bookmarked.
|
|
|
|
*/
|
|
|
|
bool isBookmarked( int page ) const;
|
|
|
|
|
2007-01-13 17:28:54 +00:00
|
|
|
/**
|
|
|
|
* Returns a list of actions for the bookmarks of the specified @p url.
|
|
|
|
*
|
|
|
|
* @note the actions will have no parents, so you have to delete them
|
|
|
|
* yourself
|
|
|
|
*/
|
|
|
|
QList< QAction* > actionsForUrl( const KUrl& url ) const;
|
|
|
|
|
2006-12-27 16:04:49 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* The bookmark manager is requesting to open the specified @p url.
|
|
|
|
*/
|
|
|
|
void openUrl( const KUrl& url );
|
|
|
|
|
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private * const d;
|
2007-01-13 15:26:05 +00:00
|
|
|
friend class Private;
|
2006-12-27 16:04:49 +00:00
|
|
|
|
|
|
|
// private interface used by the Document
|
|
|
|
friend class Document;
|
2007-10-28 18:31:33 +00:00
|
|
|
friend class DocumentPrivate;
|
2007-01-05 12:44:35 +00:00
|
|
|
|
2007-10-28 18:31:33 +00:00
|
|
|
BookmarkManager( DocumentPrivate * document );
|
2007-01-05 12:44:35 +00:00
|
|
|
|
2006-12-27 16:04:49 +00:00
|
|
|
void setUrl( const KUrl& url );
|
|
|
|
bool setPageBookmark( int page );
|
2007-01-13 14:45:51 +00:00
|
|
|
bool removePageBookmark( int page );
|
2006-12-27 16:04:49 +00:00
|
|
|
|
|
|
|
Q_DISABLE_COPY( BookmarkManager )
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|