NbtPreferences->RemovePage(1);
btnAccountAdd->Show(false);
+ NbtPreferences->ChangeSelection(0);
}
if (!accountDirFull.IsEmpty()){
- accountDirDelFull.Append(wxString::FromUTF8(getenv("HOME")));
- accountDirDelFull.Append(wxT("/.xestiacal/accounts/"));
- accountDirDelFull.Append(accountDirFull);
+ accountDirDelFull.Append(GetAccountDir(accountDirFull, false));
- wxRmDir(accountDirDelFull);
+ DeleteDirectory(accountDirDelFull);
}
reloadAccountConfig = reloadAccountInc;
-}
\ No newline at end of file
+}
+
+void frmPreferences::DeleteDirectory(wxString directoryPath)
+{
+
+ // Open the directory and look for files and directories
+ // to delete.
+
+ wxDir directoryHandle(directoryPath);
+
+ if (!directoryHandle.IsOpened())
+ {
+ return;
+ }
+
+ wxString directoryFilename;
+
+ bool continueProcessing = directoryHandle.GetFirst(&directoryFilename, wxEmptyString, wxDIR_FILES|wxDIR_DIRS|wxDIR_HIDDEN);
+ while (continueProcessing)
+ {
+ wxString directoryFilenameFull = directoryPath + "/" + directoryFilename;
+ if (wxDir::Exists(directoryFilenameFull))
+ {
+ DeleteDirectory(directoryFilenameFull);
+ continueProcessing = directoryHandle.GetNext(&directoryFilename);
+ continue;
+ }
+ wxRemoveFile(directoryFilenameFull);
+ continueProcessing = directoryHandle.GetNext(&directoryFilename);
+ }
+ directoryHandle.Close();
+
+ wxRmDir(directoryPath);
+}