Skip to content

Commit 718721d

Browse files
committed
在删除便签时,新增功能以递归删除对应的图片文件夹,确保相关文件被清理
1 parent be1c310 commit 718721d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

noteeditwidget.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,17 @@ void NoteEditWidget::onDeleteButtonClicked()
590590

591591
// 从数据库中删除
592592
if (m_database->deleteNote(noteId)) {
593+
// 删除便签对应的图片文件夹
594+
QString imageDirPath = getImageDirectory(noteId);
595+
if (!imageDirPath.isEmpty()) {
596+
QDir imageDir(imageDirPath);
597+
if (imageDir.exists()) {
598+
// 递归删除目录及其内容
599+
imageDir.removeRecursively();
600+
qDebug() << "已删除便签图片目录:" << imageDirPath;
601+
}
602+
}
603+
593604
// 发送删除信号
594605
emit noteDeleted(noteId);
595606

0 commit comments

Comments
 (0)