2014-09-08 15:54:52 +00:00
|
|
|
#include "CalendarManager.h"
|
|
|
|
|
|
|
|
CalendarManager::CalendarManager(calendarSchedule *ptr)
|
|
|
|
{
|
|
|
|
this->caliSchedPtr = ptr;
|
2014-09-11 12:48:23 +00:00
|
|
|
caliDialog = new CalendarDialog();
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CalendarManager::setCalendar(std::string html)
|
|
|
|
{
|
|
|
|
caliSchedPtr->setPage(html);
|
|
|
|
}
|
2014-09-11 20:08:37 +00:00
|
|
|
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
2014-09-12 09:11:28 +00:00
|
|
|
// if (caliSchedPtr->getCourses()->empty())
|
|
|
|
// return;
|
2014-09-11 12:48:23 +00:00
|
|
|
QMessageBox msgBox;
|
|
|
|
int buttonClicked = caliDialog->exec();
|
|
|
|
if (buttonClicked == 0) //cancel?
|
|
|
|
return;
|
|
|
|
//calDialog.getStartDate(),calDialog.getEndDate()
|
|
|
|
if(caliDialog->ok())
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
2014-09-11 12:48:23 +00:00
|
|
|
if(CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog))
|
|
|
|
{
|
|
|
|
msgBox.setIcon(QMessageBox::Information);
|
|
|
|
msgBox.setText(QObject::tr("Exported Successfuly!"));
|
|
|
|
msgBox.exec();
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2014-09-11 19:58:08 +00:00
|
|
|
msgBox.setText(QObject::tr("Error on exporting."));
|
2014-09-11 12:48:23 +00:00
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2014-09-11 12:48:23 +00:00
|
|
|
msgBox.setText(QObject::tr("Dates not valid"));
|
2014-09-08 15:54:52 +00:00
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|