GUI: add menu to export simple search history to text file
This commit is contained in:
parent
1681ab1172
commit
a42d52cd20
@ -79,7 +79,9 @@
|
|||||||
<addaction name="actionSave_last_query"/>
|
<addaction name="actionSave_last_query"/>
|
||||||
<addaction name="actionLoad_saved_query"/>
|
<addaction name="actionLoad_saved_query"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="fileExportSSearchHistoryAction"/>
|
||||||
<addaction name="fileEraseSearchHistoryAction"/>
|
<addaction name="fileEraseSearchHistoryAction"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="fileEraseDocHistoryAction"/>
|
<addaction name="fileEraseDocHistoryAction"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="fileExitAction"/>
|
<addaction name="fileExitAction"/>
|
||||||
@ -205,6 +207,14 @@
|
|||||||
<cstring>fileEraseSearchHistoryAction</cstring>
|
<cstring>fileEraseSearchHistoryAction</cstring>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="fileExportSSearchHistoryAction">
|
||||||
|
<property name="text">
|
||||||
|
<string>E&xport simple search history</string>
|
||||||
|
</property>
|
||||||
|
<property name="name" stdset="0">
|
||||||
|
<cstring>fileExportSSearchHistoryAction</cstring>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="showMissingHelpers_Action">
|
<action name="showMissingHelpers_Action">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Missing &helpers</string>
|
<string>Missing &helpers</string>
|
||||||
|
|||||||
@ -315,6 +315,8 @@ void RclMain::init()
|
|||||||
this, SLOT(eraseDocHistory()));
|
this, SLOT(eraseDocHistory()));
|
||||||
connect(fileEraseSearchHistoryAction, SIGNAL(triggered()),
|
connect(fileEraseSearchHistoryAction, SIGNAL(triggered()),
|
||||||
this, SLOT(eraseSearchHistory()));
|
this, SLOT(eraseSearchHistory()));
|
||||||
|
connect(fileExportSSearchHistoryAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(exportSimpleSearchHistory()));
|
||||||
connect(actionSave_last_query, SIGNAL(triggered()),
|
connect(actionSave_last_query, SIGNAL(triggered()),
|
||||||
this, SLOT(saveLastQuery()));
|
this, SLOT(saveLastQuery()));
|
||||||
connect(actionLoad_saved_query, SIGNAL(triggered()),
|
connect(actionLoad_saved_query, SIGNAL(triggered()),
|
||||||
@ -1005,7 +1007,8 @@ void RclMain::showDocHistory()
|
|||||||
}
|
}
|
||||||
// Construct a bogus SearchData structure
|
// Construct a bogus SearchData structure
|
||||||
std::shared_ptr<Rcl::SearchData>searchdata =
|
std::shared_ptr<Rcl::SearchData>searchdata =
|
||||||
std::shared_ptr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND, cstr_null));
|
std::shared_ptr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND,
|
||||||
|
cstr_null));
|
||||||
searchdata->setDescription((const char *)tr("History data").toUtf8());
|
searchdata->setDescription((const char *)tr("History data").toUtf8());
|
||||||
|
|
||||||
|
|
||||||
@ -1014,7 +1017,8 @@ void RclMain::showDocHistory()
|
|||||||
new DocSequenceHistory(rcldb, g_dynconf,
|
new DocSequenceHistory(rcldb, g_dynconf,
|
||||||
string(tr("Document history").toUtf8()));
|
string(tr("Document history").toUtf8()));
|
||||||
src->setDescription((const char *)tr("History data").toUtf8());
|
src->setDescription((const char *)tr("History data").toUtf8());
|
||||||
DocSource *source = new DocSource(theconfig, std::shared_ptr<DocSequence>(src));
|
DocSource *source = new DocSource(theconfig,
|
||||||
|
std::shared_ptr<DocSequence>(src));
|
||||||
m_source = std::shared_ptr<DocSequence>(source);
|
m_source = std::shared_ptr<DocSequence>(source);
|
||||||
m_source->setSortSpec(m_sortspec);
|
m_source->setSortSpec(m_sortspec);
|
||||||
m_source->setFiltSpec(m_filtspec);
|
m_source->setFiltSpec(m_filtspec);
|
||||||
@ -1037,12 +1041,44 @@ void RclMain::eraseDocHistory()
|
|||||||
|
|
||||||
void RclMain::eraseSearchHistory()
|
void RclMain::eraseSearchHistory()
|
||||||
{
|
{
|
||||||
|
int rep = QMessageBox::warning(
|
||||||
|
0, tr("Confirm"),
|
||||||
|
tr("Erasing simple and advanced search history lists, "
|
||||||
|
"please click Ok to confirm"),
|
||||||
|
QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton);
|
||||||
|
if (rep == QMessageBox::Ok) {
|
||||||
prefs.ssearchHistory.clear();
|
prefs.ssearchHistory.clear();
|
||||||
if (sSearch)
|
if (sSearch)
|
||||||
sSearch->clearAll();
|
sSearch->clearAll();
|
||||||
if (g_advshistory)
|
if (g_advshistory)
|
||||||
g_advshistory->clear();
|
g_advshistory->clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RclMain::exportSimpleSearchHistory()
|
||||||
|
{
|
||||||
|
QFileDialog dialog(0, "Saving simple search history");
|
||||||
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
dialog.setViewMode(QFileDialog::List);
|
||||||
|
QFlags<QDir::Filter> flags = QDir::NoDotAndDotDot|QDir::Files;
|
||||||
|
dialog.setFilter(flags);
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string path = qs2utf8s(dialog.selectedFiles().value(0));
|
||||||
|
LOGDEB("Chosen path: " << path << "\n");
|
||||||
|
FILE *fp = fopen(path.c_str(), "wb");
|
||||||
|
if (fp == 0) {
|
||||||
|
QMessageBox::warning(0, "Recoll",
|
||||||
|
tr("Could not open/create file"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < prefs.ssearchHistory.count(); i++) {
|
||||||
|
fprintf(fp, "%s\n", qs2utf8s(prefs.ssearchHistory[i]).c_str());
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
// Called when the uiprefs dialog is ok'd
|
// Called when the uiprefs dialog is ok'd
|
||||||
void RclMain::setUIPrefs()
|
void RclMain::setUIPrefs()
|
||||||
|
|||||||
@ -139,6 +139,7 @@ public slots:
|
|||||||
virtual void resetSearch();
|
virtual void resetSearch();
|
||||||
virtual void eraseDocHistory();
|
virtual void eraseDocHistory();
|
||||||
virtual void eraseSearchHistory();
|
virtual void eraseSearchHistory();
|
||||||
|
virtual void exportSimpleSearchHistory();
|
||||||
virtual void saveLastQuery();
|
virtual void saveLastQuery();
|
||||||
virtual void loadSavedQuery();
|
virtual void loadSavedQuery();
|
||||||
virtual void setStemLang(QAction *id);
|
virtual void setStemLang(QAction *id);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user