X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=c49d11905013a51329b4e1d9ecc9cb026843ffd4;hb=bbe4e00c72ef57febad268b6937d950c01969a54;hp=00811d835442a73b7376b5676750b0838e251560;hpb=40601ae070413b727a68e35e5b8c619176c661b1;p=quassel.git diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 00811d83..c49d1190 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2015 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -22,7 +22,9 @@ #include #include +#if QT_VERSION < 0x050000 #include // for Qt::escape() +#endif #include "buffermodel.h" #include "buffersettings.h" @@ -209,8 +211,13 @@ QString NetworkItem::toolTip(int column) const { Q_UNUSED(column); +#if QT_VERSION < 0x050000 QStringList toolTip(QString("%1").arg(Qt::escape(networkName()))); toolTip.append(tr("Server: %1").arg(Qt::escape(currentServer()))); +#else + QStringList toolTip(QString("%1").arg(networkName().toHtmlEscaped())); + toolTip.append(tr("Server: %1").arg(currentServer().toHtmlEscaped())); +#endif toolTip.append(tr("Users: %1").arg(nickCount())); if (_network) { @@ -456,6 +463,12 @@ bool QueryBufferItem::setData(int column, const QVariant &value, int role) case Qt::EditRole: { QString newName = value.toString(); + + // Sanity check - buffer names must not contain newlines! + int nlpos = newName.indexOf('\n'); + if (nlpos >= 0) + newName = newName.left(nlpos); + if (!newName.isEmpty()) { Client::renameBuffer(bufferId(), newName); return true; @@ -572,7 +585,11 @@ QString ChannelBufferItem::toolTip(int column) const Q_UNUSED(column); QStringList toolTip; +#if QT_VERSION < 0x050000 toolTip.append(tr("Channel %1").arg(Qt::escape(bufferName()))); +#else + toolTip.append(tr("Channel %1").arg(bufferName().toHtmlEscaped())); +#endif if (isActive()) { //TODO: add channel modes toolTip.append(tr("Users: %1").arg(nickCount())); @@ -588,7 +605,11 @@ QString ChannelBufferItem::toolTip(int column) const QString _topic = topic(); if (_topic != "") { _topic = stripFormatCodes(_topic); +#if QT_VERSION < 0x050000 _topic = Qt::escape(_topic); +#else + _topic = _topic.toHtmlEscaped(); +#endif toolTip.append(QString(" ")); toolTip.append(tr("Topic: %1").arg(_topic)); } @@ -708,7 +729,7 @@ void ChannelBufferItem::addUsersToCategory(const QList &ircUsers) QHash >::const_iterator catIter = categories.constBegin(); while (catIter != categories.constEnd()) { catIter.key()->addUsers(catIter.value()); - catIter++; + ++catIter; } } @@ -1264,7 +1285,8 @@ void NetworkModel::updateBufferActivity(Message &msg) } } else { - updateBufferActivity(bufferItem(msg.bufferInfo()), msg); + if ((BufferSettings(msg.bufferId()).messageFilter() & msg.type()) != msg.type()) + updateBufferActivity(bufferItem(msg.bufferInfo()), msg); } }