Progress bar related updating
authorJan Lapinkataja <jan.lapinkataja@ixonos.com>
Fri, 22 May 2009 12:53:38 +0000 (15:53 +0300)
committerJan Lapinkataja <jan.lapinkataja@ixonos.com>
Fri, 22 May 2009 12:53:38 +0000 (15:53 +0300)
src/BusinessLogic/Engine.cpp
src/IO/DeviceControl/DeviceConfigurator.cpp
src/IO/DeviceControl/DeviceManager.cpp
src/IO/DeviceControl/DeviceManager.h
src/UserInterface/Utils/ProgressBar.cpp
src/UserInterface/WindowManager.cpp

index bbee693..a61006c 100644 (file)
@@ -323,10 +323,11 @@ void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
        {
                case PasswordDialog::Correct :
                {
-                       iWindowManager->showProgressBar( "Changing current operation mode." );
+                       iWindowManager->showProgressBar( "Changing current operation mode.", true );
                        connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
                        connect( iDevice, SIGNAL( changingMode( const QString & ) ),
                                        iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+                       connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( progressBarCancelled() ) );
                        iDevice->changeMode( true );
                        break;
                }
index 4fa515e..76e17ce 100644 (file)
@@ -17,7 +17,7 @@ DeviceConfigurator::~DeviceConfigurator()
 }
 
 bool DeviceConfigurator::toggleScreenSwitchOff( bool aEnable )
-{
+{      
        qDebug() << "DeviceConfigurator::toggleScreenSwitchOff( bool )";
        QString command = "gconftool-2";
        QStringList args;
index c4b6a64..6c6eb27 100644 (file)
@@ -178,11 +178,12 @@ void DeviceManager::toggleErrorSending( bool aToggle )
 void DeviceManager::modeChanged()
 {
        if( iModeToggler != 0 ) {
-               if ( iModeToggler->success() ) { //mode changing went well
-                       delete iModeToggler;
-                       iModeToggler = 0;
+               if ( iModeToggler->success() ) //mode changing went well
                        iConfigurator->restartDevice();
-               }
+               else
+                       emit changingModeFailed();
+               delete iModeToggler;
+               iModeToggler = 0;
        }
        
        //in case device restarting fails we just continue
index f4c8ec8..4d5aaa7 100644 (file)
@@ -112,6 +112,11 @@ signals:
         * \param aMessage Explains the sub-change
         */
        void changingMode( const QString &aMessage );
+       //! Signal. Emitted if the operation mode change fails.
+       /*!
+        * Signal. Emitted if the operation mode change fails.
+        */
+       void changingModeFailed();
 
 private slots:
        //! Slot. Handles "full screen"-hardware key presses.
index 835e5eb..6ab9fe2 100755 (executable)
@@ -33,6 +33,7 @@ ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aPar
                connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
        }
        mainLayout->addLayout( subLayout );
+       mainLayout->setAlignment( Qt::AlignCenter );
        setLayout( mainLayout );
 }
 
index 535434b..924392e 100644 (file)
@@ -188,6 +188,7 @@ void WindowManager::showProgressBar( const QString &aText, bool aCancellable )
        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() ) );
        }