Ignore:
Timestamp:
Jun 12, 2013 10:30:53 AM (10 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
e6d4539
Parents:
5dbb9c2
Message:

Add support to enable / disable VNET and related options via warden GUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/warden-gui/dialogEditIP.cpp

    rf7c535e red41975  
    2929  JailDir = pcbsd::Utils::getValFromPCConf("/usr/local/etc/warden.conf", "JDIR"); 
    3030  jailName = name; 
     31  QFile file; 
    3132  QString tmp; 
    3233 
     34  // Is VNET enabled? 
     35  file.setFileName( JailDir + "/." + jailName + ".meta/vnet" ); 
     36  if ( file.exists() ) 
     37    checkVNET->setChecked(true); 
     38 
    3339  // Lets start loading IP addresses 
    34   QFile file( JailDir + "/." + jailName + ".meta/ipv4" ); 
     40  file.setFileName( JailDir + "/." + jailName + ".meta/ipv4" ); 
    3541  if ( file.exists() && file.open( QIODevice::ReadOnly ) ) { 
    3642     QTextStream stream( &file ); tmp=""; tmp = stream.readLine(); 
     
    119125 
    120126  // Our buttons / slots 
     127  connect( checkVNET, SIGNAL( clicked() ), this, SLOT( slotCheckChecks() ) ); 
    121128  connect( checkIPv4, SIGNAL( clicked() ), this, SLOT( slotCheckChecks() ) ); 
    122129  connect( checkIPv4Bridge, SIGNAL( clicked() ), this, SLOT( slotCheckChecks() ) ); 
     
    263270  lineIP6Router->setEnabled(checkIPv6Router->isChecked()); 
    264271 
     272  // Enable / disable VNET only options 
     273  if ( checkVNET->isChecked() ) 
     274  { 
     275    lineIPBridge->setEnabled(checkIPv4Bridge->isChecked()); 
     276    lineIPRouter->setEnabled(checkIPv4Router->isChecked()); 
     277    lineIP6Bridge->setEnabled(checkIPv6Bridge->isChecked()); 
     278    lineIP6Router->setEnabled(checkIPv6Router->isChecked()); 
     279    checkIPv4Bridge->setEnabled(true); 
     280    checkIPv4Router->setEnabled(true); 
     281    checkIPv6Bridge->setEnabled(true); 
     282    checkIPv6Router->setEnabled(true); 
     283  } else { 
     284    lineIPBridge->setEnabled(false); 
     285    lineIPRouter->setEnabled(false); 
     286    lineIP6Bridge->setEnabled(false); 
     287    lineIP6Router->setEnabled(false); 
     288    checkIPv4Bridge->setEnabled(false); 
     289    checkIPv4Router->setEnabled(false); 
     290    checkIPv6Bridge->setEnabled(false); 
     291    checkIPv6Router->setEnabled(false); 
     292  } 
     293 
    265294} 
    266295 
     
    317346 
    318347  // Start saving settings 
     348  file.setFileName( JailDir + "/." + jailName + ".meta/vnet" ); 
     349  if ( checkVNET->isChecked() ) { 
     350    if ( file.open( QIODevice::WriteOnly ) ) { 
     351       QTextStream stream( &file ); 
     352         stream << ""; 
     353       file.close(); 
     354    } 
     355  } else { 
     356    file.remove(); 
     357  } 
     358 
    319359  file.setFileName( JailDir + "/." + jailName + ".meta/alias-ipv4" ); 
    320360  if ( ! IPv4Alias.isEmpty() ) { 
Note: See TracChangeset for help on using the changeset viewer.