Commit 9c9fba84 authored by vfjpl's avatar vfjpl

prefixes for 125

parent 72419e60
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -83,12 +84,25 @@ ActionDialog::ActionDialog( QWidget* parent ) :
this, &ActionDialog::reject );
}
ActionDialog::~ActionDialog()
{
delete m_terminal;
delete m_messageLabel;
delete m_informationLabel;
delete m_showDetails;
delete m_progressBar;
delete m_buttonBox;
}
void
ActionDialog::writeToTerminal( const QString& information )
{
m_terminal->append( information );
}
void
ActionDialog::showDetails( const QString& link )
{
......@@ -110,6 +124,7 @@ ActionDialog::showDetails( const QString& link )
}
}
void
ActionDialog::startJob()
{
......@@ -124,7 +139,7 @@ ActionDialog::startJob()
KAuth::ExecuteJob* kAuthJob = m_installAction.execute();
connect( kAuthJob, &KAuth::ExecuteJob::newData,
[=] ( const QVariantMap &data )
[this] ( const QVariantMap &data )
{
QString output = data.value( "Data" ).toString();
foreach ( auto line, output.split( QRegExp( "[\r\n]" ),QString::SkipEmptyParts ) )
......@@ -140,17 +155,16 @@ ActionDialog::startJob()
} );
connect( kAuthJob, &KAuth::ExecuteJob::result,
[=] ( KJob *kjob )
[this] ( KJob *kjob )
{
auto job = qobject_cast<KAuth::ExecuteJob*>( kjob );
if ( job->error() == 0 )
jobDone( true, tr ( "Changes failed, click on 'Show Details' for more information" ) );
if ( kjob->error() == 0 )
jobDone( true, tr ( "Changes were made successfully" ) );
else
jobDone( false, tr ( "Changes failed, click on 'Show Details' for more information" ) );
} );
connect( kAuthJob, &KAuth::ExecuteJob::statusChanged,
[=] ( KAuth::Action::AuthStatus status )
[this] ( KAuth::Action::AuthStatus status )
{
// switch (status) {
// case KAuth::Action::AuthStatus::DeniedStatus : {
......@@ -173,25 +187,12 @@ ActionDialog::startJob()
kAuthJob->start();
}
void
ActionDialog::jobDone ( bool success, QString message )
{
if ( success )
{
m_jobSuccesful = true;
if ( message != NULL )
m_messageLabel->setText( tr ( "Changes were made successfully" ) );
else
m_messageLabel->setText( message );
}
else
{
m_jobSuccesful = false;
if ( message != NULL )
m_messageLabel->setText( tr ( "Changes failed, click on 'Show Details' for more information" ) );
else
m_messageLabel->setText( message );
}
m_jobSuccesful = success;
m_messageLabel->setText( message );
m_terminal->append( QString( "\n" ) );
m_terminal->append( QString( tr( "Done ..." ) ) );
......@@ -201,12 +202,14 @@ ActionDialog::jobDone ( bool success, QString message )
m_progressBar->setValue( 100 );
}
bool
ActionDialog::isJobSuccesful() const
{
return m_jobSuccesful;
}
void
ActionDialog::updateInfo( const QString& data )
{
......@@ -214,6 +217,7 @@ ActionDialog::updateInfo( const QString& data )
m_informationLabel->setText( data );
}
KAuth::Action
ActionDialog::installAction() const
{
......
......@@ -34,6 +34,7 @@ class ActionDialog : public QDialog
public:
explicit ActionDialog( QWidget* parent = 0 );
~ActionDialog();
KAuth::Action installAction() const;
void setInstallAction( const KAuth::Action& installAction );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment