summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-16 16:29:14 (UTC)
committer llornkcor <llornkcor>2002-05-16 16:29:14 (UTC)
commit62c1424c5421e926173133ab4acd7346c590612e (patch) (unidiff)
treef9df1716b94df11330bb7cb466e26d2e3d1f8add
parentb94bd6003bf7c2024b0f254805f54ff4e52ead6e (diff)
downloadopie-62c1424c5421e926173133ab4acd7346c590612e.zip
opie-62c1424c5421e926173133ab4acd7346c590612e.tar.gz
opie-62c1424c5421e926173133ab4acd7346c590612e.tar.bz2
fixed not loading ftp configs correctly..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 7ca3fff..293c391 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -205,326 +205,329 @@ OpieFtp::OpieFtp( )
205 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 205 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
206 this,SLOT( remoteListClicked(QListViewItem *)) ); 206 this,SLOT( remoteListClicked(QListViewItem *)) );
207 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 207 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
208 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 208 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
209 209
210 tabLayout_2->addWidget( Remote_View, 0, 0 ); 210 tabLayout_2->addWidget( Remote_View, 0, 0 );
211 211
212 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 212 TabWidget->insertTab( tab_2, tr( "Remote" ) );
213 213
214 tab_3 = new QWidget( TabWidget, "tab_3" ); 214 tab_3 = new QWidget( TabWidget, "tab_3" );
215 tabLayout_3 = new QGridLayout( tab_3 ); 215 tabLayout_3 = new QGridLayout( tab_3 );
216 tabLayout_3->setSpacing( 2); 216 tabLayout_3->setSpacing( 2);
217 tabLayout_3->setMargin( 2); 217 tabLayout_3->setMargin( 2);
218 218
219 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 219 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
220 TextLabel1->setText( tr( "Username" ) ); 220 TextLabel1->setText( tr( "Username" ) );
221 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 221 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
222 222
223 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 223 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
224 UsernameComboBox->setEditable(TRUE); 224 UsernameComboBox->setEditable(TRUE);
225 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 225 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
226 226
227 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 227 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
228 TextLabel2->setText( tr( "Password" ) ); 228 TextLabel2->setText( tr( "Password" ) );
229 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 229 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
230 230
231 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 231 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
232 PasswordEdit->setEchoMode(QLineEdit::Password); 232 PasswordEdit->setEchoMode(QLineEdit::Password);
233 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 233 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
234 234
235 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 235 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
236 TextLabel3->setText( tr( "Remote server" ) ); 236 TextLabel3->setText( tr( "Remote server" ) );
237 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 237 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
238 238
239 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 239 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
240 ServerComboBox->setEditable(TRUE); 240 ServerComboBox->setEditable(TRUE);
241 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 241 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
242 242
243 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 243 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
244 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); 244 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) ));
245 245
246 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 246 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
247 TextLabel5->setText( tr( "Remote path" ) ); 247 TextLabel5->setText( tr( "Remote path" ) );
248 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 248 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
249 249
250 250
251 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 251 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
252 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 252 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
253 253
254 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 254 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
255 TextLabel4->setText( tr( "Port" ) ); 255 TextLabel4->setText( tr( "Port" ) );
256 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 256 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
257 257
258 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 258 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
259 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 259 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
260 PortSpinBox->setMaxValue(32786); 260 PortSpinBox->setMaxValue(32786);
261 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 261 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
262 262
263 QPushButton *deleteServerBtn; 263 QPushButton *deleteServerBtn;
264 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); 264 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" );
265 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); 265 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3);
266 266
267 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 267 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
268 268
269 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 269 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" );
270 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); 270 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1);
271 connectServerBtn->setToggleButton(TRUE); 271 connectServerBtn->setToggleButton(TRUE);
272 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 272 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
273 273
274 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 274 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
275 tabLayout_3->addItem( spacer, 5, 0 ); 275 tabLayout_3->addItem( spacer, 5, 0 );
276 276
277 TabWidget->insertTab( tab_3, tr( "Config" ) ); 277 TabWidget->insertTab( tab_3, tr( "Config" ) );
278 278
279 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 279 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
280 this,SLOT(tabChanged(QWidget*))); 280 this,SLOT(tabChanged(QWidget*)));
281 281
282 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 282 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
283 currentDir.setPath( QDir::currentDirPath()); 283 currentDir.setPath( QDir::currentDirPath());
284// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 284// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
285 285
286 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 286 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
287 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 287 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
288 288
289 currentPathCombo->setEditable(TRUE); 289 currentPathCombo->setEditable(TRUE);
290 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 290 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
291 291
292 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 292 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
293 this, SLOT( currentPathComboActivated( const QString & ) ) ); 293 this, SLOT( currentPathComboActivated( const QString & ) ) );
294 294
295 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 295 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
296 this,SLOT(currentPathComboChanged())); 296 this,SLOT(currentPathComboChanged()));
297 297
298 ProgressBar = new QProgressBar( this, "ProgressBar" ); 298 ProgressBar = new QProgressBar( this, "ProgressBar" );
299 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 299 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
300 300
301// fillCombos(); 301 fillCombos();
302 302
303 filterStr="*"; 303 filterStr="*";
304 b=FALSE; 304 b=FALSE;
305 populateLocalView(); 305 populateLocalView();
306 readConfig(); 306qDebug("read COnfig");
307 readConfig();
308 qDebug("Set current item");
307 ServerComboBox->setCurrentItem(currentServerConfig); 309 ServerComboBox->setCurrentItem(currentServerConfig);
308 310
309 TabWidget->setCurrentPage(2); 311 TabWidget->setCurrentPage(2);
310} 312}
311 313
312OpieFtp::~OpieFtp() 314OpieFtp::~OpieFtp()
313{ 315{
314} 316}
315 317
316void OpieFtp::cleanUp() 318void OpieFtp::cleanUp()
317{ 319{
318 if(conn) 320 if(conn)
319 FtpQuit(conn); 321 FtpQuit(conn);
320 QString sfile=QDir::homeDirPath(); 322 QString sfile=QDir::homeDirPath();
321 if(sfile.right(1) != "/") 323 if(sfile.right(1) != "/")
322 sfile+="/._temp"; 324 sfile+="/._temp";
323 else 325 else
324 sfile+="._temp"; 326 sfile+="._temp";
325 QFile file( sfile); 327 QFile file( sfile);
326 if(file.exists()) 328 if(file.exists())
327 file.remove(); 329 file.remove();
328 exit(0); 330 exit(0);
329} 331}
330 332
331void OpieFtp::tabChanged(QWidget *w) 333void OpieFtp::tabChanged(QWidget *w)
332{ 334{
333 if (TabWidget->currentPageIndex() == 0) { 335 if (TabWidget->currentPageIndex() == 0) {
334 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 336 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
335 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 337 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
336 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 338 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
337 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 339 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
338 if(cdUpButton->isHidden()) 340 if(cdUpButton->isHidden())
339 cdUpButton->show(); 341 cdUpButton->show();
340 if(homeButton->isHidden()) 342 if(homeButton->isHidden())
341 homeButton->show(); 343 homeButton->show();
342 344
343 } 345 }
344 if (TabWidget->currentPageIndex() == 1) { 346 if (TabWidget->currentPageIndex() == 1) {
345 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 347 currentPathCombo->lineEdit()->setText( currentRemoteDir );
346 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 348 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
347 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 349 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
348 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 350 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
349 if(cdUpButton->isHidden()) 351 if(cdUpButton->isHidden())
350 cdUpButton->show(); 352 cdUpButton->show();
351 homeButton->hide(); 353 homeButton->hide();
352 354
353 } 355 }
354 if (TabWidget->currentPageIndex() == 2) { 356 if (TabWidget->currentPageIndex() == 2) {
355 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 357 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
356 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 358 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
357 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 359 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
358 cdUpButton->hide(); 360 cdUpButton->hide();
359 homeButton->hide(); 361 homeButton->hide();
360 } 362 }
361} 363}
362 364
363void OpieFtp::newConnection() 365void OpieFtp::newConnection()
364{ 366{
365 UsernameComboBox->lineEdit()->setText(""); 367 UsernameComboBox->lineEdit()->setText("");
366 PasswordEdit->setText( "" ); 368 PasswordEdit->setText( "" );
367 ServerComboBox->lineEdit()->setText( ""); 369 ServerComboBox->lineEdit()->setText( "");
368 remotePath->setText( currentRemoteDir = "/"); 370 remotePath->setText( currentRemoteDir = "/");
369 PortSpinBox->setValue( 21); 371 PortSpinBox->setValue( 21);
370 TabWidget->setCurrentPage(2); 372 TabWidget->setCurrentPage(2);
371} 373}
372 374
373void OpieFtp::serverComboEdited(const QString & edit) 375void OpieFtp::serverComboEdited(const QString & edit)
374{ 376{
375 if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 377 if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
376 qDebug("ServerComboEdited"); 378 qDebug("ServerComboEdited");
377 currentServerConfig = -1; 379 currentServerConfig = -1;
378 } 380 }
379} 381}
380 382
381void OpieFtp::connectorBtnToggled(bool On) 383void OpieFtp::connectorBtnToggled(bool On)
382{ 384{
383 if(On) { 385 if(On) {
384 connector(); 386 connector();
385 } else { 387 } else {
386 disConnector(); 388 disConnector();
387 } 389 }
388 390
389} 391}
390 392
391void OpieFtp::connector() 393void OpieFtp::connector()
392{ 394{
393// QCopEnvelope ( "QPE/System", "busy()" ); 395// QCopEnvelope ( "QPE/System", "busy()" );
394// qApp->processEvents(); 396// qApp->processEvents();
395 currentRemoteDir=remotePath->text(); 397 currentRemoteDir=remotePath->text();
396 if(ServerComboBox->currentText().isEmpty()) { 398 if(ServerComboBox->currentText().isEmpty()) {
397 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 399 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
398 TabWidget->setCurrentPage(2); 400 TabWidget->setCurrentPage(2);
399 ServerComboBox->setFocus(); 401 ServerComboBox->setFocus();
400 connectServerBtn->setOn(FALSE); 402 connectServerBtn->setOn(FALSE);
401 connectServerBtn->setText( tr("Connect")); 403 connectServerBtn->setText( tr("Connect"));
402 return; 404 return;
403 } 405 }
404 FtpInit(); 406 FtpInit();
405 TabWidget->setCurrentPage(1); 407 TabWidget->setCurrentPage(1);
406 QString ftp_host = ServerComboBox->currentText(); 408 QString ftp_host = ServerComboBox->currentText();
407 QString ftp_user = UsernameComboBox->currentText(); 409 QString ftp_user = UsernameComboBox->currentText();
408 QString ftp_pass = PasswordEdit->text(); 410 QString ftp_pass = PasswordEdit->text();
409 QString port=PortSpinBox->cleanText(); 411 QString port=PortSpinBox->cleanText();
410 port.stripWhiteSpace(); 412 port.stripWhiteSpace();
411 413
412 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 414 if(ftp_host.find("ftp://",0, TRUE) != -1 )
413 ftp_host=ftp_host.right(ftp_host.length()-6); 415 ftp_host=ftp_host.right(ftp_host.length()-6);
414 ftp_host+=":"+port; 416 ftp_host+=":"+port;
415 if (!FtpConnect( ftp_host.latin1(), &conn)) { 417 if (!FtpConnect( ftp_host.latin1(), &conn)) {
416 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 418 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
417 connectServerBtn->setOn(FALSE); 419 connectServerBtn->setOn(FALSE);
418 connectServerBtn->setText( tr("Connect")); 420 connectServerBtn->setText( tr("Connect"));
419 return ; 421 return ;
420 } 422 }
421 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 423 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
422 QString msg; 424 QString msg;
423 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 425 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
424 msg.replace(QRegExp(":"),"\n"); 426 msg.replace(QRegExp(":"),"\n");
425 QMessageBox::message(tr("Note"),msg); 427 QMessageBox::message(tr("Note"),msg);
426 if(conn) 428 if(conn)
427 FtpQuit(conn); 429 FtpQuit(conn);
428 connectServerBtn->setOn(FALSE); 430 connectServerBtn->setOn(FALSE);
429 connectServerBtn->setText( tr("Connect")); 431 connectServerBtn->setText( tr("Connect"));
430 return ; 432 return ;
431 } 433 }
432 remoteDirList("/") ; 434 remoteDirList("/") ;
433 setCaption(ftp_host); 435 setCaption(ftp_host);
434 writeConfig(); 436 if( currentServerConfig == -1)
437 writeConfig();
435 connectServerBtn->setText( tr("Disconnect")); 438 connectServerBtn->setText( tr("Disconnect"));
436// QCopEnvelope ( "QPE/System", "notBusy()" ); 439// QCopEnvelope ( "QPE/System", "notBusy()" );
437} 440}
438 441
439void OpieFtp::disConnector() 442void OpieFtp::disConnector()
440{ 443{
441 if(conn) 444 if(conn)
442 FtpQuit(conn); 445 FtpQuit(conn);
443 setCaption("OpieFtp"); 446 setCaption("OpieFtp");
444 currentRemoteDir="/"; 447 currentRemoteDir="/";
445 Remote_View->clear(); 448 Remote_View->clear();
446 connectServerBtn->setText( tr("Connect")); 449 connectServerBtn->setText( tr("Connect"));
447 connectServerBtn->setOn(FALSE); 450 connectServerBtn->setOn(FALSE);
448 setCaption("OpieFtp"); 451 setCaption("OpieFtp");
449} 452}
450 453
451void OpieFtp::localUpload() 454void OpieFtp::localUpload()
452{ 455{
453 int fsz; 456 int fsz;
454// QCopEnvelope ( "QPE/System", "busy()" ); 457// QCopEnvelope ( "QPE/System", "busy()" );
455// qApp->processEvents(); 458// qApp->processEvents();
456 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 459 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
457 QListViewItemIterator it( Local_View ); 460 QListViewItemIterator it( Local_View );
458 for ( ; it.current(); ++it ) { 461 for ( ; it.current(); ++it ) {
459 if ( it.current()->isSelected() ) { 462 if ( it.current()->isSelected() ) {
460 QString strItem = it.current()->text(0); 463 QString strItem = it.current()->text(0);
461 QString localFile = currentDir.canonicalPath()+"/"+strItem; 464 QString localFile = currentDir.canonicalPath()+"/"+strItem;
462 QString remoteFile= currentRemoteDir+strItem; 465 QString remoteFile= currentRemoteDir+strItem;
463 QFileInfo fi(localFile); 466 QFileInfo fi(localFile);
464 if( !fi.isDir()) { 467 if( !fi.isDir()) {
465 fsz=fi.size(); 468 fsz=fi.size();
466 ProgressBar->setTotalSteps(fsz); 469 ProgressBar->setTotalSteps(fsz);
467 470
468 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 471 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
469 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 472 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
470 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 473 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
471 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 474 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
472 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 475 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
473 476
474 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 477 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
475 QString msg; 478 QString msg;
476 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 479 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
477 msg.replace(QRegExp(":"),"\n"); 480 msg.replace(QRegExp(":"),"\n");
478 QMessageBox::message(tr("Note"),msg); 481 QMessageBox::message(tr("Note"),msg);
479 } 482 }
480 } else { 483 } else {
481 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 484 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
482 } 485 }
483 ProgressBar->reset(); 486 ProgressBar->reset();
484 nullifyCallBack(); 487 nullifyCallBack();
485 it.current()->setSelected(FALSE); 488 it.current()->setSelected(FALSE);
486 } //end currentSelected 489 } //end currentSelected
487 } 490 }
488 for ( ; it.current(); ++it ) { 491 for ( ; it.current(); ++it ) {
489 Local_View->clearSelection(); 492 Local_View->clearSelection();
490 } 493 }
491 Local_View->clearFocus(); 494 Local_View->clearFocus();
492 TabWidget->setCurrentPage(1); 495 TabWidget->setCurrentPage(1);
493 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 496 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
494// QCopEnvelope ( "QPE/System", "notBusy()" ); 497// QCopEnvelope ( "QPE/System", "notBusy()" );
495} 498}
496 499
497void OpieFtp::nullifyCallBack() 500void OpieFtp::nullifyCallBack()
498{ 501{
499 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 502 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
500 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 503 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
501 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 504 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
502 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 505 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
503} 506}
504 507
505void OpieFtp::remoteDownload() 508void OpieFtp::remoteDownload()
506{ 509{
507// qApp->processEvents(); 510// qApp->processEvents();
508 int fsz; 511 int fsz;
509// QCopEnvelope ( "QPE/System", "busy()" ); 512// QCopEnvelope ( "QPE/System", "busy()" );
510 513
511 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 514 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
512 QListViewItemIterator it( Remote_View ); 515 QListViewItemIterator it( Remote_View );
513 for ( ; it.current(); ++it ) { 516 for ( ; it.current(); ++it ) {
514 if ( it.current()->isSelected() ) { 517 if ( it.current()->isSelected() ) {
515 QString strItem = it.current()->text(0); 518 QString strItem = it.current()->text(0);
516// strItem=strItem.right(strItem.length()-1); 519// strItem=strItem.right(strItem.length()-1);
517 QString localFile = currentDir.canonicalPath(); 520 QString localFile = currentDir.canonicalPath();
518 if(localFile.right(1).find("/",0,TRUE) == -1) 521 if(localFile.right(1).find("/",0,TRUE) == -1)
519 localFile += "/"; 522 localFile += "/";
520 localFile += strItem; 523 localFile += strItem;
521// QString localFile = currentDir.canonicalPath()+"/"+strItem; 524// QString localFile = currentDir.canonicalPath()+"/"+strItem;
522 QString remoteFile= currentRemoteDir+strItem; 525 QString remoteFile= currentRemoteDir+strItem;
523 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 526 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
524 fsz = 0; 527 fsz = 0;
525 QString temp; 528 QString temp;
526 temp.sprintf( remoteFile+" "+" %dkb", fsz); 529 temp.sprintf( remoteFile+" "+" %dkb", fsz);
527 530
528 ProgressBar->setTotalSteps(fsz); 531 ProgressBar->setTotalSteps(fsz);
529 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 532 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
530 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 533 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
@@ -1052,285 +1055,294 @@ void OpieFtp::localRename()
1052 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 1055 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
1053 if( rename(oldname.latin1(), newName.latin1())== -1) 1056 if( rename(oldname.latin1(), newName.latin1())== -1)
1054 QMessageBox::message(tr("Note"),tr("Could not rename")); 1057 QMessageBox::message(tr("Note"),tr("Could not rename"));
1055 } 1058 }
1056 populateLocalView(); 1059 populateLocalView();
1057} 1060}
1058 1061
1059void OpieFtp::currentPathComboActivated(const QString & currentPath) { 1062void OpieFtp::currentPathComboActivated(const QString & currentPath) {
1060 if (TabWidget->currentPageIndex() == 0) { 1063 if (TabWidget->currentPageIndex() == 0) {
1061 chdir( currentPath.latin1() ); 1064 chdir( currentPath.latin1() );
1062 currentDir.cd( currentPath, TRUE); 1065 currentDir.cd( currentPath, TRUE);
1063 populateLocalView(); 1066 populateLocalView();
1064 update(); 1067 update();
1065 } else { 1068 } else {
1066// chdir( currentPath.latin1() ); 1069// chdir( currentPath.latin1() );
1067// currentDir.cd( currentPath, TRUE); 1070// currentDir.cd( currentPath, TRUE);
1068// populateList(); 1071// populateList();
1069// update(); 1072// update();
1070 1073
1071 } 1074 }
1072} 1075}
1073 1076
1074void OpieFtp::fillCombo(const QString &currentPath) { 1077void OpieFtp::fillCombo(const QString &currentPath) {
1075 1078
1076 currentPathCombo->lineEdit()->setText(currentPath); 1079 currentPathCombo->lineEdit()->setText(currentPath);
1077 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1080 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1078 currentPathCombo->clear(); 1081 currentPathCombo->clear();
1079 localDirPathStringList.prepend(currentPath ); 1082 localDirPathStringList.prepend(currentPath );
1080 currentPathCombo->insertStringList( localDirPathStringList,-1); 1083 currentPathCombo->insertStringList( localDirPathStringList,-1);
1081 } 1084 }
1082 currentPathCombo->lineEdit()->setText(currentPath); 1085 currentPathCombo->lineEdit()->setText(currentPath);
1083 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1086 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1084 currentPathCombo->clear(); 1087 currentPathCombo->clear();
1085 remoteDirPathStringList.prepend(currentPath ); 1088 remoteDirPathStringList.prepend(currentPath );
1086 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1089 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1087 } 1090 }
1088} 1091}
1089 1092
1090void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1093void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1091 1094
1092 currentPathCombo->lineEdit()->setText(currentPath); 1095 currentPathCombo->lineEdit()->setText(currentPath);
1093 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1096 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1094 currentPathCombo->clear(); 1097 currentPathCombo->clear();
1095 remoteDirPathStringList.prepend(currentPath ); 1098 remoteDirPathStringList.prepend(currentPath );
1096 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1099 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1097 } 1100 }
1098} 1101}
1099 1102
1100void OpieFtp::currentPathComboChanged() 1103void OpieFtp::currentPathComboChanged()
1101{ 1104{
1102 QString oldRemoteCurrentDir = currentRemoteDir; 1105 QString oldRemoteCurrentDir = currentRemoteDir;
1103// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1106// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
1104 if (TabWidget->currentPageIndex() == 0) { 1107 if (TabWidget->currentPageIndex() == 0) {
1105 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1108 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1106 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1109 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1107 populateLocalView(); 1110 populateLocalView();
1108 } else { 1111 } else {
1109 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1112 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1110 } 1113 }
1111 } 1114 }
1112 if (TabWidget->currentPageIndex() == 1) { 1115 if (TabWidget->currentPageIndex() == 1) {
1113 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1116 currentRemoteDir = currentPathCombo->lineEdit()->text();
1114 if(currentRemoteDir.right(1) !="/") { 1117 if(currentRemoteDir.right(1) !="/") {
1115 currentRemoteDir = currentRemoteDir +"/"; 1118 currentRemoteDir = currentRemoteDir +"/";
1116 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1119 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1117 } 1120 }
1118 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 1121 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
1119 currentRemoteDir = oldRemoteCurrentDir; 1122 currentRemoteDir = oldRemoteCurrentDir;
1120 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1123 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1121 } 1124 }
1122 1125
1123 remoteDirList( (const QString &)currentRemoteDir); 1126 remoteDirList( (const QString &)currentRemoteDir);
1124 } 1127 }
1125} 1128}
1126 1129
1127void OpieFtp::switchToLocalTab() 1130void OpieFtp::switchToLocalTab()
1128{ 1131{
1129 TabWidget->setCurrentPage(0); 1132 TabWidget->setCurrentPage(0);
1130} 1133}
1131 1134
1132void OpieFtp::switchToRemoteTab() 1135void OpieFtp::switchToRemoteTab()
1133{ 1136{
1134 TabWidget->setCurrentPage(1); 1137 TabWidget->setCurrentPage(1);
1135} 1138}
1136 1139
1137void OpieFtp::switchToConfigTab() 1140void OpieFtp::switchToConfigTab()
1138{ 1141{
1139 TabWidget->setCurrentPage(2); 1142 TabWidget->setCurrentPage(2);
1140} 1143}
1141 1144
1142void OpieFtp::readConfig() 1145void OpieFtp::readConfig()
1143{ 1146{
1144 fillCombos(); 1147 fillCombos();
1145 Config cfg("opieftp"); 1148 Config cfg("opieftp");
1146 cfg.setGroup("Server"); 1149 cfg.setGroup("Server");
1147 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1150 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1151
1148// qDebug("Reading %d", currentServerConfig); 1152// qDebug("Reading %d", currentServerConfig);
1149 serverComboSelected( currentServerConfig); 1153 serverComboSelected( currentServerConfig);
1150} 1154}
1151 1155
1152void OpieFtp::writeConfig() 1156void OpieFtp::writeConfig()
1153{ 1157{
1154 Config cfg("opieftp"); 1158 Config cfg("opieftp");
1155 cfg.setGroup("Server"); 1159 cfg.setGroup("Server");
1156 QString username, remoteServerStr, remotePathStr, password, port, temp; 1160 QString username, remoteServerStr, remotePathStr, password, port, temp;
1157 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1161 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1158 if( currentServerConfig == -1) { 1162 if( currentServerConfig == -1) {
1159 for (int i = 1; i <= numberOfEntries; i++) { 1163 for (int i = 1; i <= numberOfEntries; i++) {
1160 temp.setNum(i); 1164 temp.setNum(i);
1161 cfg.setGroup("Server"); 1165 cfg.setGroup("Server");
1162 QString tempStr = cfg.readEntry( temp,""); 1166 QString tempStr = cfg.readEntry( temp,"");
1163 } 1167 }
1164 temp.setNum( numberOfEntries + 1); 1168 temp.setNum( numberOfEntries + 1);
1165 cfg.setGroup("Server"); 1169 cfg.setGroup("Server");
1166 remoteServerStr = cfg.readEntry( temp,""); 1170 remoteServerStr = cfg.readEntry( temp,"");
1167 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1171 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1168 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1172 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1169 1173
1170 temp.setNum(numberOfEntries+1); 1174 temp.setNum(numberOfEntries+1);
1171 cfg.setGroup("Server"); 1175 cfg.setGroup("Server");
1172 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1176 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1177 cfg.writeEntry("currentServer", numberOfEntries+1);
1173 cfg.setGroup(temp); 1178 cfg.setGroup(temp);
1174 cfg.writeEntry("RemotePath", remotePath->text()); 1179 cfg.writeEntry("RemotePath", remotePath->text());
1175 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1180 cfg.writeEntry("Username", UsernameComboBox->currentText());
1176 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1181 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1177 cfg.setGroup("Server"); 1182 cfg.setGroup("Server");
1178 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1183 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1184
1179 } 1185 }
1180} 1186}
1181 1187
1182void OpieFtp::fillCombos() 1188void OpieFtp::fillCombos()
1183{ 1189{
1184 Config cfg("opieftp"); 1190 Config cfg("opieftp");
1185 cfg.setGroup("Server"); 1191 cfg.setGroup("Server");
1186 QString username, remoteServerStr, remotePathStr, password, port, temp; 1192 QString username, remoteServerStr, remotePathStr, password, port, temp;
1187 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1193 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1188 for (int i = 1; i <= numberOfEntries; i++) { 1194 for (int i = 1; i <= numberOfEntries; i++) {
1189 temp.setNum(i); 1195 temp.setNum(i);
1196 qDebug(temp);
1190 cfg.setGroup("Server"); 1197 cfg.setGroup("Server");
1191 remoteServerStr = cfg.readEntry( temp,""); 1198 remoteServerStr = cfg.readEntry( temp,"");
1199 qDebug( remoteServerStr);
1192 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1200 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1193 port = remoteServerStr.right( divider - 1); 1201 port = remoteServerStr.right( divider - 1);
1194 bool ok; 1202 bool ok;
1195 PortSpinBox->setValue( port.toInt(&ok,10)); 1203 PortSpinBox->setValue( port.toInt(&ok,10));
1196 1204
1197 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1205 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1206 qDebug( remoteServerStr);
1198 ServerComboBox->insertItem( remoteServerStr ); 1207 ServerComboBox->insertItem( remoteServerStr );
1199// cfg.setGroup(temp); 1208// cfg.setGroup(temp);
1200 1209
1201// remotePathStr = cfg.readEntry(remoteServer,""); 1210// remotePathStr = cfg.readEntry(remoteServer,"");
1202// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); 1211// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE);
1203// port = remoteServer.right( divider+1); 1212// port = remoteServer.right( divider+1);
1204// PortSpinBox->setValue( port); 1213// PortSpinBox->setValue( port);
1205 1214
1206// remoteServer = remoteServer.left(divider - 1); 1215// remoteServer = remoteServer.left(divider - 1);
1207// remotePath->setText( remotePathStr); 1216// remotePath->setText( remotePathStr);
1208 1217
1209// username = cfg.readEntry(temp); 1218// username = cfg.readEntry(temp);
1210// UsernameComboBox->insertItem(username); 1219// UsernameComboBox->insertItem(username);
1211// password = cfg.readEntryCrypt(username,""); 1220// password = cfg.readEntryCrypt(username,"");
1212// PasswordEdit->setText(password); 1221// PasswordEdit->setText(password);
1213 } 1222 }
1214} 1223}
1215 1224
1216 1225
1217void OpieFtp::serverComboSelected(int index) 1226void OpieFtp::serverComboSelected(int index)
1218{ 1227{
1219 currentServerConfig = index; 1228 currentServerConfig = index;
1220 QString username, remoteServerStr, remotePathStr, password, port, temp; 1229 QString username, remoteServerStr, remotePathStr, password, port, temp;
1221// remoteServerStr = ServerComboBox->text(index); 1230// remoteServerStr = ServerComboBox->text(index);
1222 Config cfg("opieftp"); 1231 Config cfg("opieftp");
1223 cfg.setGroup("Server"); 1232 cfg.setGroup("Server");
1224 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1233 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1225 1234
1226 temp.setNum(index+1); 1235 temp.setNum(index);
1227 remoteServerStr = cfg.readEntry( temp,""); 1236 remoteServerStr = cfg.readEntry( temp,"");
1237 qDebug("Group" +temp);
1228 cfg.setGroup(temp); 1238 cfg.setGroup(temp);
1229// qDebug(temp); 1239// qDebug(temp);
1230 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1240 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1231 port = remoteServerStr.right( divider - 1); 1241 port = remoteServerStr.right( divider - 1);
1232 bool ok; 1242 bool ok;
1233 int portInt = port.toInt(&ok,10); 1243 int portInt = port.toInt(&ok,10);
1234 if( portInt == 0) portInt = 21; 1244 if( portInt == 0) portInt = 21;
1235 1245
1236 PortSpinBox->setValue( portInt); 1246 PortSpinBox->setValue( portInt);
1237 1247
1238 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1248 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1239 1249
1240 username = cfg.readEntry("Username", "anonymous"); 1250 username = cfg.readEntry("Username", "anonymous");
1241 UsernameComboBox->lineEdit()->setText(username); 1251 UsernameComboBox->lineEdit()->setText(username);
1242 1252 qDebug(username);
1243// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1253// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
1244 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1254 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1245 1255// UsernameComboBox
1256// PasswordEdit
1257
1246 cfg.setGroup("Server"); 1258 cfg.setGroup("Server");
1247 temp.sprintf("%d",currentServerConfig); 1259 temp.sprintf("%d",currentServerConfig);
1248 cfg.writeEntry("currentServer", temp); 1260 cfg.writeEntry("currentServer", temp);
1249 update(); 1261 update();
1250} 1262}
1251// UsernameComboBox->lineEdit()->setText("root"); 1263// UsernameComboBox->lineEdit()->setText("root");
1252// PasswordEdit->setText( tr( "" ) ); 1264// PasswordEdit->setText( tr( "" ) );
1253// ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); 1265// ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
1254// remotePath->setText( currentRemoteDir = "/home/llornkcor/"); 1266// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
1255// PortSpinBox->setValue( 4242); 1267// PortSpinBox->setValue( 4242);
1256 1268
1257void OpieFtp::deleteServer() 1269void OpieFtp::deleteServer()
1258{ 1270{
1259 QString username, remoteServerStr, remotePathStr, password, port, temp; 1271 QString username, remoteServerStr, remotePathStr, password, port, temp;
1260 remoteServerStr = ServerComboBox->currentText( ); 1272 remoteServerStr = ServerComboBox->currentText( );
1261 username = UsernameComboBox->currentText(); 1273 username = UsernameComboBox->currentText();
1262 Config cfg("opieftp"); 1274 Config cfg("opieftp");
1263 cfg.setGroup("Server"); 1275 cfg.setGroup("Server");
1264 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1276 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1265 for (int i = 0; i <= numberOfEntries; i++) { 1277 for (int i = 0; i <= numberOfEntries; i++) {
1266 temp.setNum(i+1); 1278 temp.setNum(i+1);
1267 cfg.setGroup("Server"); 1279 cfg.setGroup("Server");
1268 if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 1280 if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1
1269 && cfg.readEntry(temp).find(username,0,TRUE) != -1 1281 && cfg.readEntry(temp).find(username,0,TRUE) != -1
1270 && !remoteServerStr.isEmpty()) { 1282 && !remoteServerStr.isEmpty()) {
1271 qDebug(temp); 1283 qDebug(temp);
1272 } 1284 }
1273 } 1285 }
1274} 1286}
1275 1287
1276void OpieFtp::upDir() 1288void OpieFtp::upDir()
1277{ 1289{
1278 if (TabWidget->currentPageIndex() == 0) { 1290 if (TabWidget->currentPageIndex() == 0) {
1279 QString current = currentDir.canonicalPath(); 1291 QString current = currentDir.canonicalPath();
1280 QDir dir(current); 1292 QDir dir(current);
1281 dir.cdUp(); 1293 dir.cdUp();
1282 current = dir.canonicalPath(); 1294 current = dir.canonicalPath();
1283 chdir( current.latin1() ); 1295 chdir( current.latin1() );
1284 currentDir.cd( current, TRUE); 1296 currentDir.cd( current, TRUE);
1285 populateLocalView(); 1297 populateLocalView();
1286 update(); 1298 update();
1287 } else { 1299 } else {
1288 if( FtpCDUp( conn) == 0) { 1300 if( FtpCDUp( conn) == 0) {
1289 QString msg; 1301 QString msg;
1290 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1302 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1291 msg.replace(QRegExp(":"),"\n"); 1303 msg.replace(QRegExp(":"),"\n");
1292 QMessageBox::message(tr("Note"),msg); 1304 QMessageBox::message(tr("Note"),msg);
1293// qDebug(msg); 1305// qDebug(msg);
1294 } 1306 }
1295 char path[256]; 1307 char path[256];
1296 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1308 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1297 QString msg; 1309 QString msg;
1298 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1310 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1299 msg.replace(QRegExp(":"),"\n"); 1311 msg.replace(QRegExp(":"),"\n");
1300 QMessageBox::message(tr("Note"),msg); 1312 QMessageBox::message(tr("Note"),msg);
1301// qDebug(msg); 1313// qDebug(msg);
1302 } 1314 }
1303 currentRemoteDir=path; 1315 currentRemoteDir=path;
1304 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1316 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1305 if(currentRemoteDir.right(1) !="/") 1317 if(currentRemoteDir.right(1) !="/")
1306 currentRemoteDir +="/"; 1318 currentRemoteDir +="/";
1307 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1319 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1308 fillRemoteCombo( (const QString &)currentRemoteDir); 1320 fillRemoteCombo( (const QString &)currentRemoteDir);
1309 1321
1310 } 1322 }
1311} 1323}
1312 1324
1313void OpieFtp::docButtonPushed() { 1325void OpieFtp::docButtonPushed() {
1314 QString current = QPEApplication::documentDir(); 1326 QString current = QPEApplication::documentDir();
1315 chdir( current.latin1() ); 1327 chdir( current.latin1() );
1316 currentDir.cd( current, TRUE); 1328 currentDir.cd( current, TRUE);
1317 populateLocalView(); 1329 populateLocalView();
1318 update(); 1330 update();
1319 1331
1320} 1332}
1321 1333
1322void OpieFtp::homeButtonPushed() { 1334void OpieFtp::homeButtonPushed() {
1323 QString current = QDir::homeDirPath(); 1335 QString current = QDir::homeDirPath();
1324 chdir( current.latin1() ); 1336 chdir( current.latin1() );
1325 currentDir.cd( current, TRUE); 1337 currentDir.cd( current, TRUE);
1326 populateLocalView(); 1338 populateLocalView();
1327 update(); 1339 update();
1328} 1340}
1329 1341
1330void OpieFtp::doAbout() { 1342void OpieFtp::doAbout() {
1331 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" 1343 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1332 "L.J.Potter<llornkcor@handhelds.org>\n" 1344 "L.J.Potter<llornkcor@handhelds.org>\n"
1333 "and uses ftplib copyright 1996-2000\n" 1345 "and uses ftplib copyright 1996-2000\n"
1334 "by Thomas Pfau, pfau@cnj.digex.net\n\n" 1346 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1335 "and is licensed by the GPL"); 1347 "and is licensed by the GPL");
1336} 1348}