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