• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kaddressbook

configuretableviewdialog.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include <QtCore/QString>
00025 #include <QtGui/QCheckBox>
00026 #include <QtGui/QGroupBox>
00027 #include <QtGui/QHBoxLayout>
00028 #include <QtGui/QRadioButton>
00029 #include <QtGui/QVBoxLayout>
00030 #include <QtGui/QWidget>
00031 
00032 #include <kconfig.h>
00033 #include <kdeversion.h>
00034 #include <kglobal.h>
00035 #include <kiconloader.h>
00036 #include <kimageio.h>
00037 #include <klineedit.h>
00038 #include <klocale.h>
00039 #include <kurlrequester.h>
00040 
00041 #include "configuretableviewdialog.h"
00042 
00043 ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab,
00044                                                     QWidget *parent )
00045   : ViewConfigureWidget( ab, parent )
00046 {
00047   QWidget *page = addPage( i18n( "Look & Feel" ), QString(),
00048                            KIconLoader::global()->loadIcon( "configure",
00049                            KIconLoader::Panel ) );
00050 
00051   mPage = new LookAndFeelPage( page );
00052 }
00053 
00054 ConfigureTableViewWidget::~ConfigureTableViewWidget()
00055 {
00056 }
00057 
00058 void ConfigureTableViewWidget::restoreSettings( const KConfigGroup &config )
00059 {
00060   ViewConfigureWidget::restoreSettings( config );
00061 
00062   mPage->restoreSettings( config );
00063 }
00064 
00065 void ConfigureTableViewWidget::saveSettings( KConfigGroup &config )
00066 {
00067   ViewConfigureWidget::saveSettings( config );
00068 
00069   mPage->saveSettings( config );
00070 }
00071 
00072 
00073 
00074 LookAndFeelPage::LookAndFeelPage(QWidget *parent)
00075   : QWidget(parent)
00076 {
00077   initGUI();
00078 
00079   // Set initial state
00080   enableBackgroundToggled(mBackgroundBox->isChecked());
00081 }
00082 
00083 void LookAndFeelPage::restoreSettings( const KConfigGroup &config )
00084 {
00085   mAlternateButton->setChecked(config.readEntry("ABackground", true));
00086   mLineButton->setChecked(config.readEntry("SingleLine", false));
00087   mToolTipBox->setChecked(config.readEntry("ToolTips", true));
00088 
00089   if (!mAlternateButton->isChecked() && !mLineButton->isChecked())
00090     mNoneButton->setChecked(true);
00091 
00092   mBackgroundBox->setChecked(config.readEntry("Background", false));
00093   mBackgroundName->lineEdit()->setText(config.readPathEntry("BackgroundName", QString()));
00094   mIMPresenceBox->setChecked( config.readEntry( "InstantMessagingPresence", false ) );
00095 }
00096 
00097 void LookAndFeelPage::saveSettings( KConfigGroup &config )
00098 {
00099   config.writeEntry("ABackground", mAlternateButton->isChecked());
00100   config.writeEntry("SingleLine", mLineButton->isChecked());
00101   config.writeEntry("ToolTips", mToolTipBox->isChecked());
00102   config.writeEntry("Background", mBackgroundBox->isChecked());
00103   config.writePathEntry("BackgroundName", mBackgroundName->lineEdit()->text());
00104   config.writeEntry( "InstantMessagingPresence", mIMPresenceBox->isChecked() );
00105 }
00106 
00107 void LookAndFeelPage::initGUI()
00108 {
00109   QVBoxLayout *layout = new QVBoxLayout(this);
00110   layout->setSpacing(KDialog::spacingHint());
00111   layout->setMargin(0);
00112 
00113   QGroupBox *group = new QGroupBox(i18n("Row Separator"));
00114   layout->addWidget(group);
00115 
00116   mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"));
00117   mAlternateButton->setObjectName( "mAlternateButton" );
00118   mLineButton = new QRadioButton(i18n("Single line"));
00119   mLineButton->setObjectName( "mLineButton" );
00120   mNoneButton = new QRadioButton(i18n("None"));
00121   mNoneButton->setObjectName( "mNoneButton" );
00122   QVBoxLayout *updateLayout = new QVBoxLayout;
00123   updateLayout->addWidget(mNoneButton);
00124   updateLayout->addWidget(mLineButton);
00125   updateLayout->addWidget(mAlternateButton);
00126 
00127   group->setLayout(updateLayout);
00128 
00129 
00130   // Background Checkbox/Selector
00131   QHBoxLayout *backgroundLayout = new QHBoxLayout();
00132   layout->addLayout(backgroundLayout);
00133 
00134   mBackgroundBox = new QCheckBox(i18n("Enable background image:"), this );
00135   mBackgroundBox->setObjectName( "mBackgroundBox" );
00136   connect(mBackgroundBox, SIGNAL(toggled(bool)),
00137           SLOT(enableBackgroundToggled(bool)));
00138   backgroundLayout->addWidget(mBackgroundBox);
00139 
00140   mBackgroundName = new KUrlRequester(this);
00141   mBackgroundName->setObjectName( "mBackgroundName");
00142   mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
00143                            KFile::LocalOnly);
00144   mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading));
00145   backgroundLayout->addWidget(mBackgroundName);
00146 
00147   // ToolTip Checkbox
00148   mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), this );
00149   mToolTipBox->setObjectName( "mToolTipBox");
00150   layout->addWidget(mToolTipBox);
00151   mIMPresenceBox = new QCheckBox( i18n( "Show instant messaging presence" ), this );
00152   mIMPresenceBox->setObjectName( "mIMPresenceBox" );
00153   layout->addWidget( mIMPresenceBox );
00154 }
00155 
00156 void LookAndFeelPage::enableBackgroundToggled(bool enabled)
00157 {
00158   mBackgroundName->setEnabled(enabled);
00159 }
00160 
00161 #include "configuretableviewdialog.moc"

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal