mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #1222 from mfleisz/andrtsg
Android: Added support for TS Gateway
This commit is contained in:
commit
ea443ace40
|
@ -586,7 +586,7 @@ void android_process_cliprdr_event(freerdp* inst, wMessage* event)
|
|||
break;
|
||||
|
||||
default:
|
||||
DEBUG_ANDROID("unknown event type %d", event->event_type);
|
||||
DEBUG_ANDROID("unknown event type %d", GetMessageType(event->id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -652,6 +652,37 @@ JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass
|
|||
settings->RedirectClipboard = enable ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port,
|
||||
jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain)
|
||||
{
|
||||
freerdp* inst = (freerdp*)instance;
|
||||
rdpSettings * settings = inst->settings;
|
||||
|
||||
const jbyte *gatewayhostname = (*env)->GetStringUTFChars(env, jgatewayhostname, NULL);
|
||||
const jbyte *gatewayusername = (*env)->GetStringUTFChars(env, jgatewayusername, NULL);
|
||||
const jbyte *gatewaypassword = (*env)->GetStringUTFChars(env, jgatewaypassword, NULL);
|
||||
const jbyte *gatewaydomain = (*env)->GetStringUTFChars(env, jgatewaydomain, NULL);
|
||||
|
||||
DEBUG_ANDROID("gatewayhostname: %s", (char*) gatewayhostname);
|
||||
DEBUG_ANDROID("gatewayport: %d", port);
|
||||
DEBUG_ANDROID("gatewayusername: %s", (char*) gatewayusername);
|
||||
DEBUG_ANDROID("gatewaypassword: %s", (char*) gatewaypassword);
|
||||
DEBUG_ANDROID("gatewaydomain: %s", (char*) gatewaydomain);
|
||||
|
||||
settings->GatewayHostname = strdup(gatewayhostname);
|
||||
settings->GatewayPort = port;
|
||||
settings->GatewayUsername = strdup(gatewayusername);
|
||||
settings->GatewayPassword = strdup(gatewaypassword);
|
||||
settings->GatewayDomain = strdup(gatewaydomain);
|
||||
settings->GatewayUsageMethod = TRUE;
|
||||
settings->GatewayUseSameCredentials = FALSE;
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, jgatewayhostname, gatewayhostname);
|
||||
(*env)->ReleaseStringUTFChars(env, jgatewayusername, gatewayusername);
|
||||
(*env)->ReleaseStringUTFChars(env, jgatewaypassword, gatewaypassword);
|
||||
(*env)->ReleaseStringUTFChars(env, jgatewaydomain, gatewaydomain);
|
||||
}
|
||||
|
||||
void copy_pixel_buffer(UINT8* dstBuf, UINT8* srcBuf, int x, int y, int width, int height, int wBuf, int hBuf, int bpp)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -737,7 +768,7 @@ JNIEXPORT void JNICALL jni_freerdp_send_key_event(
|
|||
|
||||
android_push_event(inst, event);
|
||||
|
||||
DEBUG_ANDROID("send_key_event: %d, %d", scancode, flags);
|
||||
DEBUG_ANDROID("send_key_event: %d, %d", (int)scancode, flags);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL jni_freerdp_send_unicodekey_event(
|
||||
|
|
|
@ -46,6 +46,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls
|
|||
JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir);
|
||||
JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath);
|
||||
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
|
||||
JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain);
|
||||
JNIEXPORT void JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cls, jint instance, jstring jdirectory);
|
||||
JNIEXPORT jboolean JNICALL jni_freerdp_update_graphics(JNIEnv *env, jclass cls, jint instance, jobject bitmap, jint x, jint y, jint width, jint height);
|
||||
JNIEXPORT void JNICALL jni_freerdp_send_cursor_event(JNIEnv *env, jclass cls, jint instance, jint x, jint y, jint flags);
|
||||
|
|
|
@ -82,6 +82,12 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
|
|||
jni_freerdp_set_drive_redirection(env, cls, inst, path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1gateway_1info
|
||||
(JNIEnv *env, jclass cls, jint inst, jstring hostname, jint port, jstring username, jstring password, jstring domain)
|
||||
{
|
||||
jni_freerdp_set_gateway_info(env, cls, inst, hostname, port, username, password, domain);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1update_1graphics(
|
||||
JNIEnv *env, jclass cls, jint instance, jobject bitmap, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,14 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
|
|||
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1drive_1redirection
|
||||
(JNIEnv *, jclass, jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
|
||||
* Method: freerdp_set_gateway_info
|
||||
* Signature: (ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1gateway_1info
|
||||
(JNIEnv *, jclass, jint, jstring, jint, jstring, jstring, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
|
||||
* Method: freerdp_update_graphics
|
||||
|
|
|
@ -105,6 +105,9 @@
|
|||
<string name="settings_enable_3g_settings">Configuracion 3G</string>
|
||||
<string name="settings_screen_3g">Pantalla 3G</string>
|
||||
<string name="settings_performance_3g">Rendimiento 3G</string>
|
||||
<string name="settings_cat_gateway">Gateway</string>
|
||||
<string name="settings_enable_gateway_settings">Enable Gateway</string>
|
||||
<string name="settings_gateway_settings">Gateway Settings</string>
|
||||
<string name="settings_redirect_sdcard">Redirect SDCard</string>
|
||||
<string name="settings_security">Seguridad</string>
|
||||
<string-array name="security_array">
|
||||
|
|
|
@ -104,6 +104,9 @@
|
|||
<string name="settings_enable_3g_settings">"Paramètres 3G"</string>
|
||||
<string name="settings_screen_3g">"Écran 3G"</string>
|
||||
<string name="settings_performance_3g">"Performance 3G"</string>
|
||||
<string name="settings_cat_gateway">Gateway</string>
|
||||
<string name="settings_enable_gateway_settings">Enable Gateway</string>
|
||||
<string name="settings_gateway_settings">Gateway Settings</string>
|
||||
<string name="settings_redirect_sdcard">"Redirect SDCard"</string>
|
||||
<string name="settings_security">"Securité"</string>
|
||||
<string-array name="security_array">
|
||||
|
|
|
@ -105,6 +105,9 @@
|
|||
<string name="settings_enable_3g_settings">3G Settings</string>
|
||||
<string name="settings_screen_3g">3G Screen</string>
|
||||
<string name="settings_performance_3g">3G Performance</string>
|
||||
<string name="settings_cat_gateway">Gateway</string>
|
||||
<string name="settings_enable_gateway_settings">Enable Gateway</string>
|
||||
<string name="settings_gateway_settings">Gateway Settings</string>
|
||||
<string name="settings_redirect_sdcard">Redirect SDCard</string>
|
||||
<string name="settings_security">Security</string>
|
||||
<string-array name="security_array">
|
||||
|
|
|
@ -12,8 +12,15 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<PreferenceCategory android:title="Advanced">
|
||||
|
||||
<CheckBoxPreference android:key="bookmark.enable_3g_settings" android:title="@string/settings_enable_3g_settings" />
|
||||
|
||||
<CheckBoxPreference android:key="bookmark.enable_gateway_settings" android:title="@string/settings_enable_gateway_settings" />
|
||||
<PreferenceScreen android:key="bookmark.gateway_settings" android:title="@string/settings_gateway_settings">
|
||||
<intent android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="*"
|
||||
android:targetClass="com.freerdp.freerdpcore.presentation.BookmarkActivity"
|
||||
android:data="preferences://gateway_settings" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<CheckBoxPreference android:key="bookmark.enable_3g_settings" android:title="@string/settings_enable_3g_settings" />
|
||||
<PreferenceScreen android:key="bookmark.screen_3g" android:title="@string/settings_screen_3g">
|
||||
<intent android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="*"
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
Credential Settings Layout
|
||||
|
||||
Copyright 2013 Felix Long
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:freerdp="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory android:title="@string/settings_cat_gateway">
|
||||
<EditTextPreference android:key="bookmark.gateway_hostname" android:title="@string/settings_hostname" android:summary="Name or address of the target computer"/>
|
||||
<com.freerdp.freerdpcore.utils.IntEditTextPreference android:key="bookmark.gateway_port" android:title="@string/settings_port" android:summary="Gateway Port on the target computer" android:numeric="integer" android:inputType="number" freerdp:bounds_min="10" freerdp:bounds_max="65535" freerdp:bounds_default="443" />
|
||||
<EditTextPreference android:key="bookmark.gateway_username" android:title="@string/settings_username"/>
|
||||
<EditTextPreference android:key="bookmark.gateway_password" android:title="@string/settings_password" android:inputType="textPassword" />
|
||||
<EditTextPreference android:key="bookmark.gateway_domain" android:title="@string/settings_domain" android:summary="Optional"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
|
@ -15,14 +15,111 @@ import android.os.Parcelable;
|
|||
|
||||
public class ManualBookmark extends BookmarkBase
|
||||
{
|
||||
// Gateway Settings class
|
||||
public static class GatewaySettings implements Parcelable
|
||||
{
|
||||
private String hostname;
|
||||
private int port;
|
||||
private String username;
|
||||
private String password;
|
||||
private String domain;
|
||||
|
||||
public GatewaySettings() {
|
||||
hostname = "";
|
||||
port = 443;
|
||||
username = "";
|
||||
password = "";
|
||||
domain = "";
|
||||
}
|
||||
|
||||
public GatewaySettings(Parcel parcel) {
|
||||
hostname = parcel.readString();
|
||||
port = parcel.readInt();
|
||||
username = parcel.readString();
|
||||
password = parcel.readString();
|
||||
domain = parcel.readString();
|
||||
}
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags)
|
||||
{
|
||||
out.writeString(hostname);
|
||||
out.writeInt(port);
|
||||
out.writeString(username);
|
||||
out.writeString(password);
|
||||
out.writeString(domain);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<GatewaySettings> CREATOR = new Parcelable.Creator<GatewaySettings>()
|
||||
{
|
||||
public GatewaySettings createFromParcel(Parcel in) {
|
||||
return new GatewaySettings(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GatewaySettings[] newArray(int size) {
|
||||
return new GatewaySettings[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private String hostname;
|
||||
private int port;
|
||||
private boolean enableGatewaySettings;
|
||||
private GatewaySettings gatewaySettings;
|
||||
|
||||
private void init()
|
||||
{
|
||||
type = TYPE_MANUAL;
|
||||
hostname = "";
|
||||
port = 3389;
|
||||
port = 3389;
|
||||
enableGatewaySettings = false;
|
||||
gatewaySettings = new GatewaySettings();
|
||||
}
|
||||
|
||||
public ManualBookmark(Parcel parcel)
|
||||
|
@ -31,6 +128,9 @@ public class ManualBookmark extends BookmarkBase
|
|||
type = TYPE_MANUAL;
|
||||
hostname = parcel.readString();
|
||||
port = parcel.readInt();
|
||||
|
||||
enableGatewaySettings = (parcel.readInt() == 1 ? true : false);
|
||||
gatewaySettings = parcel.readParcelable(GatewaySettings.class.getClassLoader());
|
||||
}
|
||||
|
||||
public ManualBookmark() {
|
||||
|
@ -53,7 +153,27 @@ public class ManualBookmark extends BookmarkBase
|
|||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public boolean getEnableGatewaySettings()
|
||||
{
|
||||
return enableGatewaySettings;
|
||||
}
|
||||
|
||||
public void setEnableGatewaySettings(boolean enableGatewaySettings)
|
||||
{
|
||||
this.enableGatewaySettings = enableGatewaySettings;
|
||||
}
|
||||
|
||||
public GatewaySettings getGatewaySettings()
|
||||
{
|
||||
return gatewaySettings;
|
||||
}
|
||||
|
||||
public void setGatewaySettings(GatewaySettings gatewaySettings)
|
||||
{
|
||||
this.gatewaySettings = gatewaySettings;
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ManualBookmark> CREATOR = new Parcelable.Creator<ManualBookmark>()
|
||||
{
|
||||
public ManualBookmark createFromParcel(Parcel in) {
|
||||
|
@ -77,6 +197,8 @@ public class ManualBookmark extends BookmarkBase
|
|||
super.writeToParcel(out, flags);
|
||||
out.writeString(hostname);
|
||||
out.writeInt(port);
|
||||
out.writeInt(enableGatewaySettings ? 1 : 0);
|
||||
out.writeParcelable(gatewaySettings, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,6 +209,12 @@ public class ManualBookmark extends BookmarkBase
|
|||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putString("bookmark.hostname", hostname);
|
||||
editor.putInt("bookmark.port", port);
|
||||
editor.putBoolean("bookmark.enable_gateway_settings", enableGatewaySettings);
|
||||
editor.putString("bookmark.gateway_hostname", gatewaySettings.getHostname());
|
||||
editor.putInt("bookmark.gateway_port", gatewaySettings.getPort());
|
||||
editor.putString("bookmark.gateway_username", gatewaySettings.getUsername());
|
||||
editor.putString("bookmark.gateway_password", gatewaySettings.getPassword());
|
||||
editor.putString("bookmark.gateway_domain", gatewaySettings.getDomain());
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
|
@ -97,6 +225,12 @@ public class ManualBookmark extends BookmarkBase
|
|||
|
||||
hostname = sharedPrefs.getString("bookmark.hostname", "");
|
||||
port = sharedPrefs.getInt("bookmark.port", 3389);
|
||||
enableGatewaySettings = sharedPrefs.getBoolean("bookmark.enable_gateway_settings", false);
|
||||
gatewaySettings.setHostname(sharedPrefs.getString("bookmark.gateway_hostname", ""));
|
||||
gatewaySettings.setPort(sharedPrefs.getInt("bookmark.gateway_port", 443));
|
||||
gatewaySettings.setUsername(sharedPrefs.getString("bookmark.gateway_username", ""));
|
||||
gatewaySettings.setPassword(sharedPrefs.getString("bookmark.gateway_password", ""));
|
||||
gatewaySettings.setDomain(sharedPrefs.getString("bookmark.gateway_domain", ""));
|
||||
}
|
||||
|
||||
// Cloneable
|
||||
|
|
|
@ -45,6 +45,7 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
private static final int PREFERENCES_ADVANCED = 5;
|
||||
private static final int PREFERENCES_SCREEN3G = 6;
|
||||
private static final int PREFERENCES_PERFORMANCE3G = 7;
|
||||
private static final int PREFERENCES_GATEWAY = 8;
|
||||
|
||||
// bookmark needs to be static because the activity is started for each subview
|
||||
// (we have to do this because Android has a bug where the style for Preferences
|
||||
|
@ -112,6 +113,13 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
if(bookmark == null)
|
||||
bookmark = new ManualBookmark();
|
||||
|
||||
// hide gateway settings if we edit a non-manual bookmark
|
||||
if (current_preferences == PREFERENCES_ADVANCED && bookmark.getType() != ManualBookmark.TYPE_MANUAL)
|
||||
{
|
||||
getPreferenceScreen().removePreference(findPreference("bookmark.enable_gateway"));
|
||||
getPreferenceScreen().removePreference(findPreference("bookmark.gateway"));
|
||||
}
|
||||
|
||||
// update preferences from bookmark
|
||||
bookmark.writeToSharedPreferences(getPreferenceManager().getSharedPreferences());
|
||||
|
||||
|
@ -155,6 +163,11 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
addPreferencesFromResource(R.xml.credentials_settings);
|
||||
current_preferences = PREFERENCES_CREDENTIALS;
|
||||
}
|
||||
else if (getIntent().getData().toString().equals("preferences://gateway_settings"))
|
||||
{
|
||||
addPreferencesFromResource(R.xml.gateway_settings);
|
||||
current_preferences = PREFERENCES_GATEWAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
addPreferencesFromResource(R.xml.bookmark_settings);
|
||||
|
@ -230,7 +243,8 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
"bookmark.performance",
|
||||
"bookmark.advanced",
|
||||
"bookmark.screen_3g",
|
||||
"bookmark.performance_3g"
|
||||
"bookmark.performance_3g",
|
||||
"bookmark.gateway_settings"
|
||||
};
|
||||
|
||||
for (int i = 0; i < prefKeys.length; ++i)
|
||||
|
@ -264,6 +278,10 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
case PREFERENCES_SCREEN3G:
|
||||
screenSettingsChanged(sharedPreferences, key);
|
||||
break;
|
||||
|
||||
case PREFERENCES_GATEWAY:
|
||||
gatewaySettingsChanged(sharedPreferences, key);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -291,6 +309,10 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
case PREFERENCES_SCREEN3G:
|
||||
initScreenSettings3G(sharedPreferences);
|
||||
break;
|
||||
|
||||
case PREFERENCES_GATEWAY:
|
||||
initGatewaySettings(sharedPreferences);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,6 +354,7 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
|
||||
private void initAdvancedSettings(SharedPreferences sharedPreferences)
|
||||
{
|
||||
advancedSettingsChanged(sharedPreferences, "bookmark.enable_gateway_settings");
|
||||
advancedSettingsChanged(sharedPreferences, "bookmark.enable_3g_settings");
|
||||
advancedSettingsChanged(sharedPreferences, "bookmark.security");
|
||||
advancedSettingsChanged(sharedPreferences, "bookmark.resolution_3g");
|
||||
|
@ -341,7 +364,12 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
|
||||
private void advancedSettingsChanged(SharedPreferences sharedPreferences, String key)
|
||||
{
|
||||
if (key.equals("bookmark.enable_3g_settings"))
|
||||
if (key.equals("bookmark.enable_gateway_settings"))
|
||||
{
|
||||
boolean enabled = sharedPreferences.getBoolean(key, false);
|
||||
findPreference("bookmark.gateway_settings").setEnabled(enabled);
|
||||
}
|
||||
else if (key.equals("bookmark.enable_3g_settings"))
|
||||
{
|
||||
boolean enabled = sharedPreferences.getBoolean(key, false);
|
||||
findPreference("bookmark.screen_3g").setEnabled(enabled);
|
||||
|
@ -441,6 +469,40 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
|
|||
findPreference(key).setSummary(String.valueOf(sharedPreferences.getInt(key, 600)));
|
||||
}
|
||||
|
||||
private void initGatewaySettings(SharedPreferences sharedPreferences)
|
||||
{
|
||||
gatewaySettingsChanged(sharedPreferences, "bookmark.gateway_hostname");
|
||||
gatewaySettingsChanged(sharedPreferences, "bookmark.gateway_port");
|
||||
gatewaySettingsChanged(sharedPreferences, "bookmark.gateway_username");
|
||||
gatewaySettingsChanged(sharedPreferences, "bookmark.gateway_password");
|
||||
gatewaySettingsChanged(sharedPreferences, "bookmark.gateway_domain");
|
||||
}
|
||||
|
||||
private void gatewaySettingsChanged(SharedPreferences sharedPreferences, String key)
|
||||
{
|
||||
if (key.equals("bookmark.gateway_hostname"))
|
||||
{
|
||||
findPreference(key).setSummary(sharedPreferences.getString(key, ""));
|
||||
}
|
||||
else if (key.equals("bookmark.gateway_port"))
|
||||
{
|
||||
findPreference(key).setSummary(String.valueOf(sharedPreferences.getInt(key, 443)));
|
||||
}
|
||||
else if (key.equals("bookmark.gateway_username"))
|
||||
{
|
||||
findPreference(key).setSummary(sharedPreferences.getString(key, ""));
|
||||
}
|
||||
else if (key.equals("bookmark.gateway_password"))
|
||||
{
|
||||
if (sharedPreferences.getString(key, "").length() == 0)
|
||||
findPreference(key).setSummary(getResources().getString(R.string.settings_password_empty));
|
||||
else
|
||||
findPreference(key).setSummary(getResources().getString(R.string.settings_password_present));
|
||||
}
|
||||
else if (key.equals("bookmark.gateway_domain"))
|
||||
findPreference(key).setSummary(sharedPreferences.getString(key, ""));
|
||||
}
|
||||
|
||||
private boolean verifySettings(SharedPreferences sharedPreferences) {
|
||||
|
||||
boolean verifyFailed = false;
|
||||
|
|
|
@ -22,7 +22,7 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||
|
||||
public class BookmarkDB extends SQLiteOpenHelper
|
||||
{
|
||||
private static final int DB_VERSION = 2;
|
||||
private static final int DB_VERSION = 3;
|
||||
private static final String DB_NAME = "bookmarks.db";
|
||||
|
||||
public static final String ID = BaseColumns._ID;
|
||||
|
@ -130,6 +130,13 @@ public class BookmarkDB extends SQLiteOpenHelper
|
|||
+ "screen_settings INTEGER NOT NULL, "
|
||||
+ "performance_flags INTEGER NOT NULL, "
|
||||
|
||||
+ "enable_gateway_settings INTEGER DEFAULT 0, "
|
||||
+ "gateway_hostname TEXT, "
|
||||
+ "gateway_port INTEGER DEFAULT 443, "
|
||||
+ "gateway_username TEXT, "
|
||||
+ "gateway_password TEXT, "
|
||||
+ "gateway_domain TEXT, "
|
||||
|
||||
+ "enable_3g_settings INTEGER DEFAULT 0, "
|
||||
+ "screen_3g INTEGER NOT NULL, "
|
||||
+ "performance_3g INTEGER NOT NULL, "
|
||||
|
@ -138,7 +145,7 @@ public class BookmarkDB extends SQLiteOpenHelper
|
|||
+ "remote_program TEXT, "
|
||||
+ "work_dir TEXT, "
|
||||
+ "console_mode INTEGER, "
|
||||
|
||||
|
||||
+ "FOREIGN KEY(screen_settings) REFERENCES tbl_screen_settings(" + ID + "), "
|
||||
+ "FOREIGN KEY(performance_flags) REFERENCES tbl_performance_flags(" + ID + "), "
|
||||
+ "FOREIGN KEY(screen_3g) REFERENCES tbl_screen_settings(" + ID + "), "
|
||||
|
|
|
@ -42,6 +42,9 @@ public class LibFreeRDP
|
|||
private static native void freerdp_set_clipboard_redirection(int inst, boolean enable);
|
||||
private static native void freerdp_set_drive_redirection(int inst, String path);
|
||||
|
||||
private static native void freerdp_set_gateway_info(int inst, String gatewayhostname, int port,
|
||||
String gatewayusername, String gatewaypassword, String gatewaydomain);
|
||||
|
||||
private static native boolean freerdp_update_graphics(int inst,
|
||||
Bitmap bitmap, int x, int y, int width, int height);
|
||||
|
||||
|
@ -155,6 +158,14 @@ public class LibFreeRDP
|
|||
// always enable clipboard redirection
|
||||
freerdp_set_clipboard_redirection(inst, true);
|
||||
|
||||
// Gateway enabled?
|
||||
if (bookmark.getType() == BookmarkBase.TYPE_MANUAL && bookmark.<ManualBookmark>get().getEnableGatewaySettings())
|
||||
{
|
||||
ManualBookmark.GatewaySettings gatewaySettings = bookmark.<ManualBookmark>get().getGatewaySettings();
|
||||
freerdp_set_gateway_info(inst, gatewaySettings.getHostname(), gatewaySettings.getPort(),
|
||||
gatewaySettings.getUsername(), gatewaySettings.getPassword(), gatewaySettings.getDomain());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,26 @@ public class ManualBookmarkGateway extends BookmarkBaseGateway {
|
|||
ManualBookmark bm = (ManualBookmark)bookmark;
|
||||
columns.put("hostname", bm.getHostname());
|
||||
columns.put("port", bm.getPort());
|
||||
|
||||
// gateway settings
|
||||
columns.put("enable_gateway_settings", bm.getEnableGatewaySettings());
|
||||
columns.put("gateway_hostname", bm.getGatewaySettings().getHostname());
|
||||
columns.put("gateway_port", bm.getGatewaySettings().getPort());
|
||||
columns.put("gateway_username", bm.getGatewaySettings().getUsername());
|
||||
columns.put("gateway_password", bm.getGatewaySettings().getPassword());
|
||||
columns.put("gateway_domain", bm.getGatewaySettings().getDomain());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addBookmarkSpecificColumns(ArrayList<String> columns) {
|
||||
columns.add("hostname");
|
||||
columns.add("port");
|
||||
columns.add("enable_gateway_settings");
|
||||
columns.add("gateway_hostname");
|
||||
columns.add("gateway_port");
|
||||
columns.add("gateway_username");
|
||||
columns.add("gateway_password");
|
||||
columns.add("gateway_domain");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,8 +66,11 @@ public class ManualBookmarkGateway extends BookmarkBaseGateway {
|
|||
ManualBookmark bm = (ManualBookmark)bookmark;
|
||||
bm.setHostname(cursor.getString(cursor.getColumnIndex("hostname")));
|
||||
bm.setPort(cursor.getInt(cursor.getColumnIndex("port")));
|
||||
}
|
||||
|
||||
bm.setEnableGatewaySettings(cursor.getInt(cursor.getColumnIndex("enable_gateway_settings")) == 0 ? false : true);
|
||||
readGatewaySettings(bm, cursor);
|
||||
}
|
||||
|
||||
public BookmarkBase findByLabelOrHostname(String pattern)
|
||||
{
|
||||
if(pattern.length() == 0)
|
||||
|
@ -84,4 +101,14 @@ public class ManualBookmarkGateway extends BookmarkBaseGateway {
|
|||
cursor.close();
|
||||
return bookmarks;
|
||||
}
|
||||
|
||||
private void readGatewaySettings(ManualBookmark bookmark, Cursor cursor)
|
||||
{
|
||||
ManualBookmark.GatewaySettings gatewaySettings = bookmark.getGatewaySettings();
|
||||
gatewaySettings.setHostname(cursor.getString(cursor.getColumnIndex("gateway_hostname")));
|
||||
gatewaySettings.setPort(cursor.getInt(cursor.getColumnIndex("gateway_port")));
|
||||
gatewaySettings.setUsername(cursor.getString(cursor.getColumnIndex("gateway_username")));
|
||||
gatewaySettings.setPassword(cursor.getString(cursor.getColumnIndex("gateway_password")));
|
||||
gatewaySettings.setDomain(cursor.getString(cursor.getColumnIndex("gateway_domain")));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue