[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio/bookmarks
From: David Faure <faure () kde ! org>
Date: 2005-01-29 2:48:01
Message-ID: 20050129024801.6019E1D17E () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
One step towards XBEL conformance: add owner attribute to <metadata>; Frerich
pointed out that it's mandatory.
M +25 -2 kbookmark.cc 1.119
--- kdelibs/kio/bookmarks/kbookmark.cc #1.118:1.119
@@ -371,4 +371,27 @@ static QDomText get_or_create_text(QDomN
}
+// Look for a metadata with owner="http://www.kde.org" or without any owner (for compatibility)
+static QDomNode findOrCreateMetadata( QDomNode& parent )
+{
+ static const char kdeOwner[] = "http://www.kde.org";
+ QDomElement metadataElement;
+ for ( QDomNode _node = parent.firstChild(); !_node.isNull(); _node = _node.nextSibling() ) {
+ QDomElement elem = _node.toElement();
+ if ( !elem.isNull() && elem.tagName() == "metadata" ) {
+ const QString owner = elem.attribute( "owner" );
+ if ( owner == kdeOwner )
+ return elem;
+ if ( owner.isEmpty() )
+ metadataElement = elem;
+ }
+ }
+ if ( metadataElement.isNull() ) {
+ metadataElement = parent.ownerDocument().createElement( "metadata" );
+ parent.appendChild(metadataElement);
+ }
+ metadataElement.setAttribute( "owner", kdeOwner );
+ return metadataElement;
+}
+
void KBookmark::updateAccessMetadata()
{
@@ -376,5 +399,5 @@ void KBookmark::updateAccessMetadata()
QDomNode subnode = cd_or_create(internalElement(), "info");
- subnode = cd_or_create(subnode, "metadata");
+ subnode = findOrCreateMetadata(subnode);
uint timet = QDateTime::currentDateTime().toTime_t();
@@ -399,5 +422,5 @@ void KBookmark::updateAccessMetadata()
domtext.setData(QString::number(currentCount));
- // TODO - for 3.3 - time_modified
+ // TODO - for 4.0 - time_modified
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic