void MessageFolder::openMailbox() { if (QMailStore* store = QMailStore::instance()) { if (!mFolder.id().isValid()) { QMailFolderKey key(QMailFolderKey::Name,mailbox()); key &= QMailFolderKey(QMailFolderKey::ParentId,QMailFolderId()); QMailFolderIdList folderIdList = QMailStore::instance()->queryFolders(key); if(folderIdList.isEmpty()) { // create folder QMailFolder newFolder(mailbox()); if(!QMailStore::instance()->addFolder(&newFolder)) qWarning() << "Failed to add folder " << mailbox(); mFolder = newFolder; } else { // load folder QMailFolderId folderId = folderIdList.first(); mFolder = QMailFolder(folderId); } //set the folder key mParentFolderKey = QMailMessageKey(QMailMessageKey::ParentFolderId,mFolder.id()); } // notify when our content is reported to have changed connect(store, SIGNAL(folderContentsModified(QMailFolderIdList)), this, SLOT(folderContentsModified(QMailFolderIdList))); } }
void AccountSettings::testConfiguration() { QModelIndex index(accountView->currentIndex()); if (index.isValid()) { QMailAccountId id(accountModel->idFromIndex(index)); QMailAccount account(id); if (account.status() & (QMailAccount::MessageSource | QMailAccount::MessageSink)) { // See if the user wants to test the configuration for this account if (QMessageBox::question(this, preExisting ? tr("Account Modified") : tr("Account Added"), tr("Do you wish to test the configuration for this account?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { statusDisplay->setVisible(true); statusDisplay->setStatus(tr("Testing configuration...")); if (account.status() & QMailAccount::MessageSource) { retrievalAction->retrieveFolderList(id, QMailFolderId(), true); } else if (account.status() & QMailAccount::MessageSink) { transmitAction->transmitMessages(id); } } } } }
/*! Returns the folder configured for the standard folder role \a folder for this account, if there is one. \sa setStandardFolder() */ QMailFolderId QMailAccount::standardFolder(QMailFolder::StandardFolder folder) const { const QMap<QMailFolder::StandardFolder, QMailFolderId>::const_iterator it = d->_standardFolders.find(folder); if (it != d->_standardFolders.end()) return it.value(); return QMailFolderId(); }
void AccountInfo::testAccountConfiguration() { if (m_account->status() & (QMailAccount::MessageSource | QMailAccount::MessageSink)) { if (m_account->status() & QMailAccount::MessageSource) { m_retrievalAction->retrieveFolderList(m_account->id(), QMailFolderId(), true); } else if (m_account->status() & QMailAccount::MessageSink) { m_transmitAction->transmitMessages(m_account->id()); } } }
/*! Sets the folder configured for the standard folder role \a folder for this account to \a folderId. \sa standardFolder() */ void QMailAccount::setStandardFolder(QMailFolder::StandardFolder folder, const QMailFolderId &folderId) { if (folder == QMailFolder::OutboxFolder) { qWarning() << "Cannot configure Outbox for account!"; } else { if (folderId == QMailFolderId()) { // Resetting to default d->_standardFolders.remove(folder); } else { d->_standardFolders.insert(folder, folderId); } } }
void FolderListModel::setCurrentFolderIdx(int folderIdx) { if (folderIdx >= m_folderList.count()) { qCWarning(lcGeneral) << Q_FUNC_INFO << " Can't set Invalid Index: " << folderIdx; } if (folderIdx != m_currentFolderIdx) { m_currentFolderIdx = folderIdx; m_currentFolderType = static_cast<FolderListModel::FolderStandardType>(folderType(m_currentFolderIdx).toInt()); m_currentFolderUnreadCount = folderUnreadCount(m_currentFolderIdx); m_currentFolderId = QMailFolderId(folderId(m_currentFolderIdx)); emit currentFolderIdxChanged(); emit currentFolderUnreadCountChanged(); } }
void ActionFolderModel::init() { // Add the 'compose' action append(new ComposeActionMessageSet(this, tr("New message"))); // Add the standard folders foreach (QMailFolder::StandardFolder identifier, QList<QMailFolder::StandardFolder>() << QMailFolder::InboxFolder << QMailFolder::SentFolder << QMailFolder::DraftsFolder << QMailFolder::TrashFolder << QMailFolder::OutboxFolder) append(new ActionFolderMessageSet(this, QMailFolderId(identifier), false)); // Add the 'email' action append(new EmailActionMessageSet(this, tr("Email"))); loadCachedNames(); }
QMailFolderId convert(const QMessageFolderId &id) { return QMailFolderId(stripIdentifierPrefix(id.toString()).toULongLong()); }