Bug 129514 - Add confirmation dialog to "Close session" menu item
Summary: Add confirmation dialog to "Close session" menu item
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Unclassified
Component: general (show other bugs)
Version: 1.6.4
Platform: Gentoo Packages Linux
: NOR minor (vote)
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-20 21:42 UTC by Niklas Laxström
Modified: 2006-07-22 21:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niklas Laxström 2006-06-20 21:42:06 UTC
Version:           1.6.4 (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages

Steps to reproduce:
1. Open menu with rmb, choose Close session
2. Session closes

Expected result:
Confirmation dialog which asks if I really want to close this session


I find current behaviour annoying because 1) I use laptop with no real mouse 2) I often copy text from bottom of the screen by double clicking and choosing copy from menu. But sometimes I accidentally close my session, because cursor has moved over "Close session" (the first item when activating many at bottom of the screen) and release from my "click" comes too late and is interpreted as select this item. Fortunately I'm usually inside a screen, so no loss of data happens.
Comment 1 Kurt Hindenburg 2006-06-21 18:29:13 UTC
This is a bug not a wish... I'll commit the fix shortly.
Comment 2 Kurt Hindenburg 2006-06-21 18:29:43 UTC
SVN commit 553664 by hindenburg:

RMB->Close Session and tabbar menu->Close Session now uses the 
Close Confirmation Dialog.

Will forward port once I get KDE4 compiling again.

BUG: 129514 


 M  +6 -4      konsole.cpp  
 M  +1 -1      konsole.h  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #553663:553664
@@ -1109,7 +1109,7 @@
      // "Configure Shortcuts").
 
   m_closeSession = new KAction(i18n("C&lose Session"), "fileclose", 0, this,
-                               SLOT(closeCurrentSession()), m_shortcuts, "close_session");
+                               SLOT(confirmCloseCurrentSession()), m_shortcuts, "close_session");
   m_print = new KAction(i18n("&Print Screen..."), "fileprint", 0, this, SLOT( slotPrint() ), m_shortcuts, "file_print");
   m_quit = new KAction(i18n("&Quit"), "exit", 0, this, SLOT( close() ), m_shortcuts, "file_quit");
 
@@ -1340,7 +1340,7 @@
 
 void Konsole::slotTabCloseSession()
 {
-  m_contextMenuSession->closeSession();
+  confirmCloseCurrentSession(m_contextMenuSession);
 }
 
 void Konsole::slotTabbarContextMenu(const QPoint & pos)
@@ -2975,13 +2975,15 @@
     */
 }
 
-void Konsole::confirmCloseCurrentSession()
+void Konsole::confirmCloseCurrentSession( TESession* _se )
 {
+   if ( !_se )
+      _se = se;
    if (KMessageBox::warningContinueCancel(this,
      i18n("Are you sure that you want to close the current session?"),
      i18n("Close Confirmation"), KGuiItem(i18n("C&lose Session"),"tab_remove"),
      "ConfirmCloseSession")==KMessageBox::Continue)
-       closeCurrentSession();
+       _se->closeSession();
 }
 
 void Konsole::closeCurrentSession()
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.h #553663:553664
@@ -139,7 +139,7 @@
   void activateSession();
   void activateSession(TESession*);
   void closeCurrentSession();
-  void confirmCloseCurrentSession();
+  void confirmCloseCurrentSession(TESession* _se=0);
   void doneSession(TESession*);
   void slotCouldNotClose();
   void toggleFullScreen();
Comment 3 Kurt Hindenburg 2006-07-03 19:17:14 UTC
SVN commit 557634 by hindenburg:

RMB->Close Session and tabbar menu->Close Session now uses the 
Close Confirmation Dialog.

CCBUG: 129514


 M  +7 -4      konsole.cpp  
 M  +1 -1      konsole.h  


--- trunk/KDE/kdebase/apps/konsole/konsole/konsole.cpp #557633:557634
@@ -1135,7 +1135,7 @@
      // "Configure Shortcuts").
 
   m_closeSession = new KAction(KIcon("fileclose"), i18n("C&lose Session"), m_shortcuts, "close_session");
-  connect(m_closeSession, SIGNAL(triggered(bool) ), SLOT(closeCurrentSession()));
+  connect(m_closeSession, SIGNAL(triggered(bool) ), SLOT( confirmCloseCurrentSession() ));
   m_print = new KAction(KIcon("fileprint"), i18n("&Print Screen..."), m_shortcuts, "file_print");
   connect(m_print, SIGNAL(triggered(bool) ), SLOT( slotPrint() ));
   m_quit = new KAction(KIcon("exit"), i18n("&Quit"), m_shortcuts, "file_quit");
@@ -1393,7 +1393,7 @@
 
 void Konsole::slotTabCloseSession()
 {
-  m_contextMenuSession->closeSession();
+  confirmCloseCurrentSession(m_contextMenuSession);
 }
 
 void Konsole::slotTabbarContextMenu(const QPoint & pos)
@@ -3001,13 +3001,16 @@
    */
 }
 
-void Konsole::confirmCloseCurrentSession()
+void Konsole::confirmCloseCurrentSession( TESession* _se )
 {
+   if ( !_se )
+      _se = se;
+
   if (KMessageBox::warningContinueCancel(this,
         i18n("Are you sure that you want to close the current session?"),
         i18n("Close Confirmation"), KGuiItem(i18n("C&lose Session"),"tab_remove"),
         "ConfirmCloseSession")==KMessageBox::Continue)
-    closeCurrentSession();
+    _se->closeSession();
 }
 
 void Konsole::closeCurrentSession()
--- trunk/KDE/kdebase/apps/konsole/konsole/konsole.h #557633:557634
@@ -140,7 +140,7 @@
   void activateSession();
   void activateSession(TESession*);
   void closeCurrentSession();
-  void confirmCloseCurrentSession();
+  void confirmCloseCurrentSession(TESession* _se=0);
   void doneSession(TESession*);
   void slotCouldNotClose();
   void toggleFullScreen();
Comment 4 Robert Knight 2006-07-20 22:10:18 UTC
Hello,

I found the new behaviour annoying because it prompted for closure even on sessions where I wasn't doing anything.

For KDE 4 I have tried to make the behaviour more intelligent by only asking if there are running programs.  eg.  The idea being that it won't ask if you just have a shell open at a particular bookmark, but it will ask if you have Vi running with a possibly unsaved/unfinished document or are busy compiling something.

Is this new behaviour likely to be a problem for your use case?
Comment 5 Kurt Hindenburg 2006-07-22 21:08:39 UTC
I'm not sure the best way of handling this... I tried various other terms and they don't popup a confirmation window when exiting one session.  However, I can understand the reporter's problem.
Likely another option somewhere, unless you want to say 'hey you clicked close session' so that's what Konsole did.