2014-09-08 15:54:52 +00:00
|
|
|
#include "CalendarManager.h"
|
|
|
|
|
2014-10-08 04:14:50 +00:00
|
|
|
CalendarManager::CalendarManager(QWidget *parent, QGridLayout *ptr) : QWidget(parent)
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
2014-10-08 04:14:50 +00:00
|
|
|
caliSchedPtr = new calendarSchedule(this);
|
|
|
|
examSchePtr = new calendarExam();
|
2014-09-22 22:17:05 +00:00
|
|
|
ptr->addWidget(caliSchedPtr);
|
2014-10-08 04:14:50 +00:00
|
|
|
caliDialog = new CalendarDialog(this);
|
|
|
|
examDialogPtr = new examDialog(this,examSchePtr);
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
|
2014-09-17 01:08:38 +00:00
|
|
|
void CalendarManager::setCalendar(QString html)
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
|
|
|
caliSchedPtr->setPage(html);
|
2014-10-08 04:14:50 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CalendarManager::setExamsSchedule(QString html)
|
|
|
|
{
|
|
|
|
examSchePtr->setPage(html);
|
|
|
|
examDialogPtr->initializingDataIntoTable();
|
2014-10-12 02:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CalendarManager::showExamDialog()
|
|
|
|
{
|
2014-10-08 04:14:50 +00:00
|
|
|
examDialogPtr->show();
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
2014-10-10 17:36:00 +00:00
|
|
|
void CalendarManager::exportCalendarCSV()
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
2014-10-10 17:36:00 +00:00
|
|
|
if (this->caliSchedPtr->getCourses().isEmpty())
|
2014-09-17 02:47:12 +00:00
|
|
|
return;
|
2014-09-11 12:48:23 +00:00
|
|
|
QMessageBox msgBox;
|
|
|
|
int buttonClicked = caliDialog->exec();
|
|
|
|
if (buttonClicked == 0) //cancel?
|
2014-09-17 02:47:12 +00:00
|
|
|
return;
|
2014-09-11 12:48:23 +00:00
|
|
|
//calDialog.getStartDate(),calDialog.getEndDate()
|
2014-09-17 02:47:12 +00:00
|
|
|
if (caliDialog->ok())
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
2014-10-13 15:22:31 +00:00
|
|
|
if (CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog, examSchePtr))
|
2014-09-11 12:48:23 +00:00
|
|
|
{
|
|
|
|
msgBox.setIcon(QMessageBox::Information);
|
|
|
|
msgBox.setText(QObject::tr("Exported Successfuly!"));
|
2014-09-17 02:55:28 +00:00
|
|
|
msgBox.exec();
|
|
|
|
|
2014-09-11 12:48:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
|
|
|
msgBox.setIcon(QMessageBox::Critical);
|
2014-09-17 02:47:12 +00:00
|
|
|
msgBox.setText(QObject::tr("Dates not valid"));
|
2014-09-17 02:55:28 +00:00
|
|
|
msgBox.exec();
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
2014-09-17 02:55:28 +00:00
|
|
|
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|