summaryrefslogtreecommitdiffstats
path: root/noatun/modules/splitplaylist/find.cpp
blob: 99eaa8ed1417000610e27abc7f99a12674ef911e (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 <klocale.h>

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

	TQGridLayout *tqlayout=new TQGridLayout(mainWidget);
	tqlayout->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);

	tqlayout->addMultiCellWidget(mText, 0, 0, 0, 1);
	tqlayout->addWidget(mRegexp, 1, 0);
	tqlayout->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"