Commit 7279316f authored by Dmitry81's avatar Dmitry81

Review notes was fixed.

parent 9f6b1468
......@@ -53,42 +53,38 @@ const auto autoConnectKey = QStringLiteral("AutoConnect");
// InfoTeCS ViPNet support, removing ViPNet Key(Unmerge) Directory
int removeFolder(QDir & dir)
bool removeFolder(const QDir & dir)
{
int res = 0;
//Get Directory list
QStringList lstDirs = dir.entryList(QDir::Dirs |
QDir::AllDirs |
QDir::NoDotAndDotDot);
QStringList dirsList = dir.entryList(QDir::Dirs |
QDir::AllDirs |
QDir::NoDotAndDotDot);
//Get file,named sockets and device files list
QStringList lstFiles = dir.entryList(QDir::Files | QDir::System);
QStringList filesList = dir.entryList(QDir::Files | QDir::System);
//Deleting files
foreach (QString entry, lstFiles)
{
foreach (QString entry, filesList) {
QString entryAbsPath = dir.absolutePath() + "/" + entry;
if ( !QFile::remove(entryAbsPath) ) {
if (!QFile::remove(entryAbsPath)) {
qCWarning(lcVpnLog) << "Can't remove file: " << entryAbsPath;
}
}
//Recursive directory removing
foreach (QString entry, lstDirs)
{
foreach (QString entry, dirsList) {
QString entryAbsPath = dir.absolutePath() + "/" + entry;
QDir tmp(entryAbsPath);
if ( removeFolder(tmp) != 0 ) {
if (!removeFolder(tmp)) {
qCWarning(lcVpnLog) << "Can't remove dir: " << tmp;
}
}
//Processing directory deleting
if (!QDir().rmdir(dir.absolutePath()))
{
res = 1;
}
return res;
if (!QDir().rmdir(dir.absolutePath()))
return false;
return true;
}
QString vpnServicePath(QString connectionPath)
......@@ -581,20 +577,17 @@ void VpnModel::deleteConnection(const QString &path, bool deleteForModify)
// InfoTeCS ViPNet support, removing ViPNet Key(Unmerge) Directory
if (conn->type() == QStringLiteral("vipnet")) {
if (!deleteForModify) {
if (!deleteForModify) {
//final ViPNet connection delete .
QVariantMap providerProperties = conn->providerProperties();
if(providerProperties.contains("ViPNet.DstPath"))
{
if(providerProperties.contains("ViPNet.DstPath")) {
const QString dstdir = providerProperties.value("ViPNet.DstPath").toString();
qCWarning(lcVpnLog) << "Removing ViPNet DST directory:" << dstdir;
QDir dstDir (dstdir);
if (removeFolder(dstDir))
{
qCWarning(lcVpnLog) << "Failed to remove ViPNet DST directory" << dstdir;
if (!removeFolder(dstDir)) {
qCWarning(lcVpnLog) << "Failed to remove ViPNet DST directory" << dstdir;
}
}
else {
} else {
qCWarning(lcVpnLog) << "vipnet provider properties does not contain Unmerge direcory" ;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment