Switch to unified view

a/src/qtgui/advshist.cpp b/src/qtgui/advshist.cpp
...
...
55
    text.clear();
55
    text.clear();
56
    field.clear();
56
    field.clear();
57
    slack = 0;
57
    slack = 0;
58
    d = m = y = di.d1 = di.m1 = di.y1 = di.d2 = di.m2 = di.y2 = 0;
58
    d = m = y = di.d1 = di.m1 = di.y1 = di.d2 = di.m2 = di.y2 = 0;
59
    hasdates = false;
59
    hasdates = false;
60
  exclude = false;
60
    }
61
    }
61
62
62
    // Temporary data while parsing.
63
    // Temporary data while parsing.
63
    QString currentText;
64
    QString currentText;
64
    QString whatclause;
65
    QString whatclause;
65
    string field, text;
66
    string field, text;
66
    int slack;
67
    int slack;
67
    int d, m, y;
68
    int d, m, y;
68
    DateInterval di;
69
    DateInterval di;
69
    bool hasdates;
70
    bool hasdates;
71
    bool exclude;
70
};
72
};
71
73
72
bool SDHXMLHandler::startElement(const QString & /* namespaceURI */,
74
bool SDHXMLHandler::startElement(const QString & /* namespaceURI */,
73
                const QString & /* localName */,
75
                const QString & /* localName */,
74
                const QString &qName,
76
                const QString &qName,
...
...
99
    if (currentText == "OR") {
101
    if (currentText == "OR") {
100
        sd->setTp(SCLT_OR);
102
        sd->setTp(SCLT_OR);
101
    }
103
    }
102
    } else if (qName == "CT") {
104
    } else if (qName == "CT") {
103
    whatclause = currentText.trimmed();
105
    whatclause = currentText.trimmed();
106
    } else if (qName == "NEG") {
107
  exclude = true;
104
    } else if (qName == "F") {
108
    } else if (qName == "F") {
105
    field = base64_decode(qs2utf8s(currentText.trimmed()));
109
    field = base64_decode(qs2utf8s(currentText.trimmed()));
106
    } else if (qName == "T") {
110
    } else if (qName == "T") {
107
    text = base64_decode(qs2utf8s(currentText.trimmed()));
111
    text = base64_decode(qs2utf8s(currentText.trimmed()));
108
    } else if (qName == "S") {
112
    } else if (qName == "S") {
109
    slack = atoi((const char *)currentText.toAscii());
113
    slack = atoi((const char *)currentText.toAscii());
110
    } else if (qName == "C") {
114
    } else if (qName == "C") {
111
    SearchDataClause *c;
115
    SearchDataClause *c;
112
    if (whatclause == "AND" || whatclause.isEmpty()) {
116
    if (whatclause == "AND" || whatclause.isEmpty()) {
113
        c = new SearchDataClauseSimple(SCLT_AND, text, field);
117
        c = new SearchDataClauseSimple(SCLT_AND, text, field);
118
      c->setexclude(exclude);
114
    } else if (whatclause == "OR") {
119
    } else if (whatclause == "OR") {
115
        c = new SearchDataClauseSimple(SCLT_OR, text, field);
120
        c = new SearchDataClauseSimple(SCLT_OR, text, field);
121
      c->setexclude(exclude);
116
    } else if (whatclause == "EX") {
122
    } else if (whatclause == "EX") {
123
      // Compat with old hist. We don't generete EX (SCLT_EXCL) anymore
124
      // it's replaced with OR + exclude flag
117
        c = new SearchDataClauseSimple(SCLT_EXCL, text, field);
125
        c = new SearchDataClauseSimple(SCLT_OR, text, field);
126
      c->setexclude(true);
118
    } else if (whatclause == "FN") {
127
    } else if (whatclause == "FN") {
119
        c = new SearchDataClauseFilename(text);
128
        c = new SearchDataClauseFilename(text);
129
      c->setexclude(exclude);
120
    } else if (whatclause == "PH") {
130
    } else if (whatclause == "PH") {
121
        c = new SearchDataClauseDist(SCLT_PHRASE, text, slack, field);
131
        c = new SearchDataClauseDist(SCLT_PHRASE, text, slack, field);
132
      c->setexclude(exclude);
122
    } else if (whatclause == "NE") {
133
    } else if (whatclause == "NE") {
123
        c = new SearchDataClauseDist(SCLT_NEAR, text, slack, field);
134
        c = new SearchDataClauseDist(SCLT_NEAR, text, slack, field);
135
      c->setexclude(exclude);
124
    } else {
136
    } else {
125
        LOGERR(("Bad clause type [%s]\n", qs2utf8s(whatclause).c_str()));
137
        LOGERR(("Bad clause type [%s]\n", qs2utf8s(whatclause).c_str()));
126
        return false;
138
        return false;
127
    }
139
    }
128
    sd->addClause(c);
140
    sd->addClause(c);
129
    whatclause = "";
141
    whatclause = "";
130
    text.clear();
142
    text.clear();
131
    field.clear();
143
    field.clear();
132
    slack = 0;
144
    slack = 0;
145
  exclude = false;
133
    } else if (qName == "D") {
146
    } else if (qName == "D") {
134
    d = atoi((const char *)currentText.toAscii());
147
    d = atoi((const char *)currentText.toAscii());
135
    } else if (qName == "M") {
148
    } else if (qName == "M") {
136
    m = atoi((const char *)currentText.toAscii());
149
    m = atoi((const char *)currentText.toAscii());
137
    } else if (qName == "Y") {
150
    } else if (qName == "Y") {