Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions deepin-font-manager/interfaces/dfontpreviewlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@

#include <QApplication>
#include <QMenu>
#include <QMouseEvent>

Check warning on line 24 in deepin-font-manager/interfaces/dfontpreviewlistview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QMouseEvent> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QKeyEvent>

Check warning on line 25 in deepin-font-manager/interfaces/dfontpreviewlistview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QKeyEvent> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QFocusEvent>

Check warning on line 26 in deepin-font-manager/interfaces/dfontpreviewlistview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QFocusEvent> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QSet>

Check warning on line 27 in deepin-font-manager/interfaces/dfontpreviewlistview.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QSet> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DWIDGET_USE_NAMESPACE

Expand Down Expand Up @@ -2399,6 +2400,7 @@
qDebug() << __FUNCTION__ << " before delete " << m_dataThread->getFontModelList().size() << m_fontPreviewProxyModel->rowCount();

int deleteCount = files.count();
const QSet<QString> fileSet(files.begin(), files.end());

if (!force)
updateSpinner(DFontSpinnerWidget::Delete, false);
Expand All @@ -2408,14 +2410,15 @@
DFontPreviewItemData itemData(*iter);
QString filePath = itemData.fontInfo.filePath;
//如果字体文件已经不存在,则从t_manager表中删除
if (files.contains(filePath)) {
if (fileSet.contains(filePath)) {
//删除字体之前启用字体,防止下次重新安装后就被禁用
enableFont(itemData.fontInfo.filePath);
DFMDBManager::instance()->deleteFontInfo(itemData);
QFontDatabase::removeApplicationFont(itemData.appFontId);
m_dataThread->removePathWatcher(filePath);
iter = m_dataThread->m_fontModelList.erase(iter);
m_recoverSelectStateUserfontMultiMap.remove(filePath);
Q_EMIT itemRemoved(itemData);
} else {
++iter;
}
Expand All @@ -2425,7 +2428,21 @@

enableFonts();

Q_EMIT requestUpdateModel(deleteCount, !force);
// 设置预览大小
emit m_signalManager->fontSizeRequestToSlider();

// 删除之后设置焦点
if (m_FontViewHasFocus) {
refreshFocuses();
setFontViewHasFocus(false);
}

Q_EMIT requestShowSpinner(false, true, DFontSpinnerWidget::Delete);
Q_EMIT rowCountChanged();
Q_EMIT deleteFinished();
syncTabStatus();
m_recoveryTabFocusState = false;
PerformanceMonitor::deleteFontFinish(deleteCount);
m_dataThread->onAutoDirWatchers();
qDebug() << "Exiting function: DFontPreviewListView::deleteCurFonts";
}
Expand Down