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:

Qt Code:
  1. void Test::on_pushButton2_clicked()
  2. {
  3.  
  4. QVariant name;
  5.  
  6. QString fileName = QFileDialog::getSaveFileName(this,
  7. tr("Save file"), "",
  8. tr("Myapp (*.app);;All Files (*)"));
  9.  
  10. if (fileName.isEmpty())
  11. return;
  12. else {
  13. QFile file(fileName);
  14. if (!file.open(QIODevice::WriteOnly)) {
  15. QMessageBox::information(this, tr("Unable to open file"),
  16. file.errorString());
  17. return;
  18. }
  19.  
  20.  
  21. name = webView->page()->mainFrame()->evaluateJavaScript("dosave()");
  22. }
  23. }
To copy to clipboard, switch view to plain text mode 

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.