mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
Browser: Add window to inspect history
This commit is contained in:
parent
ebe925b7c0
commit
3454891d38
11 changed files with 259 additions and 0 deletions
44
Userland/Applications/Browser/History/HistoryWidget.cpp
Normal file
44
Userland/Applications/Browser/History/HistoryWidget.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "HistoryWidget.h"
|
||||
#include <Applications/Browser/HistoryWidgetGML.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
|
||||
namespace Browser {
|
||||
HistoryWidget::HistoryWidget()
|
||||
{
|
||||
load_from_gml(history_widget_gml);
|
||||
|
||||
m_table_view = find_descendant_of_type_named<GUI::TableView>("history_tableview");
|
||||
m_textbox = find_descendant_of_type_named<GUI::TextBox>("history_filter_textbox");
|
||||
|
||||
m_model = adopt_ref(*new HistoryModel());
|
||||
|
||||
m_filtering_model = MUST(GUI::FilteringProxyModel::create(*m_model));
|
||||
m_filtering_model->set_filter_term(""sv);
|
||||
|
||||
m_textbox->on_change = [this] {
|
||||
m_filtering_model->set_filter_term(m_textbox->text());
|
||||
if (m_filtering_model->row_count() != 0)
|
||||
m_table_view->set_cursor(m_filtering_model->index(0, 0), GUI::AbstractView::SelectionUpdate::Set);
|
||||
};
|
||||
|
||||
m_table_view->set_model(m_filtering_model);
|
||||
m_table_view->set_alternating_row_colors(true);
|
||||
}
|
||||
|
||||
void HistoryWidget::set_history_entries(Vector<History::URLTitlePair> entries)
|
||||
{
|
||||
m_model->set_items(entries);
|
||||
}
|
||||
|
||||
void HistoryWidget::clear_history_entries()
|
||||
{
|
||||
m_model->clear_items();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue