mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
add page history save mode
This commit is contained in:
parent
c2ddd3dba5
commit
64ae36eecf
3 changed files with 32 additions and 2 deletions
|
|
@ -86,7 +86,11 @@
|
||||||
},
|
},
|
||||||
"database":
|
"database":
|
||||||
{
|
{
|
||||||
"enabled":true
|
"enabled":true,
|
||||||
|
"mode":
|
||||||
|
{
|
||||||
|
"renew":true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"progressbar":
|
"progressbar":
|
||||||
|
|
|
||||||
|
|
@ -343,6 +343,32 @@ class History
|
||||||
$this->treeview->show_all();
|
$this->treeview->show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add(
|
||||||
|
string $url,
|
||||||
|
?string $title = null,
|
||||||
|
bool $renew = false // delete previous records with same URL
|
||||||
|
): ?int
|
||||||
|
{
|
||||||
|
if ($renew)
|
||||||
|
{
|
||||||
|
foreach ($this->app->database->getHistory($url) as $record)
|
||||||
|
{
|
||||||
|
$this->app->database->deleteHistory(
|
||||||
|
$record->id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $this->app->database->addHistory(
|
||||||
|
$url,
|
||||||
|
$title
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->refresh();
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
public function getSelectedColumn(
|
public function getSelectedColumn(
|
||||||
int $column,
|
int $column,
|
||||||
\GtkTreeView $treeview = null
|
\GtkTreeView $treeview = null
|
||||||
|
|
|
||||||
|
|
@ -711,7 +711,7 @@ class Page
|
||||||
$this->app->history->add(
|
$this->app->history->add(
|
||||||
$url,
|
$url,
|
||||||
$title,
|
$title,
|
||||||
$this->config->history->database->renew
|
$this->config->history->database->mode->renew
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue