Merge branch 'master' into dev_local
authorZoltan Papp <zoltan.papp@ixonos.com>
Thu, 28 May 2009 10:08:16 +0000 (13:08 +0300)
committerZoltan Papp <zoltan.papp@ixonos.com>
Thu, 28 May 2009 10:08:16 +0000 (13:08 +0300)
Conflicts:
src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/UserInterface/WindowManager.h

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

  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
  
+ // Macro to help deleting objects. This could be global.
+ #define QT_DELETE(X) \
+       if ( X != 0 ) \
+       { \
+               delete X; \
+               X = 0; \
+       }
  Engine::Engine() :
-       iClock( 0), iConfiguration(Configuration::instance() ), iCommunication( 0)
+               iClock( 0 ), iConfiguration( 0 ), iCommunication( 0 ),
+               iWindowManager( 0 ), iUIManager( 0 )
  {
        qDebug() << "Engine::Engine()";
 +      iCommunicationFailed = false;
-       // if reading of configuration fails, signal that initialization failed
-       if (iConfiguration == 0)
-       {
-               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 ) ));
-       // 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& ) ));
+       
+       initConfiguration();
+       initDevice();
+       initCommunication();
+       initUserInterface();
+       
        //initialize idle time counter
        iIdleTimeCounter = new QTimer();
        iIdleTimeCounter->setSingleShot( true);
@@@ -209,158 -188,166 +189,179 @@@ void Engine::fetchMeetingDetails( Meeti
        connect(iWindowManager, 
        SIGNAL( progressBarCancelled() ), this, 
        SLOT( fetchMeetingDetailsCancelled() ));
-       iCommunication->fetchMeetingDetails( *aMeeting);
+       iCommunication->fetchMeetingDetails( *aMeeting); */
+       iCommunication->fetchMeetingDetails( *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++)
-       {
-               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*> & )";
 -      
 -      for ( int i = 0; i < iMeetings.count(); ++i ) {
 +      if( iCommunicationFailed )
 +      {
 +              iCommunicationFailed = false;
-               //iWindowManager->connectionEstablished();
++              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++)
++      for ( int i = 0; i < iMeetings.count(); ++i ) 
 +      {
-               // if the (i)th meeting is not in the local meeting list
-               if ( !isMeetingInList(iMeetings, aMeetings.at(i) ) )
-               {
-                       // add to the local database =)
-                       Meeting* m = new Meeting( *(aMeetings.at( i )) );
-                       iMeetings.append(m);
-                       // and signal the changes
-                       iWindowManager->insertMeeting(m);
-               }
+               Meeting* m = iMeetings.takeAt( i );
+               delete m;
+       }
+       iMeetings.clear();
+       for ( int i = 0; i < aMeetings.count(); ++i ) {
+               Meeting* m = new Meeting( *( aMeetings.at( i ) ) );
+               iMeetings.append( m );
        }
  
-       // check if there is any meeting NOT in the list came from the server -> deleted
-       for (int i = 0; i < iMeetings.count(); i++)
+       // refresh room status info
+       roomStatusInfoNeeded( defaultRoom() );
+ }
+ void Engine::errorHandler( int aCode, const QString &aAddInfo )
+ {     
++      if( aCode >= 100 && aCode < 150 )
 +      {
-               // if the (i)th meeting is in the local but NOT in the server's meeting list
-               if ( !isMeetingInList(aMeetings, iMeetings.at(i) ) )
-               {
-                       Meeting* m = iMeetings.takeAt(i);
-                       // signal the changes
-                       iWindowManager->deleteMeeting(m);
-                       // delete the meeting from the local list
-                       delete m;
-               }
++              iCommunicationFailed = true;
++              //TODO: Call window manager
++              //if ( iWindowManager != 0 ) iWindowManager->connectionLost();
++      }
+       if ( iWindowManager != 0 )
+       {
+               iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
        }
+ }
  
-       // refresh room status info
-       roomStatusInfoNeeded(defaultRoom() );
+ 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);
  }
  
