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

src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/IO/Communication/MessagingUtils.cpp
src/IO/Communication/MessagingUtils.h
src/IO/DeviceControl/DeviceManager.cpp
src/IO/DeviceControl/DeviceManager.h
src/IO/DeviceControl/OperationModeToggler.cpp
src/IO/DeviceControl/OperationModeToggler.h
src/UserInterface/WindowManager.cpp

index ad8e197..3f4597a 100644 (file)
@@ -271,9 +271,11 @@ 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) );
 }
 
@@ -320,10 +322,12 @@ void Engine::passwordEntered(PasswordDialog::PasswordStatus aPasswordStatus)
        {
                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);
                        break;
                }
@@ -340,12 +344,11 @@ void Engine::passwordEntered(PasswordDialog::PasswordStatus aPasswordStatus)
        }
 }
 
-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()
index dc82d8e..22a1ea2 100644 (file)
@@ -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.
index 0f6e63e..d12b73a 100644 (file)
@@ -1,4 +1,5 @@
 #include <QUrl>
+#include <time.h>
 
 #include "MessagingUtils.h"
 #include "Meeting.h"
@@ -868,8 +869,26 @@ int ReqMsgGetUserAvailability::setTimeZone()
                return MsgErrSomeError;
        }
        int err = MsgErrNoError;
+
+       time_t rawtime;
+       tm *localTime;
+
+       time(&rawtime);
+       localTime = localtime(&rawtime);
+       
+       int offsetMinutes = localTime->tm_gmtoff / 60;
+       if (localTime->tm_isdst)
+               offsetMinutes -= 60;    // If DST is in use then reduce an hour from offset, because
+                                                               // DST will be added to the offset later and it already includes
+                                                               // DST. TODO: This is silly and must be changed if possible.
+                                                               // If you can get UTC offset without DST, use it here.
+       
+#ifdef MU_DEBUG
+       qDebug( "ReqMsgGetUserAvailability::setTimeZone - offset in minutes=%d", offsetMinutes );
+#endif
+       
        //TODO: timezone and daylight times to application configuration
-       setNodeValue( QString( "Bias" ), QString::number( -120 ), QDomNode::ElementNode, QString( "TimeZone" ) );
+       setNodeValue( QString( "Bias" ), QString::number( -offsetMinutes ), QDomNode::ElementNode, QString( "TimeZone" ) );
        setNodeValue( QString( "Bias" ), QString::number( 0 ), QDomNode::ElementNode, QString( "StandardTime" ) );
        setNodeValue( QString( "Time" ), QString( "03:00:00" ), QDomNode::ElementNode, QString( "StandardTime" ) );
        setNodeValue( QString( "DayOrder" ), QString::number( 5 ), QDomNode::ElementNode, QString( "StandardTime" ) );
index b15a99b..29d9744 100644 (file)
@@ -17,8 +17,8 @@
 #define ACTION_URL "http://schemas.microsoft.com/exchange/services/2006/messages/"
 
 //Set MessagingUtils Debug on/off
-//#define MU_DEBUG
-#undef MU_DEBUG
+#define MU_DEBUG
+//#undef MU_DEBUG
 
 class Meeting;
 class Room;
index 6c6eb27..92613b2 100644 (file)
@@ -81,7 +81,8 @@ void DeviceManager::changeMode( bool aChange )
        }
        iModeToggler = new OperationModeToggler( iMode, iSettings, iAlarmSender, iConfigurator, iDataStorage );
        connect( iModeToggler, SIGNAL( finished() ), this, SLOT( modeChanged() ) );
