diff options
Diffstat (limited to 'pica-client/chatwindow.cpp')
| -rw-r--r-- | pica-client/chatwindow.cpp | 32 |
1 files changed, 19 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); +} + |
