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 "configuretableviewdialog.h"
00025
00026 #include <qstring.h>
00027 #include <qwidget.h>
00028 #include <qlayout.h>
00029 #include <qradiobutton.h>
00030 #include <qcheckbox.h>
00031 #include <qvbox.h>
00032 #include <qbuttongroup.h>
00033
00034 #include <kglobal.h>
00035 #include <klocale.h>
00036 #include <klineedit.h>
00037 #include <kurlrequester.h>
00038 #include <kiconloader.h>
00039 #include <kconfig.h>
00040
00042
00043 LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name)
00044 : QWidget(parent, name)
00045 {
00046 initGUI();
00047
00048
00049 enableBackgroundToggled(mBackgroundBox->isChecked());
00050 }
00051
00052 void LookAndFeelPage::readConfig(KConfig *config)
00053 {
00054 mAlternateButton->setChecked(config->readBoolEntry("ABackground", true));
00055 mLineButton->setChecked(config->readBoolEntry("SingleLine", false));
00056 mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true));
00057
00058 if (!mAlternateButton->isChecked() & !mLineButton->isChecked())
00059 mNoneButton->setChecked(true);
00060
00061 mBackgroundBox->setChecked(config->readBoolEntry("Background", false));
00062 mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName"));
00063 }
00064
00065 void LookAndFeelPage::writeConfig(KConfig *config)
00066 {
00067 config->writeEntry("ABackground", mAlternateButton->isChecked());
00068 config->writeEntry("SingleLine", mLineButton->isChecked());
00069 config->writeEntry("ToolTips", mToolTipBox->isChecked());
00070 config->writeEntry("Background", mBackgroundBox->isChecked());
00071 config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text());
00072 }
00073
00074 void LookAndFeelPage::initGUI()
00075 {
00076 QVBoxLayout *layout = new QVBoxLayout(this);
00077 layout->setSpacing(KDialog::spacingHint());
00078 layout->setMargin(KDialog::marginHint());
00079
00080 QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal,
00081 i18n("Row Separator"), this);
00082 layout->addWidget(group);
00083
00084 mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"),
00085 group, "mAlternateButton");
00086 mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton");
00087 mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton");
00088
00089
00090 QHBoxLayout *backgroundLayout = new QHBoxLayout();
00091 layout->addLayout(backgroundLayout);
00092
00093 mBackgroundBox = new QCheckBox(i18n("Enable background image:"), this,
00094 "mBackgroundBox");
00095 connect(mBackgroundBox, SIGNAL(toggled(bool)),
00096 SLOT(enableBackgroundToggled(bool)));
00097 backgroundLayout->addWidget(mBackgroundBox);
00098
00099 mBackgroundName = new KURLRequester(this, "mBackgroundName");
00100 mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
00101 KFile::LocalOnly);
00102 mBackgroundName->setFilter(i18n("*.png *.jpg *.xpm|Image Files\n*|All Files"));
00103 backgroundLayout->addWidget(mBackgroundName);
00104
00105
00106 mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), this,
00107 "mToolTipBox");
00108 layout->addWidget(mToolTipBox);
00109 }
00110
00111 void LookAndFeelPage::enableBackgroundToggled(bool enabled)
00112 {
00113 mBackgroundName->setEnabled(enabled);
00114 }
00115
00117
00118
00119 ConfigureTableViewDialog::ConfigureTableViewDialog(const QString &viewName,
00120 KABC::AddressBook *doc,
00121 QWidget *parent,
00122 const char *name)
00123 : ConfigureViewDialog(viewName, doc, parent, name)
00124 {
00125 initGUI();
00126 }
00127
00128 ConfigureTableViewDialog::~ConfigureTableViewDialog()
00129 {
00130 }
00131
00132 void ConfigureTableViewDialog::readConfig(KConfig *config)
00133 {
00134 ConfigureViewDialog::readConfig(config);
00135
00136 mPage->readConfig(config);
00137 }
00138
00139 void ConfigureTableViewDialog::writeConfig(KConfig *config)
00140 {
00141 ConfigureViewDialog::writeConfig(config);
00142
00143 mPage->writeConfig(config);
00144 }
00145
00146 void ConfigureTableViewDialog::initGUI()
00147 {
00148 QWidget *page = addVBoxPage(i18n("Look & Feel"), QString::null,
00149 KGlobal::iconLoader()->loadIcon("looknfeel",
00150 KIcon::Desktop));
00151
00152 mPage = new LookAndFeelPage(page, "mLookAndFeelPage");
00153 }
00154
00155 #include "configuretableviewdialog.moc"
This file is part of the documentation for kdelibs Version 3.1.4.