<left>

Contents->MIME Types

1. MIME Types
2. Defining a MIME Type
3. Cross Referencing MIME Types
4. "Open With" List
5. Importing MIME Types
   - Synchronising with the System's Global MIME Types
6. Exporting MIME Types
7. Defining Global MIME Types

### MIME Types

MIME (Multipurpose Internet Mail Extensions) Types were originally used to associate file types sent between Internet E-mail clients, however it has since been extended to other applications including web browsers and file system browsers (such as Endeavour).

Endeavour has a built-in MIME Types engine, that supports objects of different types and uniquenesses to be associated with each other. Each MIME Type has the following properties:

- Class - Determines if the MIME Type represents a `System Object`, `File Format`, `Application`, or `Unique Object`.
- Type - Specifies the MIME Type's path which is a unique identifier used to identify this MIME Type..
- Location - Specifies the location of the application or unique object. This value exists only if the class is set to `Application` or `Unique Object`.
- Extensions - Specifies a space separated list of file name extensions to be associated with this MIME Type. Each extension must start with a `.` character. This value exists only if the class is set to `File Format`.
- Description - An arbitary verbose description of the MIME Type.
- Handler - Determines if a Command or one of Endeavour's windows should be used to open the object associated with this MIME Type.
- Command - A command string that will be executed in order to open the object associated with this MIME Type. This value exists only if the class is set to `Application`, `File Format` or `Unique Object`. Each one of those MIME Types may have one or more commands (`Application` class MIME Types usually only have one command), where the first command is considered the default. Each command has a name and a command string. The command string may be a reference to another MIME Type of class `Application`.

Back to the top

### Defining a MIME Type

To define a new MIME Type, go to View->MIME Types...

You should then see the dialog shown below (it may take a while for the MIME Types to be loaded):

Suppose, for this example, you want to define a MIME Type for a text file format who's file name extension is `.txt` and the default program to be executed for it is `/usr/bin/tknotepad`, then first select an item from the list at where you want to insert the new MIME Type at and then click on Add...

A new MIME Type will be added and a dialog will appear as shown below:

To add a value to the Commands list, first make sure that Handle By is set to `Command` and then click on to add a new command.

Now double click on the new command's cell and enter the new values. You need to define both the new command's name and the new command's value (two cells).

You can also click on the cell and then click on to define the command's name and value.

The new command's name can be any of the following:

Command Name | Activated By
--- | ---
`default` | `DOUBLECLICK` or File->Open
`view` | `DOUBLECLICK` or File->Open
`edit` | `SHIFT + DOUBLECLICK`

For this example, set the command's name to `default` and the command value to `/usr/bin/tknotepad "%s"`, as shown below:

Name | Command
--- | ---
`default` | `/usr/bin/tknotepad "%s"`

You can create as many commands for this MIME Type as you wish, but currently only the command names listed above are supported. All other command names will be ignored.

To set an icon for this MIME Type, click on the corresponding icon in the Icons frame on the right. You will then be prompted for an icon image file, select an `.xpm` image file that you want to use and click on Select.

Each MIME Type Icon has the following states:

- Standard - The default state for all types of objects
- Selected - The expanded state for directories. For all other types of objects, this state has no affect.
- Extended - The broken state for links that do not have a valid destination. For all other types of objects, this state has no affect.
- Hidden - The hidden state for all types of objects that are set hidden.

Endeavour comes with a large set of icons located in:

- `/usr/share/endeavour2/icons/`

Large icons are typically 48 by 48 pixels, medium icons are typically 32 by 32 pixels, and small icons are typically 20 by 20 pixels.

Click on OK when you are done.

In the future (for this example) if you double click on an object who has an extension of `.txt` then the following command will be executed:

- `/usr/bin/tknotepad /somewhere/somefile.txt`

Where `/somewhere/somefile.txt` is the full path to the actual object.

Valid extensions include `.txt .tar.gz .Z *rc Makefile*`. Prefixes or suffixes (without the `.` deliminator) require a `*` character after or before the word (respectivly).

Back to the top

### Cross Referencing MIME Types

When you define a command for your MIME Type, you can set that command to either reffer to a specific program (as seen in the above example) or you can reffer it to another MIME Type who's class is set to `Application`.

To reffer the command of one MIME Type to a `Application` class MIME Type:

First create a new `Application` class MIME Type by clicking on Add... and set its values to the following:

- class to `Application`
- type to `application/text/editor`
- location to `/usr/bin/tknotepad`
- commands to `default` `/usr/bin/tknotepad`

For `Application` class MIME Types, only the first defined command will be used (subsequent commands are ignored).

Click on OK when you are done.

