summaryrefslogtreecommitdiff
path: root/doc/API.txt
blob: bc730237fcc4762a13bab42a8625d0d9c14b504b (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
==============================================================================
                           Description of the API
==============================================================================

This file is a complete list and description of all API calls. It doesn't
contain any information specific to any language bindings.



Conventions:
============

All strings, filenames, urls, etc. are UTF8-encoded, unless specified 
otherwise.

All filenames and paths must be absolute.

Window relations:
-----------------

Many calls take 'windowinfo' argument that specifies a window related to the call.
This argument is necessary for maintaining proper window relations so that e.g.
a dialog opened from the call is properly associated with a window from the application
to which it logically belongs. Missing or incorrect data may result in focus problems.

Applications should specify the toplevel window related to the request. If the application
has only one main window then this is the window, if it has more then the relevant
one should be used (e.g. for the OpenUrl call the window should be the toplevel window
in which the user clicked on the link). See bindings documentation for further details.


API calls list:
===============

Init() -> ( bool ok )
---------------------

Needs to be the very first call performed. If the call fails, no API can be used.

ok: if false, initialization failed


Capabilities() -> ( int[] capabilities )
----------------------------------------

Returns a list of all commands that the desktop supports. Refer to your
bindings documentation for details on command id's.

capabilities: a list of capabilities


OpenUrl( string url, windowinfo winfo ) -> ( bool ok )
------------------------------------------------------

Opens the given URL or filename in the default web browser.

url: URL or filename to open
winfo: window related to this request (see conventions)
ok: if false, the url wasn't opened


ExecuteUrl( string url, windowinfo winfo ) -> ( bool ok )
---------------------------------------------------------

Opens the given URL or filename in the default application for the file (image viewer for image, etc.)

url: URL or filename to open
winfo: window related to this request (see conventions)
ok: if false, the URL/file wasn't opened


ButtonOrder() -> ( int order )
------------------------------

Returns the system button order.

order: 0 - error
       1 - Ok/Cancel
       2 - Cancel/Ok


RunAsUser( string user, string command, windowinfo winfo ) -> ( bool ok )
-------------------------------------------------------------------------

Executes the given command as a different user.

user: username or empty for superuser
command: command to execute
winfo: window related to this request (see conventions)
ok: if false, the command wasn't executed


SuspendScreensaving( bool suspend ) -> ( bool ok )
--------------------------------------------------

Suspends or resumes screensaving.

suspend: whether to suspend screensaving
ok: if false, suspending failed


MailTo( string subject, string body, string to, string cc, string bcc, string[] attachments, windowinfo winfo ) -> ( bool ok )
------------------------------------------------------------------------------------------------------------------------------

Opens a window for composing mail in the default mail client.

subject: mail subject or empty
body: mail body or empty
to: mail's To:, multiple entries are separated using commas, may be empty
to: mail's CC:, multiple entries are separated using commas, may be empty
to: mail's BCC:, multiple entries are separated using commas, may be empty
attachments: a list of filenames to be attached to the mail
winfo: window related to this request (see conventions)


LocalFile( string url, string local, bool allow_download, windowinfo winfo ) -> ( string result )
-------------------------------------------------------------------------------------------------

Converts an URL to a local file location, downloading the remote file
if necessary and allowed. The URL may be already a local file in which
case it will be simply returned.

file: URL or path of the file to convert to local file
allow_download: If the file URL doesn't point to a local file, it will be downloaded
    to a temporary local file if allow_download is true
local: filename of a local file that should be used as a temporary file
    in case of downloading; if empty, then a random temporary file is used and it needs
    to be eventually removed using RemoveTemporaryLocalFile; note that if the source
    file already is a local file, then its path will be returned and this field will
    be ignored
winfo: window related to this request (see conventions)
result: filename of the resulting local file, may be equal to the source file


UploadFile( string local, string file, bool remove_local, windowinfo winfo ) -> ( bool ok )
-------------------------------------------------------------------------------------------

Uploads local file to its URL location. This function is a complement for LocalFile
to save a temporary file to its real location after it's been changed. In case
the destination is a local file then this call successfully returns without doing anything.

local: filename of a temporary file obtained from LocalFile
file: URL or path of the location where to save the file to
remove_local: if true, equivalent to calling RemoveTemporaryLocalFile with the local
    file after this call
winfo: window related to this request (see conventions)
ok: if false, the upload failed

RemoveTemporaryLocalFile( string local ) -> ( bool ok )
-------------------------------------------------------

Removes a temporary local file created by LocalFile (only works it LocalFile had
to create a random temporary file itself). This call doesn't affect files that
haven't been created by LocalFile.

local: filename of a temporary file to be removed
ok: if false, the removal failed