diff options
Diffstat (limited to 'kmrml/kmrml/lib')
-rw-r--r-- | kmrml/kmrml/lib/CMakeLists.txt | 26 | ||||
-rw-r--r-- | kmrml/kmrml/lib/Makefile.am | 11 | ||||
-rw-r--r-- | kmrml/kmrml/lib/kmrml_config.cpp | 339 | ||||
-rw-r--r-- | kmrml/kmrml/lib/kmrml_config.h | 123 | ||||
-rw-r--r-- | kmrml/kmrml/lib/mrml_shared.cpp | 235 | ||||
-rw-r--r-- | kmrml/kmrml/lib/mrml_shared.h | 166 | ||||
-rw-r--r-- | kmrml/kmrml/lib/mrml_utils.cpp | 89 | ||||
-rw-r--r-- | kmrml/kmrml/lib/mrml_utils.h | 50 | ||||
-rw-r--r-- | kmrml/kmrml/lib/version.h | 6 | ||||
-rw-r--r-- | kmrml/kmrml/lib/watcher_stub.cpp | 95 | ||||
-rw-r--r-- | kmrml/kmrml/lib/watcher_stub.h | 36 |
11 files changed, 0 insertions, 1176 deletions
diff --git a/kmrml/kmrml/lib/CMakeLists.txt b/kmrml/kmrml/lib/CMakeLists.txt deleted file mode 100644 index fb51a3ac..00000000 --- a/kmrml/kmrml/lib/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -################################################# -# -# (C) 2010-2011 Calvin Morrison -# mutantturkey@gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - - -#### kcmkgamma (static) ######################### - -tde_add_library( kmrmlstuff STATIC_PIC AUTOMOC - SOURCES - kmrml_config.cpp mrml_shared.cpp - mrml_utils.cpp watcher_stub.cpp -) diff --git a/kmrml/kmrml/lib/Makefile.am b/kmrml/kmrml/lib/Makefile.am deleted file mode 100644 index 1f6ec6ac..00000000 --- a/kmrml/kmrml/lib/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -noinst_LTLIBRARIES = libkmrmlstuff.la -libkmrmlstuff_la_SOURCES = kmrml_config.cpp mrml_shared.cpp mrml_utils.cpp\ -watcher_stub.cpp -noinst_HEADERS = kmrml_config.h mrml_shared.h mrml_utils.h watcher_stub.h - -METASOURCES = AUTO - -libkmrmlstuff_la_LDFLAGS = $(all_libraries) -no-undefined -libkmrmlstuff_la_LIBADD = $(LIB_TDECORE) - -INCLUDES = -I$(top_srcdir) $(all_includes) diff --git a/kmrml/kmrml/lib/kmrml_config.cpp b/kmrml/kmrml/lib/kmrml_config.cpp deleted file mode 100644 index 9f5872b9..00000000 --- a/kmrml/kmrml/lib/kmrml_config.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <tqdir.h> -#include <tqfile.h> -#include <tqtextcodec.h> - -#include <tdeconfig.h> -#include <kdebug.h> -#include <tdeglobal.h> -#include <kprocess.h> -#include <kstandarddirs.h> - -#include "kmrml_config.h" - -#include <tdeversion.h> -#if TDE_VERSION < 307 - #define QUOTE( x ) x -#else - #define QUOTE( x ) TDEProcess::quote( x ) -#endif - -using namespace KMrml; - -// #define DEFAULT_ADDCOLLECTION_CMD "gift-add-collection.pl --thumbnail-dir=%t --local-encoding %d" -#define DEFAULT_ADDCOLLECTION_CMD "gift-add-collection.pl --gift-home=%h --thumbnail-dir=%t --local-encoding=%e %d" -#define DEFAULT_REMOVECOLLECTION_CMD "gift-add-collection.pl --gift-home=%h --local-encoding=%e --remove-collection %d" - -#define DEFAULT_MRMLD_CMD "gift --port %p --datadir %d" -#define DEFAULT_MRMLD_CMD_AUTOPORT "gift --datadir %d" - -#define CONFIG_GROUP "MRML Settings" -#define DEFAULT_HOST "localhost" -#define DEFAULT_USER "kmrml" -#define DEFAULT_PASS "none" -#define DEFAULT_AUTH false -#define DEFAULT_AUTOPORT true -const int DEFAULT_PORT = 12789; - -Config::Config() -{ - m_ownConfig = new TDEConfig( "tdeio_mrmlrc", false, false ); - m_config = m_ownConfig; - - init(); -} - -Config::Config( TDEConfig *config ) - : m_config( config ), - m_ownConfig( 0L ) -{ - init(); -} - -Config::~Config() -{ - delete m_ownConfig; -} - -void Config::init() -{ - m_config->setGroup( CONFIG_GROUP ); - m_defaultHost = m_config->readEntry( "Default Host" ); - if ( m_defaultHost.isEmpty() ) - m_defaultHost = DEFAULT_HOST; - - m_hostList = m_config->readListEntry( "Host List" ); - if ( m_hostList.isEmpty() ) - m_hostList.append( DEFAULT_HOST ); - - m_serverStartedIndividually = - m_config->readBoolEntry( "ServerStartedIndividually", false ); -} - -bool Config::sync() -{ - bool notifySlaves = m_config->isDirty(); - m_config->sync(); - return notifySlaves; - - // This moved to kcontrol/MainPage::save() so we don't have to link against - // TDEIO and need a full TDEApplication instance to work (so that the tiny - // mrmlsearch binary can also use this class) - // tell the ioslaves about the new configuration -// if ( notifySlaves ) -// TDEIO::SlaveConfig::self()->reset(); -} - -void Config::setDefaultHost( const TQString& host ) -{ - m_defaultHost = host.isEmpty() ? - TQString::fromLatin1(DEFAULT_HOST) : host; - - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "Default Host", m_defaultHost ); -} - -ServerSettings Config::settingsForLocalHost() const -{ - return settingsForHost( "localhost" ); -} - -ServerSettings Config::settingsForHost( const TQString& host ) const -{ - TDEConfigGroup config( m_config, settingsGroup( host ) ); - ServerSettings settings; - - settings.host = host; - settings.configuredPort = config.readUnsignedNumEntry( "Port", - DEFAULT_PORT ); - settings.autoPort = (host == "localhost") && - config.readBoolEntry("Automatically determine Port", - DEFAULT_AUTOPORT ); - settings.user = config.readEntry( "Username", DEFAULT_USER ); - settings.pass = config.readEntry( "Password", DEFAULT_PASS ); - settings.useAuth = config.readBoolEntry( "Perform Authentication", - DEFAULT_AUTH ); - - return settings; -} - -void Config::addSettings( const ServerSettings& settings ) -{ - TQString host = settings.host; - if ( m_hostList.find( host ) == m_hostList.end() ) - m_hostList.append( host ); - - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "Host List", m_hostList ); - - m_config->setGroup( settingsGroup( host ) ); - m_config->writeEntry( "Host", host ); - m_config->writeEntry( "Port", settings.configuredPort ); - m_config->writeEntry( "Automatically determine Port", settings.autoPort ); - m_config->writeEntry( "Username", settings.user ); - m_config->writeEntry( "Password", settings.pass ); - m_config->writeEntry( "Perform Authentication", settings.useAuth ); -} - -bool Config::removeSettings( const TQString& host ) -{ - bool success = m_config->deleteGroup( settingsGroup( host ) ); - if ( success ) - { - m_hostList.remove( host ); - m_config->setGroup( CONFIG_GROUP ); - } - - return success; -} - -TQStringList Config::indexableDirectories() const -{ - m_config->setGroup( CONFIG_GROUP ); - return m_config->readListEntry( "Indexable Directories" ); -} - -void Config::setIndexableDirectories( const TQStringList& dirs ) -{ - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "Indexable Directories", dirs ); -} - -TQString Config::addCollectionCommandLine() const -{ - m_config->setGroup( CONFIG_GROUP ); - TQString cmd = m_config->readEntry( "AddCollection Commandline", - DEFAULT_ADDCOLLECTION_CMD ); - int index = cmd.find( "%h" ); - if ( index != -1 ) - cmd.replace( index, 2, QUOTE( mrmldDataDir() ) ); - - index = cmd.find( "%e" ); - if ( index != -1 ) - cmd.replace( index, 2, TQTextCodec::codecForLocale()->mimeName() ); - - return cmd; -} - -void Config::setAddCollectionCommandLine( const TQString& cmd ) -{ - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "AddCollection Commandline", cmd ); -} - -TQString Config::removeCollectionCommandLine() const -{ - m_config->setGroup( CONFIG_GROUP ); - TQString cmd = m_config->readEntry( "RemoveCollection Commandline", - DEFAULT_REMOVECOLLECTION_CMD ); - int index = cmd.find( "%h" ); - if ( index != -1 ) - cmd.replace( index, 2, QUOTE( mrmldDataDir() ) ); - - index = cmd.find( "%e" ); - if ( index != -1 ) - cmd.replace( index, 2, TQTextCodec::codecForLocale()->mimeName() ); - - return cmd; -} - -void Config::setRemoveCollectionCommandLine( const TQString& cmd ) -{ - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "RemoveCollection Commandline", cmd ); -} - -TQString Config::mrmldCommandline() const -{ - ServerSettings settings = settingsForLocalHost(); - - m_config->setGroup( CONFIG_GROUP ); - TQString cmd = m_config->readEntry( "MrmmlDaemon Commandline", - settings.autoPort ? - DEFAULT_MRMLD_CMD_AUTOPORT : - DEFAULT_MRMLD_CMD ); - - // add data directory and port to the commandline - int index = cmd.find( "%p" ); - if ( index != -1 ) - { - TQString port = settings.autoPort ? - TQString() : TQString::number( settings.configuredPort ); - cmd.replace( index, 2, port ); - } - index = cmd.find( "%d" ); - if ( index != -1 ) - { - cmd.replace( index, 2, QUOTE( mrmldDataDir() ) ); - } - - tqDebug("***** commandline: %s", cmd.latin1()); - - return cmd; -} - -TQString Config::mrmldDataDir() -{ - TQString dir = TDEGlobal::dirs()->saveLocation( "data", - "kmrml/mrmld-data/" ); - if ( dir.isEmpty() ) // fallback - dir = TQDir::homeDirPath() + "/"; - - return dir; -} - -void Config::setMrmldCommandLine( const TQString& cmd ) -{ - m_config->setGroup( CONFIG_GROUP ); - m_config->writeEntry( "MrmmlDaemon Commandline", cmd ); -} - -/////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// - -ServerSettings::ServerSettings() - : configuredPort( 0 ), - autoPort( true ), - useAuth( false ) -{ -} - -ServerSettings::ServerSettings( const TQString& host, unsigned short int port, - bool autoPort, bool useAuth, - const TQString& user, const TQString& pass ) -{ - this->host = host; - this->configuredPort = port; - this->autoPort = autoPort; - this->useAuth = useAuth; - this->user = user; - this->pass = pass; -} - -// static -ServerSettings ServerSettings::defaults() -{ - return ServerSettings( DEFAULT_HOST, DEFAULT_PORT, - (!strcmp(DEFAULT_HOST, "localhost") && DEFAULT_PORT), - DEFAULT_AUTH, DEFAULT_USER, DEFAULT_PASS ); -} - -KURL ServerSettings::getUrl() const -{ - KURL url; - url.setProtocol( "mrml" ); - url.setHost( host ); - if ( !autoPort ) - url.setPort( configuredPort ); - - if ( useAuth && user.isEmpty() ) - { - url.setUser( user ); - url.setPass( pass ); - } - - return url; -} - -unsigned short int ServerSettings::port() const -{ - if ( autoPort ) - { - TQString portsFile = Config::mrmldDataDir() + "gift-port.txt"; - TQFile file( portsFile ); - if ( file.open( IO_ReadOnly ) ) - { - TQString line; - (void) file.readLine( line, 6 ); -// tqDebug("**** read: %s", line.latin1()); - - file.close(); - - bool ok; - unsigned short int p = line.toUShort( &ok ); - if ( ok ) - return p; - } - else - kdWarning() << "Can't open \"" << portsFile << "\" to automatically determine the gift port" << endl; - } - - return configuredPort; -} diff --git a/kmrml/kmrml/lib/kmrml_config.h b/kmrml/kmrml/lib/kmrml_config.h deleted file mode 100644 index 9bb435cf..00000000 --- a/kmrml/kmrml/lib/kmrml_config.h +++ /dev/null @@ -1,123 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KMRML_CONFIG_H -#define KMRML_CONFIG_H - -class TDEConfig; - -#include <tqstringlist.h> -#include <kurl.h> - -namespace KMrml -{ - class ServerSettings - { - public: - ServerSettings(); - ServerSettings(const TQString& host, unsigned short int port, - bool autoPort, bool useAuth, const - TQString& user, const TQString& pass); - - // does NOT set the port in the KURL object, if autoPort is selected - // tdeio_mrml is going to determine itself (via ServerSettings::port()). - // This deuglifies the mrml:/ url a bit (no port is shown) - KURL getUrl() const; - - TQString host; - TQString user; - TQString pass; - unsigned short int configuredPort; - bool autoPort :1; // only possible with host == localhost - bool useAuth :1; - - static ServerSettings defaults(); - - // returns configuredPort or the automatically determined port, - // depending on the value of autoPort - unsigned short int port() const; - }; - - class Config - { - public: - Config(); - Config( TDEConfig *config ); // does not take ownership of TDEConfig - ~Config(); - - bool sync(); - - ServerSettings defaultSettings() const - { - return settingsForHost( m_defaultHost ); - } - - ServerSettings settingsForLocalHost() const; - ServerSettings settingsForHost( const TQString& host ) const; - - void setDefaultHost( const TQString& host ); - - /** - * Indexed by the hostname -- ensures there are no dupes - */ - void addSettings( const ServerSettings& settings ); - - bool removeSettings( const TQString& host ); - - TQStringList hosts() const { return m_hostList; } - - /** - * The list of indexable directories -- only applicable to "localhost" - */ - TQStringList indexableDirectories() const; - void setIndexableDirectories( const TQStringList& dirs ); - - TQString addCollectionCommandLine() const; - void setAddCollectionCommandLine( const TQString& cmd ); - - TQString removeCollectionCommandLine() const; - void setRemoveCollectionCommandLine( const TQString& cmd ); - - void setMrmldCommandLine( const TQString& cmd ); - TQString mrmldCommandline() const; - - // e.g. Wolfgang needs this :) - bool serverStartedIndividually() const { - return m_serverStartedIndividually; - } - - static TQString mrmldDataDir(); - - private: - void init(); - - TQString settingsGroup( const TQString& host ) const - { - return TQString::fromLatin1( "SettingsFor: " ).append( host ); - } - - bool m_serverStartedIndividually; - TQString m_defaultHost; - TQStringList m_hostList; - - TDEConfig *m_config; - TDEConfig *m_ownConfig; - }; -} - -#endif // KMRML_CONFIG_H diff --git a/kmrml/kmrml/lib/mrml_shared.cpp b/kmrml/kmrml/lib/mrml_shared.cpp deleted file mode 100644 index be653f58..00000000 --- a/kmrml/kmrml/lib/mrml_shared.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "mrml_shared.h" - -// mrml stuff -const TQString * MrmlShared::m_sessionId = 0L; -const TQString * MrmlShared::m_transactionId = 0L; -const TQString * MrmlShared::m_algorithm = 0L; -const TQString * MrmlShared::m_algorithmId = 0L; -const TQString * MrmlShared::m_algorithmName = 0L; -const TQString * MrmlShared::m_algorithmList = 0L; -const TQString * MrmlShared::m_algorithmType = 0L; -const TQString * MrmlShared::m_collectionId = 0L; -const TQString * MrmlShared::m_collectionList = 0L; -const TQString * MrmlShared::m_collection = 0L; -const TQString * MrmlShared::m_collectionName = 0L; -const TQString * MrmlShared::m_queryParadigm = 0L; -const TQString * MrmlShared::m_queryParadigmList = 0L; -const TQString * MrmlShared::m_configureSession = 0L; - -const TQString * MrmlShared::m_propertySheet = 0L; -const TQString * MrmlShared::m_propertySheetId = 0L; -const TQString * MrmlShared::m_propertySheetType = 0L; -const TQString * MrmlShared::m_sendName = 0L; -const TQString * MrmlShared::m_sendType = 0L; -const TQString * MrmlShared::m_sendValue = 0L; -const TQString * MrmlShared::m_maxSubsetSize = 0L; -const TQString * MrmlShared::m_minSubsetSize = 0L; -const TQString * MrmlShared::m_caption = 0L; -const TQString * MrmlShared::m_from = 0L; -const TQString * MrmlShared::m_to = 0L; -const TQString * MrmlShared::m_step = 0L; -const TQString * MrmlShared::m_sendBooleanInverted = 0L; - -const TQString * MrmlShared::m_element = 0L; -const TQString * MrmlShared::m_attribute = 0L; -const TQString * MrmlShared::m_attributeName = 0L; -const TQString * MrmlShared::m_attributeValue = 0L; -const TQString * MrmlShared::m_children = 0L; -const TQString * MrmlShared::m_none = 0L; - -const TQString * MrmlShared::m_multiSet = 0L; -const TQString * MrmlShared::m_subset = 0L; -const TQString * MrmlShared::m_setElement = 0L; -const TQString * MrmlShared::m_boolean = 0L; -const TQString * MrmlShared::m_numeric = 0L; -const TQString * MrmlShared::m_textual = 0L; -const TQString * MrmlShared::m_panel = 0L; -const TQString * MrmlShared::m_clone = 0L; -const TQString * MrmlShared::m_reference = 0L; - -const TQString * MrmlShared::m_visibility = 0L; -const TQString * MrmlShared::m_visible = 0L; -const TQString * MrmlShared::m_invisible = 0L; -const TQString * MrmlShared::m_popup = 0L; -// const TQString * MrmlShared::m_ = 0L; - -// meta-data -const TQString * MrmlShared::m_mrml_data = 0L; - -// tdeio_mrml tasks -const TQString * MrmlShared::m_tdeio_task = 0L; -const TQString * MrmlShared::m_tdeio_initialize = 0L; -const TQString * MrmlShared::m_tdeio_startQuery = 0L; - - -int MrmlShared::s_references = 0; - -void MrmlShared::ref() -{ - if ( s_references == 0 ) - init(); - - s_references++; -} - -bool MrmlShared::deref() -{ - if ( s_references > 0 ) - s_references--; - - if ( s_references == 0 ) - { - // ### delete all strings here... - - return true; - } - - return false; -} - -void MrmlShared::init() -{ - m_sessionId = new TQString ( "session-id" ) ; - m_transactionId = new TQString ( "transaction-id" ) ; - m_algorithm = new TQString ( "algorithm" ) ; - m_algorithmId = new TQString ( "algorithm-id" ) ; - m_algorithmName = new TQString ( "algorithm-name" ) ; - m_algorithmList = new TQString ( "algorithm-list" ) ; - m_algorithmType = new TQString ( "algorithm-type" ) ; - m_collectionId = new TQString ( "collection-id" ) ; - m_collectionList = new TQString ( "collection-list" ) ; - m_collection = new TQString ( "collection" ) ; - m_collectionName = new TQString ( "collection-name" ) ; - m_queryParadigm = new TQString ( "query-paradigm" ) ; - m_queryParadigmList = new TQString ( "query-paradigm-list" ) ; - m_configureSession = new TQString ( "configure-session" ) ; - - m_propertySheet = new TQString ( "property-sheet" ) ; - m_propertySheetId = new TQString ( "property-sheet-id" ) ; - m_propertySheetType = new TQString ( "property-sheet-type" ) ; - m_sendName = new TQString ( "send-name" ) ; - m_sendType = new TQString ( "send-type" ) ; - m_sendValue = new TQString ( "send-value" ) ; - m_maxSubsetSize = new TQString ( "maxsubsetsize" ) ; - m_minSubsetSize = new TQString ( "minsubsetsize" ) ; - m_caption = new TQString ( "caption" ) ; - m_from = new TQString ( "from" ) ; - m_to = new TQString ( "to" ) ; - m_step = new TQString ( "step" ) ; - m_sendBooleanInverted = new TQString ( "send-boolean-inverted" ) ; - - m_element = new TQString ( "element" ) ; - m_attribute = new TQString ( "attribute" ) ; - m_attributeName = new TQString ( "attribute-name" ) ; - m_attributeValue = new TQString ( "attribute-value" ) ; - m_children = new TQString ( "children" ) ; - m_none = new TQString ( "none" ) ; - - m_multiSet = new TQString ( "multi-set" ) ; - m_subset = new TQString ( "subset" ) ; - m_setElement = new TQString ( "set-element" ) ; - m_boolean = new TQString ( "boolean" ) ; - m_numeric = new TQString ( "numeric" ) ; - m_textual = new TQString ( "textual" ) ; - m_panel = new TQString ( "panel" ) ; - m_clone = new TQString ( "clone" ) ; - m_reference = new TQString ( "reference" ) ; - - m_visibility = new TQString ( "visibility" ) ; - m_visible = new TQString ( "visible" ) ; - m_invisible = new TQString ( "invisible" ) ; - m_popup = new TQString ( "popup" ) ; -// m_ = new TQString ( "" ) ; - -// meta-data - m_mrml_data = new TQString ( "mrml_data" ) ; - -// tdeio_mrml tasks - m_tdeio_task = new TQString ( "tdeio_task" ) ; - m_tdeio_initialize = new TQString ( "tdeio_initialize" ) ; - m_tdeio_startQuery = new TQString ( "tdeio_startQuery" ) ; -} - -void MrmlShared::cleanup() -{ - delete m_sessionId; - delete m_transactionId; - delete m_algorithm; - delete m_algorithmId; - delete m_algorithmName; - delete m_algorithmList; - delete m_algorithmType; - delete m_collectionId; - delete m_collectionList; - delete m_collection; - delete m_collectionName; - delete m_queryParadigm; - delete m_queryParadigmList; - delete m_configureSession; - - // property sheet stuff - delete m_propertySheet; - delete m_propertySheetId; - delete m_propertySheetType; - delete m_sendName; - delete m_sendType; - delete m_sendValue; - delete m_maxSubsetSize; - delete m_minSubsetSize; - delete m_caption; - delete m_from; - delete m_to; - delete m_step; - delete m_sendBooleanInverted; - - delete m_multiSet; - delete m_subset; - delete m_setElement; - delete m_boolean; - delete m_numeric; - delete m_textual; - delete m_panel; - delete m_clone; - delete m_reference; - - delete m_element; - delete m_attribute; - delete m_attributeName; - delete m_attributeValue; - delete m_children; - delete m_none; - - delete m_visibility; - delete m_visible; - delete m_invisible; - delete m_popup; -// delete m_; - - // meta-data - delete m_mrml_data; - - // tdeio_mrml tasks - delete m_tdeio_task; - delete m_tdeio_initialize; - delete m_tdeio_startQuery; - -} diff --git a/kmrml/kmrml/lib/mrml_shared.h b/kmrml/kmrml/lib/mrml_shared.h deleted file mode 100644 index 7f523bc0..00000000 --- a/kmrml/kmrml/lib/mrml_shared.h +++ /dev/null @@ -1,166 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001,2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SHARED_H -#define SHARED_H - -// maybe use mrml_const.h from libMRML, unfortunately not installed -// by gift 0.1.6pre2 - -#include <tqshared.h> -#include <tqstring.h> - -class MrmlShared -{ -public: -// attribute/element names for mrml - static void ref(); - static bool deref(); - - static const TQString& sessionId() { return *m_sessionId; } - static const TQString& transactionId() { return *m_transactionId; } - static const TQString& algorithm() { return *m_algorithm; } - static const TQString& algorithmId() { return *m_algorithmId; } - static const TQString& algorithmName() { return *m_algorithmName; } - static const TQString& algorithmList() { return *m_algorithmList; } - static const TQString& algorithmType() { return *m_algorithmType; } - static const TQString& collectionId() { return *m_collectionId; } - static const TQString& collectionList() { return *m_collectionList; } - static const TQString& collection() { return *m_collection; } - static const TQString& collectionName() { return *m_collectionName; } - static const TQString& queryParadigm() { return *m_queryParadigm; } - static const TQString& queryParadigmList() { return *m_queryParadigmList; } - static const TQString& configureSession() { return *m_configureSession; } - - // property sheet stuff - static const TQString& propertySheet() { return *m_propertySheet; } - static const TQString& propertySheetId() { return *m_propertySheetId; } - static const TQString& propertySheetType() { return *m_propertySheetType; } - static const TQString& sendName() { return *m_sendName; } - static const TQString& sendType() { return *m_sendType; } - static const TQString& sendValue() { return *m_sendValue; } - static const TQString& maxSubsetSize() { return *m_maxSubsetSize; } - static const TQString& minSubsetSize() { return *m_minSubsetSize; } - static const TQString& caption() { return *m_caption; } - static const TQString& from() { return *m_from; } - static const TQString& to() { return *m_to; } - static const TQString& step() { return *m_step; } - static const TQString& sendBooleanInverted() { return *m_sendBooleanInverted; } - - static const TQString& multiSet() { return *m_multiSet; } - static const TQString& subset() { return *m_subset; } - static const TQString& setElement() { return *m_setElement; } - static const TQString& boolean() { return *m_boolean; } - static const TQString& numeric() { return *m_numeric; } - static const TQString& textual() { return *m_textual; } - static const TQString& panel() { return *m_panel; } - static const TQString& clone() { return *m_clone; } - static const TQString& reference() { return *m_reference; } - - static const TQString& element() { return *m_element; } - static const TQString& attribute() { return *m_attribute; } - static const TQString& attributeName() { return *m_attributeName; } - static const TQString& attributeValue() { return *m_attributeValue; } - static const TQString& children() { return *m_children; } - static const TQString& none() { return *m_none; } - - static const TQString& visibility() { return *m_visibility; } - static const TQString& visible() { return *m_visible; } - static const TQString& invisible() { return *m_invisible; } - static const TQString& popup() { return *m_popup; } -// static const TQString& () { return *m_; } - - // meta-data - static const TQString& mrml_data() { return *m_mrml_data; } - - // tdeio_mrml tasks - static const TQString& tdeio_task() { return *m_tdeio_task; } - static const TQString& tdeio_initialize() { return *m_tdeio_initialize; } - static const TQString& tdeio_startQuery() { return *m_tdeio_startQuery; } - - -private: - static const TQString * m_sessionId; - static const TQString * m_transactionId; - static const TQString * m_algorithm; - static const TQString * m_algorithmId; - static const TQString * m_algorithmName; - static const TQString * m_algorithmList; - static const TQString * m_algorithmType; - static const TQString * m_collectionId; - static const TQString * m_collectionList; - static const TQString * m_collection; - static const TQString * m_collectionName; - static const TQString * m_queryParadigm; - static const TQString * m_queryParadigmList; - static const TQString * m_configureSession; - - // property sheet stuff - static const TQString * m_propertySheet; - static const TQString * m_propertySheetId; - static const TQString * m_propertySheetType; - static const TQString * m_sendName; - static const TQString * m_sendType; - static const TQString * m_sendValue; - static const TQString * m_maxSubsetSize; - static const TQString * m_minSubsetSize; - static const TQString * m_caption; - static const TQString * m_from; - static const TQString * m_to; - static const TQString * m_step; - static const TQString * m_sendBooleanInverted; - - static const TQString * m_multiSet; - static const TQString * m_subset; - static const TQString * m_setElement; - static const TQString * m_boolean; - static const TQString * m_numeric; - static const TQString * m_textual; - static const TQString * m_panel; - static const TQString * m_clone; - static const TQString * m_reference; - - static const TQString * m_element; - static const TQString * m_attribute; - static const TQString * m_attributeName; - static const TQString * m_attributeValue; - static const TQString * m_children; - static const TQString * m_none; - - static const TQString * m_visibility; - static const TQString * m_visible; - static const TQString * m_invisible; - static const TQString * m_popup; -// static const TQString * m_; - - // meta-data - static const TQString * m_mrml_data; - - // tdeio_mrml tasks - static const TQString * m_tdeio_task; - static const TQString * m_tdeio_initialize; - static const TQString * m_tdeio_startQuery; - -private: - static void cleanup(); - static void init(); - - static int s_references; -}; - -#endif // SHARED_H diff --git a/kmrml/kmrml/lib/mrml_utils.cpp b/kmrml/kmrml/lib/mrml_utils.cpp deleted file mode 100644 index 314bbc7b..00000000 --- a/kmrml/kmrml/lib/mrml_utils.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <dcopclient.h> -#include <tdeapplication.h> -#include <kprocess.h> -#include <kstaticdeleter.h> - -#include "watcher_stub.h" - -#include "mrml_utils.h" - -// after 100 of no use, terminate the mrmld -#define TIMEOUT 100 -// how often to restart the mrmld in case of failure -#define NUM_RESTARTS 5 - -using namespace KMrml; - -KStaticDeleter<Util> utils_sd; - -Util *Util::s_self = 0L; - -Util::Util() -{ - // we need our own dcopclient, when used in tdeio_mrml - if ( !DCOPClient::mainClient() ) - { - DCOPClient::setMainClient( new DCOPClient() ); - if ( !DCOPClient::mainClient()->attach() ) - tqWarning( "tdeio_mrml: Can't attach to DCOP Server."); - } -} - -Util::~Util() -{ - if ( this == s_self ) - s_self = 0L; -} - -Util *Util::self() -{ - if ( !s_self ) - s_self = utils_sd.setObject( new Util() ); - return s_self; -} - -bool Util::requiresLocalServerFor( const KURL& url ) -{ - return url.host().isEmpty() || url.host() == "localhost"; -} - -bool Util::startLocalServer( const Config& config ) -{ - if ( config.serverStartedIndividually() ) - return true; - - DCOPClient *client = DCOPClient::mainClient(); - - // ### check if it's already running (add dcop method to Watcher) - Watcher_stub watcher( client, "kded", "daemonwatcher"); - return ( watcher.requireDaemon( client->appId(), - "mrmld", config.mrmldCommandline(), - TIMEOUT, NUM_RESTARTS ) - && watcher.ok() ); -} - -void Util::unrequireLocalServer() -{ - DCOPClient *client = DCOPClient::mainClient(); - - Watcher_stub watcher( client, "kded", "daemonwatcher"); - watcher.unrequireDaemon( client->appId(), "mrmld" ); -} diff --git a/kmrml/kmrml/lib/mrml_utils.h b/kmrml/kmrml/lib/mrml_utils.h deleted file mode 100644 index 5707b177..00000000 --- a/kmrml/kmrml/lib/mrml_utils.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#ifndef MRML_UTILS_H -#define MRML_UTILS_H - -#include <tqobject.h> - -#include <kurl.h> - -#include "kmrml_config.h" - -namespace KMrml -{ - class Util : public TQObject - { - public: - static Util * self(); - ~Util(); - - bool requiresLocalServerFor( const KURL& url ); - bool startLocalServer( const Config& config ); - void unrequireLocalServer(); -// bool isLocalServerRunning(); - - private: - static Util *s_self; - Util(); - }; - - -} - -#endif // MRML_UTILS_H diff --git a/kmrml/kmrml/lib/version.h b/kmrml/kmrml/lib/version.h deleted file mode 100644 index 5cf8e270..00000000 --- a/kmrml/kmrml/lib/version.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - -#define KMRML_VERSION "0.3.2" - -#endif // VERSION_H diff --git a/kmrml/kmrml/lib/watcher_stub.cpp b/kmrml/kmrml/lib/watcher_stub.cpp deleted file mode 100644 index d10dcbc7..00000000 --- a/kmrml/kmrml/lib/watcher_stub.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -// Generated in ../server/ via dcopidl -- needs to be in the lib tho. -// Regenerate when necessary by uncommenting the watcher.stub in -// ../server/Makefile.am -// - -#include "watcher_stub.h" -#include <dcopclient.h> - -#include <kdatastream.h> - -namespace KMrml { - -Watcher_stub::Watcher_stub( const TQCString& app, const TQCString& obj ) - : DCOPStub( app, obj ) -{ -} - -Watcher_stub::Watcher_stub( DCOPClient* client, const TQCString& app, const TQCString& obj ) - : DCOPStub( client, app, obj ) -{ -} - -bool Watcher_stub::requireDaemon( const TQCString& arg0, const TQString& arg1, const TQString& arg2, uint arg3, int arg4 ) -{ - bool result; - if ( !dcopClient() ) { - setStatus( CallFailed ); - return false; - } - TQByteArray data, replyData; - TQCString replyType; - TQDataStream arg( data, IO_WriteOnly ); - arg << arg0; - arg << arg1; - arg << arg2; - arg << arg3; - arg << arg4; - if ( dcopClient()->call( app(), obj(), "requireDaemon(TQCString,TQString,TQString,uint,int)", data, replyType, replyData ) ) { - if ( replyType == "bool" ) { - TQDataStream _reply_stream( replyData, IO_ReadOnly ); - _reply_stream >> result; - setStatus( CallSucceeded ); - } else { - callFailed(); - } - } else { - callFailed(); - } - return result; -} - -void Watcher_stub::unrequireDaemon( const TQCString& arg0, const TQString& arg1 ) -{ - if ( !dcopClient() ) { - setStatus( CallFailed ); - return; - } - TQByteArray data, replyData; - TQCString replyType; - TQDataStream arg( data, IO_WriteOnly ); - arg << arg0; - arg << arg1; - if ( dcopClient()->call( app(), obj(), "unrequireDaemon(TQCString,TQString)", data, replyType, replyData ) ) { - setStatus( CallSucceeded ); - } else { - callFailed(); - } -} - -TQStringList Watcher_stub::runningDaemons() -{ - TQStringList result; - if ( !dcopClient() ) { - setStatus( CallFailed ); - return result; - } - TQByteArray data, replyData; - TQCString replyType; - if ( dcopClient()->call( app(), obj(), "runningDaemons()", data, replyType, replyData ) ) { - if ( replyType == TQSTRINGLIST_OBJECT_NAME_STRING ) { - TQDataStream _reply_stream( replyData, IO_ReadOnly ); - _reply_stream >> result; - setStatus( CallSucceeded ); - } else { - callFailed(); - } - } else { - callFailed(); - } - return result; -} - -} // namespace - diff --git a/kmrml/kmrml/lib/watcher_stub.h b/kmrml/kmrml/lib/watcher_stub.h deleted file mode 100644 index ce570908..00000000 --- a/kmrml/kmrml/lib/watcher_stub.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Generated in ../server/ via dcopidl -- needs to be in the lib tho. -// Regenerate when necessary by uncommenting the watcher.stub in -// ../server/Makefile.am -// - -#ifndef __WATCHER_STUB__ -#define __WATCHER_STUB__ - -#include <dcopstub.h> -#include <tqdict.h> -#include <tqptrlist.h> -#include <tqmap.h> -#include <tqstrlist.h> -#include <tqstringlist.h> -#include <tqtimer.h> -#include <kdedmodule.h> -#include <kprocess.h> - -namespace KMrml { - -class Watcher_stub : public DCOPStub -{ -public: - Watcher_stub( const TQCString& app, const TQCString& id ); - Watcher_stub( DCOPClient* client, const TQCString& app, const TQCString& id ); - virtual bool requireDaemon( const TQCString& clientAppId, const TQString& daemonKey, const TQString& commandline, uint timeout, int numRestarts ); - virtual void unrequireDaemon( const TQCString& clientAppId, const TQString& daemonKey ); - virtual TQStringList runningDaemons(); -protected: - Watcher_stub() : DCOPStub( never_use ) {}; -}; - -} // namespace - -#endif |