Summary: | workdir option sets starting directory only for the very first session in konsole | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Rudo Thomas <rudo> |
Component: | general | Assignee: | Konsole Developer <konsole-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
This patch solved the problem described.
Revised version of the patch. More recent patch |
Description
Rudo Thomas
2004-12-10 23:40:04 UTC
Created attachment 8612 [details]
This patch solved the problem described.
Still applies to 3.3.2.
Created attachment 8632 [details]
Revised version of the patch.
The previous version always set workdir when restoring session. The revised one
(against 3.3.2) solves this issue. It is not binary compatible, however. This
makes it a candidate for inclusion in KDE-3.4...?
I'm aware of your patch. I'm busy with another konsole patch for the moment. When I get some free time I'll test it. It is possible it will make it in for 3.4 Created attachment 8816 [details]
More recent patch
With all the changes recently, the old patch didn't apply cleanly. Here is a
new version for CVS.
I don't use --workdir and I'm not sure if it 'expected' that all newly created
sessions should start up at --workdir.
Hmmm. How would you describe the expected effect of the workdir option then? I think setting the directory for the first session *only* does not make much sense. Happy new year :-) Rudo. 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); |