Merge branch 'master' of https://git.maemo.org/projects/qtmeetings
authoritkonma <marko.itkonen@ixonos.com>
Mon, 1 Jun 2009 06:09:24 +0000 (09:09 +0300)
committeritkonma <marko.itkonen@ixonos.com>
Mon, 1 Jun 2009 06:09:24 +0000 (09:09 +0300)
Conflicts:
src/BusinessLogic/UIManager.h

17 files changed:
resources/xml/errortable.xml
src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/BusinessLogic/UIManager.cpp
src/BusinessLogic/UIManager.h
src/IO/Communication/CommunicationManager.cpp
src/IO/DeviceControl/DeviceConfigurator.cpp
src/IO/DeviceControl/DeviceManager.cpp
src/IO/DeviceControl/DeviceManager.h
src/IO/DeviceControl/HWKeyListener.cpp
src/IO/DeviceControl/OperationModeToggler.cpp
src/UserInterface/Utils/PasswordDialog.cpp
src/UserInterface/Utils/PasswordDialog.h
src/UserInterface/Utils/ProgressBar.cpp
src/UserInterface/Utils/ProgressBar.h
src/UserInterface/Views/RoomStatusIndicatorWidget.cpp
src/UserInterface/Views/RoomStatusIndicatorWidget.h

index 4706fce..841228a 100644 (file)
     <error code="110">Communication error</error>
     <error code="111">Communication: Invalid username or password</error>
     <error code="200">Device Control: Error creating internal file storage.</error>
-    <error code="201">Failed to change the operation mode. Error removing old alarm events.</error>
-       <error code="202">Failed to change the operation mode. Error sending alarm events. %1</error>
-       <error code="203">Failed to change the operation mode. Error storing data about sent alarm events. Removing the already sent alarm events.</error>
-       <error code="204">Error storing data of original automatic screen switching-off and dimming parameter values. Using the default values instead.</error>
-       <error code="205">Error fetching data of original automatic screen switching-off and dimming parameter values. Using the default values instead.</error>
-       <error code="206">Failed to change the operation mode. Error changing automatic screen switching-off and dimming parameter values.</error>
-       <error code="207">Failed to change the operation mode. Error fetching data of original hardware key settings.</error>
-       <error code="208">Failed to change the operation mode. Error storing data of original hardware key settings.</error>
-       <error code="209">Failed to change the operation mode. Error changing hardware key settings.</error>
-       <error code="210">Failed to change the operation mode. Init script to auto launch the application was not installed/removed.</error>
-       <error code="211">Failed to change the operation mode. The application failed to know the current mode of itself.</error>
-       <error code="212">Failed to change the operation mode. The application failed to store the current mode of itself.</error>
-       <error code="213">Failed to change the operation mode. Error restarting the device. Restart device manually.</error>
+    <error code="201">Device Control: Error removing old alarm events.</error>
+       <error code="202">Device Control: Error sending alarm events. %1</error>
+       <error code="203">Device Control: Error storing data about sent alarm events. Removing the already sent alarm events.</error>
+       <error code="204">Device Control: Error storing data of original automatic screen switching-off and dimming parameter values. Used the default values instead.</error>
+       <error code="205">Device Control: Error fetching data of original automatic screen switching-off and dimming parameter values. Used the default values instead.</error>
+       <error code="206">Device Control: Error changing automatic screen switching-off and dimming parameter values.</error>
+       <error code="207">Device Control: Error fetching data of original hardware key settings.</error>
+       <error code="208">Device Control: Error storing data of original hardware key settings.</error>
+       <error code="209">Device Control: Error changing hardware key settings.</error>
+       <error code="210">Device Control: Init script to auto launch the application was not installed/removed.</error>
+       <error code="211">Device Control: The application failed to know the current mode of itself.</error>
+       <error code="212">Device Control: The application failed to store the current mode of itself.</error>
+       <error code="213">Device Control: Error restarting the device. Restart device manually to activate operation mode change.</error>
 </errors>
index 009dbdd..962da10 100644 (file)
@@ -240,20 +240,16 @@ void Engine::shownWeekChanged( QDate aFrom )
 //     fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
 }
 
