Bug 153785 - terminal doesnt start in current directory
Summary: terminal doesnt start in current directory
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
Depends on:
Reported: 2007-12-10 17:04 UTC by Morten O. Hansen
Modified: 2007-12-16 20:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:

patches bug (625 bytes, patch)
2007-12-10 21:41 UTC, Morten O. Hansen

Note You need to log in before you can comment on or make changes to this bug.
Description Morten O. Hansen 2007-12-10 17:04:39 UTC
Version:           0.9.5 (from svn) (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.2.3 20071123 (prerelease) (Debian 4.2.2-4) 
OS:                Linux

the embedded terminal doesnt always start in the correct directory (which ofcourse should be the current one).
Comment 1 Morten O. Hansen 2007-12-10 20:51:51 UTC
after some checking, i have found a way to reproduce this every time:
1) start dolphin
2) enter a directory e.g. ~/kde/src
3) press f4 (terminal now opens and shows ~/kde/src)
4) f4 again (it is now gone)
5) enter ~/kde/bin
6) press f4 (current directory will now be ~/kde/src)

it seems that url().path() is correct, so maybe theres something wrong with showShellInDir() ?

sendInput("cd " + url().path() + "; clear\n") on line 77 of terminalsidebarpage.cpp seems to work. but its not really a good fix!
Comment 2 Morten O. Hansen 2007-12-10 21:41:16 UTC
Created attachment 22464 [details]
patches bug

Enclosed is a patch that should fix the problem. showShellInDir only changes
directory when the shell-process is created (so when it is first, created it
wont do anything on successive calls).

I moved the showShellInDir-call to right after the terminal is created, and
added a sendInput instead.
Comment 3 Peter Penz 2007-12-16 12:28:07 UTC
Thanks a lot for the detailed analyzes + the patch. Even if sendInput("cd" + ...) might not be the nicest approach, the time until KDE 4.0 is quite short and I applied your patch :-)
Comment 4 Peter Penz 2007-12-16 12:29:03 UTC
SVN commit 749039 by ppenz:

fixes for the terminal panel:
* assure that the correct directory is entered when reopening the terminal
* let the terminal be focused also when reopening it

BUG: 153785
BUG: 153756

 M  +7 -3      terminalsidebarpage.cpp  
 M  +2 -0      terminalsidebarpage.h  

WebSVN link: http://websvn.kde.org/?view=rev&revision=749039
Comment 5 Morten O. Hansen 2007-12-16 20:04:22 UTC
Yeah, sendInput isnt very clean.. (you can see the cd commands being sent to the console). But not sure if there is another way. 

Btw, there is also a patch in bug #153697 :-) 
Comment 6 Peter Penz 2007-12-16 20:14:00 UTC
> Btw, there is also a patch in bug #153697 :-) 

Wow, great! I just had a look and I'll apply it. I'm also not sure for 153697 whether there might be nicer approaches (I think in Qt4.4 there are easier ways for disabling global shortcuts), but like said: 4.0 is approaching... Thanks a lot!