Commit 68760bdb authored by Robert Knight's avatar Robert Knight

Implement changing of tab title format in Edit Profile Dialog.

svn path=/branches/work/konsole-split-view/; revision=659595
parent 278429bb
......@@ -86,6 +86,10 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
_ui->initialDirEdit->setText( info->defaultWorkingDirectory() );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
_ui->tabTitleEdit->setText( info->property(Profile::LocalTabTitleFormat).value<QString>() );
_ui->remoteTabTitleEdit->setText(
info->property(Profile::RemoteTabTitleFormat).value<QString>());
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
connect( _ui->iconSelectButton , SIGNAL(clicked()) , this , SLOT(selectIcon()) );
......
......@@ -354,13 +354,21 @@ QString Session::userTitle() const
{
return _userTitle;
}
QString Session::displayTitle() const
void Session::setTabTitleFormat(TabTitleContext context , const QString& format)
{
if (!_userTitle.isEmpty())
return _userTitle;
else
return title();
if ( context == LocalTabTitle )
_localTabTitleFormat = format;
else if ( context == RemoteTabTitle )
_remoteTabTitleFormat = format;
}
QString Session::tabTitleFormat(TabTitleContext context) const
{
if ( context == LocalTabTitle )
return _localTabTitleFormat;
else if ( context == RemoteTabTitle )
return _remoteTabTitleFormat;
return QString::null;
}
void Session::monitorTimerDone()
......
......@@ -142,11 +142,14 @@ public:
* in the terminal), or an empty string if the user has not set a custom title
*/
QString userTitle() const;
/**
* Returns the title of the session for display in UI widgets
* (eg. window captions)
*/
QString displayTitle() const;
enum TabTitleContext
{
LocalTabTitle,
RemoteTabTitle
};
void setTabTitleFormat(TabTitleContext context , const QString& format);
QString tabTitleFormat(TabTitleContext context) const;
QString keymap() const;
......@@ -298,6 +301,10 @@ private:
QString _title;
QString _userTitle;
QString _localTabTitleFormat;
QString _remoteTabTitleFormat;
QString _iconName;
QString _iconText; // as set by: echo -en '\033]1;IconText\007
bool _addToUtmp;
......
......@@ -119,10 +119,10 @@ void SessionController::snapshot()
if ( process->name(&ok) == "ssh" && ok )
{
SSHProcessInfo sshInfo(*process);
_session->setTitle( sshInfo.format("%H / %u") );
_session->setTitle( sshInfo.format(_session->tabTitleFormat(Session::RemoteTabTitle)) );
}
else
_session->setTitle( process->format("%d / %n") );
_session->setTitle( process->format(_session->tabTitleFormat(Session::LocalTabTitle) ) );
if ( snapshot != process )
{
......
......@@ -515,8 +515,16 @@ void SessionManager::applyProfile(Session* session, Profile* info , bool modifie
{
if ( !modifiedPropertiesOnly || info->isPropertySet(Profile::Icon) )
session->setIconName(info->icon());
if ( !modifiedPropertiesOnly || info->isPropertySet(Profile::KeyBindings) )
session->setKeymap(info->property(Profile::KeyBindings).value<QString>());
if ( !modifiedPropertiesOnly || info->isPropertySet(Profile::LocalTabTitleFormat) )
session->setTabTitleFormat( Session::LocalTabTitle ,
info->property(Profile::LocalTabTitleFormat).value<QString>());
if ( !modifiedPropertiesOnly || info->isPropertySet(Profile::RemoteTabTitleFormat) )
session->setTabTitleFormat( Session::RemoteTabTitle ,
info->property(Profile::RemoteTabTitleFormat).value<QString>());
}
QString SessionManager::addProfile(Profile* type)
......
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