kitchensync Library API Documentation

kabckonnectorconfig.cpp

00001 /* 00002 This file is part of KitchenSync. 00003 00004 Copyright (c) 2004 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #include <kabc/resource.h> 00023 #include <kconfig.h> 00024 #include <klocale.h> 00025 #include <kresources/manager.h> 00026 00027 #include <qlabel.h> 00028 #include <qlayout.h> 00029 00030 #include "kabckonnector.h" 00031 00032 #include "kabckonnectorconfig.h" 00033 00034 using namespace KSync; 00035 00036 KABCKonnectorConfig::KABCKonnectorConfig( QWidget *parent ) 00037 : KRES::ConfigWidget( parent, 0 ) 00038 { 00039 initGUI(); 00040 00041 KRES::Manager<KABC::Resource> manager( "contact" ); 00042 manager.readConfig(); 00043 KRES::Manager<KABC::Resource>::ActiveIterator it; 00044 for ( it = manager.activeBegin(); it != manager.activeEnd(); ++it ) { 00045 mResourceIdentifiers.append( (*it)->identifier() ); 00046 mResourceBox->insertItem( (*it)->resourceName() ); 00047 } 00048 } 00049 00050 KABCKonnectorConfig::~KABCKonnectorConfig() 00051 { 00052 } 00053 00054 void KABCKonnectorConfig::loadSettings( KRES::Resource *resource ) 00055 { 00056 KABCKonnector *konnector = dynamic_cast<KABCKonnector *>( resource ); 00057 if ( konnector ) { 00058 int pos = mResourceIdentifiers.findIndex( konnector->currentResource() ); 00059 mResourceBox->setCurrentItem( pos ); 00060 } 00061 } 00062 00063 void KABCKonnectorConfig::saveSettings( KRES::Resource *resource ) 00064 { 00065 KABCKonnector *konnector = dynamic_cast<KABCKonnector *>( resource ); 00066 if ( konnector ) { 00067 int pos = mResourceBox->currentItem(); 00068 konnector->setCurrentResource( mResourceIdentifiers[ pos ] ); 00069 } 00070 } 00071 00072 void KABCKonnectorConfig::initGUI() 00073 { 00074 QBoxLayout *layout = new QVBoxLayout( this ); 00075 00076 QLabel *label = new QLabel( i18n( "Select the resource you want to sync with." ), this ); 00077 layout->addWidget( label ); 00078 00079 mResourceBox = new QComboBox( this ); 00080 layout->addWidget( mResourceBox ); 00081 } 00082 00083 #include "kabckonnectorconfig.moc"
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 1 15:18:59 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003