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

List:       kde-commits
Subject:    KDE/kdenetwork/kdict
From:       Henrique Pinto <stampede () coltec ! ufmg ! br>
Date:       2005-05-15 17:04:47
Message-ID: 1116176687.943639.22175.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 414259 by henrique:

	* Move some small things around



 M  +19 -8     trunk/KDE/kdenetwork/kdict/application.cpp  
 M  +6 -0      trunk/KDE/kdenetwork/kdict/application.h  
 M  +2 -2      trunk/KDE/kdenetwork/kdict/dict.h  
 M  +0 -9      trunk/KDE/kdenetwork/kdict/main.cpp  
 M  +3 -2      trunk/KDE/kdenetwork/kdict/toplevel.cpp  
 M  +1 -1      trunk/KDE/kdenetwork/kdict/toplevel.h  


--- trunk/KDE/kdenetwork/kdict/application.cpp #414258:414259
@@ -20,11 +20,13 @@
 Application::Application()
  : KUniqueApplication()
 {
+  m_mainWindow = new TopLevel( 0, "mainWindow" );
 }
 
 
 Application::~Application()
 {
+  delete m_mainWindow;
 }
 
 
@@ -36,22 +38,31 @@
   // process parameters...
   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
+  m_mainWindow->show();
+
   if (args->isSet("clipboard"))
-    static_cast<TopLevel*>(mainWidget())->defineClipboard();
-  else {
-    if (args->count()>0) {
+  {
+    m_mainWindow->defineClipboard();
+  }
+  else
+  {
+    if (args->count()>0)
+    {
       QString phrase;
-      for (int i=0;i<args->count();i++) {
+      for (int i=0;i<args->count();i++)
+      {
         phrase += QString::fromLocal8Bit(args->arg(i));
         if (i+1 < args->count())
           phrase += " ";
       }
-      static_cast<TopLevel*>(mainWidget())->define(phrase);
-    } else
-      static_cast<TopLevel*>(mainWidget())->normalStartup();
+      m_mainWindow->define(phrase);
+    }
+    else
+    {
+      m_mainWindow->normalStartup();
+    }
   }
 
-  kdDebug(5004) << "Application::newInstance() done" << endl;
   return 0;
 }
 
--- trunk/KDE/kdenetwork/kdict/application.h #414258:414259
@@ -13,9 +13,12 @@
 #define APPLICATION_H
 
 #include <kuniqueapplication.h>
+#include <qguardedptr.h>
 
 #define KDICT_VERSION "0.6"
 
+class TopLevel;
+
 class Application : public KUniqueApplication
 {
   Q_OBJECT
@@ -28,6 +31,9 @@
         main window active if Kdict is already running */
     int newInstance();
 
+  private:
+    QGuardedPtr<TopLevel> m_mainWindow;
+
 };
 
 #endif
--- trunk/KDE/kdenetwork/kdict/dict.h #414258:414259
@@ -13,9 +13,9 @@
    JobData          used for data transfer between Client and Interface
    DictAsyncClient  all network related stuff happens here in an asynchrous thread
    DictInterface    interface for DictAsyncClient, job management
-   
+
    -------------------------------------------------------------*/
- 
+
 #ifndef _DICT_H_
 #define _DICT_H_
 
--- trunk/KDE/kdenetwork/kdict/main.cpp #414258:414259
@@ -52,14 +52,5 @@
 
   Application app;
 
-  if (app.isRestored()) {
-     RESTORE(TopLevel);
-  }
-  else
-  {
-     TopLevel* top = new TopLevel();
-     top->show();
-  }
-
   return app.exec();
 }
--- trunk/KDE/kdenetwork/kdict/toplevel.cpp #414258:414259
@@ -50,8 +50,9 @@
 GlobalData *global;
 
 
-TopLevel::TopLevel()
-: DCOPObject("KDictIface"), KMainWindow(), optDlg(0L), setsDlg(0L), stopRef(0)
+TopLevel::TopLevel(QWidget* parent, const char* name)
+  : DCOPObject("KDictIface"), KMainWindow(parent, name, WType_TopLevel),
+    optDlg(0L), setsDlg(0L), stopRef(0)
 {
   kapp->dcopClient()->setDefaultObject(objId());
   kapp->setMainWidget(this);
--- trunk/KDE/kdenetwork/kdict/toplevel.h #414258:414259
@@ -43,7 +43,7 @@
 
 public:
 
-  TopLevel();
+  TopLevel(QWidget* parent = 0, const char* name = 0);
   ~TopLevel();
 
   void normalStartup();             // called when started without commandline parameters
[prev in list] [next in list] [prev in thread] [next in thread] 

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