本文整理汇总了C++中XdgDesktopFile类的典型用法代码示例。如果您正苦于以下问题:C++ XdgDesktopFile类的具体用法?C++ XdgDesktopFile怎么用?C++ XdgDesktopFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XdgDesktopFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: foreach
void LXQtQuickLaunch::dropEvent(QDropEvent *e)
{
const QMimeData *mime = e->mimeData();
foreach (const QUrl &url, mime->urls().toSet())
{
QString fileName(url.isLocalFile() ? url.toLocalFile() : url.url());
QFileInfo fi(fileName);
XdgDesktopFile xdg;
if (xdg.load(fileName))
{
if (xdg.isSuitable())
addButton(new QuickLaunchAction(&xdg, this));
}
else if (fi.exists() && fi.isExecutable() && !fi.isDir())
{
addButton(new QuickLaunchAction(fileName, fileName, "", this));
}
else if (fi.exists())
{
addButton(new QuickLaunchAction(fileName, this));
}
else
{
qWarning() << "XdgDesktopFile" << fileName << "is not valid";
QMessageBox::information(this, tr("Drop Error"),
tr("File/URL '%1' cannot be embedded into QuickLaunch for now").arg(fileName)
);
}
}
saveSettings();
}
开发者ID:MatteO-Matic,项目名称:lxqt-panel,代码行数:33,代码来源:lxqtquicklaunch.cpp
示例2: QAction
XdgAction::XdgAction(const QString& desktopFileName, QObject *parent):
QAction(parent)
{
XdgDesktopFile df;
df.load(desktopFileName);
load(df);
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:7,代码来源:xdgaction.cpp
示例3: QMainWindow
RazorConfig::MainWindow::MainWindow() : QMainWindow()
{
setupUi(this);
qDebug() << "Reading desktop files from dir:" << RAZOR_CONFIG_MODULES_DIR;
QDirIterator it(RAZOR_CONFIG_MODULES_DIR, QStringList() << "*.desktop");
int ix = 0;
QString name;
while (it.hasNext()) {
name = it.next();
XdgDesktopFile *xdg = new XdgDesktopFile();
xdg->load(name);
if (!xdg->isValid())
{
qDebug() << "INVALID DESKTOP FILE:" << name;
delete xdg;
continue;
}
new ConfigItem(xdg, listWidget);
++ix;
}
if (listWidget->count() == 0)
statusBar()->showMessage(tr("No config modules found in: ") + RAZOR_CONFIG_MODULES_DIR);
connect(listWidget, SIGNAL(itemActivated(QListWidgetItem*)),//SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this, SLOT(listWidget_itemDoubleClicked(QListWidgetItem *)));
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:32,代码来源:mainwindow.cpp
示例4: qDebug
void FileIcon::launchApp()
{
qDebug() << "FileIcon::launchApp()" << m_file << m_mimeInfo->mimeType();
XdgDesktopFile* desktopFile = XdgDesktopFileCache::getDefaultApp(m_mimeInfo->mimeType());
if (desktopFile)
desktopFile->startDetached(m_file);
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:8,代码来源:desktopicon.cpp
示例5: run
bool AppLinkItem::run() const
{
XdgDesktopFile desktop;
if (desktop.load(mDesktopFile))
return desktop.startDetached();
else
return false;
}
开发者ID:ThomasVie,项目名称:lxqt-runner,代码行数:8,代码来源:providers.cpp
示例6: QFrame
LXQtQuickLaunch::LXQtQuickLaunch(ILXQtPanelPlugin *plugin, QWidget* parent) :
QFrame(parent),
mPlugin(plugin),
mPlaceHolder(0)
{
setAcceptDrops(true);
mLayout = new LXQt::GridLayout(this);
setLayout(mLayout);
QString desktop;
QString file;
QString execname;
QString exec;
QString icon;
for (const QMap<QString, QVariant> &app : mPlugin->settings()->readArray("apps"))
{
desktop = app.value("desktop", "").toString();
file = app.value("file", "").toString();
if (!desktop.isEmpty())
{
XdgDesktopFile xdg;
if (!xdg.load(desktop))
{
qDebug() << "XdgDesktopFile" << desktop << "is not valid";
continue;
}
if (!xdg.isSuitable())
{
qDebug() << "XdgDesktopFile" << desktop << "is not applicable";
continue;
}
addButton(new QuickLaunchAction(&xdg, this));
}
else if (! file.isEmpty())
{
addButton(new QuickLaunchAction(file, this));
}
else
{
execname = app.value("name", "").toString();
exec = app.value("exec", "").toString();
icon = app.value("icon", "").toString();
if (icon.isNull())
{
qDebug() << "Icon" << icon << "is not valid (isNull). Skipped.";
continue;
}
addButton(new QuickLaunchAction(execname, exec, icon, this));
}
} // for
if (mLayout->isEmpty())
showPlaceHolder();
realign();
}
开发者ID:MatteO-Matic,项目名称:lxqt-panel,代码行数:58,代码来源:lxqtquicklaunch.cpp
示例7: debugAutostart
void XdgAutoStart::debugAutostart()
{
for (int i = 0; i < m_list.count(); i++)
{
XdgDesktopFile * tmp = m_list.at(i);
qDebug() << tmp->value("Name").toString();
}
}
开发者ID:Alexandr-Galko,项目名称:razor-qt,代码行数:9,代码来源:xdgautostart.cpp
示例8: onItemTrigerred
void XdgCachedMenu::onItemTrigerred()
{
XdgCachedMenuAction* action = static_cast<XdgCachedMenuAction*>(sender());
XdgDesktopFile df;
char* desktop_file = menu_cache_item_get_file_path(action->item());
df.load(desktop_file);
g_free(desktop_file);
df.startDetached();
}
开发者ID:MoonLightDE,项目名称:MoonLightDE,代码行数:9,代码来源:xdgcachedmenu.cpp
示例9: file
void AutostartItem::setEnabled(bool enable)
{
XdgDesktopFile f = file();
if (enable)
f.removeEntry("Hidden");
else
f.setValue("Hidden", true);
setLocal(f);
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:10,代码来源:autostartitem.cpp
示例10: qDebug
/**
* @brief does clean the list according to the XDG-Standards
*/
void XdgAutoStart::cleanList()
{
qDebug() << "XdgAutoStart: cleaning house! (" << badNames.count() << " bad Names )";
for (int i = 0; i < m_list.count(); i++)
{
XdgDesktopFile * tmp = m_list.at(i);
if (badNames.contains(tmp->value("Name").toString()))
{
delete m_list.takeAt(i);
}
}
qDebug() << "XdgAutoStart: after cleaning: " << m_list.count()<< " items left.";
}
开发者ID:Alexandr-Galko,项目名称:razor-qt,代码行数:16,代码来源:xdgautostart.cpp
示例11: foreach
void XdgMenuApplinkProcessor::step2()
{
// Create AppLinks elements ...........................
QDomDocument doc = mElement.ownerDocument();
foreach (XdgMenuAppFileInfo* fileInfo, mSelected)
{
if (mOnlyUnallocated && fileInfo->allocated())
continue;
XdgDesktopFile* file = fileInfo->desktopFile();
bool show = false;
QStringList envs = mMenu->environments();
const int N = envs.size();
for (int i = 0; i < N; ++i)
{
if (file->isShown(envs.at(i)))
{
show = true;
break;
}
}
if (!show)
continue;
QDomElement appLink = doc.createElement(QLatin1String("AppLink"));
appLink.setAttribute(QLatin1String("id"), fileInfo->id());
appLink.setAttribute(QLatin1String("title"), file->localizedValue(QLatin1String("Name")).toString());
appLink.setAttribute(QLatin1String("comment"), file->localizedValue(QLatin1String("Comment")).toString());
appLink.setAttribute(QLatin1String("genericName"), file->localizedValue(QLatin1String("GenericName")).toString());
appLink.setAttribute(QLatin1String("exec"), file->value(QLatin1String("Exec")).toString());
appLink.setAttribute(QLatin1String("terminal"), file->value(QLatin1String("Terminal")).toBool());
appLink.setAttribute(QLatin1String("startupNoify"), file->value(QLatin1String("StartupNotify")).toBool());
appLink.setAttribute(QLatin1String("path"), file->value(QLatin1String("Path")).toString());
appLink.setAttribute(QLatin1String("icon"), file->value(QLatin1String("Icon")).toString());
appLink.setAttribute(QLatin1String("desktopFile"), file->fileName());
mElement.appendChild(appLink);
}
// Process childs menus ...............................
foreach (XdgMenuApplinkProcessor* child, mChilds)
child->step2();
}
开发者ID:pmattern,项目名称:libqtxdg,代码行数:49,代码来源:xdgmenuapplinkprocessor.cpp
示例12: exec
void QuickLaunchAction::execAction()
{
QString exec(data().toString());
qDebug() << "execAction" << exec;
switch (m_type)
{
case ActionLegacy:
QProcess::startDetached(exec);
break;
case ActionXdg:
{
XdgDesktopFile * xdg = XdgDesktopFileCache::getFile(exec);
if (xdg->isValid())
xdg->startDetached();
break;
}
case ActionFile:
QDesktopServices::openUrl(QUrl(exec));
break;
}
}
开发者ID:ActionLuzifer,项目名称:razor-qt,代码行数:21,代码来源:quicklaunchaction.cpp
示例13: foreach
foreach (const XdgDesktopFile& file, localList)
{
QString name = QFileInfo(file.fileName()).fileName();
if (items.contains(name))
{
items[name].setLocal(file, true);
}
else
{
AutostartItem item;
item.setLocal(file, true);
items.insert(name, item);
}
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:14,代码来源:autostartitem.cpp
示例14: builGroup
void builGroup(const QDomElement& xml)
{
QString category;
if (! xml.attribute("title").isEmpty())
category = xml.attribute("title");
else
category = xml.attribute("name");
DomElementIterator it(xml , "AppLink");
while(it.hasNext())
{
QDomElement x = it.next();
XdgDesktopFile xdg;
xdg.load(x.attribute("desktopFile"));
ConfigPane pane;
pane.id() = xdg.value("Icon").toString();
pane.category() = category;
pane.setXdg(xdg);
m_list.append(pane);
}
}
开发者ID:Boris-de,项目名称:razor-qt,代码行数:23,代码来源:mainwindow.cpp
示例15: editButton_clicked
void AutoStartPage::editButton_clicked()
{
QModelIndex index = ui->autoStartView->selectionModel()->currentIndex();
XdgDesktopFile file = mXdgAutoStartModel->desktopFile(index);
AutoStartEdit edit(file.name(), file.value("Exec").toString(), file.contains("X-LXQt-Need-Tray"));
if (edit.exec() == QDialog::Accepted)
{
file.setLocalizedValue("Name", edit.name());
file.setValue("Exec", edit.command());
if (edit.needTray())
file.setValue("X-LXQt-Need-Tray", true);
else
file.removeEntry("X-LXQt-Need-Tray");
mXdgAutoStartModel->setEntry(index, file, true);
}
}
开发者ID:RalfJung,项目名称:lxqt-session,代码行数:17,代码来源:autostartpage.cpp
示例16: editButton_clicked
void AutoStartPage::editButton_clicked()
{
QModelIndex index = ui->autoStartView->selectionModel()->currentIndex();
XdgDesktopFile* file = mXdgAutoStartModel->desktopFile(index);
if (!file)
return;
AutoStartEdit edit(file->name(), file->value("Exec").toString(), file->contains("X-Razor-Need-Tray"));
if (edit.exec() == QDialog::Accepted)
{
file->setLocalizedValue("Name", edit.name());
file->setValue("Exec", edit.command());
if (edit.needTray())
file->setValue("X-Razor-Need-Tray", true);
else
file->removeEntry("X-Razor-Need-Tray");
}
mXdgAutoStartModel->setData(index, 0, Qt::UserRole);
}
开发者ID:Odeskguru,项目名称:razor-qt,代码行数:19,代码来源:autostartpage.cpp
示例17: load
void XdgAction::load(const XdgDesktopFile& desktopFile)
{
mDesktopFile = desktopFile;
if (mDesktopFile.isValid())
{
setText(mDesktopFile.name());
setToolTip(mDesktopFile.comment());
setIcon(desktopFile.icon());
if (icon().isNull())
setIcon(XdgIcon::fromTheme("application-x-executable"));
connect(this, SIGNAL(triggered()), this, SLOT(runConmmand()));
}
else
{
setText("");
setToolTip("");
setIcon(QIcon());
}
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:21,代码来源:xdgaction.cpp
示例18: run
bool AppLinkItem::run() const
{
XdgDesktopFile *desktop = XdgDesktopFileCache::getFile(mDesktopFile);
return desktop->startDetached();
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:5,代码来源:providers.cpp
示例19: qDebug
void RazorDeskManager::updateIconList()
{
m_fsw->blockSignals(true);
qDebug() << "updateIconList";
QDirIterator dirIter(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
QStringList tmpList;
while (dirIter.hasNext())
{
dirIter.next();
QString df(dirIter.filePath());
// HACK: QDir::NoDotAndDotDot does not work so this fixes it...
if (df.endsWith("/..") || df.endsWith("/."))
continue;
qDebug() << df;
tmpList.append(df);
// only non existing icons are created
if (m_iconList.contains(df))
{
qDebug() << "updateIconList REREAD. Skip:" << df;
continue;
}
QPoint pos(0, 0);
RazorDeskIconBase * idata;
if (dirIter.filePath().endsWith(".desktop")) //only use .desktop files!
{
XdgDesktopFile* tmp = new XdgDesktopFile();
tmp->load(df);
if (tmp->isShow())
{
idata = new RazorDeskIconDesktop(tmp, pos);
}
else
{
delete tmp;
qDebug() << "Desktop file" << df << "isShow==false";
continue;
}
}
else
{
idata = new RazorDeskIconFile(df, pos);
}
idata->setLaunchMode(m_launchMode);
connect(idata, SIGNAL(moved(QPoint)), this, SLOT(saveIconState()));
m_iconList[df] = idata;
}
// now remove potentialy deleted icons
IconMapIterator iter(m_iconList);
while (iter.hasNext())
{
iter.next();
if (tmpList.contains(iter.key()))
continue;
delete m_iconList.take(iter.key());
}
qDebug() << "Razordeskmanl: found " << m_iconList.count() << " usable desktop-entries";
restoreIconState();
m_fsw->blockSignals(false);
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:73,代码来源:razordeskman.cpp
示例20: switch
QVariantMap XdgModule::loadDesktopFile(const QString &fileName){
QVariantMap result;
XdgDesktopFile desktop;
desktop.load(fileName);
switch(desktop.type()){
case XdgDesktopFile::UnknownType:
result["type"] = "unknown";
break;
case XdgDesktopFile::ApplicationType:
result["type"] = "application";
break;
case XdgDesktopFile::LinkType:
result["type"] = "link";
break;
case XdgDesktopFile::DirectoryType:
result["type"] = "directory";
}
result["valid"] = desktop.isValid();
result["categories"] = desktop.categories();
result["icon"] = desktop.icon().pixmap(icon_size, icon_size);
result["icon_name"] = desktop.iconName();
result["name"] = desktop.name();
result["comment"] = desktop.comment();
QString url = desktop.url();
QVariant exec = desktop.value("Exec");
QVariant no_display = desktop.value("NoDisplay");
if(!url.isEmpty())
result["url"] = url;
if(exec.isValid())
result["exec"] = exec;
if(no_display.isValid())
result["no_display"] = no_display;
return result;
}
开发者ID:Icenowy,项目名称:Cubway,代码行数:36,代码来源:xdg.cpp
注:本文中的XdgDesktopFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论