blob: 3724781d96f257ab3a44b8a9487b1a1225a9422b (
plain)
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
|
/*
ircguiclient.cpp
Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
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 <klocale.h>
#include <tdeversion.h>
#if KDE_IS_VERSION( 3, 1, 90 )
#include <tdeactioncollection.h>
#else
// ------------------------------------------------------------
// TODO: UGLY HACK, remove when we drop KDE 3.1 compatibility
#ifdef KDE_NO_COMPAT
#undef KDE_NO_COMPAT
#include <tdeaction.h>
#define KDE_NO_COMPAT 1
#endif
// ------------------------------------------------------------
#endif
#include <tqptrlist.h>
#include <kdebug.h>
#include <tqdom.h>
#include "kopetechatsession.h"
#include "kcodecaction.h"
#include "ircguiclient.h"
#include "ircaccount.h"
#include "irccontact.h"
IRCGUIClient::IRCGUIClient( Kopete::ChatSession *parent ) : TQObject(parent) , KXMLGUIClient(parent)
{
Kopete::ContactPtrList members = parent->members();
if( members.count() > 0 )
{
m_user = static_cast<IRCContact*>( members.first() );
/***
FIXME: Why doesn't this work???? Have to use DOM hack below now...
setXMLFile("ircchatui.rc");
unplugActionList( "irccontactactionlist" );
TQPtrList<TDEAction> *actions = m_user->customContextMenuActions( parent );
plugActionList( "irccontactactionlist", *actions );
delete actions;
*/
setXMLFile("ircchatui.rc");
TQDomDocument doc = domDocument();
TQDomNode menu = doc.documentElement().firstChild().firstChild();
TQPtrList<TDEAction> *actions = m_user->customContextMenuActions( parent );
if( actions )
{
for( TDEAction *a = actions->first(); a; a = actions->next() )
{
actionCollection()->insert( a );
TQDomElement newNode = doc.createElement( "Action" );
newNode.setAttribute( "name", a->name() );
menu.appendChild( newNode );
}
}
else
{
kdDebug(14120) << k_funcinfo << "Actions == 0" << endl;
}
delete actions;
setDOMDocument( doc );
}
else
{
kdDebug(14120) << k_funcinfo << "Members == 0" << endl;
}
}
IRCGUIClient::~IRCGUIClient()
{
}
void IRCGUIClient::slotSelectCodec( const TQTextCodec *codec )
{
m_user->setCodec( codec );
}
#include "ircguiclient.moc"
|