search: show file type icons in addition to name in results

Tento commit je obsažen v:
Albert S. 2018-02-10 13:59:27 +01:00
rodič 4b9ccc50da
revize 96fe3e08f6

Zobrazit soubor

@ -23,6 +23,7 @@
#include <QDate>
#include <QHeaderView>
#include <QDesktopServices>
#include <QFileIconProvider>
Window::Window(const QVector<EntryConfig> &configs, const QString &dbpath)
{
this->userEntryButtons = generateEntryButtons(configs);
@ -363,6 +364,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
{
clearGrid();
treeFileSearchResults.clear();
QFileIconProvider provider;
for(const QString &path : results)
{
QFileInfo pathInfo(path);
@ -371,6 +373,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
QString datestr = pathInfo.lastModified().toString(Qt::ISODate);
QTreeWidgetItem *item = new QTreeWidgetItem(&treeFileSearchResults);
item->setText(0, fileName);
item->setIcon(0, provider.icon(pathInfo));
item->setText(1, absPath);
item->setText(2, datestr);