diff options
Diffstat (limited to 'pica-client')
| -rw-r--r-- | pica-client/chatwindow.cpp | 32 | ||||
| -rw-r--r-- | pica-client/chatwindow.h | 1 | ||||
| -rw-r--r-- | pica-client/msguirouter.cpp | 1 |
3 files changed, 21 insertions, 13 deletions
diff --git a/pica-client/chatwindow.cpp b/pica-client/chatwindow.cpp index c00d0fc..da23c7c 100644 --- a/pica-client/chatwindow.cpp +++ b/pica-client/chatwindow.cpp @@ -15,18 +15,10 @@ ChatWindow::ChatWindow(QByteArray peer_id) : QWidget(0), peer_id_(peer_id), hist(config_dbname, Accounts::GetCurrentAccount().id) { QVBoxLayout *layout; - QString title; - - + set_peer_name(); { Contacts ct(config_dbname, Accounts::GetCurrentAccount().id); - peer_name_ = ct.GetContactName(peer_id_); - - title = peer_name_; - - if (peer_name_.isEmpty()) - peer_name_ = peer_id_.toBase64(); QList<Contacts::ContactRecord> L = ct.GetContacts(Contacts::temporary); addcontactquestion = false; @@ -38,7 +30,6 @@ ChatWindow::ChatWindow(QByteArray peer_id) : break; } } - } { Accounts ac(config_dbname); @@ -48,9 +39,6 @@ ChatWindow::ChatWindow(QByteArray peer_id) : my_name_ = Accounts::GetCurrentAccount().id.toBase64(); } - title = QObject::tr("Chat with ") + title + " - " + peer_id_.toBase64(); - setWindowTitle(title); - layout = new QVBoxLayout; chatw = new QTextEdit(this); @@ -370,3 +358,21 @@ void ChatWindow::addct_removequestion() addcontactquestion = false; } } + +void ChatWindow::set_peer_name() +{ + QString title; + Contacts ct(config_dbname, Accounts::GetCurrentAccount().id); + + peer_name_ = ct.GetContactName(peer_id_); + + title = peer_name_; + + if (peer_name_.isEmpty()) + peer_name_ = peer_id_.toBase64(); + + + title = QObject::tr("Chat with ") + title + " - " + peer_id_.toBase64(); + setWindowTitle(title); +} + diff --git a/pica-client/chatwindow.h b/pica-client/chatwindow.h index a099130..f898aab 100644 --- a/pica-client/chatwindow.h +++ b/pica-client/chatwindow.h @@ -40,6 +40,7 @@ public slots: void msg_from_peer(QString msg); void msg_delivered(); void msg_informational(QString text);//юзер в оффлайне, набирает сообщение, и т.д. серым шрифтом, курсив + void set_peer_name(); private: diff --git a/pica-client/msguirouter.cpp b/pica-client/msguirouter.cpp index 6abe8c0..4cb7771 100644 --- a/pica-client/msguirouter.cpp +++ b/pica-client/msguirouter.cpp @@ -64,6 +64,7 @@ void MsgUIRouter::create_chatwindow(QByteArray peer_id) connect(cw, SIGNAL(msg_input(QString,ChatWindow*)), this, SLOT(msg_to_peer(QString,ChatWindow*))); connect(cw, SIGNAL(chatwindow_close(ChatWindow*)), this, SLOT(chatwindow_closed(ChatWindow*))); connect(cw, SIGNAL(contacts_update()), skynet, SIGNAL(ContactsUpdated())); + connect(skynet, SIGNAL(ContactsUpdated()), cw, SLOT(set_peer_name())); cw->show(); } |
