diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-03-10 20:22:29 +0100 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-03-10 20:22:29 +0100 |
commit | 630780cae4683e8ba403b28da84f963221d80ee3 (patch) | |
tree | 74ee9eac3a4c5640451e88b29a1b3350ca538def /src/org/apg/ui/SendKeyActivity.java | |
parent | 3fd5a55516eace832d2d2300ebf7a2579ab9c6dc (diff) | |
download | open-keychain-630780cae4683e8ba403b28da84f963221d80ee3.tar.gz open-keychain-630780cae4683e8ba403b28da84f963221d80ee3.tar.bz2 open-keychain-630780cae4683e8ba403b28da84f963221d80ee3.zip |
new directory structure
Diffstat (limited to 'src/org/apg/ui/SendKeyActivity.java')
-rw-r--r-- | src/org/apg/ui/SendKeyActivity.java | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/src/org/apg/ui/SendKeyActivity.java b/src/org/apg/ui/SendKeyActivity.java deleted file mode 100644 index c44e87469..000000000 --- a/src/org/apg/ui/SendKeyActivity.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.apg.ui; - -import org.apg.Apg; -import org.apg.Constants; -import org.apg.HkpKeyServer; -import org.apg.Id; -import org.apg.Constants.extras; -import org.apg.Id.message; -import org.spongycastle.openpgp.PGPKeyRing; -import org.spongycastle.openpgp.PGPPublicKeyRing; -import org.apg.R; - -import android.os.Bundle; -import android.os.Message; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.Spinner; -import android.widget.Toast; - -/** - * gpg --send-key activity - * - * Sends the selected public key to a key server - */ -public class SendKeyActivity extends BaseActivity { - - private Button export; - private Spinner keyServer; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.key_server_export_layout); - - export = (Button) findViewById(R.id.btn_export_to_server); - keyServer = (Spinner) findViewById(R.id.keyServer); - - ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mPreferences.getKeyServers()); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - keyServer.setAdapter(adapter); - if (adapter.getCount() > 0) { - keyServer.setSelection(0); - } else { - export.setEnabled(false); - } - - export.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - startThread(); - } - }); - } - - @Override - public void run() { - String error = null; - Bundle data = new Bundle(); - Message msg = new Message(); - - HkpKeyServer server = new HkpKeyServer((String) keyServer.getSelectedItem()); - - int keyRingId = getIntent().getIntExtra(Apg.EXTRA_KEY_ID, -1); - - PGPKeyRing keyring = Apg.getKeyRing(keyRingId); - if (keyring != null && keyring instanceof PGPPublicKeyRing) { - boolean uploaded = Apg.uploadKeyRingToServer(server, (PGPPublicKeyRing) keyring); - if (!uploaded) { - error = "Unable to export key to selected server"; - } - } - - data.putInt(Constants.extras.STATUS, Id.message.export_done); - - if (error != null) { - data.putString(Apg.EXTRA_ERROR, error); - } - - msg.setData(data); - sendMessage(msg); - } - - @Override - public void doneCallback(Message msg) { - super.doneCallback(msg); - - Bundle data = msg.getData(); - String error = data.getString(Apg.EXTRA_ERROR); - if (error != null) { - Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT).show(); - return; - } - - Toast.makeText(this, R.string.keySendSuccess, Toast.LENGTH_SHORT).show(); - finish(); - } -} |