Ejemplo n.º 1
0
QModelIndex FolderListView::systemFolderIndex(const QString& identifier) const
{
    bool search = (identifier == MailboxList::LastSearchString);

    QModelIndex index = model()->index( 0, 0 );
    for ( ; index.isValid(); index = next( index ) ) {
        Folder* folder = folderItemFromIndex( index )->folder();
        if ( folder->folderType() == FolderTypeSystem ) {
            if ( (search && static_cast<SystemFolder*>(folder)->isSearch()) ||
                 (folder->mailbox() == identifier) ) {
                break;
            }
        }
    }

    return index;
}