Skip to content
Open
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
2 changes: 1 addition & 1 deletion lib/Controller/NotesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function xml($guid)
protected function getNotes()
{
$username = $this->user->getUid();
$notes = new \OCA\Grauphel\Lib\NoteStorage($this->deps->urlGen);
$notes = new \OCA\Grauphel\Storage\NoteStorage($this->deps->urlGen);
$notes->setUsername($username);
return $notes;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Converter/ReStructuredText.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function convert($xmlContent)
*/
protected function fixLinkUrl($linkUrl)
{
if ($linkUrl{0} == '/') {
if ($linkUrl[0] == '/') {
//Unix file path
$linkUrl = 'file://' . $linkUrl;
}
Expand Down
36 changes: 0 additions & 36 deletions lib/Search/Note.php

This file was deleted.

60 changes: 34 additions & 26 deletions lib/Search/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace OCA\Grauphel\Search;

use OCA\Grauphel\NoteStorage;
use OCA\Grauphel\Storage\NoteStorage;
use OCA\Grauphel\AppInfo\Application;

use OCP\IL10N;
Expand All @@ -17,54 +17,62 @@

class Provider implements IProvider
{
private IL10N $il10;
private IURLGenerator $url;
private IL10N $l10n;
private IURLGenerator $url;

public function __construct(IL10N $l10n, IURLGenerator $urlGenerator)
{
$this->il10 = $l10n;
$this->url = $urlGenerator;
}
public function __construct(IL10N $l10n, IURLGenerator $urlGenerator)
{
$this->l10n = $l10n;
$this->url = $urlGenerator;
}

public function getId(): string
{
{
return Application::APP_ID;
}

public function getName(): string
{
return $this->lutil->l10n->t('Grauphel');
{
return $this->l10n->t('Grauphel');
}

public function getOrder(string $route, array $routeParameters): int
{
{
if (strpos($route, $this->getId() . '.') === 0) {
return -1;
}

return self::ORDER;
return 55;
}

public function search(IUser $user, ISearchQuery $query) : SearchResult
{
$notes = new NoteStorage($this->urlGen);
$notes->setUsername( $user->getUID());

$qp = new QueryParser();
$rows = $notes->search($qp->parse($query));
$notes = new NoteStorage($this->url);
$notes->setUsername($user->getUID());

$qp = new QueryParser();
$rows = $notes->search($qp->parse($query->getTerm()));

$icon = $this->url->imagePath($this->getID(), 'app.svg');

$results = array();
foreach ($rows as $row)
{
$res = new Note();
$res->id = $row['note_guid'];
$res->name = htmlspecialchars_decode($row['note_title']);
$res->link = $this->url->linkToRoute(
'grauphel.gui.note', array('guid' => $row['note_guid'])
foreach ($rows as $row)
{
$res = new SearchResultEntry(
$icon,
htmlspecialchars_decode($row['note_title']),
'',
$this->url->linkToRoute(
'grauphel.gui.note', array('guid' => $row['note_guid'])
)
);
$results[] = $res;
}
return $results;

return SearchResult::complete(
$this->getName(),
$results
);
}
}
?>