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/oscar/icq/icqreadaway.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/oscar/icq/icqreadaway.cpp')
-rw-r--r-- | kopete/protocols/oscar/icq/icqreadaway.cpp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/kopete/protocols/oscar/icq/icqreadaway.cpp b/kopete/protocols/oscar/icq/icqreadaway.cpp new file mode 100644 index 00000000..94cccafd --- /dev/null +++ b/kopete/protocols/oscar/icq/icqreadaway.cpp @@ -0,0 +1,106 @@ +/* + icqreadaway.cpp - ICQ Protocol Plugin + + Copyright (c) 2003 by Stefan Gehn <metz AT gehn.net> + Kopete (c) 2003 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * 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 "icqreadaway.h" + +#include "icqprotocol.h" +#include "icqaccount.h" +#include "icqcontact.h" + +#include <qvbox.h> + +#include <ktextbrowser.h> +#include <klocale.h> +#include <krun.h> + +#include <assert.h> + + +ICQReadAway::ICQReadAway(ICQContact *c, QWidget *parent, const char* name) + : KDialogBase(parent, name, false, QString::null, Close | User1, + Close, false, i18n("&Fetch Again")) +{ + assert(c); + + mAccount = static_cast<ICQAccount*>(c->account()); + mContact = c; + setCaption(i18n("'%2' Message for %1").arg(c->displayName()).arg(c->onlineStatus().description())); + + QVBox *mMainWidget = makeVBoxMainWidget(); + + awayMessageBrowser = new KTextBrowser(mMainWidget, "userInfoView"); + awayMessageBrowser->setTextFormat(AutoText); + awayMessageBrowser->setNotifyClick(true); + awayMessageBrowser->setText(mContact->awayMessage()); + + QObject::connect( + awayMessageBrowser, SIGNAL(urlClick(const QString&)), + this, SLOT(slotUrlClicked(const QString&))); + QObject::connect( + awayMessageBrowser, SIGNAL(mailClick(const QString&, const QString&)), + this, SLOT(slotMailClicked(const QString&, const QString&))); + + connect(this, SIGNAL(user1Clicked()), + this, SLOT(slotFetchAwayMessage())); + connect(this, SIGNAL(closeClicked()), + this, SLOT(slotCloseClicked())); + + connect(c, SIGNAL(awayMessageChanged()), + this, SLOT(slotAwayMessageChanged())); + + slotFetchAwayMessage(); +} + +void ICQReadAway::slotFetchAwayMessage() +{ + if(!mAccount->isConnected()) + return; + + awayMessageBrowser->setDisabled(true); + enableButton(User1,false); + + mAccount->engine()->requestAwayMessage(mContact); + + setCaption(i18n("Fetching '%2' Message for %1...").arg(mContact->displayName()).arg(mContact->onlineStatus().description())); +} // END slotFetchAwayMessage() + +void ICQReadAway::slotAwayMessageChanged() +{ + setCaption(i18n("'%2' Message for %1").arg(mContact->displayName()).arg(mContact->onlineStatus().description())); + awayMessageBrowser->setText(mContact->awayMessage()); + + awayMessageBrowser->setDisabled(false); + enableButton(User1,true); + +} // END slotAwayMessageChanged() + +void ICQReadAway::slotCloseClicked() +{ + emit closing(); +} + +void ICQReadAway::slotUrlClicked(const QString &url) +{ + new KRun(KURL(url)); +} + +void ICQReadAway::slotMailClicked(const QString&, const QString &address) +{ + new KRun(KURL(address)); +} + +#include "icqreadaway.moc" +// vim: set noet ts=4 sts=4 sw=4: |