Merge branch 'master' into dev_local
authorZoltan Papp <zoltan.papp@ixonos.com>
Tue, 26 May 2009 11:50:09 +0000 (14:50 +0300)
committerZoltan Papp <zoltan.papp@ixonos.com>
Tue, 26 May 2009 11:50:09 +0000 (14:50 +0300)
Conflicts:
src/BusinessLogic/Engine.cpp

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

@@@ -22,7 -22,6 +22,7 @@@ Engine::Engine() 
                iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 )
  {
        qDebug() << "Engine::Engine()";
 +      iCommunicationFailed = false;
        // if reading of configuration fails, signal that initialization failed
        if ( iConfiguration == 0 )
        {
@@@ -234,12 -233,6 +234,12 @@@ bool Engine::isMeetingInList( const QLi
  void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
  {
        qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
 +      if( iCommunicationFailed )
 +      {
 +              iCommunicationFailed = false;
 +              //iWindowManager->connectionEstablished();
 +      }
 +
        // check if there is any new meeting in the list came from the server -> added
        for ( int i = 0; i < aMeetings.count(); i++ )
        {
@@@ -276,11 -269,6 +276,11 @@@ void Engine::meetingDetailsFetched( Mee
  {
        qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
        iWindowManager->closeProgressBar();
 +      if( iCommunicationFailed )
 +      {
 +              iCommunicationFailed = false;
 +              iWindowManager->connectionEstablished();
 +      }
        iWindowManager->showMeetingInfo( &aDetailedMeeting );
  }
  
@@@ -288,17 -276,11 +288,19 @@@ void Engine::errorHandler( int aCode, c
  {
        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;
 +              if( !iCommunicationFailed )
 +              {
 +                      // Only inform window manager when first error appears
 +                      iCommunicationFailed = true;
 +                      //iWindowManager->connectionLost();
 +              }
 +      }
-       iWindowManager->closeProgressBar();
+               iWindowManager->closeProgressBar();
+       }
        iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
  }
  
@@@ -343,10 -325,11 +345,11 @@@ void Engine::passwordEntered( PasswordD
        {
                case PasswordDialog::Correct :
                {
+                       iAutoRefresh->stop(); //we stop the metting updating
                        iWindowManager->showProgressBar( "Changing current operation mode." );
-                       connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
                        connect( iDevice, SIGNAL( changingMode( const QString & ) ),
                                        iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+                       connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
                        iDevice->changeMode( true );
                        break;
                }
        }
  }
  
- 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,11 -120,11 +120,11 @@@ 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.
@@@ -180,8 -180,6 +180,8 @@@ private
        QTimer *iAutoRefresh;
  
        QList<Meeting*> iMeetings;
 +      
 +      bool iCommunicationFailed;
  };
  
  #endif /*ENGINE_H_*/
@@@ -188,8 -188,10 +188,10 @@@ void WindowManager::showProgressBar( co
        qDebug() << "WindowManager::showProgressBar( const QString & )";
        if( iProgressBar == 0 ) {
                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() ) );
@@@ -212,16 -214,3 +214,16 @@@ void WindowManager::updateProgressBar( 
        if( iProgressBar != 0 )
                iProgressBar->update( aMessage );
  }
 +
 +void WindowManager::connectionLost()
 +{
 +      //TODO: Inform all views
 +      qDebug() << "WindowManager::connectionLost()";
 +}
 +
 +void WindowManager::connectionEstablished()
 +{
 +      //TODO: Inform all views
 +      qDebug() << "WindowManager::connectionEstablished()";
 +}
 +