Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Sein <ivan@struktur.de>2017-04-26 12:59:52 +0300
committerIvan Sein <ivan@struktur.de>2017-04-26 12:59:52 +0300
commitc960e4e25c16b0d2d54c0396ab4f11e19192414c (patch)
tree425ed2fdfd4087404b420e1ca9c7aebd33704d9d /lib/ContactsMenu
parent2bdc76ca4b64a58bab9867b7fb5825770df97b11 (diff)
Add video call action to internal users in contacts menu.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
Diffstat (limited to 'lib/ContactsMenu')
-rw-r--r--lib/ContactsMenu/Providers/CallProvider.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/ContactsMenu/Providers/CallProvider.php b/lib/ContactsMenu/Providers/CallProvider.php
new file mode 100644
index 000000000..a879127ce
--- /dev/null
+++ b/lib/ContactsMenu/Providers/CallProvider.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @copyright 2017 Ivan Sein <ivan@nextcloud.com>
+ *
+ * @author 2017 Ivan Sein <ivan@nextcloud.com>
+ *
+ * @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 OCA\Spreed\ContactsMenu\Providers;
+
+use OCP\Contacts\ContactsMenu\IActionFactory;
+use OCP\Contacts\ContactsMenu\IEntry;
+use OCP\Contacts\ContactsMenu\IProvider;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+
+/**
+ * @todo move to contacts app
+ */
+class CallProvider implements IProvider {
+
+ /** @var IActionFactory */
+ private $actionFactory;
+
+ /** @var IURLGenerator */
+ private $urlGenerator;
+
+ /** @var IL10N */
+ private $l10n;
+
+ /**
+ * @param IActionFactory $actionFactory
+ * @param IURLGenerator $urlGenerator
+ */
+ public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n) {
+ $this->actionFactory = $actionFactory;
+ $this->urlGenerator = $urlGenerator;
+ $this->l10n = $l10n;
+ }
+
+ /**
+ * @param IEntry $entry
+ */
+ public function process(IEntry $entry) {
+ $uid = $entry->getProperty('UID');
+
+ if (is_null($uid)) {
+ // Nothing to do
+ return;
+ }
+
+ $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/video.svg'));
+ $callUrl = $this->urlGenerator->getAbsoluteURL('/index.php/apps/spreed/');
+ $action = $this->actionFactory->newLinkAction($iconUrl, $this->l10n->t('Video Call'), $callUrl);
+ $entry->addAction($action);
+ }
+
+}