User interface update
[qtmeetings] / src / BusinessLogic / UIManager.cpp
index da3c877..6adc9e5 100644 (file)
@@ -37,8 +37,9 @@ UIManager::UIManager( Engine *aEngine, WindowManager *aWindowManager ) :
        if ( iEngine == 0 ) return;
        if ( iWindowManager == 0 ) return;
        
+       connect(iWindowManager, SIGNAL(showSettingsClicked()), this, SLOT(settingsViewRequest()));
+
        createWeeklyView();
-       createSettingsView();
        createRoomStatusIndicator();
        createPasswordDialog();
        createProgressBar();
@@ -85,6 +86,7 @@ void UIManager::createSettingsView()
        
        // Connect signals
        connect( iSettingsView, SIGNAL( okClicked() ), this, SLOT( settingsOkClicked() ) );
+       connect( iSettingsView, SIGNAL( cancelClicked() ), this, SLOT( settingsCancelClicked() ) );
 }
 
 void UIManager::createRoomStatusIndicator()
@@ -133,12 +135,11 @@ void UIManager::connectCommunicationManager( CommunicationManager *aCommunicatio
 //             UIMANAGER SLOTS
 void UIManager::settingsViewRequest()
 {
+       createSettingsView();
+
        // Show the settings view and stop the idle timer
-       if ( iSettingsView != 0 )
-       {
-               iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
-               iEngine->stopIdleTimeCounter();
-       }
+       iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
+       iEngine->stopIdleTimeCounter();
 }
 
 void UIManager::settingsOkClicked()
@@ -147,7 +148,9 @@ void UIManager::settingsOkClicked()
        if ( iWeeklyView != 0 )
        {
                iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+               QT_DELETE(iSettingsView);
                iEngine->startIdleTimeCounter();
+               currentRoomChanged(iWeeklyView->currentRoom());
        }
 }
 
@@ -222,14 +225,27 @@ void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode )
        }
 }
 
+void UIManager::connectionLost()
+{
+       qDebug() << "UIManager::connectionLost()";
+       iWeeklyView->connectionLost();
+       iRoomStatusIndicator->connectionLost();
+}
+
+void UIManager::connectionEstablished()
+{
+       qDebug() << "UIManager::connectionEstablished()";
+       iWeeklyView->connectionEstablished();
+       iRoomStatusIndicator->connectionEstablished();
+}
+
 void UIManager::currentRoomChanged(Room *aRoom)
 {
        qDebug() << "[UIManager::currentRoomChanged] <Invoked>";
        if ( iWeeklyView != 0 )
        {
-               QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() );
-               QDateTime to = QDateTime( from.addDays( 8 ) );
-               iEngine->fetchMeetings( from, to, aRoom );
+               QDateTime shown = QDateTime( iWeeklyView->beginnigOfShownWeek() );
+               iEngine->fetchMeetings( shown.date().weekNumber(), shown.date().year(), aRoom );
        }
 }
 
@@ -290,3 +306,14 @@ void UIManager::hideProgressBar()
                iProgressBar->close();
        }
 }
+
+void UIManager::settingsCancelClicked()
+{
+       // Show the weekly view and restart the idle timer
+       if ( iWeeklyView != 0 )
+       {
+               iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+               QT_DELETE(iSettingsView);
+               iEngine->startIdleTimeCounter();
+       }
+}