Commit 931d64df authored by Kurt Hindenburg's avatar Kurt Hindenburg

Allow konsole to store terminal size in the profile.

This removes the profile setting to 'Save window size upon exit'.  Now
it is in the Konsole settings; each profile can now set desired column
and row size.

Konsole Settings->Configure Konsole->General->Use current window size
on next startup:
Enabled - ignores all profile size settings - uses previous window size
Disabled - profile size settings are used - set via Edit Current
 Profile 1st tab

Only new windows will use "new" col/row/size settings.

BUG: 152385
REVIEW: 115628
FIXED-IN: 2.13
parent 7515e0a5
......@@ -274,9 +274,12 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile)
_ui->iconSelectButton->setIcon(KIcon(profile->icon()));
_ui->startInSameDirButton->setChecked(profile->startInCurrentSessionDir());
// terminal options
_ui->terminalColumnsEntry->setValue(profile->terminalColumns());
_ui->terminalRowsEntry->setValue(profile->terminalRows());
// window options
_ui->showTerminalSizeHintButton->setChecked(profile->showTerminalSizeHint());
_ui->saveGeometryOnExitButton->setChecked(profile->saveGeometryOnExit());
// signals and slots
connect(_ui->dirSelectButton, SIGNAL(clicked()), this, SLOT(selectInitialDir()));
......@@ -292,8 +295,11 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile)
connect(_ui->environmentEditButton , SIGNAL(clicked()), this,
SLOT(showEnvironmentEditor()));
connect(_ui->saveGeometryOnExitButton, SIGNAL(toggled(bool)), this,
SLOT(saveGeometryOnExit(bool)));
connect(_ui->terminalColumnsEntry, SIGNAL(valueChanged(int)),
this, SLOT(terminalColumnsEntryChanged(int)));
connect(_ui->terminalRowsEntry, SIGNAL(valueChanged(int)),
this, SLOT(terminalRowsEntryChanged(int)));
connect(_ui->showTerminalSizeHintButton, SIGNAL(toggled(bool)), this,
SLOT(showTerminalSizeHint(bool)));
}
......@@ -339,9 +345,13 @@ void EditProfileDialog::setupTabsPage(const Profile::Ptr profile)
this, SLOT(silenceSecondsChanged(int)));
}
void EditProfileDialog::saveGeometryOnExit(bool value)
void EditProfileDialog::terminalColumnsEntryChanged(int value)
{
updateTempProfileProperty(Profile::TerminalColumns, value);
}
void EditProfileDialog::terminalRowsEntryChanged(int value)
{
updateTempProfileProperty(Profile::SaveGeometryOnExit, value);
updateTempProfileProperty(Profile::TerminalRows, value);
}
void EditProfileDialog::showTerminalSizeHint(bool value)
{
......
......@@ -114,8 +114,9 @@ private slots:
void tabTitleFormatChanged(const QString& text);
void remoteTabTitleFormatChanged(const QString& text);
void terminalColumnsEntryChanged(int);
void terminalRowsEntryChanged(int);
void showTerminalSizeHint(bool);
void saveGeometryOnExit(bool);
void showEnvironmentEditor();
void silenceSecondsChanged(int);
......
......@@ -32,8 +32,8 @@
<attribute name="title">
<string comment="@title:tab Generic, common options">General</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_10">
<property name="title">
<string comment="@title:group Generic, common options">General</string>
......@@ -199,31 +199,120 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_12">
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_16">
<property name="title">
<string>Window</string>
<string>Terminal Size</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="saveGeometryOnExitButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Columns</string>
</property>
<property name="toolTip">
<string>Set the window size and position for this profile when exiting</string>
</widget>
</item>
<item row="0" column="1">
<widget class="KIntSpinBox" name="terminalColumnsEntry">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Rows</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="KIntSpinBox" name="terminalRowsEntry">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<widget class="QLabel" name="label_5">
<property name="text">
<string>This will not alter any open windows.</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="6">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Save window size and position on exit</string>
<string>Configure Konsole-&gt;General-&gt;Use current window size on next startup must be disabled for these entries to work.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_12">
<property name="title">
<string>Window</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="showTerminalSizeHintButton">
<property name="toolTip">
......@@ -237,7 +326,7 @@
</layout>
</widget>
</item>
<item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -438,7 +527,7 @@
</sizepolicy>
</property>
<property name="text">
<string comment="KDE::DoNotExtract">FONT PREVIEW TEXT</string>
<string comment="KDE::DoNotExtract">KSqueezedTextLabel</string>
</property>
<property name="textElideMode">
<enum>Qt::ElideRight</enum>
......@@ -460,17 +549,17 @@
</widget>
</item>
<item>
<widget class="KDoubleNumInput" name="fontSizeInput" native="true">
<property name="minimum" stdset="0">
<widget class="KDoubleNumInput" name="fontSizeInput">
<property name="minimum">
<double>4.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="singleStep" stdset="0">
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="decimals" stdset="0">
<property name="decimals">
<number>1</number>
</property>
</widget>
......@@ -607,7 +696,7 @@
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout4">
<layout class="QGridLayout" name="gridLayout_34">
<item row="0" column="0">
<widget class="QRadioButton" name="scrollHalfPage">
<property name="toolTip">
......
......@@ -77,6 +77,23 @@ MainWindow::MainWindow()
, _menuBarInitialVisibility(true)
, _menuBarInitialVisibilityApplied(false)
{
if (!KonsoleSettings::saveGeometryOnExit()) {
// If we are not using the global Konsole save geometry on exit,
// remove all Height and Width from [MainWindow] from konsolerc
// Each screen resolution will have entries (Width 1280=619)
KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig("konsolerc");
KConfigGroup group = konsoleConfig->group("MainWindow");
QMap<QString, QString> configEntries = group.entryMap();
QMapIterator<QString, QString> i(configEntries);
while (i.hasNext()) {
i.next();
if (i.key().startsWith(QLatin1String("Width"))
|| i.key().startsWith(QLatin1String("Height"))) {
group.deleteEntry(i.key());
}
}
}
if (useTransparency()) {
// It is useful to have translucent terminal area
setAttribute(Qt::WA_TranslucentBackground, true);
......@@ -97,8 +114,6 @@ MainWindow::MainWindow()
connect(_viewManager, SIGNAL(viewPropertiesChanged(QList<ViewProperties*>)),
bookmarkHandler(), SLOT(setViews(QList<ViewProperties*>)));
connect(_viewManager, SIGNAL(setSaveGeometryOnExitRequest(bool)), this,
SLOT(setSaveGeometryOnExit(bool)));
connect(_viewManager, SIGNAL(updateWindowIcon()), this,
SLOT(updateWindowIcon()));
connect(_viewManager, SIGNAL(newViewRequest(Profile::Ptr)),
......@@ -166,12 +181,6 @@ void MainWindow::restoreMenuAccelerators()
}
}
void MainWindow::setSaveGeometryOnExit(bool save)
{
// enable save and restore of window size
setAutoSaveSettings("MainWindow", save);
}
void MainWindow::correctStandardShortcuts()
{
// replace F1 shortcut for help contents
......@@ -699,7 +708,7 @@ void MainWindow::applyKonsoleSettings()
setNavigationStyleSheet(KonsoleSettings::tabBarStyleSheet());
}
// setAutoSaveSettings("MainWindow", KonsoleSettings::saveGeometryOnExit());
setAutoSaveSettings("MainWindow", KonsoleSettings::saveGeometryOnExit());
updateWindowCaption();
}
......
......@@ -160,8 +160,6 @@ private slots:
void profileListChanged(const QList<QAction*>& actions);
void configureNotifications();
void setSaveGeometryOnExit(bool visible);
void updateWindowIcon();
void updateWindowCaption();
......
......@@ -66,7 +66,6 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { LocalTabTitleFormat , "tabtitle" , 0 , QVariant::String }
, { RemoteTabTitleFormat , "RemoteTabTitleFormat" , GENERAL_GROUP , QVariant::String }
, { ShowTerminalSizeHint , "ShowTerminalSizeHint" , GENERAL_GROUP , QVariant::Bool }
, { SaveGeometryOnExit , "SaveGeometryOnExit" , GENERAL_GROUP , QVariant::Bool }
, { StartInCurrentSessionDir , "StartInCurrentSessionDir" , GENERAL_GROUP , QVariant::Bool }
, { SilenceSeconds, "SilenceSeconds" , GENERAL_GROUP , QVariant::Int }
, { TerminalColumns, "TerminalColumns" , GENERAL_GROUP , QVariant::Int }
......@@ -155,7 +154,6 @@ FallbackProfile::FallbackProfile()
setProperty(LocalTabTitleFormat, "%d : %n");
setProperty(RemoteTabTitleFormat, "(%u) %H");
setProperty(ShowTerminalSizeHint, true);
setProperty(SaveGeometryOnExit, true);
setProperty(StartInCurrentSessionDir, true);
setProperty(MenuIndex, "0");
setProperty(SilenceSeconds, 10);
......
......@@ -118,10 +118,6 @@ public:
* resizing the application window.
*/
ShowTerminalSizeHint,
/** (bool) Specifies whether the geometry information is saved when
* window is closed.
*/
SaveGeometryOnExit,
/** (QFont) The font to use in terminal displays using this profile. */
Font,
/** (QString) The name of the color scheme to use in terminal
......@@ -385,11 +381,6 @@ public:
return property<bool>(Profile::ShowTerminalSizeHint);
}
/** Convenience method for property<bool>(Profile::SaveGeometryOnExit) */
bool saveGeometryOnExit() const {
return property<bool>(Profile::SaveGeometryOnExit);
}
/** Convenience method for property<QFont>(Profile::Font) */
QFont font() const {
return property<QFont>(Profile::Font);
......@@ -495,6 +486,16 @@ public:
return property<int>(Profile::SilenceSeconds);
}
/** Convenience method for property<QString>(Profile::TerminalColumns) */
int terminalColumns() const {
return property<int>(Profile::TerminalColumns);
}
/** Convenience method for property<QString>(Profile::TerminalRows) */
int terminalRows() const {
return property<int>(Profile::TerminalRows);
}
/** Convenience method for property<QString>(Profile::MenuIndex) */
QString menuIndex() const {
return property<QString>(Profile::MenuIndex);
......
......@@ -790,8 +790,6 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
{
Q_ASSERT(profile);
emit setSaveGeometryOnExitRequest(profile->saveGeometryOnExit());
emit updateWindowIcon();
// load color scheme
......
......@@ -218,7 +218,6 @@ signals:
* activated.
*/
void setMenuBarVisibleRequest(bool);
void setSaveGeometryOnExitRequest(bool);
void updateWindowIcon();
/** Requests creation of a new view with the default profile. */
......
......@@ -28,7 +28,6 @@ GeneralSettings::GeneralSettings(QWidget* aParent) : QWidget(aParent)
setupUi(this);
this->kcfg_ShowTerminalSizeHint->setVisible(false);
this->kcfg_SaveGeometryOnExit->setVisible(false);
}
GeneralSettings::~GeneralSettings()
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>156</height>
<width>528</width>
<height>197</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -62,8 +62,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>If enabled, profile settings will be ignored</string>
</property>
<property name="text">
<string>Save window size and position on exit</string>
<string>Use current window size on next startup</string>
</property>
</widget>
</item>
......
......@@ -31,7 +31,7 @@
<default>true</default>
</entry>
<entry name="SaveGeometryOnExit" type="Bool">
<label>Save window size on exit</label>
<label>Use current window size on next startup</label>
<tooltip>The window size will be saved upon exiting Konsole</tooltip>
<default>true</default>
</entry>
......
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