Hide history window during waiting for delete screenshot from S3

This commit is contained in:
Yuriy Puchkov
2020-08-06 18:57:14 +03:00
parent 3053541827
commit aba85cbf52
3 changed files with 18 additions and 6 deletions

View File

@@ -61,6 +61,7 @@ ImgS3Uploader::ImgS3Uploader(QWidget *parent) :
void ImgS3Uploader::init(const QString &title, const QString &label) {
m_proxy = nullptr;
m_success = false;
setWindowTitle(title);
setWindowIcon(QIcon(":img/app/flameshot.svg"));
@@ -194,6 +195,7 @@ void ImgS3Uploader::handleReplyUpload(QNetworkReply *reply) {
if (ConfigHandler().copyAndCloseAfterUploadEnabled()) {
QApplication::clipboard()->setText(m_imageURL.toString());
SystemNotification().sendMessage(QObject::tr("URL copied to clipboard."));
m_success = true;
close();
} else {
onUploadOk();
@@ -209,6 +211,7 @@ void ImgS3Uploader::handleReplyDeleteResource(QNetworkReply *reply) {
m_spinner->deleteLater();
if (reply->error() == QNetworkReply::NoError) {
if (ConfigHandler().copyAndCloseAfterUploadEnabled()) {
m_success = true;
SystemNotification().sendMessage(QObject::tr("File is deleted from S3"));
close();
}
@@ -351,3 +354,7 @@ void ImgS3Uploader::copyImage() {
QApplication::clipboard()->setPixmap(m_pixmap);
m_notification->showMessage(tr("Screenshot copied to clipboard."));
}
bool ImgS3Uploader::success() {
return m_success;
}

View File

@@ -42,6 +42,7 @@ public:
explicit ImgS3Uploader(QWidget *parent = nullptr);
void upload();
void deleteResource(const QString &, const QString &);
bool success();
private slots:
void handleReplyUpload(QNetworkReply *reply);
@@ -62,6 +63,7 @@ private:
// class members
private:
bool m_success;
ConfigEnterprise *m_configEnterprise;
ImgS3Settings m_s3Settings;
QString m_deleteToken;