1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Cleaned up success message after settings import

This commit is contained in:
cketti 2011-10-14 06:19:30 +02:00
parent f5e684310e
commit effb45c463
2 changed files with 14 additions and 4 deletions

View File

@ -1041,6 +1041,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="settings_importing">Importing settings...</string> <string name="settings_importing">Importing settings...</string>
<string name="settings_import_scanning_file">Scanning file...</string> <string name="settings_import_scanning_file">Scanning file...</string>
<string name="settings_export_success">Saved exported settings to <xliff:g id="filename">%s</xliff:g></string> <string name="settings_export_success">Saved exported settings to <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_import_global_settings_success">Imported global settings from <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_import_success">Imported <xliff:g id="accounts">%s</xliff:g> from <xliff:g id="filename">%s</xliff:g></string> <string name="settings_import_success">Imported <xliff:g id="accounts">%s</xliff:g> from <xliff:g id="filename">%s</xliff:g></string>
<plurals name="settings_import_success"> <plurals name="settings_import_success">
<item quantity="one">1 account</item> <item quantity="one">1 account</item>

View File

@ -1410,13 +1410,22 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
removeProgressDialog(); removeProgressDialog();
String filename = mUri.getLastPathSegment(); String filename = mUri.getLastPathSegment();
if (success) { boolean globalSettings = mImportResults.globalSettings;
int imported = mImportResults.importedAccounts.size(); int imported = mImportResults.importedAccounts.size();
if (success && (globalSettings || imported > 0)) {
//TODO: display names of imported accounts (name from file *and* possibly new name) //TODO: display names of imported accounts (name from file *and* possibly new name)
activity.showSimpleDialog(R.string.settings_import_success_header, if (imported == 0) {
R.string.settings_import_success, imported, filename); 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(); activity.refresh();
} else { } else {
//TODO: better error messages //TODO: better error messages