import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.Log_OC;
 
     private static final String TAG = "OwnCloudPreferences";
     private DbHandler mDbHandler;
     private CheckBoxPreference pCode;
+    private CheckBoxPreference pSaveLocation;
     //private CheckBoxPreference pLogging;
     //private Preference pLoggingHistory;
     private Preference pAboutApp;
             });            
             
         }
-        
-        
+
+        pSaveLocation = (CheckBoxPreferenceWithLongTitle) findPreference("save_last_upload_location");
+        if(pSaveLocation != null){
+            pSaveLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+                @Override
+                public boolean onPreferenceChange(Preference preference, Object newValue) {
+                        if( newValue instanceof Boolean)
+                        {
+                           if(!(Boolean) newValue)
+                           {
+                               SharedPreferences.Editor appPrefs = PreferenceManager
+                                       .getDefaultSharedPreferences(getApplicationContext()).edit();
+                               appPrefs.remove("last_upload_path");
+                               appPrefs.commit();
+                           }
+                        }
+                        return true;
+                    }
+            });
+        }
 
         PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("more");