csv exporting messages fix.
This commit is contained in:
parent
c3345399f4
commit
f7a468fb31
|
@ -12,7 +12,6 @@ void CalendarManager::setCalendar(QString html)
|
||||||
}
|
}
|
||||||
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
|
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
|
||||||
{
|
{
|
||||||
qDebug() << this->caliSchedPtr->getCourses();
|
|
||||||
if (this->caliSchedPtr->getCourses() == NULL)
|
if (this->caliSchedPtr->getCourses() == NULL)
|
||||||
return;
|
return;
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
@ -26,14 +25,17 @@ void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer
|
||||||
{
|
{
|
||||||
msgBox.setIcon(QMessageBox::Information);
|
msgBox.setIcon(QMessageBox::Information);
|
||||||
msgBox.setText(QObject::tr("Exported Successfuly!"));
|
msgBox.setText(QObject::tr("Exported Successfuly!"));
|
||||||
|
msgBox.exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
msgBox.setText(QObject::tr("Dates not valid"));
|
msgBox.setText(QObject::tr("Dates not valid"));
|
||||||
}
|
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,8 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
|
||||||
if ((cal == NULL) || (calSched == NULL)) //pointers checking!
|
if ((cal == NULL) || (calSched == NULL)) //pointers checking!
|
||||||
return false;
|
return false;
|
||||||
if (calSched->getCourses() == NULL)
|
if (calSched->getCourses() == NULL)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
qDebug() << "Getting path for csv file from user...";
|
qDebug() << "Getting path for csv file from user...";
|
||||||
QString filePath = getFileFath();
|
QString filePath = getFileFath();
|
||||||
if (filePath == NULL) //User canceled
|
if (filePath == NULL) //User canceled
|
||||||
|
@ -24,9 +23,13 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
|
||||||
qDebug() << "Atempting to export the Schedule...";
|
qDebug() << "Atempting to export the Schedule...";
|
||||||
|
|
||||||
QFile file(filePath);
|
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;
|
return false;
|
||||||
}//else
|
}//else
|
||||||
//Delete the file
|
//Delete the file
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "../Calendar/calendarSchedule.h"
|
#include "../Calendar/calendarSchedule.h"
|
||||||
#include "../Calendar/calendardialog.h"
|
#include "../Calendar/calendardialog.h"
|
||||||
|
|
Loading…
Reference in a new issue