bool MtpStoragesModel::update(const mtp::SessionPtr &session)
{
	beginResetModel();
	_storages.clear();
	mtp::msg::StorageIDs storages = session->GetStorageIDs();
	for(auto id : storages.StorageIDs)
	{
		mtp::msg::StorageInfo info = session->GetStorageInfo(id);
		_storages.append(qMakePair(id, info));
	}
	mtp::msg::StorageInfo anyStorage;
	anyStorage.StorageDescription = toUtf8(tr("All storages (BUGS, BEWARE)"));
	_storages.append(qMakePair((mtp::u32)mtp::Session::AllStorages, anyStorage));
	endResetModel();
	return !storages.StorageIDs.empty();
}
bool MtpStoragesModel::update(const mtp::SessionPtr &session)
{
	beginResetModel();
	_storages.clear();
	mtp::msg::StorageIDs storages = session->GetStorageIDs();
	for(auto id : storages.StorageIDs)
	{
		mtp::msg::StorageInfo info;
		try { info = session->GetStorageInfo(id); }
		catch (const mtp::InvalidResponseException &ex)
		{
			if (ex.Type == mtp::ResponseType::InvalidStorageID)
				return false;
			else
				throw;
		}
		_storages.append(qMakePair(id, info));
	}
	mtp::msg::StorageInfo anyStorage;
	anyStorage.StorageDescription = toUtf8(tr("All storages (BUGS, BEWARE)"));
	_storages.append(qMakePair((mtp::u32)mtp::Session::AllStorages, anyStorage));
	endResetModel();
	return !storages.StorageIDs.empty();
}