File indexing completed on 2025-01-05 04:37:29

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #ifndef BTAUTOROTATELOGJOB_H
0007 #define BTAUTOROTATELOGJOB_H
0008 
0009 #include <cstdlib>
0010 #include <kio/job.h>
0011 
0012 namespace bt
0013 {
0014 class Log;
0015 
0016 /**
0017     @author Joris Guisson <joris.guisson@gmail.com>
0018 
0019     Job which handles the rotation of the log file.
0020     This Job must do several move jobs which must be done sequentially.
0021 */
0022 class AutoRotateLogJob : public KIO::Job
0023 {
0024 public:
0025     AutoRotateLogJob(const QString &file, Log *lg);
0026     ~AutoRotateLogJob() override;
0027 
0028     virtual void kill(bool quietly = true);
0029 
0030 private:
0031     void moveJobDone(KJob *);
0032     void compressJobDone(KJob *);
0033 
0034     void update();
0035 
0036 private:
0037     QString file;
0038     int cnt;
0039     Log *lg;
0040 };
0041 
0042 }
0043 
0044 #endif