Fix scoping issues with Screen::DecodingOptions

Authored by ahmadsamir on May 10 2018, 12:49 PM.

Description

Fix scoping issues with Screen::DecodingOptions

Summary:
Move the Q_DECLARE_OPERATORS_FOR_FLAGS macro declaration for the
DecodingOption enum to the Konsole namespace. This should fix a bug that
happens when KeyboardTranslator.h is included in Screen.h (either
directly or indirectly), where the compiler doesn't find the |() operator
of the QFlags class.

I haven't pinpointed where the conflicting |() operator is coming from
exactly, but moving the macro declaration to the Konsole namespace
matches how other QFlags are used through out the code (and matches
upstream doc examples).

Test Plan:

  • Add this include to Screen.h and try to compile: #include "KeyboardTranslator.h"
  • The compilation fails in SessionController.cpp:

error: invalid conversion from 'int' to 'Konsole::Screen::DecodingOption'
The line it fails on is 1200:
QString selectedText = _view->screenWindow()->selectedText(Screen::PreserveLineBreaks | Screen::TrimLeadingWhitespace | Screen::TrimTrailingWhitespace);

  • Apply the diff and build again, the build should complete

I tested the options from the DecodingOption enum from the Screen class and they still work as before

Reviewers: Konsole, hindenburg

Reviewed By: Konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: Konsole

Differential Revision: https://phabricator.kde.org/D12797

Details

Committed
hindenburgMay 10 2018, 1:01 PM
Reviewer
Konsole
Differential Revision
D12797: Fix scoping issues with Screen::DecodingOptions
Parents
R319:7e040b615955: The exported version env var should have a consistent length
Branches
Unknown
Tags
Unknown