From 2d84c9d3ad0aaea0620658024537d54e6a7939f4 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:00 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kjsembed/kscript/Makefile.am | 17 ---- kjsembed/kscript/javascript.cpp | 111 ----------------------- kjsembed/kscript/javascript.desktop | 7 -- kjsembed/kscript/javascript.h | 60 ------------- kjsembed/kscript/swaptabs.desktop | 5 -- kjsembed/kscript/swaptabs.js | 75 ---------------- kjsembed/kscript/swaptabs.ui | 172 ------------------------------------ 7 files changed, 447 deletions(-) delete mode 100644 kjsembed/kscript/Makefile.am delete mode 100644 kjsembed/kscript/javascript.cpp delete mode 100644 kjsembed/kscript/javascript.desktop delete mode 100644 kjsembed/kscript/javascript.h delete mode 100644 kjsembed/kscript/swaptabs.desktop delete mode 100644 kjsembed/kscript/swaptabs.js delete mode 100644 kjsembed/kscript/swaptabs.ui (limited to 'kjsembed/kscript') diff --git a/kjsembed/kscript/Makefile.am b/kjsembed/kscript/Makefile.am deleted file mode 100644 index 2efe1a79..00000000 --- a/kjsembed/kscript/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = -I$(srcdir) -I$(top_srcdir) $(all_includes) - -kde_module_LTLIBRARIES = libjavascript.la - -libjavascript_la_SOURCES = javascript.cpp -libjavascript_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -lDCOP -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -no-undefined -avoid-version -libjavascript_la_LIBADD = -lkscript ../libkjsembed.la - - -METASOURCES = AUTO - -servicetypedir = $(kde_servicesdir) -servicetype_DATA = javascript.desktop - -katescriptsdir = $(kde_datadir)/kate/scripts -katescripts_DATA = swaptabs.desktop swaptabs.ui -katescripts_SCRIPTS = swaptabs.js diff --git a/kjsembed/kscript/javascript.cpp b/kjsembed/kscript/javascript.cpp deleted file mode 100644 index 22de1aef..00000000 --- a/kjsembed/kscript/javascript.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Ian Reinhart Geiser (geiseri@kde.org) - - 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 "javascript.h" -#include -#include -#include -#include -#include -#include - -#include -#include -//using namespace KScriptInterface; -typedef KGenericFactory JavaScriptFactory; -K_EXPORT_COMPONENT_FACTORY( libjavascript, JavaScriptFactory( "JavaScript" ) ) - -JavaScript::JavaScript(KScriptClientInterface *parent, const char *name, const TQStringList &args ) -{ - ScriptClientInterface = parent; - m_jsembed = new KJSEmbed::KJSEmbedPart(this, "kjsembed_part"); - m_scriptLoc = ""; // arg1? - m_method = ""; // arg2? - m_jsembed->addObject( this, "KScriptInterface"); - m_jsembed->addObject( m_jsembed->view(), "console" ); -} - -JavaScript::~JavaScript() -{ -} - -TQString JavaScript::script() const -{ - return m_scriptLoc; -} - -void JavaScript::setScript( const TQString &scriptFile ) -{ - m_scriptLoc = scriptFile; -} - -void JavaScript::setScript( const TQString &scriptFile, const TQString &method ) -{ - m_scriptLoc = scriptFile; - m_method = method; -} - -void JavaScript::run(TQObject *context, const TQVariant &arg) -{ - TQVariant retVal; - if( context ) m_jsembed->addObject(context); - - m_jsembed->runFile(m_scriptLoc, m_jsembed->globalObject() ); - - if( !m_method.isEmpty() ) - { - KJS::List args; - args.append( KJSEmbed::convertToValue(m_jsembed->globalExec(), arg) ); - KJS::Value val = m_jsembed->callMethod(m_method, args); - retVal = KJSEmbed::convertToVariant(m_jsembed->globalExec(),val); - } - ScriptClientInterface->done(KScriptClientInterface::ResultSuccess, retVal); -} - -void JavaScript::writeLine( const TQString &msg ) -{ - ScriptClientInterface->output(msg); -} - -void JavaScript::writeWarning( const TQString &msg ) -{ - ScriptClientInterface->warning(msg); -} - -void JavaScript::writeError( const TQString &msg ) -{ - ScriptClientInterface->error(msg); -} - -void JavaScript::setProgress( int percent ) -{ - ScriptClientInterface->progress(percent); -} - -TQString JavaScript::appID() const -{ - return kapp->dcopClient()->appId(); -} - -void JavaScript::kill() -{ - // not sure what to do here.... -} - -#include "javascript.moc" diff --git a/kjsembed/kscript/javascript.desktop b/kjsembed/kscript/javascript.desktop deleted file mode 100644 index 1d612975..00000000 --- a/kjsembed/kscript/javascript.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Name=KJSEmbed Script Runner -Type=Service -X-TDE-Library=libjavascript -X-TDE-Script-Runner=JavaScript/kjs -ServiceTypes=KScriptRunner/KScriptRunner -Comment=Javascript scripts from inside the application. diff --git a/kjsembed/kscript/javascript.h b/kjsembed/kscript/javascript.h deleted file mode 100644 index 9ca87f24..00000000 --- a/kjsembed/kscript/javascript.h +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2003 Ian Reinhart Geiser (geiseri@kde.org) - - 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 __javascript_h__ -#define __javascript_h__ - -#include -#include -#include - -namespace KJSEmbed { - class KJSEmbedPart; -} - -//using namespace KScriptInterface; -class JavaScript : public KScriptInterface -{ - Q_OBJECT - TQ_PROPERTY( TQString appID READ appID ) - -public: - JavaScript(KScriptClientInterface *parent, const char *name, const TQStringList &args); - virtual ~JavaScript(); - TQString script() const; - void setScript( const TQString &scriptFile ); - void setScript( const TQString &scriptLibFile, const TQString &method ); - void run(TQObject *context = 0, const TQVariant &arg = 0); - void kill(); - - TQString appID() const; - -public slots: - void writeLine( const TQString &msg ); - void writeWarning( const TQString &msg ); - void writeError( const TQString &msg ); - void setProgress( int percent ); - -private: - KScriptClientInterface *ScriptClientInterface; - KJSEmbed::KJSEmbedPart *m_jsembed; - TQString m_method; - TQString m_scriptLoc; -}; - -#endif diff --git a/kjsembed/kscript/swaptabs.desktop b/kjsembed/kscript/swaptabs.desktop deleted file mode 100644 index ebe80ab9..00000000 --- a/kjsembed/kscript/swaptabs.desktop +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Name=Swap tabs and spaces. -Comment=Swap tabs and space indentation in text. -Type=JavaScript/kjs -X-TDE-ScriptName=swaptabs.js diff --git a/kjsembed/kscript/swaptabs.js b/kjsembed/kscript/swaptabs.js deleted file mode 100644 index 20d19248..00000000 --- a/kjsembed/kscript/swaptabs.js +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env kjscmd -var appID = "kate"; -StdDirs.addResourceType("swaptabs", StdDirs.kde_default("data") + "/kate/scripts"); - -var client = new DCOPClient(); -var config = new Config( this, "swaptabsrc" ); -var documentIndex = client.call(appID, "KateDocumentManager", "activeDocumentNumber()"); -var ui = StdDirs.findResource("swaptabs","swaptabs.ui"); -var dlg = Factory.loadui(ui); - -// Load prefs -dlg.count.value = config.readNumEntry("Spaces", 8 ); -dlg.swap.selectedId = config.readNumEntry("Mode", 0 ); - -if( dlg.exec() == 1 ) -{ - var spaces = dlg.count.value; - - var sourceText; - var destText; - if( dlg.selection.checked ) - sourceText = client.call(appID, "SelectionInterface#" + documentIndex, "selection()"); - else - sourceText = client.call(appID, "EditInterface#" + documentIndex, "text()"); - - if( dlg.swap.selectedId == 0 ) - destText = replaceSpaces( spaces, sourceText ); - else - destText = replaceTabs( spaces, sourceText ); - - if( dlg.selection.checked ) - { - if( client.call(appID, "SelectionInterface#" + documentIndex, "hasSelection()") ) - { - var startLine = client.call(appID, "SelectionInterfaceExt#" + documentIndex, "selStartLine()"); - var startCol = client.call(appID, "SelectionInterfaceExt#" + documentIndex, "selStartCol()"); - client.call(appID, "SelectionInterface#" + documentIndex, "removeSelectedText()"); - client.call(appID, "SelectionInterface#" + documentIndex, "clearSelection()"); - client.call(appID, "EditInterface#" + documentIndex, "insertText(uint,uint,TQString)", startLine, startCol, destText); - } - else - { - alert("You must first select text."); - return false; - } - } - else - client.call(appID, "EditInterface#" + documentIndex, "setText(TQString)", destText ); - - // save prefs - config.writeNumEntry("Spaces", dlg.count.value ); - config.writeNumEntry("Mode", dlg.swap.selectedId ); -} - -function replaceSpaces( count, text ) -{ - var regExp = new RegExp("[ ]{"+count+","+count+"}", "g"); - regExp.mulitline = true; - - returnText = text.replace( regExp, "\t"); - return returnText; -} - -function replaceTabs( count, text ) -{ - - var regExp = new RegExp("[\t]","g"); - regExp.mulitline = true; - - var spaces = ""; - for( var idx = 0; idx < count; ++idx) - spaces += " "; - returnText = text.replace( regExp, spaces); - return returnText; -} diff --git a/kjsembed/kscript/swaptabs.ui b/kjsembed/kscript/swaptabs.ui deleted file mode 100644 index f7f5e973..00000000 --- a/kjsembed/kscript/swaptabs.ui +++ /dev/null @@ -1,172 +0,0 @@ - -MyDialog - - - MyDialog - - - - 0 - 0 - 219 - 176 - - - - Swap Tabs & Spaces - - - true - - - - unnamed - - - - layout2 - - - - unnamed - - - - textLabel1 - - - Number of spaces for a tab: - - - - - count - - - 4 - - - - - - - swap - - - Swap - - - 0 - - - - unnamed - - - - radioButton1 - - - Tabs for spaces - - - - - radioButton2 - - - Spaces for tabs - - - - - - - selection - - - Substitute only in current selection - - - - - Layout1 - - - - unnamed - - - 0 - - - 6 - - - - Horizontal Spacing2 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - buttonOk - - - &OK - - - - - - true - - - true - - - - - buttonCancel - - - &Cancel - - - - - - true - - - - - - - - - buttonOk - clicked() - MyDialog - accept() - - - buttonCancel - clicked() - MyDialog - reject() - - - - -- cgit v1.2.1