<string>S&top search</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/stop.png</normaloff>:/main/icons/stop.png</iconset>
</property>
</widget>
<string notr="true">^</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/folder_go.png</normaloff>:/main/icons/folder_go.png</iconset>
</property>
</widget>
<string notr="true">...</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/folder_find.png</normaloff>:/main/icons/folder_find.png</iconset>
</property>
</widget>
<string>S&top search</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/stop.png</normaloff>:/main/icons/stop.png</iconset>
</property>
<property name="shortcut">
<string>&Export</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/database_save.png</normaloff>:/main/icons/database_save.png</iconset>
</property>
<property name="shortcut">
<string>&Preview</string>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/eye.png</normaloff>:/main/icons/eye.png</iconset>
</property>
<property name="shortcut">
<x>0</x>
<y>0</y>
<width>1030</width>
- <height>26</height>
+ <height>30</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
</widget>
<action name="actionExit">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/door_in.png</normaloff>:/main/icons/door_in.png</iconset>
</property>
<property name="text">
</action>
<action name="actionSearch">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/action_go.png</normaloff>:/main/icons/action_go.png</iconset>
</property>
<property name="text">
</action>
<action name="actionExport">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/database_save.png</normaloff>:/main/icons/database_save.png</iconset>
</property>
<property name="text">
</action>
<action name="actionUp">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/folder_go.png</normaloff>:/main/icons/folder_go.png</iconset>
</property>
<property name="text">
</action>
<action name="actionSelectDirectory">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/folder_find.png</normaloff>:/main/icons/folder_find.png</iconset>
</property>
<property name="text">
</action>
<action name="actionGetAbsPath">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/folder.png</normaloff>:/main/icons/folder.png</iconset>
</property>
<property name="text">
</action>
<action name="actionGetFullName">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/table.png</normaloff>
<normalon>:/main/icons/table.gif</normalon>:/main/icons/table.png</iconset>
</property>
</action>
<action name="actionGetBaseDirectory">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/action_paste.png</normaloff>:/main/icons/action_paste.png</iconset>
</property>
<property name="text">
</action>
<action name="actionReset">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/wand.png</normaloff>:/main/icons/wand.png</iconset>
</property>
<property name="text">
</action>
<action name="actionSaveProgramState">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/disk.png</normaloff>:/main/icons/disk.png</iconset>
</property>
<property name="text">
</action>
<action name="actionOptions">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/wrench.png</normaloff>:/main/icons/wrench.png</iconset>
</property>
<property name="text">
</action>
<action name="actionPreview">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/eye.png</normaloff>:/main/icons/eye.png</iconset>
</property>
<property name="text">
</action>
<action name="actionStart">
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/action_go.png</normaloff>:/main/icons/action_go.png</iconset>
</property>
<property name="text">
<bool>false</bool>
</property>
<property name="icon">
- <iconset resource="refind.qrc">
+ <iconset>
<normaloff>:/main/icons/stop.png</normaloff>:/main/icons/stop.png</iconset>
</property>
<property name="text">
<tabstop>comboBoxExcludedDirs</tabstop>
<tabstop>tableWidget</tabstop>
</tabstops>
- <resources>
- <include location="refind.qrc"/>
- </resources>
+ <resources/>
<connections>
<connection>
<sender>actionExit</sender>
return item == NULL ? m_emptyLines : item->lines();
}
+/**
+ * Removes a file from the cache.
+ *
+ * @param filename the filename with path
+ */
+void FileCache::remove(const QString &filename)
+{
+ m_cache.remove(filename);
+}
+
public:
void addOrUpdate(const QString& filename);
const QStringList& lines(const QString& filename) const;
+ void remove(const QString& filename);
private:
QMap<QString, FileCacheItem*> m_cache;
QStringList m_emptyLines;
* Constructor.
*
* @param table the table for the found files
+ * @param cache the file content cache
*/
-FileFinder::FileFinder(QTableWidget& table) :
+FileFinder::FileFinder(QTableWidget& table, FileCache& cache) :
ReFileSearch(),
m_table(table),
m_files(),
m_dirs(0),
m_foundFiles(0),
- m_ignoredFiles(0)
+ m_ignoredFiles(0),
+ m_addNotDetach(false),
+ m_regularExpression(NULL),
+ m_text(NULL),
+ m_inverseSearch(false),
+ m_caseSensitive(false),
+ m_cache(cache)
{
setSearchMode(smFiles);
}
}
}
+/**
+ * Adds a file to the file table.
+ *
+ * @param full the filename with path
+ * @param path the path of the file
+ * @param node the filename without path
+ * @param info the info about the file
+ */
+void FileFinder::detachFromTable(const QString& full, const QString &path,
+ const QString &node)
+{
+ if (! m_files.contains(full)){
+ ++m_ignoredFiles;
+ } else {
+ ++m_foundFiles;
+ m_files.remove(full);
+ for (int ix = m_table.rowCount() - 1; ix >= 0; --ix){
+ if (m_table.item(ix, colNode)->text() == node
+ && m_table.item(ix, colPath)->text() == path){
+ m_table.removeRow(ix);
+ break;
+ }
+ }
+ }
+}
+
/**
* Clears the table.
*/
bool FileFinder::handleFile(const QString &full, const QString &path,
const QString &node, const QFileInfo& info)
{
- addToTable(full, path, node, info);
+ bool found = false;
+ if (m_regularExpression != NULL){
+ found = searchWithRegExpr(full);
+ } else if (m_text != NULL){
+ found = searchText(full);
+ }
+ if (found){
+ if (m_addNotDetach)
+ addToTable(full, path, node, info);
+ else
+ detachFromTable(full, path, node);
+ }
return true;
}
+/**
+ * Searches a text in the file content.
+ *
+ * @param filename the file to search
+ * @return <i>true</i>: if <i>! m_inverseSearch</i>: the text has been found<br>
+ * if <i>m_inverseSearch</i>: the text has not been found<br>
+ */
+bool FileFinder::searchText(const QString &filename)
+{
+ m_cache.addOrUpdate(filename);
+ const QStringList& lines = m_cache.lines(filename);
+ bool rc = false;
+ if (m_caseSensitive){
+ if (m_inverseSearch){
+ rc = true;
+ for (int ix = 0; ix < lines.size(); ++ix){
+ if (lines[ix].indexOf(m_text) < 0){
+ rc = false;
+ break;
+ }
+ }
+ } else {
+ rc = false;
+ for (int ix = 0; ix < lines.size(); ++ix){
+ if (lines[ix].indexOf(m_text) >= 0){
+ rc = true;
+ break;
+ }
+ }
+ }
+ } else {
+ if (m_inverseSearch){
+
+ } else {
+
+ }
+ }
+ if (! rc)
+ m_cache.remove(filename);
+ return rc;
+}
+
+/**
+ * Searches a regular expression in the file content.
+ *
+ * @param filename the file to search
+ * @return <i>true</i>: the text has been found
+ */
+bool FileFinder::searchWithRegExpr(const QString& filename){
+ m_cache.addOrUpdate(filename);
+ const QStringList& lines = m_cache.lines(filename);
+
+ bool rc = false;
+ if (m_inverseSearch){
+ rc = true;
+ for (int ix = 0; ix < lines.size(); ++ix){
+ if (m_regularExpression->match(lines[ix]).hasMatch()){
+ rc = false;
+ break;
+ }
+ }
+ } else {
+ rc = false;
+ for (int ix = 0; ix < lines.size(); ++ix){
+ if (m_regularExpression->match(lines[ix]).hasMatch()){
+ rc = true;
+ break;
+ }
+ }
+ }
+ if (rc)
+ m_cache.remove(filename);
+ return rc;
+}
+
/**
* Searches files in a directory tree and put them into a table widget.
*
oneDirectory(baseDirectory, 0);
}
+/**
+ * Sets the flag for the search mode.
+ *
+ * @param addNotDetach <i>true</i>: the found files will be added
+ */
+void FileFinder::setAddNotDetach(bool addNotDetach)
+{
+ m_addNotDetach = addNotDetach;
+}
+
+/**
+ * Sets the text search options.
+ *
+ * @param text text to search
+ * @param caseSensitive <i>true</i>: the search is case sensitive
+ * @param isRegularExpression <i>true</i>: the text is a regular expression
+ * @param inverseSearch <i>true</i>: the file is selected if the text
+ * is not found
+ */
+void FileFinder::setTextToSearch(const QString &text, bool caseSensitive,
+ bool isRegularExpression, bool inverseSearch)
+{
+ m_inverseSearch = inverseSearch;
+ delete m_text;
+ delete m_regularExpression;
+ m_text = NULL;
+ m_regularExpression = NULL;
+ m_caseSensitive = caseSensitive;
+ if (! text.isEmpty()){
+ if (isRegularExpression){
+ m_regularExpression = new QRegularExpression(text,
+ caseSensitive ? QRegularExpression::NoPatternOption
+ : QRegularExpression::CaseInsensitiveOption);
+ } else {
+ m_text = new QString(text);
+ }
+ }
+}
+
#ifndef FILEFINDER_H
#define FILEFINDER_H
-
+class FileCache;
class FileFinder : public ReFileSearch
{
public:
- FileFinder( QTableWidget& m_table);
+ FileFinder( QTableWidget& m_table, FileCache& cache);
virtual ~FileFinder();
public:
void addToTable(const QString& full, const QString &path,
int ignoredFiles() const;
void search(const QString& baseDirectory, const QString& patterns,
int minDepth, int maxDepth);
-
-
+ void setAddNotDetach(bool addNotDetach);
+ void setTextToSearch(const QString &text, bool caseSensitive,
+ bool isRegularExpression, bool inverseSearch);
+private:
+ void detachFromTable(const QString &full, const QString &path, const QString &node);
+ bool searchWithRegExpr(const QString &filename);
+ bool searchText(const QString &filename);
private:
QTableWidget& m_table;
QSet<QString> m_files;
int m_dirs;
int m_foundFiles;
int m_ignoredFiles;
+ bool m_addNotDetach;
+ QRegularExpression* m_regularExpression;
+ QString* m_text;
+ bool m_inverseSearch;
+ bool m_caseSensitive;
+ FileCache& m_cache;
};
#endif // FILEFINDER_H
connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(onAdd()));
connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(onClear()));
connect(ui->pushButtonFilter, SIGNAL(clicked()), this, SLOT(onFilter()));
+ connect(ui->pushButtonDetach, SIGNAL(clicked()), this, SLOT(onDetach()));
delete m_fileFinder;
- m_fileFinder = new FileFinder(*ui->tableWidget);
+ m_fileFinder = new FileFinder(*ui->tableWidget, *m_fileCache);
ui->tableWidget->setColumnWidth(colNode, 200);
ui->tableWidget->setColumnWidth(colSize, 125);
*/
void MainWindow::onAdd()
{
- QString base = ui->comboBoxBaseDirectory->currentText();
- if (base.isEmpty()){
- say(LOG_ERROR, tr("missing a base directory"));
- } else {
- m_fileFinder->search(base, ui->comboBoxFilePatterns->currentText(),
- atoi(ui->lineEditMinDepth->text().toLocal8Bit().data()),
- atoi(ui->lineEditMaxDepth->text().toLocal8Bit().data()));
- int files = ui->tableWidget->rowCount();
- ui->labelFileCount->setText(QString::number(files)
- + " " + tr("file(s)"));
- say(LOG_INFO, tr("files: %1 already found: %2 processed directories: %3")
- .arg(m_fileFinder->foundFiles())
- .arg(m_fileFinder->ignoredFiles())
- .arg(m_fileFinder->processedDirs()));
- }
+ searchFiles(true);
+}
+
+/**
+ * Handles the click of the "Detach" button.
+ */
+void MainWindow::onDetach()
+{
+ searchFiles(false);
}
/**
return level >= LOG_INFO;
}
+/**
+ * Common operation of onAdd() and onDetach().
+ *
+ * @param addNotDetach <i>true</i>: add the found files<br>
+ * <i>false</i>: detach the found files
+ */
+void MainWindow::searchFiles(bool addNotDetach)
+{
+ QString base = ui->comboBoxBaseDirectory->currentText();
+ if (base.isEmpty()){
+ say(LOG_ERROR, tr("missing a base directory"));
+ } else {
+ QDateTime olderThan = comboDate(ui->comboBoxOlder);
+ QDateTime youngerThan = comboDate(ui->comboBoxYounger);
+ m_fileFinder->setOlderThan(olderThan.currentMSecsSinceEpoch() <= 0
+ ? NULL : new QDateTime(olderThan));
+ m_fileFinder->setYoungerThan(olderThan.currentMSecsSinceEpoch() <= 0
+ ? NULL : new QDateTime(youngerThan));
+ m_fileFinder->setTextToSearch(ui->comboBoxTextPattern->currentText(),
+ ui->checkBoxCaseSensitiv->isChecked(),
+ ui->checkBoxRegularExpr->isChecked(),
+ ui->checkBoxInverse->isChecked());
+ m_fileFinder->setAddNotDetach(addNotDetach);
+ m_fileFinder->search(base, ui->comboBoxFilePatterns->currentText(),
+ atoi(ui->lineEditMinDepth->text().toLocal8Bit().data()),
+ atoi(ui->lineEditMaxDepth->text().toLocal8Bit().data()));
+ int files = ui->tableWidget->rowCount();
+ ui->labelFileCount->setText(QString::number(files)
+ + " " + tr("file(s)"));
+ say(LOG_INFO, tr("files: %1 already found: %2 processed directories: %3")
+ .arg(m_fileFinder->foundFiles())
+ .arg(m_fileFinder->ignoredFiles())
+ .arg(m_fileFinder->processedDirs()));
+ }
+}
+
/**
* Event
* @param oldString
virtual void onAboutToQuit();
virtual void onGuiTimerUpdate();
virtual void onLanguageChange();
+ void searchFiles(bool addNotDetach);
private slots:
void onAbout();
void onAdd();
void onClear();
+ void onDetach();
void onFilter();
void onSelectBaseDirectory();
void textEdited(const QString& oldString, const QString& newString);
</item>
</layout>
</widget>
+ <widget class="QWidget" name="tabDirectorySearchOptions">
+ <attribute name="title">
+ <string>Directory search options</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,1">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Text pattern:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="ReComboBox" name="comboBoxTextPattern">
+ <property name="toolTip">
+ <string>Only files containing this text / text pattern will be found.
+If the checkbox "Regular expression" is selected the text is interpreted as regular expression.
+If the checkbox "inverse search" is checked a file is found only if the file does <b>not</b> contain the text / text pattern.</string>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QCheckBox" name="checkBoxCaseSensitiv">
+ <property name="text">
+ <string>Case sensitive</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxRegularExpr">
+ <property name="text">
+ <string>Regular expression</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxInverse">
+ <property name="toolTip">
+ <string>If checked: a file will be selected only if the pattern is not found</string>
+ </property>
+ <property name="text">
+ <string>inverse search</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Younger then:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="ReComboBox" name="comboBoxYounger">
+ <property name="toolTip">
+ <string><html><head/><body><p>Formula of the minimal file date.</p><p>Example (relative): 3*5days+ 2hour</p><p>Example (absolute): 2015.12.31/23:59:59 - 3weeks</p><p>A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).</p><p>Usual precedence: '+' &lt; '*' &lt; '^'</p><p>The operands are integer numbers with potentionally a unit.</p><p>The first operand may be an absolute date, date and time or time:</p><p>Date syntax: yyyy.mm.dd</p><p>Time syntax HH:MM:SS</p><p>Units: minutes, hours, days, weeks</p><p>Abbrevation is allowed: 'd' is the same as 'days'</p></body></html></string>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_10" stretch="0,1">
+ <item>
+ <widget class="QLabel" name="label_13">
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Older than:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxOlder">
+ <property name="toolTip">
+ <string><html><head/><body><p>Formula of the maximal file date.</p><p>Example (relative): 3*5days+ 2hour</p><p>Example (absolute): 2015.12.31/23:59:59 - 3weeks</p><p><br/></p><p>A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).</p><p>Usual precedence: '+' &lt; '*' &lt; '^'</p><p>The operands are integer numbers with potentionally a unit.</p><p>The first operand may be an absolute date, date and time or time:</p><p>Date syntax: yyyy.mm.dd</p><p>Time syntax HH:MM:SS</p><p>Units: minutes, hours, days, weeks</p><p>Abbrevation is allowed: 'd' is the same as 'days'</p></body></html></string>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
<widget class="QWidget" name="tabSingleFiles">
<attribute name="title">
<string>Single files</string>
<property name="title">
<string>Activity</string>
</property>
- <widget class="QPushButton" name="pushButtonAdd">
+ <widget class="QLabel" name="labelFileCount">
<property name="geometry">
<rect>
- <x>19</x>
- <y>27</y>
- <width>85</width>
- <height>33</height>
+ <x>0</x>
+ <y>150</y>
+ <width>131</width>
+ <height>20</height>
</rect>
</property>
- <property name="toolTip">
- <string>Adds the described files into the table below</string>
- </property>
<property name="text">
- <string>&Add</string>
+ <string notr="true"/>
</property>
</widget>
- <widget class="QPushButton" name="pushButtonClear">
+ <widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>19</x>
- <y>67</y>
- <width>85</width>
- <height>33</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Clears the table below</string>
- </property>
- <property name="text">
- <string>&Clear</string>
- </property>
- </widget>
- <widget class="QLabel" name="labelFileCount">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>120</y>
- <width>131</width>
- <height>20</height>
+ <y>27</y>
+ <width>87</width>
+ <height>113</height>
</rect>
</property>
- <property name="text">
- <string notr="true"> </string>
- </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QPushButton" name="pushButtonAdd">
+ <property name="toolTip">
+ <string>Adds the described files into the table below</string>
+ </property>
+ <property name="text">
+ <string>&Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButtonDetach">
+ <property name="toolTip">
+ <string>Removes the found files from the table below</string>
+ </property>
+ <property name="text">
+ <string>&Detach</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButtonClear">
+ <property name="toolTip">
+ <string>Clears the table below</string>
+ </property>
+ <property name="text">
+ <string>&Clear</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</widget>
</item>
m_maxDepth(9999),
m_searchMode(smFilesAndDirs),
m_matcher(),
- m_processedDirs(0)
+ m_processedDirs(0),
+ m_youngerThan(NULL),
+ m_olderThan(NULL)
{
}
return m_minDepth;
}
+/**
+ * Returns the "older than" value.
+ *
+ * @return the "older than" value
+ */
+QDateTime* ReFileSearch::olderThan() const
+{
+ return m_olderThan;
+}
+
/**
* Does the search in one directory.
*
full += OS_SEPARATOR;
full += node;
QFileInfo info(full);
- if (! info.isDir()){
+ if (m_olderThan != NULL && info.lastModified() > *m_olderThan)
+ continue;
+ if (m_youngerThan != NULL && info.lastModified() < *m_youngerThan)
+ continue;
+ if (! info.isDir()){
if (m_searchMode == smDirs || depth < m_minDepth){
continue;
}
}
}
+/**
+ * Returns the number of processed directories.
+ *
+ * @return the number of directories entered during the search
+ */
+int ReFileSearch::processedDirs() const
+{
+ return m_processedDirs;
+}
+
/**
* Returns the current search mode.
*
m_searchMode = searchMode;
}
-int ReFileSearch::processedDirs() const
-{
- return m_processedDirs;
-}
-
/**
* Sets the maximal depth.
*
m_minDepth = minDepth;
}
+/**
+ * Sets the "older than" value.
+ *
+ * @param youngerThan NULL: no check of "older than"<br>
+ * otherwise: only files older than this will be "found"
+ */
+void ReFileSearch::setOlderThan(QDateTime *olderThan)
+{
+ m_olderThan = olderThan;
+}
+
/**
* Sets the search patterns.
*
{
m_matcher.setPatterns(includeExcludePatterns, ',', '-');
}
+
+/**
+ * Sets the "younger than" value.
+ *
+ * @param youngerThan NULL: no check of "younger than"<br>
+ * otherwise: only files younger than this will be "found"
+ */
+void ReFileSearch::setYoungerThan(QDateTime *youngerThan)
+{
+ m_youngerThan = youngerThan;
+}
+
+/**
+ * Returns the "younger than" value.
+ *
+ * @return the "younger than" value
+ */
+QDateTime* ReFileSearch::youngerThan() const
+{
+ return m_youngerThan;
+}
+
int maxDepth() const;
int minDepth() const;
void oneDirectory(const QString& directory, int depth);
+ QDateTime *olderThan() const;
int processedDirs() const;
SearchMode searchMode() const;
void setMaxDepth(int maxDepth);
void setMinDepth(int minDepth);
+ void setOlderThan(QDateTime *olderThan);
void setPatterns(const QString& includeExcludePattern);
void setSearchMode(const SearchMode& searchMode);
+ void setYoungerThan(QDateTime *youngerThan);
+ QDateTime *youngerThan() const;
+
protected:
int m_minDepth;
int m_maxDepth;
- SearchMode m_searchMode;
- ReIncludeExcludeMatcher m_matcher;
+ SearchMode m_searchMode;
+ ReIncludeExcludeMatcher m_matcher;
int m_processedDirs;
+ QDateTime* m_youngerThan;
+ QDateTime* m_olderThan;
};
#endif // REFILESEARCH_HPP