]> gitweb.hamatoma.de Git - reqt/commitdiff
rebackgui: integrated mount and blkid
authorhama <hama@siduction.net>
Sun, 15 May 2016 06:26:55 +0000 (08:26 +0200)
committerhama <hama@siduction.net>
Sun, 15 May 2016 06:26:55 +0000 (08:26 +0200)
* no script is needed for mount and blkid info
* refactoring: ReSuccess_t and ReTrue_t

25 files changed:
appl/rebackgui/BackupUtils.cpp
appl/rebackgui/BackupUtils.hpp
appl/rebackgui/Configuration.cpp
appl/rebackgui/Configuration.hpp
appl/rebackgui/mainwindow.cpp
appl/rebackgui/mainwindow.hpp
base/ReConfig.cpp
base/ReConfig.hpp
base/ReFileUtils.cpp
base/ReFileUtils.hpp
base/ReLogger.cpp
base/ReLogger.hpp
base/ReProcess.cpp
base/ReProcess.hpp
base/ReRandomizer.cpp
base/ReRandomizer.hpp
base/ReStringUtils.cpp
base/ReStringUtils.hpp
base/rebase.hpp
base/retrace.hpp
gui/ReGuiApplication.cpp
gui/ReGuiQueue.cpp
gui/ReGuiQueue.hpp
gui/ReStateStorage.cpp
gui/ReStateStorage.hpp

index 91891b412f05b2c0a0c952b999a87223614972aa..2b7e5d4e6cd62e9ab5fce873238adda0d053644e 100644 (file)
@@ -44,18 +44,16 @@ QString BackupUtils::findAbstractTarget(const QString& path, ReLogger* logger)
        QString rc;
 #if defined __linux__
        QStringList args;
-       args << "/usr/local/bin/osconnect.pl"
-               << "find-label" << path;
-       QByteArray output = ReProcess::executeAndRead("/usr/bin/perl", args, 20);
-       QByteArrayList lines = output.split('\n');
-       if (lines.count() < 2){
-               logger->log(LOG_ERROR, LOC_FIND_TARGET_1, "missing lines from osconnect.pl");
-       } else if (lines.at(1).startsWith("+++")) {
-               logger->logv(LOG_ERROR, LOC_FIND_TARGET_2, "mounting failed: %s",
-                                       lines.at(1).mid(3).constData());
-       } else {
-               rc = QString::fromUtf8(lines.at(0)) + ";"
-                               + QString::fromUtf8(lines.at(1));
+       ReMountInfo& mountInfo = ReMountInfo::instance(true);
+       QString device = mountInfo.findDevice(path);
+       if (! device.isEmpty()){
+               ReBlockDevices& devices = ReBlockDevices::instance(true);
+               const ReBlockDevice* dev = devices.findByDevice(device);
+               if (dev != NULL){
+                       QString mountedAt = mountInfo.m_mountPointOfDevice.value(device);
+                       QString relativePath = path.mid(mountedAt.length() + 1);
+                       rc = "L=" + dev->m_label + ";" + relativePath;
+               }
        }
 #elif defined _WIN32
        rc = ";" + path.mid(2);
@@ -70,35 +68,46 @@ QString BackupUtils::findAbstractTarget(const QString& path, ReLogger* logger)
  * Note: if the medium of the target is an external medium
  * the path can change.
  *
- * @param item  the info about the backup item
- * @return      "": not found<br>
- *              otherwise: the full path of the target directory
+ * @param item                         the info about the backup item
+ * @param tempoararyMounted    the device which was newly mounted.<br>
+ *                                                     "": device was already mounted
+ * @return                                     "": not found<br>
+ *                                                     otherwise: the full path of the target directory
  */
-QString BackupUtils::findTarget(const BackupItem& item, ReLogger* logger)
+QString BackupUtils::findTarget(const BackupItem& item, MainWindow& mainWindow,
+                                                               QString& tempoararyMounted)
 {
        QString rc;
 #if defined __linux__
+       tempoararyMounted.clear();
        if (item.m_target.isEmpty()){
                // nothing to do
        } else if (item.m_target.startsWith(";/")){
                // the path is an absolute path on a fixed disk:
                rc = item.m_target.mid(1);
        } else {
+               ReBlockDevices& devices = ReBlockDevices::instance();
                QStringList parts = item.m_target.split(';');
                QStringList args;
-               args << "/usr/local/bin/osconnect.pl"
-                       << "search-target" << parts.at(0)
-                        << parts.at(1)
-                        << "/media/EFI_system/backup";
-               QByteArray output = ReProcess::executeAndRead("/usr/bin/perl", args, 20);
-               QByteArrayList lines = output.split('\n');
-               if (lines.count() < 2){
-                       logger->log(LOG_ERROR, LOC_FIND_TARGET_1, "missing lines from osconnect.pl");
-               } else if (lines.at(1).startsWith("+++")) {
-                       logger->logv(LOG_ERROR, LOC_FIND_TARGET_2, "mounting failed: %s",
-                                               lines.at(1).mid(3).constData());
-               } else {
-                       rc = QString::fromUtf8(lines.at(0));
+               QString label = parts.at(0);
+               QString relativePath = parts.at(1);
+               if (label.startsWith("L="))
+                       label = label.mid(2);
+               const ReBlockDevice* device = devices.findByLabel(label);
+               if (device != NULL){
+                       ReMountInfo& mountInfo = ReMountInfo::instance();
+                       if (mountInfo.m_mountPointOfDevice.contains(device->m_device)){
+                               rc = mountInfo.m_mountPointOfDevice.value(device->m_device);
+                                       + OS_SEPARATOR + relativePath;
+                       } else {
+                               QStringList args;
+                               QString mountPath = "/media/" + label;
+                               ReFileUtils::makeDir(mountPath, mainWindow.logger());
+
+                               if (ReMountInfo::mount(device->m_device, mountPath, &mainWindow)){
+                                       tempoararyMounted = device->m_device;
+                               }
+                       }
                }
        }
 #elif defined _WIN32
@@ -151,7 +160,7 @@ QString BackupUtils::nameOfTargetDescription(const QString& path){
  * @param logger    the logger
  * @return          <code>true</code>: target is already initialized
  */
-bool BackupUtils::prepareTarget(const QString& path, BackupItem &item,
+ReSuccess_t BackupUtils::prepareTarget(const QString& path, BackupItem &item,
                                                                ReLogger* logger)
 {
        bool rc = false;
index 1f97ee120d981985990865bd3f498126cbcd525a..7a8ab0afc48a14702518e4e2bc5150d54a951d15 100644 (file)
@@ -19,9 +19,10 @@ public:
 public:
        static QString dateToString(const QDateTime& dateTime);
        static QString findAbstractTarget(const QString& path, ReLogger* logger);
-       static QString findTarget(const BackupItem& item, ReLogger* logger);
+       static QString findTarget(const BackupItem& item, MainWindow& mainWindow,
+                       QString& temporaryMounted);
        static QString nameOfTargetDescription(const QString &path);
-       static bool prepareTarget(const QString &path, BackupItem &item, ReLogger *logger);
+       static ReSuccess_t prepareTarget(const QString &path, BackupItem &item, ReLogger *logger);
        static QDateTime stringToDate(const QString& dateTime);
        static QString targetDescription(const QString& backupPath, ReLogger *logger);
 };
index d461e49fff56d4a0f34999c402d5fddf4e3eedb2..88298e1bc36f2f71daccfe86fbc720b335f3d050 100644 (file)
@@ -10,6 +10,9 @@
  */
 
 #include "backupgui.hpp"
+#define WITH_TRACE
+#include "base/retrace.hpp"
+DECLARE_TRACER(s_traceConfig, "/tmp/bup_conf.log");
 
 /**
  * Constructor.
@@ -75,6 +78,8 @@ void Configuration::appendNew()
  */
 void Configuration::check()
 {
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               ">Configuration::check: size: %d\n", m_items.size()));
        if (m_items.size() == 0){
                appendNew();
        }
@@ -83,6 +88,8 @@ void Configuration::check()
                if (item.m_uid.isEmpty())
                        item.m_uid = QString(ReRandomizer::buildUUID());
        }
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               "<Configuration::check\n"));
 }
 
 /**
@@ -111,6 +118,9 @@ static bool intCompare(int a, int b){
  */
 void Configuration::load(QString filename)
 {
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               ">Configuration::load: %s\n",
+               filename.toLocal8Bit().constData()));
        if (filename.isEmpty())
                filename = m_mainWindow->fileOfHome(m_mainWindow->applicationName() + ".conf");
        FILE* fp = fopen(I18N::s2b(filename).constData(), "r");
