qtgui: add menu to erase search history + misc cleanups
This commit is contained in:
@@ -136,6 +136,7 @@
|
||||
</property>
|
||||
<addaction name="fileToggleIndexingAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="fileEraseSearchHistoryAction"/>
|
||||
<addaction name="fileEraseDocHistoryAction"/>
|
||||
<addaction name="showMissingHelpers_Action"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -204,6 +205,14 @@
|
||||
<cstring>fileEraseDocHistoryAction</cstring>
|
||||
</property>
|
||||
</action>
|
||||
<action name="fileEraseSearchHistoryAction">
|
||||
<property name="text">
|
||||
<string>&Erase search history</string>
|
||||
</property>
|
||||
<property name="name" stdset="0">
|
||||
<cstring>fileEraseSearchHistoryAction</cstring>
|
||||
</property>
|
||||
</action>
|
||||
<action name="showMissingHelpers_Action">
|
||||
<property name="text">
|
||||
<string>&Show missing helpers</string>
|
||||
|
||||
+20
-9
@@ -91,7 +91,7 @@ void RclMain::init()
|
||||
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text"),
|
||||
QT_TR_NOOP("sorted"), QT_TR_NOOP("filtered")
|
||||
};
|
||||
DocSource::set_translations((const char *)tr("sorted").toUtf8(),
|
||||
DocSequence::set_translations((const char *)tr("sorted").toUtf8(),
|
||||
(const char *)tr("filtered").toUtf8());
|
||||
curPreview = 0;
|
||||
asearchform = 0;
|
||||
@@ -225,6 +225,8 @@ void RclMain::init()
|
||||
this, SLOT(toggleIndexing()));
|
||||
connect(fileEraseDocHistoryAction, SIGNAL(activated()),
|
||||
this, SLOT(eraseDocHistory()));
|
||||
connect(fileEraseSearchHistoryAction, SIGNAL(activated()),
|
||||
this, SLOT(eraseSearchHistory()));
|
||||
connect(helpAbout_RecollAction, SIGNAL(activated()),
|
||||
this, SLOT(showAboutDialog()));
|
||||
connect(showMissingHelpers_Action, SIGNAL(activated()),
|
||||
@@ -262,7 +264,7 @@ void RclMain::init()
|
||||
connect(this, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||
restable, SLOT(onSortDataChanged(DocSeqSortSpec)));
|
||||
|
||||
connect(restable->getModel(), SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||
connect(restable->getModel(), SIGNAL(sortColumnChanged(DocSeqSortSpec)),
|
||||
this, SLOT(onResTableSortBy(DocSeqSortSpec)));
|
||||
connect(restable, SIGNAL(docEditClicked(Rcl::Doc)),
|
||||
this, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
@@ -605,6 +607,9 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
|
||||
src->setAbstractParams(prefs.queryBuildAbstract,
|
||||
prefs.queryReplaceAbstract);
|
||||
m_source = RefCntr<DocSequence>(src);
|
||||
m_source->setSortSpec(m_sortspec);
|
||||
m_source->setFiltSpec(m_filtspec);
|
||||
|
||||
emit docSourceChanged(m_source);
|
||||
emit sortDataChanged(m_sortspec);
|
||||
emit filtDataChanged(m_filtspec);
|
||||
@@ -881,6 +886,7 @@ void RclMain::onSortCtlChanged()
|
||||
prefs.sortActive = prefs.sortDesc = false;
|
||||
}
|
||||
LOGDEB(("RclMain::onCtlDataChanged(): emitting change signals\n"));
|
||||
m_source->setSortSpec(m_sortspec);
|
||||
emit sortDataChanged(m_sortspec);
|
||||
emit applyFiltSortData();
|
||||
}
|
||||
@@ -904,13 +910,8 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
||||
{
|
||||
LOGDEB(("RclMain::on_actionShowResultsAsTable_toggled(%d)\n", int(on)));
|
||||
prefs.showResultsAsTable = on;
|
||||
if (on) {
|
||||
restable->show();
|
||||
reslist->hide();
|
||||
} else {
|
||||
restable->hide();
|
||||
reslist->show();
|
||||
}
|
||||
restable->setVisible(on);
|
||||
reslist->setVisible(!on);
|
||||
}
|
||||
|
||||
void RclMain::on_actionSortByDateAsc_toggled(bool on)
|
||||
@@ -1259,6 +1260,8 @@ void RclMain::showDocHistory()
|
||||
string(tr("Document history").toUtf8()));
|
||||
src->setDescription((const char *)tr("History data").toUtf8());
|
||||
m_source = RefCntr<DocSequence>(src);
|
||||
m_source->setSortSpec(m_sortspec);
|
||||
m_source->setFiltSpec(m_filtspec);
|
||||
emit docSourceChanged(m_source);
|
||||
emit sortDataChanged(m_sortspec);
|
||||
emit filtDataChanged(m_filtspec);
|
||||
@@ -1277,6 +1280,13 @@ void RclMain::eraseDocHistory()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RclMain::eraseSearchHistory()
|
||||
{
|
||||
prefs.ssearchHistory.clear();
|
||||
sSearch->queryText->clear();
|
||||
}
|
||||
|
||||
// Called when the uiprefs dialog is ok'd
|
||||
void RclMain::setUIPrefs()
|
||||
{
|
||||
@@ -1338,6 +1348,7 @@ void RclMain::catgFilter(int id)
|
||||
it != tps.end(); it++)
|
||||
m_filtspec.orCrit(DocSeqFiltSpec::DSFS_MIMETYPE, *it);
|
||||
}
|
||||
m_source->setFiltSpec(m_filtspec);
|
||||
emit filtDataChanged(m_filtspec);
|
||||
emit applyFiltSortData();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public slots:
|
||||
virtual void previewExposed(Preview *, int sid, int docnum);
|
||||
virtual void resetSearch();
|
||||
virtual void eraseDocHistory();
|
||||
virtual void eraseSearchHistory();
|
||||
virtual void setStemLang(QAction *id);
|
||||
virtual void adjustPrefsMenu();
|
||||
virtual void catgFilter(int);
|
||||
|
||||
+14
-8
@@ -268,16 +268,17 @@ extern "C" int XFlush(void *);
|
||||
|
||||
void ResList::setDocSource(RefCntr<DocSequence> nsource)
|
||||
{
|
||||
LOGDEB(("ResList::setDocSource()\n"));
|
||||
m_source = RefCntr<DocSequence>(new DocSource(nsource));
|
||||
}
|
||||
|
||||
// Reapply parameters. Sort params probably changed
|
||||
void ResList::readDocSource()
|
||||
{
|
||||
LOGDEB(("ResList::readDocSource\n"));
|
||||
LOGDEB(("ResList::readDocSource()\n"));
|
||||
resetView();
|
||||
if (m_source.isNull())
|
||||
return;
|
||||
resetList();
|
||||
m_listId = newListId();
|
||||
|
||||
// Reset the page size in case the preference was changed
|
||||
@@ -287,19 +288,24 @@ void ResList::readDocSource()
|
||||
emit hasResults(m_source->getResCnt());
|
||||
}
|
||||
|
||||
void ResList::setSortParams(DocSeqSortSpec spec)
|
||||
void ResList::setSortParams(DocSeqSortSpec)
|
||||
{
|
||||
LOGDEB(("ResList::setSortParams\n"));
|
||||
m_source->setSortSpec(spec);
|
||||
LOGDEB2(("ResList::setSortParams\n"));
|
||||
}
|
||||
|
||||
void ResList::setFilterParams(const DocSeqFiltSpec& spec)
|
||||
void ResList::setFilterParams(const DocSeqFiltSpec&)
|
||||
{
|
||||
LOGDEB(("ResList::setFilterParams\n"));
|
||||
m_source->setFiltSpec(spec);
|
||||
LOGDEB2(("ResList::setFilterParams\n"));
|
||||
}
|
||||
|
||||
void ResList::resetList()
|
||||
{
|
||||
LOGDEB(("ResList::resetList()\n"));
|
||||
setDocSource(RefCntr<DocSequence>());
|
||||
resetView();
|
||||
}
|
||||
|
||||
void ResList::resetView()
|
||||
{
|
||||
m_curPvDoc = -1;
|
||||
// There should be a progress bar for long searches but there isn't
|
||||
|
||||
@@ -123,6 +123,7 @@ class ResList : public QTextBrowser
|
||||
emit linkClicked(s, m_lstClckMod);
|
||||
};
|
||||
static int newListId();
|
||||
void resetView();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -252,8 +252,8 @@ QVariant RecollModel::headerData(int idx, Qt::Orientation orientation,
|
||||
|
||||
QVariant RecollModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
LOGDEB2(("RecollModel::data: row %d col %d\n", index.row(),
|
||||
index.column()));
|
||||
LOGDEB1(("RecollModel::data: row %d col %d\n", index.row(),
|
||||
index.column()));
|
||||
if (m_source.isNull() || role != Qt::DisplayRole || !index.isValid() ||
|
||||
index.column() >= int(m_fields.size())) {
|
||||
return QVariant();
|
||||
@@ -285,7 +285,7 @@ void RecollModel::sort(int column, Qt::SortOrder order)
|
||||
spec.desc = order == Qt::AscendingOrder ? false : true;
|
||||
m_source->setSortSpec(spec);
|
||||
readDocSource();
|
||||
emit sortDataChanged(spec);
|
||||
emit sortColumnChanged(spec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +444,7 @@ void ResTable::onSortDataChanged(DocSeqSortSpec)
|
||||
|
||||
void ResTable::readDocSource(bool resetPos)
|
||||
{
|
||||
LOGDEB(("ResTable::readDocSource(%d)\n", int(resetPos)));
|
||||
if (resetPos)
|
||||
tableView->verticalScrollBar()->setSliderPosition(0);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual void addColumn(int, const string&);
|
||||
|
||||
signals:
|
||||
void sortDataChanged(DocSeqSortSpec);
|
||||
void sortColumnChanged(DocSeqSortSpec);
|
||||
|
||||
private:
|
||||
mutable RefCntr<DocSequence> m_source;
|
||||
|
||||
@@ -45,6 +45,10 @@ void SSearch::init()
|
||||
searchTypCMB->addItem(tr("File name"));
|
||||
searchTypCMB->addItem(tr("Query language"));
|
||||
|
||||
// We'd like to use QComboBox::InsertAtTop but it doesn't do lru
|
||||
// (existing item stays at its place instead of jumping at top)
|
||||
queryText->setInsertPolicy(QComboBox::NoInsert);
|
||||
|
||||
queryText->addItems(prefs.ssearchHistory);
|
||||
queryText->setEditText("");
|
||||
connect(queryText->lineEdit(), SIGNAL(returnPressed()),
|
||||
@@ -191,13 +195,11 @@ void SSearch::startSimpleSearch()
|
||||
// So do it by hand.
|
||||
QString txt = queryText->currentText();
|
||||
int index = queryText->findText(txt);
|
||||
if (index > 0)
|
||||
if (index >= 0)
|
||||
queryText->removeItem(index);
|
||||
// The combobox is set for no insertion, insert here:
|
||||
queryText->insertItem(0, txt);
|
||||
queryText->setCurrentIndex(0);
|
||||
|
||||
|
||||
// Save the current state of the listbox list to the prefs (will
|
||||
// go to disk)
|
||||
prefs.ssearchHistory.clear();
|
||||
|
||||
Reference in New Issue
Block a user