qt.learner
11th August 2010, 14:01
Hi,
I have an application written in JavaScript. I am trying to port it on on Maemo Platform using Qt.
I am facing problems in implementing "Save feature" to it. Whatever data I write on my application is saved in a "string" in a dosave() function of my JavaScript file.
I am using this code to interact with JavaScript function:
void Test::on_pushButton2_clicked()
{
QVariant name;
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save file"), "",
tr("Myapp (*.app);;All Files (*)"));
if (fileName.isEmpty())
return;
else {
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Unable to open file"),
file.errorString());
return;
}
name = webView->page()->mainFrame()->evaluateJavaScript("dosave()");
}
}
I am able to save my file but when I open it , I get blank file again with no data in it.
I am not able retrieve data.
Kindly suggest some solution to my problem.
What are the ways I can save the data returned by the JavaScript function and can get back same thing on my file when I open it.
How can I implement data structures or Hash table in Qt programming, where I can save the strings returned and then use them in function created in Javascript used to open my saved files ?
Kindly suggest some solutions.
I have an application written in JavaScript. I am trying to port it on on Maemo Platform using Qt.
I am facing problems in implementing "Save feature" to it. Whatever data I write on my application is saved in a "string" in a dosave() function of my JavaScript file.
I am using this code to interact with JavaScript function:
void Test::on_pushButton2_clicked()
{
QVariant name;
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save file"), "",
tr("Myapp (*.app);;All Files (*)"));
if (fileName.isEmpty())
return;
else {
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Unable to open file"),
file.errorString());
return;
}
name = webView->page()->mainFrame()->evaluateJavaScript("dosave()");
}
}
I am able to save my file but when I open it , I get blank file again with no data in it.
I am not able retrieve data.
Kindly suggest some solution to my problem.
What are the ways I can save the data returned by the JavaScript function and can get back same thing on my file when I open it.
How can I implement data structures or Hash table in Qt programming, where I can save the strings returned and then use them in function created in Javascript used to open my saved files ?
Kindly suggest some solutions.