1 /* 2 KApacheLog, a apache log viewer tool 3 SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com> 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #include "acpidConfigurationWidget.h" 9 AcpidConfigurationWidget()10AcpidConfigurationWidget::AcpidConfigurationWidget() 11 : LogModeConfigurationWidget(i18n("Acpid Log"), QStringLiteral(ACPID_MODE_ICON), i18n("Acpid Log")) 12 { 13 auto layout = new QHBoxLayout(this); 14 15 mFileList = new FileList(this, i18n("<p>These files will be analyzed to show the <b>Acpid log</b>.</p>")); 16 connect(mFileList, &FileList::fileListChanged, this, &LogModeConfigurationWidget::configurationChanged); 17 layout->addWidget(mFileList); 18 } 19 saveConfig()20void AcpidConfigurationWidget::saveConfig() 21 { 22 auto *acpidConfiguration = Globals::instance().findLogMode(QStringLiteral(ACPID_LOG_MODE_ID))->logModeConfiguration<AcpidConfiguration *>(); 23 24 acpidConfiguration->setAcpidPaths(mFileList->paths()); 25 } 26 readConfig()27void AcpidConfigurationWidget::readConfig() 28 { 29 auto *acpidConfiguration = Globals::instance().findLogMode(QStringLiteral(ACPID_LOG_MODE_ID))->logModeConfiguration<AcpidConfiguration *>(); 30 31 mFileList->removeAllItems(); 32 33 mFileList->addPaths(acpidConfiguration->acpidPaths()); 34 } 35 defaultConfig()36void AcpidConfigurationWidget::defaultConfig() 37 { 38 // TODO Find a way to read the configuration per default 39 readConfig(); 40 } 41 isValid() const42bool AcpidConfigurationWidget::isValid() const 43 { 44 if (!mFileList->isEmpty()) { 45 return true; 46 } 47 48 return false; 49 } 50