Changeset 56d14dd


Ignore:
Timestamp:
04/22/13 13:24:01 (17 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
5afea32
Parents:
462bd62
git-author:
Ken Moore <ken@…> (04/22/13 13:21:18)
git-committer:
Ken Moore <ken@…> (04/22/13 13:24:01)
Message:

Give EasyPBI the ability to set desktop/menu entries as requiring root (using pc-su), add a menu button to re-load the current module, and fix a couple bugs with the xdg entry binary (used to crash if you gave it a path like "bin/app").

Location:
src-qt4/EasyPBI
Files:
4 edited

Legend:

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

    r1620346 r56d14dd  
    2222        settings = new Config(); 
    2323        //Setup the Menu items 
    24         ui->actionExit->setIcon(Backend::icon("")); 
     24        ui->actionExit->setIcon(Backend::icon("close")); 
     25        ui->actionRefresh_Module->setIcon(Backend::icon("refresh")); 
    2526        //Setup the pushbutton menu lists 
    2627        menu_elOpts.addAction("binary"); 
     
    152153  if( currentModule->path().isEmpty() ){  
    153154    ui->actionPackage_Module->setEnabled(FALSE); 
     155    ui->actionRefresh_Module->setEnabled(FALSE); 
    154156    if(PBI_BUILDING_NOW.isEmpty() ){ui->toolBox->setEnabled(FALSE); return; } 
    155157    else{  
     
    162164    ui->toolBox->setEnabled(TRUE);  
    163165    ui->actionPackage_Module->setEnabled(TRUE);   
     166    ui->actionRefresh_Module->setEnabled(TRUE); 
    164167  } 
    165168  //Figure out the type of module that is loaded 
     
    367370   QMessageBox::information(this,tr("Success"),tr("A copy of the current module has been successfully packaged  within the module directory.") ); 
    368371 
     372} 
     373 
     374void MainGUI::on_actionRefresh_Module_triggered(){ 
     375  QString modSel = currentModule->path(); //re-load the current module 
     376  bool ok = currentModule->loadModule(modSel);  
     377  if(ok){  
     378    qDebug() << "Loaded module:"<<modSel;          
     379    line_module->setText(modSel.replace(QDir::homePath(),"~"));  
     380    if(currentModule->isLocalPBI){ radio_module_local->toggle(); } 
     381    else{  
     382      radio_module_port->toggle(); //Port PBI 
     383      if( settings->check("isportsavailable") ){  
     384        currentModule->readPortInformation(settings->value("portsdir")+"/"+currentModule->readValue("makeport")); 
     385      } 
     386    } 
     387    refreshGUI("all"); 
     388  } 
    369389} 
    370390 
     
    800820    for(int i=0; i<cBins.length(); i++){ 
    801821      menu_bins.addAction(cBins[i]); 
    802       //menu_binsnew.addAction(cBins[i]); 
    803822    }  
    804823  } 
     
    841860    ui->check_xdg_terminal->setChecked(FALSE); 
    842861    ui->check_xdg_nodisplay->setChecked(FALSE); 
     862    ui->check_requiresroot->setChecked(FALSE); 
    843863    ui->push_xdg_savechanges->setEnabled(FALSE); 
    844864    //Make sure we don't have any of the structures loaded from previously 
     
    872892    if( (chk == "true") || (chk=="yes") ){ ui->check_xdg_nodisplay->setChecked(TRUE); } 
    873893    else{ ui->check_xdg_nodisplay->setChecked(FALSE); } 
     894    chk = currentModule->readValue("desktoprequiresroot").toLower(); 
     895    if( (chk == "true") || (chk=="yes") ){ ui->check_xdg_requiresroot->setChecked(TRUE); } 
     896    else{ ui->check_xdg_requiresroot->setChecked(FALSE); } 
    874897         
    875898  }else if(ui->radio_xdg_menu->isChecked()){ 
     
    896919    if( (chk == "true") || (chk=="yes") ){ ui->check_xdg_nodisplay->setChecked(TRUE); } 
    897920    else{ ui->check_xdg_nodisplay->setChecked(FALSE); } 
     921    chk = currentModule->readValue("menurequiresroot").toLower(); 
     922    if( (chk == "true") || (chk=="yes") ){ ui->check_xdg_requiresroot->setChecked(TRUE); } 
     923    else{ ui->check_xdg_requiresroot->setChecked(FALSE); } 
    898924     
    899925    //Load the XDG-MIME file associations 
     
    9741000    if(ui->check_xdg_nodisplay->isChecked()){ checked="true"; } 
    9751001    currentModule->writeValue("desktopnodisplay",checked); 
     1002    checked = "false"; 
     1003    if(ui->check_xdg_requiresroot->isChecked()){ checked="true"; } 
     1004    currentModule->writeValue("desktoprequiresroot", checked); 
    9761005    //Now save the file 
    9771006    ok = currentModule->writeDesktop(); 
     
    9891018    if(ui->check_xdg_nodisplay->isChecked()){ checked="true"; } 
    9901019    currentModule->writeValue("menunodisplay",checked); 
     1020    checked = "false"; 
     1021    if(ui->check_xdg_requiresroot->isChecked()){ checked="true"; } 
     1022    currentModule->writeValue("menurequiresroot", checked); 
    9911023    //Setup the mime type associations as appropriate 
    9921024    checkMime(); 
     
    10091041  QStringList cFiles; 
    10101042  if(ui->radio_xdg_desktop->isChecked() ){ 
    1011     filename = ui->line_xdg_exec->text(); 
     1043    filename = ui->line_xdg_exec->text().section("/",-1); 
    10121044    cFiles = currentModule->filesAvailable("xdg-desktop").replaceInStrings(".desktop",""); 
    10131045  }else if(ui->radio_xdg_menu->isChecked() ){ 
    1014     filename = ui->line_xdg_exec->text(); 
     1046    filename = ui->line_xdg_exec->text().section("/",-1); 
    10151047    cFiles = currentModule->filesAvailable("xdg-menu").replaceInStrings(".desktop",""); 
    10161048  } 
     
    10361068    if(ui->check_xdg_nodisplay->isChecked()){ checked="true"; } 
    10371069    currentModule->writeValue("desktopnodisplay",checked); 
     1070    checked = "false"; 
     1071    if(ui->check_xdg_requiresroot->isChecked()){ checked="true"; } 
     1072    currentModule->writeValue("desktoprequiresroot", checked); 
    10381073    //Now save the file 
    10391074    ok = currentModule->writeDesktop(); 
     
    10551090    if(ui->check_xdg_nodisplay->isChecked()){ checked="true"; } 
    10561091    currentModule->writeValue("menunodisplay",checked); 
     1092    checked = "false"; 
     1093    if(ui->check_xdg_requiresroot->isChecked()){ checked="true"; } 
     1094    currentModule->writeValue("menurequiresroot", checked); 
    10571095    //Now save the file 
    10581096    ok = currentModule->writeMenu();     
  • src-qt4/EasyPBI/mainGUI.h

    r1620346 r56d14dd  
    4545    void on_actionPreferences_triggered(); 
    4646    void on_actionPackage_Module_triggered(); 
     47    void on_actionRefresh_Module_triggered(); 
    4748    void on_actionFreeBSD_Ports_triggered(); 
    4849    void on_actionPBI_Modules_triggered(); 
  • src-qt4/EasyPBI/mainGUI.ui

    r1620346 r56d14dd  
    11311131                     </widget> 
    11321132                    </item> 
    1133                     <item row="5" column="0"> 
     1133                    <item row="6" column="0"> 
    11341134                     <widget class="QLabel" name="label_xdg_menu"> 
    11351135                      <property name="text"> 
     
    11381138                     </widget> 
    11391139                    </item> 
    1140                     <item row="5" column="1"> 
     1140                    <item row="6" column="1"> 
    11411141                     <layout class="QHBoxLayout" name="horizontalLayout_9"> 
    11421142                      <item> 
     
    11591159                     </layout> 
    11601160                    </item> 
    1161                     <item row="6" column="0"> 
     1161                    <item row="7" column="0"> 
    11621162                     <widget class="QLabel" name="label_xdg_mimepatterns"> 
    11631163                      <property name="text"> 
     
    11661166                     </widget> 
    11671167                    </item> 
    1168                     <item row="6" column="1"> 
     1168                    <item row="7" column="1"> 
    11691169                     <widget class="QLineEdit" name="line_xdg_mimepatterns"> 
    11701170                      <property name="statusTip"> 
    11711171                       <string>Space-separated list of automatic file associations (Example: *.junk *.JUNK *.test *.TEST)</string> 
     1172                      </property> 
     1173                     </widget> 
     1174                    </item> 
     1175                    <item row="5" column="1"> 
     1176                     <widget class="QCheckBox" name="check_xdg_requiresroot"> 
     1177                      <property name="toolTip"> 
     1178                       <string>Application needs administrator privileges to run</string> 
     1179                      </property> 
     1180                      <property name="statusTip"> 
     1181                       <string>Application needs administrator privileges to run</string> 
     1182                      </property> 
     1183                      <property name="text"> 
     1184                       <string>Requires Root</string> 
    11721185                      </property> 
    11731186                     </widget> 
     
    16801693    <addaction name="separator"/> 
    16811694    <addaction name="actionPackage_Module"/> 
     1695    <addaction name="actionRefresh_Module"/> 
    16821696   </widget> 
    16831697   <widget class="QMenu" name="menuInformation"> 
     
    18541868   </property> 
    18551869  </action> 
     1870  <action name="actionRefresh_Module"> 
     1871   <property name="text"> 
     1872    <string>Refresh Module</string> 
     1873   </property> 
     1874  </action> 
    18561875 </widget> 
    18571876 <resources> 
  • src-qt4/EasyPBI/modBuild.cpp

    readdb04 r56d14dd  
    1313  serverStruct <<"NO"<<"00"<<"00"<<"NO"; 
    1414    //serverStruct=[ needroot, buildkey, priority, noTMPFS] 
    15   menuStruct << ""<<""<<""<<""<<""<<""<<""<<""; 
    16     //menuStruct=[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype] 
    17   desktopStruct << ""<<""<<""<<""<<""<<""<<""; 
    18     //desktopStruct=[ name, genericname, exec, icon, nodisplay, terminal, mimetype] 
     15  menuStruct << ""<<""<<""<<""<<""<<""<<""<<""<<""; 
     16    //menuStruct=[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype, requiresroot] 
     17  desktopStruct << ""<<""<<""<<""<<""<<""<<""<<""; 
     18    //desktopStruct=[ name, genericname, exec, icon, nodisplay, terminal, mimetype, requiresroot] 
    1919  mimeStruct << "" << "" << ""; 
    2020    //mimeStruct=[ info, type, patterns] (patterns is a " "-delimited list) 
     
    381381  //Reset the structure 
    382382  menuStruct.clear(); 
    383   menuStruct << ""<<""<<""<<""<<""<<""<<""<<"" 
    384   //[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype] 
     383  menuStruct << ""<<""<<""<<""<<""<<""<<""<<""<<"" 
     384  //[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype, requiresroot] 
    385385         
    386386  if(ifile.isEmpty()){ return TRUE; } //Also allow this to be a "reset" function for the currently loaded file 
     
    404404        }else if(line.startsWith("Exec=")){ 
    405405          QString exec = line.section("=",1,3,QString::SectionSkipEmpty); 
     406          if(exec.simplified().startsWith("pc-su ")){ menuStruct[8] = "true"; }            
     407          else{ menuStruct[8] = "false"; } 
    406408          menuStruct[2] = getFilenameFromPath(exec); 
    407409        }else if(line.startsWith("Icon=")){ 
     
    442444  contents << "Name="+menuStruct[0]; 
    443445  contents << "GenericName="+menuStruct[1]; 
    444   contents << "Exec=%%PBI_EXEDIR%%/"+getFilenameFromPath(menuStruct[2]); 
     446  if(menuStruct[8].toLower()=="yes" || menuStruct[8].toLower()=="true"){ 
     447    contents << "Exec=pc-su %%PBI_EXEDIR%%/"+getFilenameFromPath(menuStruct[2]); 
     448  }else{ 
     449    contents << "Exec=%%PBI_EXEDIR%%/"+getFilenameFromPath(menuStruct[2]); 
     450  } 
    445451  contents << "Path=%%PBI_APPDIR%%"; 
    446452  contents << "Icon=%%PBI_APPDIR%%/"+getFilenameFromPath(menuStruct[3]); 
     
    471477  //Reset the structure 
    472478  desktopStruct.clear(); 
    473   desktopStruct << ""<<""<<""<<""<<""<<""<<""; 
    474     //[ name, genericname, exec, icon, nodisplay, terminal, mimetypes] 
     479  desktopStruct << ""<<""<<""<<""<<""<<""<<""<<""; 
     480    //[ name, genericname, exec, icon, nodisplay, terminal, mimetypes, requiresroot] 
    475481         
    476482  if(ifile.isEmpty()){ return TRUE; } //Also allow this to be a "reset" function for the currently loaded file 
     
    494500        }else if(line.startsWith("Exec=")){ 
    495501          QString exec = line.section("=",1,3,QString::SectionSkipEmpty); 
     502          if(exec.simplified().startsWith("pc-su ")){ desktopStruct[7] = "true"; }                 
     503          else{ desktopStruct[7] = "false"; } 
    496504          desktopStruct[2] = getFilenameFromPath(exec); 
    497505        }else if(line.startsWith("Icon=")){ 
     
    530538  contents << "Name="+desktopStruct[0]; 
    531539  contents << "GenericName="+desktopStruct[1]; 
    532   contents << "Exec=%%PBI_EXEDIR%%/"+getFilenameFromPath(desktopStruct[2]); 
     540  if(desktopStruct[7].toLower()=="yes" || desktopStruct[7].toLower()=="true"){ 
     541    contents << "Exec=pc-su %%PBI_EXEDIR%%/"+getFilenameFromPath(desktopStruct[2]); 
     542  }else{ 
     543    contents << "Exec=%%PBI_EXEDIR%%/"+getFilenameFromPath(desktopStruct[2]); 
     544  } 
    533545  contents << "Path=%%PBI_APPDIR%%"; 
    534546  contents << "Icon=%%PBI_APPDIR%%/"+getFilenameFromPath(desktopStruct[3]); 
     
    931943//mkStruct=[ makeport, portbefore, portafter, makeoptions] 
    932944//serverStruct=[ needroot, buildkey, priority, noTMPFS] 
    933 //menuStruct=[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype] 
    934 //desktopStruct=[ name, genericname, exec, icon, nodisplay, terminal, mimetype] 
     945//menuStruct=[ name, genericname, exec, icon, nodisplay, terminal, categories, mimetype, requiresroot] 
     946//desktopStruct=[ name, genericname, exec, icon, nodisplay, terminal, mimetype, requiresroot] 
    935947//mimeStruct=[ info, type, patterns] (patterns is a " "-delimited list) 
    936948//portStruct=[ name, author, website, options, binaries, menu-category, isGraphical ]    
     
    959971  else if(var=="menucategories"){ val = menuStruct[6]; } 
    960972  else if(var=="menumimetype"){ val = menuStruct[7]; } 
     973  else if(var=="menurequiresroot"){ val = menuStruct[8]; } 
    961974  else if(var=="desktopname"){ val = desktopStruct[0]; } 
    962975  else if(var=="desktopgenericname"){ val = desktopStruct[1]; } 
     
    966979  else if(var=="desktopterminal"){ val = desktopStruct[5]; } 
    967980  else if(var=="desktopmimetype"){ val = desktopStruct[6]; } 
     981  else if(var=="desktoprequiresroot"){ val = desktopStruct[7]; } 
    968982  else if(var=="mimeinfo"){ val = mimeStruct[0]; } 
    969983  else if(var=="mimetype"){ val = mimeStruct[1]; } 
     
    10121026  else if(var=="menucategories"){ menuStruct[6] = value; } 
    10131027  else if(var=="menumimetype"){ menuStruct[7] = value; } 
     1028  else if(var=="menurequiresroot"){ menuStruct[8] = value; } 
    10141029  else if(var=="desktopname"){ desktopStruct[0] = value; } 
    10151030  else if(var=="desktopgenericname"){ desktopStruct[1] = value; } 
     
    10191034  else if(var=="desktopterminal"){ desktopStruct[5] = value; } 
    10201035  else if(var=="desktopmimetype"){ desktopStruct[6] = value; } 
     1036  else if(var=="desktoprequiresroot"){ desktopStruct[7] = value; } 
    10211037  else if(var=="mimeinfo"){ mimeStruct[0] = value; } 
    10221038  else if(var=="mimetype"){ mimeStruct[1] = value; } 
Note: See TracChangeset for help on using the changeset viewer.