|
|
@ -97,28 +97,18 @@ public class ApplicationSettings { |
|
|
|
if (port.equals("")) |
|
|
|
if (port.equals("")) |
|
|
|
port = Integer.toString(Daemon.getDefaultPortNumber(type, ssl)); |
|
|
|
port = Integer.toString(Daemon.getDefaultPortNumber(type, ssl)); |
|
|
|
|
|
|
|
|
|
|
|
return new ServerSetting(order, |
|
|
|
return new ServerSetting(order, prefs.getString("server_name_" + order, null), type, prefs.getString( |
|
|
|
prefs.getString("server_name_" + order, null), type, |
|
|
|
"server_address_" + order, null), prefs.getString("server_localaddress_" + order, null), |
|
|
|
prefs.getString("server_address_" + order, null), |
|
|
|
prefs.getString("server_localnetwork_" + order, null), Integer.parseInt(port), ssl, prefs.getBoolean( |
|
|
|
prefs.getString("server_localaddress_" + order, null), |
|
|
|
"server_ssltrustall_" + order, false), prefs.getString("server_ssltrustkey_" + order, null), |
|
|
|
prefs.getString("server_localnetwork_" + order, null), |
|
|
|
|
|
|
|
Integer.parseInt(port), |
|
|
|
|
|
|
|
ssl, |
|
|
|
|
|
|
|
prefs.getBoolean("server_ssltrustall_" + order, false), |
|
|
|
|
|
|
|
prefs.getString("server_ssltrustkey_" + order, null), |
|
|
|
|
|
|
|
prefs.getString("server_folder_" + order, null), |
|
|
|
prefs.getString("server_folder_" + order, null), |
|
|
|
!prefs.getBoolean("server_disableauth_" + order, false), |
|
|
|
!prefs.getBoolean("server_disableauth_" + order, false), prefs.getString("server_user_" + order, null), |
|
|
|
prefs.getString("server_user_" + order, null), |
|
|
|
prefs.getString("server_pass_" + order, null), prefs.getString("server_extrapass_" + order, null), |
|
|
|
prefs.getString("server_pass_" + order, null), |
|
|
|
OS.fromCode(prefs.getString("server_os_" + order, "type_linux")), prefs.getString("server_downloaddir_" |
|
|
|
prefs.getString("server_extrapass_" + order, null), |
|
|
|
+ order, null), prefs.getString("server_ftpurl_" + order, null), prefs.getString( |
|
|
|
OS.fromCode(prefs.getString("server_os_" + order, "type_linux")), |
|
|
|
"server_ftppass_" + order, null), Integer.parseInt(prefs.getString("server_timeout_" + order, |
|
|
|
prefs.getString("server_downloaddir_" + order, null), |
|
|
|
"8")), prefs.getBoolean("server_alarmfinished_" + order, true), prefs.getBoolean( |
|
|
|
prefs.getString("server_ftpurl_" + order, null), |
|
|
|
"server_alarmnew_" + order, false), false); |
|
|
|
prefs.getString("server_ftppass_" + order, null), |
|
|
|
|
|
|
|
Integer.parseInt(prefs.getString("server_timeout_" + order, "8")), |
|
|
|
|
|
|
|
prefs.getBoolean("server_alarmfinished_" + order, true), |
|
|
|
|
|
|
|
prefs.getBoolean("server_alarmnew_" + order, false), |
|
|
|
|
|
|
|
false); |
|
|
|
|
|
|
|
// @formatter:on
|
|
|
|
// @formatter:on
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -261,10 +251,8 @@ public class ApplicationSettings { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public WebsearchSetting getWebsearchSetting(int order) { |
|
|
|
public WebsearchSetting getWebsearchSetting(int order) { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
return new WebsearchSetting(order, |
|
|
|
return new WebsearchSetting(order, prefs.getString("websearch_name_" + order, null), prefs.getString( |
|
|
|
prefs.getString("websearch_name_" + order, null), |
|
|
|
"websearch_baseurl_" + order, null), prefs.getString("websearch_cookies_" + order, null)); |
|
|
|
prefs.getString("websearch_baseurl_" + order, null), |
|
|
|
|
|
|
|
prefs.getString("websearch_cookies_" + order, null)); |
|
|
|
|
|
|
|
// @formatter:on
|
|
|
|
// @formatter:on
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -325,11 +313,9 @@ public class ApplicationSettings { |
|
|
|
public RssfeedSetting getRssfeedSetting(int order) { |
|
|
|
public RssfeedSetting getRssfeedSetting(int order) { |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
long lastViewed = prefs.getLong("rssfeed_lastviewed_" + order, -1); |
|
|
|
long lastViewed = prefs.getLong("rssfeed_lastviewed_" + order, -1); |
|
|
|
return new RssfeedSetting(order, |
|
|
|
return new RssfeedSetting(order, prefs.getString("rssfeed_name_" + order, null), prefs.getString("rssfeed_url_" |
|
|
|
prefs.getString("rssfeed_name_" + order, null), |
|
|
|
+ order, null), prefs.getBoolean("rssfeed_reqauth_" + order, false), lastViewed == -1L ? null |
|
|
|
prefs.getString("rssfeed_url_" + order, null), |
|
|
|
: new Date(lastViewed)); |
|
|
|
prefs.getBoolean("rssfeed_reqauth_" + order, false), |
|
|
|
|
|
|
|
lastViewed == -1L ? null: new Date(lastViewed)); |
|
|
|
|
|
|
|
// @formatter:on
|
|
|
|
// @formatter:on
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -427,12 +413,6 @@ public class ApplicationSettings { |
|
|
|
public SearchSetting getLastUsedSearchSite() { |
|
|
|
public SearchSetting getLastUsedSearchSite() { |
|
|
|
String lastKey = getLastUsedSearchSiteKey(); |
|
|
|
String lastKey = getLastUsedSearchSiteKey(); |
|
|
|
List<SearchSite> allsites = searchHelper.getAvailableSites(); |
|
|
|
List<SearchSite> allsites = searchHelper.getAvailableSites(); |
|
|
|
int lastWebsearch = -1; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
lastWebsearch = Integer.parseInt(lastKey); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
// Not an in-app search site, but probably an in-app search
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (lastKey == null) { |
|
|
|
if (lastKey == null) { |
|
|
|
// No site yet set specified; return the first in-app one, if available
|
|
|
|
// No site yet set specified; return the first in-app one, if available
|
|
|
@ -442,6 +422,14 @@ public class ApplicationSettings { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lastWebsearch = -1; |
|
|
|
|
|
|
|
if (lastKey.startsWith(WebsearchSetting.KEY_PREFIX)) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
lastWebsearch = Integer.parseInt(lastKey.substring(WebsearchSetting.KEY_PREFIX.length())); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
// Not an in-app search site, but probably an in-app search
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (lastWebsearch >= 0) { |
|
|
|
if (lastWebsearch >= 0) { |
|
|
|
// The last used site should be a user-configured web search site
|
|
|
|
// The last used site should be a user-configured web search site
|
|
|
|
int max = getMaxWebsearch(); // Zero-based index, so with max == 0 there is 1 server
|
|
|
|
int max = getMaxWebsearch(); // Zero-based index, so with max == 0 there is 1 server
|
|
|
@ -481,7 +469,7 @@ public class ApplicationSettings { |
|
|
|
* Registers the unique key of some web search or in-app search site as being last used by the user |
|
|
|
* Registers the unique key of some web search or in-app search site as being last used by the user |
|
|
|
* @param order The key identifying the specific server |
|
|
|
* @param order The key identifying the specific server |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setLastUsedSearchSite(SearchSite site) { |
|
|
|
public void setLastUsedSearchSite(SearchSetting site) { |
|
|
|
prefs.edit().putString("header_setsearchsite", site.getKey()).commit(); |
|
|
|
prefs.edit().putString("header_setsearchsite", site.getKey()).commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -520,12 +508,10 @@ public class ApplicationSettings { |
|
|
|
if (!prefs.contains("widget_server_" + appWidgetId)) |
|
|
|
if (!prefs.contains("widget_server_" + appWidgetId)) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
// @formatter:off
|
|
|
|
// @formatter:off
|
|
|
|
return new WidgetConfig( |
|
|
|
return new WidgetConfig(prefs.getInt("widget_server_" + appWidgetId, -1), StatusType.valueOf(prefs.getString( |
|
|
|
prefs.getInt("widget_server_" + appWidgetId, -1), |
|
|
|
"widget_status_" + appWidgetId, StatusType.ShowAll.name())), TorrentsSortBy.valueOf(prefs.getString( |
|
|
|
StatusType.valueOf(prefs.getString("widget_status_" + appWidgetId, StatusType.ShowAll.name())), |
|
|
|
"widget_sortby_" + appWidgetId, TorrentsSortBy.Alphanumeric.name())), prefs.getBoolean( |
|
|
|
TorrentsSortBy.valueOf(prefs.getString("widget_sortby_" + appWidgetId, TorrentsSortBy.Alphanumeric.name())), |
|
|
|
"widget_reverse_" + appWidgetId, false), prefs.getBoolean("widget_darktheme_" + appWidgetId, false)); |
|
|
|
prefs.getBoolean("widget_reverse_" + appWidgetId, false), |
|
|
|
|
|
|
|
prefs.getBoolean("widget_darktheme_" + appWidgetId, false)); |
|
|
|
|
|
|
|
// @formatter:on
|
|
|
|
// @formatter:on
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|