Now go and edit the previous MIME Type that defined the `.txt` file format and change its command to reffer to the type value of the `Application` class MIME Type you just created.

Command values that do not start with an absolute path imply that the command reffers to another MIME Type. For example, a command value of `application/text/editor` reffers to another MIME Type who's type is `application/text/editor`.

Now the default command for an object who's extension is `.txt` will be refered to the new `Application` class MIME Type who's type value is set to `application/text/editor`. This will allow you to change your preferred application for a group of MIME Types that all require just one common application by only changing that one `Application` class MIME Type.

Back to the top

### "Open With" List

The items that appear in the "Open With" list (the list that you see when you go to File->Open With...) are MIME Types who's class is set to `Application`.

To add an item to the "Open With" list, follow the steps in section Defining a MIME Type. Make sure that you set the MIME Type's class to `Application`.

Back to the top

### Importing MIME Types

File formats that contain MIME Types which Endeavour can import from are as follows:

- Debian, MetaMail, MUTT MailCap format (`*mailcap`)
- Media Types format (`*media.types` `*mime.types`)
- Endeavour Mark II MIME Types format (`mimetypes.ini`)

To import MIME Types:

1. Go to View->MIME Types...
2. Select the MIME Type in the list at the position where you want to insert the imported MIME Types at (or do not select any position to append)
3. Click on Import, a File Browser will appear.
4. Select the File Name and the File Type that you want to import, then click on Import.
5. Depending on the File Type that you selected, an Options Dialog may appear, select the options that you want and then click on Import.

Note that other MIME Type files may not contain the same amount of information as the Endeavour Mark II MIME Types format does. So you may need to edit the imported MIME Types to add more information manually.

#### Synchronising with the System's Global MIME Types

In some cases you may want Endeavour Mark II to synchronise its MIME Types with the system's global MIME Types. This way, you only need to update the system's global MIME Types and synchronise Endeavour Mark II to them.

For Debian Linux, Redhat Linux, and Mandrake Linux users, to synchronise Endeavour Mark II's MIME Types with the system's global MIME Types:

1. Go to View->MIME Types...
2. Unselect all MIME Type in the list.
3. Click on Import, a File Browser will appear.
4. Select the global Mailcap file (usually `/etc/mailcap`) and set the File Type to `Mailcap`, then click on Import, an Options Dialog will appear.
5. Make sure Update and Only Newer are checked, then click on Import.
6. (wait for the MIME Types to be imported)
7. Click on Import, a File Browser will appear.
8. Select the global Media Types file (usually `/etc/mime.types`) and set the File Type to `Media Types`, then click on Import, an Options Dialog will appear.
9. Make sure Update and Only Newer are checked, then click on Import.

MIME Types that already exist in Endeavour Mark II's MIME Types list will be updated, and newer ones will be appended (there will not be any duplicate MIME Types).

You may still need to add additional information (such as icons), since the Mailcap and Media Types files do not contain as much information as the Endeavour Mark II MIME Types do.

You need to repeat the above procedure each time the system's global MIME Types are updated. Information that you added manually, such as icons, will not be cleared or modified when you synchronise.

Back to the top

### Exporting MIME Types

File formats that contain MIME Types which Endeavour can export to are as follows:

- Debian, MetaMail, MUTT MailCap format (`*mailcap`)
- Media Types format (`*media.types` `*mime.types`)
- Endeavour Mark II MIME Types format (`mimetypes.ini`)

To export MIME Types:

1. Go to View->MIME Types...
2. Select all the MIME Types in the list that you want to export.
3. Click on Export, a File Browser will appear.
4. Set the File Type to the format that you want to export to and specify the File Name, then click on Export

Back to the top

### Defining Global MIME Types

To define your own global MIME Types, you must have access to the global MIME Types file `/usr/share/endeavour2/mimetypes.ini`.

Before you begin, you should back up the existing global MIME Types file (if any).

Defining global MIME Types is similar to the Export process, the steps are as follows.

1. Go to View->MIME Types...
2. Select all the MIME Types in the list that you want to export (including any current global MIME Types that you want in the new global MIME Types file).
3. Click on Export, a file browser will appear.
4. In the Type: list, select the `Endeavour MIME Types files (.ini)` format.
5. Enter the path of the file you want to export to (this can be a tempory file if do not have access to the global MIME Types file and want to move the exported file to that location later), and click on OK.

If there were no errors encountered in the above steps and you backed up your old global MIME Types file, move the MIME Types file you just exported to `/usr/share/endeavour2/mimetypes.ini` and then restart Endeavour.

Back to the top

Endeavour Mark II is Copyright © 1997-2004 WolfPack Entertainment

</left>