users who are away are now greyed out in the nickview
[quassel.git] / src / client / networkmodel.cpp
index 4f702ac..7cfc5f6 100644 (file)
@@ -143,6 +143,13 @@ void BufferItem::attachIrcChannel(IrcChannel *ircChannel) {
          this, SLOT(userModeChanged(IrcUser *)));
   connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
          this, SLOT(userModeChanged(IrcUser *)));
+
+  if(!ircChannel->ircUsers().isEmpty()) {
+    qWarning() << "Channel" << ircChannel->name() << "has already users which is quite surprising :)";
+    foreach(IrcUser *ircUser, ircChannel->ircUsers()) {
+      join(ircUser);
+    }
+  }
   
   emit dataChanged();
 }
@@ -408,6 +415,8 @@ int UserCategoryItem::categoryFromModes(const QString &modes) {
 
 QVariant UserCategoryItem::data(int column, int role) const {
   switch(role) {
+  case NetworkModel::ItemActiveRole:
+    return true;
   case NetworkModel::ItemTypeRole:
     return NetworkModel::UserCategoryItemType;
   case NetworkModel::BufferIdRole:
@@ -450,6 +459,8 @@ quint64 IrcUserItem::id() const {
 
 QVariant IrcUserItem::data(int column, int role) const {
   switch(role) {
+  case NetworkModel::ItemActiveRole:
+    return !_ircUser->isAway();
   case NetworkModel::ItemTypeRole:
     return NetworkModel::IrcUserItemType;
   case NetworkModel::BufferIdRole:
@@ -465,7 +476,14 @@ QVariant IrcUserItem::data(int column, int role) const {
 
 QString IrcUserItem::toolTip(int column) const {
   Q_UNUSED(column);
-  return "<p><b>" + nickName() + "</b><br />" + _ircUser->hostmask() + "</p>";
+  QString toolTip = "<b>" + nickName() + "</b><br />" + _ircUser->hostmask();
+  if(_ircUser->isAway()) {
+    toolTip += "<br /> away";
+    if(!_ircUser->awayMessage().isEmpty()) { 
+      toolTip += " (" + _ircUser->awayMessage() + ")"; 
+    }
+  }
+  return "<p>" + toolTip + "</p>";
 }
 
 void IrcUserItem::setNick(QString newNick) {