mainwindow: warn if deleted files in search results
This commit is contained in:
父節點
45b2dbed4d
當前提交
9c1769f1c1
@ -190,10 +190,12 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
{
|
||||
this->pdfSearchResults.clear();
|
||||
ui->treeResultsList->clear();
|
||||
ui->lblSearchResults->setText("Results: " + QString::number(results.size()) + " files");
|
||||
|
||||
bool hasDeleted = false;
|
||||
for(const SearchResult &result : results)
|
||||
{
|
||||
QFileInfo pathInfo(result.fileData.absPath);
|
||||
|
||||
QString fileName = pathInfo.fileName();
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
|
||||
|
||||
@ -203,9 +205,17 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
item->setText(1, result.fileData.absPath);
|
||||
item->setText(2, dt.toString(Qt::ISODate));
|
||||
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
||||
if(result.fileData.absPath.endsWith(".pdf"))
|
||||
bool exists = pathInfo.exists();
|
||||
if(exists)
|
||||
{
|
||||
this->pdfSearchResults.append(result);
|
||||
if(result.fileData.absPath.endsWith(".pdf"))
|
||||
{
|
||||
this->pdfSearchResults.append(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hasDeleted = true;
|
||||
}
|
||||
}
|
||||
ui->treeResultsList->resizeColumnToContents(0);
|
||||
@ -220,6 +230,14 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
{
|
||||
makePdfPreview(1);
|
||||
}
|
||||
|
||||
QString statusText = "Results: " + QString::number(results.size()) + " files";
|
||||
if(hasDeleted)
|
||||
{
|
||||
statusText += " WARNING: Some files don't exist anymore. No preview available for those. Index out of sync";
|
||||
}
|
||||
ui->lblSearchResults->setText(statusText);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::makePdfPreview(int page)
|
||||
|
Loading…
Reference in New Issue
Block a user