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/lib/librcl.a
|
||||||
src/mk/localdefs
|
src/mk/localdefs
|
||||||
src/mk/sysconf
|
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/.moc/*
|
||||||
|
src/qtgui/.obj/*
|
||||||
src/qtgui/.ui/*
|
src/qtgui/.ui/*
|
||||||
src/qtgui/Makefile
|
src/qtgui/Makefile
|
||||||
src/qtgui/i18n/*.qm
|
src/qtgui/i18n/*.qm
|
||||||
|
src/qtgui/qrc_recoll.cpp
|
||||||
src/qtgui/recoll
|
src/qtgui/recoll
|
||||||
src/qtgui/recoll.pro
|
src/qtgui/recoll.pro
|
||||||
src/query/alldeps
|
src/query/alldeps
|
||||||
src/query/recollq
|
src/query/recollq
|
||||||
src/query/xadump
|
src/query/xadump
|
||||||
src/recollinstall
|
src/recollinstall
|
||||||
src/sampleconf/recoll.conf
|
|
||||||
src/sampleconf/rclmon.sh
|
src/sampleconf/rclmon.sh
|
||||||
|
src/sampleconf/recoll.conf
|
||||||
website/usermanual/*
|
website/usermanual/*
|
||||||
|
|||||||
@ -740,8 +740,8 @@ bool RclConfig::getFieldConfParam(const string &name, const string &sk,
|
|||||||
|
|
||||||
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
|
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclConfig::getMimeViewerDef: mtype %s apptag %s\n",
|
LOGDEB2(("RclConfig::getMimeViewerDef: mtype [%s] apptag [%s]\n",
|
||||||
mtype.c_str(), apptag.c_str()));
|
mtype.c_str(), apptag.c_str()));
|
||||||
string hs;
|
string hs;
|
||||||
if (mimeview == 0)
|
if (mimeview == 0)
|
||||||
return hs;
|
return hs;
|
||||||
|
|||||||
@ -64,12 +64,7 @@ PrefsPack prefs;
|
|||||||
void rwSettings(bool writing)
|
void rwSettings(bool writing)
|
||||||
{
|
{
|
||||||
LOGDEB1(("rwSettings: write %d\n", int(writing)));
|
LOGDEB1(("rwSettings: write %d\n", int(writing)));
|
||||||
#if QT_VERSION >= 0x040000
|
|
||||||
QSettings settings("Recoll.org", "recoll");
|
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.mainwidth, "/Recoll/geometry/width", Num, 0);
|
||||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Num, 0);
|
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Num, 0);
|
||||||
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", 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 <qevent.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#define Q34EVOVERRIDE QEvent::AccelOverride
|
|
||||||
#else
|
|
||||||
#define Q34EVOVERRIDE QEvent::ShortcutOverride
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "rclhelp.h"
|
#include "rclhelp.h"
|
||||||
@ -48,7 +43,8 @@ HelpClient::HelpClient(QObject *parent, const char *name)
|
|||||||
bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
static time_t last_start;
|
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()));
|
// LOGDEB(("HelpClient::eventFilter: %d\n", (int)event->type()));
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||||
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
|
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
|
||||||
@ -78,4 +74,3 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>31</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="fileMenu">
|
<widget class="QMenu" name="fileMenu">
|
||||||
|
|||||||
@ -34,20 +34,7 @@ using std::pair;
|
|||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qfiledialog.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>
|
#include <qshortcut.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <qtabwidget.h>
|
#include <qtabwidget.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
@ -92,18 +79,6 @@ using namespace confgui;
|
|||||||
extern "C" int XFlush(void *);
|
extern "C" int XFlush(void *);
|
||||||
QString g_stringAllStem, g_stringNoStem;
|
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()
|
void RclMain::init()
|
||||||
{
|
{
|
||||||
// This is just to get the common catg strings into the message file
|
// 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.
|
// A shortcut to get the focus back to the search entry.
|
||||||
QKeySequence seq("Ctrl+Shift+s");
|
QKeySequence seq("Ctrl+Shift+s");
|
||||||
#if RCLQT4
|
|
||||||
QShortcut *sc = new QShortcut(seq, this);
|
QShortcut *sc = new QShortcut(seq, this);
|
||||||
connect(sc, SIGNAL (activated()), this, SLOT (focusToSearch()));
|
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
|
// Toolbar+combobox version of the category selector
|
||||||
@ -191,26 +160,20 @@ void RclMain::init()
|
|||||||
QToolBar *catgToolBar = new QToolBar(this);
|
QToolBar *catgToolBar = new QToolBar(this);
|
||||||
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
|
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
|
||||||
catgCMB->insertItem(tr("All"));
|
catgCMB->insertItem(tr("All"));
|
||||||
#if RCLQT4
|
|
||||||
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
|
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
|
||||||
catgCMB->setToolTip(tr("Document category filter"));
|
catgCMB->setToolTip(tr("Document category filter"));
|
||||||
catgToolBar->addWidget(catgCMB);
|
catgToolBar->addWidget(catgCMB);
|
||||||
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
|
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Document categories buttons
|
// 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);
|
QHBoxLayout *bgrphbox = new QHBoxLayout(catgBGRP);
|
||||||
QButtonGroup *bgrp = new QButtonGroup(catgBGRP);
|
QButtonGroup *bgrp = new QButtonGroup(catgBGRP);
|
||||||
bgrphbox->addWidget(allRDB);
|
bgrphbox->addWidget(allRDB);
|
||||||
int bgrpid = 0;
|
int bgrpid = 0;
|
||||||
bgrp->addButton(allRDB, bgrpid++);
|
bgrp->addButton(allRDB, bgrpid++);
|
||||||
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
|
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
|
||||||
#endif
|
|
||||||
allRDB->setChecked(true);
|
allRDB->setChecked(true);
|
||||||
list<string> cats;
|
list<string> cats;
|
||||||
rclconfig->getMimeCategories(cats);
|
rclconfig->getMimeCategories(cats);
|
||||||
@ -225,27 +188,17 @@ void RclMain::init()
|
|||||||
but->setText(tr(catgnm));
|
but->setText(tr(catgnm));
|
||||||
if (prefs.catgToolBar && catgCMB)
|
if (prefs.catgToolBar && catgCMB)
|
||||||
catgCMB->insertItem(tr(catgnm));
|
catgCMB->insertItem(tr(catgnm));
|
||||||
#if RCLQT4
|
|
||||||
bgrphbox->addWidget(but);
|
bgrphbox->addWidget(but);
|
||||||
bgrp->addButton(but, bgrpid++);
|
bgrp->addButton(but, bgrpid++);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#if RCLQT3
|
|
||||||
catgBGRP->setButton(0);
|
|
||||||
#else
|
|
||||||
catgBGRP->setLayout(bgrphbox);
|
catgBGRP->setLayout(bgrphbox);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (prefs.catgToolBar)
|
if (prefs.catgToolBar)
|
||||||
catgBGRP->hide();
|
catgBGRP->hide();
|
||||||
// Connections
|
// Connections
|
||||||
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
|
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
|
||||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
||||||
#if RCLQT4
|
|
||||||
sSearch->queryText->installEventFilter(this);
|
sSearch->queryText->installEventFilter(this);
|
||||||
#else
|
|
||||||
sSearch->queryText->lineEdit()->installEventFilter(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(preferencesMenu, SIGNAL(activated(int)),
|
connect(preferencesMenu, SIGNAL(activated(int)),
|
||||||
this, SLOT(setStemLang(int)));
|
this, SLOT(setStemLang(int)));
|
||||||
@ -310,15 +263,6 @@ void RclMain::init()
|
|||||||
// speeded up during indexing
|
// speeded up during indexing
|
||||||
periodictimer->start(1000);
|
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"));
|
toolsSpellAction->setIcon(QIcon(":/images/spell.png"));
|
||||||
nextPageAction->setIcon(QIcon(":/images/nextpage.png"));
|
nextPageAction->setIcon(QIcon(":/images/nextpage.png"));
|
||||||
prevPageAction->setIcon(QIcon(":/images/prevpage.png"));
|
prevPageAction->setIcon(QIcon(":/images/prevpage.png"));
|
||||||
@ -326,8 +270,6 @@ void RclMain::init()
|
|||||||
toolsDoc_HistoryAction->setIcon(QIcon(":/images/history.png"));
|
toolsDoc_HistoryAction->setIcon(QIcon(":/images/history.png"));
|
||||||
toolsAdvanced_SearchAction->setIcon(QIcon(":/images/asearch.png"));
|
toolsAdvanced_SearchAction->setIcon(QIcon(":/images/asearch.png"));
|
||||||
toolsSort_parametersAction->setIcon(QIcon(":/images/sortparms.png"));
|
toolsSort_parametersAction->setIcon(QIcon(":/images/sortparms.png"));
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// If requested by prefs, restore sort state. The easiest way is to let
|
// If requested by prefs, restore sort state. The easiest way is to let
|
||||||
// a SortForm do it for us.
|
// a SortForm do it for us.
|
||||||
@ -350,11 +292,7 @@ void RclMain::initDbOpen()
|
|||||||
if (!maybeOpenDb(reason)) {
|
if (!maybeOpenDb(reason)) {
|
||||||
nodb = true;
|
nodb = true;
|
||||||
switch (QMessageBox::
|
switch (QMessageBox::
|
||||||
#if (QT_VERSION >= 0x030200)
|
|
||||||
question
|
question
|
||||||
#else
|
|
||||||
information
|
|
||||||
#endif
|
|
||||||
(this, "Recoll",
|
(this, "Recoll",
|
||||||
qApp->translate("Main", "Could not open database in ") +
|
qApp->translate("Main", "Could not open database in ") +
|
||||||
QString::fromLocal8Bit(rclconfig->getDbDir().c_str()) +
|
QString::fromLocal8Bit(rclconfig->getDbDir().c_str()) +
|
||||||
@ -391,11 +329,7 @@ void RclMain::initDbOpen()
|
|||||||
void RclMain::focusToSearch()
|
void RclMain::focusToSearch()
|
||||||
{
|
{
|
||||||
LOGDEB(("Giving focus to sSearch\n"));
|
LOGDEB(("Giving focus to sSearch\n"));
|
||||||
sSearch->queryText->setFocus(
|
sSearch->queryText->setFocus(Qt::ShortcutFocusReason);
|
||||||
#if RCLQT4
|
|
||||||
Qt::ShortcutFocusReason
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RclMain::setStemLang(int id)
|
void RclMain::setStemLang(int id)
|
||||||
|
|||||||
@ -32,43 +32,25 @@
|
|||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
|
|
||||||
class ExecCmd;
|
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;
|
class Preview;
|
||||||
|
|
||||||
|
#include "ui_rclmain.h"
|
||||||
|
|
||||||
namespace confgui {
|
namespace confgui {
|
||||||
class ConfIndexW;
|
class ConfIndexW;
|
||||||
}
|
}
|
||||||
|
|
||||||
using confgui::ConfIndexW;
|
using confgui::ConfIndexW;
|
||||||
|
|
||||||
class RclMain : public DummyRclMainBase
|
class RclMain : public QMainWindow, public Ui::RclMainBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RclMain(RCLMAINPARENT * parent = 0)
|
RclMain(QWidget * parent = 0)
|
||||||
: DummyRclMainBase(parent)
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
~RclMain() {}
|
~RclMain() {}
|
||||||
|
|||||||
@ -36,13 +36,8 @@ void SortForm::init()
|
|||||||
slabs += tr("Date");
|
slabs += tr("Date");
|
||||||
slabs += tr("Mime type");
|
slabs += tr("Mime type");
|
||||||
|
|
||||||
#if QT_VERSION < 0x040000
|
|
||||||
fldCMB1->insertStringList(slabs);
|
|
||||||
fldCMB2->insertStringList(slabs);
|
|
||||||
#else
|
|
||||||
fldCMB1->addItems(slabs);
|
fldCMB1->addItems(slabs);
|
||||||
fldCMB2->addItems(slabs);
|
fldCMB2->addItems(slabs);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize values from prefs:
|
// Initialize values from prefs:
|
||||||
mcntSB->setValue(prefs.sortDepth);
|
mcntSB->setValue(prefs.sortDepth);
|
||||||
|
|||||||
@ -21,41 +21,23 @@
|
|||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
#include "sortseq.h"
|
#include "sortseq.h"
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#include "sort.h"
|
|
||||||
#else
|
|
||||||
#include "ui_sort.h"
|
#include "ui_sort.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
|
|
||||||
//MOC_SKIP_BEGIN
|
class SortForm : public QDialog, public Ui::SortFormBase
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SortForm(QDialog* parent = 0)
|
SortForm(QWidget* parent = 0)
|
||||||
: DummySortFormBase(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
~SortForm() {}
|
~SortForm() {}
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
virtual void setData();
|
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 <qlayout.h>
|
||||||
#include <qtooltip.h>
|
#include <qtooltip.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#include <qlistview.h>
|
|
||||||
#else
|
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
@ -92,59 +88,25 @@ void SpellW::init()
|
|||||||
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
connect(expTypeCMB, SIGNAL(activated(int)), this, SLOT(modeSet(int)));
|
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"));
|
QStringList labels(tr("Term"));
|
||||||
labels.push_back(tr("Doc. / Tot."));
|
labels.push_back(tr("Doc. / Tot."));
|
||||||
suggsLV->setHorizontalHeaderLabels(labels);
|
suggsLV->setHorizontalHeaderLabels(labels);
|
||||||
suggsLV->setShowGrid(0);
|
suggsLV->setShowGrid(0);
|
||||||
suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
||||||
|
suggsLV->verticalHeader()->setDefaultSectionSize(20);
|
||||||
connect(suggsLV,
|
connect(suggsLV,
|
||||||
SIGNAL(cellDoubleClicked(int, int)),
|
SIGNAL(cellDoubleClicked(int, int)),
|
||||||
this, SLOT(textDoubleClicked(int, int)));
|
this, SLOT(textDoubleClicked(int, int)));
|
||||||
#endif
|
|
||||||
|
|
||||||
suggsLV->setColumnWidth(0, 200);
|
suggsLV->setColumnWidth(0, 200);
|
||||||
suggsLV->setColumnWidth(1, 150);
|
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 */
|
/* Expand term according to current mode */
|
||||||
void SpellW::doExpand()
|
void SpellW::doExpand()
|
||||||
{
|
{
|
||||||
// Can't clear qt4 table widget: resets column headers too
|
// Can't clear qt4 table widget: resets column headers too
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
suggsLV->clear();
|
|
||||||
#else
|
|
||||||
suggsLV->setRowCount(0);
|
suggsLV->setRowCount(0);
|
||||||
#endif
|
|
||||||
if (baseWordLE->text().isEmpty())
|
if (baseWordLE->text().isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -209,43 +171,25 @@ void SpellW::doExpand()
|
|||||||
|
|
||||||
|
|
||||||
if (res.entries.empty()) {
|
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")));
|
suggsLV->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
for (list<Rcl::TermMatchEntry>::reverse_iterator it =
|
|
||||||
res.entries.rbegin();
|
|
||||||
it != res.entries.rend(); it++) {
|
|
||||||
#else
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
|
||||||
it != res.entries.end(); it++) {
|
it != res.entries.end(); it++) {
|
||||||
#endif
|
|
||||||
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
|
||||||
char num[30];
|
char num[30];
|
||||||
if (it->wcf)
|
if (it->wcf)
|
||||||
sprintf(num, "%d / %d", it->docs, it->wcf);
|
sprintf(num, "%d / %d", it->docs, it->wcf);
|
||||||
else
|
else
|
||||||
num[0] = 0;
|
num[0] = 0;
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
new MyListViewItem(suggsLV,
|
|
||||||
QString::fromUtf8(it->term.c_str()),
|
|
||||||
QString::fromAscii(num));
|
|
||||||
#else
|
|
||||||
if (suggsLV->rowCount() <= row)
|
if (suggsLV->rowCount() <= row)
|
||||||
suggsLV->setRowCount(row+1);
|
suggsLV->setRowCount(row+1);
|
||||||
suggsLV->setItem(row, 0,
|
suggsLV->setItem(row, 0,
|
||||||
new QTableWidgetItem(QString::fromUtf8(it->term.c_str())));
|
new QTableWidgetItem(QString::fromUtf8(it->term.c_str())));
|
||||||
suggsLV->setItem(row++, 1,
|
suggsLV->setItem(row++, 1,
|
||||||
new QTableWidgetItem(QString::fromAscii(num)));
|
new QTableWidgetItem(QString::fromAscii(num)));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#if (QT_VERSION >= 0x040000)
|
|
||||||
suggsLV->setRowCount(row+1);
|
suggsLV->setRowCount(row+1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,40 +197,18 @@ void SpellW::wordChanged(const QString &text)
|
|||||||
{
|
{
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
expandPB->setEnabled(false);
|
expandPB->setEnabled(false);
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
suggsLV->clear();
|
|
||||||
#else
|
|
||||||
suggsLV->setRowCount(0);
|
suggsLV->setRowCount(0);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
expandPB->setEnabled(true);
|
expandPB->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
void SpellW::textDoubleClicked(int, int){}
|
|
||||||
void SpellW::textDoubleClicked()
|
|
||||||
#else
|
|
||||||
void SpellW::textDoubleClicked() {}
|
void SpellW::textDoubleClicked() {}
|
||||||
void SpellW::textDoubleClicked(int row, int)
|
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);
|
QTableWidgetItem *item = suggsLV->item(row, 0);
|
||||||
if (item)
|
if (item)
|
||||||
emit(wordSelect(item->text()));
|
emit(wordSelect(item->text()));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellW::modeSet(int mode)
|
void SpellW::modeSet(int mode)
|
||||||
|
|||||||
@ -21,30 +21,16 @@
|
|||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qwidget.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"
|
#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
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpellW(QWidget* parent = 0)
|
SpellW(QWidget* parent = 0)
|
||||||
: DummySpellBase(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,11 +56,7 @@ void SSearch::init()
|
|||||||
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
|
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
|
||||||
connect(searchTypCMB, SIGNAL(activated(int)), this, SLOT(searchTypeChanged(int)));
|
connect(searchTypCMB, SIGNAL(activated(int)), this, SLOT(searchTypeChanged(int)));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040000
|
|
||||||
queryText->installEventFilter(this);
|
queryText->installEventFilter(this);
|
||||||
#else
|
|
||||||
queryText->lineEdit()->installEventFilter(this);
|
|
||||||
#endif
|
|
||||||
m_escape = false;
|
m_escape = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,90 +305,6 @@ void SSearch::completion()
|
|||||||
|
|
||||||
#undef SHOWEVENTS
|
#undef SHOWEVENTS
|
||||||
#if defined(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)
|
static const char *eventTypeToStr(int tp)
|
||||||
{
|
{
|
||||||
switch (tp) {
|
switch (tp) {
|
||||||
@ -531,7 +443,6 @@ static const char *eventTypeToStr(int tp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
bool SSearch::eventFilter(QObject *, QEvent *event)
|
bool SSearch::eventFilter(QObject *, QEvent *event)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,27 +23,10 @@
|
|||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#include "ssearchb.h"
|
|
||||||
#else
|
|
||||||
#include "ui_ssearchb.h"
|
#include "ui_ssearchb.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
//MOC_SKIP_BEGIN
|
class SSearch : public QWidget, public Ui::SSearchBase
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -51,8 +34,9 @@ public:
|
|||||||
enum SSearchType {SST_ANY = 0, SST_ALL = 1, SST_FNM = 2, SST_LANG = 3};
|
enum SSearchType {SST_ANY = 0, SST_ALL = 1, SST_FNM = 2, SST_LANG = 3};
|
||||||
|
|
||||||
SSearch(QWidget* parent = 0, const char * = 0)
|
SSearch(QWidget* parent = 0, const char * = 0)
|
||||||
: DummySSearchBase(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
~SSearch(){}
|
~SSearch(){}
|
||||||
|
|||||||
@ -1,109 +1,106 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0" stdsetdef="1">
|
<ui version="4.0">
|
||||||
<author></author>
|
<class>SSearchBase</class>
|
||||||
<comment></comment>
|
<widget class="QWidget" name="SSearchBase">
|
||||||
<exportmacro></exportmacro>
|
<property name="geometry">
|
||||||
<class>SSearchBase</class>
|
<rect>
|
||||||
<widget class="QWidget" name="SSearchBase">
|
<x>0</x>
|
||||||
<property name="geometry">
|
<y>0</y>
|
||||||
<rect>
|
<width>593</width>
|
||||||
<x>0</x>
|
<height>48</height>
|
||||||
<y>0</y>
|
</rect>
|
||||||
<width>593</width>
|
</property>
|
||||||
<height>48</height>
|
<property name="windowTitle">
|
||||||
</rect>
|
<string>SSearchBase</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<layout class="QHBoxLayout">
|
||||||
<string>SSearchBase</string>
|
<property name="spacing">
|
||||||
</property>
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<property name="margin">
|
<item>
|
||||||
<number>4</number>
|
<widget class="QPushButton" name="clearqPB">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="spacing">
|
<bool>false</bool>
|
||||||
<number>2</number>
|
</property>
|
||||||
</property>
|
<property name="toolTip">
|
||||||
<item>
|
<string>Erase search entry</string>
|
||||||
<layout class="QHBoxLayout">
|
</property>
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="clearqPB">
|
<string>Clear</string>
|
||||||
<property name="enabled">
|
</property>
|
||||||
<bool>false</bool>
|
<property name="shortcut">
|
||||||
</property>
|
<string>Ctrl+S</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Clear</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="shortcut">
|
<item>
|
||||||
<string>Ctrl+S</string>
|
<widget class="QPushButton" name="searchPB">
|
||||||
</property>
|
<property name="enabled">
|
||||||
<property name="toolTip" stdset="0">
|
<bool>false</bool>
|
||||||
<string>Erase search entry</string>
|
</property>
|
||||||
</property>
|
<property name="toolTip">
|
||||||
</widget>
|
<string>Start query</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="searchPB">
|
<string>Search</string>
|
||||||
<property name="enabled">
|
</property>
|
||||||
<bool>false</bool>
|
<property name="shortcut">
|
||||||
</property>
|
<string/>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Search</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="shortcut">
|
<item>
|
||||||
<string/>
|
<widget class="QComboBox" name="searchTypCMB">
|
||||||
</property>
|
<property name="focusPolicy">
|
||||||
<property name="toolTip" stdset="0">
|
<enum>Qt::TabFocus</enum>
|
||||||
<string>Start query</string>
|
</property>
|
||||||
</property>
|
<property name="toolTip">
|
||||||
</widget>
|
<string>Choose search type.</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<widget class="QComboBox" name="searchTypCMB">
|
</item>
|
||||||
<property name="focusPolicy">
|
<item>
|
||||||
<enum>Qt::TabFocus</enum>
|
<widget class="QComboBox" name="queryText">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="toolTip" stdset="0">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<string>Choose search type.</string>
|
<horstretch>8</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
</widget>
|
</sizepolicy>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="minimumSize">
|
||||||
<widget class="QComboBox" name="queryText">
|
<size>
|
||||||
<property name="sizePolicy">
|
<width>155</width>
|
||||||
<sizepolicy>
|
<height>0</height>
|
||||||
<hsizetype>7</hsizetype>
|
</size>
|
||||||
<vsizetype>0</vsizetype>
|
</property>
|
||||||
<horstretch>8</horstretch>
|
<property name="toolTip">
|
||||||
<verstretch>0</verstretch>
|
<string>Enter search terms here. Type ESC SPC for completions of current term.</string>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="editable">
|
||||||
<property name="minimumSize">
|
<bool>true</bool>
|
||||||
<size>
|
</property>
|
||||||
<width>155</width>
|
<property name="maxCount">
|
||||||
<height>0</height>
|
<number>30</number>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
<property name="insertPolicy">
|
||||||
<property name="editable">
|
<enum>QComboBox::NoInsert</enum>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="duplicatesEnabled">
|
||||||
<property name="maxCount">
|
<bool>false</bool>
|
||||||
<number>30</number>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="insertPolicy">
|
</item>
|
||||||
<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>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
<layoutdefault spacing="6" margin="0"/>
|
</layout>
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="0"/>
|
||||||
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
</ui>
|
</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 <qvariant.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qtabwidget.h>
|
#include <qtabwidget.h>
|
||||||
|
#include <qlistwidget.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qspinbox.h>
|
#include <qspinbox.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
#if QT_VERSION < 0x040000
|
|
||||||
#include <qlistbox.h>
|
|
||||||
#include <qlistview.h>
|
|
||||||
#include <qfiledialog.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 <qlayout.h>
|
||||||
#include <qtooltip.h>
|
#include <qtooltip.h>
|
||||||
#include <qwhatsthis.h>
|
#include <qwhatsthis.h>
|
||||||
#include <qtextedit.h>
|
#include <qtextedit.h>
|
||||||
|
#include <qlist.h>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
@ -128,7 +118,7 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
reslistFontPB->setText(reslistFontFamily + "-" +
|
reslistFontPB->setText(reslistFontFamily + "-" +
|
||||||
s.setNum(reslistFontSize));
|
s.setNum(reslistFontSize));
|
||||||
}
|
}
|
||||||
rlfTE->setText(prefs.reslistformat);
|
rlfTE->setPlainText(prefs.reslistformat);
|
||||||
|
|
||||||
// Stemming language combobox
|
// Stemming language combobox
|
||||||
stemLangCMB->clear();
|
stemLangCMB->clear();
|
||||||
@ -163,19 +153,23 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
idxLV->clear();
|
idxLV->clear();
|
||||||
for (list<string>::iterator it = prefs.allExtraDbs.begin();
|
for (list<string>::iterator it = prefs.allExtraDbs.begin();
|
||||||
it != prefs.allExtraDbs.end(); it++) {
|
it != prefs.allExtraDbs.end(); it++) {
|
||||||
QCheckListItem *item =
|
QListWidgetItem *item =
|
||||||
new QCheckListItem(idxLV, QString::fromLocal8Bit(it->c_str()),
|
new QListWidgetItem(QString::fromLocal8Bit(it->c_str()),
|
||||||
QCheckListItem::CheckBox);
|
idxLV);
|
||||||
if (item) item->setOn(false);
|
if (item)
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
}
|
}
|
||||||
for (list<string>::iterator it = prefs.activeExtraDbs.begin();
|
for (list<string>::iterator it = prefs.activeExtraDbs.begin();
|
||||||
it != prefs.activeExtraDbs.end(); it++) {
|
it != prefs.activeExtraDbs.end(); it++) {
|
||||||
QCheckListItem *item;
|
QList<QListWidgetItem *>items =
|
||||||
if ((item = (QCheckListItem *)
|
idxLV->findItems (QString::fromLocal8Bit(it->c_str()),
|
||||||
idxLV->findItem (QString::fromLocal8Bit(it->c_str()), 0))) {
|
Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||||
item->setOn(true);
|
for (QList<QListWidgetItem *>::iterator it = items.begin();
|
||||||
|
it != items.end(); it++) {
|
||||||
|
(*it)->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
idxLV->sortItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIPrefsDialog::accept()
|
void UIPrefsDialog::accept()
|
||||||
@ -195,11 +189,11 @@ void UIPrefsDialog::accept()
|
|||||||
if (prefs.reslistformat ==
|
if (prefs.reslistformat ==
|
||||||
QString::fromAscii(prefs.getV18DfltResListFormat())) {
|
QString::fromAscii(prefs.getV18DfltResListFormat())) {
|
||||||
prefs.reslistformat += " ";
|
prefs.reslistformat += " ";
|
||||||
rlfTE->setText(prefs.reslistformat);
|
rlfTE->setPlainText(prefs.reslistformat);
|
||||||
}
|
}
|
||||||
if (prefs.reslistformat.stripWhiteSpace().isEmpty()) {
|
if (prefs.reslistformat.stripWhiteSpace().isEmpty()) {
|
||||||
prefs.reslistformat = prefs.getDfltResListFormat();
|
prefs.reslistformat = prefs.getDfltResListFormat();
|
||||||
rlfTE->setText(prefs.reslistformat);
|
rlfTE->setPlainText(prefs.reslistformat);
|
||||||
}
|
}
|
||||||
prefs.creslistformat = (const char*)prefs.reslistformat.utf8();
|
prefs.creslistformat = (const char*)prefs.reslistformat.utf8();
|
||||||
|
|
||||||
@ -228,17 +222,17 @@ void UIPrefsDialog::accept()
|
|||||||
prefs.autoSuffsEnable = autoSuffsCB->isChecked();
|
prefs.autoSuffsEnable = autoSuffsCB->isChecked();
|
||||||
prefs.autoSuffs = autoSuffsLE->text();
|
prefs.autoSuffs = autoSuffsLE->text();
|
||||||
|
|
||||||
QListViewItemIterator it(idxLV);
|
|
||||||
prefs.allExtraDbs.clear();
|
prefs.allExtraDbs.clear();
|
||||||
prefs.activeExtraDbs.clear();
|
prefs.activeExtraDbs.clear();
|
||||||
while (it.current()) {
|
for (int i = 0; i < idxLV->count(); i++) {
|
||||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
QListWidgetItem *item = idxLV->item(i);
|
||||||
prefs.allExtraDbs.push_back((const char *)item->text().local8Bit());
|
if (item) {
|
||||||
if (item->isOn()) {
|
prefs.allExtraDbs.push_back((const char *)item->text().local8Bit());
|
||||||
prefs.activeExtraDbs.push_back((const char *)
|
if (item->checkState() == Qt::Checked) {
|
||||||
item->text().local8Bit());
|
prefs.activeExtraDbs.push_back((const char *)
|
||||||
|
item->text().local8Bit());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rwSettings(true);
|
rwSettings(true);
|
||||||
@ -325,52 +319,42 @@ void UIPrefsDialog::showViewAction(const QString& mt)
|
|||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// External / extra search indexes setup
|
// External / extra search indexes setup
|
||||||
// TBD: a way to remove entry from 'all' list (del button?)
|
|
||||||
|
|
||||||
void UIPrefsDialog::togExtraDbPB_clicked()
|
void UIPrefsDialog::togExtraDbPB_clicked()
|
||||||
{
|
{
|
||||||
QListViewItemIterator it(idxLV);
|
for (int i = 0; i < idxLV->count(); i++) {
|
||||||
while (it.current()) {
|
QListWidgetItem *item = idxLV->item(i);
|
||||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
|
||||||
if (item->isSelected()) {
|
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()
|
void UIPrefsDialog::actAllExtraDbPB_clicked()
|
||||||
{
|
{
|
||||||
QListViewItemIterator it(idxLV);
|
for (int i = 0; i < idxLV->count(); i++) {
|
||||||
while (it.current()) {
|
QListWidgetItem *item = idxLV->item(i);
|
||||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
item->setCheckState(Qt::Checked);
|
||||||
item->setOn(true);
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void UIPrefsDialog::unacAllExtraDbPB_clicked()
|
void UIPrefsDialog::unacAllExtraDbPB_clicked()
|
||||||
{
|
{
|
||||||
QListViewItemIterator it(idxLV);
|
for (int i = 0; i < idxLV->count(); i++) {
|
||||||
while (it.current()) {
|
QListWidgetItem *item = idxLV->item(i);
|
||||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
item->setCheckState(Qt::Unchecked);
|
||||||
item->setOn(false);
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIPrefsDialog::delExtraDbPB_clicked()
|
void UIPrefsDialog::delExtraDbPB_clicked()
|
||||||
{
|
{
|
||||||
list<QCheckListItem*> dlt;
|
QList<QListWidgetItem *> items = idxLV->selectedItems();
|
||||||
QListViewItemIterator it(idxLV);
|
for (QList<QListWidgetItem *>::iterator it = items.begin();
|
||||||
while (it.current()) {
|
it != items.end(); it++) {
|
||||||
QCheckListItem *item = (QCheckListItem *)it.current();
|
|
||||||
if (item->isSelected()) {
|
|
||||||
dlt.push_back(item);
|
|
||||||
}
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
for (list<QCheckListItem*>::iterator it = dlt.begin();
|
|
||||||
it != dlt.end(); it++)
|
|
||||||
delete *it;
|
delete *it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -380,14 +364,14 @@ void UIPrefsDialog::delExtraDbPB_clicked()
|
|||||||
*/
|
*/
|
||||||
void UIPrefsDialog::addExtraDbPB_clicked()
|
void UIPrefsDialog::addExtraDbPB_clicked()
|
||||||
{
|
{
|
||||||
QFileDialog fdia;
|
static QString lastdir;
|
||||||
bool savedh = fdia.showHiddenFiles();
|
|
||||||
fdia.setShowHiddenFiles(true);
|
QString input = QFileDialog::getExistingDirectory(this,
|
||||||
QString input = QFileDialog::getExistingDirectory("", this, 0,
|
tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"),
|
||||||
tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"));
|
lastdir);
|
||||||
fdia.setShowHiddenFiles(savedh);
|
|
||||||
if (input.isEmpty())
|
if (input.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
lastdir = input;
|
||||||
|
|
||||||
string dbdir = (const char *)input.local8Bit();
|
string dbdir = (const char *)input.local8Bit();
|
||||||
LOGDEB(("ExtraDbDial: got: [%s]\n", dbdir.c_str()));
|
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
|
// For some reason, finditem (which we used to use to detect duplicates
|
||||||
// here) does not work anymore here: qt 4.6.3
|
// 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();
|
string nv = (const char *)input.local8Bit();
|
||||||
QListViewItemIterator it(idxLV);
|
QListViewItemIterator it(idxLV);
|
||||||
while (it.current()) {
|
while (it.current()) {
|
||||||
@ -424,20 +415,8 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
|||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
#else // if findItem worked...
|
|
||||||
if (idxLV->findItem(input,
|
|
||||||
#if QT_VERSION < 0x040000
|
|
||||||
Qt::CaseSensitive|Qt::ExactMatch
|
|
||||||
#else
|
|
||||||
Q3ListView::CaseSensitive|Q3ListView::ExactMatch
|
|
||||||
#endif
|
#endif
|
||||||
)) {
|
QListWidgetItem *item = new QListWidgetItem(input, idxLV);
|
||||||
QMessageBox::warning(0, "Recoll",
|
item->setCheckState(Qt::Unchecked);
|
||||||
tr("The selected directory is already in the index list"));
|
idxLV->sortItems();
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
new QCheckListItem(idxLV, input, QCheckListItem::CheckBox);
|
|
||||||
idxLV->sort();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,39 +21,20 @@
|
|||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#include "uiprefs.h"
|
|
||||||
#else
|
|
||||||
#include "ui_uiprefs.h"
|
#include "ui_uiprefs.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
class QDialog;
|
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 ViewAction;
|
||||||
|
|
||||||
class UIPrefsDialog : public DummyUIPrefsDialogBase
|
class UIPrefsDialog : public QDialog, public Ui::uiPrefsDialogBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UIPrefsDialog(QDialog* parent = 0)
|
UIPrefsDialog(QDialog* parent = 0)
|
||||||
: DummyUIPrefsDialogBase(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
~UIPrefsDialog(){};
|
~UIPrefsDialog(){};
|
||||||
|
|||||||
@ -1,100 +1,118 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0" stdsetdef="1">
|
<ui version="4.0">
|
||||||
<author></author>
|
<class>ViewActionBase</class>
|
||||||
<comment></comment>
|
<widget class="QDialog" name="ViewActionBase">
|
||||||
<exportmacro></exportmacro>
|
<property name="geometry">
|
||||||
<class>ViewActionBase</class>
|
<rect>
|
||||||
<widget class="QDialog" name="ViewActionBase">
|
<x>0</x>
|
||||||
<property name="geometry">
|
<y>0</y>
|
||||||
<rect>
|
<width>446</width>
|
||||||
<x>0</x>
|
<height>180</height>
|
||||||
<y>0</y>
|
</rect>
|
||||||
<width>400</width>
|
</property>
|
||||||
<height>132</height>
|
<property name="windowTitle">
|
||||||
</rect>
|
<string>Native Viewers</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<layout class="QHBoxLayout">
|
||||||
<string>Native Viewers</string>
|
<item>
|
||||||
</property>
|
<layout class="QVBoxLayout">
|
||||||
<layout class="QHBoxLayout">
|
<item>
|
||||||
<item>
|
<widget class="QLabel" name="textLabel1">
|
||||||
<layout class="QVBoxLayout">
|
<property name="text">
|
||||||
<item>
|
<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>
|
||||||
<widget class="QLabel" name="textLabel1">
|
</property>
|
||||||
<property name="text">
|
<property name="wordWrap">
|
||||||
<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>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
</widget>
|
||||||
<bool>false</bool>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<widget class="QTableWidget" name="actionsLV">
|
||||||
</item>
|
<property name="toolTip">
|
||||||
<item>
|
<string>Select one or several file types, then click Change Action to modify the program used to open them</string>
|
||||||
<widget class="Q3ListView" name="actionsLV">
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Sunken</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
<property name="editTriggers">
|
||||||
<enum>Q3ListView::Extended</enum>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="allColumnsShowFocus">
|
<property name="selectionMode">
|
||||||
<bool>true</bool>
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showSortIndicator">
|
<property name="selectionBehavior">
|
||||||
<bool>true</bool>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" stdset="0">
|
<property name="showGrid">
|
||||||
<string>Select one or several file types, then click Change Action to modify the program used to open them</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<column>
|
<property name="sortingEnabled">
|
||||||
<property name="text">
|
<bool>true</bool>
|
||||||
<string>File type</string>
|
</property>
|
||||||
</property>
|
<property name="columnCount">
|
||||||
<property name="clickable">
|
<number>2</number>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="allColumnsShowFocus" stdset="0">
|
||||||
<property name="resizable">
|
<bool>true</bool>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="showSortIndicator" stdset="0">
|
||||||
</column>
|
<bool>true</bool>
|
||||||
<column>
|
</property>
|
||||||
<property name="text">
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
<string>Action</string>
|
<number>150</number>
|
||||||
</property>
|
</attribute>
|
||||||
<property name="clickable">
|
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</attribute>
|
||||||
<property name="resizable">
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</attribute>
|
||||||
</column>
|
<attribute name="verticalHeaderVisible">
|
||||||
</widget>
|
<bool>false</bool>
|
||||||
</item>
|
</attribute>
|
||||||
<item>
|
<attribute name="verticalHeaderVisible">
|
||||||
<layout class="QHBoxLayout">
|
<bool>false</bool>
|
||||||
<item>
|
</attribute>
|
||||||
<widget class="QPushButton" name="chgActPB">
|
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||||
<property name="text">
|
<bool>true</bool>
|
||||||
<string>Change Action</string>
|
</attribute>
|
||||||
</property>
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
</item>
|
</attribute>
|
||||||
<item>
|
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||||
<widget class="QPushButton" name="closePB">
|
<number>150</number>
|
||||||
<property name="text">
|
</attribute>
|
||||||
<string>Close</string>
|
<column/>
|
||||||
</property>
|
<column/>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item>
|
||||||
</item>
|
<layout class="QHBoxLayout">
|
||||||
</layout>
|
<item>
|
||||||
</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>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
</layout>
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -26,16 +26,7 @@ using namespace std;
|
|||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
#include <qlistwidget.h>
|
||||||
#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 <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qinputdialog.h>
|
#include <qinputdialog.h>
|
||||||
@ -50,71 +41,74 @@ using namespace std;
|
|||||||
void ViewAction::init()
|
void ViewAction::init()
|
||||||
{
|
{
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
connect(chgActPB, SIGNAL(clicked()), this, SLOT(editAction()));
|
connect(chgActPB, SIGNAL(clicked()),
|
||||||
connect(actionsLV,
|
this, SLOT(editActions()));
|
||||||
#if (QT_VERSION < 0x040000)
|
connect(actionsLV,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
|
||||||
SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
|
this, SLOT(onItemDoubleClicked(QTableWidgetItem *)));
|
||||||
#else
|
|
||||||
SIGNAL(doubleClicked(Q3ListViewItem *, const QPoint &, int)),
|
|
||||||
#endif
|
|
||||||
this, SLOT(editAction()));
|
|
||||||
fillLists();
|
fillLists();
|
||||||
resize(QSize(640, 250).expandedTo(minimumSizeHint()) );
|
resize(QSize(640, 250).expandedTo(minimumSizeHint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewAction::fillLists()
|
void ViewAction::fillLists()
|
||||||
{
|
{
|
||||||
actionsLV->clear();
|
actionsLV->clear();
|
||||||
|
actionsLV->verticalHeader()->setDefaultSectionSize(20);
|
||||||
vector<pair<string, string> > defs;
|
vector<pair<string, string> > defs;
|
||||||
rclconfig->getMimeViewerDefs(defs);
|
rclconfig->getMimeViewerDefs(defs);
|
||||||
|
actionsLV->setRowCount(defs.size());
|
||||||
|
int row = 0;
|
||||||
for (vector<pair<string, string> >::const_iterator it = defs.begin();
|
for (vector<pair<string, string> >::const_iterator it = defs.begin();
|
||||||
it != defs.end(); it++) {
|
it != defs.end(); it++) {
|
||||||
new QListViewItem(actionsLV,
|
actionsLV->setItem(row, 0,
|
||||||
QString::fromAscii(it->first.c_str()),
|
new QTableWidgetItem(QString::fromAscii(it->first.c_str())));
|
||||||
QString::fromAscii(it->second.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)
|
void ViewAction::selectMT(const QString& mt)
|
||||||
{
|
{
|
||||||
QListViewItem *item = actionsLV->findItem(mt, 0, QLVEXACTMATCH);
|
actionsLV->clearSelection();
|
||||||
if (item) {
|
QList<QTableWidgetItem *>items =
|
||||||
actionsLV->ensureItemVisible(item);
|
actionsLV->findItems(mt, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||||
actionsLV->setSelected(item, true);
|
for (QList<QTableWidgetItem *>::iterator it = items.begin();
|
||||||
actionsLV->setSelectionAnchor(item);
|
it != items.end(); it++) {
|
||||||
|
(*it)->setSelected(true);
|
||||||
|
actionsLV->setCurrentItem(*it, QItemSelectionModel::Columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void ViewAction::onItemDoubleClicked(QTableWidgetItem * item)
|
||||||
// To avoid modifying the listview state from the dbl click signal, as
|
|
||||||
// advised by the manual
|
|
||||||
void ViewAction::listDblClicked()
|
|
||||||
{
|
{
|
||||||
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;
|
QString action0;
|
||||||
list<string> mtypes;
|
list<string> mtypes;
|
||||||
bool dowarnmultiple = true;
|
bool dowarnmultiple = true;
|
||||||
|
for (int row = 0; row < actionsLV->rowCount(); row++) {
|
||||||
QListViewItemIterator it(actionsLV);
|
QTableWidgetItem *item0 = actionsLV->item(row, 0);
|
||||||
while (it.current()) {
|
if (!item0->isSelected())
|
||||||
QListViewItem *item = it.current();
|
|
||||||
if (!item->isSelected()) {
|
|
||||||
++it;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
mtypes.push_back((const char *)item0->text().local8Bit());
|
||||||
mtypes.push_back((const char *)item->text(0).utf8());
|
QTableWidgetItem *item1 = actionsLV->item(row, 1);
|
||||||
QString action = (const char *)item->text(1).utf8();
|
QString action = item1->text();
|
||||||
if (action0.isEmpty()) {
|
if (action0.isEmpty()) {
|
||||||
action0 = action;
|
action0 = action;
|
||||||
} else {
|
} else {
|
||||||
if (action != action0 && dowarnmultiple) {
|
if (action != action0 && dowarnmultiple) {
|
||||||
switch (QMessageBox::warning(0, "Recoll",
|
switch (QMessageBox::warning(0, "Recoll",
|
||||||
tr("Changing actions with different "
|
tr("Changing actions with "
|
||||||
"current values"),
|
"different current values"),
|
||||||
"Continue",
|
"Continue",
|
||||||
"Cancel",
|
"Cancel",
|
||||||
0, 0, 1)) {
|
0, 0, 1)) {
|
||||||
@ -123,20 +117,18 @@ void ViewAction::editAction()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
if (action0.isEmpty())
|
if (action0.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString text = QInputDialog::getText(
|
QString newaction = QInputDialog::getText("Recoll", "Edit action:",
|
||||||
"Recoll", "Edit action:",
|
|
||||||
QLineEdit::Normal,
|
QLineEdit::Normal,
|
||||||
action0, &ok, this);
|
action0, &ok, this);
|
||||||
if (!ok || text.isEmpty() )
|
if (!ok || newaction.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string sact = (const char *)text.utf8();
|
string sact = (const char *)newaction.local8Bit();
|
||||||
for (list<string>::const_iterator it = mtypes.begin();
|
for (list<string>::const_iterator it = mtypes.begin();
|
||||||
it != mtypes.end(); it++) {
|
it != mtypes.end(); it++) {
|
||||||
rclconfig->setMimeViewerDef(*it, sact);
|
rclconfig->setMimeViewerDef(*it, sact);
|
||||||
|
|||||||
@ -21,52 +21,29 @@
|
|||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
|
||||||
#include "viewaction.h"
|
|
||||||
#else
|
|
||||||
#include "ui_viewaction.h"
|
#include "ui_viewaction.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
|
class QTableWidget;
|
||||||
|
|
||||||
//MOC_SKIP_BEGIN
|
class ViewAction : public QDialog, public Ui::ViewActionBase
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ViewAction(QDialog* parent = 0)
|
ViewAction(QWidget* parent = 0)
|
||||||
: DummyViewActionBase(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
|
setupUi(this);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
~ViewAction() {}
|
~ViewAction() {}
|
||||||
|
|
||||||
void selectMT(const QString& mt);
|
void selectMT(const QString& mt);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void editAction();
|
virtual void editActions();
|
||||||
virtual void listDblClicked();
|
virtual void onItemDoubleClicked(QTableWidgetItem *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void fillLists();
|
virtual void fillLists();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user