[geary/mjog/email-templates: 71/72] Plugin.Composer: Support specifying a folder to save email
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/email-templates: 71/72] Plugin.Composer: Support specifying a folder to save email
- Date: Mon, 20 Apr 2020 13:56:09 +0000 (UTC)
commit 9a4a0e76b5bfadfdac5fd2051ddb3c92f7d2ebc2
Author: Michael Gratton <mike vee net>
Date: Mon Apr 20 23:50:53 2020 +1000
Plugin.Composer: Support specifying a folder to save email
.../application/application-plugin-manager.vala | 43 ++++++++++++++++++----
src/client/plugin/plugin-composer.vala | 10 +++++
2 files changed, 45 insertions(+), 8 deletions(-)
---
diff --git a/src/client/application/application-plugin-manager.vala
b/src/client/application/application-plugin-manager.vala
index 765af474..4db5fa5b 100644
--- a/src/client/application/application-plugin-manager.vala
+++ b/src/client/application/application-plugin-manager.vala
@@ -73,7 +73,9 @@ public class Application.PluginManager : GLib.Object {
if (impl == null) {
throw new Plugin.Error.NOT_SUPPORTED("Not a valid account");
}
- return new ComposerImpl(this.backing, impl.backing, this.email);
+ return new ComposerImpl(
+ this.backing, impl.backing, this.folders, this.email
+ );
}
public void register_action(GLib.Action action) {
@@ -178,26 +180,24 @@ public class Application.PluginManager : GLib.Object {
private Client application;
private AccountContext account;
+ private FolderStoreFactory folders;
private EmailStoreFactory email;
private Geary.Email? to_load = null;
+ private Geary.Folder? save_location = null;
public ComposerImpl(Client application,
AccountContext account,
+ FolderStoreFactory folders,
EmailStoreFactory email) {
this.application = application;
this.account = account;
+ this.folders = folders;
this.email = email;
}
public void show() {
- if (this.to_load == null) {
- this.application.controller.compose_new_email.begin();
- } else {
- this.application.controller.compose_with_context_email.begin(
- EDIT, this.to_load, null
- );
- }
+ this.show_impl.begin();
}
public async void edit_email(Plugin.EmailIdentifier to_load)
@@ -217,6 +217,33 @@ public class Application.PluginManager : GLib.Object {
this.to_load = Geary.Collection.first(email);
}
}
+
+ public void save_to_folder(Plugin.Folder? location) {
+ var folder = this.folders.get_engine_folder(location);
+ if (folder != null && folder.account == this.account.account) {
+ this.save_location = folder;
+ }
+ }
+
+ private async void show_impl() {
+ var controller = this.application.controller;
+ Composer.Widget? composer = null;
+ if (this.to_load == null) {
+ composer = yield controller.compose_new_email(
+ null,
+ this.save_location
+ );
+ } else {
+ composer = yield controller.compose_with_context_email(
+ EDIT,
+ this.to_load,
+ null,
+ this.save_location
+ );
+ }
+ //composer.can_send = this.can_send;
+ }
+
}
diff --git a/src/client/plugin/plugin-composer.vala b/src/client/plugin/plugin-composer.vala
index c6980a64..9635f39b 100644
--- a/src/client/plugin/plugin-composer.vala
+++ b/src/client/plugin/plugin-composer.vala
@@ -32,4 +32,14 @@ public interface Plugin.Composer : Geary.BaseObject {
public async abstract void edit_email(EmailIdentifier to_load)
throws GLib.Error;
+ /**
+ * Sets the folder used to save the message being composed.
+ *
+ * Ensures email for both automatic and manual saving of the email
+ * in the composer is saved to the given folder. This must be
+ * called before calling {@link show}, and has no effect if called
+ * afterwards.
+ */
+ public abstract void save_to_folder(Plugin.Folder? location);
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]