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

List:       kde-commits
Subject:    kdepim/kaplan/src
From:       David Faure <faure () kde ! org>
Date:       2003-01-04 22:32:32
[Download RAW message or body]

CVS commit by faure: 

* Mainwindow settings auto-saved
* Implement the KDCOPServiceStarter interface, to load parts in-process when
looking for a particular DCOP service.


  M +27 -10    core.cpp   1.15
  M +17 -7     core.h   1.7


--- kdepim/kaplan/src/core.cpp  #1.14:1.15
@@ -43,4 +43,5 @@
 #include "navigator.h"
 #include "core.h"
+#include <dcopclient.h>
 
 
@@ -77,4 +78,7 @@ Core::Core()
 
   m_navigator->setCurrentItem(0);
+
+  resize(600, 400); // initial size
+  setAutoSaveSettings();
 }
 
@@ -82,5 +86,4 @@ Core::Core()
 Core::~Core()
 {
-        saveSettings(); 
     QPtrList<KParts::Part> parts = *m_partManager->parts();
     parts.setAutoDelete(true);
@@ -90,14 +93,8 @@ Core::~Core()
 void Core::loadSettings()
 {
-        KConfig* config = kapp->config();
-        config->setGroup("General");
-        resize( config->readSizeEntry("Dimensions", new QSize(600, 400)) );
 }
         
 void Core::saveSettings()
 {
-        KConfig* config = kapp->config();
-        config->setGroup("General");
-        config->writeEntry("Dimensions", size());
 }
 
@@ -137,4 +134,5 @@ void Core::addPlugin(Kaplan::Plugin *plu
   // merge the plugins GUI into the main window
   insertChildClient(plugin);
+  m_plugins.append(plugin);
 }
 
@@ -166,5 +164,5 @@ void Core::showView(QWidget *view)
 void Core::slotQuit()
 {
-  kapp->quit();
+  close();
 }
 
@@ -175,4 +173,23 @@ void Core::addMainEntry(QString text, QS
 }
 
+int Core::startServiceFor( const QString& serviceType,
+                           const QString& constraint,
+                           const QString& preferences,
+                           QString *error, QCString* dcopService, int flags )
+{
+  QPtrListIterator<Kaplan::Plugin> it( m_plugins );
+  for ( ; it.current() ; ++it )
+  {
+    if ( it.current()->createDCOPInterface( serviceType ) ) {
+      kdDebug() << "found interface for " << serviceType << endl;
+      if ( dcopService )
+        *dcopService = it.current()->dcopClient()->appId();
+      kdDebug() << "appId=" << it.current()->dcopClient()->appId() << endl;
+      return 0; // success
+    }
+  }
+  kdDebug() << "Didn't find dcop interface, falling back to external process" << \
endl; +  return KDCOPServiceStarter::startServiceFor( serviceType, constraint, \
preferences, error, dcopService, flags ); +}
 
 #include "core.moc"

--- kdepim/kaplan/src/core.h  #1.6:1.7
@@ -25,4 +25,5 @@
 
 #include <qwidgetstack.h>
+#include <qptrlist.h>
 
 
@@ -33,4 +34,5 @@
 
 #include "kpcore.h"
+#include <kdcopservicestarter.h>
 
 
@@ -43,5 +45,5 @@ class Navigator;
 class KAction;
 
-class Core : public Kaplan::Core
+class Core : public Kaplan::Core, public KDCOPServiceStarter
 {
   Q_OBJECT
@@ -60,4 +62,11 @@ public:
   virtual void insertNewAction(KAction *action);
   
+  // KDCOPServiceStarter interface
+  virtual int startServiceFor( const QString& serviceType,
+                               const QString& constraint = QString::null,
+                               const QString& preferences = QString::null,
+                               QString *error=0, QCString* dcopService=0,
+                               int flags=0 );
+
 private slots:
 
@@ -81,4 +90,5 @@ private:
   
   QWidgetStack *m_stack;
+  QPtrList<Kaplan::Plugin> m_plugins;
 
   KActionMenu *m_newActions;


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

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