From de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:02:02 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kioslave/settings/CMakeLists.txt | 38 ---- kioslave/settings/Makefile.am | 21 --- kioslave/settings/applications.protocol | 15 -- kioslave/settings/kio_settings.cc | 298 -------------------------------- kioslave/settings/kio_settings.h | 0 kioslave/settings/programs.protocol | 15 -- kioslave/settings/settings.protocol | 15 -- 7 files changed, 402 deletions(-) delete mode 100644 kioslave/settings/CMakeLists.txt delete mode 100644 kioslave/settings/Makefile.am delete mode 100644 kioslave/settings/applications.protocol delete mode 100644 kioslave/settings/kio_settings.cc delete mode 100644 kioslave/settings/kio_settings.h delete mode 100644 kioslave/settings/programs.protocol delete mode 100644 kioslave/settings/settings.protocol (limited to 'kioslave/settings') diff --git a/kioslave/settings/CMakeLists.txt b/kioslave/settings/CMakeLists.txt deleted file mode 100644 index 7732c7661..000000000 --- a/kioslave/settings/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - settings.protocol programs.protocol applications.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_settings (module) ##################### - -set( target kio_settings ) - -tde_add_kpart( ${target} AUTOMOC - SOURCES kio_settings.cc - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kioslave/settings/Makefile.am b/kioslave/settings/Makefile.am deleted file mode 100644 index e302f7d90..000000000 --- a/kioslave/settings/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -INCLUDES= $(all_includes) - -####### Files - -kde_module_LTLIBRARIES = kio_settings.la - -kio_settings_la_SOURCES = kio_settings.cc -kio_settings_la_LIBADD = $(LIB_KSYCOCA) -kio_settings_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -noinst_HEADERS = kio_settings.h - -kdelnk_DATA = settings.protocol programs.protocol applications.protocol -kdelnkdir = $(kde_servicesdir) - - -SUBDIRS=. - -messages: - $(XGETTEXT) `find . -name "*.cc" -o -name "*.cpp" -o -name "*.h"` -o $(podir)/kio_settings.pot - diff --git a/kioslave/settings/applications.protocol b/kioslave/settings/applications.protocol deleted file mode 100644 index 0193dfb8b..000000000 --- a/kioslave/settings/applications.protocol +++ /dev/null @@ -1,15 +0,0 @@ -[Protocol] -exec=kio_settings -protocol=applications -input=none -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link, -reading=true -writing=false -makedir=false -deleting=false -linking=false -moving=false -Icon=kmenu -maxInstances=2 -Class=:local diff --git a/kioslave/settings/kio_settings.cc b/kioslave/settings/kio_settings.cc deleted file mode 100644 index 5622cb8aa..000000000 --- a/kioslave/settings/kio_settings.cc +++ /dev/null @@ -1,298 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Joseph Wenninger - - 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 -#include -#include -#include -#include -#include - -class SettingsProtocol : public TDEIO::SlaveBase -{ -public: - enum RunMode { SettingsMode, ProgramsMode, ApplicationsMode }; - SettingsProtocol(const TQCString &protocol, const TQCString &pool, const TQCString &app); - virtual ~SettingsProtocol(); - virtual void get( const KURL& url ); - virtual void stat(const KURL& url); - virtual void listDir(const KURL& url); - void listRoot(); - KServiceGroup::Ptr findGroup(const TQString &relPath); - -private: - DCOPClient *m_dcopClient; - RunMode m_runMode; -}; - -extern "C" { - KDE_EXPORT int kdemain( int, char **argv ) - { - kdDebug() << "kdemain for settings kioslave" << endl; - TDEInstance instance( "kio_settings" ); - SettingsProtocol slave(argv[1], argv[2], argv[3]); - slave.dispatchLoop(); - return 0; - } -} - - -static void addAtom(TDEIO::UDSEntry& entry, unsigned int ID, long l, const TQString& s = TQString::null) -{ - TDEIO::UDSAtom atom; - atom.m_uds = ID; - atom.m_long = l; - atom.m_str = s; - entry.append(atom); -} - -static void createFileEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime, const TQString& iconName, const TQString& localPath) -{ - entry.clear(); - addAtom(entry, TDEIO::UDS_NAME, 0, TDEIO::encodeFileName(name)); - addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFREG); - addAtom(entry, TDEIO::UDS_URL, 0, url); - addAtom(entry, TDEIO::UDS_ACCESS, 0500); - addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); - addAtom(entry, TDEIO::UDS_SIZE, 0); - addAtom(entry, TDEIO::UDS_LOCAL_PATH, 0, localPath); - addAtom(entry, TDEIO::UDS_CREATION_TIME, 1); - addAtom(entry, TDEIO::UDS_MODIFICATION_TIME, time(0)); - addAtom(entry, TDEIO::UDS_ICON_NAME, 0, iconName); -} - -static void createDirEntry(TDEIO::UDSEntry& entry, const TQString& name, const TQString& url, const TQString& mime,const TQString& iconName) -{ - entry.clear(); - addAtom(entry, TDEIO::UDS_NAME, 0, name); - addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR); - addAtom(entry, TDEIO::UDS_ACCESS, 0500); - addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, mime); - addAtom(entry, TDEIO::UDS_URL, 0, url); - addAtom(entry, TDEIO::UDS_SIZE, 0); - addAtom(entry, TDEIO::UDS_ICON_NAME, 0, iconName); -} - -SettingsProtocol::SettingsProtocol( const TQCString &protocol, const TQCString &pool, const TQCString &app): SlaveBase( protocol, pool, app ) -{ - // Adjusts which part of the TDE Menu to virtualize. - if ( protocol == "programs" ) - m_runMode = ProgramsMode; - else - if (protocol == "applications") - m_runMode = ApplicationsMode; - else - m_runMode = SettingsMode; - - m_dcopClient = new DCOPClient(); - if (!m_dcopClient->attach()) - { - kdDebug() << "ERROR WHILE CONNECTING TO DCOPSERVER" << endl; - } -} - -SettingsProtocol::~SettingsProtocol() -{ - delete m_dcopClient; -} - -KServiceGroup::Ptr SettingsProtocol::findGroup(const TQString &relPath) -{ - TQString nextPart; - TQString alreadyFound("Settings/"); - TQStringList rest = TQStringList::split('/', relPath); - - kdDebug() << "Trying harder to find group " << relPath << endl; - for (unsigned int i=0; iisValid()) - return 0; - - KServiceGroup::List list = tmp->entries(true, true); - KServiceGroup::List::ConstIterator it = list.begin(); - - bool found = false; - for (; it != list.end(); ++it) { - KSycocaEntry *e = *it; - if (e->isType(KST_KServiceGroup)) { - KServiceGroup::Ptr g(static_cast(e)); - if ((g->caption()==rest.front()) || (g->name()==alreadyFound+rest.front())) { - kdDebug() << "Found group with caption " << g->caption() - << " with real name: " << g->name() << endl; - found = true; - rest.remove(rest.begin()); - alreadyFound = g->name(); - kdDebug() << "ALREADY FOUND: " << alreadyFound << endl; - break; - } - } - } - - if (!found) { - kdDebug() << "Group with caption " << rest.front() << " not found within " - << alreadyFound << endl; - return 0; - } - - } - return KServiceGroup::group(alreadyFound); -} - -void SettingsProtocol::get( const KURL & url ) -{ - KService::Ptr service = KService::serviceByDesktopName(url.fileName()); - if (service && service->isValid()) { - KURL redirUrl; - redirUrl.setPath(locate("apps", service->desktopEntryPath())); - redirection(redirUrl); - finished(); - } else { - error( TDEIO::ERR_IS_DIRECTORY, url.prettyURL() ); - } -} - - -void SettingsProtocol::stat(const KURL& url) -{ - TDEIO::UDSEntry entry; - - TQString servicePath( url.path(1) ); - servicePath.remove(0, 1); // remove starting '/' - - if ( m_runMode == SettingsMode) - servicePath = "Settings/" + servicePath; - - KServiceGroup::Ptr grp = KServiceGroup::group(servicePath); - - if (grp && grp->isValid()) { - createDirEntry(entry, (m_runMode == SettingsMode) ? i18n("Settings") : ( (m_runMode==ApplicationsMode) ? i18n("Applications") : i18n("Programs")), - url.url(), "inode/directory",grp->icon() ); - } else { - KService::Ptr service = KService::serviceByDesktopName( url.fileName() ); - if (service && service->isValid()) { -// KURL newUrl; -// newUrl.setPath(locate("apps", service->desktopEntryPath())); -// createFileEntry(entry, service->name(), newUrl, "application/x-desktop", service->icon()); - - createFileEntry(entry, service->name(), url.url(1)+service->desktopEntryName(), - "application/x-desktop", service->icon(), locate("apps", service->desktopEntryPath()) ); - } else { - error(TDEIO::ERR_SLAVE_DEFINED,i18n("Unknown settings folder")); - return; - } - } - - statEntry(entry); - finished(); - return; -} - - -void SettingsProtocol::listDir(const KURL& url) -{ - TQString groupPath = url.path(1); - groupPath.remove(0, 1); // remove starting '/' - - if ( m_runMode == SettingsMode) - groupPath.prepend("Settings/"); - - KServiceGroup::Ptr grp = KServiceGroup::group(groupPath); - - if (!grp || !grp->isValid()) { - grp = findGroup(groupPath); - if (!grp || !grp->isValid()) { - error(TDEIO::ERR_SLAVE_DEFINED,i18n("Unknown settings folder")); - return; - } - } - - unsigned int count = 0; - TDEIO::UDSEntry entry; - - KServiceGroup::List list = grp->entries(true, true); - KServiceGroup::List::ConstIterator it; - - for (it = list.begin(); it != list.end(); ++it) { - KSycocaEntry * e = *it; - - if (e->isType(KST_KServiceGroup)) { - KServiceGroup::Ptr g(static_cast(e)); - TQString groupCaption = g->caption(); - - // Avoid adding empty groups. - KServiceGroup::Ptr subMenuRoot = KServiceGroup::group(g->relPath()); - if (subMenuRoot->childCount() == 0) - continue; - - // Ignore dotfiles. - if ((g->name().at(0) == '.')) - continue; - - TQString relPath = g->relPath(); - - // Do not display the "Settings" menu group in Programs Mode. - if( (m_runMode == ProgramsMode) && relPath.startsWith( "Settings" ) ) - { - kdDebug() << "SettingsProtocol: SKIPPING entry programs:/" << relPath << endl; - continue; - } - - switch( m_runMode ) - { - case( SettingsMode ): - relPath.remove(0, 9); // length("Settings/") ==9 - kdDebug() << "SettingsProtocol: adding entry settings:/" << relPath << endl; - createDirEntry(entry, groupCaption, "settings:/"+relPath, "inode/directory",g->icon()); - break; - case( ProgramsMode ): - kdDebug() << "SettingsProtocol: adding entry programs:/" << relPath << endl; - createDirEntry(entry, groupCaption, "programs:/"+relPath, "inode/directory",g->icon()); - break; - case( ApplicationsMode ): - kdDebug() << "SettingsProtocol: adding entry applications:/" << relPath << endl; - createDirEntry(entry, groupCaption, "applications:/"+relPath, "inode/directory",g->icon()); - break; - } - - } else { - KService::Ptr s(static_cast(e)); - kdDebug() << "SettingsProtocol: adding file entry " << url.url(1)+s->name() << endl; - createFileEntry(entry,s->name(),url.url(1)+s->desktopEntryName(), "application/x-desktop",s->icon(),locate("apps", s->desktopEntryPath())); - } - - listEntry(entry, false); - count++; - } - - totalSize(count); - listEntry(entry, true); - finished(); -} - -// vim: ts=4 sw=4 et diff --git a/kioslave/settings/kio_settings.h b/kioslave/settings/kio_settings.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/kioslave/settings/programs.protocol b/kioslave/settings/programs.protocol deleted file mode 100644 index c09ac6372..000000000 --- a/kioslave/settings/programs.protocol +++ /dev/null @@ -1,15 +0,0 @@ -[Protocol] -exec=kio_settings -protocol=programs -input=none -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link, -reading=true -writing=false -makedir=false -deleting=false -linking=false -moving=false -Icon=kmenu -maxInstances=2 -Class=:local diff --git a/kioslave/settings/settings.protocol b/kioslave/settings/settings.protocol deleted file mode 100644 index 268bc0c69..000000000 --- a/kioslave/settings/settings.protocol +++ /dev/null @@ -1,15 +0,0 @@ -[Protocol] -exec=kio_settings -protocol=settings -input=none -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link, -reading=true -writing=false -makedir=false -deleting=false -linking=false -moving=false -Icon=kcontrol -maxInstances=2 -Class=:local -- cgit v1.2.1