AttachmentListModel::AttachmentListModel(QObject *parent) :
    QAbstractListModel(parent)
  , m_messageId(QMailMessageId())
{
    roles.insert(ContentLocation, "contentLocation");
    roles.insert(DisplayName, "displayName");
    roles.insert(Downloaded, "downloaded");
    roles.insert(MimeType, "mimeType");
    roles.insert(Size, "size");
    roles.insert(StatusInfo, "statusInfo");
    roles.insert(Url, "url");
    roles.insert(ProgressInfo, "progressInfo");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(roles);
#endif

    connect(EmailAgent::instance(), SIGNAL(attachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus)),
            this, SLOT(onAttachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus)));

    connect(EmailAgent::instance(), SIGNAL(attachmentDownloadProgressChanged(QString,int)),
            this, SLOT(onAttachmentDownloadProgressChanged(QString,int)));

    connect(EmailAgent::instance(), SIGNAL(attachmentUrlChanged(QString,QString)),
            this, SLOT(onAttachmentUrlChanged(QString,QString)));
}
Example #2
0
bool MessageFolder::copyMessage(const QMailMessageId& id)
{
    QMailMessage message(id);

    message.setId(QMailMessageId()); //reset id
    message.setParentFolderId(mFolder.id());
    return QMailStore::instance()->addMessage(&message);
}
QMailMessageId QMailMessageListModelPrivate::idFromIndex(const QModelIndex& index) const
{
    init();

    if (index.isValid()) {
        int row = index.row();
        if ((row >= 0) && (row < _idList.count())) {
            return _idList.at(row);
        }
    }

    return QMailMessageId();
}
Example #4
0
void WriteMail::reset()
{
    mail = QMailMessage();

    if (m_composerInterface) {
        // Remove any associated widgets
        m_widgetStack->removeWidget(m_composerInterface);
        m_composerInterface = 0;
    }

    m_hasMessageChanged = false;
    m_precursorId = QMailMessageId();
    m_replyAction = QMailMessage::NoResponse;
}
Example #5
0
QMailMessageId convert(const QMessageId &id)
{
    return QMailMessageId(stripIdentifierPrefix(id.toString()).toULongLong());
}
void AttachmentListModel::setMessageId(int id)
{
    m_messageId = QMailMessageId(id);
    m_message = QMailMessage(m_messageId);
    resetModel();
}