File fix-profile-terminal-size.patch of Package konsole.openSUSE_Leap_42.1_Update
From: Kurt Hindenburg <kurt.hindenburg@gmail.com>
Date: Sat, 30 Jan 2016 17:09:33 +0000
Subject: Allow profile's termainal size to work again
X-Git-Url: http://quickgit.kde.org/?p=konsole.git&a=commitdiff&h=55f02e5b8e3e2395050940c33c97306311192e18
---
Allow profile's termainal size to work again
When Konsole Settings -> 'Use current window size on next startup' is
disabled, use the Profile's terminal size for new windows.
Many thanks to Roman Gilg (subdiff gmail com) for research and patch.
If there are no further issues, I'll commit to 15.12 branch (should go
.2 release).
REVIEW: 126924
CCBUG: 345403
---
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -36,6 +36,7 @@
#include "MainWindow.h"
#include "Session.h"
#include "ShellCommand.h"
+#include "KonsoleSettings.h"
using namespace Konsole;
@@ -83,7 +84,7 @@
{
MainWindow* window = newMainWindow();
window->createSession(profile, directory);
- window->show();
+ finalizeNewMainWindow(window);
}
void Application::detachView(Session* session)
@@ -93,7 +94,7 @@
// Since user is dragging and dropping, move dnd window to where
// the user has the cursor (correct multiple monitor setups).
window->move(QCursor::pos());
- window->show();
+ finalizeNewMainWindow(window);
}
int Application::newInstance()
@@ -109,8 +110,12 @@
if (processHelpArgs(args))
return 0;
+ // returns from processWindowArgs(args, createdNewMainWindow)
+ // if a new window was created
+ bool createdNewMainWindow = false;
+
// create a new window or use an existing one
- MainWindow* window = processWindowArgs(args);
+ MainWindow* window = processWindowArgs(args, createdNewMainWindow);
if (args->isSet("tabs-from-file")) {
// create new session(s) as described in file
@@ -148,10 +153,15 @@
// run. After that KMainWindow will have manually resized the
// window to its saved size at this point (so the Qt::WA_Resized
// attribute will be set)
- if (!window->testAttribute(Qt::WA_Resized))
- window->resize(window->sizeHint());
-
- window->show();
+
+
+ // If not restoring size from last time or only adding new tab,
+ // resize window to chosen profile size (see Bug:345403)
+ if (createdNewMainWindow){
+ finalizeNewMainWindow(window);
+ } else{
+ window->show();
+ }
}
}
@@ -285,7 +295,7 @@
window->hide();
}
-MainWindow* Application::processWindowArgs(KCmdLineArgs* args)
+MainWindow* Application::processWindowArgs(KCmdLineArgs* args, bool &createdNewMainWindow)
{
MainWindow* window = 0;
if (args->isSet("new-tab")) {
@@ -299,6 +309,7 @@
}
if (window == 0) {
+ createdNewMainWindow = true;
window = newMainWindow();
// override default menubar visibility
@@ -475,3 +486,9 @@
}
}
+void Application::finalizeNewMainWindow(MainWindow* window)
+{
+ if (!KonsoleSettings::saveGeometryOnExit())
+ window->resize(window->sizeHint());
+ window->show();
+}
--- a/src/Application.h
+++ b/src/Application.h
@@ -77,12 +77,13 @@
void listProfilePropertyInfo();
void startBackgroundMode(MainWindow* window);
bool processHelpArgs(KCmdLineArgs* args);
- MainWindow* processWindowArgs(KCmdLineArgs* args);
+ MainWindow* processWindowArgs(KCmdLineArgs* args, bool &createdNewMainWindow);
Profile::Ptr processProfileSelectArgs(KCmdLineArgs* args);
Profile::Ptr processProfileChangeArgs(KCmdLineArgs* args, Profile::Ptr baseProfile);
void processTabsFromFileArgs(KCmdLineArgs* args, MainWindow* window);
void createTabFromArgs(KCmdLineArgs* args, MainWindow* window,
const QHash<QString, QString>&);
+ void finalizeNewMainWindow(MainWindow* window);
MainWindow* _backgroundInstance;
};