bool KMSpecialManager::loadPrinters() { if (m_loaded) return true; bool result(true); QString localDir = KGlobal::dirs()->localkdedir(); QStringList files = KGlobal::dirs()->findAllResources("data", "kdeprint/specials.desktop"); // local files should processed last, so we need to reorder the list // and put local files at the end QStringList orderedFiles; for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it) { if ((*it).startsWith(localDir)) orderedFiles.append(*it); else orderedFiles.prepend(*it); } // then parse the ordered list for (QStringList::ConstIterator it=orderedFiles.begin(); it!=orderedFiles.end() && result; ++it) { // skip the local file for root if (getuid() == 0 && (*it).startsWith(localDir)) break; else result = loadDesktopFile(*it); } return result; }
void QuickLaunchAction::execAction() { QString exec(data().toString()); qDebug() << "execAction" << exec; switch (m_type) { case ActionLegacy: QProcess::startDetached(exec); break; case ActionXdg: { XdgDesktopFile xdg; if(loadDesktopFile(xdg, exec)) xdg.startDetached(); break; } case ActionFile: QDesktopServices::openUrl(QUrl(exec)); break; } }