| 777 | } |
| 778 | |
| 779 | bool ChatRootView::isSendShortcut(int key, int modifiers) const |
| 780 | { |
| 781 | const QKeySequence sequence = sendMessageKeySequence(); |
| 782 | if (sequence.isEmpty()) |
| 783 | return false; |
| 784 | |
| 785 | const QKeyCombination combination = sequence[0]; |
| 786 | const int sequenceKey = combination.key(); |
| 787 | |
| 788 | const int relevantMask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier |
| 789 | | Qt::MetaModifier; |
| 790 | const int sequenceModifiers = combination.keyboardModifiers() & relevantMask; |
| 791 | const int eventModifiers = modifiers & relevantMask; |
| 792 | |
| 793 | const bool isReturnLike = sequenceKey == Qt::Key_Return || sequenceKey == Qt::Key_Enter; |
| 794 | const bool keyMatches = key == sequenceKey |
| 795 | || (isReturnLike && (key == Qt::Key_Return || key == Qt::Key_Enter)); |
| 796 | |
| 797 | return keyMatches && eventModifiers == sequenceModifiers; |
| 798 | } |
| 799 | |
| 800 | QString ChatRootView::sendShortcutText() const |
| 801 | { |
nothing calls this directly
no test coverage detected