# HG changeset patch # User Chris Cannam # Date 1300193009 0 # Node ID 3824e8bb91eba0447f368d5c37336cd4fe6a7634 # Parent bb189827f6d1d42365a21c93147e9a15d4eec701 Use ~/Documents or ~/My Documents as default folder path, not ~ diff -r bb189827f6d1 -r 3824e8bb91eb multichoicedialog.cpp --- 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; } diff -r bb189827f6d1 -r 3824e8bb91eb multichoicedialog.h --- a/multichoicedialog.h Tue Mar 15 12:00:31 2011 +0000 +++ b/multichoicedialog.h Tue Mar 15 12:43:29 2011 +0000 @@ -83,6 +83,8 @@ QLabel *m_urlLabel; QComboBox *m_urlCombo; QAbstractButton *m_okButton; + + QString getDefaultPath() const; }; #endif // MULTICHOICEDIALOG_H