Bug 125116 - please add ability to "open in the same window" config GUI to KolourPaint
Summary: please add ability to "open in the same window" config GUI to KolourPaint
Status: CONFIRMED
Alias: None
Product: kolourpaint
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: kolourpaint-support
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-07 15:25 UTC by Technologov
Modified: 2014-09-30 21:12 UTC (History)
0 users

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 Technologov 2006-04-07 15:25:16 UTC
Version:           1.4.3_light-pre (using KDE 3.4.2 Level "b" , SUSE 10.0)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.13-15-default

Currently, when you open a bitmap in KolourPaint it opens in a new window. I ask the developers, to make KolourPaint configurable - so the user can choose if he wants to open bitmaps in current window (like MS Paint) or in a new window (like it's current way).

OS: SUSE Linux 10.0. KDE 3.4.2, KolourPaint 1.4.3 light-pre.
Comment 1 Thiago Macieira 2006-04-10 02:26:27 UTC
I don't agree. All KDE applications open new windows when opening other documents if they don't support tabbing or another MDI mechanism. KolourPaint shouldn't behave differently.
Comment 2 Technologov 2006-04-10 16:18:24 UTC
I understand, but this behavior should be configurable.
Comment 3 Technologov 2006-04-10 16:23:01 UTC
Maybe I should change the topic to "All KDE software" instead of "Kolourpaint" ?
Comment 4 Thiago Macieira 2006-04-10 18:14:55 UTC
No. The KDE HIG says it should open a new window. It's not a bug report that will change that. You'll need to convince our usability people first.
Comment 5 Clarence Dang 2006-12-15 00:58:56 UTC
Closed as per Comment #1: KolourPaint should be consistent with other KDE applications.

However, if you *really* want this, let me know and I will implement a hidden configuration option.
Comment 6 Technologov 2006-12-15 01:19:47 UTC
Yes, please. Some people are used to MS Paint (including me and my father), and we prefer to open new image in same window (actually replacing what we have editing).

When I need to edit 2 pictures simulatenously, then I manually open 2 MS Paints, and can edit (copy-paste) between those.

I am not asking to make this default, just an option.
Comment 7 Technologov 2006-12-15 01:21:31 UTC
After all - it looks & feels so similar to MS Paint (which is good), so that even such small thing is noticeable.
Comment 8 Clarence Dang 2006-12-15 08:07:53 UTC
SVN commit 613781 by dang:

Add hidden configuration option "Open Images in the Same Window" which,
when enabled, forces "File / New", "File / Open ..." and "File / Open Recent"
to never open a new window.


Given that it violates the KDE UI standards, I don't think it should have a
user-visible config option - do you agree or disagree?


Testing has been limited due to my checkout of kdelibs 4.0 having far too
many bugs.


Technical details:
- Removed kpMainWindow::shouldOpenInNewWindow() and inlined the code as
  the method would be too confusing if this configuration option was on


Support for the feature:

1.
CCMAIL: 125116-done@bugs.kde.org

2. 
Frank Wieduwilt, Linux Magazine Issue #44 (Jul '04) p77:

"Unfortunately, the program [KolourPaint] opens up each image in a separate
window.  This tends to clutter up the screen while working with multiple
images.  The developers have promised to change this in the imminent 1.1
version, however."

3.
And the feature was also silented requested by me :)



 M  +3 -0      NEWS  
 M  +1 -0      kpdefs.h  
 M  +20 -0     mainwindow/kpmainwindow.cpp  
 M  +0 -1      mainwindow/kpmainwindow.h  
 M  +47 -13    mainwindow/kpmainwindow_file.cpp  
 M  +2 -0      mainwindow/kpmainwindow_p.h  


--- trunk/KDE/kdegraphics/kolourpaint/NEWS #613780:613781
@@ -15,7 +15,10 @@
      - Centre image on page
      [also in branches/KDE/3.5/]
 
