|
|
|
@ -53,18 +53,18 @@ void RDBManager::slotForceBackup(TQValueList<Backup> backupList)
|
|
|
|
|
TQString RDBManager::compareAtTime(Backup backup, TQDateTime date)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--compare-at-time";
|
|
|
|
|
*proc << TQString::number(date.toTime_t()); // increment date
|
|
|
|
|
// Adds source and dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.source())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.source())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
// Adds the listener
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList output = listen->stdOut();
|
|
|
|
@ -81,17 +81,17 @@ TQString RDBManager::compareAtTime(Backup backup, TQDateTime date)
|
|
|
|
|
TQString RDBManager::listChangedSince(Backup backup, TQDateTime date)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--list-changed-since";
|
|
|
|
|
*proc << TQString::number(date.toTime_t()); // increment date
|
|
|
|
|
// Adds the dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
// Adds a listener
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList output = listen->stdOut();
|
|
|
|
@ -108,17 +108,17 @@ TQString RDBManager::listChangedSince(Backup backup, TQDateTime date)
|
|
|
|
|
TQString RDBManager::listAtTime(Backup backup, TQDateTime date)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--list-at-time";
|
|
|
|
|
*proc << TQString::number(date.toTime_t()); // increment date
|
|
|
|
|
// Adds the dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
// Adds a listener
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList output = listen->stdOut();
|
|
|
|
@ -135,18 +135,18 @@ TQString RDBManager::listAtTime(Backup backup, TQDateTime date)
|
|
|
|
|
TQValueList<TQDateTime> RDBManager::incrementList(Backup backup)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--list-increments";
|
|
|
|
|
*proc << "-v2";
|
|
|
|
|
*proc << "--parsable-output";
|
|
|
|
|
// Adds the dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
// Adds a listener
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList output = listen->stdOut();
|
|
|
|
@ -204,20 +204,20 @@ TQValueList<Backup> RDBManager::outdatedBackupList()
|
|
|
|
|
void RDBManager::slotRestoreBackup(Backup backup,TQDateTime time)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--force";
|
|
|
|
|
*proc << "--restore-as-of";
|
|
|
|
|
*proc << TQString::number(time.toTime_t()); // Date of the increment to restore
|
|
|
|
|
// Adds source and dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.source())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.source())));
|
|
|
|
|
// Adds a listener (for output recording)
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStderr(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdErr(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStderr(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdErr(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
kdDebug() << "Executed process: " << proc->args() << endl;
|
|
|
|
@ -235,13 +235,13 @@ void RDBManager::slotRestoreBackup(Backup backup,TQDateTime time)
|
|
|
|
|
bool RDBManager::isRDB()
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
*proc << "-V";
|
|
|
|
|
// Adds a listener (for output recording)
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList outList = listen->stdOut();
|
|
|
|
@ -260,13 +260,13 @@ bool RDBManager::isRDB()
|
|
|
|
|
TQString RDBManager::RDBVersion()
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
*proc << "-V";
|
|
|
|
|
// Adds a listener (for output recording)
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
TQStringList outList = listen->stdOut();
|
|
|
|
@ -283,7 +283,7 @@ TQString RDBManager::RDBVersion()
|
|
|
|
|
void RDBManager::doBackup(Backup backup)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess(KeepSettings::controlRDBPriority,KeepSettings::rDBPriority());
|
|
|
|
|
TDEProcess *proc = RDBProcess(KeepSettings::controlRDBPriority,KeepSettings::rDBPriority());
|
|
|
|
|
// Adds include and exclude
|
|
|
|
|
if ( backup.useIncludeExclude() )
|
|
|
|
|
{
|
|
|
|
@ -296,12 +296,12 @@ void RDBManager::doBackup(Backup backup)
|
|
|
|
|
if ( type == "I" )
|
|
|
|
|
{
|
|
|
|
|
*proc << "--include";
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(file)));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(file)));
|
|
|
|
|
}
|
|
|
|
|
else if ( type == "E" )
|
|
|
|
|
{
|
|
|
|
|
*proc << "--exclude";
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(file)));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(file)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -325,14 +325,14 @@ void RDBManager::doBackup(Backup backup)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Adds source and dest
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.source())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(KProcess::quote(backup.dest())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.source())));
|
|
|
|
|
*proc << TQString(TQFile::encodeName(TDEProcess::quote(backup.dest())));
|
|
|
|
|
// Adds a listener (for output recording)
|
|
|
|
|
RDBListener *listen = new RDBListener();
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStderr(KProcess *,char *,int)),listen,TQT_SLOT(receivedStdErr(KProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStdout(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdOut(TDEProcess *,char *,int)));
|
|
|
|
|
connect(proc,TQT_SIGNAL(receivedStderr(TDEProcess *,char *,int)),listen,TQT_SLOT(receivedStdErr(TDEProcess *,char *,int)));
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
kdDebug() << "Executed process: " << proc->args() << endl;
|
|
|
|
@ -358,13 +358,13 @@ void RDBManager::doBackup(Backup backup)
|
|
|
|
|
void RDBManager::removeOldIncrements(Backup backup)
|
|
|
|
|
{
|
|
|
|
|
// Gets the rdiff-backup process
|
|
|
|
|
KProcess *proc = RDBProcess();
|
|
|
|
|
TDEProcess *proc = RDBProcess();
|
|
|
|
|
// Adds the options
|
|
|
|
|
*proc << "--remove-older-than" << TQString("%1").arg(backup.deleteAfter()) + "D";
|
|
|
|
|
// Adds dest
|
|
|
|
|
*proc << backup.dest();
|
|
|
|
|
// Starts the process
|
|
|
|
|
if ( !proc->start(KProcess::Block, KProcess::AllOutput) )
|
|
|
|
|
if ( !proc->start(TDEProcess::Block, TDEProcess::AllOutput) )
|
|
|
|
|
kdDebug() << "Error starting rdiff-backup" << endl;
|
|
|
|
|
|
|
|
|
|
kdDebug() << "Executed process: " << proc->args() << endl;
|
|
|
|
@ -372,9 +372,9 @@ void RDBManager::removeOldIncrements(Backup backup)
|
|
|
|
|
delete proc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KProcess *RDBManager::RDBProcess(bool isNice,int niceLevel)
|
|
|
|
|
TDEProcess *RDBManager::RDBProcess(bool isNice,int niceLevel)
|
|
|
|
|
{
|
|
|
|
|
KProcess *proc = new KProcess();
|
|
|
|
|
TDEProcess *proc = new TDEProcess();
|
|
|
|
|
proc->setUseShell(true);
|
|
|
|
|
if ( isNice )
|
|
|
|
|
{
|
|
|
|
|