当前位置: 首页>>代码示例>>C++>>正文


C++ QMailMessage类代码示例

本文整理汇总了C++中QMailMessage的典型用法代码示例。如果您正苦于以下问题:C++ QMailMessage类的具体用法?C++ QMailMessage怎么用?C++ QMailMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QMailMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prepareComposer

void WriteMail::modify(const QMailMessage& previousMessage)
{
    QString recipients = "";

    prepareComposer(previousMessage.messageType(), previousMessage.parentAccountId());
    if (composer().isEmpty())
        return;

    // Record any message properties we should retain
    mail.setId(previousMessage.id());
    mail.setParentFolderId(previousMessage.parentFolderId());
    mail.setContentScheme(previousMessage.contentScheme());
    mail.setContentIdentifier(previousMessage.contentIdentifier());
    mail.setTo(previousMessage.to());
    mail.setFrom(previousMessage.from());
    mail.setCustomFields(previousMessage.customFields());
    mail.setServerUid(previousMessage.serverUid());

    m_composerInterface->compose(QMailMessage::NoResponse, previousMessage);

    // ugh. we need to do this everywhere
    m_hasMessageChanged = false;
    m_precursorId = mail.inResponseTo();
    m_replyAction = mail.responseType();
}
开发者ID:qt-labs,项目名称:messagingframework,代码行数:25,代码来源:writemail.cpp

示例2: matches

