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

List:       kde-commits
Subject:    kdebase/konqueror/sidebar/trees/dirtree_module
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-05-27 10:28:24
[Download RAW message or body]

CVS commit by waba: 

Don't duplicate items when renaming a dir.


  M +13 -7     dirtree_module.cpp   1.29


--- kdebase/konqueror/sidebar/trees/dirtree_module/dirtree_module.cpp  #1.28:1.29
@@ -369,5 +369,5 @@ void KonqSidebarDirTreeModule::listDirec
 void KonqSidebarDirTreeModule::slotNewItems( const KFileItemList& entries )
 {
-    //kdDebug(1201) << this << " KonqSidebarDirTreeModule::slotNewItems " << \
entries.count() << endl; +    kdDebug(1201) << this << " \
KonqSidebarDirTreeModule::slotNewItems " << entries.count() << endl;  
     Q_ASSERT(entries.count());
@@ -453,5 +453,8 @@ void KonqSidebarDirTreeModule::slotRefre
                 dirTreeItem->setText( 0, KIO::decodeFileName( fileItem->name() ) );
 
-                m_dictSubDirs.insert(dirTreeItem->id, item);
+                // Make sure the item doesn't get inserted twice!
+                // dirTreeItem->id points to the new name
+                remove(m_dictSubDirs, dirTreeItem->id, dirTreeItem);
+                m_dictSubDirs.insert(dirTreeItem->id, dirTreeItem);
             }
 
@@ -485,11 +488,14 @@ void KonqSidebarDirTreeModule::slotRedir
     kdDebug(1201) << \
"******************************KonqSidebarDirTreeModule::slotRedirection(" << \
newUrl.prettyURL() << ")" << endl;  
+    QString oldUrlStr = oldUrl.url(-1);
+    QString newUrlStr = newUrl.url(-1);
+
     QPtrList<KonqSidebarTreeItem> *itemList;
     KonqSidebarTreeItem * item;
-    lookupItems(m_dictSubDirs, oldUrl.url(-1), item, itemList);
+    lookupItems(m_dictSubDirs, oldUrlStr, item, itemList);
 
     if (!item)
     {
-        kdWarning(1201) << "NOT FOUND   oldUrl=" << oldUrl.url(-1) << endl;
+        kdWarning(1201) << "NOT FOUND   oldUrl=" << oldUrlStr << endl;
         return;
     }
@@ -498,8 +504,8 @@ void KonqSidebarDirTreeModule::slotRedir
     {
         // We need to update the URL in m_dictSubDirs
-        m_dictSubDirs.insert( newUrl.url(-1), item );
-        item->alias << newUrl.url(-1);
+        m_dictSubDirs.insert( newUrlStr, item );
+        item->alias << newUrlStr;
 
-        kdDebug(1201) << "Updating url of " << item << " to " << newUrl.url(-1) << \
endl; +        kdDebug(1201) << "Updating url of " << item << " to " << newUrlStr << \
endl;  
     } while ((item = itemList ? itemList->take(0) : 0));


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

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