mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:22:43 +00:00 
			
		
		
		
	Userland: Filter out unsupported file types in open dialogs in more apps
This commit is contained in:
		
							parent
							
								
									27011cf55d
								
							
						
					
					
						commit
						8bd68198d6
					
				
					 10 changed files with 69 additions and 16 deletions
				
			
		|  | @ -210,7 +210,13 @@ ErrorOr<void> PDFViewerWidget::initialize_menubar(GUI::Window& window) | |||
| { | ||||
|     auto file_menu = TRY(window.try_add_menu("&File"_short_string)); | ||||
|     TRY(file_menu->try_add_action(GUI::CommonActions::make_open_action([&](auto&) { | ||||
|         auto response = FileSystemAccessClient::Client::the().open_file(&window); | ||||
|         FileSystemAccessClient::OpenFileOptions options { | ||||
|             .allowed_file_types = Vector { | ||||
|                 GUI::FileTypeFilter { "PDF Files", { { "pdf" } } }, | ||||
|                 GUI::FileTypeFilter::all_files(), | ||||
|             }, | ||||
|         }; | ||||
|         auto response = FileSystemAccessClient::Client::the().open_file(&window, options); | ||||
|         if (!response.is_error()) | ||||
|             open_file(response.value().filename(), response.value().release_stream()); | ||||
|     }))); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Karol Kosek
						Karol Kosek