Need testing on mac and Windows

This commit is contained in:
Sagi Dayan 2014-09-08 20:59:02 +03:00
parent 431b71bebc
commit df791d62b4

View file

@ -18,12 +18,12 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched)
qDebug() << "Atempting to export the Schedule..."; qDebug() << "Atempting to export the Schedule...";
QFile file(filePath); QFile file(filePath);
if(!file.open(QIODevice::ReadWrite | QIODevice::Text)) if(!file.open(QIODevice::ReadWrite | QIODevice::Text |QIODevice::Truncate))
{ {
qDebug() << "unable to open/create the file... maybe permissions error."; qDebug() << "unable to open/create the file... maybe permissions error.";
return false; return false;
}//else }//else
//Delete the file
QTextStream out(&file); QTextStream out(&file);
out << CSV_CALENDAR_HEADER << "\n"; out << CSV_CALENDAR_HEADER << "\n";
for (calendarCourse *coursePtr: *(calSched->getCourses())) for (calendarCourse *coursePtr: *(calSched->getCourses()))
@ -50,7 +50,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched)
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if(line != NULL) if(line != NULL)
out << line << char(0x0D); out << line << char(0x0D) << char(0x0A);
#endif #endif
} }