use nicer filenames during export
This commit is contained in:
@@ -18,7 +18,11 @@
|
|||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@@ -93,7 +97,7 @@ public class BackupFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!includeSecretKeys) {
|
if (!includeSecretKeys) {
|
||||||
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, false);
|
startBackup(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +152,7 @@ public class BackupFragment extends Fragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true);
|
startBackup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}.execute(activity.getContentResolver());
|
}.execute(activity.getContentResolver());
|
||||||
@@ -178,7 +182,19 @@ public class BackupFragment extends Fragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true);
|
startBackup(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startBackup(boolean exportSecret) {
|
||||||
|
File filename;
|
||||||
|
String date = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(new Date());
|
||||||
|
if (exportSecret) {
|
||||||
|
filename = new File(Constants.Path.APP_DIR, "keys_" + date + ".asc");
|
||||||
|
} else {
|
||||||
|
filename = new File(Constants.Path.APP_DIR, "keys_" + date + ".pub.asc");
|
||||||
|
}
|
||||||
|
mExportHelper.showExportKeysDialog(null, filename, exportSecret);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import org.sufficientlysecure.keychain.util.Log;
|
|||||||
import org.sufficientlysecure.keychain.util.NfcHelper;
|
import org.sufficientlysecure.keychain.util.NfcHelper;
|
||||||
import org.sufficientlysecure.keychain.util.Preferences;
|
import org.sufficientlysecure.keychain.util.Preferences;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -413,7 +414,8 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
|
|
||||||
private void backupToFile() {
|
private void backupToFile() {
|
||||||
new ExportHelper(this).showExportKeysDialog(
|
new ExportHelper(this).showExportKeysDialog(
|
||||||
mMasterKeyId, Constants.Path.APP_DIR_FILE, true);
|
mMasterKeyId, new File(Constants.Path.APP_DIR,
|
||||||
|
KeyFormattingUtils.convertKeyIdToHex(mMasterKeyId) + ".sec.asc"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteKey() {
|
private void deleteKey() {
|
||||||
|
|||||||
Reference in New Issue
Block a user