blob: c0a7a36724ef4d180999bf84b928d5e4315862a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/***************************************************************************
* Copyright (C) 2003 by Sylvain Joyeux *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "parsers.h"
#include "../apt.h"
static QString
html_dpkgs_line_begin("<tr><td class=\"file\">%1</td><td>\n\t"),
html_dpkgs_line_end("\n</td></tr>\n");
namespace Parsers
{
void FileSearch::operator() (AptProtocol* slave, const QString & tag, const QString & value )
{
static QString buffer;
if (tag == "begin")
{
m_result_count = 0;
}
else if (tag == "error")
{
*slave << "<div class=\"error\">" + value + "</div>";
}
else if (tag == "file")
{
if (m_result_count)
*slave << buffer + html_dpkgs_line_end;
*slave << html_dpkgs_line_begin.arg(value);
++m_result_count;
buffer = "";
}
else if (tag == "package")
{
if (!buffer.isEmpty()) buffer = buffer + ", ";
buffer += "<a href=\"apt:/show?" + value + "\">" + value + "</a>";
}
else if (tag == "end")
{
*slave << buffer + html_dpkgs_line_end;
buffer="";
}
}
}
|