kaddressbook Library API Documentation

imaddresswidget.cpp

00001 /* 00002 imaddresswidget.cpp 00003 00004 IM address editor widget for KAddressbook 00005 00006 Copyright (c) 2004 Will Stephenson <lists@stevello.free-online.co.uk> 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 00022 As a special exception, permission is given to link this program 00023 with any edition of Qt, and distribute the resulting executable, 00024 without including the source code for Qt in the source distribution. 00025 */ 00026 #include <qcheckbox.h> 00027 #include <qcombobox.h> 00028 #include <qlineedit.h> 00029 00030 #include <kdebug.h> 00031 #include <kiconloader.h> 00032 #include <klocale.h> 00033 #include <kplugininfo.h> 00034 00035 #include "imaddresswidget.h" 00036 00037 IMAddressWidget::IMAddressWidget( QWidget *parent, QValueList<KPluginInfo *> protocols ) : IMAddressBase( parent ) 00038 { 00039 mProtocols = protocols; 00040 populateProtocols(); 00041 } 00042 00043 IMAddressWidget::IMAddressWidget( QWidget *parent, QValueList<KPluginInfo *> protocols, KPluginInfo *protocol, const QString& address, const IMContext& context ) : IMAddressBase( parent ) 00044 { 00045 mProtocols = protocols; 00046 populateProtocols(); 00047 cmbProtocol->setCurrentItem( mProtocols.findIndex( protocol ) ); 00048 /*cmbContext->setCurrentItem( (int)context );*/ 00049 edtAddress->setText( address ); 00050 } 00051 00052 KPluginInfo * IMAddressWidget::protocol() 00053 { 00054 int protocolIndex = cmbProtocol->currentItem(); 00055 return mProtocols[ protocolIndex ]; 00056 } 00057 00058 IMContext IMAddressWidget::context() 00059 { 00060 IMContext context = Any; 00061 /* if ( cmbContext->currentItem() ) 00062 { 00063 00064 int contextIndex = cmbContext->currentItem(); 00065 switch ( contextIndex ) 00066 { 00067 case 0: 00068 context = Any; 00069 break; 00070 case 1: 00071 context = Home; 00072 break; 00073 case 2: 00074 context = Work; 00075 break; 00076 } 00077 } 00078 */ 00079 return context; 00080 } 00081 00082 QString IMAddressWidget::address() 00083 { 00084 return edtAddress->text(); 00085 } 00086 00087 void IMAddressWidget::populateProtocols() 00088 { 00089 // insert the protocols in order 00090 QValueList<KPluginInfo *>::ConstIterator it; 00091 for ( it = mProtocols.begin(); it != mProtocols.end(); ++it ) 00092 cmbProtocol->insertItem( SmallIcon( (*it)->icon() ), (*it)->name() ); 00093 } 00094
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:36 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003