1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
icqreadaway.cpp - ICQ Protocol Plugin
Copyright (c) 2003 by Stefan Gehn <metz AT gehn.net>
Kopete (c) 2003 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 "icqreadaway.h"
#include "icqprotocol.h"
#include "icqaccount.h"
#include "icqcontact.h"
#include <tqvbox.h>
#include <ktextbrowser.h>
#include <klocale.h>
#include <krun.h>
#include <assert.h>
ICQReadAway::ICQReadAway(ICQContact *c, TQWidget *parent, const char* name)
: KDialogBase(parent, name, false, TQString(), Close | User1,
Close, false, i18n("&Fetch Again"))
{
assert(c);
mAccount = static_cast<ICQAccount*>(c->account());
mContact = c;
setCaption(i18n("'%2' Message for %1").tqarg(c->displayName()).tqarg(c->onlinetqStatus().description()));
TQVBox *mMainWidget = makeVBoxMainWidget();
awayMessageBrowser = new KTextBrowser(mMainWidget, "userInfoView");
awayMessageBrowser->setTextFormat(AutoText);
awayMessageBrowser->setNotifyClick(true);
awayMessageBrowser->setText(mContact->awayMessage());
TQObject::connect(
awayMessageBrowser, TQT_SIGNAL(urlClick(const TQString&)),
this, TQT_SLOT(slotUrlClicked(const TQString&)));
TQObject::connect(
awayMessageBrowser, TQT_SIGNAL(mailClick(const TQString&, const TQString&)),
this, TQT_SLOT(slotMailClicked(const TQString&, const TQString&)));
connect(this, TQT_SIGNAL(user1Clicked()),
this, TQT_SLOT(slotFetchAwayMessage()));
connect(this, TQT_SIGNAL(closeClicked()),
this, TQT_SLOT(slotCloseClicked()));
connect(c, TQT_SIGNAL(awayMessageChanged()),
this, TQT_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...").tqarg(mContact->displayName()).tqarg(mContact->onlinetqStatus().description()));
} // END slotFetchAwayMessage()
void ICQReadAway::slotAwayMessageChanged()
{
setCaption(i18n("'%2' Message for %1").tqarg(mContact->displayName()).tqarg(mContact->onlinetqStatus().description()));
awayMessageBrowser->setText(mContact->awayMessage());
awayMessageBrowser->setDisabled(false);
enableButton(User1,true);
} // END slotAwayMessageChanged()
void ICQReadAway::slotCloseClicked()
{
emit closing();
}
void ICQReadAway::slotUrlClicked(const TQString &url)
{
new KRun(KURL(url));
}
void ICQReadAway::slotMailClicked(const TQString&, const TQString &address)
{
new KRun(KURL(address));
}
#include "icqreadaway.moc"
// vim: set noet ts=4 sts=4 sw=4:
|