Commit cd4adc3f authored by Kurt Hindenburg's avatar Kurt Hindenburg

Allow the window size and location to be saved per profile.

Patch is from Gentoo.

BUG: 181129

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=1144208
parent 48cc2c5b
......@@ -253,6 +253,7 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
// window options
_ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) );
_ui->saveGeometryOnExitButton->setChecked( info->property<bool>(Profile::SaveGeometryOnExit) );
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
......@@ -268,6 +269,8 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
connect(_ui->showMenuBarButton , SIGNAL(toggled(bool)) , this ,
SLOT(showMenuBar(bool)) );
connect(_ui->saveGeometryOnExitButton , SIGNAL(toggled(bool)) , this ,
SLOT(saveGeometryOnExit(bool)) );
connect(_ui->environmentEditButton , SIGNAL(clicked()) , this ,
SLOT(showEnvironmentEditor()) );
......@@ -369,6 +372,10 @@ void EditProfileDialog::showMenuBar(bool show)
{
_tempProfile->setProperty(Profile::ShowMenuBar,show);
}
void EditProfileDialog::saveGeometryOnExit(bool save)
{
_tempProfile->setProperty(Profile::SaveGeometryOnExit,save);
}
void EditProfileDialog::tabTitleFormatChanged(const QString& format)
{
_tempProfile->setProperty(Profile::LocalTabTitleFormat,format);
......
......@@ -120,6 +120,7 @@ private slots:
void insertRemoteTabTitleText(const QString& text);
void showMenuBar(bool);
void saveGeometryOnExit(bool);
void showEnvironmentEditor();
void tabBarVisibilityChanged(int);
void tabBarPositionChanged(int);
......
......@@ -228,9 +228,25 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="saveGeometryOnExitButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Set the window size and position for this profile when exiting</string>
</property>
<property name="text">
<string>Save window size and position on exit</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
......
......@@ -91,6 +91,8 @@ MainWindow::MainWindow()
connect( _viewManager , SIGNAL(setMenuBarVisibleRequest(bool)) , this ,
SLOT(setMenuBarVisibleOnce(bool)) );
connect( _viewManager , SIGNAL(setSaveGeometryOnExitRequest(bool)) , this ,
SLOT(setSaveGeometryOnExit(bool)) );
connect( _viewManager , SIGNAL(newViewRequest(Profile::Ptr)) ,
this , SLOT(newFromProfile(Profile::Ptr)) );
connect( _viewManager , SIGNAL(newViewRequest()) ,
......@@ -141,6 +143,11 @@ void MainWindow::setMenuBarVisibleOnce(bool visible)
_menuBarVisibilitySet = true;
}
void MainWindow::setSaveGeometryOnExit(bool save)
{
setAutoSaveSettings("MainWindow",save);
}
void MainWindow::correctShortcuts()
{
// replace F1 shortcut for help contents
......
......@@ -171,6 +171,8 @@ class MainWindow : public KXmlGuiWindow
// effect if the menu bar is a MacOS-style top-level menu
void setMenuBarVisibleOnce(bool visible);
void setSaveGeometryOnExit(bool visible);
void openUrls(const QList<KUrl>& urls);
private:
......
......@@ -76,6 +76,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
, { LocalTabTitleFormat , "tabtitle" , 0 , QVariant::String }
, { RemoteTabTitleFormat , "RemoteTabTitleFormat" , GENERAL_GROUP , QVariant::String }
, { ShowMenuBar , "ShowMenuBar" , GENERAL_GROUP , QVariant::Bool }
, { SaveGeometryOnExit , "SaveGeometryOnExit" , GENERAL_GROUP , QVariant::Bool }
, { TabBarMode , "TabBarMode" , GENERAL_GROUP , QVariant::Int }
, { TabBarPosition , "TabBarPosition" , GENERAL_GROUP , QVariant::Int }
, { StartInCurrentSessionDir , "StartInCurrentSessionDir" , GENERAL_GROUP , QVariant::Bool }
......@@ -156,6 +157,7 @@ FallbackProfile::FallbackProfile()
setProperty(TabBarMode,AlwaysShowTabBar);
setProperty(TabBarPosition,TabBarBottom);
setProperty(ShowMenuBar,true);
setProperty(SaveGeometryOnExit,true);
setProperty(StartInCurrentSessionDir,true);
setProperty(ShowNewAndCloseTabButtons,false);
setProperty(MenuIndex,"0");
......
......@@ -115,6 +115,7 @@ public:
RemoteTabTitleFormat,
/** (bool) Specifies whether the menu bar should be shown in the main application window. */
ShowMenuBar,
SaveGeometryOnExit,
/** (TabBarModeEnum) Specifies when the tab bar should be shown in
* the main application window. */
TabBarMode,
......
......@@ -787,6 +787,8 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
// menu bar visibility
emit setMenuBarVisibleRequest( info->property<bool>(Profile::ShowMenuBar) );
emit setSaveGeometryOnExitRequest( info->property<bool>(Profile::SaveGeometryOnExit) );
// tab bar visibility
if (applyContainerSettings)
{
......
......@@ -196,6 +196,7 @@ signals:
* activated.
*/
void setMenuBarVisibleRequest(bool);
void setSaveGeometryOnExitRequest(bool);
/** Requests creation of a new view with the default profile. */
void newViewRequest();
......
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