summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp72
1 files changed, 35 insertions, 37 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 41fcd515..634e068f 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -92,6 +92,36 @@ int Application::newInstance()
// so initialize only once
static bool first = true;
+ if(args->count() == 0)
+ {
+ MainWindow *w = 0;
+ if(first) // we are starting rekonq, for the first time with no args: use startup behaviour
+ {
+ switch(ReKonfig::startupBehaviour())
+ {
+ case 0: // open home page
+ w = newMainWindow();
+ w->slotHome();
+ break;
+ case 1: // open new tab page
+ w = newMainWindow();
+ w->homePage();
+ break;
+ case 2: // restore session
+ if(sessionManager()->restoreSession())
+ break;
+ default:
+ w = newMainWindow();
+ w->slotHome();
+ break;
+ }
+ }
+ else // rekonq has just been started. Just open a new window
+ {
+ w = newMainWindow();
+ }
+ }
+
if (first)
{
QTimer::singleShot(0, this, SLOT(postLaunch()));
@@ -106,9 +136,8 @@ int Application::newInstance()
kDebug() << "session restored";
return 1;
}
-
-// --------------------------------------------------------------------------
-
+
+ // are there args? load them..
if (args->count() > 0)
{
// is there a window open on the current desktop ? use it!
@@ -137,10 +166,6 @@ int Application::newInstance()
return 3;
}
- // creating new window
- MainWindow *w = newMainWindow();
- w->slotHome();
-
return 0;
}
@@ -177,11 +202,7 @@ void Application::slotSaveConfiguration() const
MainWindow *Application::mainWindow()
{
if(m_mainWindows.isEmpty())
- {
- kDebug() << "No extant windows: creating one new...";
- MainWindow *w = newMainWindow();
- return w;
- }
+ return 0;
MainWindow *active = qobject_cast<MainWindow*>(QApplication::activeWindow());
@@ -245,10 +266,7 @@ KIcon Application::icon(const KUrl &url)
{
if(!Application::instance()->mainWindowList().isEmpty()) // avoid infinite loop at startup
{
- // means it is the urlbar
- if(url.isEmpty() && Application::instance()->mainWindow()->currentTab()->url().scheme() == "rekonq")
- return KIcon("arrow-right");
-
+
if(url == KUrl("rekonq:closedTabs"))
return KIcon("tab-close");
if(url == KUrl("rekonq:history"))
@@ -330,7 +348,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
}
// loading home pages
- if (homePage(url))
+ if (mainWindow()->homePage(url))
return;
if (url.scheme() == QLatin1String("mailto"))
@@ -445,23 +463,3 @@ MainWindowList Application::mainWindowList()
{
return m_mainWindows;
}
-
-
-bool Application::homePage(const KUrl &url)
-{
- if ( url == KUrl("rekonq:closedTabs")
- || url == KUrl("rekonq:history")
- || url == KUrl("rekonq:bookmarks")
- || url == KUrl("rekonq:favorites")
- || url == KUrl("rekonq:home")
- )
- {
- kDebug() << "loading home: " << url;
- MainView *view = mainWindow()->mainView();
- WebView *w = view->currentWebView();
- HomePage p(w);
- w->setHtml( p.rekonqHomePage(url), url);
- return true;
- }
- return false;
-}