aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java11
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java44
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java9
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java9
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SignKeyActivity.java4
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java2
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java1
-rw-r--r--OpenPGP-Keychain/src/main/res/raw/help_nfc_beam.html2
-rw-r--r--OpenPGP-Keychain/src/main/res/raw/nfc_beam_share.html4
-rw-r--r--OpenPGP-Keychain/src/main/res/values/strings.xml1
10 files changed, 44 insertions, 43 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
index 9018bd21c..a7a574ee7 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java
@@ -110,10 +110,11 @@ public class PgpImportExport {
/**
* Imports keys from given data. If keyIds is given only those are imported
*/
- public Bundle importKeyRings(List<ImportKeysListEntry> entries) throws PgpGeneralException, PGPException, IOException {
+ public Bundle importKeyRings(List<ImportKeysListEntry> entries)
+ throws PgpGeneralException, PGPException, IOException {
Bundle returnData = new Bundle();
- updateProgress(R.string.progress_importing_secret_keys, 0, entries.size());
+ updateProgress(R.string.progress_importing, 0, 100);
int newKeys = 0;
int oldKeys = 0;
@@ -142,12 +143,12 @@ public class PgpImportExport {
} else if (status == Id.return_value.bad) {
++badKeys;
}
-
- position++;
- updateProgress(position, entries.size());
} else {
Log.e(Constants.TAG, "Object not recognized as PGPKeyRing!");
}
+
+ position++;
+ updateProgress(position / entries.size() * 100, 100);
}
} catch (Exception e) {
Log.e(Constants.TAG, "Exception on parsing key file!", e);
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
index bf534012f..52883749e 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
@@ -121,39 +121,30 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
extras = new Bundle();
}
- /**
- * Android Standard Actions
- */
if (Intent.ACTION_VIEW.equals(action)) {
// Android's Action when opening file associated to Keychain (see AndroidManifest.xml)
// override action to delegate it to Keychain's ACTION_IMPORT_KEY
action = ACTION_IMPORT_KEY;
}
- /**
- * Scanning a fingerprint directly with Barcode Scanner
- */
if (scheme != null && scheme.toLowerCase(Locale.ENGLISH).equals(Constants.FINGERPRINT_SCHEME)) {
+ /* Scanning a fingerprint directly with Barcode Scanner */
getSupportActionBar().setSelectedNavigationItem(0);
loadFragment(ImportKeysQrCodeFragment.class, null, mNavigationStrings[0]);
loadFromFingerprintUri(dataUri);
- }
-
- /**
- * Keychain's own Actions
- */
- if (ACTION_IMPORT_KEY.equals(action)) {
+ } else if (ACTION_IMPORT_KEY.equals(action)) {
+ /* Keychain's own Actions */
getSupportActionBar().setSelectedNavigationItem(1);
loadFragment(ImportKeysFileFragment.class, null, mNavigationStrings[1]);
if (dataUri != null) {
// directly load data
- startListFragment(savedInstanceState, null, dataUri);
+ startListFragment(savedInstanceState, null, dataUri, null);
} else if (extras.containsKey(EXTRA_KEY_BYTES)) {
byte[] importData = intent.getByteArrayExtra(EXTRA_KEY_BYTES);
// directly load data
- startListFragment(savedInstanceState, importData, null);
+ startListFragment(savedInstanceState, importData, null, null);
}
} else if (ACTION_IMPORT_KEY_FROM_KEYSERVER.equals(action)) {
String query = null;
@@ -179,9 +170,11 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
Bundle args = new Bundle();
args.putString(ImportKeysServerFragment.ARG_QUERY, query);
loadFragment(ImportKeysServerFragment.class, args, mNavigationStrings[0]);
+
+ startListFragment(savedInstanceState, null, null, query);
} else {
// Other actions
- startListFragment(savedInstanceState, null, null);
+ startListFragment(savedInstanceState, null, null, null);
if (ACTION_IMPORT_KEY_FROM_FILE.equals(action)) {
getSupportActionBar().setSelectedNavigationItem(1);
@@ -197,7 +190,7 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
}
}
- private void startListFragment(Bundle savedInstanceState, byte[] bytes, Uri dataUri) {
+ private void startListFragment(Bundle savedInstanceState, byte[] bytes, Uri dataUri, String serverQuery) {
// Check that the activity is using the layout version with
// the fragment_container FrameLayout
if (findViewById(R.id.import_keys_list_container) != null) {
@@ -210,7 +203,7 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
}
// Create an instance of the fragment
- mListFragment = ImportKeysListFragment.newInstance(bytes, dataUri, null);
+ mListFragment = ImportKeysListFragment.newInstance(bytes, dataUri, serverQuery);
// Add the fragment to the 'fragment_container' FrameLayout
// NOTE: We use commitAllowingStateLoss() to prevent weird crashes!
@@ -270,14 +263,19 @@ public class ImportKeysActivity extends DrawerActivity implements OnNavigationLi
return;
}
- Intent queryIntent = new Intent(this, ImportKeysActivity.class);
- queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER);
- queryIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
- startActivity(queryIntent);
+ String query = "0x" + fingerprint;
+
+ // search directly
+ getSupportActionBar().setSelectedNavigationItem(0);
+ Bundle args = new Bundle();
+ args.putString(ImportKeysServerFragment.ARG_QUERY, query);
+ loadFragment(ImportKeysServerFragment.class, args, mNavigationStrings[0]);
+
+ startListFragment(null, null, null, query);
}
- public void loadCallback(byte[] importData, Uri dataUri, String serverQuery, String keyserver) {
- mListFragment.loadNew(importData, dataUri, serverQuery, keyserver);
+ public void loadCallback(byte[] importData, Uri dataUri, String serverQuery, String keyServer) {
+ mListFragment.loadNew(importData, dataUri, serverQuery, keyServer);
}
// private void importAndSignOld(final long keyId, final String expectedFingerprint) {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
index ea9f507db..3006b0820 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysAdapter;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListLoader;
@@ -122,6 +123,10 @@ public class ImportKeysListFragment extends SherlockListFragment implements
mKeyBytes = getArguments().getByteArray(ARG_BYTES);
mServerQuery = getArguments().getString(ARG_SERVER_QUERY);
+ // TODO: this is used when scanning QR Code. Currently it simply uses key server nr 0
+ mKeyServer = Preferences.getPreferences(getActivity())
+ .getKeyServers()[0];
+
if (mDataUri != null || mKeyBytes != null) {
// Start out with a progress indicator.
setListShown(false);
@@ -155,8 +160,8 @@ public class ImportKeysListFragment extends SherlockListFragment implements
mAdapter.notifyDataSetChanged();
}
- public void loadNew(byte[] importData, Uri dataUri, String serverQuery, String keyServer) {
- mKeyBytes = importData;
+ public void loadNew(byte[] keyBytes, Uri dataUri, String serverQuery, String keyServer) {
+ mKeyBytes = keyBytes;
mDataUri = dataUri;
mServerQuery = serverQuery;
mKeyServer = keyServer;
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java
index da0033083..2e0956d8b 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java
@@ -17,8 +17,10 @@
package org.sufficientlysecure.keychain.ui;
+import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.Preferences;
+import org.sufficientlysecure.keychain.util.Log;
import android.content.Context;
import android.os.Bundle;
@@ -124,10 +126,10 @@ public class ImportKeysServerFragment extends Fragment {
mImportActivity = (ImportKeysActivity) getActivity();
- // if query has been set on instantiation, search immediately!
+ // set displayed values
if (getArguments() != null && getArguments().containsKey(ARG_QUERY)) {
String query = getArguments().getString(ARG_QUERY);
- mQueryEditText.setText(query);
+ mQueryEditText.setText(query, TextView.BufferType.EDITABLE);
String keyServer = null;
if (getArguments().containsKey(ARG_KEY_SERVER)) {
@@ -138,7 +140,8 @@ public class ImportKeysServerFragment extends Fragment {
keyServer = (String) mServerSpinner.getSelectedItem();
}
- search(query, keyServer);
+ Log.d(Constants.TAG, "query: " + query);
+ Log.d(Constants.TAG, "keyServer: " + keyServer);
}
}
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SignKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SignKeyActivity.java
index a8b9b0d88..cb2ec9551 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SignKeyActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SignKeyActivity.java
@@ -54,9 +54,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.beardedhen.androidbootstrap.BootstrapButton;
/**
- * gpg --sign-key
- *
- * signs the specified public key with the specified secret master key
+ * Signs the specified public key with the specified secret master key
*/
public class SignKeyActivity extends SherlockFragmentActivity implements
SelectSecretKeyLayoutFragment.SelectSecretKeyCallback {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
index d72dd37ab..87c06c97e 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java
@@ -40,8 +40,6 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.beardedhen.androidbootstrap.BootstrapButton;
/**
- * gpg --send-key activity
- *
* Sends the selected public key to a key server
*/
public class UploadKeyActivity extends SherlockFragmentActivity {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
index bd583ac10..05e52fb47 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java
@@ -178,7 +178,6 @@ public class HkpKeyServer extends KeyServer {
Matcher matcher = PUB_KEY_LINE.matcher(data);
while (matcher.find()) {
-// KeyInfo info = new KeyInfo();
ImportKeysListEntry info = new ImportKeysListEntry();
info.bitStrength = Integer.parseInt(matcher.group(1));
info.algorithm = matcher.group(2);
diff --git a/OpenPGP-Keychain/src/main/res/raw/help_nfc_beam.html b/OpenPGP-Keychain/src/main/res/raw/help_nfc_beam.html
index 301c04267..f3bb9d16e 100644
--- a/OpenPGP-Keychain/src/main/res/raw/help_nfc_beam.html
+++ b/OpenPGP-Keychain/src/main/res/raw/help_nfc_beam.html
@@ -7,7 +7,7 @@ And don't add newlines before or after p tags because of transifex -->
<body>
<h2>How to receive keys</h2>
<ol>
-<li>Go to your partners 'Manage Public Keys' and long press on the key you want to share.</li>
+<li>Go to your partners contacts and open the contact you want to share.</li>
<li>Hold the two devices back to back (they have to be almost touching) and you’ll feel a vibration.</li>
<li>After it vibrates you’ll see the content on your partners device turn into a card-like object with Star Trek warp speed-looking animation in the background.</li>
<li>Tap the card and the content will then load on the your device.</li>
diff --git a/OpenPGP-Keychain/src/main/res/raw/nfc_beam_share.html b/OpenPGP-Keychain/src/main/res/raw/nfc_beam_share.html
index 734e69fc5..873c71777 100644
--- a/OpenPGP-Keychain/src/main/res/raw/nfc_beam_share.html
+++ b/OpenPGP-Keychain/src/main/res/raw/nfc_beam_share.html
@@ -7,8 +7,8 @@ And don't add newlines before or after p tags because of transifex -->
<body>
<ol>
<li>Make sure that NFC is turned on in Settings > More > NFC and make sure that Android Beam is also on in the same section.</li>
-<li>Hold the two devices back to back (they have to be almost touching) and you’ll feel a vibration.</li>
-<li>After it vibrates you’ll see the content on your device turn into a card-like object with Star Trek warp speed-looking animation in the background.</li>
+<li>Hold the two devices back to back (they have to be almost touching) and you'll feel a vibration.</li>
+<li>After it vibrates you'll see the content on your device turn into a card-like object with Star Trek warp speed-looking animation in the background.</li>
<li>Tap the card and the content will then load on the other person’s device.</li>
</ol>
</body>
diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml
index 61d6bbe30..c47f9e860 100644
--- a/OpenPGP-Keychain/src/main/res/values/strings.xml
+++ b/OpenPGP-Keychain/src/main/res/values/strings.xml
@@ -294,7 +294,6 @@
<string name="progress_building_master_key">building master ring…</string>
<string name="progress_adding_sub_keys">adding sub keys…</string>
<string name="progress_saving_key_ring">saving key…</string>
- <string name="progress_importing_secret_keys">importing secret keys…</string>
<plurals name="progress_exporting_key">
<item quantity="one">exporting key…</item>