Merge lp:~tomdroid-dev/tomdroid/check-for-linebreak into lp:~tomdroid-maintainers/tomdroid/main

Proposed by Stefan Hammer
Status: Merged
Merged at revision: 286
Proposed branch: lp:~tomdroid-dev/tomdroid/check-for-linebreak
Merge into: lp:~tomdroid-maintainers/tomdroid/main
Diff against target: 92 lines (+16/-7)
4 files modified
NEWS (+1/-0)
res/values/strings.xml (+1/-1)
res/xml/preferences.xml (+4/-2)
src/org/tomdroid/ui/PreferencesActivity.java (+10/-4)
To merge this branch: bzr merge lp:~tomdroid-dev/tomdroid/check-for-linebreak
Reviewer Review Type Date Requested Status
Olivier Bilodeau Approve
Review via email: mp+100330@code.launchpad.net

Description of the change

To post a comment you must log in.
287. By Stefan Hammer

modified NEWS entry to save Olivier some work :-)

288. By Stefan Hammer

adding singleline=true is a better fix. Further, checking for tabs and spaces also avoids crashing

289. By Stefan Hammer

wicht copy/paste linebreaks could also go in... it is more save to also check for them. Now I am really done.

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

merge!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2012-03-31 22:07:31 +0000
+++ NEWS 2012-04-01 13:30:25 +0000
@@ -13,6 +13,7 @@
1313
14-------------------------------------------------------------------------------14-------------------------------------------------------------------------------
15Versoin 0.?? released on ??15Versoin 0.?? released on ??
16* Fix crash when authenticating a server URL that includes newline (Stefan Hammer, lp:902855)
16* Can specify folder for SD Card Sync (ie: dropbox) (Stefan Hammer, lp:837119)17* Can specify folder for SD Card Sync (ie: dropbox) (Stefan Hammer, lp:837119)
17* Creating home-screen shortcuts to notes is now possible (Piotr Adamski, 18* Creating home-screen shortcuts to notes is now possible (Piotr Adamski,
18 lp:882703)19 lp:882703)
1920
=== modified file 'res/values/strings.xml'
--- res/values/strings.xml 2012-03-31 21:13:15 +0000
+++ res/values/strings.xml 2012-04-01 13:30:25 +0000
@@ -57,7 +57,7 @@
57 <string name="prefAuthenticate">Authenticate</string>57 <string name="prefAuthenticate">Authenticate</string>
58 <string name="prefLocation">Location on SD Card</string>58 <string name="prefLocation">Location on SD Card</string>
59 <string name="prefFolderCreated">The folder \"%1$s\" does not exist yet. Please connect your device to the computer, create the folder and fill it with *.note files.</string>59 <string name="prefFolderCreated">The folder \"%1$s\" does not exist yet. Please connect your device to the computer, create the folder and fill it with *.note files.</string>
60 <string name="prefNoValidLocation">\"%1$s\" is no valid folder location. Please try again!</string>60 <string name="prefNoValidEntry">\"%1$s\" contains invalid characters.\nPlease try again!</string>
61 61
62 <string name="prefSyncCompleteAuth">Completing authentication. Please wait...</string>62 <string name="prefSyncCompleteAuth">Completing authentication. Please wait...</string>
63 <string name="prefSyncConnectionFailed">The connection to the server has failed, please check that the address you entered is correct.</string>63 <string name="prefSyncConnectionFailed">The connection to the server has failed, please check that the address you entered is correct.</string>
6464
=== modified file 'res/xml/preferences.xml'
--- res/xml/preferences.xml 2012-01-12 12:14:57 +0000
+++ res/xml/preferences.xml 2012-04-01 13:30:25 +0000
@@ -33,12 +33,14 @@
33 <EditTextPreference android:key="sync_server"33 <EditTextPreference android:key="sync_server"
34 android:title="@string/prefSyncServer"34 android:title="@string/prefSyncServer"
35 android:positiveButtonText="@string/prefAuthenticate"35 android:positiveButtonText="@string/prefAuthenticate"
36 android:shouldDisableView="true"/>36 android:shouldDisableView="true"
37 android:singleLine="true"/>
37 38
38 <EditTextPreference android:key="sd_location"39 <EditTextPreference android:key="sd_location"
39 android:title="@string/prefLocation"40 android:title="@string/prefLocation"
40 android:positiveButtonText="@string/btnOk"41 android:positiveButtonText="@string/btnOk"
41 android:shouldDisableView="true"/>42 android:shouldDisableView="true"
43 android:singleLine="true"/>
42 </PreferenceCategory>44 </PreferenceCategory>
43 <PreferenceCategory android:title="@string/prefSearch">45 <PreferenceCategory android:title="@string/prefSearch">
44 <Preference46 <Preference
4547
=== modified file 'src/org/tomdroid/ui/PreferencesActivity.java'
--- src/org/tomdroid/ui/PreferencesActivity.java 2012-03-31 21:08:34 +0000
+++ src/org/tomdroid/ui/PreferencesActivity.java 2012-04-01 13:30:25 +0000
@@ -112,6 +112,10 @@
112 Toast.LENGTH_SHORT).show();112 Toast.LENGTH_SHORT).show();
113 return false;113 return false;
114 }114 }
115 if ((serverUri.toString().contains("\t")) || (serverUri.toString().contains(" ")) || (serverUri.toString().contains("\n"))){
116 noValidEntry(serverUri.toString());
117 return false;
118 }
115 119
116 authenticate((String) serverUri);120 authenticate((String) serverUri);
117 return true;121 return true;
@@ -127,8 +131,8 @@
127 if (locationUri.equals(Preferences.getString(Preferences.Key.SD_LOCATION))) { 131 if (locationUri.equals(Preferences.getString(Preferences.Key.SD_LOCATION))) {
128 return false;132 return false;
129 }133 }
130 if (locationUri.toString().contains("\n")) { 134 if ((locationUri.toString().contains("\t")) || (locationUri.toString().contains("\n"))) {
131 noValidLocation(locationUri.toString());135 noValidEntry(locationUri.toString());
132 return false;136 return false;
133 }137 }
134 138
@@ -277,6 +281,7 @@
277 281
278 private void folderNotExisting(String path) {282 private void folderNotExisting(String path) {
279 new AlertDialog.Builder(this)283 new AlertDialog.Builder(this)
284 .setTitle(getString(R.string.error))
280 .setMessage(String.format(getString(R.string.prefFolderCreated), path))285 .setMessage(String.format(getString(R.string.prefFolderCreated), path))
281 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {286 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {
282 public void onClick(DialogInterface dialog, int which) {287 public void onClick(DialogInterface dialog, int which) {
@@ -285,9 +290,10 @@
285 .show();290 .show();
286 }291 }
287 292
288 private void noValidLocation(String path) {293 private void noValidEntry(String Entry) {
289 new AlertDialog.Builder(this)294 new AlertDialog.Builder(this)
290 .setMessage(String.format(getString(R.string.prefNoValidLocation), path))295 .setTitle(getString(R.string.error))
296 .setMessage(String.format(getString(R.string.prefNoValidEntry), Entry))
291 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {297 .setNeutralButton(getString(R.string.btnOk), new OnClickListener() {
292 public void onClick(DialogInterface dialog, int which) {298 public void onClick(DialogInterface dialog, int which) {
293 dialog.dismiss();299 dialog.dismiss();

Subscribers

People subscribed via source and target branches