summaryrefslogtreecommitdiffstats
path: root/noatun/modules/splitplaylist/find.cpp
blob: 0a97131c41485728d6b5158f41d4aec394bd0c62 (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
#include "find.h"
#include <tqlayout.h>
#include <kcombobox.h>
#include <tqpushbutton.h>
#include <tqcheckbox.h>
#include <tdelocale.h>

Finder::Finder(TQWidget *parent) : KDialogBase(parent, 0, false, i18n("Find"), Close | User1, User1, false, KGuiItem(i18n("&Find"),"find"))
{
	TQWidget *mainWidget = new TQWidget(this);
	mainWidget->setMinimumWidth(320);
	setMainWidget(mainWidget);

	TQGridLayout *layout=new TQGridLayout(mainWidget);
	layout->setSpacing(KDialog::spacingHint());

	mText=new KHistoryCombo(mainWidget);
	mText->setMaxCount(10);

	mText->setFocus();

	mRegexp=new TQCheckBox(i18n("&Regular expression"), mainWidget);
	mBackwards=new TQCheckBox(i18n("Find &backwards"), mainWidget);

	layout->addMultiCellWidget(mText, 0, 0, 0, 1);
	layout->addWidget(mRegexp, 1, 0);
	layout->addWidget(mBackwards, 1, 1);

	connect(this, TQT_SIGNAL(user1Clicked()), TQT_SLOT(clicked()));

	connect(mText, TQT_SIGNAL(activated(int)), TQT_SLOT(clicked()));
	connect(mText, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(textChanged(const TQString &)));

	enableButton(User1, false);
}

void Finder::textChanged(const TQString &text) {
	enableButton(User1, !text.isEmpty());
}

bool Finder::regexp() const
{
	return mRegexp->isChecked();
}

bool Finder::isForward() const
{
	return !mBackwards->isChecked();
}

void Finder::clicked()
{
	mText->addToHistory( mText->currentText() );
	emit search(this);
}

TQString Finder::string() const
{
	return mText->currentText();
}


#include "find.moc"