void KitchenAlertMainWindow::loadTimer()
{
- QString filename = QFileDialog::getOpenFileName(this,"",defaultSaveDirectory_,tr("KitchenAlert timer files (*.kitchenalert)"));
+
+// If the default save directory does not exist use /home/user instead (as that's what the save dialog will use)
+// This avoids a situation where save directs to a folder that cannot be accessed with open...
+
+ QString startDirectory;
+
+ if (QFile(defaultSaveDirectory_).exists())
+ {
+ startDirectory = defaultSaveDirectory_;
+ }
+ else
+ {
+ startDirectory = "/home/user/";
+ qDebug () << "default save directory not found";
+ }
+
+
+ //Get the filename to open with a dialog
+
+ QString filename = QFileDialog::getOpenFileName(this,"",startDirectory,tr("KitchenAlert timer files (*.kitchenalert)"));
if (!filename.isEmpty())
{
CurrentAlertsTableModel model_; /*! The model that stores the alerts */
- const QString defaultSaveDirectory_;
+ QString defaultSaveDirectory_;
/*!
Returns a QMoldelIndex pointing to the cell in the column 0 of the row that is currently selected.