Revert "Changed the default save directory"
[kitchenalert] / src / kitchenalertmainwindow.cpp
index 33ae87a..f5fbfa5 100644 (file)
 
 
 
+
 KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::KitchenAlertMainWindow)
     {
-
-  defaultSaveDirectory_ = "/home/user/MyDocs/KitchenAlert/";
+      
+  defaultSaveDirectory_ = "/home/user/KitchenAlert";    
 
   ui->setupUi(this);
 
@@ -388,9 +389,12 @@ void KitchenAlertMainWindow::remove()
         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()
@@ -454,7 +458,26 @@ 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())
     {