24 #include <tqbuttongroup.h>
27 #include <tqradiobutton.h>
29 #include <tdeconfig.h>
30 #include <kcombobox.h>
32 #include <tdelocale.h>
34 #include "viewconfigurefilterpage.h"
37 ViewConfigureFilterPage::ViewConfigureFilterPage( TQWidget *parent,
39 : TQWidget( parent, name )
41 TQBoxLayout *topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint() );
43 mFilterGroup =
new TQButtonGroup();
44 connect( mFilterGroup, TQ_SIGNAL( clicked(
int ) ), TQ_SLOT( buttonClicked(
int ) ) );
46 TQLabel *label =
new TQLabel( i18n(
"The default filter will be activated whenever"
47 " this view is displayed. This feature allows you to configure views that only"
48 " interact with certain types of information based on the filter. Once the view"
49 " is activated, the filter can be changed at anytime." ),
this );
50 label->setAlignment( TQt::AlignLeft | TQt::AlignTop | TQt::WordBreak );
51 topLayout->addWidget( label );
53 TQWidget *spacer =
new TQWidget(
this );
54 spacer->setMinimumHeight( 5 );
55 topLayout->addWidget( spacer );
57 TQRadioButton *button =
new TQRadioButton( i18n(
"No default filter" ),
this );
58 mFilterGroup->insert( button );
59 topLayout->addWidget( button );
61 button =
new TQRadioButton( i18n(
"Use last active filter" ),
this );
62 mFilterGroup->insert( button );
63 topLayout->addWidget( button );
65 TQBoxLayout *comboLayout =
new TQHBoxLayout();
66 topLayout->addLayout( comboLayout );
67 button =
new TQRadioButton( i18n(
"Use filter:" ),
this );
68 mFilterGroup->insert( button );
69 comboLayout->addWidget( button );
71 mFilterCombo =
new KComboBox(
this );
72 comboLayout->addWidget( mFilterCombo );
74 topLayout->addStretch( 100 );
77 ViewConfigureFilterPage::~ViewConfigureFilterPage()
82 void ViewConfigureFilterPage::restoreSettings( TDEConfig *config )
84 mFilterCombo->clear();
88 Filter::List::ConstIterator it;
89 for ( it = list.begin(); it != list.end(); ++it )
90 mFilterCombo->insertItem( (*it).name() );
92 int id = config->readNumEntry(
"DefaultFilterType", 1 );
93 mFilterGroup->setButton(
id );
97 mFilterCombo->setCurrentText( config->readEntry(
"DefaultFilterName" ) );
100 void ViewConfigureFilterPage::saveSettings( TDEConfig *config )
102 config->writeEntry(
"DefaultFilterName", mFilterCombo->currentText() );
103 config->writeEntry(
"DefaultFilterType", mFilterGroup->id( mFilterGroup->selected() ) );
106 void ViewConfigureFilterPage::buttonClicked(
int id )
108 mFilterCombo->setEnabled(
id == 2 );
111 #include "viewconfigurefilterpage.moc"
void restore(TDEConfig *config)
Loads the filter from the config file.