Browse Source

Merged changes.

pull/11/head
Eric Kok 12 years ago
parent
commit
fe1a993c32
  1. 2
      android/.classpath
  2. 5
      android/src/org/transdroid/gui/DetailsFragment.java
  3. 4
      lib/src/org/transdroid/daemon/util/HttpHelper.java

2
android/.classpath

@ -2,8 +2,8 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/Transdroid Torrent Connect"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/Transdroid Torrent Connect"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

5
android/src/org/transdroid/gui/DetailsFragment.java

@ -265,8 +265,11 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
} }
if (item.getItemId() == FILEMENU_FTPDOWNLOAD_ID) { if (item.getItemId() == FILEMENU_FTPDOWNLOAD_ID) {
// Set up an intent to download this file using the partial user-specified FTP URL // Set up an intent to download this file using the partial user-specified FTP URL
Uri ftpUri = Uri.parse(daemon.getSettings().getFtpUrl() + file.getRelativePath()); Uri ftpUri = Uri.parse(daemon.getSettings().getFtpUrl() + file.getRelativePath());
// Try with an AndFTP PICK Intent
Intent dl = new Intent(Intent.ACTION_PICK); Intent dl = new Intent(Intent.ACTION_PICK);
dl.setDataAndType(Uri.parse(ftpUri.getScheme() + "://" + ftpUri.getHost()), Transdroid.ANDFTP_INTENT_TYPE); dl.setDataAndType(Uri.parse(ftpUri.getScheme() + "://" + ftpUri.getHost()), Transdroid.ANDFTP_INTENT_TYPE);
if (!ftpUri.getScheme().equals("alias")) { if (!ftpUri.getScheme().equals("alias")) {
@ -283,7 +286,7 @@ public class DetailsFragment extends Fragment implements IDaemonCallback, OnSele
ftpUri.getEncodedPath().indexOf("/", 1) < 0? ftpUri.getEncodedPath().substring(1): ftpUri.getEncodedPath()); ftpUri.getEncodedPath().indexOf("/", 1) < 0? ftpUri.getEncodedPath().substring(1): ftpUri.getEncodedPath());
dl.putExtra(Transdroid.ANDFTP_INTENT_LOCAL, "/sdcard/download"); dl.putExtra(Transdroid.ANDFTP_INTENT_LOCAL, "/sdcard/download");
TLog.d(LOG_NAME, "Requesting FTP transfer for " + dl.getStringExtra(Transdroid.ANDFTP_INTENT_FILE) TLog.d(LOG_NAME, "Requesting AndFTP transfer for " + dl.getStringExtra(Transdroid.ANDFTP_INTENT_FILE)
+ " from " + dl.getDataString()); + " from " + dl.getDataString());
if (ActivityUtil.isIntentAvailable(getActivity(), dl)) { if (ActivityUtil.isIntentAvailable(getActivity(), dl)) {
startActivity(dl); startActivity(dl);

4
lib/src/org/transdroid/daemon/util/HttpHelper.java

@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.security.InvalidParameterException;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import org.apache.http.Header; import org.apache.http.Header;
@ -49,6 +48,7 @@ import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams; import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpContext;
import org.transdroid.daemon.DaemonException; import org.transdroid.daemon.DaemonException;
import org.transdroid.daemon.DaemonException.ExceptionType;
import org.transdroid.daemon.DaemonSettings; import org.transdroid.daemon.DaemonSettings;
/** /**
@ -113,7 +113,7 @@ public class HttpHelper {
// Authentication credentials // Authentication credentials
if (userBasicAuth) { if (userBasicAuth) {
if (username == null || password == null) { if (username == null || password == null) {
throw new InvalidParameterException("No username or password was provided while we hadauthentication enabled"); throw new DaemonException(ExceptionType.AuthenticationFailure, "No username or password was provided while we hadauthentication enabled");
} }
httpclient.getCredentialsProvider().setCredentials( httpclient.getCredentialsProvider().setCredentials(
new AuthScope(authAddress, authPort, AuthScope.ANY_REALM), new AuthScope(authAddress, authPort, AuthScope.ANY_REALM),

Loading…
Cancel
Save