CRecentLocationsDialog

Recent locations dialog is an improved version of standard open/save file dialog. It features lists of 100 most recently accessed folders and files for easier navigation among commonly used resources. Double-clicking on a folder item or selecting an item from the folders list and clicking Browse button below launches a standard open/save file dialog at the selected directory. Double-clicking on files list item immediately opens/saves selected file. Selecting an item from files list and clicking Browse button below launches standard open/save file dialog at the directory containing selected file. The filenames filter lets user sort files by extension and access time, in this order. Files matching selected name filter are displayed in red. If you select a file using standard open/save file dialog it will be added on top of the recent files list and displayed in blue. Instead of double-clicking an item from the files list, user can also select one and click the OK button. Cancel button as usual abandons the dialog without any action. It’s a versatile component which makes accessing recent files a lot easier.

DOWNLOAD SOURCE CODE (BSD-licensed):
CRecentLocationsDialog Source Code

Usage example:

CRecentLocationsDialog dlg;
dlg.setCaption(tr("Select database file"));
dlg.setFilter("Database files (*.db)");
if (dlg.exec() == QDialog::Accepted)
{
	QString fname = dlg.selectedFiles()[0];
	ui->databaseName_lineEdit->setText(fname);
}

Have phun 😉

Leave a Reply

Your email address will not be published. Required fields are marked *