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

List:       kde-commits
Subject:    kdelibs/kate/interfaces
From:       Joseph Wenninger <kde () jowenn ! at>
Date:       2004-08-21 11:13:35
Message-ID: 20040821111335.45C7B90CD () office ! kde ! org
[Download RAW message or body]

CVS commit by jowenn: 

make unregistering of commandline plugins possible


  M +1 -1      interfaces.cpp   1.25
  M +13 -2     katecmd.cpp   1.8


--- kdelibs/kate/interfaces/interfaces.cpp  #1.24:1.25
@@ -67,5 +67,5 @@ bool Document::registerCommand (Command 
 bool Document::unregisterCommand (Command *cmd)
 {
-  return KateCmd::self()->registerCommand (cmd);
+  return KateCmd::self()->unregisterCommand (cmd);
 }
 

--- kdelibs/kate/interfaces/katecmd.cpp  #1.7:1.8
@@ -20,4 +20,5 @@
 
 #include <kstaticdeleter.h>
+#include <kdebug.h>
 
 KateCmd *KateCmd::s_self = 0;
@@ -39,6 +40,8 @@ bool KateCmd::registerCommand (Kate::Com
       return false;
 
-  for (uint z=0; z<l.count(); z++)
+  for (uint z=0; z<l.count(); z++) {
     m_dict.insert (l[z], cmd);
+    kdDebug()<<"Inserted command:"<<l[z]<<endl;
+  }
 
   m_cmds += l;
@@ -47,6 +50,14 @@ bool KateCmd::registerCommand (Kate::Com
 }
 
-bool KateCmd::unregisterCommand (Kate::Command *)
+bool KateCmd::unregisterCommand (Kate::Command *cmd)
 {
+  QStringList l;
+  QDictIterator<Kate::Command> it(m_dict);
+  for( ; it.current(); ++it )
+        if (it.current()==cmd) l<<it.currentKey();
+  for ( QStringList::Iterator it1 = l.begin(); it1 != l.end(); ++it1 ) {
+        m_dict.remove(*it1);
+        kdDebug()<<"Removed command:"<<*it1<<endl;
+  }
   return true;
 }


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

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