mirror of
https://github.com/QRouland/UTPass.git
synced 2025-01-24 23:56:39 +00:00
25 lines
477 B
C++
25 lines
477 B
C++
|
#include "rmjob.h"
|
||
|
|
||
|
RmJob::RmJob(QString path):
|
||
|
m_path(path)
|
||
|
{
|
||
|
this->setObjectName("RmJob");
|
||
|
}
|
||
|
|
||
|
|
||
|
void RmJob::run()
|
||
|
{
|
||
|
auto info = QFileInfo(this->m_path);
|
||
|
if (info.isFile()) {
|
||
|
auto file = QFile(this->m_path);
|
||
|
file.remove();
|
||
|
emit resultReady(false);
|
||
|
} else if (info.isDir()) {
|
||
|
auto dir = QDir(this->m_path);
|
||
|
dir.removeRecursively();
|
||
|
emit resultReady(false);
|
||
|
} else {
|
||
|
emit resultReady(true);
|
||
|
}
|
||
|
}
|