diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-01-24 09:47:14 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-04-25 21:47:17 +0300 |
commit | d091793ceb1ab2a60133608e844e1d83a5de19f2 (patch) | |
tree | 12c4c5863c5ede094a78c534e03d6718823abb04 /lib/public/Contacts | |
parent | db94b5d4af711f6e18aac0c9d4b0357a3b9123d1 (diff) |
Contacts menu
* load list of contacts from the server
* show last message of each contact
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/Contacts')
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IAction.php | 65 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IActionFactory.php | 54 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IEntry.php | 66 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/ILinkAction.php | 43 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IProvider.php | 37 |
5 files changed, 265 insertions, 0 deletions
diff --git a/lib/public/Contacts/ContactsMenu/IAction.php b/lib/public/Contacts/ContactsMenu/IAction.php new file mode 100644 index 00000000000..44ad1af5ae8 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IAction.php @@ -0,0 +1,65 @@ +<?php + +/** + * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Contacts\ContactsMenu; + +use JsonSerializable; + +/** + * Apps should use the IActionFactory to create new action objects + * + * @since 12.0 + */ +interface IAction extends JsonSerializable { + + /** + * @param string $icon absolute URI to an icon + * @since 12.0 + */ + public function setIcon($icon); + + /** + * @return string localized action name, e.g. 'Call' + * @since 12.0 + */ + public function getName(); + + /** + * @param string $name localized action name, e.g. 'Call' + * @since 12.0 + */ + public function setName($name); + + /** + * @param int $priority priorize actions, high order ones are shown on top + * @since 12.0 + */ + public function setPriority($priority); + + /** + * @return int priority to priorize actions, high order ones are shown on top + * @since 12.0 + */ + public function getPriority(); +} diff --git a/lib/public/Contacts/ContactsMenu/IActionFactory.php b/lib/public/Contacts/ContactsMenu/IActionFactory.php new file mode 100644 index 00000000000..8778a729a56 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IActionFactory.php @@ -0,0 +1,54 @@ +<?php + +/** + * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Contacts\ContactsMenu; + +/** + * @since 12.0 + */ +interface IActionFactory { + + /** + * Construct and return a new link action for the contacts menu + * + * @since 12.0 + * + * @param string $icon full path to the action's icon + * @param string $name localized name of the action + * @param string $href target URL + * @return ILinkAction + */ + public function newLinkAction($icon, $name, $href); + + /** + * Construct and return a new email action for the contacts menu + * + * @since 12.0 + * + * @param string $icon full path to the action's icon + * @param string $name localized name of the action + * @param string $email target e-mail address + * @return ILinkAction + */ + public function newEMailAction($icon, $name, $email); +} diff --git a/lib/public/Contacts/ContactsMenu/IEntry.php b/lib/public/Contacts/ContactsMenu/IEntry.php new file mode 100644 index 00000000000..eb04147a1bc --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IEntry.php @@ -0,0 +1,66 @@ +<?php + +/** + * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Contacts\ContactsMenu; + +use JsonSerializable; + +/** + * @since 12.0 + */ +interface IEntry extends JsonSerializable { + + /** + * @since 12.0 + * @return string + */ + public function getFullName(); + + /** + * @since 12.0 + * @return string[] + */ + public function getEMailAddresses(); + + /** + * @since 12.0 + * @return string|null image URI + */ + public function getAvatar(); + + /** + * @since 12.0 + * @param IAction $action an action to show in the contacts menu + */ + public function addAction(IAction $action); + + /** + * Get an arbitrary property from the contact + * + * @since 12.0 + * @param string $key + * @return mixed the value of the property or null + */ + public function getProperty($key); +} diff --git a/lib/public/Contacts/ContactsMenu/ILinkAction.php b/lib/public/Contacts/ContactsMenu/ILinkAction.php new file mode 100644 index 00000000000..4e29f757c26 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/ILinkAction.php @@ -0,0 +1,43 @@ +<?php + +/** + * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Contacts\ContactsMenu; + +/** + * @since 12.0 + */ +interface ILinkAction extends IAction { + + /** + * @since 12.0 + * @param string $href the target URL of the action + */ + public function setHref($href); + + /** + * @since 12.0 + * @return string + */ + public function getHref(); +} diff --git a/lib/public/Contacts/ContactsMenu/IProvider.php b/lib/public/Contacts/ContactsMenu/IProvider.php new file mode 100644 index 00000000000..17fcc003720 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IProvider.php @@ -0,0 +1,37 @@ +<?php + +/** + * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Contacts\ContactsMenu; + +/** + * @since 12.0 + */ +interface IProvider { + + /** + * @since 12.0 + * @param IEntry $entry + */ + public function process(IEntry $entry); +} |