freerdp: merge with master

This commit is contained in:
Marc-André Moreau 2013-05-08 15:15:15 -04:00
commit 5e4365788f
39 changed files with 1024 additions and 63 deletions

View File

@ -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;
}
}

View File

@ -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(

View File

@ -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);

View File

@ -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)
{

View File

@ -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

View File

@ -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">

View File

@ -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">

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<!-- Button labels -->
<string name="yes">Ja</string>
<string name="no">Nee</string>
<string name="cancel">Annuleren</string>
<string name="cont">Doorgaan</string>
<string name="login">Inloggen</string>
<string name="logout">Uitloggen</string>
<!-- Home menu items -->
<string name="menu_exit">Sluiten</string>
<string name="menu_about">Over</string>
<string name="menu_help">Help</string>
<string name="menu_new_bookmark">Nieuwe connectie</string>
<string name="menu_app_settings">Instellingen</string>
<!-- Bookmark menu items -->
<string name="menu_title_bookmark">Connectie</string>
<string name="menu_connect">Verbinden</string>
<string name="menu_edit">Bewerken</string>
<string name="menu_delete">Verwijderen</string>
<!-- Session menu items -->
<string name="menu_sys_keyboard">Toetsenbord</string>
<string name="menu_ext_keyboard">Functietoetsen</string>
<string name="menu_touch_pointer">Touch Pointer</string>
<string name="menu_home">home</string>
<string name="menu_disconnect">Verbinding verbreken</string>
<!-- List section headers -->
<string name="section_bookmarks">Handmatige connecties</string>
<string name="section_active_sessions">Actieve sessies</string>
<!-- Search strings -->
<string name="search_hint">Verbinden met computer</string>
<!-- List placeholder labels -->
<string name="list_placeholder_login">Login</string>
<string name="list_placeholder_no_servers">Geen servers</string>
<string name="list_placeholder_connecting">Verbinden ...</string>
<string name="list_placeholder_disconnecting">Verbinding verbreken ...</string>
<string name="list_placeholder_connection_error">Connectie verloren</string>
<string name="list_placeholder_wrong_password">Ongeldig wachtwoord</string>
<string name="list_placeholder_invalid_username">Ongeldige gebruikersnaam</string>
<string name="list_placeholder_add_bookmark">Connectie toevoegen</string>
<!-- Bookmark settings strings -->
<string name="settings_cat_host">Host</string>
<string name="settings_label">Label</string>
<string name="settings_hostname">Host</string>
<string name="settings_port">Poort</string>
<string name="settings_cat_credentials">Inloggegevens</string>
<string name="settings_credentials">Inloggegevens</string>
<string name="settings_username">Gebruikersnaam</string>
<string name="settings_password">Wachtwoord</string>
<string name="settings_domain">Domein</string>
<string name="settings_cat_settings">Instellingen</string>
<string name="settings_screen">Scherm</string>
<string name="settings_cat_screen">Scherminstellingen</string>
<string name="settings_colors">Kleuren</string>
<string-array name="colors_array">
<item>Hoge kleuren (16 Bit)</item>
<item>Ware kleuren (24 Bit)</item>
<item>Hoogste kwaliteit (32 Bit)</item>
</string-array>
<string-array name="colors_values_array">
<item>16</item>
<item>24</item>
<item>32</item>
</string-array>
<string name="settings_resolution">Resolutie</string>
<string name="resolution_automatic">Automatisch</string>
<string name="resolution_custom">Aangepast</string>
<string-array name="resolutions_array">
<item>Automatisch</item>
<item>Aangepast</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
<item>1024x768</item>
<item>1280x1024</item>
<item>1440x900</item>
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<string-array name="resolutions_values_array">
<item>Automatisch</item>
<item>Aangepast</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
<item>1024x768</item>
<item>1280x1024</item>
<item>1440x900</item>
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<string name="settings_width">Breedte</string>
<string name="settings_height">Hoogte</string>
<string name="settings_performance">Prestatie</string>
<string name="settings_cat_performance">Prestatieinstellingen</string>
<string name="settings_perf_remotefx">RemoteFX</string>
<string name="settings_perf_wallpaper">Bureaublad achtergrond</string>
<string name="settings_perf_font_smoothing">Lettertype Smoothing</string>
<string name="settings_perf_desktop_composition">Bureaublad compositie</string>
<string name="settings_perf_full_window_drag">Inhoud van het venster weergeven tijdens slepen</string>
<string name="settings_perf_menu_animation">Menu animatie</string>
<string name="settings_perf_theming">Visuele stijlen</string>
<string name="settings_advanced">Geavanceerd</string>
<string name="settings_cat_advanced">Geavanceerde instellingen</string>
<string name="settings_enable_3g_settings">3G Instellingen</string>
<string name="settings_screen_3g">3G Scherm</string>
<string name="settings_performance_3g">3G Prestatie</string>
<string name="settings_security">Beveiliging</string>
<string-array name="security_array">
<item>Automatisch</item>
<item>RDP</item>
<item>TLS</item>
<item>NLA</item>
</string-array>
<string-array name="security_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string name="settings_remote_program">Extern programma</string>
<string name="settings_work_dir">Werkmap</string>
<string name="settings_console_mode">Console modus</string>
<!-- App settings strings -->
<string name="settings_password_present">*******</string>
<string name="settings_password_empty">Niet ingesteld</string>
<string name="settings_cat_ui">Gebruikersinterface</string>
<string name="settings_ui_hide_status_bar">Verberg statusbalk</string>
<string name="settings_ui_hide_zoom_controls">Verberg Zoom Controls</string>
<string name="settings_ui_swap_mouse_buttons">Wissel muisknoppen</string>
<string name="settings_ui_invert_scrolling">Scrollen omkeren</string>
<string name="settings_ui_auto_scroll_touchpointer">Touch Pointer Auto Scroll</string>
<string name="settings_ui_ask_on_exit">Toon dialoog bij sluiten</string>
<string name="settings_cat_power">Energiebesparing</string>
<string name="settings_power_disconnect_timeout">Sluit inactieve ingen</string>
<string name="settings_cat_security">Beveiliging</string>
<string name="settings_security_accept_certificates">Accepteer alle certificaten</string>
<string name="settings_security_clear_certificate_cache">Certificaat cache opschonen</string>
<string name="settings_description_after_minutes">na %1$d minuten</string>
<string name="settings_description_disabled">Uitgeschakeld</string>
<!-- Activity titles -->
<string name="title_bookmark_settings">Connectie instellingen</string>
<string name="title_application_settings">Instellingen</string>
<string name="title_home">aFreeRDP - FreeRDP voor Android</string>
<string name="title_create_shortcut">RDP verbinding</string>
<string name="title_help">Help</string>
<string name="title_about">Over</string>
<!-- Error message strings -->
<string name="error_bookmark_incomplete_title">Annuleren zonder opslaan?</string>
<string name="error_bookmark_incomplete">Druk op "Annuleren" om af te breken!\nKlik op "Doorgaan" om de verplichte velden op te geven!</string>
<string name="error_connection_failure">Fout bij het verbinden met de server!</string>
<!-- Info message strings -->
<string name="info_capabilities_changed">De scherm instellingen zijn veranderd omdat de server de door u opgegeven instellingen niet ondersteunt!</string>
<string name="info_reset_success">Certificaat cache is verwijderd!</string>
<string name="info_reset_failed">Fout bij het verwijderderen van certificaat cache!</string>
<!-- Dialog strings -->
<string name="dlg_title_verify_certificate">Controleer certificaat</string>
<string name="dlg_msg_verify_certificate">De identiteit van de externe computer niet kan worden geverifieerd. Wilt u toch verbinden?</string>
<string name="dlg_title_credentials">Vul uw gegevens in</string>
<string name="dlg_title_create_shortcut">Snelkoppeling maken</string>
<string name="dlg_msg_create_shortcut">Snelkoppeling naam:</string>
<string name="dlg_msg_connecting">Verbinden ...</string>
<string name="dlg_msg_logging_in">Aanmelden ...</string>
<string name="dlg_title_about">Over aFreeRDP</string>
<string name="dlg_msg_about">Versie: %1$s\n\u00A9 2012 Thinstuff Technologies GmbH</string>
<string name="dlg_title_create_bookmark_after_qc">Connectie instellingen opslaan?</string>
<string name="dlg_msg_create_bookmark_after_qc">Uw connectie instellingen zijn niet opgeslagen! Wilt u deze opslaan?</string>
<string name="dlg_title_save_bookmark">Verbinding opslaan?</string>
<string name="dlg_save_bookmark">Wilt u alle wijzigingen opslaan?</string>
<string name="dlg_dont_show_again">Niet opnieuw vragen</string>
<string name="dlg_title_exit">Toepassing sluiten?</string>
<string name="dlg_msg_exit">Weet u zeker dat u de applicatie wilt sluiten?</string>
<string name="dlg_title_clear_cert_cache">Verwijder certificaten?</string>
<string name="dlg_msg_clear_cert_cache">Weet u zeker dat u al uw cache certificaten wilt verwijderen?</string>
</resources>

View File

@ -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">

View File

@ -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="*"

View File

@ -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>

View File

@ -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;
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() {
@ -54,6 +154,26 @@ public class ManualBookmark extends BookmarkBase
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

View File

@ -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());
@ -154,6 +162,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
{
@ -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;
@ -464,6 +526,7 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
private void finishAndResetBookmark()
{
bookmark = null;
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
finish();
}
@ -474,6 +537,7 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
if (current_preferences != PREFERENCES_BOOKMARK)
{
super.onBackPressed();
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
return;
}

View File

@ -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, "

View File

@ -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;
}

View File

@ -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,6 +66,9 @@ 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)
@ -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")));
}
}

