dblclck in reslist adds to search lineedit
This commit is contained in:
parent
4646f62d6b
commit
4718c4016d
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.24 2006-04-22 06:27:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.25 2006-04-26 11:29:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -97,6 +97,8 @@ void RclMain::init()
|
||||
this, SLOT(startAdvSearch(Rcl::AdvSearchData)));
|
||||
connect(sSearch, SIGNAL(clearSearch()), resList, SLOT(resetSearch()));
|
||||
connect(resList, SIGNAL(docExpand(int)), this, SLOT(docExpand(int)));
|
||||
connect(resList, SIGNAL(wordSelect(QString)),
|
||||
this, SLOT(ssearchAddTerm(QString)));
|
||||
|
||||
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
||||
prevPageAction->setIconSet(createIconSet("prevpage.png"));
|
||||
@ -431,8 +433,30 @@ void RclMain::startPreview(int docnum)
|
||||
curPreview->closeCurrentTab();
|
||||
}
|
||||
|
||||
// Add term to simple search. Term comes out of double-click in
|
||||
// reslist or preview. The cleanup code is really horrible. Selection
|
||||
// out of the reslist will typically look like
|
||||
// <!-- Fragment -->sometext
|
||||
// It would probably be better to cleanup in preview.ui.h and
|
||||
// rclreslist.cpp and do the proper html stuff in the latter case
|
||||
// (which is different because it's format is explicit richtext
|
||||
// instead of auto as for preview, needed because it's built by
|
||||
// fragments?).
|
||||
static const char* punct = " \t()<>\"'[]{}!^*,";
|
||||
void RclMain::ssearchAddTerm(QString term)
|
||||
{
|
||||
string t = (const char *)term.utf8();
|
||||
string::size_type pos = t.find_last_not_of(punct);
|
||||
if (pos == string::npos)
|
||||
return;
|
||||
t = t.substr(0, pos+1);
|
||||
pos = t.find_last_of(punct);
|
||||
if (pos != string::npos)
|
||||
t = t.substr(pos+1);
|
||||
if (t.empty())
|
||||
return;
|
||||
term = QString::fromUtf8(t.c_str());
|
||||
|
||||
QString text = sSearch->queryText->text();
|
||||
text += QString::fromLatin1(" ") + term;
|
||||
sSearch->queryText->setText(text);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.14 2006-04-22 06:27:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.15 2006-04-26 11:29:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@ -35,7 +35,7 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
||||
{
|
||||
if (!name)
|
||||
setName("rclResList");
|
||||
setTextFormat(RclResList::RichText);
|
||||
setTextFormat(Qt::RichText);
|
||||
setReadOnly(TRUE);
|
||||
setUndoRedoEnabled(FALSE);
|
||||
languageChange();
|
||||
@ -47,6 +47,8 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
||||
connect(this, SIGNAL(linkClicked(const QString &)),
|
||||
this, SLOT(linkWasClicked(const QString &)));
|
||||
connect(this, SIGNAL(headerClicked()), this, SLOT(showQueryDetails()));
|
||||
connect(this, SIGNAL(doubleClicked(int,int)),
|
||||
this, SLOT(doubleClicked(int, int)));
|
||||
m_winfirst = -1;
|
||||
m_docsource = 0;
|
||||
}
|
||||
@ -409,6 +411,13 @@ void RclResList::clicked(int par, int car)
|
||||
setParagraphBackgroundColor(par, color);
|
||||
}
|
||||
|
||||
// Double click in res list: add selection to simple search
|
||||
void RclResList::doubleClicked(int, int)
|
||||
{
|
||||
if (hasSelectedText())
|
||||
emit(wordSelect(selectedText()));
|
||||
}
|
||||
|
||||
void RclResList::linkWasClicked(const QString &s)
|
||||
{
|
||||
LOGDEB(("RclResList::linkClicked: [%s]\n", s.ascii()));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef _RCLRESLIST_H_INCLUDED_
|
||||
#define _RCLRESLIST_H_INCLUDED_
|
||||
/* @(#$Id: rclreslist.h,v 1.7 2006-04-22 06:27:37 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
/* @(#$Id: rclreslist.h,v 1.8 2006-04-26 11:29:10 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
|
||||
#include <qtextbrowser.h>
|
||||
#include <qpopupmenu.h>
|
||||
@ -25,6 +25,7 @@ class RclResList : public QTextBrowser
|
||||
public slots:
|
||||
virtual void resetSearch() {m_winfirst = -1;clear();}
|
||||
virtual void clicked(int, int);
|
||||
virtual void doubleClicked(int, int);
|
||||
virtual void resPageUpOrBack();
|
||||
virtual void resPageDownOrNext();
|
||||
virtual void resultPageBack();
|
||||
@ -42,6 +43,7 @@ class RclResList : public QTextBrowser
|
||||
void docPreviewClicked(int);
|
||||
void headerClicked();
|
||||
void docExpand(int);
|
||||
void wordSelect(QString);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user