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
This commit is contained in:
Sagi Dayan 2014-09-12 12:11:28 +03:00
parent 3287bfe31b
commit 99aa0ed909
3 changed files with 14 additions and 3 deletions

View file

@ -12,8 +12,8 @@ void CalendarManager::setCalendar(std::string html)
}
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
{
if (caliSchedPtr->getCourses() == NULL)
return;
// if (caliSchedPtr->getCourses()->empty())
// return;
QMessageBox msgBox;
int buttonClicked = caliDialog->exec();
if (buttonClicked == 0) //cancel?

View file

@ -49,6 +49,9 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
//Local Check and ui setting.
checkLocale();
//calendar bug fix
calendarLoaded = false;
}
MainScreen::~MainScreen()
@ -264,6 +267,7 @@ void MainScreen::on_getCalendarBtn_clicked()
//ui->plainTextEdit->setPlainText(loginHandel->getCurrentPageContect());
calendar->resetTable();
calendar->setCalendar(loginHandel->getCurrentPageContect().toStdString());
calendarLoaded = true;
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
@ -276,7 +280,12 @@ void MainScreen::on_exportToCVSBtn_clicked()
{
if (loginHandel->isLoggedInFlag())
{
this->calendar->exportCalendarCSV();
if(calendarLoaded)
this->calendar->exportCalendarCSV();
else
{
QMessageBox::critical(this,tr("Error"),"No Calendar was loaded."); //Need Translation
}
}
}

View file

@ -86,6 +86,8 @@ private:
coursesTableManager *courseTableMgr;
loginHandler *loginHandel;
bool calendarLoaded;
};
#endif // MAINSCREEN_H