[Konsole-devel] [Bug 94864] workdir option sets starting directory only for the very first session in konsole

Kurt V.Hindenburg kurt.hindenburg at kdemail.net
Fri Dec 31 00:08:52 UTC 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=94864        
kurt.hindenburg kdemail net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From kurt.hindenburg kdemail net  2004-12-31 01:08 -------
CVS commit by hindenburg: 

Allow --workdir to set the directory in new sessions.
Thanks to Rudo Thomas for the patch, which had to be altered slightly.

FEATURE: 94864


  M +10 -1     konsole.cpp   1.495
  M +3 -1      konsole.h   1.193
  M +3 -2      main.cpp   1.276


--- kdebase/konsole/konsole/konsole.cpp  #1.494:1.495
 @ -188,5 +188,5  @ static const char * const fonts[] = {
 
 Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bool frameon, bool scrollbaron,
-                 QCString type, bool b_inRestore, const int wanted_tabbar )
+                 QCString type, bool b_inRestore, const int wanted_tabbar, const QString &workdir )
 :DCOPObject( "konsole" )
 ,KMainWindow(0, name)
 @ -265,4 +265,5  @ Konsole::Konsole(const char* name, int h
 ,sessionNumberMapper(0)
 ,sl_sessionShortCuts(0)
+,s_workDir(workdir)
 {
   isRestored = b_inRestore;
 @ -1433,4 +1434,7  @ void Konsole::saveProperties(KConfig* co
       saveMainWindowSettings(config);
   }
+
+  if (!s_workDir.isEmpty())
+    config->writePathEntry("workdir", s_workDir);
 }
 
 @ -2672,4 +2676,9  @ QString Konsole::newSession(KSimpleConfi
      txt = _title;
 
+  // apply workdir only when the session config does not have a directory
+  if (cwd.isEmpty())
+     cwd = s_workDir;
+  // bookmarks take precedence over workdir
+  // however, --workdir option has precedence in the very first session
   if (!_cwd.isEmpty())
      cwd = _cwd;

--- kdebase/konsole/konsole/konsole.h  #1.192:1.193
 @ -69,5 +69,6  @ public:
   Konsole(const char * name, int histon, bool menubaron, bool tabbaron,
     bool frameon, bool scrollbaron,
-    QCString type = 0, bool b_inRestore = false, const int wanted_tabbar = 0);
+    QCString type = 0, bool b_inRestore = false, const int wanted_tabbar = 0,
+    const QString &workdir=QString::null);
 
   ~Konsole();
 @ -415,4 +416,5  @ private:
   QSignalMapper* sessionNumberMapper;
   QStringList    sl_sessionShortCuts;
+  QString  s_workDir;
 };
 

--- kdebase/konsole/konsole/main.cpp  #1.275:1.276
 @ -473,6 +473,7  @ extern "C" int KDE_EXPORT kdemain(int ar
         sIcon = sessionconfig->readEntry("Icon0","openterm");
         sCwd = sessionconfig->readPathEntry("Cwd0");
+        workDir = sessionconfig->readPathEntry("workdir");
         n_tabbar = QMIN(sessionconfig->readUnsignedNumEntry("tabbar",Konsole::TabBottom),2);
-        Konsole *m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,0/*type*/,true,n_tabbar);
+        Konsole *m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,0/*type*/,true,n_tabbar, workDir);
 
         m->newSession(sPgm, eargs, sTerm, sIcon, sTitle, sCwd);
 @ -542,5 +543,5  @ extern "C" int KDE_EXPORT kdemain(int ar
   else
   {
-    Konsole*  m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,type, false, 0);
+    Konsole*  m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,type, false, 0, workDir);
     m->newSession((shell ? QFile::decodeName(shell) : QString::null), eargs, term, QString::null, title, workDir);
     m->enableFullScripting(full_script);



More information about the konsole-devel mailing list