Index: sources/storage/filehandler.h =================================================================== diff -u -r90d3f5b31186834168c9ad869f8d2d038200dfcf -r56e378f7504701b9e9a9dccaf205aef2fd52c58e --- sources/storage/filehandler.h (.../filehandler.h) (revision 90d3f5b31186834168c9ad869f8d2d038200dfcf) +++ sources/storage/filehandler.h (.../filehandler.h) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) @@ -1,48 +1,43 @@ /*! * - * Copyright (c) 2019-2019 Diality Inc. - All Rights Reserved. - * \copyright \n - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n - * IN PART OR IN WHOLE, \n - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file filehandler.h - * \date 2019/09/30 - * \author Behrouz NematiPour + * \file filehandler.h + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 + * \author (original) Behrouz NematiPour + * \date (original) 24-Sep-2019 * */ #pragma once // Qt -#include -#include -// Project +#include +class QDate; namespace Storage { -class FileHandler : public QObject +/*! + * \brief The FileHandler class + * This class is suppose to be the static class + * which contains methods to manipulate files and folders + * Since it is static it doesn't have thread so needs to be used with care + * and the class(es) which is using it needs to be taking care of the threading + */ +class FileHandler { - Q_OBJECT + static void errOut(const QString &vMessage); - const char *_usbMount = "/media/usb/"; - const char *_usbfsys = "vfat"; - bool _mounted = false; - - QFileSystemWatcher fsWatcher; - public: - explicit FileHandler(QObject *parent = nullptr); + static bool write(const QString &vFileName, const QString &vContent, bool vAppend = true); + static bool read (const QString &vFileName, QString &vContent); - bool init(); - bool doExport(); - bool doImport(); - -signals: - void usbStatusChanged(bool available); - -private slots: - void directoryChanged(const QString &vPath); - bool mountUsb(QString device); + 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); }; - }