configuretableviewdialog.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <qstring.h>
00025 #include <qwidget.h>
00026 #include <qlayout.h>
00027 #include <qradiobutton.h>
00028 #include <qcheckbox.h>
00029 #include <qvbox.h>
00030 #include <qbuttongroup.h>
00031
00032 #include <kglobal.h>
00033 #include <klocale.h>
00034 #include <klineedit.h>
00035 #include <kurlrequester.h>
00036 #include <kiconloader.h>
00037 #include <kimageio.h>
00038 #include <kconfig.h>
00039
00040 #include "configuretableviewdialog.h"
00041
00042 ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab,
00043 QWidget *parent,
00044 const char *name )
00045 : ViewConfigureWidget( ab, parent, name )
00046 {
00047 QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
00048 KGlobal::iconLoader()->loadIcon( "looknfeel",
00049 KIcon::Panel ) );
00050
00051 mPage = new LookAndFeelPage( page );
00052 }
00053
00054 ConfigureTableViewWidget::~ConfigureTableViewWidget()
00055 {
00056 }
00057
00058 void ConfigureTableViewWidget::restoreSettings( KConfig *config )
00059 {
00060 ViewConfigureWidget::restoreSettings( config );
00061
00062 mPage->restoreSettings( config );
00063 }
00064
00065 void ConfigureTableViewWidget::saveSettings( KConfig *config )
00066 {
00067 ViewConfigureWidget::saveSettings( config );
00068
00069 mPage->saveSettings( config );
00070 }
00071
00072
00073
00074 LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name)
00075 : QWidget(parent, name)
00076 {
00077 initGUI();
00078
00079
00080 enableBackgroundToggled(mBackgroundBox->isChecked());
00081 }
00082
00083 void LookAndFeelPage::restoreSettings( KConfig *config )
00084 {
00085 mAlternateButton->setChecked(config->readBoolEntry("ABackground", true));
00086 mLineButton->setChecked(config->readBoolEntry("SingleLine", false));
00087 mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true));
00088
00089 if (!mAlternateButton->isChecked() & !mLineButton->isChecked())
00090 mNoneButton->setChecked(true);
00091
00092 mBackgroundBox->setChecked(config->readBoolEntry("Background", false));
00093 mBackgroundName->lineEdit()->setText(config->readPathEntry("BackgroundName"));
00094 }
00095
00096 void LookAndFeelPage::saveSettings( KConfig *config )
00097 {
00098 config->writeEntry("ABackground", mAlternateButton->isChecked());
00099 config->writeEntry("SingleLine", mLineButton->isChecked());
00100 config->writeEntry("ToolTips", mToolTipBox->isChecked());
00101 config->writeEntry("Background", mBackgroundBox->isChecked());
00102 config->writePathEntry("BackgroundName", mBackgroundName->lineEdit()->text());
00103 }
00104
00105 void LookAndFeelPage::initGUI()
00106 {
00107 QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialogBase::spacingHint());
00108
00109 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal,
00110 i18n("Row Separator"), this);
00111 layout->addWidget(group);
00112
00113 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"),
00114 group, "mAlternateButton");
00115 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton");
00116 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton");
00117
00118
00119 QHBoxLayout *backgroundLayout = new QHBoxLayout();
00120 layout->addLayout(backgroundLayout);
00121
00122 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), this,
00123 "mBackgroundBox");
00124 connect(mBackgroundBox, SIGNAL(toggled(bool)),
00125 SLOT(enableBackgroundToggled(bool)));
00126 backgroundLayout->addWidget(mBackgroundBox);
00127
00128 mBackgroundName = new KURLRequester(this, "mBackgroundName");
00129 mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
00130 KFile::LocalOnly);
00131 mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading));
00132 backgroundLayout->addWidget(mBackgroundName);
00133
00134
00135 mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), this,
00136 "mToolTipBox");
00137 layout->addWidget(mToolTipBox);
00138 }
00139
00140 void LookAndFeelPage::enableBackgroundToggled(bool enabled)
00141 {
00142 mBackgroundName->setEnabled(enabled);
00143 }
00144
00145 #include "configuretableviewdialog.moc"
This file is part of the documentation for kaddressbook Library Version 3.2.2.