00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
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
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
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
00090
QValueList<KPluginInfo *>::ConstIterator it;
00091
for ( it = mProtocols.begin(); it != mProtocols.end(); ++it )
00092 cmbProtocol->insertItem( SmallIcon( (*it)->icon() ), (*it)->name() );
00093 }
00094