const int numParams = params.size();
if(numParams < 1) {
qWarning() << "IrcServerHandler::handle005(): received RPL_ISUPPORT (005) with too few parameters:" << serverDecode(params);
- return;
}
QString rpl_isupport_suffix = serverDecode(params.last());
emit putCmd("LIST", serverEncode(msg.split(' ', QString::SkipEmptyParts)));
}
-
void UserInputHandler::handleMe(const BufferInfo &bufferInfo, const QString &msg) {
if(bufferInfo.bufferName().isEmpty()) return; // server buffer
networkConnection()->ctcpHandler()->query(bufferInfo.bufferName(), "ACTION", msg);
void UserInputHandler::handleMode(const BufferInfo &bufferInfo, const QString &msg) {
Q_UNUSED(bufferInfo)
+
+ QStringList params = msg.split(' ', QString::SkipEmptyParts);
+ // if the first argument is neither a channel nor us (user modes are only to oneself) the current buffer is assumed to be the target
+ if(!params.isEmpty() && !network()->isChannelName(params[0]) && !network()->isMyNick(params[0]))
+ params.prepend(bufferInfo.bufferName());
+
// TODO handle correct encoding for buffer modes (channelEncode())
- emit putCmd("MODE", serverEncode(msg.split(' ', QString::SkipEmptyParts)));
+ emit putCmd("MODE", serverEncode(params));
}
// TODO: show privmsgs
*****************************************/
BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config)
: QSortFilterProxyModel(model),
- _config(0)
+ _config(0),
+ _sortOrder(Qt::AscendingOrder)
{
setConfig(config);
setSourceModel(model);
if(droppedNetworkId == networkId) {
if(row < 0)
row = 0;
+
if(row < rowCount(parent)) {
BufferId beforeBufferId = parent.child(row, 0).data(NetworkModel::BufferIdRole).value<BufferId>();
pos = config()->bufferList().indexOf(beforeBufferId);
+ if(_sortOrder == Qt::DescendingOrder)
+ pos++;
} else {
- pos = config()->bufferList().count();
+ if(_sortOrder == Qt::AscendingOrder)
+ pos = config()->bufferList().count();
+ else
+ pos = 0;
}
if(config()->bufferList().contains(bufferId)) {
return true;
}
+void BufferViewFilter::sort(int column, Qt::SortOrder order) {
+ _sortOrder = order;
+ QSortFilterProxyModel::sort(column, order);
+}
+
void BufferViewFilter::addBuffer(const BufferId &bufferId) const {
if(!config() || config()->bufferList().contains(bufferId))
return;
void setConfig(BufferViewConfig *config);
inline BufferViewConfig *config() const { return _config; }
+ virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+
public slots:
void checkPreviousCurrentForRemoval(const QModelIndex ¤t, const QModelIndex &previous);
void checkItemForRemoval(const QModelIndex &index) { checkItemsForRemoval(index, index); }
private:
QPointer<BufferViewConfig> _config;
+ Qt::SortOrder _sortOrder;
QColor _FgColorInactiveActivity;
QColor _FgColorNoActivity;