Ignore:
Timestamp:
04/22/13 13:24:01 (20 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, releng/10.1
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").

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.