'src is a list of tuples representing items to copy. The tuple is
(type, containing category key, category key is global search term,
full name, category key, path to node)
The type must be TagTreeItem.TAG
dest is the TagTreeItem node to receive the items
action is Qt.CopyAction or Qt.MoveAction'

def move_or_copy_item_to_user_category(self, src, dest, action):

    def process_source_node(user_cats, src_parent, src_parent_is_gst, is_uc, dest_key, idx):
        u'\n                                                Copy/move    an    item    and    all    its    children    to    the    destination\n                                                '
        copied = False
        src_name = idx.tag.original_name
        src_cat = idx.tag.category
        if (is_uc and (not src_parent_is_gst) and (src_parent in user_cats) and (action == Qt.MoveAction)):
            new_cat = []
            for tup in user_cats[src_parent]:
                if ((src_name == tup[0]) and (src_cat == tup[1])):
                    continue
                new_cat.append(list(tup))
            user_cats[src_parent] = new_cat
        else:
            copied = True
        add_it = True
        if ((not is_uc) and (src_cat == u'news')):
            src_cat = u'tags'
        for tup in user_cats[dest_key]:
            if ((src_name == tup[0]) and (src_cat == tup[1])):
                add_it = False
        if add_it:
            user_cats[dest_key].append([src_name, src_cat, 0])
        for c in idx.children:
            copied = process_source_node(user_cats, src_parent, src_parent_is_gst, is_uc, dest_key, c)
        return copied
    user_cats = self.db.prefs.get(u'user_categories', {})
    path = None
    for s in src:
        (src_parent, src_parent_is_gst) = s[1:3]
        path = s[5]
        if src_parent.startswith(u'@'):
            is_uc = True
            src_parent = src_parent[1:]
        else:
            is_uc = False
        dest_key = dest.category_key[1:]
        if (dest_key not in user_cats):
            continue
        idx = self.index_for_path(path)
        if idx.isValid():
            process_source_node(user_cats, src_parent, src_parent_is_gst, is_uc, dest_key, self.get_node(idx))
    self.db.new_api.set_pref(u'user_categories', user_cats)
    self.refresh_required.emit()
    self.user_category_added.emit()
    return True
