kaddressbook Library API Documentation

configurecardviewdialog.cpp

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., 675 Mass Ave, Cambridge, MA 02139, 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 "configurecardviewdialog.h"
00025 
00026 #include <qstring.h>
00027 #include <qwidget.h>
00028 #include <qlayout.h>
00029 #include <qcheckbox.h>
00030 #include <qvbox.h>
00031 #include <qgroupbox.h>
00032 
00033 #include <kglobal.h>
00034 #include <klocale.h>
00035 #include <kiconloader.h>
00036 #include <kconfig.h>
00037 
00039 // Look and feel page
00040 CardViewLookAndFeelPage::CardViewLookAndFeelPage(QWidget *parent, 
00041                                                  const char *name)
00042   : QWidget(parent, name)
00043 {
00044   initGUI();
00045 }
00046     
00047 void CardViewLookAndFeelPage::readConfig(KConfig *config)
00048 {
00049   mBordersBox->setChecked(config->readBoolEntry("DrawBorder", true));
00050   mSeparatorsBox->setChecked(config->readBoolEntry("DrawSeparators", true));
00051   mLabelsBox->setChecked(config->readBoolEntry("DrawFieldLabels", true));
00052   mEmptyFieldsBox->setChecked(config->readBoolEntry("ShowEmptyFields", true));
00053 }
00054     
00055 void CardViewLookAndFeelPage::writeConfig(KConfig *config)
00056 {
00057   config->writeEntry("DrawBorder", mBordersBox->isChecked());
00058   config->writeEntry("DrawSeparators", mSeparatorsBox->isChecked());
00059   config->writeEntry("DrawFieldLabels", mLabelsBox->isChecked());
00060   config->writeEntry("ShowEmptyFields", mEmptyFieldsBox->isChecked());
00061 }
00062     
00063 void CardViewLookAndFeelPage::initGUI()
00064 {
00065   QVBoxLayout *layout = new QVBoxLayout(this);
00066   layout->setSpacing(KDialog::spacingHint());
00067   layout->setMargin(KDialog::marginHint());
00068   
00069   QGroupBox *group = 0;
00070     
00071   group = new QGroupBox(1, Qt::Horizontal, i18n("General"), this);
00072   layout->addWidget(group);
00073   
00074   mSeparatorsBox = new QCheckBox(i18n("Draw separators between columns"),
00075                                  group, "mSeparatorsBox");
00076       
00077   group = new QGroupBox(1, Qt::Horizontal, i18n("Cards"), this);
00078   layout->addWidget(group);
00079       
00080   mBordersBox = new QCheckBox(i18n("Draw borders"), group, "mBordersBox");
00081   mLabelsBox = new QCheckBox(i18n("Show field labels"), group, "mLabelsBox");
00082   mEmptyFieldsBox = new QCheckBox(i18n("Show fields with no value"), group,
00083                                   "mEmptyFieldsBox");
00084 }
00085 
00087 // ConfigureCardViewDialog
00088 
00089 ConfigureCardViewDialog::ConfigureCardViewDialog(const QString &viewName, 
00090                                                    KABC::AddressBook *doc,
00091                                                    QWidget *parent, 
00092                                                    const char *name)
00093   : ConfigureViewDialog(viewName, doc, parent, name)
00094 {
00095   initGUI();
00096 }
00097                                            
00098 ConfigureCardViewDialog::~ConfigureCardViewDialog()
00099 {
00100 }
00101     
00102 void ConfigureCardViewDialog::readConfig(KConfig *config)
00103 {
00104   ConfigureViewDialog::readConfig(config);
00105   
00106   mPage->readConfig(config);
00107 }
00108 
00109 void ConfigureCardViewDialog::writeConfig(KConfig *config)
00110 {
00111   ConfigureViewDialog::writeConfig(config);
00112   
00113   mPage->writeConfig(config);
00114 }
00115     
00116 void ConfigureCardViewDialog::initGUI()
00117 {
00118   QWidget *page = addVBoxPage(i18n("Look & Feel"), QString::null,
00119                               KGlobal::iconLoader()->loadIcon("looknfeel",
00120                                                             KIcon::Desktop));
00121   
00122   mPage = new CardViewLookAndFeelPage(page, "mPage");
00123 }
00124 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:09 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001