Index: sources/device/DeviceController.cpp =================================================================== diff -u -rc73feffa73c7fe073a7a7581144f5806dfc91beb -r389f028cb9d4d320eae393de7c4408a58a619356 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision c73feffa73c7fe073a7a7581144f5806dfc91beb) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 389f028cb9d4d320eae393de7c4408a58a619356) @@ -30,6 +30,7 @@ #include "ApplicationController.h" #include "FileHandler.h" #include "DeviceModels.h" +#include "Settings.h" // namespace using namespace Model; @@ -111,6 +112,9 @@ DEVICE_DEV_INIT_CONNECTIONS_LIST + connect(this, SIGNAL(didEventThreadChange()), + this, SLOT( onEventThreadChange())); + } /*! @@ -129,6 +133,8 @@ connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(quit())); _thread->start(); moveToThread(_thread); + + emit didEventThreadChange( QPrivateSignal() ); } /*! @@ -583,7 +589,7 @@ MDeviceCryptSetupResponse model; model._data.mAccepted = false; model._data.mMessage = tr("Encrypted Partition %1 started.").arg(_deviceCryptSetupRequest._data.mCommand); - didAttributeResponse(model.data()); + emit didAttributeResponse(model.data()); } /*! @@ -602,8 +608,24 @@ else deviceInfo = _processCryptSetup.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); // DEBUG: qDebug() << model._data.mEchoInfo; - didAttributeResponse(model.data()); + emit didAttributeResponse(model.data()); LOG_APPED_UI(model.data().mMessage); + + + // move the configuration files if the encrypted partition creation was successful. + if ( ! model._data.mAccepted ) return; + QString msg = ""; + int err = 0 ; + //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. + Storage::Settings settings; + err = settings.configurationsMove(&msg); + if ( err ) { + model._data.mAccepted = false ; + model._data.mReason = err ; + model._data.mMessage = msg ; + emit didAttributeResponse(model.data()); + LOG_APPED_UI(model.data().mMessage); + } } ///////////////////////////////////////////// DeviceBluetoothPaired @@ -634,7 +656,7 @@ else deviceInfo = _processBluetoothPairedReset.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); LOG_APPED_UI(model.data().mMessage); - didAttributeResponse(model.data()); + emit didAttributeResponse(model.data()); } ///////////////////////////////////////////// DeviceBluetoothPairedQuery @@ -666,7 +688,7 @@ if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processBluetoothPairedQuery.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); - didAttributeResponse(model.data()); + emit didAttributeResponse(model.data()); LOG_APPED_UI(model.data().mMessage); } @@ -724,3 +746,20 @@ _macWireless = vMacWireless .trimmed(); _macBluetooth = vMacBluetooth .trimmed(); } + +void DeviceController::onEventThreadChange() +{ + qDebug() << " ---------- " << __FUNCTION__ << QThread::currentThread()->objectName() << QThread::currentThread() << qApp->thread(); + if ( QThread::currentThread() != &Threads::_DeviceController_Thread ) { + qCritical() << " ***** Device controller thread not initialized correctly ***** "; + } + + // I_AM_HERE + // HERE move the settings read from ApplicationController to here + // here is when the DeviceController is moved to its thread + // and now can start mounting the encrypted partition + // and then read the settings. + // TODO don't forget to check for the required configurations files and parameters in the settings class. + // and take care of the security flag in the Storage class. +} +