コード例 #1
0
// current strategy: Fetch 100 items per Account
// ATTENTION: This method is const and thus it is not possible to modify
// the _activityLists hash or so. Doesn't make it easier...
bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{
    if( _activityLists.count() == 0 ) return true;

    for(auto i = _activityLists.begin() ; i != _activityLists.end(); ++i) {
        AccountState *ast = i.key();
        if( ast && ast->isConnected() ) {
            ActivityList activities = i.value();
            if( activities.count() == 0 &&
                    ! _currentlyFetching.contains(ast) ) {
                return true;
            }
        }
    }

    return false;
}
コード例 #2
0
// current strategy: Fetch 100 items per Account
bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{
    if( _activityLists.count() == 0 ) return true;

    QMap<AccountState*, ActivityList>::const_iterator i = _activityLists.begin();
    while (i != _activityLists.end()) {
        AccountState *ast = i.key();
        if( !ast->isConnected() ) {
            return false;
        }
        ActivityList activities = i.value();
        if( activities.count() == 0 &&
                ! _currentlyFetching.contains(ast) ) {
            return true;
        }
        ++i;
    }

    return false;
}