- void Engine::meetingDetailsFetched(Meeting &aDetailedMeeting)
+ void Engine::cancelFetchMeetingDetails()
  {
-       qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
-       iWindowManager->closeProgressBar();
-       if( iCommunicationFailed )
+       iCommunication->cancelFetchMeetingDetails();
+ }
+ void Engine::shownWeekChanged( QDate aFrom )
+ {
+       qDebug() << "[Engine::shownWeekChanged] <Invoked>";
+       QDateTime from( aFrom );
+       QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) );
+       qDebug() << "[Engine::shownWeekChanged] <From " << aFrom.toString( "d.m. h:mm" ) << " to " << to.toString( "d.m. h:mm" ) << ">";
+       iCommunication->fetchMeetings( from, to, *defaultRoom() );
+ //    fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
+ }
+ void Engine::changeDeviceMode( bool aChange )
+ {
+       if ( aChange )
++      }
        {
-               iCommunicationFailed = false;
-               iWindowManager->connectionEstablished();
+               connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( changeModeFailed() ) );
+               iAutoRefresh->stop(); // Stop the meeting update
        }
-       iWindowManager->showMeetingInfo( &aDetailedMeeting);
+       iDevice->changeMode( aChange );
  }
  
- void Engine::errorHandler(int aCode, const QString &aAddInfo)
+ void Engine::changeModeFailed()
  {
-       qDebug() << "Engine::ErrorHandler, aCode: " << aCode;
-       // inform UI about the problem
-       if( aCode >= 100 && aCode <= 150 ) { //communication errors
+       qDebug() << "Engine::progressBarCancelled()";
+       iDevice->changeMode( false );
+       iAutoRefresh->start(); //we start the metting updating
+ }
+ void Engine::initUserInterface()
+ {
+       qDebug() << "[Engine::initUserInterface] <Invoked>";
+       
+       // Initialize the window manager and connect what ever signals can be connected
+       iWindowManager = new WindowManager;
+       // Create the UIManager which internally handles most of the UI actions
+       iUIManager = new UIManager( this, iWindowManager );
+       
+       connect( iWindowManager, SIGNAL( eventDetected() ), this, SLOT( handleViewEvent() ) );
+       connect( iWindowManager, SIGNAL( previousViewRestored() ), iUIManager, SLOT( previousViewRestored() ) );
+       connect( iWindowManager, SIGNAL( dialogActivated() ), this, SLOT( dialogActivated() ) );
+       connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
+       
+       // Show the UI
+       iWindowManager->setWindowState( Qt::WindowMaximized );
+       iWindowManager->show();
+       iUIManager->showMainView();
+       
+       qDebug() << "[Engine::initUserInterface] <Finished>";
+ }
+ void Engine::handleViewEvent()
+ {
+       if ( iIdleTimeCounter != 0 )
        {
-               //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();
+               // Restart the idle time counter when view event is received
+               iIdleTimeCounter->stop();
+               iIdleTimeCounter->start();
        }
-       iWindowManager->error(ErrorMapper::codeToString(aCode, aAddInfo) );
  }
  
- void Engine::currentRoomChanged(Room *aCurrentRoom)
+ void Engine::initConfiguration()
  {
-       qDebug() << "Engine::currentRoomChanged to " << aCurrentRoom->name();
-       QDateTime from(iWindowManager->weeklyView()->beginnigOfShownWeek() );
-       QDateTime to(from.addDays( 8) );
-       fetchMeetings(from, to, aCurrentRoom);
+       iConfiguration = Configuration::instance();
+       if ( iConfiguration == 0 )
+       {
+               QTimer::singleShot( 0, this, SLOT( closeApplication() ) );
+       }
+       iCurrentRoom = iConfiguration->defaultRoom();
  }
  
- void Engine::fetchMeetings(const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn)
+ void Engine::connectSignals()
  {
-       qDebug()
-                       << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
-       iCommunication->fetchMeetings(aFrom, aUntil, *aIn);
+       // Connect engine objects signals to UIManager
+       connect( iClock, SIGNAL( tick( QDateTime ) ), iUIManager, SLOT( updateTime( QDateTime ) ) );
+       connect( iIdleTimeCounter, SIGNAL( timeout() ) , iUIManager, SLOT( roomStatusIndicatorRequested() ) );
+       
+       iUIManager->connectDeviceManager( iDevice );
+       iUIManager->connectCommunicationManager( iCommunication );
  }
  
- void Engine::shownWeekChanged(QDate aFrom)
+ void Engine::initCommunication()
  {
-       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() );
+       // 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*>& ) ) );
  }
  
