summaryrefslogtreecommitdiffstats
path: root/kmyfirewall/kmfwidgets/kmfchecklistoutput.cpp
blob: f57c347669353449ebe8590517d5e4f38bcc5b0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/***************************************************************************
 begin                : Tue Jul 30 2002
 copyright            : (C) 2002 by Christian Hubinger
 email                : chubinger@irrsinnig.org
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kmfchecklistoutput.h"

// TQt includs
#include <tqlabel.h>
#include <tqlistbox.h>
#include <tqpushbutton.h>
#include <tqlistview.h>
#include <tqlayout.h>
#include <tqstring.h>

// kde includes
#include <tdelocale.h>
#include <kdebug.h>
#include <tdeglobal.h>
#include <kiconloader.h>

namespace KMF {
KMFCheckListOutput::KMFCheckListOutput( TQWidget *parent, const char *name , bool modal, WFlags fl ) : TQDialog( parent, name, modal, fl ) {
	setCaption( "KMyFirewall" );
	TQGridLayout *l_prog = new TQGridLayout( this,4,2,6,11 );
  text = new TQLabel( i18n("<qt><b>Trying to guess the system configuration...</b><br>"
													"If errors are occurring you'll have to setup the configuration yourself."
													"</qt>"), this);
	l_prog -> addMultiCellWidget( text, 0, 0, 0, 2 );

	mpb_ok = new TQPushButton( this, "Ok" );
	mpb_ok->setText( i18n( "&Close Window" ) );
	l_prog -> addMultiCellWidget( mpb_ok, 4, 4, 0, 2 );

	mlb_outputView = new TQListView( this, "msg" );
	mlb_outputView->addColumn( i18n( "Looking For" ) );
	mlb_outputView->addColumn( i18n( "Found?" ) );
	mlb_outputView->setSelectionMode( TQListView::NoSelection );
	mlb_outputView->setSorting( -1 );
	l_prog -> addMultiCellWidget( mlb_outputView, 1, 3, 0, 2 );


	connect( mpb_ok, TQ_SIGNAL( clicked() ) , this, TQ_SLOT( hide() ) );
	m_currItem = new TQListViewItem( mlb_outputView );
	m_currItem->setText( 0, i18n( "Starting system scan..." ) );
	loadIcons();
	this->resize( 450, 450 );
}

KMFCheckListOutput::~KMFCheckListOutput() {}

void KMFCheckListOutput::appendLine( const TQString &txt ) {
	TQListViewItem * item = new TQListViewItem( mlb_outputView, m_currItem );
	item->setMultiLinesEnabled( true );
	item->setText( 0, txt );
	m_currItem = item;
	kdDebug() << "void KMFCheckListOutput::appendLine(TQString txt)" << endl;
}

void KMFCheckListOutput::setStatus( bool ok, const TQString &err_msg ) {
	kdDebug() << "void KMFCheckListOutput::setStatus(bool ok,TQString &err_msg)" << endl;
	if ( ok ) {
		m_currItem->setPixmap( 1, icon_ok );
	} else {
		m_currItem->setPixmap( 1, icon_err );
		m_currItem->setOpen( true );
		if ( !err_msg.isEmpty() ) {
			TQListViewItem * item = new TQListViewItem( m_currItem );
			item->setText( 0, err_msg );
		}
	}
}

void KMFCheckListOutput::clearList() {
	kdDebug() << "void KMFCheckListOutput::clearList()" << endl;
	mlb_outputView->clear();
}

void KMFCheckListOutput::loadIcons() {
	kdDebug() << "void KMFCheckListOutput::loadIcons()" << endl;
	TDEIconLoader *loader = TDEGlobal::iconLoader();
	TQString icon_name;

	icon_name = "process-stop";
	icon_err = loader->loadIcon( icon_name, TDEIcon::Small );

	icon_name = "button_ok";
	icon_ok = loader->loadIcon( icon_name, TDEIcon::Small );

}

}

#include "kmfchecklistoutput.moc"