diff --git a/file_lock.admin.inc b/file_lock.admin.inc
index 3dd4815..96a5cae 100644
--- a/file_lock.admin.inc
+++ b/file_lock.admin.inc
@@ -13,15 +13,20 @@ function file_lock_admin_config($form, &$form_state) {
     '#type' => 'radios',
     '#title' => t('Automatic file lock'),
     '#options' => array(
+        'none' => t('None'),
         'all' => t('Lock all new files'),
         'pattern' => t('Lock files by pattern'),
         'regex' => t('Lock files by regular expression'),
-        'none' => t('None'),
     ),
     '#default_value' => variable_get('file_lock_mode', 'none'),
     '#description' => t('Choose how new files should automaticly be locked.'),
   );
 
+  // Add a new "Lock files by type" option if we have the File Entity module.
+  if (module_exists('file_entity')) {
+    $form['file_lock_mode']['#options']['type'] = t('Lock files by type');
+  }
+
   $form['file_lock_pattern'] = array(
     '#type' => 'textfield',
     '#title' => t('Pattern'),
@@ -46,22 +51,29 @@ function file_lock_admin_config($form, &$form_state) {
     ),
   );
 
-  /* TODO: by type, by field
-   * add ^options 'type' => t('Lock files by filetype'),
-   $form['file_lock_by_type'] = array(
-     '#type' => 'checkbox',
-     '#title' => t('lock files by type'),
-     '#default_value' => variable_get('file_lock_by_type', 0),
-     '#description' => t('Lock files from specific types'),
-     '#states' => array(
-       // Only show this field when the 'toggle_me' checkbox is enabled.
-       'enabled' => array(
-         ':input[name="file_lock_all"]' => array('checked' => FALSE),
-         ':input[name="file_lock_by_pattern"]' => array('checked' => FALSE),
-       ),
-     ),
-   );
-  */
+  // Add a new "Lock files by type" settings if we have the File Entity module.
+  if (module_exists('file_entity')) {
+    // Fetch all file types that will be used as options.
+    $types_all = file_type_get_all_types($reset = FALSE);
+    $file_type_options = array();
+    foreach ($types_all as $type) {
+      $file_type_options[$type->type] = $type->label;
+    }
+
+    $form['file_lock_types'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('File types'),
+      '#default_value' => variable_get('file_lock_types', array()),
+      '#options' => $file_type_options,
+      '#description' => 'Only files of this type will be locked.',
+      '#states' => array(
+        'visible' => array(
+          ':input[name="file_lock_mode"]' => array('value' => 'type'),
+        ),
+      ),
+    );
+  }
+
   $form['hook'] = array(
     '#type' => 'fieldset',
     '#title' => 'Hooks',
diff --git a/file_lock.module b/file_lock.module
index 72178be..21c00a9 100644
--- a/file_lock.module
+++ b/file_lock.module
@@ -111,6 +111,12 @@ function file_lock_act_on($file, $lock_mode = NULL) {
       }
       break;
 
+    case 'type':
+      $lock_file_types = variable_get('file_lock_types', array());
+      if (in_array($file->type, $lock_file_types, TRUE)) {
+        file_lock_add_lock($file);
+      }
+      break;
   }
 }
 
