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

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2020-11-24 18:06:19 +0300
committerRichard Steinmetz <richard@steinmetz.cloud>2020-11-24 18:35:06 +0300
commita77aed871a75f625bc2830206ca88176f163c791 (patch)
treee9fe1cd62492093aea77708046ae63292b5b2d4b /lib/Dashboard
parent9669b1bea81a6feb143a27aba85ff5c19d40a54d (diff)
Add unread mail dashboard widget
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'lib/Dashboard')
-rw-r--r--lib/Dashboard/ImportantMailWidget.php44
-rw-r--r--lib/Dashboard/MailWidget.php19
-rw-r--r--lib/Dashboard/UnreadMailWidget.php44
3 files changed, 91 insertions, 16 deletions
diff --git a/lib/Dashboard/ImportantMailWidget.php b/lib/Dashboard/ImportantMailWidget.php
new file mode 100644
index 000000000..faef4209c
--- /dev/null
+++ b/lib/Dashboard/ImportantMailWidget.php
@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2020 Richard Steinmetz <richard@steinmetz.cloud>
+ *
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
+ *
+ * @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\Mail\Dashboard;
+
+class ImportantMailWidget extends MailWidget {
+
+ /**
+ * @inheritDoc
+ */
+ public function getId(): string {
+ return 'mail';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getTitle(): string {
+ return $this->l10n->t('Important mail');
+ }
+}
diff --git a/lib/Dashboard/MailWidget.php b/lib/Dashboard/MailWidget.php
index 1c2fc833a..194bc4ae7 100644
--- a/lib/Dashboard/MailWidget.php
+++ b/lib/Dashboard/MailWidget.php
@@ -6,6 +6,7 @@ declare(strict_types=1);
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -34,10 +35,10 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Util;
-class MailWidget implements IWidget {
+abstract class MailWidget implements IWidget {
/** @var IL10N */
- private $l10n;
+ protected $l10n;
/** @var IURLGenerator */
private $urlGenerator;
@@ -66,20 +67,6 @@ class MailWidget implements IWidget {
/**
* @inheritDoc
*/
- public function getId(): string {
- return Application::APP_ID;
- }
-
- /**
- * @inheritDoc
- */
- public function getTitle(): string {
- return $this->l10n->t('Important mail');
- }
-
- /**
- * @inheritDoc
- */
public function getOrder(): int {
return 4;
}
diff --git a/lib/Dashboard/UnreadMailWidget.php b/lib/Dashboard/UnreadMailWidget.php
new file mode 100644
index 000000000..a58054388
--- /dev/null
+++ b/lib/Dashboard/UnreadMailWidget.php
@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2020 Richard Steinmetz <richard@steinmetz.cloud>
+ *
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
+ *
+ * @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\Mail\Dashboard;
+
+class UnreadMailWidget extends MailWidget {
+
+ /**
+ * @inheritDoc
+ */
+ public function getId(): string {
+ return 'mail-unread';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getTitle(): string {
+ return $this->l10n->t('Unread mail');
+ }
+}