summaryrefslogtreecommitdiffstats
path: root/kspy/receiversview.cpp
blob: 2b04303ad9d3a3bb65e655ca579f5a60c1fae649 (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
/***************************************************************************
                          tqreceiversview.cpp  -  description
                             -------------------
    begin                : Tue Jan 11 2005
    copyright            : (C) 2005 by Richard Dale
    email                : Richard_Dale@tipitina.demon.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 <tqobjectdict.h>
#include <tqobjectlist.h>
#include <tqmetaobject.h>
#include <tqstrlist.h>
#include <tqvariant.h>
#include <tqsignalslotimp.h>

#include <klocale.h>

#include "receiversview.h"

class UnencapsulatedTQObject : public TQObject {
public:
    TQConnectionList *public_tqreceivers(int signal) const { return tqreceivers(signal); }
};

ReceiversView::ReceiversView(TQWidget *tqparent, const char *name ) : KListView(tqparent,name)
{
  addColumn( i18n( "Object" ) );
  addColumn( i18n( "Type" ) );
  addColumn( i18n( "Member Name" ) );

  setRootIsDecorated( true );
  setAllColumnsShowFocus( true );
  setFullWidth( true );
}

ReceiversView::~ReceiversView()
{
}

void ReceiversView::buildList( TQObject *o )
{
  TQMetaObject *mo = o->tqmetaObject();
    
  UnencapsulatedTQObject * qobject = (UnencapsulatedTQObject *) o;
  TQStrList signalNames = mo->signalNames(true);
    
  for (int sig = 0; sig < mo->numSignals(true); sig++) {
    TQConnectionList * clist = qobject->public_tqreceivers(sig);
    if (clist != 0) {
      KListViewItem *conn = new KListViewItem( this, signalNames.at(sig) );
            
      for (    TQConnection * connection = clist->first(); 
               connection != 0; 
               connection = clist->next() ) 
      {
        new KListViewItem( conn,
                           connection->object()->name(), 
                           connection->memberType() == 1 ? "SLOT" : "SIGNAL",
                           connection->memberName() );
      }
    }
  }  
}

void ReceiversView::setTarget( TQObject *o )
{
  clear();
  buildList( o );
}

#include "receiversview.moc"