Commit 675dbcb2 authored by Jekyll Wu's avatar Jekyll Wu

Emit signal currentDirectoryChanged(QString) after current directory changes

Note: the signal is not emitted immediately after the current directory
changes. There is noticable delay (usually below 1 second) at the
moment.

FEATURE: 156919
REVIEW: 104372
FIXED-IN:4.9.0
parent a7f71fe9
......@@ -220,6 +220,8 @@ void Part::activeViewChanged(SessionController* controller)
removeChildClient(_pluggedController);
disconnect(_pluggedController, SIGNAL(titleChanged(ViewProperties*)), this,
SLOT(activeViewTitleChanged(ViewProperties*)));
disconnect(_pluggedController,SIGNAL(currentDirectoryChanged(QString)),this,
SIGNAL(currentDirectoryChanged(QString)));
}
// insert new controller
......@@ -227,6 +229,8 @@ void Part::activeViewChanged(SessionController* controller)
connect(controller, SIGNAL(titleChanged(ViewProperties*)), this,
SLOT(activeViewTitleChanged(ViewProperties*)));
activeViewTitleChanged(controller);
connect(controller,SIGNAL(currentDirectoryChanged(QString)),this,
SIGNAL(currentDirectoryChanged(QString)));
const char* displaySignal = SIGNAL(overrideShortcutCheck(QKeyEvent*,bool&));
const char* partSlot = SLOT(overrideTerminalShortcut(QKeyEvent*,bool&));
......
......@@ -167,6 +167,11 @@ signals:
*/
void activityDetected();
/**
* Emitted when the current working directory of the active session has changed.
*/
void currentDirectoryChanged(const QString& dir);
protected:
/** Reimplemented from KParts::PartBase. */
virtual bool openFile();
......
......@@ -279,7 +279,14 @@ QString Session::currentWorkingDirectory()
ProcessInfo* Session::updateWorkingDirectory()
{
ProcessInfo* process = getProcessInfo();
_currentWorkingDir = process->validCurrentDir();
const QString currentDir = process->validCurrentDir();
if ( currentDir != _currentWorkingDir )
{
_currentWorkingDir = currentDir;
emit currentDirectoryChanged(_currentWorkingDir);
}
return process;
}
......
......@@ -567,6 +567,13 @@ signals:
*/
void stateChanged(int state);
/**
* Emitted when the current working directory of this session changes.
*
* @param dir The new current woking directory of the session.
*/
void currentDirectoryChanged(const QString& dir);
/** Emitted when a bell event occurs in the session. */
void bellRequest(const QString& message);
......
......@@ -143,6 +143,9 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
// listen to title and icon changes
connect(_session, SIGNAL(titleChanged()), this, SLOT(sessionTitleChanged()));
connect( _session , SIGNAL(currentDirectoryChanged(QString)) ,
this , SIGNAL(currentDirectoryChanged(QString)) );
// listen for color changes
connect(_session, SIGNAL(changeBackgroundColorRequest(QColor)), _view, SLOT(setBackgroundColor(QColor)));
connect(_session, SIGNAL(changeForegroundColorRequest(QColor)), _view, SLOT(setForegroundColor(QColor)));
......
......@@ -172,6 +172,12 @@ signals:
void rawTitleChanged();
/**
* Emitted when the curreent working directory of the session associated with
* the controller is changed.
*/
void currentDirectoryChanged(const QString& dir);
public slots:
/**
* Issues a command to the session to navigate to the specified URL.
......
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