-void Engine::changeDeviceMode( bool aChange )
+void Engine::changeDeviceMode()
 {
-       if ( aChange )
-       {
-               connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( changeModeFailed() ) );
-               iAutoRefresh->stop(); // Stop the meeting update
-       }
-       iDevice->changeMode( aChange );
+       connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
+       iAutoRefresh->stop(); // Stop the meeting update
+       iDevice->changeMode();
 }
 
 void Engine::changeModeFailed()
 {
        qDebug() << "Engine::progressBarCancelled()";
-       iDevice->changeMode( false );
        iAutoRefresh->start(); //we start the metting updating
 }
 
@@ -276,12 +272,15 @@ void Engine::initUserInterface()
        iWindowManager->show();
        iUIManager->showMainView();
        
+       // This triggers the meeting fetching
+       iUIManager->currentRoomChanged( this->iCurrentRoom );
+       
        qDebug() << "[Engine::initUserInterface] <Finished>";
 }
 
 void Engine::handleViewEvent()
 {
-       if ( iIdleTimeCounter != 0 )
+       if ( iIdleTimeCounter != 0 && iIdleTimeCounter->isActive())
        {
                // Restart the idle time counter when view event is received
                iIdleTimeCounter->stop();
@@ -369,5 +368,6 @@ void Engine::startIdleTimeCounter()
 
 void Engine::currentRoomChanged(Room *aRoom)
 {
+       qDebug() << "[Engine::currentRoomChanged] <invoked>";
        iCurrentRoom = aRoom;
 }
\ No newline at end of file
index 99992dd..dc538ec 100644 (file)
@@ -120,7 +120,7 @@ private slots:
        void stopIdleTimeCounter();
        void startIdleTimeCounter();
 
-       void changeDeviceMode( bool aChange );
+       void changeDeviceMode();
        
        void currentRoomChanged( Room *aRoom );
        
index ab1bad2..a25e1a7 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()
@@ -67,15 +63,6 @@ void UIManager::showMainView()
        iWindowManager->showView( iWeeklyView );
 }
 
-void UIManager::showProgressBar( QString aText )
-{
-       if ( iProgressBar != 0 )
-       {
-               iProgressBar->update( aText );
-               iWindowManager->showDialog( iProgressBar );
-       }
-}
-
 // ===============================================
 //             INITIALIZE THE UIMANAGER
 void UIManager::createWeeklyView()
@@ -108,15 +95,13 @@ void UIManager::createRoomStatusIndicator()
 
 void UIManager::createPasswordDialog()
 {
-       iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), tr("UIManager::createPasswordDialog"), tr("UIManager::createPasswordDialog") );
-       
+       iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), "", tr("Enter password") );
        connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
 }
 
 void UIManager::createProgressBar()
 {
        iProgressBar = new ProgressBar( tr("CHANGE THIS"), true );
-       
        // Connect to UIManager
        connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
        // Connect to Engine
@@ -178,9 +163,9 @@ void UIManager::showMeetingProgressBar( Meeting *aMeeting )
 {
        if ( iProgressBar != 0 )
        {
-               iProgressBar->update( tr("Fetching meeting info...") );
+               iProgressBar->update( tr( "Fetching meeting info..." ), tr( "Please wait" ) );
+               iProgressBar->toggleCancellable( true );
                iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
-               iEngine->stopIdleTimeCounter();
        }
 }
 
@@ -220,26 +205,25 @@ void UIManager::progressBarCancelled()
        if ( iProgressBar != 0 )
        {
                iProgressBar->close();
-               iEngine->startIdleTimeCounter();
        }
 }
 
 void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode )
 {
        qDebug() << "[UIManager::changeModeOrdered] <Invoked>";
-       
-       QString message = tr( "You are about to change operation mode to %1." )
-                               .arg( iEngine->iDevice->operationModeToString( aMode ) );
 
        if ( iPasswordDialog != 0 )
        {
-               // TODO : Set the new text for password dialog
+               QString text = tr( "You are about to change operation mode to %1." )
+                                               .arg( iEngine->iDevice->operationModeToString( aMode ) );
+               iPasswordDialog->update( text );
                iWindowManager->showDialog( static_cast<QDialog *>( iPasswordDialog ) );
        }
 }
 
 void UIManager::currentRoomChanged(Room *aRoom)
 {
+       qDebug() << "[UIManager::currentRoomChanged] <Invoked>";
        if ( iWeeklyView != 0 )
        {
                QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() );
@@ -264,15 +248,17 @@ void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus )
                        // Show the progress bar..
                        if ( iProgressBar != 0 )
                        {
-                               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
+                               iProgressBar->update( tr( "" ), tr( "Changing operation mode" ) );
+                               iProgressBar->toggleCancellable( false );
+                               iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
                        }
                        // ... and initiate the mode changing
