diff options
author | lookshe <github@lookshe.org> | 2015-04-12 20:59:12 +0200 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2015-04-12 20:59:12 +0200 |
commit | 56e695cf1be3c519d749e3736bdc60a39b43fd8d (patch) | |
tree | 6074c8c9b002f75df1c41c181f2ccc6e66debad2 /src/main | |
parent | 98c09f18a22628eae9c98f6efa861f739677e188 (diff) |
added settings for accepting and downloading files
fix in Settings, initialize with same values like in preferences.xml
Diffstat (limited to 'src/main')
23 files changed, 75 insertions, 29 deletions
diff --git a/src/main/java/de/tzur/conversations/Settings.java b/src/main/java/de/tzur/conversations/Settings.java index cc2ac045..ff253e40 100644 --- a/src/main/java/de/tzur/conversations/Settings.java +++ b/src/main/java/de/tzur/conversations/Settings.java @@ -38,20 +38,34 @@ public final class Settings { case "led_notify_color": Settings.LED_COLOR = preferences.getInt(name, Settings.LED_COLOR); break; + case "auto_download_file_wlan": + Settings.DOWNLOAD_ONLY_WLAN = preferences.getBoolean(name, Settings.DOWNLOAD_ONLY_WLAN); + break; + case "auto_download_file_link": + Settings.DOWNLOAD_IMAGE_LINKS = preferences.getBoolean(name, Settings.DOWNLOAD_IMAGE_LINKS); + break; } } /** * Boolean if emoticons should be parsed to emoticons or not. */ - public static boolean PARSE_EMOTICONS = false; + public static boolean PARSE_EMOTICONS = true; /** * Boolean if online status should be shown or not. */ - public static boolean SHOW_ONLINE_STATUS = false; + public static boolean SHOW_ONLINE_STATUS = true; /** * LED Color */ public static int LED_COLOR = 0xffffffff; + /** + * Boolean if image-links should be downloaded or not. + */ + public static boolean DOWNLOAD_IMAGE_LINKS = true; + /** + * Boolean if automatic downloads should be done only jif connected to WLAN. + */ + public static boolean DOWNLOAD_ONLY_WLAN = true; /** * This is a utility class - private constructor avoids any instantiation. diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 8ae9b642..076de66f 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -3,6 +3,7 @@ package eu.siacs.conversations.parser; import net.java.otr4j.session.Session; import net.java.otr4j.session.SessionStatus; +import de.tzur.conversations.Settings; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; @@ -618,7 +619,7 @@ public class MessageParser extends AbstractParser implements } } final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager(); - if (message.trusted() && message.bodyContainsDownloadable() && manager.getAutoAcceptFileSize() > 0) { + if (message.trusted() && Settings.DOWNLOAD_IMAGE_LINKS && message.bodyContainsDownloadable() && manager.getAutoAcceptFileSize() > 0) { manager.createNewConnection(message); } else if (!message.isRead()) { mXmppConnectionService.getNotificationService().push(message); diff --git a/src/main/res/values-ar-rEG/strings.xml b/src/main/res/values-ar-rEG/strings.xml index 3acf8e54..9db20be6 100644 --- a/src/main/res/values-ar-rEG/strings.xml +++ b/src/main/res/values-ar-rEG/strings.xml @@ -97,7 +97,7 @@ <string name="pref_general">عام</string> <string name="pref_xmpp_resource">الريسورس</string> <string name="pref_accept_files">ضبط استقبال الملفات</string> - <string name="pref_accept_files_summary">اقبل تلقائيا الملفات أقل من</string> + <string name="pref_accept_files_size_summary">اقبل تلقائيا الملفات أقل من</string> <string name="pref_notification_settings">اعدادات الإشعارات</string> <string name="pref_notifications">الإشعارات</string> <string name="pref_notifications_summary">أخبرني عندما تصل رساله جديده</string> diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml index 2f89f3ae..2c444785 100644 --- a/src/main/res/values-bg/strings.xml +++ b/src/main/res/values-bg/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP ресурс</string> <string name="pref_xmpp_resource_summary">Името, с което се определя този клиент</string> <string name="pref_accept_files">Приемане на файлове</string> - <string name="pref_accept_files_summary">Автоматично приемане на файлове с размер, по-малък от...</string> + <string name="pref_accept_files_size_summary">Автоматично приемане на файлове с размер, по-малък от...</string> <string name="pref_notification_settings">Настройки за известията</string> <string name="pref_notifications">Известия</string> <string name="pref_notifications_summary">Известяване при получаване на ново съобщение</string> diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml index e50fa740..911c42d7 100644 --- a/src/main/res/values-ca/strings.xml +++ b/src/main/res/values-ca/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">Recursos XMPP</string> <string name="pref_xmpp_resource_summary">El nom que identifica aquest client amb</string> <string name="pref_accept_files">Acceptar fitxers</string> - <string name="pref_accept_files_summary">Accepta fitxers automàticament amb una mida menor a…</string> + <string name="pref_accept_files_size_summary">Accepta fitxers automàticament amb una mida menor a…</string> <string name="pref_notification_settings">Ajustos de notificacions</string> <string name="pref_notifications">Notificacions</string> <string name="pref_notifications_summary">Notifica quan arriba un nou missatge</string> diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 0c08fa7a..03b18a71 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP zdroj</string> <string name="pref_xmpp_resource_summary">Jméno se kterým se tento klient identifikuje</string> <string name="pref_accept_files">Přijímat soubory</string> - <string name="pref_accept_files_summary">Automaticky přijímat soubory menší než…</string> + <string name="pref_accept_files_size_summary">Automaticky přijímat soubory menší než…</string> <string name="pref_notification_settings">Nastavení upozornění</string> <string name="pref_notifications">Upozornění</string> <string name="pref_notifications_summary">Upozornit při přijetí nové zprávy</string> diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 1233817f..9b48bfd5 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -98,7 +98,13 @@ <string name="pref_xmpp_resource">XMPP-Ressource</string> <string name="pref_xmpp_resource_summary">Der Name, mit dem sich der Client selbst identifiziert</string> <string name="pref_accept_files">Dateiannahme</string> - <string name="pref_accept_files_summary">Dateien, die kleiner sind als …, automatisch annehmen</string> + <string name="pref_accept_files_summary">Einstellungen für Dateiannahme und automatischen Download</string> + <string name="pref_accept_files_size">Größe</string> + <string name="pref_accept_files_size_summary">Dateien, die kleiner sind als …, automatisch annehmen</string> + <string name="pref_accept_files_download">nur WLAN</string> + <string name="pref_accept_files_download_summary">Automatisches Herunterladen und Akzpetieren von Dateien nur im WLAN</string> + <string name="pref_accept_files_download_link">Bilder-Links</string> + <string name="pref_accept_files_download_link_summary">Bilder-Links automatisch herunterladen</string> <string name="pref_notification_settings">Benachrichtigungen</string> <string name="pref_notifications">Benachrichtigungen</string> <string name="pref_notifications_summary">Benachrichtige mich, wenn eine neue Nachricht ankommt</string> diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index 48dc4034..eadf1afc 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">πόρος XMPP</string> <string name="pref_xmpp_resource_summary">Το όνομα με το οποίο ταυτοποιείται αυτό το πρόγραμμα-πελάτης</string> <string name="pref_accept_files">Αποδοχή αρχείων</string> - <string name="pref_accept_files_summary">Αυτόματη αποδοχή αρχείων μικρότερα από...</string> + <string name="pref_accept_files_size_summary">Αυτόματη αποδοχή αρχείων μικρότερα από...</string> <string name="pref_notification_settings">Επιλογές ειδοποιήσεων</string> <string name="pref_notifications">Ειδοποιήσεις</string> <string name="pref_notifications_summary">Ειδοποίηση όταν λαμβάνεται ένα νέο μήνυμα</string> diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index 639eddfa..91da6b80 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">Recurso</string> <string name="pref_xmpp_resource_summary">El nombre que identifica el cliente que estás utilizando</string> <string name="pref_accept_files">Aceptar archivos</string> - <string name="pref_accept_files_summary">De forma automática aceptar archivos menores que…</string> + <string name="pref_accept_files_size_summary">De forma automática aceptar archivos menores que…</string> <string name="pref_notification_settings">Ajustes de notificación</string> <string name="pref_notifications">Notificaciones</string> <string name="pref_notifications_summary">Notifica cuando llega un nuevo mensaje</string> diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index 4d81c1bf..4b03d8b3 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP baliabidea</string> <string name="pref_xmpp_resource_summary">Bezero honek bere burua aurkezteko erabiltzen duen izena</string> <string name="pref_accept_files">Fitxategiak onartu</string> - <string name="pref_accept_files_summary">Hurrengo tamaina baino fitxategi txikiagoak automatikoki onartu…</string> + <string name="pref_accept_files_size_summary">Hurrengo tamaina baino fitxategi txikiagoak automatikoki onartu…</string> <string name="pref_notification_settings">Jakinarazpenen ezarpenak</string> <string name="pref_notifications">Jakinarazpenak</string> <string name="pref_notifications_summary">Mezu berri bat heltzerakoan jakinarazi</string> diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 69440362..b5df7f98 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">Ressource XMPP</string> <string name="pref_xmpp_resource_summary">Nom permettant d\'identifier ce client XMPP</string> <string name="pref_accept_files">Accepter les fichiers</string> - <string name="pref_accept_files_summary">Accepter automatiquement les fichiers plus petits que…</string> + <string name="pref_accept_files_size_summary">Accepter automatiquement les fichiers plus petits que…</string> <string name="pref_notification_settings">Paramètres de notification</string> <string name="pref_notifications">Notifications</string> <string name="pref_notifications_summary">Notifier l\'arrivée d\'un message</string> diff --git a/src/main/res/values-gl/strings.xml b/src/main/res/values-gl/strings.xml index 70a8f351..c432bd2e 100644 --- a/src/main/res/values-gl/strings.xml +++ b/src/main/res/values-gl/strings.xml @@ -62,7 +62,7 @@ <string name="pref_xmpp_resource">Recurso</string> <string name="pref_xmpp_resource_summary">O nome que identifica o cliente que estás a empregar</string> <string name="pref_accept_files">Aceptar arquivos</string> - <string name="pref_accept_files_summary">De forma automática aceptar arquivos menores de…</string> + <string name="pref_accept_files_size_summary">De forma automática aceptar arquivos menores de…</string> <string name="pref_notification_settings">Axustes de notificación</string> <string name="pref_notifications">Notificacións</string> <string name="pref_notifications_summary">Notifica cuando chega unha nova mensaxe</string> diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index c32e9585..d65fdc0d 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">Risorsa XMPP</string> <string name="pref_xmpp_resource_summary">Il nome con il quale questo client si identifica</string> <string name="pref_accept_files">Accetta i file</string> - <string name="pref_accept_files_summary">Accetta automaticamente i file più piccoli di…</string> + <string name="pref_accept_files_size_summary">Accetta automaticamente i file più piccoli di…</string> <string name="pref_notification_settings">Impostazioni di Notifica</string> <string name="pref_notifications">Notifiche</string> <string name="pref_notifications_summary">Notifica quando arriva un nuovo messaggio</string> diff --git a/src/main/res/values-iw/strings.xml b/src/main/res/values-iw/strings.xml index 010da80e..7ef94abc 100644 --- a/src/main/res/values-iw/strings.xml +++ b/src/main/res/values-iw/strings.xml @@ -83,7 +83,7 @@ <string name="pref_xmpp_resource">משאב XMPP</string> <string name="pref_xmpp_resource_summary">השם שלקוח זה מזהה את עצמו עם</string> <string name="pref_accept_files">קבל קבצים</string> - <string name="pref_accept_files_summary">קבל אוטומטית קבצים קטנים יותר מאשר…</string> + <string name="pref_accept_files_size_summary">קבל אוטומטית קבצים קטנים יותר מאשר…</string> <string name="pref_notification_settings">הגדרות התראה</string> <string name="pref_notifications">התראות</string> <string name="pref_notifications_summary">תודיע כאשר הודעה חדשה מגיעה</string> diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 2b8c5501..d8d13f81 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP resource</string> <string name="pref_xmpp_resource_summary">De naam waarmee deze client zich identificeert</string> <string name="pref_accept_files">Accepteer bestanden</string> - <string name="pref_accept_files_summary">Accepteer automatisch bestanden kleiner dan…</string> + <string name="pref_accept_files_size_summary">Accepteer automatisch bestanden kleiner dan…</string> <string name="pref_notification_settings">Meldingsinstellingen</string> <string name="pref_notifications">Meldingen</string> <string name="pref_notifications_summary">Melding als een nieuw bericht arriveert</string> diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index 4a96a7fe..8c4d0950 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -84,7 +84,7 @@ <string name="pref_xmpp_resource">Название ресурса</string> <string name="pref_xmpp_resource_summary">Имя которым Conversations идентифицирует себя</string> <string name="pref_accept_files">Принимать файлы</string> - <string name="pref_accept_files_summary">Автоматический прием файлов…</string> + <string name="pref_accept_files_size_summary">Автоматический прием файлов…</string> <string name="pref_notification_settings">Настройки Уведомлений</string> <string name="pref_notifications">Уведомление</string> <string name="pref_notifications_summary">Использовать звуковое уведомление когда приходят новые сообщения</string> diff --git a/src/main/res/values-sk/strings.xml b/src/main/res/values-sk/strings.xml index bca8d3d2..911f9cd5 100644 --- a/src/main/res/values-sk/strings.xml +++ b/src/main/res/values-sk/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP zdroj</string> <string name="pref_xmpp_resource_summary">Meno, ktorým sa tento klient identifikuje</string> <string name="pref_accept_files">Prijať súbory</string> - <string name="pref_accept_files_summary">Automaticky prijať súbory menšie ako…</string> + <string name="pref_accept_files_size_summary">Automaticky prijať súbory menšie ako…</string> <string name="pref_notification_settings">Nastavenia upozornení</string> <string name="pref_notifications">Upozornenia</string> <string name="pref_notifications_summary">Upozorniť pri prijatí novej správy</string> diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml index 479889b7..6517a309 100644 --- a/src/main/res/values-sr/strings.xml +++ b/src/main/res/values-sr/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">ИксМПП ресурс</string> <string name="pref_xmpp_resource_summary">Име са којим се овај клијент идентификује</string> <string name="pref_accept_files">Прихваћај фајлове</string> - <string name="pref_accept_files_summary">Аутоматски прихваћај фајлове мање од…</string> + <string name="pref_accept_files_size_summary">Аутоматски прихваћај фајлове мање од…</string> <string name="pref_notification_settings">Поставке обавештења</string> <string name="pref_notifications">Обавештења</string> <string name="pref_notifications_summary">Обавести кад стигне нова порука</string> diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 69a66808..6f2b9858 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -98,7 +98,7 @@ <string name="pref_xmpp_resource">XMPP resurs</string> <string name="pref_xmpp_resource_summary">Namnet som klienten identifierar sig med</string> <string name="pref_accept_files">Acceptera filer</string> - <string name="pref_accept_files_summary">Acceptera automatiskt filer som är mindre än…</string> + <string name="pref_accept_files_size_summary">Acceptera automatiskt filer som är mindre än…</string> <string name="pref_notification_settings">Notifieringsinställningar</string> <string name="pref_notifications">Notifieringar</string> <string name="pref_notifications_summary">Notifiera när meddelande tagits emot</string> diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index 49ca9b97..b78176c4 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -84,7 +84,7 @@ <string name="pref_xmpp_resource">XMPP 资源</string> <string name="pref_xmpp_resource_summary">客户端标识名称</string> <string name="pref_accept_files">接收文件</string> - <string name="pref_accept_files_summary">自动接收小于 … 的文件</string> + <string name="pref_accept_files_size_summary">自动接收小于 … 的文件</string> <string name="pref_notification_settings">通知设置</string> <string name="pref_notifications">通知</string> <string name="pref_notifications_summary">收到新消息时通知</string> diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml index 8aed12d6..f3e67665 100644 --- a/src/main/res/values-zh-rTW/strings.xml +++ b/src/main/res/values-zh-rTW/strings.xml @@ -82,7 +82,7 @@ <string name="pref_xmpp_resource">XMPP 資源</string> <string name="pref_xmpp_resource_summary">客戶端標示名稱</string> <string name="pref_accept_files">接收文件</string> - <string name="pref_accept_files_summary">自動接收小於 … 的文件</string> + <string name="pref_accept_files_size_summary">自動接收小於 … 的文件</string> <string name="pref_notification_settings">通知設定</string> <string name="pref_notifications">通知</string> <string name="pref_notifications_summary">收到新訊息時通知</string> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 2cd67077..03c1386f 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -100,7 +100,13 @@ <string name="pref_xmpp_resource">XMPP resource</string> <string name="pref_xmpp_resource_summary">The name this client identifies itself with</string> <string name="pref_accept_files">Accept files</string> - <string name="pref_accept_files_summary">Automatically accept files smaller than…</string> + <string name="pref_accept_files_summary">Settings for accepting and automatically downloading files</string> + <string name="pref_accept_files_size">Size</string> + <string name="pref_accept_files_size_summary">Automatically accept files smaller than…</string> + <string name="pref_accept_files_download">WLAN only</string> + <string name="pref_accept_files_download_summary">Download and accept files automatically only when using WLAN</string> + <string name="pref_accept_files_download_link">Image links</string> + <string name="pref_accept_files_download_link_summary">Automatically download image links</string> <string name="pref_notification_settings">Notification Settings</string> <string name="pref_notifications">Notifications</string> <string name="pref_notifications_summary">Notify when a new message arrives</string> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 206fc6b4..72b6a7c8 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -16,13 +16,32 @@ android:key="resource" android:summary="@string/pref_xmpp_resource_summary" android:title="@string/pref_xmpp_resource" /> - <ListPreference - android:defaultValue="524288" - android:entries="@array/filesizes" - android:entryValues="@array/filesizes_values" - android:key="auto_accept_file_size" + + <PreferenceScreen android:summary="@string/pref_accept_files_summary" - android:title="@string/pref_accept_files" /> + android:title="@string/pref_accept_files"> + + <CheckBoxPreference + android:defaultValue="true" + android:key="auto_download_file_link" + android:summary="@string/pref_accept_files_download_link_summary" + android:title="@string/pref_accept_files_download_link" /> + + <ListPreference + android:defaultValue="524288" + android:entries="@array/filesizes" + android:entryValues="@array/filesizes_values" + android:key="auto_accept_file_size" + android:summary="@string/pref_accept_files_size_summary" + android:title="@string/pref_accept_files_size" /> + + <CheckBoxPreference + android:defaultValue="true" + android:key="auto_download_file_wlan" + android:summary="@string/pref_accept_files_download_summary" + android:title="@string/pref_accept_files_download" /> + + </PreferenceScreen> <CheckBoxPreference android:defaultValue="true" |