[SOLVED] How to let <input type="file"/> remember the last selected directory with Qt webkit?
-
Create an app consuming Qt webkit, create a html file including <input type="file"/>, run the app browse this html file, select a file by <input type="file"/> element, close the app, restart the app, the directory last selected is not remembered.
But in chrome, the last selected directory can be remembered.
How to let <input type="file"/> remember the last selected directory with Qt webkit? -
Yes, but you need to implement it yourself, exactly like chrome developers have done it too... chrome is not webkit, chrome is based on webkit engine, exactly like QtWebKit is based on WebKit and QtWebKit is not WebKit itself!
-
Thanks, Need I to implement it in webkit or Qtwebkit? Does Chrome make some changes in its webkit, right?
[quote author="AcerExtensa" date="1373385102"]Yes, but you need to implement it yourself, exactly like chrome developers have done it too... chrome is not webkit, chrome is based on webkit engine, exactly like QtWebKit is based on WebKit and QtWebKit is not WebKit itself![/quote]
-
On Qt side there is virtual functions in QWebPage class to be reimplemented for this purpose... You need to subclass QWebPage and reimplement "virtual QString chooseFile ( QWebFrame * parentFrame, const QString & suggestedFile )":http://qt-project.org/doc/qt-4.8/qwebpage.html#chooseFile for single file, or "virtual bool extension ( Extension extension, const ExtensionOption * option = 0, ExtensionReturn * output = 0 )":http://qt-project.org/doc/qt-4.8/qwebpage.html#extension with "QWebPage::ChooseMultipleFilesExtension ":http://qt-project.org/doc/qt-4.8/qwebpage.html#Extension-enum extension for multiple file upload. For multiple file upload you also need to reimplement "virtual bool supportsExtension ( Extension extension ) const":http://qt-project.org/doc/qt-4.8/qwebpage.html#supportsExtension and return true for supported extensions. There is also signals to handle downloads of files, take a look at "QWebPage Class Reference":http://qt-project.org/doc/qt-4.8/qwebpage.html
-
Please add "[SOLVED]" prefix to the topic subject. Thanks!