@@ -164,6 +174,9 @@ void Configuration::load(QString filename)
                fclose(fp);
        }
        check();
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               "<Configuration::load: %s\n",
+               filename.toLocal8Bit().constData()));
 }
 
 /**
@@ -173,9 +186,13 @@ void Configuration::load(QString filename)
  * @return             <code>true</code>: the last backup date has been found (and
  *                             set in <code>item</code>)
  */
-bool Configuration::readBackupDate(BackupItem& item){
-       bool rc = false;
-       QString target = BackupUtils::findTarget(item, m_mainWindow->logger());
+ReSuccess_t Configuration::readBackupDate(BackupItem& item){
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               ">Configuration::readBackupDate: %s\n",
+               item.m_name.toLocal8Bit().constData()));
+       ReSuccess_t rc = false;
+       QString temporaryMounted;
+       QString target = BackupUtils::findTarget(item, *m_mainWindow, temporaryMounted);
        if (! target.isEmpty()){
                QString name = BackupUtils::nameOfTargetDescription(target);
                ReConfig config(I18N::s2b(name).constData());
@@ -188,6 +205,9 @@ bool Configuration::readBackupDate(BackupItem& item){
                        }
                }
        }
+       m_mainWindow->unmount(temporaryMounted);
+       FILETRACE_IT(s_traceConfig, (s_traceConfig.m_fp,
+               "<Configuration::readBackupDate\n"));
        return rc;
 }
 
index 17933c99899fe2e7b45e9d35ab8bdb66466b72de..c8f02000bd9f1eb05266df3b692d7a0d45efae30 100644 (file)
@@ -41,7 +41,7 @@ public:
        void check();
        BackupItemList& items();
        void load(QString filename);
-       bool readBackupDate(BackupItem& item);
+       ReSuccess_t readBackupDate(BackupItem& item);
        void save(QString filename);
 
 private:
index df5bea340fd2a5cb325472fffa67cee520c617cc..da223e27f57270c89959412277028951bfcb7ae4 100644 (file)
@@ -12,6 +12,9 @@
 #include "backupgui.hpp"
 #include "aboutdialog.hpp"
 #include <QFileDialog>
+#define WITH_TRACE
+#include "base/retrace.hpp"
+DECLARE_TRACER(s_traceMain, "/tmp/bup_main.log");
 
 const QString VERSION("2016.04.07");
 
