<string name="cannot_decrypt_password">Cannot decrypt password</string>
<string name="error_export">Error exporting database</string>\r
<string name="export_database">Export Database</string>
- <string name="export_success">Export to 'passwordsafe.csv' successful. Warning! The file is not encrypted.</string>
+ <string name="export_success">Export to '</string>\r
+ <string name="export_success2">' successful. Warning! The file is not encrypted.</string>
<string name="export_file_error">Unable to create export file 'passwordsafe.csv' on SDCARD. You might try disconnecting USB from computer.</string>
<string name="import_database">Import Database</string>\r
<string name="import_file_missing">Import file is missing:</string>\r
<string name="dialog_title_external_access">OI Safe: Another application requests access.</string>\r
<string name="dialog_summary_external_access">Allow other applications to secure your data with OI Safe.</string>\r
<string name="dialog_comment_external_access">This can also be set in OI Safe\'s Menu / Preferences.</string>\r
- <string name="pref_title_lock_timeout">Lock timeout</string>\r
+ <string name="pref_title_lock_timeout">Auto lock timeout</string>\r
<string name="pref_summary_lock_timeout">Minutes before timeout occurs and safe is locked.</string>\r
- <string name="pref_dialog_title_lock_timeout">Lock timeout</string>\r
+ <string name="pref_dialog_title_lock_timeout">Auto lock timeout</string>\r
<string name="intent_decrypt">Decrypt (OI Safe)</string>\r
<string name="intent_encrypt">Encrypt (OI Safe)</string>\r
<string name="intent_get_password">Get password (OI Safe)</string>\r
public static final int MAX_CATEGORIES = 256;
- private static final String EXPORT_FILENAME = "/sdcard/passwordsafe.csv";
- public static final String BACKUP_FILENAME = "/sdcard/passwordsafe.xml";
+ private static final String EXPORT_FILENAME = "/sdcard/oisafe.csv";
+ public static final String BACKUP_FILENAME = "/sdcard/oisafe.xml";
public static final String KEY_ID = "id"; // Intent keys
private int importedEntries=0;
private Thread importThread=null;
private boolean importDeletedDatabase=false;
+ private String importedFilename="";
private Thread backupThread=null;
Toast.makeText(CategoryList.this, importMessage,
Toast.LENGTH_LONG).show();
}
- String deleteMsg=getString(R.string.import_delete_csv) +
- " " + EXPORT_FILENAME + "?";
- Dialog about = new AlertDialog.Builder(CategoryList.this)
- .setIcon(R.drawable.passicon)
- .setTitle(R.string.import_complete)
- .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- File csvFile=new File(EXPORT_FILENAME);
- csvFile.delete();
- }
- })
- .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- }
- })
- .setMessage(deleteMsg)
- .create();
- about.show();
+ if (importedFilename != "") {
+ String deleteMsg=getString(R.string.import_delete_csv) +
+ " " + importedFilename + "?";
+ Dialog about = new AlertDialog.Builder(CategoryList.this)
+ .setIcon(R.drawable.passicon)
+ .setTitle(R.string.import_complete)
+ .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ File csvFile=new File(importedFilename);
+ csvFile.delete();
+ importedFilename="";
+ }
+ })
+ .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int whichButton) {
+ }
+ })
+ .setMessage(deleteMsg)
+ .create();
+ about.show();
+ }
if ((importedEntries!=0) || (importDeletedDatabase))
{
}
public boolean exportDatabase(){
+ String filename=EXPORT_FILENAME;
try {
- CSVWriter writer = new CSVWriter(new FileWriter(EXPORT_FILENAME), ',');
+ CSVWriter writer = new CSVWriter(new FileWriter(filename), ',');
String[] header = { getString(R.string.category),
getString(R.string.description),
Toast.LENGTH_SHORT).show();
return false;
}
- Toast.makeText(CategoryList.this, R.string.export_success,
+ String msg=getString(R.string.export_success)+filename+
+ getString(R.string.export_success2);
+ Toast.makeText(CategoryList.this, msg,
Toast.LENGTH_LONG).show();
return true;
}
dbHelper.deleteDatabase();
}
- public void deleteDatabase4Import(){
+ public void deleteDatabase4Import(final String filename){
// Log.i(TAG,"deleteDatabase4Import");
Dialog about = new AlertDialog.Builder(this)
.setIcon(R.drawable.passicon)
public void onClick(DialogInterface dialog, int whichButton) {
deleteDatabaseNow();
importDeletedDatabase=true;
- importDatabaseThreadStart();
+ importDatabaseThreadStart(filename);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
}
public void importDatabase(){
- File csvFile=new File(EXPORT_FILENAME);
+ final String filename=EXPORT_FILENAME;
+ File csvFile=new File(filename);
if (!csvFile.exists()) {
String msg=getString(R.string.import_file_missing) + " " +
- EXPORT_FILENAME;
+ filename;
Toast.makeText(CategoryList.this, msg,
Toast.LENGTH_LONG).show();
return;
.setTitle(R.string.dialog_import_title)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
- deleteDatabase4Import();
+ deleteDatabase4Import(filename);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
importDeletedDatabase=false;
- importDatabaseThreadStart();
+ importDatabaseThreadStart(filename);
}
})
.setMessage(R.string.dialog_import_msg)
* the import in a thread it allows the main UI thread to return
* and permit the updating of the progress dialog.
*/
- private void importDatabaseThreadStart(){
+ private void importDatabaseThreadStart(final String filename){
showDialog(IMPORT_PROGRESS_KEY);
importThread = new Thread(new Runnable() {
public void run() {
- importDatabaseFromCSV();
+ importDatabaseFromCSV(filename);
dismissDialog(IMPORT_PROGRESS_KEY);
Message m = new Message();
* While running inside a thread, read from a CSV and import
* into the database.
*/
- private void importDatabaseFromCSV(){
+ private void importDatabaseFromCSV(String filename){
try {
importMessage="";
importedEntries=0;
final int recordLength=6;
- CSVReader reader= new CSVReader(new FileReader(EXPORT_FILENAME));
+ CSVReader reader= new CSVReader(new FileReader(filename));
String [] nextLine;
nextLine = reader.readNext();
if (nextLine==null) {
//
// read the whole file again to import the actual fields
//
- reader = new CSVReader(new FileReader(EXPORT_FILENAME));
+ reader = new CSVReader(new FileReader(filename));
nextLine = reader.readNext();
int newEntries=0;
int lineNumber=0;
}else{
importMessage=getString(R.string.added)+ " "+ newEntries +
" "+ getString(R.string.entries);
+ importedFilename=filename;
}
} catch (IOException e) {
e.printStackTrace();
// Fields
// ===========================================================
- private boolean in_apws = false;
+ private boolean in_oisafe = false;
private boolean in_masterkey = false;
private boolean in_category = false;
private boolean in_entry = false;
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
- if (localName.equals("AndroidPasswordSafe")) {
- in_apws = true;
+ if (localName.equals("OISafe")) {
+ in_oisafe = true;
String attrValue = atts.getValue("version");
int version = Integer.parseInt(attrValue);
myRestoreDataSet.setVersion(version);
myRestoreDataSet.setDate(date);
- if (debug) Log.d(TAG,"found APWS "+version+" date "+date);
+ if (debug) Log.d(TAG,"found OISafe "+version+" date "+date);
- }else if (in_apws && localName.equals("MasterKey")) {
+ }else if (in_oisafe && localName.equals("MasterKey")) {
in_masterkey = true;
if (debug) Log.d(TAG,"found MasterKey");
- }else if (in_apws && localName.equals("Category")) {
+ }else if (in_oisafe && localName.equals("Category")) {
in_category = true;
String name = atts.getValue("name");
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
- if (localName.equals("AndroidPasswordSafe")) {
- in_apws = false;
- }else if (in_apws && localName.equals("MasterKey")) {
+ if (localName.equals("OISafe")) {
+ in_oisafe = false;
+ }else if (in_oisafe && localName.equals("MasterKey")) {
in_masterkey = false;
- }else if (in_apws && localName.equals("Category")) {
+ }else if (in_oisafe && localName.equals("Category")) {
in_category = false;
myRestoreDataSet.storyCategory();