You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.2 KiB
89 lines
2.2 KiB
15 years ago
|
|
||
15 years ago
|
#include <tqcstring.h>
|
||
|
#include <tqsocket.h>
|
||
|
#include <tqdatetime.h>
|
||
|
#include <tqbitarray.h>
|
||
15 years ago
|
|
||
|
#include <stdlib.h>
|
||
|
#include <math.h>
|
||
|
#include <unistd.h>
|
||
|
#include <sys/socket.h>
|
||
|
#include <netinet/in.h>
|
||
|
#include <netdb.h>
|
||
|
|
||
|
#include <kapplication.h>
|
||
|
#include <kdebug.h>
|
||
|
#include <kmessagebox.h>
|
||
|
#include <kinstance.h>
|
||
|
#include <kglobal.h>
|
||
|
#include <kstandarddirs.h>
|
||
|
#include <klocale.h>
|
||
|
#include <kurl.h>
|
||
|
#include <ksock.h>
|
||
|
|
||
|
#include "%{APPNAMELC}.h"
|
||
|
|
||
12 years ago
|
using namespace TDEIO;
|
||
15 years ago
|
|
||
|
|
||
15 years ago
|
kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol(const TQCString &pool_socket, const TQCString &app_socket)
|
||
15 years ago
|
: SlaveBase("kio_%{APPNAMELC}", pool_socket, app_socket)
|
||
|
{
|
||
|
kdDebug() << "kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol()" << endl;
|
||
|
}
|
||
|
|
||
|
|
||
|
kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol()
|
||
|
{
|
||
|
kdDebug() << "kio_%{APPNAMELC}Protocol::~kio_%{APPNAMELC}Protocol()" << endl;
|
||
|
}
|
||
|
|
||
|
|
||
|
void kio_%{APPNAMELC}Protocol::get(const KURL& url )
|
||
|
{
|
||
|
kdDebug() << "kio_%{APPNAMELC}::get(const KURL& url)" << endl ;
|
||
|
|
||
|
kdDebug() << "Seconds: " << url.query() << endl;
|
||
15 years ago
|
TQString remoteServer = url.host();
|
||
15 years ago
|
int remotePort = url.port();
|
||
|
kdDebug() << "myURL: " << url.prettyURL() << endl;
|
||
|
|
||
13 years ago
|
infoMessage(i18n("Looking for %1...").arg( remoteServer ) );
|
||
15 years ago
|
// Send the mimeType as soon as it is known
|
||
|
mimeType("text/plain");
|
||
|
// Send the data
|
||
15 years ago
|
TQString theData = "This is a test of kio_%{APPNAMELC}";
|
||
|
data(TQCString(theData.local8Bit()));
|
||
|
data(TQByteArray()); // empty array means we're done sending the data
|
||
15 years ago
|
finished();
|
||
|
}
|
||
|
|
||
|
|
||
|
void kio_%{APPNAMELC}Protocol::mimetype(const KURL & /*url*/)
|
||
|
{
|
||
|
mimeType("text/plain");
|
||
|
finished();
|
||
|
}
|
||
|
|
||
|
|
||
|
extern "C"
|
||
|
{
|
||
|
int kdemain(int argc, char **argv)
|
||
|
{
|
||
12 years ago
|
TDEInstance instance( "kio_%{APPNAMELC}" );
|
||
15 years ago
|
|
||
|
kdDebug(7101) << "*** Starting kio_%{APPNAMELC} " << endl;
|
||
|
|
||
|
if (argc != 4) {
|
||
|
kdDebug(7101) << "Usage: kio_%{APPNAMELC} protocol domain-socket1 domain-socket2" << endl;
|
||
|
exit(-1);
|
||
|
}
|
||
|
|
||
|
kio_%{APPNAMELC}Protocol slave(argv[2], argv[3]);
|
||
|
slave.dispatchLoop();
|
||
|
|
||
|
kdDebug(7101) << "*** kio_%{APPNAMELC} Done" << endl;
|
||
|
return 0;
|
||
|
}
|
||
|
}
|