pimsettingexporterconsole.h 2.1 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   Copyright (C) 2015-2016 Montel Laurent <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

Laurent Montel's avatar
Laurent Montel committed
4 5 6 7
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
Laurent Montel's avatar
Laurent Montel committed
8

Laurent Montel's avatar
Laurent Montel committed
9 10 11 12
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
Laurent Montel's avatar
Laurent Montel committed
13

Laurent Montel's avatar
Laurent Montel committed
14 15 16 17
   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
Laurent Montel's avatar
Laurent Montel committed
18 19 20 21 22 23
*/

#ifndef PIMSETTINGEXPORTERCONSOLE_H
#define PIMSETTINGEXPORTERCONSOLE_H

#include <QObject>
Laurent Montel's avatar
Laurent Montel committed
24
class PimSettingsBackupRestore;
Laurent Montel's avatar
Laurent Montel committed
25
class LogInFile;
Laurent Montel's avatar
Laurent Montel committed
26
class LogInfo;
Laurent Montel's avatar
Laurent Montel committed
27 28 29 30
class PimSettingExporterConsole : public QObject
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
31 32 33 34 35
    enum Mode {
        Import = 0,
        Export = 1
    };

Laurent Montel's avatar
Laurent Montel committed
36 37
    explicit PimSettingExporterConsole(QObject *parent = Q_NULLPTR);
    ~PimSettingExporterConsole();
Laurent Montel's avatar
Laurent Montel committed
38

Laurent Montel's avatar
Laurent Montel committed
39 40 41 42 43 44 45
    Mode mode() const;
    void setMode(const Mode &mode);

    void setLogFileName(const QString &logFileName);

    void setTemplateFileName(const QString &templateFileName);

Laurent Montel's avatar
Laurent Montel committed
46
    void start();
47

48 49
    QString importExportFileName() const;
    void setImportExportFileName(const QString &importFileName);
50

Laurent Montel's avatar
Laurent Montel committed
51 52
Q_SIGNALS:
    void finished();
Laurent Montel's avatar
Laurent Montel committed
53

Laurent Montel's avatar
Laurent Montel committed
54 55 56 57
private Q_SLOTS:
    void slotAddEndLine();
    void slotAddError(const QString &message);
    void slotAddInfo(const QString &message);
Laurent Montel's avatar
Laurent Montel committed
58
    void slotAddTitle(const QString &message);
59 60 61
    void slotJobFailed();
    void slotBackupDone();
    void slotJobFinished();
Laurent Montel's avatar
Laurent Montel committed
62
    void slotRestoreDone();
Laurent Montel's avatar
Laurent Montel committed
63
private:
Laurent Montel's avatar
Laurent Montel committed
64
    void initializeLogInFile();
Laurent Montel's avatar
Laurent Montel committed
65
    void closeLogFile();
Laurent Montel's avatar
Laurent Montel committed
66
    QString mTemplateFileName;
67
    QString mImportExportFileName;
Laurent Montel's avatar
Laurent Montel committed
68
    PimSettingsBackupRestore *mPimSettingsBackupRestore;
Laurent Montel's avatar
Laurent Montel committed
69
    LogInFile *mLogInFile;
Laurent Montel's avatar
Laurent Montel committed
70
    LogInfo *mLogInfo;
Laurent Montel's avatar
Laurent Montel committed
71 72
    Mode mMode;
    bool mInProgress;
Laurent Montel's avatar
Laurent Montel committed
73 74 75
};

#endif // PIMSETTINGEXPORTERCONSOLE_H