微调app删除文件

This commit is contained in:
yangjiaxuan 2023-01-11 19:17:26 +08:00
parent b186102826
commit c194efba48
4 changed files with 349 additions and 327 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,8 @@ Dialog_ClrCache::Dialog_ClrCache(QWidget *parent)
{
ui->setupUi(this);
ui->lineEdit->setEnabled(false);
m_cachePath = getCachePath();
ui->lineEdit->setText(m_cachePath);
setInformation(m_cachePath);
@ -76,9 +78,13 @@ void Dialog_ClrCache::on_btn_clr_clicked()
bool Dialog_ClrCache::clrCache(const QString &path)
{
bool isSuccessful = false;
QDir dir = QDir(path);
bool isSuccessful = dir.removeRecursively();
// dir.mkpath(m_cachePath);
if (!path.isEmpty() && (path.endsWith("Cache/") || path.endsWith("Cache\\")))
{
isSuccessful = dir.removeRecursively();
}
return isSuccessful;
}
@ -159,6 +165,12 @@ void Dialog_ClrCache::on_btn_directory_clicked()
void Dialog_ClrCache::on_pbtn_ok_clicked()
{
if(ui->lineEdit->text().isEmpty())
{
QMessageBox::information(this, tr("tips"), tr("directory can not be empty"));
return;
}
QString filePath = ui->lineEdit->text();
HGResult ret = HGBase_CreateDir(getStdString(filePath).c_str());
if (ret != HGBASE_ERR_OK)

View File

@ -387,6 +387,10 @@
<source>create cachePath failed: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>directory can not be empty</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Dialog_Export</name>