diff --git a/main/CalendarTab/CalendarManager.h b/main/CalendarTab/CalendarManager.h index 766fff3..98ba20a 100644 --- a/main/CalendarTab/CalendarManager.h +++ b/main/CalendarTab/CalendarManager.h @@ -4,7 +4,7 @@ #include "./src/jceData/Calendar/calendarPage.h" #include "./src/jceData/Calendar/calendarSchedule.h" #include "./src/jceData/CSV/csv_exporter.h" -#include "./src/jceData/Calendar/calendardialog.h" +#include "./src/jceData/Calendar/calendarDialog.h" #include #include diff --git a/src/appDatabase/savedata.h b/src/appDatabase/savedata.h index f387282..2c94119 100644 --- a/src/appDatabase/savedata.h +++ b/src/appDatabase/savedata.h @@ -5,22 +5,20 @@ * SaveData Class * -------------------------------------- * - * all functions in this class are static! - * no need to create an object! - * - * provides all the needed functions - * for saving user data for JCE login. + * Uses QMap * - * the class will enteract with a file formated by tags for storing the valus. - * the file format is as sutch: - * - * [status]Status Value[/] - * [username]usernaem vale[/] - * [password]hashed(not really) password vale[/] + * key : vale * - * the class will create a file if not exists by calling Save Data::init() function. + * Keys: + * "username" + * "password" + * "local" + * "calendar" + * + * Note that the password will be encrypted using the SimpleCrypt class! + * + * SimpleCrypt class was found at the qt projects forms - and been fixed by Sagi Dayan. * - * for more info about functions - see implantation */ /* QT libs */ @@ -31,7 +29,7 @@ #include #include "simplecrypt.h" -#define FILE_NAME "JAC_DB.dat" +#define FILE_NAME "JM.dat" class SaveData { diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index 5f2963d..375321d 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -69,8 +69,20 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca QString room = coursePtr->getRoom(); QDate currentDate = cal->getStartDate(); // currentDate will iterate throuh the semester + int firstDayOfSemester = currentDate.dayOfWeek(); //Returns the weekday (1 = Monday to 7 = Sunday) for this date. - currentDate = currentDate.addDays(day-1); //selecting the REAL starting day of that course + changeDayNumberFromQtToNormal(&firstDayOfSemester); //Get sync with our day numbers. + + /* + * these 6 lines will get the right day for the starting poin in a + * semester for eatch course. + */ + if(day > firstDayOfSemester) + currentDate = currentDate.addDays(day-firstDayOfSemester); //add the gap + else if(day < firstDayOfSemester) + currentDate = currentDate.addDays(6); //move a week nius one day + else// == + currentDate = currentDate; //just for clearaty /* * secondary loop - We have course info and starting day. @@ -180,3 +192,31 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM return CSV_line; } + +void CSV_Exporter::changeDayNumberFromQtToNormal(int *QtDay) +{ + switch(*QtDay){ + case 7: + *QtDay = SUNDAY; + break; + case 1: + *QtDay = MONDAY; + break; + case 2: + *QtDay = TUESDAY; + break; + case 3: + *QtDay = WENDSDAY; + break; + case 4: + *QtDay = THURSDAY; + break; + case 5: + *QtDay = FRIDAY; + break; + default: + *QtDay = 7; + break; + } + return; //Done. +} diff --git a/src/jceData/CSV/csv_exporter.h b/src/jceData/CSV/csv_exporter.h index d17246d..99218b7 100644 --- a/src/jceData/CSV/csv_exporter.h +++ b/src/jceData/CSV/csv_exporter.h @@ -9,7 +9,7 @@ #include #include "../Calendar/calendarSchedule.h" -#include "../Calendar/calendardialog.h" +#include "../Calendar/calendarDialog.h" #define CSV_CALENDAR_HEADER "Subject,Start Date,Start Time,End Date,End Time,Description,Location" @@ -24,6 +24,8 @@ public: private: static QString getFileFath(); static QString makeLine(QString name,QDate *date,int startH,int startM,int endH,int endM,QString lecturer,QString room,QString type); + static void changeDayNumberFromQtToNormal(int *); + enum DAYS{SUNDAY=1, MONDAY=2, TUESDAY=3, WENDSDAY=4, THURSDAY=5, FRIDAY=6}; }; #endif // CSV_EXPORTER_H diff --git a/src/jceData/Calendar/calendardialog.cpp b/src/jceData/Calendar/calendarDialog.cpp similarity index 94% rename from src/jceData/Calendar/calendardialog.cpp rename to src/jceData/Calendar/calendarDialog.cpp index fb17d3a..3d8eb2e 100644 --- a/src/jceData/Calendar/calendardialog.cpp +++ b/src/jceData/Calendar/calendarDialog.cpp @@ -1,5 +1,5 @@ #include "calendarDialog.h" -#include "ui_calenDardialog.h" +#include "ui_calendardialog.h" CalendarDialog::CalendarDialog(QWidget *parent) : diff --git a/src/jceData/Calendar/calendardialog.h b/src/jceData/Calendar/calendarDialog.h similarity index 100% rename from src/jceData/Calendar/calendardialog.h rename to src/jceData/Calendar/calendarDialog.h diff --git a/src/jceData/Calendar/calendardialog.ui b/src/jceData/Calendar/calendarDialog.ui similarity index 100% rename from src/jceData/Calendar/calendardialog.ui rename to src/jceData/Calendar/calendarDialog.ui