diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/LSession.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index b7ea2fe1..e820e97b 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -11,7 +11,7 @@ #include "BootSplash.h" #ifndef DEBUG -#define DEBUG 0 +#define DEBUG 1 #endif //Initialize all the global objects to null pointers @@ -53,8 +53,8 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu Lumina::EVThread = new QThread(); Lumina::NWS->moveToThread(Lumina::EVThread); Lumina::EVThread->start(); - Lumina::ROOTWIN = new RootWindow(); Lumina::APPLIST = XDGDesktopList::instance(); + Lumina::ROOTWIN = new RootWindow(); Lumina::SHORTCUTS = new LShortcutEvents(); //this can be moved to it's own thread eventually as well setupGlobalConnections(); @@ -134,7 +134,7 @@ void LSession::setupSession(){ Lumina::ROOTWIN->start(); Lumina::NWS->setRoot_numberOfWorkspaces(QStringList() << "one" << "two"); Lumina::NWS->setRoot_currentWorkspace(0); - + if(DEBUG){ qDebug() << " - Create Desktop Context Menu"; } DesktopContextMenu *cmenu = new DesktopContextMenu(Lumina::ROOTWIN); connect(cmenu, SIGNAL(showLeaveDialog()), this, SLOT(StartLogout()) ); cmenu->start(); @@ -384,10 +384,28 @@ void LSession::StartReboot(bool skipupdates){ } void LSession::LaunchApplication(QString exec){ + qDebug() << "Launch Application:" << exec; ExternalProcess::launch(exec); } +void LSession::LaunchDesktopApplication(QString app, QString action){ + qDebug() << "Launch Desktop Application:" << app << action; + XDGDesktop *xdg = Lumina::APPLIST->findAppFile(app); + bool cleanup = false; + if(xdg==0){ + xdg = new XDGDesktop(app); + cleanup = true; + } + if(xdg->isValid()){ + QString exec = xdg->generateExec(QStringList(), action); + ExternalProcess::launch(exec, QStringList(), xdg->startupNotify); + } + + if(cleanup && xdg!=0){ xdg->deleteLater(); } +} + void LSession::LaunchStandardApplication(QString app, QStringList args){ + qDebug() << "Launch Standard Application:" << app << args; //Find/replace standardized apps with thier mimetypes if(app.startsWith("--")){ app = "application/"+app.section("--",-1).simplified(); } //First see if this is a mimetype with a default application @@ -395,24 +413,18 @@ void LSession::LaunchStandardApplication(QString app, QStringList args){ QString mimeapp = XDGMime::findDefaultAppForMime(app); if(!mimeapp.isEmpty()){ app = mimeapp; } } - if(app.endsWith(".desktop")){ + if(!app.endsWith(".desktop")){ + //actual command/binary - just launch it + ExternalProcess::launch(app, args, false); // do not use startup notify cursor + }else{ //Get the XDGDesktop structure XDGDesktop *desk = 0; bool cleanup = false; if(app.startsWith("/") && QFile::exists(app)){ desk = new XDGDesktop(app); cleanup = true; } - if(!desk->isValid()){ + if(desk==0 || !desk->isValid()){ //Need to find the app within the current list - QHash<QString, XDGDesktop*>applist = Lumina::APPLIST->files; if(cleanup){ desk->deleteLater(); desk = 0; cleanup = false; } app = app.section("/",-1); //make sure this is a relative path - QStringList list = applist.keys().filter("/"+app); - if(!list.filter(QDir::homePath()).isEmpty()){ desk = applist[list.filter(QDir::homePath()).first()]; } //prefer user-override files - if(desk==0 || !desk->isValid()){ - desk = 0; - for(int i=0; i<list.length() && desk==0; i++){ - XDGDesktop *tmp = applist[list[i]]; - if(tmp->isValid()){ desk = tmp; } - } - } + desk = Lumina::APPLIST->findAppFile(app); } if(desk!=0 && desk->isValid()){ //Got the application - go ahead and assemble the startup command @@ -420,8 +432,6 @@ void LSession::LaunchStandardApplication(QString app, QStringList args){ ExternalProcess::launch(exec, QStringList(), desk->startupNotify); } if(cleanup){ desk->deleteLater(); } - }else{ - ExternalProcess::launch(app, args, false); // do not use startup notify cursor } } |