Merge branch 'master' of https://git.maemo.org/projects/qtmeetings
authoritkonma <marko.itkonen@ixonos.com>
Tue, 26 May 2009 11:52:25 +0000 (14:52 +0300)
committeritkonma <marko.itkonen@ixonos.com>
Tue, 26 May 2009 11:52:25 +0000 (14:52 +0300)
Conflicts:
src/BusinessLogic/Engine.cpp

1  2 
src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/UserInterface/WindowManager.cpp

  #include <QList>
  #include <QtDebug>
  
 -QTime Engine::endOfTheDay = QTime( 23, 59, 0, 0 ); // end of the day is 11:59pm
 +QTime Engine::endOfTheDay = QTime( 23, 59, 0, 0); // end of the day is 11:59pm
  const int IDLE_TIME_MULTIPLIER = 60000; // Multiplies milliseconds to minutes
  
  Engine::Engine() :
 -              iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 )
 +      iClock( 0), iConfiguration(Configuration::instance() ), iCommunication( 0)
  {
        qDebug() << "Engine::Engine()";
        // if reading of configuration fails, signal that initialization failed
 -      if ( iConfiguration == 0 )
 +      if (iConfiguration == 0)
        {
 -              QTimer::singleShot( 0, this, SLOT( closeApplication() ) );
 +              QTimer::singleShot( 0, this, SLOT( closeApplication() ));
                return;
        }
 -              
 +
        //initialize window manager
        iWindowManager = new WindowManager( iConfiguration );
 -      connect( iWindowManager, SIGNAL( roomStatusInfoNeeded( Room * ) ), this, SLOT( roomStatusInfoNeeded( Room * ) ) );
 -      connect( iWindowManager, SIGNAL( observedEventDetected() ), this, SLOT( observedEventDetected() ) );
 -      connect( iWindowManager, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( fetchMeetingDetails( Meeting * ) ) );
 -      connect( iWindowManager, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
 -      connect( iWindowManager, SIGNAL( shownWeekChanged( QDate ) ), this, SLOT( shownWeekChanged( QDate ) ) );
 -      connect( iWindowManager, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
 -                      this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
 -
 -      
 +      connect(iWindowManager, SIGNAL( roomStatusInfoNeeded( Room * ) ), this, SLOT( roomStatusInfoNeeded( Room * ) ));
 +      connect(iWindowManager, SIGNAL( observedEventDetected() ), this, SLOT( observedEventDetected() ));
 +      connect(iWindowManager, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( fetchMeetingDetails( Meeting * ) ));
 +      connect(iWindowManager, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ));
 +      connect(iWindowManager, SIGNAL( shownWeekChanged( QDate ) ), this, SLOT( shownWeekChanged( QDate ) ));
 +      connect(iWindowManager, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ));
 +
        // initialize communication
        iCommunication = new CommunicationManager( *(iConfiguration->connectionSettings()) );
 -      connect( iCommunication, SIGNAL( error( int, CommunicationManager::CommunicationType  ) ),
 -                      this, SLOT( errorHandler( int ) ) );
 -      connect( iCommunication, SIGNAL( meetingsFetched( const QList<Meeting*>& ) ),
 -                      this, SLOT( meetingsFetched( const QList<Meeting*>& ) ) );
 -      connect( iCommunication, SIGNAL( meetingDetailsFetched( Meeting& ) ),
 -                      this, SLOT( meetingDetailsFetched( Meeting& ) ) );
 +      connect(iCommunication, SIGNAL( error( int, CommunicationManager::CommunicationType ) ), this, SLOT( errorHandler( int ) ));
 +      connect(iCommunication, SIGNAL( meetingsFetched( const QList<Meeting*>& ) ), this, SLOT( meetingsFetched( const QList<Meeting*>& ) ));
 +      connect(iCommunication, SIGNAL( meetingDetailsFetched( Meeting& ) ), this, SLOT( meetingDetailsFetched( Meeting& ) ));
  
        //initialize idle time counter
        iIdleTimeCounter = new QTimer();
 -      iIdleTimeCounter->setSingleShot( true );
 -      iIdleTimeCounter->setInterval( IDLE_TIME_MULTIPLIER * iConfiguration->displaySettings()->screensaver() );
 +      iIdleTimeCounter->setSingleShot( true);
 +      iIdleTimeCounter->setInterval(IDLE_TIME_MULTIPLIER
 +                      * iConfiguration->displaySettings()->screensaver() );
        iIdleTimeCounter->start();
 -      connect( iIdleTimeCounter, SIGNAL( timeout() ), iWindowManager, SLOT( showRoomStatus() ) );
 +      connect(iIdleTimeCounter, SIGNAL( timeout() ), iWindowManager, SLOT( showRoomStatus() ));
  
        // create application clock
        iClock = new Clock;
 -      connect( iClock, SIGNAL( tick( QDateTime ) ), this, SLOT( checkStatusOfAllRooms() ) );
 -      connect( iClock, SIGNAL( tick( QDateTime ) ), iWindowManager, SLOT( distributeDateTimeInfo( QDateTime ) ) );
 +      connect(iClock, SIGNAL( tick( QDateTime ) ), this, SLOT( checkStatusOfAllRooms() ));
 +      connect(iClock, SIGNAL( tick( QDateTime ) ), iWindowManager, SLOT( distributeDateTimeInfo( QDateTime ) ));
  
        iAutoRefresh = new QTimer;
 -      iAutoRefresh->setInterval( iConfiguration->connectionSettings()->refreshInterval() * 1000 );
 +      iAutoRefresh->setInterval(iConfiguration->connectionSettings()->refreshInterval() * 1000);
        iAutoRefresh->start();
 -      connect( iAutoRefresh, SIGNAL( timeout() ), iAutoRefresh, SLOT( start() ) );
 -      connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ) );
 +      connect(iAutoRefresh, SIGNAL( timeout() ), iAutoRefresh, SLOT( start() ));
 +      connect(iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ));
  
        // create device manager
        iDevice = new DeviceManager( iConfiguration->startupSettings() );
 -      connect( iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ) );  
 -      connect( iDevice, SIGNAL( changeModeOrdered( DeviceManager::OperationMode ) ), 
 -                      this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) );
 +      connect(iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ));
 +      connect(iDevice, SIGNAL( changeModeOrdered( DeviceManager::OperationMode ) ), this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ));
        iDevice->initDeviceManager();
 -      
 -      if( iDevice->currentOperationMode() == DeviceManager::KioskMode )
 +
 +      if (iDevice->currentOperationMode() == DeviceManager::KioskMode)
                iWindowManager->fullScreen();
  
 -      QTimer::singleShot( 0, this, SLOT( fetchMeetings() ) );
 +      QTimer::singleShot( 0, this, SLOT( fetchMeetings() ));
  
        // TODO: continue implementation
  }
