summaryrefslogtreecommitdiffstats
path: root/pica-client/chatwindow.cpp
diff options
context:
space:
mode:
authorme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2014-08-17 21:22:07 +0000
committerAnton <anton@picapica>2014-08-18 01:22:37 +0400
commitd1e98f6c59e5ef991e556a01df02fe4182834c3b (patch)
tree42d8e5c92f06b080fcae1ad00a16f6a728c061aa /pica-client/chatwindow.cpp
parentc34605186f4d2b37ea2f8bb7c1db67dfaea3ff42 (diff)
downloadpica-pica-d1e98f6c59e5ef991e556a01df02fe4182834c3b.tar.gz
pica-pica-d1e98f6c59e5ef991e556a01df02fe4182834c3b.zip
update peer name in chatwindow after the first communication in order to show nickname instead of ID
git-svn-id: svn://localhost/project_picapica/trunk@332 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'pica-client/chatwindow.cpp')
-rw-r--r--pica-client/chatwindow.cpp32
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);
+}
+