diff --git a/lib/rdcut_dialog.cpp b/lib/rdcut_dialog.cpp index 27e57a9d..39527ae9 100644 --- a/lib/rdcut_dialog.cpp +++ b/lib/rdcut_dialog.cpp @@ -35,6 +35,8 @@ #include #include #include +#include + // // Icons @@ -641,14 +643,29 @@ void RDCutDialog::BuildGroupList() } } +QString RDCutDialog::StateFile() { + bool home_found = false; + QString home = RDGetHomeDir(&home_found); + if (home_found) { + return QString().sprintf("%s/.rdcartdialog",(const char *)home); + } else { + return NULL; + } +} void RDCutDialog::LoadState() { - if(getenv("HOME")==NULL) { + QString state_file = StateFile(); + if (state_file == NULL) { return; } + RDProfile *p=new RDProfile(); - p->setSource(QString().sprintf("%s/.rdcartdialog",getenv("HOME"))); + p->setSource(state_file); + + bool value_read = false; + cart_limit_box->setChecked(p->boolValue("RDCartDialog", "LimitSearch", true, &value_read)); + delete p; } @@ -657,11 +674,12 @@ void RDCutDialog::SaveState() { FILE *f=NULL; - if(getenv("HOME")==NULL) { + QString state_file = StateFile(); + if (state_file == NULL) { return; } - if((f=fopen(QString().sprintf("%s/.rdcartdialog",getenv("HOME")),"w"))== - NULL) { + + if((f=fopen(state_file,"w"))==NULL) { return; } fprintf(f,"[RDCartDialog]\n"); diff --git a/lib/rdcut_dialog.h b/lib/rdcut_dialog.h index d909cff9..5bb2803f 100644 --- a/lib/rdcut_dialog.h +++ b/lib/rdcut_dialog.h @@ -74,6 +74,7 @@ class RDCutDialog : public QDialog void RefreshCuts(); void SelectCut(QString cutname); void BuildGroupList(); + QString StateFile(); void LoadState(); void SaveState(); RDListView *cut_cart_list;