ReceiveExternalFiles:

- fix no upload possible after creation new folder
- obey canWrite permission for folder creation

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-03-21 15:04:39 +01:00
parent dbad1aa991
commit f99c7f2ddd
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 20 additions and 18 deletions

View file

@ -118,6 +118,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
newDir.setRemoteId(createdRemoteFolder.getRemoteId());
newDir.setModificationTimestamp(System.currentTimeMillis());
newDir.setEncrypted(FileStorageUtils.checkEncryptionStatus(newDir, getStorageManager()));
newDir.setPermissions(createdRemoteFolder.getPermissions());
getStorageManager().saveFile(newDir);
Log_OC.d(TAG, "Create directory " + mRemotePath + " in Database");

View file

@ -59,12 +59,24 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.PreferenceManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.nextcloud.client.preferences.PreferenceManager;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -104,20 +116,6 @@ import java.util.List;
import java.util.Stack;
import java.util.Vector;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
/**
* This can be used to upload things to an ownCloud instance.
*/
@ -1064,8 +1062,11 @@ public class ReceiveExternalFilesActivity extends FileActivity
}
// tint search event
final MenuItem item = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
final MenuItem searchMenuItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
MenuItem newFolderMenuItem = menu.findItem(R.id.action_create_dir);
newFolderMenuItem.setEnabled(mFile.canWrite());
// hacky as no default way is provided
int fontColor = ThemeUtils.fontColor(this);