summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp16
-rw-r--r--Swift/Controllers/Chat/MUCController.h2
-rw-r--r--Swift/Controllers/RosterController.cpp6
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp9
-rw-r--r--Swift/QtUI/QtStatusWidget.h1
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp13
6 files changed, 38 insertions, 9 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index e582f1b..14fe180 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -141,7 +141,11 @@ void MUCController::handleWindowClosed() {
void MUCController::handleOccupantJoined(const MUCOccupant& occupant) {
receivedActivity();
JID jid(nickToJID(occupant.getNick()));
- roster_->addContact(jid, occupant.getNick(), roleToGroupName(occupant.getRole()));
+ JID realJID;
+ if (occupant.getRealJID()) {
+ realJID = occupant.getRealJID().get();
+ }
+ roster_->addContact(jid, realJID, occupant.getNick(), roleToGroupName(occupant.getRole()));
if (joined_) {
String joinString = occupant.getNick() + " has joined the room";
MUCOccupant::Role role = occupant.getRole();
@@ -177,12 +181,16 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<Message>) {
joined_ = true;
}
-void MUCController::handleOccupantRoleChanged(const String& nick, const MUCOccupant::Role& newRole, const MUCOccupant::Role& oldRole) {
+void MUCController::handleOccupantRoleChanged(const String& nick, const MUCOccupant& occupant, const MUCOccupant::Role& oldRole) {
receivedActivity();
JID jid(nickToJID(nick));
roster_->removeContactFromGroup(jid, roleToGroupName(oldRole));
- roster_->addContact(jid, nick, roleToGroupName(newRole));
- chatWindow_->addSystemMessage(nick + " is now a " + roleToFriendlyName(newRole));
+ JID realJID;
+ if (occupant.getRealJID()) {
+ realJID = occupant.getRealJID().get();
+ }
+ roster_->addContact(jid, realJID, nick, roleToGroupName(occupant.getRole()));
+ chatWindow_->addSystemMessage(nick + " is now a " + roleToFriendlyName(occupant.getRole()));
}
String MUCController::roleToGroupName(MUCOccupant::Role role) {
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index bf46a08..f409309 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -46,7 +46,7 @@ namespace Swift {
void handleOccupantJoined(const MUCOccupant& occupant);
void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const String& reason);
void handleOccupantPresenceChange(boost::shared_ptr<Presence> presence);
- void handleOccupantRoleChanged(const String& nick, const MUCOccupant::Role& newRole, const MUCOccupant::Role& oldRole);
+ void handleOccupantRoleChanged(const String& nick, const MUCOccupant& occupant,const MUCOccupant::Role& oldRole);
void handleJoinComplete(const String& nick);
void handleJoinFailed(boost::shared_ptr<ErrorPayload> error);
void handleJoinTimeoutTick();
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 191d5fb..46248a1 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -104,10 +104,10 @@ void RosterController::handleOnJIDAdded(const JID& jid) {
String name = nickResolver_->jidToNick(jid);
if (!groups.empty()) {
foreach(const String& group, groups) {
- roster_->addContact(jid, name, group);
+ roster_->addContact(jid, jid, name, group);
}
} else {
- roster_->addContact(jid, name, "Contacts");
+ roster_->addContact(jid, jid, name, "Contacts");
}
}
@@ -132,7 +132,7 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
}
foreach(const String& group, groups) {
if (std::find(oldGroups.begin(), oldGroups.end(), group) == oldGroups.end()) {
- roster_->addContact(jid, xmppRoster_->getNameForJID(jid), group);
+ roster_->addContact(jid, jid, xmppRoster_->getNameForJID(jid), group);
}
}
foreach(const String& group, oldGroups) {
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 7d39531..d7c0e63 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -124,11 +124,15 @@ void QtStatusWidget::generateList() {
foreach (StatusShow::Type type, icons_.keys()) {
QListWidgetItem* item = new QListWidgetItem(text, menu_);
item->setIcon(icons_[type]);
+ item->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(type)) + ": " + item->text());
+ item->setStatusTip(item->toolTip());
item->setData(Qt::UserRole, QVariant(type));
}
foreach (StatusShow::Type type, icons_.keys()) {
QListWidgetItem* item = new QListWidgetItem(P2QSTRING(StatusShow::typeToFriendlyName(type)), menu_);
item->setIcon(icons_[type]);
+ item->setToolTip(item->text());
+ item->setStatusTip(item->toolTip());
item->setData(Qt::UserRole, QVariant(type));
}
}
@@ -207,6 +211,9 @@ void QtStatusWidget::handleItemClicked(QListWidgetItem* item) {
handleEditComplete();
}
+void QtStatusWidget::setNewToolTip() {
+ statusTextLabel_->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(selectedStatusType_)) + ": " + statusTextLabel_->text());
+}
void QtStatusWidget::setStatusText(const QString& text) {
statusText_ = text;
@@ -215,11 +222,13 @@ void QtStatusWidget::setStatusText(const QString& text) {
escapedText.replace("<","&lt;");
// statusTextLabel_->setText("<i>" + escapedText + "</i>");
statusTextLabel_->setText(escapedText);
+ setNewToolTip();
}
void QtStatusWidget::setStatusType(StatusShow::Type type) {
selectedStatusType_ = icons_.contains(type) ? type : StatusShow::Online;
statusIcon_->setPixmap(icons_[selectedStatusType_].pixmap(16, 16));
+ setNewToolTip();
}
}
diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h
index 4425b1d..2163d5a 100644
--- a/Swift/QtUI/QtStatusWidget.h
+++ b/Swift/QtUI/QtStatusWidget.h
@@ -43,6 +43,7 @@ namespace Swift {
void handleItemClicked(QListWidgetItem* item);
private:
void viewMode();
+ void setNewToolTip();
//QComboBox *types_;
QStackedWidget* stack_;
QLabel* statusIcon_;
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp
index e5a938e..a801d3f 100644
--- a/Swift/QtUI/Roster/RosterModel.cpp
+++ b/Swift/QtUI/Roster/RosterModel.cpp
@@ -115,7 +115,18 @@ QColor RosterModel::getBackgroundColor(RosterItem* item) const {
}
QString RosterModel::getToolTip(RosterItem* item) const {
- return dynamic_cast<ContactRosterItem*>(item) && !getStatusText(item).isEmpty() ? P2QSTRING(item->getDisplayName()) + "\n" + getStatusText(item) : P2QSTRING(item->getDisplayName());
+ QString tip(P2QSTRING(item->getDisplayName()));
+ ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
+ if (contact) {
+ if (contact->getDisplayJID().isValid()) {
+ tip += "\n" + P2QSTRING(contact->getDisplayJID().toBare().toString());
+ }
+ tip += "\n " + P2QSTRING(StatusShow::typeToFriendlyName(contact->getStatusShow()));
+ if (!getStatusText(item).isEmpty()) {
+ tip += ": " + getStatusText(item);
+ }
+ }
+ return tip;
}
QIcon RosterModel::getAvatar(RosterItem* item) const {