-
- /* DISABLED FOR RELEASE UNTIL FIXED
- pLogging = (CheckBoxPreference) findPreference("log_to_file");
- if (pLogging != null) {
- pLogging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
-
- String logpath = Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log";
-
- if(!pLogging.isChecked()) {
- Log_OC.d("Debug", "start logging");
- Log_OC.v("PATH", logpath);
- Log_OC.startLogging(logpath);
- }
- else {
- Log_OC.d("Debug", "stop logging");
- Log_OC.stopLogging();
- }
- return true;
- }
- });
- }
-
- pLoggingHistory = (Preference) findPreference("log_history");
- if (pLoggingHistory != null) {
- pLoggingHistory.setOnPreferenceClickListener(new OnPreferenceClickListener() {
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent intent = new Intent(getApplicationContext(),LogHistoryActivity.class);
- startActivity(intent);
- return true;
+ }
+
+ @Override
+ protected void onPause() {
+ saveInstantUploadPathOnPreferences();
+ super.onPause();
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+
+ // Filter for only showing contextual menu when long press on the
+ // accounts
+ if (mShowContextMenu) {
+ getMenuInflater().inflate(R.menu.account_picker_long_click, menu);
+ mShowContextMenu = false;
+ }
+ super.onCreateContextMenu(menu, v, menuInfo);
+ }
+
+ /**
+ * Called when the user clicked on an item into the context menu created at
+ * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} for
+ * every ownCloud {@link Account} , containing 'secondary actions' for them.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onContextItemSelected(android.view.MenuItem item) {
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
+ Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
+ for (Account a : accounts) {
+ if (a.name.equals(mAccountName)) {
+ if (item.getItemId() == R.id.change_password) {
+
+ // Change account password
+ Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a);
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
+ AuthenticatorActivity.ACTION_UPDATE_TOKEN);
+ startActivity(updateAccountCredentials);
+
+ } else if (item.getItemId() == R.id.delete_account) {
+
+ // Remove account
+ am.removeAccount(a, this, mHandler);
+ }