Bug 94851 - When starting the first time, the main window is very small
Summary: When starting the first time, the main window is very small
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
: 102939 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-10 21:47 UTC by Joonas Koivunen
Modified: 2005-11-05 15:40 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Koivunen 2004-12-10 21:47:37 UTC
Version:            (using KDE KDE 3.3.90)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.3.4 Slackware 10
OS:                Linux

Topic explains it all, when there's no ~/.kde/share/config/kpdfrc, window size will be 264x150 in size (@ 1280x1024 resolution).

One can argue whether this is a bug or not, I think it is because when a first time linux/kde user tries out all the programs in his/hers new great looking system, starting kpdf (with that nice icon now and all), _it looks very unprofessional_ that the program (which is usually used in almost fullscreen) starts in some lone corner of display. So small that you might not even notice it.
Comment 1 Albert Astals Cid 2004-12-10 23:17:54 UTC
CVS commit by aacid: 

Show the window maximized when the user opens the program for the very first time
BUG: 94851 


  M +6 -0      kpdf_shell.cpp   1.40


--- kdegraphics/kpdf/kpdf/kpdf_shell.cpp  #1.39:1.40
@@ -39,4 +39,5 @@
 #include <kparts/componentfactory.h>
 #include <kio/netaccess.h>
+#include <kmainwindowiface.h> 
 
 #include <qcursor.h>
@@ -86,4 +87,9 @@ Shell::Shell()
 
   readSettings();
+  if (!KGlobal::config()->hasGroup("MainWindow"))
+  {
+    KMainWindowInterface kmwi(this);
+    kmwi.maximize();
+  }
 }
 


Comment 2 Joonas Koivunen 2004-12-11 12:38:40 UTC
Quite frankly I disagree with it getting maximized, how about the way for example konqueror starts, not maximed nor as small as possible.

I can't find it from the kdebase/konqueror sources, as I don't know what other ways there are to do it besides from using KMainWindowInterface class.
Comment 3 Albert Astals Cid 2004-12-11 12:50:28 UTC
Obviously not a bug, changing to wishlist.

The potential usability problem caused by showing it in a too small windows is fixed by showing it maximized. If you want to provide a better way do not hesitate to show me the code.
Comment 4 Iñaki Baz Castillo 2005-03-25 10:18:09 UTC
If I maximize any KDE application and close it, the next time I open it the window is maximized. But in KPDF it doesn't occur, it always start with a very small window size.
I'm not speaking about the first time I opened KPDF, I'm speaking about all the times I open KPDF.
Comment 5 Albert Astals Cid 2005-03-25 13:40:08 UTC
KDE 3.4.x or HEAD? I can reproduce it in HEAD (introduced it with the save zoom feature i think) but KDE 3.4.x always respect the last size before closing
Comment 6 Iñaki Baz Castillo 2005-03-28 16:21:21 UTC
I use KPDF 0.4 in KDE 3.4.0.
If I open an empty KPDF, it starts in full screen mode (because the last time I closed KPDF I left the screen maximized).
But if I open a file in Konqueror with KPDF, it always appears in a small window. I can maximize it and close, but when I open the same file again it appears in a small window again, so it doesn't respect the last size.
Comment 7 Markus Waibel 2005-04-12 00:20:16 UTC
exact same here. i'm voting for this! (even though after opening some 100 pdfs in the last days i hardly notice anymore...) :)
Comment 8 Arne Schmitz 2005-04-14 15:45:59 UTC
Yup, having the same problems with KDE 3.4.0. It does not happen always, but very often, and it is very annoying indeed.
Comment 9 Markus Waibel 2005-04-19 15:39:57 UTC
I just erased my .kde (after backup) - solved a lot of trouble I was having with KDE 3.4, including this bug! Maybe some permission issues? 
Comment 10 Iñaki Baz Castillo 2005-04-19 16:27:03 UTC
Humm, something extrange, I have erased my .kde/share/config/kpdfrc but nothing has changed. Anyway I have seen some things:

- If I open Kpdf directly (without double click in some pdf file), Kpdf appears in the last state that if was open (maximized, with a exactly size, etc). No problems in this way.

- If I open Konqueror and open a pdf file with Kpdf there maybe a problem:

a) I open the file and maximize it, and the close. When I open again Kpdf, it appears in very small window. Problem.

b) I open the file and set a big size for the Kpdf window, but NOT MAXIMIZED. Then I close Kpdf and when opening again a pdf file Kpdf stars with the same size (not maximized, but the same size that when I closed the last time). No problem here.
Comment 11 Albert Astals Cid 2005-05-01 23:47:10 UTC
*** Bug 102939 has been marked as a duplicate of this bug. ***
Comment 12 Albert Astals Cid 2005-05-01 23:49:24 UTC
CVS commit by aacid: 

