Ignore:
Timestamp:
07/05/13 09:45:49 (13 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
4f9718b
Parents:
635dc54
Message:

Couple improvements to EasyPBI:
1) Allow the user to bypass the warning about an invalid FreeBSD port when adding to make port before/after (no bypass for creating a new module)
2) Make EasyPBI re-generate the scripts directory if it is missing and you try to save a script file to a module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/EasyPBI/mainGUI.cpp

    r9bdcc26 rcc7dbf3  
    163163} 
    164164 
    165 bool MainGUI::isValidPort(QString pPath){ 
     165bool MainGUI::isValidPort(QString pPath, bool allowOverride){ 
    166166  bool ok = FALSE; 
    167167  if( QFile::exists(pPath) && QFile::exists(pPath+"/Makefile") && QFile::exists(pPath+"/distinfo") ){ 
    168168    ok = TRUE; 
     169  } 
     170  //Display a warning message 
     171  if(allowOverride){ 
     172    ok = (QMessageBox::Apply == QMessageBox::warning(this,tr("EasyPBI: Invalid Port"), tr("The directory selected does not appear to be a valid FreeBSD port. \n\n Do you wish to continue using it anyway?"), QMessageBox::Apply | QMessageBox::Cancel, QMessageBox::Cancel) );  
     173  }else{ 
     174    QMessageBox::warning(this,tr("EasyPBI: Invalid Port"), tr("The directory selected is not a valid FreeBSD port. Please select a port directory which contains the appropriate Makefile and distinfo.")); 
    169175  } 
    170176  return ok; 
     
    545551  //Check if the port is valid 
    546552  if( !isValidPort(portSel) ){ 
    547     QMessageBox::warning(this,tr("EasyPBI: Invalid Port"), tr("The directory selected is not a valid FreeBSD port. Please select a port directory which contains the appropriate Makefile and distinfo.")); 
    548553    return; 
    549554  } 
     
    622627  if(portSel.isEmpty()){return;} //action cancelled or closed    
    623628  //Check if the port is valid 
    624   if( !isValidPort(portSel) ){ 
    625     QMessageBox::warning(this,tr("EasyPBI: Invalid Port"), tr("The directory selected is not a valid FreeBSD port. Please select a port directory which contains the appropriate Makefile and distinfo files.")); 
     629  if( !isValidPort(portSel,TRUE) ){ 
    626630    return; 
    627631  } 
     
    649653  if(portSel.isEmpty()){return;} //action cancelled or closed    
    650654  //Check if the port is valid 
    651   if( !isValidPort(portSel) ){ 
    652     QMessageBox::warning(this,tr("EasyPBI: Invalid Port"), tr("The directory selected is not a valid FreeBSD port. Please select a port directory which contains the appropriate Makefile and distinfo files.")); 
     655  if( !isValidPort(portSel,TRUE) ){ 
    653656    return; 
    654657  } 
     
    12341237  QStringList contents = ui->text_scripts_edit->toPlainText().split("\n"); 
    12351238  //get the current file 
    1236   QString filename = currentModule->path() + "/scripts/"+ui->list_scripts_file->currentText(); 
     1239  QString dir = currentModule->path() + "/scripts/"; 
     1240  bool ok = ModBuild::createDir(dir); //make sure the scripts directory exists 
     1241  QString filename = ui->list_scripts_file->currentText(); 
    12371242  //Save the file 
    1238   bool ok = ModBuild::createFile(filename,contents); 
     1243  ok = ModBuild::createFile(dir+filename,contents); 
    12391244  //display a warning if error 
    12401245  if(!ok){ 
Note: See TracChangeset for help on using the changeset viewer.