@@@ -97,19 -102,15 +97,19 @@@ void Engine::closeApplication(
  {
        qDebug() << "Engine::closeApplication()";
        // closes application after 1 second
 -      QTimer::singleShot( 1000, QApplication::instance(), SLOT( quit() ) );
 +      QTimer::singleShot( 1000, QApplication::instance(), SLOT( quit() ));
  }
  
  void Engine::observedEventDetected()
  {
        qDebug() << "Engine::observedEventDetected()";
 +      if ( !iIdleTimeCounter->isActive() )
 +      {
 +              iWindowManager->weeklyView()->showCurrentWeek();
 +      }
        iWindowManager->showWeeklyView();
        // prepare to restart idle counter
 -      if ( iIdleTimeCounter->isActive() )
 +      if (iIdleTimeCounter->isActive() )
        {
                iIdleTimeCounter->stop();
        }
@@@ -127,20 -128,22 +127,20 @@@ void Engine::checkStatusOfAllRooms(
  {
        qDebug() << "Engine::checkStatusOfAllRooms()";
        // iterate trough on the rooms
 -      for ( int i = 0; i < iConfiguration->rooms().count(); i++ )
 +      for (int i = 0; i < iConfiguration->rooms().count(); i++)
        {
                // and check the status
 -              roomStatusInfoNeeded( iConfiguration->rooms().at( i ) );
 +              roomStatusInfoNeeded(iConfiguration->rooms().at(i) );
        }
  }
  
 -int Engine::indexOfMeetingAt( Room *aRoom, QDateTime aAt )
 +int Engine::indexOfMeetingAt(Room *aRoom, QDateTime aAt)
  {
        qDebug() << "Engine::indexOfMeetingAt( Room *, QDateTime )";
 -      for ( int i = 0; i < iMeetings.count(); i++ )
 +      for (int i = 0; i < iMeetings.count(); i++)
        {
                // exchange server ensures that there is only one meeting in a room at a specified time
 -              if ( aRoom->equals( iMeetings.at( i )->room() )
 -                        && iMeetings.at( i )->startsAt() <= aAt
 -                        && iMeetings.at( i )->endsAt() >= aAt )
 +              if (aRoom->equals(iMeetings.at( i )->room() ) && iMeetings.at( i )->startsAt() <= aAt && iMeetings.at( i )->endsAt() >= aAt)
                {
                        return i;
                }
        return -1;
  }
  
 -int Engine::indexOfMeetingAfter( Room *aRoom, QDateTime aAfter )
 +int Engine::indexOfMeetingAfter(Room *aRoom, QDateTime aAfter)
  {
        qDebug() << "Engine::indexOfMeetingAfter( Room *, QDateTime )";
        // seeks for the next meeting on the SAME DAY
        int min = -1;
 -      for ( int i = 0; i < iMeetings.count(); i++ )
 +      for (int i = 0; i < iMeetings.count(); i++)
        {
                // if the meeting is in the same room, on the same day but after the specified time
 -              if ( aRoom->equals( iMeetings.at( i )->room() )
 -                        && iMeetings.at( i )->startsAt().date() == aAfter.date()
 -                        && iMeetings.at( i )->startsAt() > aAfter )
 +              if (aRoom->equals(iMeetings.at( i )->room() ) && iMeetings.at( i )->startsAt().date() == aAfter.date() && iMeetings.at( i )->startsAt() > aAfter)
                {
                        // if there was not any meeting find yet or the previously found is a later one then the (i)th
 -                      if ( min == -1
 -                                || iMeetings.at( min )->startsAt() > iMeetings.at( i )->startsAt() )
 +                      if (min == -1 || iMeetings.at( min )->startsAt() > iMeetings.at( i )->startsAt() )
                        {
                                min = i;
                        }
        return min;
  }
  
 -void Engine::roomStatusInfoNeeded( Room *aRoom )
 +void Engine::roomStatusInfoNeeded(Room *aRoom)
  {
        qDebug() << "Engine::roomStatusInfoNeeded( Room * )";
 -      if ( aRoom == 0 )
 +      if (aRoom == 0)
        {
                return;
        }
  
 -      int indexOfCurrentMeeting = indexOfMeetingAt( aRoom, iClock->datetime() );
 -      int indexOfNextMeeting = indexOfMeetingAfter( aRoom, iClock->datetime() );
 +      int indexOfCurrentMeeting = indexOfMeetingAt(aRoom, iClock->datetime() );
 +      int indexOfNextMeeting = indexOfMeetingAfter(aRoom, iClock->datetime() );
  
        // if there is no meeting, then status is Free; otherwise Busy
 -      Room::Status status = ( indexOfCurrentMeeting == -1 ) ? Room::FreeStatus : Room::BusyStatus;
 +      Room::Status
 +                      status =
 +                                      (indexOfCurrentMeeting == -1 ) ? Room::FreeStatus : Room::BusyStatus;
        // if room is Busy, then check end time, otherwise...
 -      QTime until = ( status == Room::BusyStatus ) ? iMeetings.at( indexOfCurrentMeeting )->endsAt().time() :
 -                        // ...if there is meeting following on the same day then check end time, otherwise end is the of the working day
 -                        (( indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay );
 +      QTime until = (status == Room::BusyStatus ) ? iMeetings.at( indexOfCurrentMeeting )->endsAt().time() :
 +      // ...if there is meeting following on the same day then check end time, otherwise end is the of the working day
 +      ((indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay );
  
        //currently works only for deafult room
 -      if( aRoom->equals( *(defaultRoom() ) ) )
 -              iWindowManager->roomStatusChanged( aRoom, status, until );
 +      if (aRoom->equals( *(defaultRoom() )) )
 +              iWindowManager->roomStatusChanged(aRoom, status, until);
  }
  
  void Engine::fetchMeetings()
  {
        Room *room = defaultRoom();
        qDebug() << "Engine::fetchMeetings for " << room->name();
 -      fetchMeetings( iClock->datetime(), iClock->datetime().addDays( 7 ), room );
 +      fetchMeetings(iClock->datetime(), iClock->datetime().addDays( 7), room);
  }
  
 -void Engine::fetchMeetingDetails( Meeting *aMeeting )
 +void Engine::fetchMeetingDetails(Meeting *aMeeting)
  {
        qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
 -      iWindowManager->showProgressBar( tr("Please Wait"), true );
 -      iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") );
 -      connect( iWindowManager,
 -                       SIGNAL( progressBarCancelled() ),
 -                       this,
 -                       SLOT( fetchMeetingDetailsCancelled() )
 -                      );
 -      iCommunication->fetchMeetingDetails( *aMeeting );
 +      iWindowManager->showProgressBar(tr("Please Wait"), true);
 +      iWindowManager->updateProgressBar(tr("Fetching Meeting Details...") );
 +      connect(iWindowManager, 
 +      SIGNAL( progressBarCancelled() ), this, 
 +      SLOT( fetchMeetingDetailsCancelled() ));
 +      iCommunication->fetchMeetingDetails( *aMeeting);
  }
  
 -bool Engine::isMeetingInList( const QList<Meeting*> &aList, const Meeting *aMeeting )
 +bool Engine::isMeetingInList(const QList<Meeting*> &aList, const Meeting *aMeeting)
  {
 -      qDebug() << "Engine::isMeetingInList( const QList<Meeting*> &, const Meeting * )";
 -      for ( int i = 0; i < aList.count(); i++ )
 +      qDebug()
 +                      << "Engine::isMeetingInList( const QList<Meeting*> &, const Meeting * )";
 +      for (int i = 0; i < aList.count(); i++)
        {
 -              if ( aMeeting->equals( *(aList.at( i )) ) )
 +              if (aMeeting->equals( *(aList.at(i))) )
                {
                        return true;
                }
        return false;
  }
  
 -void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
 +void Engine::meetingsFetched(const QList<Meeting*> &aMeetings)
  {
        qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
        // check if there is any new meeting in the list came from the server -> added
 -      for ( int i = 0; i < aMeetings.count(); i++ )
 +      for (int i = 0; i < aMeetings.count(); i++)
        {
                // if the (i)th meeting is not in the local meeting list
 -              if ( !isMeetingInList( iMeetings, aMeetings.at( i ) ) )
 +              if ( !isMeetingInList(iMeetings, aMeetings.at(i) ) )
                {
                        // add to the local database =)
                        Meeting* m = new Meeting( *(aMeetings.at( i )) );
 -                      iMeetings.append( m );
 +                      iMeetings.append(m);
                        // and signal the changes
 -                      iWindowManager->insertMeeting( m );
 +                      iWindowManager->insertMeeting(m);
                }
        }
  
        // check if there is any meeting NOT in the list came from the server -> deleted
 -      for ( int i = 0; i < iMeetings.count(); i++ )
 +      for (int i = 0; i < iMeetings.count(); i++)
        {
                // if the (i)th meeting is in the local but NOT in the server's meeting list
 -              if ( !isMeetingInList( aMeetings, iMeetings.at( i ) ) )
 +              if ( !isMeetingInList(aMeetings, iMeetings.at(i) ) )
                {
 -                      Meeting* m = iMeetings.takeAt( i );
 +                      Meeting* m = iMeetings.takeAt(i);
                        // signal the changes
 -                      iWindowManager->deleteMeeting( m );
 +                      iWindowManager->deleteMeeting(m);
                        // delete the meeting from the local list
                        delete m;
                }
        }
  
        // refresh room status info
 -      roomStatusInfoNeeded( defaultRoom() );
 +      roomStatusInfoNeeded(defaultRoom() );
  }
  
 -void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting )
 +void Engine::meetingDetailsFetched(Meeting &aDetailedMeeting)
  {
        qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
        iWindowManager->closeProgressBar();
 -      iWindowManager->showMeetingInfo( &aDetailedMeeting );
 +      iWindowManager->showMeetingInfo( &aDetailedMeeting);
  }
  
 -void Engine::errorHandler( int aCode, const QString &aAddInfo )
 +void Engine::errorHandler(int aCode, const QString &aAddInfo)
  {
        qDebug() << "Engine::ErrorHandler, aCode: " << aCode;
        // inform UI about the problem
-       if (aCode >= 100 && aCode <= 150)
+       if( aCode >= 100 && aCode <= 150 ) { //communication errors
+               //we don't want these to close operation changing
                qDebug() << "CommunicationManager signaled an error:" << aCode;
-       iWindowManager->closeProgressBar();
+               iWindowManager->closeProgressBar();
+       }
 -      iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
 +      iWindowManager->error(ErrorMapper::codeToString(aCode, aAddInfo) );
  }
  
 -void Engine::currentRoomChanged( Room *aCurrentRoom )
 +void Engine::currentRoomChanged(Room *aCurrentRoom)
  {
        qDebug() << "Engine::currentRoomChanged to " << aCurrentRoom->name();
 -      QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() );
 -      QDateTime to( from.addDays( 8 ) );
 -      fetchMeetings( from, to, aCurrentRoom );
 +      QDateTime from(iWindowManager->weeklyView()->beginnigOfShownWeek() );
 +      QDateTime to(from.addDays( 8) );
 +      fetchMeetings(from, to, aCurrentRoom);
  }
  
 -void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn )
 +void Engine::fetchMeetings(const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn)
  {
 -      qDebug() << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
 -      iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
 +      qDebug()
 +                      << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
 +      iCommunication->fetchMeetings(aFrom, aUntil, *aIn);
  }
  
 -void Engine::shownWeekChanged( QDate aFrom )
 +void Engine::shownWeekChanged(QDate aFrom)
  {
        qDebug() << "Engine::shownWeekChanged( QDate )";
 -      QDateTime from( aFrom );
 -      QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) );
 -      qDebug() << "Engine::shownWeekChanged " << aFrom.toString( "d.m. h:mm" ) << " to " << to.toString( "d.m. h:mm" );
 -      fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
 +      QDateTime from(aFrom);
 +      QDateTime to(aFrom.addDays( 7), QTime( 23, 59) );
 +      qDebug() << "Engine::shownWeekChanged " << aFrom.toString("d.m. h:mm")
 +                      << " to " << to.toString("d.m. h:mm");
 +      fetchMeetings(from, to, iWindowManager->weeklyView()->currentRoom() );
  }
  
 -void Engine::changeModeOrdered( DeviceManager::OperationMode aMode )
 -{     
 +void Engine::changeModeOrdered(DeviceManager::OperationMode aMode)
 +{
        qDebug() << "Engine::changeModeOrdered( DeviceManager::OperationMode )";
        QString message = tr( "You are about to change operation mode to %1." )
 -                              .arg( iDevice->operationModeToString( aMode ) );
 -      
 -      iWindowManager->showPasswordDialog( iConfiguration->adminPassword(), message );
 +      .arg(iDevice->operationModeToString(aMode) );
 +
 +      iWindowManager->showPasswordDialog(iConfiguration->adminPassword(), message);
  }
  
 -void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
 +void Engine::passwordEntered(PasswordDialog::PasswordStatus aPasswordStatus)
  {
        qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
        iWindowManager->closePasswordDialog();
 -      
 -      switch ( aPasswordStatus )
 +
 +      switch (aPasswordStatus)
        {
 -              case PasswordDialog::Correct :
 +              case PasswordDialog::Correct:
                {
-                       iWindowManager->showProgressBar("Changing current operation mode.", true);
-                       connect(iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ));
+                       iAutoRefresh->stop(); //we stop the metting updating
+                       iWindowManager->showProgressBar( "Changing current operation mode." );
 +                      connect(iDevice, SIGNAL( changingMode( const QString & ) ), iWindowManager, SLOT( updateProgressBar( const QString & ) ));
-                       connect(iDevice, SIGNAL( changingModeFailed() ), this, SLOT( progressBarCancelled() ));
+                       connect( iDevice, SIGNAL( changingMode( const QString & ) ),
+                                       iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+                       connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
 -                      iDevice->changeMode( true );
 +                      iDevice->changeMode( true);
                        break;
                }
 -              case PasswordDialog::Incorrect :
 +              case PasswordDialog::Incorrect:
                {
 -                      iWindowManager->error( tr( "Incorrect password." ) );
 -                      iDevice->changeMode( false );
 +                      iWindowManager->error(tr("Incorrect password.") );
 +                      iDevice->changeMode( false);
                        break;
                }
 -              default : //case PasswordDialog::Canceled
 +              default: //case PasswordDialog::Canceled
                {
 -                      iDevice->changeMode( false );
 +                      iDevice->changeMode( false);
                }
        }
  }
  
- void Engine::progressBarCancelled()
+ void Engine::changeModeFailed()
  {
-       qDebug() << "Engine::progressBarCancelled()";
-       //TODO: cancel the on-going event
+       qDebug() << "Engine::changeModeFailed()";
        iWindowManager->closeProgressBar();
-       iDevice->changeMode( false);
+       iAutoRefresh->start(); //we start the metting updating
  }
  
  void Engine::fetchMeetingDetailsCancelled()
@@@ -120,17 -120,17 +120,17 @@@ private slots
         * \param aPasswordStatus The status of the password.
         */
        void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
-       //! Slot for receiving the cancel event of the progress bar.
+       //! Slot for receiving the failure event of operation mode changing.
        /*!
-        * Slot. Receives the cancel event of the progress bar.
+        * Slot. Receives the failure event of operation mode changing.
         */
-       void progressBarCancelled();
+       void changeModeFailed();
        //! Slot for receiving the cancel event of the progress bar.
        /*!
         *  Receives the cancel event of the progress bar when meeting details requested.
         */
        void fetchMeetingDetailsCancelled();
 -      
 +
  private:
        //! Provides the index of the Meeting instance which is at the specified time.
        /*!
         * \param aIn The room which meetings need to be fetched.
         */
        void fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn );
 -
 +      
  private:
        static QTime endOfTheDay;
  
@@@ -88,7 -88,7 +88,7 @@@ void WindowManager::roomStatusChanged( 
  void WindowManager::showRoomStatus()
  {
        qDebug() << "WindowManager::showRoomStatus";
 -
 +      iWeeklyView->setDefaultRoom();
        if ( iRoomStatusView == 0 )
        {
                emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
@@@ -190,7 -190,8 +190,8 @@@ void WindowManager::showProgressBar( co
                iProgressBar = new ProgressBar( aText, aCancellable );
                iProgressBar->setFixedSize( 600, 125 );
                iProgressBar->show();
-               connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
+               if( aCancellable )
+                       connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
        }
        
        //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );