summaryrefslogtreecommitdiffstats
path: root/kate/kjswrapper/samples
diff options
context:
space:
mode:
Diffstat (limited to 'kate/kjswrapper/samples')
-rw-r--r--kate/kjswrapper/samples/Makefile.am23
-rw-r--r--kate/kjswrapper/samples/katekjsconsolewindow.desktop55
-rw-r--r--kate/kjswrapper/samples/katekjsconsolewindow.js18
-rw-r--r--kate/kjswrapper/samples/katekjsconsolewindow.rc8
-rw-r--r--kate/kjswrapper/samples/katekjsselect.desktop53
-rw-r--r--kate/kjswrapper/samples/katekjsselect.js92
-rw-r--r--kate/kjswrapper/samples/katekjsselect.rc8
-rw-r--r--kate/kjswrapper/samples/katekjstest1.desktop90
-rw-r--r--kate/kjswrapper/samples/katekjstest1.js167
9 files changed, 514 insertions, 0 deletions
diff --git a/kate/kjswrapper/samples/Makefile.am b/kate/kjswrapper/samples/Makefile.am
new file mode 100644
index 0000000..ee9a457
--- /dev/null
+++ b/kate/kjswrapper/samples/Makefile.am
@@ -0,0 +1,23 @@
+
+# Install the .rc file in the Part's directory (in this case, the part
+# is KHTMLPart)
+#pluginsdir=$(kde_datadir)/kate/plugins/katekjswrapper
+#plugins_DATA=ui.rc
+
+plugins1dir=$(kde_datadir)/kate/plugins/katekjstest1
+plugins1_DATA=katekjstest1.js
+
+pluginsconsolewindowdir=$(kde_datadir)/kate/plugins/katekjsconsolewindow
+pluginsconsolewindow_DATA=katekjsconsolewindow.js katekjsconsolewindow.rc
+
+pluginsselectdir=$(kde_datadir)/kate/plugins/katekjsselect
+pluginsselect_DATA=katekjsselect.js katekjsselect.rc
+
+#plugins2dir = $(kde_datadir)/kate/plugins/katekjstest2
+#plugins2_DATA = katekjstest2.js
+
+kde_services_DATA = katekjstest1.desktop katekjsconsolewindow.desktop katekjsselect.desktop
+#kde_services_DATA = katekjstest2.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kateinsertcommand.pot
diff --git a/kate/kjswrapper/samples/katekjsconsolewindow.desktop b/kate/kjswrapper/samples/katekjsconsolewindow.desktop
new file mode 100644
index 0000000..a882953
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsconsolewindow.desktop
@@ -0,0 +1,55 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katekjswrapperplugin
+X-Kate-Version=2.2
+X-Kate-PluginName=katekjsconsolewindow
+Name=Kate Javascript Console Window
+Name[bg]=Прозорец за изхода на Javascript
+Name[ca]=Finestra de consola de Javascript per a Kate
+Name[cs]=Okno javscriptové konzole Kate
+Name[da]=Kate Javascript konsolvindue
+Name[de]=Konsolenfenster für JavaScript in Kate
+Name[el]=Παράθυρο κονσόλας Javascript του Kate
+Name[eo]=Javaskripta konzolfenestro por Kodredaktilo
+Name[es]=Ventana de la consola de Javascript de Kate
+Name[et]=Kate Javascripti konsooliaken
+Name[eu]=Kate Javascript konsola leihoa
+Name[fa]=پنجرۀ پیشانۀ جاوااسکریپت Kate
+Name[fi]=Kate Javascript konsoli-ikkuna
+Name[fr]=Console Javascript pour Kate
+Name[fy]=Kate Javascript console-finster
+Name[ga]=Fuinneog Chonsóil Javascript Kate
+Name[gl]=Fiestra de Consola de JavaScript para Kate
+Name[he]= חלון תסריטי הג'אווה של Kate
+Name[hi]=केएटीई जावास्क्रिप्ट कंसोल विंडो
+Name[hr]=Kate terminalski prozor za Javascript
+Name[hu]=Kate Javascript-es parancsértelmező ablak
+Name[is]=Kate Javascript skjáhermir
+Name[it]=Finestra console JavaScript di Kate
+Name[ja]=Kate Javascript コンソールウィンドウ
+Name[ka]=Kate Javascript კონსოლის ფანჯარა
+Name[kk]=Kate Javascript консоль терезесі
+Name[km]=បង្អួច​កុងសូល​របស់ Kate Javascript
+Name[mk]=прозорец со Javascript-конзола за Кате
+Name[nb]=Javascript konsollvindu for Kate
+Name[nds]=Javascript-Konsoolfinster för Kate
+Name[ne]=केट जाभास्क्रिप्ट कन्सोल सञ्झ्याल
+Name[nl]=Kate Javascript console-venster
+Name[nn]=Javascript-konsollvindauge til Kate
+Name[pa]=ਕੇਟ ਜਾਵਾਸਕਰਿਪ ਕੰਨਸੋਲ ਝਰੋਖਾ
+Name[pl]=Okno konsoli Javascript dla Kate
+Name[pt]=Janela de Consola de JavaScript do Kate
+Name[pt_BR]=Janela de Console Javascript do Kate
+Name[ru]=Окно консоли Javascript Kate
+Name[sk]=Konzolové okno Kate Javascript
+Name[sl]=Konzolno okno javascripta v Kate
+Name[sr]=Конзолни прозор JavaSript-а за Kate
+Name[sr@Latn]=Konzolni prozor JavaSript-a za Kate
+Name[sv]=Kate Javaskript terminalfönster
+Name[tg]=Тирезаи нозиргоҳи Kate Javascript
+Name[tr]=Kate Javascript Konsol Penceresi
+Name[uk]=Вікно консолі Javascript для Kate
+Name[vi]=Cửa sổ bàn giao tiếp Javascript Kate
+Name[zh_CN]=Kate Javascript 控制台窗口
+Name[zh_TW]=Kate Javascript 主控台視窗
diff --git a/kate/kjswrapper/samples/katekjsconsolewindow.js b/kate/kjswrapper/samples/katekjsconsolewindow.js
new file mode 100644
index 0000000..e253ce0
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsconsolewindow.js
@@ -0,0 +1,18 @@
+function newWindowCallBack(mainwindow) {
+ var ac=mainwindow.actionCollection();
+ action = new KAction( ac, 'kjsconsole_show_action' );
+ action.text = 'Javascript Console Window';
+ action.icon = 'konsole';
+
+ mainwindow.showConsole = function()
+ {
+
+ KJSConsole();
+ }
+
+ action.connect( action, 'activated()', mainwindow, 'showConsole' );
+
+}
+
+setWindowConfiguration(null,newWindowCallBack,null);
+
diff --git a/kate/kjswrapper/samples/katekjsconsolewindow.rc b/kate/kjswrapper/samples/katekjsconsolewindow.rc
new file mode 100644
index 0000000..7ac34fc
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsconsolewindow.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="katekjsconsolewindow" library="libkatekjsconsolewindowplugin" version="1">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="kjsconsole_show_action"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/kate/kjswrapper/samples/katekjsselect.desktop b/kate/kjswrapper/samples/katekjsselect.desktop
new file mode 100644
index 0000000..c4d1273
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsselect.desktop
@@ -0,0 +1,53 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katekjswrapperplugin
+X-Kate-Version=2.2
+X-Kate-PluginName=katekjsselect
+Name=Select Smallest Enclosing Block
+Name[ca]=Selecció del bloc tancat més petit
+Name[cs]=Zvolte nejmenší blok
+Name[da]=Vælg den mindste omsluttende blok
+Name[de]=Kleinsten einschließenden Block auswählen
+Name[el]=Επιλογή του μικρότερου περικλυόμενου κομματιού
+Name[eo]=Elektu pli mallongan entenantan blokon
+Name[es]=Selecciona un bloque cerrado más pequeño
+Name[et]=Vali väikseim sulgev blokk
+Name[eu]=Hautatu blokerik txikiena
+Name[fa]=گزینش کوچک‌ترین بلوک محصور
+Name[fi]=Valitse pienin ympäröity lohko
+Name[fr]=Sélection du plus petit bloc enfermé
+Name[fy]=Lytste ynslutende blok selektearje
+Name[gl]=Seleccionar o Menor Bloco Envolvente
+Name[he]=בחר את בלוק הסגירה הכי קטן
+Name[hr]=Odabir najmanjeg zatvorenog bloka
+Name[hu]=A legkisebb bezáró blokk kijelölése
+Name[is]=Velja minnstu umluktu blokkina
+Name[it]=Seleziona il più piccolo blocco
+Name[ja]=囲っている最も内側のブロックを選択します
+Name[ka]=უმცირესი დახურვის ბლოკის ამორჩევა
+Name[kk]=Ең шағын блокты таңдау
+Name[km]=ជ្រើស​ប្លុក​ដែល​បាន​ព័ទ្ធ​ជុំវិញ​​​តូច​បំផុត
+Name[lt]=Žymėti mažiausią bloką
+Name[mk]=Најмал опкружувачки блок
+Name[ms]=Pilih Blok Penutupan Terkecil
+Name[nb]=Velg minste omsluttende blokk
+Name[nds]=Den lüttsten insluten Block utsöken
+Name[ne]=सामेल गरिने सबैभन्दा सानो खण्ड चयन गर्नुहोस्
+Name[nl]=Kleinste insluitende blok selecteren
+Name[nn]=Vel minste omsluttande blokk
+Name[pl]=Wybierz najmniejszy blok zawierający
+Name[pt]=Seleccionar o Menor Bloco Envolvente
+Name[pt_BR]=Sleecione o Menor Bloco Aninhado
+Name[ru]=Выбор наименьшего блока
+Name[sk]=Zvolí najmenší ohraničujúci blok
+Name[sl]=Izberite najmanjši obdajajoč blok
+Name[sr]=Изаберите најмањи обухватајући блок
+Name[sr@Latn]=Izaberite najmanji obuhvatajući blok
+Name[sv]=Markera minsta omgivande block
+Name[ta]=மிகச்சிறிய இணைப்பை தேர்ந்தெடு
+Name[tr]=Çevreleyen en küçük bloğu seç
+Name[uk]=Виберіть найменший блок включення
+Name[vi]=Chọn khối chứa nhỏ nhất
+Name[zh_CN]=选择最小的包围块
+Name[zh_TW]=選擇最小封閉區域
diff --git a/kate/kjswrapper/samples/katekjsselect.js b/kate/kjswrapper/samples/katekjsselect.js
new file mode 100644
index 0000000..d6a33fb
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsselect.js
@@ -0,0 +1,92 @@
+function newWindowCallBack(mainwindow) {
+ var ac=mainwindow.actionCollection();
+ action = new KAction( ac, 'kjsselect_select_action' );
+ action.text = 'Select enclosing block';
+ //action.icon = 'konsole';
+
+
+ mainwindow.selectIt = function()
+ {
+ endChars=Array();
+ endChars['\"']="\"";
+ endChars['(']=")";
+ endChars['[']="]";
+ endChars['\'']="'";
+ endChars['{']="}";
+ endChar="";
+ av=this.viewManager().activeView();
+ d=KATE.DocumentManager.activeDocument();
+
+ lineCnt=d.numLines();
+ x=av.cursorColumn();
+ y=av.cursorLine();
+ line=d.textLine(y);
+ sy=y;
+ sx=x-1;
+ while (true) {
+ if (sx<0) {
+ sy=sy-1;
+ if (sy<0) {
+ d.selectAll();
+ return;
+ }
+ line=d.textLine(sy);
+ while (line.length==0) {
+ sy=sy-1;
+ if (sy<0) {
+ d.selectAll();
+ return;
+ }
+ line=d.textLine(sy);
+ }
+ sx=line.length-1;
+
+ }
+ if (
+ (line[sx]=="\"") ||
+ (line[sx]=="'") ||
+ (line[sx]=="(") ||
+ (line[sx]=="[") ||
+ (line[sx]=="{")
+ ) {
+ endChar=endChars[line[sx]];
+ break;
+ }else sx--;
+ }
+
+
+ alert("Searching end");
+ ex=x;
+ ey=y;
+ line=d.textLine(y);
+ while (true) {
+ if (ex>=(line.length-1)) {
+ ey=ey+1;
+ if (ey>=lineCnt) {
+ d.selectAll();
+ return;
+ }
+ line=d.textLine(ey);
+ while (line.length==0) {
+ ey=ey+1;
+ if (ey>=lineCnt) {
+ d.selectAll();
+ return;
+ }
+ line=d.textLine(ey);
+ }
+ ex=0;
+ }
+ if (line[ex]==endChar)
+ break; else ex++;
+ }
+ d.setSelection(sy,sx,ey,ex);
+
+ }
+
+ action.connect( action, 'activated()', mainwindow, 'selectIt' );
+
+}
+
+setWindowConfiguration(null,newWindowCallBack,null);
+
diff --git a/kate/kjswrapper/samples/katekjsselect.rc b/kate/kjswrapper/samples/katekjsselect.rc
new file mode 100644
index 0000000..2b210a1
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjsselect.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="katekjsselect" library="libkatekjsselect" version="1">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="kjsselect_select_action"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/kate/kjswrapper/samples/katekjstest1.desktop b/kate/kjswrapper/samples/katekjstest1.desktop
new file mode 100644
index 0000000..d5731b5
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjstest1.desktop
@@ -0,0 +1,90 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katekjswrapperplugin
+X-Kate-Version=2.2
+X-Kate-PluginName=katekjstest1
+Name=Kate KJS Test 1
+Name[bs]=Kate KJS test 1
+Name[ca]=Test 1 per KJS a Kate
+Name[cs]=Kate KJS test 1
+Name[el]=Kate KJS δοκιμή 1
+Name[eo]=KJS testo 1 de Kodredaktilo
+Name[et]=Kate KJS test 1
+Name[eu]=Kate KJS-ren 1 froga
+Name[fa]=آزمون ۱ Kate KJS
+Name[fi]=Kate KJS testi 1
+Name[fr]=Test 1 KJS pour Kate
+Name[ga]=Tástáil 1 Kate KJS
+Name[gl]=Proba 1 para Kate KJS
+Name[he]=ניסוי KJS של Kate מספר 1
+Name[hi]=के-एटीई केजेएस जाँच 1
+Name[is]=Kate KJS prufa 1
+Name[ja]=Kate KJS テスト 1
+Name[km]=សាកល្បង Kate KJS
+Name[ms]=Kate KJS Ujian 1
+Name[nds]=Kate-KJSTest 1
+Name[ne]=केट केजेएस परीक्षण १
+Name[nn]=Kate KJS-test 1
+Name[pa]=ਕੇਟ KJS Test 1
+Name[pl]=KJS Test 1 dla Kate
+Name[pt]=Teste 1 Kate do KJS
+Name[pt_BR]=Teste Kate KJS 1
+Name[sl]=Kate KJS preizkus 1
+Name[sr]=Kate KJS, тест 1
+Name[sr@Latn]=Kate KJS, test 1
+Name[ta]=கேட் KJS சோதனை 1
+Name[tr]=Kate KJS Deneme1
+Name[uk]=Kate KJS Тест 1
+Name[vi]=Thử thách KJS Kate 1
+Name[zh_CN]=Kate KJS 测试 1
+Comment=Test for the KJS Wrapper
+Comment[bg]=Проба на обвивката на KJS
+Comment[ca]=Test pel Wrapper de KJS
+Comment[cs]=Test KJS wrapperu
+Comment[da]=Test for KJS Wrapper
+Comment[de]=Test für den KJS-Wrapper
+Comment[el]=Δοκιμή για το KJS Wrapper
+Comment[eo]=Testo por la KJS envolvaĵo
+Comment[es]=Test para el ajuste KJS
+Comment[et]=KJS Wrapperi test
+Comment[eu]=KJS Wrapper-erako testua
+Comment[fa]=آزمون برای سطربندی KJS
+Comment[fi]=KJS Wrapperin testi
+Comment[fr]=Test pour l'interface avec KJS
+Comment[fy]=Test foar de KJS Wrapper
+Comment[ga]=Tástáil an Rapar KJS
+Comment[gl]=Proba para o Wrapper de KJS
+Comment[he]=ניסיון עבור המעטפת KJS
+Comment[hi]=केजेएस व्रेपर के लिए जाँच
+Comment[hr]=Provjera za KJS omotač
+Comment[hu]=Tesztprogram a KJS felülethez
+Comment[is]=Prufa fyrir KJS eininguna
+Comment[it]=Test per il wrapper KJS
+Comment[ja]=KJS ラッパーのテスト
+Comment[ka]=KJS Wrapper-ის შემოწმება
+Comment[kk]=KJS Wrapper сынағы
+Comment[km]=សាកល្បង​សម្រាប់​​កម្មវិធី​រុំ​ KJS
+Comment[lt]=Bandymas KJS įdėklui
+Comment[mk]=Тест за обвивката KJS
+Comment[ms]=Ujian untuk Pembungkus KJS
+Comment[nb]=Test for KJS-omslaget
+Comment[nds]=Test för den KJS-Wrapper
+Comment[ne]=केजेएस आवरणका लागि परीक्षण
+Comment[nl]=Test voor de KJS Wrapper
+Comment[nn]=Test for KJS-omslaget
+Comment[pl]=Test obsługi KJS
+Comment[pt]=Teste para o 'Wrapper' de KJS
+Comment[pt_BR]=Teste para o Wrapper do KJS
+Comment[ru]=Тест KJS Wrapper
+Comment[sk]=Test pre obálku KJS
+Comment[sl]=Preizkus za KJS Wrapper
+Comment[sr]=Тест за KJS омотач
+Comment[sr@Latn]=Test za KJS omotač
+Comment[sv]=Test för KJS-omslutande program
+Comment[ta]=KJS சுற்றுத்தாளுக்கான சோதனை
+Comment[tr]=KJS Wrapper Testi
+Comment[uk]=Тест для KJS Wrapper
+Comment[vi]=Thử thách cho bộ bao bọc KJS
+Comment[zh_CN]=KJS Wrapper 的测试
+Comment[zh_TW]=KJS 包裝測試
diff --git a/kate/kjswrapper/samples/katekjstest1.js b/kate/kjswrapper/samples/katekjstest1.js
new file mode 100644
index 0000000..7e4e041
--- /dev/null
+++ b/kate/kjswrapper/samples/katekjstest1.js
@@ -0,0 +1,167 @@
+/****************************************************************
+ First configuration page
+****************************************************************/
+function Page1 (parentWidget) {
+ this.defaults=function() {
+ alert("Defaults has been called");
+ }
+ this.apply=function() {
+ alert("Apply has been called");
+ }
+ this.reset=function() {
+ alert("Reset defaults has been called");
+ }
+ box=new QVBox(parentWidget);
+ this.button1=new QPushButton(box);
+ this.button1.text="P1 Button 1";
+ this.button1.show();
+ this.button2=new QPushButton(box);
+ this.button2.text="P1 Button 2";
+ this.button2.show();
+ box.show();
+}
+Page1.name="Page1"
+Page1.fullName="Test1/Page1";
+
+/****************************************************************
+ Second configuration page
+****************************************************************/
+
+function Page2 (parentWidget) {
+ box=new QVBox(parentWidget);
+ this.button1=new QPushButton(box);
+ this.button1.text="P2 Button 1";
+ this.button1.show();
+ this.button2=new QPushButton(box);
+ this.button2.text="P2Button 2";
+ this.button2.show();
+ box.show();
+}
+Page2.name="Page2";
+Page2.fullName="Test1/Page2";
+
+/****************************************************************
+ Third configuration page
+****************************************************************/
+
+function Page3 (parentWidget) {
+ box=new QVBox(parentWidget);
+ this.button1=new QPushButton(box);
+ this.button1.text="P3 Button 1";
+ this.button1.show();
+ this.button2=new QPushButton(box);
+ this.button2.text="P3 Button 2";
+ this.button2.show();
+ box.show();
+}
+Page3.name="Page3";
+Page3.fullName="Test1/Page3";
+
+
+/****************************************************************
+ First toolview
+****************************************************************/
+
+function MyToolView1 (mainwindow,parentwidget) {
+ parentwidget.caption="This is my first JS Toolview";
+ parentwidget.icon=StdIcons.BarIcon("yes");
+
+ this.lv = new KListView( parentwidget );
+
+ this.lv.addColumn('Pix');
+ this.lv.addColumn('One');
+ this.lv.addColumn('Two');
+ this.lv.addColumn('Three');
+
+ this.lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" );
+ this.lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" );
+ this.lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" );
+ this.lv.insertItem( StdIcons.BarIcon("no"), 'Something', "Nothing", "Thing" );
+
+ this.changed=function() {
+ alert("Item changed");
+ KATE.DocumentManager.activeDocument().insertText(0,0,"TEST");
+ }
+ this.lv.connect(this.lv,'selectionChanged()',this,'changed');
+
+
+ this.mw=mainwindow;
+ this.cleanup=function() {
+ alert("Cleanup MyToolView1");
+ }
+
+}
+MyToolView1.startPosition=KATE.ToolView.Right;
+MyToolView1.name="myfirstjstoolview"
+
+
+/****************************************************************
+ Second toolview
+****************************************************************/
+
+function MyToolView2 (mainwindow,parentwidget) {
+ parentwidget.caption="This is my second JS Toolview";
+ parentwidget.icon=StdIcons.BarIcon("no");
+
+ this.lb=new QListBox(parentwidget);
+ this.mainwindow=mainwindow;
+ this.cleanup=function() {
+ alert("Cleanup MyToolView2");
+ }
+}
+MyToolView2.startPosition=KATE.ToolView.Left;
+MyToolView2.name="mysecondjstoolview"
+
+
+
+/****************************************************************
+ NewWindow callback
+****************************************************************/
+
+function newWindowCallBack(mainwindow) {
+ alert("New Window has been created");
+/*
+ anotherToolView = function (mainwindow,parentwidget) {
+ parentwidget.caption="This is my third JS Toolview";
+ parentwidget.icon=StdIcons.BarIcon("kate");
+
+ this.lb=new QListBox(parentwidget);
+ this.mainwindow=mainwindow;
+ this.cleanup=function() {
+ alert("Cleanup MyToolView3");
+ }
+ }
+ anotherToolView.startPosition=KATE.ToolView.Left;
+ anotherToolView.name="mythirdjsoolview"
+ mainwindow.createToolView(anotherToolView);*/
+}
+
+/****************************************************************
+ WindowRemoved callback
+****************************************************************/
+function windowRemovedCallBack(mainwindow) {
+ alert("Window has been removed");
+}
+
+
+
+
+
+
+/****************************************************************
+ Initialization
+****************************************************************/
+
+cpc=new Array();
+cpc.push(Page1);
+cpc.push(Page2);
+setConfigPages(cpc);
+//setConfigPages(Page3);
+//addConfigPage(Page3);
+
+tvc=new Array();
+tvc.push(MyToolView1);
+tvc.push(MyToolView2);
+setWindowConfiguration(tvc,newWindowCallBack,windowRemovedCallBack);
+//setWindowConfiguration(MyToolView1,newWindowCallBack,windowRemovedCallBack);
+