summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/autotoolsaction.cpp
blob: a9404e69150aff0c453eec7a122604eb2c7a6f5d (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
   TDevelop Autotools Support
   Copyright (c) 2005 by Matt Rogers <mattr@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 "autotoolsaction.h"

#include <tqtoolbutton.h>
#include <tqtooltip.h>
#include <tqwhatsthis.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kiconloader.h>

AutoToolsAction::~AutoToolsAction()
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const KShortcut& cut,
                                  const TQObject* receiver, const char* slot,
                                  KActionCollection* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQIconSet& pix, const KShortcut& cut,
                                  const TQObject* receiver, const char* slot,
                                  KActionCollection* parent, const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQString& pix, const KShortcut& cut,
                                  const TQObject* receiver, const char* slot,
                                  KActionCollection* parent, const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const KGuiItem& item, const KShortcut & cut,
                                  const TQObject* receiver, const char* slot,
                                  KActionCollection* parent, const char* name )
: KAction( item, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const KShortcut& cut,
                                  TQObject* parent, const char* name )
: KAction( text, cut, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const KShortcut& cut,
                                  const TQObject* receiver, const char* slot,
                                  TQObject* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQIconSet& pix,
                                  const KShortcut& cut, TQObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQString& pix,
                                  const KShortcut& cut, TQObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQIconSet& pix,
                                  const KShortcut& cut, const TQObject* receiver,
                                  const char* slot, TQObject* parent, const char * name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( const TQString& text, const TQString& pix,
                                  const KShortcut & cut, const TQObject* receiver,
                                  const char* slot, TQObject* parent, const char * name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
}

AutoToolsAction::AutoToolsAction( TQObject * parent, const char * name )
: KAction( parent, name )
{
}

int AutoToolsAction::plug( TQWidget* w, int index )
{
	if ( !w ) {
		kdWarning(129) << "KAction::plug called with 0 argument\n";
		return -1;
	}
	
	// Check if action is permitted
	if (kapp && !kapp->authorizeKAction(name()))
		return -1;
	
	if ( ::tqqt_cast<TQToolButton*>( w ) )
	{
		TQToolButton* tb = static_cast<TQToolButton*>( w );
		connect( tb, TQT_SIGNAL( clicked() ), this, TQT_SLOT( activate() ) );
		int id = getToolButtonID();
		
		if ( !icon().isEmpty() )
			tb->setPixmap( SmallIcon( icon() ) );
		else
			tb->setText( text() );
		
		if ( !isEnabled() )
			tb->setEnabled( false );
		
		if ( !whatsThis().isEmpty() )
		{
			TQWhatsThis::remove( tb );
			TQWhatsThis::add( tb, whatsThisWithIcon() );
		}
		
		if ( !toolTip().isEmpty() )
		{
			TQToolTip::remove( tb );
			TQToolTip::add( tb, toolTip() );
		}
		
		addContainer( tb, id );
		
		return containerCount() - 1;
	}
	
	return KAction::plug( w, index );
}

void AutoToolsAction::updateEnabled( int i )
{
	TQWidget* w = container( i );
	
	if ( ::tqqt_cast<TQToolButton*>( w ) )
		static_cast<TQToolButton*>( w )->setEnabled( isEnabled() );
	else
		KAction::updateEnabled( i ) ;
}



//kate: indent-mode csands; tab-width 4;