- void Engine::changeModeOrdered(DeviceManager::OperationMode aMode)
+ void Engine::initDevice()
  {
-       qDebug() << "Engine::changeModeOrdered( DeviceManager::OperationMode )";
-       QString message = tr( "You are about to change operation mode to %1." )
-       .arg(iDevice->operationModeToString(aMode) );
+       // create device manager
+       iDevice = new DeviceManager( iConfiguration->startupSettings() );
+       connect( iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ) );  
+       iDevice->initDeviceManager();
+ }
  
-       iWindowManager->showPasswordDialog(iConfiguration->adminPassword(), message);
+ void Engine::dialogActivated()
+ {
+       if ( iIdleTimeCounter != 0 )
+       {
+               iIdleTimeCounter->stop();
+       }
  }
  
- void Engine::passwordEntered(PasswordDialog::PasswordStatus aPasswordStatus)
+ void Engine::dialogDeactivated()
  {
-       qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
-       iWindowManager->closePasswordDialog();
+       if ( iIdleTimeCounter != 0 )
+       {
+               iIdleTimeCounter->start();
+       }
+ }
  
-       switch (aPasswordStatus)
+ void Engine::previousViewRestored()
+ {
+       if ( iIdleTimeCounter != 0 )
        {
-               case PasswordDialog::Correct:
-               {
-                       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( changingMode( const QString & ) ),
-                                       iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
-                       connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
-                       iDevice->changeMode( true);
-                       break;
-               }
-               case PasswordDialog::Incorrect:
-               {
-                       iWindowManager->error(tr("Incorrect password.") );
-                       iDevice->changeMode( false);
-                       break;
-               }
-               default: //case PasswordDialog::Canceled
-               {
-                       iDevice->changeMode( false);
-               }
+               iIdleTimeCounter->start();
        }
  }
  
@@@ -181,7 -205,7 +205,8 @@@ private
  
        QList<Meeting*> iMeetings;
        
+       Room *iCurrentRoom;
 +      bool iCommunicationFailed;
  };
  
  #endif /*ENGINE_H_*/
@@@ -208,22 -121,8 +121,21 @@@ void WindowManager::error( const QStrin
        }
  }
  
