summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-08-28 22:44:34 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-08-31 23:25:26 +0900
commit086012dcad8a976a0dabbb7cbc20c9cb612cdfa9 (patch)
tree56c9bfcfd7cd13b17707dc8862f26932e9814973 /virt
parent409e7f624d202c7f96b4d0ab2da1834135169f8b (diff)
downloadkrusader-master.tar.gz
krusader-master.zip
Restructure source foldersHEADmaster
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'virt')
-rw-r--r--virt/CMakeL10n.txt3
-rw-r--r--virt/Makefile.am17
-rw-r--r--virt/virt.cpp305
-rw-r--r--virt/virt.h55
-rw-r--r--virt/virt.protocol19
5 files changed, 0 insertions, 399 deletions
diff --git a/virt/CMakeL10n.txt b/virt/CMakeL10n.txt
deleted file mode 100644
index e878b92..0000000
--- a/virt/CMakeL10n.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-##### create translation templates ##############
-
-tde_l10n_create_template( "messages/tdeio_virt/" )
diff --git a/virt/Makefile.am b/virt/Makefile.am
deleted file mode 100644
index 39c0cd9..0000000
--- a/virt/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Makefile.am of tdebase/tdeioslave/tar
-
-INCLUDES = $(all_includes)
-AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
-METASOURCES = AUTO
-
-kde_module_LTLIBRARIES = tdeio_virt.la
-
-tdeio_virt_la_SOURCES = virt.cpp
-tdeio_virt_la_LIBADD = $(LIB_TDESYCOCA)
-tdeio_virt_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_TQT) $(LIB_TDECORE)
-
-noinst_HEADERS = virt.h
-
-kdelnk_DATA = virt.protocol
-kdelnkdir = $(kde_servicesdir)
-
diff --git a/virt/virt.cpp b/virt/virt.cpp
deleted file mode 100644
index c94b282..0000000
--- a/virt/virt.cpp
+++ /dev/null
@@ -1,305 +0,0 @@
-/***************************************************************************
- 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 <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <tqfile.h>
-#include <kurl.h>
-#include <kdebug.h>
-#include <tdelocale.h>
-#include <tdeversion.h>
-#include <tdeinstance.h>
-#include <tdemessagebox.h>
-
-#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 TDE_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<KURL::List> 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<KURL::List> 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<TQString, TQString> map = db->entryMap("virt_db");
- TQMap<TQString, TQString>::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.h b/virt/virt.h
deleted file mode 100644
index 8f5bc79..0000000
--- a/virt/virt.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************
- virt.h
- -------------------
- 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. *
- * *
- ***************************************************************************/
-
-#ifndef _VIRT_H
-#define _VIRT_H
-
-#include <sys/types.h>
-#include <tqdict.h>
-#include <tdeconfig.h>
-#include <tdeio/slavebase.h>
-
-class VirtProtocol : public TDEIO::SlaveBase {
-public:
- VirtProtocol( const TQCString &pool, const TQCString &app );
- virtual ~VirtProtocol();
-
- virtual void listDir ( const KURL & url );
- virtual void stat ( const KURL & url );
- virtual void get ( const KURL & url );
- virtual void mkdir(const KURL& url,int permissions);
- virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
- virtual void del (KURL const & url, bool isFile);
-
-protected:
- bool lock();
- bool unlock();
- bool save();
- bool load();
-
- void local_entry(const KURL& url,TDEIO::UDSEntry& entry);
- bool addDir(TQString& path);
-
-
- static TQDict<KURL::List> kioVirtDict;
- static TDEConfig* tdeio_virt_db;
-
- bool rewriteURL(const KURL&, KURL&);
-
-};
-
-#endif
diff --git a/virt/virt.protocol b/virt/virt.protocol
deleted file mode 100644
index b23b509..0000000
--- a/virt/virt.protocol
+++ /dev/null
@@ -1,19 +0,0 @@
-[Protocol]
-exec=tdeio_virt
-protocol=virt
-input=filesystem
-output=filesystem
-listing=Name,Type,Size,Date,AccessDate,Access,Owner,Group,Link
-reading=true
-writing=true
-makedir=true
-deleting=true
-linking=true
-moving=true
-Icon=computer
-maxInstances=4
-copyFromFile=true
-X-DocPath=tdeioslave/virt/index.html
-Class=:local
-#deleteRecursive=true
-#fileNameUsedForCopying=Name