mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-30 03:34:17 +00:00
Copy to FindBuffer added by Cmd+E on OS X.
This commit is contained in:
parent
a89185565a
commit
e015a8299e
@ -1471,6 +1471,10 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) {
|
||||
_widget->onListEscapePressed();
|
||||
} else if (e == QKeySequence::Copy && !_selected.isEmpty()) {
|
||||
copySelectedText();
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
setToClipboard(getSelectedText(), QClipboard::FindBuffer);
|
||||
#endif // Q_OS_MAC
|
||||
} else if (e == QKeySequence::Delete) {
|
||||
int32 selectedForForward, selectedForDelete;
|
||||
getSelectionState(selectedForForward, selectedForDelete);
|
||||
|
@ -345,6 +345,13 @@ void FlatInput::keyPressEvent(QKeyEvent *e) {
|
||||
emit cancelled();
|
||||
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
||||
emit submitted(ctrl && shift);
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto selected = selectedText();
|
||||
if (!selected.isEmpty() && echoMode() == QLineEdit::Normal) {
|
||||
QApplication::clipboard()->setText(selected, QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
}
|
||||
|
||||
@ -1229,6 +1236,14 @@ void InputArea::InputAreaInner::keyPressEvent(QKeyEvent *e) {
|
||||
e->ignore();
|
||||
} else if (f()->_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
|
||||
e->ignore();
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto cursor = textCursor();
|
||||
int start = cursor.selectionStart(), end = cursor.selectionEnd();
|
||||
if (end > start) {
|
||||
QApplication::clipboard()->setText(f()->getText(start, end), QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
} else {
|
||||
QTextCursor tc(textCursor());
|
||||
if (enter && ctrl) {
|
||||
@ -1944,6 +1959,14 @@ void InputField::InputFieldInner::keyPressEvent(QKeyEvent *e) {
|
||||
e->ignore();
|
||||
} else if (f()->_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
|
||||
e->ignore();
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto cursor = textCursor();
|
||||
int start = cursor.selectionStart(), end = cursor.selectionEnd();
|
||||
if (end > start) {
|
||||
QApplication::clipboard()->setText(f()->getText(start, end), QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
} else {
|
||||
QTextCursor tc(textCursor());
|
||||
if (enter && ctrl) {
|
||||
@ -2338,6 +2361,13 @@ void MaskedInputField::keyPressEvent(QKeyEvent *e) {
|
||||
emit cancelled();
|
||||
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
||||
emit submitted(ctrl && shift);
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto selected = selectedText();
|
||||
if (!selected.isEmpty() && echoMode() == QLineEdit::Normal) {
|
||||
QApplication::clipboard()->setText(selected, QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,6 +304,13 @@ void FlatLabel::keyPressEvent(QKeyEvent *e) {
|
||||
onCopySelectedText();
|
||||
e->accept();
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto selection = _selection.empty() ? (_contextMenu ? _savedSelection : _selection) : _selection;
|
||||
if (!selection.empty()) {
|
||||
QApplication::clipboard()->setText(_text.originalText(selection, _contextExpandLinksMode), QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1337,6 +1337,15 @@ void FlatTextarea::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
} else if (e->key() == Qt::Key_Search || e == QKeySequence::Find) {
|
||||
e->ignore();
|
||||
#ifdef Q_OS_MAC
|
||||
} else if (e->key() == Qt::Key_E && e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
auto cursor = textCursor();
|
||||
int start = cursor.selectionStart(), end = cursor.selectionEnd();
|
||||
if (end > start) {
|
||||
TagList tags;
|
||||
QApplication::clipboard()->setText(getTextPart(start, end, &tags), QClipboard::FindBuffer);
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
} else {
|
||||
QTextCursor tc(textCursor());
|
||||
if (enter && ctrl) {
|
||||
|
Loading…
Reference in New Issue
Block a user