Permalink
Browse files

Clean up when the SSH key generation is automatically run, and remind…

… the user if the remote host information changes to save the SSH Key to a USB stick
  • Loading branch information...
1 parent 171831b commit 4a54eefae84c38efc80f6078f4dbfb13cfb86a5e @beanpole135 beanpole135 committed Aug 21, 2013
View
12 src-qt4/life-preserver/LPConfig.cpp
@@ -104,17 +104,19 @@ void LPConfig::checkForChanges(){
if(nTotSnaps != localSnapshots){ localChanged = true; localSnapshots = nTotSnaps; }
//Replication Settings
+ bool updateSSHKey = false;
if(isReplicated != ui->groupReplicate->isChecked()){
remoteChanged = true;
isReplicated = ui->groupReplicate->isChecked();
+ if(isReplicated){ updateSSHKey = true; }
}
QString tmp = ui->lineHostName->text().simplified();
- if( tmp != remoteHost ){ remoteChanged = true; remoteHost = tmp; }
+ if( tmp != remoteHost ){ remoteChanged = true; remoteHost = tmp; updateSSHKey=true;}
tmp = ui->lineUserName->text().simplified();
- if( tmp != remoteUser ){ remoteChanged = true; remoteUser = tmp; }
+ if( tmp != remoteUser ){ remoteChanged = true; remoteUser = tmp; updateSSHKey=true;}
tmp = ui->lineRemoteDataset->text().simplified();
if( tmp != remoteDataset ){ remoteChanged = true; remoteDataset = tmp; }
- if( ui->spinPort->value() != remotePort){ remoteChanged = true; remotePort = ui->spinPort->value(); }
+ if( ui->spinPort->value() != remotePort){ remoteChanged = true; remotePort = ui->spinPort->value(); updateSSHKey=true;}
int nFreq = -1;
if(ui->radioRepTime->isChecked()){
nFreq = ui->time_replicate->time().hour();
@@ -124,6 +126,10 @@ void LPConfig::checkForChanges(){
}else{
if( nFreq != remoteFreq ){ remoteChanged = true; remoteFreq = nFreq; }
}
+ if(updateSSHKey){
+ //Prompt for the SSH key generation
+ LPBackend::setupSSHKey(remoteHost, remoteUser, remotePort);
+ }
}
void LPConfig::setLocalKeepNumber(){
View
3 src-qt4/life-preserver/LPWizard.cpp
@@ -32,6 +32,8 @@ void LPWizard::slotFinished(){
remoteHost = ui->lineHostName->text();
remoteUser = ui->lineUserName->text();
remoteDataset = ui->lineRemoteDataset->text();
+ //Prompt for the SSH key generation
+ LPBackend::setupSSHKey(remoteHost, remoteUser, remotePort);
}
if(ui->radioDaily->isChecked()){ localTime = ui->timeEdit->time().hour(); }
else if( ui->radio10Min->isChecked()){ localTime = -10; }
@@ -44,6 +46,7 @@ void LPWizard::slotFinished(){
if(localTime >0){ totalSnapshots = ui->spin_keepDays->value(); }
else{ totalSnapshots = ui->spin_keepDays->value() * (1440/(-localTime)); } //convert to number of snapshots a day
}
+
//Now close the UI
this->close();
}
View
2 src-qt4/life-preserver/LPWizard.h
@@ -5,6 +5,8 @@
#include <QString>
#include <QDebug>
+#include "LPBackend.h"
+
namespace Ui{
class LPWizard;
}
View
10 src-qt4/life-preserver/mainUI.cpp
@@ -238,8 +238,13 @@ void mainUI::on_tool_config_clicked(){
change = true;
}
if(CFG.remoteChanged){
- LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
- change = true;
+ change = true;
+ if(CFG.isReplicated){
+ LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
+ QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
+ }else{
+ LPBackend::removeReplication(ds);
+ }
}
//Now update the UI if appropriate
if(change){
@@ -341,6 +346,7 @@ void mainUI::slotAddDataset(QAction *act){
if( LPBackend::setupDataset(dataset, wiz.localTime, wiz.totalSnapshots) ){
if(wiz.enableReplication){
LPBackend::setupReplication(dataset, wiz.remoteHost, wiz.remoteUser, wiz.remotePort, wiz.remoteDataset, wiz.remoteTime);
+ QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
}
}
}

0 comments on commit 4a54eef

Please sign in to comment.