Advanced Usage
Command Line Options
When running &appname; from the command line, there are several options for opening data files. They may be seen by running tellico --help.
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
&DCOP; Interface
&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 tellico-<pid>, where <pid> is the process id of the running application.
DCOP Commands
Two &DCOP; objects are available in the tellico interface: tellico and collection.
The tellico Object
The full list of &DCOP; commands in the tellico object is shown below:
bool importTellico(TQString file, TQString action)
bool importBibtex(TQString file, TQString action)
bool importMODS(TQString file, TQString action)
bool importRIS(TQString file, TQString action)
bool exportXML(TQString file)
bool exportZip(TQString file)
bool exportBibtex(TQString file)
bool exportHTML(TQString file)
bool exportCSV(TQString file)
bool exportPilotDB(TQString file)
QValueList<long int> selectedEntries()
QValueList<long int> filteredEntries()
void openFile(TQString file)
void setFilter(TQString text)
bool showEntry(long int id)
For the four import commands, the first argument is the file to import, and the second is the import action. Three actions are available: replace, append, and merge. Four file formats are supported for importing: Tellico XML files, Bibtex files, MODS files, and RIS files.
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.
A list of the entry IDs currently selected or being filtered is able to facilitate showing or updating entries in the view.
A new data file may be opened by using the openFile() command. The full path must be specified.
A new filter may be set using the setFilter() command, which is the equivalent of typing in the filter box in the main window.
Given an entry ID, showEntry() will select that entry and show the entry details in the main window.
The collection Object
The full list of &DCOP; commands in the collection object is shown below:
long int addEntry()
bool removeEntry(long int entryID)
QStringList values(TQString fieldName)
QStringList values(long int entryID,TQString fieldName)
QStringList bibtexKeys()
TQString bibtexKey(long int entryID)
bool setFieldValue(long int entryID,TQString fieldName,TQString value)
bool addFieldValue(long int entryID,TQString fieldName,TQString value)
A new empty entry may be created in the current collection using the addEntry() 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 removeEntry().
Calling values() 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.
If the current collection is a bibliography, calling bibtexKeys() will return the Bibtex citation key for all selected entries. The bibtexKey for a specific entry may be found by using the bibtekKey() command.
Entries can be edited directly with the &DCOP; interface. Given an entry ID, setFieldValue() will set the field value directly. To add a value, without affecting the existing values, use addFieldValue(). The new value gets appended to the end of the existing list.
DCOP Examples
Here are some examples for scripting &appname; using the &DCOP; interface. Since the pid must be known, the easiest way to include that in the shell command is like so: dcop $(dcop | grep tellico) tellico.
Open a Bibtex file
% dcop $(dcop | grep tellico) tellico importBibtex ~/documents/reference.bib replace
true
Export a Bibtex file
% dcop $(dcop | grep tellico) tellico exportBibtex ~/documents/reference.bib
true
Echo the citation key of the current selection
% dcop $(dcop | grep tellico) collection bibtexKeys
stephenson2004
Add a new entry and set the title
% myid=`dcop $(dcop | grep tellico) collection addEntry`
% dcop $(dcop | grep tellico) collection setFieldValue $myid title "My New Book"
true