Skip to content

Instantly share code, notes, and snippets.

@kovrov
Created July 21, 2011 13:53
Show Gist options
  • Save kovrov/1097233 to your computer and use it in GitHub Desktop.
Save kovrov/1097233 to your computer and use it in GitHub Desktop.
QMF query threads
QMailStore *store = QMailStore::instance();
QMailAccountIdList accounts = store->queryAccounts();
QMailAccount account = QMailAccount(accounts[0]);
QMailFolderId folder_id = account.standardFolder(QMailFolder::InboxFolder);
QMailMessageKey folder_key = QMailMessageKey::parentFolderId(folder_id);
QMailThreadKey select_key = QMailThreadKey::includes(folder_key);
// we can only sort by id or serverUid ?
QMailThreadSortKey sort_key = QMailThreadSortKey::id(Qt::AscendingOrder);
QMailThreadIdList list = store->queryThreads(select_key, sort_key);
class QMailThreadModel : public QAbstractItemModel
{
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex parent(const QModelIndex &index) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
void setKey(const QMailThreadKey &key);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment