27 #include <tqradiobutton.h>
28 #include <tqcheckbox.h>
30 #include <tqbuttongroup.h>
32 #include <tdeversion.h>
33 #include <tdeglobal.h>
34 #include <tdelocale.h>
35 #include <klineedit.h>
36 #include <kurlrequester.h>
37 #include <kiconloader.h>
39 #include <tdeconfig.h>
41 #include "configuretableviewdialog.h"
43 ConfigureTableViewWidget::ConfigureTableViewWidget( TDEABC::AddressBook *ab,
48 TQWidget *page = addPage( i18n(
"Look & Feel" ), TQString(),
49 TDEGlobal::iconLoader()->loadIcon(
"preferences-desktop",
55 ConfigureTableViewWidget::~ConfigureTableViewWidget()
63 mPage->restoreSettings( config );
70 mPage->saveSettings( config );
75 LookAndFeelPage::LookAndFeelPage(TQWidget *parent,
const char *name)
76 : TQWidget(parent, name)
81 enableBackgroundToggled(mBackgroundBox->isChecked());
84 void LookAndFeelPage::restoreSettings( TDEConfig *config )
86 mAlternateButton->setChecked(config->readBoolEntry(
"ABackground",
true));
87 mLineButton->setChecked(config->readBoolEntry(
"SingleLine",
false));
88 mToolTipBox->setChecked(config->readBoolEntry(
"ToolTips",
true));
90 if (!mAlternateButton->isChecked() && !mLineButton->isChecked())
91 mNoneButton->setChecked(
true);
93 mBackgroundBox->setChecked(config->readBoolEntry(
"Background",
false));
94 mBackgroundName->lineEdit()->setText(config->readPathEntry(
"BackgroundName"));
95 #if KDE_IS_VERSION(3,2,90)
96 mIMPresenceBox->setChecked( config->readBoolEntry(
"InstantMessagingPresence",
false ) );
100 void LookAndFeelPage::saveSettings( TDEConfig *config )
102 config->writeEntry(
"ABackground", mAlternateButton->isChecked());
103 config->writeEntry(
"SingleLine", mLineButton->isChecked());
104 config->writeEntry(
"ToolTips", mToolTipBox->isChecked());
105 config->writeEntry(
"Background", mBackgroundBox->isChecked());
106 config->writePathEntry(
"BackgroundName", mBackgroundName->lineEdit()->text());
107 #if KDE_IS_VERSION(3,2,90)
108 config->writeEntry(
"InstantMessagingPresence", mIMPresenceBox->isChecked() );
112 void LookAndFeelPage::initGUI()
114 TQVBoxLayout *layout =
new TQVBoxLayout(
this, 0, KDialogBase::spacingHint());
116 TQButtonGroup *group =
new TQButtonGroup(1, TQt::Horizontal,
117 i18n(
"Row Separator"),
this);
118 layout->addWidget(group);
120 mAlternateButton =
new TQRadioButton(i18n(
"Alternating backgrounds"),
121 group,
"mAlternateButton");
122 mLineButton =
new TQRadioButton(i18n(
"Single line"), group,
"mLineButton");
123 mNoneButton =
new TQRadioButton(i18n(
"None"), group,
"mNoneButton");
126 TQHBoxLayout *backgroundLayout =
new TQHBoxLayout();
127 layout->addLayout(backgroundLayout);
129 mBackgroundBox =
new TQCheckBox(i18n(
"Enable background image:"),
this,
131 connect(mBackgroundBox, TQ_SIGNAL(toggled(
bool)),
132 TQ_SLOT(enableBackgroundToggled(
bool)));
133 backgroundLayout->addWidget(mBackgroundBox);
135 mBackgroundName =
new KURLRequester(
this,
"mBackgroundName");
136 mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
138 mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading));
139 backgroundLayout->addWidget(mBackgroundName);
142 mToolTipBox =
new TQCheckBox(i18n(
"Enable contact tooltips"),
this,
144 layout->addWidget(mToolTipBox);
145 #if KDE_IS_VERSION(3,2,90)
146 mIMPresenceBox =
new TQCheckBox( i18n(
"Show instant messaging presence" ),
this,
"mIMPresenceBox" );
147 layout->addWidget( mIMPresenceBox );
151 void LookAndFeelPage::enableBackgroundToggled(
bool enabled)
153 mBackgroundName->setEnabled(enabled);
156 #include "configuretableviewdialog.moc"