ckpt
This commit is contained in:
parent
fb3a94578c
commit
acea982406
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.1 2006-03-21 09:15:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.2 2006-03-21 13:27:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -40,8 +40,11 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
|||||||
clearWState( WState_Polished );
|
clearWState( WState_Polished );
|
||||||
|
|
||||||
// signals and slots connections
|
// signals and slots connections
|
||||||
connect(this, SIGNAL( doubleClicked( int , int ) ), this, SLOT( doubleClicked(int,int) ) );
|
connect(this, SIGNAL(doubleClicked(int, int)),
|
||||||
connect(this, SIGNAL( clicked( int , int ) ), this, SLOT( clicked(int,int) ) );
|
this, SLOT(doubleClicked(int,int)));
|
||||||
|
connect(this, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)));
|
||||||
|
connect(this, SIGNAL(linkClicked(const QString &)),
|
||||||
|
this, SLOT(linkWasClicked(const QString &)));
|
||||||
|
|
||||||
|
|
||||||
// Code from init:
|
// Code from init:
|
||||||
@ -53,8 +56,6 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
|||||||
m_waitingdbl = false;
|
m_waitingdbl = false;
|
||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
m_docsource = 0;
|
m_docsource = 0;
|
||||||
connect(this, SIGNAL(linkClicked(const QString &)),
|
|
||||||
this, SLOT(linkWasClicked(const QString &)));
|
|
||||||
viewport()->installEventFilter(this);
|
viewport()->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +66,6 @@ RclResList::~RclResList()
|
|||||||
delete m_docsource;
|
delete m_docsource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RclResList::languageChange()
|
void RclResList::languageChange()
|
||||||
{
|
{
|
||||||
setCaption( tr( "Result list" ) );
|
setCaption( tr( "Result list" ) );
|
||||||
@ -108,11 +108,13 @@ int RclResList::reldocnumfromparnum(int par)
|
|||||||
void RclResList::doubleClicked(int par, int )
|
void RclResList::doubleClicked(int par, int )
|
||||||
{
|
{
|
||||||
LOGDEB(("RclResList::doubleClicked: par %d\n", par));
|
LOGDEB(("RclResList::doubleClicked: par %d\n", par));
|
||||||
|
#if 0
|
||||||
m_dblclck = true;
|
m_dblclck = true;
|
||||||
int reldocnum = reldocnumfromparnum(par);
|
int reldocnum = reldocnumfromparnum(par);
|
||||||
if (reldocnum < 0)
|
if (reldocnum < 0)
|
||||||
return;
|
return;
|
||||||
emit docDoubleClicked(m_winfirst + reldocnum);
|
emit docDoubleClicked(m_winfirst + reldocnum);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single click in result list: we don't actually do anything but
|
// Single click in result list: we don't actually do anything but
|
||||||
@ -120,6 +122,7 @@ void RclResList::doubleClicked(int par, int )
|
|||||||
// double click
|
// double click
|
||||||
void RclResList::clicked(int par, int car)
|
void RclResList::clicked(int par, int car)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (m_waitingdbl)
|
if (m_waitingdbl)
|
||||||
return;
|
return;
|
||||||
LOGDEB(("RclResList::clicked:wfirst %d par %d char %d drg %d\n",
|
LOGDEB(("RclResList::clicked:wfirst %d par %d char %d drg %d\n",
|
||||||
@ -134,6 +137,7 @@ void RclResList::clicked(int par, int car)
|
|||||||
m_dblclck = false;
|
m_dblclck = false;
|
||||||
// Wait to see if there's going to be a dblclck
|
// Wait to see if there's going to be a dblclck
|
||||||
QTimer::singleShot(150, this, SLOT(delayedClick()) );
|
QTimer::singleShot(150, this, SLOT(delayedClick()) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +172,7 @@ void RclResList::delayedClick()
|
|||||||
int reldocnum = reldocnumfromparnum(par);
|
int reldocnum = reldocnumfromparnum(par);
|
||||||
|
|
||||||
if (reldocnum < 0) {
|
if (reldocnum < 0) {
|
||||||
emit headerClicked();
|
// emit headerClicked();
|
||||||
} else {
|
} else {
|
||||||
emit docClicked(m_winfirst + reldocnum);
|
emit docClicked(m_winfirst + reldocnum);
|
||||||
}
|
}
|
||||||
@ -246,6 +250,7 @@ void RclResList::resultPageBack()
|
|||||||
showResultPage();
|
showResultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert byte count into unit (KB/MB...) appropriate for display
|
||||||
static string displayableBytes(long size)
|
static string displayableBytes(long size)
|
||||||
{
|
{
|
||||||
char sizebuf[30];
|
char sizebuf[30];
|
||||||
@ -326,16 +331,22 @@ void RclResList::showResultPage()
|
|||||||
// We could use a <title> but the textedit doesnt display
|
// We could use a <title> but the textedit doesnt display
|
||||||
// it prominently
|
// it prominently
|
||||||
append("<qt><head></head><body>");
|
append("<qt><head></head><body>");
|
||||||
QString line = "<p><font size=+1><b>";
|
// Note: have to append text in chunks that make sense
|
||||||
line += m_docsource->title().c_str();
|
// html-wise. If we break things up to much, the editor
|
||||||
line += "</b></font><br>";
|
// gets confused. Hence the use of the 'chunk' text
|
||||||
append(line);
|
// accumulator
|
||||||
line = tr("<b>Displaying results starting at index"
|
QString chunk = "<p><font size=+1><b>";
|
||||||
|
chunk += m_docsource->title().c_str();
|
||||||
|
chunk += "</b></font><br>";
|
||||||
|
chunk += "<a href=\"H-1\">";
|
||||||
|
chunk += tr("Show query details");
|
||||||
|
chunk += "</a><br>";
|
||||||
|
append(chunk);
|
||||||
|
chunk = tr("<b>Displaying results starting at index"
|
||||||
" %1 (maximum set size %2)</b></p>\n")
|
" %1 (maximum set size %2)</b></p>\n")
|
||||||
.arg(m_winfirst+1)
|
.arg(m_winfirst+1)
|
||||||
.arg(resCnt);
|
.arg(resCnt);
|
||||||
append(line);
|
append(chunk);
|
||||||
append("<a href=\"Une certaine valeur\">Ceci est un lien</a>\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gotone = true;
|
gotone = true;
|
||||||
@ -396,18 +407,27 @@ void RclResList::showResultPage()
|
|||||||
if (!sh.empty())
|
if (!sh.empty())
|
||||||
result += string("<p><b>") + sh + "</p>\n<p>";
|
result += string("<p><b>") + sh + "</p>\n<p>";
|
||||||
else
|
else
|
||||||
result = "<p>";
|
result += "<p>";
|
||||||
|
result += string(perbuf) + sizebuf + "<b>" + doc.title + "</b><br>";
|
||||||
|
result += doc.mimetype + " ";
|
||||||
|
result += string(datebuf) + " ";
|
||||||
|
char vlbuf[100];
|
||||||
|
sprintf(vlbuf, "\"P%d\"", m_winfirst+i);
|
||||||
|
result += string("<a href=") + vlbuf + ">" + "Preview" + "</a>"
|
||||||
|
+ " ";
|
||||||
|
sprintf(vlbuf, "E%d", m_winfirst+i);
|
||||||
|
result += string("<a href=") + vlbuf + ">" + "Edit" + "</a>";
|
||||||
|
result += string("<br>");
|
||||||
|
|
||||||
if (!img_name.empty()) {
|
if (!img_name.empty()) {
|
||||||
result += "<img source=\"" + img_name + "\" align=\"left\">";
|
result += "<img source=\"" + img_name + "\" align=\"left\">";
|
||||||
}
|
}
|
||||||
result += string(perbuf) + sizebuf + "<b>" + doc.title + "</b><br>";
|
|
||||||
result += doc.mimetype + " " +
|
|
||||||
(datebuf[0] ? string(datebuf) + "<br>" : string("<br>"));
|
|
||||||
result += "<i>" + doc.url + +"</i><br>";
|
result += "<i>" + doc.url + +"</i><br>";
|
||||||
if (!abst.empty())
|
if (!abst.empty())
|
||||||
result += abst + "<br>";
|
result += abst + "<br>";
|
||||||
if (!doc.keywords.empty())
|
if (!doc.keywords.empty())
|
||||||
result += doc.keywords + "<br>";
|
result += doc.keywords + "<br>";
|
||||||
|
|
||||||
result += "</p>\n";
|
result += "</p>\n";
|
||||||
|
|
||||||
QString str = QString::fromUtf8(result.c_str(), result.length());
|
QString str = QString::fromUtf8(result.c_str(), result.length());
|
||||||
@ -458,5 +478,18 @@ void RclResList::showResultPage()
|
|||||||
void RclResList::linkWasClicked(const QString &s)
|
void RclResList::linkWasClicked(const QString &s)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclResList::linkClicked: [%s]\n", s.ascii()));
|
LOGDEB(("RclResList::linkClicked: [%s]\n", s.ascii()));
|
||||||
|
int i = atoi(s.ascii()+1);
|
||||||
|
int what = s.ascii()[0];
|
||||||
|
switch (what) {
|
||||||
|
case 'H':
|
||||||
|
emit headerClicked();
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
emit docClicked(i);
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
emit docDoubleClicked(i);
|
||||||
|
break;
|
||||||
|
default: break;// ??
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user