X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=f1b1c73bd9f12e33c7bb350b7fa5220a6c43390f;hp=0582d44c6776c48671cae4fa694567219b2dc0e8;hb=4787ae231945b6d6ca8b3c255924c4f13178f83c;hpb=56607f81246f04db3a0e71c9a8757d7f75d6cfcf
diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp
index 0582d44c..f1b1c73b 100644
--- a/src/client/networkmodel.cpp
+++ b/src/client/networkmodel.cpp
@@ -33,7 +33,6 @@
#include "util.h" // get rid of this (needed for isChannelName)
-// #define PHONDEV
/*****************************************
* Fancy Buffer Items
@@ -55,21 +54,13 @@ BufferItem::BufferItem(BufferInfo bufferInfo, AbstractTreeItem *parent)
setFlags(flags);
}
-const BufferInfo &BufferItem::bufferInfo() const {
- return _bufferInfo;
-}
-
quint64 BufferItem::id() const {
return qHash(bufferInfo().bufferId());
}
-bool BufferItem::isStatusBuffer() const {
- return bufferType() == BufferInfo::StatusBuffer;
-}
-
-BufferInfo::Type BufferItem::bufferType() const {
- return bufferInfo().type();
-}
+// bool BufferItem::isStatusBuffer() const {
+// return bufferType() == BufferInfo::StatusBuffer;
+// }
bool BufferItem::isActive() const {
if(bufferType() == BufferInfo::ChannelBuffer)
@@ -168,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);
}
@@ -297,14 +288,14 @@ QString BufferItem::toolTip(int column) const {
switch(bufferType()) {
case BufferInfo::StatusBuffer: {
QString netName = Client::network(bufferInfo().networkId())->networkName();
- toolTip.append(QString("Status buffer from %1").arg(netName));
+ toolTip.append(tr("Status buffer of %1").arg(netName));
break;
}
case BufferInfo::ChannelBuffer:
- toolTip.append(QString("
Channel %1
").arg(bufferName()));
+ toolTip.append(tr("Channel %1").arg(bufferName()));
if(isActive()) {
//TODO: add channel modes
- toolTip.append(QString("Users: %1").arg(nickCount()));
+ toolTip.append(tr("Users: %1").arg(nickCount()));
BufferSettings s;
bool showTopic = s.value("DisplayTopicInTooltip", QVariant(false)).toBool();
@@ -314,23 +305,23 @@ QString BufferItem::toolTip(int column) const {
_topic.replace(QString("<"), QString("<"));
_topic.replace(QString(">"), QString(">"));
toolTip.append(QString(" "));
- toolTip.append(QString("Topic: %1").arg(_topic));
+ toolTip.append(tr("Topic: %1").arg(_topic));
}
}
} else {
- toolTip.append(QString("Not active
Double-click to join"));
+ toolTip.append(tr("Not active
Double-click to join"));
}
break;
case BufferInfo::QueryBuffer:
- toolTip.append(QString("Query with %1").arg(bufferName()));
- if(topic() != "") toolTip.append(QString("Away Message: %1").arg(topic()));
+ toolTip.append(tr("Query with %1").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(" %1
").arg(toolTip.join("
"));
+ return tr(" %1
").arg(toolTip.join("
"));
}
/*
@@ -423,8 +414,6 @@ void NetworkItem::attachNetwork(Network *network) {
this, SLOT(attachIrcChannel(QString)));
connect(network, SIGNAL(connectedSet(bool)),
this, SIGNAL(dataChanged()));
-
- // FIXME: connect this and that...
emit dataChanged();
}
@@ -596,33 +585,21 @@ QVariant IrcUserItem::data(int column, int role) const {
QString IrcUserItem::toolTip(int column) const {
Q_UNUSED(column);
QStringList toolTip(QString("%1").arg(nickName()));
+ if(_ircUser->userModes() != "") toolTip[0].append(QString(" (%1)").arg(_ircUser->userModes()));
if(_ircUser->isAway()) toolTip[0].append(" is away");
if(!_ircUser->awayMessage().isEmpty()) toolTip[0].append(QString(" (%1)").arg(_ircUser->awayMessage()));
if(!_ircUser->realName().isEmpty()) toolTip.append(_ircUser->realName());
if(!_ircUser->ircOperator().isEmpty()) toolTip.append(_ircUser->ircOperator());
- toolTip.append(_ircUser->hostmask());
+ toolTip.append(_ircUser->hostmask().remove(0, _ircUser->hostmask().indexOf("!")+1));
if(_ircUser->idleTime().isValid()) {
QDateTime now = QDateTime::currentDateTime();
QDateTime idle = _ircUser->idleTime();
int idleTime = idle.secsTo(now);
-
- QList< QPair > 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()));
}
if(!_ircUser->server().isEmpty()) toolTip.append(tr("server: %1").arg(_ircUser->server()));