Bug 60645 - toolbars, removing the player buttons
Summary: toolbars, removing the player buttons
Status: RESOLVED FIXED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-02 19:31 UTC by trpn
Modified: 2003-07-26 06:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
qmainwindow-restore-dockwindows.patch (1.43 KB, text/x-diff)
2003-07-25 03:22 UTC, Scott Wheeler
Details
qmainwindow-restore-dockwindows-2.patch (1.24 KB, text/x-diff)
2003-07-25 16:27 UTC, Scott Wheeler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description trpn 2003-07-02 19:31:16 UTC
Version:           1.1 (using KDE KDE 3.1.2)
Installed from:    Mandrake RPMs
OS:          Linux

When clicking on the toolbars to move them it is possible to move the player buttons (stop,play, etc..) as a floating toolbar (meaning its not attached to the rest of the player, playlist, etc). Leaving the toolbar as a "floating" bar and  clicking on the juk system tray will hide everything, however the player button toolbar will not return when juk is again maximised. There also isn't a configure toolbar option when right clicking on another tooolbar to get it back.
Comment 1 Scott Wheeler 2003-07-04 01:12:50 UTC
Hmm, thought I responded to this earlier.  Guess I forgot to click "submit".  This is a 
little better in CVS since there's an option to "show toolbars", but I have noticed this 
before.  I presume it's a library bug -- I'll check into it soon. 
Comment 2 Scott Wheeler 2003-07-25 03:22:59 UTC
Subject: restore dockwindows

Currently QMainWindow::hide() takes care to hide top-level dock widgets when 
the main window is hidden, but doesn't restore these when the widget is shown 
again.

===
	QObjectList *list = queryList( "QDockWindow" );
	QObjectListIt it( *list );
	while ( it.current() ) {
	    QDockWindow *dw = (QDockWindow*)it.current();
	    ++it;
	    if ( dw->isTopLevel() && dw->isVisible() )
		dw->hide();
	}
	delete list;
===

This comes in to play notably when docking things in the system tray and 
restoring them from there.  There's an example here:

http://bugs.kde.org/show_bug.cgi?id=60645

I simply pasted the above code in QMainWindow::show() and reversed the logic 
to produce the attached patch (which fixes the mentioned bug).

Cheers,

-Scott



Created an attachment (id=2059)
qmainwindow-restore-dockwindows.patch
Comment 3 qt-bugs 2003-07-25 14:13:45 UTC
Subject: Re: [Issue N27475] restore dockwindows

On Friday, 25. Jul 2003 03:22 Scott Wheeler wrote:
> Currently QMainWindow::hide() takes care to hide top-level dock
> widgets when the main window is hidden, but doesn't restore these when
> the widget is shown again.
>
> ===
> 	QObjectList *list = queryList( "QDockWindow" );
> 	QObjectListIt it( *list );
> 	while ( it.current() ) {
> 	    QDockWindow *dw = (QDockWindow*)it.current();
> 	    ++it;
> 	    if ( dw->isTopLevel() && dw->isVisible() )
> 		dw->hide();
> 	}
> 	delete list;
> ===
>
> This comes in to play notably when docking things in the system tray
> and restoring them from there. There's an example here:
>
> http://bugs.kde.org/show_bug.cgi?id=60645
>
> I simply pasted the above code in QMainWindow::show() and reversed the
> logic to produce the attached patch (which fixes the mentioned bug).
>
> Cheers,
>
> -Scott

Hi Scott,

this would break creating applications with initially hidden dockwindows
that the user has to show explicitly. I guess QMainWindow::hide()
should reset the ForceHide widget state for the dock windows; I'll
check this for a future version of Qt. For 3.2 I cannot introduce such
a change I'm afraid.

Regards,
Volker

--
Volker Hilsheimer, Support Manager
Trolltech AS, Waldemar Thranes gate 98, NO-0175 Oslo, Norway

Comment 4 Scott Wheeler 2003-07-25 16:27:05 UTC
Subject: Re: [Issue N27475] restore dockwindows

Quoting qt-bugs@trolltech.com: 
 
> this would break creating applications with initially hidden dockwindows 
> that the user has to show explicitly. I guess QMainWindow::hide() 
> should reset the ForceHide widget state for the dock windows; I'll 
> check this for a future version of Qt. For 3.2 I cannot introduce such 
> a change I'm afraid. 
 
Hmm, ok.  I normally avoid (non-toolbar) dock windows like the plague, so I 
guess I hadn't run into that one.  ;-) 
 
Ok, here's one that saves a list of the things actually hidden by the call to 
QMainWindow::hide() and restores those on the next call to QMainWindow::show
(). 
 
