Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions apps/settings/lib/Controller/CommonSettingsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use OCP\INavigationManager;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Settings\IIconSection;
use OCP\Settings\IManager as ISettingsManager;
use OCP\Settings\ISettings;

Expand Down Expand Up @@ -84,7 +83,7 @@ private function getNavigationParameters($currentType, $currentSection) {

protected function formatSections($sections, $currentSection, $type, $currentType, bool $subAdminOnly = false) {
$templateParameters = [];
/** @var \OCP\Settings\ISection[] $prioritizedSections */
/** @var \OCP\Settings\IIconSection[] $prioritizedSections */
foreach ($sections as $prioritizedSections) {
foreach ($prioritizedSections as $section) {
if ($type === 'admin') {
Expand All @@ -96,10 +95,7 @@ protected function formatSections($sections, $currentSection, $type, $currentTyp
continue;
}

$icon = '';
if ($section instanceof IIconSection) {
$icon = $section->getIcon();
}
$icon = $section->getIcon();

$active = $section->getID() === $currentSection
&& $type === $currentType;
Expand Down
7 changes: 2 additions & 5 deletions apps/settings/lib/Search/SectionSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
use OCP\Search\SearchResultEntry;
use OCP\Settings\ISection;
use OCP\Settings\IIconSection;
use OCP\Settings\IManager;

class SectionSearch implements IProvider {
Expand Down Expand Up @@ -117,7 +117,7 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {

/**
* @param ISearchQuery $query
* @param ISection[][] $sections
* @param IIconSection[][] $sections
* @param string $subline
* @param string $routeName
* @return array
Expand All @@ -135,10 +135,7 @@ public function searchSections(ISearchQuery $query, array $sections, string $sub

/**
* We can't use the icon URL at the moment as they don't invert correctly for dark theme
* $iconUrl = '';
* if ($section instanceof IIconSection) {
* $iconUrl = $section->getIcon();
* }
*/

$result[] = new SearchResultEntry(
Expand Down
4 changes: 2 additions & 2 deletions apps/theming/tests/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use OCP\AppFramework\App;
use OCP\Capabilities\ICapability;
use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\Settings\IIconSection;
use OCP\Settings\ISettings;
use Test\TestCase;

Expand Down Expand Up @@ -75,7 +75,7 @@ public function queryData() {
[Admin::class],
[Admin::class, ISettings::class],
[Section::class],
[Section::class, ISection::class],
[Section::class, IIconSection::class],
];
}

Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => $baseDir . '/lib/public/Settings/IManager.php',
'OCP\\Settings\\ISection' => $baseDir . '/lib/public/Settings/ISection.php',
'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => $baseDir . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\Share' => $baseDir . '/lib/public/Share.php',
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php',
'OCP\\Settings\\IManager' => __DIR__ . '/../../..' . '/lib/public/Settings/IManager.php',
'OCP\\Settings\\ISection' => __DIR__ . '/../../..' . '/lib/public/Settings/ISection.php',
'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\Share' => __DIR__ . '/../../..' . '/lib/public/Share.php',
Expand Down
17 changes: 6 additions & 11 deletions lib/private/Settings/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Settings\IIconSection;
use OCP\Settings\IManager;
use OCP\Settings\ISection;
use OCP\Settings\ISettings;
use OCP\Settings\ISubAdminSettings;

Expand Down Expand Up @@ -80,7 +80,7 @@ public function __construct(

/**
* @param string $type 'admin' or 'personal'
* @param string $section Class must implement OCP\Settings\ISection
* @param string $section Class must implement OCP\Settings\IIconSection
*
* @return void
*/
Expand All @@ -95,7 +95,7 @@ public function registerSection(string $type, string $section) {
/**
* @param string $type 'admin' or 'personal'
*
* @return ISection[]
* @return IIconSection[]
*/
protected function getSections(string $type): array {
if (!isset($this->sections[$type])) {
Expand All @@ -108,18 +108,13 @@ protected function getSections(string $type): array {

foreach (array_unique($this->sectionClasses[$type]) as $index => $class) {
try {
/** @var ISection $section */
/** @var IIconSection $section */
$section = \OC::$server->query($class);
} catch (QueryException $e) {
$this->log->logException($e, ['level' => ILogger::INFO]);
continue;
}

if (!$section instanceof ISection) {
$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
continue;
}

$sectionID = $section->getID();

if ($sectionID !== 'connected-accounts' && isset($this->sections[$type][$sectionID])) {
Expand Down Expand Up @@ -212,7 +207,7 @@ public function getAdminSections(): array {
$appSections = $this->getSections('admin');

foreach ($appSections as $section) {
/** @var ISection $section */
/** @var IIconSection $section */
if (!isset($sections[$section->getPriority()])) {
$sections[$section->getPriority()] = [];
}
Expand Down Expand Up @@ -269,7 +264,7 @@ public function getPersonalSections(): array {
$appSections = $this->getSections('personal');

foreach ($appSections as $section) {
/** @var ISection $section */
/** @var IIconSection $section */
if (!isset($sections[$section->getPriority()])) {
$sections[$section->getPriority()] = [];
}
Expand Down
32 changes: 31 additions & 1 deletion lib/public/Settings/IIconSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
/**
* @copyright Copyright (c) 2017, Joas Schilling <coding@schilljs.com>
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Joas Schilling <coding@schilljs.com>
* @author Lukas Reschke <lukas@statuscode.ch>
*
* @license GNU AGPL version 3 or any later version
*
Expand All @@ -26,7 +28,35 @@
/**
* @since 12
*/
interface IIconSection extends ISection {
interface IIconSection {
/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
* @since 9.1
*/
public function getID();

/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
* @since 9.1
*/
public function getName();

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
* @since 9.1
*/
public function getPriority();

/**
* returns the relative path to an 16*16 icon describing the section.
* e.g. '/core/img/places/files.svg'
Expand Down
60 changes: 0 additions & 60 deletions lib/public/Settings/ISection.php

This file was deleted.