View File

@ -1195,7 +1195,6 @@ void* xf_thread(void* param)
exit_code = XF_EXIT_CONN_FAILED;
ExitThread(exit_code);
}
channels = instance->context->channels;
settings = instance->context->settings;
@ -1224,6 +1223,11 @@ void* xf_thread(void* param)
rcount = 0;
wcount = 0;
if (freerdp_focus_required(instance))
{
xf_kbd_focus_in(xfi);
}
if (!async_transport)
{
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)

View File

@ -191,15 +191,16 @@ void xf_kbd_focus_in(xfInfo* xfi)
{
rdpInput* input;
UINT32 syncFlags;
int dummy, mouseX, mouseY;
Window wdummy;
UINT32 state = 0;
input = xfi->instance->input;
/* on focus in send a tab up like mstsc.exe */
input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x0F);
/* synchronize toggle keys */
syncFlags = xf_kbd_get_toggle_keys_state(xfi);
input->SynchronizeEvent(input, syncFlags);
XQueryPointer(xfi->display, xfi->window->handle, &wdummy, &wdummy, &mouseX, &mouseY, &dummy, &dummy, &state);
input->FocusInEvent(input, syncFlags, mouseX, mouseY);
}
BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)

View File

@ -13,6 +13,7 @@
#import "EditorSelectionController.h"
#import "ScreenSelectionController.h"
#import "PerformanceEditorController.h"
#import "BookmarkGatewaySettingsController.h"
@interface AdvancedBookmarkEditorController ()
@ -68,7 +69,7 @@
switch (section)
{
case SECTION_ADVANCED_SETTINGS: // advanced settings
return 7;
return 9;
default:
break;
}
@ -100,23 +101,29 @@
{
switch([indexPath row])
{
case 0: // 3G Settings
case 0: // Enable/Disable TSG Settings
cellType = TableCellIdentifierYesNo;
break;
case 1: // 3G screen/color depth
cellType = TableCellIdentifierSelection;
break;
case 2: // 3G performance settings
case 1: // TS Gateway Settings
cellType = TableCellIdentifierSubEditor;
break;
case 3: // security mode
case 2: // 3G Settings
cellType = TableCellIdentifierYesNo;
break;
case 3: // 3G screen/color depth
cellType = TableCellIdentifierSelection;
break;
case 4: // remote program
case 5: // work dir
case 4: // 3G performance settings
cellType = TableCellIdentifierSubEditor;
break;
case 5: // security mode
cellType = TableCellIdentifierSelection;
break;
case 6: // remote program
case 7: // work dir
cellType = TableCellIdentifierText;
break;
case 6: // console mode
case 8: // console mode
cellType = TableCellIdentifierYesNo;
break;
default:
@ -153,6 +160,24 @@
switch(indexPath.row)
{
case 0:
{
EditFlagTableViewCell* flagCell = (EditFlagTableViewCell*)cell;
[[flagCell label] setText:NSLocalizedString(@"Enable TS Gateway", @"'Enable TS Gateway': Bookmark enable TSG settings")];
[[flagCell toggle] setTag:GET_TAG_FROM_PATH(indexPath)];
[[flagCell toggle] setOn:[_params boolForKey:@"enable_tsg_settings"]];
[[flagCell toggle] addTarget:self action:@selector(toggleSettingValue:) forControlEvents:UIControlEventValueChanged];
break;
}
case 1:
{
BOOL enable_tsg_settings = [_params boolForKey:@"enable_tsg_settings"];
EditSubEditTableViewCell* editCell = (EditSubEditTableViewCell*)cell;
[[editCell label] setText:NSLocalizedString(@"TS Gateway Settings", @"'TS Gateway Settings': Bookmark TS Gateway Settings")];
[[editCell label] setEnabled:enable_tsg_settings];
[editCell setSelectionStyle:enable_tsg_settings ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone];
break;
}
case 2:
{
EditFlagTableViewCell* flagCell = (EditFlagTableViewCell*)cell;
[[flagCell label] setText:NSLocalizedString(@"3G Settings", @"'3G Settings': Bookmark enable 3G settings")];
@ -161,7 +186,7 @@
[[flagCell toggle] addTarget:self action:@selector(toggleSettingValue:) forControlEvents:UIControlEventValueChanged];
break;
}
case 1:
case 3:
{
EditSelectionTableViewCell* selCell = (EditSelectionTableViewCell*)cell;
[[selCell label] setText:NSLocalizedString(@"3G Screen", @"'3G Screen': Bookmark 3G Screen settings")];
@ -173,7 +198,7 @@
[selCell setSelectionStyle:enable_3G_settings ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone];
break;
}
case 2:
case 4:
{
EditSubEditTableViewCell* editCell = (EditSubEditTableViewCell*)cell;
[[editCell label] setText:NSLocalizedString(@"3G Performance", @"'3G Performance': Bookmark 3G Performance Settings")];
@ -181,14 +206,14 @@
[editCell setSelectionStyle:enable_3G_settings ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone];
break;
}
case 3:
case 5:
{
EditSelectionTableViewCell* selCell = (EditSelectionTableViewCell*)cell;
[[selCell label] setText:NSLocalizedString(@"Security", @"'Security': Bookmark protocl security settings")];
[[selCell selection] setText:ProtocolSecurityDescription([_params intForKey:@"security"])];
break;
}
case 4:
case 6:
{
EditTextTableViewCell* textCell = (EditTextTableViewCell*)cell;
[[textCell label] setText:NSLocalizedString(@"Remote Program", @"'Remote Program': Bookmark remote program settings")];
@ -198,7 +223,7 @@
[self adjustEditTextTableViewCell:textCell];
break;
}
case 5:
case 7:
{
EditTextTableViewCell* textCell = (EditTextTableViewCell*)cell;
[[textCell label] setText:NSLocalizedString(@"Working Directory", @"'Working Directory': Bookmark working directory settings")];
@ -208,7 +233,7 @@
[self adjustEditTextTableViewCell:textCell];
break;
}
case 6:
case 8:
{
EditFlagTableViewCell* flagCell = (EditFlagTableViewCell*)cell;
[[flagCell label] setText:NSLocalizedString(@"Console Mode", @"'Console Mode': Bookmark console mode settings")];
@ -233,14 +258,18 @@
switch ([indexPath row])
{
case 1:
if ([_params boolForKey:@"enable_tsg_settings"])
viewCtrl = [[[BookmarkGatewaySettingsController alloc] initWithBookmark:_bookmark] autorelease];
break;
case 3:
if ([_params boolForKey:@"enable_3g_settings"])
viewCtrl = [[[ScreenSelectionController alloc] initWithConnectionParams:_params keyPath:@"settings_3g"] autorelease];
break;
case 2:
case 4:
if ([_params boolForKey:@"enable_3g_settings"])
viewCtrl = [[[PerformanceEditorController alloc] initWithConnectionParams:_params keyPath:@"settings_3g"] autorelease];
break;
case 3:
case 5:
viewCtrl = [[[EditorSelectionController alloc] initWithConnectionParams:_params entries:[NSArray arrayWithObject:@"security"] selections:[NSArray arrayWithObject:SelectionForSecuritySetting()]] autorelease];
break;
default:
@ -267,13 +296,13 @@
switch(textField.tag)
{
// update remote program/work dir settings
case GET_TAG(SECTION_ADVANCED_SETTINGS, 4):
case GET_TAG(SECTION_ADVANCED_SETTINGS, 6):
{
[_params setValue:[textField text] forKey:@"remote_program"];
break;
}
case GET_TAG(SECTION_ADVANCED_SETTINGS, 5):
case GET_TAG(SECTION_ADVANCED_SETTINGS, 7):
{
[_params setValue:[textField text] forKey:@"working_dir"];
break;
@ -293,12 +322,22 @@
switch(valueSwitch.tag)
{
case GET_TAG(SECTION_ADVANCED_SETTINGS, 0):
[_params setBool:[valueSwitch isOn] forKey:@"enable_3g_settings"];
{
[_params setBool:[valueSwitch isOn] forKey:@"enable_tsg_settings"];
NSArray* indexPaths = [NSArray arrayWithObjects:[NSIndexPath indexPathForRow:1 inSection:SECTION_ADVANCED_SETTINGS], [NSIndexPath indexPathForRow:2 inSection:SECTION_ADVANCED_SETTINGS], nil];
[[self tableView] reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
break;
}
case GET_TAG(SECTION_ADVANCED_SETTINGS, 6):
case GET_TAG(SECTION_ADVANCED_SETTINGS, 2):
{
[_params setBool:[valueSwitch isOn] forKey:@"enable_3g_settings"];
NSArray* indexPaths = [NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:SECTION_ADVANCED_SETTINGS], [NSIndexPath indexPathForRow:2 inSection:SECTION_ADVANCED_SETTINGS], nil];
[[self tableView] reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
break;
}
case GET_TAG(SECTION_ADVANCED_SETTINGS, 8):
[_params setBool:[valueSwitch isOn] forKey:@"console"];
break;

View File

@ -0,0 +1,25 @@
/*
Controller to edit ts gateway bookmark settings
Copyright 2013 Thinstuff Technologies GmbH, Author: Martin Fleisz
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/.
*/
#import "EditorBaseController.h"
@class ComputerBookmark;
@class ConnectionParams;
@interface BookmarkGatewaySettingsController : EditorBaseController
{
@private
ComputerBookmark* _bookmark;
ConnectionParams* _params;
}
// init for the given bookmark
- (id)initWithBookmark:(ComputerBookmark*)bookmark;
@end

View File

@ -0,0 +1,236 @@
//
// BookmarkGatewaySettingsController.m
// FreeRDP
//
// Created by Thinstuff Developer on 4/30/13.
//
//
#import "BookmarkGatewaySettingsController.h"
#import "Bookmark.h"
#import "Utils.h"
#import "EditorSelectionController.h"
#define SECTION_TSGATEWAY_SETTINGS 0
#define SECTION_COUNT 1
@interface BookmarkGatewaySettingsController ()
@end
@implementation BookmarkGatewaySettingsController
- (id)initWithBookmark:(ComputerBookmark*)bookmark
{
if ((self = [super initWithStyle:UITableViewStyleGrouped]))
{
// set additional settings state according to bookmark data
_bookmark = [bookmark retain];
_params = [bookmark params];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self setTitle:NSLocalizedString(@"TS Gateway Settings", @"TS Gateway Settings title")];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// we need to reload the table view data here to have up-to-date data for the
// advanced settings accessory items (like for resolution/color mode settings)
[[self tableView] reloadData];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)dealloc
{
[super dealloc];
[_bookmark release];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return SECTION_COUNT;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
switch (section)
{
case SECTION_TSGATEWAY_SETTINGS: // ts gateway settings
return 5;
default:
break;
}
return 0;
}
// set section headers
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch(section)
{
case SECTION_TSGATEWAY_SETTINGS:
return NSLocalizedString(@"TS Gateway", @"'TS Gateway': ts gateway settings header");
}
return @"unknown";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// determine the required cell type
NSString* cellType = nil;
switch([indexPath section])
{
case SECTION_TSGATEWAY_SETTINGS: // advanced settings
{
switch([indexPath row])
{
case 0: // hostname
case 1: // port
case 2: // username
case 4: // domain
cellType = TableCellIdentifierText;
break;
case 3: // password
cellType = TableCellIdentifierSecretText;
break;
default:
break;
}
break;
}
}
NSAssert(cellType != nil, @"Couldn't determine cell type");
// get the table view cell
UITableViewCell *cell = [self tableViewCellFromIdentifier:cellType];
NSAssert(cell, @"Invalid cell");
// set cell values
switch([indexPath section])
{
// advanced settings
case SECTION_TSGATEWAY_SETTINGS:
[self initGatewaySettings:indexPath cell:cell];
break;
default:
break;
}
return cell;
}
// updates server settings in the UI
- (void)initGatewaySettings:(NSIndexPath*)indexPath cell:(UITableViewCell*)cell
{
EditTextTableViewCell* textCell = (EditTextTableViewCell*)cell;
[[textCell textfield] setTag:GET_TAG_FROM_PATH(indexPath)];
switch([indexPath row])
{
case 0:
{
[[textCell label] setText:NSLocalizedString(@"Host", @"'Host': Bookmark hostname")];
[[textCell textfield] setText:[_params StringForKey:@"tsg_hostname"]];
[[textCell textfield] setPlaceholder:NSLocalizedString(@"not set", @"not set placeholder")];
break;
}
case 1:
{
int port = [_params intForKey:@"tsg_port"];
if (port == 0) port = 443;
[[textCell label] setText:NSLocalizedString(@"Port", @"'Port': Bookmark port")];
[[textCell textfield] setText:[NSString stringWithFormat:@"%d", port]];
[[textCell textfield] setKeyboardType:UIKeyboardTypeNumberPad];
break;
}
case 2:
{
[[textCell textfield] setTag:GET_TAG_FROM_PATH(indexPath)];
[[textCell label] setText:NSLocalizedString(@"Username", @"'Username': Bookmark username")];
[[textCell textfield] setText:[_params StringForKey:@"tsg_username"]];
[[textCell textfield] setPlaceholder:NSLocalizedString(@"not set", @"not set placeholder")];
break;
}
case 3:
{
[[textCell textfield] setTag:GET_TAG_FROM_PATH(indexPath)];
[[textCell label] setText:NSLocalizedString(@"Password", @"'Password': Bookmark password")];
[[textCell textfield] setText:[_params StringForKey:@"tsg_password"]];
[[textCell textfield] setPlaceholder:NSLocalizedString(@"not set", @"not set placeholder")];
break;
}
case 4:
{
[[textCell textfield] setTag:GET_TAG_FROM_PATH(indexPath)];
[[textCell label] setText:NSLocalizedString(@"Domain", @"'Domain': Bookmark domain")];
[[textCell textfield] setText:[_params StringForKey:@"tsg_domain"]];
[[textCell textfield] setPlaceholder:NSLocalizedString(@"not set", @"not set placeholder")];
break;
}
default:
NSLog(@"Invalid row index in settings table!");
break;
}
[self adjustEditTextTableViewCell:textCell];
}
#pragma mark -
#pragma mark Text Field delegate
- (BOOL)textFieldShouldReturn:(UITextField*)textField
{
[textField resignFirstResponder];
return NO;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
switch(textField.tag)
{
// update server settings
case GET_TAG(SECTION_TSGATEWAY_SETTINGS, 0):
[_params setValue:[textField text] forKey:@"tsg_hostname"];
break;
case GET_TAG(SECTION_TSGATEWAY_SETTINGS, 1):
[_params setInt:[[textField text] intValue] forKey:@"tsg_port"];
break;
case GET_TAG(SECTION_TSGATEWAY_SETTINGS, 2):
[_params setValue:[textField text] forKey:@"tsg_username"];
break;
case GET_TAG(SECTION_TSGATEWAY_SETTINGS, 3):
[_params setValue:[textField text] forKey:@"tsg_password"];
break;
case GET_TAG(SECTION_TSGATEWAY_SETTINGS, 4):
[_params setValue:[textField text] forKey:@"tsg_domain"];
break;
default:
break;
}
return YES;
}
@end

View File

@ -56,6 +56,12 @@
return YES;
}
- (void)dealloc
{
[super dealloc];
[_bookmark release];
}
#pragma mark -
#pragma mark Table view data source

View File

@ -9,6 +9,7 @@
#import "EncryptionController.h"
#import "SFHFKeychainUtils.h"
#import "TSXAdditions.h"
@interface EncryptionController (Private)
@ -109,7 +110,14 @@ static EncryptionController* _shared_encryption_controller = nil;
- (NSString*)keychainDefaultPassword
{
return [[UIDevice currentDevice] uniqueIdentifier];
NSString* password = [[NSUserDefaults standardUserDefaults] stringForKey:@"UUID"];
if ([password length] == 0)
{
password = [NSString stringWithUUID];
[[NSUserDefaults standardUserDefaults] setObject:password forKey:@"UUID"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"TSXMasterPasswordVerification"];
}
return password;
}
#pragma mark -

View File

@ -56,6 +56,12 @@
return key;
}
- (void)dealloc
{
[super dealloc];
[_params release];
}
#pragma mark -
#pragma mark Table view data source

View File

@ -65,6 +65,18 @@
<string></string>
<key>console</key>
<false/>
<key>enable_tsg_settings</key>
<false/>
<key>tsg_hostname</key>
<string></string>
<key>tsg_port</key>
<integer>443</integer>
<key>tsg_username</key>
<string></string>
<key>tsg_password</key>
<string></string>
<key>tsg_domain</key>
<string></string>
</dict>
<key>ui.auto_scroll_touchpointer</key>
<true/>

View File

@ -28,16 +28,21 @@
_connection_params = [dict mutableDeepCopy];
if ([[_connection_params objectForKey:@"password"] isKindOfClass:[NSData class]])
{
NSString* plaintext_password = [[[EncryptionController sharedEncryptionController] decryptor] decryptString:[_connection_params objectForKey:@"password"]];
[self setValue:plaintext_password forKey:@"password"];
}
[self decryptPasswordForKey:@"password"];
[self decryptPasswordForKey:@"tsg_password"];
return self;
}
- (void)decryptPasswordForKey:(NSString*)key
{
if ([[_connection_params objectForKey:key] isKindOfClass:[NSData class]])
{
NSString* plaintext_password = [[[EncryptionController sharedEncryptionController] decryptor] decryptString:[_connection_params objectForKey:key]];
[self setValue:plaintext_password forKey:key];
}
}
- (id)initWithBaseDefaultParameters
{
return [self initWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey:@"TSXDefaultComputerBookmarkSettings"]];
@ -89,19 +94,23 @@
[serializable_params setObject:[_connection_params objectForKey:k] forKey:k];
if ([serializable_params objectForKey:@"password"] != nil)
{
NSData* encrypted_password = [[[EncryptionController sharedEncryptionController] encryptor] encryptString:[serializable_params objectForKey:@"password"]];
if (encrypted_password)
[serializable_params setObject:encrypted_password forKey:@"password"];
else
[serializable_params removeObjectForKey:@"password"];
}
[self serializeDecryptedForKey:@"password" forParams:serializable_params];
if ([serializable_params objectForKey:@"tsg_password"] != nil)
[self serializeDecryptedForKey:@"tsg_password" forParams:serializable_params];
[coder encodeObject:serializable_params forKey:@"connectionParams"];
[serializable_params release];
}
- (void)serializeDecryptedForKey:(NSString*)key forParams:(NSMutableDictionary*)params
{
NSData* encrypted_password = [[[EncryptionController sharedEncryptionController] encryptor] encryptString:[params objectForKey:key]];
if (encrypted_password)
[params setObject:encrypted_password forKey:key];
else
[params removeObjectForKey:key];
}
#pragma mark -
#pragma mark NSKeyValueCoding

View File

@ -164,6 +164,18 @@ NSString* TSXSessionDidFailToConnectNotification = @"TSXSessionDidFailToConnect"
break;
}
// ts gateway settings
if ([_params boolForKey:@"enable_tsg_settings"])
{
settings->GatewayHostname = strdup([_params UTF8StringForKey:@"tsg_hostname"]);
settings->GatewayPort = [_params intForKey:@"tsg_port"];
settings->GatewayUsername = strdup([_params UTF8StringForKey:@"tsg_username"]);
settings->GatewayPassword = strdup([_params UTF8StringForKey:@"tsg_password"]);
settings->GatewayDomain = strdup([_params UTF8StringForKey:@"tsg_domain"]);
settings->GatewayUsageMethod = TRUE;
settings->GatewayUseSameCredentials = FALSE;
}
// Remote keyboard layout
settings->KeyboardLayout = 0x409;

View File

@ -52,6 +52,14 @@ If you want to specify an output directory add CONFIGURATION_BUILD_DIR=<output-p
* If using XCode choose "Open Other" from the welcome screen, browse to the FreeRDP root directory and select FreeRDP.xcodeproj.
* If you switch between platforms (OS and SIMULATOR) please remove CMakeCache.txt and CMakeFiles/ before calling cmake again.
Otherwise build errors might occur (this seems to be a bug with cmake or the cmake scripts). To switch between platforms do:
rm CMakeCache.txt
rm -rf CMakeFiles/
before you run a new cmake command with the desired platform.
cmake variables
===============

View File

@ -218,6 +218,7 @@ FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
FREERDP_API freerdp* freerdp_new(void);
FREERDP_API void freerdp_free(freerdp* instance);
FREERDP_API BOOL freerdp_focus_required(freerdp* instance);
#ifdef __cplusplus
}
#endif

View File

@ -67,6 +67,7 @@ typedef void (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pFocusInEvent)(rdpInput* input, UINT16 toggleStates, UINT16 x, UINT16 y);
struct rdp_input
{
@ -79,7 +80,9 @@ struct rdp_input
pUnicodeKeyboardEvent UnicodeKeyboardEvent; /* 18 */
pMouseEvent MouseEvent; /* 19 */
pExtendedMouseEvent ExtendedMouseEvent; /* 20 */
UINT32 paddingB[32 - 21]; /* 21 */
pFocusInEvent FocusInEvent; /*21 */
UINT32 paddingB[32 - 22]; /* 22 */
/* Internal */
@ -98,6 +101,7 @@ FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down
FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API void freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates, UINT16 x, UINT16 y);
#ifdef __cplusplus
}

View File

@ -129,6 +129,7 @@ BOOL rdp_recv_server_control_pdu(rdpRdp* rdp, wStream* s)
case CTRLACTION_GRANTED_CONTROL:
rdp->finalize_sc_pdus |= FINALIZE_SC_CONTROL_GRANTED_PDU;
rdp->resendFocus = TRUE;
break;
}

