X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.cpp;h=5daec856559992fe4fbd9e7c0ea43afdbb17ee6c;hp=821496624cf27511e33b005f7c2aff01723e8003;hb=1a45f16a9734820fba42fe1db3f38dd1eee49df6;hpb=88ce73ff525535c00cc979fff357fbe4cb8cdc2b diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 82149662..5daec856 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -22,9 +22,6 @@ #include #include -#if QT_VERSION < 0x050000 -#include // for Qt::escape() -#endif #include "buffermodel.h" #include "buffersettings.h" @@ -40,7 +37,7 @@ * Network Items *****************************************/ NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent) - : PropertyMapItem(QList() << "networkName" << "currentServer" << "nickCount", parent), + : PropertyMapItem(parent), _networkId(netid), _statusBufferItem(0) { @@ -53,6 +50,13 @@ NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent) } +QStringList NetworkItem::propertyOrder() const +{ + static QStringList order{"networkName", "currentServer", "nickCount"}; + return order; +} + + QVariant NetworkItem::data(int column, int role) const { switch (role) { @@ -79,11 +83,7 @@ QString NetworkItem::escapeHTML(const QString &string, bool useNonbreakingSpaces { // QString.replace() doesn't guarantee the source string will remain constant. // Use a local variable to avoid compiler errors. -#if QT_VERSION < 0x050000 - QString formattedString = Qt::escape(string); -#else QString formattedString = string.toHtmlEscaped(); -#endif return (useNonbreakingSpaces ? formattedString.replace(" ", " ") : formattedString); } @@ -283,7 +283,7 @@ void NetworkItem::onNetworkDestroyed() * Fancy Buffer Items *****************************************/ BufferItem::BufferItem(const BufferInfo &bufferInfo, AbstractTreeItem *parent) - : PropertyMapItem(QStringList() << "bufferName" << "topic" << "nickCount", parent), + : PropertyMapItem(parent), _bufferInfo(bufferInfo), _activity(BufferInfo::NoActivity) { @@ -291,6 +291,13 @@ BufferItem::BufferItem(const BufferInfo &bufferInfo, AbstractTreeItem *parent) } +QStringList BufferItem::propertyOrder() const +{ + static QStringList order{"bufferName", "topic", "nickCount"}; + return order; +} + + void BufferItem::setActivityLevel(BufferInfo::ActivityLevel level) { if (_activity != level) { @@ -641,8 +648,8 @@ QString QueryBufferItem::toolTip(int column) const NetworkItem::escapeHTML(tr("Identified for this nick")), !accountAdded); // Don't add the account row again if information's already added via account-notify - // Mark the row as added - accountAdded = true; + // Not used further down... + // accountAdded = true; } else { addRow(NetworkItem::escapeHTML(tr("Service Reply"), true), NetworkItem::escapeHTML(_ircUser->whoisServiceReply()), @@ -992,7 +999,7 @@ void ChannelBufferItem::userModeChanged(IrcUser *ircUser) const QList UserCategoryItem::categories = QList() << 'q' << 'a' << 'o' << 'h' << 'v'; UserCategoryItem::UserCategoryItem(int category, AbstractTreeItem *parent) - : PropertyMapItem(QStringList() << "categoryName", parent), + : PropertyMapItem(parent), _category(category) { setFlags(Qt::ItemIsEnabled); @@ -1001,6 +1008,13 @@ UserCategoryItem::UserCategoryItem(int category, AbstractTreeItem *parent) } +QStringList UserCategoryItem::propertyOrder() const +{ + static QStringList order{"categoryName"}; + return order; +} + + // caching this makes no sense, since we display the user number dynamically QString UserCategoryItem::categoryName() const { @@ -1094,7 +1108,7 @@ QVariant UserCategoryItem::data(int column, int role) const * Irc User Items *****************************************/ IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent) - : PropertyMapItem(QStringList() << "nickName", parent), + : PropertyMapItem(parent), _ircUser(ircUser) { setObjectName(ircUser->nick()); @@ -1104,6 +1118,13 @@ IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent) } +QStringList IrcUserItem::propertyOrder() const +{ + static QStringList order{"nickName"}; + return order; +} + + QVariant IrcUserItem::data(int column, int role) const { switch (role) { @@ -1208,8 +1229,8 @@ QString IrcUserItem::toolTip(int column) const NetworkItem::escapeHTML(tr("Identified for this nick")), !accountAdded); // Don't add the account row again if information's already added via account-notify - // Mark the row as added - accountAdded = true; + // Not used further down... + // accountAdded = true; } else { addRow(NetworkItem::escapeHTML(tr("Service Reply"), true), NetworkItem::escapeHTML(_ircUser->whoisServiceReply()),