diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2017-04-26 01:31:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-26 01:31:11 +0200 |
commit | 6db6911a13bf2d2d219422d25a0a4a4406dce8ef (patch) | |
tree | 6d33b4e4cc22bb1bf4753d83f44e1bb8422082e3 /lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php | |
parent | 255c7df3bdbaccf00ba8e9fb00e750ffb9a50356 (diff) | |
parent | 241e397326545ee3ecad1a6a50dbe7839faa5c21 (diff) | |
download | nextcloud-server-6db6911a13bf2d2d219422d25a0a4a4406dce8ef.tar.gz nextcloud-server-6db6911a13bf2d2d219422d25a0a4a4406dce8ef.zip |
Merge pull request #3233 from nextcloud/contactsmenu
Contacts menu
Diffstat (limited to 'lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php')
-rw-r--r-- | lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php new file mode 100644 index 00000000000..d5630e6420d --- /dev/null +++ b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php @@ -0,0 +1,60 @@ +<?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 OC\Contacts\ContactsMenu\Providers; + +use OCP\Contacts\ContactsMenu\IActionFactory; +use OCP\Contacts\ContactsMenu\IEntry; +use OCP\Contacts\ContactsMenu\IProvider; +use OCP\IURLGenerator; + +class EMailProvider implements IProvider { + + /** @var IActionFactory */ + private $actionFactory; + + /** @var IURLGenerator */ + private $urlGenerator; + + /** + * @param IActionFactory $actionFactory + * @param IURLGenerator $urlGenerator + */ + public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator) { + $this->actionFactory = $actionFactory; + $this->urlGenerator = $urlGenerator; + } + + /** + * @param IEntry $entry + */ + public function process(IEntry $entry) { + $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/mail.svg')); + foreach ($entry->getEMailAddresses() as $address) { + $action = $this->actionFactory->newEMailAction($iconUrl, $address, $address); + $entry->addAction($action); + } + } + +} |