D12797: Fix scoping issues with Screen::DecodingOptions

Ahmad Samir noreply at phabricator.kde.org
Thu May 10 04:19:16 UTC 2018


ahmadsamir created this revision.
ahmadsamir added a reviewer: Konsole.
Restricted Application added a project: Konsole.
Restricted Application added a subscriber: konsole-devel.
ahmadsamir requested review of this revision.

REVISION 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' on line 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

REPOSITORY
  R319 Konsole

BRANCH
  screen-decodingOption-scope

REVISION DETAIL
  https://phabricator.kde.org/D12797

AFFECTED FILES
  src/Screen.h
  src/ScreenWindow.h

To: ahmadsamir, #konsole
Cc: konsole-devel, herrold, ngraham, hindenburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20180510/cdd2d9b5/attachment.html>


More information about the konsole-devel mailing list