implement update interval of list; can be disabled / changed by user
[kdenetwork.git] / kopete / protocols / testbed / testbedaddcontactpage.cpp
blob741767db06c9f8c8718e0a82ca66b9021304b6b3
1 /*
2 testbedaddcontactpage.cpp - Kopete Testbed Protocol
4 Copyright (c) 2003 by Will Stephenson <will@stevello.free-online.co.uk>
5 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
7 *************************************************************************
8 * *
9 * This library is free software; you can redistribute it and/or *
10 * modify it under the terms of the GNU General Public *
11 * License as published by the Free Software Foundation; either *
12 * version 2 of the License, or (at your option) any later version. *
13 * *
14 *************************************************************************
17 #include "testbedaddcontactpage.h"
19 #include <qlayout.h>
20 #include <qradiobutton.h>
21 //Added by qt3to4:
22 #include <QVBoxLayout>
23 #include <qlineedit.h>
24 #include <kdebug.h>
26 #include "kopeteaccount.h"
27 #include "kopetecontactlist.h"
28 #include "kopetemetacontact.h"
30 #include "testbedcontact.h"
32 TestbedAddContactPage::TestbedAddContactPage( QWidget* parent )
33 : AddContactPage(parent)
35 kDebug(14210) ;
36 QVBoxLayout* l = new QVBoxLayout( this );
37 QWidget* w = new QWidget();
38 m_testbedAddUI.setupUi( w );
39 l->addWidget( w );
42 TestbedAddContactPage::~TestbedAddContactPage()
46 bool TestbedAddContactPage::apply( Kopete::Account* a, Kopete::MetaContact* m )
48 if ( validateData() )
50 QString name = m_testbedAddUI.m_uniqueName->text();
52 if ( a->addContact(name, m, Kopete::Account::ChangeKABC ) )
54 TestbedContact * newContact = qobject_cast<TestbedContact*>( Kopete::ContactList::self()->findContact( a->protocol()->pluginId(), a->accountId(), name ) );
55 if ( newContact )
57 newContact->setType( m_testbedAddUI.m_rbEcho->isChecked() ? TestbedContact::Echo : TestbedContact::Group );
58 return true;
61 else
62 return false;
64 return false;
67 bool TestbedAddContactPage::validateData()
69 return true;
73 #include "testbedaddcontactpage.moc"