comparison multichoicedialog.cpp @ 342:3824e8bb91eb

Use ~/Documents or ~/My Documents as default folder path, not ~
author Chris Cannam
date Tue, 15 Mar 2011 12:43:29 +0000
parents 8fd71f570884
children
comparison
equal deleted inserted replaced
340:bb189827f6d1 342:3824e8bb91eb
163 m_currentChoice = id; 163 m_currentChoice = id;
164 choiceChanged(); 164 choiceChanged();
165 } 165 }
166 } 166 }
167 167
168 QString
169 MultiChoiceDialog::getDefaultPath() const
170 {
171 QDir home(QDir::home());
172 QDir dflt;
173
174 dflt = QDir(home.filePath(tr("My Documents")));
175 DEBUG << "testing " << dflt << endl;
176 if (dflt.exists()) return dflt.canonicalPath();
177
178 dflt = QDir(home.filePath(tr("Documents")));
179 DEBUG << "testing " << dflt << endl;
180 if (dflt.exists()) return dflt.canonicalPath();
181
182 DEBUG << "all failed, returning " << home << endl;
183 return home.canonicalPath();
184 }
185
168 void 186 void
169 MultiChoiceDialog::browse() 187 MultiChoiceDialog::browse()
170 { 188 {
171 QString origin = getArgument(); 189 QString origin = getArgument();
172 190
173 if (origin == "") { 191 if (origin == "") {
174 #ifdef Q_OS_WIN32 192 origin = getDefaultPath();
175 origin = "c:";
176 #else
177 origin = QDir::homePath();
178 #endif
179 } 193 }
180 194
181 QString path = origin; 195 QString path = origin;
182 196
183 if (m_argTypes[m_currentChoice] == DirectoryArg || 197 if (m_argTypes[m_currentChoice] == DirectoryArg ||
317 m_urlCombo->show(); 331 m_urlCombo->show();
318 m_urlCombo->addItems(rf->getRecent()); 332 m_urlCombo->addItems(rf->getRecent());
319 m_fileLabel->setText(tr("&Folder:")); 333 m_fileLabel->setText(tr("&Folder:"));
320 m_fileLabel->show(); 334 m_fileLabel->show();
321 m_fileCombo->show(); 335 m_fileCombo->show();
322 m_fileCombo->lineEdit()->setText(QDir::homePath()); 336 m_fileCombo->lineEdit()->setText(getDefaultPath());
323 m_browseButton->show(); 337 m_browseButton->show();
324 break; 338 break;
325 } 339 }
326 340
327 updateOkButton(); 341 updateOkButton();