diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp index e141332..8a9d4e5 100644 --- a/main/CalendarTab/CalendarManager.cpp +++ b/main/CalendarTab/CalendarManager.cpp @@ -12,7 +12,6 @@ void CalendarManager::setCalendar(QString html) } void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug { - qDebug() << this->caliSchedPtr->getCourses(); if (this->caliSchedPtr->getCourses() == NULL) return; QMessageBox msgBox; @@ -26,14 +25,17 @@ void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer { msgBox.setIcon(QMessageBox::Information); msgBox.setText(QObject::tr("Exported Successfuly!")); + msgBox.exec(); + } } else { msgBox.setIcon(QMessageBox::Critical); msgBox.setText(QObject::tr("Dates not valid")); + msgBox.exec(); } - msgBox.exec(); + } diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index 385949a..df7ef39 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -10,9 +10,8 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca if ((cal == NULL) || (calSched == NULL)) //pointers checking! return false; if (calSched->getCourses() == NULL) - { return false; - } + qDebug() << "Getting path for csv file from user..."; QString filePath = getFileFath(); if (filePath == NULL) //User canceled @@ -24,9 +23,13 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca qDebug() << "Atempting to export the Schedule..."; QFile file(filePath); - if (!file.open(QIODevice::ReadWrite | QIODevice::Text |QIODevice::Truncate)) + if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) { - qDebug() << "unable to open/create the file... maybe permissions error."; + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Critical); + msgBox.setText(QObject::tr("Unable to open or create the file.\nExporting Failed")); + msgBox.exec(); + qWarning() << "unable to open/create the file... maybe permissions error."; return false; }//else //Delete the file diff --git a/src/jceData/CSV/csv_exporter.h b/src/jceData/CSV/csv_exporter.h index 4cea49b..d17246d 100644 --- a/src/jceData/CSV/csv_exporter.h +++ b/src/jceData/CSV/csv_exporter.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "../Calendar/calendarSchedule.h" #include "../Calendar/calendardialog.h"