diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/app_templates/kioslave/slave.cpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/app_templates/kioslave/slave.cpp')
-rw-r--r-- | languages/cpp/app_templates/kioslave/slave.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/kioslave/slave.cpp b/languages/cpp/app_templates/kioslave/slave.cpp new file mode 100644 index 00000000..df32aebf --- /dev/null +++ b/languages/cpp/app_templates/kioslave/slave.cpp @@ -0,0 +1,88 @@ + +#include <qcstring.h> +#include <qsocket.h> +#include <qdatetime.h> +#include <qbitarray.h> + +#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" + +using namespace KIO; + + +kio_%{APPNAMELC}Protocol::kio_%{APPNAMELC}Protocol(const QCString &pool_socket, const QCString &app_socket) + : 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; + QString remoteServer = url.host(); + int remotePort = url.port(); + kdDebug() << "myURL: " << url.prettyURL() << endl; + + infoMessage(i18n("Looking for %1...").arg( remoteServer ) ); + // Send the mimeType as soon as it is known + mimeType("text/plain"); + // Send the data + QString theData = "This is a test of kio_%{APPNAMELC}"; + data(QCString(theData.local8Bit())); + data(QByteArray()); // empty array means we're done sending the data + finished(); +} + + +void kio_%{APPNAMELC}Protocol::mimetype(const KURL & /*url*/) +{ + mimeType("text/plain"); + finished(); +} + + +extern "C" +{ + int kdemain(int argc, char **argv) + { + KInstance instance( "kio_%{APPNAMELC}" ); + + 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; + } +} |