use restable instead of reslist for "show subdocs"
This commit is contained in:
parent
656d0a1395
commit
ceef5aebd0
@ -279,6 +279,8 @@ void RclMain::init()
|
||||
reslist, SLOT(showQueryDetails()));
|
||||
connect(periodictimer, SIGNAL(timeout()),
|
||||
this, SLOT(periodic100()));
|
||||
|
||||
restable->setRclMain(this, true);
|
||||
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
|
||||
restable, SLOT(setDocSource(RefCntr<DocSequence>)));
|
||||
connect(this, SIGNAL(searchReset()),
|
||||
@ -290,8 +292,7 @@ void RclMain::init()
|
||||
|
||||
connect(restable->getModel(), SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||
this, SLOT(onSortDataChanged(DocSeqSortSpec)));
|
||||
connect(restable, SIGNAL(docEditClicked(Rcl::Doc)),
|
||||
this, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
|
||||
connect(restable, SIGNAL(docPreviewClicked(int, Rcl::Doc, int)),
|
||||
this, SLOT(startPreview(int, Rcl::Doc, int)));
|
||||
connect(restable, SIGNAL(docExpand(Rcl::Doc)),
|
||||
@ -305,7 +306,7 @@ void RclMain::init()
|
||||
connect(restable, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
|
||||
this, SLOT(saveDocToFile(Rcl::Doc)));
|
||||
|
||||
reslist->setRclMain(this);
|
||||
reslist->setRclMain(this, true);
|
||||
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
|
||||
reslist, SLOT(setDocSource(RefCntr<DocSequence>)));
|
||||
connect(firstPageAction, SIGNAL(activated()),
|
||||
@ -321,8 +322,6 @@ void RclMain::init()
|
||||
|
||||
connect(reslist, SIGNAL(hasResults(int)),
|
||||
this, SLOT(resultCount(int)));
|
||||
connect(reslist, SIGNAL(docExpand(Rcl::Doc)),
|
||||
this, SLOT(docExpand(Rcl::Doc)));
|
||||
connect(reslist, SIGNAL(wordSelect(QString)),
|
||||
sSearch, SLOT(addTerm(QString)));
|
||||
connect(reslist, SIGNAL(wordReplace(const QString&, const QString&)),
|
||||
@ -331,8 +330,9 @@ void RclMain::init()
|
||||
this, SLOT(enableNextPage(bool)));
|
||||
connect(reslist, SIGNAL(prevPageAvailable(bool)),
|
||||
this, SLOT(enablePrevPage(bool)));
|
||||
connect(reslist, SIGNAL(docEditClicked(Rcl::Doc)),
|
||||
this, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
|
||||
connect(reslist, SIGNAL(docExpand(Rcl::Doc)),
|
||||
this, SLOT(docExpand(Rcl::Doc)));
|
||||
connect(reslist, SIGNAL(showSnippets(Rcl::Doc)),
|
||||
this, SLOT(showSnippets(Rcl::Doc)));
|
||||
connect(reslist, SIGNAL(showSubDocs(Rcl::Doc)),
|
||||
@ -1579,9 +1579,9 @@ void RclMain::showSubDocs(Rcl::Doc doc)
|
||||
RefCntr<DocSequence>
|
||||
source(new DocSource(theconfig, RefCntr<DocSequence>(src)));
|
||||
|
||||
ResList *res = new ResList();
|
||||
res->setRclMain(this);
|
||||
res->setIsMainList(0);
|
||||
ResTable *res = new ResTable();
|
||||
// ResList *res = new ResList();
|
||||
res->setRclMain(this, false);
|
||||
res->setDocSource(source);
|
||||
res->readDocSource();
|
||||
res->show();
|
||||
|
||||
@ -43,6 +43,7 @@ SOURCES += \
|
||||
crontool.cpp \
|
||||
guiutils.cpp \
|
||||
main.cpp \
|
||||
multisave.cpp \
|
||||
preview_w.cpp \
|
||||
ptrans_w.cpp \
|
||||
rclhelp.cpp \
|
||||
@ -67,6 +68,7 @@ FORMS = \
|
||||
firstidx.ui \
|
||||
idxsched.ui \
|
||||
listdialog.ui \
|
||||
multisave.ui \
|
||||
ptrans.ui \
|
||||
rclmain.ui \
|
||||
restable.ui \
|
||||
|
||||
@ -277,7 +277,7 @@ static PlainToRichQtReslist g_hiliter;
|
||||
|
||||
ResList::ResList(QWidget* parent, const char* name)
|
||||
: RESLIST_PARENTCLASS(parent), m_curPvDoc(-1), m_lstClckMod(0),
|
||||
m_listId(0), m_rclmain(0), m_ismainlist(true), m_coninit(false)
|
||||
m_listId(0), m_rclmain(0), m_ismainres(true)
|
||||
{
|
||||
if (!name)
|
||||
setObjectName("resList");
|
||||
@ -344,6 +344,24 @@ ResList::~ResList()
|
||||
};
|
||||
}
|
||||
|
||||
void ResList::setRclMain(RclMain *m, bool ismain)
|
||||
{
|
||||
m_rclmain = m;
|
||||
m_ismainres = ismain;
|
||||
if (!m_ismainres) {
|
||||
connect(new QShortcut(closeKeySeq, this), SIGNAL (activated()),
|
||||
this, SLOT (close()));
|
||||
connect(new QShortcut(quitKeySeq, this), SIGNAL (activated()),
|
||||
m_rclmain, SLOT (fileExit()));
|
||||
connect(this, SIGNAL(previewRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startPreview(Rcl::Doc)));
|
||||
connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
|
||||
m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
|
||||
connect(this, SIGNAL(editRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
}
|
||||
}
|
||||
|
||||
void ResList::setFont()
|
||||
{
|
||||
#ifdef RESLIST_TEXTBROWSER
|
||||
@ -379,21 +397,6 @@ void ResList::setDocSource(RefCntr<DocSequence> nsource)
|
||||
{
|
||||
LOGDEB(("ResList::setDocSource()\n"));
|
||||
m_source = RefCntr<DocSequence>(new DocSource(theconfig, nsource));
|
||||
if (!m_ismainlist && !m_coninit) {
|
||||
m_coninit = true;
|
||||
connect(new QShortcut(closeKeySeq, this), SIGNAL (activated()),
|
||||
this, SLOT (close()));
|
||||
connect(new QShortcut(quitKeySeq, this), SIGNAL (activated()),
|
||||
m_rclmain, SLOT (fileExit()));
|
||||
connect(this, SIGNAL(previewRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startPreview(Rcl::Doc)));
|
||||
connect(this, SIGNAL(docEditClicked(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
|
||||
m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
|
||||
connect(this, SIGNAL(editRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
}
|
||||
}
|
||||
|
||||
// A query was executed, or the filtering/sorting parameters changed,
|
||||
@ -912,13 +915,13 @@ void ResList::linkWasClicked(const QUrl &url)
|
||||
return;
|
||||
}
|
||||
if (what == 'P') {
|
||||
if (m_ismainlist) {
|
||||
if (m_ismainres) {
|
||||
emit docPreviewClicked(i, doc, m_lstClckMod);
|
||||
} else {
|
||||
emit previewRequested(doc);
|
||||
}
|
||||
} else {
|
||||
emit docEditClicked(doc);
|
||||
emit editRequested(doc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -979,8 +982,8 @@ void ResList::createPopupMenu(const QPoint& pos)
|
||||
if (!getDoc(m_popDoc, doc))
|
||||
return;
|
||||
int options = 0;
|
||||
if (m_ismainlist)
|
||||
options |= ResultPopup::showExpand;
|
||||
if (m_ismainres)
|
||||
options |= ResultPopup::isMain;
|
||||
QMenu *popup = ResultPopup::create(this, options, m_source, doc);
|
||||
popup->popup(mapToGlobal(pos));
|
||||
}
|
||||
@ -989,7 +992,7 @@ void ResList::menuPreview()
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
if (m_ismainlist) {
|
||||
if (m_ismainres) {
|
||||
emit docPreviewClicked(m_popDoc, doc, 0);
|
||||
} else {
|
||||
emit previewRequested(doc);
|
||||
@ -1042,7 +1045,7 @@ void ResList::menuEdit()
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc))
|
||||
emit docEditClicked(doc);
|
||||
emit editRequested(doc);
|
||||
}
|
||||
|
||||
void ResList::menuCopyFN()
|
||||
|
||||
@ -67,14 +67,8 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
int listId() const {return m_listId;}
|
||||
int pageFirstDocNum();
|
||||
void setFont();
|
||||
void setRclMain(RclMain *m)
|
||||
{
|
||||
m_rclmain = m;
|
||||
}
|
||||
void setIsMainList(bool onoff)
|
||||
{
|
||||
m_ismainlist = onoff;
|
||||
}
|
||||
void setRclMain(RclMain *m, bool ismain);
|
||||
|
||||
public slots:
|
||||
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
||||
virtual void resetList(); // Erase current list
|
||||
@ -104,7 +98,6 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
signals:
|
||||
void nextPageAvailable(bool);
|
||||
void prevPageAvailable(bool);
|
||||
void docEditClicked(Rcl::Doc);
|
||||
void docPreviewClicked(int, Rcl::Doc, int);
|
||||
void docSaveToFileClicked(Rcl::Doc);
|
||||
void previewRequested(Rcl::Doc);
|
||||
@ -145,8 +138,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
QString m_text;
|
||||
#endif
|
||||
RclMain *m_rclmain;
|
||||
bool m_ismainlist;
|
||||
bool m_coninit;
|
||||
bool m_ismainres;
|
||||
|
||||
virtual void displayPage(); // Display current page
|
||||
static int newListId();
|
||||
|
||||
@ -53,11 +53,11 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
||||
if (opts & showExpand)
|
||||
popup->addAction(me->tr("Find &similar documents"),
|
||||
me, SLOT(menuExpand()));
|
||||
if (doc.haspages && source->snippetsCapable())
|
||||
if (doc.haspages && source.isNotNull() && source->snippetsCapable())
|
||||
popup->addAction(me->tr("Open &Snippets window"),
|
||||
me, SLOT(menuOpenSnippets()));
|
||||
|
||||
if (rcldb && rcldb->hasSubDocs(doc))
|
||||
if ((opts & showSubs) && rcldb && rcldb->hasSubDocs(doc))
|
||||
popup->addAction(me->tr("Show subdocuments / attachments"),
|
||||
me, SLOT(menuShowSubDocs()));
|
||||
return popup;
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#define _RESPOPUP_H_INCLUDED_
|
||||
|
||||
namespace ResultPopup {
|
||||
enum Options {showExpand = 0x1};
|
||||
enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3};
|
||||
extern QMenu *create(QWidget *me, int opts,
|
||||
RefCntr<DocSequence> source,
|
||||
Rcl::Doc& doc);
|
||||
|
||||
@ -46,6 +46,10 @@
|
||||
#include "plaintorich.h"
|
||||
#include "indexer.h"
|
||||
#include "respopup.h"
|
||||
#include "rclmain_w.h"
|
||||
|
||||
static const QKeySequence quitKeySeq("Ctrl+q");
|
||||
static const QKeySequence closeKeySeq("Ctrl+w");
|
||||
|
||||
// Compensate for the default and somewhat bizarre vertical placement
|
||||
// of text in cells
|
||||
@ -133,14 +137,14 @@ ResTableDetailArea::ResTableDetailArea(ResTable* parent)
|
||||
|
||||
void ResTableDetailArea::createPopupMenu(const QPoint& pos)
|
||||
{
|
||||
if (!m_table || m_table->m_detaildocnum < 0) {
|
||||
LOGDEB(("ResTableDetailArea::createPopupMenu: no table/detaildoc\n"));
|
||||
return;
|
||||
if (m_table && m_table->m_model && m_table->m_detaildocnum >= 0) {
|
||||
QMenu *popup =
|
||||
ResultPopup::create(m_table, m_table->m_ismainres ?
|
||||
ResultPopup::showExpand : 0,
|
||||
m_table->m_model->getDocSource(),
|
||||
m_table->m_detaildoc);
|
||||
popup->popup(mapToGlobal(pos));
|
||||
}
|
||||
QMenu *popup = ResultPopup::create(m_table, ResultPopup::showExpand,
|
||||
m_table->m_model->getDocSource(),
|
||||
m_table->m_detaildoc);
|
||||
popup->popup(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -478,7 +482,7 @@ void ResTable::init()
|
||||
tableView->setModel(m_model);
|
||||
tableView->setMouseTracking(true);
|
||||
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
|
||||
tableView->setItemDelegate(new ResTableDelegate(this));
|
||||
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||
@ -512,7 +516,8 @@ void ResTable::init()
|
||||
QShortcut *sc = new QShortcut(seq, this);
|
||||
connect(sc, SIGNAL (activated()),
|
||||
tableView->selectionModel(), SLOT (clear()));
|
||||
connect(tableView->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex &)),
|
||||
connect(tableView->selectionModel(),
|
||||
SIGNAL(currentChanged(const QModelIndex&, const QModelIndex &)),
|
||||
this, SLOT(onTableView_currentChanged(const QModelIndex&)));
|
||||
|
||||
m_pager = new ResTablePager(this);
|
||||
@ -539,6 +544,24 @@ void ResTable::init()
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
}
|
||||
|
||||
void ResTable::setRclMain(RclMain *m, bool ismain)
|
||||
{
|
||||
m_rclmain = m;
|
||||
m_ismainres = ismain;
|
||||
if (!m_ismainres) {
|
||||
connect(new QShortcut(closeKeySeq, this), SIGNAL (activated()),
|
||||
this, SLOT (close()));
|
||||
connect(new QShortcut(quitKeySeq, this), SIGNAL (activated()),
|
||||
m_rclmain, SLOT (fileExit()));
|
||||
connect(this, SIGNAL(previewRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startPreview(Rcl::Doc)));
|
||||
connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)),
|
||||
m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
|
||||
connect(this, SIGNAL(editRequested(Rcl::Doc)),
|
||||
m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
}
|
||||
}
|
||||
|
||||
int ResTable::getDetailDocNumOrTopRow()
|
||||
{
|
||||
if (m_detaildocnum >= 0)
|
||||
@ -560,6 +583,8 @@ void ResTable::makeRowVisible(int row)
|
||||
// This is called by rclmain_w prior to exiting
|
||||
void ResTable::saveColState()
|
||||
{
|
||||
if (!m_ismainres)
|
||||
return;
|
||||
QSettings settings;
|
||||
settings.setValue("resTableSplitterSizes", splitter->saveState());
|
||||
|
||||
@ -718,7 +743,7 @@ void ResTable::linkWasClicked(const QUrl &url)
|
||||
if (what == 'P')
|
||||
emit docPreviewClicked(i, m_detaildoc, 0);
|
||||
else
|
||||
emit docEditClicked(m_detaildoc);
|
||||
emit editRequested(m_detaildoc);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -730,19 +755,23 @@ void ResTable::linkWasClicked(const QUrl &url)
|
||||
void ResTable::createPopupMenu(const QPoint& pos)
|
||||
{
|
||||
LOGDEB(("ResTable::createPopupMenu: m_detaildocnum %d\n", m_detaildocnum));
|
||||
if (m_detaildocnum < 0)
|
||||
return;
|
||||
QMenu *popup = ResultPopup::create(this, ResultPopup::showExpand,
|
||||
m_model->getDocSource(),
|
||||
m_detaildoc);
|
||||
popup->popup(mapToGlobal(pos));
|
||||
if (m_detaildocnum >= 0 && m_model) {
|
||||
QMenu *popup =
|
||||
ResultPopup::create(this, m_ismainres? ResultPopup::isMain : 0,
|
||||
m_model->getDocSource(), m_detaildoc);
|
||||
popup->popup(mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void ResTable::menuPreview()
|
||||
{
|
||||
if (m_detaildocnum < 0)
|
||||
return;
|
||||
emit docPreviewClicked(m_detaildocnum, m_detaildoc, 0);
|
||||
if (m_detaildocnum >= 0) {
|
||||
if (m_ismainres) {
|
||||
emit docPreviewClicked(m_detaildocnum, m_detaildoc, 0);
|
||||
} else {
|
||||
emit previewRequested(m_detaildoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResTable::menuSaveToFile()
|
||||
@ -775,7 +804,7 @@ void ResTable::menuOpenParent()
|
||||
void ResTable::menuEdit()
|
||||
{
|
||||
if (m_detaildocnum >= 0)
|
||||
emit docEditClicked(m_detaildoc);
|
||||
emit editRequested(m_detaildoc);
|
||||
}
|
||||
|
||||
void ResTable::menuCopyFN()
|
||||
@ -850,10 +879,7 @@ void ResTable::addColumn()
|
||||
if (!m_model)
|
||||
return;
|
||||
QAction *action = (QAction *)sender();
|
||||
LOGDEB(("addColumn: text %s, data %s\n",
|
||||
(const char *)action->text().toUtf8(),
|
||||
(const char *)action->data().toString().toUtf8()
|
||||
));
|
||||
string field((const char *)action->data().toString().toUtf8());
|
||||
m_model->addColumn(m_popcolumn, field);
|
||||
LOGDEB(("addColumn: text %s, data %s\n", qs2utf8s(action->text()).c_str(),
|
||||
qs2utf8s(action->data().toString()).c_str()));
|
||||
m_model->addColumn(m_popcolumn, qs2utf8s(action->data().toString()));
|
||||
}
|
||||
|
||||
@ -100,6 +100,7 @@ private:
|
||||
|
||||
class ResTablePager;
|
||||
class QUrl;
|
||||
class RclMain;
|
||||
|
||||
class ResTable : public QWidget, public Ui::ResTable
|
||||
{
|
||||
@ -108,7 +109,8 @@ class ResTable : public QWidget, public Ui::ResTable
|
||||
public:
|
||||
ResTable(QWidget* parent = 0)
|
||||
: QWidget(parent),
|
||||
m_model(0), m_pager(0), m_detail(0), m_detaildocnum(-1)
|
||||
m_model(0), m_pager(0), m_detail(0), m_detaildocnum(-1),
|
||||
m_rclmain(0), m_ismainres(true)
|
||||
{
|
||||
setupUi(this);
|
||||
init();
|
||||
@ -119,6 +121,8 @@ public:
|
||||
virtual ResTableDetailArea* getDetailArea() {return m_detail;}
|
||||
virtual int getDetailDocNumOrTopRow();
|
||||
|
||||
void setRclMain(RclMain *m, bool ismain);
|
||||
|
||||
public slots:
|
||||
virtual void onTableView_currentChanged(const QModelIndex&);
|
||||
virtual void on_tableView_entered(const QModelIndex& index);
|
||||
@ -147,7 +151,6 @@ public slots:
|
||||
|
||||
signals:
|
||||
void docPreviewClicked(int, Rcl::Doc, int);
|
||||
void docEditClicked(Rcl::Doc);
|
||||
void docSaveToFileClicked(Rcl::Doc);
|
||||
void previewRequested(Rcl::Doc);
|
||||
void editRequested(Rcl::Doc);
|
||||
@ -165,6 +168,8 @@ private:
|
||||
int m_detaildocnum;
|
||||
Rcl::Doc m_detaildoc;
|
||||
int m_popcolumn;
|
||||
RclMain *m_rclmain;
|
||||
bool m_ismainres;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user