Sagi Dayan
99aa0ed909
Added a bool flag to main. calendarLoaded. @liranbg - you method did not work (at least on linux)... now user will be prompted with an error message dialog. No Crash. Closing bug #10
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#include "CalendarManager.h"
|
|
|
|
CalendarManager::CalendarManager(calendarSchedule *ptr)
|
|
{
|
|
this->caliSchedPtr = ptr;
|
|
caliDialog = new CalendarDialog();
|
|
}
|
|
|
|
void CalendarManager::setCalendar(std::string html)
|
|
{
|
|
caliSchedPtr->setPage(html);
|
|
}
|
|
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
|
|
{
|
|
// if (caliSchedPtr->getCourses()->empty())
|
|
// return;
|
|
QMessageBox msgBox;
|
|
int buttonClicked = caliDialog->exec();
|
|
if (buttonClicked == 0) //cancel?
|
|
return;
|
|
//calDialog.getStartDate(),calDialog.getEndDate()
|
|
if(caliDialog->ok())
|
|
{
|
|
if(CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog))
|
|
{
|
|
msgBox.setIcon(QMessageBox::Information);
|
|
msgBox.setText(QObject::tr("Exported Successfuly!"));
|
|
msgBox.exec();
|
|
}else
|
|
{
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
msgBox.setText(QObject::tr("Error on exporting."));
|
|
msgBox.exec();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
msgBox.setIcon(QMessageBox::Critical);
|
|
msgBox.setText(QObject::tr("Dates not valid"));
|
|
msgBox.exec();
|
|
}
|
|
}
|
|
|
|
|