@@ -128,7 +128,7 @@ ProjectInfoPage::ProjectInfoPage( QWidget *parent )
128128
129129 this ->project_path_change_button_ = new QPushButton ( " Choose Alternative Location" );
130130 connect ( this ->project_path_change_button_ , SIGNAL ( clicked () ), this , SLOT ( set_path () ) );
131- this ->project_path_change_button_ ->setFocusPolicy ( Qt::NoFocus );
131+ this ->project_path_change_button_ ->setFocusPolicy ( Qt::NoFocus );
132132
133133 this ->registerField ( " projectName" , this ->project_name_lineedit_ );
134134
@@ -161,29 +161,32 @@ void ProjectInfoPage::initializePage()
161161
162162void ProjectInfoPage::set_path ()
163163{
164- // QDir converts the empty QString "" to the current directory
165- this ->warning_message_ ->hide ();
166-
167-
168- QString path_name = QFileDialog::getExistingDirectory ( this ,
169- tr ( " Choose Save Directory..." ), this ->project_path_lineedit_ ->text (),
170- QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks );
171-
172- // getExistingString generates an empty string if canceled or closed.
173- // If either happens, this will exit without changing anything.
174- if (path_name == " " )
164+ // QDir converts the empty QString "" to the current directory
165+ this ->warning_message_ ->hide ();
166+
167+ QString path_name;
168+ QFileDialog *dialog = new QFileDialog ( this , tr ( " Choose Save Directory..." ));
169+ dialog->setAcceptMode (QFileDialog::AcceptOpen);
170+ dialog->setFileMode (QFileDialog::DirectoryOnly);
171+ dialog->setOption (QFileDialog::ShowDirsOnly);
172+ dialog->setOption (QFileDialog::DontResolveSymlinks);
173+
174+ dialog->open ( this , SLOT ( set_name ( const QString& ) ) );
175+ }
176+
177+ void ProjectInfoPage::set_name (const QString& name)
178+ {
179+ if (!name.isEmpty ())
175180 {
176- return ;
177- }
178- QDir project_directory_ = QDir (path_name);
179-
181+ QDir project_directory_ = QDir (name);
182+
180183 if ( project_directory_.exists () )
181- {
182- this ->project_path_lineedit_ ->setText ( project_directory_.canonicalPath () );
184+ {
185+ this ->project_path_lineedit_ ->setText ( project_directory_.canonicalPath () );
183186 this ->most_recent_path_ = &project_directory_;
184- }
185-
186- registerField ( " projectPath " , this -> project_path_lineedit_ );
187+ }
188+ }
189+
187190}
188191
189192bool ProjectInfoPage::validatePage ()
0 commit comments