仅华高开放升级服务,调整文件夹访问权限提示

This commit is contained in:
yangjiaxuan 2023-02-22 15:18:06 +08:00
parent 6236a07e14
commit 8bc478777a
6 changed files with 609 additions and 594 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -128,15 +128,17 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
resize(950, 720);
}
if (!m_versionDll->IsValid())
{
ui->actionact_update->setVisible(false);
ui->act_feedback->setVisible(false);
}
else
ui->actionact_update->setVisible(false);
ui->act_feedback->setVisible(false);
#if defined(OEM_HUAGAO)
if (m_versionDll->IsValid())
{
ui->actionact_update->setVisible(true);
ui->act_feedback->setVisible(true);
m_versionDll->PostUserOpenInfo(HGVERSION_APPNAME_SCANNER, m_oemName);
}
#endif
HGChar cfgpath[512] = {0};
QString old;
@ -1309,9 +1311,19 @@ void MainWindow::on_export_scanned_image(void)
void MainWindow::on_continueScan()
{
if(!isLimitAccessFolder(""))
if (1 == m_scanType)
{
return;
if(!isLimitAccessFolder(1))
{
return;
}
}
else if (2 == m_scanType)
{
if(!isLimitAccessFolder(2))
{
return;
}
}
if (!dev_que_.is_online() || m_isScanning || 0 == m_scanType)
@ -3218,7 +3230,7 @@ void MainWindow::on_act_scannerSettings_triggered()
void MainWindow::on_act_acquire_triggered()
{
if(!isLimitAccessFolder(""))
if(!isLimitAccessFolder(1))
{
return;
}
@ -3296,7 +3308,7 @@ void MainWindow::on_act_acquire_triggered()
void MainWindow::on_act_acquireSingle_triggered()
{
if(!isLimitAccessFolder(""))
if(!isLimitAccessFolder(1))
{
return;
}
@ -3408,7 +3420,7 @@ void MainWindow::on_act_acquireInto_triggered()
// m_aquireIntoSaveParam.m_savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + dateTime.toString("yyyyMMddhhmmss") + "/");
if(!isLimitAccessFolder(m_aquireIntoSaveParam.m_savePath))
if(!isLimitAccessFolder(2))
{
return;
}
@ -3469,7 +3481,7 @@ void MainWindow::on_act_acquireInto_triggered()
void MainWindow::on_act_insertFromScanner_triggered()
{
if(!isLimitAccessFolder(""))
if(!isLimitAccessFolder(1))
{
return;
}
@ -3733,42 +3745,43 @@ void MainWindow::upgradeApp(QString pkgPath)
QString tmpPath(tmpPath2);
#if defined(HG_CMP_MSC)
#if defined(OEM_HANWANG)
QFile::remove(tmpPath + "HwUpgradeApp.exe");
QFile::copy(curPath + "HwUpgradeApp.exe", tmpPath + "HwUpgradeApp.exe");
QFile::remove(tmpPath + "HwBase.dll");
QFile::copy(curPath + "HwBase.dll", tmpPath + "HwBase.dll");
QFile::remove(tmpPath + "HwVersion.dll");
QFile::copy(curPath + "HwVersion.dll", tmpPath + "HwVersion.dll");
#elif defined(OEM_LISICHENG)
QFile::remove(tmpPath + "LscUpgradeApp.exe");
QFile::copy(curPath + "LscUpgradeApp.exe", tmpPath + "LscUpgradeApp.exe");
QFile::remove(tmpPath + "LscBase.dll");
QFile::copy(curPath + "LscBase.dll", tmpPath + "LscBase.dll");
QFile::remove(tmpPath + "LscVersion.dll");
QFile::copy(curPath + "LscVersion.dll", tmpPath + "LscVersion.dll");
#elif defined(OEM_CANGTIAN)
QFile::remove(tmpPath + "CtsUpgradeApp.exe");
QFile::copy(curPath + "CtsUpgradeApp.exe", tmpPath + "CtsUpgradeApp.exe");
QFile::remove(tmpPath + "CtsBase.dll");
QFile::copy(curPath + "CtsBase.dll", tmpPath + "CtsBase.dll");
QFile::remove(tmpPath + "CtsVersion.dll");
QFile::copy(curPath + "CtsVersion.dll", tmpPath + "CtsVersion.dll");
#elif defined(OEM_ZHONGJING)
QFile::remove(tmpPath + "ZJUpgradeApp.exe");
QFile::copy(curPath + "ZJUpgradeApp.exe", tmpPath + "ZJUpgradeApp.exe");
QFile::remove(tmpPath + "ZJBase.dll");
QFile::copy(curPath + "ZJBase.dll", tmpPath + "ZJBase.dll");
QFile::remove(tmpPath + "ZJVersion.dll");
QFile::copy(curPath + "ZJVersion.dll", tmpPath + "ZJVersion.dll");
#else
// #if defined(OEM_HANWANG)
// QFile::remove(tmpPath + "HwUpgradeApp.exe");
// QFile::copy(curPath + "HwUpgradeApp.exe", tmpPath + "HwUpgradeApp.exe");
// QFile::remove(tmpPath + "HwBase.dll");
// QFile::copy(curPath + "HwBase.dll", tmpPath + "HwBase.dll");
// QFile::remove(tmpPath + "HwVersion.dll");
// QFile::copy(curPath + "HwVersion.dll", tmpPath + "HwVersion.dll");
// #elif defined(OEM_LISICHENG)
// QFile::remove(tmpPath + "LscUpgradeApp.exe");
// QFile::copy(curPath + "LscUpgradeApp.exe", tmpPath + "LscUpgradeApp.exe");
// QFile::remove(tmpPath + "LscBase.dll");
// QFile::copy(curPath + "LscBase.dll", tmpPath + "LscBase.dll");
// QFile::remove(tmpPath + "LscVersion.dll");
// QFile::copy(curPath + "LscVersion.dll", tmpPath + "LscVersion.dll");
// #elif defined(OEM_CANGTIAN)
// QFile::remove(tmpPath + "CtsUpgradeApp.exe");
// QFile::copy(curPath + "CtsUpgradeApp.exe", tmpPath + "CtsUpgradeApp.exe");
// QFile::remove(tmpPath + "CtsBase.dll");
// QFile::copy(curPath + "CtsBase.dll", tmpPath + "CtsBase.dll");
// QFile::remove(tmpPath + "CtsVersion.dll");
// QFile::copy(curPath + "CtsVersion.dll", tmpPath + "CtsVersion.dll");
// #elif defined(OEM_ZHONGJING)
// QFile::remove(tmpPath + "ZJUpgradeApp.exe");
// QFile::copy(curPath + "ZJUpgradeApp.exe", tmpPath + "ZJUpgradeApp.exe");
// QFile::remove(tmpPath + "ZJBase.dll");
// QFile::copy(curPath + "ZJBase.dll", tmpPath + "ZJBase.dll");
// QFile::remove(tmpPath + "ZJVersion.dll");
// QFile::copy(curPath + "ZJVersion.dll", tmpPath + "ZJVersion.dll");
// #else
QFile::remove(tmpPath + "HGUpgradeApp.exe");
QFile::copy(curPath + "HGUpgradeApp.exe", tmpPath + "HGUpgradeApp.exe");
QFile::remove(tmpPath + "HGBase.dll");
QFile::copy(curPath + "HGBase.dll", tmpPath + "HGBase.dll");
QFile::remove(tmpPath + "HGVersion.dll");
QFile::copy(curPath + "HGVersion.dll", tmpPath + "HGVersion.dll");
#endif
// #endif
QFile::remove(tmpPath + "msvcp140.dll");
QFile::copy(curPath + "msvcp140.dll", tmpPath + "msvcp140.dll");
@ -3792,42 +3805,42 @@ void MainWindow::upgradeApp(QString pkgPath)
QFile::remove(tmpPath + "imageformats/qgif.dll");
QFile::copy(curPath + "imageformats/qgif.dll", tmpPath + "imageformats/qgif.dll");
#else
#if defined(OEM_HANWANG)
QFile::remove(tmpPath + "HwUpgradeApp");
QFile::copy(curPath + "HwUpgradeApp", tmpPath + "HwUpgradeApp");
//QFile::remove(tmpPath + "libHwBase.so");
//QFile::copy(curPath + "libHwBase.so", tmpPath + "libHwBase.so");
//QFile::remove(tmpPath + "libHwVersion.so");
//QFile::copy(curPath + "libHwVersion.so", tmpPath + "libHwVersion.so");
#elif defined(OEM_LISICHENG)
QFile::remove(tmpPath + "LscUpgradeApp");
QFile::copy(curPath + "LscUpgradeApp", tmpPath + "LscUpgradeApp");
//QFile::remove(tmpPath + "libLscBase.so");
//QFile::copy(curPath + "libLscBase.so", tmpPath + "libLscBase.so");
//QFile::remove(tmpPath + "libLscVersion.so");
//QFile::copy(curPath + "libLscVersion.so", tmpPath + "libLscVersion.so");
#elif defined(OEM_CANGTIAN)
QFile::remove(tmpPath + "CtsUpgradeApp");
QFile::copy(curPath + "CtsUpgradeApp", tmpPath + "CtsUpgradeApp");
//QFile::remove(tmpPath + "libCtsBase.so");
//QFile::copy(curPath + "libCtsBase.so", tmpPath + "libCtsBase.so");
//QFile::remove(tmpPath + "libCtsVersion.so");
//QFile::copy(curPath + "libCtsVersion.so", tmpPath + "libCtsVersion.so");
#elif defined(OEM_ZHONGJING)
QFile::remove(tmpPath + "ZjUpgradeApp");
QFile::copy(curPath + "ZjUpgradeApp", tmpPath + "ZjUpgradeApp");
//QFile::remove(tmpPath + "libZjBase.so");
//QFile::copy(curPath + "libZjBase.so", tmpPath + "libZjBase.so");
//QFile::remove(tmpPath + "libZjVersion.so");
//QFile::copy(curPath + "libZjVersion.so", tmpPath + "libZjVersion.so");
#else
// #if defined(OEM_HANWANG)
// QFile::remove(tmpPath + "HwUpgradeApp");
// QFile::copy(curPath + "HwUpgradeApp", tmpPath + "HwUpgradeApp");
// //QFile::remove(tmpPath + "libHwBase.so");
// //QFile::copy(curPath + "libHwBase.so", tmpPath + "libHwBase.so");
// //QFile::remove(tmpPath + "libHwVersion.so");
// //QFile::copy(curPath + "libHwVersion.so", tmpPath + "libHwVersion.so");
// #elif defined(OEM_LISICHENG)
// QFile::remove(tmpPath + "LscUpgradeApp");
// QFile::copy(curPath + "LscUpgradeApp", tmpPath + "LscUpgradeApp");
// //QFile::remove(tmpPath + "libLscBase.so");
// //QFile::copy(curPath + "libLscBase.so", tmpPath + "libLscBase.so");
// //QFile::remove(tmpPath + "libLscVersion.so");
// //QFile::copy(curPath + "libLscVersion.so", tmpPath + "libLscVersion.so");
// #elif defined(OEM_CANGTIAN)
// QFile::remove(tmpPath + "CtsUpgradeApp");
// QFile::copy(curPath + "CtsUpgradeApp", tmpPath + "CtsUpgradeApp");
// //QFile::remove(tmpPath + "libCtsBase.so");
// //QFile::copy(curPath + "libCtsBase.so", tmpPath + "libCtsBase.so");
// //QFile::remove(tmpPath + "libCtsVersion.so");
// //QFile::copy(curPath + "libCtsVersion.so", tmpPath + "libCtsVersion.so");
// #elif defined(OEM_ZHONGJING)
// QFile::remove(tmpPath + "ZjUpgradeApp");
// QFile::copy(curPath + "ZjUpgradeApp", tmpPath + "ZjUpgradeApp");
// //QFile::remove(tmpPath + "libZjBase.so");
// //QFile::copy(curPath + "libZjBase.so", tmpPath + "libZjBase.so");
// //QFile::remove(tmpPath + "libZjVersion.so");
// //QFile::copy(curPath + "libZjVersion.so", tmpPath + "libZjVersion.so");
// #else
QFile::remove(tmpPath + "HGUpgradeApp");
QFile::copy(curPath + "HGUpgradeApp", tmpPath + "HGUpgradeApp");
//QFile::remove(tmpPath + "libHGBase.so");
//QFile::copy(curPath + "libHGBase.so", tmpPath + "libHGBase.so");
//QFile::remove(tmpPath + "libHGVersion.so");
//QFile::copy(curPath + "libHGVersion.so", tmpPath + "libHGVersion.so");
#endif
// #endif
#endif
QProcess proc;
@ -3840,29 +3853,29 @@ void MainWindow::upgradeApp(QString pkgPath)
argList.push_back(QString("-language=%1").arg(m_currLang.toStdString().c_str()));
#if defined(HG_CMP_MSC)
#if defined(OEM_HANWANG)
isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp.exe", argList);
#elif defined(OEM_LISICHENG)
isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp.exe", argList);
#elif defined(OEM_CANGTIAN)
isSuccessdStart = proc.startDetached(tmpPath + "CtsUpgradeApp.exe", argList);
#elif defined(OEM_ZHONGJING)
isSuccessdStart = proc.startDetached(tmpPath + "ZJUpgradeApp.exe", argList);
#else
// #if defined(OEM_HANWANG)
// isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp.exe", argList);
// #elif defined(OEM_LISICHENG)
// isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp.exe", argList);
// #elif defined(OEM_CANGTIAN)
// isSuccessdStart = proc.startDetached(tmpPath + "CtsUpgradeApp.exe", argList);
// #elif defined(OEM_ZHONGJING)
// isSuccessdStart = proc.startDetached(tmpPath + "ZJUpgradeApp.exe", argList);
// #else
isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp.exe", argList);
#endif
// #endif
#else
#if defined(OEM_HANWANG)
isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp", argList);
#elif defined(OEM_LISICHENG)
isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp", argList);
#elif defined(OEM_CANGTIAN)
isSuccessdStart = proc.startDetached(tmpPath + "CtsUpgradeApp", argList);
#elif defined(OEM_ZHONGJING)
isSuccessdStart = proc.startDetached(tmpPath + "ZjUpgradeApp", argList);
#else
// #if defined(OEM_HANWANG)
// isSuccessdStart = proc.startDetached(tmpPath + "HwUpgradeApp", argList);
// #elif defined(OEM_LISICHENG)
// isSuccessdStart = proc.startDetached(tmpPath + "LscUpgradeApp", argList);
// #elif defined(OEM_CANGTIAN)
// isSuccessdStart = proc.startDetached(tmpPath + "CtsUpgradeApp", argList);
// #elif defined(OEM_ZHONGJING)
// isSuccessdStart = proc.startDetached(tmpPath + "ZjUpgradeApp", argList);
// #else
isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp", argList);
#endif
// #endif
#endif
if (isSuccessdStart)
@ -3879,49 +3892,45 @@ void MainWindow::upgradeApp(QString pkgPath)
}
}
bool MainWindow::isLimitAccessFolder(QString filePath)
bool MainWindow::isLimitAccessFolder(int type)
{
HGChar documentsPath[512];
HGBase_GetDocumentsPath(documentsPath, 512);
HGChar procName[512];
HGBase_GetProcessName(procName, 512);
strcat(documentsPath, procName);
HGBase_CreateDir(getStdString(documentsPath).c_str());
QString cachePath = Dialog_ClrCache::getCachePath();
QString aquireIntoPath = m_aquireIntoSaveParam.m_savePath;
QString filePath;
HGChar uuid[512];
HGBase_GetUuid(uuid, 512);
strcat(documentsPath, "/");
strcat(documentsPath, uuid);
HGResult ret = HGBase_CreateDir(getStdString(documentsPath).c_str());
if(ret != HGBASE_ERR_OK)
if (1 == type)
{
if(!filePath.isEmpty())
filePath = cachePath + uuid;
}
else if (2 == type)
{
filePath = aquireIntoPath + uuid;
}
HGResult ret = HGBase_CreateDir(getStdString(filePath).c_str());
if (ret != HGBASE_ERR_OK)
{
QString info;
if (1 == type)
{
HGChar uuid2[512];
HGBase_GetUuid(uuid2, 512);
filePath += uuid2;
ret = HGBase_CreateDir(getStdString(filePath).c_str());
if (ret != HGBASE_ERR_OK)
{
QMessageBox::critical(this, tr("error"), tr("folder limit"));
m_dialogLog->addLog(tr("folder limit"), true);
m_wndStatusBar->setDeviceStatusInfo(tr("folder limit"), true);
return false;
}
else
{
HGBase_DeleteDir(getStdString(filePath).c_str());
}
return true;
info = tr("cache path folder limit:%1").arg(cachePath);
}
QMessageBox::critical(this, tr("error"), tr("folder limit"));
m_dialogLog->addLog(tr("folder limit"), true);
m_wndStatusBar->setDeviceStatusInfo(tr("folder limit"), true);
else if (2 == type)
{
info = tr("aquireinto folder limit:%1").arg(aquireIntoPath);
}
QMessageBox::critical(this, tr("error"), info);
m_dialogLog->addLog(info, true);
m_wndStatusBar->setDeviceStatusInfo(info, true);
return false;
}
else
{
HGBase_DeleteDir(getStdString(documentsPath).c_str());
HGBase_DeleteDir(getStdString(filePath).c_str());
}
return true;
}

View File

@ -268,7 +268,7 @@ private:
bool open_scanner(const QString& name, const QString& scheme);
bool judgeDiskSpace(QString currentPath, bool showDlg = true);
void upgradeApp(QString pkgPath);
bool isLimitAccessFolder(QString filePath);
bool isLimitAccessFolder(int type); //type:1-aquire,2-aquireInto
static QString GetDevType(const QString& fwVersion, bool &canLock);
void upgradeFwAndLockDevice();
void deleteOverdueLogFile(const QString& logFilePath);