当前位置: 首页>>代码示例>>C++>>正文


C++ XdgDesktopFile::load方法代码示例

本文整理汇总了C++中XdgDesktopFile::load方法的典型用法代码示例。如果您正苦于以下问题:C++ XdgDesktopFile::load方法的具体用法?C++ XdgDesktopFile::load怎么用?C++ XdgDesktopFile::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XdgDesktopFile的用法示例。


在下文中一共展示了XdgDesktopFile::load方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: it

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

示例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: dropEvent

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

示例4: run

bool AppLinkItem::run() const
{
    XdgDesktopFile desktop;
    if (desktop.load(mDesktopFile))
        return desktop.startDetached();
    else
        return false;
}
开发者ID:ThomasVie,项目名称:lxqt-runner,代码行数:8,代码来源:providers.cpp

示例5: if

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

示例6: 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

示例7: execAction

void QuickLaunchAction::execAction()
{
    QString exec(data().toString());
    qDebug() << "execAction" << exec;
    switch (m_type)
    {
        case ActionLegacy:
            QProcess::startDetached(exec);
            break;
        case ActionXdg:
        {
            XdgDesktopFile xdg;
            if(xdg.load(exec))
                xdg.startDetached();
            break;
        }
        case ActionFile:
            QDesktopServices::openUrl(QUrl(exec));
            break;
    }
}
开发者ID:dbluelle,项目名称:lxqt-panel,代码行数:21,代码来源:quicklaunchaction.cpp

示例8: 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

示例9: loadDesktopFile

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

示例10: updateIconList

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


注:本文中的XdgDesktopFile::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。