Summary:
When there is only one tab and a process is running, remove the
'close current tab' option when attempting to close Konsole.
Test Plan:
1. Open Konsole (assuming you have not check 'Do not ask again')
2. Start any process (ie top)
3. Try to close Konsole
Should only be 2 options, 'Close window' and 'Cancel'
Reviewers: #konsole, hindenburg
Reviewed By: #konsole, hindenburg
Subscribers: hindenburg, ngraham, konsole-devel
Tags: #konsole
Differential Revision: https://phabricator.kde.org/D23146
When XDG_CURRENT_DESKTOP ≠ kde, perssing and immediately releasing Alt
key makes focus get stuck in menu. Fix this by overriding QProxyStyle.
This does not influence menu accelerators (e.g. Alt+f to access "File" in
menu), which continue working according to user settings.
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
BUG: 410641
FIXED-IN: 19.08
Differential Revision: https://phabricator.kde.org/D22980
Fixes a problem detected by Coverity Scan.
Coverity Scan log (relevant part)
---------------------------------
```
(...)
*** CID 241675: (UNINTENDED_INTEGER_DIVISION)
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 728
in Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &,
const QColor &, const QColor &, bool &)()
722 painter.setPen(cursorColor);
723 724 if (_cursorShape == Enum::BlockCursor) {
725 // draw the cursor outline, adjusting the area so that
726 // it is draw entirely inside 'rect'
727 int penWidth = qMax(1, painter.pen().width());
CID 241675: (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "penWidth" and "2", and then converting
the integer quotient to type "double". Any remainder, or fractional
part of the quotient, is ignored.
728 painter.drawRect(cursorRect.adjusted(penWidth / 2 + 0.5,
729 penWidth / 2 + 0.5,
730 - penWidth / 2 - penWidth % 2 + 0.5,
731 - penWidth / 2 - penWidth % 2 + 0.5));
732 733 // draw the cursor body only when the widget has focus
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 729
in Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &,
const QColor &, const QColor &, bool &)()
723 724 if (_cursorShape == Enum::BlockCursor) {
725 // draw the cursor outline, adjusting the area so that
726 // it is draw entirely inside 'rect'
727 int penWidth = qMax(1, painter.pen().width());
728 painter.drawRect(cursorRect.adjusted(penWidth / 2 + 0.5,
CID 241675: (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "penWidth" and "2", and then converting
the integer quotient to type "double". Any remainder, or fractional
part of the quotient, is ignored.
729 penWidth / 2 + 0.5,
730 - penWidth / 2 - penWidth % 2 + 0.5,
731 - penWidth / 2 - penWidth % 2 + 0.5));
732 733 // draw the cursor body only when the widget has focus
734 if (hasFocus()) {
(...)
```
How the initial terminal size is set:
* TerminalDisplay calculates size in pixels from requested columns/rows
count, and uses it as the size hint.
* TabbedViewContainer, which wraps TerminalDisplay and QTabBar,
and MainWindow, which wraps TabbedViewContainer, calculates their
sizes from their children's size hints. It is assumed the size
is equal to children's bounding rectangle size, eventually increased
by visible margins.
* TerminalDisplay adjusts its size to fill the window. In this case,
this should change nothing.
QTabWidget's (TabbedViewContainer base class) sizeHint() includes
some (*nonexistent*) margins added by widgets style (by default 2*2,
2*4 in Breeze). Those were propagated to the window size and were
increasing TerminalDisplay size.
Reimplemented TabbedViewContainer::sizeHint() returns the size of its
children's bounding rectangle.
rects creates a temporary vector with all the rectangles and
returns the result, destructing in the end. we don't need that
if we are only interested in iterating thru the rects. QRegion
has begin / end so it's usable in Q_FOREACH and range based for.
This reverts commit d689ba5403.
I should have tested this more; this breaks a number of things as
switching doesn't execute the 'Command'. Since the next release is
close, let's just revert for now.
FIXED-IN: 19.08
CCBUG: 319926