From: masensio Date: Mon, 18 Nov 2013 13:42:07 +0000 (+0100) Subject: t puswqMerge branch 'refactor_remote_operation_to_create_folder' into refactor_remote... X-Git-Tag: oc-android-1.5.5~123^2~4 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/515ec5e8dd751956264dffdb1b5db65eda0aed8a?hp=f780062616bd9fec5eae37affff04d697befc795 t puswqMerge branch 'refactor_remote_operation_to_create_folder' into refactor_remote_operation_to_rename_folder Conflicts: oc_framework-test-project/src/com/owncloud/android/oc_framework_test_project/TestActivity.java oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java --- diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b1075278..bdd792b0 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -18,8 +18,8 @@ along with this program. If not, see . --> + android:versionCode="105000" + android:versionName="1.5.0" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/SETUP.md b/SETUP.md index 6e7b7f62..64701577 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,56 +1,73 @@ - If you want to start help developing ownCloud please follow the [contribution guidlines][0] and observe these instructions: +If you want to start help developing ownCloud please follow the [contribution guidelines][0] and observe these instructions: - 1. Fork and download android/develop repository: - - - NOTE: You must have git in your enviroment path - - Navigate to https://github.com/owncloud/android, click fork. - - Clone your new repo: "git clone git@github.com:YOURGITHUBNAME/android.git" - - "cd android" - - Checkout remote develop branch: "git checkout -b develop remotes/origin/develop" - - Pull changes from your develop branch: "git pull origin develop" - - Make sure to get the latest changes from official android/develop branch: - - Make official owncloud repo known as upstream: "git remote add upstream git@github.com:owncloud/android.git" - - Pull latest changes from upstream: "git pull upstream develop" - - 2. Building with console/maven: - - - OPTIONAL, CONTINUE WITH STEP 3 IF NOT REQUIRED! - - NOTE: You must have mvn in your enviroment path - - Download/install Android plugin for Maven, then build ownCloud with mvn: - - "cd .." - - "git clone https://github.com/mosabua/maven-android-sdk-deployer.git" - - "cd maven-android-sdk-deployer" - - "mvn -pl com.simpligility.android.sdk-deployer:android-17 -am install" - - "cd ../android" - - Now you can create APK using "mvn package" - - 3. Building with Eclipse: - - - NOTE: You must have android/tools, and 'platforms-tools' in your enviroment path - - Prepare building with Eclipse: - - "setup_env.bat" or "./setup_env.sh" - - Open Eclipse and create new "Android Project from Existing Code". As root choose android/actionbarsherlock/library - - Increase Android API level until project compiles. 14 should work. - - Clean project and compile. - - Make sure android/actionbarsherlock/library/bin/library.jar was created! - - Import OwnCloud Android project. - - Increase Android API level to 17. - - Clean project and compile. - - After those actions you should be good to go. HAVE FUN! - - NOTE: Even though API level is set to 17, APK also runs on older devices because in AndroidManifest.xml minSdkVersion is set to 8. - - 4. Create pull request: +### 1. Fork and download android/develop repository: + +NOTE: You must have git in your environment path variable to perform the next operations. + +* Navigate to https://github.com/owncloud/android, click fork. +* Clone your new repo: "git clone git@github.com:YOURGITHUBNAME/android.git" +* Move to the project folder with "cd android" +* Checkout remote develop branch: "git checkout -b develop remotes/origin/develop" +* Pull changes from your develop branch: "git pull origin develop" +* Make official ownCloud repo known as upstream: "git remote add upstream git@github.com:owncloud/android.git" +* Make sure to get the latest changes from official android/develop branch: "git pull upstream develop" + +At this point you can continue using different tools to build the project. Section 2, 3 and 4 describe some of the existing alternatives. + +### 2. Building with Ant: + +NOTE: You must have the Android SDK 'tools/', and 'platforms-tools/' folders in your environment path variable. + +* Complete the setup of project properties and resolve pending dependencies running "setup_env.bat" or "./setup_env.sh" . +* Run "ant clean" . +* Run "ant debug" to generate a debuggable version of the ownCkoud app. + +### 3. Building with console/maven: + +NOTE: You must have mvn in your environment path + +* Download/install Android plugin for Maven, then build ownCloud with mvn: +* "cd .." +* "git clone https://github.com/mosabua/maven-android-sdk-deployer.git" +* "cd maven-android-sdk-deployer" +* "mvn -pl com.simpligility.android.sdk-deployer:android-17 -am install" +* "cd ../android" +* Now you can create APK using "mvn package" + +### 4. Building with Eclipse: + +NOTE: You must have the Android SDK 'tools/', and 'platforms-tools/' folders in your environment path variable. + +* Complete the setup of project properties and resolve pending dependencies running "setup_env.bat" or "./setup_env.sh" . +* Open Eclipse and create new "Android Project from Existing Code". Choose android/actionbarsherlock/library as root. +* Clean project and compile. +* If any error appear, check the project properties; in the 'Android' section, API Level should be greater or equal than 14. +* Make sure android/actionbarsherlock/library/bin/library.jar was created. +* Create a new "Android Project from Existing Code". Choose android/oc_framework/library as root. +* Clean project and compile. +* If any error appear, check the project properties; in the 'Android' section, API Level should be 19 or greater. +* Make sure android/oc_framework/bin/classes.jar was created. +* Import ownCloud Android project. +* Clean project and compile. +* If any error appears, check the project properties; in the 'Android' section: + - API Level should be 19 or greater. + - Two library projects should appear referred in the bottom square: actionbarsherlock/library and oc_framework. Add them if needed. +* After those actions you should be good to go. HAVE FUN! + +NOTE: Even though API level is set to 19, APK also runs on older devices because in AndroidManifest.xml minSdkVersion is set to 8. + +### 5. Create pull request: - - NOTE: You must sign the [Contributor Agreement][1] before your changes can be accepted! - - Commit your changes locally: "git commit -a" - - Push your changes to your Github repo: "git push" - - Browse to https://github.com/YOURGITHUBNAME/android/pulls and issue pull request - - Click "Edit" and set "base:develop" - - Again, click "Edit" and set "compare:develop" - - Enter description and send pull request. +NOTE: You must sign the [Contributor Agreement][1] before your changes can be accepted! + +* Commit your changes locally: "git commit -a" +* Push your changes to your Github repo: "git push" +* Browse to https://github.com/YOURGITHUBNAME/android/pulls and issue pull request +* Click "Edit" and set "base:develop" +* Again, click "Edit" and set "compare:develop" +* Enter description and send pull request. [0]: https://github.com/owncloud/android/blob/master/CONTRIBUTING.md [1]: http://owncloud.org/about/contributor-agreement/ - diff --git a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java index 90c59bb4..84145022 100644 --- a/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java +++ b/oc_framework-test-project/oc_framework-test-test/src/com/owncloud/android/oc_framework_test_project/test/CreateFolderTest.java @@ -38,19 +38,17 @@ public class CreateFolderTest extends ActivityInstrumentationTestCase2"+ am.getUserData(mAccount, "oc_version") ); -// Log.d(TAG, "oc_base_url --->"+ am.getUserData(mAccount, "oc_base_url") ); -// } - + // Get the WebDavClient + AuthTask task = new AuthTask(); + task.execute(this.getApplicationContext()); - try { - mClient = OwnCloudClientFactory.createOwnCloudClient(mAccount, this.getApplicationContext()); - } catch (OperationCanceledException e) { - Log.e(TAG, "Error while trying to access to " + mAccount.name, e); - e.printStackTrace(); - } catch (AuthenticatorException e) { - Log.e(TAG, "Error while trying to access to " + mAccount.name, e); - e.printStackTrace(); - } catch (AccountNotFoundException e) { - Log.e(TAG, "Error while trying to access to " + mAccount.name, e); - e.printStackTrace(); - } catch (IOException e) { - Log.e(TAG, "Error while trying to access to " + mAccount.name, e); - e.printStackTrace(); - } } @Override @@ -89,15 +69,14 @@ public class TestActivity extends Activity { /** * Access to the library method to Create a Folder - * @param folderName * @param remotePath * @param createFullPath * * @return */ - public RemoteOperationResult createFolder(String folderName, String remotePath, boolean createFullPath) { + public RemoteOperationResult createFolder(String remotePath, boolean createFullPath) { - CreateRemoteFolderOperation createOperation = new CreateRemoteFolderOperation(folderName, remotePath, createFullPath); + CreateRemoteFolderOperation createOperation = new CreateRemoteFolderOperation(remotePath, createFullPath); RemoteOperationResult result = createOperation.execute(mClient); return result; @@ -120,4 +99,39 @@ public class TestActivity extends Activity { return result; } + + private class AuthTask extends AsyncTask { + + @Override + protected WebdavClient doInBackground(Context... params) { + WebdavClient client = null; + try { + client = OwnCloudClientFactory.createOwnCloudClient(mAccount, (Context) params[0] ); + } catch (OperationCanceledException e) { + Log.e(TAG, "Error while trying to access to " + mAccount.name, e); + e.printStackTrace(); + } catch (AuthenticatorException e) { + Log.e(TAG, "Error while trying to access to " + mAccount.name, e); + e.printStackTrace(); + } catch (AccountNotFoundException e) { + Log.e(TAG, "Error while trying to access to " + mAccount.name, e); + e.printStackTrace(); + } catch (IOException e) { + Log.e(TAG, "Error while trying to access to " + mAccount.name, e); + e.printStackTrace(); + } catch (IllegalStateException e) { + Log.e(TAG, "Error while trying to access to " + mAccount.name, e); + e.printStackTrace(); + } + return client; + } + + @Override + protected void onPostExecute(WebdavClient result) { + // TODO Auto-generated method stub + super.onPostExecute(result); + mClient = result; + } + + } } diff --git a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java index f25c22ed..0974d08b 100644 --- a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java +++ b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/CreateRemoteFolderOperation.java @@ -29,19 +29,16 @@ public class CreateRemoteFolderOperation extends RemoteOperation { private static final int CONNECTION_TIMEOUT = 5000; - protected String mFolderName; protected String mRemotePath; protected boolean mCreateFullPath; /** * Constructor * - * @param folderName Name of new directory * @param remotePath Full path to the new directory to create in the remote server. * @param createFullPath 'True' means that all the ancestor folders should be created if don't exist yet. */ - public CreateRemoteFolderOperation(String folderName, String remotePath, boolean createFullPath) { - mFolderName = folderName; + public CreateRemoteFolderOperation(String remotePath, boolean createFullPath) { mRemotePath = remotePath; mCreateFullPath = createFullPath; } @@ -56,7 +53,7 @@ public class CreateRemoteFolderOperation extends RemoteOperation { RemoteOperationResult result = null; MkColMethod mkcol = null; - boolean noInvalidChars = FileUtils.validateName(mFolderName); + boolean noInvalidChars = FileUtils.isValidPath(mRemotePath); if (noInvalidChars) { try { mkcol = new MkColMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath)); @@ -87,7 +84,7 @@ public class CreateRemoteFolderOperation extends RemoteOperation { private RemoteOperationResult createParentFolder(String parentPath, WebdavClient client) { - RemoteOperation operation = new CreateRemoteFolderOperation("", parentPath, + RemoteOperation operation = new CreateRemoteFolderOperation(parentPath, mCreateFullPath); return operation.execute(client); } diff --git a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java index c05c4ca8..2ead67b3 100644 --- a/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java +++ b/oc_framework/src/com/owncloud/android/oc_framework/operations/remote/RenameRemoteFileOperation.java @@ -57,7 +57,7 @@ public class RenameRemoteFileOperation extends RemoteOperation { LocalMoveMethod move = null; - boolean noInvalidChars = FileUtils.validateName(mNewName); + boolean noInvalidChars = FileUtils.isValidPath(mNewRemotePath); if (noInvalidChars) { try { diff --git a/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java b/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java index 75bd5669..8fb01dce 100644 --- a/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java +++ b/oc_framework/src/com/owncloud/android/oc_framework/utils/FileUtils.java @@ -20,13 +20,31 @@ public class FileUtils { * @param fileName * @return */ - public static boolean validateName(String fileName) { + public static boolean isValidName(String fileName) { boolean result = true; - Log.d("FileUtils", "fileName ======= " + fileName); - if (fileName.contains("/") || fileName.contains("\\") || fileName.contains("<") || - fileName.contains(">") || fileName.contains(":") || fileName.contains("\"") || - fileName.contains("|") || fileName.contains("?") || fileName.contains("*")) { + Log.d("FileUtils", "fileName =======" + fileName); + if (fileName.contains(PATH_SEPARATOR) || + fileName.contains("\\") || fileName.contains("<") || fileName.contains(">") || + fileName.contains(":") || fileName.contains("\"") || fileName.contains("|") || + fileName.contains("?") || fileName.contains("*")) { + result = false; + } + return result; + } + + /** + * Validate the path to detect if contains any forbidden character: \ , < , > , : , " , | , ? , * + * @param path + * @return + */ + public static boolean isValidPath(String path) { + boolean result = true; + + Log.d("FileUtils", "path ....... " + path); + if (path.contains("\\") || path.contains("<") || path.contains(">") || + path.contains(":") || path.contains("\"") || path.contains("|") || + path.contains("?") || path.contains("*")) { result = false; } return result; diff --git a/oc_jb_workaround/AndroidManifest.xml b/oc_jb_workaround/AndroidManifest.xml index 9ae118d9..1b12fb49 100644 --- a/oc_jb_workaround/AndroidManifest.xml +++ b/oc_jb_workaround/AndroidManifest.xml @@ -1,18 +1,18 @@ + android:versionCode="0100010" + android:versionName="1.0.10" > + android:targetSdkVersion="19" /> + > diff --git a/oc_jb_workaround/res/drawable-hdpi/main_app_icon.png b/oc_jb_workaround/res/drawable-hdpi/main_app_icon.png index e388c7be..6fe153bb 100644 Binary files a/oc_jb_workaround/res/drawable-hdpi/main_app_icon.png and b/oc_jb_workaround/res/drawable-hdpi/main_app_icon.png differ diff --git a/oc_jb_workaround/res/drawable-hdpi/workaround_app_icon.png b/oc_jb_workaround/res/drawable-hdpi/workaround_app_icon.png index 7daeea4a..f28286a7 100644 Binary files a/oc_jb_workaround/res/drawable-hdpi/workaround_app_icon.png and b/oc_jb_workaround/res/drawable-hdpi/workaround_app_icon.png differ diff --git a/oc_jb_workaround/res/drawable-ldpi/main_app_icon.png b/oc_jb_workaround/res/drawable-ldpi/main_app_icon.png index 11cf0ab1..1bc470be 100644 Binary files a/oc_jb_workaround/res/drawable-ldpi/main_app_icon.png and b/oc_jb_workaround/res/drawable-ldpi/main_app_icon.png differ diff --git a/oc_jb_workaround/res/drawable-ldpi/workaround_app_icon.png b/oc_jb_workaround/res/drawable-ldpi/workaround_app_icon.png index 8cd92ff9..cd8eb078 100644 Binary files a/oc_jb_workaround/res/drawable-ldpi/workaround_app_icon.png and b/oc_jb_workaround/res/drawable-ldpi/workaround_app_icon.png differ diff --git a/oc_jb_workaround/res/drawable-mdpi/main_app_icon.png b/oc_jb_workaround/res/drawable-mdpi/main_app_icon.png index 6997c7e4..9008b9d3 100644 Binary files a/oc_jb_workaround/res/drawable-mdpi/main_app_icon.png and b/oc_jb_workaround/res/drawable-mdpi/main_app_icon.png differ diff --git a/oc_jb_workaround/res/drawable-mdpi/workaround_app_icon.png b/oc_jb_workaround/res/drawable-mdpi/workaround_app_icon.png index 5bc795a3..f7ca7b00 100644 Binary files a/oc_jb_workaround/res/drawable-mdpi/workaround_app_icon.png and b/oc_jb_workaround/res/drawable-mdpi/workaround_app_icon.png differ diff --git a/oc_jb_workaround/res/values-v11/styles.xml b/oc_jb_workaround/res/values-v11/styles.xml deleted file mode 100644 index 541752f6..00000000 --- a/oc_jb_workaround/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/oc_jb_workaround/res/values-v14/styles.xml b/oc_jb_workaround/res/values-v14/styles.xml deleted file mode 100644 index f20e0150..00000000 --- a/oc_jb_workaround/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/oc_jb_workaround/res/values/setup.xml b/oc_jb_workaround/res/values/setup.xml index ed898f55..0bf5e1dd 100644 --- a/oc_jb_workaround/res/values/setup.xml +++ b/oc_jb_workaround/res/values/setup.xml @@ -1,4 +1,21 @@ + ownCloud Jelly Bean Workaround for lost credentials diff --git a/oc_jb_workaround/res/values/styles.xml b/oc_jb_workaround/res/values/styles.xml deleted file mode 100644 index 4a10ca49..00000000 --- a/oc_jb_workaround/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png index 8a2fe193..6fe153bb 100644 Binary files a/res/drawable-hdpi/icon.png and b/res/drawable-hdpi/icon.png differ diff --git a/res/drawable-hdpi/logo.png b/res/drawable-hdpi/logo.png index a920912c..188d693a 100644 Binary files a/res/drawable-hdpi/logo.png and b/res/drawable-hdpi/logo.png differ diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png index f8f54b73..1bc470be 100644 Binary files a/res/drawable-ldpi/icon.png and b/res/drawable-ldpi/icon.png differ diff --git a/res/drawable-ldpi/logo.png b/res/drawable-ldpi/logo.png index 7de7cb84..23998ff5 100644 Binary files a/res/drawable-ldpi/logo.png and b/res/drawable-ldpi/logo.png differ diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png index 42bbaad0..9008b9d3 100644 Binary files a/res/drawable-mdpi/icon.png and b/res/drawable-mdpi/icon.png differ diff --git a/res/drawable-mdpi/logo.png b/res/drawable-mdpi/logo.png index a920912c..23998ff5 100644 Binary files a/res/drawable-mdpi/logo.png and b/res/drawable-mdpi/logo.png differ diff --git a/res/values-hu-rHU/strings.xml b/res/values-hu-rHU/strings.xml index 88da10fc..81bcfa6f 100644 --- a/res/values-hu-rHU/strings.xml +++ b/res/values-hu-rHU/strings.xml @@ -24,7 +24,11 @@ Ez megjeleníti a rögzitett eseményeket Elözmények törlése Súgó + Ajánlja egy barátjának + Visszajelzés Impresszum + Próbálja ki %1$s-t az okostelefonján! + Kérem próbálja ki %1$s-t az okostelefonján!\nInnen tölthető le: %2$s Szerver állapot ellenörzés A kiszolgáló címe Felhasználói név @@ -91,6 +95,7 @@ Néhány helyi fájlt figyelmen kívül hagytunk %1$d fájlt nem sikerült a %2$s mappából bemásolni Az 1.3.16 verzió használatakor azok az állományok, amiket erről az eszközről töltenek fel, a helyi %1$s mappába másolódnak be, hogy elkerülhető legyen az adatveszteség, amikor ugyanazt az állományt több résztvevő is szinkronizál.\n\nEmiatt a változás miatt, az e program korábbi változataival feltöltött állományok a %2$s mappába másolódtak. Sajnos azonban egy a szinkronizáció közben fellépő hiba miatt ez a feladat csak részben valósult meg. Két lehetősége van: vagy úgy dönt, hogy maradjanak a fájl(ok) ahol vannak és akkor törölje a %3$s-re mutató linket, vagy pedig helyezze át az állomány(oka)t a %1$s mappába, és tartsa meg a %4$s-re mutató linket.\n\nAz alábbiakban látható a helyi fájl(ok) listája és a távoli fájl(ok) a %5$s mappában, amihez linkelve voltak. + A %1$s mappa már nem létezik Helyezzük át mindet Az összes fájlt áthelyeztük Egyes fájlokat nem sikerült áthelyezni @@ -116,6 +121,7 @@ Nem támogatott média kodek Media fájl nem olvasható Médiafájl kódolása nem megfelelő + A lejátszás közben időtúllépés történt A média fájlt nem lehet streamelni. A média fájlt nem tudja lejátszani a jelenlegi médialejátszó Biztonsági hiba amikor megpróbálja lejátszani a %1$s @@ -130,12 +136,15 @@ A kapcsolat létrejött Kapcsolat tesztelése... Hibás a kiszolgáló beállítása + Egy bejelentkezési beállítás már létezik ugyanehhez a kiszolgálóhoz és felhasználóhoz + A megadott felhasználó nem azonos ezzel a belépési jogosultsággal Ismeretlen hiba történt! A kiszolgáló nem található Kiszolgáló nem található A kiszolgáló túl sokára válaszolt Hibás URL Nem sikerült az SSL kapcsolat felépítése + Az SSL kiszolgáló tanúsítványát nem sikerült ellenőrizni Ismeretlen változat a kiszolgálón A kapcsolat nem hozható létre Létrejött a titkosított kapcsolat @@ -143,7 +152,12 @@ Sikertelen azonosítás Hozzáférés megtagadva az azonsítást végző szerver által Nem várt állapot; kérlek, menj a szerver URL-jére újra. + A jogosultsága lejárt. Kérjük jelentkezzen be ismét! Kélek, írd be a jelenlegi jelszavadat + Lejárt a munkamenetének érvényessége. Kérjük jelentkezzen be ismét! + Kapcsolódás a felhasználóazonosítást végző kiszolgálóhoz... + A kiszolgáló nem támogatja ezt a felhasználóazonosítási módszert + %1$s nem támogat több bejelenkezési jogosultságot Automatikusan frissítse a fájlokat Átnevezés Eltávolítás @@ -164,6 +178,7 @@ Egy pillanat... Váratlan hiba; válassza ki a fájlt más programból Egy fájl sincs kiválasztva + Bejelentkezés oAuth2-vel Kapcsolódás az oAuth2 szerverhez... A kiszolgálót nem sikerült azonosítani - A kiszolgáló tanúsítványa nem megbízható diff --git a/res/values-sl/strings.xml b/res/values-sl/strings.xml index a54c11c4..faaee3f7 100644 --- a/res/values-sl/strings.xml +++ b/res/values-sl/strings.xml @@ -1,5 +1,7 @@ + različica %1$s + Osveži račun Pošlji datoteko Vsebina iz drugih programov Datoteke @@ -21,6 +23,7 @@ Pomoč Odziv Natis + Preveri strežnik Naslov strežnika Uporabniško ime Geslo @@ -93,10 +96,11 @@ Koda PIN bo zahtevana vsakič pred zagonom programa. Ponovno vnesite kodo PIN programa Odstrani kodo PIN programa - Vrednosti kodo PIN programa nista enaki - Nepravilen kodo PIN programa + Vrednosti kod PIN programa nista enaki + Nepravilna koda PIN programa Koda PIN programa je odstranjena Koda PIN programa je shranjena + Predvajalnik glasbe %1$s %1$s (predvajanja) %1$s (nalaganja) Medijskih datotek ni bilo mogoče najti @@ -112,15 +116,15 @@ Varna povezava ni na voljo. Povezava je vzpostavljena Preizkušanje povezave ... - Nastavitve servera so napačno oblikovane - Prišlo je do neznane napake + Napačno oblikovane nastavitve strežnika + Prišlo je do neznane napake! Gostitelja ni mogoče najti Namestitve servera ni mogoče najti Strežnik je potreboval preveč časa za odgovor Napačno oblikovan naslov URL Začenjanje SSL je spodletelo - Neprepoznana različica strežnika servera - Povezave ni mogoče vzpostaviti + Nepoznana različica strežnika + Ni mogoče vzpostaviti povezave Varna povezava je vzpostavljena Datoteka naj bo posodobljena Preimenuj @@ -165,6 +169,7 @@ Podpis: Algoritem: To je vsebnik predmetov. + Slika PNG 389 KB 2012/05/18 12:23 PM 12:23:45 @@ -179,6 +184,7 @@ Te slike ni mogoče prikazati Datoteke %1$s ni mogoče kopirati v krajevno mapo %2$s. izberi vse + vse izbrane poskusi znova Naloži več slik Sporočilo o napaki: diff --git a/res/values/strings.xml b/res/values/strings.xml index 21699cf8..05c7ecf8 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -182,7 +182,7 @@ Remote file could not be checked File contents already synchronized Directory could not be created - Invalid character in foldername: / \\ < > : " | ? * + Forbidden characters: / \\ < > : " | ? * Wait a moment "Unexpected problem ; please select the file from a different app" No file was selected @@ -232,7 +232,7 @@ This image can not be shown %1$s could not be copied to %2$s local directory - Failed InstantUpload" + Failed InstantUpload Failed instant uploads Summary of all failed instant uploads select all diff --git a/src/com/owncloud/android/files/OwnCloudFileObserver.java b/src/com/owncloud/android/files/OwnCloudFileObserver.java index 47a66b65..68c97e4f 100644 --- a/src/com/owncloud/android/files/OwnCloudFileObserver.java +++ b/src/com/owncloud/android/files/OwnCloudFileObserver.java @@ -28,8 +28,6 @@ import com.owncloud.android.oc_framework.operations.RemoteOperationResult.Result import com.owncloud.android.ui.activity.ConflictsResolveActivity; import com.owncloud.android.utils.Log_OC; - - import android.accounts.Account; import android.content.Context; import android.content.Intent; @@ -37,45 +35,57 @@ import android.os.FileObserver; public class OwnCloudFileObserver extends FileObserver { - public static int CHANGES_ONLY = CLOSE_WRITE; + private static int MASK = (FileObserver.MODIFY | FileObserver.CLOSE_WRITE); private static String TAG = OwnCloudFileObserver.class.getSimpleName(); private String mPath; private int mMask; private Account mOCAccount; - //private OCFile mFile; private Context mContext; + private boolean mModified; - public OwnCloudFileObserver(String path, Account account, Context context, int mask) { - super(path, mask); + public OwnCloudFileObserver(String path, Account account, Context context) { + super(path, MASK); if (path == null) throw new IllegalArgumentException("NULL path argument received"); - /*if (file == null) - throw new IllegalArgumentException("NULL file argument received");*/ if (account == null) throw new IllegalArgumentException("NULL account argument received"); if (context == null) throw new IllegalArgumentException("NULL context argument received"); - /*if (!path.equals(file.getStoragePath()) && !path.equals(FileStorageUtils.getDefaultSavePathFor(account.name, file))) - throw new IllegalArgumentException("File argument is not linked to the local file set in path argument"); */ mPath = path; - //mFile = file; mOCAccount = account; mContext = context; - mMask = mask; + mModified = false; } + @Override public void onEvent(int event, String path) { Log_OC.d(TAG, "Got file modified with event " + event + " and path " + mPath + ((path != null) ? File.separator + path : "")); - if ((event & mMask) == 0) { + if ((event & MASK) == 0) { Log_OC.wtf(TAG, "Incorrect event " + event + " sent for file " + mPath + ((path != null) ? File.separator + path : "") + " with registered for " + mMask + " and original path " + mPath); - return; - } + } else { + if ((event & FileObserver.MODIFY) != 0) { + // file changed + mModified = true; + } + // not sure if it's possible, but let's assume that both kind of events can be received at the same time + if ((event & FileObserver.CLOSE_WRITE) != 0) { + // file closed + if (mModified) { + mModified = false; + startSyncOperation(); + } + } + } + } + + + private void startSyncOperation() { FileDataStorageManager storageManager = new FileDataStorageManager(mOCAccount, mContext.getContentResolver()); OCFile file = storageManager.getFileByLocalPath(mPath); // a fresh object is needed; many things could have occurred to the file since it was registered to observe // again, assuming that local files are linked to a remote file AT MOST, SOMETHING TO BE DONE; diff --git a/src/com/owncloud/android/files/services/FileObserverService.java b/src/com/owncloud/android/files/services/FileObserverService.java index 871d2abf..fa1fec24 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -162,8 +162,7 @@ public class FileObserverService extends Service { OwnCloudFileObserver observer = new OwnCloudFileObserver( path, account, - getApplicationContext(), - OwnCloudFileObserver.CHANGES_ONLY); + getApplicationContext()); mObserversMap.put(path, observer); if (new File(path).exists()) { observer.startWatching(); @@ -202,8 +201,7 @@ public class FileObserverService extends Service { /// the local file was never registered to observe before observer = new OwnCloudFileObserver( localPath, account, - getApplicationContext(), - OwnCloudFileObserver.CHANGES_ONLY); + getApplicationContext()); mObserversMap.put(localPath, observer); Log_OC.d(TAG, "Observer added for path " + localPath); diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index e8dcf949..61f61791 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -562,8 +562,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe RemoteOperation operation = new ExistenceCheckOperation(pathToGrant, this, false); RemoteOperationResult result = operation.execute(mUploadClient); if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND && mCurrentUpload.isRemoteFolderToBeCreated()) { - operation = new CreateFolderOperation( mCurrentUpload.getFileName(), - pathToGrant, + operation = new CreateFolderOperation( pathToGrant, true, mStorageManager ); result = operation.execute(mUploadClient); diff --git a/src/com/owncloud/android/operations/CreateFolderOperation.java b/src/com/owncloud/android/operations/CreateFolderOperation.java index 57843332..1cf1f84d 100644 --- a/src/com/owncloud/android/operations/CreateFolderOperation.java +++ b/src/com/owncloud/android/operations/CreateFolderOperation.java @@ -39,7 +39,6 @@ public class CreateFolderOperation extends RemoteOperation implements OnRemoteOp private static final String TAG = CreateFolderOperation.class.getSimpleName(); - protected String mFolderName; protected String mRemotePath; protected boolean mCreateFullPath; protected FileDataStorageManager mStorageManager; @@ -47,12 +46,10 @@ public class CreateFolderOperation extends RemoteOperation implements OnRemoteOp /** * Constructor * - * @param remotePath Full path to the new directory to create in the remote server. * @param createFullPath 'True' means that all the ancestor folders should be created if don't exist yet. * @param storageManager Reference to the local database corresponding to the account where the file is contained. */ - public CreateFolderOperation(String folderName, String remotePath, boolean createFullPath, FileDataStorageManager storageManager) { - mFolderName = folderName; + public CreateFolderOperation(String remotePath, boolean createFullPath, FileDataStorageManager storageManager) { mRemotePath = remotePath; mCreateFullPath = createFullPath; mStorageManager = storageManager; @@ -62,7 +59,7 @@ public class CreateFolderOperation extends RemoteOperation implements OnRemoteOp @Override protected RemoteOperationResult run(WebdavClient client) { - CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mFolderName, mRemotePath, mCreateFullPath); + CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mRemotePath, mCreateFullPath); RemoteOperationResult result = operation.execute(client); if (result.isSuccess()) { diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 2ec9f2e2..0bf82075 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1335,7 +1335,7 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa } else { dismissLoadingDialog(); if (result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME) { - Toast.makeText(FileDisplayActivity.this, R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG).show(); + Toast.makeText(FileDisplayActivity.this, R.string.filename_forbidden_characters, Toast.LENGTH_LONG).show(); } else { try { Toast msg = Toast.makeText(FileDisplayActivity.this, R.string.create_dir_fail_msg, Toast.LENGTH_LONG); @@ -1376,7 +1376,7 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa msg.show(); // TODO throw again the new rename dialog } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) { - Toast msg = Toast.makeText(this, R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG); + Toast msg = Toast.makeText(this, R.string.filename_forbidden_characters, Toast.LENGTH_LONG); msg.show(); } else { Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); @@ -1442,7 +1442,7 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa // Create directory path += newDirectoryName + OCFile.PATH_SEPARATOR; - RemoteOperation operation = new CreateFolderOperation(newDirectoryName, path, false, mStorageManager); + RemoteOperation operation = new CreateFolderOperation(path, false, mStorageManager); operation.execute( getAccount(), FileDisplayActivity.this, FileDisplayActivity.this, diff --git a/src/com/owncloud/android/ui/dialog/EditNameDialog.java b/src/com/owncloud/android/ui/dialog/EditNameDialog.java index 4d6243af..862715fd 100644 --- a/src/com/owncloud/android/ui/dialog/EditNameDialog.java +++ b/src/com/owncloud/android/ui/dialog/EditNameDialog.java @@ -27,10 +27,11 @@ import android.view.View; import android.view.WindowManager.LayoutParams; import android.widget.EditText; import android.widget.TextView; +import android.widget.Toast; import com.actionbarsherlock.app.SherlockDialogFragment; import com.owncloud.android.R; - +import com.owncloud.android.oc_framework.utils.FileUtils; /** @@ -129,6 +130,10 @@ public class EditNameDialog extends SherlockDialogFragment implements DialogInte switch (which) { case AlertDialog.BUTTON_POSITIVE: { mNewFilename = ((TextView)(getDialog().findViewById(R.id.user_input))).getText().toString(); + if (!FileUtils.isValidName(mNewFilename)) { + Toast.makeText(getSherlockActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG).show(); + return; + } mResult = true; } case AlertDialog.BUTTON_NEGATIVE: { // fall through diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 66febdf4..ea0f814c 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -817,7 +817,7 @@ public class FileDetailFragment extends FileFragment implements msg.show(); // TODO throw again the new rename dialog } if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) { - Toast msg = Toast.makeText(getActivity(), R.string.create_dir_fail_msg_invalid_characters, Toast.LENGTH_LONG); + Toast msg = Toast.makeText(getActivity(), R.string.filename_forbidden_characters, Toast.LENGTH_LONG); msg.show(); } else { Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG);