Commit 85b03470 authored by Robert Knight's avatar Robert Knight

Avoid code duplication

svn path=/branches/work/konsole-split-view/; revision=656587
parent 1db8b2d7
......@@ -82,25 +82,19 @@ bool Part::openFile()
void Part::startProgram( const QString& program,
const QStringList& arguments )
{
SessionManager* const manager = SessionManager::instance();
Session* session = createSession(QString::null);
#warning "FIXME - Port this to MutableSessionInfo's replacement."
/*MutableSessionInfo* info = new MutableSessionInfo(QString());
info->setCommand(program);
info->setArguments(arguments);
QString key = manager->addSessionType(info);
Session* session = manager->createSession(key);
session->setListenToKeyPress(true);
_viewManager->createView(session);
session->run();*/
session->setProgram(program);
session->setArguments(arguments);
session->run();
}
void Part::showShellInDir( const QString& dir )
{
Session* session = SessionManager::instance()->createSession(QString());
Session* session = createSession(QString::null);
session->setInitialWorkingDirectory(dir);
session->setListenToKeyPress(true);
_viewManager->createView(session);
session->run();
}
void Part::sendInput( const QString& text )
......@@ -111,13 +105,14 @@ void Part::sendInput( const QString& text )
while ( iter.hasNext() )
iter.next()->emulation()->sendText(text);
}
void Part::createSession(const QString& key)
Session* Part::createSession(const QString& key)
{
Session* session = SessionManager::instance()->createSession(key);
session->setListenToKeyPress(true);
_viewManager->createView(session);
session->run();
return session;
}
void Part::activeViewChanged(SessionController* controller)
{
......
......@@ -72,7 +72,9 @@ protected:
virtual bool openFile();
private slots:
void createSession(const QString& key);
// creates a new session using the specified key.
// call the run() method on the returned Session instance to begin the session
Session* createSession(const QString& key);
void activeViewChanged(SessionController* controller);
private:
ViewManager* _viewManager;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment