From d7344819834e469c2e5875f756f1ad973b2e06d9 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 27 May 2011 07:22:56 -0400
Subject: [PATCH] - Added option to specify to which address book add new contacts

---
 program/steps/settings/func.inc |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index a44d6c8..280185e 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -131,6 +131,7 @@
   $sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview'));
   $sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition'));
   $sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying'));
+  $sections['addressbook'] = array('id' => 'addressbook','section' => rcube_label('addressbook'));
   $sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders'));
   $sections['server'] = array('id' => 'server',  'section' => rcube_label('serversettings'));
 
@@ -582,6 +583,32 @@
 
     break;
 
+
+    // Addressbook config
+    case 'addressbook':
+
+    $blocks = array(
+      'main' => array('name' => Q(rcube_label('mainoptions'))),
+    );
+
+    if (!isset($no_override['default_addressbook'])
+      && ($books = $RCMAIL->get_address_sources(true))
+    ) {
+      $field_id = 'rcmfd_default_addressbook';
+      $select_abook = new html_select(array('name' => '_default_addressbook', 'id' => $field_id));
+
+      foreach ($books as $book) {
+        $select_abook->add($book['name'], $book['id']);
+      }
+
+      $blocks['main']['options']['default_addressbook'] = array(
+        'title' => html::label($field_id, Q(rcube_label('defaultaddressbook'))),
+        'content' => $select_abook->show($config['default_addressbook']),
+      );
+    }
+
+    break;
+
     // Special IMAP folders
     case 'folders':
 

--
Gitblit v1.9.1