]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: removed autolock within onUserInteraction() which caused
authorrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Sun, 6 Sep 2009 08:38:06 +0000 (08:38 +0000)
committerrmceoin <rmceoin@72b678ce-9140-0410-bee8-679b907dd61a>
Sun, 6 Sep 2009 08:38:06 +0000 (08:38 +0000)
duplicate frontdoors.
Added patches from Billy Cui for PassView copying to clipboard
and bug with IntentHandler

git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2295 72b678ce-9140-0410-bee8-679b907dd61a

17 files changed:
res/values-de/strings.xml
res/values-fr/strings.xml
res/values/strings.xml
src/org/openintents/safe/AskPassword.java
src/org/openintents/safe/CategoryEdit.java
src/org/openintents/safe/CategoryList.java
src/org/openintents/safe/ChangePass.java
src/org/openintents/safe/FrontDoor.java
src/org/openintents/safe/Help.java
src/org/openintents/safe/IntentHandler.java
src/org/openintents/safe/PassEdit.java
src/org/openintents/safe/PassGen.java
src/org/openintents/safe/PassList.java
src/org/openintents/safe/PassView.java
src/org/openintents/safe/Preferences.java
src/org/openintents/safe/Restore.java
src/org/openintents/safe/Search.java

index 29278ca826a50ff55ed21f7ad2d1abcb6b443476..7cfa8ba5f8a5b483e7a8fe4ac9ae52946293e4af 100644 (file)
     <string name="dialog_restore_database_msg">Sind Sie sicher, dass Sie die bestehenden Einträge ersetzen wollen?</string>
     <string name="restore_found">%s Passwörter im Backup gefunden vom %s.</string>
     <string name="restore_complete">Fertig. Passwörter wiederhergestellt: %s</string>
-    <string name="copy_to_clipboard">Password wurde in Zwischenablage kopiert</string>
+    <string name="copied_to_clipboard">wurde in Zwischenablage kopiert</string>
     <string name="invalid_website">Ungültige Webseite</string>
     
     <!-- Menu label to open a category -->
index 973acdefffdec33849eff1a758779203ada7d6fd..dc2285a5f8971a21deacaf36b294cbfc3d3904d7 100644 (file)
     <string name="dialog_restore_database_msg">Êtes-vous sûr de vouloir remplacer les données actuelles?</string>
     <string name="restore_found">Trouvé %s mots de passe à partir de la sauvegarde du %s.</string>
     <string name="restore_complete">Complet. Mots de passe restaurés: %s</string>
-    <string name="copy_to_clipboard">Copier le mot de passe dans le Presse-papiers</string>
+    <!--  needs to be re-translated -->
+    <string name="copied_to_clipboard">Copier le mot de passe dans le Presse-papiers</string>
     <string name="invalid_website">Site invalide</string>
     
     <!-- Menu label to open a category -->
index 7ac871b06c33a5d948b539bce07e39db83f296b0..9ef6f0cea815b34d72a9fb9a91bc5c362b8270b1 100644 (file)
     <string name="dialog_restore_database_msg">Are you sure you want to replace the current data?</string>\r
     <string name="restore_found">Found %s passwords from backup dated %s.</string>\r
     <string name="restore_complete">Complete.  Passwords restored: %s</string>\r
-    <string name="copy_to_clipboard">Copying Password to Clipboard</string>\r
+    <string name="copied_to_clipboard">copied to Clipboard</string>\r
     <string name="invalid_website">Invalid website</string>\r
     \r
     <!-- Menu label to open a category -->\r