- void WindowManager::updateProgressBar( const QString &aMessage )
+ void WindowManager::setFullscreen()
  {
-       qDebug() << "WindowManager::updateProgressBar( const QString & )";
-       if( iProgressBar != 0 )
-               iProgressBar->update( aMessage );
+       this->setWindowState( Qt::WindowFullScreen );
+       // Resize event handles the rest.
  }
 +
 +void WindowManager::connectionLost()
 +{
 +      //TODO: Inform all views
 +      qDebug() << "WindowManager::connectionLost()";
 +}
 +
 +void WindowManager::connectionEstablished()
 +{
 +      //TODO: Inform all views
 +      qDebug() << "WindowManager::connectionEstablished()";
 +}
 +
 -#ifndef WINDOWMANAGER_H_\r
 -#define WINDOWMANAGER_H_\r
 -\r
 -#include <QWidget>\r
 -#include <QStack>\r
 -\r
 -// Forward declarations\r
 -class ViewBase;\r
 -class QEvent;\r
 -class QSize;\r
 -class QDialog;\r
 -class QString;\r
 -\r
 -//! UserInterface class. Manages displayed views.\r
 -/*!\r
 - * UserInterface class. WindowManager class is responsible for displaying views that inherit the\r
 - * ViewBase class. It also handles dialog showing. Depending on the views type the WindowManager\r
 - * can track the views events and restore previous view if the current on is ObservedView. This\r
 - * is a handy mechanism for screensaver etc.\r
 - */\r
 -class WindowManager : public QWidget\r
 -{\r
 -      Q_OBJECT\r
 -\r
 -public:\r
 -      //! Constructor.\r
 -      /*!\r
 -       * Constructor of WindowManager.\r
 -       */\r
 -      WindowManager( QWidget *aParent = 0 );\r
 -      //! Destructor.\r
 -      virtual ~WindowManager();\r
 -      \r
 -      virtual bool event(QEvent *event);\r
 -\r
 -signals:\r
 -      //! Request current status of the room.\r
 -      /*!\r
 -       * Signal is emitted when there is need to check current status of room aRoom.\r
 -       * \param aRoom Meetingroom which status is requested.\r
 -       */\r
 -      void eventDetected();\r
 -      \r
 -      //! The view size is changed.\r
 -      /*!\r
 -       * This signal is emitted when the window managers view changes,\r
 -       * i.e. it received resized QEvent.\r
 -       * \param The new view size.\r
 -       */\r
 -      void viewResized(const QSize &newSize, const QSize &oldSize);\r
 -      \r
 -      //! Previous view is restored.\r
 -      /*!\r
 -       * This signal is emitted when previously stored view is\r
 -       * restored. This happens when view with type ViewMode::ObservedView\r
 -       * is shown and it receives an event that initiates the view\r
 -       * restoring chain.\r
 -       */\r
 -      void previousViewRestored();\r
 -      \r
 -      void dialogActivated();\r
 -      void dialogDeactivated();\r
 -\r
 -public slots:\r
 -      //! Shows the view.\r
 -      /*!\r
 -       * Show view that inherits ViewBase class. If the views parent is not\r
 -       * the WindowManager it will changed within this method. Depeding on the\r
 -       * views type the currently active view might be stored and restored\r
 -       * when specific event occurs in the view to be displayed.\r
 -       */\r
 -      void showView( ViewBase *view );\r
 -      \r
 -      //! Shows modal dialog.\r
 -      /*!\r
 -       * Shows modal dialog. Emits dialogActivated() signal prior calling\r
 -       * QDialog's exec() method and emits dialogDeactivated signal when\r
 -       * the exec() method returns.\r
 -       */\r
 -      void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );\r
 -      \r
 -      //! View event is detected.\r
 -      /*!\r
 -       * WindowManager connects this slot to ViewBase classes eventDetected()\r
 -       * signal and either emits eventDetected() signal if the current views\r
 -       * type is ViewMode::NormalView or restores possible previous view\r
 -       * if the current views type is ViewMode::ObservedView.\r
 -       */\r
 -      void viewEventDetected();\r
 -      \r
 -      void setFullscreen();\r
 -      \r
 -      void error( const QString &aErrorMessage );\r
 -\r
 -private:\r
 -      //! Name of the application.\r
 -      QString iApplicationName;\r
 -      \r
 -      //! Currently active view.\r
 -      ViewBase *iCurrentView;\r
 -      \r
 -      //! Stack of views previously displayed.\r
 -      QStack<ViewBase *> iViewList;\r
 -\r
 -};\r
 -\r
 -#endif /*WINDOWMANAGER_H_*/\r
 +#ifndef WINDOWMANAGER_H_
 +#define WINDOWMANAGER_H_
 +
- #include <QObject>
- #include <QTime>
- #include "Room.h"
- #include "Meeting.h"
- #include "PasswordDialog.h"
- #include "DeviceManager.h"
++#include <QWidget>
++#include <QStack>
 +
- class QTimer;
- class RoomStatusIndicatorWidget;
- class WeeklyViewWidget;
- class Engine;
- class MeetingInfoDialog;
- class SettingsView;
- class ProgressBar;
- class Configuration;
++// Forward declarations
++class ViewBase;
++class QEvent;
++class QSize;
++class QDialog;
++class QString;
 +