View File

@ -2197,9 +2197,6 @@ BOOL rdp_read_multifragment_update_capability_set(wStream* s, UINT16 length, rdp
stream_read_UINT32(s, multifragMaxRequestSize); /* MaxRequestSize (4 bytes) */
if (settings->MultifragMaxRequestSize < multifragMaxRequestSize)
settings->MultifragMaxRequestSize = multifragMaxRequestSize;
return TRUE;
}

View File

@ -244,6 +244,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
case FASTPATH_UPDATETYPE_PTR_DEFAULT:
update->pointer->pointer_system.type = SYSPTR_DEFAULT;
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
break;
case FASTPATH_UPDATETYPE_PTR_POSITION:
@ -666,7 +667,7 @@ static UINT32 fastpath_get_sec_bytes(rdpRdp* rdp)
return sec_bytes;
}
wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE eventCode)
wStream* fastpath_input_pdu_init_header(rdpFastPath* fastpath)
{
rdpRdp *rdp;
wStream* s;
@ -686,12 +687,24 @@ wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE ev
}
Stream_Seek(s, fastpath_get_sec_bytes(rdp));
return s;
}
wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE eventCode)
{
rdpRdp *rdp;
wStream* s;
rdp = fastpath->rdp;
s = fastpath_input_pdu_init_header(fastpath);
stream_write_BYTE(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */
return s;
}
BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s)
BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNumEvents)
{
rdpRdp *rdp;
UINT16 length;
@ -709,8 +722,12 @@ BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s)
}
eventHeader = FASTPATH_INPUT_ACTION_FASTPATH;
<<<<<<< HEAD
eventHeader |= (1 << 2); /* numberEvents */
=======
eventHeader |= (iNumEvents << 2); /* numberEvents */
>>>>>>> f1672948ff0b5f6a9d3cda658a18104df3c3d1e4
if (rdp->sec_flags & SEC_ENCRYPT)
eventHeader |= (FASTPATH_INPUT_ENCRYPTED << 6);
if (rdp->sec_flags & SEC_SECURE_CHECKSUM)
@ -754,6 +771,11 @@ BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s)
return TRUE;
}
BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s)
{
return fastpath_send_multiple_input_pdu(fastpath, s, 1);
}
wStream* fastpath_update_pdu_init(rdpFastPath* fastpath)
{
wStream* s;

View File

@ -110,7 +110,9 @@ BOOL fastpath_read_header_rdp(rdpFastPath* fastpath, wStream* s, UINT16 *length)
int fastpath_recv_updates(rdpFastPath* fastpath, wStream* s);
int fastpath_recv_inputs(rdpFastPath* fastpath, wStream* s);
wStream* fastpath_input_pdu_init_header(rdpFastPath* fastpath);
wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE eventCode);
BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iEventCount);
BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s);
wStream* fastpath_update_pdu_init(rdpFastPath* fastpath);

View File

@ -275,6 +275,22 @@ BOOL freerdp_shall_disconnect(freerdp* instance)
return instance->context->rdp->disconnect;
}
FREERDP_API BOOL freerdp_focus_required(freerdp* instance)
{
rdpRdp* rdp;
BOOL bRetCode = FALSE;
rdp = instance->context->rdp;
if (rdp->resendFocus)
{
bRetCode = TRUE;
rdp->resendFocus = FALSE;
}
return bRetCode;
}
void freerdp_get_version(int* major, int* minor, int* revision)
{
if (major != NULL)

View File

@ -61,8 +61,8 @@ struct rdp_tsg
LPWSTR MachineName;
TSG_STATE state;
BOOL PendingPdu;
BOOL BytesRead;
BOOL BytesAvailable;
UINT32 BytesRead;
UINT32 BytesAvailable;
UINT32 StubOffset;
UINT32 StubLength;
rdpSettings* settings;

View File

@ -151,6 +151,21 @@ void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UI
rdp_send_client_input_pdu(rdp, s);
}
void input_send_focus_in_event(rdpInput* input, UINT16 toggleStates, UINT16 x, UINT16 y)
{
/* send a tab up like mstsc.exe */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f);
/* send the toggle key states */
input_send_synchronize_event(input, (toggleStates & 0x1F));
/* send another tab up like mstsc.exe */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE, 0x0f);
/* finish with a mouse pointer position like mstsc.exe */
input_send_extended_mouse_event(input, PTR_FLAGS_MOVE, x, y);
}
void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags)
{
wStream* s;
@ -206,6 +221,35 @@ void input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UIN
fastpath_send_input_pdu(rdp->fastpath, s);
}
void input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates, UINT16 x, UINT16 y)
{
wStream* s;
rdpRdp* rdp = input->context->rdp;
BYTE eventFlags = 0;
s = fastpath_input_pdu_init_header(rdp->fastpath);
/* send a tab up like mstsc.exe */
eventFlags = FASTPATH_INPUT_KBDFLAGS_RELEASE | FASTPATH_INPUT_EVENT_SCANCODE << 5;
stream_write_BYTE(s, eventFlags); /* Key Release event (1 byte) */
stream_write_BYTE(s, 0x0f); /* keyCode (1 byte) */
/* send the toggle key states */
eventFlags = (toggleStates & 0x1F) | FASTPATH_INPUT_EVENT_SYNC << 5;
stream_write_BYTE(s, eventFlags); /* toggle state (1 byte) */
/* send another tab up like mstsc.exe */
eventFlags = FASTPATH_INPUT_KBDFLAGS_RELEASE | FASTPATH_INPUT_EVENT_SCANCODE << 5;
stream_write_BYTE(s, eventFlags); /* Key Release event (1 byte) */
stream_write_BYTE(s, 0x0f); /* keyCode (1 byte) */
/* finish with a mouse pointer position like mstsc.exe */
eventFlags = 0 | FASTPATH_INPUT_EVENT_MOUSE << 5;
stream_write_BYTE(s, eventFlags); /* Mouse Pointer event (1 byte) */
input_write_extended_mouse_event(s, PTR_FLAGS_MOVE, x, y);
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
}
static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
{
UINT32 toggleFlags;
@ -379,6 +423,7 @@ void input_register_client_callbacks(rdpInput* input)
input->UnicodeKeyboardEvent = input_send_fastpath_unicode_keyboard_event;
input->MouseEvent = input_send_fastpath_mouse_event;
input->ExtendedMouseEvent = input_send_fastpath_extended_mouse_event;
input->FocusInEvent = input_send_fastpath_focus_in_event;
}
else
{
@ -387,6 +432,7 @@ void input_register_client_callbacks(rdpInput* input)
input->UnicodeKeyboardEvent = input_send_unicode_keyboard_event;
input->MouseEvent = input_send_mouse_event;
input->ExtendedMouseEvent = input_send_extended_mouse_event;
input->FocusInEvent = input_send_focus_in_event;
}
input->asynchronous = settings->AsyncInput;
@ -430,6 +476,11 @@ void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT
IFCALL(input->ExtendedMouseEvent, input, flags, x, y);
}
void freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates, UINT16 x, UINT16 y)
{
IFCALL(input->FocusInEvent, input, toggleStates, x, y);
}
int input_process_events(rdpInput* input)
{
return input_message_queue_process_pending_messages(input);

View File

@ -156,6 +156,7 @@ struct rdp_rdp
UINT32 errorInfo;
UINT32 finalize_sc_pdus;
BOOL disconnect;
BOOL resendFocus;
};
BOOL rdp_read_security_header(wStream* s, UINT16* flags);

View File

@ -377,7 +377,7 @@ rdpSettings* freerdp_settings_new(void* instance)
settings->VirtualChannelChunkSize = CHANNEL_CHUNK_LENGTH;
settings->MultifragMaxRequestSize = 0x200000;
settings->MultifragMaxRequestSize = 0xFFFF;
settings->GatewayUseSameCredentials = TRUE;