mirror of
https://github.com/QRouland/UTPass.git
synced 2025-07-22 15:25:58 +00:00
Add support for ssh clone
This commit is contained in:
plugins
po
qml
@ -15,7 +15,7 @@ bool Utils::unzip(QUrl zip_url, QString dir_out_path)
|
||||
if (!this->m_sem->tryAcquire(1, 500)) {
|
||||
return false;
|
||||
}
|
||||
qInfo() << "Unzip path " << zip_url << " to " << dir_out_path;
|
||||
qInfo() << "[Utils] Unzip path " << zip_url << " to " << dir_out_path;
|
||||
auto job = new UnzipJob(zip_url, QDir(dir_out_path));
|
||||
connect(job, &UnzipJob::resultReady, this, &Utils::unzipResult);
|
||||
connect(job, &UnzipJob::finished, job, &QObject::deleteLater);
|
||||
@ -26,13 +26,13 @@ bool Utils::unzip(QUrl zip_url, QString dir_out_path)
|
||||
void Utils::unzipResult(bool err)
|
||||
{
|
||||
|
||||
qDebug() << "Unzip Result";
|
||||
qDebug() << "[Utils] Unzip Result";
|
||||
if (err) {
|
||||
qInfo() << "Unzip Failed";
|
||||
qInfo() << "[Utils] Unzip Failed";
|
||||
emit unzipFailed();
|
||||
|
||||
} else {
|
||||
qInfo() << "Unzip Succeed";
|
||||
qInfo() << "[Utils] Unzip Succeed";
|
||||
emit unzipSucceed();
|
||||
}
|
||||
this->m_sem->release(1);
|
||||
@ -42,7 +42,7 @@ void Utils::unzipResult(bool err)
|
||||
QString Utils::manifestPath()
|
||||
{
|
||||
auto path = QDir(QDir::currentPath()).filePath("manifest_.json");
|
||||
qInfo() << "Manifest path : " << path;
|
||||
qInfo() << "[Utils] Manifest path : " << path;
|
||||
return path;
|
||||
}
|
||||
|
||||
@ -56,3 +56,12 @@ bool Utils::rmDir(QUrl dir_url)
|
||||
QDir dir(dir_url.toLocalFile());
|
||||
return dir.removeRecursively();
|
||||
}
|
||||
|
||||
bool Utils::fileExists(QUrl path)
|
||||
{
|
||||
QString p = path.toLocalFile();
|
||||
auto ret = QFileInfo::exists(p) && QFileInfo(p).isFile();
|
||||
qDebug() << "[Utils]" << path << " existing file :" << ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,14 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE bool rmDir(QUrl dir_url);
|
||||
|
||||
/**
|
||||
* @brief Verify that file exists at the specified URL.
|
||||
*
|
||||
* @param path The URL of the file to verfidy.
|
||||
* @return `true` if the file exist; `false` otherwise.
|
||||
*/
|
||||
Q_INVOKABLE bool fileExists(QUrl path);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user