Index: denali.pro.user =================================================================== diff -u -r23eda7b49841f242485b70d0a96f4bdde50f71bc -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- denali.pro.user (.../denali.pro.user) (revision 23eda7b49841f242485b70d0a96f4bdde50f71bc) +++ denali.pro.user (.../denali.pro.user) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -1,6 +1,6 @@ - + EnvironmentId Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r6531fd93584d910ce4313638b868d5fd20e77b68 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 6531fd93584d910ce4313638b868d5fd20e77b68) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -200,6 +200,7 @@ Message message; QStringList items; + quint8 id; if ( vContent.isEmpty() ) { error = eError_OutFileEmpty; ok = false; goto lErr; } @@ -212,22 +213,28 @@ count = items.count(); // check the required message length - if ( count < eMessage_Count ) { error = eError_HeaderCount ; ok = false; goto lErr; } - index = eMessage_Timestamp ; message.timestamp = items[index].toUInt(&ok); if (!ok) { error = eError_Timestamp ; ok = false; goto lErr; } - index = eMessage_Sequence ; message.sequence = items[index].toUInt(&ok); if (!ok) { error = eError_Sequence ; ok = false; goto lErr; } - index = eMessage_CRC ; message.crc = items[index].toUInt(&ok); if (!ok) { error = eError_CRC ; ok = false; goto lErr; } - index = eMessage_MessageID ; message.id = items[index].toInt (&ok); if (!ok) { error = eError_MessageID ; ok = false; goto lErr; } - index = eMessage_ParamCount; message.paramCount = items[index].toUInt(&ok); if (!ok) { error = eError_ParamCount ; ok = false; goto lErr; } + if ( count < eMessage_Count ) { error = eError_HeaderCount ; ok = false; goto lErr; } + index = eMessage_Timestamp ; message.timestamp = items[index].toUInt(&ok); if (!ok) { error = eError_Timestamp ; ok = false; goto lErr; } + index = eMessage_Sequence ; message.sequence = items[index].toUInt(&ok); if (!ok) { error = eError_Sequence ; ok = false; goto lErr; } + index = eMessage_CRC ; message.crc = items[index].toUInt(&ok); if (!ok) { error = eError_CRC ; ok = false; goto lErr; } + index = eMessage_MessageID ; message.id = items[index].toInt (&ok); if (!ok) { error = eError_MessageID ; ok = false; goto lErr; } + index = eMessage_ParamCount; message.paramCount = items[index].toUInt(&ok); if (!ok) { error = eError_ParamCount ; ok = false; goto lErr; } // check the parameters count - if ( count - eMessage_Count < message.paramCount ) { error = eError_Parameter ; ok = false; goto lErr; } + if ( count - eMessage_Count != message.paramCount ) { error = eError_ParamMismatch ; ok = false; goto lErr; } + // check missing parameters + id = CS2UI(message.id); + if ( ! paramCount.contains(id)) paramCount[id] = 0; + if ( paramCount[id] != message.paramCount ) { error = eError_ParamMissing ; ok = false; goto lErr; } + + // convert the message id and check its validity message.id = CS2UI(static_cast(message.id)); - if ( eMessageID_Start > message.id || message.id > eMessageID_Count ) { error = eError_InvalidID ; ok = false; goto lErr; } + if ( eMessageID_Start > message.id || message.id > eMessageID_Count ) { error = eError_InvalidID ; ok = false; goto lErr; } // getting the parameters - for ( quint32 index = eMessage_Count; index < message.paramCount; index++ ) { + for ( quint32 index = eMessage_Count; index < eMessage_Count + message.paramCount; index++ ) { message.params.append( items[index] ); } @@ -239,19 +246,19 @@ lErr: // building the error info for each error switch (error) { - case eError_Unknown : args = { }; break; - case eError_OutFileEmpty: args = { }; break; - case eError_HeaderCount : args = { count , eMessage_Count }; break; - case eError_Timestamp : args = { items[index].trimmed() }; break; - case eError_Sequence : args = { items[index].trimmed() }; break; - case eError_CRC : args = { items[index].trimmed() }; break; - case eError_MessageID : args = { items[index].trimmed() }; break; - case eError_InvalidID : args = { items[index].trimmed() }; break; - case eError_ParamCount : args = { items[index].trimmed() }; break; - case eError_Parameter : args = { count - eMessage_Count , message.paramCount }; break; - case eError_NoHistory : args = { }; break; - case eError_LogFolder : args = { }; break; - case eError_LogFileInp : args = { }; break; + case eError_Unknown : args = { }; break; + case eError_OutFileEmpty : args = { }; break; + case eError_HeaderCount : args = { count , eMessage_Count }; break; + case eError_Timestamp : args = { items[index].trimmed() }; break; + case eError_Sequence : args = { items[index].trimmed() }; break; + case eError_CRC : args = { items[index].trimmed() }; break; + case eError_MessageID : args = { items[index].trimmed() }; break; + case eError_InvalidID : args = { items[index].trimmed() }; break; + case eError_ParamCount : args = { items[index].trimmed() }; break; + case eError_ParamMismatch : args = { count - eMessage_Count , message.paramCount }; break; + case eError_ParamMissing : args = { paramCount[message.id] , message.paramCount }; break; + // Interpreter function only handles the message parsing errors. So default can be used. + default : break; } toLog(error, args); return false; @@ -266,22 +273,27 @@ */ QString CloudSyncController::toText(CloudSyncController::Errors_Enum vErrorID) { - QString text = tr( "CS Unknown Error" ) ; - if ( vErrorID == 0 ) return text; + QString text = tr( "CS Unknown Error" ) ; + if ( vErrorID == 0 ) return text; switch (vErrorID) { - case eError_Unknown : ; break; - case eError_OutFileEmpty: text = tr( "CS Out buffer empty" ) ; break; - case eError_HeaderCount : text = tr( "CS Incorrect header" ) ; break; - case eError_Timestamp : text = tr( "CS Incorrect timestamp" ) ; break; - case eError_Sequence : text = tr( "CS Incorrect sequence" ) ; break; - case eError_CRC : text = tr( "CS Incorrect CRC" ) ; break; - case eError_MessageID : text = tr( "CS Incorrect ID" ) ; break; - case eError_InvalidID : text = tr( "CS Invalid ID" ) ; break; - case eError_ParamCount : text = tr( "CS Incorrect parameter length" ) ; break; - case eError_Parameter : text = tr( "CS Incorrect parameter count" ) ; break; - case eError_NoHistory : text = tr( "CS No history available" ) ; break; - case eError_LogFolder : text = tr( "CS The log folder cannot be created." ) ; break; - case eError_LogFileInp : text = tr( "CS Error writing to the input file." ) ; break; + case eError_Unknown : /* "CS Unknown Error" */ ; break; + case eError_OutFileEmpty : text = tr( "CS Out buffer empty" ) ; break; + case eError_HeaderCount : text = tr( "CS Incorrect header" ) ; break; + case eError_Timestamp : text = tr( "CS Incorrect timestamp" ) ; break; + case eError_Sequence : text = tr( "CS Incorrect sequence" ) ; break; + case eError_CRC : text = tr( "CS Incorrect CRC" ) ; break; + case eError_MessageID : text = tr( "CS Incorrect ID" ) ; break; + case eError_ParamCount : text = tr( "CS Incorrect parameter count" ) ; break; + case eError_InvalidID : text = tr( "CS Invalid ID" ) ; break; + case eError_ParamMismatch : text = tr( "CS Mismatch parameter count" ) ; break; + case eError_ParamMissing : text = tr( "CS Missing parameter" ) ; break; + case eError_NoHistory : text = tr( "CS No history available" ) ; break; + case eError_LogFolder : text = tr( "CS The log folder cannot be created." ) ; break; + case eError_LogFileInp : text = tr( "CS Error writing to the input file." ) ; break; + case eError_CredentialFile : text = tr( "CS The credentials file does not exist." ) ; break; + case eError_CredentialMake : text = tr( "CS The credentials folder make failed." ) ; break; + case eError_CredentialCopy : text = tr( "CS The credentials file copy failed." ) ; break; + case eError_CredentialRemove: text = tr( "CS The credentials file remove failed." ) ; break; } return text; } @@ -301,19 +313,24 @@ QString info = QString( "[%1]" ).arg( vErrorID ) ; switch (vErrorID) { - case eError_Unknown : ; break; - case eError_OutFileEmpty: ; break; - case eError_HeaderCount : info = QString( "[%1:%2/%3]" ).arg( vErrorID ).arg( item(0) ).arg( item(1) ) ; break; - case eError_Timestamp : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_Sequence : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_CRC : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_MessageID : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_InvalidID : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_ParamCount : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_Parameter : info = QString( "[%1:%2/%3]" ).arg( vErrorID ).arg( item(0) ).arg( item(1) ) ; break; - case eError_NoHistory : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; - case eError_LogFolder : ; break; - case eError_LogFileInp : ; break; + case eError_Unknown : ; break; + case eError_OutFileEmpty : ; break; + case eError_HeaderCount : info = QString( "[%1:%2/%3]" ).arg( vErrorID ).arg( item(0) ).arg( item(1) ) ; break; + case eError_Timestamp : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_Sequence : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_CRC : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_MessageID : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_InvalidID : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_ParamCount : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_ParamMismatch : info = QString( "[%1:%2/%3]" ).arg( vErrorID ).arg( item(0) ).arg( item(1) ) ; break; + case eError_ParamMissing : info = QString( "[%1:%2/%3]" ).arg( vErrorID ).arg( item(0) ).arg( item(1) ) ; break; + case eError_NoHistory : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_LogFolder : ; break; + case eError_LogFileInp : ; break; + case eError_CredentialFile : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_CredentialMake : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_CredentialCopy : info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; + case eError_CredentialRemove: info = QString( "[%1:%2]" ).arg( vErrorID ).arg( item(0) ) ; break; } return info; } @@ -351,7 +368,7 @@ bool ok = true; Message message; if ( ! interpret(vContent, message) ) return false; // The error handling internal to interpret method. - ok = sendMessage(message.id); + ok = sendMessage(message); return ok; } @@ -508,11 +525,11 @@ // Same parameters will be sent for these messages for now, so data is not changed. switch (vAction) { + // case GuiActionType::ID_PreTreatmentStates : // has not been discussed how to be sent out. + // case GuiActionType::ID_TreatmentStates : // has not been discussed how to be sent out. + // case GuiActionType::ID_PostTreatmentStates : // has not been discussed how to be sent out. + // case GuiActionType::ID_DisinfectStates : // has not been discussed how to be sent out. case GuiActionType::ID_HDOperationModeData : - case GuiActionType::ID_PreTreatmentStates : - case GuiActionType::ID_TreatmentStates : - case GuiActionType::ID_PostTreatmentStates : - case GuiActionType::ID_DisinfectStates : saveUIHistory(eMessageID_DeviceState , vData ); sendUIHistory(eMessageID_DeviceState ); // can be removed if CS doesn't need it. break; @@ -548,20 +565,20 @@ * Some messages are sent out upon request form the last received on the history and will not be asked from FW. * \return true if there is a history for that message and no error happened. */ -bool CloudSyncController::sendMessage(const qint32 vAction) { +bool CloudSyncController::sendMessage(const Message &vMessage) { bool ok = false; // this function is used int sendUIResponse, therefore the message IDs which are responses should be implemented here. - switch (vAction) { - case eMessageID_DeviceRegister : /* No Request/Response */ break; + switch (vMessage.id) { + case eMessageID_DeviceRegister : /* No Request/Response */ break; - case eMessageID_DeviceInfo : ok = sendDeviceInfo(); break; - case eMessageID_SaveCredentials : break; - case eMessageID_SendCredentials : break; - case eMessageID_ResetFactory : ok = sendResetFactory(); break; - case eMessageID_DeviceState : ok = sendDeviceState(); break; + case eMessageID_DeviceInfo : ok = sendDeviceInfo ( ); break; + case eMessageID_CredentialsSave : ok = sendCredentialsSave( vMessage ); break; + case eMessageID_CredentialsSend : ok = sendCredentialsSend( ); break; + case eMessageID_ResetFactory : ok = sendResetFactory ( ); break; + case eMessageID_DeviceState : ok = sendDeviceState ( ); break; - case eMessageID_TxReport : break; + case eMessageID_TxReport : break; } return ok; @@ -607,6 +624,57 @@ } /*! + * \brief CloudSyncController::sendCredentialsSave + * \details saves the credentials files which their location have been sent. + * \param vMessage - the message received from CloudSync + * \return true on successfully saving the files. + */ +bool CloudSyncController::sendCredentialsSave( const Message &vMessage) +{ + bool ok = true; + QString destination = QString(Storage::CloudSync_Base_Path_Name) + Storage::CloudSync_Credentials_Folder_Name; + + // create the destination folder if does not exist. + if ( ! Storage::FileHandler::makeFolder( destination ) ) { toLog(eError_CredentialMake , { }); ok = false; goto lOut; } + + // file existence has been separated from copy remove to avoid partial copy. + for ( auto fileName : vMessage.params ) { + if ( ! QFileInfo::exists(fileName) ) { toLog(eError_CredentialFile , {fileName }); ok = false; goto lOut; } + } + + if ( ok ) { + for ( auto sourceFile : vMessage.params ) { + QString fileName = QFileInfo(sourceFile).fileName(); + if ( ! QFile::copy (sourceFile, destination + fileName) ) { toLog(eError_CredentialCopy , {fileName }); ok = false; goto lOut; } + if ( ! QFile::remove(sourceFile ) ) { toLog(eError_CredentialRemove , {fileName }); ok = false; goto lOut; } + } + } + +lOut: + return ok; +} + +/*! + * \brief CloudSyncController::sendSaveCredentials + * \details saves the credentials files which their location have been sent. + * \param vMessage - the message received from CloudSync + * \return true on successfully saving the files. + */ +bool CloudSyncController::sendCredentialsSend() +{ + bool ok = true; + qint32 messageID = UI2CS(eMessageID_CredentialsSend); + QString source = QString(Storage::CloudSync_Base_Path_Name) + Storage::CloudSync_Credentials_Folder_Name; + QString destination = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/" + Storage::CloudSync_Credentials_Folder_Name; + + if ( Storage::FileHandler::copyFolder(source, destination) != 0 ) { toLog(eError_CredentialCopy , {destination }); ok = false; goto lOut; } + ok = sendUIBuff(QString("%1,1,%2").arg( messageID ).arg(destination)); + +lOut: + return ok; +} + +/*! * \brief CloudSyncController::sendDeviceRegister * \details sends the device registration request * \return true on successful send. Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r6531fd93584d910ce4313638b868d5fd20e77b68 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 6531fd93584d910ce4313638b868d5fd20e77b68) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -76,23 +76,29 @@ QString _deviceInfoUI = ""; enum Errors_Enum { - eError_Unknown = 500, // Unknown error, initial error before error check + eError_Unknown = 500, // Unknown error, initial error before error check - eError_HeaderCount , - eError_Timestamp , - eError_Sequence , - eError_CRC , - eError_MessageID , - eError_InvalidID , - eError_ParamCount , - eError_Parameter , + eError_HeaderCount , + eError_Timestamp , + eError_Sequence , + eError_CRC , + eError_MessageID , + eError_InvalidID , + eError_ParamCount , + eError_ParamMismatch , + eError_ParamMissing , - eError_NoHistory , + eError_NoHistory , - eError_LogFolder , - eError_LogFileInp , + eError_LogFolder , + eError_LogFileInp , - eError_OutFileEmpty , // Out file has changed from CS2UI but the content is empty. + eError_CredentialMake , + eError_CredentialFile , + eError_CredentialCopy , + eError_CredentialRemove , + + eError_OutFileEmpty , // Out file has changed from CS2UI but the content is empty. }; typedef QHash MessageList; @@ -124,20 +130,19 @@ enum MessageID_Enum { eMessageID_Start = 0, - // [ #1( ID ) <-> #2( ID ) ] Description ( #1 Requests and #2 responses ) + // // [ #1( ID ) <-> #2( ID ) ] Description ( #1 Requests and #2 responses ) // Manufacturing eMessageID_Error = 0, // [ CS(2000) <-> UI(1000) ] Error Report eMessageID_DeviceRegister = 1, // [ UI(1001) -> CS( ) ] Device Registration Request eMessageID_DeviceInfo = 2, // [ CS(2002) <-> UI(1002) ] Device information Request - eMessageID_SaveCredentials = 3, // [ CS(2003) -> UI(1003) ] Save Credentials Request - eMessageID_SendCredentials = 4, // [ CS(2004) <-> UI(1004) ] Send Credentials Request + eMessageID_CredentialsSave = 3, // [ CS(2003) -> UI(1003) ] Save Credentials Request + eMessageID_CredentialsSend = 4, // [ CS(2004) <-> UI(1004) ] Send Credentials Request eMessageID_ResetFactory = 5, // [ CS(2005) <-> UI(1005) ] Reset Factory Request // Deployment eMessageID_DeviceState = 6, // [ CS(2006) <-> UI(1006) ] Device State Request - + // Tx Report eMessageID_TxReport = 7, // [ UI(1007) -> CS(2007) ] TxReport Notify - // // Subject to change so has been commented out for now // @@ -148,6 +153,10 @@ eMessageID_Count }; + QHash paramCount { + { eMessageID_CredentialsSave , 3 }, + }; + enum DeviceInfo_Enum { eDeviceInfo_Ix = 0, // received message data index of each HD, DG. Data index 0 is always the info. eDeviceInfo_HD = 0, // stored index in the UI history. @@ -191,16 +200,16 @@ bool sendUIBuff (const QString &vData ); bool saveUIHistory (const qint32 vAction, const QVariantList &vData); bool sendUIHistory (const qint32 vAction ); - bool sendMessage (const qint32 vAction ); + bool sendMessage (const Message &vMessage ); bool writeInpFile (const QString &vInpBuff ); QString toText (Errors_Enum vErrorID); QString toInfo (Errors_Enum vErrorID, const QVariantList &vInfoItems); void toLog (Errors_Enum vErrorID, const QVariantList &vInfoItems); - qint32 UI2CS (MessageID_Enum vID) { return vID + eUI; } - qint32 CS2UI (MessageID_Enum vID) { return vID - eCS; } + qint32 UI2CS (qint32 vID) { return vID + eUI ; } + qint32 CS2UI (qint32 vID) { return abs(vID - eCS); } // error bool sendError (); // eMessageID_Error @@ -224,8 +233,8 @@ bool doResetFactory (); // eMessageID_ResetFactory bool sendResetFactory (); // eMessageID_ResetFactory - bool sendSaveCredentials (); // eMessageID_SaveCredentials - bool sendSendCredentials (); // eMessageID_SendCredentials + bool sendCredentialsSave (const Message &vMessage); // eMessageID_SaveCredentials + bool sendCredentialsSend (); // eMessageID_SendCredentials bool sendTxReport (); // eMessageID_TxReport }; Index: sources/model/hd/alarm/MAlarmMapping.cpp =================================================================== diff -u -red9ea343a2a22623796045d9e1229a2cbfa8c970 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision ed9ea343a2a22623796045d9e1229a2cbfa8c970) +++ sources/model/hd/alarm/MAlarmMapping.cpp (.../MAlarmMapping.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -7,7 +7,7 @@ * * \file MAlarmMapping.cpp * \author (last) Behrouz NematiPour - * \date (last) 23-Feb-2022 + * \date (last) 24-Feb-2022 * \author (original) Behrouz NematiPour * \date (original) 03-May-2021 * Index: sources/storage/FileHandler.cpp =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -138,24 +138,64 @@ * \details Copies all the file and folders recursively. * \param vSource - The source folder * \param vDestination - The destination folder - * \return Tue on successful execution. + * \return True on successful execution. * \note This method uses the Linux "cp -r vSource vDestination" command * Not a Thread-Safe. - * */ -int FileHandler::copyFolder(const QString &vSource, const QString &vDestination ) +int FileHandler::copyFolder(const QString &vSource, const QString &vDestination) { // coco begin validated: This needs user interaction to export to USB device // has been tested manually since currently it is the only place it has been used. - QString cp = "cp"; + QString cmd = "cp"; QStringList arguments; arguments << "-r" << vSource << vDestination; - int result = QProcess::execute(cp, arguments); + int result = QProcess::execute(cmd, arguments); return result; } // coco end /*! + * \brief FileHandler::moveFolder + * \details Moves the source folder to destination. + * \param vFolder - The folder to be removed + * \return True on successful execution. + * \note This method uses the Linux "mv vSource vDestination" command + * Not a Thread-Safe. + */ +int FileHandler::moveFolder(const QString &vSource, const QString &vDestination) +{ + // coco begin validated: This needs user interaction to check the file system + // has been tested manually since currently it is the only place it has been used. + QString cmd = "mv"; + QStringList arguments; + arguments << vSource << vDestination; + int result = QProcess::execute(cmd, arguments); + return result; +} +// coco end + +/*! + * \brief FileHandler::removeFolder + * \details Removes the entire folder. + * \param vFolder - The folder + * \return True on successful execution. + * \note This method uses the Linux "rm -frd vSource vDestination" command + * <<<<< DANGEROUS BE CAREFUL >>>>> + * Not a Thread-Safe. + */ +int FileHandler::removeFolder(const QString &vFolder) +{ + // coco begin validated: This needs user interaction to check the file system + // has been tested manually since currently it is the only place it has been used. + QString cmd = "rm"; + QStringList arguments; + arguments << "-frd" << vFolder; + int result = QProcess::execute(cmd, arguments); + return result; +} +// coco end + +/*! * \brief FileHandler::removeFiles * \details * \param vFolder Index: sources/storage/FileHandler.h =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/storage/FileHandler.h (.../FileHandler.h) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/storage/FileHandler.h (.../FileHandler.h) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -37,14 +37,16 @@ static void errOut(const QString &vMessage); public: - static bool write (const QString &vFileName, const QString &vContent, bool vAppend = true); - static bool read (const QString &vFileName, QString &vContent); - static bool read (const QString &vFileName, QJsonObject &vContent, QJsonParseError *error = nullptr); + static bool write (const QString &vFileName, const QString &vContent, bool vAppend = true); + static bool read (const QString &vFileName, QString &vContent); + static bool read (const QString &vFileName, QJsonObject &vContent, QJsonParseError *error = nullptr); - static int copyFolder (const QString &vSource , const QString &vDestination); - static int removeFiles(const QStringList &vFolders, const QStringList &vNameFilter, const QDate &vDateOlderThan); - static bool makeFolder (const QString &vFolder); - static bool isMounted (const QString &vPath, bool *vIsReadOnly = nullptr); + static int copyFolder (const QString &vSource , const QString &vDestination); + static int moveFolder (const QString &vSource , const QString &vDestination); + static int removeFolder(const QString &vFolder); + static int removeFiles (const QStringList &vFolders, const QStringList &vNameFilter, const QDate &vDateOlderThan); + static bool makeFolder (const QString &vFolder); + static bool isMounted (const QString &vPath, bool *vIsReadOnly = nullptr); static QFileInfoList find(const QString &vPath, QStringList vNameFilters, quint8 vRetainPercent); Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -59,6 +59,21 @@ const char *Settings_Path_Name = "/home/denali/Projects/application/resources/settings/"; #endif + // CloudSync credentials +#ifdef BUILD_FOR_TARGET + const char *CloudSync_Base_Path_Name = "/home/root/.cloudSync/"; +#else + // on VM it is a temporary file which is not being tracked + const char *CloudSync_Base_Path_Name = "/home/denali/Desktop/cloudsync/"; +#endif + +#ifdef BUILD_FOR_TARGET + const char *CloudSync_Credentials_Folder_Name = "credentials/"; +#else + // on VM it is a temporary file which is not being tracked + const char *CloudSync_Credentials_Folder_Name = "credentials/"; +#endif + // Scripts #ifdef BUILD_FOR_TARGET const char *Scripts_Path_Name = "/home/root/scripts/"; Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r27cc308ff5113a9386899d3c8f8b29962a8498e1 -r3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 27cc308ff5113a9386899d3c8f8b29962a8498e1) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 3f60b9a1c0b3a43ec1c5c72955dce0d80354e35c) @@ -39,6 +39,10 @@ // Settings extern const char *Settings_Path_Name; + // CloudSync_Credentials_Path_Name + extern const char *CloudSync_Base_Path_Name; + extern const char *CloudSync_Credentials_Folder_Name; + // Scripts extern const char *Scripts_Path_Name;