replaced all q3 widgets except textbrowsers
This commit is contained in:
parent
e03b17fd95
commit
c5e40d8510
18
.hgignore
18
.hgignore
@ -58,30 +58,18 @@ src/lib/alldeps
|
||||
src/lib/librcl.a
|
||||
src/mk/localdefs
|
||||
src/mk/sysconf
|
||||
src/qt4gui/.moc/*
|
||||
src/qt4gui/.ui/*
|
||||
src/qt4gui/Makefile
|
||||
src/qt4gui/advsearch.ui
|
||||
src/qt4gui/images
|
||||
src/qt4gui/preview.ui
|
||||
src/qt4gui/qrc_recoll.cpp
|
||||
src/qt4gui/recoll
|
||||
src/qt4gui/recoll.app
|
||||
src/qt4gui/recoll.pro
|
||||
src/qt4gui/sort.ui
|
||||
src/qt4gui/ssearchb.ui
|
||||
src/qt4gui/uiprefs.ui
|
||||
src/qt4gui/viewaction.ui
|
||||
src/qtgui/.moc/*
|
||||
src/qtgui/.obj/*
|
||||
src/qtgui/.ui/*
|
||||
src/qtgui/Makefile
|
||||
src/qtgui/i18n/*.qm
|
||||
src/qtgui/qrc_recoll.cpp
|
||||
src/qtgui/recoll
|
||||
src/qtgui/recoll.pro
|
||||
src/query/alldeps
|
||||
src/query/recollq
|
||||
src/query/xadump
|
||||
src/recollinstall
|
||||
src/sampleconf/recoll.conf
|
||||
src/sampleconf/rclmon.sh
|
||||
src/sampleconf/recoll.conf
|
||||
website/usermanual/*
|
||||
|
||||
@ -740,8 +740,8 @@ bool RclConfig::getFieldConfParam(const string &name, const string &sk,
|
||||
|
||||
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
|
||||
{
|
||||
LOGDEB(("RclConfig::getMimeViewerDef: mtype %s apptag %s\n",
|
||||
mtype.c_str(), apptag.c_str()));
|
||||
LOGDEB2(("RclConfig::getMimeViewerDef: mtype [%s] apptag [%s]\n",
|
||||
mtype.c_str(), apptag.c_str()));
|
||||
string hs;
|
||||
if (mimeview == 0)
|
||||
return hs;
|
||||
|
||||
@ -64,12 +64,7 @@ PrefsPack prefs;
|
||||
void rwSettings(bool writing)
|
||||
{
|
||||
LOGDEB1(("rwSettings: write %d\n", int(writing)));
|
||||
#if QT_VERSION >= 0x040000
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
#else
|
||||
QSettings settings;
|
||||
settings.setPath("Recoll.org", "Recoll", QSettings::User);
|
||||
#endif
|
||||
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Num, 0);
|
||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Num, 0);
|
||||
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Num, 0);
|
||||
|
||||
@ -22,11 +22,6 @@ static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.57 2008-10-13 07:57:12 dockes E
|
||||
|
||||
#include <qevent.h>
|
||||
#include <qwidget.h>
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#define Q34EVOVERRIDE QEvent::AccelOverride
|
||||
#else
|
||||
#define Q34EVOVERRIDE QEvent::ShortcutOverride
|
||||
#endif
|
||||
|
||||
#include "recoll.h"
|
||||
#include "rclhelp.h"
|
||||
@ -48,7 +43,8 @@ HelpClient::HelpClient(QObject *parent, const char *name)
|
||||
bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
static time_t last_start;
|
||||
if (event->type() == QEvent::KeyPress || event->type() == Q34EVOVERRIDE) {
|
||||
if (event->type() == QEvent::KeyPress ||
|
||||
event->type() == QEvent::ShortcutOverride) {
|
||||
// LOGDEB(("HelpClient::eventFilter: %d\n", (int)event->type()));
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
|
||||
@ -78,4 +74,3 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>31</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="fileMenu">
|
||||
|
||||
@ -34,20 +34,7 @@ using std::pair;
|
||||
#include <qapplication.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qfiledialog.h>
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include <qcstring.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qaccel.h>
|
||||
#undef RCLQT4
|
||||
#define RCLQT3 1
|
||||
#else
|
||||
#undef RCLQT3
|
||||
#define RCLQT4 1
|
||||
#include <qshortcut.h>
|
||||
#endif
|
||||
|
||||
#include <qtabwidget.h>
|
||||
#include <qtimer.h>
|
||||
@ -92,18 +79,6 @@ using namespace confgui;
|
||||
extern "C" int XFlush(void *);
|
||||
QString g_stringAllStem, g_stringNoStem;
|
||||
|
||||
// Taken from qt designer. Don't know why it's needed.
|
||||
#if RCLQT3
|
||||
static QIconSet createIconSet(const QString &name)
|
||||
{
|
||||
QIconSet ic(QPixmap::fromMimeSource(name));
|
||||
QString iname = "d_" + name;
|
||||
ic.setPixmap(QPixmap::fromMimeSource(iname),
|
||||
QIconSet::Small, QIconSet::Disabled );
|
||||
return ic;
|
||||
}
|
||||
#endif
|
||||
|
||||
void RclMain::init()
|
||||
{
|
||||
// This is just to get the common catg strings into the message file
|
||||
@ -175,14 +150,8 @@ void RclMain::init()
|
||||
|
||||
// A shortcut to get the focus back to the search entry.
|
||||
QKeySequence seq("Ctrl+Shift+s");
|
||||
#if RCLQT4
|
||||
QShortcut *sc = new QShortcut(seq, this);
|
||||
connect(sc, SIGNAL (activated()), this, SLOT (focusToSearch()));
|
||||
#else
|
||||
QAccel *sc = new QAccel(this);
|
||||
sc->insertItem(seq);
|
||||
connect(sc, SIGNAL (activated(int)), this, SLOT (focusToSearch()));
|
||||
#endif
|
||||
|
||||
|
||||
// Toolbar+combobox version of the category selector
|
||||
@ -191,26 +160,20 @@ void RclMain::init()
|
||||
QToolBar *catgToolBar = new QToolBar(this);
|
||||
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
|
||||
catgCMB->insertItem(tr("All"));
|
||||
#if RCLQT4
|
||||
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
|
||||
catgCMB->setToolTip(tr("Document category filter"));
|
||||
catgToolBar->addWidget(catgCMB);
|
||||
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Document categories buttons
|
||||
#if RCLQT3
|
||||
catgBGRP->setColumnLayout(1, Qt::Vertical);
|
||||
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
||||
#else
|
||||
QHBoxLayout *bgrphbox = new QHBoxLayout(catgBGRP);
|
||||
QButtonGroup *bgrp = new QButtonGroup(catgBGRP);
|
||||
bgrphbox->addWidget(allRDB);
|
||||
int bgrpid = 0;
|
||||
bgrp->addButton(allRDB, bgrpid++);
|
||||
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
|
||||
#endif
|
||||
|
||||
allRDB->setChecked(true);
|
||||
list<string> cats;
|
||||
rclconfig->getMimeCategories(cats);
|
||||
@ -225,27 +188,17 @@ void RclMain::init()
|
||||
but->setText(tr(catgnm));
|
||||
if (prefs.catgToolBar && catgCMB)
|
||||
catgCMB->insertItem(tr(catgnm));
|
||||
#if RCLQT4
|
||||
bgrphbox->addWidget(but);
|
||||
bgrp->addButton(but, bgrpid++);
|
||||
#endif
|
||||
}
|
||||
#if RCLQT3
|
||||
catgBGRP->setButton(0);
|
||||
#else
|
||||
catgBGRP->setLayout(bgrphbox);
|
||||
#endif
|
||||
|
||||
if (prefs.catgToolBar)
|
||||
catgBGRP->hide();
|
||||
// Connections
|
||||
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
|
||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
||||
#if RCLQT4
|
||||
sSearch->queryText->installEventFilter(this);
|
||||
#else
|
||||
sSearch->queryText->lineEdit()->installEventFilter(this);
|
||||
#endif
|
||||
|
||||
connect(preferencesMenu, SIGNAL(activated(int)),
|
||||
this, SLOT(setStemLang(int)));
|
||||
@ -310,15 +263,6 @@ void RclMain::init()
|
||||
// speeded up during indexing
|
||||
periodictimer->start(1000);
|
||||
|
||||
#if RCLQT3
|
||||
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
||||
prevPageAction->setIconSet(createIconSet("prevpage.png"));
|
||||
firstPageAction->setIconSet(createIconSet("firstpage.png"));
|
||||
toolsSpellAction->setIconSet(QPixmap::fromMimeSource("spell.png"));
|
||||
toolsDoc_HistoryAction->setIconSet(QPixmap::fromMimeSource("history.png"));
|
||||
toolsAdvanced_SearchAction->setIconSet(QPixmap::fromMimeSource("asearch.png"));
|
||||
toolsSort_parametersAction->setIconSet(QPixmap::fromMimeSource("sortparms.png"));
|
||||
#else
|
||||
toolsSpellAction->setIcon(QIcon(":/images/spell.png"));
|
||||
nextPageAction->setIcon(QIcon(":/images/nextpage.png"));
|
||||
prevPageAction->setIcon(QIcon(":/images/prevpage.png"));
|
||||
@ -326,8 +270,6 @@ void RclMain::init()
|
||||
toolsDoc_HistoryAction->setIcon(QIcon(":/images/history.png"));
|
||||
toolsAdvanced_SearchAction->setIcon(QIcon(":/images/asearch.png"));
|
||||
toolsSort_parametersAction->setIcon(QIcon(":/images/sortparms.png"));
|
||||
#endif
|
||||
|
||||
|
||||
// If requested by prefs, restore sort state. The easiest way is to let
|
||||
// a SortForm do it for us.
|
||||
@ -350,11 +292,7 @@ void RclMain::initDbOpen()
|
||||
if (!maybeOpenDb(reason)) {
|
||||
nodb = true;
|
||||
switch (QMessageBox::
|
||||
#if (QT_VERSION >= 0x030200)
|
||||
question
|
||||
#else
|
||||
information
|
||||
#endif
|
||||
(this, "Recoll",
|
||||
qApp->translate("Main", "Could not open database in ") +
|
||||
QString::fromLocal8Bit(rclconfig->getDbDir().c_str()) +
|
||||
@ -391,11 +329,7 @@ void RclMain::initDbOpen()
|
||||
void RclMain::focusToSearch()
|
||||
{
|
||||
LOGDEB(("Giving focus to sSearch\n"));
|
||||
sSearch->queryText->setFocus(
|
||||
#if RCLQT4
|
||||
Qt::ShortcutFocusReason
|
||||
#endif
|
||||
);
|
||||
sSearch->queryText->setFocus(Qt::ShortcutFocusReason);
|
||||
}
|
||||
|
||||
void RclMain::setStemLang(int id)
|
||||
|
||||
@ -32,43 +32,25 @@
|
||||
#include "pathut.h"
|
||||
|
||||
class ExecCmd;
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#include "rclmain.h"
|
||||
#else
|
||||
#include "ui_rclmain.h"
|
||||
#endif
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
class DummyRclMainBase : public RclMainBase
|
||||
{
|
||||
public: DummyRclMainBase(QWidget* parent = 0) : RclMainBase(parent) {}
|
||||
};
|
||||
#define RCLMAINPARENT QWidget
|
||||
#else
|
||||
class DummyRclMainBase : public QMainWindow, public Ui::RclMainBase
|
||||
{
|
||||
public: DummyRclMainBase(QWidget *parent) :QMainWindow(parent){setupUi(this);}
|
||||
#define RCLMAINPARENT QMainWindow
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class Preview;
|
||||
|
||||
#include "ui_rclmain.h"
|
||||
|
||||
namespace confgui {
|
||||
class ConfIndexW;
|
||||
class ConfIndexW;
|
||||
}
|
||||
|
||||
using confgui::ConfIndexW;
|
||||
|
||||
class RclMain : public DummyRclMainBase
|
||||
class RclMain : public QMainWindow, public Ui::RclMainBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RclMain(RCLMAINPARENT * parent = 0)
|
||||
: DummyRclMainBase(parent)
|
||||
RclMain(QWidget * parent = 0)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
~RclMain() {}
|
||||
|
||||
@ -36,13 +36,8 @@ void SortForm::init()
|
||||
slabs += tr("Date");
|
||||
slabs += tr("Mime type");
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
fldCMB1->insertStringList(slabs);
|
||||
fldCMB2->insertStringList(slabs);
|
||||
#else
|
||||
fldCMB1->addItems(slabs);
|
||||
fldCMB2->addItems(slabs);
|
||||
#endif
|
||||
|
||||
// Initialize values from prefs:
|
||||
mcntSB->setValue(prefs.sortDepth);
|
||||
|
||||
@ -21,41 +21,23 @@
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
#include "sortseq.h"
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include "sort.h"
|
||||
#else
|
||||
#include "ui_sort.h"
|
||||
#endif
|
||||
|
||||
class QDialog;
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
class DummySortFormBase : public SortFormBase
|
||||
{
|
||||
public: DummySortFormBase(QWidget* parent = 0) : SortFormBase(parent) {}
|
||||
};
|
||||
#else
|
||||
class DummySortFormBase : public QDialog, public Ui::SortFormBase
|
||||
{
|
||||
public: DummySortFormBase(QWidget* parent):QDialog(parent){setupUi(this);}
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class SortForm : public DummySortFormBase
|
||||
class SortForm : public QDialog, public Ui::SortFormBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SortForm(QDialog* parent = 0)
|
||||
: DummySortFormBase(parent)
|
||||
SortForm(QWidget* parent = 0)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
~SortForm() {}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void apply();
|
||||
virtual void setData();
|
||||
|
||||
@ -31,12 +31,8 @@ static char rcsid[] = "@(#$Id: spell_w.cpp,v 1.11 2007-02-19 16:28:05 dockes Exp
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qcombobox.h>
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include <qlistview.h>
|
||||
#else
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
#endif
|
||||
|
||||
#include "debuglog.h"
|
||||
#include "recoll.h"
|
||||
@ -92,59 +88,25 @@ void SpellW::init()
|
||||
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(expTypeCMB, SIGNAL(activated(int)), this, SLOT(modeSet(int)));
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
connect(suggsLV,
|
||||
SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
|
||||
this, SLOT(textDoubleClicked()));
|
||||
// No initial sorting: user can choose to establish one
|
||||
suggsLV->setSorting(100, false);
|
||||
#else
|
||||
QStringList labels(tr("Term"));
|
||||
labels.push_back(tr("Doc. / Tot."));
|
||||
suggsLV->setHorizontalHeaderLabels(labels);
|
||||
suggsLV->setShowGrid(0);
|
||||
suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
||||
suggsLV->verticalHeader()->setDefaultSectionSize(20);
|
||||
connect(suggsLV,
|
||||
SIGNAL(cellDoubleClicked(int, int)),
|
||||
this, SLOT(textDoubleClicked(int, int)));
|
||||
#endif
|
||||
|
||||
suggsLV->setColumnWidth(0, 200);
|
||||
suggsLV->setColumnWidth(1, 150);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
// Subclass qlistviewitem for numeric sorting on column 1
|
||||
class MyListViewItem : public QListViewItem
|
||||
{
|
||||
public:
|
||||
MyListViewItem(QListView *listView, const QString& s1, const QString& s2)
|
||||
: QListViewItem(listView, s1, s2)
|
||||
{ }
|
||||
|
||||
int compare(QListViewItem * i, int col, bool) const {
|
||||
if (col == 0)
|
||||
return i->text(0).compare(text(0));
|
||||
if (col == 1)
|
||||
return i->text(1).toInt() - text(1).toInt();
|
||||
// ??
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
#else
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* Expand term according to current mode */
|
||||
void SpellW::doExpand()
|
||||
{
|
||||
// Can't clear qt4 table widget: resets column headers too
|
||||
#if (QT_VERSION < 0x040000)
|
||||
suggsLV->clear();
|
||||
#else
|
||||
suggsLV->setRowCount(0);
|
||||
#endif
|
||||
if (baseWordLE->text().isEmpty())
|
||||
return;
|
||||
|
||||
@ -209,43 +171,25 @@ void SpellW::doExpand()
|
||||
|
||||
|
||||
if (res.entries.empty()) {
|
||||
#if (QT_VERSION < 0x040000)
|
||||
new MyListViewItem(suggsLV, tr("No expansion found"), "");
|
||||
#else
|
||||
suggsLV->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
|
||||
#endif
|
||||
} else {
|
||||
#if (QT_VERSION < 0x040000)
|
||||
for (list<Rcl::TermMatchEntry>::reverse_iterator it =
|
||||
res.entries.rbegin();
|
||||
it != res.entries.rend(); it++) {
|
||||
#else
|
||||
int row = 0;
|
||||
for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
||||
it != res.entries.end(); it++) {
|
||||
#endif
|
||||
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
||||
char num[30];
|
||||
if (it->wcf)
|
||||
sprintf(num, "%d / %d", it->docs, it->wcf);
|
||||
else
|
||||
num[0] = 0;
|
||||
#if (QT_VERSION < 0x040000)
|
||||
new MyListViewItem(suggsLV,
|
||||
QString::fromUtf8(it->term.c_str()),
|
||||
QString::fromAscii(num));
|
||||
#else
|
||||
if (suggsLV->rowCount() <= row)
|
||||
suggsLV->setRowCount(row+1);
|
||||
suggsLV->setItem(row, 0,
|
||||
new QTableWidgetItem(QString::fromUtf8(it->term.c_str())));
|
||||
suggsLV->setItem(row++, 1,
|
||||
new QTableWidgetItem(QString::fromAscii(num)));
|
||||
#endif
|
||||
}
|
||||
#if (QT_VERSION >= 0x040000)
|
||||
suggsLV->setRowCount(row+1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,40 +197,18 @@ void SpellW::wordChanged(const QString &text)
|
||||
{
|
||||
if (text.isEmpty()) {
|
||||
expandPB->setEnabled(false);
|
||||
#if (QT_VERSION < 0x040000)
|
||||
suggsLV->clear();
|
||||
#else
|
||||
suggsLV->setRowCount(0);
|
||||
#endif
|
||||
} else {
|
||||
expandPB->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
void SpellW::textDoubleClicked(int, int){}
|
||||
void SpellW::textDoubleClicked()
|
||||
#else
|
||||
void SpellW::textDoubleClicked() {}
|
||||
void SpellW::textDoubleClicked(int row, int)
|
||||
#endif
|
||||
{
|
||||
#if (QT_VERSION < 0x040000)
|
||||
QListViewItemIterator it(suggsLV);
|
||||
while (it.current()) {
|
||||
QListViewItem *item = it.current();
|
||||
if (!item->isSelected()) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
emit(wordSelect((const char *)item->text(0)));
|
||||
++it;
|
||||
}
|
||||
#else
|
||||
QTableWidgetItem *item = suggsLV->item(row, 0);
|
||||
if (item)
|
||||
emit(wordSelect(item->text()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpellW::modeSet(int mode)
|
||||
|
||||
@ -21,30 +21,16 @@
|
||||
#include <qvariant.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
#include "spell.h"
|
||||
class DummySpellBase : public SpellBase
|
||||
{
|
||||
public: DummySpellBase(QWidget* parent = 0) : SpellBase(parent) {}
|
||||
};
|
||||
#else
|
||||
#include "ui_spell.h"
|
||||
class DummySpellBase : public QWidget, public Ui::SpellBase
|
||||
{
|
||||
public: DummySpellBase(QWidget* parent):QWidget(parent){setupUi(this);}
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class SpellW : public DummySpellBase
|
||||
class SpellW : public QWidget, public Ui::SpellBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpellW(QWidget* parent = 0)
|
||||
: DummySpellBase(parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@ -56,11 +56,7 @@ void SSearch::init()
|
||||
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
|
||||
connect(searchTypCMB, SIGNAL(activated(int)), this, SLOT(searchTypeChanged(int)));
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
queryText->installEventFilter(this);
|
||||
#else
|
||||
queryText->lineEdit()->installEventFilter(this);
|
||||
#endif
|
||||
m_escape = false;
|
||||
}
|
||||
|
||||
@ -309,90 +305,6 @@ void SSearch::completion()
|
||||
|
||||
#undef SHOWEVENTS
|
||||
#if defined(SHOWEVENTS)
|
||||
#if QT_VERSION < 0x040000
|
||||
static const char *eventTypeToStr(int tp)
|
||||
{
|
||||
switch (tp) {
|
||||
case 0: return "None";
|
||||
case 1: return "Timer";
|
||||
case 2: return "MouseButtonPress";
|
||||
case 3: return "MouseButtonRelease";
|
||||
case 4: return "MouseButtonDblClick";
|
||||
case 5: return "MouseMove";
|
||||
case 6: return "KeyPress";
|
||||
case 7: return "KeyRelease";
|
||||
case 8: return "FocusIn";
|
||||
case 9: return "FocusOut";
|
||||
case 10: return "Enter";
|
||||
case 11: return "Leave";
|
||||
case 12: return "Paint";
|
||||
case 13: return "Move";
|
||||
case 14: return "Resize";
|
||||
case 15: return "Create";
|
||||
case 16: return "Destroy";
|
||||
case 17: return "Show";
|
||||
case 18: return "Hide";
|
||||
case 19: return "Close";
|
||||
case 20: return "Quit";
|
||||
case 21: return "Reparent";
|
||||
case 22: return "ShowMinimized";
|
||||
case 23: return "ShowNormal";
|
||||
case 24: return "WindowActivate";
|
||||
case 25: return "WindowDeactivate";
|
||||
case 26: return "ShowToParent";
|
||||
case 27: return "HideToParent";
|
||||
case 28: return "ShowMaximized";
|
||||
case 29: return "ShowFullScreen";
|
||||
case 30: return "Accel";
|
||||
case 31: return "Wheel";
|
||||
case 32: return "AccelAvailable";
|
||||
case 33: return "CaptionChange";
|
||||
case 34: return "IconChange";
|
||||
case 35: return "ParentFontChange";
|
||||
case 36: return "ApplicationFontChange";
|
||||
case 37: return "ParentPaletteChange";
|
||||
case 38: return "ApplicationPaletteChange";
|
||||
case 39: return "PaletteChange";
|
||||
case 40: return "Clipboard";
|
||||
case 42: return "Speech";
|
||||
case 50: return "SockAct";
|
||||
case 51: return "AccelOverride";
|
||||
case 52: return "DeferredDelete";
|
||||
case 60: return "DragEnter";
|
||||
case 61: return "DragMove";
|
||||
case 62: return "DragLeave";
|
||||
case 63: return "Drop";
|
||||
case 64: return "DragResponse";
|
||||
case 70: return "ChildInserted";
|
||||
case 71: return "ChildRemoved";
|
||||
case 72: return "LayoutHint";
|
||||
case 73: return "ShowWindowRequest";
|
||||
case 74: return "WindowBlocked";
|
||||
case 75: return "WindowUnblocked";
|
||||
case 80: return "ActivateControl";
|
||||
case 81: return "DeactivateControl";
|
||||
case 82: return "ContextMenu";
|
||||
case 83: return "IMStart";
|
||||
case 84: return "IMCompose";
|
||||
case 85: return "IMEnd";
|
||||
case 86: return "Accessibility";
|
||||
case 87: return "TabletMove";
|
||||
case 88: return "LocaleChange";
|
||||
case 89: return "LanguageChange";
|
||||
case 90: return "LayoutDirectionChange";
|
||||
case 91: return "Style";
|
||||
case 92: return "TabletPress";
|
||||
case 93: return "TabletRelease";
|
||||
case 94: return "OkRequest";
|
||||
case 95: return "HelpRequest";
|
||||
case 96: return "WindowStateChange";
|
||||
case 97: return "IconDrag";
|
||||
case 1000: return "User";
|
||||
case 65535: return "MaxUser";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
#else
|
||||
static const char *eventTypeToStr(int tp)
|
||||
{
|
||||
switch (tp) {
|
||||
@ -531,7 +443,6 @@ static const char *eventTypeToStr(int tp)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool SSearch::eventFilter(QObject *, QEvent *event)
|
||||
{
|
||||
|
||||
@ -23,27 +23,10 @@
|
||||
#include "recoll.h"
|
||||
#include "searchdata.h"
|
||||
#include "refcntr.h"
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include "ssearchb.h"
|
||||
#else
|
||||
|
||||
#include "ui_ssearchb.h"
|
||||
#endif
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
class DummySSearchBase : public SSearchBase
|
||||
{
|
||||
public: DummySSearchBase(QWidget* parent = 0) : SSearchBase(parent) {}
|
||||
};
|
||||
#else
|
||||
class DummySSearchBase : public QWidget, public Ui::SSearchBase
|
||||
{
|
||||
public: DummySSearchBase(QWidget* parent) : QWidget(parent) {setupUi(this);}
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class SSearch : public DummySSearchBase
|
||||
class SSearch : public QWidget, public Ui::SSearchBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -51,8 +34,9 @@ public:
|
||||
enum SSearchType {SST_ANY = 0, SST_ALL = 1, SST_FNM = 2, SST_LANG = 3};
|
||||
|
||||
SSearch(QWidget* parent = 0, const char * = 0)
|
||||
: DummySSearchBase(parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
~SSearch(){}
|
||||
|
||||
@ -1,109 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0" stdsetdef="1">
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>SSearchBase</class>
|
||||
<widget class="QWidget" name="SSearchBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>593</width>
|
||||
<height>48</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SSearchBase</string>
|
||||
</property>
|
||||
<ui version="4.0">
|
||||
<class>SSearchBase</class>
|
||||
<widget class="QWidget" name="SSearchBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>593</width>
|
||||
<height>48</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SSearchBase</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearqPB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Erase search entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="searchPB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Start query</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="searchTypCMB">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Choose search type.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="queryText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>8</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>155</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Enter search terms here. Type ESC SPC for completions of current term.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearqPB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Erase search entry</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="searchPB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start query</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="searchTypCMB">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Choose search type.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="queryText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>8</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>155</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter search terms here. Type ESC SPC for completions of current term.</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="0"/>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="0"/>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
1350
src/qtgui/uiprefs.ui
1350
src/qtgui/uiprefs.ui
File diff suppressed because it is too large
Load Diff
@ -31,29 +31,19 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.26 2008-10-03 08:09:36 dockes E
|
||||
#include <qvariant.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qtabwidget.h>
|
||||
#include <qlistwidget.h>
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qlistbox.h>
|
||||
#include <qlistview.h>
|
||||
#include <qfiledialog.h>
|
||||
#else
|
||||
#include <q3listbox.h>
|
||||
#include <q3listview.h>
|
||||
#include <q3filedialog.h>
|
||||
#define QListView Q3ListView
|
||||
#define QCheckListItem Q3CheckListItem
|
||||
#define QFileDialog Q3FileDialog
|
||||
#define QListViewItemIterator Q3ListViewItemIterator
|
||||
#endif
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qlist.h>
|
||||
|
||||
#include "recoll.h"
|
||||
#include "guiutils.h"
|
||||
@ -128,7 +118,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
reslistFontPB->setText(reslistFontFamily + "-" +
|
||||
s.setNum(reslistFontSize));
|
||||
}
|
||||
rlfTE->setText(prefs.reslistformat);
|
||||
rlfTE->setPlainText(prefs.reslistformat);
|
||||
|
||||
// Stemming language combobox
|
||||
stemLangCMB->clear();
|
||||
@ -163,19 +153,23 @@ void UIPrefsDialog::setFromPrefs()
|
||||
idxLV->clear();
|
||||
for (list<string>::iterator it = prefs.allExtraDbs.begin();
|
||||
it != prefs.allExtraDbs.end(); it++) {
|
||||
QCheckListItem *item =
|
||||
new QCheckListItem(idxLV, QString::fromLocal8Bit(it->c_str()),
|
||||
QCheckListItem::CheckBox);
|
||||
if (item) item->setOn(false);
|
||||
QListWidgetItem *item =
|
||||
new QListWidgetItem(QString::fromLocal8Bit(it->c_str()),
|
||||
idxLV);
|
||||
if (item)
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
for (list<string>::iterator it = prefs.activeExtraDbs.begin();
|
||||
it != prefs.activeExtraDbs.end(); it++) {
|
||||
QCheckListItem *item;
|
||||
if ((item = (QCheckListItem *)
|
||||
idxLV->findItem (QString::fromLocal8Bit(it->c_str()), 0))) {
|
||||
item->setOn(true);
|
||||
QList<QListWidgetItem *>items =
|
||||
idxLV->findItems (QString::fromLocal8Bit(it->c_str()),
|
||||
Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
for (QList<QListWidgetItem *>::iterator it = items.begin();
|
||||
it != items.end(); it++) {
|
||||
(*it)->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
idxLV->sortItems();
|
||||
}
|
||||
|
||||
void UIPrefsDialog::accept()
|
||||
@ -195,11 +189,11 @@ void UIPrefsDialog::accept()
|
||||
if (prefs.reslistformat ==
|
||||
QString::fromAscii(prefs.getV18DfltResListFormat())) {
|
||||
prefs.reslistformat += " ";
|
||||
rlfTE->setText(prefs.reslistformat);
|
||||
rlfTE->setPlainText(prefs.reslistformat);
|
||||
}
|
||||
if (prefs.reslistformat.stripWhiteSpace().isEmpty()) {
|
||||
prefs.reslistformat = prefs.getDfltResListFormat();
|
||||
rlfTE->setText(prefs.reslistformat);
|
||||
rlfTE->setPlainText(prefs.reslistformat);
|
||||
}
|
||||
prefs.creslistformat = (const char*)prefs.reslistformat.utf8();
|
||||
|
||||
@ -228,17 +222,17 @@ void UIPrefsDialog::accept()
|
||||
prefs.autoSuffsEnable = autoSuffsCB->isChecked();
|
||||
prefs.autoSuffs = autoSuffsLE->text();
|
||||
|
||||
QListViewItemIterator it(idxLV);
|
||||
prefs.allExtraDbs.clear();
|
||||
prefs.activeExtraDbs.clear();
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
prefs.allExtraDbs.push_back((const char *)item->text().local8Bit());
|
||||
if (item->isOn()) {
|
||||
prefs.activeExtraDbs.push_back((const char *)
|
||||
item->text().local8Bit());
|
||||
for (int i = 0; i < idxLV->count(); i++) {
|
||||
QListWidgetItem *item = idxLV->item(i);
|
||||
if (item) {
|
||||
prefs.allExtraDbs.push_back((const char *)item->text().local8Bit());
|
||||
if (item->checkState() == Qt::Checked) {
|
||||
prefs.activeExtraDbs.push_back((const char *)
|
||||
item->text().local8Bit());
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
rwSettings(true);
|
||||
@ -325,52 +319,42 @@ void UIPrefsDialog::showViewAction(const QString& mt)
|
||||
|
||||
////////////////////////////////////////////
|
||||
// External / extra search indexes setup
|
||||
// TBD: a way to remove entry from 'all' list (del button?)
|
||||
|
||||
void UIPrefsDialog::togExtraDbPB_clicked()
|
||||
{
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
for (int i = 0; i < idxLV->count(); i++) {
|
||||
QListWidgetItem *item = idxLV->item(i);
|
||||
if (item->isSelected()) {
|
||||
item->setOn(!item->isOn());
|
||||
if (item->checkState() == Qt::Checked) {
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
} else {
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
void UIPrefsDialog::actAllExtraDbPB_clicked()
|
||||
{
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
item->setOn(true);
|
||||
++it;
|
||||
for (int i = 0; i < idxLV->count(); i++) {
|
||||
QListWidgetItem *item = idxLV->item(i);
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
void UIPrefsDialog::unacAllExtraDbPB_clicked()
|
||||
{
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
item->setOn(false);
|
||||
++it;
|
||||
for (int i = 0; i < idxLV->count(); i++) {
|
||||
QListWidgetItem *item = idxLV->item(i);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
void UIPrefsDialog::delExtraDbPB_clicked()
|
||||
{
|
||||
list<QCheckListItem*> dlt;
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
||||
if (item->isSelected()) {
|
||||
dlt.push_back(item);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
for (list<QCheckListItem*>::iterator it = dlt.begin();
|
||||
it != dlt.end(); it++)
|
||||
QList<QListWidgetItem *> items = idxLV->selectedItems();
|
||||
for (QList<QListWidgetItem *>::iterator it = items.begin();
|
||||
it != items.end(); it++) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,14 +364,14 @@ void UIPrefsDialog::delExtraDbPB_clicked()
|
||||
*/
|
||||
void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
{
|
||||
QFileDialog fdia;
|
||||
bool savedh = fdia.showHiddenFiles();
|
||||
fdia.setShowHiddenFiles(true);
|
||||
QString input = QFileDialog::getExistingDirectory("", this, 0,
|
||||
tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"));
|
||||
fdia.setShowHiddenFiles(savedh);
|
||||
static QString lastdir;
|
||||
|
||||
QString input = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"),
|
||||
lastdir);
|
||||
if (input.isEmpty())
|
||||
return;
|
||||
lastdir = input;
|
||||
|
||||
string dbdir = (const char *)input.local8Bit();
|
||||
LOGDEB(("ExtraDbDial: got: [%s]\n", dbdir.c_str()));
|
||||
@ -411,7 +395,14 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
|
||||
// For some reason, finditem (which we used to use to detect duplicates
|
||||
// here) does not work anymore here: qt 4.6.3
|
||||
#if 1
|
||||
QList<QListWidgetItem *>items =
|
||||
idxLV->findItems (input, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (!items.empty()) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("The selected directory is already in the index list"));
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
string nv = (const char *)input.local8Bit();
|
||||
QListViewItemIterator it(idxLV);
|
||||
while (it.current()) {
|
||||
@ -424,20 +415,8 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
}
|
||||
++it;
|
||||
}
|
||||
#else // if findItem worked...
|
||||
if (idxLV->findItem(input,
|
||||
#if QT_VERSION < 0x040000
|
||||
Qt::CaseSensitive|Qt::ExactMatch
|
||||
#else
|
||||
Q3ListView::CaseSensitive|Q3ListView::ExactMatch
|
||||
#endif
|
||||
)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("The selected directory is already in the index list"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
new QCheckListItem(idxLV, input, QCheckListItem::CheckBox);
|
||||
idxLV->sort();
|
||||
QListWidgetItem *item = new QListWidgetItem(input, idxLV);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
idxLV->sortItems();
|
||||
}
|
||||
|
||||
@ -21,39 +21,20 @@
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include "uiprefs.h"
|
||||
#else
|
||||
#include "ui_uiprefs.h"
|
||||
#endif
|
||||
|
||||
class QDialog;
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
class DummyUIPrefsDialogBase : public UIPrefsDialogBase
|
||||
{
|
||||
public: DummyUIPrefsDialogBase(QWidget* parent = 0)
|
||||
: UIPrefsDialogBase(parent) {}
|
||||
};
|
||||
#else
|
||||
class DummyUIPrefsDialogBase : public QDialog, public Ui::UIPrefsDialogBase
|
||||
{
|
||||
public: DummyUIPrefsDialogBase(QDialog *parent):QDialog(parent) {setupUi(this);}
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class ViewAction;
|
||||
|
||||
class UIPrefsDialog : public DummyUIPrefsDialogBase
|
||||
class UIPrefsDialog : public QDialog, public Ui::uiPrefsDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UIPrefsDialog(QDialog* parent = 0)
|
||||
: DummyUIPrefsDialogBase(parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
~UIPrefsDialog(){};
|
||||
|
||||
@ -1,100 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0" stdsetdef="1">
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>ViewActionBase</class>
|
||||
<widget class="QDialog" name="ViewActionBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>132</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Native Viewers</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Select one or several mime types then click "Change Action"<br>You can also close this dialog and check "Use desktop preferences"<br>in the main panel to ignore this list and use your desktop defaults.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Q3ListView" name="actionsLV">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>Q3ListView::Extended</enum>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="showSortIndicator">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Select one or several file types, then click Change Action to modify the program used to open them</string>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>File type</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Action</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="chgActPB">
|
||||
<property name="text">
|
||||
<string>Change Action</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<ui version="4.0">
|
||||
<class>ViewActionBase</class>
|
||||
<widget class="QDialog" name="ViewActionBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>446</width>
|
||||
<height>180</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Native Viewers</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Select one or several mime types then click "Change Action"<br>You can also close this dialog and check "Use desktop preferences"<br>in the main panel to ignore this list and use your desktop defaults.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="actionsLV">
|
||||
<property name="toolTip">
|
||||
<string>Select one or several file types, then click Change Action to modify the program used to open them</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="showSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>150</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>150</number>
|
||||
</attribute>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="chgActPB">
|
||||
<property name="text">
|
||||
<string>Change Action</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -26,16 +26,7 @@ using namespace std;
|
||||
#include <qpushbutton.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include <qlistview.h>
|
||||
#define QLVEXACTMATCH Qt::ExactMatch
|
||||
#else
|
||||
#include <q3listview.h>
|
||||
#define QListView Q3ListView
|
||||
#define QListViewItem Q3ListViewItem
|
||||
#define QListViewItemIterator Q3ListViewItemIterator
|
||||
#define QLVEXACTMATCH Q3ListView::ExactMatch
|
||||
#endif
|
||||
#include <qlistwidget.h>
|
||||
|
||||
#include <qmessagebox.h>
|
||||
#include <qinputdialog.h>
|
||||
@ -50,71 +41,74 @@ using namespace std;
|
||||
void ViewAction::init()
|
||||
{
|
||||
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(chgActPB, SIGNAL(clicked()), this, SLOT(editAction()));
|
||||
connect(actionsLV,
|
||||
#if (QT_VERSION < 0x040000)
|
||||
SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
|
||||
#else
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *, const QPoint &, int)),
|
||||
#endif
|
||||
this, SLOT(editAction()));
|
||||
connect(chgActPB, SIGNAL(clicked()),
|
||||
this, SLOT(editActions()));
|
||||
connect(actionsLV,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
|
||||
this, SLOT(onItemDoubleClicked(QTableWidgetItem *)));
|
||||
fillLists();
|
||||
resize(QSize(640, 250).expandedTo(minimumSizeHint()) );
|
||||
resize(QSize(640, 250).expandedTo(minimumSizeHint()));
|
||||
}
|
||||
|
||||
void ViewAction::fillLists()
|
||||
{
|
||||
actionsLV->clear();
|
||||
actionsLV->verticalHeader()->setDefaultSectionSize(20);
|
||||
vector<pair<string, string> > defs;
|
||||
rclconfig->getMimeViewerDefs(defs);
|
||||
actionsLV->setRowCount(defs.size());
|
||||
int row = 0;
|
||||
for (vector<pair<string, string> >::const_iterator it = defs.begin();
|
||||
it != defs.end(); it++) {
|
||||
new QListViewItem(actionsLV,
|
||||
QString::fromAscii(it->first.c_str()),
|
||||
QString::fromAscii(it->second.c_str()));
|
||||
actionsLV->setItem(row, 0,
|
||||
new QTableWidgetItem(QString::fromAscii(it->first.c_str())));
|
||||
actionsLV->setItem(row, 1,
|
||||
new QTableWidgetItem(QString::fromAscii(it->second.c_str())));
|
||||
row++;
|
||||
}
|
||||
|
||||
QStringList labels(tr("Mime type"));
|
||||
labels.push_back(tr("Command"));
|
||||
actionsLV->setHorizontalHeaderLabels(labels);
|
||||
}
|
||||
|
||||
void ViewAction::selectMT(const QString& mt)
|
||||
{
|
||||
QListViewItem *item = actionsLV->findItem(mt, 0, QLVEXACTMATCH);
|
||||
if (item) {
|
||||
actionsLV->ensureItemVisible(item);
|
||||
actionsLV->setSelected(item, true);
|
||||
actionsLV->setSelectionAnchor(item);
|
||||
actionsLV->clearSelection();
|
||||
QList<QTableWidgetItem *>items =
|
||||
actionsLV->findItems(mt, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
for (QList<QTableWidgetItem *>::iterator it = items.begin();
|
||||
it != items.end(); it++) {
|
||||
(*it)->setSelected(true);
|
||||
actionsLV->setCurrentItem(*it, QItemSelectionModel::Columns);
|
||||
}
|
||||
}
|
||||
|
||||
// To avoid modifying the listview state from the dbl click signal, as
|
||||
// advised by the manual
|
||||
void ViewAction::listDblClicked()
|
||||
void ViewAction::onItemDoubleClicked(QTableWidgetItem * item)
|
||||
{
|
||||
QTimer::singleShot(0, this, SLOT(editAction()));
|
||||
actionsLV->clearSelection();
|
||||
item->setSelected(true);
|
||||
QTableWidgetItem *item0 = actionsLV->item(item->row(), 0);
|
||||
item0->setSelected(true);
|
||||
editActions();
|
||||
}
|
||||
|
||||
void ViewAction::editAction()
|
||||
void ViewAction::editActions()
|
||||
{
|
||||
QString action0;
|
||||
list<string> mtypes;
|
||||
bool dowarnmultiple = true;
|
||||
|
||||
QListViewItemIterator it(actionsLV);
|
||||
while (it.current()) {
|
||||
QListViewItem *item = it.current();
|
||||
if (!item->isSelected()) {
|
||||
++it;
|
||||
for (int row = 0; row < actionsLV->rowCount(); row++) {
|
||||
QTableWidgetItem *item0 = actionsLV->item(row, 0);
|
||||
if (!item0->isSelected())
|
||||
continue;
|
||||
}
|
||||
mtypes.push_back((const char *)item->text(0).utf8());
|
||||
QString action = (const char *)item->text(1).utf8();
|
||||
mtypes.push_back((const char *)item0->text().local8Bit());
|
||||
QTableWidgetItem *item1 = actionsLV->item(row, 1);
|
||||
QString action = item1->text();
|
||||
if (action0.isEmpty()) {
|
||||
action0 = action;
|
||||
} else {
|
||||
if (action != action0 && dowarnmultiple) {
|
||||
switch (QMessageBox::warning(0, "Recoll",
|
||||
tr("Changing actions with different "
|
||||
"current values"),
|
||||
tr("Changing actions with "
|
||||
"different current values"),
|
||||
"Continue",
|
||||
"Cancel",
|
||||
0, 0, 1)) {
|
||||
@ -123,20 +117,18 @@ void ViewAction::editAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
if (action0.isEmpty())
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
QString text = QInputDialog::getText(
|
||||
"Recoll", "Edit action:",
|
||||
QString newaction = QInputDialog::getText("Recoll", "Edit action:",
|
||||
QLineEdit::Normal,
|
||||
action0, &ok, this);
|
||||
if (!ok || text.isEmpty() )
|
||||
if (!ok || newaction.isEmpty() )
|
||||
return;
|
||||
|
||||
string sact = (const char *)text.utf8();
|
||||
string sact = (const char *)newaction.local8Bit();
|
||||
for (list<string>::const_iterator it = mtypes.begin();
|
||||
it != mtypes.end(); it++) {
|
||||
rclconfig->setMimeViewerDef(*it, sact);
|
||||
|
||||
@ -21,52 +21,29 @@
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
|
||||
#if (QT_VERSION < 0x040000)
|
||||
#include "viewaction.h"
|
||||
#else
|
||||
#include "ui_viewaction.h"
|
||||
#endif
|
||||
|
||||
class QDialog;
|
||||
class QMouseEvent;
|
||||
class QTableWidget;
|
||||
|
||||
//MOC_SKIP_BEGIN
|
||||
#if QT_VERSION < 0x040000
|
||||
class DummyViewActionBase : public ViewActionBase
|
||||
{
|
||||
public: DummyViewActionBase(QWidget* parent = 0) : ViewActionBase(parent) {}
|
||||
};
|
||||
#else
|
||||
class DummyViewActionBase : public QDialog, public Ui::ViewActionBase
|
||||
{
|
||||
public:
|
||||
DummyViewActionBase(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
//MOC_SKIP_END
|
||||
|
||||
class ViewAction : public DummyViewActionBase
|
||||
class ViewAction : public QDialog, public Ui::ViewActionBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ViewAction(QDialog* parent = 0)
|
||||
: DummyViewActionBase(parent)
|
||||
ViewAction(QWidget* parent = 0)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
}
|
||||
~ViewAction() {}
|
||||
|
||||
void selectMT(const QString& mt);
|
||||
|
||||
public slots:
|
||||
virtual void editAction();
|
||||
virtual void listDblClicked();
|
||||
|
||||
virtual void editActions();
|
||||
virtual void onItemDoubleClicked(QTableWidgetItem *);
|
||||
private:
|
||||
virtual void init();
|
||||
virtual void fillLists();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user