- /// State recovery - CURRENT DIRECTORY ; priority: 1/ getIntent(), 2/ savedInstanceState (in onCreate()), 3/ root dir\r
- if(getIntent().hasExtra(FileDetailFragment.EXTRA_FILE)) {\r
- mCurrentDir = (OCFile) getIntent().getParcelableExtra(FileDetailFragment.EXTRA_FILE);\r
- if(mCurrentDir != null && !mCurrentDir.isDirectory()){\r
- mCurrentDir = mStorageManager.getFileById(mCurrentDir.getParentId());\r
- }\r
- // clear intent extra, so rotating the screen will not return us to this directory\r
- getIntent().removeExtra(FileDetailFragment.EXTRA_FILE);\r
+ /// Check if mCurrentDir is a directory\r
+ if(mCurrentDir != null && !mCurrentDir.isDirectory()) {\r
+ mCurrentFile = mCurrentDir;\r
+ mCurrentDir = mStorageManager.getFileById(mCurrentDir.getParentId());\r
+ }\r
+ \r
+ /// Check if mCurrentDir and mCurrentFile are in the current account, and update them\r
+ if (mCurrentDir != null) {\r
+ mCurrentDir = mStorageManager.getFileByPath(mCurrentDir.getRemotePath()); // mCurrentDir == null if it is not in the current account\r
+ }\r
+ if (mCurrentFile != null) {\r
+ if (mCurrentFile.fileExists()) {\r
+ mCurrentFile = mStorageManager.getFileByPath(mCurrentFile.getRemotePath()); // mCurrentFile == null if it is not in the current account\r
+ } // else : keep mCurrentFile with the received value; this is currently the case of an upload in progress, when the user presses the status notification in a landscape tablet\r
+ }\r
+ \r
+ /// Default to root if mCurrentDir was not found\r
+ if (mCurrentDir == null) {\r
+ mCurrentDir = mStorageManager.getFileByPath("/"); // will be NULL if the database was never synchronized\r