1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

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

uploading multiple files
This commit is contained in:
nowrep 2011-05-22 11:05:36 +02:00
parent 9fb119fc95
commit cab1fa4ca9
2 changed files with 19 additions and 0 deletions

View File

@ -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);

View File

@ -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;
};