bool AccountManager::isAccountIdAvailable(const QString &id) const
{
- const auto it = std::find_if(_accounts.cbegin(), _accounts.cend(), [id](const auto &acc) {
+ return std::none_of(_accounts.cbegin(), _accounts.cend(), [id](const auto &acc) {
return acc->account()->id() == id;
});
- return it == _accounts.cend();
}
QString AccountManager::generateFreeAccountId() const
// where two folders for different accounts point at the same
// local folders.
const auto folderMap = FolderMan::instance()->map();
- const auto it = std::find_if(folderMap.cbegin(), folderMap.cend(), [this](const auto *other) {
+ const auto oneAccountOnly = std::none_of(folderMap.cbegin(), folderMap.cend(), [this](const auto *other) {
return other != this && other->cleanPath() == this->cleanPath();
});
- bool oneAccountOnly = it == folderMap.cend();
bool compatible = _saveBackwardsCompatible || oneAccountOnly;
if (compatible) {
// Migration: The first account that's configured for a local folder shall
// be saved in a backwards-compatible way.
const auto folderList = FolderMan::instance()->map();
- const auto it = std::find_if(folderList.cbegin(), folderList.cend(), [this, folder](const auto *other) {
+ const auto oneAccountOnly = std::none_of(folderList.cbegin(), folderList.cend(), [this, folder](const auto *other) {
return other != folder && other->cleanPath() == folder->cleanPath();
});
- bool oneAccountOnly = it == folderList.cend();
folder->setSaveBackwardsCompatible(oneAccountOnly);
if (folder) {