1
/* This program is free software; you can redistribute it and/or modify
2
* it under the terms of the GNU General Public License version 2
3
* as published by the Free Software Foundation.
5
* This program is distributed in the hope that it will be useful,
6
* but WITHOUT ANY WARRANTY; without even the implied warranty of
7
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8
* GNU General Public License for more details.
10
* You should have received a copy of the GNU General Public License
11
* along with this program; if not, write to the Free Software
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
* Author: Moshe Wagner. <moshe.wagner@gmail.com>
17
#include "searchform.h"
19
SearchForm::SearchForm(QWidget *parent) : QDialog(parent), m_ui(new Ui::SearchForm)
23
if (LANG == "Hebrew") toRTL();
25
m_ui->lineEdit->setFocus();
29
void SearchForm::toRTL()
31
this->setLayoutDirection(Qt::RightToLeft);
34
SearchForm::~SearchForm()
39
void SearchForm::on_submit_clicked()
41
QString otxt = m_ui->lineEdit->text();
42
QString stxt = m_ui->lineEdit->text();
44
if (m_ui->regexpCheckBox->isChecked())
46
emit Search(QRegExp(stxt), tr("RegExp: ") + otxt);
50
if ( m_ui->radioButton->isChecked() )
52
if ( m_ui->fullCheckBox->isChecked()) stxt = "[ :.,-]" + stxt + "[ :.,-]";
56
QStringList words = stxt.split(" ");
57
for (int i=0; i<words.size(); i++)
59
if (words[i] != "") pat += allowNikudAndTeamim(words[i]);
60
if ( i != words.size()-1 ) pat+= "|";
64
emit Search(QRegExp(pat), otxt);
68
stxt = allowNikudAndTeamim(stxt);
69
if ( m_ui->fullCheckBox->isChecked()) stxt = "[ :.,-]" + stxt + "[ :.,-]";
71
emit Search(QRegExp(stxt), otxt);
77
void SearchForm::on_cancel_clicked()
83
void SearchForm::on_regexpCheckBox_clicked(bool checked)
85
m_ui->groupBox->setEnabled(!checked);