=== modified file 'debian/control'
--- debian/control	2015-01-28 15:35:49 +0000
+++ debian/control	2015-03-25 21:44:17 +0000
@@ -15,6 +15,10 @@
                qtdeclarative5-dev (>= 5.0),
                qtdeclarative5-dev-tools,
                qtdeclarative5-ubuntu-telephony0.1 | qtdeclarative5-ubuntu-telephony-plugin,
+               qtdeclarative5-ubuntu-contacts0.1,
+               qtdeclarative5-qtcontacts-plugin,
+               qtdeclarative5-ubuntu-telephony-phonenumber0.1,
+               qtdeclarative5-ubuntu-history0.1,
                qtdeclarative5-ubuntu-ui-toolkit-plugin,
                xvfb,
 Standards-Version: 3.9.4

=== modified file 'src/qml/DialerPage/DialerPage.qml'
--- src/qml/DialerPage/DialerPage.qml	2014-12-11 19:03:12 +0000
+++ src/qml/DialerPage/DialerPage.qml	2015-03-25 21:44:17 +0000
@@ -62,7 +62,9 @@
     objectName: "dialerPage"
 
     title: {
-        if (mainView.greeterMode) {
+        if (!mainView.applicationActive || !mainView.telepathyReady) {
+            return " "
+        } else if (mainView.greeterMode) {
             return i18n.tr("Emergency Calls")
         } else if (telepathyHelper.flightMode) {
             return i18n.tr("Flight mode")

=== modified file 'src/qml/dialer-app.qml'
--- src/qml/dialer-app.qml	2015-01-21 21:06:32 +0000
+++ src/qml/dialer-app.qml	2015-03-25 21:44:17 +0000
@@ -34,6 +34,8 @@
     property QtObject account: defaultAccount()
     property bool greeterMode: (state == "greeterMode")
     property bool lastHasCalls: callManager.hasCalls
+    property bool telepathyReady: false
+    property var currentStack: mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode
 
     function defaultAccount() {
         // we only use the default account property if we have more
@@ -84,6 +86,7 @@
     Connections {
         target: telepathyHelper
         onSetupReady: {
+            telepathyReady = true
             if (multipleAccounts && !telepathyHelper.defaultCallAccount &&
                 settings.mainViewDontAskCount < 3 && pageStackNormalMode.depth === 1 && !mainView.greeterMode) {
                 PopupUtils.open(Qt.createComponent("Dialogs/NoDefaultSIMCardDialog.qml").createObject(mainView))
@@ -370,20 +373,17 @@
     }
 
     function animateLiveCall() {
-        var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode
-        if (stack.currentPage && stack.currentPage.triggerCallAnimation) {
-            stack.currentPage.triggerCallAnimation();
+        if (currentStack.currentPage && currentStack.currentPage.triggerCallAnimation) {
+            currentStack.currentPage.triggerCallAnimation();
         } else {
             switchToLiveCall();
         }
     }
 
     function switchToLiveCall() {
-        var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode
-
         if (pageStackNormalMode.depth > 2 && pageStackNormalMode.currentPage.objectName == "contactsPage") {
             // pop contacts Page
-            stack.pop();
+            currentStack.pop();
         }
 
         var properties = {}
@@ -391,11 +391,11 @@
             properties["defaultTimeout"] = 30000
         }
 
-        if (stack.currentPage.objectName == "pageLiveCall") {
+        if (currentStack.currentPage.objectName == "pageLiveCall") {
             return;
         }
  
-        stack.push(Qt.resolvedUrl("LiveCallPage/LiveCall.qml"), properties)
+        currentStack.push(Qt.resolvedUrl("LiveCallPage/LiveCall.qml"), properties)
     }
 
     function showNotification(title, text) {
@@ -520,9 +520,8 @@
                 return;
             }
 
-            var stack = mainView.greeterMode ? pageStackGreeterMode : pageStackNormalMode
             // if we are animating the dialpad view, do not switch to livecall directly
-            if (stack.currentPage && stack.currentPage.callAnimationRunning) {
+            if (currentStack.currentPage && currentStack.currentPage.callAnimationRunning) {
                 mainView.lastHasCalls = callManager.hasCalls
                 return;
             }

=== modified file 'tests/qml/CMakeLists.txt'
--- tests/qml/CMakeLists.txt	2014-12-16 01:44:17 +0000
+++ tests/qml/CMakeLists.txt	2015-03-25 21:44:17 +0000
@@ -19,6 +19,7 @@
     declare_qml_test("keypad_button" tst_KeypadButton.qml)
     declare_qml_test("main_view" tst_MainView.qml)
     declare_qml_test("stopwatch" tst_StopWatch.qml)
+    declare_qml_test("dialer_page" tst_DialerPage.qml)
 else()
     if (NOT QMLTESTRUNNER_BIN)
         message(WARNING "Qml tests disabled: qmltestrunner not found")
@@ -30,5 +31,7 @@
 set(QML_TST_FILES
     tst_KeypadButton.qml
     tst_StopWatch.qml
+    tst_MainView.qml
+    tst_DialerPage.qml
 )
 add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})

=== added file 'tests/qml/tst_DialerPage.qml'
--- tests/qml/tst_DialerPage.qml	1970-01-01 00:00:00 +0000
+++ tests/qml/tst_DialerPage.qml	2015-03-25 21:44:17 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014 Canonical Ltd.
+ *
+ * This file is part of dialer-app.
+ *
+ * dialer-app 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; version 3.
+ *
+ * dialer-app 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 <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.2
+import QtTest 1.0
+import Ubuntu.Test 0.1
+
+Item {
+    id: root
+
+    width: units.gu(40)
+    height: units.gu(60)
+
+    Item {
+        id: application
+        function mmiPluginList() {
+            return []
+        }
+    }
+
+    Loader {
+        id: mainViewLoader
+        property string i18nDirectory: ""
+        source: '../../src/qml/dialer-app.qml'
+    }
+
+    UbuntuTestCase {
+        id: dialerPageTestCase
+        name: 'dialerPageTestCase'
+
+        when: windowShown
+
+        function init() {
+        }
+
+        function cleanup() {
+        }
+
+        function test_dialerPageHeaderTitleWhenAppIsInBackground() {
+            tryCompare(mainViewLoader.item, 'applicationActive', true)
+            tryCompare(mainViewLoader.item.currentStack, 'depth', 1)
+            tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('No network'))
+            mainViewLoader.item.applicationActive = false
+            tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', ' ')
+            mainViewLoader.item.applicationActive = true
+            tryCompare(mainViewLoader.item.currentStack.currentPage, 'title', i18n.tr('No network'))
+        }
+    }
+}

