summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-11-10 15:56:22 (GMT)
committerTobias Markmann <tm@ayena.de>2013-11-18 14:58:53 (GMT)
commit3f8ff1c0e154dcb9959906e6865053dbe975892f (patch)
tree494f84e2d36130cc14806a9c6828e4ed433fc8c7 /Swift/Controllers/Roster/ContactRosterItem.cpp
parentd674359cdefae70f3cc1fa6439c96c82b508b5e9 (diff)
downloadswift-3f8ff1c0e154dcb9959906e6865053dbe975892f.zip
swift-3f8ff1c0e154dcb9959906e6865053dbe975892f.tar.bz2
Improve tooltips to include avatars, last seen and vcard information.
Change-Id: I3768d9891ba903c5e2ce8217de0b4413ce40bb9a License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/Roster/ContactRosterItem.cpp')
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp
index 70b4a1b..6239033 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.cpp
+++ b/Swift/Controllers/Roster/ContactRosterItem.cpp
@@ -4,14 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swift/Controllers/Roster/ContactRosterItem.h"
-#include "Swift/Controllers/Roster/GroupRosterItem.h"
+#include <Swift/Controllers/Roster/ContactRosterItem.h>
+
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Base/DateTime.h>
#include <Swiften/Elements/Idle.h>
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <Swift/Controllers/Roster/GroupRosterItem.h>
namespace Swift {
@@ -52,6 +53,16 @@ std::string ContactRosterItem::getIdleText() const {
}
}
+std::string ContactRosterItem::getOfflineSinceText() const {
+ if (offlinePresence_) {
+ boost::optional<boost::posix_time::ptime> delay = offlinePresence_->getTimestamp();
+ if (offlinePresence_->getType() == Presence::Unavailable && delay) {
+ return dateTimeToLocalString(*delay);
+ }
+ }
+ return "";
+}
+
void ContactRosterItem::setAvatarPath(const boost::filesystem::path& path) {
avatarPath_ = path;
onDataChanged();
@@ -136,12 +147,20 @@ bool ContactRosterItem::supportsFeature(const Feature feature) const {
void ContactRosterItem::setBlockState(BlockState state) {
blockState_ = state;
+ onDataChanged();
}
ContactRosterItem::BlockState ContactRosterItem::blockState() const {
return blockState_;
}
+VCard::ref ContactRosterItem::getVCard() const {
+ return vcard_;
}
+void ContactRosterItem::setVCard(VCard::ref vcard) {
+ vcard_ = vcard;
+ onDataChanged();
+}
+}