Bug 76323 - no mainWindow restore on exec kopete
Summary: no mainWindow restore on exec kopete
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-28 00:22 UTC by Kees van Wijk
Modified: 2004-03-01 05:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kees van Wijk 2004-02-28 00:22:59 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Gentoo Packages

Many kde applications startup only one instance, Examples are juk or kmail. 
So the effect of starting a second juk or kmail by typing into a konsole kmail or juk is only (as far as I, the user, see) to raise the existing instance. Probably through something like 
"dcop kmail kmail-mainwindow restore" 
This is a very nice feature but it is missing from kopete. 

When I type "kopete" in my terminal while there is already one instance running that instance should by restored (raised).

Groeten,
Kees
Comment 1 Matt Rogers 2004-03-01 03:12:06 UTC
working on it! (or as lilachaze would say, "Mine!")
Comment 2 Matt Rogers 2004-03-01 05:43:58 UTC
CVS commit by mattr: 

Fix bug 76323. Restore the window when attempting to run a second instance
of kopete. [BACKPORT]

CCMAIL: 76323-done@bugs.kde.org


  M +22 -0     kopete.cpp   1.170.2.2
  M +2 -0      kopete.h   1.81.2.1


--- kdenetwork/kopete/kopete/kopete.cpp  #1.170.2.1:1.170.2.2
@@ -216,4 +216,26 @@ void  Kopete::slotAllPluginsLoaded()
 }
 
+int Kopete::newInstance()
+{
+        kdDebug(14000) << k_funcinfo << endl;
+
+        /** The following three lines work around the problem that
+         * Kopete has multiple main windows, so qapp->mainWidget()
+         * returns 0, which breaks the normal
+         * KUniqueApplication::newInstance() that raises the window
+         * when we run a new instance.
+         *
+         * 1. Set the main widget to the contact list window
+         * 2. Call KUniqueApplication::newInstance()
+         * 3. Set the main widget back to 0
+         */
+
+        setMainWidget( m_mainWindow );
+        int kUniqAppReturnCode = KUniqueApplication::newInstance();
+        setMainWidget( 0L );
+
+        return kUniqAppReturnCode;
+}
+
 void Kopete::quitKopete()
 {

--- kdenetwork/kopete/kopete/kopete.h  #1.81:1.81.2.1
@@ -49,4 +49,6 @@ public:
         bool isShuttingDown() const { return m_isShuttingDown; }
 
+        virtual int newInstance();
+
 public slots:
         /**