-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkfiledeleter.cpp
More file actions
25 lines (21 loc) · 974 Bytes
/
kfiledeleter.cpp
File metadata and controls
25 lines (21 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "kfiledeleter.h"
#include <QPushButton>
KFileDeleter::KFileDeleter(const QFileInfoList &fileInfoList, QWidget *parent) :
QObject(parent),
m_thread(new KFileDeleteThread(fileInfoList, this)),
m_waitingMessageBox(new QMessageBox(QMessageBox::NoIcon, tr("删除中"), tr("正在删除,请稍后"), QMessageBox::Cancel, parent))
{
// 绑定信号,实现终止删除
connect(m_waitingMessageBox, &QMessageBox::buttonClicked, this, [&]() {
if (m_thread->isRunning())
m_thread->exit();
});
// 绑定信号,实现删除结束之后关闭提示框
connect(m_thread, &KFileDeleteThread::finished, this, [&]() {
m_waitingMessageBox->close();
QMessageBox *successMessageBox = new QMessageBox(QMessageBox::NoIcon, tr("完成"), tr("删除成功"), QMessageBox::Ok, parent);
successMessageBox->exec();
});
m_thread->start();
m_waitingMessageBox->exec();
}