From c3985aba70c7a89eeb47cef58b28442055bec4c2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jan 2017 10:37:17 +0100 Subject: [PATCH] Add the icon for the default sections Signed-off-by: Joas Schilling --- core/img/actions/settings-dark.svg | 1 + lib/private/Server.php | 3 ++- lib/private/Settings/Manager.php | 19 ++++++++++++------- lib/private/Settings/Section.php | 21 ++++++++++++++++++--- settings/css/settings.css | 29 ----------------------------- settings/img/edit.svg | 1 - settings/img/settings.svg | 1 - settings/img/tag.svg | 1 - settings/img/theming.svg | 1 - settings/img/toggle.svg | 1 - 10 files changed, 33 insertions(+), 45 deletions(-) create mode 100644 core/img/actions/settings-dark.svg delete mode 100644 settings/img/edit.svg delete mode 100644 settings/img/settings.svg delete mode 100644 settings/img/tag.svg delete mode 100644 settings/img/theming.svg delete mode 100644 settings/img/toggle.svg diff --git a/core/img/actions/settings-dark.svg b/core/img/actions/settings-dark.svg new file mode 100644 index 0000000000..2160b673e3 --- /dev/null +++ b/core/img/actions/settings-dark.svg @@ -0,0 +1 @@ + diff --git a/lib/private/Server.php b/lib/private/Server.php index d88a687bbc..8528d5e7b3 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -792,7 +792,8 @@ class Server extends ServerContainer implements IServerContainer { $c->getEncryptionManager(), $c->getUserManager(), $c->getLockingProvider(), - new \OC\Settings\Mapper($c->getDatabaseConnection()) + new \OC\Settings\Mapper($c->getDatabaseConnection()), + $c->getURLGenerator() ); return $manager; }); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 949826aa24..7a339b9419 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -29,6 +29,7 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Settings\ISettings; @@ -55,6 +56,8 @@ class Manager implements IManager { private $userManager; /** @var ILockingProvider */ private $lockingProvider; + /** @var IURLGenerator */ + private $url; /** * @param ILogger $log @@ -65,7 +68,7 @@ class Manager implements IManager { * @param IUserManager $userManager * @param ILockingProvider $lockingProvider * @param Mapper $mapper - * @internal param IDBConnection $dbc + * @param IURLGenerator $url */ public function __construct( ILogger $log, @@ -75,7 +78,8 @@ class Manager implements IManager { EncryptionManager $encryptionManager, IUserManager $userManager, ILockingProvider $lockingProvider, - Mapper $mapper + Mapper $mapper, + IURLGenerator $url ) { $this->log = $log; $this->dbc = $dbc; @@ -85,6 +89,7 @@ class Manager implements IManager { $this->encryptionManager = $encryptionManager; $this->userManager = $userManager; $this->lockingProvider = $lockingProvider; + $this->url = $url; } /** @@ -260,11 +265,11 @@ class Manager implements IManager { public function getAdminSections() { // built-in sections $sections = [ - 0 => [new Section('server', $this->l->t('Server settings'), 0)], - 5 => [new Section('sharing', $this->l->t('Sharing'), 0)], - 45 => [new Section('encryption', $this->l->t('Encryption'), 0)], - 98 => [new Section('additional', $this->l->t('Additional settings'), 0)], - 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0)], + 0 => [new Section('server', $this->l->t('Server settings'), 0, $this->url->imagePath('settings', 'admin.svg'))], + 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], + 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], + 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], + 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))], ]; $rows = $this->mapper->getAdminSectionsFromDB(); diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php index b3cf242279..c89a3999c4 100644 --- a/lib/private/Settings/Section.php +++ b/lib/private/Settings/Section.php @@ -23,25 +23,29 @@ namespace OC\Settings; -use OCP\Settings\ISection; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var string */ private $id; /** @var string */ private $name; /** @var int */ private $priority; + /** @var string */ + private $icon; /** * @param string $id * @param string $name * @param int $priority + * @param string $icon */ - public function __construct($id, $name, $priority) { + public function __construct($id, $name, $priority, $icon = '') { $this->id = $id; $this->name = $name; $this->priority = $priority; + $this->icon = $icon; } /** @@ -74,4 +78,15 @@ class Section implements ISection { public function getPriority() { return $this->priority; } + + /** + * returns the relative path to an 16*16 icon describing the section. + * e.g. '/core/img/places/files.svg' + * + * @returns string + * @since 12 + */ + public function getIcon() { + return $this->icon; + } } diff --git a/settings/css/settings.css b/settings/css/settings.css index b9b5570bc7..5c6e30b9bf 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -737,35 +737,6 @@ table.grid td.date{ padding-left: 25px; } -/* icons for sidebar */ -.nav-icon-server { - background-image: url('../img/admin.svg?v=1'); -} -.nav-icon-sharing { - background-image: url('../img/share.svg?v=1'); -} -.nav-icon-theming { - background-image: url('../img/theming.svg?v=1'); -} -.nav-icon-encryption { - background-image: url('../img/password.svg?v=1'); -} -.nav-icon-workflow { - background-image: url('../img/tag.svg?v=1'); -} -.nav-icon-survey_client { - background-image: url('../img/toggle.svg?v=1'); -} -.nav-icon-logging { - background-image: url('../img/edit.svg?v=1'); -} -.nav-icon-additional { - background-image: url('../img/settings.svg?v=1'); -} -.nav-icon-tips-tricks { - background-image: url('../img/help.svg?v=1'); -} - #security-warning li { list-style: initial; margin: 10px 0; diff --git a/settings/img/edit.svg b/settings/img/edit.svg deleted file mode 100644 index 5b798f3f4e..0000000000 --- a/settings/img/edit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/settings/img/settings.svg b/settings/img/settings.svg deleted file mode 100644 index f132dfa94b..0000000000 --- a/settings/img/settings.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings/img/tag.svg b/settings/img/tag.svg deleted file mode 100644 index 464ab936a7..0000000000 --- a/settings/img/tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/settings/img/theming.svg b/settings/img/theming.svg deleted file mode 100644 index adf97966c4..0000000000 --- a/settings/img/theming.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings/img/toggle.svg b/settings/img/toggle.svg deleted file mode 100644 index 1f3de01ff3..0000000000 --- a/settings/img/toggle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file