From f5c566c238d8f238c0f851ae9258dfb565b311fa Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 26 Jan 2021 12:09:28 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro (cherry picked from commit 88d44ce75144a78770db59d033395537a36f1b25) --- iso/Makefile.am | 2 +- iso/iso.cpp | 2 +- krArc/Makefile.am | 2 +- krusader/Makefile.am | 2 +- po/tdeio_virt.pot | 6 +- tar/Makefile.am | 2 +- tar/tar.cc | 482 --------------------------------------------------- tar/tar.cpp | 482 +++++++++++++++++++++++++++++++++++++++++++++++++++ virt/Makefile.am | 2 +- virt/virt.cc | 305 -------------------------------- virt/virt.cpp | 305 ++++++++++++++++++++++++++++++++ 11 files changed, 796 insertions(+), 796 deletions(-) delete mode 100644 tar/tar.cc create mode 100644 tar/tar.cpp delete mode 100644 virt/virt.cc create mode 100644 virt/virt.cpp diff --git a/iso/Makefile.am b/iso/Makefile.am index 83783d8..6c24f04 100644 --- a/iso/Makefile.am +++ b/iso/Makefile.am @@ -57,7 +57,7 @@ uninstall-local: # make messages.po. Move this one to ../po/ and "make merge" in po # the -x is for skipping messages already translated in tdelibs messages: - LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + LIST=`find . -name \*.h -o -name \*.cpp`; \ if test -n "$$LIST"; then \ $(XGETTEXT) -C -ki18n -x $(kde_includes)/kde.pot $$LIST -o ../po/iso.pot; \ fi diff --git a/iso/iso.cpp b/iso/iso.cpp index 019cac9..e9845c0 100644 --- a/iso/iso.cpp +++ b/iso/iso.cpp @@ -15,7 +15,7 @@ * * ***************************************************************************/ - /* This file is heavily based on tar.cc from tdebase + /* This file is heavily based on tar.cpp from tdebase * (c) David Faure */ diff --git a/krArc/Makefile.am b/krArc/Makefile.am index df0d0f4..606e80d 100644 --- a/krArc/Makefile.am +++ b/krArc/Makefile.am @@ -52,7 +52,7 @@ uninstall-local: # make messages.po. Move this one to ../po/ and "make merge" in po # the -x is for skipping messages already translated in tdelibs messages: - LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + LIST=`find . -name \*.h -o -name \*.cpp`; \ if test -n "$$LIST"; then \ $(XGETTEXT) -C -ki18n -x $(kde_includes)/kde.pot $$LIST -o ../po/krarc.pot; \ fi diff --git a/krusader/Makefile.am b/krusader/Makefile.am index d06a63c..5d9c9cc 100644 --- a/krusader/Makefile.am +++ b/krusader/Makefile.am @@ -189,7 +189,7 @@ krusaderuajs_DATA = \ # messages: messages: rc.cpp - LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + LIST=`find . -name \*.h -o -name \*.cpp`; \ if test -n "$$LIST"; then \ $(XGETTEXT) $$LIST -o $(podir)/krusader.pot; \ fi diff --git a/po/tdeio_virt.pot b/po/tdeio_virt.pot index 0436050..9d85eef 100644 --- a/po/tdeio_virt.pot +++ b/po/tdeio_virt.pot @@ -27,14 +27,14 @@ msgid "" "Your emails" msgstr "" -#: virt.cc:80 +#: virt.cpp:80 msgid "Virtulal delete" msgstr "" -#: virt.cc:81 +#: virt.cpp:81 msgid "remove from virtual space" msgstr "" -#: virt.cc:82 +#: virt.cpp:82 msgid "really delete" msgstr "" diff --git a/tar/Makefile.am b/tar/Makefile.am index 4d2ed23..9673ecf 100644 --- a/tar/Makefile.am +++ b/tar/Makefile.am @@ -6,7 +6,7 @@ METASOURCES = AUTO kde_module_LTLIBRARIES = tdeio_tar.la -tdeio_tar_la_SOURCES = tar.cc +tdeio_tar_la_SOURCES = tar.cpp tdeio_tar_la_LIBADD = $(LIB_TDESYCOCA) tdeio_tar_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) diff --git a/tar/tar.cc b/tar/tar.cc deleted file mode 100644 index bb83b14..0000000 --- a/tar/tar.cc +++ /dev/null @@ -1,482 +0,0 @@ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // to be removed - -#include "tar.h" - -using namespace TDEIO; - -#if KDE_IS_VERSION(3,4,0) -extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } -#else -extern "C" { int kdemain( int argc, char **argv ); } -#endif - -int kdemain( int argc, char **argv ) { - TDEInstance instance( "tdeio_tar" ); - - kdDebug( 7109 ) << "Starting " << getpid() << endl; - - if ( argc != 4 ) { - fprintf( stderr, "Usage: tdeio_tar protocol domain-socket1 domain-socket2\n" ); - exit( -1 ); - } - - ArchiveProtocol slave( argv[ 2 ], argv[ 3 ] ); - slave.dispatchLoop(); - - kdDebug( 7109 ) << "Done" << endl; - return 0; -} - -ArchiveProtocol::ArchiveProtocol( const TQCString &pool, const TQCString &app ) : SlaveBase( "tar", pool, app ) { - kdDebug( 7109 ) << "ArchiveProtocol::ArchiveProtocol" << endl; - m_archiveFile = 0L; -} - -ArchiveProtocol::~ArchiveProtocol() { - delete m_archiveFile; -} - -void ArchiveProtocol::put( const KURL& url, int, bool, bool resume ){ - if( resume ){ - error(ERR_UNSUPPORTED_ACTION,i18n("This protocol does not support resuming") ); - return; - } - - TQByteArray tempBuffer; - TQPtrQueue buffer; - buffer.setAutoDelete(true); - int readResult=0; - int size = 0; - TQByteArray* temp; - do{ - dataReq(); - temp = new TQByteArray(); - readResult = readData(*temp); - buffer.enqueue(temp); - size += temp->size(); - } while( readResult > 0 ); - - TQString filename = url.path().mid(m_archiveName.length()+1); - - if( !m_archiveFile->prepareWriting(filename,user,group,size) ){ - error(ERR_UNSUPPORTED_ACTION, - i18n("Writing to %1 is not supported").arg(filename) ); - return; - } - while( (temp=buffer.dequeue()) ){ - m_archiveFile->writeData(temp->data(),temp->size()); - } - m_archiveFile->doneWriting(size); - - finished(); -} - -void ArchiveProtocol::mkdir(const KURL& url,int){ - TQString filename = url.path().mid(m_archiveName.length()+1); - m_archiveFile->writeDir(filename,user,group); - finished(); -} - -bool ArchiveProtocol::checkNewFile( const KURL & url, TQString & path ) { - TQString fullPath = url.path(); - kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile " << fullPath << endl; - - - // Are we already looking at that file ? - if ( m_archiveFile && m_archiveName == fullPath.left( m_archiveName.length() ) ) { - // Has it changed ? - struct stat statbuf; - if ( ::stat( TQFile::encodeName( m_archiveName ), &statbuf ) == 0 ) { - if ( m_mtime == statbuf.st_mtime ) { - path = fullPath.mid( m_archiveName.length() ); - kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile returning " << path << endl; - return true; - } - } - } - kdDebug( 7109 ) << "Need to open a new file" << endl; - - // Close previous file - if ( m_archiveFile ) { - m_archiveFile->close(); - delete m_archiveFile; - m_archiveFile = 0L; - } - - // Find where the tar file is in the full path - int pos = 0; - TQString archiveFile; - path = TQString(); - - int len = fullPath.length(); - if ( len != 0 && fullPath[ len - 1 ] != '/' ) - fullPath += '/'; - - kdDebug( 7109 ) << "the full path is " << fullPath << endl; - while ( ( pos = fullPath.find( '/', pos + 1 ) ) != -1 ) { - TQString tryPath = fullPath.left( pos ); - kdDebug( 7109 ) << fullPath << " trying " << tryPath << endl; - struct stat statbuf; - if ( ::stat( TQFile::encodeName( tryPath ), &statbuf ) == 0 && !S_ISDIR( statbuf.st_mode ) ) { - archiveFile = tryPath; - m_mtime = statbuf.st_mtime; - user = TQFileInfo(archiveFile).owner(); - group = TQFileInfo(archiveFile).group(); - path = fullPath.mid( pos + 1 ); - kdDebug( 7109 ) << "fullPath=" << fullPath << " path=" << path << endl; - len = path.length(); - if ( len > 1 ) { - if ( path[ len - 1 ] == '/' ) - path.truncate( len - 1 ); - } else - path = TQString::fromLatin1( "/" ); - kdDebug( 7109 ) << "Found. archiveFile=" << archiveFile << " path=" << path << endl; - break; - } - } - if ( archiveFile.isEmpty() ) { - kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile: not found" << endl; - return false; - } - - // Open new file - if ( url.protocol() == "tar" ) { - kdDebug( 7109 ) << "Opening KTar on " << archiveFile << endl; - m_archiveFile = new KTar( archiveFile ); - } else if ( url.protocol() == "ar" ) { - kdDebug( 7109 ) << "Opening KAr on " << archiveFile << endl; - m_archiveFile = new KAr( archiveFile ); - } else if ( url.protocol() == "zip" ) { - kdDebug( 7109 ) << "Opening KZip on " << archiveFile << endl; - m_archiveFile = new KZip( archiveFile ); - } else { - kdWarning( 7109 ) << "Protocol " << url.protocol() << " not supported by this IOSlave" << endl; - return false; - } - - if ( !m_archiveFile->open( IO_ReadWrite ) ) { - kdDebug( 7109 ) << "Opening " << archiveFile << "failed." << endl; - delete m_archiveFile; - m_archiveFile = 0L; - return false; - } - - m_archiveName = archiveFile; - return true; -} - - -void ArchiveProtocol::createUDSEntry( const KArchiveEntry * archiveEntry, UDSEntry & entry ) { - UDSAtom atom; - entry.clear(); - atom.m_uds = UDS_NAME; - atom.m_str = archiveEntry->name(); - entry.append( atom ); - - atom.m_uds = UDS_FILE_TYPE; - atom.m_long = archiveEntry->permissions() & S_IFMT; // keep file type only - entry.append( atom ); - - atom.m_uds = UDS_SIZE; - atom.m_long = archiveEntry->isFile() ? ( ( KArchiveFile * ) archiveEntry ) ->size() : 0L ; - entry.append( atom ); - - atom.m_uds = UDS_MODIFICATION_TIME; - atom.m_long = archiveEntry->date(); - entry.append( atom ); - - atom.m_uds = UDS_ACCESS; - atom.m_long = archiveEntry->permissions() & 07777; // keep permissions only - entry.append( atom ); - - atom.m_uds = UDS_USER; - atom.m_str = archiveEntry->user(); - entry.append( atom ); - - atom.m_uds = UDS_GROUP; - atom.m_str = archiveEntry->group(); - entry.append( atom ); - - atom.m_uds = UDS_LINK_DEST; - atom.m_str = archiveEntry->symlink(); - entry.append( atom ); -} - -void ArchiveProtocol::listDir( const KURL & url ) { - kdDebug( 7109 ) << "ArchiveProtocol::listDir " << url.url() << endl; - - TQString path; - if ( !checkNewFile( url, path ) ) { - TQCString _path( TQFile::encodeName( url.path() ) ); - kdDebug( 7109 ) << "Checking (stat) on " << _path << endl; - struct stat buff; - if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) { - error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); - return ; - } - // It's a real dir -> redirect - KURL redir; - redir.setPath( url.path() ); - kdDebug( 7109 ) << "Ok, redirection to " << redir.url() << endl; - redirection( redir ); - finished(); - // And let go of the tar file - for people who want to unmount a cdrom after that - delete m_archiveFile; - m_archiveFile = 0L; - return ; - } - - if ( path.isEmpty() ) { - KURL redir( url.protocol() + TQString::fromLatin1( ":/" ) ); - kdDebug( 7109 ) << "url.path()==" << url.path() << endl; - redir.setPath( url.path() + TQString::fromLatin1( "/" ) ); - kdDebug( 7109 ) << "ArchiveProtocol::listDir: redirection " << redir.url() << endl; - redirection( redir ); - finished(); - return ; - } - - kdDebug( 7109 ) << "checkNewFile done" << endl; - const KArchiveDirectory* root = m_archiveFile->directory(); - const KArchiveDirectory* dir; - if ( !path.isEmpty() && path != "/" ) { - kdDebug( 7109 ) << TQString( "Looking for entry %1" ).arg( path ) << endl; - const KArchiveEntry* e = root->entry( path ); - if ( !e ) { - error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); - return ; - } - if ( ! e->isDirectory() ) { - error( TDEIO::ERR_IS_FILE, url.prettyURL() ); - return ; - } - dir = ( KArchiveDirectory* ) e; - } else { - dir = root; - } - - TQStringList l = dir->entries(); - totalSize( l.count() ); - - UDSEntry entry; - TQStringList::Iterator it = l.begin(); - for ( ; it != l.end(); ++it ) { - kdDebug( 7109 ) << ( *it ) << endl; - const KArchiveEntry* archiveEntry = dir->entry( ( *it ) ); - - createUDSEntry( archiveEntry, entry ); - - listEntry( entry, false ); - } - - listEntry( entry, true ); // ready - - finished(); - - kdDebug( 7109 ) << "ArchiveProtocol::listDir done" << endl; -} - -void ArchiveProtocol::stat( const KURL & url ) { - TQString path; - UDSEntry entry; - if ( !checkNewFile( url, path ) ) { - // We may be looking at a real directory - this happens - // when pressing up after being in the root of an archive - TQCString _path( TQFile::encodeName( url.path() ) ); - kdDebug( 7109 ) << "ArchiveProtocol::stat (stat) on " << _path << endl; - struct stat buff; - if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) { - kdDebug( 7109 ) << "isdir=" << S_ISDIR( buff.st_mode ) << " errno=" << strerror( errno ) << endl; - error( TDEIO::ERR_DOES_NOT_EXIST, url.path() ); - return ; - } - // Real directory. Return just enough information for KRun to work - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = url.fileName(); - entry.append( atom ); - kdDebug( 7109 ) << "ArchiveProtocol::stat returning name=" << url.fileName() << endl; - - atom.m_uds = TDEIO::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 m_archiveFile; - m_archiveFile = 0L; - return ; - } - - const KArchiveDirectory* root = m_archiveFile->directory(); - const KArchiveEntry* archiveEntry; - if ( path.isEmpty() ) { - path = TQString::fromLatin1( "/" ); - archiveEntry = root; - } else { - archiveEntry = root->entry( path ); - } - if ( !archiveEntry ) { - error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); - return ; - } - - createUDSEntry( archiveEntry, entry ); - statEntry( entry ); - - finished(); -} - -void ArchiveProtocol::get( const KURL & url ) { - kdDebug( 7109 ) << "ArchiveProtocol::get" << url.url() << endl; - - TQString path; - if ( !checkNewFile( url, path ) ) { - error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); - return ; - } - - const KArchiveDirectory* root = m_archiveFile->directory(); - const KArchiveEntry* archiveEntry = root->entry( path ); - - if ( !archiveEntry ) { - error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); - return ; - } - if ( archiveEntry->isDirectory() ) { - error( TDEIO::ERR_IS_DIRECTORY, url.prettyURL() ); - return ; - } - const KArchiveFile* archiveFileEntry = static_cast( archiveEntry ); - if ( !archiveEntry->symlink().isEmpty() ) { - kdDebug( 7109 ) << "Redirection to " << archiveEntry->symlink() << endl; - KURL realURL( url, archiveEntry->symlink() ); - kdDebug( 7109 ) << "realURL= " << realURL.url() << endl; - redirection( realURL ); - finished(); - return ; - } - - totalSize( archiveFileEntry->size() ); - - TQByteArray completeData = archiveFileEntry->data(); - - KMimeMagicResult * result = KMimeMagic::self() ->findBufferFileType( completeData, path ); - kdDebug( 7109 ) << "Emitting mimetype " << result->mimeType() << endl; - mimeType( result->mimeType() ); - - data( completeData ); - - processedSize( archiveFileEntry->size() ); - data( TQByteArray() ); - - finished(); -} - -/* - In case someone wonders how the old filter stuff looked like : :) -void TARProtocol::slotData(void *_p, int _len) -{ - switch (m_cmd) { - case CMD_PUT: - assert(m_pFilter); - m_pFilter->send(_p, _len); - break; - default: - abort(); - break; - } -} - -void TARProtocol::slotDataEnd() -{ - switch (m_cmd) { - case CMD_PUT: - assert(m_pFilter && m_pJob); - m_pFilter->finish(); - m_pJob->dataEnd(); - m_cmd = CMD_NONE; - break; - default: - abort(); - break; - } -} - -void TARProtocol::jobData(void *_p, int _len) -{ - switch (m_cmd) { - case CMD_GET: - assert(m_pFilter); - m_pFilter->send(_p, _len); - break; - case CMD_COPY: - assert(m_pFilter); - m_pFilter->send(_p, _len); - break; - default: - abort(); - } -} - -void TARProtocol::jobDataEnd() -{ - switch (m_cmd) { - case CMD_GET: - assert(m_pFilter); - m_pFilter->finish(); - dataEnd(); - break; - case CMD_COPY: - assert(m_pFilter); - m_pFilter->finish(); - m_pJob->dataEnd(); - break; - default: - abort(); - } -} - -void TARProtocol::filterData(void *_p, int _len) -{ -debug("void TARProtocol::filterData"); - switch (m_cmd) { - case CMD_GET: - data(_p, _len); - break; - case CMD_PUT: - assert (m_pJob); - m_pJob->data(_p, _len); - break; - case CMD_COPY: - assert(m_pJob); - m_pJob->data(_p, _len); - break; - default: - abort(); - } -} -*/ - diff --git a/tar/tar.cpp b/tar/tar.cpp new file mode 100644 index 0000000..bb83b14 --- /dev/null +++ b/tar/tar.cpp @@ -0,0 +1,482 @@ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // to be removed + +#include "tar.h" + +using namespace TDEIO; + +#if KDE_IS_VERSION(3,4,0) +extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } +#else +extern "C" { int kdemain( int argc, char **argv ); } +#endif + +int kdemain( int argc, char **argv ) { + TDEInstance instance( "tdeio_tar" ); + + kdDebug( 7109 ) << "Starting " << getpid() << endl; + + if ( argc != 4 ) { + fprintf( stderr, "Usage: tdeio_tar protocol domain-socket1 domain-socket2\n" ); + exit( -1 ); + } + + ArchiveProtocol slave( argv[ 2 ], argv[ 3 ] ); + slave.dispatchLoop(); + + kdDebug( 7109 ) << "Done" << endl; + return 0; +} + +ArchiveProtocol::ArchiveProtocol( const TQCString &pool, const TQCString &app ) : SlaveBase( "tar", pool, app ) { + kdDebug( 7109 ) << "ArchiveProtocol::ArchiveProtocol" << endl; + m_archiveFile = 0L; +} + +ArchiveProtocol::~ArchiveProtocol() { + delete m_archiveFile; +} + +void ArchiveProtocol::put( const KURL& url, int, bool, bool resume ){ + if( resume ){ + error(ERR_UNSUPPORTED_ACTION,i18n("This protocol does not support resuming") ); + return; + } + + TQByteArray tempBuffer; + TQPtrQueue buffer; + buffer.setAutoDelete(true); + int readResult=0; + int size = 0; + TQByteArray* temp; + do{ + dataReq(); + temp = new TQByteArray(); + readResult = readData(*temp); + buffer.enqueue(temp); + size += temp->size(); + } while( readResult > 0 ); + + TQString filename = url.path().mid(m_archiveName.length()+1); + + if( !m_archiveFile->prepareWriting(filename,user,group,size) ){ + error(ERR_UNSUPPORTED_ACTION, + i18n("Writing to %1 is not supported").arg(filename) ); + return; + } + while( (temp=buffer.dequeue()) ){ + m_archiveFile->writeData(temp->data(),temp->size()); + } + m_archiveFile->doneWriting(size); + + finished(); +} + +void ArchiveProtocol::mkdir(const KURL& url,int){ + TQString filename = url.path().mid(m_archiveName.length()+1); + m_archiveFile->writeDir(filename,user,group); + finished(); +} + +bool ArchiveProtocol::checkNewFile( const KURL & url, TQString & path ) { + TQString fullPath = url.path(); + kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile " << fullPath << endl; + + + // Are we already looking at that file ? + if ( m_archiveFile && m_archiveName == fullPath.left( m_archiveName.length() ) ) { + // Has it changed ? + struct stat statbuf; + if ( ::stat( TQFile::encodeName( m_archiveName ), &statbuf ) == 0 ) { + if ( m_mtime == statbuf.st_mtime ) { + path = fullPath.mid( m_archiveName.length() ); + kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile returning " << path << endl; + return true; + } + } + } + kdDebug( 7109 ) << "Need to open a new file" << endl; + + // Close previous file + if ( m_archiveFile ) { + m_archiveFile->close(); + delete m_archiveFile; + m_archiveFile = 0L; + } + + // Find where the tar file is in the full path + int pos = 0; + TQString archiveFile; + path = TQString(); + + int len = fullPath.length(); + if ( len != 0 && fullPath[ len - 1 ] != '/' ) + fullPath += '/'; + + kdDebug( 7109 ) << "the full path is " << fullPath << endl; + while ( ( pos = fullPath.find( '/', pos + 1 ) ) != -1 ) { + TQString tryPath = fullPath.left( pos ); + kdDebug( 7109 ) << fullPath << " trying " << tryPath << endl; + struct stat statbuf; + if ( ::stat( TQFile::encodeName( tryPath ), &statbuf ) == 0 && !S_ISDIR( statbuf.st_mode ) ) { + archiveFile = tryPath; + m_mtime = statbuf.st_mtime; + user = TQFileInfo(archiveFile).owner(); + group = TQFileInfo(archiveFile).group(); + path = fullPath.mid( pos + 1 ); + kdDebug( 7109 ) << "fullPath=" << fullPath << " path=" << path << endl; + len = path.length(); + if ( len > 1 ) { + if ( path[ len - 1 ] == '/' ) + path.truncate( len - 1 ); + } else + path = TQString::fromLatin1( "/" ); + kdDebug( 7109 ) << "Found. archiveFile=" << archiveFile << " path=" << path << endl; + break; + } + } + if ( archiveFile.isEmpty() ) { + kdDebug( 7109 ) << "ArchiveProtocol::checkNewFile: not found" << endl; + return false; + } + + // Open new file + if ( url.protocol() == "tar" ) { + kdDebug( 7109 ) << "Opening KTar on " << archiveFile << endl; + m_archiveFile = new KTar( archiveFile ); + } else if ( url.protocol() == "ar" ) { + kdDebug( 7109 ) << "Opening KAr on " << archiveFile << endl; + m_archiveFile = new KAr( archiveFile ); + } else if ( url.protocol() == "zip" ) { + kdDebug( 7109 ) << "Opening KZip on " << archiveFile << endl; + m_archiveFile = new KZip( archiveFile ); + } else { + kdWarning( 7109 ) << "Protocol " << url.protocol() << " not supported by this IOSlave" << endl; + return false; + } + + if ( !m_archiveFile->open( IO_ReadWrite ) ) { + kdDebug( 7109 ) << "Opening " << archiveFile << "failed." << endl; + delete m_archiveFile; + m_archiveFile = 0L; + return false; + } + + m_archiveName = archiveFile; + return true; +} + + +void ArchiveProtocol::createUDSEntry( const KArchiveEntry * archiveEntry, UDSEntry & entry ) { + UDSAtom atom; + entry.clear(); + atom.m_uds = UDS_NAME; + atom.m_str = archiveEntry->name(); + entry.append( atom ); + + atom.m_uds = UDS_FILE_TYPE; + atom.m_long = archiveEntry->permissions() & S_IFMT; // keep file type only + entry.append( atom ); + + atom.m_uds = UDS_SIZE; + atom.m_long = archiveEntry->isFile() ? ( ( KArchiveFile * ) archiveEntry ) ->size() : 0L ; + entry.append( atom ); + + atom.m_uds = UDS_MODIFICATION_TIME; + atom.m_long = archiveEntry->date(); + entry.append( atom ); + + atom.m_uds = UDS_ACCESS; + atom.m_long = archiveEntry->permissions() & 07777; // keep permissions only + entry.append( atom ); + + atom.m_uds = UDS_USER; + atom.m_str = archiveEntry->user(); + entry.append( atom ); + + atom.m_uds = UDS_GROUP; + atom.m_str = archiveEntry->group(); + entry.append( atom ); + + atom.m_uds = UDS_LINK_DEST; + atom.m_str = archiveEntry->symlink(); + entry.append( atom ); +} + +void ArchiveProtocol::listDir( const KURL & url ) { + kdDebug( 7109 ) << "ArchiveProtocol::listDir " << url.url() << endl; + + TQString path; + if ( !checkNewFile( url, path ) ) { + TQCString _path( TQFile::encodeName( url.path() ) ); + kdDebug( 7109 ) << "Checking (stat) on " << _path << endl; + struct stat buff; + if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) { + error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); + return ; + } + // It's a real dir -> redirect + KURL redir; + redir.setPath( url.path() ); + kdDebug( 7109 ) << "Ok, redirection to " << redir.url() << endl; + redirection( redir ); + finished(); + // And let go of the tar file - for people who want to unmount a cdrom after that + delete m_archiveFile; + m_archiveFile = 0L; + return ; + } + + if ( path.isEmpty() ) { + KURL redir( url.protocol() + TQString::fromLatin1( ":/" ) ); + kdDebug( 7109 ) << "url.path()==" << url.path() << endl; + redir.setPath( url.path() + TQString::fromLatin1( "/" ) ); + kdDebug( 7109 ) << "ArchiveProtocol::listDir: redirection " << redir.url() << endl; + redirection( redir ); + finished(); + return ; + } + + kdDebug( 7109 ) << "checkNewFile done" << endl; + const KArchiveDirectory* root = m_archiveFile->directory(); + const KArchiveDirectory* dir; + if ( !path.isEmpty() && path != "/" ) { + kdDebug( 7109 ) << TQString( "Looking for entry %1" ).arg( path ) << endl; + const KArchiveEntry* e = root->entry( path ); + if ( !e ) { + error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); + return ; + } + if ( ! e->isDirectory() ) { + error( TDEIO::ERR_IS_FILE, url.prettyURL() ); + return ; + } + dir = ( KArchiveDirectory* ) e; + } else { + dir = root; + } + + TQStringList l = dir->entries(); + totalSize( l.count() ); + + UDSEntry entry; + TQStringList::Iterator it = l.begin(); + for ( ; it != l.end(); ++it ) { + kdDebug( 7109 ) << ( *it ) << endl; + const KArchiveEntry* archiveEntry = dir->entry( ( *it ) ); + + createUDSEntry( archiveEntry, entry ); + + listEntry( entry, false ); + } + + listEntry( entry, true ); // ready + + finished(); + + kdDebug( 7109 ) << "ArchiveProtocol::listDir done" << endl; +} + +void ArchiveProtocol::stat( const KURL & url ) { + TQString path; + UDSEntry entry; + if ( !checkNewFile( url, path ) ) { + // We may be looking at a real directory - this happens + // when pressing up after being in the root of an archive + TQCString _path( TQFile::encodeName( url.path() ) ); + kdDebug( 7109 ) << "ArchiveProtocol::stat (stat) on " << _path << endl; + struct stat buff; + if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) { + kdDebug( 7109 ) << "isdir=" << S_ISDIR( buff.st_mode ) << " errno=" << strerror( errno ) << endl; + error( TDEIO::ERR_DOES_NOT_EXIST, url.path() ); + return ; + } + // Real directory. Return just enough information for KRun to work + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = url.fileName(); + entry.append( atom ); + kdDebug( 7109 ) << "ArchiveProtocol::stat returning name=" << url.fileName() << endl; + + atom.m_uds = TDEIO::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 m_archiveFile; + m_archiveFile = 0L; + return ; + } + + const KArchiveDirectory* root = m_archiveFile->directory(); + const KArchiveEntry* archiveEntry; + if ( path.isEmpty() ) { + path = TQString::fromLatin1( "/" ); + archiveEntry = root; + } else { + archiveEntry = root->entry( path ); + } + if ( !archiveEntry ) { + error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); + return ; + } + + createUDSEntry( archiveEntry, entry ); + statEntry( entry ); + + finished(); +} + +void ArchiveProtocol::get( const KURL & url ) { + kdDebug( 7109 ) << "ArchiveProtocol::get" << url.url() << endl; + + TQString path; + if ( !checkNewFile( url, path ) ) { + error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); + return ; + } + + const KArchiveDirectory* root = m_archiveFile->directory(); + const KArchiveEntry* archiveEntry = root->entry( path ); + + if ( !archiveEntry ) { + error( TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL() ); + return ; + } + if ( archiveEntry->isDirectory() ) { + error( TDEIO::ERR_IS_DIRECTORY, url.prettyURL() ); + return ; + } + const KArchiveFile* archiveFileEntry = static_cast( archiveEntry ); + if ( !archiveEntry->symlink().isEmpty() ) { + kdDebug( 7109 ) << "Redirection to " << archiveEntry->symlink() << endl; + KURL realURL( url, archiveEntry->symlink() ); + kdDebug( 7109 ) << "realURL= " << realURL.url() << endl; + redirection( realURL ); + finished(); + return ; + } + + totalSize( archiveFileEntry->size() ); + + TQByteArray completeData = archiveFileEntry->data(); + + KMimeMagicResult * result = KMimeMagic::self() ->findBufferFileType( completeData, path ); + kdDebug( 7109 ) << "Emitting mimetype " << result->mimeType() << endl; + mimeType( result->mimeType() ); + + data( completeData ); + + processedSize( archiveFileEntry->size() ); + data( TQByteArray() ); + + finished(); +} + +/* + In case someone wonders how the old filter stuff looked like : :) +void TARProtocol::slotData(void *_p, int _len) +{ + switch (m_cmd) { + case CMD_PUT: + assert(m_pFilter); + m_pFilter->send(_p, _len); + break; + default: + abort(); + break; + } +} + +void TARProtocol::slotDataEnd() +{ + switch (m_cmd) { + case CMD_PUT: + assert(m_pFilter && m_pJob); + m_pFilter->finish(); + m_pJob->dataEnd(); + m_cmd = CMD_NONE; + break; + default: + abort(); + break; + } +} + +void TARProtocol::jobData(void *_p, int _len) +{ + switch (m_cmd) { + case CMD_GET: + assert(m_pFilter); + m_pFilter->send(_p, _len); + break; + case CMD_COPY: + assert(m_pFilter); + m_pFilter->send(_p, _len); + break; + default: + abort(); + } +} + +void TARProtocol::jobDataEnd() +{ + switch (m_cmd) { + case CMD_GET: + assert(m_pFilter); + m_pFilter->finish(); + dataEnd(); + break; + case CMD_COPY: + assert(m_pFilter); + m_pFilter->finish(); + m_pJob->dataEnd(); + break; + default: + abort(); + } +} + +void TARProtocol::filterData(void *_p, int _len) +{ +debug("void TARProtocol::filterData"); + switch (m_cmd) { + case CMD_GET: + data(_p, _len); + break; + case CMD_PUT: + assert (m_pJob); + m_pJob->data(_p, _len); + break; + case CMD_COPY: + assert(m_pJob); + m_pJob->data(_p, _len); + break; + default: + abort(); + } +} +*/ + diff --git a/virt/Makefile.am b/virt/Makefile.am index c099846..88ccc71 100644 --- a/virt/Makefile.am +++ b/virt/Makefile.am @@ -6,7 +6,7 @@ METASOURCES = AUTO kde_module_LTLIBRARIES = tdeio_virt.la -tdeio_virt_la_SOURCES = virt.cc +tdeio_virt_la_SOURCES = virt.cpp tdeio_virt_la_LIBADD = $(LIB_TDESYCOCA) tdeio_virt_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) $(LIB_TDECORE) diff --git a/virt/virt.cc b/virt/virt.cc deleted file mode 100644 index 1af46b5..0000000 --- a/virt/virt.cc +++ /dev/null @@ -1,305 +0,0 @@ -/*************************************************************************** - virt.cc - ------------------- - begin : Fri Dec 5 2003 - copyright : (C) 2003 by Shie Erlich & Rafi Yanai - email : - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "virt.h" - -using namespace TDEIO; - -#define VIRT_VFS_DB "virt_vfs.db" -#define VIRT_PROTOCOL "virt" - -#if KDE_IS_VERSION(3,4,0) -extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } -#else -extern "C" { int kdemain( int argc, char **argv ); } -#endif - -#define KrDEBUG(X...){\ - FILE* f = fopen("/tmp/tdeio_virt.log","a+");\ - fprintf(f,X);\ - fclose(f);\ -} - -TQDict VirtProtocol::kioVirtDict; -TDEConfig* VirtProtocol::tdeio_virt_db; - -int kdemain( int argc, char **argv ) { - TDEInstance instance( "tdeio_virt" ); - - if ( argc != 4 ) { - fprintf( stderr, "Usage: tdeio_virt protocol domain-socket1 domain-socket2\n" ); - exit( -1 ); - } - - VirtProtocol slave( argv[ 2 ], argv[ 3 ] ); - slave.dispatchLoop(); - - return 0; -} - -VirtProtocol::VirtProtocol( const TQCString &pool, const TQCString &app ) : SlaveBase( "virt", pool, app ) { - tdeio_virt_db = new TDEConfig(VIRT_VFS_DB,false,"data"); -} - -VirtProtocol::~VirtProtocol() { - delete tdeio_virt_db; -} - -void VirtProtocol::del(KURL const & /*url */, bool /* isFile */ ){ -// KRDEBUG(url.path()); - - messageBox(TDEIO::SlaveBase::QuestionYesNo, - "", - i18n("Virtulal delete"), - i18n("remove from virtual space"), - i18n("really delete") - ); - - finished(); -} - -void VirtProtocol::copy( const KURL &src, const KURL &dest, int /* permissions */, bool /* overwrite */ ){ - TQString path = dest.path( -1 ).mid( 1 ); - path = path.left(path.findRev("/")); - if ( path.isEmpty() ) path = "/"; - - if( addDir(path) ){ - kioVirtDict[ path ]->append(src); - save(); - } - - finished(); -} - -bool VirtProtocol::addDir(TQString& path){ - - if( kioVirtDict[ path ] ) return true; - - TQString updir; - if( !path.contains("/") ) updir = "/"; - else updir = path.left(path.findRev("/")); - TQString name = path.mid(path.findRev("/")+1); - - if( addDir(updir) ){ - KURL url; - if( updir == "/" ) url = TQString("virt:/")+name; - else url = TQString("virt:/")+updir+"/"+name; - kioVirtDict[ updir ]->append( url ); - - KURL::List* temp = new KURL::List(); - kioVirtDict.replace( path, temp ); - - return true; - } - return false; -} - -void VirtProtocol::mkdir(const KURL& url,int){ - if( url.protocol() != VIRT_PROTOCOL ){ - redirection(url); - finished(); - return; - } - - TQString path = url.path( -1 ).mid( 1 ); - if ( path.isEmpty() ) path = "/"; - - if( kioVirtDict[ path ] ){ - error( TDEIO::ERR_DIR_ALREADY_EXIST, url.path() ); - return; - } - - addDir(path); - - save(); - - finished(); -} - -void VirtProtocol::listDir( const KURL & url ) { - if( url.protocol() != VIRT_PROTOCOL ){ - redirection(url); - finished(); - return; - } - - load(); - - TQString path = url.path( -1 ).mid( 1 ); - if ( path.isEmpty() ) path = "/"; - - KURL::List* urlList = kioVirtDict[ path ]; - if ( !urlList ) { - error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); - return; - } - - UDSEntryList dirList; - KURL::List::iterator it; - for ( it = urlList->begin() ; it != urlList->end() ; ++it ) { - KURL entry_url = *it; - // translate url->UDS_ENTRY - UDSEntry entry; - if( entry_url.protocol() == VIRT_PROTOCOL ){ - local_entry(entry_url,entry); - } else { - UDSAtom atom; - - atom.m_uds = UDS_NAME; - atom.m_str = url.isLocalFile() ? url.path() : entry_url.prettyURL(); - entry.append(atom); - - atom.m_uds = UDS_URL; - atom.m_str = entry_url.url(); - entry.append(atom); - } - - dirList.append(entry); - } - - totalSize(dirList.size()); - listEntries(dirList); - - finished(); -} - -void VirtProtocol::stat( const KURL & url ) { - if( url.protocol() != VIRT_PROTOCOL ){ - redirection(url); - finished(); - return; - } - - UDSEntry entry; - local_entry(url,entry); - - statEntry(entry); - - finished(); -} - -void VirtProtocol::get( const KURL & url ) { - if( url.protocol() != VIRT_PROTOCOL ){ - redirection(url); - finished(); - return; - } - - finished(); -} - -bool VirtProtocol::rewriteURL(const KURL& /* src */, KURL&){ - return true; -} - -bool VirtProtocol::save(){ - lock(); - - TDEConfig* db = new TDEConfig(VIRT_VFS_DB,false,"data");; - - db->setGroup("virt_db"); - TQDictIterator it( kioVirtDict ); // See TQDictIterator - for( ; it.current(); ++it ){ - KURL::List::iterator url; - TQStringList entry; - for ( url = it.current()->begin() ; url != it.current()->end() ; ++url ) { - entry.append( (*url).url() ); - } - db->writeEntry(it.currentKey(),entry); - } - - db->sync(); - delete(db); - - unlock(); - - return true; -} - -bool VirtProtocol::load(){ - lock(); - - TDEConfig* db = new TDEConfig(VIRT_VFS_DB,false,"data"); - db->setGroup("virt_db"); - - TQMap map = db->entryMap("virt_db"); - TQMap::Iterator it; - KURL::List* urlList; - for ( it = map.begin(); it != map.end(); ++it ) { - urlList = new KURL::List( db->readListEntry(it.key()) ); - kioVirtDict.replace( it.key(),urlList ); - } - - if( !kioVirtDict["/" ]){ - urlList = new KURL::List(); - kioVirtDict.replace( "/", urlList ); - } - - unlock(); - - delete(db); - - return true; -} - -void VirtProtocol::local_entry(const KURL& url,UDSEntry& entry){ - TQString path = url.path( -1 ).mid( 1 ); - if ( path.isEmpty() ) path = "/"; - - UDSAtom atom; - - atom.m_uds = UDS_NAME; - atom.m_str = url.fileName(); - entry.append(atom); - - atom.m_uds = UDS_URL; - atom.m_str = url.url(); - entry.append(atom); - - atom.m_uds = UDS_FILE_TYPE; - atom.m_long = S_IFDIR; - entry.append(atom); - - atom.m_uds = UDS_ACCESS; - atom.m_long = 0700; - entry.append(atom); - - atom.m_uds = UDS_MIME_TYPE; - atom.m_str = "inode/system_directory"; - entry.append(atom); -} - -bool VirtProtocol::lock(){ - return true; -} - -bool VirtProtocol::unlock(){ - return true; -} diff --git a/virt/virt.cpp b/virt/virt.cpp new file mode 100644 index 0000000..e7a9fb1 --- /dev/null +++ b/virt/virt.cpp @@ -0,0 +1,305 @@ +/*************************************************************************** + virt.cpp + ------------------- + begin : Fri Dec 5 2003 + copyright : (C) 2003 by Shie Erlich & Rafi Yanai + email : + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "virt.h" + +using namespace TDEIO; + +#define VIRT_VFS_DB "virt_vfs.db" +#define VIRT_PROTOCOL "virt" + +#if KDE_IS_VERSION(3,4,0) +extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } +#else +extern "C" { int kdemain( int argc, char **argv ); } +#endif + +#define KrDEBUG(X...){\ + FILE* f = fopen("/tmp/tdeio_virt.log","a+");\ + fprintf(f,X);\ + fclose(f);\ +} + +TQDict VirtProtocol::kioVirtDict; +TDEConfig* VirtProtocol::tdeio_virt_db; + +int kdemain( int argc, char **argv ) { + TDEInstance instance( "tdeio_virt" ); + + if ( argc != 4 ) { + fprintf( stderr, "Usage: tdeio_virt protocol domain-socket1 domain-socket2\n" ); + exit( -1 ); + } + + VirtProtocol slave( argv[ 2 ], argv[ 3 ] ); + slave.dispatchLoop(); + + return 0; +} + +VirtProtocol::VirtProtocol( const TQCString &pool, const TQCString &app ) : SlaveBase( "virt", pool, app ) { + tdeio_virt_db = new TDEConfig(VIRT_VFS_DB,false,"data"); +} + +VirtProtocol::~VirtProtocol() { + delete tdeio_virt_db; +} + +void VirtProtocol::del(KURL const & /*url */, bool /* isFile */ ){ +// KRDEBUG(url.path()); + + messageBox(TDEIO::SlaveBase::QuestionYesNo, + "", + i18n("Virtulal delete"), + i18n("remove from virtual space"), + i18n("really delete") + ); + + finished(); +} + +void VirtProtocol::copy( const KURL &src, const KURL &dest, int /* permissions */, bool /* overwrite */ ){ + TQString path = dest.path( -1 ).mid( 1 ); + path = path.left(path.findRev("/")); + if ( path.isEmpty() ) path = "/"; + + if( addDir(path) ){ + kioVirtDict[ path ]->append(src); + save(); + } + + finished(); +} + +bool VirtProtocol::addDir(TQString& path){ + + if( kioVirtDict[ path ] ) return true; + + TQString updir; + if( !path.contains("/") ) updir = "/"; + else updir = path.left(path.findRev("/")); + TQString name = path.mid(path.findRev("/")+1); + + if( addDir(updir) ){ + KURL url; + if( updir == "/" ) url = TQString("virt:/")+name; + else url = TQString("virt:/")+updir+"/"+name; + kioVirtDict[ updir ]->append( url ); + + KURL::List* temp = new KURL::List(); + kioVirtDict.replace( path, temp ); + + return true; + } + return false; +} + +void VirtProtocol::mkdir(const KURL& url,int){ + if( url.protocol() != VIRT_PROTOCOL ){ + redirection(url); + finished(); + return; + } + + TQString path = url.path( -1 ).mid( 1 ); + if ( path.isEmpty() ) path = "/"; + + if( kioVirtDict[ path ] ){ + error( TDEIO::ERR_DIR_ALREADY_EXIST, url.path() ); + return; + } + + addDir(path); + + save(); + + finished(); +} + +void VirtProtocol::listDir( const KURL & url ) { + if( url.protocol() != VIRT_PROTOCOL ){ + redirection(url); + finished(); + return; + } + + load(); + + TQString path = url.path( -1 ).mid( 1 ); + if ( path.isEmpty() ) path = "/"; + + KURL::List* urlList = kioVirtDict[ path ]; + if ( !urlList ) { + error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); + return; + } + + UDSEntryList dirList; + KURL::List::iterator it; + for ( it = urlList->begin() ; it != urlList->end() ; ++it ) { + KURL entry_url = *it; + // translate url->UDS_ENTRY + UDSEntry entry; + if( entry_url.protocol() == VIRT_PROTOCOL ){ + local_entry(entry_url,entry); + } else { + UDSAtom atom; + + atom.m_uds = UDS_NAME; + atom.m_str = url.isLocalFile() ? url.path() : entry_url.prettyURL(); + entry.append(atom); + + atom.m_uds = UDS_URL; + atom.m_str = entry_url.url(); + entry.append(atom); + } + + dirList.append(entry); + } + + totalSize(dirList.size()); + listEntries(dirList); + + finished(); +} + +void VirtProtocol::stat( const KURL & url ) { + if( url.protocol() != VIRT_PROTOCOL ){ + redirection(url); + finished(); + return; + } + + UDSEntry entry; + local_entry(url,entry); + + statEntry(entry); + + finished(); +} + +void VirtProtocol::get( const KURL & url ) { + if( url.protocol() != VIRT_PROTOCOL ){ + redirection(url); + finished(); + return; + } + + finished(); +} + +bool VirtProtocol::rewriteURL(const KURL& /* src */, KURL&){ + return true; +} + +bool VirtProtocol::save(){ + lock(); + + TDEConfig* db = new TDEConfig(VIRT_VFS_DB,false,"data");; + + db->setGroup("virt_db"); + TQDictIterator it( kioVirtDict ); // See TQDictIterator + for( ; it.current(); ++it ){ + KURL::List::iterator url; + TQStringList entry; + for ( url = it.current()->begin() ; url != it.current()->end() ; ++url ) { + entry.append( (*url).url() ); + } + db->writeEntry(it.currentKey(),entry); + } + + db->sync(); + delete(db); + + unlock(); + + return true; +} + +bool VirtProtocol::load(){ + lock(); + + TDEConfig* db = new TDEConfig(VIRT_VFS_DB,false,"data"); + db->setGroup("virt_db"); + + TQMap map = db->entryMap("virt_db"); + TQMap::Iterator it; + KURL::List* urlList; + for ( it = map.begin(); it != map.end(); ++it ) { + urlList = new KURL::List( db->readListEntry(it.key()) ); + kioVirtDict.replace( it.key(),urlList ); + } + + if( !kioVirtDict["/" ]){ + urlList = new KURL::List(); + kioVirtDict.replace( "/", urlList ); + } + + unlock(); + + delete(db); + + return true; +} + +void VirtProtocol::local_entry(const KURL& url,UDSEntry& entry){ + TQString path = url.path( -1 ).mid( 1 ); + if ( path.isEmpty() ) path = "/"; + + UDSAtom atom; + + atom.m_uds = UDS_NAME; + atom.m_str = url.fileName(); + entry.append(atom); + + atom.m_uds = UDS_URL; + atom.m_str = url.url(); + entry.append(atom); + + atom.m_uds = UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + entry.append(atom); + + atom.m_uds = UDS_ACCESS; + atom.m_long = 0700; + entry.append(atom); + + atom.m_uds = UDS_MIME_TYPE; + atom.m_str = "inode/system_directory"; + entry.append(atom); +} + +bool VirtProtocol::lock(){ + return true; +} + +bool VirtProtocol::unlock(){ + return true; +} -- cgit v1.2.1