summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-09 00:57:44 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-09 00:57:44 +0200
commit2000e8acb0e5f851dfc4024b48c7f08610fc857e (patch)
tree3af7636d22c3d56ac80ae69751a7bc0bf23d7e20 /src/application.cpp
parentThis is a really big commit, implementing the new urlbar (diff)
downloadrekonq-2000e8acb0e5f851dfc4024b48c7f08610fc857e.tar.xz
Re-enabling all KDE url magics
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp82
1 files changed, 44 insertions, 38 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 3405a1b2..48264440 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -289,53 +289,23 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
if (url.isEmpty())
return;
- // sanitization
- KUrl loadingUrl( url.toEncoded() );
-
- if ( !loadingUrl.isValid() )
+ if ( !url.isValid() )
{
- KMessageBox::error(0, i18n("Malformed URL:\n%1", loadingUrl.url(KUrl::RemoveTrailingSlash)));
+ KMessageBox::error(0, i18n("Malformed URL:\n%1", url.url(KUrl::RemoveTrailingSlash)));
return;
}
- // first, create the webview(s) to not let hangs UI..
- WebTab *tab = 0;
- MainWindow *w = 0;
- w = (type == Rekonq::NewWindow)
- ? newMainWindow()
- : mainWindow();
-
- switch(type)
- {
- case Rekonq::SettingOpenTab:
- tab = w->mainView()->newWebTab(!ReKonfig::openTabsBack(), ReKonfig::openTabsNearCurrent());
- break;
- case Rekonq::NewCurrentTab:
- tab = w->mainView()->newWebTab(true);
- break;
- case Rekonq::NewBackTab:
- tab = w->mainView()->newWebTab(false, ReKonfig::openTabsNearCurrent());
- break;
- case Rekonq::NewWindow:
- case Rekonq::CurrentTab:
- tab = w->mainView()->currentWebTab();
- break;
- };
-
- WebView *view = tab->view();
-
- if (view)
- {
- FilterUrlJob *job = new FilterUrlJob(view, loadingUrl.pathOrUrl(), this);
- Weaver::instance()->enqueue(job);
- }
+ prepareLoading(url.pathOrUrl(), type);
}
void Application::loadUrl(const QString& urlString, const Rekonq::OpenType& type)
-{
- return loadUrl( QUrl::fromUserInput(urlString), type );
+{
+ if(urlString.isEmpty())
+ return;
+
+ prepareLoading(urlString, type);
}
@@ -400,3 +370,39 @@ void Application::newWindow()
loadUrl( KUrl("about:home"), Rekonq::NewWindow );
mainWindow()->mainView()->urlBarWidget()->setFocus();
}
+
+
+void Application::prepareLoading(const QString& urlString, const Rekonq::OpenType& type)
+{
+ // first, create the webview(s) to not let hangs UI..
+ WebTab *tab = 0;
+ MainWindow *w = 0;
+ w = (type == Rekonq::NewWindow)
+ ? newMainWindow()
+ : mainWindow();
+
+ switch(type)
+ {
+ case Rekonq::SettingOpenTab:
+ tab = w->mainView()->newWebTab(!ReKonfig::openTabsBack(), ReKonfig::openTabsNearCurrent());
+ break;
+ case Rekonq::NewCurrentTab:
+ tab = w->mainView()->newWebTab(true);
+ break;
+ case Rekonq::NewBackTab:
+ tab = w->mainView()->newWebTab(false, ReKonfig::openTabsNearCurrent());
+ break;
+ case Rekonq::NewWindow:
+ case Rekonq::CurrentTab:
+ tab = w->mainView()->currentWebTab();
+ break;
+ };
+
+ WebView *view = tab->view();
+
+ if (view)
+ {
+ FilterUrlJob *job = new FilterUrlJob(view, urlString, this);
+ Weaver::instance()->enqueue(job);
+ }
+}