From bec0deb0925091d2b26038deed730c72af9c0a37 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 3 Nov 2011 16:25:34 +0100 Subject: Let rekonq save file remotely Andreas's comment was helpful: rekonq COULD save file remotely, but for same strange reason, KFileDialog::getSaveFileName() could not select remote files. Switching to getSaveUrl seems fixing the problem Ah... also a style clean up here. Sorry for the merged commit... BUG: 242675 --- src/mainwindow.cpp | 6 +++--- src/settings/webkitwidget.h | 2 +- src/tabbar.cpp | 6 +++--- src/urlbar/urlbar.cpp | 12 ++++++------ src/urlbar/urlresolver.cpp | 2 +- src/webpluginfactory.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 23ccf25d..beab3afc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -669,14 +669,14 @@ void MainWindow::fileSaveAs() name = srcUrl.host() + QString(".html"); } - const QString destUrl = KFileDialog::getSaveFileName(name, QString(), this); + const KUrl destUrl = KFileDialog::getSaveUrl(name, QString(), this); if (destUrl.isEmpty()) return; if (w->page()->isContentEditable()) { QString code = w->page()->mainFrame()->toHtml(); - QFile file(destUrl); + QFile file(destUrl.url()); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; @@ -686,7 +686,7 @@ void MainWindow::fileSaveAs() return; } - KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite); + KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite); job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache. job->addMetaData("cache", "cache"); // Use entry from cache if available. job->uiDelegate()->setAutoErrorHandlingEnabled(true); diff --git a/src/settings/webkitwidget.h b/src/settings/webkitwidget.h index 0046839a..de584a11 100644 --- a/src/settings/webkitwidget.h +++ b/src/settings/webkitwidget.h @@ -51,7 +51,7 @@ signals: private slots: void hasChanged(); void updateJavascriptSettings(bool); - + private: void setWebSettingsToolTips(); diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 74c339e0..6e9b781b 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -489,8 +489,8 @@ void TabBar::dropEvent(QDropEvent* event) int urlCount = event->mimeData()->urls().count(); if (urlCount > 1) { - Q_FOREACH (const QUrl url, event->mimeData()->urls()) - rApp->loadUrl(url, Rekonq::NewTab); + Q_FOREACH(const QUrl url, event->mimeData()->urls()) + rApp->loadUrl(url, Rekonq::NewTab); } else rApp->loadUrl(event->mimeData()->urls().first(), Rekonq::NewFocusedTab); @@ -525,7 +525,7 @@ bool TabBar::isURLValid(const QString &url) if (editedURL.startsWith("http://") || editedURL.startsWith("https://") || editedURL.startsWith("ftp://")) editedURL = editedURL.remove(QRegExp("(http|https|ftp)://")); if (editedURL.contains('.') && editedURL.indexOf('.') > 0 && editedURL.indexOf('.') < editedURL.length() && !editedURL.trimmed().contains(" ") - && QUrl::fromUserInput(editedURL).isValid()) + && QUrl::fromUserInput(editedURL).isValid()) isValid = true; return isValid; } diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 54045bf4..9460cf8a 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -261,28 +261,28 @@ void UrlBar::keyPressEvent(QKeyEvent *event) if (currentText.isEmpty()) return KLineEdit::keyPressEvent(event); - + // this handles the Modifiers + Return key combinations if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { - switch(event->modifiers()) + switch (event->modifiers()) { case Qt::AltModifier: loadRequestedUrl(currentText, Rekonq::NewFocusedTab); break; - + case Qt::ControlModifier: loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".com"))); break; - + case 0x06000000: // Qt::ControlModifier | Qt::ShiftModifier: loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".org"))); break; - + case Qt::ShiftModifier: loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".net"))); break; - + default: loadRequestedUrl(currentText); break; diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index a1459399..e7f41c7b 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -402,7 +402,7 @@ void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &s { if (text == i.title) continue; - + urlString = i.url; if (urlString.isEmpty()) { diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp index 73291991..c0cfceee 100644 --- a/src/webpluginfactory.cpp +++ b/src/webpluginfactory.cpp @@ -64,7 +64,7 @@ QObject *WebPluginFactory::create(const QString &mimeType, case 1: if (mimeType != QString("application/x-shockwave-flash") - || mimeType != QString("application/futuresplash")) + || mimeType != QString("application/futuresplash")) break; if (_loadClickToFlash) -- cgit v1.2.1