How's this one look? 
 
-Scott 

Created an attachment (id=2067)
qmainwindow-restore-dockwindows-2.patch
Comment 5 qt-bugs 2003-07-25 18:31:46 UTC
Subject: Re: [Issue N27475] restore dockwindows

On Friday, 25. Jul 2003 16:26 Scott Wheeler wrote:
> Quoting qt-bugs@trolltech.com:
>
> > this would break creating applications with initially hidden
> > dockwindows
> > that the user has to show explicitly. I guess QMainWindow::hide()
> > should reset the ForceHide widget state for the dock windows; I'll
> > check this for a future version of Qt. For 3.2 I cannot introduce
> > such
> > a change I'm afraid.
>
> Hmm, ok. I normally avoid (non-toolbar) dock windows like the plague,
> so I guess I hadn't run into that one. ;-)
>
> Ok, here's one that saves a list of the things actually hidden by the
> call to QMainWindow::hide() and restores those on the next call to
> QMainWindow::show ().
>
> How's this one look?
>
> -Scott

Hi Scott,

it does look better indeed, but I'm afraid the change is still not
critical enough for the 3.2 release. I'll keep it in mind for main
though!

Regards,
Volker

--
Volker Hilsheimer, Support Manager
Trolltech AS, Waldemar Thranes gate 98, NO-0175 Oslo, Norway

Comment 6 Scott Wheeler 2003-07-26 05:27:52 UTC
Subject: Re: [Issue N27475] restore dockwindows

On Friday 25 July 2003 18:31, qt-bugs@trolltech.com wrote:

> Hi Scott,
> 
> it does look better indeed, but I'm afraid the change is still not
> critical enough for the 3.2 release. I'll keep it in mind for main
> though!

In a quick survey in KDE CVS this affects at least KAlarm, JuK, KGPG, KGet and 
Kopete -- some of which don't have a "show toolbars" option in the menus to 
force the toolbar to come back.  i.e. in those cases, the only option to get 
the toolbar back involves editing the configuration file.

I'll probably hack around this in KMainWindow this weekend (basically 
reimplementing QApplication::[hide/show]() with the patched version 
suggested), but I still don't like doing so.  ;-)

-Scott

Comment 7 Scott Wheeler 2003-07-26 06:17:00 UTC
Subject: kdelibs/kdeui

CVS commit by wheeler: 

TT says that they won't fix this one before 3.3, so I'm (sadly) doing the
fix here.  The affects at least 5 apps in CVS.

Right now if a MainWindow is hidden that has floating toolbars those are
hidden, but aren't restored when it is shown.  In some apps this requires
editing the config file to get the toolbar back.

See the mentioned bug for the qt-bugs mails.  Also did some s/TRUE/true/
s/FALSE/false/ while I was in there.

CCMAIL:60645-done@bugs.kde.org


  M +41 -10    kmainwindow.cpp   1.116
  M +13 -1     kmainwindow.h   1.86


--- kdelibs/kdeui/kmainwindow.cpp  #1.115:1.116
@@ -68,4 +68,5 @@ public:
     KToggleAction *showStatusBarAction;
     QRect defaultWindowSize;
+    QPtrList<QDockWindow> hiddenDockWindows;
 };
 
@@ -103,5 +104,5 @@ public:
         config->setGroup(QString::fromLatin1("Number"));
         config->writeEntry(QString::fromLatin1("NumberOfWindows"), n );
-        return TRUE;
+        return true;
     }
 
@@ -154,5 +155,5 @@ public:
 
         // the user wants it, the user gets it
-        return TRUE;
+        return true;
     }
 };
