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

List:       kde-commits
Subject:    branches/work/soc-kdepim-scripting/kontact/src
From:       Kun Xi <bookstack () gmail ! com>
Date:       2005-07-29 10:06:03
Message-ID: 1122631563.612247.31992.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 439928 by kunxi:

Singleton KPIM::ScriptManager integrated

 M  +7 -6      mainwindow.cpp  
 M  +0 -1      mainwindow.h  


--- branches/work/soc-kdepim-scripting/kontact/src/mainwindow.cpp #439927:439928
@@ -893,14 +893,13 @@
 void MainWindow::setupScripts()
 {
   // refered to kate/app/katemainwindow.cpp 
-  scriptMan = new KPIM::ScriptManager(this);
   kdDebug() << "setupScripts" << endl;
   kdDebug() << "path:" << QString(kapp->name()) +"/scripts/" << endl;
   QStringList scripts = KGlobal::dirs()->findAllResources("data", \
QString(kapp->name()) + "/scripts/*.desktop", false, true );  
   for (QStringList::Iterator it = scripts.begin(); it != scripts.end(); ++it ) {
     kdDebug() << "finding Add-on " << *it << endl;
-    scriptMan->addScript( *it );
+    KPIM::ScriptManager::instance()->addScript( *it );
   }
 }
 
@@ -908,7 +907,7 @@
 {
   KPIM::KJSEngine::instance()->addObject(this, "Kontact");
   
-  QDictIterator<KPIM::ScriptInfo> it ( scriptMan->scripts());
+  QDictIterator<KPIM::ScriptInfo> it ( KPIM::ScriptManager::instance()->scripts());
   for(; it.current(); ++it )
   {
     KPIM::ScriptInfo* si = it.current();
@@ -925,14 +924,16 @@
     }
   }
     
-  connect( scriptMenu->popupMenu(), SIGNAL(activated( int)), this, SLOT(runScript( \
int ))); +  connect( scriptMenu->popupMenu(), SIGNAL(activated( int )), this, \
SLOT(runScript( int )));  }
 
 void MainWindow::runScript( int idx )
 {
-  QString menu  = scriptMenu->popupMenu()->text( idx ); 
+  kdDebug() << "idx =" << idx << endl;
+  QString menu  = scriptMenu->popupMenu()->text( idx );
+  menu.remove('&');
   kdDebug() << "menu item " << menu << " clicked" << endl;
-  scriptMan->runScript( menu ); 
+  KPIM::ScriptManager::instance()->runScript( menu ); 
 }
 
 #include "mainwindow.moc"
--- branches/work/soc-kdepim-scripting/kontact/src/mainwindow.h #439927:439928
@@ -159,7 +159,6 @@
     AboutDialog *mAboutDialog;
     bool mReallyClose;
    
-    KPIM::ScriptManager* scriptMan;
     KActionMenu* scriptMenu;
 };
 


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

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