// organized after lest expensive search
bool Search::matches(const QMailMessage& in) const
{
    if ( !matchesStatus(in) )
        return false;

    if ( !matchesAccount(in) )
        return false;
    if ( !matchesFolder(in) )
        return false;

    if ( !match(fromMail, in.from().toString() ) )
        return false;

    if ( !matchesTo(in) )
        return false;

    if ( !match(subject, in.subject() ) )
        return false;

    if ( !matchesBeforeDate(in) )
        return false;
    if ( !matchesAfterDate(in) )
        return false;

    if ( !matchesBody(in) )
        return false;

    return true;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:30,代码来源:search.cpp

示例3: insertMessage

bool MessageFolder::insertMessage(QMailMessage &message)
{
    message.setParentFolderId(mFolder.id());

    if (message.id().isValid()) {
        return QMailStore::instance()->updateMessage(&message);
    } else {
        return QMailStore::instance()->addMessage(&message);
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:10,代码来源:messagefolder.cpp

示例4: respond

void WriteMail::respond(const QMailMessage& source, QMailMessage::ResponseType type)
{
    prepareComposer(source.messageType(), source.parentAccountId());
    if (composer().isEmpty())
        return;

    m_composerInterface->compose(type, source);
    m_hasMessageChanged = true;
    m_precursorId = source.id();
    m_replyAction = type;
}
开发者ID:qt-labs,项目名称:messagingframework,代码行数:11,代码来源:writemail.cpp

示例5: switch

bool Search::matchesStatus(const QMailMessage& mail) const
{
    switch( _status ) {
        case Any:       return true;
        case Read:      return ( mail.status() & (QMailMessage::Read | QMailMessage::ReadElsewhere) );
        case Unread:    return ( !(mail.status() & (QMailMessage::Read | QMailMessage::ReadElsewhere)) );
        case Replied:   return ( (mail.status() & QMailMessage::Replied) 
                                 || (mail.status() & QMailMessage::RepliedAll) );
    }

    return false;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:12,代码来源:search.cpp

示例6: matchesFolder

bool Search::matchesFolder(const QMailMessage& mail) const
{
    if ( folder.isEmpty() )
        return true;

    return ( folder == mail.fromMailbox() );
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:7,代码来源:search.cpp

示例7: matchesBody

/*  Reading entire mailbox is very slow on a large mailbox  */
bool Search::matchesBody(const QMailMessage& mail) const
{
    if ( body.isEmpty() )
        return true;

    return match(body, mail.body().data());
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:8,代码来源:search.cpp

示例8: bodyPlainText

QString EmailMessageListModel::bodyPlainText(const QMailMessage &mailMsg) const
{
    if (QMailMessagePartContainer *container = mailMsg.findPlainTextContainer()) {
        return container->body().data();
    }

    return QString();
}
开发者ID:adenexter,项目名称:nemo-qml-plugins,代码行数:8,代码来源:emailmessagelistmodel.cpp

示例9: connect

void ConversationPage::processAttachments(const QMailMessage &message)
{
    if (!message.status() & QMailMessageMetaData::HasAttachments)
        return;

    connect(this, SIGNAL(downloadCompleted()), this, SLOT(saveAttachment()));

    bool oneTimeFlag = true;
    for (uint i = 1; i < message.partCount(); ++i)
    {
        QMailMessagePart sourcePart = message.partAt(i);
        if (!(sourcePart.multipartType() == QMailMessagePartContainer::MultipartNone))
            continue;

        if (oneTimeFlag)
        {
            MSeparator *separator = new MSeparator();
            separator->setObjectName("Separator");
            m_policy->addItem(separator);
            oneTimeFlag = false;
        }

        MStylableWidget *w = new MStylableWidget(this);
        QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal);
        w->setLayout(layout);
        //% "Attached: "
        MLabel *label = new MLabel(qtTrId("xx_attached"));
        label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        label->setObjectName ("AttachmentText");
        layout->addItem(label);
        MButton *button = new MButton(sourcePart.displayName());
        button->setObjectName ("AttachmentButton");
        button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        layout->addItem(button);

        //% "Download..."
        AttachmentAction *action = new AttachmentAction(qtTrId("xx_download_context_menu"), button, sourcePart);
        connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentDownloadDialog()));

        //% "Open..."
        action = new AttachmentAction(qtTrId("xx_open_context_menu"), button, sourcePart);
        connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentOpenDialog()));
        m_policy->addItem (w);
    }
}
开发者ID:dudochkin-victor,项目名称:handset-email,代码行数:45,代码来源:conversationpage.cpp

示例10: matchesAccount

bool Search::matchesAccount(const QMailMessage& mail) const
{
    if ( fromAccount.isEmpty() )
        return true;
    if (fromAccount == mail.fromAccount() )
        return true;

    return false;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:9,代码来源:search.cpp

示例11: matchesTo

/*  TODO:  We should swap the mail in to get the full to, cc and bcc
    lists.  Only to.first() are currently cached.  Reading all the mails
    from disk are currently to slow a process though
*/
bool Search::matchesTo(const QMailMessage& mail) const
{
    if ( recipient.isEmpty() )
        return true;

    foreach (const QMailAddress& address, mail.to())
        if ( match( recipient, address.toString() ) )
            return true;

    return false;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:15,代码来源:search.cpp

示例12: setText

void EmailComposerInterface::setMessage( const QMailMessage &mail )
{
    if (mail.multipartType() == QMailMessagePartContainer::MultipartNone) {
        if (mail.hasBody())
            setText( mail.body().data(), mail.contentType().content() );
    } else {
        // The only type of multipart message we currently compose is Mixed, with
        // all but the first part as out-of-line attachments
        int textPart = -1;
        for ( uint i = 0; i < mail.partCount(); ++i ) {
            QMailMessagePart &part = const_cast<QMailMessagePart&>(mail.partAt(i));
            
            if (textPart == -1 && part.contentType().type().toLower() == "text") {
                // This is the first text part, we will use as the forwarded text body
                textPart = i;
            } else {
                QString attPath = part.attachmentPath();
                QMailMessage::AttachmentsAction action = QMailMessage::LinkToAttachments;

                // Detach the part data to a temporary file if necessary
                if (attPath.isEmpty()) {
                    if (part.detachAttachment(Qtopia::tempDir())) {
                        attPath = part.attachmentPath();
                        action = QMailMessage::CopyAttachments;

                        // Create a content object for the file
                        QContent doc(attPath);

                        if (part.hasBody()) {
                            QMailMessageContentType type(part.contentType());

                            if (doc.drmState() == QContent::Unprotected)
                                doc.setType(type.content());
                        }

                        doc.setName(part.displayName());
                        doc.setRole(QContent::Data);

                        doc.commit();

                        // This needs to be removed after composition
                        m_temporaries.append(doc);
                    }
                }

                if (!attPath.isEmpty())
                    attach(attPath, action);
            }
        }

        if (textPart != -1) {
            const QMailMessagePart& part = mail.partAt(textPart);
            setText( part.body().data(), part.contentType().content() );
        }
    }
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:56,代码来源:emailcomposer.cpp

示例13: attachmentUrl

QString AttachmentListModel::attachmentUrl(const QMailMessage message, const QString &attachmentLocation)
{
    QString attachmentDownloadFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/mail_attachments/" + attachmentLocation;
    for (uint i = 0; i < message.partCount(); i++) {
        QMailMessagePart sourcePart = message.partAt(i);
        if (attachmentLocation == sourcePart.location().toString(true)) {
            QString attachmentPath = attachmentDownloadFolder + "/" + sourcePart.displayName();
            QFile f(attachmentPath);
            if (f.exists()) {
                return attachmentPath;
            } else {
                // we have the part downloaded locally but not in a file type yet
                if (sourcePart.hasBody()) {
                    QString path = sourcePart.writeBodyTo(attachmentDownloadFolder);
                    return path;
                }
                return QString();
            }
        }
    }
    return QString();
}
开发者ID:VDVsx,项目名称:nemo-qml-plugin-email,代码行数:22,代码来源:attachmentlistmodel.cpp

示例14: matchesAfterDate

// match against date, if the mails date is not parsed, always return true
bool Search::matchesAfterDate(const QMailMessage& mail) const
{
    if ( afterDate.isNull() )
        return true;

    QDateTime dateTime = mail.date().toLocalTime();
    if ( dateTime.isNull() )
        return true;

    if ( afterDate < dateTime.date() )
        return true;

    return false;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:15,代码来源:search.cpp

示例15: connect

QString EmailMessageListModel::bodyHtmlText(const QMailMessage &mailMsg) const
{
    // TODO: This function assumes that at least the structure has been retrieved already
    if (const QMailMessagePartContainer *container = mailMsg.findHtmlContainer()) {
        if (!container->contentAvailable()) {
            // Retrieve the data for this part
            connect (m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)),
                                        this, SLOT(downloadActivityChanged(QMailServiceAction::Activity)));
            QMailMessagePart::Location location = static_cast<const QMailMessagePart *>(container)->location();
            m_retrievalAction->retrieveMessagePart(location);
            return " ";  // Put a space here as a place holder to notify UI that we do have html body.
        }
        return container->body().data();
    }

    return QString();
}
开发者ID:kananoja,项目名称:nemo-qml-plugin-email,代码行数:17,代码来源:emailmessagelistmodel.cpp


注:本文中的QMailMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。