Every WebPage chooseFile dialog is now saving last location to speed up

uploading multiple files
remotes/origin/falkon
nowrep 15 years ago
parent 9fb119fc95
commit cab1fa4ca9
  1. 16
      src/webview/webpage.cpp
  2. 3
      src/webview/webpage.h

@ -32,6 +32,7 @@ WebPage::WebPage(WebView* parent, QupZilla* mainClass)
,p_QupZilla(mainClass)
,m_view(parent)
,m_blockAlerts(false)
,m_lastUploadLocation(QDir::homePath())
// ,m_isOpeningNextWindowAsNewTab(false)
{
setForwardUnsupportedContent(true);
@ -386,6 +387,21 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg)
_view->setFocus();
}
QString WebPage::chooseFile(QWebFrame *originatingFrame, const QString &oldFile)
{
QString suggFileName;
if (oldFile.isEmpty())
suggFileName = m_lastUploadLocation;
else
suggFileName = oldFile;
QString fileName = QFileDialog::getOpenFileName(originatingFrame->page()->view(), tr("Choose file..."), suggFileName);
if (!fileName.isEmpty())
m_lastUploadLocation = fileName;
return fileName;
}
WebPage::~WebPage()
{
setNetworkAccessManager(0);

@ -67,6 +67,8 @@ private:
virtual bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output = 0);
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type);
QString chooseFile(QWebFrame *originatingFrame, const QString &oldFile);
QupZilla* p_QupZilla;
QNetworkRequest m_lastRequest;
QWebPage::NavigationType m_lastRequestType;
@ -75,6 +77,7 @@ private:
QList<QSslCertificate> m_SslCerts;
QList<AdBlockedEntry> m_adBlockedEntries;
bool m_blockAlerts;
QString m_lastUploadLocation;
// bool m_isOpeningNextWindowAsNewTab;
};

Loading…
Cancel
Save