Bug 117900

Summary: JJ: KJobViever doesn´t remember window position
Product: [Plasma] printer-applet Reporter: Michael Stather <kontakt>
Component: generalAssignee: KDEPrint Devel Mailinglist <kde-print-devel>
Status: CLOSED UNMAINTAINED    
Severity: minor CC: bluedzins, jlayt
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michael Stather 2005-12-07 22:52:11 UTC
Version:           0.1 (using KDE 3.5.0 Level "a" , SUSE 10.0 UNSUPPORTED)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.13-15-default

KJobviewer doesn´t remember the window position between calls. It does remember the window size, though, so it is IMHO a bug.
Comment 1 Michael Goffioul 2005-12-08 09:23:31 UTC
I wouldn't call it a but. I think that most applications don't remember their window position. Indeed, the initial window position is managed by the window manager, not by the application. I would turn this into a wish item, but I event don't know if this something to implement.
Comment 2 Philip Rodrigues 2005-12-08 14:26:34 UTC
You can force the window position with the "Special window settings", so there is no reason to implement this (it would, as you say, break the window manager's positioning algorithm).
Comment 3 Cristian Tibirna 2005-12-08 18:28:15 UTC
The principles of window management technology in X (defined by ICCCM document) give to the window manager the final say on the position at which a window is placed upon creation. KJobViewer can't force the window manager to give it a specified position. It can request it, yes, but the window manager can deny the request.

If you want that a particular window be given preferential position upon creation, use the "Window specific properties" (from KControl or from any window title's contextual menu (see "Configure Window Behavior").
Comment 4 Michael Stather 2005-12-08 18:41:44 UTC
I think there is a misunderstanding here.
Almost all(!) KDE apps remember both their window size and position. This is what is called "session management" which is supported by the KDE API.
With "almost" I mean about five apps installed with my KDE 3.4.2 system don´t remember their window size.
Comment 5 Michael Stather 2006-01-13 18:02:22 UTC
Any news here (regarding my comment above).
Comment 6 Philip Rodrigues 2006-01-15 18:45:43 UTC
Oh, so you mean the position isn't saved between KDE sessions? I'll see if I can confirm this (in which case I guess it would be a bug in the session manager, not kjobviewer).
Comment 7 Michael Stather 2006-01-15 19:57:36 UTC
That´s exactly what I mean :)
I experience this too with some other apps like kaffeine.
Comment 8 Michael Stather 2006-01-26 02:19:31 UTC
Any news? Is there anything special about the way session management is implemented in KJobViewer? I see this problem with KJobViewer and Kaffeine, and with no other apps. I also think this is a bug in the session manager, but I need this info before I can submit a bug report about that.
Comment 9 Kurt Pfeifle 2007-01-11 13:34:21 UTC
I don't think KJobViewer has implemented *anything* special in regard to session management.
Comment 10 Konstantin 2007-09-04 13:17:53 UTC
Hello,

it shouldn't be hard to implement this feature. Just add the functions to the MainWindow, if there aren't allready some.
void writeSettings()
{
  QSettings settings("Organization", "application");
  settings.setValue("geometry", geometry());
}
void readSettings()
{
  QSettings settings("Organization", "application");
  QRect rect = settings.value("geometry").toRect();
  setGeometry(rect);
}

and call readSettings in the constructor of the MainWindow after setupUi
and writeSettings in the closeEvent(QCloseEvent *event) before accepting the event.

Kind Regards
Comment 11 Cristian Tibirna 2007-09-09 03:57:32 UTC
Yes indeed Konstantin

This is why this was marked as JJ. How would you feel about taking this on you? You seem to be quite close to just coding it, testing it and sending patches ofr committing (if you have an account). KDE users would be very grateful to you.
Comment 12 Konstantin 2007-09-12 10:58:28 UTC
Okay, I will try, but I don't know any coding standards for KDE.
So I'm going to post a patch on success here for discussion.

Greetings
Konstantin
Comment 13 Konstantin 2007-09-12 16:59:33 UTC
Hah! The solution was easier than I thought,
the applications stores and restores allready it's size. So all I had to do was to replace the storing of its size through its geometry. The source compiles successfully, but I don't know how to set up a testing enviornment, so maybe somebody else could test it.

Here is a diff file for kdeprint/management/kmjobviewer.cpp from kdelibs-3.5.7
diff old_kmjobviewer.cpp kmjobviewer.cpp
105c105,109
< 		resize( conf->readSizeEntry( "Size", &defSize ) );
---
> //     resize( conf->readSizeEntry( "Size", &defSize ) );
> 		QRect rect;
> 		rect.setSize(defSize);
> 		conf->readRectEntry( "Geometry", &rect );
> 		setGeometry(rect);
116c120,121
< 		conf->writeEntry( "Size", size() );
---
> //     conf->writeEntry( "Size", size() );
> 		conf->writeEntry( "Geometry", geometry() );
658c663
< 	if (m_standalone)
---
> if (m_standalone)

Kind regards
Konstantin
Comment 14 Konstantin 2007-09-12 23:58:49 UTC
Have build and tested it.
Seems to work fine.

I don't know, when the KMJobViewer is a stand alone application, and whether the user want to save the window geometry, if it isn't one.

Good night
Konstantin
Comment 15 John Layt 2009-01-02 11:10:33 UTC
KDEPrint in KDE3 is unmaintained and will have no more new features
implemented.  This request will never be implemented in KDEPrint as a result.  

In KDE4 kjobviewer has been replaced by printer-applet which uses
system-config-printer as a backend.  

It appears that printer-applet also doesn't remember its last position between runs or when closed and restored from the system tray (in openSUSE 11.1 KDE4.1.3), unlike say Kopete which does.  This is still a valid request.
Comment 16 John Layt 2009-01-02 11:10:33 UTC
*** This bug has been confirmed by popular vote. ***
Comment 17 John Layt 2009-01-02 19:05:20 UTC
On second thoughts, it's invalid to re-use this bug for printer-applet, closing and include with other feature request for persistence of all settings.