Switch to unified view

a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp
...
...
23
#include <qpushbutton.h>
23
#include <qpushbutton.h>
24
#include <qlabel.h>
24
#include <qlabel.h>
25
#include <qlineedit.h>
25
#include <qlineedit.h>
26
#include <qframe.h>
26
#include <qframe.h>
27
#include <qcheckbox.h>
27
#include <qcheckbox.h>
28
#include <qevent.h>
28
29
29
#if (QT_VERSION < 0x040000)
30
#if (QT_VERSION < 0x040000)
30
#include <qcombobox.h>
31
#include <qcombobox.h>
31
#include <qlistbox.h>
32
#include <qlistbox.h>
33
#define Q34EVOVERRIDE QEvent::AccelOverride
32
#else
34
#else
33
#include <q3combobox.h>
35
#include <q3combobox.h>
34
#include <q3listbox.h>
36
#include <q3listbox.h>
37
#define Q34EVOVERRIDE QEvent::ShortcutOverride
35
#endif
38
#endif
36
39
37
#include <qlayout.h>
40
#include <qlayout.h>
38
#include <qtooltip.h>
41
#include <qtooltip.h>
39
#include <qwhatsthis.h>
42
#include <qwhatsthis.h>
...
...
55
#include "recoll.h"
58
#include "recoll.h"
56
#include "rclconfig.h"
59
#include "rclconfig.h"
57
#include "debuglog.h"
60
#include "debuglog.h"
58
#include "searchdata.h"
61
#include "searchdata.h"
59
#include "guiutils.h"
62
#include "guiutils.h"
63
#include "rclhelp.h"
60
64
61
extern RclConfig *rclconfig;
65
extern RclConfig *rclconfig;
62
66
63
static const int initclausetypes[] = {1, 3, 0, 2, 5};
67
static const int initclausetypes[] = {1, 3, 0, 2, 5};
64
static const unsigned int iclausescnt = sizeof(initclausetypes) / sizeof(int);
68
static const unsigned int iclausescnt = sizeof(initclausetypes) / sizeof(int);
...
...
66
static map<QString,QString> cat_rtranslations;
70
static map<QString,QString> cat_rtranslations;
67
71
68
72
69
void AdvSearch::init()
73
void AdvSearch::init()
70
{
74
{
75
    (void)new HelpClient(this);
76
    HelpClient::installMap(this->name(), "RCL.SEARCH.COMPLEX");
77
78
    this->installEventFilter(this);
79
71
    // signals and slots connections
80
    // signals and slots connections
72
    connect(delFiltypPB, SIGNAL(clicked()), this, SLOT(delFiltypPB_clicked()));
81
    connect(delFiltypPB, SIGNAL(clicked()), this, SLOT(delFiltypPB_clicked()));
73
    connect(searchPB, SIGNAL(clicked()), this, SLOT(runSearch()));
82
    connect(searchPB, SIGNAL(clicked()), this, SLOT(runSearch()));
74
    connect(restrictFtCB, SIGNAL(toggled(bool)), 
83
    connect(restrictFtCB, SIGNAL(toggled(bool)), 
75
        this, SLOT(restrictFtCB_toggled(bool)));
84
        this, SLOT(restrictFtCB_toggled(bool)));
...
...
106
        } else {
115
        } else {
107
        addClause(*it);
116
        addClause(*it);
108
        }
117
        }
109
    }
118
    }
110
    }
119
    }
120
    (*m_clauseWins.begin())->wordsLE->setFocus();
111
121
112
    // Initialize lists of accepted and ignored mime types from config
122
    // Initialize lists of accepted and ignored mime types from config
113
    // and settings
123
    // and settings
114
    m_ignTypes = prefs.asearchIgnFilTyps;
124
    m_ignTypes = prefs.asearchIgnFilTyps;
115
    m_ignByCats = prefs.fileTypesByCats;
125
    m_ignByCats = prefs.fileTypesByCats;
116
    restrictCtCB->setEnabled(false);
126
    restrictCtCB->setEnabled(false);
117
    restrictCtCB->setChecked(m_ignByCats);
127
    restrictCtCB->setChecked(m_ignByCats);
118
    fillFileTypes();
128
    fillFileTypes();
119
    setHelpIndex("RCL.SEARCH.COMPLEX");
129
120
    subtreeCMB->insertStringList(prefs.asearchSubdirHist);
130
    subtreeCMB->insertStringList(prefs.asearchSubdirHist);
121
    subtreeCMB->setEditText("");
131
    subtreeCMB->setEditText("");
122
132
123
    // The clauseline frame is needed to force designer to accept a
133
    // The clauseline frame is needed to force designer to accept a
124
    // vbox to englobe the base clauses grid and 'something else' (the
134
    // vbox to englobe the base clauses grid and 'something else' (the
...
...
144
154
145
    cat_translations[QString::fromUtf8("other")] = tr("other");
155
    cat_translations[QString::fromUtf8("other")] = tr("other");
146
    cat_rtranslations[tr("other")] = QString::fromUtf8("other"); 
156
    cat_rtranslations[tr("other")] = QString::fromUtf8("other"); 
147
}
157
}
148
158
159
bool AdvSearch::eventFilter(QObject *, QEvent *event)
160
{
161
    //    LOGDEB(("AdvSearch::eventFilter. Type %d\n", (int)event->type()));
162
    if (event->type() == QEvent::KeyPress || event->type() == Q34EVOVERRIDE) {
163
  QKeyEvent *ke = static_cast<QKeyEvent *>(event);
164
  if (ke->key() == Qt::Key_Q && (ke->state() & Qt::ControlButton)) {
165
      recollNeedsExit = 1;
166
      return true;
167
  }
168
    }
169
    return false;
170
}
171
149
void AdvSearch::saveCnf()
172
void AdvSearch::saveCnf()
150
{
173
{
151
    // Save my state
174
    // Save my state
152
    prefs.advSearchClauses.clear(); 
175
    prefs.advSearchClauses.clear(); 
153
    for (std::list<SearchClauseW *>::iterator cit = m_clauseWins.begin();
176
    for (std::list<SearchClauseW *>::iterator cit = m_clauseWins.begin();
...
...
156
    }
179
    }
157
}
180
}
158
181
159
bool AdvSearch::close()
182
bool AdvSearch::close()
160
{
183
{
161
    setHelpIndex("RCL.SEARCH.SIMPLE");
162
    saveCnf();
184
    saveCnf();
163
    return QWidget::close();
185
    return QWidget::close();
164
}
186
}
165
187
166
#if (QT_VERSION >= 0x040000)
188
#if (QT_VERSION >= 0x040000)