source: calamares/trunk/fuentes/src/modules/plasmalnf/PlasmaLnfJob.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.0 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "PlasmaLnfJob.h"
20
21#include "GlobalStorage.h"
22#include "JobQueue.h"
23#include "utils/CalamaresUtilsSystem.h"
24#include "utils/Logger.h"
25
26PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id )
27    : m_lnfPath( lnfPath )
28    , m_id( id )
29{
30}
31
32
33PlasmaLnfJob::~PlasmaLnfJob()
34{
35}
36
37
38QString
39PlasmaLnfJob::prettyName() const
40{
41    return tr( "Plasma Look-and-Feel Job" );
42}
43
44QString
45PlasmaLnfJob::prettyDescription() const
46{
47    return prettyName();
48}
49
50QString PlasmaLnfJob::prettyStatusMessage() const
51{
52    return prettyName();
53}
54
55
56Calamares::JobResult
57PlasmaLnfJob::exec()
58{
59    cDebug() << "Plasma Look-and-Feel Job";
60
61    auto system = CalamaresUtils::System::instance();
62    Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
63
64    QStringList command(
65    {
66        "sudo", "-E", "-H", "-u", gs->value( "username" ).toString(),
67        m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id
68    } );
69
70    int r = system->targetEnvCall( command );
71    if ( r )
72        return Calamares::JobResult::error(
73                   tr( "Could not select KDE Plasma Look-and-Feel package" ),
74                   tr( "Could not select KDE Plasma Look-and-Feel package" ) );
75
76    return Calamares::JobResult::ok();
77}
78
Note: See TracBrowser for help on using the repository browser.