remember maximized/minimized

Frank Osterfeld <[email protected]> Fri, 12 Mar 2004 12:03:07 +0100
Newsgroups gmane.comp.kde.devel.knowit
Message-ID <[email protected]>
--Boundary-00=_rjZUASNNREtEAu4
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I have a problem with knowit when running KDE (3.2.1): When you quit knowit 
while maximized, it isn't maximized after restart. For me that's annoying, I 
had a look at other KDE apps how they save the window state. All apps I tried 
which save the window geometry (e.g. konsole, kopete, konqueror do not) start 
maximized if quit maximized. 

On the other hand, the knowit feature "start minimized if quit 
minimized" seems to be quite unique. If you restore a session, the minimized 
state is restored, but not if you quit it regularly. 
Is there a special reason for restoring the minimized mode? If not, maybe 
knowit should adhere to the "standard"?

Attached a patch which alters the behaviour (I had a look at umbrello source 
code how they did it):

-  "maximized mode" is remembered (by saving geometry())
-  minimized is not saved anymore (saving isMinimized and runMinimized stuff 
removed)

Regards,

Frank








--Boundary-00=_rjZUASNNREtEAu4
Content-Type: text/x-diff;
  charset="us-ascii";
  name="save-geometry.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="save-geometry.diff"

Gemeinsame Unterverzeichnisse: knowit-0.10beta3-original/knowit/.deps und knowit-0.10beta3-modified/knowit/.deps.
diff -u knowit-0.10beta3-original/knowit/knowit.cpp knowit-0.10beta3-modified/knowit/knowit.cpp
--- knowit-0.10beta3-original/knowit/knowit.cpp	2003-12-21 16:43:56.000000000 +0100
+++ knowit-0.10beta3-modified/knowit/knowit.cpp	2004-03-12 11:10:39.000000000 +0100
@@ -251,11 +251,8 @@
    /* Configuration */
    config = kapp->config();
    readOptions();
-
-   if (runMinimized)
-      showMinimized();
-   else 
-       show();
+   // removed runMinimized
+   show();
 
    bool opened = false;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
@@ -459,7 +456,9 @@
   config->writeEntry("Widgets", Layout->sizes());
   Options.save(config);
   config->setGroup("General");
-  config->writeEntry("Minimized", isMinimized() || !isVisible());
+  // write geometry - maximized windows stay maximized after restart,
+  // minimized state is not saved (important? No KDE app I tested saves this)
+  config->writeEntry("Geometry", size());
   config->writeEntry("LastFile", filename.path());
   actionCollection()->writeShortcutSettings("Keys", config);
   config->deleteGroup("Recent Files");
@@ -475,7 +474,8 @@
       Layout->setSizes(sizes);
    Options.read(config);
    config->setGroup("General");
-   runMinimized = config->readBoolEntry("Minimized", false);
+   // read geometry from file and resize widget, maybe another default?
+   resize( config->readSizeEntry("Geometry", new QSize(320,240)) );
    actionCollection()->readShortcutSettings("Keys", config);
    actionRecent->loadEntries(config,"Recent Files");
    QString oldfile = config->readEntry("LastFile");
Nur in knowit-0.10beta3-modified/knowit: knowit.cpp~.
diff -u knowit-0.10beta3-original/knowit/knowit.h knowit-0.10beta3-modified/knowit/knowit.h
--- knowit-0.10beta3-original/knowit/knowit.h	2003-12-21 16:45:49.000000000 +0100
+++ knowit-0.10beta3-modified/knowit/knowit.h	2004-03-12 10:32:19.000000000 +0100
@@ -64,7 +64,6 @@
     KnowitTray* systray;
     /* data items */
     TNotesCollection Notes;
-    bool runMinimized;
     QListViewItem* lastSought;
     QString soughtText;
     QTimer* AutosaveTimer;
Gemeinsame Unterverzeichnisse: knowit-0.10beta3-original/knowit/templates und knowit-0.10beta3-modified/knowit/templates.

--Boundary-00=_rjZUASNNREtEAu4--





-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click