summaryrefslogtreecommitdiffstats
path: root/part/kxesearchdialog.cpp
blob: b6cb5cc248ee388aa8d4343b9e215c0bb42f8c45 (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
/***************************************************************************
                          kxesearchdialog.cpp  -  description
                          -------------------
    begin                : Tue Jul 10 2001
    copyright            : (C) 2001, 2002, 2003 by The KXMLEditor Team
    email                : lvanek@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "kxesearchdialog.h"

#include <tqpushbutton.h>

KXESearchDialog::KXESearchDialog(TQWidget *parent, const char *name, bool modal)
	: KXESearchDialogBase(parent, name, modal)
{
	m_pPushButtonFind->setEnabled(false);
	m_pEditSearchedString->setFocus();
	m_pPushButtonFind->setDefault(true);
}

void KXESearchDialog::slotTextChanged(const TQString& string)
{
	if ( string.isEmpty() )
		m_pPushButtonFind->setEnabled(false);
	else
		m_pPushButtonFind->setEnabled(true);

	toggleAcceptButton();
}

void KXESearchDialog::slotFindInChanged()
{
	toggleAcceptButton();
}

void KXESearchDialog::toggleAcceptButton()
{
	if ( (m_pCheckBoxElementNames->isChecked()) ||(m_pCheckBoxAttributeNames->isChecked()) || (m_pCheckBoxAttributeValues->isChecked()) || (m_pCheckBoxContents->isChecked()) )
	{
		if ( m_pEditSearchedString->text().isEmpty() )
			m_pPushButtonFind->setEnabled(false);
		else
			m_pPushButtonFind->setEnabled(true);
	}
	else
		m_pPushButtonFind->setEnabled(false);
}

#include "kxesearchdialog.moc"