From 8414c169552346e5d9d06d9e35852ed629553d88 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Thu, 25 Apr 2013 01:03:05 +0200 Subject: [PATCH] Contacts: Adjust some class names --- lib/abstractpimcollection.php | 2 +- lib/abstractpimobject.php | 2 +- lib/addressbook.php | 6 +++--- lib/backend/shared.php | 6 +++--- lib/controller/groupcontroller.php | 2 +- lib/share/addressbook.php | 7 ++++--- lib/share/contact.php | 5 +++-- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/abstractpimcollection.php b/lib/abstractpimcollection.php index 2373da82..b8dbe6c4 100644 --- a/lib/abstractpimcollection.php +++ b/lib/abstractpimcollection.php @@ -26,7 +26,7 @@ namespace OCA\Contacts; * Subclass this for PIM collections */ -abstract class PIMCollectionAbstract extends PIMObjectAbstract implements \Iterator, \Countable, \ArrayAccess { +abstract class AbstractPIMCollection extends AbstractPIMObject implements \Iterator, \Countable, \ArrayAccess { // Iterator properties diff --git a/lib/abstractpimobject.php b/lib/abstractpimobject.php index 42636822..4afff952 100644 --- a/lib/abstractpimobject.php +++ b/lib/abstractpimobject.php @@ -26,7 +26,7 @@ namespace OCA\Contacts; * Subclass this class or implement IPIMObject interface for PIM objects */ -abstract class PIMObjectAbstract implements IPIMObject { +abstract class AbstractPIMObject implements IPIMObject { /** * This variable holds the ID of this object. diff --git a/lib/addressbook.php b/lib/addressbook.php index 08f720ac..df63c5c7 100644 --- a/lib/addressbook.php +++ b/lib/addressbook.php @@ -25,7 +25,7 @@ namespace OCA\Contacts; /** * This class manages our addressbooks. */ -class Addressbook extends PIMCollectionAbstract { +class Addressbook extends AbstractPIMCollection { protected $_count; /** @@ -153,7 +153,7 @@ class Addressbook extends PIMCollectionAbstract { * @return Contact[] */ function getChildren($limit = null, $offset = null, $omitdata = false) { - \OCP\Util::writeLog('contacts', __METHOD__.' backend: ' . print_r($this->backend, true), \OCP\Util::DEBUG); + //\OCP\Util::writeLog('contacts', __METHOD__.' backend: ' . print_r($this->backend, true), \OCP\Util::DEBUG); $contacts = array(); foreach($this->backend->getContacts($this->getId(), $limit, $offset, $omitdata) as $contact) { @@ -163,7 +163,7 @@ class Addressbook extends PIMCollectionAbstract { } $contacts[] = $this->objects[$contact['id']]; } - \OCP\Util::writeLog('contacts', __METHOD__.' children: '.count($contacts), \OCP\Util::DEBUG); + //\OCP\Util::writeLog('contacts', __METHOD__.' children: '.count($contacts), \OCP\Util::DEBUG); return $contacts; } diff --git a/lib/backend/shared.php b/lib/backend/shared.php index 114e149c..b6d5ed0f 100644 --- a/lib/backend/shared.php +++ b/lib/backend/shared.php @@ -44,7 +44,7 @@ class Shared extends Database { $this->addressbooks = \OCP\Share::getItemsSharedWith( 'addressbook', - Contacts\Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS + Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS ); return $this->addressbooks; @@ -61,7 +61,7 @@ class Shared extends Database { $addressbook = \OCP\Share::getItemSharedWithBySource( 'addressbook', $addressbookid, - Contacts\Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS + Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS ); // Not sure if I'm doing it wrongly, or if its supposed to return // the info in an array? @@ -83,7 +83,7 @@ class Shared extends Database { $addressbook = \OCP\Share::getItemSharedWithBySource( 'addressbook', $addressbookid, - Contacts\Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS, + Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS, null, // parameters true // includeCollection ); diff --git a/lib/controller/groupcontroller.php b/lib/controller/groupcontroller.php index 205ed204..5c887766 100644 --- a/lib/controller/groupcontroller.php +++ b/lib/controller/groupcontroller.php @@ -42,7 +42,7 @@ class GroupController extends BaseController { $groups = array( 'categories' => $categories, 'favorites' => $favorites, - 'shared' => \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS), + 'shared' => \OCP\Share::getItemsSharedWith('addressbook', \OCA\Contacts\Share\Addressbook::FORMAT_ADDRESSBOOKS), 'lastgroup' => \OCP\Config::getUserValue($params['user'], 'contacts', 'lastgroup', 'all'), 'sortorder' => \OCP\Config::getUserValue($params['user'], 'contacts', 'groupsort', ''), ); diff --git a/lib/share/addressbook.php b/lib/share/addressbook.php index 1f16f6ec..e28d0df7 100644 --- a/lib/share/addressbook.php +++ b/lib/share/addressbook.php @@ -6,9 +6,10 @@ * See the COPYING-README file. */ -namespace OCA\Contacts; +namespace OCA\Contacts\Share; +use OCA\Contacts\Backend\Database; -class Share_Backend_Addressbook implements \OCP\Share_Backend_Collection { +class Addressbook implements \OCP\Share_Backend_Collection { const FORMAT_ADDRESSBOOKS = 1; const FORMAT_COLLECTION = 2; @@ -16,7 +17,7 @@ class Share_Backend_Addressbook implements \OCP\Share_Backend_Collection { public function __construct() { // Currently only share - $this->backend = new Backend\Database(); + $this->backend = new Database(); } /** diff --git a/lib/share/contact.php b/lib/share/contact.php index 4d5f633f..716f389e 100644 --- a/lib/share/contact.php +++ b/lib/share/contact.php @@ -19,9 +19,10 @@ * License along with this library. If not, see . */ -namespace OCA\Contacts; +namespace OCA\Contacts\Share; +use OCA\Contacts; -class Share_Backend_Contact implements \OCP\Share_Backend { +class Contact implements \OCP\Share_Backend { const FORMAT_CONTACT = 0;