diff options
author | Tobias Markmann <tm@ayena.de> | 2013-02-25 23:20:59 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-03-04 15:18:47 (GMT) |
commit | 836925a5cdc7017da7fb84416c803e652b48e399 (patch) | |
tree | 2f659c2bc3e6db70cbc09e0cb13953c1a8ccd8e4 /Swift/QtUI/Roster/RosterModel.cpp | |
parent | ffbd6feb875a9d50ec834fd6dfe967528697a9ff (diff) | |
download | swift-836925a5cdc7017da7fb84416c803e652b48e399.zip swift-836925a5cdc7017da7fb84416c803e652b48e399.tar.bz2 |
Adding support for idle time.
Change-Id: I1b14edb97a0c87431ec377b084362e9761caded9
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/QtUI/Roster/RosterModel.cpp')
-rw-r--r-- | Swift/QtUI/Roster/RosterModel.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 1fc20dd..885d04c 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -84,7 +84,8 @@ QVariant RosterModel::data(const QModelIndex& index, int role) const { case AvatarRole: return getAvatar(item); case PresenceIconRole: return getPresenceIcon(item); case ChildCountRole: return getChildCount(item); - default: return QVariant(); + case IdleRole: return getIsIdle(item); + default: return QVariant(); } } @@ -93,6 +94,11 @@ int RosterModel::getChildCount(RosterItem* item) const { return group ? group->getDisplayedChildren().size() : 0; } +bool RosterModel::getIsIdle(RosterItem* item) const { + ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item); + return contact ? !contact->getIdleText().empty() : false; +} + QColor RosterModel::intToColor(int color) const { return QColor( ((color & 0xFF0000)>>16), @@ -131,6 +137,9 @@ QString RosterModel::getToolTip(RosterItem* item) const { if (!getStatusText(item).isEmpty()) { tip += ": " + getStatusText(item); } + if (!contact->getIdleText().empty()) { + tip += "\n " + tr("Idle since ") + P2QSTRING(contact->getIdleText()); + } } return tip; } |