diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index cbf236645..9fc9f1940 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# 18fef8dfe5d926ec0bc979562553adf4db8db2e9 +874a0c1f38b0da4e5bc83083b13a63b1c7eed935 diff --git a/CHANGES-3.2 b/CHANGES-3.2 index d5dbe04a5..2c5e0bdcd 100644 --- a/CHANGES-3.2 +++ b/CHANGES-3.2 @@ -8,10 +8,13 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. -# 3.2.58 (unreleased) # +# 3.2.58 (2022-05-18) # This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Arjen Balfoort - Enrique Medina Gremaldos + - Evan James ## Core ## - Internal improvements to translations-setup means that Catalan (in the @@ -19,6 +22,13 @@ This release contains contributions from (alphabetically by first name): are all better supported. Thanks Enrique. ## Modules ## + - *netinstall* Now displays entries with an empty name slightly differently. + An empty name is not generally useful, but in combination with + *immutable:true* and *selected:false* can be used to introduce separators + or descriptive comments into the list of packages. + - *partition* does not offer full-disk encryption when using ZFS. ZFS and the + way Calamares sets up FDE don't mix well. (Thanks Evan) + - *partition* Various bugs related to LUKS have been fixed. (Thanks Arjen) - *users* module now has a structured *user* key with settings specific to the user (shell, in particular). This maintains backwards compatibility with the *userShell* key. diff --git a/README.md b/README.md index 3e79d9a72..570adf575 100644 --- a/README.md +++ b/README.md @@ -65,5 +65,5 @@ that chat window open because it can easily take a few hours for someone to notice a message. Matrix is persistent, and we'll see your message eventually. -* [![Join us on Matrix](https://img.shields.io/badge/Matrix-%23calamares:kde.org-blue)](https://webchat.kde.org/#/room/%23calamares:kde.org) -* [![Chat on IRC](https://img.shields.io/badge/IRC-Libera.Chat%20%23calamares-green)](https://kiwiirc.com/client/irc.libera.chat/#calamares) +* [![Join us on Matrix](https://img.shields.io/badge/Matrix-%23calamares:kde.org-blue)](https://webchat.kde.org/#/room/%23calamares:kde.org) (needs a Matrix account) +* [![Chat on IRC](https://img.shields.io/badge/IRC-Libera.Chat%20%23calamares-green)](https://kiwiirc.com/client/irc.libera.chat/#calamares) (IRC supports guest accounts) diff --git a/ci/calamaresstyle b/ci/calamaresstyle index d3d2aa099..058468b91 100755 --- a/ci/calamaresstyle +++ b/ci/calamaresstyle @@ -24,7 +24,7 @@ test -f "$TOPDIR/.clang-format" || { echo "! No .clang-format support files in $ AS=$( which astyle ) # Allow specifying CF_VERSIONS outside already -CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format12 clang-format-12 clang-format" +CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format-13.0.1 clang-format12 clang-format-12 clang-format" for _cf in $CF_VERSIONS do # Not an error if this particular clang-format isn't found @@ -42,14 +42,17 @@ test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; } # Version 7 and earlier doesn't understand all the options we would like # Version 12 handles lambdas nicely, so use that. # Version 13 is also ok. +# Version 14 behaves differently with short-functions-in-class, +# spreading functions out that 13 keeps on one line. To avoid +# ping-pong commits, forbid 14. format_version=`"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` case "$format_version" in - 12|13|14 ) + 12|13 ) : ;; * ) - echo "! Clang-format version '$format_version' unsupported, version 12-14 required." + echo "! Clang-format version '$format_version' unsupported, versions 12 or 13 are ok." exit 1 ;; esac diff --git a/lang/calamares_oc.ts b/lang/calamares_oc.ts index 924a4444e..ad8d41b3a 100644 --- a/lang/calamares_oc.ts +++ b/lang/calamares_oc.ts @@ -37,17 +37,17 @@ Boot Partition - + Particion d’aviada System Partition - + Particion sistèma Do not install a boot loader - + Installar pas lo gestionari d'aviada @@ -83,12 +83,12 @@ Modules - + Moduls Type: - + Tipe : @@ -124,7 +124,7 @@ Reload Stylesheet - + Recargar fuèlh d’estil @@ -139,7 +139,7 @@ Debug information - + Informacions de desbugatge @@ -194,12 +194,12 @@ Run command '%1'. - + Executar la comanda « %1 ». Running command %1 %2 - + Execucion de la comanda %1 %2 @@ -207,7 +207,7 @@ Running %1 operation. - + Execucion de l’operacion %1 @@ -250,7 +250,7 @@ Loading failed. - + Fracàs del cargament. @@ -336,7 +336,7 @@ Link copied to clipboard Calamares Initialization Failed - + Lançament de Calamares fracassat @@ -396,22 +396,22 @@ Link copied to clipboard Setup is complete. Close the setup program. - + Configuracion acabada. Tampatz lo programa de configuracion. The installation is complete. Close the installer. - + L’installacion es acabada. Tampatz l’installador. Cancel setup without changing the system. - + Anullar la configuracion sens cambiar lo sistèma. Cancel installation without changing the system. - + Anullar l’installacion sens cambiar lo sistèma. @@ -436,12 +436,12 @@ Link copied to clipboard Cancel setup? - + Anullar la configuracion ? Cancel installation? - + Anullar l’installacion ? @@ -489,7 +489,7 @@ The installer will quit and all changes will be lost. %1 Installer - + Installador de %1 @@ -536,12 +536,12 @@ The installer will quit and all changes will be lost. Current: - + Actual : After: - + Aprèp : @@ -566,12 +566,12 @@ The installer will quit and all changes will be lost. Boot loader location: - + Emplaçament del gestionari d'aviada : <strong>Select a partition to install on</strong> - + <strong>Seleccionar una particion ont installar</strong> @@ -586,7 +586,7 @@ The installer will quit and all changes will be lost. EFI system partition: - + Particion sistèma EFI : @@ -803,7 +803,7 @@ The installer will quit and all changes will be lost. Package selection - + Seleccion dels paquets @@ -838,72 +838,72 @@ The installer will quit and all changes will be lost. <h1>Welcome to the Calamares setup program for %1</h1> - + <h1>La benvenguda al programa d’installacion de Calamares per %1</h1> <h1>Welcome to %1 setup</h1> - + <h1>La benvenguda a la configuracion de %1</h1> <h1>Welcome to the Calamares installer for %1</h1> - + <h1>La benvenguda a l’installador de Calamares per %1</h1> <h1>Welcome to the %1 installer</h1> - + <h1>La benvenguda a l’installador de %1</h1> Your username is too long. - + Vòstre nom d’utilizaire es tròp long. '%1' is not allowed as username. - + « %1 » es pas permés coma nom d’utilizaire. Your username must start with a lowercase letter or underscore. - + Vòstre nom d’utilizaire deu començar per una minuscula o un jonhent bas. Only lowercase letters, numbers, underscore and hyphen are allowed. - + Son solament permeses las letras minusculas, nombres, jonhents basses e los tirets. Your hostname is too short. - + Vòstre nom d’òste es tròp cort. Your hostname is too long. - + Vòstre nom d’òste es tròp long. '%1' is not allowed as hostname. - + « %1 » es pas permés coma nom d’òste. Only letters, numbers, underscore and hyphen are allowed. - + Son solament permeses las letras, nombres, jonhents basses e los tirets. Your passwords do not match! - + Los senhals correspondon pas ! OK! - + D’acòrd ! @@ -928,27 +928,27 @@ The installer will quit and all changes will be lost. Setup Complete - + Configuracion acabada Installation Complete - + Installacion acabada The setup of %1 is complete. - + La configuracion de %1 es acabada. The installation of %1 is complete. - + L’installacion de %1 es acabada. Package Selection - + Seleccion dels paquets @@ -999,7 +999,7 @@ The installer will quit and all changes will be lost. Si&ze: - + Ta&lha : @@ -1009,7 +1009,7 @@ The installer will quit and all changes will be lost. Partition &Type: - + &Tipe de particion : @@ -1019,12 +1019,12 @@ The installer will quit and all changes will be lost. E&xtended - + E&spandida Fi&le System: - + Sistèma de fic&hièr : @@ -1034,7 +1034,7 @@ The installer will quit and all changes will be lost. &Mount Point: - + Punt de &montatge : @@ -1182,17 +1182,17 @@ The installer will quit and all changes will be lost. Create user %1 - + Crear l’utilizaire %1 Create user <strong>%1</strong>. - + Crear utilizaire <strong>%1</strong>. Preserving home directory - + Servar lo repertòri home @@ -1266,7 +1266,7 @@ The installer will quit and all changes will be lost. Delete partition %1. - + Suprimir la particion %1. @@ -1276,7 +1276,7 @@ The installer will quit and all changes will be lost. Deleting partition %1. - + Supression de la particion %1. @@ -1388,12 +1388,12 @@ The installer will quit and all changes will be lost. &Mount Point: - + Punt de &montatge : Si&ze: - + Ta&lha : @@ -1403,7 +1403,7 @@ The installer will quit and all changes will be lost. Fi&le System: - + Sistèma de fic&hièr : @@ -1460,7 +1460,7 @@ The installer will quit and all changes will be lost. Details: - + Detalhs : @@ -1633,22 +1633,22 @@ The installer will quit and all changes will be lost. is plugged in to a power source - + es brancat a una alimentacion electrica The system is not plugged in to a power source. - + Lo sistèma es pas brancat a una alimentacion electrica. is connected to the Internet - + es connectat a l’Internet The system is not connected to the Internet. - + Lo sistèma es pas connectat a l’Internet. @@ -1736,7 +1736,7 @@ The installer will quit and all changes will be lost. Konsole not installed - + Konsole pas installada @@ -1778,7 +1778,7 @@ The installer will quit and all changes will be lost. System locale setting - + Paramètres de regionalizacion del sistèma @@ -1829,12 +1829,12 @@ The installer will quit and all changes will be lost. <h1>License Agreement</h1> - + <h1>Acòrd de licéncia</h1> I accept the terms and conditions above. - + Accèpti los tèrmes e las condicion aquí dessús. @@ -1875,7 +1875,7 @@ The installer will quit and all changes will be lost. URL: %1 - + URL : %1 @@ -1912,22 +1912,22 @@ The installer will quit and all changes will be lost. File: %1 - + Fichièr : %1 Hide license text - + Amagar lo tèxte de licéncia Show the license text - + Mostrar lo tèxte de licéncia Open license agreement in browser. - + Dobrir l’acòrd de licéncia dins lo navegador. @@ -1935,18 +1935,18 @@ The installer will quit and all changes will be lost. Region: - + Region : Zone: - + Zòna ; &Change... - + &Cambiar... @@ -2032,7 +2032,7 @@ The installer will quit and all changes will be lost. Timezone: %1 - + Fus orari : %1 @@ -2047,7 +2047,7 @@ The installer will quit and all changes will be lost. Package selection - + Seleccion dels paquets @@ -2067,17 +2067,17 @@ The installer will quit and all changes will be lost. Browser package - + Percórrer lo paquet Web browser - + Navegador web Kernel - + Nuclèu @@ -2087,7 +2087,7 @@ The installer will quit and all changes will be lost. Login - + Connexion @@ -2127,7 +2127,7 @@ The installer will quit and all changes will be lost. Theming - + Personalizacion @@ -2171,7 +2171,7 @@ The installer will quit and all changes will be lost. OEM Configuration - + Configuracion OEM @@ -2191,7 +2191,7 @@ The installer will quit and all changes will be lost. Timezone: %1 - + Fus orari : %1 @@ -2214,17 +2214,17 @@ The installer will quit and all changes will be lost. Password is too short - + Lo senhal es tròp cort Password is too long - + Lo senhal es tròp long Password is too weak - + Lo senhal es tròp feble @@ -2302,7 +2302,7 @@ The installer will quit and all changes will be lost. The password is too short - + Lo senhal es tròp cort @@ -2421,7 +2421,7 @@ The installer will quit and all changes will be lost. Unknown setting - %1 - + Paramètre desconegut - %1 @@ -2436,7 +2436,7 @@ The installer will quit and all changes will be lost. Bad integer value - + Marrida valor d’entièr @@ -2476,7 +2476,7 @@ The installer will quit and all changes will be lost. Unknown error - + Error desconeguda @@ -2509,7 +2509,7 @@ The installer will quit and all changes will be lost. Package Selection - + Seleccion dels paquets @@ -2522,7 +2522,7 @@ The installer will quit and all changes will be lost. Packages - + Paquets @@ -2530,7 +2530,7 @@ The installer will quit and all changes will be lost. Packages - + Paquets @@ -2556,7 +2556,7 @@ The installer will quit and all changes will be lost. Keyboard Model: - + Modèl de clavièr : @@ -2574,27 +2574,27 @@ The installer will quit and all changes will be lost. What is your name? - + Cossí vos dison ? Your Full Name - + Vòstre nom complèt What name do you want to use to log in? - + Qual nom volètz utilizar per vos connectar ? login - + identificant What is the name of this computer? - + Cossí s’apèla aqueste ordenador ? @@ -2604,7 +2604,7 @@ The installer will quit and all changes will be lost. Computer Name - + Nom de l’ordenador @@ -2671,17 +2671,17 @@ The installer will quit and all changes will be lost. Home - + Home Boot - + Boot EFI system - + Sistèma EFI @@ -2696,13 +2696,13 @@ The installer will quit and all changes will be lost. New partition - + Particion novèla %1 %2 size[number] filesystem[name] - + %1 %2 @@ -2711,13 +2711,13 @@ The installer will quit and all changes will be lost. Free Space - + Espaci disponible New partition - + Particion novèla @@ -2737,7 +2737,7 @@ The installer will quit and all changes will be lost. Mount Point - + Punt de montatge @@ -2853,12 +2853,12 @@ The installer will quit and all changes will be lost. Current: - + Actual : After: - + Aprèp : @@ -3241,7 +3241,7 @@ Output: EFI system partition: - + Particion sistèma EFI : @@ -3425,7 +3425,7 @@ Output: Internal Error - + Error intèrna @@ -4018,22 +4018,22 @@ Output: <h1>Welcome to the Calamares setup program for %1.</h1> - + <h1>La benvenguda al programa d’installacion de Calamares per %1.</h1> <h1>Welcome to %1 setup.</h1> - + <h1>La benvenguda a la configuracion de %1.</h1> <h1>Welcome to the Calamares installer for %1.</h1> - + <h1>La benvenguda a l’installador de Calamares per %1.</h1> <h1>Welcome to the %1 installer.</h1> - + <h1>La benvenguda a l’installador de %1.</h1> @@ -4164,12 +4164,12 @@ Output: Close Installer - + Tampar l’installador Restart System - + Reaviar lo sistèma @@ -4208,7 +4208,8 @@ Output: <h1>Languages</h1> </br> The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>. - + <h1>Lengas</h1> </br> + Los paramètres de lingüistics del sistèma afèctan la lenga, lo jòc de caractèrs per d’unes elements d’interfàcias de linha de comanda. Lo parametratge actual es <strong>%1</strong>. @@ -4232,7 +4233,7 @@ Output: Keyboard Model: - + Modèl de clavièr : @@ -4349,17 +4350,17 @@ Output: What is your name? - + Cossí vos dison ? Your Full Name - + Vòstre nom complèt What name do you want to use to log in? - + Qual nom volètz utilizar per vos connectar ? @@ -4374,7 +4375,7 @@ Output: Only lowercase letters, numbers, underscore and hyphen are allowed. - + Son solament permeses las letras, nombres, jonhents basses e los tirets. @@ -4384,12 +4385,12 @@ Output: What is the name of this computer? - + Cossí s’apèla aqueste ordenador ? Computer Name - + Nom de l’ordenador diff --git a/lang/calamares_pl.ts b/lang/calamares_pl.ts index 08c9435f8..d959b2e67 100644 --- a/lang/calamares_pl.ts +++ b/lang/calamares_pl.ts @@ -240,7 +240,7 @@ Loading ... - + Ładowanie... @@ -360,7 +360,7 @@ Link copied to clipboard Continue with installation? - + Kontynuować instalację? @@ -502,7 +502,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Set filesystem label on %1. - + Ustaw etykietę systemu plików na %1. @@ -683,7 +683,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Successfully unmounted %1. - + Pomyślnie odmontowano %1. @@ -868,7 +868,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. '%1' is not allowed as username. - + '%1' nie może zostać użyte jako nazwa użytkownika. @@ -908,7 +908,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. OK! - + OK! @@ -953,7 +953,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Package Selection - + Wybór Pakietów @@ -1049,7 +1049,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Label for the filesystem - + Etykieta dla systemu plików @@ -1084,7 +1084,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Mountpoint must start with a <tt>/</tt>. - + Punkt montowania musi się zaczynać od <tt>/</tt>. @@ -1418,7 +1418,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Label for the filesystem - + Etykieta dla systemu plików @@ -2037,7 +2037,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Timezone: %1 - + Strefa czasowa: %1 @@ -2196,7 +2196,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Timezone: %1 - + Strefa czasowa: %1 @@ -2289,11 +2289,11 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. The password contains fewer than %n lowercase letters - - - - - + + Hasło składa się z mniej niż %1 małej litery + Hasło składa się z mniej niż %1 małych liter + Hasło składa się z mniej niż %1 małych liter + Hasło składa się z mniej niż %1 małych liter @@ -2504,7 +2504,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Password is empty - + Hasło jest puste @@ -2532,7 +2532,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Package Selection - + Wybór Pakietów @@ -2545,7 +2545,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Packages - + Pakiety @@ -2553,7 +2553,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Packages - + Pakiety @@ -2602,7 +2602,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Your Full Name - + Twoja Pełne Imię @@ -2612,7 +2612,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. login - + login @@ -2627,7 +2627,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Computer Name - + Nazwa Komputera @@ -2644,13 +2644,13 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. Password - + Hasło Repeat Password - + Powtórz Hasło @@ -2755,7 +2755,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. File System Label - + Etykieta Systemu Plików @@ -2901,7 +2901,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone. The filesystem must be mounted on <strong>%1</strong>. - + System plików musi zostać zamontowany w <strong>%1</strong>. @@ -3120,7 +3120,7 @@ Wyjście: File not found - + Plik nie został znaleziony @@ -3130,7 +3130,7 @@ Wyjście: Directory not found - + Katalog nie został znaleziony @@ -3922,7 +3922,7 @@ i nie uruchomi się Key Column header for key/value - + Klucz @@ -4164,7 +4164,7 @@ i nie uruchomi się Back - + Wstecz @@ -4180,7 +4180,7 @@ i nie uruchomi się Installation Completed - + Instalacja została zakończona @@ -4191,12 +4191,12 @@ i nie uruchomi się Close Installer - + Zamknij instalator Restart System - + Uruchom ponownie system @@ -4210,7 +4210,7 @@ i nie uruchomi się Installation Completed - + Instalacja została zakończona @@ -4246,7 +4246,7 @@ i nie uruchomi się Back - + Wstecz @@ -4363,7 +4363,7 @@ i nie uruchomi się Back - + Wstecz @@ -4381,7 +4381,7 @@ i nie uruchomi się Your Full Name - + Twoja Pełne Imię @@ -4416,7 +4416,7 @@ i nie uruchomi się Computer Name - + Nazwa Komputera @@ -4436,12 +4436,12 @@ i nie uruchomi się Password - + Hasło Repeat Password - + Powtórz Hasło diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 6c3eed6d1..c06e13aa3 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -67,8 +67,7 @@ CalamaresApplication::init() { Logger::setupLogfile(); cDebug() << "Calamares version:" << CALAMARES_VERSION; - cDebug() << Logger::SubEntry - << "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " ); + cDebug() << Logger::SubEntry << "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " ); if ( !Calamares::Settings::instance() ) { diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index d95b87933..81e7ca97f 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -134,10 +134,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, { QPushButton* debugWindowBtn = new QPushButton; debugWindowBtn->setObjectName( "debugButton" ); - CALAMARES_RETRANSLATE_FOR( - debugWindowBtn, - debugWindowBtn->setText( QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), - "Show debug information" ) ); ); + CALAMARES_RETRANSLATE_FOR( debugWindowBtn, + debugWindowBtn->setText( QCoreApplication::translate( + CalamaresWindow::staticMetaObject.className(), "Show debug information" ) ); ); sideLayout->addWidget( debugWindowBtn ); debugWindowBtn->setFlat( true ); debugWindowBtn->setCheckable( true ); @@ -173,7 +172,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, QObject::connect( viewManager, &Calamares::ViewManager::backEnabledChanged, back, &QPushButton::setEnabled ); QObject::connect( viewManager, &Calamares::ViewManager::backLabelChanged, back, &QPushButton::setText ); QObject::connect( - viewManager, &Calamares::ViewManager::backIconChanged, [=]( QString n ) { setButtonIcon( back, n ); } ); + viewManager, &Calamares::ViewManager::backIconChanged, [ = ]( QString n ) { setButtonIcon( back, n ); } ); QObject::connect( viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, back, &QPushButton::setVisible ); bottomLayout->addWidget( back ); @@ -189,7 +188,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, QObject::connect( viewManager, &Calamares::ViewManager::nextEnabledChanged, next, &QPushButton::setEnabled ); QObject::connect( viewManager, &Calamares::ViewManager::nextLabelChanged, next, &QPushButton::setText ); QObject::connect( - viewManager, &Calamares::ViewManager::nextIconChanged, [=]( QString n ) { setButtonIcon( next, n ); } ); + viewManager, &Calamares::ViewManager::nextIconChanged, [ = ]( QString n ) { setButtonIcon( next, n ); } ); QObject::connect( viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, next, &QPushButton::setVisible ); bottomLayout->addWidget( next ); @@ -205,7 +204,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, QObject::connect( viewManager, &Calamares::ViewManager::quitEnabledChanged, quit, &QPushButton::setEnabled ); QObject::connect( viewManager, &Calamares::ViewManager::quitLabelChanged, quit, &QPushButton::setText ); QObject::connect( - viewManager, &Calamares::ViewManager::quitIconChanged, [=]( QString n ) { setButtonIcon( quit, n ); } ); + viewManager, &Calamares::ViewManager::quitIconChanged, [ = ]( QString n ) { setButtonIcon( quit, n ); } ); QObject::connect( viewManager, &Calamares::ViewManager::quitTooltipChanged, quit, &QPushButton::setToolTip ); QObject::connect( viewManager, &Calamares::ViewManager::quitVisibleChanged, quit, &QPushButton::setVisible ); bottomLayout->addWidget( quit ); diff --git a/src/calamares/DebugWindow.cpp b/src/calamares/DebugWindow.cpp index 0ac8d2f60..c85990176 100644 --- a/src/calamares/DebugWindow.cpp +++ b/src/calamares/DebugWindow.cpp @@ -78,17 +78,22 @@ DebugWindow::DebugWindow() m_ui->globalStorageView->expandAll(); // Do above when the GS changes, too - connect( gs, &GlobalStorage::changed, this, [=] { - m_globals = JobQueue::instance()->globalStorage()->data(); - m_globals_model->reload(); - m_ui->globalStorageView->expandAll(); - } ); + connect( gs, + &GlobalStorage::changed, + this, + [ = ] + { + m_globals = JobQueue::instance()->globalStorage()->data(); + m_globals_model->reload(); + m_ui->globalStorageView->expandAll(); + } ); // JobQueue page m_ui->jobQueueText->setReadOnly( true ); - connect( JobQueue::instance(), &JobQueue::queueChanged, this, [this]( const QStringList& jobs ) { - m_ui->jobQueueText->setText( jobs.join( '\n' ) ); - } ); + connect( JobQueue::instance(), + &JobQueue::queueChanged, + this, + [ this ]( const QStringList& jobs ) { m_ui->jobQueueText->setText( jobs.join( '\n' ) ); } ); // Modules page QStringList modulesKeys; @@ -122,27 +127,33 @@ DebugWindow::DebugWindow() // Tools page connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } ); - connect( m_ui->reloadStylesheetButton, &QPushButton::clicked, []() { - for ( auto* w : qApp->topLevelWidgets() ) - { - // Needs to match what's set in CalamaresWindow - if ( w->objectName() == QStringLiteral( "mainApp" ) ) - { - w->setStyleSheet( Calamares::Branding::instance()->stylesheet() ); - } - } - } ); - connect( m_ui->widgetTreeButton, &QPushButton::clicked, []() { - for ( auto* w : qApp->topLevelWidgets() ) - { - Logger::CDebug deb; - dumpWidgetTree( deb, w, 0 ); - } - } ); + connect( m_ui->reloadStylesheetButton, + &QPushButton::clicked, + []() + { + for ( auto* w : qApp->topLevelWidgets() ) + { + // Needs to match what's set in CalamaresWindow + if ( w->objectName() == QStringLiteral( "mainApp" ) ) + { + w->setStyleSheet( Calamares::Branding::instance()->stylesheet() ); + } + } + } ); + connect( m_ui->widgetTreeButton, + &QPushButton::clicked, + []() + { + for ( auto* w : qApp->topLevelWidgets() ) + { + Logger::CDebug deb; + dumpWidgetTree( deb, w, 0 ); + } + } ); // Send Log button only if it would be useful m_ui->sendLogButton->setVisible( CalamaresUtils::Paste::isEnabled() ); - connect( m_ui->sendLogButton, &QPushButton::clicked, [this]() { CalamaresUtils::Paste::doLogUploadUI( this ); } ); + connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { CalamaresUtils::Paste::doLogUploadUI( this ); } ); CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); ); } @@ -186,11 +197,15 @@ DebugWindowManager::show( bool visible ) { m_debugWindow = new Calamares::DebugWindow(); m_debugWindow->show(); - connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() { - m_debugWindow->deleteLater(); - m_visible = false; - emit visibleChanged( false ); - } ); + connect( m_debugWindow.data(), + &Calamares::DebugWindow::closed, + this, + [ = ]() + { + m_debugWindow->deleteLater(); + m_visible = false; + emit visibleChanged( false ); + } ); m_visible = true; emit visibleChanged( true ); } diff --git a/src/calamares/progresstree/ProgressTreeView.cpp b/src/calamares/progresstree/ProgressTreeView.cpp index b953db64d..900dd5028 100644 --- a/src/calamares/progresstree/ProgressTreeView.cpp +++ b/src/calamares/progresstree/ProgressTreeView.cpp @@ -51,6 +51,6 @@ ProgressTreeView::setModel( QAbstractItemModel* model ) Calamares::ViewManager::instance(), &Calamares::ViewManager::currentStepChanged, this, - [this]() { viewport()->update(); }, + [ this ]() { viewport()->update(); }, Qt::UniqueConnection ); } diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index d7078c6d2..e15df345e 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -89,9 +89,10 @@ public: = m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight ); qreal totalJobWeight - = std::accumulate( jobs.cbegin(), jobs.cend(), qreal( 0.0 ), []( qreal total, const job_ptr& j ) { - return total + j->getJobWeight(); - } ); + = std::accumulate( jobs.cbegin(), + jobs.cend(), + qreal( 0.0 ), + []( qreal total, const job_ptr& j ) { return total + j->getJobWeight(); } ); if ( totalJobWeight < 1 ) { totalJobWeight = 1.0; diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index d494d98bc..2ce85ec8d 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -290,7 +290,7 @@ Settings::reconcileInstancesAndSequence() // Since moduleFinder captures targetKey by reference, we can // update targetKey to change what the finder lambda looks for. Calamares::ModuleSystem::InstanceKey targetKey; - auto moduleFinder = [&targetKey]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; }; + auto moduleFinder = [ &targetKey ]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; }; // Check the sequence against the existing instances (which so far are only custom) for ( const auto& step : m_modulesSequence ) diff --git a/src/libcalamares/Tests.cpp b/src/libcalamares/Tests.cpp index bde7ac0d3..51fd92a2f 100644 --- a/src/libcalamares/Tests.cpp +++ b/src/libcalamares/Tests.cpp @@ -425,9 +425,8 @@ sequence: // Make a lambda where we can adjust what it looks for from the outside, // by capturing a reference. QString moduleKey = QString( "welcome" ); - auto moduleFinder = [&moduleKey]( const Calamares::InstanceDescription& d ) { - return d.isValid() && d.key().module() == moduleKey; - }; + auto moduleFinder = [ &moduleKey ]( const Calamares::InstanceDescription& d ) + { return d.isValid() && d.key().module() == moduleKey; }; const auto it0 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); QVERIFY( it0 != s.moduleInstances().constEnd() ); diff --git a/src/libcalamares/geoip/Handler.cpp b/src/libcalamares/geoip/Handler.cpp index 8ef72d99b..14de9f39c 100644 --- a/src/libcalamares/geoip/Handler.cpp +++ b/src/libcalamares/geoip/Handler.cpp @@ -150,7 +150,7 @@ Handler::query() const QString url = m_url; QString selector = m_selector; - return QtConcurrent::run( [=] { return do_query( type, url, selector ); } ); + return QtConcurrent::run( [ = ] { return do_query( type, url, selector ); } ); } QString @@ -171,7 +171,7 @@ Handler::queryRaw() const QString url = m_url; QString selector = m_selector; - return QtConcurrent::run( [=] { return do_raw_query( type, url, selector ); } ); + return QtConcurrent::run( [ = ] { return do_raw_query( type, url, selector ); } ); } } // namespace GeoIP diff --git a/src/libcalamares/locale/Lookup.cpp b/src/libcalamares/locale/Lookup.cpp index f792f08ed..3dba50898 100644 --- a/src/libcalamares/locale/Lookup.cpp +++ b/src/libcalamares/locale/Lookup.cpp @@ -43,9 +43,9 @@ lookup( TwoChar c ) } const CountryData* p - = std::find_if( country_data_table, country_data_table + country_data_size, [c = c]( const CountryData& d ) { - return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 ); - } ); + = std::find_if( country_data_table, + country_data_table + country_data_size, + [ c = c ]( const CountryData& d ) { return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 ); } ); if ( p == country_data_table + country_data_size ) { return nullptr; @@ -86,7 +86,7 @@ languageForCountry( QLocale::Country country ) { const CountryData* p = std::find_if( country_data_table, country_data_table + country_data_size, - [c = country]( const CountryData& d ) { return d.c == c; } ); + [ c = country ]( const CountryData& d ) { return d.c == c; } ); if ( p == country_data_table + country_data_size ) { return QLocale::Language::AnyLanguage; diff --git a/src/libcalamares/locale/TimeZone.cpp b/src/libcalamares/locale/TimeZone.cpp index b9dbac5ee..c0804ebd6 100644 --- a/src/libcalamares/locale/TimeZone.cpp +++ b/src/libcalamares/locale/TimeZone.cpp @@ -224,16 +224,19 @@ public: loadTZData( m_regions, m_altZones, in ); } - std::sort( m_regions.begin(), m_regions.end(), []( const RegionData* lhs, const RegionData* rhs ) { - return lhs->key() < rhs->key(); - } ); - std::sort( m_zones.begin(), m_zones.end(), []( const TimeZoneData* lhs, const TimeZoneData* rhs ) { - if ( lhs->region() == rhs->region() ) - { - return lhs->zone() < rhs->zone(); - } - return lhs->region() < rhs->region(); - } ); + std::sort( m_regions.begin(), + m_regions.end(), + []( const RegionData* lhs, const RegionData* rhs ) { return lhs->key() < rhs->key(); } ); + std::sort( m_zones.begin(), + m_zones.end(), + []( const TimeZoneData* lhs, const TimeZoneData* rhs ) + { + if ( lhs->region() == rhs->region() ) + { + return lhs->zone() < rhs->zone(); + } + return lhs->region() < rhs->region(); + } ); for ( auto* z : m_zones ) { @@ -399,7 +402,8 @@ ZonesModel::find( double latitude, double longitude ) const * either N/S or E/W equal to any other; this obviously * falls apart at the poles. */ - auto distance = [&]( const TimeZoneData* zone ) -> double { + auto distance = [ & ]( const TimeZoneData* zone ) -> double + { // Latitude doesn't wrap around: there is nothing north of 90 double latitudeDifference = abs( zone->latitude() - latitude ); @@ -445,7 +449,8 @@ ZonesModel::Iterator::operator bool() const return 0 <= m_index && m_index < m_p->m_zones.count(); } -const TimeZoneData* ZonesModel::Iterator::operator*() const +const TimeZoneData* +ZonesModel::Iterator::operator*() const { if ( *this ) { diff --git a/src/libcalamares/modulesystem/Preset.cpp b/src/libcalamares/modulesystem/Preset.cpp index a2e3f3264..1c5779afe 100644 --- a/src/libcalamares/modulesystem/Preset.cpp +++ b/src/libcalamares/modulesystem/Preset.cpp @@ -47,7 +47,7 @@ Presets::Presets( const QVariantMap& configurationMap, const QStringList& recogn { reserve( recognizedKeys.size() ); loadPresets( - *this, configurationMap, [&recognizedKeys]( const QString& s ) { return recognizedKeys.contains( s ); } ); + *this, configurationMap, [ &recognizedKeys ]( const QString& s ) { return recognizedKeys.contains( s ); } ); } bool diff --git a/src/libcalamares/packages/Tests.cpp b/src/libcalamares/packages/Tests.cpp index 09159abdf..a0422cb36 100644 --- a/src/libcalamares/packages/Tests.cpp +++ b/src/libcalamares/packages/Tests.cpp @@ -140,7 +140,7 @@ PackagesTests::testAdd() { // This is the "original" instance, so it's missing extraEditor auto op = action[ "install" ].toList(); - QCOMPARE( op.length(), packages.length()-1 ); // changed from original length + QCOMPARE( op.length(), packages.length() - 1 ); // changed from original length QVERIFY( !op.contains( extraEditor ) ); } } diff --git a/src/libcalamares/partition/PartitionIterator.cpp b/src/libcalamares/partition/PartitionIterator.cpp index 7c68e6170..8b4556f7f 100644 --- a/src/libcalamares/partition/PartitionIterator.cpp +++ b/src/libcalamares/partition/PartitionIterator.cpp @@ -29,7 +29,8 @@ PartitionIterator::PartitionIterator( PartitionTable* table ) { } -Partition* PartitionIterator::operator*() const +Partition* +PartitionIterator::operator*() const { return m_current; } diff --git a/src/libcalamares/utils/RAII.h b/src/libcalamares/utils/RAII.h index 957e4fe42..8d4a9073b 100644 --- a/src/libcalamares/utils/RAII.h +++ b/src/libcalamares/utils/RAII.h @@ -108,5 +108,5 @@ struct cScopedAssignment }; template < typename T > -cScopedAssignment( T p )->cScopedAssignment< decltype( *p ) >; +cScopedAssignment( T p ) -> cScopedAssignment< decltype( *p ) >; #endif diff --git a/src/libcalamares/utils/Retranslator.h b/src/libcalamares/utils/Retranslator.h index 8bb044983..94eba8b1c 100644 --- a/src/libcalamares/utils/Retranslator.h +++ b/src/libcalamares/utils/Retranslator.h @@ -116,7 +116,7 @@ private: * immediately after setting up the connection. This allows * setup and translation code to be mixed together. */ -#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [=] { body } ) +#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [ = ] { body } ) /** @brief Call code for the given object (widget) when language changes * * This is identical to CALAMARES_RETRANSLATE, except the @p body is called @@ -126,7 +126,7 @@ private: * immediately after setting up the connection. This allows * setup and translation code to be mixed together. */ -#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [=] { body } ) +#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [ = ] { body } ) /** @brief Call a slot in this object when language changes * * Given a slot (in method-function-pointer notation), call that slot when the diff --git a/src/libcalamares/utils/Runner.cpp b/src/libcalamares/utils/Runner.cpp index c7146c2d7..d45836334 100644 --- a/src/libcalamares/utils/Runner.cpp +++ b/src/libcalamares/utils/Runner.cpp @@ -151,16 +151,19 @@ Calamares::Utils::Runner::run() if ( m_output ) { - connect( &process, &QProcess::readyReadStandardOutput, [this, &process]() { - do - { - QString s = process.readLine(); - if ( !s.isEmpty() ) - { - Q_EMIT this->output( s ); - } - } while ( process.canReadLine() ); - } ); + connect( &process, + &QProcess::readyReadStandardOutput, + [ this, &process ]() + { + do + { + QString s = process.readLine(); + if ( !s.isEmpty() ) + { + Q_EMIT this->output( s ); + } + } while ( process.canReadLine() ); + } ); } cDebug() << Logger::SubEntry << "Running" << Logger::RedactedCommand( m_command ); diff --git a/src/libcalamaresui/utils/Qml.cpp b/src/libcalamaresui/utils/Qml.cpp index 534b2d3f5..b73bf7172 100644 --- a/src/libcalamaresui/utils/Qml.cpp +++ b/src/libcalamaresui/utils/Qml.cpp @@ -135,14 +135,14 @@ addExpansions( QmlSearch method, QStringList& candidates, const QStringList& nam std::transform( names.constBegin(), names.constEnd(), std::back_inserter( candidates ), - [&]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } ); + [ & ]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } ); } if ( ( method == QmlSearch::Both ) || ( method == QmlSearch::QrcOnly ) ) { std::transform( names.constBegin(), names.constEnd(), std::back_inserter( candidates ), - [&]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } ); + [ & ]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } ); } } @@ -222,22 +222,30 @@ registerQmlModels() // Because branding and viewmanager have a parent (CalamaresApplication // and CalamaresWindow), they will not be deleted by QmlEngine. // https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership - qmlRegisterSingletonType< Calamares::Branding >( - "io.calamares.ui", 1, 0, "Branding", []( QQmlEngine*, QJSEngine* ) -> QObject* { - return Calamares::Branding::instance(); - } ); - qmlRegisterSingletonType< Calamares::ViewManager >( - "io.calamares.ui", 1, 0, "ViewManager", []( QQmlEngine*, QJSEngine* ) -> QObject* { - return Calamares::ViewManager::instance(); - } ); + qmlRegisterSingletonType< Calamares::Branding >( "io.calamares.ui", + 1, + 0, + "Branding", + []( QQmlEngine*, QJSEngine* ) -> QObject* + { return Calamares::Branding::instance(); } ); + qmlRegisterSingletonType< Calamares::ViewManager >( "io.calamares.ui", + 1, + 0, + "ViewManager", + []( QQmlEngine*, QJSEngine* ) -> QObject* + { return Calamares::ViewManager::instance(); } ); qmlRegisterSingletonType< Calamares::GlobalStorage >( - "io.calamares.core", 1, 0, "Global", []( QQmlEngine*, QJSEngine* ) -> QObject* { - return Calamares::JobQueue::instance()->globalStorage(); - } ); + "io.calamares.core", + 1, + 0, + "Global", + []( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } ); qmlRegisterSingletonType< CalamaresUtils::Network::Manager >( - "io.calamares.core", 1, 0, "Network", []( QQmlEngine*, QJSEngine* ) -> QObject* { - return &CalamaresUtils::Network::Manager::instance(); - } ); + "io.calamares.core", + 1, + 0, + "Network", + []( QQmlEngine*, QJSEngine* ) -> QObject* { return &CalamaresUtils::Network::Manager::instance(); } ); } } diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 6c5f9ad16..949c5f64c 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -31,16 +31,19 @@ FinishedPage::FinishedPage( Config* config, QWidget* parent ) ui->mainText->setWordWrap( true ); ui->mainText->setOpenExternalLinks( true ); - connect( config, &Config::restartModeChanged, [this]( Config::RestartMode mode ) { - using Mode = Config::RestartMode; + connect( config, + &Config::restartModeChanged, + [ this ]( Config::RestartMode mode ) + { + using Mode = Config::RestartMode; - ui->restartCheckBox->setVisible( mode != Mode::Never ); - ui->restartCheckBox->setEnabled( mode != Mode::Always ); - } ); + ui->restartCheckBox->setVisible( mode != Mode::Never ); + ui->restartCheckBox->setEnabled( mode != Mode::Always ); + } ); connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked ); - connect( ui->restartCheckBox, &QCheckBox::stateChanged, [config]( int state ) { - config->setRestartNowWanted( state != 0 ); - } ); + connect( ui->restartCheckBox, + &QCheckBox::stateChanged, + [ config ]( int state ) { config->setRestartNowWanted( state != 0 ); } ); CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate ); } diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index fe94e5553..cd8d0100c 100755 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -160,13 +160,18 @@ class FstabGenerator(object): crypttab_options = self.crypttab_options # Set crypttab password for partition to none and remove crypttab options + # if crypto_keyfile.bin was not generated + if not os.path.exists(os.path.join(self.root_mount_point, "crypto_keyfile.bin")): + password = "none" + crypttab_options = "" # on root partition when /boot is unencrypted - if partition["mountPoint"] == "/": + elif partition["mountPoint"] == "/": if any([p["mountPoint"] == "/boot" and "luksMapperName" not in p for p in self.partitions]): password = "none" crypttab_options = "" + return dict( name=mapper_name, diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index 720588810..9afaef5f3 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -156,18 +156,24 @@ Config::Config( QObject* parent ) m_setxkbmapTimer.setSingleShot( true ); // Connect signals and slots - connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, [&]( int index ) { - // Set Xorg keyboard model - m_selectedModel = m_keyboardModelsModel->key( index ); - QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) ); - emit prettyStatusChanged(); - } ); + connect( m_keyboardModelsModel, + &KeyboardModelsModel::currentIndexChanged, + [ & ]( int index ) + { + // Set Xorg keyboard model + m_selectedModel = m_keyboardModelsModel->key( index ); + QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) ); + emit prettyStatusChanged(); + } ); - connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, [&]( int index ) { - m_selectedLayout = m_keyboardLayoutsModel->item( index ).first; - updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) ); - emit prettyStatusChanged(); - } ); + connect( m_keyboardLayoutsModel, + &KeyboardLayoutModel::currentIndexChanged, + [ & ]( int index ) + { + m_selectedLayout = m_keyboardLayoutsModel->item( index ).first; + updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) ); + emit prettyStatusChanged(); + } ); connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, this, &Config::xkbChanged ); diff --git a/src/modules/keyboard/KeyboardLayoutModel.cpp b/src/modules/keyboard/KeyboardLayoutModel.cpp index 3b9ba19fe..ed171a476 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.cpp +++ b/src/modules/keyboard/KeyboardLayoutModel.cpp @@ -27,7 +27,8 @@ retranslateKeyboardModels() { s_kbtranslator = new QTranslator; } - (void)CalamaresUtils::loadTranslator( CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator ); + (void)CalamaresUtils::loadTranslator( + CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator ); } @@ -220,9 +221,8 @@ KeyboardLayoutModel::init() std::stable_sort( m_layouts.begin(), m_layouts.end(), []( const QPair< QString, KeyboardGlobal::KeyboardInfo >& a, - const QPair< QString, KeyboardGlobal::KeyboardInfo >& b ) { - return a.second.description < b.second.description; - } ); + const QPair< QString, KeyboardGlobal::KeyboardInfo >& b ) + { return a.second.description < b.second.description; } ); } QHash< int, QByteArray > diff --git a/src/modules/keyboard/KeyboardPage.cpp b/src/modules/keyboard/KeyboardPage.cpp index 13ff5ca78..c821c4633 100644 --- a/src/modules/keyboard/KeyboardPage.cpp +++ b/src/modules/keyboard/KeyboardPage.cpp @@ -69,8 +69,9 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent ) cDebug() << "Variants now total=" << model->rowCount() << "selected=" << model->currentIndex(); } - connect( - ui->buttonRestore, &QPushButton::clicked, [config = config] { config->keyboardModels()->setCurrentIndex(); } ); + connect( ui->buttonRestore, + &QPushButton::clicked, + [ config = config ] { config->keyboardModels()->setCurrentIndex(); } ); connect( ui->physicalModelSelector, QOverload< int >::of( &QComboBox::currentIndexChanged ), @@ -83,21 +84,29 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent ) connect( ui->layoutSelector->selectionModel(), &QItemSelectionModel::currentChanged, - [this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } ); - connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) { - ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) ); - m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) ); - m_keyboardPreview->setVariant( - m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) ); - } ); + [ this ]( const QModelIndex& current ) + { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } ); + connect( config->keyboardLayouts(), + &KeyboardLayoutModel::currentIndexChanged, + [ this ]( int index ) + { + ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) ); + m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) ); + m_keyboardPreview->setVariant( + m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) ); + } ); connect( ui->variantSelector->selectionModel(), &QItemSelectionModel::currentChanged, - [this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } ); - connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) { - ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) ); - m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) ); - } ); + [ this ]( const QModelIndex& current ) + { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } ); + connect( config->keyboardVariants(), + &KeyboardVariantsModel::currentIndexChanged, + [ this ]( int index ) + { + ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) ); + m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) ); + } ); CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate ); } diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 8593f8385..5888fd071 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -118,15 +118,15 @@ loadLocales( const QString& localeGenPath ) // Assuming we have a list of supported locales, we usually only want UTF-8 ones // because it's not 1995. - auto notUtf8 = []( const QString& s ) { - return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive ); - }; + auto notUtf8 = []( const QString& s ) + { return !s.contains( "UTF-8", Qt::CaseInsensitive ) && !s.contains( "utf8", Qt::CaseInsensitive ); }; auto it = std::remove_if( localeGenLines.begin(), localeGenLines.end(), notUtf8 ); localeGenLines.erase( it, localeGenLines.end() ); // We strip " UTF-8" from "en_US.UTF-8 UTF-8" because it's redundant redundant. // Also simplify whitespace. - auto unredundant = []( QString& s ) { + auto unredundant = []( QString& s ) + { if ( s.endsWith( " UTF-8" ) ) { s.chop( 6 ); @@ -183,30 +183,36 @@ Config::Config( QObject* parent ) // we don't need to call an update-GS method, or introduce an intermediate // update-thing-and-GS method. And everywhere where we **do** change // language or location, we already emit the signal. - connect( this, &Config::currentLanguageCodeChanged, [&]() { - auto* gs = Calamares::JobQueue::instance()->globalStorage(); - gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() ); - } ); + connect( this, + &Config::currentLanguageCodeChanged, + [ & ]() + { + auto* gs = Calamares::JobQueue::instance()->globalStorage(); + gs->insert( "locale", m_selectedLocaleConfiguration.toBcp47() ); + } ); - connect( this, &Config::currentLCCodeChanged, [&]() { - updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() ); - } ); + connect( this, + &Config::currentLCCodeChanged, + [ & ]() { updateGSLocale( Calamares::JobQueue::instance()->globalStorage(), localeConfiguration() ); } ); - connect( this, &Config::currentLocationChanged, [&]() { - const bool locationChanged - = updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() ); + connect( this, + &Config::currentLocationChanged, + [ & ]() + { + const bool locationChanged + = updateGSLocation( Calamares::JobQueue::instance()->globalStorage(), currentLocation() ); - if ( locationChanged && m_adjustLiveTimezone ) - { - QProcess::execute( "timedatectl", // depends on systemd - { "set-timezone", currentTimezoneCode() } ); - } + if ( locationChanged && m_adjustLiveTimezone ) + { + QProcess::execute( "timedatectl", // depends on systemd + { "set-timezone", currentTimezoneCode() } ); + } - emit currentTimezoneCodeChanged( currentTimezoneCode() ); - emit currentTimezoneNameChanged( currentTimezoneName() ); - } ); + emit currentTimezoneCodeChanged( currentTimezoneCode() ); + emit currentTimezoneNameChanged( currentTimezoneName() ); + } ); - auto prettyStatusNotify = [&]() { emit prettyStatusChanged( prettyStatus() ); }; + auto prettyStatusNotify = [ & ]() { emit prettyStatusChanged( prettyStatus() ); }; connect( this, &Config::currentLanguageStatusChanged, prettyStatusNotify ); connect( this, &Config::currentLCStatusChanged, prettyStatusNotify ); connect( this, &Config::currentLocationStatusChanged, prettyStatusNotify ); diff --git a/src/modules/locale/LCLocaleDialog.cpp b/src/modules/locale/LCLocaleDialog.cpp index efa85c536..afdceb2a1 100644 --- a/src/modules/locale/LCLocaleDialog.cpp +++ b/src/modules/locale/LCLocaleDialog.cpp @@ -60,16 +60,19 @@ LCLocaleDialog::LCLocaleDialog( const QString& guessedLCLocale, const QStringLis connect( dbb->button( QDialogButtonBox::Cancel ), &QPushButton::clicked, this, &QDialog::reject ); connect( m_localesWidget, &QListWidget::itemDoubleClicked, this, &QDialog::accept ); - connect( m_localesWidget, &QListWidget::itemSelectionChanged, [this, dbb]() { - if ( m_localesWidget->selectedItems().isEmpty() ) - { - dbb->button( QDialogButtonBox::Ok )->setEnabled( false ); - } - else - { - dbb->button( QDialogButtonBox::Ok )->setEnabled( true ); - } - } ); + connect( m_localesWidget, + &QListWidget::itemSelectionChanged, + [ this, dbb ]() + { + if ( m_localesWidget->selectedItems().isEmpty() ) + { + dbb->button( QDialogButtonBox::Ok )->setEnabled( false ); + } + else + { + dbb->button( QDialogButtonBox::Ok )->setEnabled( true ); + } + } ); if ( selected > -1 ) { diff --git a/src/modules/locale/timezonewidget/timezonewidget.cpp b/src/modules/locale/timezonewidget/timezonewidget.cpp index 9ad9f2d3f..724bc59f7 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.cpp +++ b/src/modules/locale/timezonewidget/timezonewidget.cpp @@ -140,9 +140,9 @@ TimeZoneWidget::paintEvent( QPaintEvent* ) // .. the lambda manages deprecations: the old one works in Qt 5.9 and Qt 5.10, // while the new one avoids deprecation messages in Qt 5.13 and later. #if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 ) - auto textwidth = [&]( const QString& s ) { return fontMetrics.horizontalAdvance( s ); }; + auto textwidth = [ & ]( const QString& s ) { return fontMetrics.horizontalAdvance( s ); }; #else - auto textwidth = [&]( const QString& s ) { return fontMetrics.width( s ); }; + auto textwidth = [ & ]( const QString& s ) { return fontMetrics.width( s ); }; #endif const int textWidth = textwidth( m_currentLocation ? m_currentLocation->tr() : QString() ); const int textHeight = fontMetrics.height(); @@ -185,7 +185,8 @@ TimeZoneWidget::mousePressEvent( QMouseEvent* event ) int mX = event->pos().x(); int mY = event->pos().y(); - auto distance = [&]( const CalamaresUtils::Locale::TimeZoneData* zone ) { + auto distance = [ & ]( const CalamaresUtils::Locale::TimeZoneData* zone ) + { QPoint locPos = TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() ); return double( abs( mX - locPos.x() ) + abs( mY - locPos.y() ) ); }; diff --git a/src/modules/localeq/Map.qml b/src/modules/localeq/Map.qml index 5972b5c15..ab0a01a58 100644 --- a/src/modules/localeq/Map.qml +++ b/src/modules/localeq/Map.qml @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-FileCopyrightText: 2020 - 2022 Anke Boersma * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -112,7 +112,7 @@ Column { Plugin { id: mapPlugin - name: "esri" // "esri", "here", "itemsoverlay", "mapbox", "mapboxgl", "osm" + preferred: ["osm", "esri"] // "esri", "here", "itemsoverlay", "mapbox", "mapboxgl", "osm" } Map { @@ -121,7 +121,7 @@ Column { plugin: mapPlugin activeMapType: supportedMapTypes[0] //might be desirable to set zoom level configurable? - zoomLevel: 5 + zoomLevel: 7 bearing: 0 tilt: 0 copyrightsVisible : true @@ -167,12 +167,6 @@ Column { anchors.fill: map hoverEnabled: true property var coordinate: map.toCoordinate(Qt.point(mouseX, mouseY)) - Label { - x: parent.mouseX - width -5 - y: parent.mouseY - height - 5 - text: "%1, %2".arg( - parent.coordinate.latitude).arg(parent.coordinate.longitude) - } onClicked: { marker.coordinate = coordinate diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt index cfbd854c2..e605905c4 100644 --- a/src/modules/netinstall/CMakeLists.txt +++ b/src/modules/netinstall/CMakeLists.txt @@ -8,6 +8,7 @@ calamares_add_plugin(netinstall EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES Config.cpp + groupstreeview.cpp LoaderQueue.cpp NetInstallViewStep.cpp NetInstallPage.cpp diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index f7a2f66fc..9c70e97eb 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -35,10 +35,13 @@ NetInstallPage::NetInstallPage( Config* c, QWidget* parent ) ui->groupswidget->header()->setSectionResizeMode( QHeaderView::ResizeToContents ); ui->groupswidget->setModel( c->model() ); connect( c, &Config::statusChanged, ui->netinst_status, &QLabel::setText ); - connect( c, &Config::titleLabelChanged, [ui = this->ui]( const QString title ) { - ui->label->setVisible( !title.isEmpty() ); - ui->label->setText( title ); - } ); + connect( c, + &Config::titleLabelChanged, + [ ui = this->ui ]( const QString title ) + { + ui->label->setVisible( !title.isEmpty() ); + ui->label->setText( title ); + } ); connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups ); } diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index 72375d0f0..94ce6d4ba 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -1,4 +1,5 @@ -/* +/* === This file is part of Calamares - === + * * SPDX-FileCopyrightText: 2016 Luca Giambonini * SPDX-FileCopyrightText: 2016 Lisa Vitolo * SPDX-FileCopyrightText: 2017 Kyle Robbertze diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index 2ac0e73c9..99d51af9e 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -1,4 +1,5 @@ -/* +/* === This file is part of Calamares - === + * * SPDX-FileCopyrightText: 2016 Luca Giambonini * SPDX-FileCopyrightText: 2016 Lisa Vitolo * SPDX-FileCopyrightText: 2017 Kyle Robbertze diff --git a/src/modules/netinstall/PackageModel.cpp b/src/modules/netinstall/PackageModel.cpp index 256a77afd..d5bae1c89 100644 --- a/src/modules/netinstall/PackageModel.cpp +++ b/src/modules/netinstall/PackageModel.cpp @@ -349,11 +349,11 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa void PackageModel::setupModelData( const QVariantList& l ) { - Q_EMIT beginResetModel(); + beginResetModel(); delete m_rootItem; m_rootItem = new PackageTreeItem(); setupModelData( l, m_rootItem ); - Q_EMIT endResetModel(); + endResetModel(); } void @@ -361,7 +361,7 @@ PackageModel::appendModelData( const QVariantList& groupList ) { if ( m_rootItem ) { - Q_EMIT beginResetModel(); + beginResetModel(); const QStringList sources = collectSources( groupList ); @@ -386,6 +386,6 @@ PackageModel::appendModelData( const QVariantList& groupList ) // Add the new data to the model setupModelData( groupList, m_rootItem ); - Q_EMIT endResetModel(); + endResetModel(); } } diff --git a/src/modules/netinstall/PackageModel.h b/src/modules/netinstall/PackageModel.h index e97359a46..cc8668b2f 100644 --- a/src/modules/netinstall/PackageModel.h +++ b/src/modules/netinstall/PackageModel.h @@ -1,4 +1,3 @@ - /* === This file is part of Calamares - === * * SPDX-FileCopyrightText: 2017 Kyle Robbertze diff --git a/src/modules/netinstall/groupstreeview.cpp b/src/modules/netinstall/groupstreeview.cpp new file mode 100644 index 000000000..4e5ab8c8d --- /dev/null +++ b/src/modules/netinstall/groupstreeview.cpp @@ -0,0 +1,31 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ +#include "groupstreeview.h" + +#include "utils/Logger.h" + +#include + +void +GroupsTreeView::drawBranches( QPainter* painter, const QRect& rect, const QModelIndex& index ) const +{ + QTreeView::drawBranches( painter, rect, index ); + + // Empty names are handled specially: don't draw them as items, + // so the "branch" seems to just pass them by. + const QString s = index.data().toString(); + if ( s.isEmpty() ) + { + QStyleOptionViewItem opt = viewOptions(); + opt.state = QStyle::State_Sibling; + opt.rect = QRect( !isRightToLeft() ? rect.left() : rect.right() + 1, rect.top(), indentation(), rect.height() ); + painter->eraseRect( opt.rect ); + style()->drawPrimitive( QStyle::PE_IndicatorBranch, &opt, painter, this ); + } +} diff --git a/src/modules/netinstall/groupstreeview.h b/src/modules/netinstall/groupstreeview.h new file mode 100644 index 000000000..82f8bc031 --- /dev/null +++ b/src/modules/netinstall/groupstreeview.h @@ -0,0 +1,18 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ +#include + +class GroupsTreeView : public QTreeView +{ +public: + using QTreeView::QTreeView; + +protected: + virtual void drawBranches( QPainter* painter, const QRect& rect, const QModelIndex& index ) const override; +}; diff --git a/src/modules/netinstall/page_netinst.ui b/src/modules/netinstall/page_netinst.ui index f17e939cd..dd87ef7c4 100644 --- a/src/modules/netinstall/page_netinst.ui +++ b/src/modules/netinstall/page_netinst.ui @@ -36,13 +36,13 @@ SPDX-License-Identifier: GPL-3.0-or-later true - + 0 0 981 - 407 + 410 @@ -63,6 +63,13 @@ SPDX-License-Identifier: GPL-3.0-or-later + + + GroupsTreeView + QTreeView +
groupstreeview.h
+
+
diff --git a/src/modules/packagechooser/PackageChooserViewStep.cpp b/src/modules/packagechooser/PackageChooserViewStep.cpp index c3f2ce6e2..e3b27df5c 100644 --- a/src/modules/packagechooser/PackageChooserViewStep.cpp +++ b/src/modules/packagechooser/PackageChooserViewStep.cpp @@ -56,9 +56,9 @@ PackageChooserViewStep::widget() if ( !m_widget ) { m_widget = new PackageChooserPage( m_config->mode(), nullptr ); - connect( m_widget, &PackageChooserPage::selectionChanged, [=]() { - emit nextStatusChanged( this->isNextEnabled() ); - } ); + connect( m_widget, + &PackageChooserPage::selectionChanged, + [ = ]() { emit nextStatusChanged( this->isNextEnabled() ); } ); hookupModel(); } return m_widget; diff --git a/src/modules/partition/Config.cpp b/src/modules/partition/Config.cpp index 550e17460..367c4ee38 100644 --- a/src/modules/partition/Config.cpp +++ b/src/modules/partition/Config.cpp @@ -251,7 +251,9 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu gs->insert( "efiSystemPartitionSize", sizeString ); gs->insert( "efiSystemPartitionSize_i", part_size.toBytes() ); - if ( part_size.toBytes() != PartUtils::efiFilesystemMinimumSize() ) + // Assign long long int to long unsigned int to prevent compilation warning + size_t unsigned_part_size = part_size.toBytes(); + if ( unsigned_part_size != PartUtils::efiFilesystemMinimumSize() ) { cWarning() << "EFI partition size" << sizeString << "has been adjusted to" << PartUtils::efiFilesystemMinimumSize() << "bytes"; diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index 4a38ab4ca..de2a6bd4f 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -20,8 +20,10 @@ #include #include #include +#include #include #include +#include using CalamaresUtils::Partition::PartitionIterator; @@ -127,6 +129,120 @@ clonePartition( Device* device, Partition* partition ) partition->activeFlags() ); } +#ifndef WITH_KPMCORE4API +// This function was added in KPMCore 4, implementation copied from src/fs/luks.cpp +/* + SPDX-FileCopyrightText: 2010 Volker Lanz + SPDX-FileCopyrightText: 2012-2019 Andrius Štikonas + SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + SPDX-FileCopyrightText: 2016 Chantara Tith + SPDX-FileCopyrightText: 2017 Christian Morlok + SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + SPDX-FileCopyrightText: 2020 Arnaud Ferraris + SPDX-FileCopyrightText: 2020 Gaël PORTAY + + SPDX-License-Identifier: GPL-3.0-or-later +*/ +static bool +testPassphrase( FS::luks* fs, const QString& deviceNode, const QString& passphrase ) +{ + ExternalCommand cmd( QStringLiteral( "cryptsetup" ), + { QStringLiteral( "open" ), + QStringLiteral( "--tries" ), + QStringLiteral( "1" ), + QStringLiteral( "--test-passphrase" ), + deviceNode } ); + if ( cmd.write( passphrase.toLocal8Bit() + '\n' ) && cmd.start( -1 ) && cmd.exitCode() == 0 ) + { + return true; + } + + return false; +} +#else +static bool +testPassphrase( FS::luks* fs, const QString& deviceNode, const QString& passphrase ) +{ + return fs->testPassphrase( deviceNode, passphrase ); +} +#endif + +// Adapted from luks cryptOpen which always opens a dialog to ask for a passphrase +int +updateLuksDevice( Partition* partition, const QString& passphrase ) +{ + const QString deviceNode = partition->partitionPath(); + + cDebug() << "Update Luks device: " << deviceNode; + + if ( passphrase.isEmpty() ) + { + cWarning() << Logger::SubEntry << "#1: Passphrase is empty"; + return 1; + } + + if ( partition->fileSystem().type() != FileSystem::Luks ) + { + cWarning() << Logger::SubEntry << "#2: Not a luks encrypted device"; + return 2; + } + + // Cast partition fs to luks fs + FS::luks* luksFs = dynamic_cast< FS::luks* >( &partition->fileSystem() ); + + // Test the given passphrase + if ( !testPassphrase( luksFs, deviceNode, passphrase ) ) + { + cWarning() << Logger::SubEntry << "#3: Passphrase incorrect"; + return 3; + } + + if ( luksFs->isCryptOpen() ) + { + if ( !luksFs->mapperName().isEmpty() ) + { + cWarning() << Logger::SubEntry << "#4: Device already decrypted"; + return 4; + } + else + { + cDebug() << Logger::SubEntry << "No mapper node found"; + luksFs->setCryptOpen( false ); + } + } + + ExternalCommand openCmd( QStringLiteral( "cryptsetup" ), + { QStringLiteral( "open" ), deviceNode, luksFs->suggestedMapperName( deviceNode ) } ); + + if ( !( openCmd.write( passphrase.toLocal8Bit() + '\n' ) && openCmd.start( -1 ) && openCmd.exitCode() == 0 ) ) + { + cWarning() << Logger::SubEntry << openCmd.exitCode() << ": cryptsetup command failed"; + return openCmd.exitCode(); + } + + // Save the existing passphrase + luksFs->setPassphrase( passphrase ); + + luksFs->scan( deviceNode ); + + if ( luksFs->mapperName().isEmpty() ) + { + cWarning() << Logger::SubEntry << "#5: No mapper node found"; + return 5; + } + + luksFs->loadInnerFileSystem( luksFs->mapperName() ); + luksFs->setCryptOpen( luksFs->innerFS() != nullptr ); + + if ( !luksFs->isCryptOpen() ) + { + cWarning() << Logger::SubEntry << "#6: Device could not be decrypted"; + return 6; + } + + return 0; +} + Calamares::JobResult execute( Operation& operation, const QString& failureMessage ) { diff --git a/src/modules/partition/core/KPMHelpers.h b/src/modules/partition/core/KPMHelpers.h index 5648e6171..fe8713945 100644 --- a/src/modules/partition/core/KPMHelpers.h +++ b/src/modules/partition/core/KPMHelpers.h @@ -69,6 +69,8 @@ Partition* createNewEncryptedPartition( PartitionNode* parent, Partition* clonePartition( Device* device, Partition* partition ); +int updateLuksDevice( Partition* partition, const QString& passphrase ); + /** @brief Return a result for an @p operation * * Executes the operation, and if successful, returns a success result. diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index bf7c6e02c..6dddfe2f0 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -456,7 +456,6 @@ ChoicePage::continueApplyDeviceChoice() Q_EMIT deviceChosen(); } - void ChoicePage::onActionChanged() { @@ -465,6 +464,19 @@ ChoicePage::onActionChanged() { applyActionChoice( m_config->installChoice() ); } + + // Whole disk encryption isn't implemented for zfs so disable the option for now + if ( m_eraseFsTypesChoiceComboBox != nullptr && m_enableEncryptionWidget ) + { + if ( m_eraseFsTypesChoiceComboBox->currentText() == "zfs" ) + { + m_encryptWidget->hide(); + } + else + { + m_encryptWidget->show(); + } + } } void diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index 0bc35cabe..eeb548ba1 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -17,6 +17,7 @@ #include "ui_EditExistingPartitionDialog.h" #include "core/ColorUtils.h" +#include "core/KPMHelpers.h" #include "core/PartUtils.h" #include "core/PartitionCoreModule.h" #include "core/PartitionInfo.h" @@ -28,13 +29,17 @@ #include "Settings.h" #include "partition/FileSystem.h" #include "utils/Logger.h" +#include "widgets/TranslationFix.h" #include #include #include +#include #include #include +#include +#include #include using CalamaresUtils::Partition::untranslatedFS; @@ -52,6 +57,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, , m_usedMountPoints( usedMountPoints ) { m_ui->setupUi( this ); + m_ui->encryptWidget->hide(); standardMountPoints( *( m_ui->mountPointComboBox ), PartitionInfo::mountPoint( partition ) ); QColor color = ColorUtils::colorForPartition( m_partition ); @@ -132,10 +138,8 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, setFlagList( *( m_ui->m_listFlags ), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) ); } - EditExistingPartitionDialog::~EditExistingPartitionDialog() {} - PartitionTable::Flags EditExistingPartitionDialog::newFlags() const { @@ -242,8 +246,30 @@ EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) { core->setFilesystemLabel( m_device, m_partition, fsLabel ); } + core->refreshPartition( m_device, m_partition ); } + + // Update the existing luks partition + const QString passphrase = m_ui->encryptWidget->passphrase(); + if ( !passphrase.isEmpty() ) + { + int retCode = KPMHelpers::updateLuksDevice( m_partition, passphrase ); + if ( retCode != 0 ) + { + QString message = tr( "Passphrase for existing partition" ); + QString description = tr( "Partition %1 could not be decrypted " + "with the given passphrase." + "

