Summary: | When starting the first time, the main window is very small | ||
---|---|---|---|
Product: | [Unmaintained] kpdf | Reporter: | Joonas Koivunen <joonas.koivunen> |
Component: | general | Assignee: | Albert Astals Cid <aacid> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | arne.schmitz, ibc, jens-bugs.kde.org, mefoster |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Joonas Koivunen
2004-12-10 21:47:37 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(); + } } 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. 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. 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. 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 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. exact same here. i'm voting for this! (even though after opening some 100 pdfs in the last days i hardly notice anymore...) :) Yup, having the same problems with KDE 3.4.0. It does not happen always, but very often, and it is very annoying indeed. 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? 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. *** Bug 102939 has been marked as a duplicate of this bug. *** 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; }; 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. 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. 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. |