mode 700 on .recoll. move showquerydetails to rclreslist
This commit is contained in:
+13
-61
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.22 2006-04-18 08:53:28 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.23 2006-04-20 09:20:09 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -81,7 +81,6 @@ void RclMain::init()
|
||||
curPreview = 0;
|
||||
asearchform = 0;
|
||||
sortform = 0;
|
||||
sortwidth = 0;
|
||||
uiprefs = 0;
|
||||
|
||||
// Set the focus to the search terms entry:
|
||||
@@ -297,15 +296,14 @@ void RclMain::startAdvSearch(Rcl::AdvSearchData sdata)
|
||||
curPreview = 0;
|
||||
|
||||
DocSequence *docsource;
|
||||
if (sortwidth > 0) {
|
||||
if (sortspecs.sortwidth > 0) {
|
||||
DocSequenceDb myseq(rcldb, string(tr("Query results").utf8()));
|
||||
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
||||
docsource = new DocSeqSorted(myseq, sortspecs,
|
||||
string(tr("Query results (sorted)").utf8()));
|
||||
} else {
|
||||
docsource = new DocSequenceDb(rcldb, string(tr("Query results").utf8()));
|
||||
}
|
||||
currentQueryData = sdata;
|
||||
resList->setDocSource(docsource);
|
||||
resList->setDocSource(docsource, sdata);
|
||||
}
|
||||
|
||||
// Open advanced search dialog.
|
||||
@@ -333,8 +331,8 @@ void RclMain::showSortDialog()
|
||||
WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu);
|
||||
sortform->setSizeGripEnabled(FALSE);
|
||||
connect(sortform, SIGNAL(sortDataChanged(int, RclSortSpec)),
|
||||
this, SLOT(sortDataChanged(int, RclSortSpec)));
|
||||
connect(sortform, SIGNAL(sortDataChanged(RclSortSpec)),
|
||||
this, SLOT(sortDataChanged(RclSortSpec)));
|
||||
sortform->show();
|
||||
} else {
|
||||
// Close and reopen, in hope that makes us visible...
|
||||
@@ -408,8 +406,7 @@ void RclMain::startPreview(int docnum)
|
||||
QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
|
||||
curPreview->setCaption(QString::fromUtf8(currentQueryData.description.c_str()));
|
||||
curPreview->setCaption(resList->getDescription());
|
||||
connect(curPreview, SIGNAL(previewClosed(QWidget *)),
|
||||
this, SLOT(previewClosed(QWidget *)));
|
||||
curPreview->show();
|
||||
@@ -511,24 +508,23 @@ void RclMain::showDocHistory()
|
||||
}
|
||||
|
||||
DocSequence *docsource;
|
||||
if (sortwidth > 0) {
|
||||
if (sortspecs.sortwidth > 0) {
|
||||
DocSequenceHistory myseq(rcldb, m_history, string(tr("Document history").utf8()));
|
||||
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
|
||||
docsource = new DocSeqSorted(myseq, sortspecs,
|
||||
string(tr("Document history (sorted)").utf8()));
|
||||
} else {
|
||||
docsource = new DocSequenceHistory(rcldb, m_history,
|
||||
string(tr("Document history").utf8()));
|
||||
}
|
||||
currentQueryData.erase();
|
||||
currentQueryData.description = tr("History data").utf8();
|
||||
resList->setDocSource(docsource);
|
||||
Rcl::AdvSearchData sdata;
|
||||
sdata.description = tr("History data").utf8();
|
||||
resList->setDocSource(docsource, sdata);
|
||||
}
|
||||
|
||||
|
||||
void RclMain::sortDataChanged(int cnt, RclSortSpec spec)
|
||||
void RclMain::sortDataChanged(RclSortSpec spec)
|
||||
{
|
||||
LOGDEB(("RclMain::sortDataChanged\n"));
|
||||
sortwidth = cnt;
|
||||
sortspecs = spec;
|
||||
}
|
||||
|
||||
@@ -556,47 +552,3 @@ void RclMain::enablePrevPage(bool yesno)
|
||||
prevPageAction->setEnabled(yesno);
|
||||
}
|
||||
|
||||
/** Show detailed expansion of a query */
|
||||
void RclMain::showQueryDetails()
|
||||
{
|
||||
// Break query into lines of reasonable length, avoid cutting words,
|
||||
// Also limit the total number of lines.
|
||||
const unsigned int ll = 100;
|
||||
const unsigned int maxlines = 50;
|
||||
string query = currentQueryData.description;
|
||||
string oq;
|
||||
unsigned int nlines = 0;
|
||||
while (query.length() > 0) {
|
||||
string ss = query.substr(0, ll);
|
||||
if (ss.length() == ll) {
|
||||
string::size_type pos = ss.find_last_of(" ");
|
||||
if (pos == string::npos) {
|
||||
pos = query.find_first_of(" ");
|
||||
if (pos != string::npos)
|
||||
ss = query.substr(0, pos+1);
|
||||
else
|
||||
ss = query;
|
||||
} else {
|
||||
ss = ss.substr(0, pos+1);
|
||||
}
|
||||
}
|
||||
// This cant happen, but anyway. Be very sure to avoid an infinite loop
|
||||
if (ss.length() == 0) {
|
||||
LOGDEB(("showQueryDetails: Internal error!\n"));
|
||||
oq = query;
|
||||
break;
|
||||
}
|
||||
oq += ss + "\n";
|
||||
if (nlines++ >= maxlines) {
|
||||
oq += " ... \n";
|
||||
break;
|
||||
}
|
||||
query= query.substr(ss.length());
|
||||
LOGDEB1(("oq [%s]\n, query [%s]\n, ss [%s]\n",
|
||||
oq.c_str(), query.c_str(), ss.c_str()));
|
||||
}
|
||||
|
||||
QString desc = tr("Query details") + ": " +
|
||||
QString::fromUtf8(oq.c_str());
|
||||
QMessageBox::information(this, tr("Query details"), desc);
|
||||
}
|
||||
|
||||
+4
-7
@@ -40,7 +40,7 @@ public:
|
||||
: RclMainBase(parent,name,fl) {
|
||||
init();
|
||||
}
|
||||
~RclMain() {}
|
||||
~RclMain() {}
|
||||
|
||||
virtual bool close( bool );
|
||||
|
||||
@@ -48,26 +48,23 @@ public slots:
|
||||
virtual void fileExit();
|
||||
virtual void periodic100();
|
||||
virtual void fileStart_IndexingAction_activated();
|
||||
virtual void startAdvSearch( Rcl::AdvSearchData sdata );
|
||||
virtual void previewClosed( QWidget * w );
|
||||
virtual void startAdvSearch(Rcl::AdvSearchData sdata);
|
||||
virtual void previewClosed(QWidget * w);
|
||||
virtual void showAdvSearchDialog();
|
||||
virtual void showSortDialog();
|
||||
virtual void showAboutDialog();
|
||||
virtual void startManual();
|
||||
virtual void showDocHistory();
|
||||
virtual void sortDataChanged( int cnt, RclSortSpec spec );
|
||||
virtual void sortDataChanged(RclSortSpec spec);
|
||||
virtual void showUIPrefs();
|
||||
virtual void setUIPrefs();
|
||||
virtual void enableNextPage(bool);
|
||||
virtual void enablePrevPage(bool);
|
||||
virtual void showQueryDetails();
|
||||
protected:
|
||||
Preview *curPreview;
|
||||
advsearch *asearchform;
|
||||
Rcl::AdvSearchData currentQueryData;
|
||||
SortForm *sortform;
|
||||
UIPrefsDialog *uiprefs;
|
||||
int sortwidth;
|
||||
RclSortSpec sortspecs;
|
||||
RclDHistory *m_history;
|
||||
private:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.12 2006-04-19 08:26:08 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.13 2006-04-20 09:20:09 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@@ -46,7 +46,7 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
||||
connect(this, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)));
|
||||
connect(this, SIGNAL(linkClicked(const QString &)),
|
||||
this, SLOT(linkWasClicked(const QString &)));
|
||||
|
||||
connect(this, SIGNAL(headerClicked()), this, SLOT(showQueryDetails()));
|
||||
m_winfirst = -1;
|
||||
m_docsource = 0;
|
||||
}
|
||||
@@ -64,11 +64,12 @@ void RclResList::languageChange()
|
||||
}
|
||||
|
||||
// Acquire new docsource
|
||||
void RclResList::setDocSource(DocSequence *docsource)
|
||||
void RclResList::setDocSource(DocSequence *docsource, Rcl::AdvSearchData& sdt)
|
||||
{
|
||||
if (m_docsource)
|
||||
delete m_docsource;
|
||||
m_docsource = docsource;
|
||||
m_queryData = sdt;
|
||||
showResultPage();
|
||||
}
|
||||
|
||||
@@ -466,3 +467,53 @@ void RclResList::menuCopyURL()
|
||||
QClipboard::Selection);
|
||||
}
|
||||
}
|
||||
|
||||
QString RclResList::getDescription()
|
||||
{
|
||||
return QString::fromUtf8(m_queryData.description.c_str());
|
||||
}
|
||||
|
||||
/** Show detailed expansion of a query */
|
||||
void RclResList::showQueryDetails()
|
||||
{
|
||||
// Break query into lines of reasonable length, avoid cutting words,
|
||||
// Also limit the total number of lines.
|
||||
const unsigned int ll = 100;
|
||||
const unsigned int maxlines = 50;
|
||||
string query = m_queryData.description;
|
||||
string oq;
|
||||
unsigned int nlines = 0;
|
||||
while (query.length() > 0) {
|
||||
string ss = query.substr(0, ll);
|
||||
if (ss.length() == ll) {
|
||||
string::size_type pos = ss.find_last_of(" ");
|
||||
if (pos == string::npos) {
|
||||
pos = query.find_first_of(" ");
|
||||
if (pos != string::npos)
|
||||
ss = query.substr(0, pos+1);
|
||||
else
|
||||
ss = query;
|
||||
} else {
|
||||
ss = ss.substr(0, pos+1);
|
||||
}
|
||||
}
|
||||
// This cant happen, but anyway. Be very sure to avoid an infinite loop
|
||||
if (ss.length() == 0) {
|
||||
LOGDEB(("showQueryDetails: Internal error!\n"));
|
||||
oq = query;
|
||||
break;
|
||||
}
|
||||
oq += ss + "\n";
|
||||
if (nlines++ >= maxlines) {
|
||||
oq += " ... \n";
|
||||
break;
|
||||
}
|
||||
query= query.substr(ss.length());
|
||||
LOGDEB1(("oq [%s]\n, query [%s]\n, ss [%s]\n",
|
||||
oq.c_str(), query.c_str(), ss.c_str()));
|
||||
}
|
||||
|
||||
QString desc = tr("Query details") + ": " +
|
||||
QString::fromUtf8(oq.c_str());
|
||||
QMessageBox::information(this, tr("Query details"), desc);
|
||||
}
|
||||
|
||||
+12
-8
@@ -1,12 +1,13 @@
|
||||
#ifndef _RCLRESLIST_H_INCLUDED_
|
||||
#define _RCLRESLIST_H_INCLUDED_
|
||||
/* @(#$Id: rclreslist.h,v 1.5 2006-04-18 08:53:28 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
/* @(#$Id: rclreslist.h,v 1.6 2006-04-20 09:20:10 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
|
||||
#include <qtextbrowser.h>
|
||||
#include <qpopupmenu.h>
|
||||
|
||||
#include "rcldb.h"
|
||||
#include "docseq.h"
|
||||
#include "searchdata.h"
|
||||
|
||||
class RclResList : public QTextBrowser
|
||||
{
|
||||
@@ -17,8 +18,9 @@ class RclResList : public QTextBrowser
|
||||
virtual ~RclResList();
|
||||
|
||||
virtual bool getDoc( int, Rcl::Doc & );
|
||||
virtual void setDocSource(DocSequence *);
|
||||
virtual void setDocSource(DocSequence *, Rcl::AdvSearchData& qdata);
|
||||
virtual QPopupMenu *createPopupMenu(const QPoint& pos);
|
||||
virtual QString getDescription();
|
||||
|
||||
public slots:
|
||||
virtual void resetSearch() {m_winfirst = -1;clear();}
|
||||
@@ -45,15 +47,17 @@ class RclResList : public QTextBrowser
|
||||
protected slots:
|
||||
virtual void languageChange();
|
||||
virtual void linkWasClicked(const QString &);
|
||||
virtual void showQueryDetails();
|
||||
|
||||
private:
|
||||
std::map<int,int> m_pageParaToReldocnums;
|
||||
virtual int docnumfromparnum(int);
|
||||
|
||||
DocSequence *m_docsource;
|
||||
std::map<int,int> m_pageParaToReldocnums;
|
||||
Rcl::AdvSearchData m_queryData;
|
||||
DocSequence *m_docsource;
|
||||
std::vector<Rcl::Doc> m_curDocs;
|
||||
int m_winfirst;
|
||||
int m_docnum; // Docnum matching the
|
||||
int m_winfirst;
|
||||
int m_docnum; // Docnum matching the
|
||||
|
||||
virtual int docnumfromparnum(int);
|
||||
void emitLinkClicked(const QString &s) {
|
||||
emit linkClicked(s);
|
||||
};
|
||||
|
||||
@@ -388,12 +388,6 @@
|
||||
<receiver>RclMainBase</receiver>
|
||||
<slot>startPreview(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>resList</sender>
|
||||
<signal>headerClicked()</signal>
|
||||
<receiver>RclMainBase</receiver>
|
||||
<slot>showQueryDetails()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in declaration">ssearchb.h</include>
|
||||
@@ -415,7 +409,6 @@
|
||||
<slot>enablePrevPage(bool)</slot>
|
||||
<slot>startNativeViewer(int)</slot>
|
||||
<slot>startPreview(int)</slot>
|
||||
<slot>showQueryDetails()</slot>
|
||||
</slots>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
|
||||
@@ -70,6 +70,3 @@ void RclMainBase::startNativeViewer(int)
|
||||
void RclMainBase::startPreview(int)
|
||||
{
|
||||
}
|
||||
void RclMainBase::showQueryDetails()
|
||||
{
|
||||
}
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@
|
||||
<include location="local" impldecl="in implementation">sort.ui.h</include>
|
||||
</includes>
|
||||
<signals>
|
||||
<signal>sortDataChanged(int, RclSortSpec)</signal>
|
||||
<signal>sortDataChanged(RclSortSpec)</signal>
|
||||
</signals>
|
||||
<slots>
|
||||
<slot>reset()</slot>
|
||||
|
||||
+3
-4
@@ -57,7 +57,6 @@ void SortForm::setData()
|
||||
{
|
||||
LOGDEB(("SortForm::setData\n"));
|
||||
RclSortSpec spec;
|
||||
int width;
|
||||
|
||||
mcntSB->setEnabled(sortCB->isChecked());
|
||||
fldCMB1->setEnabled(sortCB->isChecked());
|
||||
@@ -66,7 +65,7 @@ void SortForm::setData()
|
||||
descCB2->setEnabled(sortCB->isChecked());
|
||||
|
||||
if (!sortCB->isChecked()) {
|
||||
width = 0;
|
||||
spec.sortwidth = 0;
|
||||
} else {
|
||||
bool desc = descCB1->isChecked();
|
||||
switch (fldCMB1->currentItem()) {
|
||||
@@ -87,7 +86,7 @@ void SortForm::setData()
|
||||
spec.addCrit(RclSortSpec::RCLFLD_MIMETYPE, desc?true:false);
|
||||
break;
|
||||
}
|
||||
width = mcntSB->value();
|
||||
spec.sortwidth = mcntSB->value();
|
||||
}
|
||||
emit sortDataChanged(width, spec);
|
||||
emit sortDataChanged(spec);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,11 @@ void SSearchBase::completion()
|
||||
{
|
||||
if (!rcldb)
|
||||
return;
|
||||
|
||||
if (searchTypCMB->currentItem() == 2) {
|
||||
// Filename: no completion
|
||||
QApplication::beep();
|
||||
return;
|
||||
}
|
||||
// Extract last word in text
|
||||
string txt = (const char *)queryText->text().utf8();
|
||||
string::size_type cs = txt.find_last_of(" ");
|
||||
|
||||
Reference in New Issue
Block a user