From effb45c4638fc5e4098c5e959ac377239521e444 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 14 Oct 2011 06:19:30 +0200 Subject: [PATCH] Cleaned up success message after settings import --- res/values/strings.xml | 1 + src/com/fsck/k9/activity/Accounts.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 36a224a5a..ebc0a1d02 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1041,6 +1041,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Importing settings... Scanning file... Saved exported settings to %s + Imported global settings from %s Imported %s from %s 1 account diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java index f3262ad3c..50cf27e8a 100644 --- a/src/com/fsck/k9/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -1410,13 +1410,22 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC removeProgressDialog(); String filename = mUri.getLastPathSegment(); - if (success) { - int imported = mImportResults.importedAccounts.size(); + boolean globalSettings = mImportResults.globalSettings; + int imported = mImportResults.importedAccounts.size(); + if (success && (globalSettings || imported > 0)) { //TODO: display names of imported accounts (name from file *and* possibly new name) - activity.showSimpleDialog(R.string.settings_import_success_header, - R.string.settings_import_success, imported, filename); + if (imported == 0) { + activity.showSimpleDialog(R.string.settings_import_success_header, + R.string.settings_import_global_settings_success, filename); + } else { + String importedAccounts = activity.getResources().getQuantityString( + R.plurals.settings_import_success, imported); + activity.showSimpleDialog(R.string.settings_import_success_header, + R.string.settings_import_success, importedAccounts, filename); + } + activity.refresh(); } else { //TODO: better error messages