void tst_QMailAddress::isEmailAddress() { QFETCH( QString, address ); QMailAddress addr = QMailAddress(QString(), address); QTEST(addr.isEmailAddress(), "emailAddress"); }
void tst_QMailAddress::isPhoneNumber() { QFETCH( QString, address ); QMailAddress addr = QMailAddress(QString(), address); QTEST(addr.isPhoneNumber(), "phoneNumber"); }
void EmailMessage::setFrom (const QString &sender) { QMailAccountIdList accountIds = QMailStore::instance()->queryAccounts( QMailAccountKey::status(QMailAccount::Enabled, QMailDataComparator::Includes), QMailAccountSortKey::name()); // look up the account id for the given sender foreach (QMailAccountId id, accountIds) { QMailAccount account(id); QMailAddress from = account.fromAddress(); if (from.address() == sender || from.toString() == sender || from.name() == sender) { m_account = account; m_msg.setParentAccountId(id); m_msg.setFrom(account.fromAddress()); } }
void tst_QMailAddress::groupMembers() { QFETCH( QString, input ); QFETCH( QString, input_name ); QFETCH( QString, input_address ); QMailAddress addr; if ( !input.isEmpty() ) addr = QMailAddress( input ); else addr = QMailAddress( input_name, input_address ); QTEST( addr.name(), "name" ); QTEST( addr.address(), "address" ); QTEST( addr.toString(), "to_string" ); QTEST( addr.isGroup(), "is_group" ); QStringList names, addresses; foreach (const QMailAddress& member, addr.groupMembers()) { names.append(member.name()); addresses.append(member.address()); } QTEST( names, "member_names" ); QTEST( addresses, "member_addresses" ); }
bool SmsClient::validSmsAddress( const QMailAddress& fromAddress ) { return sValidSmsAddress->indexIn( fromAddress.address() ) != -1; }
foreach (const QMailAddress &address, addresses) { recipients << address.address(); }
void ConversationPage::createContent() { MApplicationPage::createContent(); setContentsMargins(0, 0, 0, 0); setPannable(true); createActions(); //% "Mail" setTitle(qtTrId("xx_page_title")); MLayout *layout = new MLayout(centralWidget()); layout->setContentsMargins(0, 0, 0, 0); layout->setAnimation(0); m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical); m_policy->setObjectName("VerticalPolicy"); m_policy->setContentsMargins(0, 0, 0, 0); m_policy->setSpacing(0); QMailMessage message(m_id); //% "From" QString body = qtTrId("xx_from") + ": " + message.from().address() + "\n"; QStringList addresses = QMailAddress::toStringList(message.to()); //% "To" body.append(qtTrId("xx_to") + ": " + addresses.join("; ") + "\n"); addresses = QMailAddress::toStringList(message.cc()); if (addresses.size() > 0) //% "Cc" body.append(qtTrId("xx_cc" ) + ": " + addresses.join("; ") + "\n"); addresses = QMailAddress::toStringList(message.bcc()); if (addresses.size() > 0) //% "Bcc" body.append(qtTrId("xx_bcc" ) + ": " + addresses.join("; ") + "\n"); QMailAddress replyTo = message.replyTo(); if (!replyTo.isNull()) //% "Reply-To" body.append(qtTrId("xx_reply_to") + ": " + replyTo.toString() + "\n"); //% "Subject" body.append(qtTrId("xx_subject") + ": " + message.subject() + "\n"); //% "Date: %1" body.append(qtTrId("xx_date").arg(message.date().toLocalTime().toString(Qt::SystemLocaleShortDate))); MLabel *messageBody = new MLabel(body); messageBody->setWordWrap(true); messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); messageBody->setObjectName("BodyText"); m_policy->addItem(messageBody); MSeparator *separator = new MSeparator(); separator->setObjectName("Separator"); m_policy->addItem(separator); messageBody = new MLabel("\n" + Utils::bodyPlainText(&message)); messageBody->setWordWrap(true); messageBody->setObjectName("BodyText"); messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_policy->addItem (messageBody); processAttachments(message); centralWidget()->setLayout(layout); }