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


C++ UDSEntry::clear方法代码示例

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


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

示例1: listDir

void TrashProtocol::listDir(const KUrl& url)
{
    INIT_IMPL;
    kDebug() << "listdir: " << url;
    if ( url.path(KUrl::AddTrailingSlash) == QLatin1String("/") ) {
        listRoot();
        return;
    }
    int trashId;
    QString fileId;
    QString relativePath;
    bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
    if ( !ok ) {
        error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1", url.prettyUrl() ) );
        return;
    }
    //was: const QString physicalPath = impl.physicalPath( trashId, fileId, relativePath );

    // Get info for deleted directory - the date of deletion and orig path will be used
    // for all the items in it, and we need the physicalPath.
    TrashedFileInfo info;
    ok = impl.infoForFile( trashId, fileId, info );
    if ( !ok || info.physicalPath.isEmpty() ) {
        error( impl.lastErrorCode(), impl.lastErrorMessage() );
        return;
    }
    if ( !relativePath.isEmpty() ) {
        info.physicalPath += QLatin1Char('/');
        info.physicalPath += relativePath;
    }

    // List subdir. Can't use kio_file here since we provide our own info...
    kDebug() << "listing " << info.physicalPath;
    const QStringList entryNames = impl.listDir( info.physicalPath );
    totalSize( entryNames.count() );
    KIO::UDSEntry entry;
    for ( QStringList::const_iterator entryIt = entryNames.begin(), entryEnd = entryNames.end();
          entryIt != entryEnd ; ++entryIt )
    {
        const QString fileName = *entryIt;
        if (fileName == QLatin1String(".."))
            continue;
        const QString filePath = info.physicalPath + QLatin1Char('/') + fileName;
        // shouldn't be necessary
        //const QString url = TrashImpl::makeURL( trashId, fileId, relativePath + '/' + fileName );
        entry.clear();
        TrashedFileInfo infoForItem( info );
        infoForItem.origPath += QLatin1Char('/');
        infoForItem.origPath += fileName;

        if (createUDSEntry(filePath, fileName, fileName, entry, infoForItem)) {
            listEntry( entry, false );
        }
    }
    entry.clear();
    listEntry( entry, true );
    finished();
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:58,代码来源:kio_trash.cpp

示例2: listRoot

void RemoteProtocol::listRoot()
{
	KIO::UDSEntry entry;

	KIO::UDSEntryList remote_entries;
        m_impl.listRoot(remote_entries);

	totalSize(remote_entries.count()+2);

	m_impl.createTopLevelEntry(entry);
	listEntry(entry, false);

	m_impl.createWizardEntry(entry);
	listEntry(entry, false);

	KIO::UDSEntryList::ConstIterator it = remote_entries.constBegin();
	const KIO::UDSEntryList::ConstIterator end = remote_entries.constEnd();
	for(; it!=end; ++it)
	{
		listEntry(*it, false);
	}

	entry.clear();
	listEntry(entry, true);

	finished();
}
开发者ID:fluxer,项目名称:kde-workspace,代码行数:27,代码来源:kio_remote.cpp

示例3: listRoot

void MediaProtocol::listRoot()
{
    KIO::UDSEntry entry;

    KIO::UDSEntryList media_entries;
    bool ok = m_impl.listMedia(media_entries);

    if (!ok)
    {
        error( m_impl.lastErrorCode(), m_impl.lastErrorMessage() );
        return;
    }

    totalSize(media_entries.count()+1);

    m_impl.createTopLevelEntry(entry);
    listEntry(entry, false);

    KIO::UDSEntryListIterator it = media_entries.begin();
    KIO::UDSEntryListIterator end = media_entries.end();

    for(; it!=end; ++it)
    {
        listEntry(*it, false);
    }

    entry.clear();
    listEntry(entry, true);

    finished();
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: listMedia

bool MediaImpl::listMedia(QValueList< KIO::UDSEntry > &list)
{
    kdDebug(1219) << "MediaImpl::listMedia" << endl;

    DCOPRef mediamanager("kded", "mediamanager");
    DCOPReply reply = mediamanager.call("fullList");

    if(!reply.isValid())
    {
        m_lastErrorCode = KIO::ERR_SLAVE_DEFINED;
        m_lastErrorMessage = i18n("The KDE mediamanager is not running.");
        return false;
    }

    Medium::List media = Medium::createList(reply);

    KIO::UDSEntry entry;

    Medium::List::iterator it = media.begin();
    Medium::List::iterator end = media.end();

    for(; it != end; ++it)
    {
        entry.clear();

        createMediumEntry(entry, *it);

        list.append(entry);
    }

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

示例5: statMedium

bool MediaImpl::statMedium(const QString &name, KIO::UDSEntry &entry)
{
    kdDebug(1219) << "MediaImpl::statMedium: " << name << endl;

    DCOPRef mediamanager("kded", "mediamanager");
    DCOPReply reply = mediamanager.call("properties", name);

    if(!reply.isValid())
    {
        m_lastErrorCode = KIO::ERR_SLAVE_DEFINED;
        m_lastErrorMessage = i18n("The KDE mediamanager is not running.");
        return false;
    }

    Medium m = Medium::create(reply);

    if(m.id().isEmpty())
    {
        entry.clear();
        return false;
    }

    createMediumEntry(entry, m);

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

示例6: createHomeEntry

void HomeImpl::createHomeEntry(KIO::UDSEntry &entry,
                               const KUser &user)
{
	kdDebug() << "HomeImpl::createHomeEntry" << endl;
	
	entry.clear();
	
	QString full_name = user.loginName();
	
	if (!user.fullName().isEmpty())
	{
		full_name = user.fullName()+" ("+user.loginName()+")";
	}
	
	full_name = KIO::encodeFileName( full_name );
	
	addAtom(entry, KIO::UDS_NAME, 0, full_name);
	addAtom(entry, KIO::UDS_URL, 0, "home:/"+user.loginName());
	
	addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
	addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");

	QString icon_name = "folder_home2";

	if (user.uid()==m_effectiveUid)
	{
		icon_name = "folder_home";
	}
	
	addAtom(entry, KIO::UDS_ICON_NAME, 0, icon_name);

	KURL url;
	url.setPath(user.homeDir());
	entry += extractUrlInfos(url);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例7: createTopLevelEntry

void MediaImpl::createTopLevelEntry(KIO::UDSEntry &entry) const
{
    entry.clear();
    addAtom(entry, KIO::UDS_URL, 0, "media:/");
    addAtom(entry, KIO::UDS_NAME, 0, ".");
    addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
    addAtom(entry, KIO::UDS_ACCESS, 0555);
    addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");
    addAtom(entry, KIO::UDS_ICON_NAME, 0, "blockdevice");
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:10,代码来源:mediaimpl.cpp

示例8: createTopLevelDirEntry

void TrashProtocol::createTopLevelDirEntry(KIO::UDSEntry &entry)
{
    entry.clear();
    addAtom(entry, KIO::UDS_NAME, 0, ".");
    addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
    addAtom(entry, KIO::UDS_ACCESS, 0700);
    addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");
    addAtom(entry, KIO::UDS_USER, 0, m_userName);
    addAtom(entry, KIO::UDS_GROUP, 0, m_groupName);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:10,代码来源:kio_trash.cpp

示例9: createTopLevelDirEntry

void TrashProtocol::createTopLevelDirEntry(KIO::UDSEntry& entry)
{
    entry.clear();
    entry.insert( KIO::UDSEntry::UDS_NAME, QString::fromLatin1("."));
    entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
    entry.insert( KIO::UDSEntry::UDS_ACCESS, 0700);
    entry.insert( KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("inode/directory"));
    entry.insert( KIO::UDSEntry::UDS_USER, m_userName);
    entry.insert( KIO::UDSEntry::UDS_GROUP, m_groupName);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:10,代码来源:kio_trash.cpp

示例10: createRootUDSEntry

void ArchiveProtocol::createRootUDSEntry( KIO::UDSEntry & entry )
{
    entry.clear();
    entry.insert( KIO::UDSEntry::UDS_NAME, "." );
    entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
    entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, m_mtime );
    //entry.insert( KIO::UDSEntry::UDS_ACCESS, 07777 ); // fake 'x' permissions, this is a pseudo-directory
    entry.insert( KIO::UDSEntry::UDS_USER, m_user);
    entry.insert( KIO::UDSEntry::UDS_GROUP, m_group);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:10,代码来源:kio_archive.cpp

示例11: createTopLevelEntry

void HomeImpl::createTopLevelEntry(KIO::UDSEntry &entry) const
{
	entry.clear();
	addAtom(entry, KIO::UDS_NAME, 0, ".");
	addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
	addAtom(entry, KIO::UDS_ACCESS, 0555);
	addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");
	addAtom(entry, KIO::UDS_ICON_NAME, 0, "kfm_home");
	addAtom(entry, KIO::UDS_USER, 0, "root");
	addAtom(entry, KIO::UDS_GROUP, 0, "root");
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例12: createDirEntry

static void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime,const QString& iconName)
{
    entry.clear();
    entry.insert( KIO::UDSEntry::UDS_NAME, name );
    entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
    entry.insert( KIO::UDSEntry::UDS_ACCESS, 0500 );
    entry.insert( KIO::UDSEntry::UDS_MIME_TYPE, mime );
    if (!url.isEmpty())
        entry.insert( KIO::UDSEntry::UDS_URL, url );
    entry.insert( KIO::UDSEntry::UDS_ICON_NAME, iconName );
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:11,代码来源:kio_applications.cpp

示例13: translateTextToUDS

// translate a simple text to a UDS entry
void KameraProtocol::translateTextToUDS(KIO::UDSEntry &udsEntry,
    const QString &fn,
    const char *text)
{
    udsEntry.clear();
    udsEntry.insert(KIO::UDSEntry::UDS_FILE_TYPE,S_IFREG);
    udsEntry.insert(KIO::UDSEntry::UDS_NAME,path_quote(fn));
    udsEntry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME,fn);
    udsEntry.insert(KIO::UDSEntry::UDS_SIZE,strlen(text));
    udsEntry.insert(KIO::UDSEntry::UDS_ACCESS,(S_IRUSR | S_IRGRP | S_IROTH));
}
开发者ID:KDE,项目名称:kamera,代码行数:12,代码来源:kamera.cpp

示例14: createDirEntry

void KMobileDevice::createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime) const
{
	entry.clear();
	addAtom(entry, KIO::UDS_NAME, 0, name);
	addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
	addAtom(entry, KIO::UDS_ACCESS, 0500);
	addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
	addAtom(entry, KIO::UDS_URL, 0, url);
	PRINT_DEBUG << QString("createDirEntry: File: %1  MIME: %2  URL: %3\n").arg(name).arg(mime).arg(url);
//	addAtom(entry, KIO::UDS_SIZE, 0);
	addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, mime);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例15: listRoot

void TrashProtocol::listRoot()
{
    INIT_IMPL;
    const TrashedFileInfoList lst = impl.list();
    totalSize(lst.count());
    KIO::UDSEntry entry;
    createTopLevelDirEntry(entry);
    listEntry(entry, false);
    for(TrashedFileInfoList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
    {
        const KURL url = TrashImpl::makeURL((*it).trashId, (*it).fileId, QString::null);
        KURL origURL;
        origURL.setPath((*it).origPath);
        entry.clear();
        if(createUDSEntry((*it).physicalPath, origURL.fileName(), url.url(), entry, *it))
            listEntry(entry, false);
    }
    entry.clear();
    listEntry(entry, true);
    finished();
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:21,代码来源:kio_trash.cpp


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