Try to make size saving work, can you guys check (need to update to cvs version or apply this patch to 3.4 branch) and tell me if it works for you too?
CCBUGS: 94851


  M +1 -2      main.cpp   1.4
  M +21 -3     shell.cpp   1.6
  M +11 -3     shell.h   1.4


--- kdegraphics/kpdf/shell/main.cpp  #1.3:1.4
@@ -70,7 +70,6 @@ int main(int argc, char** argv)
             for (int i = 0; i < args->count(); ++i)
             {
-                KPDF::Shell* widget = new KPDF::Shell;
+                KPDF::Shell* widget = new KPDF::Shell(args->url(i));
                 widget->show();
-                widget->openURL(args->url(i));
             }
         }

--- kdegraphics/kpdf/shell/shell.cpp  #1.5:1.6
@@ -20,4 +20,5 @@
 // qt/kde includes
 #include <qcursor.h>
+#include <qtimer.h>
 #include <kaction.h>
 #include <kapplication.h>
@@ -43,4 +44,15 @@ Shell::Shell()
   : KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true)
 {
+  init();
+}
+
+Shell::Shell(const KURL &url)
+{
+  m_openUrl = url;
+  init();
+}
+
+void Shell::init()
+{
   // set the shell's ui resource file
   setXMLFile("shell.rc");
@@ -84,4 +96,12 @@ Shell::Shell()
     kmwi.maximize();
   }
+  setAutoSaveSettings();
+  
+  if (m_openUrl.isValid()) QTimer::singleShot(0, this, SLOT(delayedOpen()));
+}
+
+void Shell::delayedOpen()
+{
+   openURL(m_openUrl);
 }
 
@@ -141,5 +161,4 @@ void Shell::readSettings()
 void Shell::writeSettings()
 {
-    saveMainWindowSettings(KGlobal::config(), "MainWindow");
     m_recent->saveEntries( KGlobal::config() );
     KGlobal::config()->setDesktopGroup();
@@ -201,5 +220,4 @@ Shell::fileOpen()
 Shell::optionsConfigureToolbars()
 {
-  saveMainWindowSettings(KGlobal::config(), "MainWindow");
   KEditToolbar dlg(factory());
   connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(applyNewToolbarConfig()));

--- kdegraphics/kpdf/shell/shell.h  #1.3:1.4
@@ -45,4 +45,9 @@ namespace KPDF
 
     /**
+     * Open an url
+     */
+    Shell(const KURL &url);
+
+    /**
      * Default Destructor
      */
@@ -76,6 +81,6 @@ namespace KPDF
     void slotShowMenubar();
 
-  public slots:
       void openURL( const KURL & url );
+    void delayedOpen();
 
   signals:
@@ -83,7 +88,9 @@ namespace KPDF
       void saveDocumentRestoreInfo(KConfig* config);
 
+     
   private:
     void setupAccel();
     void setupActions();
+    void init();
 
   private:
@@ -95,4 +102,5 @@ namespace KPDF
       KToggleAction* m_showToolBarAction;
       bool m_menuBarWasShown, m_toolBarWasShown;
+      KURL m_openUrl;
   };
 
Comment 13 Marius 2005-06-04 09:51:19 UTC
I use kde3.4.1 it looks like half solved, because if I open window from konqueror and close it with button X in the window titlebar every thing is ok. But if I close with file->Quit, the problem is still there.

Every thing is ok if window is not maximized, it remembers the size and does not matter how I close it.
Comment 14 Albert Astals Cid 2005-06-21 22:03:52 UTC
OK, i've commited a bug that should go to KDE 3.4.2 that should completely fix this, please if in KDE 3.4.2 you still see the problem reopen this bug.
Comment 15 Mary Ellen Foster 2005-11-05 15:40:33 UTC
I'm seeing similar bugs with KPDF in 3.5 beta2 when it autostarts from a session: maximised windows come back with strange sizes when they're restored from a KDE session.

I just did an experiment. With my resolution and panel size, a maximised window is 1280x978. I opened four KPDF windows, resized them variously, logged out, and then logged back in. Here's how the windows came back:

- Un-maximised window (910x817) -- same dimensions on login
- Vertically maximised (1086x978) -- restored as 1086x250
- Horizontally maximised (1280x745) -- same dimensions
- Fully maximised (1280x978) -- restored as 336x250

Note that all of the windows came back on virtual desktop 1, even though I'd put them on four different desktops. That's probably a separate bug, and possibly not in KPDF.