-                       iEngine->changeDeviceMode( true );
+                       iEngine->changeDeviceMode();
                        break;
                case PasswordDialog::Incorrect:
                        iWindowManager->error( tr("Incorrect Password") );
+                       break;
                case PasswordDialog::Canceled:
-                       iEngine->changeDeviceMode( false );
                        break;
        }
        
index 0c40c2b..a350bd9 100644 (file)
@@ -18,6 +18,15 @@ class MeetingInfoDialog;
 class CommunicationManager;
 class QDateTime;
 
+//! User Interface manager class.
+/*!
+ * User Interface manager class that is responsible for handling
+ * UI actions. It creates the needed views and connects signals
+ * accordingly. All interactions with the UI is handled by this
+ * class. The Engine class handles the basic logic and does not
+ * know or care about the UI and this class does not know or care
+ * about the basic logic only UI related actions (signals, events etc.).
+ */
 class UIManager : public QObject
 {
        Q_OBJECT
@@ -26,27 +35,80 @@ public:
        UIManager( Engine *aEngine, WindowManager *aWindowManager );
        virtual ~UIManager();
        
+       //! Connects Device Managers signals.
+       /*!
+        * This method connects Device Managers signals directly to UI
+        * components or to it selft.
+        */
        void connectDeviceManager( DeviceManager *aDeviceManager );
+       //! Connects Communication Managers signals.
+       /*!
+        * This method connects Communication Managers signals directly to UI
+        * components or to it selft.
+        */
        void connectCommunicationManager( CommunicationManager *aCommunicationManager );
+       //! Shows the main view.
+       /*!
+        * Makes the main view visible trough WindowManager.
+        */
        void showMainView();
-       void showProgressBar( QString aText );
 
 signals:
        
 public slots:
 
+       //! Handles setting view request.
+       /*!
+        * Handles request to show settings view. Makes the
+        * view visible and stops the idle time counter.
+        */
        void settingsViewRequest();
+       //! Handles setting views ok clicked.
+       /*!
+        * Handles the setting views Ok button clicked
+        * signal. Sets the weekly view visible and starts
+        * the idle time counter.
+        */
        void settingsOkClicked();
+       //! Handles setting views cancel clicked.
+       /*!
+        * Handles the setting views Cancel button clicked
+        * signal. Sets the weekly view visible and starts
+        * the idle time counter.
+        */
        void settingsCancelClicked();
+       //! Handles room status indicator view request.
+       /*!
+        * Handles the request to show room status indicator
+        * view. Sets the view visible and stops the idle
+        * time counter. The WindowManager handles restoring
+        * what ever view was previously visible.
+        */
        void roomStatusIndicatorRequested();
+       //! Handles previousViewRestored signal.
+       /*!
+        * Handles the restoring of previous view. This is usually
+        * signaled by WindowManager when room status indicator
+        * view is being hidden.
+        */
        void previousViewRestored();
+       //! Handle change mode order.
+       /*!
+        * Handles change mode order. Displays the password query dialog
+        * and waits for its response.
+        */
        void changeModeOrdered( DeviceManager::OperationMode aMode );
+       //! Handles select room change.
+       /*!
+        * Handles the changing of currently select room. Engine is requested
+        * to start fetching new meetings for currently shown week.
+        */
+       void currentRoomChanged( Room *aRoom );
        
 private slots:
 
        void meetingsFetched( const QList<Meeting*> &aMeetings );
        void meetingDetailsFetched( Meeting &aDetailedMeeting );
-       void currentRoomChanged( Room *aRoom );
        void progressBarCancelled();
        void updateTime( QDateTime aDateTime );
        void passwordEntered( PasswordDialog::PasswordStatus aStatus );
index 8174ef7..c941c7d 100644 (file)
@@ -93,12 +93,10 @@ void CommunicationManager::fetchMeetingDetails( Meeting& aMeeting )
 
 void CommunicationManager::cancelFetchMeetingDetails()
 {
-       const RequestData *rd = NULL;
-       for( rd = findRequest( GetCalendarItem );rd != NULL; )
-       {
-               int id =  rd->requestId;
+       const RequestData *rd = findRequest( GetCalendarItem );
+       if( rd != NULL ) {
+               int id = rd->requestId;
                iCancelledRequests.append( id );
-               rd = findRequest( GetCalendarItem );
        }
 }
 
index 76e17ce..4ac495e 100644 (file)
@@ -19,6 +19,8 @@ DeviceConfigurator::~DeviceConfigurator()
 bool DeviceConfigurator::toggleScreenSwitchOff( bool aEnable )
 {      
        qDebug() << "DeviceConfigurator::toggleScreenSwitchOff( bool )";
+       emit configuringError( DeviceManager::ScreenSettingsNotChanged );
+       return false;
        QString command = "gconftool-2";
        QStringList args;
        QByteArray result;
index 3db5db7..518a7d3 100644 (file)
@@ -9,7 +9,13 @@
 #include <QtDebug>
 #include <QStringList>
 
-DeviceManager::DeviceManager( StartupSettings *aSettings )
+DeviceManager::DeviceManager( StartupSettings *aSettings ) :
+       iAlarmSender( 0 ),
+       iHWKeyListener( 0 ),
+       iSettings( 0 ),
+       iDataStorage( 0 ),
+       iConfigurator( 0 ),
+       iModeToggler( 0 )
 {
        qDebug() << "DeviceManager::DeviceManager( StartupSettings * )";
 
@@ -35,6 +41,9 @@ DeviceManager::~DeviceManager()
 void DeviceManager::initDeviceManager()
 {
        qDebug() << "DeviceManager::init()";
+       
+       qRegisterMetaType<DeviceManager::ErrorCode>("DeviceManager::ErrorCode");
+       
        iDataStorage = new DeviceDataStorage();
        connect( iDataStorage, SIGNAL( dataStorageInitFailed( DeviceManager::ErrorCode ) ),
                        this, SLOT( errorSender( DeviceManager::ErrorCode ) ) );
@@ -51,7 +60,7 @@ void DeviceManager::initDeviceManager()
                iMode = EmptyMode;
 
        iHWKeyListener = new HWKeyListener();
-       handleKeyPresses( true );
+       handleHWKeyPresses( true );
 }
 
 DeviceManager::OperationMode DeviceManager::currentOperationMode()
@@ -72,20 +81,18 @@ QString DeviceManager::operationModeToString( OperationMode aMode )
        }
 }
 
-void DeviceManager::changeMode( bool aChange )
+void DeviceManager::changeMode()
 {
        qDebug() << "void DeviceManager::changeMode()";
-       if( !aChange ) {
-               handleKeyPresses( true );
-               return;
+       if( iModeToggler == 0 ) {
+               iModeToggler = new OperationModeToggler( iMode, iSettings, iAlarmSender, iConfigurator, iDataStorage );
+               connect( iModeToggler, SIGNAL( finished() ), this, SLOT( modeChanged() ) );
+               connect( iModeToggler, SIGNAL( error( DeviceManager::ErrorCode, const QString & ) ),
+                               this, SLOT( errorSender( DeviceManager::ErrorCode, const QString & ) ) );
+               connect( iModeToggler, SIGNAL( changingMode( const QString & ) ), this, SIGNAL( changingMode( const QString & ) ) );
+               connect( iModeToggler, SIGNAL( toggleErrorSending( bool ) ), this, SLOT( toggleErrorSending( bool ) ) );
+               iModeToggler->start();
        }
-       iModeToggler = new OperationModeToggler( iMode, iSettings, iAlarmSender, iConfigurator, iDataStorage );
-       connect( iModeToggler, SIGNAL( finished() ), this, SLOT( modeChanged() ) );
-       connect( iModeToggler, SIGNAL( error( DeviceManager::ErrorCode, const QString & ) ),
-                       this, SLOT( errorSender( DeviceManager::ErrorCode, const QString & ) ) );
-       connect( iModeToggler, SIGNAL( changingMode( const QString & ) ), this, SIGNAL( changingMode( const QString & ) ) );
-       connect( iModeToggler, SIGNAL( toggleErrorSending( bool ) ), this, SLOT( toggleErrorSending( bool ) ) );
-       iModeToggler->start();
 }
 
 bool DeviceManager::setCurrentOperationMode()
@@ -126,25 +133,14 @@ bool DeviceManager::finalizeStandAloneMode()
        return true;
 }
 
-void DeviceManager::handleKeyPresses( bool aHandle )
-{
-       qDebug() << "DeviceManager::handleKeyPresses( bool )";
-       if ( !aHandle )
-               disconnect( iHWKeyListener, SIGNAL( HWKeyFullScreenPressed() ), this, SLOT( HWKeyFullScreenPressed() ) );
-       else
-               connect( iHWKeyListener, SIGNAL( HWKeyFullScreenPressed() ), this, SLOT( HWKeyFullScreenPressed() ) );
-}
-
 void DeviceManager::HWKeyFullScreenPressed()
 {
        qDebug() << "DeviceManager::HWKeyFullScreenPressed()";
-       
+       handleHWKeyPresses( false );
        // no more key presses before this one is handled
-       handleKeyPresses( false );
-       
+       //handleKeyPresses( false );
        OperationMode nextMode;
-       switch ( iMode )
-       {
+       switch ( iMode ) {
                case KioskMode:
                        nextMode = StandAloneMode;
                        break;
@@ -157,8 +153,6 @@ void DeviceManager::HWKeyFullScreenPressed()
        }
        if ( nextMode != EmptyMode )
                emit changeModeOrdered( nextMode );
-       else
-               handleKeyPresses( true );
 }
 
 void DeviceManager::errorSender( DeviceManager::ErrorCode aErrorCode, const QString &aAddInfo )
@@ -181,14 +175,24 @@ void DeviceManager::modeChanged()
 {
        qDebug() << "DeviceManager::modeChanged()";
        if( iModeToggler != 0 ) {
-               if ( iModeToggler->success() ) //mode changing went well
+               if ( iModeToggler->success() ) {//mode changing went well
+                       emit changingMode( "Restarting device" );
+                       sleep( 2 );
                        iConfigurator->restartDevice();
+               }
                else
                        emit changeModeFailed();
                delete iModeToggler;
                iModeToggler = 0;
        }
-       
-       //in case device restarting fails we just continue
-       handleKeyPresses( true );
+       handleHWKeyPresses( true );
+}
+
+void DeviceManager::handleHWKeyPresses( bool aToggle )
+{
+       qDebug() << "DeviceManager::handleHWKeyPresses( bool )";
+       if( aToggle )
+               connect( iHWKeyListener, SIGNAL( HWKeyFullScreenPressed() ), this, SLOT( HWKeyFullScreenPressed() ) );
+       else
+               disconnect( iHWKeyListener, SIGNAL( HWKeyFullScreenPressed() ), this, SLOT( HWKeyFullScreenPressed() ) );
 }
index 267cf96..2c7531a 100644 (file)
@@ -90,9 +90,9 @@ public:
        //! Changes the operation mode.
        /*!
         * Changes the operation mode.
-        * \param aChange To indicate if the mode should be changed or not
         */
-       void changeMode( bool aChange );
+       void changeMode();
+       void handleHWKeyPresses( bool aToggle );
 
 signals:
        //! Signal. Emitted if user tries to change the operation mode.
@@ -164,13 +164,6 @@ private:
         * \return True if operation mode storing and deactivation of the init script succeed; otherwise, false.
         */
        bool finalizeStandAloneMode();
-       //! Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot.
-       /*!
-        * Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot. In case
-        * a signal is caught the connection is disabled until the signal handling is finished.
-        * \param aHandle indicates if the signals should be connected or not.
-        */
-       void handleKeyPresses( bool aHandle );
 
 private:
        AlarmSender *iAlarmSender;
index 2029f79..648934b 100644 (file)
@@ -17,7 +17,7 @@ HWKeyListener::~HWKeyListener()
 
 bool HWKeyListener::eventFilter( QObject*, QEvent* e )
 {
-       if ( e->type() == QEvent::KeyPress )
+       if ( e->type() == QEvent::KeyRelease )
        {
                QKeyEvent *keyEvent = static_cast<QKeyEvent *>( e );
                switch ( keyEvent->key() )
index cfa5d5d..14f13aa 100644 (file)
@@ -22,15 +22,6 @@ OperationModeToggler::OperationModeToggler(
        iSuccess( true )
 {
        qDebug() << "OperationModeToggler::OperationModeToggler( ... )";
-       
-       qRegisterMetaType<DeviceManager::ErrorCode>("DeviceManager::ErrorCode");
-       
-       connect( iAlarmSender, SIGNAL( alarmSendingFailed( DeviceManager::ErrorCode, const QString& ) ),
-                       this, SIGNAL( error( DeviceManager::ErrorCode, const QString& ) ) );
-       connect( iConfigurator, SIGNAL( configuringError( DeviceManager::ErrorCode ) ),
-                       this, SLOT( createError( DeviceManager::ErrorCode ) ) );
-       connect( iDataStorage, SIGNAL( dataStorageInitFailed( DeviceManager::ErrorCode ) ),
-                       this, SLOT( createError( DeviceManager::ErrorCode ) ) );
 }
 
 OperationModeToggler::~OperationModeToggler()
@@ -58,6 +49,7 @@ void OperationModeToggler::run()
                                if ( !iAlarmSender->sendAlarms( iSettings->turnOnAt(), iSettings->turnOffAt() ) )
                                {
                                        iSuccess = false;
+                                       emit changingMode( "Rolling back changes..." );
                                        return; //this is critical so returning if no success
                                }
                        }
@@ -95,6 +87,7 @@ void OperationModeToggler::run()
                                // we have to roll back if something fails
                                // of course rolling back may fail as well but it is impossible to catch
                                emit toggleErrorSending( false );
+                               emit changingMode( "Rolling back changes..." );
                                iAlarmSender->removeAlarms();
                                iConfigurator->toggleHWKeys( true );
                                iConfigurator->toggleInitScript( false );
@@ -139,6 +132,7 @@ void OperationModeToggler::run()
                                // we have to roll back if something fails
                                // of course rolling back may fail as well but it is impossible to catch
                                emit toggleErrorSending( false );
+                               emit changingMode( "Rolling back changes..." );
                                iConfigurator->toggleHWKeys( false );
                                iConfigurator->toggleInitScript( true );
                                iConfigurator->toggleScreenSwitchOff( false );
index a31616b..064c7d3 100644 (file)
@@ -28,12 +28,9 @@ PasswordDialog::PasswordDialog( const QString &aPassword, const QString &aText,
 
        QVBoxLayout *layout = new QVBoxLayout;
 
-       if ( !aText.isNull() )
-       {
-               QLabel *text = new QLabel( aText );
-               layout->addWidget( text );
-               layout->addStretch();
-       }
+       iText = new QLabel( aText );
+       layout->addWidget( iText );
+       layout->addStretch();
 
        iPasswordEdit = new QLineEdit;
        iPasswordEdit->setEchoMode( QLineEdit::Password );
@@ -51,8 +48,8 @@ PasswordDialog::PasswordDialog( const QString &aPassword, const QString &aText,
        layout->addLayout( buttonLayout );
 
        // Connect the user action signals to corresponding slots
-       connect( buttonOK, SIGNAL( pressed() ), this, SLOT( okButtonPressed() ) );
-       connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( cancelButtonPressed() ) );
+       connect( buttonOK, SIGNAL( released() ), this, SLOT( okButtonPressed() ) );
+       connect( buttonCancel, SIGNAL( released() ), this, SLOT( cancelButtonPressed() ) );
 
        // Enable the layout
        setLayout( layout );
@@ -95,3 +92,8 @@ void PasswordDialog::cancelButtonPressed()
        emit passwordEntered( PasswordDialog::Canceled );
 }
 
+void PasswordDialog::update( const QString &aText )
+{
+       qDebug() << "PasswordDialog::update()";
+       iText->setText( aText );
+}
index 686523b..c62223c 100644 (file)
@@ -4,6 +4,7 @@
 #include <QDialog>
 
 class QLineEdit;
+class QLabel;
 class QByteArray;
 
 //! UserInterface class. Responsible for poping-up password query on the screen.
@@ -26,6 +27,22 @@ public:
                Incorrect, /*!< Incorrect password. */
                Canceled
        };
+       
+       //! Constructor.
+       /*!
+        * Constructor to initialize a PasswordDialog instance.
+        * \param aParent The parent object.
+        * \param aPassword The password.
+        */
+       PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle = "", QWidget *aParent = 0 );
+       //! Destructor.
+       virtual ~PasswordDialog();
+       //! Updates the text of the password dialog label.
+       /*!
+        * Updates the text of the password dialog label.
+        * \param aText The text for the label.
+        */
+       void update( const QString &aText );
 
 signals:
        //! Signals the authenticity of the password when the uuser dismisses the dialog.
@@ -39,18 +56,9 @@ private slots:
        void okButtonPressed();
        void cancelButtonPressed();
 
-public:
-       //! Constructor.
-       /*!
-        * Constructor to initialize a PasswordDialog instance.
-        * \param aParent The parent object.
-        * \param aPassword The password.
-        */
-       PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle = "", QWidget *aParent = 0 );
-       //! Destructor.
-       virtual ~PasswordDialog();
-
+private:
        QLineEdit *iPasswordEdit;
+       QLabel *iText;
        QByteArray iPasswordHash;
 };
 
index 6ab9fe2..dd9f94f 100755 (executable)
@@ -8,11 +8,12 @@
 #include <QLabel>
 #include <QtDebug>
 
-ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aParent ) :
+ProgressBar::ProgressBar( const QString &aTitle, bool aCancellable, QWidget *aParent ) :
        QDialog( aParent )
 {
        qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
-       setWindowTitle( aText );
+       setWindowTitle( aTitle );
+       
        setModal( true );
 
        iProgress = new QProgressBar();
@@ -26,12 +27,15 @@ ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aPar
        mainLayout->addWidget( iLabel );
        QHBoxLayout *subLayout = new QHBoxLayout;
        subLayout->addWidget( iProgress );
-       if( aCancellable ) {
-               QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
-               subLayout->addSpacing( 5 );
-               subLayout->addWidget( buttonCancel );
-               connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+       
+       iButton = new QPushButton( tr( "Cancel" ) );
+       subLayout->addSpacing( 5 );
+       subLayout->addWidget( iButton );
+       connect( iButton, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+       if( !aCancellable ) {
+               iButton->setVisible( false );
        }
+       
        mainLayout->addLayout( subLayout );
        mainLayout->setAlignment( Qt::AlignCenter );
        setLayout( mainLayout );
@@ -42,8 +46,18 @@ ProgressBar::~ProgressBar()
        qDebug() << "ProgressBar::~ProgressBar()";
 }
 
-void ProgressBar::update( const QString &aMessage )
+void ProgressBar::update( const QString &aMessage, const QString &aTitle )
 {
        qDebug() << "ProgressBar::update( const QString & )";
        iLabel->setText( aMessage );
+       if( aTitle != "" )
+               setWindowTitle( aTitle );
+}
+
+void ProgressBar::toggleCancellable( bool aEnable )
+{
+       if( aEnable )
+               iButton->setVisible( true );
+       else
+               iButton->setVisible( false );
 }
index bf573cd..ec52bf5 100755 (executable)
@@ -5,6 +5,7 @@
 
 class QProgressBar;
 class QLabel;
+class QPushButton;
 
 //! UserInterface class.
 /*!
@@ -20,13 +21,20 @@ public:
        /*!
         * Constructor to initialize the StatusWidget instance.
         * \param aParent Parent object.
-        * \param aText Title string to be set to the progress bar.
+        * \param aTitle Title string to be set to the progress bar.
         */
-       ProgressBar( const QString &aText, bool aCancellable = false, QWidget *aParent = 0 );
+       ProgressBar( const QString &aTitle, bool aCancellable = false, QWidget *aParent = 0 );
        //! Destructor.
        virtual ~ProgressBar();
+       //! Updates the text fields of progress bar dialog.
+       /*!
+        * Updates the text fields of progress bar dialog.
+        * \param aMessage The text for the label of the dialog.
+        * \param aTitle Title string to be set to the progress bar.
+        */
+       void update( const QString &aMessage, const QString &aTitle = "" );
        
-       void update( const QString &aMessage );
+       void toggleCancellable( bool aEnable );
 
 signals:
        //! Signal. Emitted if user presses cancel button.
@@ -39,6 +47,7 @@ signals:
 private:
        QProgressBar *iProgress;
        QLabel *iLabel;
+       QPushButton *iButton;
 
 };
 
index c903bc0..dbc2b07 100644 (file)
@@ -6,6 +6,8 @@
 #include "DigitalTimeDisplayWidget.h"\r
 #include "ToolBox.h"\r
 \r
+#include <QEvent>\r
+\r
 #include <QtDebug>\r
 \r
 QTime RoomStatusIndicatorWidget::endOfTheDay = QTime( 23, 59, 0, 0 );\r
@@ -74,25 +76,28 @@ QString RoomStatusIndicatorWidget::statusToText( const Room::Status aStatus )
 \r
 QPalette RoomStatusIndicatorWidget::createPalette( Room::Status aStatus )\r
 {\r
-       QPixmap pixmap( aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free" );\r
+       // QPixmap pixmap( aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free" );\r
+       QString image = aStatus == Room::BusyStatus ? ":roomstatus_busy" : ":roomstatus_free";\r
 \r
        // The image needs to be moved in normal mode so the traffic light not partly outside the screen\r
        const int xoffset( 60 );\r
        const int yoffset( 19 );\r
-       int cropwidth( pixmap.width() - xoffset );\r
-       int cropheight( pixmap.height() - yoffset );\r
+//     int cropwidth( pixmap.width() - xoffset );\r
+//     int cropheight( pixmap.height() - yoffset );\r
        \r
        QBrush brush;\r
        if ( windowState() == Qt::WindowFullScreen )\r
        {\r
                // Use the full image in full screen mode\r
-               brush.setTexture( pixmap );\r
+//             brush.setTexture( pixmap );\r
+               brush.setTexture( QPixmap(image) );\r
        }\r
        else\r
        {\r
                // Take part of the image so the traffic lights are moved xoffset poxels to left \r
                // and yoffset pixels to up\r
-               brush.setTexture( pixmap.copy( xoffset, yoffset, cropwidth, cropheight ) );\r
+//             brush.setTexture( pixmap.copy( xoffset, yoffset, cropwidth, cropheight ) );\r
+               brush.setTexture( QPixmap(image) );\r
        }\r
 \r
        QPalette palette;\r
@@ -117,4 +122,26 @@ void RoomStatusIndicatorWidget::statusChanged( const Room::Status aStatus, const
                iUntilTextLabel->setText( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ) );\r
        }\r
        setPalette( createPalette( aStatus ) );\r
+}
+\r
+void RoomStatusIndicatorWidget::currentRoomChanged( Room *aRoom )\r
+{\r
+       iDefaultRoomLabel->setText( aRoom->name() );\r
+}\r
+\r
+bool RoomStatusIndicatorWidget::event(QEvent *event)\r
+{\r
+       switch(event->type())\r
+       {\r
+               case QEvent::Paint:\r
+                       qDebug() << "[RoomStatusIndicatorWidget::event] <Paint event>";\r
+                       break;\r
+               case QEvent::PaletteChange:\r
+                       qDebug() << "[RoomStatusIndicatorWidget::event] <Palette change event>";\r
+                       break;\r
+               default:\r
+                       break;\r
+       }\r
+       \r
+       return ViewBase::event( event );\r
 }\r
index c20ce45..67d40dc 100644 (file)
@@ -12,6 +12,8 @@ class QLabel;
 class QVBoxLayout;\r
 class TimeDisplayWidget;\r
 \r
+class QEvent;\r
+\r
 //! UserInterface class. Indicates if the default meeting room is busy or not.\r
 /*!\r
  * UserInterface class. Indicates if the default meeting room is busy or not. This widget\r
@@ -37,6 +39,8 @@ public:
        RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent = 0 );\r
        //! Destructor.\r
        virtual ~RoomStatusIndicatorWidget();\r
+       \r
+       bool event(QEvent *event);\r
 \r
 public slots:\r
        //! Slot. Sets current time.\r