index 003499761d422514759c6b0286670430cdc1bc2b..436404553f1e32c18943493f4aee901760e5c013 100644 (file)
@@ -53,7 +53,7 @@ import android.widget.Toast;
  */
 public class AskPassword extends Activity {
 
-       private boolean debug = false;
+       private boolean debug = true;
        private static String TAG = "AskPassword";
        public static String EXTRA_IS_LOCAL = "org.openintents.safe.bundle.EXTRA_IS_REMOTE";
 
@@ -293,6 +293,16 @@ public class AskPassword extends Activity {
                super.onPause();
 
                if (debug) Log.d(TAG, "onResume()");
+               if (CategoryList.isSignedIn()==true) {
+                       if (debug) Log.d(TAG,"already signed in");
+                       Intent callbackIntent = new Intent();
+                       callbackIntent.putExtra("salt", CategoryList.getSalt());
+                       callbackIntent.putExtra("masterKey", CategoryList.getMasterKey());
+                       setResult(RESULT_OK, callbackIntent);
+                       finish();
+                       return;
+               }
+
                if (dbHelper == null) {
                        dbHelper = new DBHelper(this);
                }
index bed6de75d54a3bac12ad4f9e19617db43fce0ce2..faf3e552ebff9e5568d1c6c190f3ec6d20cc35c6 100644 (file)
@@ -175,7 +175,7 @@ public class CategoryEdit extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 49d6893b3ee12800b9423df21eff832643ba0bab..42de1d79a62a20e5eb2c3ce1ef50859fbcc41b6b 100644 (file)
@@ -993,9 +993,9 @@ public class CategoryList extends ListActivity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       Intent frontdoor = new Intent(this, FrontDoor.class);
-                       frontdoor.setAction(CryptoIntents.ACTION_AUTOLOCK);
-                       startActivity(frontdoor);
+//                     Intent frontdoor = new Intent(this, FrontDoor.class);
+//                     frontdoor.setAction(CryptoIntents.ACTION_AUTOLOCK);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 5d00b09234b49faa1a388d658fbeaf9c8baa19b2..2c5d6c69bd9852324fd8a10dad6439a412f94239 100644 (file)
@@ -427,7 +427,7 @@ public class ChangePass extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index cf5822a7dde2c118639e1f5fcd67a61bd35be5ac..9be50b8b4bd945a668e9230bcd2a2d6afb7330ad 100644 (file)
@@ -35,7 +35,7 @@ import android.util.Log;
 public class FrontDoor extends Activity {\r
 \r
     private static final String TAG = "FrontDoor";\r
-       private static final boolean debug = false;\r
+       private static final boolean debug = true;\r
 \r
 //     public static final String KEY_AUTOLOCK = "autolock";\r
        \r
index c7262f8d52d33cdbdd533c7dc50942fac9790a08..e554e39a518fa72a9dd0f66abea7f70a5485dd53 100644 (file)
@@ -157,7 +157,7 @@ public class Help extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index f7eb8f658f0c04fda3564c1682fd7d592407e8b5..b1c33aff19e326884130d9a71c38f3c603ce9d73 100644 (file)
@@ -49,7 +49,7 @@ import android.widget.Toast;
  */\r
 public class IntentHandler extends Activity {\r
 \r
-       private static final boolean debug = false;\r
+       private static final boolean debug = true;\r
        private static String TAG = "IntentHandler";\r
        \r
        private static final int REQUEST_CODE_ASK_PASSWORD = 1;\r
@@ -65,18 +65,17 @@ public class IntentHandler extends Activity {
        private Intent mServiceIntent;\r
 \r
     SharedPreferences mPreferences;\r
-       //public static String SERVICE_NAME = "org.openintents.safe.service.ServiceDispatchImpl";\r
        \r
        /** Called when the activity is first created. */\r
        @Override\r
        public void onCreate(Bundle icicle) {\r
                super.onCreate(icicle);\r
+               if (debug) Log.d(TAG, "onCreate()");\r
+               \r
                mServiceIntent = null;\r
                mPreferences = PreferenceManager.getDefaultSharedPreferences(this);\r
 \r
                Passwords.Initialize(this);\r
-\r
-               // The service is launched in onResume()\r
        }\r
 \r
        \r
@@ -518,6 +517,13 @@ public class IntentHandler extends Activity {
                        }\r
                        \r
                        try {\r
+                               final Intent thisIntent = getIntent();\r
+                               String action=thisIntent.getAction();\r
+                               if (action!=null && action.equals(CryptoIntents.ACTION_AUTOLOCK)) {\r
+                                       if (debug) Log.d(TAG,"autolock");\r
+                                       askPassIsLocal=true;\r
+                               }\r
+\r
                                if (service.getPassword() == null) {\r
                                        boolean promptforpassword = getIntent().getBooleanExtra(CryptoIntents.EXTRA_PROMPT, true);\r
                                        if (debug) Log.d(TAG, "Prompt for password: " + promptforpassword);\r
@@ -527,14 +533,8 @@ public class IntentHandler extends Activity {
                                                Intent askPass = new Intent(getApplicationContext(),\r
                                                                AskPassword.class);\r
        \r
-                                               final Intent thisIntent = getIntent();\r
                                                String inputBody = thisIntent.getStringExtra (CryptoIntents.EXTRA_TEXT);\r
        \r
-                                               String action=thisIntent.getAction();\r
-                                               if (action!=null && action.equals(CryptoIntents.ACTION_AUTOLOCK)) {\r
-                                                       if (debug) Log.d(TAG,"autolock");\r
-                                                       askPassIsLocal=true;\r
-                                               }\r
                                                askPass.putExtra (CryptoIntents.EXTRA_TEXT, inputBody);\r
                                                askPass.putExtra (AskPassword.EXTRA_IS_LOCAL, askPassIsLocal);\r
                                                //TODO: Is there a way to make sure all the extras are set?     \r
index 7bbdf767589ad56f2d7e8e3a7eb2dac72ff598bd..08fdbda30d8866a92d27fd44199bc980be678b7b 100644 (file)
@@ -128,7 +128,7 @@ public class PassEdit extends Activity {
                goButton.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View arg0) {
 
-                               Toast.makeText(PassEdit.this, R.string.copy_to_clipboard,
+                               Toast.makeText(PassEdit.this, getString(R.string.password)+" "+getString(R.string.copied_to_clipboard),
                                                Toast.LENGTH_SHORT).show();
 
                                ClipboardManager cb = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
@@ -384,8 +384,8 @@ public class PassEdit extends Activity {
                                populated=true;
                        }
                }  
-       }  
-
+       }
+       
        @Override
        public void onUserInteraction() {
                super.onUserInteraction();
@@ -393,7 +393,7 @@ public class PassEdit extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 70b8eb7e03a677e5ec3717d23fc53efdb1c58901..3fc8d12354ae162f3a6eb4967fb7cd9f4af683c0 100644 (file)
@@ -249,7 +249,7 @@ public class PassGen extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 73093c3663c71f8ac7489612de4e294532f0f977..8c165903dec7c9e3634d5233fe9b3349f40e54d4 100644 (file)
@@ -60,7 +60,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
  */
 public class PassList extends ListActivity {
 
-       private static final boolean debug = false;
+       private static final boolean debug = true;
     private static final String TAG = "PassList";
 
     // Menu Item order
@@ -198,6 +198,7 @@ public class PassList extends ListActivity {
                } catch (IllegalArgumentException e) {
                        if (debug) Log.d(TAG,"IllegalArgumentException");
                }
+               removeDialog(DECRYPT_PROGRESS_KEY);
     }
 
     @Override
@@ -491,7 +492,7 @@ public class PassList extends ListActivity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 7270ea62bd63bfe219eda6319992284e3557b780..51e86c80b8ddf855012a1e7028ecda9a286ae1b1 100644 (file)
@@ -50,7 +50,7 @@ import android.widget.Toast;
  * 
  * @author Randy McEoin
  */
-public class PassView extends Activity {
+public class PassView extends Activity implements View.OnClickListener {
 
        private static boolean debug = false;
        private static String TAG = "PassView";
@@ -130,15 +130,14 @@ public class PassView extends Activity {
 
                goButton.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View arg0) {
+                               String link = websiteText.getText().toString();
+                               if (link == null || link.equals("") || link.equals("http://")) {
+                                       return;
+                               }
 
-                               Toast.makeText(PassView.this, R.string.copy_to_clipboard,
-                                               Toast.LENGTH_SHORT).show();
-
-                               ClipboardManager cb = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
-                               cb.setText(passwordText.getText().toString());
+                               clipboard(getString(R.string.password), passwordText.getText().toString());
 
                                Intent i = new Intent(Intent.ACTION_VIEW);
-                               String link = websiteText.getText().toString();
                                Uri u = Uri.parse(link);
                                i.setData(u);
                                try {
@@ -322,7 +321,9 @@ public class PassView extends Activity {
                        descriptionText.setText(row.plainDescription);
                        websiteText.setText(row.plainWebsite);
                        usernameText.setText(row.plainUsername);
+                       usernameText.setOnClickListener(this);
                        passwordText.setText(row.plainPassword);
+                       passwordText.setOnClickListener(this);
                        noteText.setText(row.plainNote);
                        String lastEdited;
                        if (row.lastEdited!=null) {
@@ -357,6 +358,35 @@ public class PassView extends Activity {
                }
        }
 
+       /**
+        * 
+        * @author Billy Cui
+        */
+       public void onClick(View view) {
+               if (view == usernameText) {
+                       if (debug) Log.d(TAG, "click " + usernameText.getText());
+                       clipboard(getString(R.string.username),usernameText.getText().toString());
+               } else if (view == passwordText) {
+                       if (debug) Log.d(TAG, "click " + passwordText.getText());
+                       clipboard(getString(R.string.password),passwordText.getText().toString());
+               }
+       }
+
+       /**
+        * Copy to clipboard and toast to let user know that we have done so.
+        * 
+        * @author Billy Cui
+        * @param fieldName Name of the field copied from
+        * @param value String to copy to clipboard
+        */
+       private void clipboard(String fieldName, String value) {
+               Toast.makeText(PassView.this, fieldName+" "+getString(R.string.copied_to_clipboard),
+                               Toast.LENGTH_SHORT).show();
+
+               ClipboardManager cb = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
+               cb.setText(value);
+       }
+
        @Override
        public void onUserInteraction() {
                super.onUserInteraction();
@@ -364,7 +394,7 @@ public class PassView extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 3fddb5f6e61be2fd1c5ab7b73d5ce611568a0b1b..ffb0619ddba62ebb5af38d97be157f663d208a25 100644 (file)
@@ -86,7 +86,7 @@ public class Preferences extends PreferenceActivity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index a3caf9a172a719eab9dad66a18e1f42553d27691..a25c7bc57254392819e81b3182faaa597c42244a 100644 (file)
@@ -368,7 +368,7 @@ public class Restore extends Activity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }
index 901187058f1f8b250d4e0cd9be40fad9662fd6e9..71a916d0715c7bd5f38e42ca813304ef0f7932e9 100644 (file)
@@ -281,7 +281,7 @@ public class Search extends ListActivity {
                if (debug) Log.d(TAG,"onUserInteraction()");
 
                if (CategoryList.isSignedIn()==false) {
-                       startActivity(frontdoor);
+//                     startActivity(frontdoor);
                }else{
                        if (restartTimerIntent!=null) sendBroadcast (restartTimerIntent);
                }