diff --git a/.travis.yml b/.travis.yml
index df7f8ed585..942bb426d3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,8 +15,8 @@ compiler:
- gcc
env:
- - CONFIG=Release ASAN_OPTIONS=detect_odr_violation=1:leak_check_at_exit=0
- - CONFIG=Debug ASAN_OPTIONS=detect_odr_violation=1:leak_check_at_exit=0
+ - CONFIG=Release ASAN_OPTIONS=detect_odr_violation=1
+ - CONFIG=Debug ASAN_OPTIONS=detect_odr_violation=1
git:
depth: 3
@@ -37,7 +37,7 @@ script:
- cmake -DCMAKE_BUILD_TYPE=${CONFIG} -DWITH_GUI_TESTS=ON -DWITH_ASAN=ON -DWITH_XC_HTTP=ON -DWITH_XC_AUTOTYPE=ON -DWITH_XC_YUBIKEY=ON $CMAKE_ARGS ..
- make -j2
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then make test ARGS+="-E testgui --output-on-failure"; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then xvfb-run -a --server-args="-screen 0 800x600x24" make test ARGS+="-R testgui --output-on-failure"; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ]; then ASAN_OPTIONS=${ASAN_OPTIONS}:leak_check_at_exit=0 xvfb-run -a --server-args="-screen 0 800x600x24" make test ARGS+="-R testgui --output-on-failure"; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then make test ARGS+="--output-on-failure"; fi
# Generate snapcraft build when merging into master/develop branches
diff --git a/AppImage-Recipe.sh b/AppImage-Recipe.sh
index c421aa79e6..a5124a74b2 100755
--- a/AppImage-Recipe.sh
+++ b/AppImage-Recipe.sh
@@ -66,10 +66,6 @@ get_apprun
copy_deps
delete_blacklisted
-# remove dbus and systemd libs as they are not blacklisted
-find . -name libdbus-1.so.3 -exec rm {} \;
-find . -name libsystemd.so.0 -exec rm {} \;
-
get_desktop
get_icon
cat << EOF > ./usr/bin/keepassxc_env
@@ -89,14 +85,15 @@ else
fi
EOF
chmod +x ./usr/bin/keepassxc_env
-sed -i 's/Exec=keepassxc/Exec=keepassxc_env/' org.keepassxc.desktop
-get_desktopintegration $LOWERAPP
-
-GLIBC_NEEDED=$(glibc_needed)
+sed -i 's/Exec=keepassxc/Exec=keepassxc_env/' org.${LOWERAPP}.${APP}.desktop
+get_desktopintegration "org.${LOWERAPP}.${APP}"
cd ..
-generate_type2_appimage
+GLIBC_NEEDED=$(glibc_needed)
+NO_GLIBC_VERSION=true
+
+generate_type2_appimage -u "gh-releases-zsync|keepassxreboot|keepassxc|latest|KeePassXC-*-${ARCH}.AppImage.zsync"
-mv ../out/*.AppImage ../KeePassXC-${VERSION}-${ARCH}.AppImage
-rmdir ../out > /dev/null 2>&1
+mv ../out/*.AppImage* ../
+rm -rf ../out
diff --git a/CHANGELOG b/CHANGELOG
index 3719f8e4c6..931b86a83b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+2.2.3 (2017-12-11)
+=========================
+
+- Prevent database corruption when locked [#1219]
+- Fixes apply button not saving new entries [#1141]
+- Switch to Consolas font on Windows for password edit [#1229]
+- Multiple fixes to AppImage deployment [#1115, #1228]
+- Fixes multiple memory leaks [#1213]
+- Resize message close to 16x16 pixels [#1253]
+
2.2.2 (2017-10-22)
=========================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 63281f93b7..869da31769 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,7 +49,7 @@ set(CMAKE_AUTOUIC ON)
set(KEEPASSXC_VERSION_MAJOR "2")
set(KEEPASSXC_VERSION_MINOR "2")
-set(KEEPASSXC_VERSION_PATCH "2")
+set(KEEPASSXC_VERSION_PATCH "3")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${KEEPASSXC_VERSION_PATCH}")
# Distribution info
diff --git a/Dockerfile b/Dockerfile
index 6f7ace34c4..a5966be39e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,67 +14,49 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-FROM centos:7
+FROM ubuntu:14.04
-RUN set -x \
- && curl "https://copr.fedorainfracloud.org/coprs/bugzy/keepassxc/repo/epel-7/bugzy-keepassxc-epel-7.repo" \
- > /etc/yum.repos.d/bugzy-keepassxc-epel-7.repo
+ENV QT5_VERSION=59
+ENV QT5_PPA_VERSION=${QT5_VERSION}2
RUN set -x \
- && curl "https://copr.fedorainfracloud.org/coprs/sic/backports/repo/epel-7/sic-backports-epel-7.repo" \
- > /etc/yum.repos.d/sic-backports-epel-7.repo
+ && apt-get update -y \
+ && apt-get -y install software-properties-common
RUN set -x \
- && yum clean -y all \
- && yum upgrade -y
+ && add-apt-repository ppa:beineri/opt-qt${QT5_PPA_VERSION}-trusty \
+ && add-apt-repository ppa:phoerious/keepassxc
-# build and runtime dependencies
RUN set -x \
- && yum install -y \
- make \
- automake \
- gcc-c++ \
- cmake \
- libgcrypt16-devel \
- qt5-qtbase-devel \
- qt5-linguist \
- qt5-qttools \
- zlib-devel \
- qt5-qtx11extras \
- qt5-qtx11extras-devel \
- libXi-devel \
- libXtst-devel
+ && apt-get update -y \
+ && apt-get upgrade -y
-# AppImage dependencies
+# build and runtime dependencies
RUN set -x \
- && yum install -y \
- wget \
- fuse-libs
-
-# build libyubikey
-ENV YUBIKEY_VERSION=1.13
-RUN set -x && yum install -y libusb-devel
+ && apt-get install -y \
+ cmake3 \
+ g++ \
+ libgcrypt20-dev \
+ qt${QT5_VERSION}base \
+ qt${QT5_VERSION}tools \
+ qt${QT5_VERSION}x11extras \
+ zlib1g-dev \
+ libxi-dev \
+ libxtst-dev \
+ mesa-common-dev \
+ libyubikey-dev \
+ libykpers-1-dev
+
+ENV CMAKE_PREFIX_PATH=/opt/qt${QT5_VERSION}/lib/cmake
+ENV LD_LIBRARY_PATH=/opt/qt${QT5_VERSION}/lib
RUN set -x \
- && wget "https://developers.yubico.com/yubico-c/Releases/libyubikey-${YUBIKEY_VERSION}.tar.gz" \
- && tar xf libyubikey-${YUBIKEY_VERSION}.tar.gz \
- && cd libyubikey-${YUBIKEY_VERSION} \
- && ./configure --prefix=/usr --libdir=/usr/lib64 \
- && make \
- && make install \
- && cd .. \
- && rm -Rf libyubikey-${YUBIKEY_VERSION}*
+ && echo /opt/qt${QT_VERSION}/lib > /etc/ld.so.conf.d/qt${QT5_VERSION}.conf
-# build libykpers-1
-ENV YKPERS_VERSION=1.18.0
+# AppImage dependencies
RUN set -x \
- && wget "https://developers.yubico.com/yubikey-personalization/Releases/ykpers-${YKPERS_VERSION}.tar.gz" \
- && tar xf ykpers-${YKPERS_VERSION}.tar.gz \
- && cd ykpers-${YKPERS_VERSION} \
- && ./configure --prefix=/usr --libdir=/usr/lib64 \
- && make \
- && make install \
- && cd .. \
- && rm -Rf ykpers-${YKPERS_VERSION}*
+ && apt-get install -y \
+ libfuse2 \
+ wget
VOLUME /keepassxc/src
VOLUME /keepassxc/out
diff --git a/share/icons/application/16x16/actions/message-close.png b/share/icons/application/16x16/actions/message-close.png
index 4b2f9ca4d7..b3a44a232b 100644
Binary files a/share/icons/application/16x16/actions/message-close.png and b/share/icons/application/16x16/actions/message-close.png differ
diff --git a/share/linux/org.keepassxc.appdata.xml b/share/linux/org.keepassxc.appdata.xml
index 563450a4fc..1bada33006 100644
--- a/share/linux/org.keepassxc.appdata.xml
+++ b/share/linux/org.keepassxc.appdata.xml
@@ -1,5 +1,5 @@
-
+Copyright 2017 KeePassXC Team -->
org.keepassxc
KeePassXC
@@ -67,6 +67,18 @@
+
+
+
+ - Prevent database corruption when locked [#1219]
+ - Fixes apply button not saving new entries [#1141]
+ - Switch to Consolas font on Windows for password edit [#1229]
+ - Multiple fixes to AppImage deployment [#1115, #1228]
+ - Fixes multiple memory leaks [#1213]
+ - Resize message close to 16x16 pixels [#1253]
+
+
+
@@ -85,7 +97,8 @@
- Fixed screen lock and Google fallback settings [#1029]
-
+
+
- Corrected multiple snap issues [#934, #1011]
diff --git a/share/translations/keepassx_de.ts b/share/translations/keepassx_de.ts
index 2fd20f04a2..f3bd0e39fe 100644
--- a/share/translations/keepassx_de.ts
+++ b/share/translations/keepassx_de.ts
@@ -571,7 +571,7 @@ Sie können sie speichern oder die Sperre freigeben.
Do you want to save the database before locking it?
Otherwise your changes are lost.
Dieses Datenbank wurde geändert.
-Soll sie gespeichert werden bevor sie gesperrt wirt?
+Soll sie gespeichert werden bevor sie gesperrt wird?
Anderenfalls gehen Ihre Änderungen verloren.
diff --git a/share/translations/keepassx_es.ts b/share/translations/keepassx_es.ts
index f8176b8078..4792848981 100644
--- a/share/translations/keepassx_es.ts
+++ b/share/translations/keepassx_es.ts
@@ -69,7 +69,7 @@ Núcleo: %3 %4
-
+ Distribución: %1
@@ -250,7 +250,7 @@ Por favor seleccione si desea autorizar su acceso.
- Codificación
+ Códec
@@ -302,11 +302,11 @@ Por favor seleccione si desea autorizar su acceso.
- Datos originales:
+ Dato original:
- ¡Se detectaron errores en el archivo CSV!
+ ¡Error(es) detectado(s) en el archivo CSV!
@@ -728,7 +728,7 @@ Do you want to open it anyway?
- Solicitud de unión
+ Solicitud de Unión
@@ -744,7 +744,7 @@ Do you want to open it anyway?
- ¿Está seguro(a) que quiere permanentemente eliminar todo de su papelera de reciclaje?
+ ¿Está seguro que quiere eliminar permanentemente todo de su papelera de reciclaje?
@@ -795,7 +795,7 @@ Do you want to open it anyway?
- Seleccionar archivo llave
+ Seleccionar archivo
@@ -817,11 +817,11 @@ Do you want to open it anyway?
- %n semana%n semanas
+ %n semana%n semana(s)
- %n mes%n meses
+ %n mes%n mes(es)
@@ -969,7 +969,7 @@ Do you want to open it anyway?
- Predeterminado
+ Programar
@@ -1098,7 +1098,7 @@ Do you want to open it anyway?
-
+ El icono personalizado ya existe
@@ -1352,7 +1352,7 @@ Esta migración es en único sentido. No podrá abrir la base de datos importada
-
+ El archivo de bloqueo de instancia única existente no es válido. Lanzando nueva instancia.
@@ -1483,7 +1483,7 @@ Esta migración es en único sentido. No podrá abrir la base de datos importada
- Contraseña programada de único uso (TOTP)
+ Contraseña programada de único uso
diff --git a/share/translations/keepassx_fr.ts b/share/translations/keepassx_fr.ts
index 90580e146e..f3fa019202 100644
--- a/share/translations/keepassx_fr.ts
+++ b/share/translations/keepassx_fr.ts
@@ -29,27 +29,27 @@
- Revision: %1
+ Révision : %1
- Bibliothèques:
+ Bibliothèques :
- Système d'exploitation: %1
-Architecture CPU: %2
-Kernel: %3 %4
+ Système d'exploitation : %1
+Architecture CPU : %2
+Kernel : %3 %4
- Extensions activées:
+ Extensions activées :
- Signaler les bugs sur: <a href="https://github.com/keepassxreboot/keepassxc/issues" style="text-decoration: underline;">https://github.com</a>
+ Signaler les bugs sur : <a href="https://github.com/keepassxreboot/keepassxc/issues" style="text-decoration: underline;">https://github.com</a>
@@ -57,7 +57,7 @@ Kernel: %3 %4
- Mainteneurs du projet:
+ Mainteneurs du projet :
@@ -65,11 +65,11 @@ Kernel: %3 %4
- Inclure l'information suivante lorsque vous signaler un bug:
+ Inclure l'information suivante lorsque vous signaler un bug :
-
+ Distribution : %1
@@ -302,7 +302,7 @@ Veuillez sélectionner si vous souhaitez autoriser l’accès.
- Données originales:
+ Données originales :
@@ -397,7 +397,7 @@ Veuillez sélectionner si vous souhaitez autoriser l’accès.
- Challenge-réponse:
+ Challenge-réponse :
@@ -477,15 +477,15 @@ Vous pouvez maintenant la sauvegarder.
- AES: 256 Bits (par défault)
+ AES : 256 Bits (par défaut)
- Twofish: 256 bits
+ Twofish : 256 bits
- Algorithme:
+ Algorithme :
@@ -737,7 +737,7 @@ Voulez vous l'ouvrir quand même ?
- La nouvelle base de données ne peux être ouverte pendant qu'un rafraîchissement automatique de l'actuelle est en cours.
+ La nouvelle base de données ne peut être ouverte pendant qu'un rafraîchissement automatique de l'actuelle est en cours.
@@ -1095,11 +1095,11 @@ Voulez vous l'ouvrir quand même ?
- Astuce: Vous pouvez activer Google en tant que repli sous Outils>Paramètres>Sécurité
+ Astuce : Vous pouvez activer Google en tant que repli sous Outils>Paramètres>Sécurité
-
+ L'icône personnalisée existe déjà
@@ -1175,7 +1175,7 @@ Voulez vous l'ouvrir quand même ?
Reference abbreviation
- Réf:
+ Réf :
@@ -1353,7 +1353,7 @@ Il s'agit d'une migration à sens unique. Vous ne pourrez pas ouvrir l
-
+ Le fichier de verrouillage de l’instance unique existant n’est pas valide. Lancement d'une nouvelle instance.
@@ -1647,11 +1647,11 @@ Il s'agit d'une migration à sens unique. Vous ne pourrez pas ouvrir l
- Port HTTP:
+ Port HTTP :
- Port par défaut: 19455
+ Port par défaut : 19455
@@ -1681,7 +1681,7 @@ Restauration du port 19455 par défaut.
- & Retourne les champs avancés de type chaîne qui commencent par "KPH:"
+ & Retourne les champs avancés de type chaîne qui commencent par "KPH :"
@@ -1774,7 +1774,7 @@ Ne les changez que si vous savez ce que vous faites.
- &Longueur:
+ &Longueur :
@@ -1794,11 +1794,11 @@ Ne les changez que si vous savez ce que vous faites.
- Entropie: %1 bit
+ Entropie : %1 bit
- Qualité du mot de passe: %1
+ Qualité du mot de passe : %1
@@ -1830,15 +1830,15 @@ Ne les changez que si vous savez ce que vous faites.
- Liste de mots:
+ Liste de mots :
- Nombre de mots:
+ Nombre de mots :
- Séparateur de mot:
+ Séparateur de mot :
@@ -2019,7 +2019,7 @@ Veuillez déverrouiller la base de données sélectionnée ou en choisir une qui
- KeePassXC: nouvelle demande d'association
+ KeePassXC : nouvelle demande d'association
- KeePassXC: Écraser la clé existante ?
+ KeePassXC : Écraser la clé existante ?
- KeePassXC: Mettre à jour l'entrée
+ KeePassXC : Mettre à jour l'entrée
- KeePassXC: Base de données verrouillée !
+ KeePassXC : Base de données verrouillée !
- KeePassXC: Les clés ont été effacées de la base de donnée
+ KeePassXC : Les clés ont été effacées de la base de donnée
- KeePassXC: Aucune clé trouvée
+ KeePassXC : Aucune clé trouvée
@@ -2055,11 +2055,11 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- KeePassXC: Permissions retirées
+ KeePassXC : Permissions retirées
- KeePassXC: Aucune entrée avec permissions trouvée !
+ KeePassXC : Aucune entrée avec permissions trouvée !
@@ -2145,7 +2145,7 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- Ne pas indiquer la base de données comme modifiée pour les changements hors-données (par exemple: groupes développés)
+ Ne pas indiquer la base de données comme modifiée pour les changements hors-données (par exemple : groupes développés)
@@ -2227,7 +2227,7 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- Clé:
+ Clé :
@@ -2235,11 +2235,11 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- Attention: modifiez ces paramètres seulement si vous savez ce que vous faites.
+ Attention : modifiez ces paramètres seulement si vous savez ce que vous faites.
- Période de temps:
+ Période de temps :
@@ -2251,7 +2251,7 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- Taille du code:
+ Taille du code :
@@ -2375,7 +2375,7 @@ attribuez lui un nom unique pour l'identifier et acceptez la.
- Chemin du groupe à lister. Par défaut: /
+ Chemin du groupe à lister. Par défaut : /
diff --git a/share/translations/keepassx_id.ts b/share/translations/keepassx_id.ts
index f7db658d2b..1e04aeb4c1 100644
--- a/share/translations/keepassx_id.ts
+++ b/share/translations/keepassx_id.ts
@@ -69,7 +69,7 @@ Kernel: %3 %4
-
+ Distribusi: %1
diff --git a/share/translations/keepassx_it.ts b/share/translations/keepassx_it.ts
index 5125a8b63b..582d189705 100644
--- a/share/translations/keepassx_it.ts
+++ b/share/translations/keepassx_it.ts
@@ -131,7 +131,7 @@ Seleziona se vuoi consentire l'accesso.
- KeePassXC - Auto completamento
+ KeePassXC - Auto completamento
@@ -170,7 +170,7 @@ Seleziona se vuoi consentire l'accesso.
- Impossibile creare file chiave:
+ Impossibile creare file chiave:
@@ -290,11 +290,11 @@ Seleziona se vuoi consentire l'accesso.
- Nome campo vuoto
+ Nome campo vuoto
- colonna
+ colonna
@@ -302,7 +302,7 @@ Seleziona se vuoi consentire l'accesso.
- Dati originali:
+ Dati originali:
@@ -1917,23 +1917,23 @@ Modificale solo se sai quello che stai facendo.
QtIOCompressor
- Errore interno di zlib durante la compressione:
+ Errore interno di zlib durante la compressione:
- Errore durante la scrittura nel dispositivo:
+ Errore durante la scrittura nel dispositivo:
- Errore durante l'apertura dal dispositivo:
+ Errore durante l'apertura dal dispositivo:
- Errore durante la lettura dal dispositivo:
+ Errore durante la lettura dal dispositivo:
- Errore interno di zlib durante la decompressione:
+ Errore interno di zlib durante la decompressione:
@@ -1944,7 +1944,7 @@ Modificale solo se sai quello che stai facendo.
- Errore interno di zlib:
+ Errore interno di zlib:
@@ -2018,7 +2018,7 @@ Sblocca il database selezionato o scegli un altro database sbloccato.
- KeePassXC: Nuova richiesta di associazione chiave
+ KeePassXC: Nuova richiesta di associazione chiave
- ms
+ ms
@@ -2179,7 +2179,7 @@ imposta un nome unico per identificarla ed accettarla.
- sec
+ sec
@@ -2254,7 +2254,7 @@ imposta un nome unico per identificarla ed accettarla.
- sec
+ sec
diff --git a/share/translations/keepassx_ja.ts b/share/translations/keepassx_ja.ts
index 28b7c53368..dd349640f7 100644
--- a/share/translations/keepassx_ja.ts
+++ b/share/translations/keepassx_ja.ts
@@ -69,7 +69,7 @@ CPU アーキテクチャ: %2
-
+ 配布形式: %1
diff --git a/share/translations/keepassx_ko.ts b/share/translations/keepassx_ko.ts
index 0b528474d4..9b00bbc2f1 100644
--- a/share/translations/keepassx_ko.ts
+++ b/share/translations/keepassx_ko.ts
@@ -69,7 +69,7 @@ CPU 아키텍처: %2
-
+ 배포판: %1
@@ -1096,7 +1096,7 @@ Do you want to open it anyway?
-
+ 사용자 정의 아이콘이 이미 존재함
@@ -1350,7 +1350,7 @@ This is a one-way migration. You won't be able to open the imported databas
-
+ 존재하는 단일 인스턴스 잠금 파일이 잘못되었습니다. 새 인스턴스를 실행합니다.
diff --git a/share/translations/keepassx_ru.ts b/share/translations/keepassx_ru.ts
index 938d5eefdf..3058bcf149 100644
--- a/share/translations/keepassx_ru.ts
+++ b/share/translations/keepassx_ru.ts
@@ -69,7 +69,7 @@ Kernel: %3 %4
-
+ Дистрибутив: %1
@@ -219,7 +219,7 @@ Please select whether you want to allow access.
- Заменить имя пользователя и пароль к ссылкам
+ Использовать ссылки для имени пользователя и пароля
@@ -227,7 +227,7 @@ Please select whether you want to allow access.
- Добавить' - Клонировать' в заголовок
+ Добавить к названию « - клон»
@@ -579,7 +579,7 @@ Otherwise your changes are lost.
- «%1» в режиме редактирования.
+ «%1» в режиме правки.
Отменить изменения и всё равно закрыть?
@@ -741,7 +741,7 @@ Do you want to open it anyway?
- Корзина пустая?
+ Очистить корзину?
@@ -784,7 +784,7 @@ Do you want to open it anyway?
- Редактировать запись
+ Править запись
@@ -838,7 +838,7 @@ Do you want to open it anyway?
- [Защищён] Нажмите для открытия просмотра или редактирования
+ [Защищён] Нажмите для открытия просмотра или правки
@@ -853,7 +853,7 @@ Do you want to open it anyway?
- Добавить
+ Создать
@@ -946,7 +946,7 @@ Do you want to open it anyway?
EditEntryWidgetMain
- Заголовок:
+ Название:
@@ -997,7 +997,7 @@ Do you want to open it anyway?
- Редактировать группу
+ Править группу
@@ -1095,22 +1095,22 @@ Do you want to open it anyway?
- Подсказка: вы можете включить Google в качестве резервного копирования в меню «Инструменты»> «Настройки»> «Безопасность»
+ Подсказка: в качестве резервного варианта для получения значков сайтов возможно использовать Google. Включите этот параметр в меню «Инструменты» -> «Настройки» -> «Безопасность»
-
+ Пользовательский значок уже существует
EditWidgetProperties
- Создано:
+ Создание:
- Изменено:
+ Изменение:
@@ -1125,7 +1125,7 @@ Do you want to open it anyway?
Entry
- - Клонировать
+ - клон
@@ -1143,7 +1143,7 @@ Do you want to open it anyway?
- Заголовок
+ Имя записи
@@ -1162,7 +1162,7 @@ Do you want to open it anyway?
- Заголовок
+ Имя записи
@@ -1353,7 +1353,7 @@ This is a one-way migration. You won't be able to open the imported databas
-
+ Запускается новый экземпляр программы, т.к. файл блокировки запуска повреждён.
@@ -1452,11 +1452,11 @@ This is a one-way migration. You won't be able to open the imported databas
- &Добавить новую запись
+ &Создать запись
- &Посмотреть/редактировать запись
+ &Открыть/править запись
@@ -1464,11 +1464,11 @@ This is a one-way migration. You won't be able to open the imported databas
- &Добавить новую группу
+ &Создать группу
- &Редактировать группу
+ &Править группу
@@ -1524,7 +1524,7 @@ This is a one-way migration. You won't be able to open the imported databas
- &Заголовок
+ &Имя записи
@@ -1556,7 +1556,7 @@ This is a one-way migration. You won't be able to open the imported databas
- Корзина пустая
+ Очистить корзину
@@ -1701,15 +1701,15 @@ Using default port 19455.
- &Возврат только наиболее совпадающих записей
+ &Показывать только лучшие совпадения
- Возвращаются только записи с той же схемой (http: //, https: //, ftp: //, ...).
+ Будут отобраны только записи с совпадающим протоколом (http://, https://, ftp://, ...).
- &Совпадения схем адресов
+ &Проверять протокол
@@ -1879,7 +1879,7 @@ Change them only if you know what you are doing.
- Заголовок
+ Имя записи
@@ -2085,7 +2085,7 @@ give it a unique name to identify and accept it.
SettingsWidgetGeneral
- Помнить последнюю базу данных
+ Запоминать последнюю базу данных
@@ -2117,7 +2117,7 @@ give it a unique name to identify and accept it.
- При сворачивании прятать окно в системный лоток
+ При сворачивании скрывать окно в системный лоток
@@ -2129,7 +2129,7 @@ give it a unique name to identify and accept it.
- Прятать окно в системный лоток вместо выхода
+ Скрывать окно в системный лоток вместо выхода
@@ -2141,11 +2141,11 @@ give it a unique name to identify and accept it.
- Помнить последние ключевые файлы и ключи безопасности
+ Запоминать последние использованные файлы ключей и устройства
- Не помечать базу данных как измененную без изменения данных (например, для расширения групп)
+ Не помечать базу данных изменённой при действиях, не связанных с изменением данных (например, при распахивании групп)
@@ -2153,7 +2153,7 @@ give it a unique name to identify and accept it.
- Использовать URL и заголовок записи при сопоставлении окон для глобального автоввода
+ Использовать для поиска URL и название записи
@@ -2184,7 +2184,7 @@ give it a unique name to identify and accept it.
- Заблокировать базу данных после неактивности длительностью
+ Блокировать базу данных при отсутствии активности длительностью
@@ -2192,7 +2192,7 @@ give it a unique name to identify and accept it.
- Блокировать базу данных после сворачивания окна
+ Блокировать базу данных при сворачивания окна
@@ -2216,7 +2216,7 @@ give it a unique name to identify and accept it.
- Использовать Google как резерв для загрузки значков веб-сайтов
+ Использовать Google в качестве резервного варианта для получения значков веб-сайтов
diff --git a/share/translations/keepassx_zh_TW.ts b/share/translations/keepassx_zh_TW.ts
index 0dbabb3ab0..54614e5cc9 100644
--- a/share/translations/keepassx_zh_TW.ts
+++ b/share/translations/keepassx_zh_TW.ts
@@ -69,7 +69,7 @@ Kernel: %3 %4
-
+ 散佈:%1
@@ -196,7 +196,7 @@ Please select whether you want to allow access.
-
+ 挑戰回應
@@ -208,7 +208,7 @@ Please select whether you want to allow access.
-
+ 挑戰主金鑰失敗:沒有插入 YubiKey
@@ -397,7 +397,7 @@ Please select whether you want to allow access.
-
+ 挑戰驗證:
@@ -1098,7 +1098,7 @@ Do you want to open it anyway?
-
+ 自訂圖示已經存在
@@ -2140,7 +2140,7 @@ give it a unique name to identify and accept it.
- 記住最近的金鑰檔案與安全加密狗
+ 記住最近的金鑰檔案與安全鎖
diff --git a/snapcraft.yaml b/snapcraft.yaml
index 0d69941ac2..051fcebac8 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,5 +1,5 @@
name: keepassxc
-version: 2.2.2
+version: 2.2.3
grade: stable
summary: Community-driven port of the Windows application “KeePass Password Safe”
description: |
diff --git a/src/crypto/SymmetricCipherGcrypt.cpp b/src/crypto/SymmetricCipherGcrypt.cpp
index e600a7edba..1805afb0ba 100644
--- a/src/crypto/SymmetricCipherGcrypt.cpp
+++ b/src/crypto/SymmetricCipherGcrypt.cpp
@@ -86,6 +86,8 @@ bool SymmetricCipherGcrypt::init()
gcry_error_t error;
+ if(m_ctx != nullptr)
+ gcry_cipher_close(m_ctx);
error = gcry_cipher_open(&m_ctx, m_algo, m_mode, 0);
if (error != 0) {
setErrorString(error);
diff --git a/src/format/KeePass2Repair.cpp b/src/format/KeePass2Repair.cpp
index 81ada2fda5..8d18457d40 100644
--- a/src/format/KeePass2Repair.cpp
+++ b/src/format/KeePass2Repair.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Felix Geyer
+ * Copyright (C) 2017 KeePassXC Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,36 +19,29 @@
#include "KeePass2Repair.h"
#include
+#include
#include
#include "format/KeePass2RandomStream.h"
#include "format/KeePass2Reader.h"
#include "format/KeePass2XmlReader.h"
-KeePass2Repair::KeePass2Repair()
- : m_db(nullptr)
+KeePass2Repair::RepairOutcome KeePass2Repair::repairDatabase(QIODevice* device, const CompositeKey& key)
{
-}
-
-KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, const CompositeKey& key)
-{
- m_db = nullptr;
m_errorStr.clear();
KeePass2Reader reader;
reader.setSaveXml(true);
- Database* db = reader.readDatabase(device, key, true);
+ QScopedPointer db(reader.readDatabase(device, key, true));
if (!reader.hasError()) {
- delete db;
- return NothingTodo;
+ return qMakePair(NothingTodo, nullptr);
}
QByteArray xmlData = reader.xmlData();
if (!db || xmlData.isEmpty()) {
- delete db;
m_errorStr = reader.errorString();
- return UnableToOpen;
+ return qMakePair(UnableToOpen, nullptr);
}
bool repairAction = false;
@@ -59,8 +53,7 @@ KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, c
&& encodingRegExp.cap(1).compare("utf8", Qt::CaseInsensitive) != 0)
{
// database is not utf-8 encoded, we don't support repairing that
- delete db;
- return RepairFailed;
+ return qMakePair(RepairFailed, nullptr);
}
}
@@ -75,8 +68,7 @@ KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, c
if (!repairAction) {
// we were unable to find the problem
- delete db;
- return RepairFailed;
+ return qMakePair(RepairFailed, nullptr);
}
KeePass2RandomStream randomStream;
@@ -84,23 +76,16 @@ KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, c
KeePass2XmlReader xmlReader;
QBuffer buffer(&xmlData);
buffer.open(QIODevice::ReadOnly);
- xmlReader.readDatabase(&buffer, db, &randomStream);
+ xmlReader.readDatabase(&buffer, db.data(), &randomStream);
if (xmlReader.hasError()) {
- delete db;
- return RepairFailed;
+ return qMakePair(RepairFailed, nullptr);
}
else {
- m_db = db;
- return RepairSuccess;
+ return qMakePair(RepairSuccess, db.take());
}
}
-Database* KeePass2Repair::database() const
-{
- return m_db;
-}
-
QString KeePass2Repair::errorString() const
{
return m_errorStr;
diff --git a/src/format/KeePass2Repair.h b/src/format/KeePass2Repair.h
index fe2f9dbfef..e7f2c84356 100644
--- a/src/format/KeePass2Repair.h
+++ b/src/format/KeePass2Repair.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Felix Geyer
+ * Copyright (C) 2017 KeePassXC Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +21,7 @@
#include
#include
+#include
#include "core/Database.h"
#include "keys/CompositeKey.h"
@@ -36,14 +38,12 @@ class KeePass2Repair
RepairSuccess,
RepairFailed
};
+ using RepairOutcome = QPair;
- KeePass2Repair();
- RepairResult repairDatabase(QIODevice* device, const CompositeKey& key);
- Database* database() const;
+ RepairOutcome repairDatabase(QIODevice* device, const CompositeKey& key);
QString errorString() const;
private:
- Database* m_db;
QString m_errorStr;
};
diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp
index ee0e9de261..e487f97ca5 100644
--- a/src/gui/DatabaseOpenWidget.cpp
+++ b/src/gui/DatabaseOpenWidget.cpp
@@ -95,11 +95,16 @@ void DatabaseOpenWidget::showEvent(QShowEvent* event)
m_ui->editPassword->setFocus();
#ifdef WITH_XC_YUBIKEY
- connect(YubiKey::instance(), SIGNAL(detected(int,bool)), SLOT(yubikeyDetected(int,bool)), Qt::QueuedConnection);
- connect(YubiKey::instance(), SIGNAL(detectComplete()), SLOT(yubikeyDetectComplete()), Qt::QueuedConnection);
- connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
-
- pollYubikey();
+ // showEvent() may be called twice, so make sure we are only polling once
+ if (!m_yubiKeyBeingPolled) {
+ connect(YubiKey::instance(), SIGNAL(detected(int, bool)), SLOT(yubikeyDetected(int, bool)),
+ Qt::QueuedConnection);
+ connect(YubiKey::instance(), SIGNAL(detectComplete()), SLOT(yubikeyDetectComplete()), Qt::QueuedConnection);
+ connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
+
+ pollYubikey();
+ m_yubiKeyBeingPolled = true;
+ }
#endif
}
@@ -110,6 +115,7 @@ void DatabaseOpenWidget::hideEvent(QHideEvent* event)
#ifdef WITH_XC_YUBIKEY
// Don't listen to any Yubikey events if we are hidden
disconnect(YubiKey::instance(), 0, this, 0);
+ m_yubiKeyBeingPolled = false;
#endif
}
@@ -311,10 +317,12 @@ void DatabaseOpenWidget::yubikeyDetectComplete()
m_ui->checkChallengeResponse->setEnabled(true);
m_ui->buttonRedetectYubikey->setEnabled(true);
m_ui->yubikeyProgress->setVisible(false);
+ m_yubiKeyBeingPolled = false;
}
void DatabaseOpenWidget::noYubikeyFound()
{
m_ui->buttonRedetectYubikey->setEnabled(true);
m_ui->yubikeyProgress->setVisible(false);
+ m_yubiKeyBeingPolled = false;
}
diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h
index a7691a91ea..aade111c3a 100644
--- a/src/gui/DatabaseOpenWidget.h
+++ b/src/gui/DatabaseOpenWidget.h
@@ -73,6 +73,7 @@ private slots:
QString m_filename;
private:
+ bool m_yubiKeyBeingPolled = false;
Q_DISABLE_COPY(DatabaseOpenWidget)
};
diff --git a/src/gui/DatabaseRepairWidget.cpp b/src/gui/DatabaseRepairWidget.cpp
index 2b0039408a..d3dddf14f1 100644
--- a/src/gui/DatabaseRepairWidget.cpp
+++ b/src/gui/DatabaseRepairWidget.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Felix Geyer
+ * Copyright (C) 2017 KeePassXC Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,7 +70,8 @@ void DatabaseRepairWidget::openDatabase()
delete m_db;
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- KeePass2Repair::RepairResult repairResult = repair.repairDatabase(&file, masterKey);
+ auto repairOutcome = repair.repairDatabase(&file, masterKey);
+ KeePass2Repair::RepairResult repairResult = repairOutcome.first;
QApplication::restoreOverrideCursor();
switch (repairResult) {
@@ -83,7 +85,7 @@ void DatabaseRepairWidget::openDatabase()
emit editFinished(false);
return;
case KeePass2Repair::RepairSuccess:
- m_db = repair.database();
+ m_db = repairOutcome.second;
MessageBox::warning(this, tr("Success"), tr("The database has been successfully repaired\nYou can now save it."));
emit editFinished(true);
return;
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 4c9445cccc..f70df4c79e 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -298,8 +298,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
if (!saveDatabase(db)) {
return false;
}
- }
- else {
+ } else if (dbStruct.dbWidget->currentMode() != DatabaseWidget::LockedMode) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Save changes?"),
@@ -307,10 +306,9 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
QMessageBox::Yes | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Yes);
if (result == QMessageBox::Yes) {
if (!saveDatabase(db)) {
- return false;
+ return false;
}
- }
- else if (result == QMessageBox::Cancel) {
+ } else if (result == QMessageBox::Cancel) {
return false;
}
}
@@ -355,8 +353,13 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
{
DatabaseManagerStruct& dbStruct = m_dbList[db];
- if (dbStruct.saveToFilename) {
+ if (dbStruct.dbWidget->currentMode() == DatabaseWidget::LockedMode) {
+ // Never allow saving a locked database; it causes corruption
+ // We return true since a save is not required
+ return true;
+ }
+ if (dbStruct.saveToFilename) {
dbStruct.dbWidget->blockAutoReload(true);
QString errorMessage = db->saveToFile(dbStruct.canonicalFilePath);
dbStruct.dbWidget->blockAutoReload(false);
@@ -375,7 +378,6 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
MessageWidget::Error);
return false;
}
-
} else {
return saveDatabaseAs(db);
}
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 3a39bddcf0..453b2009ba 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -1125,7 +1125,7 @@ void DatabaseWidget::onWatchedFileChanged()
void DatabaseWidget::reloadDatabaseFile()
{
- if (m_db == nullptr)
+ if (m_db == nullptr || currentMode() == DatabaseWidget::LockedMode)
return;
if (! config()->get("AutoReloadOnChange").toBool()) {
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index f1d5f866c0..e37a7d28cd 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -881,7 +881,7 @@ void MainWindow::toggleWindow()
raise();
activateWindow();
-#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS)
+#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS) && (QT_VERSION < QT_VERSION_CHECK(5, 9, 0))
// re-register global D-Bus menu (needed on Ubuntu with Unity)
// see https://github.com/keepassxreboot/keepassxc/issues/271
// and https://bugreports.qt.io/browse/QTBUG-58723
diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp
index 54b0ca2881..ad736bf207 100644
--- a/src/gui/PasswordEdit.cpp
+++ b/src/gui/PasswordEdit.cpp
@@ -31,9 +31,18 @@ PasswordEdit::PasswordEdit(QWidget* parent)
{
setEchoMode(QLineEdit::Password);
updateStylesheet();
-
- // set font to system monospace font and increase letter spacing
+
+ // use a monospace font for the password field
QFont passwordFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+#ifdef Q_OS_WIN
+ // try to use Consolas on Windows, because the default Courier New has too many similar characters
+ QFont consolasFont = QFontDatabase().font("Consolas", passwordFont.styleName(), passwordFont.pointSize());
+ const QFont defaultFont;
+ if (passwordFont != defaultFont) {
+ passwordFont = consolasFont;
+ }
+#endif
+
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
setFont(passwordFont);
}
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 809ac95eb4..5a058bda46 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -278,6 +278,7 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const Q
m_database = database;
m_create = create;
m_history = history;
+ m_saved = false;
if (history) {
setHeadline(QString("%1 > %2").arg(parentName, tr("Entry history")));
@@ -438,6 +439,7 @@ void EditEntryWidget::saveEntry()
}
updateEntryData(m_entry);
+ m_saved = true;
if (!m_create) {
m_entry->endUpdate();
@@ -510,7 +512,7 @@ void EditEntryWidget::cancel()
clear();
- emit editFinished(false);
+ emit editFinished(m_saved);
}
void EditEntryWidget::clear()
diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h
index 2888d43a8a..628f8f8ed6 100644
--- a/src/gui/entry/EditEntryWidget.h
+++ b/src/gui/entry/EditEntryWidget.h
@@ -121,6 +121,7 @@ private slots:
bool m_create;
bool m_history;
+ bool m_saved;
const QScopedPointer m_mainUi;
const QScopedPointer m_advancedUi;
const QScopedPointer m_autoTypeUi;
diff --git a/tests/TestCsvParser.cpp b/tests/TestCsvParser.cpp
index 57bc683a21..a292b56bba 100644
--- a/tests/TestCsvParser.cpp
+++ b/tests/TestCsvParser.cpp
@@ -24,17 +24,12 @@ QTEST_GUILESS_MAIN(TestCsvParser)
void TestCsvParser::initTestCase()
{
- parser = new CsvParser();
-}
-
-void TestCsvParser::cleanupTestCase()
-{
- delete parser;
+ parser.reset(new CsvParser());
}
void TestCsvParser::init()
{
- file = new QTemporaryFile();
+ file.reset(new QTemporaryFile());
if (not file->open())
QFAIL("Cannot open file!");
parser->setBackslashSyntax(false);
@@ -51,20 +46,20 @@ void TestCsvParser::cleanup()
/****************** TEST CASES ******************/
void TestCsvParser::testMissingQuote() {
parser->setTextQualifier(':');
- QTextStream out(file);
+ QTextStream out(file.data());
out << "A,B\n:BM,1";
QEXPECT_FAIL("", "Bad format", Continue);
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QWARN(parser->getStatus().toLatin1());
}
void TestCsvParser::testMalformed() {
parser->setTextQualifier(':');
- QTextStream out(file);
+ QTextStream out(file.data());
out << "A,B,C\n:BM::,1,:2:";
QEXPECT_FAIL("", "Bad format", Continue);
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QWARN(parser->getStatus().toLatin1());
}
@@ -72,14 +67,14 @@ void TestCsvParser::testMalformed() {
void TestCsvParser::testBackslashSyntax() {
parser->setBackslashSyntax(true);
parser->setTextQualifier(QChar('X'));
- QTextStream out(file);
+ QTextStream out(file.data());
//attended result: one"\t\"wo
out << "Xone\\\"\\\\t\\\\\\\"w\noX\n"
<< "X13X,X2\\X,X,\"\"3\"X\r"
<< "3,X\"4\"X,,\n"
<< "XX\n"
<< "\\";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.at(0).at(0) == "one\"\\t\\\"w\no");
QVERIFY(t.at(1).at(0) == "13");
@@ -94,10 +89,10 @@ void TestCsvParser::testBackslashSyntax() {
}
void TestCsvParser::testQuoted() {
- QTextStream out(file);
+ QTextStream out(file.data());
out << "ro,w,\"end, of \"\"\"\"\"\"row\"\"\"\"\"\n"
<< "2\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.at(0).at(0) == "ro");
QVERIFY(t.at(0).at(1) == "w");
@@ -107,41 +102,41 @@ void TestCsvParser::testQuoted() {
}
void TestCsvParser::testEmptySimple() {
- QTextStream out(file);
+ QTextStream out(file.data());
out <<"";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 0);
}
void TestCsvParser::testEmptyQuoted() {
- QTextStream out(file);
+ QTextStream out(file.data());
out <<"\"\"";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 0);
}
void TestCsvParser::testEmptyNewline() {
- QTextStream out(file);
+ QTextStream out(file.data());
out <<"\"\n\"";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 0);
}
void TestCsvParser::testEmptyFile()
{
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 0);
}
void TestCsvParser::testNewline()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << "1,2\n\n\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 1);
QVERIFY(t.at(0).at(0) == "1");
@@ -150,9 +145,9 @@ void TestCsvParser::testNewline()
void TestCsvParser::testCR()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << "1,2\r3,4";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 2);
QVERIFY(t.at(0).at(0) == "1");
@@ -163,9 +158,9 @@ void TestCsvParser::testCR()
void TestCsvParser::testLF()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << "1,2\n3,4";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 2);
QVERIFY(t.at(0).at(0) == "1");
@@ -176,9 +171,9 @@ void TestCsvParser::testLF()
void TestCsvParser::testCRLF()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << "1,2\r\n3,4";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 2);
QVERIFY(t.at(0).at(0) == "1");
@@ -189,13 +184,13 @@ void TestCsvParser::testCRLF()
void TestCsvParser::testComments()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << " #one\n"
<< " \t # two, three \r\n"
<< " #, sing\t with\r"
<< " #\t me!\n"
<< "useful,text #1!";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 1);
QVERIFY(t.at(0).at(0) == "useful");
@@ -203,21 +198,21 @@ void TestCsvParser::testComments()
}
void TestCsvParser::testColumns() {
- QTextStream out(file);
+ QTextStream out(file.data());
out << "1,2\n"
<< ",,,,,,,,,a\n"
<< "a,b,c,d\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(parser->getCsvCols() == 10);
}
void TestCsvParser::testSimple() {
- QTextStream out(file);
+ QTextStream out(file.data());
out << ",,2\r,2,3\n"
<< "A,,B\"\n"
<< " ,,\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 4);
QVERIFY(t.at(0).at(0) == "");
@@ -236,11 +231,11 @@ void TestCsvParser::testSimple() {
void TestCsvParser::testSeparator() {
parser->setFieldSeparator('\t');
- QTextStream out(file);
+ QTextStream out(file.data());
out << "\t\t2\r\t2\t3\n"
<< "A\t\tB\"\n"
<< " \t\t\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 4);
QVERIFY(t.at(0).at(0) == "");
@@ -260,10 +255,10 @@ void TestCsvParser::testSeparator() {
void TestCsvParser::testMultiline()
{
parser->setTextQualifier(QChar(':'));
- QTextStream out(file);
+ QTextStream out(file.data());
out << ":1\r\n2a::b:,:3\r4:\n"
<< "2\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.at(0).at(0) == "1\n2a:b");
QVERIFY(t.at(0).at(1) == "3\n4");
@@ -281,10 +276,10 @@ void TestCsvParser::testEmptyReparsing()
void TestCsvParser::testReparsing()
{
- QTextStream out(file);
+ QTextStream out(file.data());
out << ":te\r\nxt1:,:te\rxt2:,:end of \"this\n string\":\n"
<< "2\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QEXPECT_FAIL("", "Wrong qualifier", Continue);
@@ -303,10 +298,10 @@ void TestCsvParser::testReparsing()
void TestCsvParser::testQualifier() {
parser->setTextQualifier(QChar('X'));
- QTextStream out(file);
+ QTextStream out(file.data());
out << "X1X,X2XX,X,\"\"3\"\"\"X\r"
<< "3,X\"4\"X,,\n";
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 2);
QVERIFY(t.at(0).at(0) == "1");
@@ -324,10 +319,10 @@ void TestCsvParser::testUnicode() {
//CORRECT QChar g(0x20AC);
//ERROR QChar g("\u20AC");
parser->setFieldSeparator(QChar('A'));
- QTextStream out(file);
+ QTextStream out(file.data());
out << QString("€1A2śA\"3śAż\"Ażac");
- QVERIFY(parser->parse(file));
+ QVERIFY(parser->parse(file.data()));
t = parser->getCsvTable();
QVERIFY(t.size() == 1);
QVERIFY(t.at(0).at(0) == "€1");
diff --git a/tests/TestCsvParser.h b/tests/TestCsvParser.h
index 0cf8b94d36..f8c327d638 100644
--- a/tests/TestCsvParser.h
+++ b/tests/TestCsvParser.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include "core/CsvParser.h"
@@ -37,7 +38,6 @@ private slots:
void init();
void cleanup();
void initTestCase();
- void cleanupTestCase();
void testUnicode();
void testLF();
@@ -62,8 +62,8 @@ private slots:
void testColumns();
private:
- QTemporaryFile* file;
- CsvParser* parser;
+ QScopedPointer file;
+ QScopedPointer parser;
CsvTable t;
void dumpRow(CsvTable table, int row);
};
diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp
index 50997dcca1..dfccf5d0be 100644
--- a/tests/TestGroup.cpp
+++ b/tests/TestGroup.cpp
@@ -18,9 +18,10 @@
#include "TestGroup.h"
+#include
#include
+#include
#include
-#include
#include
#include "core/Database.h"
@@ -75,6 +76,7 @@ void TestGroup::testParenting()
QCOMPARE(g3->children().size(), 1);
QCOMPARE(g4->children().size(), 0);
+ QVERIFY(rootGroup->children().at(0) == g1);
QVERIFY(rootGroup->children().at(0) == g1);
QVERIFY(g1->children().at(0) == g2);
QVERIFY(g1->children().at(1) == g3);
@@ -99,7 +101,6 @@ void TestGroup::testParenting()
g3->setIcon(Uuid::random());
g1->setIcon(2);
QCOMPARE(spy.count(), 6);
-
delete db;
QVERIFY(rootGroup.isNull());
@@ -107,7 +108,6 @@ void TestGroup::testParenting()
QVERIFY(g2.isNull());
QVERIFY(g3.isNull());
QVERIFY(g4.isNull());
-
delete tmpRoot;
}
@@ -117,18 +117,18 @@ void TestGroup::testSignals()
Database* db2 = new Database();
QPointer root = db->rootGroup();
- QSignalSpy spyAboutToAdd(db, SIGNAL(groupAboutToAdd(Group*,int)));
+ QSignalSpy spyAboutToAdd(db, SIGNAL(groupAboutToAdd(Group*, int)));
QSignalSpy spyAdded(db, SIGNAL(groupAdded()));
QSignalSpy spyAboutToRemove(db, SIGNAL(groupAboutToRemove(Group*)));
QSignalSpy spyRemoved(db, SIGNAL(groupRemoved()));
- QSignalSpy spyAboutToMove(db, SIGNAL(groupAboutToMove(Group*,Group*,int)));
+ QSignalSpy spyAboutToMove(db, SIGNAL(groupAboutToMove(Group*, Group*, int)));
QSignalSpy spyMoved(db, SIGNAL(groupMoved()));
- QSignalSpy spyAboutToAdd2(db2, SIGNAL(groupAboutToAdd(Group*,int)));
+ QSignalSpy spyAboutToAdd2(db2, SIGNAL(groupAboutToAdd(Group*, int)));
QSignalSpy spyAdded2(db2, SIGNAL(groupAdded()));
QSignalSpy spyAboutToRemove2(db2, SIGNAL(groupAboutToRemove(Group*)));
QSignalSpy spyRemoved2(db2, SIGNAL(groupRemoved()));
- QSignalSpy spyAboutToMove2(db2, SIGNAL(groupAboutToMove(Group*,Group*,int)));
+ QSignalSpy spyAboutToMove2(db2, SIGNAL(groupAboutToMove(Group*, Group*, int)));
QSignalSpy spyMoved2(db2, SIGNAL(groupMoved()));
Group* g1 = new Group();
@@ -251,7 +251,7 @@ void TestGroup::testEntries()
void TestGroup::testDeleteSignals()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
Group* groupRoot = db->rootGroup();
Group* groupChild = new Group();
Group* groupChildChild = new Group();
@@ -260,15 +260,13 @@ void TestGroup::testDeleteSignals()
groupChildChild->setObjectName("groupChildChild");
groupChild->setParent(groupRoot);
groupChildChild->setParent(groupChild);
- QSignalSpy spyAboutToRemove(db, SIGNAL(groupAboutToRemove(Group*)));
- QSignalSpy spyRemoved(db, SIGNAL(groupRemoved()));
+ QSignalSpy spyAboutToRemove(db.data(), SIGNAL(groupAboutToRemove(Group*)));
+ QSignalSpy spyRemoved(db.data(), SIGNAL(groupRemoved()));
delete groupChild;
QVERIFY(groupRoot->children().isEmpty());
QCOMPARE(spyAboutToRemove.count(), 2);
QCOMPARE(spyRemoved.count(), 2);
- delete db;
-
Group* group = new Group();
Entry* entry = new Entry();
@@ -282,7 +280,7 @@ void TestGroup::testDeleteSignals()
QCOMPARE(spyEntryRemoved.count(), 1);
delete group;
- Database* db2 = new Database();
+ QScopedPointer db2(new Database());
Group* groupRoot2 = db2->rootGroup();
Group* group2 = new Group();
group2->setParent(groupRoot2);
@@ -294,12 +292,11 @@ void TestGroup::testDeleteSignals()
delete group2;
QCOMPARE(spyEntryAboutToRemove2.count(), 1);
QCOMPARE(spyEntryRemoved2.count(), 1);
- delete db2;
}
void TestGroup::testCopyCustomIcon()
{
- Database* dbSource = new Database();
+ QScopedPointer dbSource(new Database());
Uuid groupIconUuid = Uuid::random();
QImage groupIcon(16, 16, QImage::Format_RGB32);
@@ -321,7 +318,7 @@ void TestGroup::testCopyCustomIcon()
entry->setIcon(entryIconUuid);
QCOMPARE(entry->icon(), entryIcon);
- Database* dbTarget = new Database();
+ QScopedPointer dbTarget(new Database());
group->setParent(dbTarget->rootGroup());
QVERIFY(dbTarget->metadata()->containsCustomIcon(groupIconUuid));
@@ -332,37 +329,34 @@ void TestGroup::testCopyCustomIcon()
QVERIFY(dbTarget->metadata()->containsCustomIcon(entryIconUuid));
QCOMPARE(dbTarget->metadata()->customIcon(entryIconUuid), entryIcon);
QCOMPARE(entry->icon(), entryIcon);
-
- delete dbSource;
- delete dbTarget;
}
void TestGroup::testClone()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
- Group* originalGroup = new Group();
+ QScopedPointer originalGroup(new Group());
originalGroup->setParent(db->rootGroup());
originalGroup->setName("Group");
originalGroup->setIcon(42);
- Entry* originalGroupEntry = new Entry();
- originalGroupEntry->setGroup(originalGroup);
+ QScopedPointer originalGroupEntry(new Entry());
+ originalGroupEntry->setGroup(originalGroup.data());
originalGroupEntry->setTitle("GroupEntryOld");
originalGroupEntry->setIcon(43);
originalGroupEntry->beginUpdate();
originalGroupEntry->setTitle("GroupEntry");
originalGroupEntry->endUpdate();
- Group* subGroup = new Group();
- subGroup->setParent(originalGroup);
+ QScopedPointer subGroup(new Group());
+ subGroup->setParent(originalGroup.data());
subGroup->setName("SubGroup");
- Entry* subGroupEntry = new Entry();
- subGroupEntry->setGroup(subGroup);
+ QScopedPointer subGroupEntry(new Entry());
+ subGroupEntry->setGroup(subGroup.data());
subGroupEntry->setTitle("SubGroupEntry");
- Group* clonedGroup = originalGroup->clone();
+ QScopedPointer clonedGroup(originalGroup->clone());
QVERIFY(!clonedGroup->parentGroup());
QVERIFY(!clonedGroup->database());
QVERIFY(clonedGroup->uuid() != originalGroup->uuid());
@@ -387,19 +381,15 @@ void TestGroup::testClone()
QVERIFY(clonedSubGroupEntry->uuid() != subGroupEntry->uuid());
QCOMPARE(clonedSubGroupEntry->title(), QString("SubGroupEntry"));
- Group* clonedGroupKeepUuid = originalGroup->clone(Entry::CloneNoFlags);
+ QScopedPointer clonedGroupKeepUuid(originalGroup->clone(Entry::CloneNoFlags));
QCOMPARE(clonedGroupKeepUuid->entries().at(0)->uuid(), originalGroupEntry->uuid());
QCOMPARE(clonedGroupKeepUuid->children().at(0)->entries().at(0)->uuid(), subGroupEntry->uuid());
-
- delete clonedGroup;
- delete clonedGroupKeepUuid;
- delete db;
}
void TestGroup::testCopyCustomIcons()
{
- Database* dbSource = new Database();
- Database* dbTarget = new Database();
+ QScopedPointer dbSource(new Database());
+ QScopedPointer dbTarget(new Database());
QImage iconImage1(1, 1, QImage::Format_RGB32);
iconImage1.setPixel(0, 0, qRgb(1, 2, 3));
@@ -407,20 +397,20 @@ void TestGroup::testCopyCustomIcons()
QImage iconImage2(1, 1, QImage::Format_RGB32);
iconImage2.setPixel(0, 0, qRgb(4, 5, 6));
- Group* group1 = new Group();
+ QScopedPointer group1(new Group());
group1->setParent(dbSource->rootGroup());
Uuid group1Icon = Uuid::random();
dbSource->metadata()->addCustomIcon(group1Icon, iconImage1);
group1->setIcon(group1Icon);
- Group* group2 = new Group();
- group2->setParent(group1);
+ QScopedPointer group2(new Group());
+ group2->setParent(group1.data());
Uuid group2Icon = Uuid::random();
dbSource->metadata()->addCustomIcon(group2Icon, iconImage1);
group2->setIcon(group2Icon);
- Entry* entry1 = new Entry();
- entry1->setGroup(group2);
+ QScopedPointer entry1(new Entry());
+ entry1->setGroup(group2.data());
Uuid entry1IconOld = Uuid::random();
dbSource->metadata()->addCustomIcon(entry1IconOld, iconImage1);
entry1->setIcon(entry1IconOld);
@@ -447,27 +437,24 @@ void TestGroup::testCopyCustomIcons()
QCOMPARE(metaTarget->customIcon(group1Icon).pixel(0, 0), qRgb(1, 2, 3));
QCOMPARE(metaTarget->customIcon(group2Icon).pixel(0, 0), qRgb(4, 5, 6));
-
- delete dbTarget;
- delete dbSource;
}
void TestGroup::testMerge()
{
- Group* group1 = new Group();
+ QScopedPointer group1(new Group());
group1->setName("group 1");
- Group* group2 = new Group();
+ QScopedPointer group2(new Group());
group2->setName("group 2");
- Entry* entry1 = new Entry();
- Entry* entry2 = new Entry();
+ QScopedPointer entry1(new Entry());
+ QScopedPointer entry2(new Entry());
- entry1->setGroup(group1);
+ entry1->setGroup(group1.data());
entry1->setUuid(Uuid::random());
- entry2->setGroup(group1);
+ entry2->setGroup(group1.data());
entry2->setUuid(Uuid::random());
- group2->merge(group1);
+ group2->merge(group1.data());
QCOMPARE(group1->entries().size(), 2);
QCOMPARE(group2->entries().size(), 2);
@@ -475,25 +462,22 @@ void TestGroup::testMerge()
void TestGroup::testMergeDatabase()
{
- Database* dbSource = createMergeTestDatabase();
- Database* dbDest = new Database();
+ QScopedPointer dbSource(createMergeTestDatabase());
+ QScopedPointer dbDest(new Database());
- dbDest->merge(dbSource);
+ dbDest->merge(dbSource.data());
QCOMPARE(dbDest->rootGroup()->children().size(), 2);
QCOMPARE(dbDest->rootGroup()->children().at(0)->entries().size(), 2);
-
- delete dbDest;
- delete dbSource;
}
void TestGroup::testMergeConflict()
{
- Database* dbSource = createMergeTestDatabase();
+ QScopedPointer dbSource(createMergeTestDatabase());
// test merging updated entries
// falls back to KeepBoth mode
- Database* dbCopy = new Database();
+ QScopedPointer dbCopy(new Database());
dbCopy->setRootGroup(dbSource->rootGroup()->clone(Entry::CloneNoFlags));
// sanity check
@@ -505,22 +489,19 @@ void TestGroup::testMergeConflict()
updatedTimeInfo.setLastModificationTime(updatedTimeInfo.lastModificationTime().addYears(1));
updatedEntry->setTimeInfo(updatedTimeInfo);
- dbCopy->merge(dbSource);
+ dbCopy->merge(dbSource.data());
// one entry is duplicated because of mode
QCOMPARE(dbCopy->rootGroup()->children().at(0)->entries().size(), 2);
-
- delete dbSource;
- delete dbCopy;
}
void TestGroup::testMergeConflictKeepBoth()
{
- Database* dbSource = createMergeTestDatabase();
+ QScopedPointer dbSource(createMergeTestDatabase());
// test merging updated entries
// falls back to KeepBoth mode
- Database* dbCopy = new Database();
+ QScopedPointer dbCopy(new Database());
dbCopy->setRootGroup(dbSource->rootGroup()->clone(Entry::CloneNoFlags));
// sanity check
@@ -534,21 +515,18 @@ void TestGroup::testMergeConflictKeepBoth()
dbCopy->rootGroup()->setMergeMode(Group::MergeMode::KeepBoth);
- dbCopy->merge(dbSource);
+ dbCopy->merge(dbSource.data());
// one entry is duplicated because of mode
QCOMPARE(dbCopy->rootGroup()->children().at(0)->entries().size(), 3);
// the older entry was merged from the other db as last in the group
Entry* olderEntry = dbCopy->rootGroup()->children().at(0)->entries().at(2);
QVERIFY2(olderEntry->attributes()->hasKey("merged"), "older entry is marked with an attribute \"merged\"");
-
- delete dbSource;
- delete dbCopy;
}
Database* TestGroup::createMergeTestDatabase()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
Group* group1 = new Group();
group1->setName("group 1");
@@ -566,12 +544,12 @@ Database* TestGroup::createMergeTestDatabase()
group1->setParent(db->rootGroup());
group2->setParent(db->rootGroup());
- return db;
+ return db.take();
}
void TestGroup::testFindEntry()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
Entry* entry1 = new Entry();
entry1->setTitle(QString("entry1"));
@@ -642,13 +620,11 @@ void TestGroup::testFindEntry()
// An invalid UUID.
entry = db->rootGroup()->findEntry(QString("febfb01ebcdf9dbd90a3f1579dc"));
QVERIFY(entry == nullptr);
-
- delete db;
}
void TestGroup::testFindGroupByPath()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
Group* group1 = new Group();
group1->setName("group1");
@@ -706,13 +682,11 @@ void TestGroup::testFindGroupByPath()
group = db->rootGroup()->findGroupByPath("invalid");
QVERIFY(group == nullptr);
-
- delete db;
}
void TestGroup::testPrint()
{
- Database* db = new Database();
+ QScopedPointer db(new Database());
QString output = db->rootGroup()->print();
QCOMPARE(output, QString("[empty]\n"));
@@ -731,7 +705,6 @@ void TestGroup::testPrint()
output = db->rootGroup()->print(true);
QCOMPARE(output, QString("entry1 " + entry1->uuid().toHex() + "\n"));
-
Group* group1 = new Group();
group1->setName("group1");
@@ -752,5 +725,4 @@ void TestGroup::testPrint()
QVERIFY(output.contains(QString("entry1 " + entry1->uuid().toHex() + "\n")));
QVERIFY(output.contains(QString("group1/ " + group1->uuid().toHex() + "\n")));
QVERIFY(output.contains(QString(" entry2 " + entry2->uuid().toHex() + "\n")));
- delete db;
}
diff --git a/tests/TestKeePass2Writer.cpp b/tests/TestKeePass2Writer.cpp
index 9f0c87be71..f6d3f58ad4 100644
--- a/tests/TestKeePass2Writer.cpp
+++ b/tests/TestKeePass2Writer.cpp
@@ -148,13 +148,15 @@ void TestKeePass2Writer::testRepair()
KeePass2Repair repair;
QFile file(brokenDbFilename);
file.open(QIODevice::ReadOnly);
- QCOMPARE(repair.repairDatabase(&file, key), KeePass2Repair::RepairSuccess);
- Database* dbRepaired = repair.database();
+ auto result = repair.repairDatabase(&file, key);
+ QCOMPARE(result.first, KeePass2Repair::RepairSuccess);
+ Database* dbRepaired = result.second;
QVERIFY(dbRepaired);
QCOMPARE(dbRepaired->rootGroup()->entries().size(), 1);
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->username(), QString("testuser").append(QChar(0x20AC)));
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->password(), QString("testpw"));
+ delete dbRepaired;
}
void TestKeePass2Writer::cleanupTestCase()
diff --git a/tests/TestSymmetricCipher.cpp b/tests/TestSymmetricCipher.cpp
index 4f78693d6f..5242c3888c 100644
--- a/tests/TestSymmetricCipher.cpp
+++ b/tests/TestSymmetricCipher.cpp
@@ -162,7 +162,7 @@ void TestSymmetricCipher::testTwofish256CbcEncryption()
bool ok;
for (int i = 0; i < keys.size(); ++i) {
- cipher.init(keys[i], ivs[i]);
+ QVERIFY(cipher.init(keys[i], ivs[i]));
QByteArray ptNext = plainTexts[i];
QByteArray ctPrev = ivs[i];
QByteArray ctCur;
diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp
index 75ce3cc596..6805e1053b 100644
--- a/tests/gui/TestGui.cpp
+++ b/tests/gui/TestGui.cpp
@@ -332,15 +332,27 @@ void TestGui::testAddEntry()
QTest::keyClicks(passwordRepeatEdit, "something 2");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
- // Add entry "something 3"
+ // Add entry "something 3" using the apply button then click ok
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QTest::keyClicks(titleEdit, "something 3");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Apply), Qt::LeftButton);
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
+ // Add entry "something 4" using the apply button then click cancel
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QTest::keyClicks(titleEdit, "something 4");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Apply), Qt::LeftButton);
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
+
+ // Add entry "something 5" but click cancel button (does NOT add entry)
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QTest::keyClicks(titleEdit, "something 5");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
+
QApplication::processEvents();
- // Confirm that 4 entries now exist
- QTRY_COMPARE(entryView->model()->rowCount(), 4);
+ // Confirm that 5 entries now exist
+ QTRY_COMPARE(entryView->model()->rowCount(), 5);
}
void TestGui::testPasswordEntryEntropy()
@@ -513,7 +525,7 @@ void TestGui::testTotp()
void TestGui::testSearch()
{
// Add canned entries for consistent testing
- testAddEntry();
+ Q_UNUSED(addCannedEntries());
QToolBar* toolBar = m_mainWindow->findChild("toolBar");
@@ -629,7 +641,7 @@ void TestGui::testSearch()
void TestGui::testDeleteEntry()
{
// Add canned entries for consistent testing
- testAddEntry();
+ Q_UNUSED(addCannedEntries());
GroupView* groupView = m_dbWidget->findChild("groupView");
EntryView* entryView = m_dbWidget->findChild("entryView");
@@ -905,6 +917,42 @@ void TestGui::cleanupTestCase()
delete m_mainWindow;
}
+int TestGui::addCannedEntries()
+{
+ int entries_added = 0;
+
+ // Find buttons
+ QToolBar* toolBar = m_mainWindow->findChild("toolBar");
+ QWidget* entryNewWidget = toolBar->widgetForAction(m_mainWindow->findChild("actionEntryNew"));
+ EditEntryWidget* editEntryWidget = m_dbWidget->findChild("editEntryWidget");
+ QLineEdit* titleEdit = editEntryWidget->findChild("titleEdit");
+ QLineEdit* passwordEdit = editEntryWidget->findChild("passwordEdit");
+ QLineEdit* passwordRepeatEdit = editEntryWidget->findChild("passwordRepeatEdit");
+
+ // Add entry "test" and confirm added
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QTest::keyClicks(titleEdit, "test");
+ QDialogButtonBox* editEntryWidgetButtonBox = editEntryWidget->findChild("buttonBox");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
+ ++entries_added;
+
+ // Add entry "something 2"
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QTest::keyClicks(titleEdit, "something 2");
+ QTest::keyClicks(passwordEdit, "something 2");
+ QTest::keyClicks(passwordRepeatEdit, "something 2");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
+ ++entries_added;
+
+ // Add entry "something 3"
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QTest::keyClicks(titleEdit, "something 3");
+ QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
+ ++entries_added;
+
+ return entries_added;
+}
+
void TestGui::checkDatabase(QString dbFileName)
{
if (dbFileName.isEmpty())
diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h
index 904e5f21e7..352dbf213c 100644
--- a/tests/gui/TestGui.h
+++ b/tests/gui/TestGui.h
@@ -61,6 +61,7 @@ private slots:
void testDatabaseLocking();
private:
+ int addCannedEntries();
void checkDatabase(QString dbFileName = "");
void triggerAction(const QString& name);
void dragAndDropGroup(const QModelIndex& sourceIndex, const QModelIndex& targetIndex, int row,