- //! UserInterface class. Behaves as a proxy between the user interface and application's business logic.
++//! UserInterface class. Manages displayed views.
 +/*!
-  * UserInterface class. Controls the whole user interface, starting with displaying the appropriate
-  * views. It behaves as a proxy between the user interface and application's business logic, it connects
-  * the specified components together and forwards the data to the correct place. It also manages the correct
-  * appearance of current views on the screen.
++ * UserInterface class. WindowManager class is responsible for displaying views that inherit the
++ * ViewBase class. It also handles dialog showing. Depending on the views type the WindowManager
++ * can track the views events and restore previous view if the current on is ObservedView. This
++ * is a handy mechanism for screensaver etc.
 + */
- class WindowManager : public QObject
++class WindowManager : public QWidget
 +{
 +      Q_OBJECT
 +
 +public:
 +      //! Constructor.
 +      /*!
 +       * Constructor of WindowManager.
-        * \param aConfiguration The pointer to configuration.
 +       */
-       WindowManager( Configuration *aConfiguration );
++      WindowManager( QWidget *aParent = 0 );
 +      //! Destructor.
 +      virtual ~WindowManager();
-       /*!
-        * Displays an error message
-        * \param aErrorMessage Message to be displayd
-        */
-       void error( const QString &aErrorMessage );
-       //! Updates the rooms status.
-       /*! 
-        * Forwards the signal of changed status to current view.
-        * \param aRoom Room which status is changed.
-        * \param aStatus Current status of room.
-        * \param aTime Time when status is changed.
-        */
-       void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime );
-       //! Shows the password dialog.
-       /*!
-        * Shows the password dialog.
-        * \param aAdminPassword The correct password.
-        * \param aMessage The message to be shown in the password dialog.
-        */
-       void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage );
-       //! Closes the password dialog.
-       /*!
-        * Closes the password dialog.
-        */
-       void closePasswordDialog();
-       //! Displays the weekly view.
-       /*!
-        * Displays the weekly view.
-        */
-       void showWeeklyView();
-       //! Displays the meeting info dialog.
-       /*!
-        * Displays the meeting info dialog. 
-        * \param aMeeting Meeting to be displayd
-        */
-       void showMeetingInfo( Meeting *aMeeting );
-       //! Returns the pointer to the weekly view. 
-       /*!
-        * Returns the pointer to the weekly view.
-        */
-       WeeklyViewWidget * weeklyView();
-       //! Switches the views to full screen.
-       /*!
-        * Switches the views to full screen.
-        */
-       void fullScreen();
-       //! Shows the progress bar.
-       /*!
-        * Starts showing the progress bar.
-        * \param aText The text to be shown in progress bar.
-        *  \param aCancellable Is the Cancel button visible. By default not visible.
-        */
-       void showProgressBar( const QString &aText, bool aCancellable = false );
-       //! Closes the progress bar.
-       /*!
-        * Closes the progress bar.
-        */
-       void closeProgressBar();
-       
-       void insertMeeting( Meeting *aMeeting );
 +      
-       void deleteMeeting( Meeting *aMeeting );
++      virtual bool event(QEvent *event);
++
 +      
 +      //! Shows any view specific indicators for connection error
 +      void connectionLost();
 +      
 +      //! Removes any view specific indicators for connection error
 +      void connectionEstablished();
 +
 +signals:
 +      //! Request current status of the room.
 +      /*!
 +       * Signal is emitted when there is need to check current status of room aRoom.
 +       * \param aRoom Meetingroom which status is requested.
 +       */
