From edf850be557be1fff524274eeca7f87eb5c5e1de Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 6 Dec 2015 20:30:50 +0300 Subject: [PATCH] fixed online color in contacts box, fixed share contact with text, fixed choose in contacts box by Enter key --- Telegram/SourceFiles/boxes/contactsbox.cpp | 15 +++++++-------- Telegram/SourceFiles/boxes/contactsbox.h | 2 ++ Telegram/SourceFiles/historywidget.cpp | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 7b980133af4804..e438ec678e1a16 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -1382,6 +1382,7 @@ void ContactsBox::init() { connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate())); + connect(&_filter, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_filterCancel, SIGNAL(clicked()), this, SLOT(onFilterCancel())); connect(&_inner, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int))); connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll())); @@ -1503,14 +1504,12 @@ void ContactsBox::showDone() { _filter.setFocus(); } +void ContactsBox::onSubmit() { + _inner.chooseParticipant(); +} + void ContactsBox::keyPressEvent(QKeyEvent *e) { - if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { - if (_filter.hasFocus()) { - _inner.chooseParticipant(); - } else { - ItemListBox::keyPressEvent(e); - } - } else if (_filter.hasFocus()) { + if (_filter.hasFocus()) { if (e->key() == Qt::Key_Down) { _inner.selectSkip(1); } else if (e->key() == Qt::Key_Up) { @@ -1919,7 +1918,7 @@ void MembersInner::paintDialog(Painter &p, PeerData *peer, MemberData *data, boo } p.setFont(st::contactsStatusFont->f); - p.setPen(sel ? st::contactsStatusFgOver : (data->onlineColor ? st::contactsStatusFgOnline : st::contactsStatusFg)); + p.setPen(data->onlineColor ? st::contactsStatusFgOnline : (sel ? st::contactsStatusFgOver : st::contactsStatusFg)); p.drawTextLeft(namex, st::contactsPadding.top() + st::contactsStatusTop, width(), data->online); } diff --git a/Telegram/SourceFiles/boxes/contactsbox.h b/Telegram/SourceFiles/boxes/contactsbox.h index 669e039f3078be..540f35b40c4d2e 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.h +++ b/Telegram/SourceFiles/boxes/contactsbox.h @@ -216,6 +216,8 @@ public slots: void onCreate(); void onSaveAdmins(); + void onSubmit(); + bool onSearchByUsername(bool searchCache = false); void onNeedSearchByUsername(); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index a50e56abde97b0..405ab685be2911 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -5297,11 +5297,12 @@ void HistoryWidget::cancelSendFile(const FileLoadResultPtr &file) { void HistoryWidget::confirmShareContact(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool ctrlShiftEnter) { if (!_peer) return; + PeerId shareToId = _peer->id; if (_confirmWithTextId == 0xFFFFFFFFFFFFFFFFL) { onSend(ctrlShiftEnter, replyTo); _confirmWithTextId = 0; } - shareContact(_peer->id, phone, fname, lname, replyTo); + shareContact(shareToId, phone, fname, lname, replyTo); } void HistoryWidget::cancelShareContact() {