-       connect( iModeToggler, SIGNAL( error( DeviceManager::ErrorCode ) ), this, SLOT( errorSender( DeviceManager::ErrorCode ) ) );
+       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();
@@ -172,16 +173,18 @@ void DeviceManager::errorSender( DeviceManager::ErrorCode aErrorCode, const QStr
 
 void DeviceManager::toggleErrorSending( bool aToggle )
 {
+       qDebug() << "DeviceManager::toggleErrorSending( bool )";
        iSendErrorMessages = aToggle;
 }
 
 void DeviceManager::modeChanged()
 {
+       qDebug() << "DeviceManager::modeChanged()";
        if( iModeToggler != 0 ) {
                if ( iModeToggler->success() ) //mode changing went well
                        iConfigurator->restartDevice();
                else
-                       emit changingModeFailed();
+                       emit changeModeFailed();
                delete iModeToggler;
                iModeToggler = 0;
        }
index 4d5aaa7..267cf96 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <QObject>
 #include <QStringList>
+#include <QMetaType>
 
 class AlarmSender;
 class HWKeyListener;
@@ -39,6 +40,7 @@ public:
        /*!
         * Enumeration of errors
         */
+       
        enum ErrorCode
        {
                FileCreationFailed, /*!< File couldn't be created. */
@@ -116,7 +118,7 @@ signals:
        /*!
         * Signal. Emitted if the operation mode change fails.
         */
-       void changingModeFailed();
+       void changeModeFailed();
 
 private slots:
        //! Slot. Handles "full screen"-hardware key presses.
@@ -183,4 +185,6 @@ private:
 
 };
 
+Q_DECLARE_METATYPE( DeviceManager::ErrorCode )
+
 #endif /*DEVICEMANAGER_H_*/
index 0f44687..cfa5d5d 100644 (file)
@@ -22,6 +22,15 @@ 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()
@@ -35,7 +44,7 @@ void OperationModeToggler::run()
        {
                case DeviceManager::EmptyMode:
                        // error occured. Mode cannot be changed
-                       emit error( DeviceManager::ModeNotFetched );
+                       createError( DeviceManager::ModeNotFetched );
                        iSuccess = false;
                        return;
                case DeviceManager::StandAloneMode:
@@ -78,7 +87,7 @@ void OperationModeToggler::run()
                                emit changingMode( "Storing information about the new operation mode." );
                                sleep( 2 );
                                if( !storeOperationMode( DeviceManager::KioskMode, iDataStorage ) ) {
-                                       emit error( DeviceManager::ModeNotStored );
+                                       createError( DeviceManager::ModeNotStored );
                                        iSuccess = false;
                                }       
                        }
@@ -116,7 +125,7 @@ void OperationModeToggler::run()
                                emit changingMode( "Storing information about the new operation mode." );
                                sleep( 2 );
                                if( !storeOperationMode( DeviceManager::StandAloneModeInProgress, iDataStorage ) ) {
-                                       emit error( DeviceManager::ModeNotStored );
+                                       createError( DeviceManager::ModeNotStored );
                                        iSuccess = false;
                                }
                        }
@@ -145,6 +154,7 @@ void OperationModeToggler::run()
 
 bool OperationModeToggler::success()
 {
+       qDebug() << "OperationModeToggler::success()";
        return iSuccess;
 }
                        
@@ -158,3 +168,11 @@ bool OperationModeToggler::storeOperationMode( DeviceManager::OperationMode aMod
                return false;
        return true;
 }
+
+void OperationModeToggler::createError( DeviceManager::ErrorCode aCode )
+{
+       qDebug() << "OperationModeToggler::createError( DeviceManager::ErrorCode )";
+       QString empty = "";
+       emit error( aCode, empty );
+}
+
index 0b22266..77f9382 100644 (file)
@@ -49,13 +49,13 @@ public:
        static bool storeOperationMode( DeviceManager::OperationMode aMode, DeviceDataStorage *aDataStorage );
 
 signals:
-       //! Signal. Emitted if an error occurs during operation mode fetching or reading.
+       //! Signal. Emitted if an error happens.
        /*!
-        * Signal. Emitted if an error occurs during operation mode fetching or reading. Note that other
-        * possible errors are sent by the other instances e.g. alarm sender sents it's own errors. 
-        * \param aCode The error code.
+        * Signal. Emitted if an error happens.
+        * \param aCode An error code defined by DeviceManager.
+        * \param aAddInfo Possible additional information.
         */
-       void error( DeviceManager::ErrorCode aCode );
+       void error( DeviceManager::ErrorCode aCode, const QString &aAddInfo );
        //! Signal. Emitted if an error occurs during operation mode changing.
        /*!
         * Signal. Emitted if an error occurs during operation mode changing. If an error occurs, the operation
@@ -70,6 +70,14 @@ signals:
         * \param aMessage Explains the sub-change
         */
        void changingMode( const QString &aMessage );
+
+private slots:
+       //! Slot. Emits an error signal.
+       /*!
+        * Slot. Emits an error signal. 
+        * \param aCode The error code.
+        */
+       void createError( DeviceManager::ErrorCode aCode );
        
 private:
        DeviceManager::OperationMode iMode;
index 218f984..feef534 100644 (file)
@@ -190,7 +190,8 @@ void WindowManager::showProgressBar( const QString &aText, bool aCancellable )
                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() ) );