From d260bee75021932934563059098ff42a5dc1123c Mon Sep 17 00:00:00 2001 From: Tsu Jan Date: Thu, 24 Oct 2019 14:24:36 +0330 Subject: [PATCH] On archiving, start with a name that has extension --- NEWS | 2 +- data/translations/arqiver.ts | 74 +++++++++++++++--------------- data/translations/arqiver_eo.ts | 74 +++++++++++++++--------------- data/translations/arqiver_nl.ts | 74 +++++++++++++++--------------- data/translations/arqiver_pl.ts | 74 +++++++++++++++--------------- data/translations/arqiver_pt_BR.ts | 74 +++++++++++++++--------------- mainWin.cpp | 20 +++++--- 7 files changed, 200 insertions(+), 192 deletions(-) diff --git a/NEWS b/NEWS index a9b2829..501de3a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ Latest version: - 18 Sep 2019, V0.3.0 + 24 Oct 2019, V0.3.0 See "ChangeLog" for changes. diff --git a/data/translations/arqiver.ts b/data/translations/arqiver.ts index 3497118..da44ae7 100644 --- a/data/translations/arqiver.ts +++ b/data/translations/arqiver.ts @@ -249,8 +249,8 @@ Clear text with the Escape key. - - + + Opening Archive... @@ -372,138 +372,138 @@ Clear text with the Escape key. - + Create Archive - - + + Question - + The following archive already exists: - + Do you want to replace it? - + Open Archive - - + + Add to Archive - - - - + + + + Adding Items... - + Removing Items... - - - - - + + + + + Extracting... - + View Current Item - + Enter Password - + Cancel - + OK - + Encrypt the file list - + This will take effect after files/folders are added. - - + + Extract Into Directory - + Some files will be overwritten. Do you want to continue? - + Link To: %1 - + A simple Qt archive manager - + based on libarchive, gzip and 7z - + Author - + aka. - - + + About Arqiver - + Translators diff --git a/data/translations/arqiver_eo.ts b/data/translations/arqiver_eo.ts index 236303d..d963e18 100644 --- a/data/translations/arqiver_eo.ts +++ b/data/translations/arqiver_eo.ts @@ -251,8 +251,8 @@ Viŝu la tekston per la eskapa klavo. - - + + Opening Archive... Malfermadi Arkivon... @@ -374,101 +374,101 @@ Viŝu la tekston per la eskapa klavo. Montri Ĉiujn Dosierojn (*) - + Create Archive Estigi Arkivon - - + + Question Demando - + The following archive already exists: La jana arkivo jam ekzistas: - + Do you want to replace it? Ĉu vi volas anstataŭigi ĝin? - + Open Archive Malfermi Arkivon - - + + Add to Archive Aldoni al Arkivon - - - - + + + + Adding Items... Aldoni Erojn... - + Removing Items... Forviŝi Erojn... - - - - - + + + + + Extracting... Ekstrakti... - + View Current Item Vidi Ĉi Tiun Eron - + Enter Password Enmetu Pasvorton - + Cancel Rezigni - + OK Bone - + Encrypt the file list Ĉifri la dosierliston - + This will take effect after files/folders are added. Ĉi tio efektiviĝos post kiam dosieroj/dosierujoj estas aldonitaj. - - + + Extract Into Directory Ekstrakto en Dosierujon - + Some files will be overwritten. Do you want to continue? @@ -477,38 +477,38 @@ Do you want to continue? - + Link To: %1 Ligilo Al %1 - + A simple Qt archive manager Simpla Qt-Arkivilo - + based on libarchive, gzip and 7z bazita sur libarchive, gzip kaj 7z - + Author Verkinto - + aka. akk. - - + + About Arqiver Pri Arqiver - + Translators Tradukintoj diff --git a/data/translations/arqiver_nl.ts b/data/translations/arqiver_nl.ts index 1e3a3cb..99d6b53 100644 --- a/data/translations/arqiver_nl.ts +++ b/data/translations/arqiver_nl.ts @@ -250,8 +250,8 @@ Clear text with the Escape key. - - + + Opening Archive... Bezig met openen van archief... @@ -373,139 +373,139 @@ Clear text with the Escape key. Alle bestanden tonen (*) - + Create Archive Archief creëren - - + + Question Vraag - + The following archive already exists: Het volgende archief bestaat al: - + Do you want to replace it? Wil je dit vervangen? - + Open Archive Archief openen - - + + Add to Archive Toevoegen aan archief - - - - + + + + Adding Items... Bezig met toevoegen van items... - + Removing Items... Bezig met verwijderen van items... - - - - - + + + + + Extracting... Bezig met uitpakken... - + View Current Item Huidig item tonen - + Enter Password Voer wachtwoord in - + Cancel Annuleren - + OK Oké - + Encrypt the file list Bestandslijst versleutelen - + This will take effect after files/folders are added. Dit wordt toegepast na het toevoegen van bestanden/mappen. - - + + Extract Into Directory Uitpakken naar map - + Some files will be overwritten. Do you want to continue? - + Link To: %1 Link naar: %1 - + A simple Qt archive manager Een eenvoudige Qt-archiefbeheerder - + based on libarchive, gzip and 7z gebaseerd op libarchive, gzip en 7z - + Author Maker - + aka. ook bekend als - - + + About Arqiver Over Arqiver - + Translators Vertalers diff --git a/data/translations/arqiver_pl.ts b/data/translations/arqiver_pl.ts index 58417a5..a711573 100644 --- a/data/translations/arqiver_pl.ts +++ b/data/translations/arqiver_pl.ts @@ -250,8 +250,8 @@ Clear text with the Escape key. - - + + Opening Archive... Otwieranie archiwum… @@ -373,139 +373,139 @@ Clear text with the Escape key. Pokaż wszystkie pliki (*) - + Create Archive Utwórz archiwum - - + + Question Pytanie - + The following archive already exists: Następujące archiwum już istnieje: - + Do you want to replace it? Czy chcesz je zamienić? - + Open Archive Otwórz archiwum - - + + Add to Archive Dodaj do archiwum - - - - + + + + Adding Items... Dodawanie elementów… - + Removing Items... Usuwanie elementów… - - - - - + + + + + Extracting... Rozpakowywanie… - + View Current Item Pokaż obecny element - + Enter Password Wprowadź hasło - + Cancel Anuluj - + OK OK - + Encrypt the file list Szyfruj listę plików - + This will take effect after files/folders are added. Efekt będzie widoczny po dodaniu nowych plików/katalogów. - - + + Extract Into Directory Rozpakuj do katalogu - + Some files will be overwritten. Do you want to continue? - + Link To: %1 Odnośnik do: %1 - + A simple Qt archive manager Prosty menedżer archiwum Qt - + based on libarchive, gzip and 7z oparty o libarchive, gzip i 7z - + Author Autor - + aka. aka. - - + + About Arqiver O Arqiver - + Translators Tłumacze diff --git a/data/translations/arqiver_pt_BR.ts b/data/translations/arqiver_pt_BR.ts index c3c56b4..021276b 100644 --- a/data/translations/arqiver_pt_BR.ts +++ b/data/translations/arqiver_pt_BR.ts @@ -250,8 +250,8 @@ Clear text with the Escape key. - - + + Opening Archive... Abrindo Arquivo... @@ -373,100 +373,100 @@ Clear text with the Escape key. Exibir Todos os Arquivos (*) - + Create Archive Criar Arquivo - - + + Question Questão - + The following archive already exists: O seguinte arquivo já existe: - + Do you want to replace it? Deseja substituir esse arquivo? - + Open Archive Abrir Arquivo - - + + Add to Archive Adicionar ao Arquivo - - - - + + + + Adding Items... Adicionando Itens... - + Removing Items... Removendo Itens... - - - - - + + + + + Extracting... Extraindo... - + View Current Item Exibir Item Atual - + Enter Password Digite a Senha - + Cancel Cancelar - + OK Ok - + Encrypt the file list Criptografar a lista de arquivos - + This will take effect after files/folders are added. Isso entrará em vigor depois que os arquivos/pastas forem adicionados. - - + + Extract Into Directory Extrair no Diretório - + Some files will be overwritten. Do you want to continue? @@ -474,38 +474,38 @@ Do you want to continue? Deseja continuar? - + Link To: %1 Link Para: %1 - + A simple Qt archive manager Um simples gerenciador de arquivos Qt - + based on libarchive, gzip and 7z baseado em libarchive, gzip e 7z - + Author Autor - + aka. aka. - - + + About Arqiver Sobre Arqiver - + Translators Tradutores diff --git a/mainWin.cpp b/mainWin.cpp index 1b228c3..b9cfb6c 100644 --- a/mainWin.cpp +++ b/mainWin.cpp @@ -509,6 +509,7 @@ void mainWin::newArchive() { QString file; QString path; + QString ext = (lastFilter_.isEmpty() ? ".tar.gz" : filterToExtension(lastFilter_)); if (!saFileList_.isEmpty()) { path = QFile::exists(saFileList_.at(0)) && QFileInfo(saFileList_.at(0)).isDir() ? saFileList_.at(0) + (lastFilter_.isEmpty() @@ -522,8 +523,10 @@ void mainWin::newArchive() { /* KDE's buggy file dialog needs a directory path here */ path.isEmpty() ? lastPath_ : path.section("/", 0, -2), archivingTypes()); - if (!path.isEmpty()) + if (!path.isEmpty()) { // add an appropriate extension + path += ext; dlg.selectFile(path); + } dlg.setAcceptMode(QFileDialog::AcceptSave); dlg.setFileMode(QFileDialog::AnyFile); dlg.selectNameFilter(lastFilter_); @@ -536,12 +539,11 @@ void mainWin::newArchive() { else return; // with auto-archiving, the application will exit because its main window isn't shown if (file.isEmpty()) return; QRegularExpressionMatch match; - int indx = file.indexOf(archivingExt, 0, &match); + int indx = file.lastIndexOf(archivingExt, -1, &match); if (indx > 0 && indx + match.capturedLength() == file.length()) retry = false; // the input had an acceptable extension else { - file += (lastFilter_.isEmpty() ? ".tar.gz" : filterToExtension(lastFilter_)); - if (QFile::exists(file)) { + if (QFile::exists(file + ext)) { QMessageBox::StandardButton btn = QMessageBox::question(this, tr("Question"), tr("The following archive already exists:") @@ -549,9 +551,15 @@ void mainWin::newArchive() { + tr("Do you want to replace it?\n")); if (btn == QMessageBox::No) path = file; - else retry = false; + else { + file += ext; + retry = false; + } + } + else { + file += ext; + retry = false; } - else retry = false; } }