diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/irc/ircaddcontactpage.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/irc/ircaddcontactpage.cpp')
-rw-r--r-- | kopete/protocols/irc/ircaddcontactpage.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/kopete/protocols/irc/ircaddcontactpage.cpp b/kopete/protocols/irc/ircaddcontactpage.cpp new file mode 100644 index 00000000..db4ca3b2 --- /dev/null +++ b/kopete/protocols/irc/ircaddcontactpage.cpp @@ -0,0 +1,83 @@ +/* + ircaddcontactpage.cpp - IRC Add Contact Widget + + Copyright (c) 2002 by Nick Betcher <[email protected]> + + Kopete (c) 2002 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "ircadd.h" +#include "ircaddcontactpage.h" +#include "channellist.h" + +#include "kircengine.h" + +#include "ircaccount.h" + +#include <qlayout.h> +#include <qlineedit.h> +#include <qframe.h> +#include <qtabwidget.h> +#include <kdebug.h> +#include <klocale.h> +#include <kmessagebox.h> + +IRCAddContactPage::IRCAddContactPage( QWidget *parent, IRCAccount *a ) : AddContactPage(parent, 0) +{ + (new QVBoxLayout(this))->setAutoAdd(true); + ircdata = new ircAddUI(this); + mSearch = new ChannelList( (QWidget*)ircdata->hbox, a->engine() ); + mAccount = a; + + connect( mSearch, SIGNAL( channelSelected( const QString & ) ), + this, SLOT( slotChannelSelected( const QString & ) ) ); + + connect( mSearch, SIGNAL( channelDoubleClicked( const QString & ) ), + this, SLOT( slotChannelDoubleClicked( const QString & ) ) ); +} + +IRCAddContactPage::~IRCAddContactPage() +{ +} + +void IRCAddContactPage::slotChannelSelected( const QString &channel ) +{ + ircdata->addID->setText( channel ); +} + +void IRCAddContactPage::slotChannelDoubleClicked( const QString &channel ) +{ + ircdata->addID->setText( channel ); + ircdata->tabWidget3->setCurrentPage(0); +} + +bool IRCAddContactPage::apply(Kopete::Account *account , Kopete::MetaContact *m) +{ + QString name = ircdata->addID->text(); + return account->addContact(name, m, Kopete::Account::ChangeKABC ); +} + +bool IRCAddContactPage::validateData() +{ + QString name = ircdata->addID->text(); + if (name.isEmpty() == true) + { + KMessageBox::sorry(this, i18n("<qt>You need to specify a channel to join, or query to open.</qt>"), i18n("You Must Specify a Channel")); + return false; + } + return true; +} + +#include "ircaddcontactpage.moc" + +// vim: set noet ts=4 sts=4 sw=4: + |