|
|
|
@ -26,7 +26,7 @@
|
|
|
|
|
#include <kinstance.h>
|
|
|
|
|
#include <kurl.h>
|
|
|
|
|
|
|
|
|
|
#include "app.h"
|
|
|
|
|
#include "appinfo.h"
|
|
|
|
|
|
|
|
|
|
using namespace TDEIO;
|
|
|
|
|
|
|
|
|
@ -34,43 +34,43 @@ extern "C"
|
|
|
|
|
{
|
|
|
|
|
int kdemain(int argc, char **argv)
|
|
|
|
|
{
|
|
|
|
|
kdDebug(7101) << "*** Starting tdeio_app " << endl;
|
|
|
|
|
kdDebug(7101) << "*** Starting tdeio_appinfo " << endl;
|
|
|
|
|
|
|
|
|
|
if (argc != 4)
|
|
|
|
|
{
|
|
|
|
|
kdDebug(7101) << "Usage: tdeio_app protocol domain-socket1 domain-socket2" << endl;
|
|
|
|
|
kdDebug(7101) << "Usage: tdeio_appinfo protocol domain-socket1 domain-socket2" << endl;
|
|
|
|
|
exit(255);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDEInstance instance("tdeio_app");
|
|
|
|
|
tdeio_appProtocol slave(argv[2], argv[3]);
|
|
|
|
|
TDEInstance instance("tdeio_appinfo");
|
|
|
|
|
tdeio_appInfoProtocol slave(argv[2], argv[3]);
|
|
|
|
|
slave.dispatchLoop();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tdeio_appProtocol::tdeio_appProtocol(const TQCString &pool_socket, const TQCString &app_socket)
|
|
|
|
|
: SlaveBase("tdeio_app", pool_socket, app_socket)
|
|
|
|
|
tdeio_appInfoProtocol::tdeio_appInfoProtocol(const TQCString &pool_socket,
|
|
|
|
|
const TQCString &app_socket) : SlaveBase("tdeio_appinfo", pool_socket, app_socket)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::tdeio_appProtocol()" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::tdeio_appInfoProtocol()" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tdeio_appProtocol::~tdeio_appProtocol()
|
|
|
|
|
tdeio_appInfoProtocol::~tdeio_appInfoProtocol()
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::~tdeio_appProtocol()" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::~tdeio_appInfoProtocol()" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void tdeio_appProtocol::stat(const KURL &url)
|
|
|
|
|
void tdeio_appInfoProtocol::stat(const KURL &url)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::stat: " << url << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::stat: " << url << endl;
|
|
|
|
|
|
|
|
|
|
TQString path = url.path();
|
|
|
|
|
if (path.isEmpty() || path == "/")
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::stat: " << "creating top level entry" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::stat: " << "creating top level entry" << endl;
|
|
|
|
|
// The root is "virtual" - it's not a single physical directory
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
m_impl.createTopLevelEntry(entry);
|
|
|
|
@ -83,14 +83,14 @@ void tdeio_appProtocol::stat(const KURL &url)
|
|
|
|
|
bool ok = m_impl.parseURL(url, name, path);
|
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::stat: " << "can't parse url" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::stat: " << "can't parse url" << endl;
|
|
|
|
|
error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (path.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::stat: " << "url empty after parsing" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::stat: " << "url empty after parsing" << endl;
|
|
|
|
|
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
if (m_impl.statByName(name, entry))
|
|
|
|
@ -105,18 +105,18 @@ void tdeio_appProtocol::stat(const KURL &url)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::stat: " << "url not empty after parsing: statting" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::stat: " << "url not empty after parsing: statting" << endl;
|
|
|
|
|
SlaveBase::stat(url);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tdeio_appProtocol::listDir(const KURL &url)
|
|
|
|
|
void tdeio_appInfoProtocol::listDir(const KURL &url)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::listDir: " << url << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::listDir: " << url << endl;
|
|
|
|
|
|
|
|
|
|
if (url.path().length() <= 1)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::listDir: " << "url empty: listing root" << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::listDir: " << "url empty: listing root" << endl;
|
|
|
|
|
listRoot();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -129,14 +129,14 @@ void tdeio_appProtocol::listDir(const KURL &url)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::listDir: " << "name is " << name << endl;
|
|
|
|
|
kdDebug() << "tdeio_appProtocol::listDir: " << "path is " << path << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::listDir: " << "name is " << name << endl;
|
|
|
|
|
kdDebug() << "tdeio_appInfoProtocol::listDir: " << "path is " << path << endl;
|
|
|
|
|
|
|
|
|
|
// We've been given something like appinfo:/name
|
|
|
|
|
listAppContents(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tdeio_appProtocol::listRoot()
|
|
|
|
|
void tdeio_appInfoProtocol::listRoot()
|
|
|
|
|
{
|
|
|
|
|
TDEIO::UDSEntryList system_entries;
|
|
|
|
|
bool ok = m_impl.listRoot(system_entries);
|
|
|
|
@ -155,7 +155,7 @@ void tdeio_appProtocol::listRoot()
|
|
|
|
|
finished();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tdeio_appProtocol::listAppContents(const TQString &name)
|
|
|
|
|
void tdeio_appInfoProtocol::listAppContents(const TQString &name)
|
|
|
|
|
{
|
|
|
|
|
TDEIO::UDSEntryList app_entries;
|
|
|
|
|
bool ok = m_impl.listAppContents(name, app_entries);
|