From b38f4f6ce26fd50cc7fac1d1b0c09ab22ee4e3ea Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 22 Jul 2015 16:10:11 -0400 Subject: Finish up the XDG "Actions" specification for *.desktop files, and integrate it into the AppMenu and UserButton. Also add a new flag to lumina-open so that we can specify which action to use when starting an app. --- libLumina/LuminaXDG.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'libLumina/LuminaXDG.cpp') diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp index 19a3fbae..d2b6ef41 100644 --- a/libLumina/LuminaXDG.cpp +++ b/libLumina/LuminaXDG.cpp @@ -25,25 +25,21 @@ XDGDesktop LXDG::loadDesktopFile(QString filePath, bool& ok){ DF.filePath = filePath; DF.lastRead = QDateTime::currentDateTime(); DF.exec = DF.tryexec = ""; // just to make sure this is initialized - //Check input file path validity - //QFile file(filePath); - //if(!file.exists()){ return DF; } //invalid file + //Get the current localization code QString lang = QLocale::system().name(); //lang code QString slang = lang.section("_",0,0); //short lang code - //Open the file - //if(!file.open(QIODevice::Text | QIODevice::ReadOnly)){ - //return DF; - //} - //QTextStream os(&file); + //Read in the File bool insection=false; bool inaction=false; QStringList file = LUtils::readFile(filePath); if(file.isEmpty()){ return DF; } + //if(filePath.contains("pcbsd")){ qDebug() << "Check File:" << filePath << lang << slang; } XDGDesktopAction CDA; //current desktop action for(int i=0; i LXDG::sortDesktopNames(QList apps){ return out; } -QString LXDG::getDesktopExec(XDGDesktop app){ +QString LXDG::getDesktopExec(XDGDesktop app, QString ActionID){ //Generate the executable line for the application QString out; - if(app.exec.isEmpty()){ return ""; } + QString exec = app.exec; + if( !ActionID.isEmpty() ){ + //Go through and grab the proper exec for the listed action + for(int i=0; i