Skip to content

Commit

Permalink
fixed online color in contacts box, fixed share contact with text, fi…
Browse files Browse the repository at this point in the history
…xed choose in contacts box by Enter key
  • Loading branch information
john-preston committed Dec 6, 2015
1 parent 485a6b5 commit edf850b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
15 changes: 7 additions & 8 deletions Telegram/SourceFiles/boxes/contactsbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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) {
Expand Down Expand 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);
}

Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/boxes/contactsbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public slots:
void onCreate();
void onSaveAdmins();

void onSubmit();

bool onSearchByUsername(bool searchCache = false);
void onNeedSearchByUsername();

Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/historywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit edf850b

Please sign in to comment.