summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/application.cpp90
-rw-r--r--src/application.h6
2 files changed, 60 insertions, 36 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 98579cf0..6684439c 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -42,6 +42,7 @@
#include "urlbar.h"
#include "sessionmanager.h"
#include "adblockmanager.h"
+#include "webview.h"
// KDE Includes
#include <KCmdLineArgs>
@@ -283,36 +284,9 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
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 = createView(type);
- // this should let rekonq filtering URI info and supporting
- // the beautiful KDE web browsing shortcuts
- KUriFilterData data(loadingUrl.pathOrUrl());
- data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
- loadingUrl = KUriFilter::self()->filterUri(data) ? data.uri().pathOrUrl() : QUrl::fromUserInput(loadingUrl.pathOrUrl());
+ loadingUrl = resolvUrl( loadingUrl.pathOrUrl() );
// we are sure of the url now, let's add it to history
// anyway we store here just http sites because local and ftp ones are
@@ -320,15 +294,15 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
if( url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https") )
historyManager()->addHistoryEntry( loadingUrl.prettyUrl() );
- if (!ReKonfig::openTabsBack())
- {
- w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());
- }
+// if (!ReKonfig::openTabsBack())
+// {
+// w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());
+// }
- if (tab)
+ if (view)
{
- tab->setFocus();
- tab->view()->load(loadingUrl);
+ view->setFocus();
+ view->load(loadingUrl);
}
}
@@ -372,3 +346,47 @@ AdBlockManager *Application::adblockManager()
}
return s_adblockManager;
}
+
+
+WebView *Application::createView(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;
+ };
+
+ return tab->view();
+}
+
+
+KUrl Application::resolvUrl(const QString &urlString)
+{
+ // this should let rekonq filtering URI info and supporting
+ // the beautiful KDE web browsing shortcuts
+ KUriFilterData data(urlString);
+ data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
+ KUrl url = KUriFilter::self()->filterUri(data)
+ ? data.uri().pathOrUrl()
+ : QUrl::fromUserInput( urlString );
+
+ return url;
+}
diff --git a/src/application.h b/src/application.h
index a0cd6745..c9fb079d 100644
--- a/src/application.h
+++ b/src/application.h
@@ -48,6 +48,7 @@ class HistoryManager;
class MainWindow;
class SessionManager;
class AdBlockManager;
+class WebView;
typedef QList< QPointer<MainWindow> > MainWindowList;
@@ -135,6 +136,11 @@ private slots:
void postLaunch();
private:
+
+ // loadUrl Utilities
+ WebView *createView(const Rekonq::OpenType &);
+ KUrl resolvUrl(const QString &);
+
static QPointer<HistoryManager> s_historyManager;
static QPointer<BookmarkProvider> s_bookmarkProvider;
static QPointer<SessionManager> s_sessionManager;