diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-06-15 07:30:46 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-06-15 07:30:46 (GMT) |
commit | cdb6cf0cd190b9d7373a4a295ef3ef65eedc6b53 (patch) | |
tree | dc9f401bed53a8944f492acccf7cf367c46127e6 | |
parent | a612366300aef70d2574b3f738afebdb106f1214 (diff) | |
download | Qt-cdb6cf0cd190b9d7373a4a295ef3ef65eedc6b53.zip Qt-cdb6cf0cd190b9d7373a4a295ef3ef65eedc6b53.tar.gz Qt-cdb6cf0cd190b9d7373a4a295ef3ef65eedc6b53.tar.bz2 |
Added placeholder to create e-mail account in qdesktopservices.
Currently e-mail sending with qdesktopservices::openUrl works
in Symbian only if e-mail account already exists.
The CSendUI API which is similar to RSendAs API we currently use,
would provide that e-mail account creation service for us
automatically but it requires so extensive capabilities that we
cannot use it.
-rw-r--r-- | src/gui/util/qdesktopservices_s60.cpp | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index d53c046..3588ec9 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -89,38 +89,51 @@ static void handleMailtoSchemeL(const QUrl &url) User::LeaveIfError(sendAs.Connect()); CleanupClosePushL(sendAs); - RSendAsMessage sendAsMessage; - sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); - CleanupClosePushL(sendAsMessage); - - - // Subject - sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject)); - - // Body - sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body)); - - // To - foreach(QString item, recipients) - sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - - foreach(QString item, tos) - sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - - // Cc - foreach(QString item, ccs) - sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc ); - - // Bcc - foreach(QString item, bccs) - sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc ); - - // send the message - sendAsMessage.LaunchEditorAndCloseL(); - - // sendAsMessage (already closed) - CleanupStack::Pop(); + CSendAsAccounts* accounts = CSendAsAccounts::NewL(); + CleanupStack::PushL(accounts); + sendAs.AvailableAccountsL(KUidMsgTypeSMTP, *accounts); + TInt count = accounts->Count(); + CleanupStack::PopAndDestroy(accounts); + + if(!count) { + // TODO: we should try to create account if count == 0 + // CSendUi would provide account creation service for us, but it requires ridicilous + // capabilities: LocalServices NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData + User::Leave(KErrNotSupported); + } else { + RSendAsMessage sendAsMessage; + sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); + CleanupClosePushL(sendAsMessage); + + + // Subject + sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject)); + + // Body + sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body)); + + // To + foreach(QString item, recipients) + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); + + foreach(QString item, tos) + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); + + // Cc + foreach(QString item, ccs) + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc ); + + // Bcc + foreach(QString item, bccs) + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc ); + + // send the message + sendAsMessage.LaunchEditorAndCloseL(); + + // sendAsMessage (already closed) + CleanupStack::Pop(); + } // sendAs CleanupStack::PopAndDestroy(); } |