X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fcoreaccountmodel.cpp;h=04ee15f566ce28564b7c2d42254daa967b90cb1f;hb=8582c2ad5708a1972c85bea1cf8d81ad3ece4814;hp=5fab6d90a65b674d7f72e85b4f9cf3b9b924d298;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/client/coreaccountmodel.cpp b/src/client/coreaccountmodel.cpp index 5fab6d90..04ee15f5 100644 --- a/src/client/coreaccountmodel.cpp +++ b/src/client/coreaccountmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -87,12 +87,10 @@ void CoreAccountModel::save() void CoreAccountModel::clear() { - if (rowCount()) { - beginRemoveRows(QModelIndex(), 0, rowCount()-1); - _internalAccount = 0; - _accounts.clear(); - endRemoveRows(); - } + beginResetModel(); + _internalAccount = 0; + _accounts.clear(); + endResetModel(); } @@ -155,6 +153,12 @@ bool CoreAccountModel::operator==(const CoreAccountModel &other) const } +bool CoreAccountModel::operator!=(const CoreAccountModel &other) const +{ + return !(*this == other); +} + + // TODO with Qt 4.6, use QAbstractItemModel move semantics to properly do this AccountId CoreAccountModel::createOrUpdateAccount(const CoreAccount &newAcc) { @@ -246,7 +250,7 @@ QModelIndex CoreAccountModel::accountIndex(AccountId accId) const if (_accounts.at(i).accountId() == accId) return index(i, 0); } - return QModelIndex(); + return {}; }