-       void roomStatusInfoNeeded( Room *aRoom );
-       //! Indicate that some user event has happened.
-       /*!
-        * Signal is emitted if some user event has happened.
-        */
-       void observedEventDetected();
-       //! Meeting activated.
-       /*!
-        * Signal is emitted when a meeting is clicked by the user.
-        * \param aMeeting actived meeting.
-        */
-       void meetingActivated( Meeting *aMeeting );
-       //! Signals if the shown week has been changed.
-       /*!
-        * Signal. Emitted if the shown week has been changed.
-        * \param aDate The first date of the shown week.
-        */
-       void shownWeekChanged( QDate aDate );
-       //! Signals change of the meeting room.
++      void eventDetected();
++      
++      //! The view size is changed.
 +      /*!
-        * Signal is emitted when meeting room is changed.
-        * \param aRoom Selected meeting room.
++       * This signal is emitted when the window managers view changes,
++       * i.e. it received resized QEvent.
++       * \param The new view size.
 +       */
-       void currentRoomChanged( Room *aRoom );
-       //! Signals when the password dialog buttons are clicked.
++      void viewResized(const QSize &newSize, const QSize &oldSize);
++      
++      //! Previous view is restored.
 +      /*!
-        * Signal is emitted when the password dialog buttons are clicked.
-        * \param aPasswordStatus The status of the password.
++       * This signal is emitted when previously stored view is
++       * restored. This happens when view with type ViewMode::ObservedView
++       * is shown and it receives an event that initiates the view
++       * restoring chain.
 +       */
-       void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
-       //! Signals when the cancel button in the progress bar is clicked.
++      void previousViewRestored();
++      
++      void dialogActivated();
++      void dialogDeactivated();
++
++public slots:
++      //! Shows the view.
 +      /*!
-        * Signal is emitted when the cancel button in the progress bar is clicked.
++       * Show view that inherits ViewBase class. If the views parent is not
++       * the WindowManager it will changed within this method. Depeding on the
++       * views type the currently active view might be stored and restored
++       * when specific event occurs in the view to be displayed.
 +       */
-       void progressBarCancelled();
++      void showView( ViewBase *view );
 +      
- public slots:
-       //! Slot for displaying the screensaver (room status view).
++      //! Shows modal dialog.
 +      /*!
-        * Slot. Displays the screensaver.
++       * Shows modal dialog. Emits dialogActivated() signal prior calling
++       * QDialog's exec() method and emits dialogDeactivated signal when
++       * the exec() method returns.
 +       */
-       void showRoomStatus();
-       //! Slot for updating the time.
++      void showDialog( QDialog *aDialog, bool blocking = true, bool aSendSignal = true );
++      
++      //! View event is detected.
 +      /*!
-        * Slot. Forwards the signal of changed time to current view.
-        * \param aCurrentDateTime Current date and time.
++       * WindowManager connects this slot to ViewBase classes eventDetected()
++       * signal and either emits eventDetected() signal if the current views
++       * type is ViewMode::NormalView or restores possible previous view
++       * if the current views type is ViewMode::ObservedView.
 +       */
-       void distributeDateTimeInfo( QDateTime aCurrentDateTime );
++      void viewEventDetected();
 +      
-       void updateProgressBar( const QString &aMessage );
++      void setFullscreen();
 +      
- private slots:
-       //! Displays the settings view
-       void showSettingsView();
++      void error( const QString &aErrorMessage );
 +
 +private:
 +      //! Name of the application.
 +      QString iApplicationName;
-       //! Defines whether the views should be shown as full screen 
-       bool iFullScreen;
-       //! Pointer to the configuration.
-       Configuration *iConfiguration;
-       //! Pointer to the weekly view.
-       WeeklyViewWidget *iWeeklyView;
-       //! Pointer to the screensaver (room status view).
-       RoomStatusIndicatorWidget *iRoomStatusView;
-       //! Pointer to the meeting info dialog
-       MeetingInfoDialog *iMeetingInfo;
-       //! Pointer to the settings view
-       SettingsView *iSettingsView;
-       //! Pointer to the progress bar
-       ProgressBar *iProgressBar;
-       //! Pointer to the password dialog.
-       PasswordDialog *iPasswordDialog;
++      
++      //! Currently active view.
++      ViewBase *iCurrentView;
++      
++      //! Stack of views previously displayed.
++      QStack<ViewBase *> iViewList;
 +
 +};
 +
 +#endif /*WINDOWMANAGER_H_*/