summaryrefslogtreecommitdiff
path: root/noncore/net
authorllornkcor <llornkcor>2002-03-28 01:29:02 (UTC)
committer llornkcor <llornkcor>2002-03-28 01:29:02 (UTC)
commitd360439051f476cd847c4d8cec27a52addcd72a2 (patch) (unidiff)
tree764e49aae53298ab9f020accc5a09042fd0ca874 /noncore/net
parent2e385535ffffa1a1cebf2f3a842cfe429b0c1909 (diff)
downloadopie-d360439051f476cd847c4d8cec27a52addcd72a2.zip
opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.gz
opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.bz2
added multi selection up/down. may have broken something- who knows...
Diffstat (limited to 'noncore/net') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index fd6b028..907a812 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -104,82 +104,86 @@ OpieFtp::OpieFtp( )
104 104
105 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 105 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
106 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 106 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
107 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 107 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
108 remoteMenu->insertSeparator(); 108 remoteMenu->insertSeparator();
109 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 109 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
110 110
111 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 111 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
112 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 112 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
113 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 113 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
114 tabMenu->setCheckable(TRUE); 114 tabMenu->setCheckable(TRUE);
115 115
116 TabWidget = new QTabWidget( this, "TabWidget" ); 116 TabWidget = new QTabWidget( this, "TabWidget" );
117 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); 117 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 );
118 118
119 TabWidget->setTabShape(QTabWidget::Triangular); 119 TabWidget->setTabShape(QTabWidget::Triangular);
120 120
121 tab = new QWidget( TabWidget, "tab" ); 121 tab = new QWidget( TabWidget, "tab" );
122 tabLayout = new QGridLayout( tab ); 122 tabLayout = new QGridLayout( tab );
123 tabLayout->setSpacing( 2); 123 tabLayout->setSpacing( 2);
124 tabLayout->setMargin( 2); 124 tabLayout->setMargin( 2);
125 125
126 Local_View = new QListView( tab, "Local_View" ); 126 Local_View = new QListView( tab, "Local_View" );
127// Local_View->setResizePolicy( QListView::AutoOneFit ); 127// Local_View->setResizePolicy( QListView::AutoOneFit );
128 Local_View->addColumn( tr("File"),120); 128 Local_View->addColumn( tr("File"),150);
129 Local_View->addColumn( tr("Size"),-1); 129 Local_View->addColumn( tr("Size"),-1);
130 Local_View->setColumnAlignment(1,QListView::AlignRight); 130 Local_View->setColumnAlignment(1,QListView::AlignRight);
131 Local_View->addColumn( tr("Date"),-1); 131 Local_View->addColumn( tr("Date"),-1);
132 Local_View->setColumnAlignment(2,QListView::AlignRight); 132 Local_View->setColumnAlignment(2,QListView::AlignRight);
133 Local_View->setAllColumnsShowFocus(TRUE); 133 Local_View->setAllColumnsShowFocus(TRUE);
134 Local_View->setMultiSelection( TRUE );
135
134 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 136 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
135 137
136 tabLayout->addWidget( Local_View, 0, 0 ); 138 tabLayout->addWidget( Local_View, 0, 0 );
137 139
138 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 140 connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
139 this,SLOT( localListClicked(QListViewItem *)) ); 141 this,SLOT( localListClicked(QListViewItem *)) );
140 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 142 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
141 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 143 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
142 144
143 TabWidget->insertTab( tab, tr( "Local" ) ); 145 TabWidget->insertTab( tab, tr( "Local" ) );
144 146
145 tab_2 = new QWidget( TabWidget, "tab_2" ); 147 tab_2 = new QWidget( TabWidget, "tab_2" );
146 tabLayout_2 = new QGridLayout( tab_2 ); 148 tabLayout_2 = new QGridLayout( tab_2 );
147 tabLayout_2->setSpacing( 2); 149 tabLayout_2->setSpacing( 2);
148 tabLayout_2->setMargin( 2); 150 tabLayout_2->setMargin( 2);
149 151
150 Remote_View = new QListView( tab_2, "Remote_View" ); 152 Remote_View = new QListView( tab_2, "Remote_View" );
151 Remote_View->addColumn( tr("File"),120); 153 Remote_View->addColumn( tr("File"),150);
152 Remote_View->addColumn( tr("Size"),-1); 154 Remote_View->addColumn( tr("Size"),-1);
153 Remote_View->setColumnAlignment(1,QListView::AlignRight); 155 Remote_View->setColumnAlignment(1,QListView::AlignRight);
154 Remote_View->addColumn( tr("Date"),-1); 156 Remote_View->addColumn( tr("Date"),-1);
155 Remote_View->setColumnAlignment(2,QListView::AlignRight); 157 Remote_View->setColumnAlignment(2,QListView::AlignRight);
156 Remote_View->addColumn( tr("Dir"),-1); 158 Remote_View->addColumn( tr("Dir"),-1);
157 Remote_View->setColumnAlignment(4,QListView::AlignRight); 159 Remote_View->setColumnAlignment(4,QListView::AlignRight);
158 Remote_View->setAllColumnsShowFocus(TRUE); 160 Remote_View->setAllColumnsShowFocus(TRUE);
161 Remote_View->setMultiSelection( TRUE );
162
159 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 163 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
160 164
161 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 165 connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)),
162 this,SLOT( remoteListClicked(QListViewItem *)) ); 166 this,SLOT( remoteListClicked(QListViewItem *)) );
163 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 167 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
164 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 168 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
165 169
166 tabLayout_2->addWidget( Remote_View, 0, 0 ); 170 tabLayout_2->addWidget( Remote_View, 0, 0 );
167 171
168 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 172 TabWidget->insertTab( tab_2, tr( "Remote" ) );
169 173
170 tab_3 = new QWidget( TabWidget, "tab_3" ); 174 tab_3 = new QWidget( TabWidget, "tab_3" );
171 tabLayout_3 = new QGridLayout( tab_3 ); 175 tabLayout_3 = new QGridLayout( tab_3 );
172 tabLayout_3->setSpacing( 2); 176 tabLayout_3->setSpacing( 2);
173 tabLayout_3->setMargin( 2); 177 tabLayout_3->setMargin( 2);
174 178
175 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 179 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
176 TextLabel1->setText( tr( "Username" ) ); 180 TextLabel1->setText( tr( "Username" ) );
177 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 181 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
178 182
179 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 183 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
180 UsernameComboBox->setEditable(TRUE); 184 UsernameComboBox->setEditable(TRUE);
181 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 185 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
182 186
183 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 187 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
184 TextLabel2->setText( tr( "Password" ) ); 188 TextLabel2->setText( tr( "Password" ) );
185 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 189 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
@@ -386,121 +390,134 @@ void OpieFtp::connector()
386 remoteDirList("/") ; 390 remoteDirList("/") ;
387 setCaption(ftp_host); 391 setCaption(ftp_host);
388 writeConfig(); 392 writeConfig();
389 connectServerBtn->setText( tr("Disconnect")); 393 connectServerBtn->setText( tr("Disconnect"));
390 QCopEnvelope ( "QPE/System", "notBusy()" ); 394 QCopEnvelope ( "QPE/System", "notBusy()" );
391} 395}
392 396
393void OpieFtp::disConnector() 397void OpieFtp::disConnector()
394{ 398{
395 if(conn) 399 if(conn)
396 FtpQuit(conn); 400 FtpQuit(conn);
397 setCaption("OpieFtp"); 401 setCaption("OpieFtp");
398 currentRemoteDir="/"; 402 currentRemoteDir="/";
399 Remote_View->clear(); 403 Remote_View->clear();
400 connectServerBtn->setText( tr("Connect")); 404 connectServerBtn->setText( tr("Connect"));
401 connectServerBtn->setOn(FALSE); 405 connectServerBtn->setOn(FALSE);
402 406
403} 407}
404 408
405void OpieFtp::localUpload() 409void OpieFtp::localUpload()
406{ 410{
407 int fsz; 411 int fsz;
408 QCopEnvelope ( "QPE/System", "busy()" ); 412 QCopEnvelope ( "QPE/System", "busy()" );
409// qApp->processEvents(); 413// qApp->processEvents();
410 QString strItem = Local_View->currentItem()->text(0); 414 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
415 QListViewItemIterator it( Local_View );
416 for ( ; it.current(); ++it ) {
417 if ( it.current()->isSelected() ) {
418 QString strItem = it.current()->text(0);
411 QString localFile = currentDir.canonicalPath()+"/"+strItem; 419 QString localFile = currentDir.canonicalPath()+"/"+strItem;
412 QString remoteFile= currentRemoteDir+strItem; 420 QString remoteFile= currentRemoteDir+strItem;
413 QFileInfo fi(localFile); 421 QFileInfo fi(localFile);
414 if( !fi.isDir()) { 422 if( !fi.isDir()) {
415 fsz=fi.size(); 423 fsz=fi.size();
416 ProgressBar->setTotalSteps(fsz); 424 ProgressBar->setTotalSteps(fsz);
417 425
418 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 426 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
419 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 427 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
420 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 428 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
421 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 429 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
422 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 430 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
423 431
424 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 432 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
425 QString msg; 433 QString msg;
426 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 434 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
427 msg.replace(QRegExp(":"),"\n"); 435 msg.replace(QRegExp(":"),"\n");
428 QMessageBox::message(tr("Note"),msg); 436 QMessageBox::message(tr("Note"),msg);
429 } 437 }
430 ProgressBar->reset();
431 nullifyCallBack();
432 } else { 438 } else {
433 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 439 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
434 } 440 }
441 ProgressBar->reset();
442 nullifyCallBack();
443 it.current()->setSelected(FALSE);
444 } //end currentSelected
445 }
435 TabWidget->setCurrentPage(1); 446 TabWidget->setCurrentPage(1);
436 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 447 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
437 QCopEnvelope ( "QPE/System", "notBusy()" ); 448 QCopEnvelope ( "QPE/System", "notBusy()" );
438} 449}
439 450
440void OpieFtp::nullifyCallBack() 451void OpieFtp::nullifyCallBack()
441{ 452{
442 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 453 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
443 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 454 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
444 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 455 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
445 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 456 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
446
447} 457}
448 458
449void OpieFtp::remoteDownload() 459void OpieFtp::remoteDownload()
450{ 460{
451// qApp->processEvents(); 461// qApp->processEvents();
452 int fsz; 462 int fsz;
453 QCopEnvelope ( "QPE/System", "busy()" ); 463 QCopEnvelope ( "QPE/System", "busy()" );
454 QString strItem = Remote_View->currentItem()->text(0);
455// strItem=strItem.right(strItem.length()-1);
456 464
465 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
466 QListViewItemIterator it( Remote_View );
467 for ( ; it.current(); ++it ) {
468 if ( it.current()->isSelected() ) {
469 QString strItem = it.current()->text(0);
470// strItem=strItem.right(strItem.length()-1);
457 QString localFile = currentDir.canonicalPath(); 471 QString localFile = currentDir.canonicalPath();
458 if(localFile.right(1).find("/",0,TRUE) == -1) 472 if(localFile.right(1).find("/",0,TRUE) == -1)
459 localFile += "/"; 473 localFile += "/";
460 localFile += strItem; 474 localFile += strItem;
461// QString localFile = currentDir.canonicalPath()+"/"+strItem; 475// QString localFile = currentDir.canonicalPath()+"/"+strItem;
462 QString remoteFile= currentRemoteDir+strItem; 476 QString remoteFile= currentRemoteDir+strItem;
463 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 477 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
464 fsz = 0; 478 fsz = 0;
465 QString temp; 479 QString temp;
466 temp.sprintf( remoteFile+" "+" %dkb", fsz); 480 temp.sprintf( remoteFile+" "+" %dkb", fsz);
467 481
468 ProgressBar->setTotalSteps(fsz); 482 ProgressBar->setTotalSteps(fsz);
469 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 483 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
470 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 484 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
471 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 485 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
472 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 486 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
473 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 487 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
474 488
475 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 489 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
476 QString msg; 490 QString msg;
477 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 491 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
478 msg.replace(QRegExp(":"),"\n"); 492 msg.replace(QRegExp(":"),"\n");
479 QMessageBox::message(tr("Note"),msg); 493 QMessageBox::message(tr("Note"),msg);
480 } 494 }
481 ProgressBar->reset(); 495 ProgressBar->reset();
482 nullifyCallBack(); 496 nullifyCallBack();
497 it.current()->setSelected(FALSE);
498 }
499 }
483 TabWidget->setCurrentPage(0); 500 TabWidget->setCurrentPage(0);
484 populateLocalView(); 501 populateLocalView();
485 QCopEnvelope ( "QPE/System", "notBusy()" ); 502 QCopEnvelope ( "QPE/System", "notBusy()" );
486} 503}
487 504
488bool OpieFtp::remoteDirList(const QString &dir) 505bool OpieFtp::remoteDirList(const QString &dir)
489{ 506{
490 QString tmp = QDir::homeDirPath(); 507 QString tmp = QDir::homeDirPath();
491 if(tmp.right(1) != "/") 508 if(tmp.right(1) != "/")
492 tmp+="/._temp"; 509 tmp+="/._temp";
493 else 510 else
494 tmp+="._temp"; 511 tmp+="._temp";
495// qDebug("Listing remote dir "+tmp); 512// qDebug("Listing remote dir "+tmp);
496 QCopEnvelope ( "QPE/System", "busy()" ); 513 QCopEnvelope ( "QPE/System", "busy()" );
497 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 514 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
498 QString msg; 515 QString msg;
499 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 516 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
500 msg.replace(QRegExp(":"),"\n"); 517 msg.replace(QRegExp(":"),"\n");
501 QMessageBox::message(tr("Note"),msg); 518 QMessageBox::message(tr("Note"),msg);
502 return false; 519 return false;
503 } 520 }
504 populateRemoteView() ; 521 populateRemoteView() ;
505 QCopEnvelope ( "QPE/System", "notBusy()" ); 522 QCopEnvelope ( "QPE/System", "notBusy()" );
506 return true; 523 return true;
@@ -546,71 +563,70 @@ void OpieFtp::populateLocalView()
546 fileS.sprintf( "%10li", fi->size() ); 563 fileS.sprintf( "%10li", fi->size() );
547 fileL.sprintf( "%s",fi->fileName().data() ); 564 fileL.sprintf( "%s",fi->fileName().data() );
548 fileDate= fi->lastModified().toString(); 565 fileDate= fi->lastModified().toString();
549 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 566 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
550 fileL+="/"; 567 fileL+="/";
551 isDir=TRUE; 568 isDir=TRUE;
552// qDebug( fileL); 569// qDebug( fileL);
553 } 570 }
554 } 571 }
555 if(fileL !="./" && fi->exists()) { 572 if(fileL !="./" && fi->exists()) {
556 item= new QListViewItem( Local_View,fileL,fileS , fileDate); 573 item= new QListViewItem( Local_View,fileL,fileS , fileDate);
557 QPixmap pm; 574 QPixmap pm;
558 575
559 if(isDir || fileL.find("/",0,TRUE) != -1) { 576 if(isDir || fileL.find("/",0,TRUE) != -1) {
560 if( !QDir( fi->filePath() ).isReadable()) 577 if( !QDir( fi->filePath() ).isReadable())
561 pm = Resource::loadPixmap( "lockedfolder" ); 578 pm = Resource::loadPixmap( "lockedfolder" );
562 else 579 else
563 pm= Resource::loadPixmap( "folder" ); 580 pm= Resource::loadPixmap( "folder" );
564 item->setPixmap( 0,pm ); 581 item->setPixmap( 0,pm );
565 } else { 582 } else {
566 if( !fi->isReadable() ) 583 if( !fi->isReadable() )
567 pm = Resource::loadPixmap( "locked" ); 584 pm = Resource::loadPixmap( "locked" );
568 else { 585 else {
569 MimeType mt(fi->filePath()); 586 MimeType mt(fi->filePath());
570 pm=mt.pixmap(); 587 pm=mt.pixmap(); //sets the correct pixmap for mimetype
571 if(pm.isNull()) 588 if(pm.isNull())
572 pm = Resource::loadPixmap( "UnknownDocument-14" ); 589 pm = Resource::loadPixmap( "UnknownDocument-14" );
573 item->setPixmap( 0,pm); 590 item->setPixmap( 0,pm);
574 } 591 }
575 } 592 }
576 if( fileL.find("->",0,TRUE) != -1) { 593 if( fileL.find("->",0,TRUE) != -1) {
577 // overlay link image 594 // overlay link image
578 pm= Resource::loadPixmap( "folder" ); 595 pm= Resource::loadPixmap( "folder" );
579 QPixmap lnk = Resource::loadPixmap( "symlink" ); 596 QPixmap lnk = Resource::loadPixmap( "symlink" );
580 QPainter painter( &pm ); 597 QPainter painter( &pm );
581 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 598 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
582 pm.setMask( pm.createHeuristicMask( FALSE ) ); 599 pm.setMask( pm.createHeuristicMask( FALSE ) );
583 item->setPixmap( 0, pm); 600 item->setPixmap( 0, pm);
584 } 601 }
585 } 602 }
586 isDir=FALSE; 603 isDir=FALSE;
587 ++it; 604 ++it;
588 } 605 }
589 Local_View->setSorting( 3,FALSE); 606 Local_View->setSorting( 3,FALSE);
590 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 607 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
591 fillCombo( (const QString &)currentDir); 608 fillCombo( (const QString &)currentDir);
592
593} 609}
594 610
595bool OpieFtp::populateRemoteView( ) 611bool OpieFtp::populateRemoteView( )
596{ 612{
597// qDebug("populate remoteview"); 613// qDebug("populate remoteview");
598 QString sfile=QDir::homeDirPath(); 614 QString sfile=QDir::homeDirPath();
599 if(sfile.right(1) != "/") 615 if(sfile.right(1) != "/")
600 sfile+="/._temp"; 616 sfile+="/._temp";
601 else 617 else
602 sfile+="._temp"; 618 sfile+="._temp";
603 QFile file( sfile); 619 QFile file( sfile);
604 Remote_View->clear(); 620 Remote_View->clear();
605 QString s, File_Name; 621 QString s, File_Name;
606 QListViewItem *itemDir=NULL, *itemFile=NULL; 622 QListViewItem *itemDir=NULL, *itemFile=NULL;
607 QString fileL, fileS, fileDate; 623 QString fileL, fileS, fileDate;
608 if ( file.open(IO_ReadOnly)) { 624 if ( file.open(IO_ReadOnly)) {
609 QTextStream t( &file ); // use a text stream 625 QTextStream t( &file ); // use a text stream
610 while ( !t.eof()) { 626 while ( !t.eof()) {
611 s = t.readLine(); 627 s = t.readLine();
612 fileL = s.right(s.length()-55); 628 fileL = s.right(s.length()-55);
613 fileL = fileL.stripWhiteSpace(); 629 fileL = fileL.stripWhiteSpace();
614 if(s.left(1) == "d") 630 if(s.left(1) == "d")
615 fileL = fileL+"/"; 631 fileL = fileL+"/";
616// fileL = "/"+fileL+"/"; 632// fileL = "/"+fileL+"/";
@@ -890,49 +906,48 @@ void OpieFtp::remoteMakDir()
890 QMessageBox::message(tr("Note"),msg); 906 QMessageBox::message(tr("Note"),msg);
891 } 907 }
892 QCopEnvelope ( "QPE/System", "notBusy()" ); 908 QCopEnvelope ( "QPE/System", "notBusy()" );
893 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 909 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
894 } 910 }
895} 911}
896 912
897void OpieFtp::remoteDelete() 913void OpieFtp::remoteDelete()
898{ 914{
899 QString f = Remote_View->currentItem()->text(0); 915 QString f = Remote_View->currentItem()->text(0);
900 QCopEnvelope ( "QPE/System", "busy()" ); 916 QCopEnvelope ( "QPE/System", "busy()" );
901 if( f.right(1) =="/") { 917 if( f.right(1) =="/") {
902 QString path= currentRemoteDir+f; 918 QString path= currentRemoteDir+f;
903 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 919 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
904 ,tr("Yes"),tr("No"),0,0,1) ) { 920 ,tr("Yes"),tr("No"),0,0,1) ) {
905 case 0: { 921 case 0: {
906 f=currentDir.canonicalPath()+"/"+f; 922 f=currentDir.canonicalPath()+"/"+f;
907 if(FtpRmdir( path.latin1(), conn) ==0) { 923 if(FtpRmdir( path.latin1(), conn) ==0) {
908 QString msg; 924 QString msg;
909 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); 925 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
910 msg.replace(QRegExp(":"),"\n"); 926 msg.replace(QRegExp(":"),"\n");
911 QMessageBox::message(tr("Note"),msg); 927 QMessageBox::message(tr("Note"),msg);
912 } 928 }
913 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 929 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
914
915 } 930 }
916 break; 931 break;
917 }; 932 };
918 } else { 933 } else {
919 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 934 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
920 ,tr("Yes"),tr("No"),0,0,1) ) { 935 ,tr("Yes"),tr("No"),0,0,1) ) {
921 case 0: { 936 case 0: {
922 QString path= currentRemoteDir+f; 937 QString path= currentRemoteDir+f;
923 if(FtpDelete( path.latin1(), conn)==0) { 938 if(FtpDelete( path.latin1(), conn)==0) {
924 QString msg; 939 QString msg;
925 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); 940 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
926 msg.replace(QRegExp(":"),"\n"); 941 msg.replace(QRegExp(":"),"\n");
927 QMessageBox::message(tr("Note"),msg); 942 QMessageBox::message(tr("Note"),msg);
928 } 943 }
929 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 944 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
930 } 945 }
931 break; 946 break;
932 }; 947 };
933 } 948 }
934 QCopEnvelope ( "QPE/System", "notBusy()" ); 949 QCopEnvelope ( "QPE/System", "notBusy()" );
935} 950}
936 951
937void OpieFtp::remoteRename() 952void OpieFtp::remoteRename()
938{ 953{