X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=1c365a447222943f7f7674e5409143bf483038c7;hb=7aa691713f4185fe142f54e14d6b623ee706f77a;hp=f04b8430be856d94f4444f578315d81eb30ef52a;hpb=429a6a571737b19bb60c165874fda0d74dab78da;p=quassel.git diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index f04b8430..1c365a44 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -21,16 +21,15 @@ #include "networkmodel.h" #include +#include // for Qt::escape() #include "buffermodel.h" +#include "buffersettings.h" #include "client.h" -#include "signalproxy.h" -#include "network.h" +#include "clientsettings.h" #include "ircchannel.h" - -#include "buffersettings.h" - -#include "util.h" // get rid of this (needed for isChannelName) +#include "network.h" +#include "signalproxy.h" /***************************************** * Network Items @@ -134,17 +133,17 @@ void NetworkItem::attachNetwork(Network *network) { _network = network; connect(network, SIGNAL(networkNameSet(QString)), - this, SLOT(setNetworkName(QString))); + this, SLOT(setNetworkName(QString))); connect(network, SIGNAL(currentServerSet(QString)), - this, SLOT(setCurrentServer(QString))); + this, SLOT(setCurrentServer(QString))); connect(network, SIGNAL(ircChannelAdded(IrcChannel *)), - this, SLOT(attachIrcChannel(IrcChannel *))); + this, SLOT(attachIrcChannel(IrcChannel *))); connect(network, SIGNAL(ircUserAdded(IrcUser *)), - this, SLOT(attachIrcUser(IrcUser *))); + this, SLOT(attachIrcUser(IrcUser *))); connect(network, SIGNAL(connectedSet(bool)), - this, SIGNAL(networkDataChanged())); + this, SIGNAL(networkDataChanged())); connect(network, SIGNAL(destroyed()), - this, SIGNAL(networkDataChanged())); + this, SIGNAL(networkDataChanged())); emit networkDataChanged(); } @@ -191,8 +190,8 @@ void NetworkItem::setCurrentServer(const QString &serverName) { QString NetworkItem::toolTip(int column) const { Q_UNUSED(column); - QStringList toolTip(QString("%1").arg(networkName())); - toolTip.append(tr("Server: %1").arg(currentServer())); + QStringList toolTip(QString("%1").arg(Qt::escape(networkName()))); + toolTip.append(tr("Server: %1").arg(Qt::escape(currentServer()))); toolTip.append(tr("Users: %1").arg(nickCount())); if(_network) { @@ -253,7 +252,7 @@ void BufferItem::updateActivityLevel(const Message &msg) { stateChanged = true; _firstUnreadMsgId = msg.msgId(); } - + BufferInfo::ActivityLevel oldLevel = activityLevel(); _activity |= BufferInfo::OtherActivity; @@ -380,10 +379,10 @@ bool QueryBufferItem::setData(int column, const QVariant &value, int role) { { QString newName = value.toString(); if(!newName.isEmpty()) { - Client::renameBuffer(bufferId(), newName); - return true; + Client::renameBuffer(bufferId(), newName); + return true; } else { - return false; + return false; } } break; @@ -479,7 +478,7 @@ QString ChannelBufferItem::toolTip(int column) const { Q_UNUSED(column); QStringList toolTip; - toolTip.append(tr("Channel %1").arg(bufferName())); + toolTip.append(tr("Channel %1").arg(Qt::escape(bufferName()))); if(isActive()) { //TODO: add channel modes toolTip.append(tr("Users: %1").arg(nickCount())); @@ -489,14 +488,13 @@ QString ChannelBufferItem::toolTip(int column) const { toolTip.append(tr("Mode: %1").arg(channelMode)); } - BufferSettings s; - bool showTopic = s.value("DisplayTopicInTooltip", QVariant(false)).toBool(); + ItemViewSettings s; + bool showTopic = s.displayTopicInTooltip(); if(showTopic) { QString _topic = topic(); if(_topic != "") { _topic = stripFormatCodes(_topic); - _topic.replace(QString("<"), QString("<")); - _topic.replace(QString(">"), QString(">")); + _topic = Qt::escape(_topic); toolTip.append(QString(" ")); toolTip.append(tr("Topic: %1").arg(_topic)); } @@ -514,19 +512,19 @@ void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel) { _ircChannel = ircChannel; connect(ircChannel, SIGNAL(topicSet(QString)), - this, SLOT(setTopic(QString))); + this, SLOT(setTopic(QString))); connect(ircChannel, SIGNAL(ircUsersJoined(QList)), - this, SLOT(join(QList))); + this, SLOT(join(QList))); connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)), - this, SLOT(part(IrcUser *))); + this, SLOT(part(IrcUser *))); connect(ircChannel, SIGNAL(parted()), - this, SLOT(ircChannelParted())); + this, SLOT(ircChannelParted())); connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); + this, SLOT(userModeChanged(IrcUser *))); connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); + this, SLOT(userModeChanged(IrcUser *))); connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); + this, SLOT(userModeChanged(IrcUser *))); if(!ircChannel->ircUsers().isEmpty()) join(ircChannel->ircUsers()); @@ -614,7 +612,7 @@ void ChannelBufferItem::removeUserFromCategory(IrcUser *ircUser) { categoryItem = qobject_cast(child(i)); if(categoryItem->removeUser(ircUser)) { if(categoryItem->childCount() == 0) - removeChild(i); + removeChild(i); break; } } @@ -816,9 +814,9 @@ NetworkModel::NetworkModel(QObject *parent) : TreeModel(NetworkModel::defaultHeader(), parent) { connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(checkForNewBuffers(const QModelIndex &, int, int))); + this, SLOT(checkForNewBuffers(const QModelIndex &, int, int))); connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(checkForRemovedBuffers(const QModelIndex &, int, int))); + this, SLOT(checkForRemovedBuffers(const QModelIndex &, int, int))); BufferSettings defaultSettings; defaultSettings.notify("UserNoticesTarget", this, SLOT(messageRedirectionSettingsChanged())); @@ -829,7 +827,7 @@ NetworkModel::NetworkModel(QObject *parent) QListNetworkModel::defaultHeader() { QList data; - data << tr("Buffer") << tr("Topic") << tr("Nick Count"); + data << tr("Chat") << tr("Topic") << tr("Nick Count"); return data; } @@ -1015,10 +1013,10 @@ void NetworkModel::updateBufferActivity(Message &msg) { if(bufferType(msg.bufferId()) != BufferInfo::ChannelBuffer) { msg.setFlags(msg.flags() | Message::Redirected); if(msg.flags() & Message::ServerMsg) { - // server notice - redirectionTarget = _serverNoticesTarget; + // server notice + redirectionTarget = _serverNoticesTarget; } else { - redirectionTarget = _userNoticesTarget; + redirectionTarget = _userNoticesTarget; } } break; @@ -1047,7 +1045,7 @@ void NetworkModel::updateBufferActivity(Message &msg) { if(redirectionTarget & BufferSettings::StatusBuffer) { const NetworkItem *netItem = findNetworkItem(msg.bufferInfo().networkId()); if(netItem) { - updateBufferActivity(netItem->statusBufferItem(), msg); + updateBufferActivity(netItem->statusBufferItem(), msg); } } } else {