Mercurial > hg > easyhg
diff 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 |
line wrap: on
line diff
--- a/multichoicedialog.cpp Tue Mar 15 12:00:31 2011 +0000 +++ b/multichoicedialog.cpp Tue Mar 15 12:43:29 2011 +0000 @@ -165,17 +165,31 @@ } } +QString +MultiChoiceDialog::getDefaultPath() const +{ + QDir home(QDir::home()); + QDir dflt; + + dflt = QDir(home.filePath(tr("My Documents"))); + DEBUG << "testing " << dflt << endl; + if (dflt.exists()) return dflt.canonicalPath(); + + dflt = QDir(home.filePath(tr("Documents"))); + DEBUG << "testing " << dflt << endl; + if (dflt.exists()) return dflt.canonicalPath(); + + DEBUG << "all failed, returning " << home << endl; + return home.canonicalPath(); +} + void MultiChoiceDialog::browse() { QString origin = getArgument(); if (origin == "") { -#ifdef Q_OS_WIN32 - origin = "c:"; -#else - origin = QDir::homePath(); -#endif + origin = getDefaultPath(); } QString path = origin; @@ -319,7 +333,7 @@ m_fileLabel->setText(tr("&Folder:")); m_fileLabel->show(); m_fileCombo->show(); - m_fileCombo->lineEdit()->setText(QDir::homePath()); + m_fileCombo->lineEdit()->setText(getDefaultPath()); m_browseButton->show(); break; }