remember history of restrict subdirs in adv search
This commit is contained in:
parent
d2d2c73794
commit
a3db7c1937
@ -332,9 +332,17 @@
|
|||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>unnamed</cstring>
|
<cstring>unnamed</cstring>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QLineEdit" row="1" column="0">
|
<widget class="QComboBox" row="1" column="0">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>subtreeLE</cstring>
|
<cstring>subtreeCMB</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>8</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -342,6 +350,24 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizeLimit">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maxCount">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="insertionPolicy">
|
||||||
|
<enum>AtTop</enum>
|
||||||
|
</property>
|
||||||
|
<property name="duplicatesEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip" stdset="0">
|
||||||
|
<string>Enter top directory for search</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" row="1" column="1">
|
<widget class="QPushButton" row="1" column="1">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
@ -364,20 +390,20 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</grid>
|
</grid>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Line">
|
<widget class="Line">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>line1</cstring>
|
<cstring>line1</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>HLine</enum>
|
<enum>HLine</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>Sunken</enum>
|
<enum>Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Horizontal</enum>
|
<enum>Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLayoutWidget">
|
<widget class="QLayoutWidget">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>layout25</cstring>
|
<cstring>layout25</cstring>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.1 2006-09-04 15:13:01 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.2 2006-09-11 12:05:38 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -25,6 +25,7 @@ static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.1 2006-09-04 15:13:01 dockes
|
|||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qframe.h>
|
#include <qframe.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
|
#include <qcombobox.h>
|
||||||
#include <qlistbox.h>
|
#include <qlistbox.h>
|
||||||
#include <qlayout.h>
|
#include <qlayout.h>
|
||||||
#include <qtooltip.h>
|
#include <qtooltip.h>
|
||||||
@ -44,26 +45,33 @@ using std::string;
|
|||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
|
#include "guiutils.h"
|
||||||
|
|
||||||
extern RclConfig *rclconfig;
|
extern RclConfig *rclconfig;
|
||||||
|
|
||||||
void AdvSearch::init()
|
void AdvSearch::init()
|
||||||
{
|
{
|
||||||
// signals and slots connections
|
// signals and slots connections
|
||||||
connect( delFiltypPB, SIGNAL( clicked() ), this, SLOT( delFiltypPB_clicked() ) );
|
connect(delFiltypPB, SIGNAL(clicked()), this, SLOT(delFiltypPB_clicked()));
|
||||||
connect( searchPB, SIGNAL( clicked() ), this, SLOT( searchPB_clicked() ) );
|
connect(searchPB, SIGNAL(clicked()), this, SLOT(searchPB_clicked()));
|
||||||
connect( restrictFtCB, SIGNAL( toggled(bool) ), this, SLOT( restrictFtCB_toggled(bool) ) );
|
connect(restrictFtCB, SIGNAL(toggled(bool)),
|
||||||
connect( dismissPB, SIGNAL( clicked() ), this, SLOT( close() ) );
|
this, SLOT(restrictFtCB_toggled(bool)));
|
||||||
connect( browsePB, SIGNAL( clicked() ), this, SLOT( browsePB_clicked() ) );
|
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
connect( addFiltypPB, SIGNAL( clicked() ), this, SLOT( addFiltypPB_clicked() ) );
|
connect(browsePB, SIGNAL(clicked()), this, SLOT(browsePB_clicked()));
|
||||||
connect( andWordsLE, SIGNAL( returnPressed() ), this, SLOT( searchPB_clicked() ) );
|
connect(addFiltypPB, SIGNAL(clicked()), this, SLOT(addFiltypPB_clicked()));
|
||||||
connect( orWordsLE, SIGNAL( returnPressed() ), this, SLOT( searchPB_clicked() ) );
|
connect(andWordsLE, SIGNAL(returnPressed()),
|
||||||
connect( noWordsLE, SIGNAL( returnPressed() ), this, SLOT( searchPB_clicked() ) );
|
this, SLOT(searchPB_clicked()));
|
||||||
connect( phraseLE, SIGNAL( returnPressed() ), this, SLOT( searchPB_clicked() ) );
|
connect(orWordsLE, SIGNAL(returnPressed()),
|
||||||
connect( subtreeLE, SIGNAL( returnPressed() ), this, SLOT( searchPB_clicked() ) );
|
this, SLOT(searchPB_clicked()));
|
||||||
connect( delAFiltypPB, SIGNAL( clicked() ), this, SLOT( delAFiltypPB_clicked() ) );
|
connect(noWordsLE, SIGNAL(returnPressed()),
|
||||||
connect( addAFiltypPB, SIGNAL( clicked() ), this, SLOT( addAFiltypPB_clicked() ) );
|
this, SLOT(searchPB_clicked()));
|
||||||
|
connect(phraseLE, SIGNAL(returnPressed()), this, SLOT(searchPB_clicked()));
|
||||||
|
connect(subtreeCMB->lineEdit(), SIGNAL(returnPressed()),
|
||||||
|
this, SLOT(searchPB_clicked()));
|
||||||
|
connect(delAFiltypPB, SIGNAL(clicked()),
|
||||||
|
this, SLOT(delAFiltypPB_clicked()));
|
||||||
|
connect(addAFiltypPB, SIGNAL(clicked()),
|
||||||
|
this, SLOT(addAFiltypPB_clicked()));
|
||||||
|
|
||||||
list<string> types = rclconfig->getAllMimeTypes();
|
list<string> types = rclconfig->getAllMimeTypes();
|
||||||
|
|
||||||
@ -73,6 +81,8 @@ void AdvSearch::init()
|
|||||||
}
|
}
|
||||||
yesFiltypsLB->insertStringList(ql);
|
yesFiltypsLB->insertStringList(ql);
|
||||||
|
|
||||||
|
subtreeCMB->insertStringList(prefs.asearchSubdirHist);
|
||||||
|
subtreeCMB->setEditText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,8 +184,16 @@ void AdvSearch::searchPB_clicked()
|
|||||||
mydata.filetypes.push_back(string((const char *)ctext));
|
mydata.filetypes.push_back(string((const char *)ctext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!subtreeLE->text().isEmpty()) {
|
|
||||||
mydata.topdir = string((const char*)(subtreeLE->text().utf8()));
|
if (!subtreeCMB->currentText().isEmpty()) {
|
||||||
|
mydata.topdir =
|
||||||
|
string((const char*)(subtreeCMB->currentText().utf8()));
|
||||||
|
// If this was started by clicking, need to insert the new entry
|
||||||
|
if (subtreeCMB->text(0) != subtreeCMB->currentText())
|
||||||
|
subtreeCMB->insertItem(subtreeCMB->currentText(), 0);
|
||||||
|
prefs.asearchSubdirHist.clear();
|
||||||
|
for (int index = 0; index < subtreeCMB->count(); index++)
|
||||||
|
prefs.asearchSubdirHist.push_back(subtreeCMB->text(index));
|
||||||
}
|
}
|
||||||
emit startSearch(mydata);
|
emit startSearch(mydata);
|
||||||
}
|
}
|
||||||
@ -184,6 +202,6 @@ void AdvSearch::searchPB_clicked()
|
|||||||
void AdvSearch::browsePB_clicked()
|
void AdvSearch::browsePB_clicked()
|
||||||
{
|
{
|
||||||
QString dir = QFileDialog::getExistingDirectory();
|
QString dir = QFileDialog::getExistingDirectory();
|
||||||
subtreeLE->setText(dir);
|
subtreeCMB->setEditText(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.14 2006-09-11 09:08:44 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.15 2006-09-11 12:05:38 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -167,7 +167,6 @@ void rwSettings(bool writing)
|
|||||||
const string allEdbsSk = "allExtDbs";
|
const string allEdbsSk = "allExtDbs";
|
||||||
const string actEdbsSk = "actExtDbs";
|
const string actEdbsSk = "actExtDbs";
|
||||||
if (writing) {
|
if (writing) {
|
||||||
LOGDEB(("settings: writing to dynconf\n"));
|
|
||||||
g_dynconf->eraseAll(allEdbsSk);
|
g_dynconf->eraseAll(allEdbsSk);
|
||||||
for (list<string>::const_iterator it = prefs.allExtraDbs.begin();
|
for (list<string>::const_iterator it = prefs.allExtraDbs.begin();
|
||||||
it != prefs.allExtraDbs.end(); it++) {
|
it != prefs.allExtraDbs.end(); it++) {
|
||||||
@ -203,7 +202,6 @@ void rwSettings(bool writing)
|
|||||||
}
|
}
|
||||||
prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk);
|
prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
list<string>::const_iterator it;
|
list<string>::const_iterator it;
|
||||||
@ -219,6 +217,21 @@ void rwSettings(bool writing)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
const string asbdSk = "asearchSbd";
|
||||||
|
if (writing) {
|
||||||
|
while (prefs.asearchSubdirHist.size() > 20)
|
||||||
|
prefs.asearchSubdirHist.pop_back();
|
||||||
|
g_dynconf->eraseAll(asbdSk);
|
||||||
|
for (QStringList::iterator it = prefs.asearchSubdirHist.begin();
|
||||||
|
it != prefs.asearchSubdirHist.end(); it++) {
|
||||||
|
g_dynconf->enterString(asbdSk, (const char *)((*it).utf8()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list<string> tl = g_dynconf->getStringList(asbdSk);
|
||||||
|
for (list<string>::iterator it = tl.begin(); it != tl.end(); it++)
|
||||||
|
prefs.asearchSubdirHist.push_front(QString::fromUtf8(it->c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
#ifndef _GUIUTILS_H_INCLUDED_
|
#ifndef _GUIUTILS_H_INCLUDED_
|
||||||
#define _GUIUTILS_H_INCLUDED_
|
#define _GUIUTILS_H_INCLUDED_
|
||||||
/*
|
/*
|
||||||
* @(#$Id: guiutils.h,v 1.6 2006-04-27 09:23:10 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
* @(#$Id: guiutils.h,v 1.7 2006-09-11 12:05:38 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
||||||
* jean-francois.dockes@wanadoo.fr
|
* jean-francois.dockes@wanadoo.fr
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -68,6 +68,9 @@ class PrefsPack {
|
|||||||
// to the qt settings file to avoid any bin string/ charset conv issues
|
// to the qt settings file to avoid any bin string/ charset conv issues
|
||||||
list<string> allExtraDbs;
|
list<string> allExtraDbs;
|
||||||
list<string> activeExtraDbs;
|
list<string> activeExtraDbs;
|
||||||
|
// Advanced search subdir restriction: we don't activate the last value
|
||||||
|
// but just remember previously entered values
|
||||||
|
QStringList asearchSubdirHist;
|
||||||
// Textual history of simple searches (this is just the combobox list)
|
// Textual history of simple searches (this is just the combobox list)
|
||||||
QStringList ssearchHistory;
|
QStringList ssearchHistory;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.2 2006-09-11 07:10:25 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.3 2006-09-11 12:05:38 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -66,6 +66,8 @@ void SSearch::startSimpleSearch()
|
|||||||
{
|
{
|
||||||
LOGDEB(("SSearch::startSimpleSearch\n"));
|
LOGDEB(("SSearch::startSimpleSearch\n"));
|
||||||
|
|
||||||
|
if (queryText->currentText().length() == 0)
|
||||||
|
return;
|
||||||
Rcl::AdvSearchData sdata;
|
Rcl::AdvSearchData sdata;
|
||||||
QCString u8 = queryText->currentText().utf8();
|
QCString u8 = queryText->currentText().utf8();
|
||||||
switch (searchTypCMB->currentItem()) {
|
switch (searchTypCMB->currentItem()) {
|
||||||
@ -81,6 +83,8 @@ void SSearch::startSimpleSearch()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search terms history
|
||||||
|
|
||||||
// Need to remove any previous occurence of the search entry from
|
// Need to remove any previous occurence of the search entry from
|
||||||
// the listbox list, The qt listbox doesn't do lru correctly (if
|
// the listbox list, The qt listbox doesn't do lru correctly (if
|
||||||
// already in the list the new entry would remain at it's place,
|
// already in the list the new entry would remain at it's place,
|
||||||
@ -96,11 +100,13 @@ void SSearch::startSimpleSearch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (changed);
|
} while (changed);
|
||||||
|
if (queryText->text(0) != queryText->currentText())
|
||||||
|
queryText->insertItem(queryText->currentText(), 0);
|
||||||
|
|
||||||
// Save the current state of the listbox list to file
|
// Save the current state of the listbox list to file
|
||||||
prefs.ssearchHistory.clear();
|
prefs.ssearchHistory.clear();
|
||||||
for (int index = 0; index < queryText->count(); index++)
|
for (int index = 0; index < queryText->count(); index++)
|
||||||
prefs.ssearchHistory.push_back(queryText->text(index));
|
prefs.ssearchHistory.push_back(queryText->text(index).utf8());
|
||||||
|
|
||||||
emit startSearch(sdata);
|
emit startSearch(sdata);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@
|
|||||||
<enum>AtTop</enum>
|
<enum>AtTop</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="duplicatesEnabled">
|
<property name="duplicatesEnabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip" stdset="0">
|
<property name="toolTip" stdset="0">
|
||||||
<string>Enter search terms here</string>
|
<string>Enter search terms here</string>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: history.cpp,v 1.6 2006-09-11 09:08:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: history.cpp,v 1.7 2006-09-11 12:05:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -150,6 +150,20 @@ bool RclHistory::eraseAll(const string &sk)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool RclHistory::truncate(const string &sk, unsigned int n)
|
||||||
|
{
|
||||||
|
// Is this doc already in history ? If it is we remove the old entry
|
||||||
|
list<string> names = m_data.getNames(sk);
|
||||||
|
if (names.size() <= n)
|
||||||
|
return true;
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (list<string>::const_iterator it = names.begin();
|
||||||
|
it != names.end(); it++, i++) {
|
||||||
|
if (i >= n)
|
||||||
|
m_data.erase(*it, sk);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RclHistory::enterString(const string sk, const string value)
|
bool RclHistory::enterString(const string sk, const string value)
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _HISTORY_H_INCLUDED_
|
#ifndef _HISTORY_H_INCLUDED_
|
||||||
#define _HISTORY_H_INCLUDED_
|
#define _HISTORY_H_INCLUDED_
|
||||||
/* @(#$Id: history.h,v 1.4 2006-09-11 09:08:44 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: history.h,v 1.5 2006-09-11 12:05:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamic configuration storage
|
* Dynamic configuration storage
|
||||||
@ -101,6 +101,7 @@ class RclHistory {
|
|||||||
bool enterString(const string sk, const string value);
|
bool enterString(const string sk, const string value);
|
||||||
list<string> getStringList(const string sk);
|
list<string> getStringList(const string sk);
|
||||||
bool eraseAll(const string& sk);
|
bool eraseAll(const string& sk);
|
||||||
|
bool truncate(const string& sk, unsigned int n);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_mlen;
|
unsigned int m_mlen;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user