File indexing completed on 2024-04-21 16:30:24

0001 // SPDX-FileCopyrightText: 2020 Simon Persson <simon.persson@mykolab.com>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef BUPJOB_H
0006 #define BUPJOB_H
0007 
0008 #include "backupjob.h"
0009 
0010 #include <KProcess>
0011 #include <QElapsedTimer>
0012 #include <QRegularExpression>
0013 
0014 class KupDaemon;
0015 
0016 class BupJob : public BackupJob
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     BupJob(BackupPlan &pBackupPlan, const QString &pDestinationPath, const QString &pLogFilePath, KupDaemon *pKupDaemon);
0022 
0023 protected slots:
0024     void performJob() override;
0025     void slotCheckingStarted();
0026     void slotCheckingDone(int pExitCode, QProcess::ExitStatus pExitStatus);
0027     void startIndexing();
0028     void slotIndexingStarted();
0029     void slotIndexingDone(int pExitCode, QProcess::ExitStatus pExitStatus);
0030     void slotSavingStarted();
0031     void slotSavingDone(int pExitCode, QProcess::ExitStatus pExitStatus);
0032     void slotRecoveryInfoStarted();
0033     void slotRecoveryInfoDone(int pExitCode, QProcess::ExitStatus pExitStatus);
0034     void slotReadBupErrors();
0035 
0036 protected:
0037     bool doSuspend() override;
0038     bool doResume() override;
0039 
0040     KProcess mFsckProcess;
0041     KProcess mIndexProcess;
0042     KProcess mSaveProcess;
0043     KProcess mPar2Process;
0044     QElapsedTimer mInfoRateLimiter;
0045     int mHarmlessErrorCount;
0046     bool mAllErrorsHarmless;
0047     QRegularExpression mLineBreaksRegExp;
0048     QRegularExpression mNonsenseRegExp;
0049     QRegularExpression mFileGoneRegExp;
0050     QRegularExpression mProgressRegExp;
0051     QRegularExpression mErrorCountRegExp;
0052     QRegularExpression mFileInfoRegExp;
0053 };
0054 
0055 #endif /*BUPJOB_H*/