Skip to content

Commit

Permalink
Add some public operations to backup plan executor
Browse files Browse the repository at this point in the history
  • Loading branch information
spersson committed Apr 15, 2017
1 parent 6a647f6 commit fa5fa70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions daemon/planexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void PlanExecutor::showLog() {
}

void PlanExecutor::startIntegrityCheck() {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || mState == NOT_AVAILABLE) {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || !destinationAvailable()) {
return;
}
KJob *lJob = new BupVerificationJob(*mPlan, mDestinationPath, mLogFilePath, mKupDaemon);
Expand All @@ -244,7 +244,7 @@ void PlanExecutor::startIntegrityCheck() {
}

void PlanExecutor::startRepairJob() {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || mState == NOT_AVAILABLE) {
if(mPlan->mBackupType != BackupPlan::BupType || busy() || !destinationAvailable()) {
return;
}
KJob *lJob = new BupRepairJob(*mPlan, mDestinationPath, mLogFilePath, mKupDaemon);
Expand All @@ -253,6 +253,13 @@ void PlanExecutor::startRepairJob() {
mLastState = mState;
mState = REPAIRING;
emit stateChanged();
}

void PlanExecutor::startBackupSaveJob() {
if(busy() || !destinationAvailable()) {
return;
}
enterBackupRunningState();
mRunBackupAction->setEnabled(false);
}

Expand Down
6 changes: 5 additions & 1 deletion daemon/planexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class PlanExecutor : public QObject
bool busy() {
return mState == BACKUP_RUNNING || mState == INTEGRITY_TESTING || mState == REPAIRING;
}
bool destinationAvailable() {
return mState != NOT_AVAILABLE;
}

QString currentActivityTitle();

Expand All @@ -73,6 +76,8 @@ public slots:
void updateAccumulatedUsageTime();
void startIntegrityCheck();
void startRepairJob();
void startBackupSaveJob();
void showLog();

signals:
void stateChanged();
Expand All @@ -94,7 +99,6 @@ protected slots:

void notifyBackupSucceeded();

void showLog();
void integrityCheckFinished(KJob *pJob);
void discardIntegrityNotification();
void repairFinished(KJob *pJob);
Expand Down

0 comments on commit fa5fa70

Please sign in to comment.