[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/network/ktorrent/libbtcore
From: Joris Guisson <joris.guisson () gmail ! com>
Date: 2008-03-26 10:36:00
Message-ID: 1206527760.601572.15310.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 790278 by guisson:
Added KIO::Job to gzip files, and use this job in the log rotation code, thereby \
removing the not so portable system() calls.
M +1 -0 CMakeLists.txt
M +12 -6 util/autorotatelogjob.cpp
M +1 -0 util/autorotatelogjob.h
A util/compressfilejob.cpp [License: GPL (v2+)]
A util/compressfilejob.h [License: GPL (v2+)]
M +4 -1 util/log.cpp
--- trunk/extragear/network/ktorrent/libbtcore/CMakeLists.txt #790277:790278
@@ -43,6 +43,7 @@
util/log.cpp
util/waitjob.cpp
util/autorotatelogjob.cpp
+ util/compressfilejob.cpp
bcodec/bdecoder.cpp
bcodec/bencoder.cpp
--- trunk/extragear/network/ktorrent/libbtcore/util/autorotatelogjob.cpp \
#790277:790278 @@ -19,9 +19,9 @@
***************************************************************************/
#include "autorotatelogjob.h"
#include <kurl.h>
-#include <k3process.h>
#include <util/fileops.h>
#include "log.h"
+#include "compressfilejob.h"
namespace bt
{
@@ -67,19 +67,25 @@
}
else
{
- // final log file is moved, now zip it and end the job
- std::system(QString("gzip " + K3Process::quote(file + "-1")).toLocal8Bit());
- lg->logRotateDone();
- emitResult();
+ // final log file is moved, now zip it and end the job
+ CompressFileJob* gzip = new CompressFileJob(file + "-1");
+ connect(gzip,SIGNAL(result(KJob*)),this,SLOT(compressJobDone(KJob*)));
+ gzip->start();
}
}
void AutoRotateLogJob::moveJobDone(KJob*)
{
- cnt--; // decrease counter so the newt file will be moved in update
+ cnt--; // decrease counter so the new file will be moved in update
update(); // don't care about result of job
}
+
+ void AutoRotateLogJob::compressJobDone(KJob*)
+ {
+ lg->logRotateDone();
+ emitResult();
+ }
}
#include "autorotatelogjob.moc"
--- trunk/extragear/network/ktorrent/libbtcore/util/autorotatelogjob.h #790277:790278
@@ -44,6 +44,7 @@
private slots:
void moveJobDone(KJob*);
+ void compressJobDone(KJob*);
private:
void update();
--- trunk/extragear/network/ktorrent/libbtcore/util/log.cpp #790277:790278
@@ -31,6 +31,7 @@
#include <qmutex.h>
#include "error.h"
#include "autorotatelogjob.h"
+#include "compressfilejob.h"
namespace bt
@@ -95,7 +96,9 @@
// move current log to 1 and zip it
bt::Move(file,file + "-1",true);
- system(QString("gzip %1-1").arg(file).toLocal8Bit());
+ CompressFileJob* gzip = new CompressFileJob(file + "-1");
+ gzip->exec();
+ delete gzip;
}
void setOutputFile(const QString & file,bool rotate)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic