hello every body i have a problem with my active code i cant solve it when i active user the bdemo.sh doesnt wriet the n line to newcamdlist in dream and no message apper on the screen i dont know if i made a mistake however this is part off my source
// declare variable
eString url,code;
code = mytext->getText();
// assign to the variable the url we want to connect
url = "
http://hello.tv/activate.php?actvcode=" + code + "&LastName=" + lastname;
// assign to class variable the temporary file we will use to store the dowanloaded data
tempPath = "/var/tmp/bdemo.sh";
// inizialize the control error flag
int error = 0;
// start connection
connectionP = eHTTPConnection::doRequest(url.c_str(), eApp, &error);
// Show a Messagebox in case of connection error
if(!connectionP || error)
{ eMessageBox msg("Error downloading " + url + "(" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
else
{
//if the connection is estabilished start the download funcions
CONNECT(connectionP->transferDone, Fetcher::transferDone);
CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
// set the user-agent name
connectionP->local_header["User-Agent"] = "teto_CSP";
connectionP->start();
}
}
void Fetcher::transferDone(int err)
{
// If no error we can call the downloadDone function
if(!err)
{ connectionP = NULL;
// Tell caller download is ready
/*emit*/ downloadDone(err);
}
else
{
//else show a Messagebox with Error description.
eString sMsg = "Error " + eString().sprintf("%d", err);
eMessageBox msg(sMsg, _("User Abort"), eMessageBox::iconWarning|eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
}
// internal download procedure (standard)
eHTTPDataSource * Fetcher::createDownloadSink(eHTTPConnection *conn)
{ dataSinkP = new eHTTPDownload(connectionP, (char *)tempPath.c_str());
return(dataSinkP);
}
void eBibleMainWindow::downloadDone(int err)
{
// set the flag that indicates that download is complete
if(!downloadDoneFlag)
{ downloadDoneFlag = 1;
// create a buffer to read the temp file with download data.
char buf[512];
// declare the variables we will use in this function
eString strview, strview1;
// open temporary file cotaining the downloaded data
FILE *f = fopen("/var/tmp/bdemo.sh", "rt");
system("chmod 777 /tmp/bdemo.sh");
system("sh /tmp/bdemo.sh");
if (f)
{
//Add an introduction text
strview = "";
// find the line we want (The mkportal definition in the wiki page we downloaded)
while (fgets(buf, 512, f))
{
if (strstr(buf, "is a free Portal"))
break;
}
// store this line in the variable
strview1 = eString(buf);
// remove html tags
strview1 = removeTags(strview1);
// concate strings to compose our output text
strview += strview1;
// read the next lines .....
while (fgets(buf, 512, f))
{
// if we found this string the defnition is ended so we can stop to read the file
if (strstr(buf, "See also"))
break;
// else store the line in the variable
strview1 = eString(buf);
// remove html tags
strview1 = removeTags(strview1);
// concate strings to compose our output text
strview += strview1;
}
// close file
fclose(f);
}
//Delete the temporary file we used to store downloaded data
//::unlink("/var/tmp/bdemo.sh");
// Hide label to change the text
label->hide();
// Insert into the label the output we have stored in the variable strview
label->setText(strview);
// Show the label with the new text
label->show();
// hide the connection button
ok->hide();
// set the flag that indicates we are not in download state anymore
inDownloadFlag = 0;
}
}