update std funtions to qt's

This commit is contained in:
liranbg 2014-10-18 07:15:42 +03:00
parent d59da2ca0c
commit 1520f25b2a
2 changed files with 276 additions and 280 deletions

View file

@ -116,24 +116,21 @@ int Page::stitchText(QString &from, QString &to, int index)
QString dateline = from.mid(index,from.indexOf("</b>",index+4)-index); QString dateline = from.mid(index,from.indexOf("</b>",index+4)-index);
QString temp; QString temp;
QString date; QString date;
char* tok; QStringList holder = dateline.split("<>&nbsp;:");
QStringList::iterator iterator;
int i = 0; int i = 0;
char* textToTok = strdup(dateline.toStdString().c_str()); for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
tok = strtok(textToTok,"<>&nbsp;:");
while (tok != NULL)
{ {
if (i == 1) temp = (*iterator);
if (i == 0)
{ {
temp = tok;
date += temp + "\t"; date += temp + "\t";
} }
else if (i == 3) else if (i == 3)
{ {
temp = tok;
date += temp; date += temp;
} }
i++; i++;
tok = strtok(NULL, "<>&nbsp;:");
} }
dateHeader = date; dateHeader = date;
if (bTag != "<b>") if (bTag != "<b>")

View file

@ -53,11 +53,11 @@ int jceLogin::makeConnection()
returnMode = makeFirstVisit(); returnMode = makeFirstVisit();
if (returnMode == (int)true) //requst and send first validation if (returnMode == (int)true) //requst and send first validation
{ {
status = jceStatus::JCE_START_VALIDATING_PROGRESS; // status = jceStatus::JCE_START_VALIDATING_PROGRESS;
returnMode = checkValidation(); returnMode = checkValidation();
if (returnMode == (int)true) //check if username and password are matching if (returnMode == (int)true) //check if username and password are matching
{ {
status = jceStatus::JCE_VALIDATION_PASSED; // status = jceStatus::JCE_VALIDATION_PASSED;
returnMode = makeSecondVisit(); returnMode = makeSecondVisit();
if (returnMode == (int)true) //siging in the website if (returnMode == (int)true) //siging in the website
{ {
@ -251,28 +251,27 @@ bool jceLogin::checkValidation()
QString constUserID_TAG = "value=\"-N"; QString constUserID_TAG = "value=\"-N";
QString constHassID_TAG = "-A,-N"; QString constHassID_TAG = "-A,-N";
QString hasspass,hassid; QString hasspass,hassid;
std::size_t hasspass_position1,hasspass_position2; int hasspass_position1,hasspass_position2;
std::size_t id_position1,id_position2; int id_position1,id_position2;
hasspass_position1 = this->recieverPage->indexOf(constHassID_TAG); //looking for hasspass index
hasspass_position1 = this->recieverPage->toStdString().find(constHassID_TAG.toStdString()); //looking for hasspass index if (hasspass_position1 == -1) //didnt find the tag
if (hasspass_position1 == std::string::npos) //didnt find the tag
return false; return false;
else else
hasspass_position1 += constHassID_TAG.length(); //skip the index of tag hasspass_position1 += constHassID_TAG.length(); //skip the index of tag
hasspass_position2 = this->recieverPage->toStdString().find(",-A,-A", hasspass_position1); hasspass_position2 = this->recieverPage->indexOf(",-A,-A", hasspass_position1);
//finds the hass pass //finds the hass pass
if (hasspass_position2 != std::string::npos) //found the hasspass! storing it if (hasspass_position2 != -1) //found the hasspass! storing it
hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1); hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1);
else else
return false; return false;
//finds the user id //finds the user id
id_position1 = this->recieverPage->toStdString().find(constUserID_TAG.toStdString(), 0); //looking for hassid index id_position1 = this->recieverPage->indexOf(constUserID_TAG, 0); //looking for hassid index
if (id_position1 == std::string::npos) //didnt find the tag if (id_position1 == -1) //didnt find the tag
return false; return false;
else else
id_position1 += constUserID_TAG.length(); //skip the index of tag id_position1 += constUserID_TAG.length(); //skip the index of tag
id_position2 = this->recieverPage->toStdString().find(",-A", id_position1); id_position2 = this->recieverPage->indexOf(",-A", id_position1);
if (id_position2 != std::string::npos) //found the hassid! storing it if (id_position2 != -1) //found the hassid! storing it
hassid = recieverPage->mid(id_position1,id_position2-id_position1); hassid = recieverPage->mid(id_position1,id_position2-id_position1);
else else
return false; return false;