aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-12-28 14:20:56 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-28 14:20:56 +0800
commitdcf5f23803989d03d3edc3d0d6dc7962ca8325e9 (patch)
tree55b4a26aaa963744620794062c267b7b1c7fb139
parenta6c6f6d90674cf789a114768f8597086b572ffae (diff)
downloadgsoc2013-evolution-dcf5f23803989d03d3edc3d0d6dc7962ca8325e9.tar.gz
gsoc2013-evolution-dcf5f23803989d03d3edc3d0d6dc7962ca8325e9.tar.zst
gsoc2013-evolution-dcf5f23803989d03d3edc3d0d6dc7962ca8325e9.zip
Handle mailto/email URIs (unfinished).
Restore unfinished messages on startup. svn path=/branches/kill-bonobo/; revision=36935
-rw-r--r--mail/e-mail-shell-module.c91
-rw-r--r--mail/em-utils.c2
-rw-r--r--mail/mail-component.c70
3 files changed, 124 insertions, 39 deletions
diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c
index 2accb7db94..a96a22f024 100644
--- a/mail/e-mail-shell-module.c
+++ b/mail/e-mail-shell-module.c
@@ -29,6 +29,7 @@
#include "e-util/e-util.h"
#include "shell/e-shell.h"
#include "shell/e-shell-window.h"
+#include "composer/e-msg-composer.h"
#include "widgets/misc/e-preferences-window.h"
#include "e-mail-shell-view.h"
@@ -564,13 +565,91 @@ mail_shell_module_notify_online_mode_cb (EShell *shell,
camel_session_set_online (session, online);
}
+static void
+mail_shell_module_handle_email_uri_cb (gchar *uri,
+ CamelFolder *folder,
+ gpointer user_data)
+{
+ CamelURL *url = user_data;
+ const gchar *forward;
+ const gchar *reply;
+ const gchar *uid;
+
+ if (folder == NULL) {
+ g_warning ("Could not open folder '%s'", uri);
+ goto exit;
+ }
+
+ forward = camel_url_get_param (url, "forward");
+ reply = camel_url_get_param (url, "reply");
+ uid = camel_url_get_param (url, "uid");
+
+ if (reply != NULL) {
+ gint mode;
+
+ if (g_strcmp0 (reply, "all") == 0)
+ mode = REPLY_MODE_ALL;
+ else if (g_strcmp0 (reply, "list") == 0)
+ mode = REPLY_MODE_LIST;
+ else
+ mode = REPLY_MODE_SENDER;
+
+ em_utils_reply_to_message (folder, uid, NULL, mode, NULL);
+
+ } else if (forward != NULL) {
+ GPtrArray *uids;
+
+ uids = g_ptr_array_new ();
+ g_ptr_array_add (uids, g_strdup (uid));
+
+ if (g_strcmp0 (forward, "attached") == 0)
+ em_utils_forward_attached (folder, uids, uri);
+ else if (g_strcmp0 (forward, "inline") == 0)
+ em_utils_forward_inline (folder, uids, uri);
+ else if (g_strcmp0 (forward, "quoted") == 0)
+ em_utils_forward_quoted (folder, uids, uri);
+ else
+ em_utils_forward_messages (folder, uids, uri);
+
+ } else
+ /* FIXME Create a EMailBrowser */;
+
+exit:
+ camel_url_free (url);
+}
+
static gboolean
mail_shell_module_handle_uri_cb (EShell *shell,
const gchar *uri,
EShellModule *shell_module)
{
- /* FIXME */
- return FALSE;
+ gboolean handled = TRUE;
+
+ if (g_str_has_prefix (uri, "mailto:")) {
+ if (em_utils_check_user_can_send_mail (NULL))
+ em_utils_compose_new_message_with_mailto (uri, NULL);
+
+ } else if (g_str_has_prefix (uri, "email:")) {
+ CamelURL *url;
+
+ url = camel_url_new (uri, NULL);
+ if (camel_url_get_param (url, "uid") != NULL) {
+ gchar *curi = em_uri_to_camel (uri);
+
+ mail_get_folder (
+ curi, 0,
+ mail_shell_module_handle_email_uri_cb,
+ url, mail_msg_unordered_push);
+ g_free (curi);
+
+ } else {
+ g_warning ("Email URI's must include a uid parameter");
+ camel_url_free (url);
+ }
+ } else
+ handled = FALSE;
+
+ return TRUE;
}
/* Helper for mail_shell_module_prepare_for_[off|on]line_cb() */
@@ -670,6 +749,7 @@ mail_shell_module_window_created_cb (EShell *shell,
EShellWindow *shell_window,
EShellModule *shell_module)
{
+ static gboolean first_time = TRUE;
const gchar *module_name;
module_name = G_TYPE_MODULE (shell_module)->name;
@@ -689,6 +769,13 @@ mail_shell_module_window_created_cb (EShell *shell,
g_object_weak_ref (
G_OBJECT (shell_window), (GWeakNotify)
mail_shell_module_window_weak_notify_cb, shell);
+
+ if (first_time) {
+ g_signal_connect (
+ shell_window, "map-event",
+ G_CALLBACK (e_msg_composer_check_autosave), NULL);
+ first_time = FALSE;
+ }
}
static EShellModuleInfo module_info = {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index fe51e693ad..e31bab0d22 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -228,8 +228,6 @@ em_utils_check_user_can_send_mail (GtkWindow *parent)
{
EAccount *account;
- g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
-
if (!mail_config_is_configured ()) {
if (!em_utils_configure_account (parent))
return FALSE;
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 7fa34785d8..9013556388 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -1037,28 +1037,28 @@ handleuri_got_folder(char *uri, CamelFolder *folder, void *data)
camel_url_free(url);
}
-static void
-impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
-{
- if (!strncmp (uri, "mailto:", 7)) {
- if (!em_utils_check_user_can_send_mail(NULL))
- return;
-
- em_utils_compose_new_message_with_mailto (uri, NULL);
- } else if (!strncmp(uri, "email:", 6)) {
- CamelURL *url = camel_url_new(uri, NULL);
-
- if (camel_url_get_param(url, "uid") != NULL) {
- char *curi = em_uri_to_camel(uri);
-
- mail_get_folder(curi, 0, handleuri_got_folder, url, mail_msg_unordered_push);
- g_free(curi);
- } else {
- g_warning("email uri's must include a uid parameter");
- camel_url_free(url);
- }
- }
-}
+//static void
+//impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
+//{
+// if (!strncmp (uri, "mailto:", 7)) {
+// if (!em_utils_check_user_can_send_mail(NULL))
+// return;
+//
+// em_utils_compose_new_message_with_mailto (uri, NULL);
+// } else if (!strncmp(uri, "email:", 6)) {
+// CamelURL *url = camel_url_new(uri, NULL);
+//
+// if (camel_url_get_param(url, "uid") != NULL) {
+// char *curi = em_uri_to_camel(uri);
+//
+// mail_get_folder(curi, 0, handleuri_got_folder, url, mail_msg_unordered_push);
+// g_free(curi);
+// } else {
+// g_warning("email uri's must include a uid parameter");
+// camel_url_free(url);
+// }
+// }
+//}
//static void
//impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev)
@@ -1224,11 +1224,11 @@ c//all_mail_sync (gpointer user_data)
// }
//}
-static void
-impl_mail_test(PortableServer_Servant servant, CORBA_Environment *ev)
-{
- printf("*** Testing mail interface!! ***\n");
-}
+//static void
+//impl_mail_test(PortableServer_Servant servant, CORBA_Environment *ev)
+//{
+// printf("*** Testing mail interface!! ***\n");
+//}
/* Initialization. */
@@ -1247,14 +1247,14 @@ mail_component_class_init (MailComponentClass *class)
epv->createView = impl_createView;
epv->requestQuit = impl_requestQuit;
epv->quit = impl_quit;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
- epv->handleURI = impl_handleURI;
- epv->sendAndReceive = impl_sendAndReceive;
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->setLineStatus = impl_setLineStatus;
-
- mepv->test = impl_mail_test;
+// epv->_get_userCreatableItems = impl__get_userCreatableItems;
+// epv->requestCreateItem = impl_requestCreateItem;
+// epv->handleURI = impl_handleURI;
+// epv->sendAndReceive = impl_sendAndReceive;
+// epv->upgradeFromVersion = impl_upgradeFromVersion;
+// epv->setLineStatus = impl_setLineStatus;
+
+// mepv->test = impl_mail_test;
}
//static void