mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:52:43 +00:00 
			
		
		
		
	 45a81f5a2c
			
		
	
	
		45a81f5a2c
		
	
	
	
	
		
			
			The storage inspector now has a new tab for local storage. The next step would be to persist local storage and receive real-time notifications for changes to update the table view.
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			989 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			989 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Valtteri Koskivuori <vkoskiv@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibGUI/Model.h>
 | |
| 
 | |
| namespace Browser {
 | |
| 
 | |
| class LocalStorageModel final : public GUI::Model {
 | |
| public:
 | |
|     enum Column {
 | |
|         Key,
 | |
|         Value,
 | |
|         __Count,
 | |
|     };
 | |
| 
 | |
|     void set_items(OrderedHashMap<String, String> map);
 | |
|     void clear_items();
 | |
|     virtual int row_count(GUI::ModelIndex const&) const override { return m_local_storage_entries.size(); }
 | |
|     virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
 | |
|     virtual String column_name(int column) const override;
 | |
|     virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
 | |
|     virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
 | |
| 
 | |
| private:
 | |
|     OrderedHashMap<String, String> m_local_storage_entries;
 | |
| };
 | |
| 
 | |
| }
 |