+
KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::KitchenAlertMainWindow)
{
-
- defaultSaveDirectory_ = "/home/user/MyDocs/KitchenAlert/";
+
+ defaultSaveDirectory_ = "/home/user/KitchenAlert";
ui->setupUi(this);
if (QMessageBox::question(this,tr("Confirm timer removal"),text,QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
model_.removeTimer(row);
+ ui->ComingAlertsTableView->clearSelection();
+ disableSelectionDependentButtons();
+
}
}
- ui->SnoozeButton->setDisabled(true);
+
}
void KitchenAlertMainWindow::saveTimer()
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())
{