advsearch: remove qt3 bits

This commit is contained in:
Jean-Francois Dockes 2010-12-01 09:26:17 +01:00
parent de9202a0b1
commit e03b17fd95
3 changed files with 468 additions and 534 deletions

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0" stdsetdef="1"> <ui version="4.0">
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>AdvSearchBase</class> <class>AdvSearchBase</class>
<widget class="QDialog" name="AdvSearchBase"> <widget class="QDialog" name="AdvSearchBase">
<property name="geometry"> <property name="geometry">
@ -30,70 +27,64 @@
<item> <item>
<widget class="QLabel" name="textLabel2"> <widget class="QLabel" name="textLabel2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>All non empty fields on the right will be combined with AND (&quot;All clauses&quot; choice) or OR (&quot;Any clause&quot; choice) conjunctions. &lt;br&gt;&quot;Any&quot; &quot;All&quot; and &quot;None&quot; field types can accept a mix of simple words, and phrases enclosed in double quotes.&lt;br&gt;Fields with no data are ignored.</string>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="margin">
<number>4</number>
</property>
<property name="text"> <property name="text">
<string>Search for &lt;br&gt;documents&lt;br&gt;satisfying:</string> <string>Search for &lt;br&gt;documents&lt;br&gt;satisfying:</string>
</property> </property>
<property name="toolTip" stdset="0">
<string>All non empty fields on the right will be combined with AND (&quot;All clauses&quot; choice) or OR (&quot;Any clause&quot; choice) conjunctions. &lt;br&gt;&quot;Any&quot; &quot;All&quot; and &quot;None&quot; field types can accept a mix of simple words, and phrases enclosed in double quotes.&lt;br&gt;Fields with no data are ignored.</string>
</property>
<property name="wordWrap"> <property name="wordWrap">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="margin">
<number>4</number>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="conjunctCMB"> <widget class="QComboBox" name="conjunctCMB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>8</horstretch> <horstretch>8</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip" stdset="0"> <property name="toolTip">
<string>All non empty fields on the right will be combined with AND (&quot;All clauses&quot; choice) or OR (&quot;Any clause&quot; choice) conjunctions. &lt;br&gt;&quot;Any&quot; &quot;All&quot; and &quot;None&quot; field types can accept a mix of simple words, and phrases enclosed in double quotes.&lt;br&gt;Fields with no data are ignored.</string> <string>All non empty fields on the right will be combined with AND (&quot;All clauses&quot; choice) or OR (&quot;Any clause&quot; choice) conjunctions. &lt;br&gt;&quot;Any&quot; &quot;All&quot; and &quot;None&quot; field types can accept a mix of simple words, and phrases enclosed in double quotes.&lt;br&gt;Fields with no data are ignored.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="spacer2"> <spacer name="spacer2">
<property name="sizeHint"> <property name="orientation">
<size> <enum>Qt::Vertical</enum>
<width>0</width>
<height>0</height>
</size>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="orientation"> <property name="sizeHint" stdset="0">
<enum>Qt::Vertical</enum> <size>
<width>0</width>
<height>0</height>
</size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="delClausePB"> <widget class="QPushButton" name="delClausePB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -109,9 +100,7 @@
<item> <item>
<widget class="QPushButton" name="addClausePB"> <widget class="QPushButton" name="addClausePB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -127,7 +116,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="Q3Frame" name="clauseFRM"> <widget class="QFrame" name="clauseFRM">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@ -135,12 +124,12 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing"> <property name="spacing">
<number>1</number> <number>1</number>
</property> </property>
<property name="margin">
<number>0</number>
</property>
<item> <item>
<widget class="Line" name="clauseline"> <widget class="Line" name="clauseline">
<property name="frameShape"> <property name="frameShape">
@ -171,19 +160,17 @@
<item> <item>
<widget class="QCheckBox" name="restrictFtCB"> <widget class="QCheckBox" name="restrictFtCB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Check this to enable filtering on file types</string>
</property>
<property name="text"> <property name="text">
<string>Restrict file types</string> <string>Restrict file types</string>
</property> </property>
<property name="toolTip" stdset="0">
<string>Check this to enable filtering on file types</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -192,19 +179,17 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Check this to use file categories instead of raw mime types</string>
</property>
<property name="text"> <property name="text">
<string>By categories</string> <string>By categories</string>
</property> </property>
<property name="toolTip" stdset="0">
<string>Check this to use file categories instead of raw mime types</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -240,7 +225,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Q3ListBox" name="yesFiltypsLB"> <widget class="QListWidget" name="yesFiltypsLB">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -251,7 +236,7 @@
</size> </size>
</property> </property>
<property name="selectionMode"> <property name="selectionMode">
<enum>Q3ListBox::Extended</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
</widget> </widget>
</item> </item>
@ -332,7 +317,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Q3ListBox" name="noFiltypsLB"> <widget class="QListWidget" name="noFiltypsLB">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -343,7 +328,7 @@
</size> </size>
</property> </property>
<property name="selectionMode"> <property name="selectionMode">
<enum>Q3ListBox::Extended</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
</widget> </widget>
</item> </item>
@ -366,9 +351,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QComboBox" name="subtreeCMB"> <widget class="QComboBox" name="subtreeCMB">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>8</horstretch> <horstretch>8</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -379,6 +362,9 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Enter top directory for search</string>
</property>
<property name="editable"> <property name="editable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -391,9 +377,6 @@
<property name="duplicatesEnabled"> <property name="duplicatesEnabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip" stdset="0">
<string>Enter top directory for search</string>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
@ -453,4 +436,6 @@
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<resources/>
<connections/>
</ui> </ui>

