jce-manager/main/CalendarTab/CalendarManager.cpp

47 lines
1.2 KiB
C++
Raw Normal View History

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