Changed something cannot remember what
[qtmeetings] / src / BusinessLogic / UIManager.cpp
index 19f445f..253e45a 100644 (file)
@@ -37,16 +37,12 @@ UIManager::UIManager( Engine *aEngine, WindowManager *aWindowManager ) :
        if ( iEngine == 0 ) return;
        if ( iWindowManager == 0 ) return;
        
-       qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
-       
        createWeeklyView();
        createSettingsView();
        createRoomStatusIndicator();
        createPasswordDialog();
        createProgressBar();
        createMeetingInfoDialog();
-       
-       qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
 }
 
 UIManager::~UIManager()
@@ -71,7 +67,7 @@ void UIManager::showProgressBar( QString aText )
 {
        if ( iProgressBar != 0 )
        {
-               iProgressBar->update( tr("Changing current operation mode.") );
+               iProgressBar->update( aText );
                iWindowManager->showDialog( iProgressBar );
        }
 }
@@ -89,6 +85,7 @@ void UIManager::createWeeklyView()
        // Connect signals to engine
        connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting * ) ) );
        connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), iEngine, SLOT( shownWeekChanged( QDate ) ) );
+       connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iEngine, SLOT( currentRoomChanged( Room * ) ) );
 }
 
 void UIManager::createSettingsView()
@@ -113,7 +110,7 @@ void UIManager::createPasswordDialog()
 
 void UIManager::createProgressBar()
 {
-       iProgressBar = new ProgressBar( tr("CHANGE THIS") );
+       iProgressBar = new ProgressBar( tr("CHANGE THIS"), true );
        
        // Connect to UIManager
        connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
@@ -132,11 +129,13 @@ void UIManager::connectDeviceManager( DeviceManager *aDeviceManager )
                        this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) );
        
        connect( aDeviceManager, SIGNAL( changingMode( const QString & ) ), this, SLOT( updateProgressBarText( const QString & ) ) );
+       connect( aDeviceManager, SIGNAL( changeModeFailed() ), this, SLOT( hideProgressBar() ) );
 }
 
 void UIManager::connectCommunicationManager( CommunicationManager *aCommunicationManager )
 {
        connect( aCommunicationManager, SIGNAL( meetingDetailsFetched( Meeting & ) ), this, SLOT( meetingDetailsFetched( Meeting & ) ) );
+       connect( aCommunicationManager, SIGNAL( meetingsFetched( const QList<Meeting *> & ) ), this, SLOT( meetingsFetched( const QList<Meeting *> & ) ) );
 }
 
 // ============================================
@@ -163,7 +162,11 @@ void UIManager::settingsOkClicked()
 
 void UIManager::meetingsFetched( const QList<Meeting*> &aMeetings )
 {
-       
+       qDebug() << "[UIManager::meetingsFetched] <Change the weekly views method to slot so we don't need this>";
+       if ( iWeeklyView != 0 )
+       {
+               iWeeklyView->refreshMeetings( aMeetings );
+       }
 }
 
 void UIManager::showMeetingProgressBar( Meeting *aMeeting )
@@ -171,20 +174,27 @@ void UIManager::showMeetingProgressBar( Meeting *aMeeting )
        if ( iProgressBar != 0 )
        {
                iProgressBar->update( tr("Fetching meeting info...") );
-               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
+               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
+               iEngine->stopIdleTimeCounter();
        }
 }
 
 void UIManager::meetingDetailsFetched(Meeting &aDetailedMeeting)
 {
+       qDebug() << "[UIManager::meetingDetailsFetched] <Invoked>";
        if ( iMeetingInfo != 0 )
        {
-               if ( iProgressBar != 0 )
+               if ( iProgressBar != 0 && iProgressBar->isVisible() )
                {
                        iProgressBar->close(); // Close it in case it's visible
                }
-               iMeetingInfo->setMeeting( &aDetailedMeeting );
-               iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
+               iEngine->stopIdleTimeCounter(); // Timer restarted when the dialog is dismissed.
+               MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
+               iWindowManager->showDialog( static_cast<QDialog *>( tmp ) );
+               
+// TODO : We should use the member variable and implement correctly the setMeeting() method !!!
+//             iMeetingInfo->setMeeting( &aDetailedMeeting );
+//             iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
        }
 }
 
@@ -207,6 +217,7 @@ void UIManager::progressBarCancelled()
        if ( iProgressBar != 0 )
        {
                iProgressBar->close();
+               iEngine->startIdleTimeCounter();
        }
 }
 
@@ -226,6 +237,7 @@ void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode )
 
 void UIManager::currentRoomChanged(Room *aRoom)
 {
+       qDebug() << "[UIManager::currentRoomChanged] <Invoked>";
        if ( iWeeklyView != 0 )
        {
                QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() );
@@ -250,7 +262,7 @@ void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus )
                        // Show the progress bar..
                        if ( iProgressBar != 0 )
                        {
-                               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
+                               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
                        }
                        // ... and initiate the mode changing
                        iEngine->changeDeviceMode( true );
@@ -276,3 +288,12 @@ void UIManager::updateProgressBarText(const QString &aText)
                iProgressBar->update( aText );
        }
 }
+
+void UIManager::hideProgressBar()
+{
+       qDebug() << "[UIManager::hideProgressBar] <Invoked>";
+       if ( iProgressBar != 0 && iProgressBar->isVisible() )
+       {
+               iProgressBar->close();
+       }
+}