+   * Add hidden configuration option "Open Images in the Same Window"
+     (Bug #125116)
 
+
 KolourPaint 1.4_relight Series (branches/KDE/3.5/)
 ===============================
 
--- trunk/KDE/kdegraphics/kolourpaint/kpdefs.h #613780:613781
@@ -72,6 +72,7 @@
 #define kpSettingColorSimilarity QString::fromLatin1 ("Color Similarity")
 #define kpSettingDitherOnOpen QString::fromLatin1 ("Dither on Open if Screen is 15/16bpp and Image Num Colors More Than")
 #define kpSettingPrintImageCenteredOnPage QString::fromLatin1 ("Print Image Centered On Page")
+#define kpSettingOpenImagesInSameWindow QString::fromLatin1 ("Open Images in the Same Window")
 
 #define kpSettingsGroupFileSaveAs QString::fromLatin1 ("File/Save As")
 #define kpSettingsGroupFileExport QString::fromLatin1 ("File/Export")
--- trunk/KDE/kdegraphics/kolourpaint/mainwindow/kpmainwindow.cpp #613780:613781
@@ -124,7 +124,26 @@
     d->m_moreEffectsDialogLastEffect = cfg.readEntry (kpSettingMoreEffectsLastEffect, 0);
     d->m_resizeScaleDialogLastKeepAspect = cfg.readEntry (kpSettingResizeScaleLastKeepAspect, false);
 
+    if (cfg.hasKey (kpSettingOpenImagesInSameWindow))
+    {
+        d->configOpenImagesInSameWindow = cfg.readEntry (kpSettingOpenImagesInSameWindow, false);
+    }
+    else
+    {
+        d->configOpenImagesInSameWindow = false;
+#if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\tconfigOpenImagesInSameWindow: first time"
+                  << " - writing default: " << d->configOpenImagesInSameWindow
+                  << endl;
+#endif
+        // TODO: More hidden options have to write themselves out on startup,
+        //       not on use, to be discoverable (e.g. printing centered on page).
+        cfg.writeEntry (kpSettingOpenImagesInSameWindow,
+                        d->configOpenImagesInSameWindow);
+        cfg.sync ();
+    }
 
+
 #if DEBUG_KP_MAIN_WINDOW
     kDebug () << "\t\tGeneral Settings: firstTime=" << m_configFirstTime
                << " showGrid=" << m_configShowGrid
@@ -132,6 +151,7 @@
                << " colorSimilarity=" << m_configColorSimilarity
                << " moreEffectsDialogLastEffect=" << d->m_moreEffectsDialogLastEffect
                << " resizeScaleDialogLastKeepAspect=" << d->m_resizeScaleDialogLastKeepAspect
+               << " openImagesInSameWindow=" << d->configOpenImagesInSameWindow
                << endl;
 #endif
 }
--- trunk/KDE/kdegraphics/kolourpaint/mainwindow/kpmainwindow.h #613780:613781
@@ -296,7 +296,6 @@
     bool m_exportFirstTime;
 
 private:
-    bool shouldOpenInNewWindow () const;
     void addRecentURL (const KUrl &url);
     void setRecentURLs (const QStringList &items);
 
--- trunk/KDE/kdegraphics/kolourpaint/mainwindow/kpmainwindow_file.cpp #613780:613781
@@ -27,6 +27,7 @@
 
 
 #include <kpmainwindow.h>
+#include <kpmainwindow_p.h>
 
 #include <qdatastream.h>
 #include <qpainter.h>
@@ -126,12 +127,6 @@
 
 
 // private
