Bug 111599

Summary: CTRL-W keeps closing empty document and creating new one
Product: [Unmaintained] quanta Reporter: whoeiee:eani <eani>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 3.4.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description whoeiee:eani 2005-08-27 13:04:20 UTC
Version:           3.4.2 (using KDE 3.4.2, compiled sources)
Compiler:          gcc version 3.3.5
OS:                Linux (i686) release 2.6.11.7

Upon closing all your open documents (holding down CTRL-W), When the last document is closed, Quanta creates a new blank document (this is absolutely OK), but if you hold down CTRL-W too long, that empty document gets closed again and recreated and closed again and recreated and closed again.......
I just spent almost a full minute waiting for this loop to end!

I thought it might be a good idea to change this behaviour.
Comment 1 András Manţia 2006-03-03 16:31:57 UTC
SVN commit 515385 by amantia:

Don't try to remove an empty, unmodified buffer, if it is the last          opened one.

BUG: 111599


 M  +2 -0      ChangeLog  
 M  +11 -0     src/viewmanager.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #515384:515385
@@ -12,6 +12,8 @@
   - improvements:
         - less reparsing of the document while typing is in progress
         - open dropped files [#102605]
+        - don't try to remove an empty, unmodified buffer, if it is the last
+          opened one [#111599]
 
 
 Version 3.5.1 (Release date: 23-01-2006; Started 30-11-2005):
--- branches/KDE/3.5/kdewebdev/quanta/src/viewmanager.cpp #515384:515385
@@ -153,6 +153,17 @@
 bool ViewManager::removeView(QuantaView *view, bool force, bool createNew)
 {
     if (!view) return false;
+    int noOfViews = 0;
+    QValueList<Document*> list;
+    KMdiIterator<KMdiChildView*> *it = quantaApp->createIterator();
+    for (it->first(); !it->isDone(); it->next())
+    {
+      noOfViews++;
+      if (noOfViews > 1)
+        break;
+    }
+    if (noOfViews == 1 && view->document()->isUntitled() && !view->document()->isModified())
+      return true;
     bool mayRemove = view->mayRemove();
     if (mayRemove)
     {