Make new sessions start in the same directory as the previously active session. Does not apply when creating a new tab from a specific profile.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=670566
This commit is contained in:
Robert Knight
2007-06-02 02:17:14 +00:00
parent 3f1f8cac41
commit 942ecb745c
8 changed files with 63 additions and 17 deletions

View File

@@ -78,10 +78,10 @@ MainWindow* Application::newMainWindow()
MainWindow* window = new MainWindow();
window->setSessionList( new ProfileList(true,window) );
connect( window , SIGNAL(newSessionRequest(const QString&,ViewManager*)),
this , SLOT(createSession(const QString&,ViewManager*)));
connect( window , SIGNAL(newWindowRequest(const QString&)),
this , SLOT(createWindow(const QString&)) );
connect( window , SIGNAL(newSessionRequest(const QString&,const QString&,ViewManager*)),
this , SLOT(createSession(const QString&,const QString&,ViewManager*)));
connect( window , SIGNAL(newWindowRequest(const QString&,const QString&)),
this , SLOT(createWindow(const QString&,const QString&)) );
connect( window->viewManager() , SIGNAL(viewDetached(Session*)) , this , SLOT(detachView(Session*)) );
return window;
@@ -118,7 +118,7 @@ int Application::newInstance()
window->setDefaultProfile(key);
}
createSession( window->defaultProfile() , window->viewManager() );
createSession( window->defaultProfile() , QString() , window->viewManager() );
// if the background-mode argument is supplied, start the background session
// ( or bring to the front if it already exists )
@@ -184,18 +184,21 @@ void Application::detachView(Session* session)
window->show();
}
void Application::createWindow(const QString& key)
void Application::createWindow(const QString& key , const QString& directory)
{
MainWindow* window = newMainWindow();
window->setDefaultProfile(key);
createSession(key,window->viewManager());
createSession(key,directory,window->viewManager());
window->show();
}
void Application::createSession(const QString& key , ViewManager* view)
void Application::createSession(const QString& key , const QString& directory , ViewManager* view)
{
Session* session = SessionManager::instance()->createSession(key);
if (!directory.isEmpty())
session->setInitialWorkingDirectory(directory);
// create view before starting the session process so that the session doesn't suffer
// a change in terminal size right after the session starts. some applications such as GNU Screen
// and Midnight Commander don't like this happening