summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/embedded/desktopservices/contenttab.cpp12
-rw-r--r--demos/embedded/desktopservices/contenttab.h2
-rw-r--r--demos/embedded/desktopservices/linktab.cpp9
-rw-r--r--demos/embedded/desktopservices/linktab.h1
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp75
5 files changed, 66 insertions, 33 deletions
diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp
index 450a080..bdc5e03 100644
--- a/demos/embedded/desktopservices/contenttab.cpp
+++ b/demos/embedded/desktopservices/contenttab.cpp
@@ -41,6 +41,7 @@
// EXTERNAL INCLUDES
#include <QKeyEvent>
+#include <QMessageBox>
#include <QListWidget>
#include <QVBoxLayout>
#include <QFileInfoList>
@@ -135,10 +136,19 @@ void ContentTab::keyPressEvent(QKeyEvent *event)
}
}
+void ContentTab::handleErrorInOpen(QListWidgetItem *item)
+{
+ Q_UNUSED(item);
+ QMessageBox::warning( this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close);
+}
+
// NEW SLOTS
void ContentTab::openItem(QListWidgetItem *item)
{
- QDesktopServices::openUrl(itemUrl(item));
+ bool ret = QDesktopServices::openUrl(itemUrl(item));
+ if(!ret)
+ handleErrorInOpen(item);
}
+
// End of File
diff --git a/demos/embedded/desktopservices/contenttab.h b/demos/embedded/desktopservices/contenttab.h
index a5a402e..8d37209 100644
--- a/demos/embedded/desktopservices/contenttab.h
+++ b/demos/embedded/desktopservices/contenttab.h
@@ -83,7 +83,7 @@ protected: // New Methods
virtual void populateListWidget();
virtual QString itemName(const QFileInfo &item);
virtual QUrl itemUrl(QListWidgetItem *item);
-
+ virtual void handleErrorInOpen(QListWidgetItem *item);
protected:
void keyPressEvent(QKeyEvent *event);
diff --git a/demos/embedded/desktopservices/linktab.cpp b/demos/embedded/desktopservices/linktab.cpp
index b4ab308..58d1cc6 100644
--- a/demos/embedded/desktopservices/linktab.cpp
+++ b/demos/embedded/desktopservices/linktab.cpp
@@ -41,6 +41,7 @@
// EXTERNAL INCLUDES
#include <QUrl>
+#include <QMessageBox>
#include <QListWidgetItem>
// INTERNAL INCLUDES
@@ -75,5 +76,13 @@ QUrl LinkTab::itemUrl(QListWidgetItem *item)
return QUrl();
}
}
+void LinkTab::handleErrorInOpen(QListWidgetItem *item)
+{
+ if(m_MailToItem == item) {
+ QMessageBox::warning( this, tr("Operation Failed"), tr("Please check that you have\ne-mail accunt defined"), QMessageBox::Close);
+ } else {
+ ContentTab::handleErrorInOpen(item);
+ }
+}
// End of file
diff --git a/demos/embedded/desktopservices/linktab.h b/demos/embedded/desktopservices/linktab.h
index 2ce1094..a9c9868 100644
--- a/demos/embedded/desktopservices/linktab.h
+++ b/demos/embedded/desktopservices/linktab.h
@@ -71,6 +71,7 @@ public: // Constructors & Destructors
protected: // Derived Methods
virtual void populateListWidget();
virtual QUrl itemUrl(QListWidgetItem *item);
+ virtual void handleErrorInOpen(QListWidgetItem *item);
private: // Used variables
QListWidgetItem *m_WebItem;
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();
}