~ubuntu-branches/ubuntu/dapper/ksystemlog/dapper

« back to all changes in this revision

Viewing changes to ksystemlog/src/kernel/kernelOptions.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-07-07 16:00:00 UTC
  • Revision ID: james.westby@ubuntu.com-20050707160000-a104d769ph3yfkg4
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
19
 ***************************************************************************/
 
20
 
 
21
//Qt includes
 
22
#include <qlayout.h>
 
23
#include <qvgroupbox.h>
 
24
#include <qbuttongroup.h>
 
25
#include <qlabel.h>
 
26
#include <qpushbutton.h>
 
27
#include <qvbox.h>
 
28
#include <qhbox.h>
 
29
 
 
30
//KDE includes
 
31
#include <klocale.h>
 
32
#include <kactioncollection.h>
 
33
#include <kbuttonbox.h>
 
34
#include <klistbox.h>
 
35
#include <kfiledialog.h>
 
36
#include <kurl.h>
 
37
#include <kmessagebox.h>
 
38
#include <kiconloader.h>
 
39
 
 
40
#include <kdebug.h>
 
41
 
 
42
//Project includes
 
43
#include "kernelOptions.h"
 
44
#include "ksystemlogConfig.h"
 
45
 
 
46
KernelOptions::KernelOptions(QWidget *parent) : 
 
47
        QWidget(parent) 
 
48
        {
 
49
        
 
50
        QHBoxLayout *layout = new QHBoxLayout(this);
 
51
        layout->setAutoAdd(true);
 
52
 
 
53
        QString description= i18n("<qt><p>These files will be analyzed to display <b>Kernel logs</b>. This list also determines the order in which the files are read.</p></qt>");
 
54
        fileList=new SpecificFileList(this, description);
 
55
        
 
56
        connect(fileList, SIGNAL(fileListChanged(int)), this, SLOT(slotFileListChanged(int)));
 
57
 
 
58
        readConfig();
 
59
        
 
60
 
 
61
}
 
62
 
 
63
KernelOptions::~KernelOptions() {
 
64
        
 
65
}
 
66
 
 
67
bool KernelOptions::isValid() {
 
68
        if (fileList->count()>0)
 
69
                return(true);
 
70
        else
 
71
                return(false);
 
72
}
 
73
 
 
74
void KernelOptions::slotFileListChanged(int itemLeft) {
 
75
        if (itemLeft==0)
 
76
                emit optionsChanged(false);
 
77
        else
 
78
                emit optionsChanged(true);
 
79
}
 
80
 
 
81
void KernelOptions::saveConfig() {
 
82
        kdDebug() << "Saving config from Kernel Options..." << endl;
 
83
        
 
84
        QStringList stringList;
 
85
        QValueList<int> valueList;
 
86
                
 
87
        fileList->saveConfig(stringList, valueList);
 
88
        
 
89
        KSystemLogConfig::setKernelPaths(stringList);
 
90
        KSystemLogConfig::setKernelLevels(valueList);
 
91
}
 
92
 
 
93
void KernelOptions::readConfig() {
 
94
        QStringList stringList=KSystemLogConfig::kernelPaths();
 
95
        QValueList<int> valueList=KSystemLogConfig::kernelLevels();
 
96
        
 
97
        fileList->readConfig(stringList, valueList);
 
98
}
 
99
 
 
100
 
 
101
#include "kernelOptions.moc"