compiles cleanly without qt3_support. Needs more testing
This commit is contained in:
parent
1f11387d52
commit
a29e380227
@ -62,7 +62,8 @@ static map<QString,QString> cat_rtranslations;
|
||||
void AdvSearch::init()
|
||||
{
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.COMPLEX");
|
||||
HelpClient::installMap((const char *)objectName().toUtf8(),
|
||||
"RCL.SEARCH.COMPLEX");
|
||||
|
||||
this->installEventFilter(this);
|
||||
|
||||
@ -86,8 +87,8 @@ void AdvSearch::init()
|
||||
connect(addClausePB, SIGNAL(clicked()), this, SLOT(addClause()));
|
||||
connect(delClausePB, SIGNAL(clicked()), this, SLOT(delClause()));
|
||||
|
||||
conjunctCMB->insertItem(tr("All clauses"));
|
||||
conjunctCMB->insertItem(tr("Any clause"));
|
||||
conjunctCMB->insertItem(1, tr("All clauses"));
|
||||
conjunctCMB->insertItem(2, tr("Any clause"));
|
||||
|
||||
// Create preconfigured clauses
|
||||
for (unsigned int i = 0; i < iclausescnt; i++) {
|
||||
@ -116,7 +117,7 @@ void AdvSearch::init()
|
||||
restrictCtCB->setChecked(m_ignByCats);
|
||||
fillFileTypes();
|
||||
|
||||
subtreeCMB->insertStringList(prefs.asearchSubdirHist);
|
||||
subtreeCMB->insertItems(0, prefs.asearchSubdirHist);
|
||||
subtreeCMB->setEditText("");
|
||||
|
||||
// The clauseline frame is needed to force designer to accept a
|
||||
@ -151,7 +152,7 @@ bool AdvSearch::eventFilter(QObject *, QEvent *event)
|
||||
if (event->type() == QEvent::KeyPress ||
|
||||
event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Q && (ke->state() & Qt::ControlButton)) {
|
||||
if (ke->key() == Qt::Key_Q && (ke->modifiers() & Qt::ControlModifier)) {
|
||||
recollNeedsExit = 1;
|
||||
return true;
|
||||
}
|
||||
@ -165,7 +166,7 @@ void AdvSearch::saveCnf()
|
||||
prefs.advSearchClauses.clear();
|
||||
for (std::list<SearchClauseW *>::iterator cit = m_clauseWins.begin();
|
||||
cit != m_clauseWins.end(); cit++) {
|
||||
prefs.advSearchClauses.push_back((*cit)->sTpCMB->currentItem());
|
||||
prefs.advSearchClauses.push_back((*cit)->sTpCMB->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,7 +291,7 @@ void AdvSearch::fillFileTypes()
|
||||
for (list<string>::iterator it = types.begin();
|
||||
it != types.end(); it++) {
|
||||
QString qs = QString::fromUtf8(it->c_str());
|
||||
if (m_ignTypes.findIndex(qs) < 0)
|
||||
if (m_ignTypes.indexOf(qs) < 0)
|
||||
ql.append(qs);
|
||||
}
|
||||
} else {
|
||||
@ -306,7 +307,7 @@ void AdvSearch::fillFileTypes()
|
||||
} else {
|
||||
cat = QString::fromUtf8(it->c_str());
|
||||
}
|
||||
if (m_ignTypes.findIndex(cat) < 0)
|
||||
if (m_ignTypes.indexOf(cat) < 0)
|
||||
ql.append(cat);
|
||||
}
|
||||
}
|
||||
@ -324,7 +325,7 @@ void AdvSearch::saveFileTypes()
|
||||
using namespace Rcl;
|
||||
void AdvSearch::runSearch()
|
||||
{
|
||||
RefCntr<SearchData> sdata(new SearchData(conjunctCMB->currentItem() == 0 ?
|
||||
RefCntr<SearchData> sdata(new SearchData(conjunctCMB->currentIndex() == 0 ?
|
||||
SCLT_AND : SCLT_OR));
|
||||
bool hasclause = false;
|
||||
|
||||
@ -339,17 +340,17 @@ void AdvSearch::runSearch()
|
||||
if (!hasclause)
|
||||
return;
|
||||
|
||||
if (restrictFtCB->isOn() && noFiltypsLB->count() > 0) {
|
||||
if (restrictFtCB->isChecked() && noFiltypsLB->count() > 0) {
|
||||
for (int i = 0; i < yesFiltypsLB->count(); i++) {
|
||||
if (restrictCtCB->isOn()) {
|
||||
if (restrictCtCB->isChecked()) {
|
||||
QString qcat = yesFiltypsLB->item(i)->text();
|
||||
map<QString,QString>::const_iterator qit;
|
||||
string cat;
|
||||
if ((qit = cat_rtranslations.find(qcat)) !=
|
||||
cat_rtranslations.end()) {
|
||||
cat = (const char *)qit->second.utf8();
|
||||
cat = (const char *)qit->second.toUtf8();
|
||||
} else {
|
||||
cat = (const char *)qcat.utf8();
|
||||
cat = (const char *)qcat.toUtf8();
|
||||
}
|
||||
list<string> types;
|
||||
rclconfig->getMimeCatTypes(cat, types);
|
||||
@ -359,19 +360,19 @@ void AdvSearch::runSearch()
|
||||
}
|
||||
} else {
|
||||
sdata->addFiletype((const char *)
|
||||
yesFiltypsLB->item(i)->text().utf8());
|
||||
yesFiltypsLB->item(i)->text().toUtf8());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!subtreeCMB->currentText().isEmpty()) {
|
||||
QString current = subtreeCMB->currentText();
|
||||
sdata->setTopdir((const char*)subtreeCMB->currentText().utf8());
|
||||
sdata->setTopdir((const char*)subtreeCMB->currentText().toUtf8());
|
||||
// Keep history list clean and sorted. Maybe there would be a
|
||||
// simpler way to do this
|
||||
list<QString> entries;
|
||||
for (int i = 0; i < subtreeCMB->count(); i++) {
|
||||
entries.push_back(subtreeCMB->text(i));
|
||||
entries.push_back(subtreeCMB->itemText(i));
|
||||
}
|
||||
entries.push_back(subtreeCMB->currentText());
|
||||
entries.sort();
|
||||
@ -379,12 +380,12 @@ void AdvSearch::runSearch()
|
||||
subtreeCMB->clear();
|
||||
for (list<QString>::iterator it = entries.begin();
|
||||
it != entries.end(); it++) {
|
||||
subtreeCMB->insertItem(*it);
|
||||
subtreeCMB->addItem(*it);
|
||||
}
|
||||
subtreeCMB->setCurrentText(current);
|
||||
subtreeCMB->setCurrentIndex(subtreeCMB->findText(current));
|
||||
prefs.asearchSubdirHist.clear();
|
||||
for (int index = 0; index < subtreeCMB->count(); index++)
|
||||
prefs.asearchSubdirHist.push_back(subtreeCMB->text(index));
|
||||
prefs.asearchSubdirHist.push_back(subtreeCMB->itemText(index));
|
||||
}
|
||||
saveCnf();
|
||||
|
||||
|
||||
@ -6,37 +6,11 @@ static char rcsid[] = "@(#$Id: confgui.cpp,v 1.9 2008-05-21 07:21:37 dockes Exp
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <qglobal.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QFRAME_INCLUDE <qframe.h>
|
||||
#define QFILEDIALOG_INCLUDE <qfiledialog.h>
|
||||
#define QLISTBOX_INCLUDE <qlistbox.h>
|
||||
#define QFILEDIALOG QFileDialog
|
||||
#define QFRAME QFrame
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#define QLISTBOXITEM QListBoxItem
|
||||
#define QLBEXACTMATCH Qt::ExactMatch
|
||||
#define QVBOXLAYOUT QVBoxLayout
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFrame>
|
||||
#define QFRAME_INCLUDE <q3frame.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#define QFILEDIALOG_INCLUDE <q3filedialog.h>
|
||||
|
||||
#define QLISTBOX_INCLUDE <q3listbox.h>
|
||||
|
||||
#define QFILEDIALOG Q3FileDialog
|
||||
#define QFRAME Q3Frame
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#define QLISTBOXITEM Q3ListBoxItem
|
||||
#define QLBEXACTMATCH Q3ListBox::ExactMatch
|
||||
#define QVBOXLAYOUT Q3VBoxLayout
|
||||
#endif
|
||||
#include <QListWidget>
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qlayout.h>
|
||||
@ -47,13 +21,10 @@ static char rcsid[] = "@(#$Id: confgui.cpp,v 1.9 2008-05-21 07:21:37 dockes Exp
|
||||
#include <qtooltip.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include QFILEDIALOG_INCLUDE
|
||||
#include <qinputdialog.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qcombobox.h>
|
||||
#include QFRAME_INCLUDE
|
||||
|
||||
#include "confgui.h"
|
||||
#include "smallut.h"
|
||||
@ -65,15 +36,15 @@ using std::list;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
const static int spacing = 4;
|
||||
const static int margin = 6;
|
||||
const static int spacing = 2;
|
||||
const static int margin = 2;
|
||||
|
||||
void ConfParamW::setValue(const QString& value)
|
||||
{
|
||||
if (m_fsencoding)
|
||||
m_cflink->set(string((const char *)value.local8Bit()));
|
||||
m_cflink->set(string((const char *)value.toLocal8Bit()));
|
||||
else
|
||||
m_cflink->set(string((const char *)value.utf8()));
|
||||
m_cflink->set(string((const char *)value.toUtf8()));
|
||||
}
|
||||
|
||||
void ConfParamW::setValue(int value)
|
||||
@ -89,19 +60,26 @@ void ConfParamW::setValue(bool value)
|
||||
m_cflink->set(string(buf));
|
||||
}
|
||||
|
||||
void setSzPol(QWidget *w, QSizePolicy::Policy hpol,
|
||||
QSizePolicy::Policy vpol,
|
||||
int hstretch, int vstretch)
|
||||
{
|
||||
QSizePolicy policy(hpol, vpol);
|
||||
policy.setHorizontalStretch(hstretch);
|
||||
policy.setVerticalStretch(vstretch);
|
||||
policy.setHeightForWidth(w->sizePolicy().hasHeightForWidth());
|
||||
w->setSizePolicy(policy);
|
||||
}
|
||||
|
||||
bool ConfParamW::createCommon(const QString& lbltxt, const QString& tltptxt)
|
||||
{
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
QLabel *tl = new QLabel(this);
|
||||
tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
tl->sizePolicy().hasHeightForWidth() ) );
|
||||
setSzPol(tl, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
tl->setToolTip(tltptxt);
|
||||
|
||||
m_hl->addWidget(tl);
|
||||
|
||||
@ -120,21 +98,13 @@ ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink cflink,
|
||||
return;
|
||||
|
||||
m_sb = new QSpinBox(this);
|
||||
m_sb->setMinValue(minvalue);
|
||||
m_sb->setMaxValue(maxvalue);
|
||||
m_sb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_sb->sizePolicy().hasHeightForWidth()));
|
||||
m_sb->setMinimum(minvalue);
|
||||
m_sb->setMaximum(maxvalue);
|
||||
setSzPol(m_sb, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
m_hl->addWidget(m_sb);
|
||||
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
fr->sizePolicy().hasHeightForWidth() ) );
|
||||
QFrame *fr = new QFrame(this);
|
||||
setSzPol(fr, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
m_hl->addWidget(fr);
|
||||
|
||||
loadValue();
|
||||
@ -158,12 +128,10 @@ ConfParamStrW::ConfParamStrW(QWidget *parent, ConfLink cflink,
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
|
||||
m_le = new QLineEdit(this);
|
||||
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_le->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_le, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
|
||||
m_hl->addWidget(m_le);
|
||||
|
||||
loadValue();
|
||||
@ -190,14 +158,12 @@ ConfParamCStrW::ConfParamCStrW(QWidget *parent, ConfLink cflink,
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
m_cmb = new QComboBox(false, this);
|
||||
m_cmb->insertStringList(sl);
|
||||
// m_cmb->setEditable(false);
|
||||
m_cmb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_cmb->sizePolicy().hasHeightForWidth()));
|
||||
m_cmb = new QComboBox(this);
|
||||
m_cmb->setEditable(FALSE);
|
||||
m_cmb->insertItems(0, sl);
|
||||
|
||||
setSzPol(m_cmb, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
|
||||
m_hl->addWidget(m_cmb);
|
||||
|
||||
loadValue();
|
||||
@ -216,8 +182,8 @@ void ConfParamCStrW::loadValue()
|
||||
cs = QString::fromUtf8(s.c_str());
|
||||
|
||||
for (int i = 0; i < m_cmb->count(); i++) {
|
||||
if (!cs.compare(m_cmb->text(i))) {
|
||||
m_cmb->setCurrentItem(i);
|
||||
if (!cs.compare(m_cmb->itemText(i))) {
|
||||
m_cmb->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -229,29 +195,20 @@ ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink cflink,
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
// No createCommon because the checkbox has a label
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
m_cb = new QCheckBox(lbltxt, this);
|
||||
m_cb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_cb->sizePolicy().hasHeightForWidth()));
|
||||
QToolTip::add(m_cb, tltptxt);
|
||||
setSzPol(m_cb, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
m_cb->setToolTip(tltptxt);
|
||||
m_hl->addWidget(m_cb);
|
||||
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
fr->sizePolicy().hasHeightForWidth()));
|
||||
QFrame *fr = new QFrame(this);
|
||||
setSzPol(fr, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(fr);
|
||||
|
||||
loadValue();
|
||||
QObject::connect(m_cb, SIGNAL(toggled(bool)),
|
||||
this, SLOT(setValue(bool)));
|
||||
QObject::connect(m_cb, SIGNAL(toggled(bool)), this, SLOT(setValue(bool)));
|
||||
}
|
||||
|
||||
void ConfParamBoolW::loadValue()
|
||||
@ -272,22 +229,14 @@ ConfParamFNW::ConfParamFNW(QWidget *parent, ConfLink cflink,
|
||||
return;
|
||||
|
||||
m_fsencoding = true;
|
||||
|
||||
m_le = new QLineEdit(this);
|
||||
m_le->setMinimumSize(QSize(150, 0 ));
|
||||
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_le->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_le, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(m_le);
|
||||
|
||||
m_pb = new QPushButton(this);
|
||||
m_pb->setText(tr("Browse"));
|
||||
m_pb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_pb->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_pb, QSizePolicy::Fixed, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(m_pb);
|
||||
|
||||
loadValue();
|
||||
@ -306,68 +255,56 @@ void ConfParamFNW::loadValue()
|
||||
void ConfParamFNW::showBrowserDialog()
|
||||
{
|
||||
QString s = m_isdir ?
|
||||
QFILEDIALOG::getExistingDirectory() : QFILEDIALOG::getSaveFileName();
|
||||
QFileDialog::getExistingDirectory() : QFileDialog::getSaveFileName();
|
||||
if (!s.isEmpty())
|
||||
m_le->setText(s);
|
||||
}
|
||||
|
||||
class SmallerListWidget: public QListWidget
|
||||
{
|
||||
public:
|
||||
SmallerListWidget(QWidget *parent)
|
||||
: QListWidget(parent) {}
|
||||
virtual QSize sizeHint() {return QSize(150, 40);}
|
||||
};
|
||||
|
||||
ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
// Can't use createCommon here cause we want the buttons below the label
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
QVBOXLAYOUT *vl1 = new QVBOXLAYOUT();
|
||||
QHBOXLAYOUT *hl1 = new QHBOXLAYOUT();
|
||||
QVBoxLayout *vl1 = new QVBoxLayout();
|
||||
QHBoxLayout *hl1 = new QHBoxLayout();
|
||||
|
||||
QLabel *tl = new QLabel(this);
|
||||
tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
tl->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(tl, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
tl->setToolTip(tltptxt);
|
||||
vl1->addWidget(tl);
|
||||
|
||||
QPushButton *pbA = new QPushButton(this);
|
||||
pbA->setText(tr("+"));
|
||||
pbA->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pbA->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(pbA, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
hl1->addWidget(pbA);
|
||||
|
||||
QPushButton *pbD = new QPushButton(this);
|
||||
setSzPol(pbD, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
pbD->setText(tr("-"));
|
||||
pbD->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pbD->sizePolicy().hasHeightForWidth()));
|
||||
hl1->addWidget(pbD);
|
||||
|
||||
vl1->addLayout(hl1);
|
||||
m_hl->addLayout(vl1);
|
||||
|
||||
m_lb = new QLISTBOX(this);
|
||||
m_lb->setSelectionMode(QLISTBOX::Extended);
|
||||
m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
m_lb->sizePolicy().hasHeightForWidth()));
|
||||
m_lb = new SmallerListWidget(this);
|
||||
m_lb->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setSzPol(m_lb, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
m_hl->addWidget(m_lb);
|
||||
|
||||
this->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
this->sizePolicy().hasHeightForWidth()));
|
||||
|
||||
setSzPol(this, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
loadValue();
|
||||
QObject::connect(pbA, SIGNAL(clicked()), this, SLOT(showInputDialog()));
|
||||
QObject::connect(pbD, SIGNAL(clicked()), this, SLOT(deleteSelected()));
|
||||
@ -387,22 +324,25 @@ void ConfParamSLW::loadValue()
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_lb->clear();
|
||||
m_lb->insertStringList(qls);
|
||||
m_lb->insertItems(0, qls);
|
||||
}
|
||||
|
||||
void ConfParamSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getText("", // Caption
|
||||
"", // Label
|
||||
QLineEdit::Normal, // Mode
|
||||
QString::null, // text
|
||||
&ok,
|
||||
this);
|
||||
QString s = QInputDialog::getText (this,
|
||||
"", // title
|
||||
"", // label,
|
||||
QLineEdit::Normal, // EchoMode mode
|
||||
"", // const QString & text
|
||||
&ok);
|
||||
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
@ -411,14 +351,15 @@ void ConfParamSLW::showInputDialog()
|
||||
void ConfParamSLW::listToConf()
|
||||
{
|
||||
list<string> ls;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
for (int i = 0; i < m_lb->count(); i++) {
|
||||
// General parameters are encoded as utf-8. File names as
|
||||
// local8bit There is no hope for 8bit file names anyway
|
||||
// except for luck: the original encoding is unknown.
|
||||
QString text = m_lb->item(i)->text();
|
||||
if (m_fsencoding)
|
||||
ls.push_back((const char *)(m_lb->text(i).local8Bit()));
|
||||
ls.push_back((const char *)(text.toLocal8Bit()));
|
||||
else
|
||||
ls.push_back((const char *)(m_lb->text(i).utf8()));
|
||||
ls.push_back((const char *)(text.toUtf8()));
|
||||
}
|
||||
string s;
|
||||
stringsToString(ls, s);
|
||||
@ -430,10 +371,11 @@ void ConfParamSLW::deleteSelected()
|
||||
bool didone;
|
||||
do {
|
||||
didone = false;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
if (m_lb->isSelected(i)) {
|
||||
emit entryDeleted(m_lb->text(i));
|
||||
m_lb->removeItem(i);
|
||||
for (int i = 0; i < m_lb->count(); i++) {
|
||||
if (m_lb->item(i)->isSelected()) {
|
||||
emit entryDeleted(m_lb->item(i)->text());
|
||||
QListWidgetItem *item = m_lb->takeItem(i);
|
||||
delete item;
|
||||
didone = true;
|
||||
break;
|
||||
}
|
||||
@ -445,14 +387,18 @@ void ConfParamSLW::deleteSelected()
|
||||
// "Add entry" dialog for a file name list
|
||||
void ConfParamDNLW::showInputDialog()
|
||||
{
|
||||
QString s = QFILEDIALOG::getExistingDirectory();
|
||||
QString s = QFileDialog::getExistingDirectory();
|
||||
if (!s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QLISTBOXITEM *item = m_lb->findItem(s, QLBEXACTMATCH);
|
||||
if (m_lb->selectionMode() == QLISTBOX::Single && item)
|
||||
m_lb->setSelected(item, true);
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (m_lb->selectionMode() == QAbstractItemView::SingleSelection &&
|
||||
!items.empty())
|
||||
(*items.begin())->setSelected(TRUE);
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
@ -462,16 +408,20 @@ void ConfParamDNLW::showInputDialog()
|
||||
void ConfParamCSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getItem("", // Caption
|
||||
"", // Label
|
||||
m_sl, // List
|
||||
0, // current
|
||||
false, // editable,
|
||||
&ok);
|
||||
QString s = QInputDialog::getItem (this, // parent
|
||||
"", // title
|
||||
"", // label,
|
||||
m_sl, // items,
|
||||
0, // current = 0
|
||||
FALSE, // editable = true,
|
||||
&ok);
|
||||
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,21 +27,14 @@
|
||||
#include <qglobal.h>
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#else
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#endif
|
||||
|
||||
#include "refcntr.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
class QHBOXLAYOUT;
|
||||
class QHBoxLayout;
|
||||
class QLineEdit;
|
||||
class QLISTBOX;
|
||||
class QListWidget;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
@ -84,7 +77,7 @@ namespace confgui {
|
||||
virtual void setFsEncoding(bool onoff) {m_fsencoding = onoff;}
|
||||
protected:
|
||||
ConfLink m_cflink;
|
||||
QHBOXLAYOUT *m_hl;
|
||||
QHBoxLayout *m_hl;
|
||||
// File names are encoded as local8bit in the config files. Other
|
||||
// are encoded as utf-8
|
||||
bool m_fsencoding;
|
||||
@ -192,7 +185,7 @@ namespace confgui {
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
virtual void loadValue();
|
||||
QLISTBOX *getListBox() {return m_lb;}
|
||||
QListWidget *getListBox() {return m_lb;}
|
||||
|
||||
public slots:
|
||||
virtual void setEnabled(bool i) {if(m_lb) ((QWidget*)m_lb)->setEnabled(i);}
|
||||
@ -202,7 +195,7 @@ namespace confgui {
|
||||
signals:
|
||||
void entryDeleted(QString);
|
||||
protected:
|
||||
QLISTBOX *m_lb;
|
||||
QListWidget *m_lb;
|
||||
void listToConf();
|
||||
};
|
||||
|
||||
@ -237,6 +230,10 @@ namespace confgui {
|
||||
protected:
|
||||
const QStringList m_sl;
|
||||
};
|
||||
|
||||
extern void setSzPol(QWidget *w, QSizePolicy::Policy hpol,
|
||||
QSizePolicy::Policy vpol,
|
||||
int hstretch, int vstretch);
|
||||
}
|
||||
|
||||
#endif /* _confgui_h_included_ */
|
||||
|
||||
@ -3,49 +3,18 @@ static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.13 2008-09-30 12:38:29 docke
|
||||
#endif
|
||||
|
||||
#include <qglobal.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QFRAME_INCLUDE <qframe.h>
|
||||
#define QFILEDIALOG_INCLUDE <qfiledialog.h>
|
||||
#define QLISTBOX_INCLUDE <qlistbox.h>
|
||||
#define QFILEDIALOG QFileDialog
|
||||
#define QFRAME QFrame
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#define QLISTBOXITEM QListBoxItem
|
||||
#define QLBEXACTMATCH Qt::ExactMatch
|
||||
#define QVBOXLAYOUT QVBoxLayout
|
||||
#define QGROUPBOX QGroupBox
|
||||
#include <qgroupbox.h>
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
#include <Q3GroupBox>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QFrame>
|
||||
#define QFRAME_INCLUDE <q3frame.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#define QFILEDIALOG_INCLUDE <q3filedialog.h>
|
||||
|
||||
#define QLISTBOX_INCLUDE <q3listbox.h>
|
||||
|
||||
#define QFILEDIALOG Q3FileDialog
|
||||
#define QFRAME Q3Frame
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#define QLISTBOXITEM Q3ListBoxItem
|
||||
#define QLBEXACTMATCH Q3ListBox::ExactMatch
|
||||
#define QVBOXLAYOUT Q3VBoxLayout
|
||||
#define QGROUPBOX Q3GroupBox
|
||||
#endif
|
||||
#include <qlayout.h>
|
||||
#include QFRAME_INCLUDE
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qtimer.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <QListWidget>
|
||||
|
||||
#include <list>
|
||||
using std::list;
|
||||
@ -62,20 +31,28 @@ using std::list;
|
||||
#include "rclconfig.h"
|
||||
|
||||
namespace confgui {
|
||||
const static int spacing = 6;
|
||||
const static int margin = 6;
|
||||
const static int spacing = 3;
|
||||
const static int margin = 3;
|
||||
|
||||
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
||||
: QTABDIALOG(parent), m_rclconf(config)
|
||||
: QDialog(parent), m_rclconf(config)
|
||||
{
|
||||
setCaption(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
||||
setOkButton();
|
||||
setCancelButton();
|
||||
|
||||
setWindowTitle(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
||||
tabWidget = new QTabWidget;
|
||||
reloadPanels();
|
||||
resize(QSize(600, 500).expandedTo(minimumSizeHint()));
|
||||
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
|
||||
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
|
||||
|
||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(tabWidget);
|
||||
mainLayout->addWidget(buttonBox);
|
||||
setLayout(mainLayout);
|
||||
|
||||
resize(QSize(600, 450).expandedTo(minimumSizeHint()));
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
|
||||
}
|
||||
|
||||
void ConfIndexW::acceptChanges()
|
||||
@ -101,6 +78,7 @@ void ConfIndexW::acceptChanges()
|
||||
startIndexingAfterConfig = 0;
|
||||
start_indexing(true);
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
void ConfIndexW::rejectChanges()
|
||||
@ -110,6 +88,7 @@ void ConfIndexW::rejectChanges()
|
||||
delete m_conf;
|
||||
m_conf = 0;
|
||||
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
||||
hide();
|
||||
}
|
||||
|
||||
void ConfIndexW::reloadPanels()
|
||||
@ -117,31 +96,26 @@ void ConfIndexW::reloadPanels()
|
||||
if ((m_conf = m_rclconf->cloneMainConfig()) == 0)
|
||||
return;
|
||||
m_conf->holdWrites(true);
|
||||
for (list<QWidget *>::iterator it = m_widgets.begin();
|
||||
it != m_widgets.end(); it++) {
|
||||
removePage(*it);
|
||||
delete *it;
|
||||
}
|
||||
tabWidget->clear();
|
||||
m_widgets.clear();
|
||||
|
||||
QWidget *w = new ConfTopPanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Global parameters"));
|
||||
tabWidget->addTab(w, QObject::tr("Global parameters"));
|
||||
|
||||
w = new ConfSubPanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Local parameters"));
|
||||
tabWidget->addTab(w, QObject::tr("Local parameters"));
|
||||
|
||||
w = new ConfBeaglePanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Beagle web history"));
|
||||
|
||||
tabWidget->addTab(w, QObject::tr("Beagle web history"));
|
||||
}
|
||||
|
||||
ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@ -161,7 +135,7 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
"for visited web pages.<br>"
|
||||
"A non-absolute path is taken relative to the "
|
||||
"configuration directory."), true);
|
||||
cp2->setEnabled(cp1->m_cb->isOn());
|
||||
cp2->setEnabled(cp1->m_cb->isChecked());
|
||||
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp2, SLOT(setEnabled(bool)));
|
||||
vboxLayout->addWidget(cp2);
|
||||
|
||||
@ -170,7 +144,7 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
new ConfParamIntW(this, lnk3, tr("Max. size for the web cache (MB)"),
|
||||
tr("Entries will be recycled once the size is reached"),
|
||||
-1, 1000);
|
||||
cp3->setEnabled(cp1->m_cb->isOn());
|
||||
cp3->setEnabled(cp1->m_cb->isChecked());
|
||||
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp3, SLOT(setEnabled(bool)));
|
||||
vboxLayout->addWidget(cp3);
|
||||
vboxLayout->insertStretch(-1);
|
||||
@ -188,11 +162,8 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
||||
tr("The list of directories where recursive "
|
||||
"indexing starts. Default: your home."));
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(etopdirs, 0, 0, 0, 1);
|
||||
#else
|
||||
setSzPol(etopdirs, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
gl1->addWidget(etopdirs, 0, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
||||
ConfParamSLW *eskp = new
|
||||
@ -205,11 +176,8 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"to '/usr/home', a correct skippedPath entry "
|
||||
"would be '/home/me/tmp*', not '/usr/home/me/tmp*')"));
|
||||
eskp->setFsEncoding(true);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eskp, 1, 1, 0, 1);
|
||||
#else
|
||||
setSzPol(eskp, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
gl1->addWidget(eskp, 1, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
list<string> cstemlangs = Rcl::Db::getStemmerNames();
|
||||
QStringList stemlangs;
|
||||
@ -222,22 +190,15 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
ConfParamCSLW(this, lnkidxsl, tr("Stemming languages"),
|
||||
tr("The languages for which stemming expansion<br>"
|
||||
"dictionaries will be built."), stemlangs);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eidxsl, 2, 2, 0, 1);
|
||||
#else
|
||||
setSzPol(eidxsl, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
gl1->addWidget(eidxsl, 2, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnk4(new ConfLinkRclRep(config, "logfilename"));
|
||||
ConfParamFNW *e4 = new
|
||||
ConfParamFNW(this, lnk4, tr("Log file name"),
|
||||
tr("The file where the messages will be written.<br>"
|
||||
"Use 'stderr' for terminal output"), false);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(e4, 3, 3, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(e4, 3, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
QWidget *w = 0;
|
||||
|
||||
@ -289,7 +250,7 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"To get an idea of what is installed on your system, "
|
||||
"type 'aspell config' and look for .dat files inside "
|
||||
"the 'data-dir' directory. "));
|
||||
cpaspl->setEnabled(!cpasp->m_cb->isOn());
|
||||
cpaspl->setEnabled(!cpasp->m_cb->isChecked());
|
||||
connect(cpasp->m_cb, SIGNAL(toggled(bool)), cpaspl,SLOT(setDisabled(bool)));
|
||||
gl1->addWidget(cpaspl, 6, 1);
|
||||
|
||||
@ -300,17 +261,13 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"A non-absolute path is taken relative to the "
|
||||
" configuration directory. The default is 'xapiandb'."
|
||||
), true);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(edbd, 7, 7, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(edbd, 7, 0, 1, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
: QWidget(parent), m_config(config)
|
||||
{
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@ -321,9 +278,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
QObject::tr("The list of subdirectories in the indexed "
|
||||
"hierarchy <br>where some parameters need "
|
||||
"to be redefined. Default: empty."));
|
||||
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
||||
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
||||
this, SLOT(subDirChanged()));
|
||||
m_subdirs->getListBox()->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
connect(m_subdirs->getListBox(),
|
||||
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
||||
this,
|
||||
SLOT(subDirChanged(QListWidgetItem *, QListWidgetItem *)));
|
||||
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
|
||||
this, SLOT(subDirDeleted(QString)));
|
||||
list<string> allkeydirs = config->getSubKeys();
|
||||
@ -332,12 +291,12 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
it != allkeydirs.end(); it++) {
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_subdirs->getListBox()->insertStringList(qls);
|
||||
m_subdirs->getListBox()->insertItems(0, qls);
|
||||
vboxLayout->addWidget(m_subdirs);
|
||||
|
||||
QFRAME *line2 = new QFRAME(this);
|
||||
line2->setFrameShape(QFRAME::HLine);
|
||||
line2->setFrameShadow(QFRAME::Sunken);
|
||||
QFrame *line2 = new QFrame(this);
|
||||
line2->setFrameShape(QFrame::HLine);
|
||||
line2->setFrameShadow(QFrame::Sunken);
|
||||
vboxLayout->addWidget(line2);
|
||||
|
||||
QLabel *explain = new QLabel(this);
|
||||
@ -352,31 +311,22 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
vboxLayout->addWidget(explain);
|
||||
|
||||
|
||||
m_groupbox = new QGROUPBOX(1, Qt::Horizontal, this);
|
||||
m_groupbox->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
3, // Vertical stretch
|
||||
m_groupbox->sizePolicy().hasHeightForWidth()));
|
||||
m_groupbox = new QGroupBox(this);
|
||||
setSzPol(m_groupbox, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
|
||||
QWidget *w = new QWidget(m_groupbox);
|
||||
QGridLayout *gl1 = new QGridLayout(w);
|
||||
QGridLayout *gl1 = new QGridLayout(m_groupbox);
|
||||
gl1->setSpacing(spacing);
|
||||
gl1->setMargin(margin);
|
||||
|
||||
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
||||
ConfParamSLW *eskn = new
|
||||
ConfParamSLW(w, lnkskn,
|
||||
ConfParamSLW(m_groupbox, lnkskn,
|
||||
QObject::tr("Skipped names"),
|
||||
QObject::tr("These are patterns for file or directory "
|
||||
" names which should not be indexed."));
|
||||
eskn->setFsEncoding(true);
|
||||
m_widgets.push_back(eskn);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eskn, 0, 0, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(eskn, 0, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
list<string> args;
|
||||
args.push_back("-l");
|
||||
@ -399,7 +349,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnk21(new ConfLinkRclRep(config, "defaultcharset", &m_sk));
|
||||
ConfParamCStrW *e21 = new
|
||||
ConfParamCStrW(w, lnk21,
|
||||
ConfParamCStrW(m_groupbox, lnk21,
|
||||
QObject::tr("Default character set"),
|
||||
QObject::tr("This is the character set used for reading files "
|
||||
"which do not identify the character set "
|
||||
@ -408,15 +358,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
"and the value from the NLS environnement is used."
|
||||
), charsets);
|
||||
m_widgets.push_back(e21);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(e21, 1, 1, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(e21, 1, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnk3(new ConfLinkRclRep(config, "followLinks", &m_sk));
|
||||
ConfParamBoolW *e3 = new
|
||||
ConfParamBoolW(w, lnk3,
|
||||
ConfParamBoolW(m_groupbox, lnk3,
|
||||
QObject::tr("Follow symbolic links"),
|
||||
QObject::tr("Follow symbolic links while "
|
||||
"indexing. The default is no, "
|
||||
@ -426,7 +372,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkafln(new ConfLinkRclRep(config, "indexallfilenames", &m_sk));
|
||||
ConfParamBoolW *eafln = new
|
||||
ConfParamBoolW(w, lnkafln,
|
||||
ConfParamBoolW(m_groupbox, lnkafln,
|
||||
QObject::tr("Index all file names"),
|
||||
QObject::tr("Index the names of files for which the contents "
|
||||
"cannot be identified or processed (no or "
|
||||
@ -436,7 +382,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkzfmaxkbs(new ConfLinkRclRep(config, "compressedfilemaxkbs"));
|
||||
ConfParamIntW *ezfmaxkbs = new
|
||||
ConfParamIntW(w, lnkzfmaxkbs,
|
||||
ConfParamIntW(m_groupbox, lnkzfmaxkbs,
|
||||
tr("Max. compressed file size (KB)"),
|
||||
tr("This value sets a threshold beyond which compressed"
|
||||
"files will not be processed. Set to -1 for no "
|
||||
@ -447,7 +393,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs"));
|
||||
ConfParamIntW *etxtmaxmbs = new
|
||||
ConfParamIntW(w, lnktxtmaxmbs,
|
||||
ConfParamIntW(m_groupbox, lnktxtmaxmbs,
|
||||
tr("Max. text file size (MB)"),
|
||||
tr("This value sets a threshold beyond which text "
|
||||
"files will not be processed. Set to -1 for no "
|
||||
@ -459,7 +405,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnktxtpagekbs(new ConfLinkRclRep(config, "textfilepagekbs"));
|
||||
ConfParamIntW *etxtpagekbs = new
|
||||
ConfParamIntW(w, lnktxtpagekbs,
|
||||
ConfParamIntW(m_groupbox, lnktxtpagekbs,
|
||||
tr("Text file page size (KB)"),
|
||||
tr("If this value is set (not equal to -1), text "
|
||||
"files will be split in chunks of this size for "
|
||||
@ -471,7 +417,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkfiltmaxsecs(new ConfLinkRclRep(config, "filtermaxseconds"));
|
||||
ConfParamIntW *efiltmaxsecs = new
|
||||
ConfParamIntW(w, lnkfiltmaxsecs,
|
||||
ConfParamIntW(m_groupbox, lnkfiltmaxsecs,
|
||||
tr("Max. filter exec. time (S)"),
|
||||
tr("External filters working longer than this will be "
|
||||
"aborted. This is for the rare case (ie: postscript) "
|
||||
@ -482,7 +428,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
gl1->addWidget(efiltmaxsecs, 4, 1);
|
||||
|
||||
vboxLayout->addWidget(m_groupbox);
|
||||
subDirChanged();
|
||||
subDirChanged(0, 0);
|
||||
}
|
||||
|
||||
void ConfSubPanelW::reloadAll()
|
||||
@ -493,16 +439,16 @@ void ConfSubPanelW::reloadAll()
|
||||
}
|
||||
}
|
||||
|
||||
void ConfSubPanelW::subDirChanged()
|
||||
void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
|
||||
QLISTBOXITEM *item = m_subdirs->getListBox()->selectedItem();
|
||||
if (item == 0 || item->text() == "") {
|
||||
|
||||
if (current == 0 || current->text() == "") {
|
||||
m_sk = "";
|
||||
m_groupbox->setTitle(tr("Global"));
|
||||
} else {
|
||||
m_sk = (const char *)item->text().utf8();
|
||||
m_groupbox->setTitle(item->text());
|
||||
m_sk = (const char *) current->text().toUtf8();
|
||||
m_groupbox->setTitle(current->text());
|
||||
}
|
||||
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
|
||||
reloadAll();
|
||||
@ -510,20 +456,20 @@ void ConfSubPanelW::subDirChanged()
|
||||
|
||||
void ConfSubPanelW::subDirDeleted(QString sbd)
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.utf8()));
|
||||
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.toUtf8()));
|
||||
if (sbd == "") {
|
||||
// Can't do this, have to reinsert it
|
||||
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
|
||||
return;
|
||||
}
|
||||
// Have to delete all entries for submap
|
||||
m_config->eraseKey((const char *)sbd.utf8());
|
||||
m_config->eraseKey((const char *)sbd.toUtf8());
|
||||
}
|
||||
|
||||
void ConfSubPanelW::restoreEmpty()
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
|
||||
m_subdirs->getListBox()->insertItem("", 0);
|
||||
m_subdirs->getListBox()->insertItem(0, "");
|
||||
}
|
||||
|
||||
} // Namespace confgui
|
||||
|
||||
@ -7,17 +7,13 @@
|
||||
* confgui elements, linked to configuration parameters, into panels.
|
||||
*/
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qgroupbox.h>
|
||||
#include <qtabdialog.h>
|
||||
#define QTABDIALOG QTabDialog
|
||||
#else // Qt4 ->
|
||||
#include <Q3GroupBox>
|
||||
#include <Q3TabDialog>
|
||||
#define QTABDIALOG Q3TabDialog
|
||||
#endif // QT 3/4
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QGroupBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTabWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
@ -31,7 +27,7 @@ class ConfParamDNLW;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
class ConfIndexW : public QTABDIALOG {
|
||||
class ConfIndexW : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfIndexW(QWidget *parent, RclConfig *config);
|
||||
@ -43,6 +39,8 @@ private:
|
||||
RclConfig *m_rclconf;
|
||||
ConfNull *m_conf;
|
||||
list<QWidget *> m_widgets;
|
||||
QTabWidget *tabWidget;
|
||||
QDialogButtonBox *buttonBox;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -64,7 +62,7 @@ public:
|
||||
ConfSubPanelW(QWidget *parent, ConfNull *config);
|
||||
|
||||
private slots:
|
||||
void subDirChanged();
|
||||
void subDirChanged(QListWidgetItem *, QListWidgetItem *);
|
||||
void subDirDeleted(QString);
|
||||
void restoreEmpty();
|
||||
private:
|
||||
@ -72,11 +70,7 @@ private:
|
||||
ConfParamDNLW *m_subdirs;
|
||||
list<ConfParamW*> m_widgets;
|
||||
ConfNull *m_config;
|
||||
#if QT_VERSION < 0x040000
|
||||
QGroupBox *m_groupbox;
|
||||
#else
|
||||
Q3GroupBox *m_groupbox;
|
||||
#endif
|
||||
void reloadAll();
|
||||
};
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ int main(int argc, char **argv)
|
||||
question += *argv++;
|
||||
}
|
||||
|
||||
// Translation file for Qt TOBEDONE ?
|
||||
// Translation file for Qt
|
||||
QString slang = QLocale::system().name().left(2);
|
||||
QTranslator qt(0);
|
||||
qt.load(QString("qt_") + slang, "." );
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
virtual string startMatch()
|
||||
{
|
||||
return string("<span style='color: ")
|
||||
+ string((const char *)(prefs.qtermcolor.utf8()))
|
||||
+ string((const char *)(prefs.qtermcolor.toUtf8()))
|
||||
+ string(";font-weight: bold;")
|
||||
+ string("'>");
|
||||
}
|
||||
@ -110,9 +110,10 @@ public:
|
||||
};
|
||||
|
||||
PreviewTextEdit::PreviewTextEdit(QWidget* parent,const char* name, Preview *pv)
|
||||
: QTextEdit(parent, name), m_preview(pv), m_dspflds(false)
|
||||
: QTextEdit(parent), m_preview(pv), m_dspflds(false)
|
||||
{
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setObjectName(name);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||
this, SLOT(createPopupMenu(const QPoint&)));
|
||||
m_plaintorich = new PlainToRichQtPreview();
|
||||
@ -125,44 +126,39 @@ PreviewTextEdit::~PreviewTextEdit()
|
||||
|
||||
void Preview::init()
|
||||
{
|
||||
setName("Preview");
|
||||
setSizePolicy( QSizePolicy((QSizePolicy::SizeType)5,
|
||||
(QSizePolicy::SizeType)5, 0, 0,
|
||||
sizePolicy().hasHeightForWidth()));
|
||||
QVBoxLayout* previewLayout =
|
||||
new QVBoxLayout( this, 4, 6, "previewLayout");
|
||||
setObjectName("Preview");
|
||||
QVBoxLayout* previewLayout = new QVBoxLayout(this);
|
||||
|
||||
pvTab = new QTabWidget(this, "pvTab");
|
||||
pvTab = new QTabWidget(this);
|
||||
|
||||
// Create the first tab. Should be possible to use addEditorTab
|
||||
// but this causes a pb with the sizeing
|
||||
QWidget *unnamed = new QWidget(pvTab, "unnamed");
|
||||
QVBoxLayout *unnamedLayout =
|
||||
new QVBoxLayout(unnamed, 0, 6, "unnamedLayout");
|
||||
QWidget *unnamed = new QWidget(pvTab);
|
||||
QVBoxLayout *unnamedLayout = new QVBoxLayout(unnamed);
|
||||
PreviewTextEdit *pvEdit = new PreviewTextEdit(unnamed, "pvEdit", this);
|
||||
pvEdit->setReadOnly(TRUE);
|
||||
pvEdit->setUndoRedoEnabled(FALSE);
|
||||
unnamedLayout->addWidget(pvEdit);
|
||||
pvTab->insertTab(unnamed, QString::fromLatin1(""));
|
||||
pvTab->addTab(unnamed, "");
|
||||
|
||||
previewLayout->addWidget(pvTab);
|
||||
|
||||
// Create the buttons and entry field
|
||||
QHBoxLayout *layout3 = new QHBoxLayout(0, 0, 6, "layout3");
|
||||
searchLabel = new QLabel(this, "searchLabel");
|
||||
QHBoxLayout *layout3 = new QHBoxLayout(0);
|
||||
searchLabel = new QLabel(this);
|
||||
layout3->addWidget(searchLabel);
|
||||
searchTextLine = new QLineEdit(this, "searchTextLine");
|
||||
searchTextLine = new QLineEdit(this);
|
||||
layout3->addWidget(searchTextLine);
|
||||
nextButton = new QPushButton(this, "nextButton");
|
||||
nextButton = new QPushButton(this);
|
||||
nextButton->setEnabled(TRUE);
|
||||
layout3->addWidget(nextButton);
|
||||
prevButton = new QPushButton(this, "prevButton");
|
||||
prevButton = new QPushButton(this);
|
||||
prevButton->setEnabled(TRUE);
|
||||
layout3->addWidget(prevButton);
|
||||
clearPB = new QPushButton(this, "clearPB");
|
||||
clearPB = new QPushButton(this);
|
||||
clearPB->setEnabled(FALSE);
|
||||
layout3->addWidget(clearPB);
|
||||
matchCheck = new QCheckBox(this, "matchCheck");
|
||||
matchCheck = new QCheckBox(this);
|
||||
layout3->addWidget(matchCheck);
|
||||
|
||||
previewLayout->addLayout(layout3);
|
||||
@ -182,7 +178,8 @@ void Preview::init()
|
||||
pvTab->setCornerWidget(bt);
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.PREVIEW");
|
||||
HelpClient::installMap((const char *)objectName().toUtf8(),
|
||||
"RCL.SEARCH.PREVIEW");
|
||||
|
||||
// signals and slots connections
|
||||
connect(searchTextLine, SIGNAL(textChanged(const QString&)),
|
||||
@ -201,7 +198,7 @@ void Preview::init()
|
||||
resize(prefs.pvwidth, prefs.pvheight);
|
||||
}
|
||||
m_loading = false;
|
||||
currentChanged(pvTab->currentPage());
|
||||
currentChanged(pvTab->currentWidget());
|
||||
m_justCreated = true;
|
||||
m_haveAnchors = false;
|
||||
m_curAnchor = 1;
|
||||
@ -243,31 +240,31 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
|
||||
PreviewTextEdit *edit = currentEditor();
|
||||
QKeyEvent *keyEvent = (QKeyEvent *)event;
|
||||
if (keyEvent->key() == Qt::Key_Q &&
|
||||
(keyEvent->state() & Qt::ControlButton)) {
|
||||
(keyEvent->modifiers() & Qt::ControlModifier)) {
|
||||
recollNeedsExit = 1;
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_Escape) {
|
||||
close();
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_Down &&
|
||||
(keyEvent->state() & Qt::ShiftButton)) {
|
||||
(keyEvent->modifiers() & Qt::ShiftModifier)) {
|
||||
LOGDEB2(("Preview::eventFilter: got Shift-Up\n"));
|
||||
if (edit)
|
||||
emit(showNext(this, m_searchId, edit->m_data.docnum));
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_Up &&
|
||||
(keyEvent->state() & Qt::ShiftButton)) {
|
||||
(keyEvent->modifiers() & Qt::ShiftModifier)) {
|
||||
LOGDEB2(("Preview::eventFilter: got Shift-Down\n"));
|
||||
if (edit)
|
||||
emit(showPrev(this, m_searchId, edit->m_data.docnum));
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_W &&
|
||||
(keyEvent->state() & Qt::ControlButton)) {
|
||||
(keyEvent->modifiers() & Qt::ControlModifier)) {
|
||||
LOGDEB2(("Preview::eventFilter: got ^W\n"));
|
||||
closeCurrentTab();
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_P &&
|
||||
(keyEvent->state() & Qt::ControlButton)) {
|
||||
(keyEvent->modifiers() & Qt::ControlModifier)) {
|
||||
LOGDEB2(("Preview::eventFilter: got ^P\n"));
|
||||
emit(printCurrentPreviewRequest());
|
||||
return true;
|
||||
@ -293,7 +290,7 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
|
||||
value += edit->verticalScrollBar()->pageStep();
|
||||
edit->verticalScrollBar()->setValue(value);
|
||||
return true;
|
||||
} else if (keyEvent->key() == Qt::Key_BackSpace) {
|
||||
} else if (keyEvent->key() == Qt::Key_Backspace) {
|
||||
LOGDEB2(("Preview::eventFilter: got Backspace\n"));
|
||||
int value = edit->verticalScrollBar()->value();
|
||||
value -= edit->verticalScrollBar()->pageStep();
|
||||
@ -326,10 +323,10 @@ void Preview::searchTextLine_textChanged(const QString & text)
|
||||
PreviewTextEdit *Preview::currentEditor()
|
||||
{
|
||||
LOGDEB2(("Preview::currentEditor()\n"));
|
||||
QWidget *tw = pvTab->currentPage();
|
||||
QWidget *tw = pvTab->currentWidget();
|
||||
PreviewTextEdit *edit = 0;
|
||||
if (tw) {
|
||||
edit = dynamic_cast<PreviewTextEdit*>(tw->child("pvEdit"));
|
||||
edit = tw->findChild<PreviewTextEdit*>("pvEdit");
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
@ -342,7 +339,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
|
||||
bool wordOnly)
|
||||
{
|
||||
LOGDEB(("Preview::doSearch: text [%s] txtlen %d next %d rev %d word %d\n",
|
||||
(const char *)_text.utf8(), _text.length(), int(next),
|
||||
(const char *)_text.toUtf8(), _text.length(), int(next),
|
||||
int(reverse), int(wordOnly)));
|
||||
QString text = _text;
|
||||
|
||||
@ -372,7 +369,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
|
||||
LOGDEB(("m_curAnchor: %d\n", m_curAnchor));
|
||||
QString aname =
|
||||
QString::fromUtf8(edit->m_plaintorich->termAnchorName(m_curAnchor).c_str());
|
||||
LOGDEB(("Calling scrollToAnchor(%s)\n", (const char *)aname.utf8()));
|
||||
LOGDEB(("Calling scrollToAnchor(%s)\n", (const char *)aname.toUtf8()));
|
||||
edit->scrollToAnchor(aname);
|
||||
// Position the cursor approximately at the anchor (top of
|
||||
// viewport) so that searches start from here
|
||||
@ -445,7 +442,7 @@ void Preview::currentChanged(QWidget * tw)
|
||||
{
|
||||
LOGDEB2(("PreviewTextEdit::currentChanged\n"));
|
||||
PreviewTextEdit *edit =
|
||||
dynamic_cast<PreviewTextEdit*>(tw->child("pvEdit"));
|
||||
tw->findChild<PreviewTextEdit*>("pvEdit");
|
||||
m_currentW = tw;
|
||||
LOGDEB1(("Preview::currentChanged(). Editor: %p\n", edit));
|
||||
|
||||
@ -454,9 +451,6 @@ void Preview::currentChanged(QWidget * tw)
|
||||
return;
|
||||
}
|
||||
edit->setFocus();
|
||||
// Connect doubleclick but cleanup first just in case this was
|
||||
// already connected.
|
||||
disconnect(edit, SIGNAL(doubleClicked(int, int)), this, 0);
|
||||
// Disconnect the print signal and reconnect it to the current editor
|
||||
LOGDEB(("Disconnecting reconnecting print signal\n"));
|
||||
disconnect(this, SIGNAL(printCurrentPreviewRequest()), 0, 0);
|
||||
@ -475,10 +469,7 @@ void Preview::closeCurrentTab()
|
||||
return;
|
||||
}
|
||||
if (pvTab->count() > 1) {
|
||||
QWidget *tw = pvTab->currentPage();
|
||||
if (!tw)
|
||||
return;
|
||||
pvTab->removePage(tw);
|
||||
pvTab->removeTab(pvTab->currentIndex());
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
@ -488,13 +479,13 @@ PreviewTextEdit *Preview::addEditorTab()
|
||||
{
|
||||
LOGDEB1(("PreviewTextEdit::addEditorTab()\n"));
|
||||
QWidget *anon = new QWidget((QWidget *)pvTab);
|
||||
QVBoxLayout *anonLayout = new QVBoxLayout(anon, 1, 1, "anonLayout");
|
||||
QVBoxLayout *anonLayout = new QVBoxLayout(anon);
|
||||
PreviewTextEdit *editor = new PreviewTextEdit(anon, "pvEdit", this);
|
||||
editor->setReadOnly(TRUE);
|
||||
editor->setUndoRedoEnabled(FALSE );
|
||||
anonLayout->addWidget(editor);
|
||||
pvTab->addTab(anon, "Tab");
|
||||
pvTab->showPage(anon);
|
||||
pvTab->setCurrentIndex(pvTab->count() -1);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@ -513,8 +504,8 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
||||
if (title.length() > 20) {
|
||||
title = title.left(10) + "..." + title.right(10);
|
||||
}
|
||||
QWidget *w = pvTab->currentPage();
|
||||
pvTab->changeTab(w, title);
|
||||
int curidx = pvTab->currentIndex();
|
||||
pvTab->setTabText(curidx, title);
|
||||
|
||||
char datebuf[100];
|
||||
datebuf[0] = 0;
|
||||
@ -531,7 +522,8 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
||||
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
||||
if (meta_it != doc.meta.end() && !meta_it->second.empty())
|
||||
tiptxt += meta_it->second + "\n";
|
||||
pvTab->setTabToolTip(w,QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
|
||||
pvTab->setTabToolTip(curidx,
|
||||
QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
|
||||
|
||||
PreviewTextEdit *e = currentEditor();
|
||||
if (e) {
|
||||
@ -549,11 +541,11 @@ bool Preview::makeDocCurrent(const Rcl::Doc& doc, int docnum, bool sametab)
|
||||
for (int i = 0; i < pvTab->count(); i++) {
|
||||
QWidget *tw = pvTab->widget(i);
|
||||
if (tw) {
|
||||
PreviewTextEdit *edit =
|
||||
dynamic_cast<PreviewTextEdit*>(tw->child("pvEdit"));
|
||||
PreviewTextEdit *edit =
|
||||
tw->findChild<PreviewTextEdit*>("pvEdit");
|
||||
if (edit && !edit->m_data.url.compare(doc.url) &&
|
||||
!edit->m_data.ipath.compare(doc.ipath)) {
|
||||
pvTab->showPage(tw);
|
||||
pvTab->setCurrentIndex(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -790,8 +782,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
// while still inserting at bottom
|
||||
list<QString> qrichlst;
|
||||
PreviewTextEdit *editor = currentEditor();
|
||||
editor->setText("");
|
||||
editor->setTextFormat(Qt::RichText);
|
||||
editor->setHtml("");
|
||||
editor->m_data.format = Qt::RichText;
|
||||
bool inputishtml = !fdoc.mimetype.compare("text/html");
|
||||
|
||||
@ -865,7 +856,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
if (inputishtml) {
|
||||
qrichlst.push_back(qr);
|
||||
} else {
|
||||
editor->setTextFormat(Qt::PlainText);
|
||||
editor->setPlainText("");
|
||||
editor->m_data.format = Qt::PlainText;
|
||||
for (int pos = 0; pos < (int)qr.length(); pos += l) {
|
||||
l = MIN(CHUNKL, qr.length() - pos);
|
||||
@ -917,7 +908,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
if (m_haveAnchors) {
|
||||
QString aname =
|
||||
QString::fromUtf8(editor->m_plaintorich->termAnchorName(1).c_str());
|
||||
LOGDEB2(("Call movetoanchor(%s)\n", (const char *)aname.utf8()));
|
||||
LOGDEB2(("Call movetoanchor(%s)\n", (const char *)aname.toUtf8()));
|
||||
editor->scrollToAnchor(aname);
|
||||
// Position the cursor approximately at the anchor (top of
|
||||
// viewport) so that searches start from here
|
||||
@ -932,9 +923,6 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
if (udit != idoc.meta.end())
|
||||
historyEnterDoc(g_dynconf, udit->second);
|
||||
|
||||
// Switch format back to plaintext so that selections generate plain text
|
||||
editor->setTextFormat(Qt::PlainText);
|
||||
|
||||
editor->setFocus();
|
||||
emit(previewExposed(this, m_searchId, docnum));
|
||||
LOGDEB(("LoadFileInCurrentTab: returning true\n"));
|
||||
@ -961,15 +949,16 @@ void PreviewTextEdit::toggleFields()
|
||||
|
||||
// If currently displaying fields, switch to body text
|
||||
if (m_dspflds) {
|
||||
setTextFormat(m_data.format);
|
||||
setText(m_data.richtxt);
|
||||
if (m_data.format == Qt::PlainText)
|
||||
setPlainText(m_data.richtxt);
|
||||
else
|
||||
setHtml(m_data.richtxt);
|
||||
m_dspflds = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Else display fields
|
||||
m_dspflds = true;
|
||||
setTextFormat(Qt::RichText);
|
||||
QString txt = "<html><head></head><body>\n";
|
||||
txt += "<b>" + QString::fromLocal8Bit(m_data.url.c_str());
|
||||
if (!m_data.ipath.empty())
|
||||
@ -983,15 +972,15 @@ void PreviewTextEdit::toggleFields()
|
||||
+ "</dd>\n";
|
||||
}
|
||||
txt += "</dl></body></html>";
|
||||
setText(txt);
|
||||
setHtml(txt);
|
||||
}
|
||||
|
||||
void PreviewTextEdit::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
LOGDEB2(("PreviewTextEdit::mouseDoubleClickEvent\n"));
|
||||
QTextEdit::mouseDoubleClickEvent(event);
|
||||
if (hasSelectedText() && m_preview)
|
||||
m_preview->emitWordSelect(selectedText());
|
||||
if (textCursor().hasSelection() && m_preview)
|
||||
m_preview->emitWordSelect(textCursor().selectedText());
|
||||
}
|
||||
|
||||
void PreviewTextEdit::print()
|
||||
|
||||
@ -34,8 +34,8 @@ void HelpClient::installMap(string wname, string section)
|
||||
helpmap[wname] = section;
|
||||
}
|
||||
|
||||
HelpClient::HelpClient(QObject *parent, const char *name)
|
||||
: QObject(parent, name)
|
||||
HelpClient::HelpClient(QObject *parent, const char *)
|
||||
: QObject(parent)
|
||||
{
|
||||
parent->installEventFilter(this);
|
||||
}
|
||||
@ -52,7 +52,7 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
||||
QWidget *widget = static_cast<QWidget *>(obj)->focusWidget();
|
||||
map<string, string>::iterator it = helpmap.end();
|
||||
while (widget) {
|
||||
it = helpmap.find(widget->name());
|
||||
it = helpmap.find((const char *)widget->objectName().toUtf8());
|
||||
if (it != helpmap.end())
|
||||
break;
|
||||
widget = widget->parentWidget();
|
||||
|
||||
@ -35,7 +35,6 @@ using std::pair;
|
||||
#include <qmessagebox.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qshortcut.h>
|
||||
|
||||
#include <qtabwidget.h>
|
||||
#include <qtimer.h>
|
||||
#include <qstatusbar.h>
|
||||
@ -49,9 +48,10 @@ using std::pair;
|
||||
#include <qaction.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qimage.h>
|
||||
#include <qiconset.h>
|
||||
#include <qapplication.h>
|
||||
#include <qcursor.h>
|
||||
#include <qevent.h>
|
||||
|
||||
#include "recoll.h"
|
||||
#include "debuglog.h"
|
||||
#include "mimehandler.h"
|
||||
@ -104,7 +104,7 @@ void RclMain::init()
|
||||
(void)statusBar();
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.SIMPLE");
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(), "RCL.SEARCH.SIMPLE");
|
||||
|
||||
// Set the focus to the search terms entry:
|
||||
sSearch->queryText->setFocus();
|
||||
@ -118,9 +118,9 @@ void RclMain::init()
|
||||
// Stemming language menu
|
||||
g_stringNoStem = tr("(no stemming)");
|
||||
g_stringAllStem = tr("(all languages)");
|
||||
m_idNoStem = preferencesMenu->insertItem(g_stringNoStem);
|
||||
m_idNoStem = preferencesMenu->addAction(g_stringNoStem);
|
||||
m_stemLangToId[g_stringNoStem] = m_idNoStem;
|
||||
m_idAllStem = preferencesMenu->insertItem(g_stringAllStem);
|
||||
m_idAllStem = preferencesMenu->addAction(g_stringAllStem);
|
||||
m_stemLangToId[g_stringAllStem] = m_idAllStem;
|
||||
|
||||
// Can't get the stemming languages from the db at this stage as
|
||||
@ -135,18 +135,18 @@ void RclMain::init()
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("error retrieving stemming languages"));
|
||||
}
|
||||
int curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
|
||||
int id;
|
||||
QAction *curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
|
||||
QAction *id;
|
||||
for (list<string>::const_iterator it = langs.begin();
|
||||
it != langs.end(); it++) {
|
||||
QString qlang = QString::fromAscii(it->c_str(), it->length());
|
||||
id = preferencesMenu->insertItem(qlang);
|
||||
id = preferencesMenu->addAction(qlang);
|
||||
m_stemLangToId[qlang] = id;
|
||||
if (prefs.queryStemLang == qlang) {
|
||||
curid = id;
|
||||
}
|
||||
}
|
||||
preferencesMenu->setItemChecked(curid, true);
|
||||
curid->setChecked(true);
|
||||
|
||||
// A shortcut to get the focus back to the search entry.
|
||||
QKeySequence seq("Ctrl+Shift+s");
|
||||
@ -158,8 +158,9 @@ void RclMain::init()
|
||||
QComboBox *catgCMB = 0;
|
||||
if (prefs.catgToolBar) {
|
||||
QToolBar *catgToolBar = new QToolBar(this);
|
||||
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
|
||||
catgCMB->insertItem(tr("All"));
|
||||
catgCMB = new QComboBox(catgToolBar);
|
||||
catgCMB->setEditable(FALSE);
|
||||
catgCMB->addItem(tr("All"));
|
||||
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
|
||||
catgCMB->setToolTip(tr("Document category filter"));
|
||||
catgToolBar->addWidget(catgCMB);
|
||||
@ -185,9 +186,9 @@ void RclMain::init()
|
||||
QRadioButton *but = new QRadioButton(catgBGRP);
|
||||
QString catgnm = QString::fromUtf8(it->c_str(), it->length());
|
||||
m_catgbutvec.push_back(*it);
|
||||
but->setText(tr(catgnm));
|
||||
but->setText(tr(catgnm.toUtf8()));
|
||||
if (prefs.catgToolBar && catgCMB)
|
||||
catgCMB->insertItem(tr(catgnm));
|
||||
catgCMB->addItem(tr(catgnm.toUtf8()));
|
||||
bgrphbox->addWidget(but);
|
||||
bgrp->addButton(but, bgrpid++);
|
||||
}
|
||||
@ -200,8 +201,8 @@ void RclMain::init()
|
||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
||||
sSearch->queryText->installEventFilter(this);
|
||||
|
||||
connect(preferencesMenu, SIGNAL(activated(int)),
|
||||
this, SLOT(setStemLang(int)));
|
||||
connect(preferencesMenu, SIGNAL(triggered(QAction*)),
|
||||
this, SLOT(setStemLang(QAction*)));
|
||||
connect(preferencesMenu, SIGNAL(aboutToShow()),
|
||||
this, SLOT(adjustPrefsMenu()));
|
||||
// signals and slots connections
|
||||
@ -332,13 +333,13 @@ void RclMain::focusToSearch()
|
||||
sSearch->queryText->setFocus(Qt::ShortcutFocusReason);
|
||||
}
|
||||
|
||||
void RclMain::setStemLang(int id)
|
||||
void RclMain::setStemLang(QAction *id)
|
||||
{
|
||||
LOGDEB(("RclMain::setStemLang(%d)\n", id));
|
||||
// Check that the menu entry is for a stemming language change
|
||||
// (might also be "show prefs" etc.
|
||||
bool isLangId = false;
|
||||
for (map<QString, int>::const_iterator it = m_stemLangToId.begin();
|
||||
for (map<QString, QAction*>::const_iterator it = m_stemLangToId.begin();
|
||||
it != m_stemLangToId.end(); it++) {
|
||||
if (id == it->second)
|
||||
isLangId = true;
|
||||
@ -347,11 +348,11 @@ void RclMain::setStemLang(int id)
|
||||
return;
|
||||
|
||||
// Set the "checked" item state for lang entries
|
||||
for (map<QString, int>::const_iterator it = m_stemLangToId.begin();
|
||||
for (map<QString, QAction*>::const_iterator it = m_stemLangToId.begin();
|
||||
it != m_stemLangToId.end(); it++) {
|
||||
preferencesMenu->setItemChecked(it->second, false);
|
||||
(it->second)->setChecked(false);
|
||||
}
|
||||
preferencesMenu->setItemChecked(id, true);
|
||||
id->setChecked(true);
|
||||
|
||||
// Retrieve language value (also handle special cases), set prefs,
|
||||
// notify that we changed
|
||||
@ -361,11 +362,11 @@ void RclMain::setStemLang(int id)
|
||||
} else if (id == m_idAllStem) {
|
||||
lang = "ALL";
|
||||
} else {
|
||||
lang = preferencesMenu->text(id);
|
||||
lang = id->text();
|
||||
}
|
||||
prefs.queryStemLang = lang;
|
||||
LOGDEB(("RclMain::setStemLang(%d): lang [%s]\n",
|
||||
id, (const char *)prefs.queryStemLang.ascii()));
|
||||
id, (const char *)prefs.queryStemLang.toAscii()));
|
||||
rwSettings(true);
|
||||
emit stemLangChanged(lang);
|
||||
}
|
||||
@ -373,23 +374,23 @@ void RclMain::setStemLang(int id)
|
||||
// Set the checked stemming language item before showing the prefs menu
|
||||
void RclMain::setStemLang(const QString& lang)
|
||||
{
|
||||
LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.ascii()));
|
||||
int id;
|
||||
LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.toAscii()));
|
||||
QAction *id;
|
||||
if (lang == "") {
|
||||
id = m_idNoStem;
|
||||
} else if (lang == "ALL") {
|
||||
id = m_idAllStem;
|
||||
} else {
|
||||
map<QString, int>::iterator it = m_stemLangToId.find(lang);
|
||||
map<QString, QAction*>::iterator it = m_stemLangToId.find(lang);
|
||||
if (it == m_stemLangToId.end())
|
||||
return;
|
||||
id = it->second;
|
||||
}
|
||||
for (map<QString, int>::const_iterator it = m_stemLangToId.begin();
|
||||
for (map<QString, QAction*>::const_iterator it = m_stemLangToId.begin();
|
||||
it != m_stemLangToId.end(); it++) {
|
||||
preferencesMenu->setItemChecked(it->second, false);
|
||||
(it->second)->setChecked(false);
|
||||
}
|
||||
preferencesMenu->setItemChecked(id, true);
|
||||
id->setChecked(true);
|
||||
}
|
||||
|
||||
// Prefs menu about to show
|
||||
@ -422,7 +423,7 @@ void RclMain::fileExit()
|
||||
prefs.mainwidth = width();
|
||||
prefs.mainheight = height();
|
||||
}
|
||||
prefs.ssearchTyp = sSearch->searchTypCMB->currentItem();
|
||||
prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex();
|
||||
if (asearchform)
|
||||
delete asearchform;
|
||||
// We'd prefer to do this in the exit handler, but it's apparently to late
|
||||
@ -463,14 +464,14 @@ void RclMain::periodic100()
|
||||
// and check this / restart query in DocSeqDb() ?)
|
||||
string reason;
|
||||
maybeOpenDb(reason, 1);
|
||||
periodictimer->changeInterval(1000);
|
||||
periodictimer->setInterval(1000);
|
||||
}
|
||||
} else {
|
||||
// Indexing is running
|
||||
m_idxStatusAck = false;
|
||||
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
||||
fileToggleIndexingAction->setEnabled(TRUE);
|
||||
periodictimer->changeInterval(100);
|
||||
periodictimer->setInterval(100);
|
||||
// The toggle thing is for the status to flash
|
||||
if (toggle < 9) {
|
||||
QString msg = tr("Indexing in progress: ");
|
||||
@ -498,9 +499,9 @@ void RclMain::periodic100()
|
||||
mf = url_encode(status.fn, 0);
|
||||
}
|
||||
msg += QString::fromUtf8(mf.c_str());
|
||||
statusBar()->message(msg, 4000);
|
||||
statusBar()->showMessage(msg, 4000);
|
||||
} else if (toggle == 9) {
|
||||
statusBar()->message("");
|
||||
statusBar()->showMessage("");
|
||||
}
|
||||
if (++toggle >= 10)
|
||||
toggle = 0;
|
||||
@ -517,11 +518,11 @@ void RclMain::toggleIndexing()
|
||||
if (idxthread_getStatus() == IDXTS_NULL) {
|
||||
// Indexing was in progress, stop it
|
||||
stop_indexing();
|
||||
periodictimer->changeInterval(1000);
|
||||
periodictimer->setInterval(1000);
|
||||
fileToggleIndexingAction->setText(tr("Update &Index"));
|
||||
} else {
|
||||
start_indexing(false);
|
||||
periodictimer->changeInterval(100);
|
||||
periodictimer->setInterval(100);
|
||||
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
||||
}
|
||||
fileToggleIndexingAction->setEnabled(FALSE);
|
||||
@ -543,7 +544,7 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
|
||||
resList->resetList();
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
string stemLang = (const char *)prefs.queryStemLang.ascii();
|
||||
string stemLang = (const char *)prefs.queryStemLang.toAscii();
|
||||
if (stemLang == "ALL") {
|
||||
rclconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
}
|
||||
@ -561,7 +562,7 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
|
||||
curPreview = 0;
|
||||
DocSequenceDb *src =
|
||||
new DocSequenceDb(RefCntr<Rcl::Query>(query),
|
||||
string(tr("Query results").utf8()), sdata);
|
||||
string(tr("Query results").toUtf8()), sdata);
|
||||
src->setAbstractParams(prefs.queryBuildAbstract,
|
||||
prefs.queryReplaceAbstract);
|
||||
|
||||
@ -656,7 +657,7 @@ void RclMain::showExtIdxDialog()
|
||||
// Close and reopen, in hope that makes us visible...
|
||||
uiprefs->close();
|
||||
}
|
||||
uiprefs->tabWidget->setCurrentPage(2);
|
||||
uiprefs->tabWidget->setCurrentIndex(2);
|
||||
uiprefs->show();
|
||||
}
|
||||
|
||||
@ -711,7 +712,7 @@ void RclMain::startPreview(int docnum, int mod)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mod & Qt::ShiftButton) {
|
||||
if (mod & Qt::ShiftModifier) {
|
||||
// User wants new preview window
|
||||
curPreview = 0;
|
||||
}
|
||||
@ -736,7 +737,7 @@ void RclMain::startPreview(int docnum, int mod)
|
||||
this, SLOT(previewPrevInTab(Preview *, int, int)));
|
||||
connect(curPreview, SIGNAL(previewExposed(Preview *, int, int)),
|
||||
this, SLOT(previewExposed(Preview *, int, int)));
|
||||
curPreview->setCaption(resList->getDescription());
|
||||
curPreview->setWindowTitle(resList->getDescription());
|
||||
curPreview->show();
|
||||
}
|
||||
curPreview->makeDocCurrent(doc, docnum);
|
||||
@ -833,8 +834,8 @@ void RclMain::previewExposed(Preview *, int sid, int docnum)
|
||||
static const char* punct = " \t()<>\"'[]{}!^*.,:;\n\r";
|
||||
void RclMain::ssearchAddTerm(QString term)
|
||||
{
|
||||
LOGDEB(("RclMain::ssearchAddTerm: [%s]\n", (const char *)term.utf8()));
|
||||
string t = (const char *)term.utf8();
|
||||
LOGDEB(("RclMain::ssearchAddTerm: [%s]\n", (const char *)term.toUtf8()));
|
||||
string t = (const char *)term.toUtf8();
|
||||
string::size_type pos = t.find_last_not_of(punct);
|
||||
if (pos == string::npos)
|
||||
return;
|
||||
@ -861,11 +862,11 @@ void RclMain::saveDocToFile(int docnum)
|
||||
return;
|
||||
}
|
||||
QString s =
|
||||
QFileDialog::getSaveFileName(path_home().c_str(),
|
||||
"", this,
|
||||
tr("Save file dialog"),
|
||||
tr("Choose a file name to save under"));
|
||||
string tofile((const char *)s.local8Bit());
|
||||
QFileDialog::getSaveFileName(this, //parent
|
||||
tr("Save file"), // caption
|
||||
QString::fromLocal8Bit(path_home().c_str()) //dir
|
||||
);
|
||||
string tofile((const char *)s.toLocal8Bit());
|
||||
TempFile temp; // not used
|
||||
if (!FileInterner::idocToFile(temp, tofile, rclconfig, doc)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
@ -1107,7 +1108,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
transcode(ncmd, prcmd, fcharset, "UTF-8");
|
||||
QString msg = tr("Executing: [") +
|
||||
QString::fromUtf8(prcmd.c_str()) + "]";
|
||||
stb->message(msg, 5000);
|
||||
stb->showMessage(msg, 5000);
|
||||
}
|
||||
|
||||
if (!istempfile)
|
||||
@ -1182,14 +1183,14 @@ void RclMain::showDocHistory()
|
||||
// Construct a bogus SearchData structure
|
||||
RefCntr<Rcl::SearchData>searchdata =
|
||||
RefCntr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND));
|
||||
searchdata->setDescription((const char *)tr("History data").utf8());
|
||||
searchdata->setDescription((const char *)tr("History data").toUtf8());
|
||||
|
||||
|
||||
// If you change the title, also change it in eraseDocHistory()
|
||||
DocSequenceHistory *src =
|
||||
new DocSequenceHistory(rcldb, g_dynconf,
|
||||
string(tr("Document history").utf8()));
|
||||
src->setDescription((const char *)tr("History data").utf8());
|
||||
string(tr("Document history").toUtf8()));
|
||||
src->setDescription((const char *)tr("History data").toUtf8());
|
||||
resList->setDocSource(RefCntr<DocSequence>(src));
|
||||
}
|
||||
|
||||
@ -1269,7 +1270,8 @@ bool RclMain::eventFilter(QObject *, QEvent *event)
|
||||
// filtered by the search entry to mean "select all line". We prefer to
|
||||
// keep it for the action as it's easy to find another combination to
|
||||
// select all (ie: home, then shift-end)
|
||||
if (ke->key() == Qt::Key_Home && (ke->state() & Qt::ShiftButton)) {
|
||||
if (ke->key() == Qt::Key_Home &&
|
||||
(ke->modifiers() & Qt::ShiftModifier)) {
|
||||
// Shift-Home -> first page of results
|
||||
resList->resultPageFirst();
|
||||
return true;
|
||||
|
||||
@ -90,7 +90,7 @@ public slots:
|
||||
virtual void resetSearch();
|
||||
virtual void eraseDocHistory();
|
||||
// Callback for setting the stemming language through the prefs menu
|
||||
virtual void setStemLang(int id);
|
||||
virtual void setStemLang(QAction *id);
|
||||
// Prefs menu about to show, set the checked lang entry
|
||||
virtual void adjustPrefsMenu();
|
||||
virtual void catgFilter(int);
|
||||
@ -115,10 +115,10 @@ private:
|
||||
|
||||
vector<TempFile> m_tempfiles;
|
||||
vector<ExecCmd*> m_viewers;
|
||||
map<QString, int> m_stemLangToId;
|
||||
map<QString, QAction*> m_stemLangToId;
|
||||
vector<string> m_catgbutvec;
|
||||
int m_idNoStem;
|
||||
int m_idAllStem;
|
||||
QAction * m_idNoStem;
|
||||
QAction * m_idAllStem;
|
||||
bool m_idxStatusAck; // Did we act on last status?
|
||||
|
||||
virtual void init();
|
||||
|
||||
@ -86,5 +86,3 @@ TRANSLATIONS = \
|
||||
../qtgui/i18n/recoll_uk.ts \
|
||||
../qtgui/i18n/recoll_xx.ts \
|
||||
|
||||
|
||||
QT += qt3support
|
||||
|
||||
@ -20,6 +20,7 @@ static char rcsid[] = "@(#$Id: reslist.cpp,v 1.52 2008-12-17 15:12:08 dockes Exp
|
||||
#include <qimage.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qscrollbar.h>
|
||||
#include <QTextBlock>
|
||||
#ifndef __APPLE__
|
||||
#include <qx11info_x11.h>
|
||||
#endif
|
||||
@ -111,7 +112,7 @@ bool QtGuiResListPager::append(const string& data, int docnum,
|
||||
|
||||
string QtGuiResListPager::trans(const string& in)
|
||||
{
|
||||
return string((const char*)ResList::tr(in.c_str()).utf8());
|
||||
return string((const char*)ResList::tr(in.c_str()).toUtf8());
|
||||
}
|
||||
|
||||
string QtGuiResListPager::detailsLink()
|
||||
@ -188,7 +189,7 @@ public:
|
||||
virtual ~PlainToRichQtReslist() {}
|
||||
virtual string startMatch() {
|
||||
return string("<span style='color: ")
|
||||
+ string((const char *)prefs.qtermcolor.ascii()) + string("'>");
|
||||
+ string((const char *)prefs.qtermcolor.toAscii()) + string("'>");
|
||||
}
|
||||
virtual string endMatch() {return string("</span>");}
|
||||
};
|
||||
@ -197,10 +198,12 @@ static PlainToRichQtReslist g_hiliter;
|
||||
/////////////////////////////////////
|
||||
|
||||
ResList::ResList(QWidget* parent, const char* name)
|
||||
: QTextBrowser(parent, name)
|
||||
: QTextBrowser(parent)
|
||||
{
|
||||
if (!name)
|
||||
setName("resList");
|
||||
setObjectName("resList");
|
||||
else
|
||||
setObjectName(name);
|
||||
setReadOnly(TRUE);
|
||||
setUndoRedoEnabled(FALSE);
|
||||
setOpenLinks(FALSE);
|
||||
@ -209,7 +212,8 @@ ResList::ResList(QWidget* parent, const char* name)
|
||||
setTabChangesFocus(true);
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.RESLIST");
|
||||
HelpClient::installMap((const char *)this->objectName().toAscii(),
|
||||
"RCL.SEARCH.RESLIST");
|
||||
|
||||
// signals and slots connections
|
||||
connect(this, SIGNAL(anchorClicked(const QUrl &)),
|
||||
@ -282,7 +286,7 @@ void ResList::setDocSource()
|
||||
} else {
|
||||
if (m_filtspecs.isNotNull()) {
|
||||
string title = m_baseDocSource->title() + " (" +
|
||||
string((const char*)tr("filtered").utf8()) + ")";
|
||||
string((const char*)tr("filtered").toUtf8()) + ")";
|
||||
m_docSource =
|
||||
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,m_filtspecs,
|
||||
title));
|
||||
@ -291,7 +295,7 @@ void ResList::setDocSource()
|
||||
|
||||
if (m_sortspecs.isNotNull()) {
|
||||
string title = m_baseDocSource->title() + " (" +
|
||||
string((const char *)tr("sorted").utf8()) + ")";
|
||||
string((const char *)tr("sorted").toUtf8()) + ")";
|
||||
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
|
||||
m_sortspecs,
|
||||
title));
|
||||
@ -334,7 +338,7 @@ bool ResList::displayingHistory()
|
||||
{
|
||||
// We want to reset the displayed history if it is currently
|
||||
// shown. Using the title value is an ugly hack
|
||||
string htstring = string((const char *)tr("Document history").utf8());
|
||||
string htstring = string((const char *)tr("Document history").toUtf8());
|
||||
if (m_docSource.isNull() || m_docSource->title().empty())
|
||||
return false;
|
||||
return m_docSource->title().find(htstring) == 0;
|
||||
@ -342,7 +346,7 @@ bool ResList::displayingHistory()
|
||||
|
||||
void ResList::languageChange()
|
||||
{
|
||||
setCaption(tr("Result list"));
|
||||
setWindowTitle(tr("Result list"));
|
||||
}
|
||||
|
||||
bool ResList::getTerms(vector<string>& terms,
|
||||
@ -449,13 +453,13 @@ bool ResList::getDoc(int docnum, Rcl::Doc &doc)
|
||||
|
||||
void ResList::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
if (e->key() == Qt::Key_Q && (e->state() & Qt::ControlButton)) {
|
||||
if (e->key() == Qt::Key_Q && (e->modifiers() & Qt::ControlModifier)) {
|
||||
recollNeedsExit = 1;
|
||||
return;
|
||||
} else if (e->key() == Qt::Key_Prior || e->key() == Qt::Key_Backspace) {
|
||||
} else if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Backspace) {
|
||||
resPageUpOrBack();
|
||||
return;
|
||||
} else if (e->key() == Qt::Key_Next || e->key() == Qt::Key_Space) {
|
||||
} else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Space) {
|
||||
resPageDownOrNext();
|
||||
return;
|
||||
}
|
||||
@ -465,11 +469,11 @@ void ResList::keyPressEvent(QKeyEvent * e)
|
||||
void ResList::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
m_lstClckMod = 0;
|
||||
if (e->state() & Qt::ControlButton) {
|
||||
m_lstClckMod |= Qt::ControlButton;
|
||||
if (e->modifiers() & Qt::ControlModifier) {
|
||||
m_lstClckMod |= Qt::ControlModifier;
|
||||
}
|
||||
if (e->state() & Qt::ShiftButton) {
|
||||
m_lstClckMod |= Qt::ShiftButton;
|
||||
if (e->modifiers() & Qt::ShiftModifier) {
|
||||
m_lstClckMod |= Qt::ShiftModifier;
|
||||
}
|
||||
QTextBrowser::mouseReleaseEvent(e);
|
||||
}
|
||||
@ -495,7 +499,7 @@ void ResList::highlighted(const QString& )
|
||||
void ResList::resPageUpOrBack()
|
||||
{
|
||||
int vpos = verticalScrollBar()->value();
|
||||
moveCursor(QTextBrowser::MovePgUp, false);
|
||||
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
|
||||
if (vpos == verticalScrollBar()->value())
|
||||
resultPageBack();
|
||||
}
|
||||
@ -503,7 +507,7 @@ void ResList::resPageUpOrBack()
|
||||
void ResList::resPageDownOrNext()
|
||||
{
|
||||
int vpos = verticalScrollBar()->value();
|
||||
moveCursor(QTextBrowser::MovePgDown, false);
|
||||
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
|
||||
LOGDEB(("ResList::resPageDownOrNext: vpos before %d, after %d\n",
|
||||
vpos, verticalScrollBar()->value()));
|
||||
if (vpos == verticalScrollBar()->value())
|
||||
@ -530,7 +534,7 @@ void ResList::resultPageFirst()
|
||||
void ResList::append(const QString &text)
|
||||
{
|
||||
LOGDEB2(("QtGuiReslistPager::appendQString : %s\n",
|
||||
(const char*)text.utf8()));
|
||||
(const char*)text.toUtf8()));
|
||||
QTextBrowser::append(text);
|
||||
}
|
||||
|
||||
@ -605,16 +609,17 @@ void ResList::previewExposed(int docnum)
|
||||
void ResList::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QTextBrowser::mouseDoubleClickEvent(event);
|
||||
if (hasSelectedText())
|
||||
emit(wordSelect(selectedText()));
|
||||
if (textCursor().hasSelection())
|
||||
emit(wordSelect(textCursor().selectedText()));
|
||||
}
|
||||
|
||||
void ResList::linkWasClicked(const QUrl &url)
|
||||
{
|
||||
QString s = url.toString();
|
||||
LOGDEB(("ResList::linkWasClicked: [%s]\n", s.ascii()));
|
||||
int i = atoi(s.ascii()+1) -1;
|
||||
int what = s.ascii()[0];
|
||||
const char *ascurl = s.toAscii();
|
||||
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl));
|
||||
int i = atoi(ascurl+1) - 1;
|
||||
int what = ascurl[0];
|
||||
switch (what) {
|
||||
case 'H':
|
||||
emit headerClicked();
|
||||
|
||||
@ -9,6 +9,7 @@ using std::list;
|
||||
#endif
|
||||
|
||||
#include <qtextbrowser.h>
|
||||
#include <QTextCursor>
|
||||
|
||||
#include "docseq.h"
|
||||
#include "sortseq.h"
|
||||
@ -77,7 +78,7 @@ class ResList : public QTextBrowser
|
||||
virtual void setFilterParams(const DocSeqFiltSpec &spec);
|
||||
virtual void highlighted(const QString& link);
|
||||
virtual void createPopupMenu(const QPoint& pos);
|
||||
|
||||
|
||||
signals:
|
||||
void nextPageAvailable(bool);
|
||||
void prevPageAvailable(bool);
|
||||
|
||||
@ -36,14 +36,15 @@ static char rcsid[] = "@(#$Id: searchclause_w.cpp,v 1.4 2006-12-04 06:19:11 dock
|
||||
SearchClauseW::SearchClauseW(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this, 0, 3);
|
||||
sTpCMB = new QComboBox(FALSE, this, "sTpCMB");
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this);
|
||||
sTpCMB = new QComboBox(this);
|
||||
sTpCMB->setEditable(false);
|
||||
hLayout->addWidget(sTpCMB);
|
||||
|
||||
proxSlackSB = new QSpinBox(this, "proxSlackSB");
|
||||
proxSlackSB = new QSpinBox(this);
|
||||
hLayout->addWidget(proxSlackSB);
|
||||
|
||||
wordsLE = new QLineEdit(this, "wordsLE");
|
||||
wordsLE = new QLineEdit(this);
|
||||
wordsLE->setMinimumSize(QSize(250, 0));
|
||||
hLayout->addWidget(wordsLE);
|
||||
|
||||
@ -67,22 +68,21 @@ SearchClauseW::~SearchClauseW()
|
||||
*/
|
||||
void SearchClauseW::languageChange()
|
||||
{
|
||||
setCaption(tr("SearchClauseW"));
|
||||
sTpCMB->clear();
|
||||
sTpCMB->insertItem(tr("Any of these")); // 0
|
||||
sTpCMB->insertItem(tr("All of these")); //1
|
||||
sTpCMB->insertItem(tr("None of these"));//2
|
||||
sTpCMB->insertItem(tr("This phrase"));//3
|
||||
sTpCMB->insertItem(tr("Terms in proximity"));//4
|
||||
sTpCMB->insertItem(tr("File name matching"));//5
|
||||
sTpCMB->addItem(tr("Any of these")); // 0
|
||||
sTpCMB->addItem(tr("All of these")); //1
|
||||
sTpCMB->addItem(tr("None of these"));//2
|
||||
sTpCMB->addItem(tr("This phrase"));//3
|
||||
sTpCMB->addItem(tr("Terms in proximity"));//4
|
||||
sTpCMB->addItem(tr("File name matching"));//5
|
||||
// sTpCMB->insertItem(tr("Complex clause"));//6
|
||||
|
||||
// Ensure that the spinbox will be enabled/disabled depending on
|
||||
// combobox state
|
||||
tpChange(0);
|
||||
|
||||
QToolTip::add(sTpCMB, tr("Select the type of query that will be performed with the words"));
|
||||
QToolTip::add(proxSlackSB, tr("Number of additional words that may be interspersed with the chosen ones"));
|
||||
sTpCMB->setToolTip(tr("Select the type of query that will be performed with the words"));
|
||||
proxSlackSB->setToolTip(tr("Number of additional words that may be interspersed with the chosen ones"));
|
||||
}
|
||||
|
||||
using namespace Rcl;
|
||||
@ -93,26 +93,26 @@ SearchClauseW::getClause()
|
||||
{
|
||||
if (wordsLE->text().isEmpty())
|
||||
return 0;
|
||||
switch (sTpCMB->currentItem()) {
|
||||
switch (sTpCMB->currentIndex()) {
|
||||
case 0:
|
||||
return new SearchDataClauseSimple(SCLT_OR,
|
||||
(const char *)wordsLE->text().utf8());
|
||||
(const char *)wordsLE->text().toUtf8());
|
||||
case 1:
|
||||
return new SearchDataClauseSimple(SCLT_AND,
|
||||
(const char *)wordsLE->text().utf8());
|
||||
(const char *)wordsLE->text().toUtf8());
|
||||
case 2:
|
||||
return new SearchDataClauseSimple(SCLT_EXCL,
|
||||
(const char *)wordsLE->text().utf8());
|
||||
(const char *)wordsLE->text().toUtf8());
|
||||
case 3:
|
||||
return new SearchDataClauseDist(SCLT_PHRASE,
|
||||
(const char *)wordsLE->text().utf8(),
|
||||
(const char *)wordsLE->text().toUtf8(),
|
||||
proxSlackSB->value());
|
||||
case 4:
|
||||
return new SearchDataClauseDist(SCLT_NEAR,
|
||||
(const char *)wordsLE->text().utf8(),
|
||||
(const char *)wordsLE->text().toUtf8(),
|
||||
proxSlackSB->value());
|
||||
case 5:
|
||||
return new SearchDataClauseFilename((const char *)wordsLE->text().utf8());
|
||||
return new SearchDataClauseFilename((const char *)wordsLE->text().toUtf8());
|
||||
case 6:
|
||||
default:
|
||||
return 0;
|
||||
@ -124,8 +124,8 @@ void SearchClauseW::tpChange(int index)
|
||||
{
|
||||
if (index < 0 || index > 5)
|
||||
return;
|
||||
if (sTpCMB->currentItem() != index)
|
||||
sTpCMB->setCurrentItem(index);
|
||||
if (sTpCMB->currentIndex() != index)
|
||||
sTpCMB->setCurrentIndex(index);
|
||||
switch (index) {
|
||||
case 3:
|
||||
case 4:
|
||||
|
||||
@ -56,17 +56,18 @@ void SortForm::init()
|
||||
v = spec & (0xf & ~(1<<3));
|
||||
d = spec & (1 << 3);
|
||||
spec >>= 4;
|
||||
fldCMB1->setCurrentItem(v < 3 ? v : 0);
|
||||
fldCMB1->setCurrentIndex(v < 3 ? v : 0);
|
||||
descCB1->setChecked(d != 0 ? true : false);
|
||||
|
||||
v = spec & (0xf & ~(1<<3));
|
||||
d = spec & (1 << 3);
|
||||
spec >>= 4;
|
||||
fldCMB2->setCurrentItem(v < 3 ? v : 0);
|
||||
fldCMB2->setCurrentIndex(v < 3 ? v : 0);
|
||||
descCB2->setChecked(d !=0 ? true : false);
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.SORT");
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
||||
"RCL.SEARCH.SORT");
|
||||
|
||||
// signals and slots connections
|
||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(apply()));
|
||||
@ -106,7 +107,7 @@ void SortForm::setData()
|
||||
spec.sortdepth = 0;
|
||||
} else {
|
||||
bool desc = descCB1->isChecked();
|
||||
switch (fldCMB1->currentItem()) {
|
||||
switch (fldCMB1->currentIndex()) {
|
||||
case 1:
|
||||
spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false);
|
||||
break;
|
||||
@ -116,7 +117,7 @@ void SortForm::setData()
|
||||
}
|
||||
|
||||
desc = descCB2->isChecked();
|
||||
switch (fldCMB2->currentItem()) {
|
||||
switch (fldCMB2->currentIndex()) {
|
||||
case 1:
|
||||
spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false);
|
||||
break;
|
||||
@ -129,10 +130,10 @@ void SortForm::setData()
|
||||
// Save data to prefs;
|
||||
prefs.sortDepth = spec.sortdepth;
|
||||
unsigned int spec = 0, v, d;
|
||||
v = fldCMB1->currentItem() & 0x7;
|
||||
v = fldCMB1->currentIndex() & 0x7;
|
||||
d = descCB1->isChecked() ? 8 : 0;
|
||||
spec |= (d|v);
|
||||
v = fldCMB2->currentItem() & 0x7;
|
||||
v = fldCMB2->currentIndex() & 0x7;
|
||||
d = descCB2->isChecked() ? 8 : 0;
|
||||
spec |= (d|v) << 4;
|
||||
prefs.sortSpec = (int) spec;
|
||||
|
||||
@ -48,20 +48,20 @@ static char rcsid[] = "@(#$Id: spell_w.cpp,v 1.11 2007-02-19 16:28:05 dockes Exp
|
||||
void SpellW::init()
|
||||
{
|
||||
// Don't change the order, or fix the rest of the code...
|
||||
/*0*/expTypeCMB->insertItem(tr("Wildcards"));
|
||||
/*1*/expTypeCMB->insertItem(tr("Regexp"));
|
||||
/*2*/expTypeCMB->insertItem(tr("Stem expansion"));
|
||||
/*0*/expTypeCMB->addItem(tr("Wildcards"));
|
||||
/*1*/expTypeCMB->addItem(tr("Regexp"));
|
||||
/*2*/expTypeCMB->addItem(tr("Stem expansion"));
|
||||
#ifdef RCL_USE_ASPELL
|
||||
bool noaspell = false;
|
||||
rclconfig->getConfParam("noaspell", &noaspell);
|
||||
if (!noaspell)
|
||||
/*3*/expTypeCMB->insertItem(tr("Spelling/Phonetic"));
|
||||
/*3*/expTypeCMB->addItem(tr("Spelling/Phonetic"));
|
||||
#endif
|
||||
|
||||
int typ = prefs.termMatchType;
|
||||
if (typ < 0 || typ > expTypeCMB->count())
|
||||
typ = 0;
|
||||
expTypeCMB->setCurrentItem(typ);
|
||||
expTypeCMB->setCurrentIndex(typ);
|
||||
|
||||
// Stemming language combobox
|
||||
stemLangCMB->clear();
|
||||
@ -73,12 +73,13 @@ void SpellW::init()
|
||||
for (list<string>::const_iterator it = langs.begin();
|
||||
it != langs.end(); it++) {
|
||||
stemLangCMB->
|
||||
insertItem(QString::fromAscii(it->c_str(), it->length()));
|
||||
addItem(QString::fromAscii(it->c_str(), it->length()));
|
||||
}
|
||||
stemLangCMB->setEnabled(expTypeCMB->currentItem()==2);
|
||||
stemLangCMB->setEnabled(expTypeCMB->currentIndex()==2);
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.TERMEXPLORER");
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
||||
"RCL.SEARCH.TERMEXPLORER");
|
||||
|
||||
// signals and slots connections
|
||||
connect(baseWordLE, SIGNAL(textChanged(const QString&)),
|
||||
@ -116,25 +117,25 @@ void SpellW::doExpand()
|
||||
return;
|
||||
}
|
||||
|
||||
string expr = string((const char *)baseWordLE->text().utf8());
|
||||
string expr = string((const char *)baseWordLE->text().toUtf8());
|
||||
list<string> suggs;
|
||||
|
||||
prefs.termMatchType = expTypeCMB->currentItem();
|
||||
prefs.termMatchType = expTypeCMB->currentIndex();
|
||||
|
||||
Rcl::Db::MatchType mt = Rcl::Db::ET_WILD;
|
||||
switch(expTypeCMB->currentItem()) {
|
||||
switch(expTypeCMB->currentIndex()) {
|
||||
case 0: mt = Rcl::Db::ET_WILD; break;
|
||||
case 1:mt = Rcl::Db::ET_REGEXP; break;
|
||||
case 2:mt = Rcl::Db::ET_STEM; break;
|
||||
}
|
||||
|
||||
Rcl::TermMatchResult res;
|
||||
switch (expTypeCMB->currentItem()) {
|
||||
switch (expTypeCMB->currentIndex()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
string l_stemlang = stemLangCMB->currentText().ascii();
|
||||
string l_stemlang = (const char*)stemLangCMB->currentText().toAscii();
|
||||
|
||||
if (!rcldb->termMatch(mt, l_stemlang, expr, res, 200)) {
|
||||
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
|
||||
|
||||
@ -40,12 +40,12 @@ static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.26 2008-12-05 11:09:31 dockes E
|
||||
void SSearch::init()
|
||||
{
|
||||
// See enum above and keep in order !
|
||||
searchTypCMB->insertItem(tr("Any term"));
|
||||
searchTypCMB->insertItem(tr("All terms"));
|
||||
searchTypCMB->insertItem(tr("File name"));
|
||||
searchTypCMB->insertItem(tr("Query language"));
|
||||
searchTypCMB->addItem(tr("Any term"));
|
||||
searchTypCMB->addItem(tr("All terms"));
|
||||
searchTypCMB->addItem(tr("File name"));
|
||||
searchTypCMB->addItem(tr("Query language"));
|
||||
|
||||
queryText->insertStringList(prefs.ssearchHistory);
|
||||
queryText->addItems(prefs.ssearchHistory);
|
||||
queryText->setEditText("");
|
||||
connect(queryText->lineEdit(), SIGNAL(returnPressed()),
|
||||
this, SLOT(startSimpleSearch()));
|
||||
@ -77,14 +77,16 @@ void SSearch::searchTypeChanged(int typ)
|
||||
LOGDEB(("Search type now %d\n", typ));
|
||||
// Adjust context help
|
||||
if (typ == SST_LANG)
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.LANG");
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
||||
"RCL.SEARCH.LANG");
|
||||
else
|
||||
HelpClient::installMap(this->name(), "RCL.SEARCH.SIMPLE");
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
||||
"RCL.SEARCH.SIMPLE");
|
||||
|
||||
// Also fix tooltips
|
||||
switch (typ) {
|
||||
case SST_LANG:
|
||||
QToolTip::add(queryText,
|
||||
queryText->setToolTip(tr(
|
||||
"Enter query language expression. Cheat sheet:<br>\n"
|
||||
"<i>term1 term2</i> : 'term1' and 'term2' in any field.<br>\n"
|
||||
"<i>field:term1</i> : 'term1' in field 'field'.<br>\n"
|
||||
@ -97,16 +99,17 @@ void SSearch::searchTypeChanged(int typ)
|
||||
"<i>\"term1 term2\"</i> : phrase (must occur exactly). Possible modifiers:<br>\n"
|
||||
"<i>\"term1 term2\"p</i> : unordered proximity search with default distance.<br>\n"
|
||||
"Use <b>Show Query</b> link when in doubt about result and see manual (<F1>) for more detail.\n"
|
||||
);
|
||||
));
|
||||
break;
|
||||
case SST_FNM:
|
||||
QToolTip::add(queryText, "Enter file name wildcard expression.");
|
||||
queryText->setToolTip(tr("Enter file name wildcard expression."));
|
||||
break;
|
||||
case SST_ANY:
|
||||
case SST_ALL:
|
||||
default:
|
||||
QToolTip::add(queryText,
|
||||
"Enter search terms here. Type ESC SPC for completions of current term.");
|
||||
queryText->setToolTip(tr(
|
||||
"Enter search terms here. Type ESC SPC for completions of current term."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,20 +118,20 @@ void SSearch::startSimpleSearch()
|
||||
if (queryText->currentText().length() == 0)
|
||||
return;
|
||||
|
||||
string u8 = (const char *)queryText->currentText().utf8();
|
||||
string u8 = (const char *)queryText->currentText().toUtf8();
|
||||
LOGDEB(("SSearch::startSimpleSearch: [%s]\n", u8.c_str()));
|
||||
|
||||
trimstring(u8);
|
||||
if (u8.length() == 0)
|
||||
return;
|
||||
|
||||
SSearchType tp = (SSearchType)searchTypCMB->currentItem();
|
||||
SSearchType tp = (SSearchType)searchTypCMB->currentIndex();
|
||||
Rcl::SearchData *sdata = 0;
|
||||
|
||||
if (tp == SST_LANG) {
|
||||
string reason;
|
||||
if (prefs.autoSuffsEnable)
|
||||
sdata = wasaStringToRcl(u8, reason, (const char *)prefs.autoSuffs.utf8());
|
||||
sdata = wasaStringToRcl(u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
||||
else
|
||||
sdata = wasaStringToRcl(u8, reason);
|
||||
if (sdata == 0) {
|
||||
@ -180,42 +183,25 @@ void SSearch::startSimpleSearch()
|
||||
|
||||
// Search terms history
|
||||
|
||||
// Need to remove any previous occurence of the search entry from
|
||||
// the listbox list, The qt listbox doesn't do lru correctly (if
|
||||
// already in the list the new entry would remain at it's place,
|
||||
// not jump at the top as it should
|
||||
LOGDEB3(("Querytext list count %d\n", queryText->count()));
|
||||
// Have to save current text, this will change while we clean up the list
|
||||
// We want to have the new text at the top and any older identical
|
||||
// entry to be erased. There is no standard qt policy to do this ?
|
||||
// So do it by hand.
|
||||
QString txt = queryText->currentText();
|
||||
bool changed;
|
||||
do {
|
||||
changed = false;
|
||||
for (int index = 0; index < queryText->count(); index++) {
|
||||
LOGDEB3(("Querytext[%d] = [%s]\n", index,
|
||||
(const char *)(queryText->text(index).utf8())));
|
||||
if (queryText->text(index).length() == 0 ||
|
||||
QString::compare(queryText->text(index), txt) == 0) {
|
||||
LOGDEB3(("Querytext removing at %d [%s] [%s]\n", index,
|
||||
(const char *)(queryText->text(index).utf8()),
|
||||
(const char *)(txt.utf8())));
|
||||
queryText->removeItem(index);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (changed);
|
||||
int index = queryText->findText(txt);
|
||||
if (index > 0)
|
||||
queryText->removeItem(index);
|
||||
// The combobox is set for no insertion, insert here:
|
||||
queryText->insertItem(txt, 0);
|
||||
queryText->setCurrentItem(0);
|
||||
queryText->insertItem(0, txt);
|
||||
queryText->setCurrentIndex(0);
|
||||
|
||||
|
||||
// Save the current state of the listbox list to the prefs (will
|
||||
// go to disk)
|
||||
prefs.ssearchHistory.clear();
|
||||
for (int index = 0; index < queryText->count(); index++) {
|
||||
prefs.ssearchHistory.push_back(queryText->text(index));
|
||||
prefs.ssearchHistory.push_back(queryText->itemText(index));
|
||||
}
|
||||
|
||||
|
||||
RefCntr<Rcl::SearchData> rsdata(sdata);
|
||||
emit startSearch(rsdata);
|
||||
}
|
||||
@ -232,7 +218,7 @@ bool SSearch::hasSearchString()
|
||||
|
||||
void SSearch::setAnyTermMode()
|
||||
{
|
||||
searchTypCMB->setCurrentItem(SST_ANY);
|
||||
searchTypCMB->setCurrentIndex(SST_ANY);
|
||||
}
|
||||
|
||||
// Complete last word in input by querying db for all possible terms.
|
||||
@ -240,13 +226,13 @@ void SSearch::completion()
|
||||
{
|
||||
if (!rcldb)
|
||||
return;
|
||||
if (searchTypCMB->currentItem() == SST_FNM) {
|
||||
if (searchTypCMB->currentIndex() == SST_FNM) {
|
||||
// Filename: no completion
|
||||
QApplication::beep();
|
||||
return;
|
||||
}
|
||||
// Extract last word in text
|
||||
string txt = (const char *)queryText->currentText().utf8();
|
||||
string txt = (const char *)queryText->currentText().toUtf8();
|
||||
string::size_type cs = txt.find_last_of(" ");
|
||||
if (cs == string::npos)
|
||||
cs = 0;
|
||||
@ -262,7 +248,7 @@ void SSearch::completion()
|
||||
// Query database
|
||||
const int max = 100;
|
||||
Rcl::TermMatchResult tmres;
|
||||
string stemLang = (const char *)prefs.queryStemLang.ascii();
|
||||
string stemLang = (const char *)prefs.queryStemLang.toAscii();
|
||||
if (stemLang == "ALL") {
|
||||
rclconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
}
|
||||
@ -288,15 +274,15 @@ void SSearch::completion()
|
||||
it != tmres.entries.end(); it++) {
|
||||
lst.push_back(QString::fromUtf8(it->term.c_str()));
|
||||
}
|
||||
res = QInputDialog::getItem(tr("Completions"),
|
||||
tr("Select an item:"), lst, 0,
|
||||
FALSE, &ok, this);
|
||||
res = QInputDialog::getItem (this, tr("Completions"),
|
||||
tr("Select an item:"),
|
||||
lst, 0, false, &ok);
|
||||
}
|
||||
|
||||
// Insert result
|
||||
if (ok) {
|
||||
txt.erase(cs);
|
||||
txt.append(res.utf8());
|
||||
txt.append((const char *)res.toUtf8());
|
||||
queryText->setEditText(QString::fromUtf8(txt.c_str()));
|
||||
} else {
|
||||
return;
|
||||
|
||||
@ -122,8 +122,8 @@ void UIPrefsDialog::setFromPrefs()
|
||||
|
||||
// Stemming language combobox
|
||||
stemLangCMB->clear();
|
||||
stemLangCMB->insertItem(g_stringNoStem);
|
||||
stemLangCMB->insertItem(g_stringAllStem);
|
||||
stemLangCMB->addItem(g_stringNoStem);
|
||||
stemLangCMB->addItem(g_stringAllStem);
|
||||
list<string> langs;
|
||||
if (!getStemLangs(langs)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
@ -133,12 +133,13 @@ void UIPrefsDialog::setFromPrefs()
|
||||
for (list<string>::const_iterator it = langs.begin();
|
||||
it != langs.end(); it++) {
|
||||
stemLangCMB->
|
||||
insertItem(QString::fromAscii(it->c_str(), it->length()));
|
||||
if (cur == 0 && !strcmp(prefs.queryStemLang.ascii(), it->c_str())) {
|
||||
addItem(QString::fromAscii(it->c_str(), it->length()));
|
||||
if (cur == 0 && !strcmp((const char*)prefs.queryStemLang.toAscii(),
|
||||
it->c_str())) {
|
||||
cur = stemLangCMB->count();
|
||||
}
|
||||
}
|
||||
stemLangCMB->setCurrentItem(cur);
|
||||
stemLangCMB->setCurrentIndex(cur);
|
||||
|
||||
autoPhraseCB->setChecked(prefs.ssearchAutoPhrase);
|
||||
|
||||
@ -183,16 +184,16 @@ void UIPrefsDialog::accept()
|
||||
prefs.qtermcolor = qtermColorLE->text();
|
||||
prefs.reslistfontfamily = reslistFontFamily;
|
||||
prefs.reslistfontsize = reslistFontSize;
|
||||
prefs.reslistformat = rlfTE->text();
|
||||
if (prefs.reslistformat.stripWhiteSpace().isEmpty()) {
|
||||
prefs.reslistformat = rlfTE->toPlainText();
|
||||
if (prefs.reslistformat.trimmed().isEmpty()) {
|
||||
prefs.reslistformat = prefs.dfltResListFormat;
|
||||
rlfTE->setPlainText(prefs.reslistformat);
|
||||
}
|
||||
prefs.creslistformat = (const char*)prefs.reslistformat.utf8();
|
||||
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
||||
|
||||
if (stemLangCMB->currentItem() == 0) {
|
||||
if (stemLangCMB->currentIndex() == 0) {
|
||||
prefs.queryStemLang = "";
|
||||
} else if (stemLangCMB->currentItem() == 1) {
|
||||
} else if (stemLangCMB->currentIndex() == 1) {
|
||||
prefs.queryStemLang = "ALL";
|
||||
} else {
|
||||
prefs.queryStemLang = stemLangCMB->currentText();
|
||||
@ -220,10 +221,10 @@ void UIPrefsDialog::accept()
|
||||
for (int i = 0; i < idxLV->count(); i++) {
|
||||
QListWidgetItem *item = idxLV->item(i);
|
||||
if (item) {
|
||||
prefs.allExtraDbs.push_back((const char *)item->text().local8Bit());
|
||||
prefs.allExtraDbs.push_back((const char *)item->text().toLocal8Bit());
|
||||
if (item->checkState() == Qt::Checked) {
|
||||
prefs.activeExtraDbs.push_back((const char *)
|
||||
item->text().local8Bit());
|
||||
item->text().toLocal8Bit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,13 +251,13 @@ void UIPrefsDialog::setStemLang(const QString& lang)
|
||||
cur = 1;
|
||||
} else {
|
||||
for (int i = 1; i < stemLangCMB->count(); i++) {
|
||||
if (lang == stemLangCMB->text(i)) {
|
||||
if (lang == stemLangCMB->itemText(i)) {
|
||||
cur = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
stemLangCMB->setCurrentItem(cur);
|
||||
stemLangCMB->setCurrentIndex(cur);
|
||||
}
|
||||
|
||||
void UIPrefsDialog::showFontDialog()
|
||||
@ -366,7 +367,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
return;
|
||||
lastdir = input;
|
||||
|
||||
string dbdir = (const char *)input.local8Bit();
|
||||
string dbdir = (const char *)input.toLocal8Bit();
|
||||
LOGDEB(("ExtraDbDial: got: [%s]\n", dbdir.c_str()));
|
||||
path_catslash(dbdir);
|
||||
if (!Rcl::Db::testDbDir(dbdir)) {
|
||||
@ -396,11 +397,11 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
string nv = (const char *)input.local8Bit();
|
||||
string nv = (const char *)input.toLocal8Bit();
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
string ov = (const char *)item->text().local8Bit();
|
||||
string ov = (const char *)item->text().toLocal8Bit();
|
||||
if (!ov.compare(nv)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("The selected directory is already in the index list"));
|
||||
|
||||
@ -99,7 +99,7 @@ void ViewAction::editActions()
|
||||
QTableWidgetItem *item0 = actionsLV->item(row, 0);
|
||||
if (!item0->isSelected())
|
||||
continue;
|
||||
mtypes.push_back((const char *)item0->text().local8Bit());
|
||||
mtypes.push_back((const char *)item0->text().toLocal8Bit());
|
||||
QTableWidgetItem *item1 = actionsLV->item(row, 1);
|
||||
QString action = item1->text();
|
||||
if (action0.isEmpty()) {
|
||||
@ -122,13 +122,13 @@ void ViewAction::editActions()
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
QString newaction = QInputDialog::getText("Recoll", "Edit action:",
|
||||
QString newaction = QInputDialog::getText(this, "Recoll", "Edit action:",
|
||||
QLineEdit::Normal,
|
||||
action0, &ok, this);
|
||||
action0, &ok);
|
||||
if (!ok || newaction.isEmpty() )
|
||||
return;
|
||||
|
||||
string sact = (const char *)newaction.local8Bit();
|
||||
string sact = (const char *)newaction.toLocal8Bit();
|
||||
for (list<string>::const_iterator it = mtypes.begin();
|
||||
it != mtypes.end(); it++) {
|
||||
rclconfig->setMimeViewerDef(*it, sact);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user