Commit f73cc9c7 authored by Robert Knight's avatar Robert Knight

Add an option to the profile editor to control whether new sessions start in...

Add an option to the profile editor to control whether new sessions start in the same directory as the current session.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=791273
parent 484a64d0
......@@ -278,8 +278,12 @@ void Application::createWindow(Profile::Ptr profile , const QString& directory)
Session* Application::createSession(Profile::Ptr profile, const QString& directory , ViewManager* view)
{
if (!profile)
profile = SessionManager::instance()->defaultProfile();
Session* session = SessionManager::instance()->createSession(profile);
if (!directory.isEmpty() && session->initialWorkingDirectory().isEmpty())
if (!directory.isEmpty() && profile->property<bool>(Profile::StartInCurrentSessionDir))
session->setInitialWorkingDirectory(directory);
// create view before starting the session process so that the session doesn't suffer
......
......@@ -211,6 +211,7 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
_ui->initialDirEdit->setClearButtonShown(true);
_ui->dirSelectButton->setIcon( KIcon("folder-open") );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
_ui->startInSameDirButton->setChecked(info->property<bool>(Profile::StartInCurrentSessionDir));
// window options
_ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) );
......@@ -218,7 +219,8 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
connect( _ui->iconSelectButton , SIGNAL(clicked()) , this , SLOT(selectIcon()) );
connect( _ui->startInSameDirButton , SIGNAL(toggled(bool)) , this ,
SLOT(startInSameDir(bool)));
connect( _ui->profileNameEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(profileNameChanged(const QString&)) );
connect( _ui->initialDirEdit , SIGNAL(textChanged(const QString&)) , this ,
......@@ -348,6 +350,10 @@ void EditProfileDialog::profileNameChanged(const QString& text)
_tempProfile->setProperty(Profile::Name,text);
updateCaption(_tempProfile->name());
}
void EditProfileDialog::startInSameDir(bool sameDir)
{
_tempProfile->setProperty(Profile::StartInCurrentSessionDir,sameDir);
}
void EditProfileDialog::initialDirChanged(const QString& dir)
{
_tempProfile->setProperty(Profile::Directory,dir);
......
......@@ -111,6 +111,7 @@ private slots:
void profileNameChanged(const QString& text);
void initialDirChanged(const QString& text);
void startInSameDir(bool);
void commandChanged(const QString& text);
void tabTitleFormatChanged(const QString& text);
void remoteTabTitleFormatChanged(const QString& text);
......
......@@ -32,8 +32,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......@@ -110,7 +110,7 @@
</property>
</widget>
</item>
<item row="3" column="0" >
<item row="4" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Icon:</string>
......@@ -120,7 +120,7 @@
</property>
</widget>
</item>
<item row="3" column="1" >
<item row="4" column="1" >
<widget class="QPushButton" name="iconSelectButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
......@@ -154,7 +154,7 @@
</property>
</widget>
</item>
<item row="3" column="2" >
<item row="4" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
......@@ -167,7 +167,7 @@
</property>
</spacer>
</item>
<item row="4" column="0" >
<item row="5" column="0" >
<widget class="QLabel" name="environmentLabel" >
<property name="text" >
<string>Environment:</string>
......@@ -177,7 +177,7 @@
</property>
</widget>
</item>
<item row="4" column="1" >
<item row="5" column="1" >
<widget class="QPushButton" name="environmentEditButton" >
<property name="toolTip" >
<string>Edit the list of environment variables and associated values</string>
......@@ -187,6 +187,13 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QCheckBox" name="startInSameDirButton" >
<property name="text" >
<string>Start in same directory as current tab</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -238,8 +245,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......@@ -381,8 +388,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......@@ -599,8 +606,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......@@ -777,8 +784,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......@@ -867,8 +874,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>472</height>
<width>429</width>
<height>461</height>
</rect>
</property>
<attribute name="title" >
......
......@@ -78,6 +78,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { ShowMenuBar , "ShowMenuBar" , GENERAL_GROUP , QVariant::Bool }
, { TabBarMode , "TabBarMode" , GENERAL_GROUP , QVariant::Int }
, { TabBarPosition , "TabBarPosition" , GENERAL_GROUP , QVariant::Int }
, { StartInCurrentSessionDir , "StartInCurrentSessionDir" , GENERAL_GROUP , QVariant::Bool }
// Appearance
, { Font , "Font" , APPEARANCE_GROUP , QVariant::Font }
......@@ -147,7 +148,7 @@ FallbackProfile::FallbackProfile()
setProperty(TabBarMode,AlwaysShowTabBar);
setProperty(TabBarPosition,TabBarBottom);
setProperty(ShowMenuBar,true);
setProperty(StartInCurrentSessionDir,true);
setProperty(KeyBindings,"default");
setProperty(ColorScheme,"Linux");
......
......@@ -186,7 +186,11 @@ public:
DefaultEncoding,
/** (bool) Whether fonts should be aliased or not */
AntiAliasFonts
AntiAliasFonts,
/** (bool) Whether new sessions should be started in the same directory as the
* currently active session. */
StartInCurrentSessionDir
};
/**
......
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