Testing the Bug #10

This commit is contained in:
Sagi Dayan 2014-09-14 15:01:27 +03:00
parent 3ba347bcf8
commit 582a959fb3
3 changed files with 8 additions and 11 deletions

View file

@ -10,14 +10,14 @@ void CalendarManager::setCalendar(std::string html)
{ {
caliSchedPtr->setPage(html); caliSchedPtr->setPage(html);
} }
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug bool CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
{ {
// if (caliSchedPtr->getCourses()->empty()) if (this->caliSchedPtr->getCourses()->empty())
// return; return false;
QMessageBox msgBox; QMessageBox msgBox;
int buttonClicked = caliDialog->exec(); int buttonClicked = caliDialog->exec();
if (buttonClicked == 0) //cancel? if (buttonClicked == 0) //cancel?
return; return false;
//calDialog.getStartDate(),calDialog.getEndDate() //calDialog.getStartDate(),calDialog.getEndDate()
if(caliDialog->ok()) if(caliDialog->ok())
{ {
@ -26,6 +26,7 @@ void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer
msgBox.setIcon(QMessageBox::Information); msgBox.setIcon(QMessageBox::Information);
msgBox.setText(QObject::tr("Exported Successfuly!")); msgBox.setText(QObject::tr("Exported Successfuly!"));
msgBox.exec(); msgBox.exec();
return true;
}else }else
{ {
msgBox.setIcon(QMessageBox::Critical); msgBox.setIcon(QMessageBox::Critical);
@ -39,6 +40,7 @@ void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer
msgBox.setText(QObject::tr("Dates not valid")); msgBox.setText(QObject::tr("Dates not valid"));
msgBox.exec(); msgBox.exec();
} }
return false;
} }

View file

@ -17,7 +17,7 @@ public:
delete caliSchedPtr; delete caliSchedPtr;
delete caliDialog; delete caliDialog;
} }
void exportCalendarCSV(); bool exportCalendarCSV();
void setCalendar(std::string html); void setCalendar(std::string html);
void resetTable() { if (caliSchedPtr != NULL) caliSchedPtr->clearTableItems(); } void resetTable() { if (caliSchedPtr != NULL) caliSchedPtr->clearTableItems(); }

View file

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