mainwindow: warn if deleted files in search results
This commit is contained in:
rodzic
9ced0ec742
commit
576b884574
@ -198,10 +198,12 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
|||||||
{
|
{
|
||||||
this->pdfSearchResults.clear();
|
this->pdfSearchResults.clear();
|
||||||
ui->treeResultsList->clear();
|
ui->treeResultsList->clear();
|
||||||
ui->lblSearchResults->setText("Results: " + QString::number(results.size()) + " files");
|
|
||||||
|
bool hasDeleted = false;
|
||||||
for(const SearchResult &result : results)
|
for(const SearchResult &result : results)
|
||||||
{
|
{
|
||||||
QFileInfo pathInfo(result.fileData.absPath);
|
QFileInfo pathInfo(result.fileData.absPath);
|
||||||
|
|
||||||
QString fileName = pathInfo.fileName();
|
QString fileName = pathInfo.fileName();
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
|
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
|
||||||
|
|
||||||
@ -211,11 +213,19 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
|||||||
item->setText(1, result.fileData.absPath);
|
item->setText(1, result.fileData.absPath);
|
||||||
item->setText(2, dt.toString(Qt::ISODate));
|
item->setText(2, dt.toString(Qt::ISODate));
|
||||||
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
||||||
|
bool exists = pathInfo.exists();
|
||||||
|
if(exists)
|
||||||
|
{
|
||||||
if(result.fileData.absPath.endsWith(".pdf"))
|
if(result.fileData.absPath.endsWith(".pdf"))
|
||||||
{
|
{
|
||||||
this->pdfSearchResults.append(result);
|
this->pdfSearchResults.append(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hasDeleted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
ui->treeResultsList->resizeColumnToContents(0);
|
ui->treeResultsList->resizeColumnToContents(0);
|
||||||
ui->treeResultsList->resizeColumnToContents(1);
|
ui->treeResultsList->resizeColumnToContents(1);
|
||||||
pdfDirty = !this->pdfSearchResults.empty();
|
pdfDirty = !this->pdfSearchResults.empty();
|
||||||
@ -228,6 +238,13 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
|||||||
{
|
{
|
||||||
makePdfPreview(1);
|
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)
|
void MainWindow::makePdfPreview(int page)
|
||||||
|
Ładowanie…
Reference in New Issue
Block a user