Commit 6c8ef851 authored by Robert Knight's avatar Robert Knight
Browse files

Use a more correct method to set the working directory of new sessions. ...

Use a more correct method to set the working directory of new sessions.  Session::running() -> Session::isRunning().   Remove some commented-out code.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=687611
parent 2e280bcb
......@@ -122,7 +122,7 @@ Session* Part::activeSession() const
void Part::startProgram( const QString& program,
const QStringList& arguments )
{
if ( !activeSession()->running() )
if ( !activeSession()->isRunning() )
{
if ( !program.isEmpty() && !arguments.isEmpty() )
{
......@@ -135,7 +135,7 @@ void Part::startProgram( const QString& program,
}
void Part::showShellInDir( const QString& dir )
{
if ( !activeSession()->running() )
if ( !activeSession()->isRunning() )
{
if ( !dir.isEmpty() )
activeSession()->setInitialWorkingDirectory(dir);
......
......@@ -120,7 +120,7 @@ Session::Session() :
connect( _emulation,SIGNAL(useUtf8Request(bool)),_shellProcess,SLOT(setUtf8Mode(bool)) );
connect( _shellProcess,SIGNAL(done(int)), this,SLOT(done(int)) );
connect( _shellProcess,SIGNAL(done(int)), this, SLOT(done(int)) );
//setup timer for monitoring session activity
_monitorTimer = new QTimer(this);
......@@ -135,7 +135,7 @@ bool Session::hasDarkBackground() const
{
return _hasDarkBackground;
}
bool Session::running() const
bool Session::isRunning() const
{
return _shellProcess->isRunning();
}
......@@ -155,31 +155,6 @@ void Session::setArguments(const QStringList& arguments)
_arguments = arguments;
}
void Session::ptyError()
{
// Mysterious errors about PTYs used to be shown even when there was nothing wrong
// with the PTY itself because the code which starts the session ( in ::run() ) assumes
// that if starting the shell process fails then a PTY error is the problem, when
// there are other things that can go wrong as well
#if 0
// FIXME: _shellProcess->error() is always empty
if ( _shellProcess->error().isEmpty() )
{
KMessageBox::error( QApplication::activeWindow() ,
i18n("Konsole is unable to open a PTY (pseudo teletype). "
"It is likely that this is due to an incorrect configuration "
"of the PTY devices. Konsole needs to have read/write access "
"to the PTY devices."),
i18n("A Fatal Error Has Occurred") );
}
else
KMessageBox::error(QApplication::activeWindow(), _shellProcess->error());
emit finished();
#endif
}
QList<TerminalDisplay*> Session::views() const
{
return _views;
......@@ -277,8 +252,10 @@ void Session::run()
QString dbusService = QDBusConnection::sessionBus().baseService();
QString cwd_save = QDir::currentPath();
if (!_initialWorkingDir.isEmpty())
QDir::setCurrent(_initialWorkingDir);
_shellProcess->setWorkingDirectory(_initialWorkingDir);
_shellProcess->setXonXoff(_flowControl);
_shellProcess->setErase(_emulation->getErase());
......@@ -300,16 +277,9 @@ void Session::run()
if (result < 0)
{
return;
//QTimer::singleShot(0, this, SLOT(ptyError()));
}
if (!_initialWorkingDir.isEmpty())
QDir::setCurrent(cwd_save);
else
_initialWorkingDir=cwd_save;
_shellProcess->setWriteable(false); // We are reachable via kwrited.
}
void Session::setUserTitle( int what, const QString &caption )
......
......@@ -83,7 +83,7 @@ public:
* Returns true if the session is currently running. This will be true
* after run() has been called successfully.
*/
bool running() const;
bool isRunning() const;
/**
* Sets the profile associated with this session.
......@@ -312,15 +312,11 @@ public:
/**
* Returns the process id of the terminal's foreground process.
* This is initially the same as sessionProcessId() but can change
* This is initially the same as processId() but can change
* as the user starts other programs inside the terminal.
*/
int foregroundProcessId() const;
void startZModem(const QString &rz, const QString &dir, const QStringList &list);
void cancelZModem();
bool isZModemBusy() { return _zmodemBusy; }
/** Returns the terminal session's window size in lines and columns. */
QSize size();
/**
......@@ -343,8 +339,16 @@ public:
* This has no effect once the session is running.
*/
void setDarkBackground(bool darkBackground);
/**
* Returns true if the session has a dark background.
* See setDarkBackground()
*/
bool hasDarkBackground() const;
void startZModem(const QString &rz, const QString &dir, const QStringList &list);
void cancelZModem();
bool isZModemBusy() { return _zmodemBusy; }
public slots:
/**
......@@ -433,8 +437,6 @@ private slots:
void fireZModemDetected();
void ptyError();
void onReceiveBlock( const char* buffer, int len );
void monitorTimerDone();
......
......@@ -365,6 +365,7 @@ void Vt102Emulation::XtermHack()
QChar *str = new QChar[ppos-i-2];
for (int j = 0; j < ppos-i-2; j++) str[j] = pbuf[i+1+j];
QString unistr(str,ppos-i-2);
// arg == 1 doesn't change the title. In XTerm it only changes the icon name
// (btw: arg=0 changes title and icon, arg=1 only icon, arg=2 only title
// emit changeTitle(arg,unistr);
......
This diff is collapsed.
Supports Markdown
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