-bool kpMainWindow::shouldOpenInNewWindow () const
-{
-    return (m_document && !m_document->isEmpty ());
-}
-
-// private
 void kpMainWindow::addRecentURL (const KUrl &url)
 {
 #if DEBUG_KP_MAIN_WINDOW
@@ -202,13 +197,19 @@
 
 
 // private slot
+// TODO: Disable action if
+//       (d->configOpenImagesInSameWindow && m_document && m_document->isEmpty())
+//       as it does nothing if this is true.
 void kpMainWindow::slotNew ()
 {
     if (toolHasBegunShape ())
         tool ()->endShapeInternal ();
 
-    if (m_document)
+    if (m_document && !d->configOpenImagesInSameWindow)
     {
+        // A document -- empty or otherwise -- is open.
+        // Force open a new window.  In contrast, open() might not open
+        // a new window in this case.
         kpMainWindow *win = new kpMainWindow ();
         win->show ();
     }
@@ -262,31 +263,64 @@
 // private
 bool kpMainWindow::open (const KUrl &url, bool newDocSameNameIfNotExist)
 {
-    QSize docSize = defaultDocSize ();
+#if DEBUG_KP_MAIN_WINDOW
+    kDebug () << "kpMainWindow::open(" << url
+              << ",newDocSameNameIfNotExist=" << newDocSameNameIfNotExist
+              << ")" << endl;
+#endif
 
-    // create doc
+    if (d->configOpenImagesInSameWindow)
+    {
+    #if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\topenImagesInSameWindow" << endl;
+    #endif
+        // (this brings up a dialog and might save the current doc)
+        if (!queryClose ())
+        {
+        #if DEBUG_KP_MAIN_WINDOW
+            kDebug () << "\t\tqueryClose() aborts open" << endl;
+        #endif
+            return false;
+        }
+    }
+
+    // Create/open doc.
+    const QSize docSize = defaultDocSize ();
     kpDocument *newDoc = new kpDocument (docSize.width (), docSize.height (), this);
     if (newDoc->open (url, newDocSameNameIfNotExist))
     {
+    #if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\topen OK" << endl;
+    #endif
         if (newDoc->isFromURL (false/*don't bother checking exists*/))
             addRecentURL (url);
     }
     else
     {
+    #if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\topen failed" << endl;
+    #endif
         delete newDoc;
         return false;
     }
 
-    // need new window?
-    if (shouldOpenInNewWindow ())
+    // Want new window?
+    if (m_document && !m_document->isEmpty () &&
+        !d->configOpenImagesInSameWindow)
     {
-        // send doc to new window
+    #if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\topen in new window" << endl;
+    #endif
+        // Send doc to new window.
         kpMainWindow *win = new kpMainWindow (newDoc);
         win->show ();
     }
     else
     {
-        // set up views, doc signals
+    #if DEBUG_KP_MAIN_WINDOW
+        kDebug () << "\topen in same window" << endl;
+    #endif
+        // (sets up views, doc signals)
         setDocument (newDoc);
     }
 
--- trunk/KDE/kdegraphics/kolourpaint/mainwindow/kpmainwindow_p.h #613780:613781
@@ -51,6 +51,8 @@
     int m_moreEffectsDialogLastEffect;
     bool m_resizeScaleDialogLastKeepAspect;
 
+    bool configOpenImagesInSameWindow;
+
     QActionGroup *toolsActionGroup;
 };
 
Comment 9 Clarence Dang 2006-12-15 08:10:39 UTC
Thurston, please add a section on "Hidden Configuration Options" to the manual.
Comment 10 Technologov 2006-12-15 09:54:17 UTC
Since this is intended to (ex-)Windows user, Please make it user configurable in the menus.
Comment 11 Technologov 2006-12-15 09:56:14 UTC
..And thank you very much for implement it.

If I understood you correctly, the version with such a feature will only be available for KDE 4 ?
Comment 12 Clarence Dang 2006-12-16 01:44:55 UTC
Yes, it's only for KDE 4 as KDE 3.x is permanently feature frozen.
Comment 13 Clarence Dang 2006-12-17 04:26:16 UTC
Reassigning bugs to KolourPaint support email address. 
Comment 14 Clarence Dang 2007-05-13 06:59:00 UTC
> Since this is intended to (ex-)Windows user, Please make it user configurable
> in the menus.

Can we simply document this in the manual under "Hidden Configuration Options"?

I'd prefer to not to make it configurable via the GUI because:

1. The feature violates the KDE UI standards :)

2. It's too obscure and most people will live without it.

3. We don't have a config dialog and don't want to add one just for this feature :)  In any case, I want to minimize user-visible config options / GUI clutter by using sane defaults.