Commit e587f9dc authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Rename SaveGeometryOnExit to RememberWindowSize

And migrate the old key name to the new one.
parent b641e066
...@@ -890,7 +890,7 @@ void MainWindow::showEvent(QShowEvent *event) ...@@ -890,7 +890,7 @@ void MainWindow::showEvent(QShowEvent *event)
if (_firstShowEvent) { if (_firstShowEvent) {
_firstShowEvent = false; _firstShowEvent = false;
if (!KonsoleSettings::saveGeometryOnExit() || !wasWindowGeometrySaved()) { if (!KonsoleSettings::rememberWindowSize() || !wasWindowGeometrySaved()) {
// Delay resizing to here, so that the other parts of the UI // Delay resizing to here, so that the other parts of the UI
// (ViewManager, TabbedViewContainer, TerminalDisplay ... etc) // (ViewManager, TabbedViewContainer, TerminalDisplay ... etc)
// have been created and TabbedViewContainer::sizeHint() returns // have been created and TabbedViewContainer::sizeHint() returns
......
...@@ -74,6 +74,31 @@ public: ...@@ -74,6 +74,31 @@ public:
} }
}; };
static void migrateRenamedConfigKeys()
{
struct KeyInfo {
const char *groupName;
const char *oldKeyName;
const char *newKeyName;
};
static const KeyInfo keys[] = {{"KonsoleWindow", "SaveGeometryOnExit", "RememberWindowSize"}};
KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig(QStringLiteral("konsolerc"));
// Migrate renamed config keys
for (const auto &[group, oldName, newName] : keys) {
KConfigGroup cg = konsoleConfig->group(group);
if (cg.exists() && cg.hasKey(oldName)) {
const bool value = cg.readEntry(oldName, false);
cg.deleteEntry(oldName);
cg.writeEntry(newName, value);
}
}
konsoleConfig->sync();
}
// *** // ***
// Entry point into the Konsole terminal application. // Entry point into the Konsole terminal application.
// *** // ***
...@@ -99,6 +124,8 @@ int main(int argc, char *argv[]) ...@@ -99,6 +124,8 @@ int main(int argc, char *argv[])
auto app = new QApplication(argc, argv); auto app = new QApplication(argc, argv);
app->setStyle(new MenuStyle()); app->setStyle(new MenuStyle());
migrateRenamedConfigKeys();
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
// this ensures that Ctrl and Meta are not swapped, so CTRL-C and friends // this ensures that Ctrl and Meta are not swapped, so CTRL-C and friends
// will work correctly in the terminal // will work correctly in the terminal
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="kcfg_SaveGeometryOnExit"> <widget class="QCheckBox" name="kcfg_RememberWindowSize">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<tooltip>Show terminal size in columns and lines in the center of window after resizing</tooltip> <tooltip>Show terminal size in columns and lines in the center of window after resizing</tooltip>
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="SaveGeometryOnExit" type="Bool"> <entry name="RememberWindowSize" type="Bool">
<label>Use current window size on next startup</label> <label>Use current window size on next startup</label>
<tooltip>The window size will be saved upon exiting Konsole</tooltip> <tooltip>The window size will be saved upon exiting Konsole</tooltip>
<default>true</default> <default>true</default>
......
Supports Markdown
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