00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 ***************************************************************************/ 00009 // (c) 2002 Patrick S. Vogt <tille@handhelds.org> 00010 00011 #include "packagelistremote.h" 00012 00013 #include <qstring.h> 00014 #include <qfile.h> 00015 #include <stdlib.h> 00016 #include <unistd.h> 00017 00018 PackageListRemote::PackageListRemote(PackageManagerSettings* s) 00019 : PackageList(s) 00020 { 00021 PackageListRemote(); 00022 } 00023 00024 PackageListRemote::PackageListRemote() 00025 : PackageList() 00026 { 00027 } 00028 00029 PackageListRemote::~PackageListRemote() 00030 { 00031 } 00032 00033 void PackageListRemote::query(QString s) 00034 { 00035 pvDebug(4,"set query "+s); 00036 searchString = s; 00037 } 00038 00039 void PackageListRemote::update() 00040 { 00041 pvDebug(2,"PackageListRemote::update"); 00042 if (searchString.isEmpty()) return; 00043 int r=0; 00044 QString cmdQuery; 00045 QString cmdWget = "wget"; 00046 QString redirect = "/tmp/oipkg.query"; 00047 00048 // use file for output 00049 cmdWget += " --output-document="+redirect; 00050 //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= 00051 QString server="http://ipkgfind.handhelds.org/"; 00052 cmdQuery = cmdWget+" \""+server+"packages.phtml?"; 00053 cmdQuery += "format=pda&searchtype=package§ion="; 00054 cmdQuery += "&query="+searchString; 00055 cmdQuery += "\""; 00056 00057 pvDebug(4,"search :"+cmdQuery); 00058 r = system(cmdQuery.latin1()); 00059 readFileEntries( redirect, "remote" ); 00060 00061 //[15:30:38] <killefiz> http://killefiz.de/zaurus/oipkg.php?query=puzzle 00062 QFile::remove(redirect); 00063 server="http://killefiz.de/"; 00064 cmdQuery = cmdWget+" \""+server+"zaurus/oipkg.php?"; 00065 cmdQuery += "query="+searchString; 00066 cmdQuery += "\""; 00067 00068 pvDebug(4,"search :"+cmdQuery); 00069 r = system(cmdQuery.latin1()); 00070 readFileEntries( redirect, "remote" ); 00071 }
1.4.2