mirror of
https://github.com/QRouland/UTPass.git
synced 2025-06-24 22:42:28 +00:00
Ensure that key and zip are deleted after import
This commit is contained in:
@ -29,7 +29,7 @@ void Utils::unzipResult(bool err)
|
||||
qDebug() << "Unzip Result";
|
||||
if (err) {
|
||||
qInfo() << "Unzip Failed";
|
||||
emit unzipFailed("failed to unzip archive");
|
||||
emit unzipFailed();
|
||||
|
||||
} else {
|
||||
qInfo() << "Unzip Succeed";
|
||||
@ -45,3 +45,14 @@ QString Utils::manifestPath()
|
||||
qInfo() << "Manifest path : " << path;
|
||||
return path;
|
||||
}
|
||||
|
||||
bool Utils::rmFile(QUrl file_url)
|
||||
{
|
||||
return QFile::remove(file_url.toLocalFile());
|
||||
}
|
||||
|
||||
bool Utils::rmDir(QUrl dir_url)
|
||||
{
|
||||
QDir dir(dir_url.toLocalFile());
|
||||
return dir.removeRecursively();
|
||||
}
|
||||
|
@ -34,9 +34,8 @@ signals:
|
||||
|
||||
/**
|
||||
* @brief Emitted when the unzipping operation fails.
|
||||
* @param message The error message describing the failure.
|
||||
*/
|
||||
void unzipFailed(QString message);
|
||||
void unzipFailed();
|
||||
|
||||
private:
|
||||
std::unique_ptr<QSemaphore> m_sem; /**< Semaphore for managing concurrent operations. */
|
||||
@ -48,19 +47,14 @@ public:
|
||||
Utils();
|
||||
|
||||
/**
|
||||
* @brief Unzips a ZIP file to the specified output directory.
|
||||
*
|
||||
* This method extracts the contents of a ZIP file from the specified URL and saves them to the provided
|
||||
* output directory path.
|
||||
* @brief Start a job to unzips a ZIP file to the specified output directory.
|
||||
*
|
||||
* @param zip_url The URL of the ZIP file to unzip.
|
||||
* @param dir_out The output directory where the contents of the ZIP file should be extracted.
|
||||
* @return `true` if the unzipping operation was successful, `false` otherwise.
|
||||
* @return `true` if the unzipping job is started successfullly, `false` otherwise.
|
||||
*/
|
||||
Q_INVOKABLE bool unzip(QUrl zip_url, QString dir_out);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Retrieves the path to the manifest data.
|
||||
*
|
||||
@ -70,6 +64,22 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE QString manifestPath();
|
||||
|
||||
/**
|
||||
* @brief Removes a file located at the specified URL.
|
||||
*
|
||||
* @param file_url The URL of the file to remove.
|
||||
* @return `true` if the file was successfully removed; `false` otherwise.
|
||||
*/
|
||||
Q_INVOKABLE bool rmFile(QUrl file_url);
|
||||
|
||||
/**
|
||||
* @brief Removes a directory located at the specified URL.
|
||||
*
|
||||
* @param dir_url The URL of the directory to remove.
|
||||
* @return `true` if the directory was successfully removed; `false` otherwise.
|
||||
*/
|
||||
Q_INVOKABLE bool rmDir(QUrl dir_url);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user