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


C++ Medium::needMounting方法代码示例

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


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

示例1: ensureMediumMounted

bool MediaImpl::ensureMediumMounted(Medium &medium)
{
    if(medium.id().isEmpty())
    {
        m_lastErrorCode = KIO::ERR_COULD_NOT_MOUNT;
        m_lastErrorMessage = i18n("No such medium.");
        return false;
    }

    if(medium.needMounting())
    {
        m_lastErrorCode = 0;

        mp_mounting = &medium;


        /*
        KIO::Job* job = KIO::mount(false, 0,
                                   medium.deviceNode(),
                                   medium.mountPoint());
        job->setAutoWarningHandlingEnabled(false);
        connect( job, SIGNAL( result( KIO::Job * ) ),
                 this, SLOT( slotMountResult( KIO::Job * ) ) );
        connect( job, SIGNAL( warning( KIO::Job *, const QString & ) ),
                 this, SLOT( slotWarning( KIO::Job *, const QString & ) ) );
        */
        kapp->dcopClient()->connectDCOPSignal("kded", "mediamanager", "mediumChanged(QString, bool)", "mediaimpl", "slotMediumChanged(QString)",
                                              false);

        DCOPRef mediamanager("kded", "mediamanager");
        DCOPReply reply = mediamanager.call("mount", medium.id());
        if(reply.isValid())
            reply.get(m_lastErrorMessage);
        else
            m_lastErrorMessage = i18n("Internal Error");
        if(!m_lastErrorMessage.isEmpty())
            m_lastErrorCode = KIO::ERR_SLAVE_DEFINED;
        else
        {
            qApp->eventLoop()->enterLoop();
        }

        mp_mounting = 0L;

        kapp->dcopClient()->disconnectDCOPSignal("kded", "mediamanager", "mediumChanged(QString, bool)", "mediaimpl", "slotMediumChanged(QString)");

        return m_lastErrorCode == 0;
    }

    return true;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:51,代码来源:mediaimpl.cpp

示例2: createMediumEntry

void MediaImpl::createMediumEntry(KIO::UDSEntry &entry, const Medium &medium)
{
    kdDebug(1219) << "MediaProtocol::createMedium" << endl;

    QString url = "media:/" + medium.name();

    kdDebug(1219) << "url = " << url << ", mime = " << medium.mimeType() << endl;

    entry.clear();

    addAtom(entry, KIO::UDS_URL, 0, url);

    QString label = KIO::encodeFileName(medium.prettyLabel());
    addAtom(entry, KIO::UDS_NAME, 0, label);

    addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);

    addAtom(entry, KIO::UDS_MIME_TYPE, 0, medium.mimeType());
    addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, "inode/directory");

    if(!medium.iconName().isEmpty())
    {
        addAtom(entry, KIO::UDS_ICON_NAME, 0, medium.iconName());
    }
    else
    {
        QString mime = medium.mimeType();
        QString icon = KMimeType::mimeType(mime)->icon(mime, false);
        addAtom(entry, KIO::UDS_ICON_NAME, 0, icon);
    }

    if(medium.needMounting())
    {
        addAtom(entry, KIO::UDS_ACCESS, 0400);
    }
    else
    {
        KURL url = medium.prettyBaseURL();
        entry += extractUrlInfos(url);
    }
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:41,代码来源:mediaimpl.cpp


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