summaryrefslogtreecommitdiffstats
path: root/kjsembed/kscript/swaptabs.js
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:00 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:00 -0600
commit2d84c9d3ad0aaea0620658024537d54e6a7939f4 (patch)
tree35675532f42e78dbfcd56c6b344e1f0e79013a2e /kjsembed/kscript/swaptabs.js
parent980972d200e109a643e5a10037d7f9fcf02382ed (diff)
downloadtdebindings-2d84c9d3ad0aaea0620658024537d54e6a7939f4.tar.gz
tdebindings-2d84c9d3ad0aaea0620658024537d54e6a7939f4.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kjsembed/kscript/swaptabs.js')
-rw-r--r--kjsembed/kscript/swaptabs.js75
1 files changed, 0 insertions, 75 deletions
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;
-}