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
|
<chapter id="advanced">
<title>Advanced Usage</title>
<sect1 id="command-line">
<title>Command Line Options</title>
<para>
When running &appname; from the command line, there are several options for opening data files. They may be seen by running <userinput>tellico --help</userinput>.
</para>
<programlisting>
Usage: tellico [Qt-options] [KDE-options] [options] [filename]
Tellico - a collection manager for KDE
Options:
--nofile Do not reopen the last open file
--bibtex Import <filename> as a bibtex file
--mods Import <filename> as a MODS file
--ris Import <filename> as a RIS file
Arguments:
filename File to open
</programlisting>
</sect1>
<sect1 id="dcop-interface">
<title>&DCOP; Interface</title>
<para>
&appname; has a minimal &DCOP; interface, which can be used for scripting or interacting with a running application from the command-line. As with all &DCOP; calls, you need to specify the application you want to interface with, and the particular interface. The name of the &DCOP; application is <constant>tellico-<pid></constant>, where <emphasis><pid></emphasis> is the process id of the running application.
</para>
<sect2 id="dcop-commands">
<title>DCOP Commands</title>
<para>Two &DCOP; objects are available in the tellico interface: <constant>tellico</constant> and <constant>collection</constant>.</para>
<sect3 id="dcop-tellico">
<title>The <constant>tellico</constant> Object</title>
<para>The full list of &DCOP; commands in the <constant>tellico</constant> object is shown below:</para>
<programlisting>
bool importTellico(QString file, QString action)
bool importBibtex(QString file, QString action)
bool importMODS(QString file, QString action)
bool importRIS(QString file, QString action)
bool exportXML(QString file)
bool exportZip(QString file)
bool exportBibtex(QString file)
bool exportHTML(QString file)
bool exportCSV(QString file)
bool exportPilotDB(QString file)
QValueList<long int> selectedEntries()
QValueList<long int> filteredEntries()
void openFile(QString file)
void setFilter(QString text)
bool showEntry(long int id)
</programlisting>
<para>
For the four import commands, the first argument is the file to import, and the second is the import action. Three actions are available: <emphasis>replace</emphasis>, <emphasis>append</emphasis>, and <emphasis>merge</emphasis>. Four file formats are supported for importing: Tellico XML files, Bibtex files, MODS files, and RIS files.
</para>
<para>
The current open collection in &appname; may be exported to a file, in either Tellico XML format, Tellico ZIP format, Bibtex, HTML, comma-separated values (CSV), or the PilotDB format.
</para>
<para>A list of the entry IDs currently selected or being filtered is able to facilitate showing or updating entries in the view.</para>
<para> A new data file may be opened by using the <command>openFile()</command> command. The full path must be specified.</para>
<para>A new filter may be set using the <command>setFilter()</command> command, which is the equivalent of typing in the filter box in the main window.</para>
<para>Given an entry ID, <command>showEntry()</command> will select that entry and show the entry details in the main window.</para>
</sect3>
<sect3 id="dcop-collection">
<title>The <constant>collection</constant> Object</title>
<para>The full list of &DCOP; commands in the <constant>collection</constant> object is shown below:</para>
<programlisting>
long int addEntry()
bool removeEntry(long int entryID)
QStringList values(QString fieldName)
QStringList values(long int entryID,QString fieldName)
QStringList bibtexKeys()
QString bibtexKey(long int entryID)
bool setFieldValue(long int entryID,QString fieldName,QString value)
bool addFieldValue(long int entryID,QString fieldName,QString value)
</programlisting>
<para>
A new empty entry may be created in the current collection using the <command>addEntry()</command> command. The return value is the entry ID, which can then be used to set the field values in the entry. An entry can be deleted from the collection by calling <command>removeEntry()</command>.
</para>
<para>
Calling <command>values()</command> using just a field name will return all the values for that field for the currently selected entries. If no entries are selected, the return list is empty. If an entry ID is included in the command, the field values for that specific entry are returned.
</para>
<para>
If the current collection is a bibliography, calling <command>bibtexKeys()</command> will return the Bibtex citation key for all selected entries. The bibtexKey for a specific entry may be found by using the <command>bibtekKey()</command> command.
</para>
<para>
Entries can be edited directly with the &DCOP; interface. Given an entry ID, <command>setFieldValue()</command> will set the field value directly. To add a value, without affecting the existing values, use <command>addFieldValue()</command>. The new value gets appended to the end of the existing list.
</para>
</sect3>
</sect2>
<sect2 id="dcop-examples">
<title>DCOP Examples</title>
<para>
Here are some examples for scripting &appname; using the &DCOP; interface. Since the <emphasis>pid</emphasis> must be known, the easiest way to include that in the shell command is like so: <userinput>dcop $(dcop | grep tellico) tellico</userinput>.
</para>
<screen width="40">
<emphasis>Open a Bibtex file</emphasis>
<prompt>%</prompt> <userinput>dcop $(dcop | grep tellico) tellico importBibtex ~/documents/reference.bib replace</userinput>
<computeroutput>true</computeroutput>
</screen>
<screen width="40">
<emphasis>Export a Bibtex file</emphasis>
<prompt>%</prompt> <userinput>dcop $(dcop | grep tellico) tellico exportBibtex ~/documents/reference.bib</userinput>
<computeroutput>true</computeroutput>
</screen>
<screen width="40">
<emphasis>Echo the citation key of the current selection</emphasis>
<prompt>%</prompt> <userinput>dcop $(dcop | grep tellico) collection bibtexKeys</userinput>
<computeroutput>stephenson2004</computeroutput>
</screen>
<screen width="40">
<emphasis>Add a new entry and set the title</emphasis>
<prompt>%</prompt> <userinput>myid=`dcop $(dcop | grep tellico) collection addEntry`</userinput>
<prompt>%</prompt> <userinput>dcop $(dcop | grep tellico) collection setFieldValue $myid title "My New Book"</userinput>
<computeroutput>true</computeroutput>
</screen>
</sect2>
</sect1>
</chapter>
|