Example #1
0
QModelIndex FolderListView::accountFolderIndex(const Folder* account, const QString& mailbox) const
{
    QModelIndex index = model()->index( 0, 0 );
    for ( ; index.isValid(); index = next( index ) ) {
        FolderListItem* item = folderItemFromIndex( index );
        Folder* folder = item->folder();
        if ( ( mailbox.isNull() &&
               (folder == account) ) ||
             ( (folder->folderType() == FolderTypeMailbox) &&
               (static_cast<Mailbox*>(folder)->pathName() == mailbox) &&
               (itemAccount(item) == account) ) ) {
            break;
        }
    }

    return index;
}
Example #2
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;
}