View File

@ -26,17 +26,6 @@ static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.21 2008-09-25 06:00:24 dockes
#include <qframe.h> #include <qframe.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qevent.h> #include <qevent.h>
#if (QT_VERSION < 0x040000)
#include <qcombobox.h>
#include <qlistbox.h>
#define Q34EVOVERRIDE QEvent::AccelOverride
#else
#include <q3combobox.h>
#include <q3listbox.h>
#define Q34EVOVERRIDE QEvent::ShortcutOverride
#endif
#include <qlayout.h> #include <qlayout.h>
#include <qtooltip.h> #include <qtooltip.h>
#include <qwhatsthis.h> #include <qwhatsthis.h>
@ -159,7 +148,8 @@ void AdvSearch::init()
bool AdvSearch::eventFilter(QObject *, QEvent *event) bool AdvSearch::eventFilter(QObject *, QEvent *event)
{ {
// LOGDEB(("AdvSearch::eventFilter. Type %d\n", (int)event->type())); // LOGDEB(("AdvSearch::eventFilter. Type %d\n", (int)event->type()));
if (event->type() == QEvent::KeyPress || event->type() == Q34EVOVERRIDE) { if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event); QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Q && (ke->state() & Qt::ControlButton)) { if (ke->key() == Qt::Key_Q && (ke->state() & Qt::ControlButton)) {
recollNeedsExit = 1; recollNeedsExit = 1;
@ -185,17 +175,9 @@ bool AdvSearch::close()
return QWidget::close(); return QWidget::close();
} }
#if (QT_VERSION >= 0x040000)
#define QListBoxItem Q3ListBoxItem
#define clauseVBox Ui::AdvSearchBase::clauseVBox
#define AdvSearchBaseLayout Ui::AdvSearchBase::AdvSearchBaseLayout
#endif
void AdvSearch::delAFiltypPB_clicked() void AdvSearch::delAFiltypPB_clicked()
{ {
for (unsigned int i = 0; i < yesFiltypsLB->count();i++) { yesFiltypsLB->selectAll();
yesFiltypsLB->setSelected(i, true);
}
delFiltypPB_clicked(); delFiltypPB_clicked();
} }
@ -234,60 +216,43 @@ void AdvSearch::delClause()
// Move selected file types from the searched to the ignored box // Move selected file types from the searched to the ignored box
void AdvSearch::delFiltypPB_clicked() void AdvSearch::delFiltypPB_clicked()
{ {
list<int> trl; QList<QListWidgetItem *> items = yesFiltypsLB->selectedItems();
QStringList moved; for (QList<QListWidgetItem *>::iterator it = items.begin();
for (unsigned int i = 0; i < yesFiltypsLB->count();i++) { it != items.end(); it++) {
QListBoxItem *item = yesFiltypsLB->item(i); int row = yesFiltypsLB->row(*it);
if (item && item->isSelected()) { QListWidgetItem *item = yesFiltypsLB->takeItem(row);
moved.push_back(item->text()); noFiltypsLB->insertItem(0, item);
trl.push_front(i);
}
}
if (!moved.empty()) {
noFiltypsLB->insertStringList(moved);
for (list<int>::iterator it = trl.begin();it != trl.end(); it++)
yesFiltypsLB->removeItem(*it);
}
yesFiltypsLB->sort();
noFiltypsLB->sort();
m_ignTypes.clear();
for (unsigned int i = 0; i < noFiltypsLB->count();i++) {
QListBoxItem *item = noFiltypsLB->item(i);
m_ignTypes.append(item->text());
} }
guiListsToIgnTypes();
} }
// Move selected file types from the ignored to the searched box // Move selected file types from the ignored to the searched box
void AdvSearch::addFiltypPB_clicked() void AdvSearch::addFiltypPB_clicked()
{ {
list<int> trl; QList<QListWidgetItem *> items = noFiltypsLB->selectedItems();
QStringList moved; for (QList<QListWidgetItem *>::iterator it = items.begin();
for (unsigned int i = 0; i < noFiltypsLB->count(); i++) { it != items.end(); it++) {
QListBoxItem *item = noFiltypsLB->item(i); int row = noFiltypsLB->row(*it);
if (item && item->isSelected()) { QListWidgetItem *item = noFiltypsLB->takeItem(row);
moved.push_back(item->text()); yesFiltypsLB->insertItem(0, item);
trl.push_front(i);
} }
guiListsToIgnTypes();
} }
if (!moved.empty()) {
yesFiltypsLB->insertStringList(moved); // Compute list of ignored mime type from widget lists
for (list<int>::iterator it = trl.begin();it != trl.end(); it++) void AdvSearch::guiListsToIgnTypes()
noFiltypsLB->removeItem(*it); {
} yesFiltypsLB->sortItems();
yesFiltypsLB->sort(); noFiltypsLB->sortItems();
noFiltypsLB->sort();
m_ignTypes.clear(); m_ignTypes.clear();
for (unsigned int i = 0; i < noFiltypsLB->count();i++) { for (int i = 0; i < noFiltypsLB->count();i++) {
QListBoxItem *item = noFiltypsLB->item(i); QListWidgetItem *item = noFiltypsLB->item(i);
m_ignTypes.append(item->text()); m_ignTypes.append(item->text());
} }
} }
void AdvSearch::addAFiltypPB_clicked() void AdvSearch::addAFiltypPB_clicked()
{ {
for (unsigned int i = 0; i < noFiltypsLB->count();i++) { noFiltypsLB->selectAll();
noFiltypsLB->setSelected(i, true);
}
addFiltypPB_clicked(); addFiltypPB_clicked();
} }
@ -317,7 +282,7 @@ void AdvSearch::fillFileTypes()
{ {
noFiltypsLB->clear(); noFiltypsLB->clear();
yesFiltypsLB->clear(); yesFiltypsLB->clear();
noFiltypsLB->insertStringList(m_ignTypes); noFiltypsLB->insertItems(0, m_ignTypes);
QStringList ql; QStringList ql;
if (m_ignByCats == false) { if (m_ignByCats == false) {
@ -345,7 +310,7 @@ void AdvSearch::fillFileTypes()
ql.append(cat); ql.append(cat);
} }
} }
yesFiltypsLB->insertStringList(ql); yesFiltypsLB->insertItems(0, ql);
} }
// Save current list of ignored file types to prefs // Save current list of ignored file types to prefs
@ -375,7 +340,7 @@ void AdvSearch::runSearch()
return; return;
if (restrictFtCB->isOn() && noFiltypsLB->count() > 0) { if (restrictFtCB->isOn() && noFiltypsLB->count() > 0) {
for (unsigned int i = 0; i < yesFiltypsLB->count(); i++) { for (int i = 0; i < yesFiltypsLB->count(); i++) {
if (restrictCtCB->isOn()) { if (restrictCtCB->isOn()) {
QString qcat = yesFiltypsLB->item(i)->text(); QString qcat = yesFiltypsLB->item(i)->text();
map<QString,QString>::const_iterator qit; map<QString,QString>::const_iterator qit;

View File

@ -28,34 +28,17 @@
class QDialog; class QDialog;
//MOC_SKIP_BEGIN
#if QT_VERSION < 0x040000
#include "advsearch.h"
class DummyAdvSearchBase : public AdvSearchBase
{
public: DummyAdvSearchBase(QWidget* parent = 0) : AdvSearchBase(parent) {}
};
#else
#include "ui_advsearch.h" #include "ui_advsearch.h"
class DummyAdvSearchBase : public QDialog, public Ui::AdvSearchBase
{
public: DummyAdvSearchBase(QWidget *parent):QDialog(parent) {setupUi(this);}
};
#endif class AdvSearch : public QDialog, public Ui::AdvSearchBase
//MOC_SKIP_END
class AdvSearch : public DummyAdvSearchBase
{ {
Q_OBJECT Q_OBJECT
public: public:
AdvSearch(QDialog* parent = 0) AdvSearch(QDialog* parent = 0)
: DummyAdvSearchBase(parent) : QDialog(parent)
{ {
setupUi(this);
init(); init();
} }
~AdvSearch(){} ~AdvSearch(){}
@ -66,6 +49,7 @@ public slots:
virtual void delAFiltypPB_clicked(); virtual void delAFiltypPB_clicked();
virtual void addFiltypPB_clicked(); virtual void addFiltypPB_clicked();
virtual void addAFiltypPB_clicked(); virtual void addAFiltypPB_clicked();
virtual void guiListsToIgnTypes();
virtual void restrictFtCB_toggled(bool); virtual void restrictFtCB_toggled(bool);
virtual void restrictCtCB_toggled(bool); virtual void restrictCtCB_toggled(bool);
virtual void runSearch(); virtual void runSearch();