KSystemLog – system log viewer tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

acpidOptions.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /***************************************************************************
  2. * Copyright (C) 2005 by Nicolas Ternisien *
  3. * nicolas.ternisien@gmail.com *
  4. * *
  5. * This program 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 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program 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 this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
  19. ***************************************************************************/
  20. //TQt includes
  21. #include <tqlayout.h>
  22. #include <tqvgroupbox.h>
  23. #include <tqbuttongroup.h>
  24. #include <tqlabel.h>
  25. #include <tqpushbutton.h>
  26. #include <tqvbox.h>
  27. #include <tqhbox.h>
  28. //KDE includes
  29. #include <tdelocale.h>
  30. #include <tdeactioncollection.h>
  31. #include <kbuttonbox.h>
  32. #include <tdelistbox.h>
  33. #include <tdefiledialog.h>
  34. #include <kurl.h>
  35. #include <tdemessagebox.h>
  36. #include <kiconloader.h>
  37. #include <kdebug.h>
  38. //Project includes
  39. #include "acpidOptions.h"
  40. #include "ksystemlogConfig.h"
  41. AcpidOptions::AcpidOptions(TQWidget *parent) :
  42. TQWidget(parent)
  43. {
  44. TQHBoxLayout *layout = new TQHBoxLayout(this);
  45. layout->setAutoAdd(true);
  46. TQString description=i18n("<qt><p>These files will be analyzed to display <b>ACPId log</b>. This list also determines the order in which the files are read.</p></qt>");
  47. fileList=new FileList(this, description);
  48. connect(fileList, TQT_SIGNAL(fileListChanged(int)), this, TQT_SLOT(slotFileListChanged(int)));
  49. readConfig();
  50. }
  51. AcpidOptions::~AcpidOptions() {
  52. //TODO Delete fileList (and also in other *Options classes)
  53. }
  54. bool AcpidOptions::isValid() {
  55. if (fileList->count()>0)
  56. return(true);
  57. else
  58. return(false);
  59. }
  60. void AcpidOptions::slotFileListChanged(int itemLeft) {
  61. if (itemLeft==0)
  62. emit optionsChanged(false);
  63. else
  64. emit optionsChanged(true);
  65. }
  66. void AcpidOptions::saveConfig() {
  67. kdDebug() << "Save config from AcpidOptions" << endl;
  68. TQStringList list;
  69. int count=fileList->count();
  70. for (int i=0; i<count; i++) {
  71. list.push_back(fileList->getText(i));
  72. }
  73. KSystemLogConfig::setAcpidPaths(list);
  74. }
  75. void AcpidOptions::readConfig() {
  76. TQStringList files(KSystemLogConfig::acpidPaths());
  77. TQStringList::iterator it;
  78. for(it=files.begin(); it!=files.end(); ++it) {
  79. fileList->insertItem(*it);
  80. }
  81. }
  82. #include "acpidOptions.moc"