[Konsole-devel] Re: [PATCH] make --workdir work (as expected)

Rudo Thomas rudo at matfyz.cz
Fri Dec 10 12:44:57 UTC 2004


The patch...
-------------- next part --------------
diff -ur kdebase-3.3.1-orig/konsole/konsole/konsole.cpp kdebase-3.3.1/konsole/konsole/konsole.cpp
--- kdebase-3.3.1-orig/konsole/konsole/konsole.cpp	2004-10-03 09:11:17.000000000 +0200
+++ kdebase-3.3.1/konsole/konsole/konsole.cpp	2004-12-09 21:00:10.000000000 +0100
@@ -259,6 +259,7 @@
 ,m_separator_id(-1)
 ,m_newSessionButton(0)
 ,m_removeSessionButton(0)
+,s_workDir(_cwd)
 {
   isRestored = b_inRestore;
   connect( &m_closeTimeout, SIGNAL(timeout()), this, SLOT(slotCouldNotClose()));
@@ -1442,6 +1443,9 @@
   {
       saveMainWindowSettings(config);
   }
+
+  if (!s_workDir.isEmpty())
+    config->writePathEntry("workdir", s_workDir);
 }
 
 
@@ -2648,6 +2652,11 @@
   if (!_title.isEmpty())
      txt = _title;
 
+  // apply workdir only when the session config does not have a directory set up
+  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;
 
diff -ur kdebase-3.3.1-orig/konsole/konsole/konsole.h kdebase-3.3.1/konsole/konsole/konsole.h
--- kdebase-3.3.1-orig/konsole/konsole/konsole.h	2004-10-03 09:11:17.000000000 +0200
+++ kdebase-3.3.1/konsole/konsole/konsole.h	2004-12-09 19:30:19.000000000 +0100
@@ -410,6 +410,8 @@
   QToolButton* m_newSessionButton;
   QToolButton* m_removeSessionButton;
   QPoint      m_newSessionButtonMousePressPos;
+
+  QString	s_workDir;
 };
 
 class QSpinBox;
diff -ur kdebase-3.3.1-orig/konsole/konsole/main.cpp kdebase-3.3.1/konsole/konsole/main.cpp
--- kdebase-3.3.1-orig/konsole/konsole/main.cpp	2004-08-05 20:57:16.000000000 +0200
+++ kdebase-3.3.1/konsole/konsole/main.cpp	2004-12-09 21:31:15.000000000 +0100
@@ -462,7 +462,9 @@
         sTitle = sessionconfig->readEntry("Title0", title);
         sTerm = sessionconfig->readEntry("Term0");
         sIcon = sessionconfig->readEntry("Icon0","openterm");
-        sCwd = sessionconfig->readPathEntry("Cwd0");
+        sCwd = sessionconfig->readPathEntry("workdir");
+	if (sCwd.isEmpty())
+	  sCwd = sessionconfig->readPathEntry("Cwd0");
 	n_tabbar = QMIN(sessionconfig->readUnsignedNumEntry("tabbar",Konsole::TabBottom),2);
         Konsole *m = new Konsole(wname,sPgm,eargs,histon,menubaron,tabbaron,frameon,scrollbaron,sIcon,sTitle,0/*type*/,sTerm,true,n_tabbar,sCwd);
         m->enableFullScripting(full_script);


More information about the konsole-devel mailing list