summaryrefslogtreecommitdiffstats
path: root/kommander/executor/register.cpp
blob: db794e2552be79ca65fb7791c937e887f31c8ec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/***************************************************************************
        register.cpp  -  registration of functions/specials for intance
                             -------------------
    copyright            : (C) 2004 by Michal Rudolf <mrudolf@kdewebdev.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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "instance.h"
#include <dcopinformation.h>
#include <specialinformation.h>

#include <klocale.h>

void Instance::registerDCOP()
{
  DCOPInformation::insert("enableWidget(TQString,bool)");
  DCOPInformation::insert("changeWidgetText(TQString,TQString)");
  DCOPInformation::insert("currentItem(TQString)");
  DCOPInformation::insert("item(TQString,int)");
  DCOPInformation::insert("removeListItem(TQString,int)");
  DCOPInformation::insert("addListItem(TQString,TQString,int)");
  DCOPInformation::insert("addListItems(TQString,TQStringList,int)");
  DCOPInformation::insert("addUniqueItem(TQString,TQString)");
  DCOPInformation::insert("findItem(TQString,TQString)");
  DCOPInformation::insert("clearList(TQString)");
  DCOPInformation::insert("setCurrentListItem(TQString,TQString)");
  DCOPInformation::insert("setCurrentTab(TQString,int)");
  DCOPInformation::insert("insertTab(TQString,TQString,int)");
  DCOPInformation::insert("setChecked(TQString, bool)");
  DCOPInformation::insert("setAssociatedText(TQString,TQString)");
  DCOPInformation::insert("associatedText(TQString)");
  DCOPInformation::insert("global(TQString)");
  DCOPInformation::insert("setGlobal(TQString,TQString)");
}

void Instance::registerSpecials()
{
  /* global specials */
  SpecialInformation::insert("widgetText", 0, 0);
  SpecialInformation::insert("selectedWidgetText", 0, 0);
  SpecialInformation::insert("null", 0, 0);
  SpecialInformation::insert("pid", 0, 0);
  SpecialInformation::insert("dcopid", 0, 0);
  SpecialInformation::insert("parentPid", 0, 0);
  SpecialInformation::insert("execBegin", 0, 1);
  SpecialInformation::insert("env", 1, 1);
  SpecialInformation::insert("exec", 1, 1);
  SpecialInformation::insert("execBackground", 1, 1);
  SpecialInformation::insert("global", 1, 1);
  SpecialInformation::insert("dialog", 1, 2);
  SpecialInformation::insert("readSetting", 2, 2);
  SpecialInformation::insert("setGlobal", 2, 2);
  SpecialInformation::insert("writeSetting", 2, 2);
  SpecialInformation::insert("dcop", 4, 10);

  /* array specials */
  SpecialInformation::setCurrentObject("Array");
  SpecialInformation::insert("values", 1, 1, i18n( "Return EOL-separated list of all values in the array.") );
  SpecialInformation::insert("keys", 1, 1, i18n( "Return EOL-separated list of all keys in the array.") );
  SpecialInformation::insert("clear", 1, 1, i18n( "Remove all elements from the array.") );
  SpecialInformation::insert("count", 1, 1, i18n( "Return number of elements in the array.") );
  SpecialInformation::insert("value", 2, 2, i18n( "Return the value associated with given key.") );
  SpecialInformation::insert("remove", 2, 2, i18n( "Remove element with given key from the array.") );
  SpecialInformation::insert("setValue", 3, 3, i18n( "Add element with given key and value to the array") );
  SpecialInformation::insert("fromString", 2, 2, i18n( "Add all elements in the string to the array. "
    "String should have <i>key>\\tvalue\\n</i> format.") );
  SpecialInformation::insert("toString", 1, 1, i18n( "Return all elements in the array in "
    "<i>key>\\tvalue\\n</i> format.") );
  SpecialInformation::insertInternal("indexedFromString", 3, 3, i18n( "Create an integer indexed array - starting from 0 - from a string. Use the separator character to split the string.") );
  SpecialInformation::insertInternal("indexedToString", 2, 2, i18n( "Create a string from an integer indexed array. Concatenate the elements with the separator character.") );
  SpecialInformation::insertInternal("indexedRemoveElement", 2, 2, i18n( "Remove the element specified by the key from an indexed array and reindex the array.") );

  SpecialInformation::setCurrentObject("String");
  SpecialInformation::insert("length", 1, 1, i18n( "Return number of chars in the string.") );
  SpecialInformation::insert("contains", 2, 2, i18n( "Check if the string contains given substring.") );
  SpecialInformation::insert("find", 2, 2, i18n( "Return position of a substring in the string, "
    "or -1 if it isn't found.") );
  SpecialInformation::insert("left", 2, 2, i18n( "Return first n chars of the string.") );
  SpecialInformation::insert("right", 2, 2, i18n( "Return last n chars of the string.") );
  SpecialInformation::insert("mid", 3, 3, i18n( "Return substring of the string, starting from "
    "given position.") );
  SpecialInformation::insert("remove", 2, 2, i18n( "Replace all occurencies of given substring.") );
  SpecialInformation::insert("replace", 3, 3, i18n( "Replace all occurencies of given substring "
    "with given replacement.") );
  SpecialInformation::insert("upper", 1, 1, i18n( "Convert the string to uppercase.") );
  SpecialInformation::insert("lower", 1, 1, i18n( "Convert the string to lowercase.") );
  SpecialInformation::insert("compare", 2, 2, i18n( "Compare two strings. Return 0 if they are equal, "
    "-1 if the first one is lower, 1 if the first one is higher") );
  SpecialInformation::insert("isEmpty", 1, 1, i18n( "Check if string is empty.") );
  SpecialInformation::insert("isNumber", 1, 1, i18n( "Check if string is a valid number.") );

  SpecialInformation::setCurrentObject("File");
  SpecialInformation::insert("read", 1, 1, i18n( "Return content of given file.") );
  SpecialInformation::insert("write", 2, 2, i18n( "Write given string to a file.") );
  SpecialInformation::insert("append", 2, 2, i18n( "Append given string to the end of a file.") );
}