minor bugfix: ssl/no-ssl icons will only be displayed when connected
[quassel.git] / src / client / networkmodel.cpp
index 75dd515..f1b1c73 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "util.h" // get rid of this (needed for isChannelName)
 
-// #define PHONDEV
 
 /*****************************************
 *  Fancy Buffer Items
@@ -160,7 +159,7 @@ void BufferItem::setBufferName(const QString &name) {
   _bufferName = name;
   // as long as we need those bufferInfos, we have to update that one aswell.
   // pretty ugly though :/
-  _bufferInfo = BufferInfo(_bufferInfo.bufferId(), _bufferInfo.networkId(), _bufferInfo.type(), _bufferInfo.groupId(), _bufferInfo.bufferName());
+  _bufferInfo = BufferInfo(_bufferInfo.bufferId(), _bufferInfo.networkId(), _bufferInfo.type(), _bufferInfo.groupId(), name);
   emit dataChanged(0);
 }
 
@@ -289,14 +288,14 @@ QString BufferItem::toolTip(int column) const {
   switch(bufferType()) {
     case BufferInfo::StatusBuffer: {
       QString netName = Client::network(bufferInfo().networkId())->networkName();
-      toolTip.append(QString("<b>Status buffer from %1</b>").arg(netName));
+      toolTip.append(tr("<b>Status buffer of %1</b>").arg(netName));
       break;
     }
     case BufferInfo::ChannelBuffer:
-      toolTip.append(QString("<h4>Channel %1</h4>").arg(bufferName()));
+      toolTip.append(tr("<b>Channel %1</b>").arg(bufferName()));
       if(isActive()) {
         //TODO: add channel modes 
-        toolTip.append(QString("<b>Users:</b> %1").arg(nickCount()));
+        toolTip.append(tr("<b>Users:</b> %1").arg(nickCount()));
 
         BufferSettings s;
         bool showTopic = s.value("DisplayTopicInTooltip", QVariant(false)).toBool();
@@ -306,23 +305,23 @@ QString BufferItem::toolTip(int column) const {
             _topic.replace(QString("<"), QString("&lt;"));
             _topic.replace(QString(">"), QString("&gt;"));
             toolTip.append(QString("<font size='-2'>&nbsp;</font>"));
-            toolTip.append(QString("<b>Topic:</b> %1").arg(_topic));
+            toolTip.append(tr("<b>Topic:</b> %1").arg(_topic));
           }
         }
       } else {
-        toolTip.append(QString("Not active <br /> Double-click to join"));
+        toolTip.append(tr("Not active <br /> Double-click to join"));
       }
       break;
     case BufferInfo::QueryBuffer:
-      toolTip.append(QString("<b>Query with %1</b>").arg(bufferName()));
-      if(topic() != "") toolTip.append(QString("Away Message: %1").arg(topic()));
+      toolTip.append(tr("<b>Query with %1</b>").arg(bufferName()));
+      if(topic() != "") toolTip.append(tr("Away Message: %1").arg(topic()));
       break;
     default: //this should not happen
-      toolTip.append(QString("%1 - %2").arg(bufferInfo().bufferId().toInt()).arg(bufferName()));
+      toolTip.append(tr("%1 - %2").arg(bufferInfo().bufferId().toInt()).arg(bufferName()));
       break;
   }
 
-  return QString("<p> %1 </p>").arg(toolTip.join("<br />"));
+  return tr("<p> %1 </p>").arg(toolTip.join("<br />"));
 }
 
 /*
@@ -597,23 +596,7 @@ QString IrcUserItem::toolTip(int column) const {
     QDateTime now = QDateTime::currentDateTime();
     QDateTime idle = _ircUser->idleTime();
     int idleTime = idle.secsTo(now);
-
-    QList< QPair<int, QString> > timeUnit;
-    timeUnit.append(qMakePair(365*60*60, tr("year")));
-    timeUnit.append(qMakePair(24*60*60, tr("day")));
-    timeUnit.append(qMakePair(60*60, tr("h")));
-    timeUnit.append(qMakePair(60, tr("min")));
-    timeUnit.append(qMakePair(1, tr("sec")));
-
-    QString idleString(' ');
-    for(int i=0; i < timeUnit.size(); i++) {
-      int n = idleTime / timeUnit[i].first;
-      if(n > 0) {
-        idleString += QString("%1 %2 ").arg(QString::number(n), timeUnit[i].second);
-      }
-      idleTime = idleTime % timeUnit[i].first;
-    }
-    toolTip.append(tr("idling since %1").arg(idleString));
+    toolTip.append(tr("idling since %1").arg(secondsToString(idleTime)));
   }
   if(_ircUser->loginTime().isValid()) {
     toolTip.append(tr("login time: %1").arg(_ircUser->loginTime().toString()));