@@ -40,8 +43,9 @@ MainWindow::MainWindow(QApplication& application, const QString& homeDir,
        m_maxListSize(100),
        m_mutexLastFile(),
        m_lastFile(""),
-       m_lastDirectory("")
-
+       m_lastDirectory(""),
+       m_textChangeLocked(false),
+       m_temporaryMounted("")
 {
        initializeGui();
 }
@@ -274,9 +278,9 @@ void MainWindow::initializeGui(){
  * @return  <code>true</code>: success<br>
  *          otherwise: error occurred
  */
-bool MainWindow::initializeStart(){
+ReSuccess_t MainWindow::initializeStart(){
        setStatusMessage(LOG_INFO, QObject::tr("Search started..."));
-       bool rc = true;
+       ReSuccess_t rc = true;
        BackupEngine::m_shouldStop = false;
        BackupEngine::m_searchReady = false;
        BackupEngine::m_hotBytes = 0;
@@ -302,6 +306,14 @@ bool MainWindow::initializeStart(){
        return rc;
 }
 
+/**
+ * Loads the mount and block device info.
+ */
+void MainWindow::loadOsInfo(){
+       ReMountInfo::instance(true);
+       ReBlockDevices::instance(true);
+}
+
 /**
  * Called at the program's end.
  */
@@ -396,7 +408,9 @@ void MainWindow::onChecksums(){
                say(LOG_ERROR, tr("no backup item selected"));
        } else {
                BackupItem& item = m_configuration.items()[row];
-               QString target = BackupUtils::findTarget(item, &m_logger);
+               loadOsInfo();
+               QString target = BackupUtils::findTarget(item, *this,
+                                                                                                m_temporaryMounted);
                if (target.isEmpty()){
                        say(LOG_ERROR, tr("Target not available"));
                } else {
@@ -431,7 +445,8 @@ void MainWindow::onClean()
                say(LOG_ERROR, tr("no backup item selected"));
        } else {
                BackupItem& item = m_configuration.items()[row];
-               QString target = BackupUtils::findTarget(item, &m_logger);
+               loadOsInfo();
+               QString target = BackupUtils::findTarget(item, *this, m_temporaryMounted);
                if (target.isEmpty()){
                        say(LOG_ERROR, tr("Target not available"));
                } else {
@@ -523,8 +538,16 @@ void MainWindow::onDeleteSource()
  * @param newText      the new text of the dir pattern
  */
 void MainWindow::onDirPatternTextChanged(const QString& newText){
-       UNUSED_VAR(newText);
-       onUpdateConfig();
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               ">onDirPatternTextChanged:\n"));
+       if (! m_textChangeLocked){
+               m_textChangeLocked = true;
+               UNUSED_VAR(newText);
+               onUpdateConfig();
+               m_textChangeLocked = false;
+       }
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               "<onDirPatternTextChanged:\n"));
 }
 
 /**
@@ -540,8 +563,15 @@ void MainWindow::onEnglish(){
  * @param newText      the new text of the dir pattern
  */
 void MainWindow::onFilePatternTextChanged(const QString& newText){
-       UNUSED_VAR(newText);
-       onUpdateConfig();
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               ">onFilePatternTextChanged:\n"));
+       if (! m_textChangeLocked){
+               m_textChangeLocked = true;
+               UNUSED_VAR(newText);
+               onUpdateConfig();
+       }
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               "<onFilePatternTextChanged:\n"));
 }
 
 /**
@@ -629,7 +659,8 @@ void MainWindow::onStart(){
                say(LOG_ERROR, tr("no backup item selected"));
        } else {
                BackupItem& item = m_configuration.items()[row];
-               QString target = BackupUtils::findTarget(item, &m_logger);
+               loadOsInfo();
+               QString target = BackupUtils::findTarget(item, *this, m_temporaryMounted);
                if (target.isEmpty()){
                        say(LOG_ERROR, tr("Target not available"));
                } else {
@@ -747,8 +778,10 @@ void MainWindow::startStop(bool isStart){
        ui->actionClean->setEnabled(! isStart);
        if (isStart)
                BackupEngine::m_verboseLevel = (ReVerbose_t) ui->comboBoxVerbose->currentIndex();
-       if (! isStart)
+       if (! isStart){
                setStatusMessage(LOG_INFO, "");
+               unmount("");
+       }
 
 }
 
@@ -756,6 +789,8 @@ void MainWindow::startStop(bool isStart){
  * Stores the GUI elements into the current backup item and save int to the file.
  */
 void MainWindow::onUpdateConfig(){
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               ">onUpdateConfig:\n"));
        if (m_guiIsInitialized){
                BackupItem& item = m_configuration.items()[m_currentRowConfiguration];
                item.m_name = ui->lineEditName->text();
@@ -770,6 +805,8 @@ void MainWindow::onUpdateConfig(){
                if (ui->checkBoxAutoSave->isChecked())
                        onSaveConfig();
        }
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               "<onUpdateConfig:\n"));
 }
 
 /**
@@ -844,6 +881,8 @@ void MainWindow::updateItem(int index){
  */
 void MainWindow::updateTable(QTableWidget* target)
 {
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               ">updateTable:\n"));
        if (target == NULL){
                updateTable(ui->tableWidget);
                updateTable(ui->tableWidgetConfiguration);
@@ -855,6 +894,8 @@ void MainWindow::updateTable(QTableWidget* target)
                        updateTableRow(ix, m_configuration.items()[ix], target);
                }
        }
+       FILETRACE_IT(s_traceMain, (s_traceMain.m_fp,
+               "<updateTable:\n"));
 }
 
 /**
@@ -908,7 +949,27 @@ void MainWindow::writeTargetConfiguration(BackupItem& item, const QString& targe
        onSaveConfig();
 }
 
-
-
-
+/**
+ * Unmounts the current target device.
+ *
+ * @param device       "": internal device is used.<br>
+ *                                     otherwise: the device to unmount
+ */
+void MainWindow::unmount(const QString& device)
+{
+       const QString& device2 = device.isEmpty() ? m_temporaryMounted : device;
+       if (! device2.isEmpty()){
+               QStringList args;
+               args << device2;
+               QByteArray answer = ReProcess::executeAndRead("/bin/umount", args);
+
+               if (answer.isEmpty())
+                       externalLog(tr("device %1 successfully unmounted")
+                                                        .arg(device2));
+               else
+                       externalError(tr("cannot unmount device %1: %2")
+                                                        .arg(device2)
+                                                        .arg(QString::fromUtf8(answer)));
+       }
+}
 
index 1f63750ae98cdb99459544b1ea004a548e54ea7c..366c3e93e9a6a6f12766662bc1abc158c08e7901 100644 (file)
@@ -38,11 +38,13 @@ public:
    void setLastFile(const QString& lastFile);
    void setLastFile(const QString& lastDir, const QString& lastFile);
    void saveState();
+   void unmount(const QString& device);
 protected slots:
 private:
    void extractTarget(const QString& dir);
    void initializeGui();
    bool initializeStart();
+   void loadOsInfo();
    void writeTargetConfiguration(BackupItem& item, const QString& target);
 private slots:
    void onAbout();
@@ -94,6 +96,8 @@ private:
        QMutex m_mutexLastFile;
        QString m_lastFile;
        QString m_lastDirectory;
+       bool m_textChangeLocked;
+       QString m_temporaryMounted;
 };
 
 #endif // MAINWINDOW_HPP
index b95be38844464aabcf8bea1a6daaca8244f083a6..d4d7be69e9250e07c786d2fc9d1e3c5c3a169d10 100644 (file)
@@ -194,8 +194,8 @@ void ReConfig::put(const char *key, const char *value)
  * @return      true: OK<br>
  *              false: error occurred
  */
