22 #include <tqvaluelist.h>
29 class TDEIO_EXPORT KBookmark
33 enum MetaDataOverwriteMode {
34 OverwriteMetaData, DontOverwriteMetaData
38 KBookmark( TQDomElement elem ) : element(elem) {}
40 static KBookmark standaloneBookmark(
const TQString & text,
const KURL & url,
const TQString & icon = TQString::null );
50 bool isSeparator()
const;
57 bool isNull()
const {
return element.isNull();}
65 bool hasParent()
const;
72 TQString text()
const;
77 TQString fullText()
const;
86 TQString icon()
const;
105 TQString address()
const;
116 TQDomElement internalElement()
const {
return element; }
123 void updateAccessMetadata();
130 static TQString parentAddress(
const TQString & address )
131 {
return address.left( address.findRev(
'/') ); }
136 static uint positionInParent(
const TQString & address )
137 {
return address.mid( address.findRev(
'/') + 1 ).toInt(); }
143 static TQString previousAddress(
const TQString & address )
145 uint pp = positionInParent(address);
146 return pp>0 ? parentAddress(address) +
'/' + TQString::number(pp-1) : TQString::null;
153 static TQString nextAddress(
const TQString & address )
154 {
return parentAddress(address) +
'/' + TQString::number(positionInParent(address)+1); }
161 static TQString commonParent(TQString A, TQString B);
170 TQString metaDataItem(
const TQString &key )
const;
180 void setMetaDataItem(
const TQString &key,
const TQString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
183 TQDomElement element;
190 bool hasMetaData()
const;
191 static TQString left(
const TQString & str, uint len);
217 TQString groupAddress()
const;
227 KBookmark first()
const;
232 KBookmark previous(
const KBookmark & current )
const;
237 KBookmark next(
const KBookmark & current )
const;
250 KBookmark createNewSeparator();
260 KBookmark addBookmark(
KBookmarkManager* mgr,
const KBookmark &bm,
bool emitSignal =
true );
272 KBookmark addBookmark(
KBookmarkManager* mgr,
const TQString & text,
const KURL & url,
const TQString & icon = TQString::null,
bool emitSignal =
true );
279 bool moveItem(
const KBookmark & item,
const KBookmark & after );
285 void deleteBookmark( KBookmark bk );
290 bool isToolbarGroup()
const;
294 TQDomElement findToolbar()
const;
300 TQValueList<KURL> groupUrlList()
const;
303 TQDomElement nextKnownTag( TQDomElement start,
bool goNext )
const;
306 mutable TQString m_address;
320 virtual void visit(
const KBookmark &) { ; }
324 class KBookmarkGroupTraverserPrivate *d;
This class implements the reading/writing of bookmarks in XML.