Commit 8b4285a4 authored by Martin Straka's avatar Martin Straka

iOS: Added recipient into mail controller

parent c38b451c
......@@ -29,7 +29,7 @@
@interface SimpleEmailSendController:UIViewController<MFMailComposeViewControllerDelegate> {
}
- (void)createEmail:(NSString *)body sub:(NSString *)subject
files:(NSArray *)filePaths;
- (void)createEmail:(NSString *)body rec:(NSString *)recipient
sub:(NSString *)subject files:(NSArray *)filePaths;
@end
......@@ -49,8 +49,8 @@
return (__bridge NSString *)(MIMEType);
}
- (void)createEmail:(NSString *)body sub:(NSString *)subject
files:(NSArray *)filePaths
- (void)createEmail:(NSString *)body rec:(NSString *)recipient
sub:(NSString *)subject files:(NSArray *)filePaths
{
if (![MFMailComposeViewController canSendMail]) {
[self showCantSendMailAlert];
......@@ -60,6 +60,7 @@
MFMailComposeViewController *controller =
[[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setToRecipients:@[recipient]];
[controller setSubject:subject];
[controller setMessageBody:body isHTML:NO];
......
......@@ -57,11 +57,12 @@ public:
* @brief Create email on iOS.
*
* @param[in] bodyText Email text.
* @param[in] to Recipient mail address.
* @param[in] subject Email subject.
* @param[in] filePaths Paths to attachment files.
*/
void createEmail(const QString &bodyText, const QString &subject,
const QStringList &filePaths);
void createEmail(const QString &bodyText, const QString &to,
const QString &subject, const QStringList &filePaths);
};
#endif /* _URL_OPENER_H_ */
......@@ -72,17 +72,19 @@ void UrlOpener::openFile(const QString &filePath)
#endif /* !Q_OS_IOS */
}
void UrlOpener::createEmail(const QString &bodyText, const QString &subject,
const QStringList &filePaths)
void UrlOpener::createEmail(const QString &bodyText, const QString &to,
const QString &subject, const QStringList &filePaths)
{
#ifndef Q_OS_IOS
Q_UNUSED(to);
Q_UNUSED(bodyText);
Q_UNUSED(subject);
Q_UNUSED(filePaths);
#else /* Q_OS_IOS */
NSString *recipient = to.toNSString();
NSString *body = bodyText.toNSString();
NSString *sbjct = subject.toNSString();
......@@ -103,7 +105,7 @@ void UrlOpener::createEmail(const QString &bodyText, const QString &subject,
if (rootv != nil) {
email = [[SimpleEmailSendController alloc] init];
[rootv addChildViewController:email];
[email createEmail:body sub:sbjct files:filePath];
[email createEmail:body rec:recipient sub:sbjct files:filePath];
}
#endif /* !Q_OS_IOS */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment