23 public static final int TYPE_INVALID = -1;
24 public static final int TYPE_MANUAL = 1;
25 public static final int TYPE_QUICKCONNECT = 2;
26 public static final int TYPE_CUSTOM_BASE = 1000;
27 public static final Parcelable.Creator<
BookmarkBase> CREATOR =
42 private String username;
43 private String password;
44 private String domain;
49 private String hostname;
51 private boolean enableGatewaySettings;
53 private boolean directConnect;
57 type = parcel.readInt();
58 id = parcel.readLong();
59 label = parcel.readString();
60 username = parcel.readString();
61 password = parcel.readString();
62 domain = parcel.readString();
64 screenSettings = parcel.readParcelable(
ScreenSettings.class.getClassLoader());
65 performanceFlags = parcel.readParcelable(
PerformanceFlags.class.getClassLoader());
66 advancedSettings = parcel.readParcelable(
AdvancedSettings.class.getClassLoader());
67 debugSettings = parcel.readParcelable(
DebugSettings.class.getClassLoader());
68 hostname = parcel.readString();
69 port = parcel.readInt();
70 enableGatewaySettings = (parcel.readInt() == 1);
71 gatewaySettings = parcel.readParcelable(
GatewaySettings.class.getClassLoader());
72 directConnect = (parcel.readInt() == 1);
96 enableGatewaySettings =
false;
98 directConnect =
false;
106 public void setType(
int type)
116 public void setId(
long id)
121 public String getLabel()
126 public void setLabel(String label)
131 public String getUsername()
136 public void setUsername(String username)
138 this.username = username;
141 public String getPassword()
146 public void setPassword(String password)
148 this.password = password;
151 public String getDomain()
156 public void setDomain(String domain)
158 this.domain = domain;
163 return screenSettings;
168 this.screenSettings = screenSettings;
173 return performanceFlags;
178 this.performanceFlags = performanceFlags;
183 return advancedSettings;
188 this.advancedSettings = advancedSettings;
193 return debugSettings;
198 this.debugSettings = debugSettings;
201 public String getHostname()
206 public void setHostname(String hostname)
208 this.hostname = hostname;
216 public void setPort(
int port)
221 public boolean getEnableGatewaySettings()
223 return enableGatewaySettings;
226 public void setEnableGatewaySettings(
boolean enableGatewaySettings)
228 this.enableGatewaySettings = enableGatewaySettings;
233 return gatewaySettings;
238 this.gatewaySettings = gatewaySettings;
241 public boolean isDirectConnect()
243 return directConnect;
246 public void setDirectConnect(
boolean directConnect)
248 this.directConnect = directConnect;
253 return screenSettings;
258 return performanceFlags;
261 @Override
public int describeContents()
266 @Override
public void writeToParcel(Parcel out,
int flags)
270 out.writeString(label);
271 out.writeString(username);
272 out.writeString(password);
273 out.writeString(domain);
275 out.writeParcelable(screenSettings, flags);
276 out.writeParcelable(performanceFlags, flags);
277 out.writeParcelable(advancedSettings, flags);
278 out.writeParcelable(debugSettings, flags);
279 out.writeString(hostname);
281 out.writeInt(enableGatewaySettings ? 1 : 0);
282 out.writeParcelable(gatewaySettings, flags);
283 out.writeInt(directConnect ? 1 : 0);
287 public void writeToSharedPreferences(SharedPreferences sharedPrefs)
290 Locale locale = Locale.ENGLISH;
292 SharedPreferences.Editor editor = sharedPrefs.edit();
294 editor.putString(
"bookmark.label", label);
295 editor.putString(
"bookmark.username", username);
296 editor.putString(
"bookmark.password", password);
297 editor.putString(
"bookmark.domain", domain);
299 editor.putInt(
"bookmark.colors", screenSettings.getColors());
300 editor.putString(
"bookmark.resolution",
301 screenSettings.getResolutionString().toLowerCase(locale));
302 editor.putInt(
"bookmark.width", screenSettings.getWidth());
303 editor.putInt(
"bookmark.height", screenSettings.getHeight());
305 editor.putBoolean(
"bookmark.perf_remotefx", performanceFlags.getRemoteFX());
306 editor.putBoolean(
"bookmark.perf_gfx", performanceFlags.getGfx());
307 editor.putBoolean(
"bookmark.perf_gfx_h264", performanceFlags.getH264());
308 editor.putBoolean(
"bookmark.perf_wallpaper", performanceFlags.getWallpaper());
309 editor.putBoolean(
"bookmark.perf_font_smoothing", performanceFlags.getFontSmoothing());
310 editor.putBoolean(
"bookmark.perf_desktop_composition",
311 performanceFlags.getDesktopComposition());
312 editor.putBoolean(
"bookmark.perf_window_dragging", performanceFlags.getFullWindowDrag());
313 editor.putBoolean(
"bookmark.perf_menu_animation", performanceFlags.getMenuAnimations());
314 editor.putBoolean(
"bookmark.perf_themes", performanceFlags.getTheming());
316 editor.putInt(
"bookmark.tlsSecLevel", advancedSettings.tlsSecLevel);
317 editor.putInt(
"bookmark.tlsMinLevel", advancedSettings.tlsMinLevel);
319 editor.putBoolean(
"bookmark.redirect_sdcard", advancedSettings.getRedirectSDCard());
320 editor.putInt(
"bookmark.redirect_sound", advancedSettings.getRedirectSound());
321 editor.putBoolean(
"bookmark.redirect_microphone", advancedSettings.getRedirectMicrophone());
322 editor.putInt(
"bookmark.security", advancedSettings.getSecurity());
323 editor.putString(
"bookmark.remote_program", advancedSettings.getRemoteProgram());
324 editor.putString(
"bookmark.work_dir", advancedSettings.getWorkDir());
325 editor.putBoolean(
"bookmark.console_mode", advancedSettings.getConsoleMode());
327 editor.putBoolean(
"bookmark.async_channel", debugSettings.getAsyncChannel());
328 editor.putBoolean(
"bookmark.async_update", debugSettings.getAsyncUpdate());
329 editor.putString(
"bookmark.debug_level", debugSettings.getDebugLevel());
331 editor.putString(
"bookmark.hostname", hostname);
332 editor.putInt(
"bookmark.port", port);
333 editor.putBoolean(
"bookmark.enable_gateway_settings", enableGatewaySettings);
334 editor.putString(
"bookmark.gateway_hostname", gatewaySettings.getHostname());
335 editor.putInt(
"bookmark.gateway_port", gatewaySettings.getPort());
336 editor.putString(
"bookmark.gateway_username", gatewaySettings.getUsername());
337 editor.putString(
"bookmark.gateway_password", gatewaySettings.getPassword());
338 editor.putString(
"bookmark.gateway_domain", gatewaySettings.getDomain());
344 public void readFromSharedPreferences(SharedPreferences sharedPrefs)
346 label = sharedPrefs.getString(
"bookmark.label",
"");
347 username = sharedPrefs.getString(
"bookmark.username",
"");
348 password = sharedPrefs.getString(
"bookmark.password",
"");
349 domain = sharedPrefs.getString(
"bookmark.domain",
"");
351 screenSettings.setColors(sharedPrefs.getInt(
"bookmark.colors", 16));
352 screenSettings.setResolution(sharedPrefs.getString(
"bookmark.resolution",
"automatic"),
353 sharedPrefs.getInt(
"bookmark.width", 800),
354 sharedPrefs.getInt(
"bookmark.height", 600));
356 performanceFlags.setRemoteFX(sharedPrefs.getBoolean(
"bookmark.perf_remotefx",
false));
357 performanceFlags.setGfx(sharedPrefs.getBoolean(
"bookmark.perf_gfx",
true));
358 performanceFlags.setH264(sharedPrefs.getBoolean(
"bookmark.perf_gfx_h264",
true));
359 performanceFlags.setWallpaper(sharedPrefs.getBoolean(
"bookmark.perf_wallpaper",
false));
360 performanceFlags.setFontSmoothing(
361 sharedPrefs.getBoolean(
"bookmark.perf_font_smoothing",
false));
362 performanceFlags.setDesktopComposition(
363 sharedPrefs.getBoolean(
"bookmark.perf_desktop_composition",
false));
364 performanceFlags.setFullWindowDrag(
365 sharedPrefs.getBoolean(
"bookmark.perf_window_dragging",
false));
366 performanceFlags.setMenuAnimations(
367 sharedPrefs.getBoolean(
"bookmark.perf_menu_animation",
false));
368 performanceFlags.setTheming(sharedPrefs.getBoolean(
"bookmark.perf_themes",
false));
370 advancedSettings.setTlsSecLevel(sharedPrefs.getInt(
"bookmark.tlsSecLevel", -1));
371 advancedSettings.setTlsMinLevel(sharedPrefs.getInt(
"bookmark.tlsMinLevel", -1));
373 advancedSettings.setRedirectSDCard(
374 sharedPrefs.getBoolean(
"bookmark.redirect_sdcard",
false));
375 advancedSettings.setRedirectSound(sharedPrefs.getInt(
"bookmark.redirect_sound", 0));
376 advancedSettings.setRedirectMicrophone(
377 sharedPrefs.getBoolean(
"bookmark.redirect_microphone",
false));
378 advancedSettings.setSecurity(sharedPrefs.getInt(
"bookmark.security", 0));
379 advancedSettings.setRemoteProgram(sharedPrefs.getString(
"bookmark.remote_program",
""));
380 advancedSettings.setWorkDir(sharedPrefs.getString(
"bookmark.work_dir",
""));
381 advancedSettings.setConsoleMode(sharedPrefs.getBoolean(
"bookmark.console_mode",
false));
383 debugSettings.setAsyncChannel(sharedPrefs.getBoolean(
"bookmark.async_channel",
true));
384 debugSettings.setAsyncUpdate(sharedPrefs.getBoolean(
"bookmark.async_update",
true));
385 debugSettings.setDebugLevel(sharedPrefs.getString(
"bookmark.debug_level",
"INFO"));
387 hostname = sharedPrefs.getString(
"bookmark.hostname",
"");
388 port = sharedPrefs.getInt(
"bookmark.port", 3389);
389 enableGatewaySettings = sharedPrefs.getBoolean(
"bookmark.enable_gateway_settings",
false);
390 gatewaySettings.setHostname(sharedPrefs.getString(
"bookmark.gateway_hostname",
""));
391 gatewaySettings.setPort(sharedPrefs.getInt(
"bookmark.gateway_port", 443));
392 gatewaySettings.setUsername(sharedPrefs.getString(
"bookmark.gateway_username",
""));
393 gatewaySettings.setPassword(sharedPrefs.getString(
"bookmark.gateway_password",
""));
394 gatewaySettings.setDomain(sharedPrefs.getString(
"bookmark.gateway_domain",
""));
398 public Object clone()
402 return super.clone();
404 catch (CloneNotSupportedException e)
425 private boolean remotefx =
true;
426 private boolean gfx =
true;
427 private boolean h264 =
true;
428 private boolean wallpaper =
true;
429 private boolean theming =
true;
430 private boolean fullWindowDrag =
true;
431 private boolean menuAnimations =
true;
432 private boolean fontSmoothing =
true;
433 private boolean desktopComposition =
true;
441 remotefx = parcel.readInt() != 0;
442 gfx = parcel.readInt() != 0;
443 h264 = parcel.readInt() != 0;
444 wallpaper = parcel.readInt() != 0;
445 theming = parcel.readInt() != 0;
446 fullWindowDrag = (parcel.readInt() != 0);
447 menuAnimations = parcel.readInt() != 0;
448 fontSmoothing = parcel.readInt() != 0;
449 desktopComposition = parcel.readInt() != 0;
452 public boolean getRemoteFX()
457 public void setRemoteFX(
boolean remotefx)
459 this.remotefx = remotefx;
462 public boolean getGfx()
467 public void setGfx(
boolean gfx)
472 public boolean getH264()
477 public void setH264(
boolean h264)
482 public boolean getWallpaper()
487 public void setWallpaper(
boolean wallpaper)
489 this.wallpaper = wallpaper;
492 public boolean getTheming()
497 public void setTheming(
boolean theming)
499 this.theming = theming;
502 public boolean getFullWindowDrag()
504 return fullWindowDrag;
507 public void setFullWindowDrag(
boolean fullWindowDrag)
509 this.fullWindowDrag = fullWindowDrag;
512 public boolean getMenuAnimations()
514 return menuAnimations;
517 public void setMenuAnimations(
boolean menuAnimations)
519 this.menuAnimations = menuAnimations;
522 public boolean getFontSmoothing()
524 return fontSmoothing;
527 public void setFontSmoothing(
boolean fontSmoothing)
529 this.fontSmoothing = fontSmoothing;
532 public boolean getDesktopComposition()
534 return desktopComposition;
537 public void setDesktopComposition(
boolean desktopComposition)
539 this.desktopComposition = desktopComposition;
542 @Override
public int describeContents()
547 @Override
public void writeToParcel(Parcel out,
int flags)
549 out.writeInt(remotefx ? 1 : 0);
550 out.writeInt(gfx ? 1 : 0);
551 out.writeInt(h264 ? 1 : 0);
552 out.writeInt(wallpaper ? 1 : 0);
553 out.writeInt(theming ? 1 : 0);
554 out.writeInt(fullWindowDrag ? 1 : 0);
555 out.writeInt(menuAnimations ? 1 : 0);
556 out.writeInt(fontSmoothing ? 1 : 0);
557 out.writeInt(desktopComposition ? 1 : 0);
564 public static final int FITSCREEN = -2;
565 public static final int AUTOMATIC = -1;
566 public static final int CUSTOM = 0;
567 public static final int PREDEFINED = 1;
580 private int resolution = AUTOMATIC;
581 private int colors = 32;
582 private int width = 0;
583 private int height = 0;
591 resolution = parcel.readInt();
592 colors = parcel.readInt();
593 width = parcel.readInt();
594 height = parcel.readInt();
597 private void validate()
612 if ((width <= 0) || (width > 65536))
617 if ((height <= 0) || (height > 65536))
630 resolution = AUTOMATIC;
635 public void setResolution(String resolution,
int width,
int height)
637 if (resolution.contains(
"x"))
639 String[] dimensions = resolution.split(
"x");
640 this.width = Integer.parseInt(dimensions[0]);
641 this.height = Integer.parseInt(dimensions[1]);
642 this.resolution = PREDEFINED;
644 else if (resolution.equalsIgnoreCase(
"custom"))
647 this.height = height;
648 this.resolution = CUSTOM;
650 else if (resolution.equalsIgnoreCase(
"fitscreen"))
652 this.width = this.height = 0;
653 this.resolution = FITSCREEN;
657 this.width = this.height = 0;
658 this.resolution = AUTOMATIC;
662 public int getResolution()
667 public void setResolution(
int resolution)
669 this.resolution = resolution;
671 if (resolution == AUTOMATIC || resolution == FITSCREEN)
678 public String getResolutionString()
681 return (width +
"x" + height);
683 return (isFitScreen() ?
"fitscreen" : isAutomatic() ?
"automatic" :
"custom");
686 public boolean isPredefined()
689 return (resolution == PREDEFINED);
692 public boolean isAutomatic()
695 return (resolution == AUTOMATIC);
698 public boolean isFitScreen()
701 return (resolution == FITSCREEN);
704 public boolean isCustom()
707 return (resolution == CUSTOM);
710 public int getWidth()
716 public void setWidth(
int width)
721 public int getHeight()
727 public void setHeight(
int height)
729 this.height = height;
732 public int getColors()
738 public void setColors(
int colors)
740 this.colors = colors;
743 @Override
public int describeContents()
748 @Override
public void writeToParcel(Parcel out,
int flags)
750 out.writeInt(resolution);
751 out.writeInt(colors);
753 out.writeInt(height);
760 public static final Parcelable.Creator<
DebugSettings> CREATOR =
772 private String debug;
773 private boolean asyncChannel;
774 private boolean asyncTransport;
775 private boolean asyncUpdate;
785 asyncChannel = parcel.readInt() != 0;
786 asyncTransport = parcel.readInt() != 0;
787 asyncUpdate = parcel.readInt() != 0;
788 debug = parcel.readString();
795 asyncTransport =
false;
799 private void validate()
801 final String[] levels = {
"OFF",
"FATAL",
"ERROR",
"WARN",
"INFO",
"DEBUG",
"TRACE" };
803 for (String level : levels)
805 if (level.equalsIgnoreCase(
this.debug))
814 public String getDebugLevel()
820 public void setDebugLevel(String debug)
825 public boolean getAsyncUpdate()
830 public void setAsyncUpdate(
boolean enabled)
832 asyncUpdate = enabled;
835 public boolean getAsyncChannel()
840 public void setAsyncChannel(
boolean enabled)
842 asyncChannel = enabled;
845 @Override
public int describeContents()
850 @Override
public void writeToParcel(Parcel out,
int flags)
852 out.writeInt(asyncChannel ? 1 : 0);
853 out.writeInt(asyncTransport ? 1 : 0);
854 out.writeInt(asyncUpdate ? 1 : 0);
855 out.writeString(debug);
875 private boolean redirectSDCard =
false;
876 private int redirectSound = 0;
877 private boolean redirectMicrophone =
false;
878 private int security = 0;
879 private boolean consoleMode =
false;
880 private String remoteProgram =
"";
881 private String workDir =
"";
882 private int tlsSecLevel = -1;
883 private int tlsMinLevel = -1;
891 redirectSDCard = parcel.readInt() != 0;
892 redirectSound = parcel.readInt();
893 redirectMicrophone = parcel.readInt() != 0;
894 security = parcel.readInt();
895 consoleMode = parcel.readInt() != 0;
896 remoteProgram = parcel.readString();
897 workDir = parcel.readString();
898 tlsSecLevel = parcel.readInt();
899 tlsMinLevel = parcel.readInt();
902 private void validate()
904 switch (redirectSound)
928 public int getTlsSecLevel()
933 public void setTlsSecLevel(
int level)
938 public void setTlsMinLevel(
int level)
943 public int getTlsMinLevel()
948 public boolean getRedirectSDCard()
950 return redirectSDCard;
953 public void setRedirectSDCard(
boolean redirectSDCard)
955 this.redirectSDCard = redirectSDCard;
958 public int getRedirectSound()
961 return redirectSound;
964 public void setRedirectSound(
int redirect)
966 this.redirectSound = redirect;
969 public boolean getRedirectMicrophone()
971 return redirectMicrophone;
974 public void setRedirectMicrophone(
boolean redirect)
976 this.redirectMicrophone = redirect;
979 public int getSecurity()
985 public void setSecurity(
int security)
987 this.security = security;
990 public boolean getConsoleMode()
995 public void setConsoleMode(
boolean consoleMode)
997 this.consoleMode = consoleMode;
1000 public String getRemoteProgram()
1002 return remoteProgram;
1005 public void setRemoteProgram(String remoteProgram)
1007 this.remoteProgram = remoteProgram;
1010 public String getWorkDir()
1015 public void setWorkDir(String workDir)
1017 this.workDir = workDir;
1020 @Override
public int describeContents()
1025 @Override
public void writeToParcel(Parcel out,
int flags)
1027 out.writeInt(redirectSDCard ? 1 : 0);
1028 out.writeInt(redirectSound);
1029 out.writeInt(redirectMicrophone ? 1 : 0);
1030 out.writeInt(security);
1031 out.writeInt(consoleMode ? 1 : 0);
1032 out.writeString(remoteProgram);
1033 out.writeString(workDir);
1034 out.writeInt(tlsSecLevel);
1035 out.writeInt(tlsMinLevel);
1053 private String hostname;
1055 private String username;
1056 private String password;
1057 private String domain;
1070 hostname = parcel.readString();
1071 port = parcel.readInt();
1072 username = parcel.readString();
1073 password = parcel.readString();
1074 domain = parcel.readString();
1077 public String getHostname()
1082 public void setHostname(String hostname)
1084 this.hostname = hostname;
1087 public int getPort()
1092 public void setPort(
int port)
1097 public String getUsername()
1102 public void setUsername(String username)
1104 this.username = username;
1107 public String getPassword()
1112 public void setPassword(String password)
1114 this.password = password;
1117 public String getDomain()
1122 public void setDomain(String domain)
1124 this.domain = domain;
1127 @Override
public int describeContents()
1132 @Override
public void writeToParcel(Parcel out,
int flags)
1134 out.writeString(hostname);
1136 out.writeString(username);
1137 out.writeString(password);
1138 out.writeString(domain);