merge conflict on my master - fix
This commit is contained in:
parent
0bb2835865
commit
104002c301
2 changed files with 63 additions and 0 deletions
|
@ -48,6 +48,18 @@ bool SaveData::save(QString username, QString password)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SaveData::saveCal(QString cal)
|
||||
{
|
||||
std::cout << "Trying to save data..." << std::endl;
|
||||
QFile file(FILE_NAME);
|
||||
if(!file.open(QIODevice::WriteOnly|QIODevice::Text))
|
||||
return false; /* IO Error! */
|
||||
QTextStream output(&file);
|
||||
QString text = output.readAll();
|
||||
QString line = text.
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deletes the data from file, and sets status tag to false.
|
||||
* @return true if success
|
||||
|
@ -97,6 +109,36 @@ QString SaveData::getPassword()
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Getiing the last calendar user hase been viewing.
|
||||
* @return QString - cal - in format [year]-[semester]
|
||||
*/
|
||||
QString SaveData::gatCal()
|
||||
{
|
||||
QString cal = "";
|
||||
QFile* file = new QFile(FILE_NAME);
|
||||
/* Opening file for read */
|
||||
if(file->open(QIODevice::ReadOnly|QIODevice::Text))
|
||||
cal = getValViaTag("cal", file);
|
||||
file->close();
|
||||
return cal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Getiing the users local - default is the OS local
|
||||
* @return QString - local (heb/en/default)
|
||||
*/
|
||||
QString SaveData::getLocal()
|
||||
{
|
||||
QString local = "";
|
||||
QFile* file = new QFile(FILE_NAME);
|
||||
/* Opening file for read */
|
||||
if(file->open(QIODevice::ReadOnly|QIODevice::Text))
|
||||
local = getValViaTag("local", file);
|
||||
file->close();
|
||||
return local;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This is A functions that will init the tags file.
|
||||
* if it exist - do nothing
|
||||
|
@ -198,3 +240,19 @@ QString SaveData::deHashPasword(QString pass)
|
|||
}
|
||||
return password;
|
||||
}
|
||||
|
||||
bool SaveData::isTagLine(QString line, QString tag)
|
||||
{
|
||||
for(int i = 0 ; i< line.length() ;++i)
|
||||
{
|
||||
if(line[i] == '[' && line[i+1] != '/') //get open tag at begining of line and not end of tag ("[/")
|
||||
{
|
||||
i++;
|
||||
tmpTag = line.mid(i, tag.length());
|
||||
if(tmpTag == tag)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -41,14 +41,19 @@ class SaveData
|
|||
public:
|
||||
bool static isSaved();
|
||||
bool static save(QString username, QString password);
|
||||
bool static saveCal(QString cal);
|
||||
bool static saveLocal(QString local);
|
||||
bool static deleteData();
|
||||
QString static getUsername();
|
||||
QString static getPassword();
|
||||
QString static gatCal();
|
||||
QString static getLocal();
|
||||
void static init();
|
||||
private:
|
||||
QString static getValViaTag(QString tag, QFile *file);
|
||||
QString static hashPassword(QString pass);
|
||||
QString static deHashPasword(QString pass);
|
||||
bool static isTagLine(QString line, QString tag);
|
||||
};
|
||||
|
||||
#endif // SAVEDATA_H
|
||||
|
|
Loading…
Reference in a new issue