author | llornkcor <llornkcor> | 2004-11-02 02:41:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-11-02 02:41:04 (UTC) |
commit | e83e5bd3f26270d61a83b8b91e07b35d2657d060 (patch) (unidiff) | |
tree | eec1223a69d28cd684116976dc7e970bbf846054 /noncore/apps | |
parent | 51b7bdf260bc2b5b066c6594a6d0c507add682fd (diff) | |
download | opie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.zip opie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.tar.gz opie-e83e5bd3f26270d61a83b8b91e07b35d2657d060.tar.bz2 |
new mirror site web page requiring new parsing
-rw-r--r-- | noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp index de9c72b..44ade8d 100644 --- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp +++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | |||
@@ -19,4 +19,2 @@ | |||
19 | 19 | ||
20 | /* OPIE */ | ||
21 | #include <opie2/odebug.h> | ||
22 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
@@ -45,3 +43,3 @@ void optionsDialog::ftpSiteDlg( ) | |||
45 | ListFile+="/ftpList"; | 43 | ListFile+="/ftpList"; |
46 | odebug << "opening "+ListFile << oendl; | 44 | qDebug( "opening "+ListFile ); |
47 | if ( QFile(ListFile).exists() ) { | 45 | if ( QFile(ListFile).exists() ) { |
@@ -73,3 +71,4 @@ void optionsDialog::getSite() | |||
73 | outputFile = ListFile + "list.html"; | 71 | outputFile = ListFile + "list.html"; |
74 | QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; | 72 | QString networkUrl="http://www.gutenberg.net/catalog/world/selectpermanentmirror?fk_books=12962"; |
73 | // QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; | ||
75 | //http://www.gutenberg.org/index.html"; | 74 | //http://www.gutenberg.org/index.html"; |
@@ -83,3 +82,3 @@ void optionsDialog::getSite() | |||
83 | // { // use new, improved, *INSTANT* network-dialog-file-getterer | 82 | // { // use new, improved, *INSTANT* network-dialog-file-getterer |
84 | // odebug << "gitcha!" << oendl; | 83 | // qDebug( "gitcha!" ); |
85 | // } | 84 | // } |
@@ -90,4 +89,4 @@ void optionsDialog::getSite() | |||
90 | 89 | ||
91 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; | 90 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl;// + " 2>&1" ; |
92 | odebug << "Issuing the command "+cmd << oendl; | 91 | qDebug( "Issuing the command "+cmd ); |
93 | Output *outDlg; | 92 | Output *outDlg; |
@@ -120,3 +119,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
120 | // TODO: add locations!! | 119 | // TODO: add locations!! |
121 | odebug << "parse ftplist "+outputFile << oendl; | 120 | qDebug( "parse ftplist "+outputFile ); |
122 | QString ftpList, s_location; | 121 | QString ftpList, s_location; |
@@ -133,3 +132,3 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
133 | int end; | 132 | int end; |
134 | if( s.find( "FTP mirror sites for Project Gutenberg:", 0, TRUE) !=-1) { //lower end of this file | 133 | if( s.find( "Select a Default Download Site - Project Gutenberg", 0, TRUE) !=-1) { //lower end of this file |
135 | b_gotchTest = true; | 134 | b_gotchTest = true; |
@@ -138,3 +137,5 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
138 | if(( start = s.find( "ftp://", 0, TRUE))!=-1 ) { | 137 | if(( start = s.find( "ftp://", 0, TRUE))!=-1 ) { |
139 | end = s.find( "/\"", 0, TRUE);// ==-1)) { | 138 | // qDebug(s); |
139 | // qDebug("%d", start); | ||
140 | end = s.find( "</td></tr>", 0, TRUE);// ==-1)) { | ||
140 | if( end == -1) { | 141 | if( end == -1) { |
@@ -142,3 +143,5 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
142 | } | 143 | } |
143 | ftpSite = s.mid( start, (end - start) ); | 144 | // qDebug("end %d", end); |
145 | start =start + 6; | ||
146 | ftpSite = s.mid( start , (end - start) ); | ||
144 | if(ftpSite.right(1) != "/") { | 147 | if(ftpSite.right(1) != "/") { |
@@ -146,30 +149,23 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
146 | } | 149 | } |
147 | ftpSite=ftpSite.right( ftpSite.length()-6); | 150 | // qDebug("ftpsite " + ftpSite); |
148 | if( ftpSite.find("\n", 0, TRUE) ) | 151 | |
149 | ftpSite.remove( ftpSite.find("\n", 0, TRUE), 1); | 152 | for (int j = 0 ; j<3;j++) { |
150 | 153 | s = t.readLine(); | |
151 | if( ftpSite.find("\"", 0, TRUE) ) | 154 | QString finder="</td><td rowspan=\"3\">"; |
152 | ftpSite.remove( ftpSite.find("\"", 0, TRUE), 1); | 155 | if(( start = s.find( finder, 0, TRUE) ) != -1) { |
153 | if( ftpSite.find("a>", 0, TRUE) ) | 156 | // qDebug( "%d" + s, start ); |
154 | ftpSite.remove( ftpSite.find("a>", 0, TRUE) -2, 4); | 157 | end = s.find( finder, start + 2, TRUE) ; |
155 | 158 | // qDebug("end %d",end); | |
156 | 159 | s_location = s.mid( start + finder.length() , (end - start)-finder.length() ); | |
157 | s = t.readLine(); | 160 | // |
158 | s = t.readLine(); | 161 | // qDebug("Location "+s_location ); |
159 | if(( start=s.find("<BR>(", 0, TRUE) ) != -1) { | ||
160 | // odebug << "" << s << "" << oendl; | ||
161 | end = s.find( ")", 0, TRUE)+1; | ||
162 | s_location= s.mid( start+4, (end - start) ); | ||
163 | |||
164 | // odebug << "" << s_location << "" << oendl; | ||
165 | // ftpList += ftpSite + "\n"; | ||
166 | // ftp_QListBox_1->sort( TRUE ); | ||
167 | ftpList += s_location+ " "+ftpSite+"\n"; | ||
168 | |||
169 | ftp_QListBox_1->sort( TRUE ); | ||
170 | QString winbug=" "; | ||
171 | ftp_QListBox_1->insertItem ( s_location.latin1() +winbug+ftpSite); | ||
172 | // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1()); | ||
173 | } | ||
174 | 162 | ||
163 | ftpList += s_location+ " "+ftpSite+"\n"; | ||
164 | ftp_QListBox_1->sort( TRUE ); | ||
165 | QString winbug=" "; | ||
166 | ftp_QListBox_1->insertItem ( s_location.latin1() + winbug + ftpSite); | ||
167 | j=3; | ||
168 | // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1()); | ||
169 | } | ||
170 | } | ||
175 | // ftp_QListBox_1->insertItem ( ftpSite); | 171 | // ftp_QListBox_1->insertItem ( ftpSite); |
@@ -197,3 +193,3 @@ void optionsDialog::openSiteList() { | |||
197 | 193 | ||
198 | odebug << " just opens the ftp site list" << oendl; | 194 | qDebug( " just opens the ftp site list" ); |
199 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; | 195 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; |
@@ -237,3 +233,5 @@ void optionsDialog::select_site( const char *index ) | |||
237 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); | 233 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); |
238 | odebug << "Selected ftp site is "+ s_site2 << oendl; | 234 | |
235 | qDebug( "Selected ftp site is "+ s_site2 ); | ||
236 | |||
239 | int i_ftp = s_site2.find("/", 0, FALSE); | 237 | int i_ftp = s_site2.find("/", 0, FALSE); |
@@ -248,3 +246,3 @@ odebug << "Selected ftp site is "+ s_site2 << oendl; | |||
248 | // config->write(); | 246 | // config->write(); |
249 | TextLabel3->setText( "Current ftp server:\n"+ftp_host /*+ ftp_base_dir*/ ); | 247 | TextLabel3->setText( "Current ftp server:\n" + ftp_host /*+ ftp_base_dir*/ ); |
250 | // optionsDialog::accept(); | 248 | // optionsDialog::accept(); |