diff --git a/src/tools/imgs3/imgs3uploader.cpp b/src/tools/imgs3/imgs3uploader.cpp index 405b554a..bc289f48 100644 --- a/src/tools/imgs3/imgs3uploader.cpp +++ b/src/tools/imgs3/imgs3uploader.cpp @@ -45,6 +45,7 @@ #include #include #include +#include ImgS3Uploader::ImgS3Uploader(const QPixmap &capture, QWidget *parent) : @@ -216,27 +217,47 @@ void ImgS3Uploader::handleReplyUpload(QNetworkReply *reply) { new QShortcut(Qt::Key_Escape, this, SLOT(close())); } -void ImgS3Uploader::handleReplyDeleteResource(QNetworkReply *reply) { - if (reply->error() == QNetworkReply::NoError) { - m_success = true; +void ImgS3Uploader::removeImagePreview() { + // remove local file + History history; + QString packedFileName = history.packFileName(SCREENSHOT_STORAGE_TYPE_S3, m_deleteToken, m_s3ImageName); + QString fullFileName = history.path() + packedFileName; - // remove local file - History history; - QString packedFileName = history.packFileName(SCREENSHOT_STORAGE_TYPE_S3, m_deleteToken, m_s3ImageName); - QString fullFileName = history.path() + packedFileName; - - QFile file(fullFileName); - if (file.exists()) { - file.remove(); - } - m_deleteToken.clear(); - m_s3ImageName.clear(); - close(); - } else { - QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); - setInfoLabelText(reply->errorString()); + QFile file(fullFileName); + if (file.exists()) { + file.remove(); } - new QShortcut(Qt::Key_Escape, this, SLOT(close())); + m_deleteToken.clear(); + m_s3ImageName.clear(); + m_success = true; +} + +void ImgS3Uploader::handleReplyDeleteResource(QNetworkReply *reply) { + auto replyError = reply->error(); + if (replyError == QNetworkReply::NoError) { + removeImagePreview(); + } else { + hide(); + + // generate error message + QString message = tr("Unable to remove screenshot from the remote storage."); + if(replyError == QNetworkReply::UnknownNetworkError) { + message += "\n" + tr("Network error"); + } + else if(replyError == QNetworkReply::UnknownServerError) { + message += "\n" + tr("Possibly it doesn't exist anymore"); + } + message += "\n\n" + reply->errorString(); + message += "\n\n" + tr("Do you want to remove screenshot from local history anyway?"); + + if (QMessageBox::Yes == QMessageBox::question(NULL, + tr("Remove screenshot from history?"), + message, + QMessageBox::Yes|QMessageBox::No)) { + removeImagePreview(); + } + } + close(); } void ImgS3Uploader::startDrag() { diff --git a/src/tools/imgs3/imgs3uploader.h b/src/tools/imgs3/imgs3uploader.h index 1689a21d..755fa01b 100644 --- a/src/tools/imgs3/imgs3uploader.h +++ b/src/tools/imgs3/imgs3uploader.h @@ -61,6 +61,7 @@ private: void uploadToS3(QJsonDocument &response); QNetworkProxy *initProxy(); void clearProxy(); + void removeImagePreview(); void onUploadOk(); diff --git a/translations/Internationalization_ca.ts b/translations/Internationalization_ca.ts index a399e6af..2d115637 100644 --- a/translations/Internationalization_ca.ts +++ b/translations/Internationalization_ca.ts @@ -474,64 +474,89 @@ Press Space to open the side panel. ImgS3Uploader - + Uploading Image S'està pujant la imatge - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Copia l'URL - + Open URL Obri l'URL - + Delete image - + Image to Clipboard. Imatge al porta-retalls. - + Unable to open the URL. No es pot obrir l'URL. - - + + URL copied to clipboard. L'URL s'ha copiat al porta-retalls. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. La captura s'ha copiat al porta-retalls. diff --git a/translations/Internationalization_de_DE.ts b/translations/Internationalization_de_DE.ts index dd706bb4..46eeec1b 100644 --- a/translations/Internationalization_de_DE.ts +++ b/translations/Internationalization_de_DE.ts @@ -477,64 +477,89 @@ Drücke die Leertaste um das Seitenmenü zu öffnen. ImgS3Uploader - + Uploading Image Bild hochladen - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL URL kopieren - + Open URL URL öffnen - + Delete image Bild löschen - + Image to Clipboard. Bild in Zwischenablage. - + Unable to open the URL. Kann URL nicht öffnen. - - + + URL copied to clipboard. URL kopiert. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Bildschirmaufnahme in Zwischenablage kopiert. diff --git a/translations/Internationalization_es.ts b/translations/Internationalization_es.ts index 4b537fa4..cd7a0859 100644 --- a/translations/Internationalization_es.ts +++ b/translations/Internationalization_es.ts @@ -477,64 +477,89 @@ Presiona Espacio para abrir el panel lateral. ImgS3Uploader - + Uploading Image Subiendo Imagen - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Copiar URL - + Open URL Abrir URL - + Delete image Borrar imagen - + Image to Clipboard. Imagen al Portapapeles. - + Unable to open the URL. No puede abrir la URL. - - + + URL copied to clipboard. URL copiada al portapapeles. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Captura copiada al portapapeles. diff --git a/translations/Internationalization_fr.ts b/translations/Internationalization_fr.ts index a2971d7a..87e34a21 100644 --- a/translations/Internationalization_fr.ts +++ b/translations/Internationalization_fr.ts @@ -477,64 +477,89 @@ Appuyer sur Espace pour ouvrir le panneau latéral. ImgS3Uploader - + Uploading Image Mise en ligne de l'image - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Copier l'URL - + Open URL Ouvrir l'URL - + Delete image - + Image to Clipboard. Image dans le Presse-papier. - + Unable to open the URL. Impossible d'ouvrir l'URL. - - + + URL copied to clipboard. URL copiée dans le Presse-papier. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Capture d'écran copiée dans le Presse-papier. diff --git a/translations/Internationalization_hu.ts b/translations/Internationalization_hu.ts index fe742731..f2cdab71 100644 --- a/translations/Internationalization_hu.ts +++ b/translations/Internationalization_hu.ts @@ -459,6 +459,26 @@ Press Space to open the side panel. Deleting image... + + Unable to remove screenshot from the remote storage. + + + + Network error + + + + Possibly it doesn't exist anymore + + + + Do you want to remove screenshot from local history anyway? + + + + Remove screenshot from history? + + ImgS3UploaderTool diff --git a/translations/Internationalization_ja.ts b/translations/Internationalization_ja.ts index c4e7f83d..98472718 100644 --- a/translations/Internationalization_ja.ts +++ b/translations/Internationalization_ja.ts @@ -477,64 +477,89 @@ Enter を押すと画面をキャプチャー。 ImgS3Uploader - + Uploading Image 画像をアップロード中 - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL URL をコピー - + Open URL URL を開く - + Delete image 画像を削除 - + Image to Clipboard. 画像をクリップボードへ。 - + Unable to open the URL. URL を開けません。 - - + + URL copied to clipboard. URL をクリップボードにコピーしました。 - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. スクリーンショットをクリップボードにコピーしました。 diff --git a/translations/Internationalization_ka.ts b/translations/Internationalization_ka.ts index 27a81861..1c32b297 100644 --- a/translations/Internationalization_ka.ts +++ b/translations/Internationalization_ka.ts @@ -473,64 +473,89 @@ Press Space to open the side panel. ImgS3Uploader - + Uploading Image სურათის ატვირთვა - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL URL-ის კოპირება - + Open URL URL-ის გახსნა - + Delete image - + Image to Clipboard. სურათის გაცვლის ბუფერში გაგზავნა - + Unable to open the URL. URL-ის გახსნა ვერ მოხერხდა. - - + + URL copied to clipboard. URL დაკოპირდა გაცვლის ბუფერში. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. სურათი დაკოპირდა გაცვლის ბუფერში. diff --git a/translations/Internationalization_nl.ts b/translations/Internationalization_nl.ts index c5dce15f..707ff682 100644 --- a/translations/Internationalization_nl.ts +++ b/translations/Internationalization_nl.ts @@ -477,64 +477,89 @@ Druk op spatie om het zijpaneel te openen. ImgS3Uploader - + Uploading Image Bezig met uploaden van afbeelding... - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL URL kopiëren - + Open URL URL openen - + Delete image Afbeelding verwijderen - + Image to Clipboard. Afbeelding naar klembord. - + Unable to open the URL. Kan URL niet openen. - - + + URL copied to clipboard. URL gekopieerd naar klembord. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Schermafdruk gekopieerd naar klembord. diff --git a/translations/Internationalization_pl.ts b/translations/Internationalization_pl.ts index 2062678b..463e41d7 100644 --- a/translations/Internationalization_pl.ts +++ b/translations/Internationalization_pl.ts @@ -476,64 +476,89 @@ Spacja, aby pokazać panel boczny. ImgS3Uploader - + Uploading Image Wysyłanie obrazka - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Kopiuj URL - + Open URL Otwórz URL - + Delete image Usuń obrazek - + Image to Clipboard. Obrazek do schowka. - + Unable to open the URL. Nie można otworzyć adresu URL. - - + + URL copied to clipboard. URL skopiowany do schowka. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Zrzut ekranu skopiowany do schowka. diff --git a/translations/Internationalization_pt_br.ts b/translations/Internationalization_pt_br.ts index ac40dbd4..ebd865af 100644 --- a/translations/Internationalization_pt_br.ts +++ b/translations/Internationalization_pt_br.ts @@ -477,64 +477,89 @@ Pressione espaço abrir o painel lateral. ImgS3Uploader - + Uploading Image Upando Imagem - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Copiar URL - + Open URL Abrir URL - + Delete image Deletar imagem - + Image to Clipboard. Imagem no Clipboard. - + Unable to open the URL. Não foi possível abrir a URL. - - + + URL copied to clipboard. URL copiada para o clipboard. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Screenshot copiada para o clipboard. diff --git a/translations/Internationalization_ru.ts b/translations/Internationalization_ru.ts index 06e8eb3c..9740eb28 100644 --- a/translations/Internationalization_ru.ts +++ b/translations/Internationalization_ru.ts @@ -431,7 +431,7 @@ Press Space to open the side panel. Show welcome message on launch - + Показывать приветствие при запуске @@ -497,17 +497,17 @@ Press Space to open the side panel. Загрузить на S3 - + Uploading Image Загрузка изображения - + Upload image to S3 Загрузить на S3 - + Delete image from S3 Удалить скриншот с S3 @@ -516,49 +516,74 @@ Press Space to open the side panel. Удалить скриншот - + + Remove screenshot from history? + Удалить скриншот из истории? + + + S3 Creds URL is not found in your configuration file Параметры доступов к S3 не найдены в конфигурационном файле - + Copy URL Скопировать URL - + Open URL Открыть URL - + Delete image Удалить изображение - + Image to Clipboard. Изображение в буфер обмена. - + Unable to open the URL. Не удалось открыть URL. - - + + URL copied to clipboard. URL скопирован в буфер обмена. - - + + Deleting image... Удаление скриншота... - + + Unable to remove screenshot from the remote storage. + Невозможно удалить снимок экрана из удаленного хранилища. + + + + Network error + Ошибка сети + + + + Possibly it doesn't exist anymore + Возможно, его больше не существует + + + + Do you want to remove screenshot from local history anyway? + Вы все равно хотите удалить скриншот из локальной истории? + + + Screenshot copied to clipboard. Снимок скопирован в буфер обмена. @@ -876,7 +901,7 @@ You can find me in the system tray. Hello, I'm here! Click icon in the tray to take a screenshot or click with a right button to see more options. - + Привет я тут! Щелкните значок на панели задач, чтобы сделать снимок экрана, или щелкните правой кнопкой, чтобы увидеть дополнительные параметры. diff --git a/translations/Internationalization_sk.ts b/translations/Internationalization_sk.ts index ba0a7e82..4ab3c556 100644 --- a/translations/Internationalization_sk.ts +++ b/translations/Internationalization_sk.ts @@ -477,64 +477,89 @@ Stlačte medzerník pre otvorenie postranného panelu. ImgS3Uploader - + Uploading Image Nahrávam obrázok - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Kopírovať URL - + Open URL Otvoriť URL - + Delete image Vymazať obrázok - + Image to Clipboard. Obrázok do schránky. - + Unable to open the URL. Nepodarilo sa otvoriť URL. - - + + URL copied to clipboard. URL skopírovaná do schránky. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Snímka obrazovky bola skopírovaná do schránky. diff --git a/translations/Internationalization_sr.ts b/translations/Internationalization_sr.ts index a2cd5498..056106bc 100644 --- a/translations/Internationalization_sr.ts +++ b/translations/Internationalization_sr.ts @@ -477,64 +477,89 @@ Press Space to open the side panel. ImgS3Uploader - + Uploading Image Објављујем слику - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL Запамти интернет адресу - + Open URL Посети интернет адресу - + Delete image Избриши слику - + Image to Clipboard. Сачувај у привремену меморију. - + Unable to open the URL. Нисам успео да посетим интернет адресу. - - + + URL copied to clipboard. Интернет адреса је сачувана у привременој меморији. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Слика је сачувана у привременој меморији. diff --git a/translations/Internationalization_tr.ts b/translations/Internationalization_tr.ts index 2a809772..70aee280 100644 --- a/translations/Internationalization_tr.ts +++ b/translations/Internationalization_tr.ts @@ -477,64 +477,89 @@ Yan paneli açmak için Boşluk tuşuna basın. ImgS3Uploader - + Uploading Image Resim Yükleniyor - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL URL Kopyala - + Open URL URL Aç - + Delete image Resmi sil - + Image to Clipboard. Resim Pano'ya. - + Unable to open the URL. URL açılamıyor. - - + + URL copied to clipboard. URL panoya kopyalandı. - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. Ekran görüntüsü panoya kopyalandı. diff --git a/translations/Internationalization_uk.ts b/translations/Internationalization_uk.ts index 5fd4fbb3..097a019d 100644 --- a/translations/Internationalization_uk.ts +++ b/translations/Internationalization_uk.ts @@ -431,7 +431,7 @@ Press Space to open the side panel. Show welcome message on launch - + Показувати привітання при запуску @@ -497,17 +497,17 @@ Press Space to open the side panel. Вивантажити на S3 - + Uploading Image Вивантаження зображення - + Upload image to S3 Завантажити на S3 - + Delete image from S3 Видалити скріншот з S3 @@ -516,49 +516,74 @@ Press Space to open the side panel. Видалити скіншот - + + Remove screenshot from history? + Видалити скріншот із історії? + + + S3 Creds URL is not found in your configuration file Параметри доступів до S3 не знайдені у конфігураціонному файлі - + Copy URL Скопіювати URL - + Open URL Відкрити URL - + Delete image Видалити зображення - + Image to Clipboard. Зображення до буферу обміну. - + Unable to open the URL. Не вдалось відкрити URL. - - + + URL copied to clipboard. URL скопійовано до буферу обміну. - - + + Deleting image... Видалення скріншоту... - + + Unable to remove screenshot from the remote storage. + Не вдалося видалити скріншот із віддаленого сховища. + + + + Network error + Помилка мережі + + + + Possibly it doesn't exist anymore + Можливо, його більше не існує + + + + Do you want to remove screenshot from local history anyway? + Ви все одно хочете видалити скріншот із локальної історії? + + + Screenshot copied to clipboard. Знімок скопійовано до буферу обміну. @@ -876,7 +901,7 @@ You can find me in the system tray. Hello, I'm here! Click icon in the tray to take a screenshot or click with a right button to see more options. - + Привіт, я тут! Клацніть піктограму в лотку, щоб зробити знімок екрана, або натисніть правою кнопкою, щоб переглянути додаткові параметри. diff --git a/translations/Internationalization_zh_CN.ts b/translations/Internationalization_zh_CN.ts index 8bed281a..477070de 100644 --- a/translations/Internationalization_zh_CN.ts +++ b/translations/Internationalization_zh_CN.ts @@ -478,64 +478,89 @@ Press Space to open the side panel. ImgS3Uploader - + Uploading Image 正在上传 - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL 复制链接 - + Open URL 打开链接 - + Delete image 删除图像 - + Image to Clipboard. 保存文件到剪贴板。 - + Unable to open the URL. 无法打开此链接。 - - + + URL copied to clipboard. 复制链接到剪贴板。 - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. 截图复制到剪贴板。 diff --git a/translations/Internationalization_zh_TW.ts b/translations/Internationalization_zh_TW.ts index 8062415b..1f182a63 100644 --- a/translations/Internationalization_zh_TW.ts +++ b/translations/Internationalization_zh_TW.ts @@ -473,64 +473,89 @@ Press Space to open the side panel. ImgS3Uploader - + Uploading Image 正在上傳 - + Upload image to S3 - + Delete image from S3 - + + Unable to remove screenshot from the remote storage. + + + + + Network error + + + + + Possibly it doesn't exist anymore + + + + + Do you want to remove screenshot from local history anyway? + + + + S3 Creds URL is not found in your configuration file - + Copy URL 複製連結 - + Open URL 打開連結 - + Delete image - + Image to Clipboard. 將檔案複製到剪貼簿 - + Unable to open the URL. 無法打開此連結 - - + + URL copied to clipboard. 連結已複製到剪貼簿 - - + + Deleting image... - + + Remove screenshot from history? + + + + Screenshot copied to clipboard. 截圖已複製到剪貼簿