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

List:       kde-commits
Subject:    koffice/lib/kofficeui
From:       David Faure <faure () kde ! org>
Date:       2003-12-03 15:46:22
[Download RAW message or body]

CVS commit by faure: 

Only offer Quit when there's a single document and a single mainwindow,
and we're not in koshell.
TODO: find bug number(s) and close it/them.


  M +11 -3     koTemplateChooseDia.cc   1.97


--- koffice/lib/kofficeui/koTemplateChooseDia.cc  #1.96:1.97
@@ -38,4 +38,6 @@
 #include <koFilterManager.h>
 #include <koTemplates.h>
+#include <koDocument.h>
+#include <kmainwindow.h>
 
 #include "koTemplateChooseDia.h"
@@ -205,4 +207,10 @@ KoTemplateChooseDia::~KoTemplateChooseDi
 }
 
+static bool cancelQuits() {
+    bool onlyDoc = !KoDocument::documentList() || KoDocument::documentList()->count() <= 1;
+    bool onlyMainWindow = !KMainWindow::memberList || KMainWindow::memberList->count() <= 1;
+    return onlyDoc && onlyMainWindow && kapp->instanceName() != "koshell"; // hack for koshell
+}
+
 /*================================================================*/
 // static
@@ -235,5 +243,5 @@ KoTemplateChooseDia::ReturnType KoTempla
 
     delete dlg;
-    if ( rt == Cancel && dialogType == Everything )
+    if ( rt == Cancel && dialogType == Everything && cancelQuits() )
         // The button says quit, so let's quit
         kapp->quit();
@@ -463,5 +471,5 @@ void KoTemplateChooseDia::setupDialog()
         }
 
-
+        if ( cancelQuits() )
         setButtonCancelText(i18n("&Quit"));
 


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

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