pull/1/head
Timothy Pearson 12 years ago
parent 300fd86e29
commit 3bcf39c02a

@ -62,7 +62,7 @@ class KdeApp(TDEMainWindow):
if False:
# download the contents
if KIO.NetAccess.download(url, target):
if TDEIO.NetAccess.download(url, target):
# set our caption
self.setCaption(url)
@ -70,7 +70,7 @@ class KdeApp(TDEMainWindow):
self.loadFile(target)
# and remove the temp file
KIO.NetAccess.removeTempFile(target)
TDEIO.NetAccess.removeTempFile(target)
self.setCaption(url.prettyURL())
self._view.openURL(url)

@ -18,7 +18,7 @@
from qt import *
from tdecore import *
from tdeui import *
from kio import *
from tdeio import *
from tdehtml import *
from tdeparts import *
#from kdeappiface import *

@ -17,7 +17,7 @@
# Import the required Qt and KDE modules.
from qt import *
from kio import *
from tdeio import *
from tdecore import *
import os, time
@ -28,8 +28,8 @@ DEBUG = 1
# Define a class which will be used to create IOSlave instances.
############################################################################
class SlaveClass(KIO.SlaveBase):
"""SlaveClass(KIO.SlaveBase)
class SlaveClass(TDEIO.SlaveBase):
"""SlaveClass(TDEIO.SlaveBase)
See tdelibs/tdeio/tdeio/slavebase.h for virtual functions to override.
"""
@ -37,7 +37,7 @@ class SlaveClass(KIO.SlaveBase):
########################################################################
def __init__(self, pool, app):
# We must call the initialisation method of the base class.
KIO.SlaveBase.__init__(self, "tdeioslave", pool, app)
TDEIO.SlaveBase.__init__(self, "tdeioslave", pool, app)
# Attach the DCOP client object associated with this IOSlave to the
# DCOP server.
@ -58,7 +58,7 @@ class SlaveClass(KIO.SlaveBase):
pass
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def setHost(self, host, port, user, passwd):
self.debug(
"setHost: %s %s %s %s" % (
@ -71,23 +71,23 @@ class SlaveClass(KIO.SlaveBase):
# a URL.
if unicode(host) != u"":
self.closeConnection()
self.error(KIO.ERR_MALFORMED_URL, host)
self.error(TDEIO.ERR_MALFORMED_URL, host)
return
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def openConnection(self):
# Don't call self.finished() in this method.
self.debug("openConnection")
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def closeConnection(self):
# Don't call self.finished() in this method.
self.debug("closeConnection")
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def get(self, url):
path = str(url.path())
self.debug("get(): %s" % path)
@ -95,11 +95,11 @@ class SlaveClass(KIO.SlaveBase):
item = self.contents.resolve(path)
if item is None:
self.error(KIO.ERR_DOES_NOT_EXIST, path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, path)
return
if item.isDir():
self.error(KIO.ERR_IS_DIRECTORY, path)
self.error(TDEIO.ERR_IS_DIRECTORY, path)
self.totalSize(len(item.getData()))
self.data(QByteArray(item.getData()))
@ -110,7 +110,7 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def put(self, url, permissions, overwrite, resume):
self.debug("put")
self.openConnection()
@ -121,12 +121,12 @@ class SlaveClass(KIO.SlaveBase):
parent_dir = self.contents.resolveParent(path)
if parent_dir is None:
parent_path = '/'.join(parts[:-1])
self.error(KIO.ERR_DOES_NOT_EXIST, parent_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, parent_path)
return
if parent_dir.contains(filename):
if not overwrite:
self.error(KIO.ERR_COULD_NOT_WRITE, parent_path)
self.error(TDEIO.ERR_COULD_NOT_WRITE, parent_path)
return
else:
parent_dir.unlink(filename)
@ -153,7 +153,7 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def stat(self, url):
self.debug("stat: %s" % url.url(0,0))
self.openConnection()
@ -163,14 +163,14 @@ class SlaveClass(KIO.SlaveBase):
# Return info the for the root.
item = self.contents.resolve(str(url.path()))
if item is None:
self.error(KIO.ERR_DOES_NOT_EXIST, str(url.path()))
self.error(TDEIO.ERR_DOES_NOT_EXIST, str(url.path()))
return
self.statEntry(item.getStatEntry())
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def mimetype(self, url):
self.debug("mimetype: %s" % unicode(url))
self.openConnection()
@ -178,7 +178,7 @@ class SlaveClass(KIO.SlaveBase):
path = str(url.path())
item = self.contents.resolve(path)
if item is None:
self.error(KIO.ERR_DOES_NOT_EXIST, path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, path)
return
self.mimeType(item.getMimetype())
@ -186,7 +186,7 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def listDir(self, url):
# The "url" argument is a tdecore.KURL object.
self.debug("listDir: %s" % str(url.prettyURL(0)))
@ -195,11 +195,11 @@ class SlaveClass(KIO.SlaveBase):
path = str(url.path())
dir = self.contents.resolve(path)
if dir is None:
self.error(KIO.ERR_DOES_NOT_EXIST, path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, path)
return
if not dir.isDir():
self.error(KIO.ERR_IS_FILE, path)
self.error(TDEIO.ERR_IS_FILE, path)
return
for entry in dir.listDir():
@ -209,7 +209,7 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def mkdir(self, url, permissions):
self.debug("mkdir")
self.openConnection()
@ -217,18 +217,18 @@ class SlaveClass(KIO.SlaveBase):
parent_path = str(url.path())
parent_dir = self.contents.resolveParent(parent_path)
if parent_dir is None:
self.error(KIO.ERR_DOES_NOT_EXIST, parent_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, parent_path)
return
new_dir_obj = parent_dir.mkdir(parent_path.split('/')[-1])
if new_dir_obj is None:
self.error(KIO.ERR_COULD_NOT_MKDIR, parent_path)
self.error(TDEIO.ERR_COULD_NOT_MKDIR, parent_path)
return
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def rename(self, src, dest, overwrite):
self.debug("rename: %s %s" % (src.path(), dest.path()))
self.openConnection()
@ -236,7 +236,7 @@ class SlaveClass(KIO.SlaveBase):
src_path = str(src.path())
src_obj = self.contents.resolve(src_path)
if src_obj is None:
self.error(KIO.ERR_DOES_NOT_EXIST, src_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, src_path)
return
# See if the destination path already exists.
@ -249,7 +249,7 @@ class SlaveClass(KIO.SlaveBase):
if not overwrite:
# Can't overwrite. not bad.
self.error(KIO.ERR_CANNOT_RENAME, dest_path)
self.error(TDEIO.ERR_CANNOT_RENAME, dest_path)
return
else:
# Over write, just remove the object.
@ -257,7 +257,7 @@ class SlaveClass(KIO.SlaveBase):
dest_dir = self.contents.resolveParent(dest_path)
if dest_dir is None:
self.error(KIO.ERR_DOES_NOT_EXIST, dest_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, dest_path)
return
src_obj.getParent().unlink(src_obj)
@ -280,7 +280,7 @@ class SlaveClass(KIO.SlaveBase):
# self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def copy(self, src, dest, permissions, overwrite):
self.debug("copy")
self.openConnection()
@ -288,7 +288,7 @@ class SlaveClass(KIO.SlaveBase):
src_path = str(src.path())
src_obj = self.contents.resolve(src_path)
if src_obj is None:
self.error(KIO.ERR_DOES_NOT_EXIST, src_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, src_path)
return
# See if the destination path already exists.
@ -301,7 +301,7 @@ class SlaveClass(KIO.SlaveBase):
if not overwrite:
# Can't overwrite. not bad.
self.error(KIO.ERR_COULD_NOT_WRITE, dest_path)
self.error(TDEIO.ERR_COULD_NOT_WRITE, dest_path)
return
else:
# Over write, just remove the object.
@ -309,7 +309,7 @@ class SlaveClass(KIO.SlaveBase):
dest_dir = self.contents.resolveParent(dest_path)
if dest_dir is None:
self.error(KIO.ERR_DOES_NOT_EXIST, dest_path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, dest_path)
return
new_obj = src_obj.copy()
@ -319,7 +319,7 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def del_(self, url, isfile):
self.debug("del_")
self.openConnection()
@ -327,7 +327,7 @@ class SlaveClass(KIO.SlaveBase):
path = str(url.path())
item = self.contents.resolve(path)
if item is None:
self.error(KIO.ERR_DOES_NOT_EXIST, path)
self.error(TDEIO.ERR_DOES_NOT_EXIST, path)
return
item.getParent().unlink(item.getName())
@ -335,22 +335,22 @@ class SlaveClass(KIO.SlaveBase):
self.finished()
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def disconnectSlave(self):
self.debug("disconnectSlave")
return
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def dispatchLoop(self):
self.debug("dispatchLoop")
KIO.SlaveBase.dispatchLoop(self)
TDEIO.SlaveBase.dispatchLoop(self)
########################################################################
# KIO.SlaveBase method
# TDEIO.SlaveBase method
def error(self,errid,text):
self.debug("error: %i, %s" % (errid,text) )
KIO.SlaveBase.error(self,errid,text)
TDEIO.SlaveBase.error(self,errid,text)
############################################################################
def debug(self,msg):
@ -429,40 +429,40 @@ class RAMDir(object):
length = 0
entry = []
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_NAME
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_NAME
atom.m_str = self.name
#debug("name: %s" % name)
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_SIZE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_SIZE
atom.m_long = length
#debug("length: %i" % length)
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_MODIFICATION_TIME
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_MODIFICATION_TIME
# Number of seconds since the epoch.
atom.m_long = int(time.time())
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_ACCESS
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_ACCESS
# The usual octal permission information (rw-r--r-- in this case).
atom.m_long = 0644
entry.append(atom)
# If the stat method is implemented then entries _must_ include
# the UDE_FILE_TYPE atom or the whole system may not work at all.
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_FILE_TYPE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_FILE_TYPE
#atom.m_long = os.path.stat.S_IFREG
atom.m_long = os.path.stat.S_IFDIR
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_MIME_TYPE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_MIME_TYPE
atom.m_str = self.getMimetype()
entry.append(atom)
@ -558,8 +558,8 @@ class RAMFile(object):
length = 0
entry = []
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_NAME
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_NAME
atom.m_str = self.name
#debug("name: %s" % name)
entry.append(atom)
@ -568,33 +568,33 @@ class RAMFile(object):
if self.data is not None:
length = len(self.data)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_SIZE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_SIZE
atom.m_long = length
#debug("length: %i" % length)
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_MODIFICATION_TIME
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_MODIFICATION_TIME
# Number of seconds since the epoch.
atom.m_long = int(time.time())
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_ACCESS
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_ACCESS
# The usual octal permission information (rw-r--r-- in this case).
atom.m_long = 0644
entry.append(atom)
# If the stat method is implemented then entries _must_ include
# the UDE_FILE_TYPE atom or the whole system may not work at all.
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_FILE_TYPE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_FILE_TYPE
atom.m_long = os.path.stat.S_IFREG
entry.append(atom)
atom = KIO.UDSAtom()
atom.m_uds = KIO.UDS_MIME_TYPE
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_MIME_TYPE
atom.m_str = self.getMimetype()
entry.append(atom)

@ -423,14 +423,14 @@ features in <literal role="extension">.desktop</literal> files.
</note>
</chapter>
<!-- KIO-Slaves -->
<!-- TDEIO-Slaves -->
<chapter id="tdeioslaves">
<title>KIO Slaves</title>
<title>TDEIO Slaves</title>
<para>
&appname; can be used for the creation of kio-slaves. &appname; handles the C++
&appname; can be used for the creation of tdeio-slaves. &appname; handles the C++
glue code needed for making tdeioslaves in Python.
<ulink url="http://developer.kde.org/documentation/library/kdeqt/trinityarch/nettransparency.html">developer.kde.org</ulink>
has some documentation about KIO-slaves aimed at C++ programmers.
has some documentation about TDEIO-slaves aimed at C++ programmers.
</para>
<para>
In your <filename>setup.py</filename> file you can specify the list of tdeioslaves
@ -440,7 +440,7 @@ that need to be installed.
</programlisting>
This is just a list of tuples. The first item is name of the
<literal role="extension">.protocol</literal> file that you've made for your
kio-slave. The second item is the name of the Python program to run when the
tdeio-slave. The second item is the name of the Python program to run when the
user views the module in kcontrol. This program is expected to be in
the application's data files directory.
</para>
@ -578,18 +578,18 @@ application outside of KControl to ease development and debugging.
</sect1>
<sect1 id="app-template-tdeioslave">
<title>KIO-slave Application Template</title>
<title>TDEIO-slave Application Template</title>
<para>
The <filename>tdeioslave</filename> application template is a simple
KIO-slave that implements a simple RAM disk. Once installed it can be
TDEIO-slave that implements a simple RAM disk. Once installed it can be
accessed using tdeioslave:/ in konqueror. It is initially empty. Files and
directories can be made and deposited. <filename>tdeioslave.py</filename>
contains more information and comments.
</para>
<note>
<para>
Note that the KIO subsystem usually creates multiple running instances
of a kio-slave backend. For the application template, files and directories
Note that the TDEIO subsystem usually creates multiple running instances
of a tdeio-slave backend. For the application template, files and directories
are specific to each particular backend instance. When using konqueror the
same instance will be used, but if you try to access tdeioslave:/ from a
different process a new (empty!) instance will be craeted. This can be

@ -64,8 +64,8 @@ def setup(**arg_dict):
'build_html' : BuildDocbookHTML,
'install_html' : InstallDocbookHTML,
'install_lib' : InstallLibWithRoot,
'build_tdeioslave' : BuildKioslave,
'install_tdeioslave' : InstallKioslave}
'build_tdeioslave' : BuildTdeioslave,
'install_tdeioslave' : InstallTdeioslave}
for key in kdecmdclass.iterkeys():
cmdclass.setdefault(key,kdecmdclass[key])
@ -1429,8 +1429,8 @@ class InstallI18NMessages(Command):
###########################################################################
class BuildKioslave(Command):
description = "Build Kioslaves"
class BuildTdeioslave(Command):
description = "Build Tdeioslaves"
user_options = [('no-tdeioslave',None,"Don't build tdeioslaves"),
('build-dir=','b', "build directory (where to install from)"),
@ -1499,8 +1499,8 @@ class BuildKioslave(Command):
# self.kde_tdeioslave_lib_dir = os.path.join(self.kde_lib_dir,"trinity")
self.kde_tdeioslave_lib_dir = "/opt/trinity/lib/trinity/"
if FindFileInPaths('tdeio_*.so',[self.kde_tdeioslave_lib_dir]) is None:
raise SystemExit, "Failed to find KDE Kioslave library files in: %s" % self.kde_tdeioslave_lib_dir
self.announce("Using %s for KDE Kioslave library files" % self.kde_tdeioslave_lib_dir)
raise SystemExit, "Failed to find KDE Tdeioslave library files in: %s" % self.kde_tdeioslave_lib_dir
self.announce("Using %s for KDE Tdeioslave library files" % self.kde_tdeioslave_lib_dir)
# Qt inc dir
if self.qt_inc_dir is None:
@ -1622,14 +1622,14 @@ class BuildKioslave(Command):
def run(self):
if self.no_tdeioslave:
self.announce("Skipping KIO Slaves")
self.announce("Skipping TDEIO Slaves")
return
if not os.path.isdir(self.build_dir):
os.mkdir(self.build_dir)
for moduletuple in self.distribution.tdeioslaves:
self.announce("Building KIO Slave from protocol file %s." % moduletuple[0])
self.announce("Building TDEIO Slave from protocol file %s." % moduletuple[0])
protocolfilename = moduletuple[0]
@ -1891,8 +1891,8 @@ extern "C" {
}
"""
###########################################################################
class InstallKioslave(Command):
description = "Install Kioslave files"
class InstallTdeioslave(Command):
description = "Install Tdeioslave files"
user_options = [
('install-dir=', 'd', "base directory for installing tdeioslave module files"),
@ -1943,10 +1943,10 @@ class InstallKioslave(Command):
if not self.skip_build:
self.run_command('build_tdeioslave')
self.announce("Installing Kioslave files...")
self.announce("Installing Tdeioslave files...")
for moduletuple in self.distribution.tdeioslaves:
self.announce("Building Kioslave module from protocol file %s." % moduletuple[0])
self.announce("Building Tdeioslave module from protocol file %s." % moduletuple[0])
protocolfilename = moduletuple[0]
@ -1989,7 +1989,7 @@ class InstallKioslave(Command):
self.outfiles = [os.path.join(self.install_dir,os.path.basename(file)) for file in glob.glob(os.path.join(self.build_dir,'.libs',libraryname+'*'))]
self.outfiles.append(protocolfile_dest)
self.announce("Done installing Kioslave files.")
self.announce("Done installing Tdeioslave files.")
def get_outputs(self):
return self.outfiles or []
@ -2045,7 +2045,7 @@ class CheckPyTDE(Command):
self.announce("Checking for a working PyTDE...")
# Try to import modules one by one.
for k_module in ('dcop', 'tdecore', 'tdeui', 'kio', 'tdefile', 'tdeparts', 'tdehtml', 'tdespell'):
for k_module in ('dcop', 'tdecore', 'tdeui', 'tdeio', 'tdefile', 'tdeparts', 'tdehtml', 'tdespell'):
self.announce(k_module)
try:
exec('import ' + k_module)

Loading…
Cancel
Save