@@ -174,5 +175,5 @@ KMainWindow::KMainWindow( int cflags, QW
 void KMainWindow::initKMainWindow(const char *name, int cflags)
 {
-    setDockMenuEnabled( FALSE );
+    setDockMenuEnabled( false );
     mHelpMenu = 0;
     kapp->setTopWidget( this );
@@ -340,8 +341,8 @@ bool KMainWindow::canBeRestored( int num
 {
     if ( !kapp->isRestored() )
-        return FALSE;
+        return false;
     KConfig *config = kapp->sessionConfig();
     if ( !config )
-        return FALSE;
+        return false;
     config->setGroup( QString::fromLatin1("Number") );
     int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 );
@@ -366,15 +367,45 @@ const QString KMainWindow::classNameOfTo
 }
 
+void KMainWindow::show()
+{
+    QMainWindow::show();
+
+    for ( QPtrListIterator<QDockWindow> it( d->hiddenDockWindows ); it.current(); ++it )
+        it.current()->show();
+
+    d->hiddenDockWindows.clear();
+}
+
+void KMainWindow::hide()
+{
+    if ( isVisible() ) {
+
+        d->hiddenDockWindows.clear();
+
+        QObjectList *list = queryList( "QDockWindow" );
+        for( QObjectListIt it( *list ); it.current(); ++it ) {
+            QDockWindow *dw = (QDockWindow*)it.current();
+            if ( dw->isTopLevel() && dw->isVisible() ) {
+                d->hiddenDockWindows.append( dw );
+                dw->hide();
+            }
+        }
+        delete list;
+    }
+
+    QWidget::hide();
+}
+
 bool KMainWindow::restore( int number, bool show )
 {
     if ( !canBeRestored( number ) )
-        return FALSE;
+        return false;
     KConfig *config = kapp->sessionConfig();
     if ( readPropertiesInternal( config, number ) ){
         if ( show )
             KMainWindow::show();
-        return FALSE;
+        return false;
     }
-    return FALSE;
+    return false;
 }
 
@@ -557,10 +588,10 @@ void KMainWindow::closeEvent ( QCloseEve
 bool KMainWindow::queryExit()
 {
-    return TRUE;
+    return true;
 }
 
 bool KMainWindow::queryClose()
 {
-    return TRUE;
+    return true;
 }
 

--- kdelibs/kdeui/kmainwindow.h  #1.85:1.86
@@ -284,4 +284,16 @@ public:
 
     /**
+     * Reimplementation of QMainWindow::show()
+     */
+    // KDE4 remove this method if this has been fixed in Qt
+    virtual void show();
+
+    /**
+     * Reimplementation of QMainWindow::hide()
+     */
+    // KDE4 remove this method if this has been fixed in Qt
+    virtual void hide();
+
+    /**
      * Restore the session specified by @p number.
      *


Comment 8 qt-bugs 2003-07-28 13:10:11 UTC
Subject: Re: [Issue N27475] restore dockwindows

On Saturday, 26. Jul 2003 05:27 Scott Wheeler wrote:
> On Friday 25 July 2003 18:31, qt-bugs@trolltech.com wrote:
>
> > Hi Scott,
> >
> > it does look better indeed, but I'm afraid the change is still not
> > critical enough for the 3.2 release. I'll keep it in mind for main
> > though!
>
> In a quick survey in KDE CVS this affects at least KAlarm, JuK, KGPG,
> KGet and Kopete -- some of which don't have a "show toolbars" option
> in the menus to force the toolbar to come back. i.e. in those cases,
> the only option to get the toolbar back involves editing the
> configuration file.

I'm not sure how this related though - the configuration file they write
themselves.

> I'll probably hack around this in KMainWindow this weekend (basically
> reimplementing QApplication::[hide/show]() with the patched version
> suggested), but I still don't like doing so.  ;-)

We'll address the issue here in our main branch - this has been like
this for a while now, and I cannot justify such a change in a frozen
release.

Regards,
Volker

--
Volker Hilsheimer, Support Manager
Trolltech AS, Waldemar Thranes gate 98, NO-0175 Oslo, Norway

Comment 9 Scott Wheeler 2003-07-28 20:36:26 UTC
Subject: Re: [Issue N27475] restore dockwindows

On Monday 28 July 2003 13:09, qt-bugs@trolltech.com wrote:

> > In a quick survey in KDE CVS this affects at least KAlarm, JuK, KGPG,
> > KGet and Kopete -- some of which don't have a "show toolbars" option
> > in the menus to force the toolbar to come back. i.e. in those cases,
> > the only option to get the toolbar back involves editing the
> > configuration file.
> 
> I'm not sure how this related though - the configuration file they write
> themselves.

*) Start an app that can be docked in the system tray
*) Make the toolbar "float" by dragging it away from the border of the Window
*) Dock the application in the system tray (hides the main window and toolbar)
*) Undock (shows just the main window, but the toolbar is gone)

The toolbar is gone.  If there's no menu option to turn the toolbars on and 
off -- i.e. it normally isn't possible to hide the toolbar during normal 
operation -- then it's impossible to get the toolbar back.  KDE then 
automatically saves the toolbar positions for the next time you run the 
application; in this case saving its hidden status even though it shouldn't 
be possible for the user to hide the toolbar.

As such the toolbar won't be shown when the user restarts the application or 
in fact ever again until the configuration file is changed.

Anyway -- I've hacked around this in kdelibs for now (reimplementing 
QMainWindow::show() and QMainWindow::hide()) as it'll probably be another 
couple of years before a KDE release based on Qt's main tree comes around.

-Scott