summaryrefslogtreecommitdiff
path: root/src/gui/util/qdesktopservices_s60.cpp
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-06-10 11:54:36 +0300
committerJanne Anttila <janne.anttila@digia.com>2009-06-10 11:54:36 +0300
commitde32770849417fbca964f52eb4d16e7913b28ea1 (patch)
tree6b60372072cf89a4ef2f769fae5e7aba04805ea5 /src/gui/util/qdesktopservices_s60.cpp
parent5d43a51bb53718b9c98b1720ed46469e5b77fa6f (diff)
downloadqt4-tools-de32770849417fbca964f52eb4d16e7913b28ea1.tar.gz
Switched QDesktopServices mail-to URL handling to RSendAs in Symbian.
Earlier used CSendUi required extensiva capabilities to work correctly, that's why "new email" option in desktop services example application did not work correctly with self signed capabilities. RSendAs requires lower capabilities since SendAs server (separate process) takes care of necessary actions to send the message.
Diffstat (limited to 'src/gui/util/qdesktopservices_s60.cpp')
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index a30e2ed02a..d53c04621b 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -54,8 +54,8 @@
#include <eikenv.h> // CEikonEnv
#include <apgcli.h> // RApaLsSession
#include <apgtask.h> // TApaTaskList, TApaTask
-#include <sendui.h> // CSendUi
-#include <cmessagedata.h> // CMessageData
+#include <rsendas.h> // RSendAs
+#include <rsendasmessage.h> // RSendAsMessage
#include <pathinfo.h> // PathInfo
#ifdef USE_DOCUMENTHANDLER
#include <documenthandler.h> // CDocumentHandler
@@ -85,52 +85,44 @@ static void handleMailtoSchemeL(const QUrl &url)
QStringList bccs = bcc.split(",");
- CSendUi* sendUi = CSendUi::NewLC();
+ RSendAs sendAs;
+ User::LeaveIfError(sendAs.Connect());
+ CleanupClosePushL(sendAs);
+
+ RSendAsMessage sendAsMessage;
+ sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP);
+ CleanupClosePushL(sendAsMessage);
- // Construct symbian sendUI data holder
- CMessageData* messageData = CMessageData::NewLC();
// Subject
- TPtrC subj( qt_QString2TPtrC(subject) );
- messageData->SetSubjectL( &subj );
+ sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject));
// Body
- CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
- CleanupStack::PushL( paraFormat );
- CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
- CleanupStack::PushL( charFormat );
- CRichText* bodyRichText = CRichText::NewL( paraFormat, charFormat );
- CleanupStack::PushL( bodyRichText );
-
- TPtrC bodyPtr( qt_QString2TPtrC(body) );
- if( bodyPtr.Length() )
- {
- bodyRichText->InsertL( 0, bodyPtr );
- }
- else
- {
- bodyRichText->InsertL( 0, KNullDesC );
- }
-
- messageData->SetBodyTextL( bodyRichText );
+ sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body));
// To
foreach(QString item, recipients)
- messageData->AppendToAddressL(qt_QString2TPtrC(item));
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
foreach(QString item, tos)
- messageData->AppendToAddressL(qt_QString2TPtrC(item));
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
// Cc
foreach(QString item, ccs)
- messageData->AppendCcAddressL(qt_QString2TPtrC(item));
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc );
// Bcc
foreach(QString item, bccs)
- messageData->AppendBccAddressL(qt_QString2TPtrC(item));
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc );
+
+ // send the message
+ sendAsMessage.LaunchEditorAndCloseL();
+
+ // sendAsMessage (already closed)
+ CleanupStack::Pop();
- sendUi->CreateAndSendMessageL( KUidMsgTypeSMTP, messageData );
- CleanupStack::PopAndDestroy( 5 ); // bodyRichText, charFormat, paraFormat, messageData, sendUi
+ // sendAs
+ CleanupStack::PopAndDestroy();
}
static bool handleMailtoScheme(const QUrl &url)