diff options
author | adjam <adjam@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-06-02 22:41:57 +0000 |
---|---|---|
committer | adjam <adjam@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-06-02 22:41:57 +0000 |
commit | c9d8f10a2a361dd5dffa5d61b96bc96f0d50129d (patch) | |
tree | a2c949860fb01f2efb3dfd3b439a726a4e3ea753 /src/mainwindow.cpp | |
parent | Merge branch 'master' into local-svn (diff) | |
parent | new cookie management system. That (hopefully) works well..;) (diff) | |
download | rekonq-c9d8f10a2a361dd5dffa5d61b96bc96f0d50129d.tar.xz |
Merge branch 'master' into local-svn
git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/playground/network/rekonq@976901 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 66 |
1 files changed, 3 insertions, 63 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 73ec3d6d..26ffbc11 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -30,14 +30,13 @@ // Local Includes #include "application.h" #include "settings.h" -#include "history.h" +#include "historymenu.h" #include "cookiejar.h" #include "networkaccessmanager.h" #include "bookmarks.h" #include "webview.h" #include "mainview.h" #include "bookmarks.h" -#include "download.h" #include "findbar.h" #include "sidepanel.h" #include "urlbar.h" @@ -410,65 +409,6 @@ void MainWindow::slotUpdateBrowser() } -KUrl MainWindow::guessUrlFromString(const QString &string) -{ - QString urlStr = string.trimmed(); - QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); - - // Check if it looks like a qualified URL. Try parsing it and see. - bool hasSchema = test.exactMatch(urlStr); - - if (hasSchema) - { - QUrl qurl(urlStr, QUrl::TolerantMode); - KUrl url(qurl); - - if (url.isValid()) - { - return url; - } - } - - // Might be a file. - if (QFile::exists(urlStr)) - { - QFileInfo info(urlStr); - return KUrl::fromPath(info.absoluteFilePath()); - } - - // Might be a shorturl - try to detect the schema. - if (!hasSchema) - { - int dotIndex = urlStr.indexOf(QLatin1Char('.')); - - if (dotIndex != -1) - { - QString prefix = urlStr.left(dotIndex).toLower(); - QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http"); - QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode); - KUrl url(qurl); - - if (url.isValid()) - { - return url; - } - } - } - - // Fall back to QUrl's own tolerant parser. - QUrl qurl = QUrl(string, QUrl::TolerantMode); - KUrl url(qurl); - - // finally for cases where the user just types in a hostname add http - if (qurl.scheme().isEmpty()) - { - qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode); - url = KUrl(qurl); - } - return url; -} - - void MainWindow::loadUrl(const KUrl &url) { m_view->loadUrl(url); @@ -485,7 +425,7 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { KUrl srcUrl = currentTab()->url(); - Application::downloadManager()->newDownload(srcUrl); + // FIXME implement download file } @@ -544,7 +484,7 @@ void MainWindow::slotFileOpen() if (filePath.isEmpty()) return; - loadUrl(guessUrlFromString(filePath)); + loadUrl(Application::guessUrlFromString(filePath)); } |