KBookmarks 5.109.0
|
This class implements the reading/writing of bookmarks in XML. More...
#include <KBookmarkManager>
Signals | |
void | bookmarkCompleteChange (QString caller) |
Signal send over D-Bus. | |
void | bookmarkConfigChanged () |
Signal send over D-Bus. | |
void | bookmarksChanged (QString groupAddress) |
Signal send over D-Bus. | |
void | changed (const QString &groupAddress, const QString &caller) |
Signals that the group (or any of its children) with the address groupAddress (e.g. | |
void | configChanged () |
Signals that the config changed. | |
void | error (const QString &errorMessage) |
Emitted when an error occurs. | |
Public Slots | |
void | notifyChanged (const QString &groupAddress, const QDBusMessage &msg) |
Emit the changed signal for the group whose address is given. | |
void | notifyCompleteChange (const QString &caller) |
Reparse the whole bookmarks file and notify about the change Doesn't send signal over D-Bus to the other Bookmark Managers You probably want to use emitChanged() | |
void | notifyConfigChanged () |
void | slotEditBookmarks () |
void | slotEditBookmarksAtAddress (const QString &address) |
Public Member Functions | |
~KBookmarkManager () override | |
Destructor. | |
bool | autoErrorHandlingEnabled () const |
Check whether auto error handling is enabled. | |
void | emitChanged () |
Saves the bookmark file and notifies everyone. | |
void | emitChanged (const KBookmarkGroup &group) |
Saves the bookmark file and notifies everyone. | |
void | emitConfigChanged () |
KBookmark | findByAddress (const QString &address) |
QDomDocument | internalDocument () const |
QString | path () const |
This will return the path that this manager is using to read the bookmarks. | |
KBookmarkGroup | root () const |
This will return the root bookmark. | |
bool | save (bool toolbarCache=true) const |
Save the bookmarks to an XML file on disk. | |
bool | saveAs (const QString &filename, bool toolbarCache=true) const |
Save the bookmarks to the given XML file on disk. | |
void | setAutoErrorHandlingEnabled (bool enable, QWidget *parent) |
Enable or disable auto error handling is enabled. | |
void | setEditorOptions (const QString &caption, bool browser) |
Set options with which slotEditBookmarks called keditbookmarks this can be used to change the appearance of the keditbookmarks in order to provide a slightly differing outer shell depending on the bookmarks file / app which calls it. | |
void | setUpdate (bool update) |
Set the update flag. | |
KBookmarkGroup | toolbar () |
This returns the root of the toolbar menu. | |
bool | updateAccessMetadata (const QString &url) |
Update access time stamps for a given url. | |
void | updateFavicon (const QString &url, const QString &faviconurl) |
Static Public Member Functions | |
static KBookmarkManager * | createTempManager () |
only used for KBookmarkBar | |
static KBookmarkManager * | managerForExternalFile (const QString &bookmarksFile) |
Returns a KBookmarkManager, which will use QFileSystemWatcher for change detection This is important when sharing bookmarks with other Desktops. | |
static KBookmarkManager * | managerForFile (const QString &bookmarksFile, const QString &dbusObjectName) |
This static function will return an instance of the KBookmarkManager, responsible for the given bookmarksFile . | |
static KBookmarkManager * | userBookmarksManager () |
Returns a pointer to the user's main (konqueror) bookmark collection. | |
This class implements the reading/writing of bookmarks in XML.
The bookmarks file is read and written using the XBEL standard (http://pyxml.sourceforge.net/topics/xbel/)
A sample file looks like this :
|
override |
Destructor.
bool KBookmarkManager::autoErrorHandlingEnabled | ( | ) | const |
Check whether auto error handling is enabled.
If enabled, it will show an error dialog to the user when an error occurs. It is turned on by default.
|
signal |
Signal send over D-Bus.
|
signal |
Signal send over D-Bus.
|
signal |
Signal send over D-Bus.
|
signal |
Signals that the group (or any of its children) with the address groupAddress
(e.g.
"/4/5") has been modified by the caller caller
. connect to this
|
signal |
Signals that the config changed.
|
static |
only used for KBookmarkBar
void KBookmarkManager::emitChanged | ( | ) |
Saves the bookmark file and notifies everyone.
void KBookmarkManager::emitChanged | ( | const KBookmarkGroup & | group | ) |
Saves the bookmark file and notifies everyone.
group | the parent of all changed bookmarks |
|
signal |
Emitted when an error occurs.
Contains the translated error message.
KBookmark KBookmarkManager::findByAddress | ( | const QString & | address | ) |
address
address | the address belonging to the bookmark you're looking for |
tolerate | when true tries to find the most tolerable bookmark position |
|
static |
Returns a KBookmarkManager, which will use QFileSystemWatcher for change detection This is important when sharing bookmarks with other Desktops.
bookmarksFile | full path to the bookmarks file |
|
static |
This static function will return an instance of the KBookmarkManager, responsible for the given bookmarksFile
.
If you do not instantiate this class either natively or in a derived class, then it will return an object with the default behaviors. If you wish to use different behaviors, you must derive your own class and instantiate it before this method is ever called.
bookmarksFile | full path to the bookmarks file, Use ~/.kde/share/apps/konqueror/bookmarks.xml for the konqueror bookmarks |
dbusObjectName | a unique name that represents this bookmark collection, usually your component (e.g. application) name. This is "konqueror" for the konqueror bookmarks, "kfile" for KFileDialog bookmarks, etc. The final D-Bus object path is /KBookmarkManager/dbusObjectName An empty dbusObjectName disables the registration to D-Bus (used for temporary managers) |
|
slot |
Emit the changed signal for the group whose address is given.
|
slot |
Reparse the whole bookmarks file and notify about the change Doesn't send signal over D-Bus to the other Bookmark Managers You probably want to use emitChanged()
QString KBookmarkManager::path | ( | ) | const |
This will return the path that this manager is using to read the bookmarks.
KBookmarkGroup KBookmarkManager::root | ( | ) | const |
This will return the root bookmark.
It is used to iterate through the bookmarks manually. It is mostly used internally.
bool KBookmarkManager::save | ( | bool | toolbarCache = true | ) | const |
Save the bookmarks to an XML file on disk.
You should use emitChanged() instead of this function, it saves and notifies everyone that the file has changed. Only use this if you don't want the emitChanged signal.
toolbarCache | iff true save a cache of the toolbar folder, too |
bool KBookmarkManager::saveAs | ( | const QString & | filename, |
bool | toolbarCache = true |
||
) | const |
Save the bookmarks to the given XML file on disk.
filename | full path to the desired bookmarks file location |
toolbarCache | iff true save a cache of the toolbar folder, too |
void KBookmarkManager::setAutoErrorHandlingEnabled | ( | bool | enable, |
QWidget * | parent | ||
) |
Enable or disable auto error handling is enabled.
If enabled, it will show an error dialog to the user when an error occurs. It is turned on by default. If disabled, the application should react on the error() signal.
enable | true to enable auto error handling, false to disable |
parent | the parent widget for the error dialogs, can be nullptr for top-level |
void KBookmarkManager::setEditorOptions | ( | const QString & | caption, |
bool | browser | ||
) |
Set options with which slotEditBookmarks called keditbookmarks this can be used to change the appearance of the keditbookmarks in order to provide a slightly differing outer shell depending on the bookmarks file / app which calls it.
caption | the –caption string, for instance "Konsole" |
browser | iff false display no browser specific menu items in keditbookmarks :: –nobrowser |
void KBookmarkManager::setUpdate | ( | bool | update | ) |
Set the update flag.
Defaults to true.
update | if true then KBookmarkManager will listen to D-Bus update requests. |
KBookmarkGroup KBookmarkManager::toolbar | ( | ) |
This returns the root of the toolbar menu.
In the XML, this is the group with the attribute toolbar=yes
bool KBookmarkManager::updateAccessMetadata | ( | const QString & | url | ) |
Update access time stamps for a given url.
url | the viewed url |
|
static |
Returns a pointer to the user's main (konqueror) bookmark collection.