Index: uspace/lib/ui/src/filedialog.c
===================================================================
--- uspace/lib/ui/src/filedialog.c	(revision e0cf963ea3be1b3230a964fb578b5efde4a79530)
+++ uspace/lib/ui/src/filedialog.c	(revision 11662bd0511dee7355e56a436cf2ea26fb2239ad)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2021 Jiri Svoboda
+ * Copyright (c) 2022 Jiri Svoboda
  * All rights reserved.
  *
@@ -41,4 +41,5 @@
 #include <ui/label.h>
 #include <ui/filedialog.h>
+#include <ui/filelist.h>
 #include <ui/pbutton.h>
 #include <ui/resource.h>
@@ -53,4 +54,13 @@
 	.close = ui_file_dialog_wnd_close,
 	.kbd = ui_file_dialog_wnd_kbd
+};
+
+static void ui_file_dialog_flist_activate_req(ui_file_list_t *, void *);
+static void ui_file_dialog_flist_selected(ui_file_list_t *, void *,
+    const char *);
+
+ui_file_list_cb_t ui_file_dialog_flist_cb = {
+	.activate_req = ui_file_dialog_flist_activate_req,
+	.selected = ui_file_dialog_flist_selected
 };
 
@@ -96,4 +106,5 @@
 	ui_label_t *label = NULL;
 	ui_entry_t *entry = NULL;
+	ui_file_list_t *flist = NULL;
 	ui_pbutton_t *bok = NULL;
 	ui_pbutton_t *bcancel = NULL;
@@ -115,10 +126,10 @@
 		wparams.rect.p0.y = 0;
 		wparams.rect.p1.x = 40;
-		wparams.rect.p1.y = 9;
+		wparams.rect.p1.y = 20;
 	} else {
 		wparams.rect.p0.x = 0;
 		wparams.rect.p0.y = 0;
 		wparams.rect.p1.x = 300;
-		wparams.rect.p1.y = 135;
+		wparams.rect.p1.y = 335;
 	}
 
@@ -167,7 +178,7 @@
 	if (ui_is_textmode(ui)) {
 		rect.p0.x = 3;
-		rect.p0.y = 4;
+		rect.p0.y = 3;
 		rect.p1.x = 37;
-		rect.p1.y = 5;
+		rect.p1.y = 4;
 	} else {
 		rect.p0.x = 10;
@@ -192,4 +203,65 @@
 	entry = NULL;
 
+	/* Files label */
+	rc = ui_label_create(ui_res, "Files:", &label);
+	if (rc != EOK)
+		goto error;
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 3;
+		rect.p0.y = 5;
+		rect.p1.x = 17;
+		rect.p1.y = 6;
+	} else {
+		rect.p0.x = 10;
+		rect.p0.y = 90;
+		rect.p1.x = 190;
+		rect.p1.y = 105;
+	}
+
+	ui_label_set_rect(label, &rect);
+
+	rc = ui_fixed_add(fixed, ui_label_ctl(label));
+	if (rc != EOK)
+		goto error;
+
+	label = NULL;
+
+	/* File list */
+
+	rc = ui_file_list_create(window, false, &flist);
+	if (rc != EOK)
+		goto error;
+
+	/* FIXME: Auto layout */
+	if (ui_is_textmode(ui)) {
+		rect.p0.x = 3;
+		rect.p0.y = 6;
+		rect.p1.x = 37;
+		rect.p1.y = 16;
+	} else {
+		rect.p0.x = 10;
+		rect.p0.y = 110;
+		rect.p1.x = 290;
+		rect.p1.y = 280;
+	}
+
+	ui_file_list_set_rect(flist, &rect);
+	ui_file_list_set_cb(flist, &ui_file_dialog_flist_cb, dialog);
+
+	rc = ui_fixed_add(fixed, ui_file_list_ctl(flist));
+	if (rc != EOK)
+		goto error;
+
+	dialog->flist = flist;
+	flist = NULL;
+
+	rc = ui_file_list_read_dir(dialog->flist, ".");
+	if (rc != EOK)
+		goto error;
+
+	/* OK button */
+
 	rc = ui_pbutton_create(ui_res, "OK", &bok);
 	if (rc != EOK)
@@ -201,12 +273,12 @@
 	if (ui_is_textmode(ui)) {
 		rect.p0.x = 10;
-		rect.p0.y = 6;
+		rect.p0.y = 17;
 		rect.p1.x = 20;
-		rect.p1.y = 7;
+		rect.p1.y = 18;
 	} else {
 		rect.p0.x = 55;
-		rect.p0.y = 90;
+		rect.p0.y = 290;
 		rect.p1.x = 145;
-		rect.p1.y = 118;
+		rect.p1.y = 318;
 	}
 
@@ -222,4 +294,6 @@
 	bok = NULL;
 
+	/* Cancel button */
+
 	rc = ui_pbutton_create(ui_res, "Cancel", &bcancel);
 	if (rc != EOK)
@@ -231,12 +305,12 @@
 	if (ui_is_textmode(ui)) {
 		rect.p0.x = 22;
-		rect.p0.y = 6;
+		rect.p0.y = 17;
 		rect.p1.x = 32;
-		rect.p1.y = 7;
+		rect.p1.y = 18;
 	} else {
 		rect.p0.x = 155;
-		rect.p0.y = 90;
+		rect.p0.y = 290;
 		rect.p1.x = 245;
-		rect.p1.y = 118;
+		rect.p1.y = 318;
 	}
 
@@ -263,4 +337,6 @@
 	if (entry != NULL)
 		ui_entry_destroy(entry);
+	if (flist != NULL)
+		ui_file_list_destroy(flist);
 	if (bok != NULL)
 		ui_pbutton_destroy(bok);
@@ -328,4 +404,9 @@
 	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
 	const char *fname;
+	ui_evclaim_t claim;
+
+	claim = ui_window_def_kbd(window, event);
+	if (claim == ui_claimed)
+		return;
 
 	if (event->type == KEY_PRESS &&
@@ -347,5 +428,20 @@
 	}
 
-	ui_window_def_kbd(window, event);
+}
+
+static void ui_file_dialog_flist_activate_req(ui_file_list_t *flist, void *arg)
+{
+	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
+
+	ui_file_list_activate(dialog->flist);
+	ui_entry_deactivate(dialog->ename);
+}
+
+static void ui_file_dialog_flist_selected(ui_file_list_t *flist, void *arg,
+    const char *fname)
+{
+	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
+
+	dialog->cb->bok(dialog, dialog->arg, fname);
 }
 
