From: rmceoin Date: Sun, 3 Jan 2010 03:08:47 +0000 (+0000) Subject: OI Safe: export to CSV now also exports Last edited. import ignores the X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=144182102a9aa44ee763840fb2edc4a9660f9a7a;p=android-vcpass-oisafe OI Safe: export to CSV now also exports Last edited. import ignores the extra column git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2455 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/AskPassword.java b/src/org/openintents/safe/AskPassword.java index df3e521..0ffb61c 100644 --- a/src/org/openintents/safe/AskPassword.java +++ b/src/org/openintents/safe/AskPassword.java @@ -68,7 +68,7 @@ public class AskPassword extends Activity { private int viewMode = VIEW_NORMAL; private EditText pbeKey; - private DBHelper dbHelper; + private DBHelper dbHelper=null; private TextView introText; // private TextView confirmText; private TextView remoteAsk; @@ -276,8 +276,10 @@ public class AskPassword extends Activity { if (debug) Log.d(TAG, "onPause()"); - dbHelper.close(); - dbHelper = null; + if (dbHelper!=null) { + dbHelper.close(); + dbHelper = null; + } } @Override diff --git a/src/org/openintents/safe/CategoryList.java b/src/org/openintents/safe/CategoryList.java index c73e1eb..cae49be 100644 --- a/src/org/openintents/safe/CategoryList.java +++ b/src/org/openintents/safe/CategoryList.java @@ -701,7 +701,8 @@ public class CategoryList extends ListActivity { getString(R.string.website), getString(R.string.username), getString(R.string.password), - getString(R.string.notes) + getString(R.string.notes), + getString(R.string.last_edited) }; writer.writeNext(header); @@ -716,7 +717,8 @@ public class CategoryList extends ListActivity { row.plainWebsite, row.plainUsername, row.plainPassword, - row.plainNote + row.plainNote, + row.lastEdited }; writer.writeNext(rowEntries); } @@ -835,7 +837,7 @@ public class CategoryList extends ListActivity { importMessage=getString(R.string.import_error_first_line); return; } - if (nextLine.length != recordLength){ + if (nextLine.length < recordLength){ importMessage=getString(R.string.import_error_first_line); return; } diff --git a/src/org/openintents/safe/IntentHandler.java b/src/org/openintents/safe/IntentHandler.java index c0f2fe2..be3ad92 100644 --- a/src/org/openintents/safe/IntentHandler.java +++ b/src/org/openintents/safe/IntentHandler.java @@ -18,6 +18,7 @@ package org.openintents.safe; import java.util.ArrayList; +import java.util.Arrays; import org.openintents.intents.CryptoIntents; import org.openintents.safe.dialog.DialogHostingActivity; @@ -61,7 +62,7 @@ public class IntentHandler extends Activity { // service elements private static ServiceDispatch service=null; - private ServiceDispatchConnection conn; + private ServiceDispatchConnection conn=null; private Intent mServiceIntent; SharedPreferences mPreferences; @@ -70,7 +71,7 @@ public class IntentHandler extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - if (debug) Log.d(TAG, "onCreate()"); + if (debug) Log.d(TAG, "onCreate("+icicle+")"); mServiceIntent = null; mPreferences = PreferenceManager.getDefaultSharedPreferences(this); @@ -113,6 +114,7 @@ public class IntentHandler extends Activity { try { salt = service.getSalt(); masterKey = service.getPassword(); + if (debug) Log.d(TAG,"starting actiondispatch"); actionDispatch(); } catch (RemoteException e) { Log.d(TAG, e.toString()); @@ -186,6 +188,8 @@ public class IntentHandler extends Activity { CategoryList.setSalt(salt); PassList.setMasterKey(masterKey); CategoryList.setMasterKey(masterKey); + + if (debug) Log.d(TAG,"actionDispatch()"); if ((salt==null) || (salt=="")) { return; } @@ -261,6 +265,7 @@ public class IntentHandler extends Activity { if (thisIntent.hasExtra(CryptoIntents.EXTRA_TEXT)) { // get the body text out of the extras. String inputBody = thisIntent.getStringExtra (CryptoIntents.EXTRA_TEXT); + if (debug) Log.d(TAG,"inputBody="+inputBody); String outputBody = ""; outputBody = ch.encryptWithSessionKey (inputBody); // stash the encrypted text in the extra @@ -269,12 +274,14 @@ public class IntentHandler extends Activity { if (thisIntent.hasExtra(CryptoIntents.EXTRA_TEXT_ARRAY)) { String[] in = thisIntent.getStringArrayExtra(CryptoIntents.EXTRA_TEXT_ARRAY); + if (debug) Log.d(TAG,"in="+Arrays.toString(in)); String[] out = new String[in.length]; for (int i = 0; i < in.length; i++) { if (in[i] != null) { out[i] = ch.encryptWithSessionKey(in[i]); } } + if (debug) Log.d(TAG,"out="+Arrays.toString(out)); callbackIntent.putExtra(CryptoIntents.EXTRA_TEXT_ARRAY, out); } @@ -476,11 +483,15 @@ public class IntentHandler extends Activity { private void initService() { boolean isLocal = isIntentLocal(); - conn = new ServiceDispatchConnection(isLocal); - Intent i = new Intent(); - i.setClass(this, ServiceDispatchImpl.class); - startService(i); - bindService( i, conn, Context.BIND_AUTO_CREATE); + if (conn==null) { + conn = new ServiceDispatchConnection(isLocal); + Intent i = new Intent(); + i.setClass(this, ServiceDispatchImpl.class); + startService(i); + bindService( i, conn, Context.BIND_AUTO_CREATE); + } else { + if (debug) Log.d(TAG,"service already running"); + } } /** @@ -555,6 +566,8 @@ public class IntentHandler extends Activity { if (askPassIsLocal || externalAccess) { salt = service.getSalt(); masterKey = service.getPassword(); + if (debug) Log.d(TAG,"starting actiondispatch from service"); + actionDispatch(); } else { if (debug) Log.d(TAG, "onServiceConnected: showDialogAllowExternalAccess()");