diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-07-07 15:55:07 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-08-21 10:11:38 +0200 |
commit | aaa23c19c054e01f9f173272988b7f2635d1d3fc (patch) | |
tree | 0ff5480652f9ae06a3ffd348ab31750471412b09 /lib | |
parent | 87615fb6549c884aa9891666748170aea27e89e5 (diff) |
Import vcf from files
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 5 | ||||
-rw-r--r-- | lib/Dav/PatchPlugin.php | 1 | ||||
-rw-r--r-- | lib/Listener/LoadContactsFilesActions.php | 44 |
3 files changed, 49 insertions, 1 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index a2f3a396..67ef5121 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,6 +23,8 @@ namespace OCA\Contacts\AppInfo; use OCA\Contacts\Dav\PatchPlugin; +use OCA\Contacts\Listener\LoadContactsFilesActions; +use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCP\AppFramework\App; use OCP\EventDispatcher\IEventDispatcher; use OCP\SabrePluginEvent; @@ -53,5 +55,8 @@ class Application extends App { $server->addPlugin($this->getContainer()->query(PatchPlugin::class)); } }); + + // Register files action + $eventDispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadContactsFilesActions::class); } } diff --git a/lib/Dav/PatchPlugin.php b/lib/Dav/PatchPlugin.php index 61f36b7a..6ef5fb4d 100644 --- a/lib/Dav/PatchPlugin.php +++ b/lib/Dav/PatchPlugin.php @@ -34,7 +34,6 @@ use Sabre\DAV\Server; use Sabre\DAV\ServerPlugin; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; -use Sabre\VObject\Component\VCard; use Sabre\VObject\Reader; class PatchPlugin extends ServerPlugin { diff --git a/lib/Listener/LoadContactsFilesActions.php b/lib/Listener/LoadContactsFilesActions.php new file mode 100644 index 00000000..b60a525c --- /dev/null +++ b/lib/Listener/LoadContactsFilesActions.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020, John Molakvoæ <skjnldsv@protonmail.com> + * + * @author John Molakvoæ <skjnldsv@protonmail.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\Contacts\Listener; + +use OCA\Contacts\AppInfo\Application; +use OCA\Files\Event\LoadAdditionalScriptsEvent; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Util; + +class LoadContactsFilesActions implements IEventListener { + public function handle(Event $event): void { + if (!($event instanceof LoadAdditionalScriptsEvent)) { + return; + } + + Util::addStyle(Application::APP_ID, 'icons'); + Util::addScript(Application::APP_ID, 'contacts-files-action'); + } +} |