Ignore:
Timestamp:
10/23/13 10:09:58 (12 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
dfb8c89
Parents:
b62e8c4
Message:

Add the ability to scan the network for hosts with SSH availability (port 22) to the Configuration UI. If it works, I will add the same thing to the LPWizard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPConfig.cpp

    r6a2483b rb22b3a5  
    1313  connect(ui->tool_apply,SIGNAL(clicked()), this,SLOT(slotApplyChanges()) ); 
    1414  connect(ui->tool_cancel,SIGNAL(clicked()), this, SLOT(slotCancelConfig()) ); 
     15  connect(ui->push_scanNetwork, SIGNAL(clicked()), this, SLOT(autoDetectReplicationTargets()) ); 
    1516} 
    1617 
     
    170171  ui->time_local_daily->setVisible( (index == 0) ); 
    171172} 
     173 
     174void LPConfig::autoDetectReplicationTargets(){ 
     175  QStringList targs = LPGUtils::scanNetworkSSH(); // <name>:::<address>:::<port> 
     176  if(targs.isEmpty()){ 
     177    QMessageBox::warning(this,tr("No Network Targets"), tr("We could not find any systems on the local network with SSH availability (port 22)") ); 
     178    return; 
     179  } 
     180  //Ask the user to select a target 
     181  QStringList targets; 
     182  for(int i=0; i<targs.length(); i++){ 
     183    targets << targs[i].section(":::",0,0); 
     184  } 
     185  bool ok; 
     186  QString target = QInputDialog::getItem(this, tr("Select Replication Target"), tr("Hostname:"), targets, 0, false, &ok); 
     187  if(!ok || target.isEmpty() ){ return; } //cancelled 
     188  //Now look for that target in the list of info 
     189  for(int i=0; i<targs.length(); i++){ 
     190    if(targs[i].startsWith(target+":::")){ 
     191      ui->lineHostName->setText(targs[i].section(":::",1,1)); 
     192      ui->spinPort->setValue( targs[i].section(":::",2,2).toInt() ); 
     193      break; 
     194    } 
     195  } 
     196} 
Note: See TracChangeset for help on using the changeset viewer.