2014-06-18 23:44:46 +00:00
|
|
|
#ifndef SAVEDATA_H
|
|
|
|
#define SAVEDATA_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SaveData Class
|
|
|
|
* --------------------------------------
|
|
|
|
*
|
2014-09-22 18:54:16 +00:00
|
|
|
* Uses QMap
|
2014-06-18 23:44:46 +00:00
|
|
|
*
|
2014-09-22 18:54:16 +00:00
|
|
|
* key : vale
|
|
|
|
*
|
|
|
|
* Keys:
|
|
|
|
* "username"
|
|
|
|
* "password"
|
2014-10-13 23:45:11 +00:00
|
|
|
* "locale"
|
2014-09-22 18:54:16 +00:00
|
|
|
* "calendar"
|
|
|
|
*
|
|
|
|
* Note that the password will be encrypted using the SimpleCrypt class!
|
2014-06-18 23:44:46 +00:00
|
|
|
*
|
2014-09-22 18:54:16 +00:00
|
|
|
* SimpleCrypt class was found at the qt projects forms - and been fixed by Sagi Dayan.
|
2014-06-18 23:44:46 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* QT libs */
|
|
|
|
#include <QString>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
2014-08-31 18:39:43 +00:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QMap>
|
2014-09-07 20:44:27 +00:00
|
|
|
#include "simplecrypt.h"
|
2014-06-18 23:44:46 +00:00
|
|
|
|
2014-09-22 18:54:16 +00:00
|
|
|
#define FILE_NAME "JM.dat"
|
2014-06-18 23:44:46 +00:00
|
|
|
|
|
|
|
class SaveData
|
|
|
|
{
|
|
|
|
public:
|
2014-08-31 21:27:15 +00:00
|
|
|
SaveData();
|
|
|
|
bool isSaved();
|
|
|
|
void reset();
|
|
|
|
void setUsername(QString username);
|
|
|
|
void setPassword(QString password);
|
|
|
|
void setCal(QString cal);
|
2014-10-13 23:45:11 +00:00
|
|
|
void setLocale(QString locale);
|
2014-08-31 21:27:15 +00:00
|
|
|
QString getUsername();
|
|
|
|
QString getPassword();
|
|
|
|
QString getCal();
|
2014-10-13 23:45:11 +00:00
|
|
|
QString getLocale();
|
2014-08-31 18:39:43 +00:00
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
private:
|
2014-08-31 18:39:43 +00:00
|
|
|
QMap<QString, QString> DB;
|
2014-08-31 21:27:15 +00:00
|
|
|
void load();
|
|
|
|
void save();
|
|
|
|
void createDB();
|
2014-09-07 20:44:27 +00:00
|
|
|
QString encrypt(QString pass);
|
|
|
|
QString decrypte(QString pass);
|
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SAVEDATA_H
|
2014-08-31 17:54:33 +00:00
|
|
|
|