From 472156a41b1348c714986c772759ad950fffbe75 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 15:11:21 -0600 Subject: Rename kioslaves --- tdeioslave/remote/CMakeLists.txt | 12 +- tdeioslave/remote/Makefile.am | 10 +- .../remote/kdedmodule/remotedirnotifymodule.cpp | 2 +- tdeioslave/remote/kio_remote.cpp | 234 --------------------- tdeioslave/remote/kio_remote.h | 45 ---- tdeioslave/remote/remote.protocol | 2 +- tdeioslave/remote/tdeio_remote.cpp | 234 +++++++++++++++++++++ tdeioslave/remote/tdeio_remote.h | 45 ++++ tdeioslave/remote/testremote.cpp | 2 +- 9 files changed, 293 insertions(+), 293 deletions(-) delete mode 100644 tdeioslave/remote/kio_remote.cpp delete mode 100644 tdeioslave/remote/kio_remote.h create mode 100644 tdeioslave/remote/tdeio_remote.cpp create mode 100644 tdeioslave/remote/tdeio_remote.h (limited to 'tdeioslave/remote') diff --git a/tdeioslave/remote/CMakeLists.txt b/tdeioslave/remote/CMakeLists.txt index fe4c29154..82e7c1fd1 100644 --- a/tdeioslave/remote/CMakeLists.txt +++ b/tdeioslave/remote/CMakeLists.txt @@ -27,24 +27,24 @@ link_directories( install( FILES remote.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) -##### kioremote (static) ######################## +##### tdeioremote (static) ######################## -set( target kioremote ) +set( target tdeioremote ) tde_add_library( ${target} STATIC_PIC AUTOMOC - SOURCES kio_remote.cpp remoteimpl.cpp + SOURCES tdeio_remote.cpp remoteimpl.cpp ) -##### kio_remote (module) ####################### +##### tdeio_remote (module) ####################### -set( target kio_remote ) +set( target tdeio_remote ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/modules/template_dummy_cpp.cmake dummy.cpp COPYONLY ) tde_add_kpart( ${target} SOURCES dummy.cpp - EMBED kioremote-static + EMBED tdeioremote-static LINK tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/tdeioslave/remote/Makefile.am b/tdeioslave/remote/Makefile.am index 4acb4e999..780e0ac36 100644 --- a/tdeioslave/remote/Makefile.am +++ b/tdeioslave/remote/Makefile.am @@ -4,11 +4,11 @@ SUBDIRS= . kdedmodule INCLUDES = $(all_includes) METASOURCES = AUTO -kde_module_LTLIBRARIES = kio_remote.la +kde_module_LTLIBRARIES = tdeio_remote.la -kio_remote_la_SOURCES = dummy.cpp -kio_remote_la_LIBADD = libtdeioremote.la $(LIB_KIO) -kio_remote_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined +tdeio_remote_la_SOURCES = dummy.cpp +tdeio_remote_la_LIBADD = libtdeioremote.la $(LIB_KIO) +tdeio_remote_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined dummy.cpp: echo > dummy.cpp @@ -16,7 +16,7 @@ dummy.cpp: kde_services_DATA = remote.protocol noinst_LTLIBRARIES = libtdeioremote.la -libtdeioremote_la_SOURCES = kio_remote.cpp remoteimpl.cpp +libtdeioremote_la_SOURCES = tdeio_remote.cpp remoteimpl.cpp check_PROGRAMS = testremote testremote_SOURCES = testremote.cpp diff --git a/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp b/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp index 13bfcfc29..04b7a2bee 100644 --- a/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp +++ b/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp @@ -30,7 +30,7 @@ RemoteDirNotifyModule::RemoteDirNotifyModule(const TQCString &obj) extern "C" { KDE_EXPORT KDEDModule *create_remotedirnotify(const TQCString &obj) { - TDEGlobal::locale()->insertCatalogue("kio_remote"); + TDEGlobal::locale()->insertCatalogue("tdeio_remote"); return new RemoteDirNotifyModule(obj); } } diff --git a/tdeioslave/remote/kio_remote.cpp b/tdeioslave/remote/kio_remote.cpp deleted file mode 100644 index 87437700f..000000000 --- a/tdeioslave/remote/kio_remote.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* This file is part of the KDE project - Copyright (c) 2004 Kevin Ottens - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include -#include -#include -#include -#include -#include - - -#include "kio_remote.h" - -static const KCmdLineOptions options[] = -{ - { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, - { "+pool", I18N_NOOP( "Socket name" ), 0 }, - { "+app", I18N_NOOP( "Socket name" ), 0 }, - KCmdLineLastOption -}; - -extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) - { - // TDEApplication is necessary to use other ioslaves - putenv(strdup("SESSION_MANAGER=")); - TDECmdLineArgs::init(argc, argv, "kio_remote", 0, 0, 0, 0); - TDECmdLineArgs::addCmdLineOptions( options ); - TDEApplication app( false, false ); - // We want to be anonymous even if we use DCOP - app.dcopClient()->attach(); - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - RemoteProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); - slave.dispatchLoop(); - return 0; - } -} - - -RemoteProtocol::RemoteProtocol(const TQCString &protocol, - const TQCString &pool, const TQCString &app) - : SlaveBase(protocol, pool, app) -{ -} - -RemoteProtocol::~RemoteProtocol() -{ -} - -void RemoteProtocol::listDir(const KURL &url) -{ - kdDebug(1220) << "RemoteProtocol::listDir: " << url << endl; - - if ( url.path().length() <= 1 ) - { - listRoot(); - return; - } - - int second_slash_idx = url.path().find( '/', 1 ); - TQString root_dirname = url.path().mid( 1, second_slash_idx-1 ); - - KURL target = m_impl.findBaseURL( root_dirname ); - kdDebug(1220) << "possible redirection target : " << target << endl; - if( target.isValid() ) - { - target.addPath( url.path().remove(0, second_slash_idx) ); - redirection(target); - finished(); - return; - } - - error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); -} - -void RemoteProtocol::listRoot() -{ - TDEIO::UDSEntry entry; - - TDEIO::UDSEntryList remote_entries; - m_impl.listRoot(remote_entries); - - totalSize(remote_entries.count()+2); - - m_impl.createTopLevelEntry(entry); - listEntry(entry, false); - - m_impl.createWizardEntry(entry); - listEntry(entry, false); - - TDEIO::UDSEntryListIterator it = remote_entries.begin(); - TDEIO::UDSEntryListIterator end = remote_entries.end(); - - for(; it!=end; ++it) - { - listEntry(*it, false); - } - - entry.clear(); - listEntry(entry, true); - - finished(); -} - -void RemoteProtocol::stat(const KURL &url) -{ - kdDebug(1220) << "RemoteProtocol::stat: " << url << endl; - - TQString path = url.path(); - if ( path.isEmpty() || path == "/" ) - { - // The root is "virtual" - it's not a single physical directory - TDEIO::UDSEntry entry; - m_impl.createTopLevelEntry( entry ); - statEntry( entry ); - finished(); - return; - } - - if (m_impl.isWizardURL(url)) - { - TDEIO::UDSEntry entry; - if (m_impl.createWizardEntry(entry)) - { - statEntry(entry); - finished(); - } - else - { - error(TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL()); - } - return; - } - - int second_slash_idx = url.path().find( '/', 1 ); - TQString root_dirname = url.path().mid( 1, second_slash_idx-1 ); - - if ( second_slash_idx==-1 || ( (int)url.path().length() )==second_slash_idx+1 ) - { - TDEIO::UDSEntry entry; - if (m_impl.statNetworkFolder(entry, root_dirname)) - { - statEntry(entry); - finished(); - return; - } - } - else - { - KURL target = m_impl.findBaseURL( root_dirname ); - kdDebug( 1220 ) << "possible redirection target : " << target << endl; - if ( target.isValid() ) - { - target.addPath( url.path().remove( 0, second_slash_idx ) ); - redirection( target ); - finished(); - return; - } - } - - error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); -} - -void RemoteProtocol::del(const KURL &url, bool /*isFile*/) -{ - kdDebug(1220) << "RemoteProtocol::del: " << url << endl; - - if (!m_impl.isWizardURL(url) - && m_impl.deleteNetworkFolder(url.fileName())) - { - finished(); - return; - } - - error(TDEIO::ERR_CANNOT_DELETE, url.prettyURL()); -} - -void RemoteProtocol::get(const KURL &url) -{ - kdDebug(1220) << "RemoteProtocol::get: " << url << endl; - - TQString file = m_impl.findDesktopFile( url.fileName() ); - kdDebug(1220) << "desktop file : " << file << endl; - - if (!file.isEmpty()) - { - KURL desktop; - desktop.setPath(file); - - redirection(desktop); - finished(); - return; - } - - error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); -} - -void RemoteProtocol::rename(const KURL &src, const KURL &dest, - bool overwrite) -{ - if (src.protocol()!="remote" || dest.protocol()!="remote" - || m_impl.isWizardURL(src) || m_impl.isWizardURL(dest)) - { - error(TDEIO::ERR_UNSUPPORTED_ACTION, src.prettyURL()); - return; - } - - if (m_impl.renameFolders(src.fileName(), dest.fileName(), overwrite)) - { - finished(); - return; - } - - error(TDEIO::ERR_CANNOT_RENAME, src.prettyURL()); -} diff --git a/tdeioslave/remote/kio_remote.h b/tdeioslave/remote/kio_remote.h deleted file mode 100644 index ebc6dd1ad..000000000 --- a/tdeioslave/remote/kio_remote.h +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of the KDE project - Copyright (c) 2004 Kevin Ottens - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KIO_REMOTE_H -#define KIO_REMOTE_H - -#include -#include "remoteimpl.h" - -class RemoteProtocol : public TDEIO::SlaveBase -{ -public: - RemoteProtocol(const TQCString &protocol, const TQCString &pool, - const TQCString &app); - virtual ~RemoteProtocol(); - - virtual void listDir(const KURL &url); - virtual void stat(const KURL &url); - virtual void del(const KURL &url, bool isFile); - virtual void get(const KURL &url); - virtual void rename(const KURL &src, const KURL &dest, bool overwrite); - -private: - void listRoot(); - - RemoteImpl m_impl; -}; - -#endif diff --git a/tdeioslave/remote/remote.protocol b/tdeioslave/remote/remote.protocol index 69cc638aa..2d28b3a47 100644 --- a/tdeioslave/remote/remote.protocol +++ b/tdeioslave/remote/remote.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_remote +exec=tdeio_remote protocol=remote input=none output=filesystem diff --git a/tdeioslave/remote/tdeio_remote.cpp b/tdeioslave/remote/tdeio_remote.cpp new file mode 100644 index 000000000..d4522de3e --- /dev/null +++ b/tdeioslave/remote/tdeio_remote.cpp @@ -0,0 +1,234 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include + +#include +#include +#include +#include +#include +#include + + +#include "tdeio_remote.h" + +static const KCmdLineOptions options[] = +{ + { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, + { "+pool", I18N_NOOP( "Socket name" ), 0 }, + { "+app", I18N_NOOP( "Socket name" ), 0 }, + KCmdLineLastOption +}; + +extern "C" { + int KDE_EXPORT kdemain( int argc, char **argv ) + { + // TDEApplication is necessary to use other ioslaves + putenv(strdup("SESSION_MANAGER=")); + TDECmdLineArgs::init(argc, argv, "tdeio_remote", 0, 0, 0, 0); + TDECmdLineArgs::addCmdLineOptions( options ); + TDEApplication app( false, false ); + // We want to be anonymous even if we use DCOP + app.dcopClient()->attach(); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + RemoteProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); + slave.dispatchLoop(); + return 0; + } +} + + +RemoteProtocol::RemoteProtocol(const TQCString &protocol, + const TQCString &pool, const TQCString &app) + : SlaveBase(protocol, pool, app) +{ +} + +RemoteProtocol::~RemoteProtocol() +{ +} + +void RemoteProtocol::listDir(const KURL &url) +{ + kdDebug(1220) << "RemoteProtocol::listDir: " << url << endl; + + if ( url.path().length() <= 1 ) + { + listRoot(); + return; + } + + int second_slash_idx = url.path().find( '/', 1 ); + TQString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + KURL target = m_impl.findBaseURL( root_dirname ); + kdDebug(1220) << "possible redirection target : " << target << endl; + if( target.isValid() ) + { + target.addPath( url.path().remove(0, second_slash_idx) ); + redirection(target); + finished(); + return; + } + + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); +} + +void RemoteProtocol::listRoot() +{ + TDEIO::UDSEntry entry; + + TDEIO::UDSEntryList remote_entries; + m_impl.listRoot(remote_entries); + + totalSize(remote_entries.count()+2); + + m_impl.createTopLevelEntry(entry); + listEntry(entry, false); + + m_impl.createWizardEntry(entry); + listEntry(entry, false); + + TDEIO::UDSEntryListIterator it = remote_entries.begin(); + TDEIO::UDSEntryListIterator end = remote_entries.end(); + + for(; it!=end; ++it) + { + listEntry(*it, false); + } + + entry.clear(); + listEntry(entry, true); + + finished(); +} + +void RemoteProtocol::stat(const KURL &url) +{ + kdDebug(1220) << "RemoteProtocol::stat: " << url << endl; + + TQString path = url.path(); + if ( path.isEmpty() || path == "/" ) + { + // The root is "virtual" - it's not a single physical directory + TDEIO::UDSEntry entry; + m_impl.createTopLevelEntry( entry ); + statEntry( entry ); + finished(); + return; + } + + if (m_impl.isWizardURL(url)) + { + TDEIO::UDSEntry entry; + if (m_impl.createWizardEntry(entry)) + { + statEntry(entry); + finished(); + } + else + { + error(TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL()); + } + return; + } + + int second_slash_idx = url.path().find( '/', 1 ); + TQString root_dirname = url.path().mid( 1, second_slash_idx-1 ); + + if ( second_slash_idx==-1 || ( (int)url.path().length() )==second_slash_idx+1 ) + { + TDEIO::UDSEntry entry; + if (m_impl.statNetworkFolder(entry, root_dirname)) + { + statEntry(entry); + finished(); + return; + } + } + else + { + KURL target = m_impl.findBaseURL( root_dirname ); + kdDebug( 1220 ) << "possible redirection target : " << target << endl; + if ( target.isValid() ) + { + target.addPath( url.path().remove( 0, second_slash_idx ) ); + redirection( target ); + finished(); + return; + } + } + + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); +} + +void RemoteProtocol::del(const KURL &url, bool /*isFile*/) +{ + kdDebug(1220) << "RemoteProtocol::del: " << url << endl; + + if (!m_impl.isWizardURL(url) + && m_impl.deleteNetworkFolder(url.fileName())) + { + finished(); + return; + } + + error(TDEIO::ERR_CANNOT_DELETE, url.prettyURL()); +} + +void RemoteProtocol::get(const KURL &url) +{ + kdDebug(1220) << "RemoteProtocol::get: " << url << endl; + + TQString file = m_impl.findDesktopFile( url.fileName() ); + kdDebug(1220) << "desktop file : " << file << endl; + + if (!file.isEmpty()) + { + KURL desktop; + desktop.setPath(file); + + redirection(desktop); + finished(); + return; + } + + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); +} + +void RemoteProtocol::rename(const KURL &src, const KURL &dest, + bool overwrite) +{ + if (src.protocol()!="remote" || dest.protocol()!="remote" + || m_impl.isWizardURL(src) || m_impl.isWizardURL(dest)) + { + error(TDEIO::ERR_UNSUPPORTED_ACTION, src.prettyURL()); + return; + } + + if (m_impl.renameFolders(src.fileName(), dest.fileName(), overwrite)) + { + finished(); + return; + } + + error(TDEIO::ERR_CANNOT_RENAME, src.prettyURL()); +} diff --git a/tdeioslave/remote/tdeio_remote.h b/tdeioslave/remote/tdeio_remote.h new file mode 100644 index 000000000..ebc6dd1ad --- /dev/null +++ b/tdeioslave/remote/tdeio_remote.h @@ -0,0 +1,45 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KIO_REMOTE_H +#define KIO_REMOTE_H + +#include +#include "remoteimpl.h" + +class RemoteProtocol : public TDEIO::SlaveBase +{ +public: + RemoteProtocol(const TQCString &protocol, const TQCString &pool, + const TQCString &app); + virtual ~RemoteProtocol(); + + virtual void listDir(const KURL &url); + virtual void stat(const KURL &url); + virtual void del(const KURL &url, bool isFile); + virtual void get(const KURL &url); + virtual void rename(const KURL &src, const KURL &dest, bool overwrite); + +private: + void listRoot(); + + RemoteImpl m_impl; +}; + +#endif diff --git a/tdeioslave/remote/testremote.cpp b/tdeioslave/remote/testremote.cpp index d091c5bc4..3071772a9 100644 --- a/tdeioslave/remote/testremote.cpp +++ b/tdeioslave/remote/testremote.cpp @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -#include "kio_remote.h" +#include "tdeio_remote.h" #include "testremote.h" #include -- cgit v1.2.1