Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 4a54eefae84c38efc80f6078f4dbfb13cfb86a5e 1 parent 171831b
Ken Moore beanpole135 authored
12 src-qt4/life-preserver/LPConfig.cpp
@@ -104,17 +104,19 @@ void LPConfig::checkForChanges(){
104 104 if(nTotSnaps != localSnapshots){ localChanged = true; localSnapshots = nTotSnaps; }
105 105
106 106 //Replication Settings
  107 + bool updateSSHKey = false;
107 108 if(isReplicated != ui->groupReplicate->isChecked()){
108 109 remoteChanged = true;
109 110 isReplicated = ui->groupReplicate->isChecked();
  111 + if(isReplicated){ updateSSHKey = true; }
110 112 }
111 113 QString tmp = ui->lineHostName->text().simplified();
112   - if( tmp != remoteHost ){ remoteChanged = true; remoteHost = tmp; }
  114 + if( tmp != remoteHost ){ remoteChanged = true; remoteHost = tmp; updateSSHKey=true;}
113 115 tmp = ui->lineUserName->text().simplified();
114   - if( tmp != remoteUser ){ remoteChanged = true; remoteUser = tmp; }
  116 + if( tmp != remoteUser ){ remoteChanged = true; remoteUser = tmp; updateSSHKey=true;}
115 117 tmp = ui->lineRemoteDataset->text().simplified();
116 118 if( tmp != remoteDataset ){ remoteChanged = true; remoteDataset = tmp; }
117   - if( ui->spinPort->value() != remotePort){ remoteChanged = true; remotePort = ui->spinPort->value(); }
  119 + if( ui->spinPort->value() != remotePort){ remoteChanged = true; remotePort = ui->spinPort->value(); updateSSHKey=true;}
118 120 int nFreq = -1;
119 121 if(ui->radioRepTime->isChecked()){
120 122 nFreq = ui->time_replicate->time().hour();
@@ -124,6 +126,10 @@ void LPConfig::checkForChanges(){
124 126 }else{
125 127 if( nFreq != remoteFreq ){ remoteChanged = true; remoteFreq = nFreq; }
126 128 }
  129 + if(updateSSHKey){
  130 + //Prompt for the SSH key generation
  131 + LPBackend::setupSSHKey(remoteHost, remoteUser, remotePort);
  132 + }
127 133 }
128 134
129 135 void LPConfig::setLocalKeepNumber(){
3  src-qt4/life-preserver/LPWizard.cpp
@@ -32,6 +32,8 @@ void LPWizard::slotFinished(){
32 32 remoteHost = ui->lineHostName->text();
33 33 remoteUser = ui->lineUserName->text();
34 34 remoteDataset = ui->lineRemoteDataset->text();
  35 + //Prompt for the SSH key generation
  36 + LPBackend::setupSSHKey(remoteHost, remoteUser, remotePort);
35 37 }
36 38 if(ui->radioDaily->isChecked()){ localTime = ui->timeEdit->time().hour(); }
37 39 else if( ui->radio10Min->isChecked()){ localTime = -10; }
@@ -44,6 +46,7 @@ void LPWizard::slotFinished(){
44 46 if(localTime >0){ totalSnapshots = ui->spin_keepDays->value(); }
45 47 else{ totalSnapshots = ui->spin_keepDays->value() * (1440/(-localTime)); } //convert to number of snapshots a day
46 48 }
  49 +
47 50 //Now close the UI
48 51 this->close();
49 52 }
2  src-qt4/life-preserver/LPWizard.h
@@ -5,6 +5,8 @@
5 5 #include <QString>
6 6 #include <QDebug>
7 7
  8 +#include "LPBackend.h"
  9 +
8 10 namespace Ui{
9 11 class LPWizard;
10 12 }
10 src-qt4/life-preserver/mainUI.cpp
@@ -238,8 +238,13 @@ void mainUI::on_tool_config_clicked(){
238 238 change = true;
239 239 }
240 240 if(CFG.remoteChanged){
241   - LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
242   - change = true;
  241 + change = true;
  242 + if(CFG.isReplicated){
  243 + LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
  244 + 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!!"));
  245 + }else{
  246 + LPBackend::removeReplication(ds);
  247 + }
243 248 }
244 249 //Now update the UI if appropriate
245 250 if(change){
@@ -341,6 +346,7 @@ void mainUI::slotAddDataset(QAction *act){
341 346 if( LPBackend::setupDataset(dataset, wiz.localTime, wiz.totalSnapshots) ){
342 347 if(wiz.enableReplication){
343 348 LPBackend::setupReplication(dataset, wiz.remoteHost, wiz.remoteUser, wiz.remotePort, wiz.remoteDataset, wiz.remoteTime);
  349 + 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!!"));
344 350 }
345 351 }
346 352 }

0 comments on commit 4a54eef

Please sign in to comment.
Something went wrong with that request. Please try again.