From 6ff6bedea4f1aae9ded9b6e3b7363ee79b2f4fed Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 26 Jun 2013 03:38:33 -0400
Subject: [PATCH] Disable dragging/copying of contact groups

---
 program/js/app.js                  |    5 +++++
 program/steps/addressbook/copy.inc |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index c6b6d39..c923f68 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4150,6 +4150,8 @@
       this.show_contentframe(false);
 
     if (list.selection.length) {
+      list.draggable = false;
+
       // no source = search result, we'll need to detect if any of
       // selected contacts are in writable addressbook to enable edit/delete
       // we'll also need to know sources used in selection for copy
@@ -4172,6 +4174,9 @@
         else {
           writable = writable || (!source.readonly && !contact.readonly);
         }
+
+        if (contact._type != 'group')
+          list.draggable = true;
       }
 
       this.env.selection_sources = $.unique(this.env.selection_sources);
diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc
index 480a9b5..59b4ffc 100644
--- a/program/steps/addressbook/copy.inc
+++ b/program/steps/addressbook/copy.inc
@@ -57,6 +57,10 @@
     foreach ($cid as $cid) {
         $a_record = $CONTACTS->get_record($cid, true);
 
+        // avoid copying groups
+        if ($a_record['_type'] == 'group')
+            continue;
+
         // Check if contact exists, if so, we'll need it's ID
         // Note: Some addressbooks allows empty email address field
         if (!empty($a_record['email']))

--
Gitblit v1.9.1