[calligra] libs/main: Show the current working directory by default when starting without args

Marijn Kruisselbrink mkruisselbrink at kde.org
Mon Jul 4 11:57:22 BST 2011


Why would you want the "current" working directory to be shown when you start 
an app from the kde menu and/or krunner or any of many other places where you 
invoke the application without having a clear concept of working directory? 
This might be a nice feature for people that start stuff from the command line 
often, but it seems like it would break for the much more common use-case of 
end-users starting apps from user interfaces...

Marijn

On Monday, July 04, 2011 03:17:44 am Boudewijn Rempt wrote:
> Git commit e3b34f96f68b3ed752b8069b9d423583a69b88ef by Boudewijn Rempt.
> Committed on 04/07/2011 at 12:16.
> Pushed by rempt into branch 'master'.
> 
> Show the current working directory by default when starting without args
> 
> Instead of showing the directory from which we last loaded a file when
> we start an app without any arguments, show the directory from which
> the app was started.
> 
> BUG:260477
> 
> M  +8    -0    libs/main/KoApplication.cpp
> 
> http://commits.kde.org/calligra/e3b34f96f68b3ed752b8069b9d423583a69b88ef
> 
> diff --git a/libs/main/KoApplication.cpp b/libs/main/KoApplication.cpp
> index 8c1d148..af80653 100644
> --- a/libs/main/KoApplication.cpp
> +++ b/libs/main/KoApplication.cpp
> @@ -34,6 +34,7 @@
>  #include <kdesktopfile.h>
>  #include <kmessagebox.h>
>  #include <kstandarddirs.h>
> +#include <krecentdirs.h>
>  #include <kiconloader.h>
>  #include <kdebug.h>
>  #include <QtDBus/QtDBus>
> @@ -136,6 +137,13 @@ bool KoApplication::start()
> 
>      // No argument -> create an empty document
>      if (!argsCount) {
> +
> +        // if there's no document, add the current working directory
> +        // to the recent dirs so the open dialog and open pane show
> +        // the directory from where the app was started, instead of
> +        // the last directory from where we opened a file
> +        KRecentDirs::add(":OpenDialog", QDir::currentPath());
> +
>          QString errorMsg;
>          KoDocument* doc = entry.createDoc(&errorMsg);
>          if (!doc) {




More information about the calligra-devel mailing list