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

List:       kde-core-devel
Subject:    Re: [PATCH] new CloseWindow and CloseDocument KStandardGuiItems
From:       Marcel Partap <mpartap () gmx ! net>
Date:       2009-01-17 17:52:56
Message-ID: 49721AF8.9070007 () gmx ! net
[Download RAW message or body]

> I'd warn you that there has be a very long and heated discussion of
>  this and related topics going on for the last couple weeks on the 
> kde-usability list [1].
Uuuuhh no way I am reading all of _that_ thread ;)
I knew some discussion was going on so i wanted to only *add* those
two actions and change them in Konqueror, leaving the policy within 
other apps to the respective app maintainers. But the core of the 
problem is nicely concentrated in the following statement by Jud Craft:
  > Here's the sad truth:  by applying Ctrl-W consistently *every* time
  > (which is a good thing!) based on Application behavior, we actually
  > end up being *inconsistent*...because the *behavior* is what is
  > inconsistent between the Apps.

also, quoting from the kstandardactions implementation makes this 
dilemma even more visible
 > (KAction *quit: Quit the program.)
 > Note that you probably want to connect this action to either
 > QWidget::close() or QApplication::closeAllWindows()

So i didn't change anything in there and provide here just the patch 
to add "Close window" and "Close document" GUI-wise, make Konqui use 
the former one instead of the "Quit" button and leave further steps to 
others more bold than me ;)
rgds marcel

-- 
   "Obstacles are those frightful things you see when you take
    your eyes off your goal."         -- Henry Ford (1863-1947)

    Change the world! Vote: http://hfopi.org/vote-future


["add-close-document-action-icons.tar.gz" (application/gzip)]
["kstandardguiitem-add-closewindow-and-closedocument.patch" (text/plain)]

Index: kdelibs/kdeui/util/kstandardguiitem.h
===================================================================
--- kdelibs/kdeui/util/kstandardguiitem.h	(revision 910391)
+++ kdelibs/kdeui/util/kstandardguiitem.h	(working copy)
@@ -47,10 +47,10 @@
 
     enum StandardItem
     {
-        Ok=1, Cancel, Yes, No, Discard, Save, DontSave, SaveAs,
-        Apply, Clear, Help, Defaults, Close, Back, Forward, Print,
-        Continue, Open, Quit, AdminMode, Reset, Delete, Insert,
-        Configure, Find, Stop, Add, Remove, Test, Properties, Overwrite
+        Ok=1, Cancel, Yes, No, Discard, Save, DontSave, SaveAs, Apply, Clear,
+        Help, Defaults, Close, Back, Forward, Print, Continue, Open, Quit,
+        AdminMode, Reset, Delete, Insert, Configure, Find, Stop, Add, Remove,
+        Test, Properties, Overwrite, CloseWindow, CloseDocument
     };
 
     /**
@@ -138,6 +138,18 @@
     KDEUI_EXPORT KGuiItem close();
 
     /**
+     * Returns the 'CloseWindow' gui item.
+     * @since 4.3
+     */
+    KDEUI_EXPORT KGuiItem closeWindow();
+
+    /**
+     * Returns the 'CloseDocument' gui item.
+     * @since 4.3
+     */
+    KDEUI_EXPORT KGuiItem closeDocument();
+
+    /**
      * Returns the 'Print' gui item.
      */
     KDEUI_EXPORT KGuiItem print();
Index: kdelibs/kdeui/util/kstandardguiitem.cpp
===================================================================
--- kdelibs/kdeui/util/kstandardguiitem.cpp	(revision 910391)
+++ kdelibs/kdeui/util/kstandardguiitem.cpp	(working copy)
@@ -41,6 +41,8 @@
   case Clear    : return clear();
   case Help     : return help();
   case Close    : return close();
+  case CloseWindow : return closeWindow();
+  case CloseDocument : return closeDocument();
   case Defaults : return defaults();
   case Back     : return back();
   case Forward  : return forward();
@@ -78,6 +80,8 @@
   case Apply    : return QLatin1String("apply");
   case Help     : return QLatin1String("help");
   case Close    : return QLatin1String("close");
+  case CloseWindow : return QLatin1String("closeWindow");
+  case CloseDocument : return QLatin1String("closeDocument");
   case Defaults : return QLatin1String("defaults");
   case Back     : return QLatin1String("back");
   case Forward  : return QLatin1String("forward");
@@ -181,6 +185,18 @@
                    i18n( "Close the current window or document" ) );
 }
 
+KGuiItem closeWindow()
+{
+  return KGuiItem( i18n( "&Close Window" ), "window-close",
+		   i18n( "Close the current window." ) );
+}
+
+KGuiItem closeDocument()
+{
+  return KGuiItem( i18n( "&Close Document" ), "document-close",
+		   i18n( "Close the current document." ) );
+}
+
 KGuiItem defaults()
 {
   return KGuiItem( i18n( "&Defaults" ), "document-revert",

["konqueror-change-close-button.patch" (text/plain)]

Index: kdebase/apps/konqueror/src/konqmainwindow.cpp
===================================================================
--- kdebase/apps/konqueror/src/konqmainwindow.cpp	(revision 912267)
+++ kdebase/apps/konqueror/src/konqmainwindow.cpp	(working copy)
@@ -5060,7 +5061,7 @@
                   i18n("You have multiple tabs open in this window, "
                         "are you sure you want to quit?"),
                   i18n("Confirmation"),
-                  KStandardGuiItem::quit(),
+                  KStandardGuiItem::closeWindow(),
                   KGuiItem(i18n( "C&lose Current Tab" ), "tab-close"),
                   KStandardGuiItem::cancel(),
                   "MultipleTabConfirm"


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

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