" + "Edit the partition again and give the correct passphrase" + "or delete and create a new encrypted partition." ) + .arg( m_partition->partitionPath() ); + + QMessageBox mb( QMessageBox::Information, message, description, QMessageBox::Ok, this->parentWidget() ); + Calamares::fixButtonLabels( &mb ); + mb.exec(); + } + } } } @@ -266,7 +292,6 @@ EditExistingPartitionDialog::replacePartResizerWidget() m_partitionSizeController->setPartResizerWidget( widget, m_ui->formatRadioButton->isChecked() ); } - void EditExistingPartitionDialog::updateMountPointPicker() { @@ -293,13 +318,47 @@ EditExistingPartitionDialog::updateMountPointPicker() { setSelectedMountPoint( m_ui->mountPointComboBox, QString() ); } + + toggleEncryptWidget(); } void EditExistingPartitionDialog::checkMountPointSelection() { - validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), - m_usedMountPoints, - m_ui->mountPointExplanation, - m_ui->buttonBox->button( QDialogButtonBox::Ok ) ); + if ( validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), + m_usedMountPoints, + m_ui->mountPointExplanation, + m_ui->buttonBox->button( QDialogButtonBox::Ok ) ) ) + { + toggleEncryptWidget(); + } +} + +void +EditExistingPartitionDialog::toggleEncryptWidget() +{ + // Show/hide encryptWidget: + // check if partition is a previously luks formatted partition + // and not currently formatted + // and its mount point not a standard mount point except when it's /home + QString mp = selectedMountPoint( m_ui->mountPointComboBox ); + if ( !mp.isEmpty() && m_partition->fileSystem().type() == FileSystem::Luks && !m_ui->formatRadioButton->isChecked() + && ( !standardMountPoints().contains( mp ) || mp == "/home" ) ) + { + m_ui->encryptWidget->show(); + m_ui->encryptWidget->reset( false ); + } + // TODO: When formatting a partition user must be able to encrypt that partition + // Probably need to delete this partition and create a new one + // else if ( m_ui->formatRadioButton->isChecked() + // && !mp.isEmpty()) + // { + // m_ui->encryptWidget->show(); + // m_ui->encryptWidget->reset(); + // } + else + { + m_ui->encryptWidget->reset(); + m_ui->encryptWidget->hide(); + } } diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.h b/src/modules/partition/gui/EditExistingPartitionDialog.h index 89b5b55e4..5d1e7fd65 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.h +++ b/src/modules/partition/gui/EditExistingPartitionDialog.h @@ -32,6 +32,11 @@ class EditExistingPartitionDialog : public QDialog { Q_OBJECT public: + struct FreeSpace + { + Partition* p; + }; + EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, @@ -53,6 +58,7 @@ private: PartitionTable::Flags newFlags() const; void replacePartResizerWidget(); void updateMountPointPicker(); + void toggleEncryptWidget(); }; #endif /* EDITEXISTINGPARTITIONDIALOG_H */ diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.ui b/src/modules/partition/gui/EditExistingPartitionDialog.ui index 4a9982656..ff9cc33c5 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.ui +++ b/src/modules/partition/gui/EditExistingPartitionDialog.ui @@ -10,8 +10,8 @@ SPDX-License-Identifier: GPL-3.0-or-later 0 0 - 450 - 615 + 570 + 689 @@ -97,7 +97,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
- + &Mount Point: @@ -107,7 +107,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - + @@ -153,14 +153,14 @@ SPDX-License-Identifier: GPL-3.0-or-later - + Flags: - + true @@ -173,7 +173,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - + Label for the filesystem @@ -183,20 +183,39 @@ SPDX-License-Identifier: GPL-3.0-or-later - + FS Label: - + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + @@ -218,6 +237,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
kpmcore/gui/partresizerwidget.h
1 + + EncryptWidget + QWidget +
gui/EncryptWidget.h
+ 1 +
sizeSpinBox diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index fe7623050..41272bc4b 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -70,14 +70,17 @@ EncryptWidget::EncryptWidget( QWidget* parent ) void -EncryptWidget::reset() +EncryptWidget::reset( bool checkVisible ) { m_ui->m_passphraseLineEdit->clear(); m_ui->m_confirmLineEdit->clear(); m_ui->m_encryptCheckBox->setChecked( false ); -} + m_ui->m_encryptCheckBox->setVisible( checkVisible ); + m_ui->m_passphraseLineEdit->setVisible( !checkVisible ); + m_ui->m_confirmLineEdit->setVisible( !checkVisible ); +} EncryptWidget::Encryption EncryptWidget::state() const @@ -146,7 +149,7 @@ EncryptWidget::updateState() } Encryption newState; - if ( m_ui->m_encryptCheckBox->isChecked() ) + if ( m_ui->m_encryptCheckBox->isChecked() || !m_ui->m_encryptCheckBox->isVisible() ) { if ( !m_ui->m_passphraseLineEdit->text().isEmpty() && m_ui->m_passphraseLineEdit->text() == m_ui->m_confirmLineEdit->text() ) diff --git a/src/modules/partition/gui/EncryptWidget.h b/src/modules/partition/gui/EncryptWidget.h index 5c24d68e6..704365817 100644 --- a/src/modules/partition/gui/EncryptWidget.h +++ b/src/modules/partition/gui/EncryptWidget.h @@ -33,7 +33,7 @@ public: explicit EncryptWidget( QWidget* parent = nullptr ); - void reset(); + void reset( bool checkVisible = true ); Encryption state() const; void setText( const QString& text ); diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index a4de6cc47..7a5f2bab4 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -96,7 +96,8 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent ) connect( view->selectionModel(), &QItemSelectionModel::selectionChanged, - [this]( const QItemSelection& selected, const QItemSelection& ) { + [ this ]( const QItemSelection& selected, const QItemSelection& ) + { auto i = selected.indexes(); if ( !i.isEmpty() ) { diff --git a/src/modules/summary/Config.cpp b/src/modules/summary/Config.cpp index 9038f786f..6eddfa3f7 100644 --- a/src/modules/summary/Config.cpp +++ b/src/modules/summary/Config.cpp @@ -61,7 +61,7 @@ SummaryModel::rowCount( const QModelIndex& ) const void SummaryModel::setSummaryList( const Calamares::ViewStepList& steps, bool withWidgets ) { - Q_EMIT beginResetModel(); + beginResetModel(); m_summary.clear(); for ( Calamares::ViewStep* step : steps ) @@ -76,7 +76,7 @@ SummaryModel::setSummaryList( const Calamares::ViewStepList& steps, bool withWid m_summary << StepSummary { step->prettyName(), text, widget }; } - Q_EMIT endResetModel(); + endResetModel(); } Config::Config( QObject* parent ) diff --git a/src/modules/tracking/TrackingPage.cpp b/src/modules/tracking/TrackingPage.cpp index 727efebbd..a5fb3ccc6 100644 --- a/src/modules/tracking/TrackingPage.cpp +++ b/src/modules/tracking/TrackingPage.cpp @@ -45,16 +45,22 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent ) &QCheckBox::stateChanged, \ config->x##Tracking(), \ QOverload< bool >::of( &TrackingStyleConfig::setTracking ) ); \ - connect( config->x##Tracking(), &TrackingStyleConfig::trackingChanged, this, [this, config]() { \ - this->trackerChanged( config->x##Tracking(), this->ui->x##Group, this->ui->x##CheckBox ); \ - } ); \ - connect( ui->x##PolicyButton, &QAbstractButton::clicked, config, [config] { \ - QString url( config->x##Tracking()->policy() ); \ - if ( !url.isEmpty() ) \ - { \ - QDesktopServices::openUrl( url ); \ - } \ - } ); \ + connect( config->x##Tracking(), \ + &TrackingStyleConfig::trackingChanged, \ + this, \ + [ this, config ]() \ + { this->trackerChanged( config->x##Tracking(), this->ui->x##Group, this->ui->x##CheckBox ); } ); \ + connect( ui->x##PolicyButton, \ + &QAbstractButton::clicked, \ + config, \ + [ config ] \ + { \ + QString url( config->x##Tracking()->policy() ); \ + if ( !url.isEmpty() ) \ + { \ + QDesktopServices::openUrl( url ); \ + } \ + } ); \ } while ( false ) trackingSetup( install ); @@ -63,16 +69,19 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent ) #undef trackingSetup - connect( config, &Config::generalPolicyChanged, [this]( const QString& url ) { - this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); - } ); - connect( ui->generalPolicyLabel, &QLabel::linkActivated, [config] { - QString url( config->generalPolicy() ); - if ( !url.isEmpty() ) - { - QDesktopServices::openUrl( url ); - } - } ); + connect( config, + &Config::generalPolicyChanged, + [ this ]( const QString& url ) { this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); } ); + connect( ui->generalPolicyLabel, + &QLabel::linkActivated, + [ config ] + { + QString url( config->generalPolicy() ); + if ( !url.isEmpty() ) + { + QDesktopServices::openUrl( url ); + } + } ); retranslate(); } diff --git a/src/modules/users/CheckPWQuality.cpp b/src/modules/users/CheckPWQuality.cpp index 0a67a117a..fc692d246 100644 --- a/src/modules/users/CheckPWQuality.cpp +++ b/src/modules/users/CheckPWQuality.cpp @@ -49,7 +49,7 @@ DEFINE_CHECK_FUNC( minLength ) { cDebug() << Logger::SubEntry << "minLength set to" << minLength; checks.push_back( PasswordCheck( []() { return QCoreApplication::translate( "PWQ", "Password is too short" ); }, - [minLength]( const QString& s ) { return s.length() >= minLength; }, + [ minLength ]( const QString& s ) { return s.length() >= minLength; }, PasswordCheck::Weight( 10 ) ) ); } } @@ -65,7 +65,7 @@ DEFINE_CHECK_FUNC( maxLength ) { cDebug() << Logger::SubEntry << "maxLength set to" << maxLength; checks.push_back( PasswordCheck( []() { return QCoreApplication::translate( "PWQ", "Password is too long" ); }, - [maxLength]( const QString& s ) { return s.length() <= maxLength; }, + [ maxLength ]( const QString& s ) { return s.length() <= maxLength; }, PasswordCheck::Weight( 10 ) ) ); } } @@ -378,8 +378,9 @@ DEFINE_CHECK_FUNC( libpwquality ) /* Something actually added? */ if ( requirement_count ) { - checks.push_back( PasswordCheck( [settings]() { return settings->explanation(); }, - [settings]( const QString& s ) { + checks.push_back( PasswordCheck( [ settings ]() { return settings->explanation(); }, + [ settings ]( const QString& s ) + { int r = settings->check( s ); if ( r < 0 ) { diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index 8f36862ce..b0bd94d7e 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -78,6 +78,20 @@ updateGSAutoLogin( bool doAutoLogin, const QString& login ) } } +static const QStringList& +alwaysForbiddenLoginNames() +{ + static QStringList s { QStringLiteral( "root" ), QStringLiteral( "nobody" ) }; + return s; +} + +static const QStringList& +alwaysForbiddenHostNames() +{ + static QStringList s { QStringLiteral( "localhost" ) }; + return s; +} + const NamedEnumTable< HostNameAction >& hostnameActionNames() { diff --git a/src/modules/users/Tests.cpp b/src/modules/users/Tests.cpp index 2ce0c0a7b..ac27570ca 100644 --- a/src/modules/users/Tests.cpp +++ b/src/modules/users/Tests.cpp @@ -120,6 +120,11 @@ UserTests::testGetSet() QVERIFY( c.loginNameStatus().isEmpty() ); // now it's still ok QCOMPARE( c.loginName(), lg ); QCOMPARE( c.fullName(), ful ); + } + // Test forbidden login names + { + QVERIFY( c.forbiddenLoginNames().contains( QStringLiteral( "root" ) ) ); + QVERIFY( c.loginNameStatus().isEmpty() ); // it's ok now c.setLoginName( "root" ); QVERIFY( !c.loginNameStatus().isEmpty() ); // can't be root } diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 9f991a53a..0b0961815 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -165,7 +165,7 @@ WelcomePage::setupButton( Button role, const QString& url ) { auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ); button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) ); - connect( button, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } ); + connect( button, &QPushButton::clicked, [ u ]() { QDesktopServices::openUrl( u ); } ); } else {