Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnFrameController.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4 by maloninc, Thu Oct 6 05:29:01 2005 UTC revision 1.5 by maloninc, Fri Oct 7 10:19:46 2005 UTC
# Line 112  void mnFrameController::handleAddDir(wxC Line 112  void mnFrameController::handleAddDir(wxC
112          dlg = new wxDirDialog(frame);          dlg = new wxDirDialog(frame);
113          if(dlg->ShowModal() == wxID_OK) {          if(dlg->ShowModal() == wxID_OK) {
114                  gotDirName = dlg->GetPath();                  gotDirName = dlg->GetPath();
115                  frame->addNotePanel(&gotDirName);                  if(isExistConfig(&gotDirName) == false){
116                            frame->addNotePanel(&gotDirName);
117                    }
118                    else {
119                            wxMessageBox(wxT("It already exist in MalonNote"), wxT("Already exist"), wxOK|wxICON_INFORMATION);
120                            return;
121                    }
122          }          }
123          updateConfig();          updateConfig();
124  }  }
# Line 147  void mnFrameController::updateConfig() Line 153  void mnFrameController::updateConfig()
153          }          }
154          delete config;          delete config;
155  }  }
156    
157    bool mnFrameController::isExistConfig(wxString* dir)
158    {
159            wxString* dirName = new wxString();
160            wxString gotDirName;
161            wxDirDialog* dlg;
162            wxString confKey;
163    
164            wxConfig* config = new wxConfig(wxT(CONF_APP_NAME));
165            for(int i = 0; ;i++) {
166                    if(i == 0) {
167                            confKey.sprintf(wxT(CONF_WIKI_DIR));
168                    }
169                    else {
170                            confKey.sprintf(wxT(CONF_WIKI_DIR) "%d", i);
171                    }
172                    if(config->Read(confKey.c_str(), dirName)) {
173                            if(*dir == *dirName) return true;    /* Exist */
174                    }
175                    else {
176                            break;
177                    }
178            }
179            
180            delete dirName;
181            delete config;
182    
183            return false;
184    }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26