-bool ReConfig::read(const char* file) {
-       bool rc = true;
+ReSuccess_t ReConfig::read(const char* file) {
+       ReSuccess_t rc = true;
        m_lineList.reserve(1024);
        if (file == NULL)
                file = m_file.constData();
@@ -235,8 +235,8 @@ bool ReConfig::read(const char* file) {
  * @return      true: OK<br>
  *              false: error occurred
  */
-bool ReConfig::write(const char* file) {
-       bool rc = false;
+ReSuccess_t ReConfig::write(const char* file) {
+       ReSuccess_t rc = false;
        if (m_readOnly)
                m_logger->log(LOG_ERROR, LOC_WRITE_1, "cannot write: (readonly");
        else {
index b2bdb44785a3d1218ff3e2df36be1ed27d48f60b..14e61e95294f1af2f292c59ecf67995528fc595f 100644 (file)
@@ -27,8 +27,8 @@ public:
        void put(const char* key, bool value);
        void put(const char* key, int value);
        void put(const char* key, const char* value);
-       bool read(const char* file = NULL);
-       bool write(const char* file = NULL);
+       ReSuccess_t read(const char* file = NULL);
+       ReSuccess_t write(const char* file = NULL);
 
 private:
        void initLogger();
index f52fe2c18dfb419a469de00fa176b0b4a5e14322..4a86676d5aa7cc001570f89cc74e473bc93300f7 100644 (file)
@@ -23,8 +23,9 @@ enum {
 };
 int ReFileUtils::m_maxCharSet = 128;
 bool ReFileUtils::m_ignoreSetUidError = false;
-
 QDateTime ReFileUtils::m_undefinedTime;
+ReMountInfo* ReMountInfo::m_instance = NULL;
+ReBlockDevices* ReBlockDevices::m_instance = NULL;
 
 /**
  * Constructor.
@@ -275,9 +276,9 @@ QString ReFileUtils::copy(const QString& source, const QString& target,
  *                                     <code>false</code>: at least one deletion failed
  */
 
-bool ReFileUtils::deleteTree(const QString& path, bool withBase,
+ReSuccess_t ReFileUtils::deleteTree(const QString& path, bool withBase,
        ReLogger* logger) {
-       bool rc = true;
+       ReSuccess_t rc = true;
        QDir dir(path);
 
        if (dir.exists(path)) {
@@ -587,7 +588,7 @@ mode_t ReFileUtils::nativePermissions(QFile::Permissions permissions){
  * @return                     <code>true</code>: success: the directory exists<br>
  *                                     <code>false</code>: error occurred
  */
-bool ReFileUtils::makeDir(const char* path, ReLogger* logger) {
+ReSuccess_t ReFileUtils::makeDir(const char* path, ReLogger* logger) {
        struct stat info;
        bool rc = true;
        if (stat(path, &info) != 0) {
@@ -613,7 +614,7 @@ bool ReFileUtils::makeDir(const char* path, ReLogger* logger) {
  * @return                     <code>true</code>: success: the directory exists<br>
  *                                     <code>false</code>: error occurred
  */
-bool ReFileUtils::makeDir(const QString& path, ReLogger* logger) {
+ReSuccess_t ReFileUtils::makeDir(const QString& path, ReLogger* logger) {
        return makeDir(I18N::s2b(path).constData(), logger);
 }
 /**
@@ -624,9 +625,9 @@ bool ReFileUtils::makeDir(const QString& path, ReLogger* logger) {
  * @return                     <code>true</code>: success: the directory exists<br>
  *                                     <code>false</code>: error occurred
  */
-bool ReFileUtils::makeDirWithParents(const char* path, ReLogger* logger) {
+ReSuccess_t ReFileUtils::makeDirWithParents(const char* path, ReLogger* logger) {
        struct stat info;
-       bool rc = false;
+       ReSuccess_t rc = false;
        if (stat(path, &info) == 0 && S_ISDIR(info.st_mode)){
                rc = true;
        } else {
@@ -673,7 +674,7 @@ bool ReFileUtils::makeDirWithParents(const char* path, ReLogger* logger) {
  * @return                     <code>true</code>: success: the directory exists<br>
  *                                     <code>false</code>: error occurred
  */
-bool ReFileUtils::makeDirWithParents(const QString& path, ReLogger* logger) {
+ReSuccess_t ReFileUtils::makeDirWithParents(const QString& path, ReLogger* logger) {
        return makeDirWithParents(I18N::s2b(path).constData(), logger);
 }
 
@@ -881,9 +882,9 @@ QByteArray ReFileUtils::replaceExtension(const char* path, const char* ext) {
  * @param logger               the logger
  * @return                             <code>true</code>: success
  */
-bool ReFileUtils::setPermissions(const char* filename,
+ReSuccess_t ReFileUtils::setPermissions(const char* filename,
                QFile::Permissions permissions, ReLogger* logger) {
-       bool rc = true;
+       ReSuccess_t rc = true;
        if (! QFile::setPermissions(QString(filename), permissions)){
                if (logger != NULL)
                        logger->logv(LOG_ERROR, LOC_SET_TIMES_1,
@@ -903,9 +904,9 @@ bool ReFileUtils::setPermissions(const char* filename,
  * @param logger       the logger
  * @return                     <code>true</code>: success
  */
-bool ReFileUtils::setTimes(const char* filename, const QDateTime& modified,
+ReSuccess_t ReFileUtils::setTimes(const char* filename, const QDateTime& modified,
        const QDateTime& accessed, ReLogger* logger) {
-       bool rc = true;
+       ReSuccess_t rc = true;
 #if defined __linux__
        struct timeval vals[2];
        int64_t millisec = accessed == m_undefinedTime
@@ -967,9 +968,9 @@ bool ReFileUtils::setTimes(const char* filename, const QDateTime& modified,
  * @param logger       the logger
  * @return                     <code>true</code>: success
  */
bool ReFileUtils::setTimes(const QString& filename, const QDateTime& modified,
ReSuccess_t ReFileUtils::setTimes(const QString& filename, const QDateTime& modified,
                                const QDateTime& accessed, ReLogger* logger) {
-       bool rc = true;
+       ReSuccess_t rc = true;
 #if defined _WIN32
        // utime does not work with VS10-32-bit
        FILETIME accessed2 = unixTimeToFileTime(accessed.toMSecsSinceEpoch());
@@ -996,8 +997,6 @@ bool ReFileUtils::setTimes(const char* filename, const QDateTime& modified,
        return rc;
 }
 
-                               bool rc = true;
-
 /** Sets the read position of a file.
  * @param file         file to process
  * @param offset       the position. @see <code>whence</code>
@@ -1185,8 +1184,7 @@ QByteArray ReFileUtils::tempFile(const char* node, const char* parent,
                _unlink(rc.constData());
        return rc;
 }
-
-#if defined _WIN32
+#if 0
 /**
  * Converts the unix time (milliseconds from 1.1.1970) to the WIN32 filetime.
  *
@@ -1223,3 +1221,201 @@ void ReFileUtils::writeToFile(const char* filename, const char* content,
                fclose(fp);
        }
 }
+#ifdef __linux__
+/**
+ * Constructor.
+ */
+ReMountInfo::ReMountInfo()
+{
+       load();
+}
+/**
+ * Reads the mount info with the command mount.
+ */
+void ReMountInfo::load()
+{
+       QStringList args;
+       QByteArray output = ReProcess::executeAndRead("/bin/mount", args, 20);
+       QByteArrayList lines = output.split('\n');
+       QString device;
+       QRegularExpression regExpr("^(.*?) on (.*) type ");
+       QString relativePath;
+       QString line;
+       QString directory;
+       for (int ix = 0; ix < lines.size(); ix++){
+               line = I18N::b2s(lines.at(ix));
+               QRegularExpressionMatch match = regExpr.match(line);
+               if (match.hasMatch()){
+                       device = match.captured(1);
+                       directory = match.captured(2);
+                       m_deviceOfMountPoint.insert(directory, device);
+                       m_mountPointOfDevice.insert(device, directory);
+               }
+       }
+}
+
+/**
+ * Find the device of a given path.
+ *
+ * @param path  the path
+ * @return      the device with a mountpoint starting the path
+ */
+QString ReMountInfo::findDevice(const QString &path)
+{
+       QString rc;
+       QMap<QString, QString>::const_iterator it;
+       for (it = m_deviceOfMountPoint.cbegin(); it != m_deviceOfMountPoint.cend(); ++it){
+                       QString path2 = *it;
+                       if (path.startsWith(path2) && path2 != OS_SEPARATOR_STR)
+                               rc = m_deviceOfMountPoint.value(path2);
+       }
+       return rc;
+}
+#endif
+
+#ifdef __linux__
+/**
+ * Returns a singleton instance.
+ *
+ * @forceLoad   <code>true</code>: the current data will be loaded unconditional
+ * @return the singleton instance
+ */
+ReMountInfo& ReMountInfo::instance(bool forceLoad){
+       if (m_instance == NULL)
+               m_instance = new ReMountInfo();
+       else if (forceLoad)
+               m_instance->load();
+
+                       return *m_instance;
+}
+
+/**
+ * Mounts a block device to a given directory.
+ *
+ * @param device       name of the device, e.g. "/dev/sdb1"
+ * @param path         mount point (directory)
+ * @param announcer    <code>NULL</code> or the error logger
+ * @return                     <code>true</code>: success
+ */
+ReSuccess_t ReMountInfo::mount(const QString& device, const QString& path,
+       ReAnnouncer* announcer)
+{
+       QStringList args;
+       args << "/bin/mount" << device << path;
+       QByteArray error;
+       ReSuccess_t rc =  ReProcess::executeSilent("/usr/bin/sudo", args, 30, &error);
+       if (! rc &&& announcer != NULL)
+               announcer->say(LOG_ERROR, QString(error));
+       return rc;
+}
+#endif
+
+#if 0
+bool equals(const QString& s1, const QString& s2){
+       bool rc = s1.length() == s2.length();
+       if (rc){
+               for (int ix = 0; ix < s1.length(); ix++){
+                       if (s1.at(ix) != s2.at(ix)){
+                               rc = false;
+                               break;
+                       }
+               }
+       }
+       return rc;
+}
+#endif
+
+#ifdef __linux__
+/**
+ * Finds the block device by a given label.
+ *
+ * @param label        label to search
+ * @return             <code>NULL</code>: not found
+ *                             otherwise: the block device with the given label
+ */
+const ReBlockDevice* ReBlockDevices::findByLabel(const QString& label) const
+{
+       const ReBlockDevice* rc = NULL;
+       QList<ReBlockDevice>::const_iterator it;
+       for (it = m_devices.cbegin(); it != m_devices.cend(); ++it){
+               if ((*it).m_label == label){
+                       rc = &*it;
+                       break;
+               }
+       }
+       return rc;
+}
+
+/**
+ * Finds the block device by a given label.
+ *
+ * @param label        label to search
+ * @return             <code>NULL</code>: not found
+ *                             otherwise: the block device with the given label
+ */
+const ReBlockDevice* ReBlockDevices::findByDevice(const QString& device) const
+{
+       const ReBlockDevice* rc = NULL;
+       QList<ReBlockDevice>::const_iterator it;
+       for (it = m_devices.cbegin(); it != m_devices.cend(); ++it){
+               if ((*it).m_device == device){
+                       rc = &*it;
+                       break;
+               }
+       }
+       return rc;
+}
+#endif
+
+#ifdef __linux__
+/**
+ * Constructor.
+ */
+ReBlockDevices::ReBlockDevices()
+{
+       load();
+}
+
+/**
+ * Returns the singleton instance.
+ *
+ * @forceLoad   <code>true</code>: the current data will be always reloaded
+ * @return     the singleton instance
+ */
+ReBlockDevices& ReBlockDevices::instance(bool forceLoad)
+{
+       if (m_instance == NULL)
+               m_instance = new ReBlockDevices();
+       else if (forceLoad)
+               m_instance->load();
+       return *m_instance;
+}
+
+/**
+* Reads the information from the blkid command.
+*/
+void ReBlockDevices::load(){
+       QStringList args;
+       QByteArray output = ReProcess::executeAndRead("/sbin/blkid", args, 20);
+       QByteArrayList lines = output.split('\n');
+       QRegularExpression regExpr2("^([^:]+):.*?"
+                                                               "( LABEL=\"([^\"]+)\")?"
+                                                               " UUID=\"([^\"]+)\""
+                                                               " TYPE=\"([^\"]+)\"");
+       QString line;
+       for (int ix = 0; ix < lines.size(); ix++){
+               line = I18N::b2s(lines.at(ix));
+               QRegularExpressionMatch match = regExpr2.match(line);
+               if (match.hasMatch()){
+                       ReBlockDevice dev;
+                       dev.m_device = match.captured(1);
+                       dev.m_label = match.captured(3);
+                       dev.m_uuid = match.captured(4);
+                       dev.m_type = match.captured(5);
+                       m_devices.append(dev);
+               }
+       }
+}
+
+#endif
+
index 94dc5eaec57f9d5968f632e918f81c772b856e68..3ffb5aaa34f440f8a246a831295e9141c91f619a 100644 (file)
@@ -49,7 +49,7 @@ public:
        static QString copy(const QString& source, const QString& target,
                        const QFileInfo* sourceInfo, QByteArray& buffer,
                        bool setUser = true);
-       static bool deleteTree(const QString& path, bool withBase,
+       static ReSuccess_t deleteTree(const QString& path, bool withBase,
                ReLogger* logger = NULL);
        static QString extensionOf(const QString& filename);
        static QByteArray extensionOf(const char* filename);
@@ -86,10 +86,10 @@ public:
                return path.replace(OS_2nd_SEPARATOR, OS_SEPARATOR);
 #endif
        }
-       static bool makeDir(const char* path, ReLogger* logger = NULL);
-       static bool makeDir(const QString& path, ReLogger* logger = NULL);
-       static bool makeDirWithParents(const char* path, ReLogger* logger = NULL);
-       static bool makeDirWithParents(const QString& path, ReLogger* logger = NULL);
+       static ReSuccess_t makeDir(const char* path, ReLogger* logger = NULL);
+       static ReSuccess_t makeDir(const QString& path, ReLogger* logger = NULL);
+       static ReSuccess_t makeDirWithParents(const char* path, ReLogger* logger = NULL);
+       static ReSuccess_t makeDirWithParents(const QString& path, ReLogger* logger = NULL);
        static QString nodeOf(const QString& filename);
        static QByteArray nodeOf(const char* filename);
        static QString parentOf(const QString& filename);
@@ -100,12 +100,12 @@ public:
        static QString replaceExtension(const QString& path, const QString& ext);
        static QByteArray replaceExtension(const char* path, const char* ext);
        static int seek(FILE* file, int64_t offset, int whence);
-       static bool setPermissions(const char* filename,
+       static ReSuccess_t setPermissions(const char* filename,
                                                           QFile::Permissions permissions,
                                                           ReLogger* logger = NULL);
-       static bool setTimes(const char* filename, const QDateTime& modified,
+       static ReSuccess_t setTimes(const char* filename, const QDateTime& modified,
                const QDateTime& accessed = m_undefinedTime, ReLogger* logger = NULL);
-       static bool setTimes(const QString& filename, const QDateTime& modified,
+       static ReSuccess_t setTimes(const QString& filename, const QDateTime& modified,
                const QDateTime& accessed = m_undefinedTime, ReLogger* logger = NULL);
        static void splitUrl(const QString& url, QString* protocol, QString* host,
                        QString* path, QString* node, QString* params = NULL);
@@ -128,4 +128,58 @@ public:
        static bool m_ignoreSetUidError;
 };
 
+#ifdef __linux__
+/**
+ * Holds the info shown by the "mount" command.
+ */
+class ReMountInfo {
+public:
+       ReMountInfo();
+public:
+       void load();
+       QString findDevice(const QString& path);
+public:
+       QMap<QString, QString> m_deviceOfMountPoint;
+       QMap<QString, QString> m_mountPointOfDevice;
+private:
+       static ReMountInfo* m_instance;
+public:
+       static ReMountInfo& instance(bool forceLoad = false);
+       static ReSuccess_t mount(const QString& device, const QString& path,
+               ReAnnouncer* announcer = NULL);
+};
+
+/**
+ * Describes one device with the info get from the command "blkid".
+ */
+class ReBlockDevice {
+public:
+       QString m_device;
+       QString m_label;
+       QString m_uuid;
+       QString m_type;
+       QString m_partitonUUID;
+};
+
+/**
+ * Holds the info shown by the "blkid" command.
+ */
+class ReBlockDevices {
+public:
+       ReBlockDevices();
+public:
+       void load();
+       const ReBlockDevice* findByLabel(const QString& label) const;
+       const ReBlockDevice* findByDevice(const QString& device) const;
+public:
+       static ReBlockDevices& instance(bool forceLoad = false);
+
+private:
+       QList<ReBlockDevice> m_devices;
+private:
+       static ReBlockDevices* m_instance;
+};
+
+#endif
+
 #endif // REFILEUTILS_HPP
index 2147d6a49a627e76f0f9d88c65183ef80d18b962..544f304bebb5419a0adb792fdd3d286f36448992 100644 (file)
@@ -265,7 +265,7 @@ const QByteArray& ReLogger::getStdPrefix(ReLoggerLevel level, int location) {
  * @param message      the logging message
  * @return                     true: for chaining
  */
-bool ReLogger::log(ReLoggerLevel level, int location, const char* message) {
+ReTrue_t ReLogger::log(ReLoggerLevel level, int location, const char* message) {
        m_stdPrefix = "";
        bool first = true;
        for (size_t ix = 0; ix < m_countAppenders; ix++) {
@@ -288,7 +288,7 @@ bool ReLogger::log(ReLoggerLevel level, int location, const char* message) {
  * @param message      the logging message
  * @return                     true: for chaining
  */
-bool ReLogger::log(ReLoggerLevel level, int location,
+ReTrue_t ReLogger::log(ReLoggerLevel level, int location,
        const QByteArray& message) {
        return log(level, location, message.data());
 }
@@ -301,7 +301,7 @@ bool ReLogger::log(ReLoggerLevel level, int location,
  * @param message      the logging message
  * @return                     true: for chaining
  */
-bool ReLogger::log(ReLoggerLevel level, int location, const ReString& message) {
+ReTrue_t ReLogger::log(ReLoggerLevel level, int location, const ReString& message) {
        return log(level, location, I18N::s2b(message).data());
 }
 
@@ -314,7 +314,7 @@ bool ReLogger::log(ReLoggerLevel level, int location, const ReString& message) {
  * @param ...          the values of the placeholders (varargs)
  * @return                     true: for chaining
  */
-bool ReLogger::logv(ReLoggerLevel level, int location, const char* format,
+ReTrue_t ReLogger::logv(ReLoggerLevel level, int location, const char* format,
        ...) {
        char buffer[64000];
        va_list ap;
@@ -334,7 +334,7 @@ bool ReLogger::logv(ReLoggerLevel level, int location, const char* format,
  * @param varlist      variable arguments
  * @return                     true: for chaining
  */
-bool ReLogger::log(ReLoggerLevel level, int location, const char* format,
+ReTrue_t ReLogger::log(ReLoggerLevel level, int location, const char* format,
        va_list& varlist) {
        char buffer[64000];
        qvsnprintf(buffer, sizeof buffer, format, varlist);
index f3cc7520a058d82e619127e8a15d270f89bd53a1..dc06f1d03a832d331970704adc4f6e25e8c04c7e 100644 (file)
@@ -88,11 +88,11 @@ private:
        // Prohibits assignment operator: no implementation!
        ReLogger& operator =(const ReLogger& source);
 public:
-       bool log(ReLoggerLevel level, int location, const char* message);
-       bool log(ReLoggerLevel level, int location, const QByteArray& message);
-       bool log(ReLoggerLevel level, int location, const ReString& message);
-       bool logv(ReLoggerLevel level, int location, const char* format, ...);
-       bool log(ReLoggerLevel level, int location, const char* format,
+       ReTrue_t log(ReLoggerLevel level, int location, const char* message);
+       ReTrue_t log(ReLoggerLevel level, int location, const QByteArray& message);
+       ReTrue_t log(ReLoggerLevel level, int location, const ReString& message);
+       ReTrue_t logv(ReLoggerLevel level, int location, const char* format, ...);
+       ReTrue_t log(ReLoggerLevel level, int location, const char* format,
                va_list& varlist);
        void addAppender(ReAppender* appender);
        ReAppender* findAppender(const char* name) const;
index 2fdd8569570c8ac243ca37df17c389f89e4740cd..e22cb7944e0dceb57ec57bd8c3e6957266bedd40 100644 (file)
@@ -43,6 +43,39 @@ QByteArray ReProcess::executeAndRead(const QString& program,
        return rc;
 }
 
+/**
+ * Executes an external program which have normally no output.
+ *
+ * If an output is found this is an error message.
+ *
+ * @param program              the program to execute
+ * @param args                 the program arguments
+ * @param timeout              the maximal count of seconds waiting for program's end
+ * @param errorMessage OUT: error message. May be <code>NULL</code>
+ * @return                             <code>true</code>: success
+ */
+ReSuccess_t ReProcess::executeSilent(const QString& program,
+               const QStringList& args, int timeout, QByteArray* errorMessage)
+{
+       QProcess process;
+       process.setProcessChannelMode(QProcess::MergedChannels);
+       process.start(program, args, QIODevice::ReadOnly);
+       process.waitForFinished(timeout * 1000);
+       QByteArray output = process.readAllStandardOutput();
+       bool rc = output.isEmpty();
+       if (! rc){
+               if (errorMessage != NULL)
+                       *errorMessage = output;
+       } else {
+               QString error = process.errorString();
+               rc = error.isEmpty();
+               if (! rc && errorMessage != NULL){
+                       *errorMessage = output;
+               }
+       }
+       return rc;
+}
+
 /**
  * Executes an external program and return its output.
  *
index c1c34ddaddfb9b8e1835aac7371e28690a3bd619..c932a4858b056933ef43c6a313df2f6ee92fe2d8 100644 (file)
@@ -21,10 +21,11 @@ public:
 
 public:
        static QByteArray executeAndRead(const QString& program,
-                       const QStringList& args, int timeout = 60, bool mergeStdError = true);
+               const QStringList& args, int timeout = 60, bool mergeStdError = true);
        static QByteArray executeAndRead(const QByteArray& command, int timeout = 60);
        static QByteArray executeAndFilter(const char* command, const QString& regExpr);
-
+       static bool executeSilent(const QString& program, const QStringList& args,
+               int timeout, QByteArray* errorMessage = NULL);
 };
 
 #endif // REPROCESS_HPP
index a2ad003134d1c3cdac4b26d4074596b5048de8e9..4e95a2e1cc76e5947d94d305f2515824dc21f27d 100644 (file)
@@ -1188,14 +1188,14 @@ ReRandomizer& ReByteScrambler::contentRandom(bool doReset)
  * @param info                         OUT: the reserved area in the header
  * @return                                     <code>true</code>: success
  */
-bool ReByteScrambler::initFromHeader(int reservedLength, int markerLength,
+ReSuccess_t ReByteScrambler::initFromHeader(int reservedLength, int markerLength,
                int infoLength, int encryptedFrom, QByteArray* header,
                QByteArray& info)
 {
        TRACE("initFromHeader():\n");
        encryptedFrom = max(encryptedFrom, (int) sizeof(int64_t)
                                                + reservedLength + markerLength);
-       bool rc = true;
+       ReSuccess_t rc = true;
        if (header == NULL)
                header = &m_header;
        int headerLength = sizeof(int64_t) + reservedLength + markerLength + infoLength;
index 21cbdc6e250e2ddc77296f36867dec8c08f17d58..9fdce66de5f44037b57173bbf45914c3992c7f20 100644 (file)
@@ -354,7 +354,7 @@ public:
        ReByteScrambler& operator =(const ReByteScrambler& source);
 public:
        ReRandomizer& contentRandom(bool doReset);
-       bool initFromHeader(int reservedLength, int markerLength,
+       ReSuccess_t initFromHeader(int reservedLength, int markerLength,
                                                int infoLength, int encryptedFrom, QByteArray* header,
                                                QByteArray& info);
        void initHeader(int reservedLength, int markerLength, int infoLength,
index d8b450e0d07b145e4ecd426350028db8b59b22ad..79a815d129d88c667b26ffbdae9fdfa6d669d774 100644 (file)
@@ -434,7 +434,7 @@ QByteArray ReStringUtils::toNumber(int value, const char* format) {
  * @return          true: successful<br>
  *                  false: error occurred
  */
-bool ReStringUtils::write(const char* file, const char* content,
+ReSuccess_t ReStringUtils::write(const char* file, const char* content,
        const char* mode) {
        FILE* fp = fopen(file, mode);
        if (fp != NULL) {
@@ -763,10 +763,10 @@ void ReCharSet::getMinMax(const char* charSet, char& minChar, char& maxChar)
  * @return                             <code>true</code>: success<br>
  *                                             <code>false</code>: minChar or maxChar invalid or wrong size
  */
-bool ReCharSet::fillIndexOf(const char* charSet, char minChar, char maxChar,
+ReSuccess_t ReCharSet::fillIndexOf(const char* charSet, char minChar, char maxChar,
                                                        int* indexOf, size_t sizeIndexOf)
 {
-       bool rc = true;
+       ReSuccess_t rc = true;
        int length = maxChar - minChar + 1;
        if (length != int(sizeIndexOf / sizeof*indexOf))
                rc = false;
index c83eb693257a8e22dcba5cc929ed654679e5a66f..007da6dc7d658f03dce3be161bb7c5bde3a201af 100644 (file)
@@ -62,7 +62,7 @@ public:
                                  char separator = AUTO_SEPARATOR);
        static QByteArray read(const char* file, bool removeLastNewline = true);
        static QByteArray replaceNode(const char* source, const char* newNode);
-       static bool write(const char* file, const char* content = NULL,
+       static ReSuccess_t write(const char* file, const char* content = NULL,
                const char* mode = "w");
        static QList<QByteArray> toArray(const char* source, const char* separator);
        static QByteArray toCString(const char* source, int maxLength = -1);
index 60dfb22b5e0c4a3459b5844a361cf67c426d1d67..986fa58c3b517429328fb311a3a6a752a0b22659 100644 (file)
 #include <QMutex>
 
 typedef unsigned char uint8_t;
+/** <code>true</code> means success. */
+typedef bool ReSuccess_t;
+/** Always true */
+typedef bool ReTrue_t;
+/** Always false */
+typedef bool ReFalse_t;
+
 #if !defined __linux__
 typedef qint64 int64_t;
 #endif
index 21f7d91b35e051a0800be1264963372162cbc88b..e631b20fa2e480284de4aaf3ce46e9cf1241fcc8 100644 (file)
@@ -21,7 +21,8 @@
 #define IF_TRACE(statem) statem
 #define DECLARE_TRACER(varName, fileName) static ReTracer varName(fileName)
 // Example: FILETRACE_IT(s_tracerLoop, (s_tracerLoop.m_fp, "value: %d", 33));
-#define FILETRACE_IT(varName, args) do { fprintf args; fflush(varName.m_fp); } while(false)
+#define FILETRACE_IT(varName, args) do { if (varName.m_fp != NULL) { \
+       fprintf args; fflush(varName.m_fp); } } while(false)
 #else
 #define TRACE(m)
 #define TRACE1(format, a1)
index a2340c812e431c55538610ef11ef89b8f2fcb5b9..74d83264bc0ee34ea1b00c908376e5fbe0ab3956 100644 (file)
@@ -153,9 +153,9 @@ ReLogger* ReGuiApplication::logger()
  * @param type         the type of the queue entry
  * @param widget       NULL or the target widget
  * @param info         the info for the target widget
- * @return          <code>true</code>
+ * @return          <code>true</code> (for chaining)
  */
-bool ReGuiApplication::externalAppend(ReGuiQueueItem::WidgetType type, QWidget* widget,
+ReTrue_t ReGuiApplication::externalAppend(ReGuiQueueItem::WidgetType type, QWidget* widget,
                                                                 const QString& info){
        m_mutexGuiQueue.lock();
        m_guiQueue.pushBack(ReGuiQueueItem(type, widget, info));
index a9de75e32795f821a66c19701514b54a61719cc4..cb3ab294a9c80230e801330988401f27c469a2df 100644 (file)
@@ -82,9 +82,9 @@ ReGuiQueueItem ReGuiQueue::popFront()
  * @return     <code>true</code>: the info could be put into the widget<br>
  *                     <code>false</code>: nothing is done
  */
-bool ReGuiQueueItem::apply(ReGuiQueue &queue, int maxItems) const
+ReSuccess_t ReGuiQueueItem::apply(ReGuiQueue &queue, int maxItems) const
 {
-       bool rc = m_widget != NULL;
+       ReSuccess_t rc = m_widget != NULL;
        if (rc){
                if (maxItems > 0 && queue.m_countOfType[m_type] > maxItems){
                        // nothing to do!
index a5c0c7cb313ce9e603e6b2519814c0db1fb91488..e0a91faf1097c7cceee0a717679702d0cfbf4d7b 100644 (file)
@@ -62,7 +62,7 @@ public:
                return *this;
        }
 public:
-       bool apply(ReGuiQueue &queue, int maxItems = 0) const;
+       ReSuccess_t apply(ReGuiQueue &queue, int maxItems = 0) const;
 public:
        WidgetType m_type;
        QWidget* m_widget;
index 879c1444c3145f1f937c649f6d5587ed3d165321..8304183b8accba7d8861560c9a63eb140d920ad6 100644 (file)
@@ -150,8 +150,10 @@ QByteArray ReStateStorage::fullname(const char* name) {
 
 /**
  * Initializes the instance for writing the storage information.
+ *
+ * @return     <code>true</code>: success
  */
-bool ReStateStorage::initForRead() {
+ReSuccess_t ReStateStorage::initForRead() {
        if (m_fp == NULL)
                if ((m_fp = fopen(I18N::s2b(m_filename).constData(), "rb")) == NULL) {
                        if (m_logger != NULL)
@@ -178,8 +180,10 @@ bool ReStateStorage::initForRead() {
 }
 /**
  * Initializes the instance for writing the storage information.
+ *
+ * @return     <code>true</code>: success
  */
-bool ReStateStorage::initForWrite() {
+ReSuccess_t ReStateStorage::initForWrite() {
        if (m_fp == NULL)
                m_fp = fopen(I18N::s2b(m_filename).constData(), "wb");
        if (m_fp == NULL) {
index b44de8b338de2300592267071e91b8bfa9c9fe4d..cfe9447ea7066fe548d27c2f77219025a11721f4 100644 (file)
@@ -29,8 +29,8 @@ public:
        QByteArray fullname(const char* name);
        QStringList& historyAsList(const char* key, QStringList& list,
                const char* form = NULL);
-       bool initForRead();
-       bool initForWrite();
+       ReSuccess_t initForRead();
+       ReSuccess_t initForWrite();
        /** Returns the map containing the storage content.
         * @return      the map
         */