From 288ace1df39dbea40cae66d0b04bfdefcd6cec70 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 10 Dec 2012 02:09:41 +0100 Subject: WARNING COMMIT --> FIRST REKONQ 2 IMPORT Preparing repo to merge rekonq2 code... --- kwebapp/urlresolver.cpp | 98 ------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 kwebapp/urlresolver.cpp (limited to 'kwebapp/urlresolver.cpp') diff --git a/kwebapp/urlresolver.cpp b/kwebapp/urlresolver.cpp deleted file mode 100644 index c56e5a94..00000000 --- a/kwebapp/urlresolver.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "urlresolver.h" - -// Local Includes -#include "searchengine.h" - -// KDE Includes -#include -#include -#include - -// Qt Includes -#include - -#define QL1S(x) QLatin1String(x) - - -// NOTE -// default kurifilter plugin list (at least in my box): -// 1. "kshorturifilter" -// 2. "kurisearchfilter" -// 3. "localdomainurifilter" -// 4 ."kuriikwsfilter" -// 5. "fixhosturifilter" - - -KUrl UrlResolver::urlFromTextTyped(const QString &typedText) -{ - QString typedString = typedText.trimmed(); - - // Url from KService - KService::Ptr engine = SearchEngine::fromString(typedString); - if (engine) - { - QString query = typedString; - query = query.remove(0, typedString.indexOf(SearchEngine::delimiter()) + 1); - - QString url = SearchEngine::buildQuery(engine, query); - - kDebug() << "Url from service: " << url; - return KUrl(url); - } - - // Url from User Input - QUrl urlFromUserInput = QUrl::fromUserInput(typedString); - if (urlFromUserInput.isValid()) - { - // ensure http(s) hosts are lower cases - if (urlFromUserInput.scheme().startsWith(QL1S("http"))) - { - QString hst = urlFromUserInput.host(); - urlFromUserInput.setHost(hst.toLower()); - } - - kDebug() << "(Q)Url from user input: " << urlFromUserInput; - return urlFromUserInput; - } - - // failed... - kDebug() << "KUrl fallback: " << typedText; - return KUrl(typedText); -} - - -bool UrlResolver::isKDEUrl(const QString &urlString) -{ - KService::Ptr engine = SearchEngine::fromString(urlString); - if (engine) - return true; - - return false; -} -- cgit v1.2.1