diff --git a/src/modules/users/gui/UsersPage.cpp b/src/modules/users/gui/UsersPage.cpp
index ce9d5e73b..9617eb1d8 100644
--- a/src/modules/users/gui/UsersPage.cpp
+++ b/src/modules/users/gui/UsersPage.cpp
@@ -193,6 +193,8 @@ UsersPage::addUserClicked() {
ui->rootPw->setText(dlg->password);
ui->confirmRootPw->setText(dlg->password);
}
+
+ ui->labelNoUser->hide();
}
delete dlg;
@@ -272,7 +274,7 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
m_avatarFilePath.replace("~", home);
}
- j = new SetAvatarJob( user->avatarFile, m_avatarFilePath );
+ j = new SetAvatarJob( user->avatarFile, m_avatarFilePath, user->username, defaultGroupsList[0] );
list.append( Calamares::job_ptr(j) );
}
}
@@ -292,12 +294,8 @@ UsersPage::onActivate()
{
emit checkReady( isReady() );
- // If there is no user yet, open the dialog as soon as the
- // page is enabled. This makes it easy for people who want
- // to create one user.
- if (m_userModel.rowCount() == 0) {
- addUserClicked();
- }
+ ui->labelNoUser->setText( QObject::tr( "Please create at least one user." ) );
+ ui->labelNoUser->show();
}
void
diff --git a/src/modules/users/gui/page_usersetup.ui b/src/modules/users/gui/page_usersetup.ui
index 64cac7966..a936839cd 100644
--- a/src/modules/users/gui/page_usersetup.ui
+++ b/src/modules/users/gui/page_usersetup.ui
@@ -7,7 +7,7 @@
0
0
694
- 475
+ 447
@@ -109,7 +109,7 @@
0
0
678
- 249
+ 197
@@ -270,6 +270,18 @@
+ -
+
+
+
+ true
+
+
+
+
+
+
+
diff --git a/src/modules/users/jobs/SetAvatarJob.cpp b/src/modules/users/jobs/SetAvatarJob.cpp
index 6a582f1c8..7bd57e59d 100644
--- a/src/modules/users/jobs/SetAvatarJob.cpp
+++ b/src/modules/users/jobs/SetAvatarJob.cpp
@@ -19,16 +19,19 @@
#include
#include "GlobalStorage.h"
+#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "JobQueue.h"
#include
#include
-SetAvatarJob::SetAvatarJob(const QString &avatarFile, const QString &destPath)
+SetAvatarJob::SetAvatarJob(const QString &avatarFile, const QString &destPath, const QString& owner, const QString& group)
: Calamares::Job()
, m_avatarFile(avatarFile)
, m_destPath(destPath)
+ , m_owner(owner)
+ , m_group(group)
{
}
@@ -70,15 +73,23 @@ Calamares::JobResult SetAvatarJob::exec()
QString destination( destDir + m_destPath );
QFile avatarFile( m_avatarFile );
+ QString userGroup( m_owner + ":" + m_group );
+ // We do not return errors in case of issues with the avatar, as it is not
+ // critical enough to stop the whole installation.
if (!avatarFile.exists()) {
cLog() << "Avatar file does not exist";
- return Calamares::JobResult::error( tr("Avatar file does not exist") );
}
-
if (!avatarFile.copy(destination)) {
- cLog() << "Error copying:" << avatarFile.errorString();
- return Calamares::JobResult::error( tr("Error copying") );
+ cLog() << "Error copying avatar:" << avatarFile.errorString();
+ } else {
+ int ec = CalamaresUtils::System::instance()->
+ targetEnvCall({ "chown",
+ userGroup,
+ m_destPath });
+ if ( ec ) {
+ cLog() << "Error changing ownership of the avatar file. Exit code: " << ec;
+ }
}
return Calamares::JobResult::ok();
diff --git a/src/modules/users/jobs/SetAvatarJob.h b/src/modules/users/jobs/SetAvatarJob.h
index fddf42a99..5908b4815 100644
--- a/src/modules/users/jobs/SetAvatarJob.h
+++ b/src/modules/users/jobs/SetAvatarJob.h
@@ -25,7 +25,7 @@ class SetAvatarJob : public Calamares::Job
{
Q_OBJECT
public:
- SetAvatarJob( const QString& avatarFile, const QString& destPath );
+ SetAvatarJob( const QString& avatarFile, const QString& destPath, const QString& owner, const QString& group );
QString prettyName() const override;
QString prettyDescription() const override;
QString prettyStatusMessage() const override;
@@ -33,6 +33,9 @@ public:
private:
const QString m_avatarFile;
const QString m_destPath;
+ // Owner and group of the destination avatar file.
+ const QString m_owner;
+ const QString m_group;
};