Works now without any existing location settings, enabling a new user to start using it.
[ptas] / zouba / uicontroller.cpp
index f1a32cf..2f823d2 100644 (file)
@@ -19,6 +19,20 @@ UiController::UiController( Ui *ui ) :
   Location *homeLocation = locations->location( "home" );
   Location *workLocation = locations->location( "work" );
 
+  if ( homeLocation==0 ) {
+    homeLocation = new Location( "home" );
+    locations->addLocation( homeLocation );
+  } else if ( homeLocation->isValid() ) {
+    setHomeButtonValid();
+  }
+
+  if ( workLocation==0 ) {
+    workLocation = new Location( "work" );
+    locations->addLocation( workLocation );
+  } else if ( workLocation->isValid() ) {
+    setWorkButtonValid();
+  }
+
   connect(
       homeLocation, SIGNAL( becomeValid() ),
       this, SLOT( setHomeButtonValid() )
@@ -37,9 +51,6 @@ UiController::UiController( Ui *ui ) :
       locations, SLOT( saveLocation() )
       );
 
-  homeLocation->resolveAddress( Ytv::Home );
-  workLocation->resolveAddress( Ytv::Work );
-
   destination.append( homeLocation );
   destination.append( workLocation );