[geary/wip/244-save-sent-ui-missing: 2/3] Default Outlook accounts to not save sent mail



commit 4d57ab9b620d91e4f8e2d47450b8ca73a9ebe837
Author: Michael Gratton <mike vee net>
Date:   Wed Feb 20 14:06:02 2019 +1100

    Default Outlook accounts to not save sent mail
    
    See #65

 src/engine/api/geary-account-information.vala      | 34 +++++++---------------
 .../outlook/imap-engine-outlook-account.vala       |  2 +-
 .../engine/api/geary-account-information-test.vala |  2 +-
 3 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 78b3c065..a3e68016 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -127,18 +127,18 @@ public class Geary.AccountInformation : BaseObject {
         get; set; default = DEFAULT_PREFETCH_PERIOD_DAYS;
     }
 
-    /**
-     * Specifies if the user has requested that sent mail be saved.
-     *
-     * Note that Geary will only actively push sent mail when this AND
-     * {@link allow_save_sent} are both true.
-     */
+    /** Specifies if sent email should be saved to the Sent folder. */
     public bool save_sent {
-        // If we aren't allowed to save sent mail due to account type, we want
-        // to return true here on the assumption that the account will save
-        // sent mail for us, and thus the user can't disable sent mail from
-        // being saved.
-        get { return (allow_save_sent() ? this._save_sent : true); }
+        get {
+            bool save = _save_sent;
+            switch (this.service_provider) {
+            case GMAIL:
+            case OUTLOOK:
+                save = false;
+                break;
+            }
+            return save;
+        }
         set { this._save_sent = value; }
     }
     private bool _save_sent = true;
@@ -355,18 +355,6 @@ public class Geary.AccountInformation : BaseObject {
         return removed;
     }
 
-    /**
-     * Determines if {@link save_sent} property can be set.
-     *
-     * If not, that property will always be true and setting it will
-     * be ignored.
-     */
-    public bool allow_save_sent() {
-        // We should never push mail to Gmail, since its servers
-        // automatically push sent mail to the sent mail folder.
-        return this.service_provider != ServiceProvider.GMAIL;
-    }
-
     /**
      * Returns the configured path for a special folder type.
      *
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala 
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index afce5172..dca134d6 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -10,7 +10,7 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
 
 
     public static void setup_account(AccountInformation account) {
-        // noop
+        account.save_sent = false;
     }
 
     public static void setup_service(ServiceInformation service) {
diff --git a/test/engine/api/geary-account-information-test.vala 
b/test/engine/api/geary-account-information-test.vala
index abe5d9da..1323ffcf 100644
--- a/test/engine/api/geary-account-information-test.vala
+++ b/test/engine/api/geary-account-information-test.vala
@@ -31,7 +31,7 @@ class Geary.AccountInformationTest : TestCase {
                 new RFC822.MailboxAddress(null, "test1 example com")
             ).save_sent
         );
-        assert_true(
+        assert_false(
             new AccountInformation(
                 "test",
                 ServiceProvider.OUTLOOK,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]