Got something working
[qtmeetings] / src / BusinessLogic / UIManager.cpp
index 19f445f..7e24d61 100644 (file)
@@ -71,7 +71,7 @@ void UIManager::showProgressBar( QString aText )
 {
        if ( iProgressBar != 0 )
        {
-               iProgressBar->update( tr("Changing current operation mode.") );
+               iProgressBar->update( aText );
                iWindowManager->showDialog( iProgressBar );
        }
 }
@@ -113,7 +113,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 +132,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 +165,12 @@ void UIManager::settingsOkClicked()
 
 void UIManager::meetingsFetched( const QList<Meeting*> &aMeetings )
 {
-       
+       qDebug() << "[UIManager::meetingsFetched] <SHOULD NOT SIMPLY INSERT MEETINGS TO WEEKLYVIEW !!!>";
+       for ( int i = 0; i < aMeetings.count(); i++ )
+       {
+               Meeting *m = new Meeting( *( aMeetings.at(i) ) );
+               iWeeklyView->insertMeeting( m );
+       }
 }
 
 void UIManager::showMeetingProgressBar( Meeting *aMeeting )
@@ -171,20 +178,22 @@ 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 );
        }
 }
 
 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 ) );
+               // iMeetingInfo->setMeeting( &aDetailedMeeting );
+               MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
+               iWindowManager->showDialog( static_cast<QDialog *>( tmp/*iMeetingInfo*/ ) );
        }
 }
 
@@ -250,7 +259,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 +285,12 @@ void UIManager::updateProgressBarText(const QString &aText)
                iProgressBar->update( aText );
        }
 }
+
+void UIManager::hideProgressBar()
+{
+       qDebug() << "[UIManager::hideProgressBar] <Invoked>";
+       if ( iProgressBar != 0 && iProgressBar->isVisible() )
+       {
+               iProgressBar->close();
+       }
+}