本文整理汇总了C++中kio::UDSEntry::append方法的典型用法代码示例。如果您正苦于以下问题:C++ UDSEntry::append方法的具体用法?C++ UDSEntry::append怎么用?C++ UDSEntry::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::UDSEntry
的用法示例。
在下文中一共展示了UDSEntry::append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listVideoDVDs
void kio_videodvdProtocol::listVideoDVDs()
{
int cnt = 0;
for( QPtrListIterator<K3bDevice::Device> it( s_deviceManager->dvdReader() ); *it; ++it ) {
K3bDevice::Device* dev = *it;
K3bDevice::DiskInfo di = dev->diskInfo();
// we search for a DVD with a single track.
if( di.isDvdMedia() && di.numTracks() == 1 ) {
//
// now do a quick check for VideoDVD.
// - no dvdcss for speed
// - only a check for the VIDEO_TS dir
//
K3bIso9660 iso( new K3bIso9660DeviceBackend(dev) );
iso.setPlainIso9660( true );
if( iso.open() && iso.firstIsoDirEntry()->entry( "VIDEO_TS" ) ) {
// FIXME: cache the entry for speedup
UDSEntryList udsl;
KIO::UDSEntry uds;
KIO::UDSAtom a;
a.m_uds = KIO::UDS_NAME;
a.m_str = iso.primaryDescriptor().volumeId;
uds.append( a );
a.m_uds = KIO::UDS_FILE_TYPE;
a.m_long = S_IFDIR;
uds.append( a );
a.m_uds = KIO::UDS_MIME_TYPE;
a.m_str = "inode/directory";
uds.append( a );
a.m_uds = KIO::UDS_ICON_NAME;
a.m_str = "dvd_unmount";
uds.append( a );
udsl.append( uds );
listEntries( udsl );
++cnt;
}
}
}
if( cnt )
finished();
else
error( ERR_SLAVE_DEFINED, i18n("No VideoDVD found") );
}
示例2: createUDSEntry
KIO::UDSEntry kio_videodvdProtocol::createUDSEntry( const K3bIso9660Entry* e ) const
{
KIO::UDSEntry uds;
KIO::UDSAtom a;
a.m_uds = KIO::UDS_NAME;
a.m_str = e->name();
uds.append( a );
a.m_uds = KIO::UDS_ACCESS;
a.m_long = e->permissions();
uds.append( a );
a.m_uds = KIO::UDS_CREATION_TIME;
a.m_long = e->date();
uds.append( a );
a.m_uds = KIO::UDS_MODIFICATION_TIME;
a.m_long = e->date();
uds.append( a );
if( e->isDirectory() )
{
a.m_uds = KIO::UDS_FILE_TYPE;
a.m_long = S_IFDIR;
uds.append( a );
a.m_uds = KIO::UDS_MIME_TYPE;
a.m_str = "inode/directory";
uds.append( a );
}
else
{
const K3bIso9660File* file = static_cast<const K3bIso9660File*>( e );
a.m_uds = KIO::UDS_SIZE;
a.m_long = file->size();
uds.append( a );
a.m_uds = KIO::UDS_FILE_TYPE;
a.m_long = S_IFREG;
uds.append( a );
a.m_uds = KIO::UDS_MIME_TYPE;
if( e->name().endsWith( "VOB" ) )
a.m_str = "video/mpeg";
else
a.m_str = "unknown";
uds.append( a );
}
return uds;
}
示例3: extractUrlInfos
KIO::UDSEntry HomeImpl::extractUrlInfos(const KURL &url)
{
m_entryBuffer.clear();
KIO::StatJob *job = KIO::stat(url, false);
connect( job, SIGNAL( result(KIO::Job *) ),
this, SLOT( slotStatResult(KIO::Job *) ) );
qApp->eventLoop()->enterLoop();
KIO::UDSEntry::iterator it = m_entryBuffer.begin();
KIO::UDSEntry::iterator end = m_entryBuffer.end();
KIO::UDSEntry infos;
for(; it!=end; ++it)
{
switch( (*it).m_uds )
{
case KIO::UDS_ACCESS:
case KIO::UDS_USER:
case KIO::UDS_GROUP:
case KIO::UDS_CREATION_TIME:
case KIO::UDS_MODIFICATION_TIME:
case KIO::UDS_ACCESS_TIME:
infos.append(*it);
break;
default:
break;
}
}
addAtom(infos, KIO::UDS_LOCAL_PATH, 0, url.path());
return infos;
}
示例4: addAtom
static void addAtom(KIO::UDSEntry &entry, unsigned int ID, long long l, const QString &s = QString::null)
{
KIO::UDSAtom atom;
atom.m_uds = ID;
atom.m_long = l;
atom.m_str = s;
entry.append(atom);
}
示例5: createUDSEntry
void PakProtocol::createUDSEntry(const KArchiveEntry *archiveEntry, KIO::UDSEntry &entry) {
KIO::UDSAtom atom;
entry.clear();
atom.m_uds = KIO::UDS_NAME;
atom.m_str = remoteEncoding()->decode(archiveEntry->name().local8Bit());
entry.append(atom);
atom.m_uds = KIO::UDS_SIZE;
atom.m_long = archiveEntry->isFile() ? ((KArchiveFile *)archiveEntry)->size() : 0L ;
entry.append(atom);
atom.m_uds = KIO::UDS_FILE_TYPE;
atom.m_long = archiveEntry->permissions() & S_IFMT; // keep file type only
entry.append(atom);
atom.m_uds = KIO::UDS_ACCESS;
atom.m_long = archiveEntry->permissions() & 07777; // keep permissions only
entry.append(atom);
}
示例6: stat
void kio_videodvdProtocol::stat( const KURL& url )
{
if( url.path() == "/" ) {
//
// stat the root path
//
KIO::UDSEntry uds;
KIO::UDSAtom a;
a.m_uds = KIO::UDS_NAME;
a.m_str = "/";
uds.append( a );
a.m_uds = KIO::UDS_FILE_TYPE;
a.m_long = S_IFDIR;
uds.append( a );
a.m_uds = KIO::UDS_MIME_TYPE;
a.m_str = "inode/directory";
uds.append( a );
statEntry( uds );
finished();
}
else {
QString isoPath;
K3bIso9660* iso = openIso( url, isoPath );
if( iso ) {
const K3bIso9660Entry* e = iso->firstIsoDirEntry()->entry( isoPath );
if( e ) {
statEntry( createUDSEntry( e ) );
finished();
}
else
error( ERR_DOES_NOT_EXIST, url.path() );
delete iso;
}
}
}
示例7: extractUrlInfos
KIO::UDSEntry MediaImpl::extractUrlInfos(const KURL &url)
{
m_entryBuffer.clear();
KIO::StatJob *job = KIO::stat(url, false);
job->setAutoWarningHandlingEnabled(false);
connect(job, SIGNAL(result(KIO::Job *)), this, SLOT(slotStatResult(KIO::Job *)));
connect(job, SIGNAL(warning(KIO::Job *, const QString &)), this, SLOT(slotWarning(KIO::Job *, const QString &)));
qApp->eventLoop()->enterLoop();
KIO::UDSEntry::iterator it = m_entryBuffer.begin();
KIO::UDSEntry::iterator end = m_entryBuffer.end();
KIO::UDSEntry infos;
for(; it != end; ++it)
{
switch((*it).m_uds)
{
case KIO::UDS_ACCESS:
case KIO::UDS_USER:
case KIO::UDS_GROUP:
case KIO::UDS_CREATION_TIME:
case KIO::UDS_MODIFICATION_TIME:
case KIO::UDS_ACCESS_TIME:
infos.append(*it);
break;
default:
break;
}
}
if(url.isLocalFile())
{
addAtom(infos, KIO::UDS_LOCAL_PATH, 0, url.path());
}
return infos;
}
示例8: stat
void PakProtocol::stat(const KURL &url) {
kdDebug(PAK_DEBUG_ID) << "Entering stat()" << endl;
QString path;
KIO::UDSEntry entry;
KIO::Error errorNum;
if ( !checkNewFile( url, path, errorNum ) )
{
// We may be looking at a real directory - this happens
// when pressing up after being in the root of an archive
if ( errorNum == KIO::ERR_CANNOT_OPEN_FOR_READING )
{
// If we cannot open, it might be a problem with the archive header (e.g. unsupported format)
// Therefore give a more specific error message
error( KIO::ERR_SLAVE_DEFINED,
i18n( "Could not open the file, probably due to an unsupported file format.\n%1")
.arg( url.prettyURL() ) );
return;
}
else if ( errorNum != KIO::ERR_IS_DIRECTORY )
{
// We have any other error
error( errorNum, url.prettyURL() );
return;
}
// Real directory. Return just enough information for KRun to work
KIO::UDSAtom atom;
atom.m_uds = KIO::UDS_NAME;
atom.m_str = url.fileName();
entry.append( atom );
kdDebug( PAK_DEBUG_ID ) << "ArchiveProtocol::stat returning name=" << url.fileName() << endl;
KDE_struct_stat buff;
if ( KDE_stat( QFile::encodeName( url.path() ), &buff ) == -1 )
{
// Should not happen, as the file was already stated by checkNewFile
error( KIO::ERR_COULD_NOT_STAT, url.prettyURL() );
return;
}
atom.m_uds = KIO::UDS_FILE_TYPE;
atom.m_long = buff.st_mode & S_IFMT;
entry.append( atom );
statEntry( entry );
finished();
// And let go of the tar file - for people who want to unmount a cdrom after that
delete _pakFile;
_pakFile = 0L;
return;
}
const KArchiveDirectory* root = _pakFile->directory();
const KArchiveEntry* archiveEntry;
if ( path.isEmpty() )
{
path = QString::fromLatin1( "/" );
archiveEntry = root;
} else {
path = QString::fromLocal8Bit(remoteEncoding()->encode(path));
archiveEntry = root->entry( path );
}
if ( !archiveEntry )
{
error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
return;
}
createUDSEntry( archiveEntry, entry );
statEntry( entry );
finished();
/*kdDebug(PAK_DEBUG_ID) << "Entering stat()" << endl;
KIO::UDSEntry entry;
createUDSEntry(NULL, entry);
kdDebug(PAK_DEBUG_ID) << "Giving file away" << endl;
statEntry(entry);
finished();
kdDebug(PAK_DEBUG_ID) << "-<> Exiting stat()" << endl;*/
}