summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelistremote.cpp
blob: 39bbac206820c1b73c9c1cb06468bb8c3894e21a (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>

#include "packagelistremote.h"

#include <qstring.h>
#include <qfile.h>
#include <stdlib.h>
#include <unistd.h>

PackageListRemote::PackageListRemote(PackageManagerSettings* s)
	: PackageList(s)
{
	PackageListRemote();
}

PackageListRemote::PackageListRemote()
	: PackageList()
{
}

PackageListRemote::~PackageListRemote()
{
}

void PackageListRemote::query(QString s)
{
	pvDebug(4,"set query "+s);
	searchString = s;	
}

void PackageListRemote::update()
{
	pvDebug(2,"PackageListRemote::update");	
 	if (searchString.isEmpty()) return;
 	int r=0;
  QString cmdQuery;
  QString cmdWget = "wget";
  QString redirect = "/tmp/oipkg.query";

  // use file for output
  cmdWget += " --output-document="+redirect;
//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
	QString server="http://ipkgfind.handhelds.org/"; 	
  cmdQuery = cmdWget+" \""+server+"packages.phtml?";
  cmdQuery += "format=pda&searchtype=package&section=";
  cmdQuery += "&query="+searchString;           	
  cmdQuery += "\"";

  pvDebug(4,"search :"+cmdQuery);
  r = system(cmdQuery.latin1());
  readFileEntries( redirect, "remote" );

//[15:30:38] <killefiz> http://killefiz.de/zaurus/oipkg.php?query=puzzle
  QFile::remove(redirect);
  server="http://killefiz.de/"; 	
  cmdQuery = cmdWget+" \""+server+"zaurus/oipkg.php?";
  cmdQuery += "query="+searchString;           	
  cmdQuery += "\"";

  pvDebug(4,"search :"+cmdQuery);
  r = system(cmdQuery.latin1());
  readFileEntries( redirect, "remote" );
}