Fix scoping issues with Screen::DecodingOptions
ClosedPublic

Authored by ahmadsamir on May 10 2018, 4:19 AM.

Details

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

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.May 10 2018, 4:19 AM
Restricted Application added a project: Konsole. · View Herald TranscriptMay 10 2018, 4:19 AM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
ahmadsamir requested review of this revision.EditedMay 10 2018, 4:19 AM
ahmadsamir updated this revision to Diff 33924.
ahmadsamir edited the test plan for this revision. (Show Details)

Fix phabricator markup screw-up

ahmadsamir updated this revision to Diff 33925.May 10 2018, 4:22 AM
ahmadsamir edited the test plan for this revision. (Show Details)

Take 2

hindenburg accepted this revision.May 10 2018, 1:01 PM
hindenburg added a subscriber: hindenburg.

Thanks

This revision is now accepted and ready to land.May 10 2018, 1:01 PM
This revision was automatically updated to reflect the committed changes.