[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kio/bookmarks
From:       Frerich Raabe <raabe () kde ! org>
Date:       2005-01-31 0:45:27
Message-ID: 20050131004527.EAFE81CF60 () office ! kde ! org
[Download RAW message or body]

CVS commit by raabe: 

- David thinks that if a bookmark with non-default meta data gets added, the
  big 'need to reread whole bookmark file' signal needs to be emitted, instead
  of the little 'just this bookmark group changed' signal. I couldn't reproduce
  the scenario he describes (or I just misunderstood what I was supposed to do)
  but this can't hurt I think, so here we go.


  M +30 -4     kbookmark.cc   1.121
  M +3 -0      kbookmark.h   1.59


--- kdelibs/kio/bookmarks/kbookmark.cc  #1.120:1.121
@@ -180,8 +180,13 @@ KBookmark KBookmarkGroup::addBookmark( K
     element.appendChild( bm.internalElement() );
 
-    if (emitSignal)
+    if (emitSignal) {
+        if ( bm.hasExtraMetaData() ) {
+            mgr->notifyCompleteChange( "" );
+        } else {
         emit mgr->notifier().addedBookmark(
                                  mgr->path(), bm.url().url(),
                                  bm.fullText(), bm.address(), bm.icon() );
+        }
+    }
 
     return bm;
@@ -398,4 +403,25 @@ static QDomNode findOrCreateMetadata( QD
 }
 
+bool KBookmark::hasExtraMetaData() const
+{
+    static const QString &timeAdded = KGlobal::staticQString( "time_added" );
+    static const QString &timeVisited = KGlobal::staticQString( "time_visited" );
+    static const QString &visitCount = KGlobal::staticQString( "visit_count" );
+
+    QDomNode n = cd_or_create( internalElement(), "info" );
+    n = findOrCreateMetadata( n );
+    for ( n = n.firstChild(); !n.isNull(); n = n.nextSibling() ) {
+        if ( !n.isElement() ) {
+            continue;
+        }
+        const QString tagName = n.toElement().tagName();
+        if ( tagName != timeAdded && tagName != timeVisited && tagName != visitCount ) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 void KBookmark::updateAccessMetadata()
 {

--- kdelibs/kio/bookmarks/kbookmark.h  #1.58:1.59
@@ -181,4 +181,7 @@ protected:
     // around internal QDomElements. Any additional information
     // has to be implemented as an attribute of the QDomElement.
+
+private:
+    bool hasExtraMetaData() const;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic