-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 204 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 11 |
2 files changed, 113 insertions, 102 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 37e2134..fd6b028 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -16,16 +16,17 @@ | |||
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/mimetype.h> | ||
24 | 25 | ||
25 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
26 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
27 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
28 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
29 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
30 | #include <qdir.h> | 31 | #include <qdir.h> |
31 | #include <qfile.h> | 32 | #include <qfile.h> |
@@ -197,16 +198,17 @@ OpieFtp::OpieFtp( ) | |||
197 | 198 | ||
198 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 199 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
199 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 200 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); |
200 | 201 | ||
201 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 202 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
202 | TextLabel5->setText( tr( "Remote path" ) ); | 203 | TextLabel5->setText( tr( "Remote path" ) ); |
203 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 204 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
204 | 205 | ||
206 | |||
205 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 207 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
206 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 208 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
207 | 209 | ||
208 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 210 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
209 | TextLabel4->setText( tr( "Port" ) ); | 211 | TextLabel4->setText( tr( "Port" ) ); |
210 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 212 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
211 | 213 | ||
212 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 214 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
@@ -220,36 +222,35 @@ OpieFtp::OpieFtp( ) | |||
220 | 222 | ||
221 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 223 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
222 | 224 | ||
223 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 225 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
224 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 226 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
225 | connectServerBtn->setToggleButton(TRUE); | 227 | connectServerBtn->setToggleButton(TRUE); |
226 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 228 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
227 | 229 | ||
228 | |||
229 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 230 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
230 | tabLayout_3->addItem( spacer, 5, 0 ); | 231 | tabLayout_3->addItem( spacer, 5, 0 ); |
231 | 232 | ||
232 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 233 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
233 | 234 | ||
234 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 235 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
235 | this,SLOT(tabChanged(QWidget*))); | 236 | this,SLOT(tabChanged(QWidget*))); |
236 | 237 | ||
237 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 238 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
238 | currentDir.setPath( QDir::currentDirPath()); | 239 | currentDir.setPath( QDir::currentDirPath()); |
239 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 240 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
240 | 241 | ||
241 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 242 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
242 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); | 243 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); |
243 | 244 | currentPathCombo->setEditable(TRUE); | |
244 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 245 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
245 | 246 | ||
246 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 247 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
247 | this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) ); | 248 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
248 | 249 | ||
249 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 250 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
250 | this,SLOT(currentPathComboChanged())); | 251 | this,SLOT(currentPathComboChanged())); |
251 | 252 | ||
252 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 253 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
253 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 254 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
254 | 255 | ||
255 | // fillCombos(); | 256 | // fillCombos(); |
@@ -260,16 +261,17 @@ OpieFtp::OpieFtp( ) | |||
260 | PortSpinBox->setValue( 4242); | 261 | PortSpinBox->setValue( 4242); |
261 | remotePath->setText( currentRemoteDir = "/"); | 262 | remotePath->setText( currentRemoteDir = "/"); |
262 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 263 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
263 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | 264 | // UsernameComboBox->lineEdit()->setText("llornkcor"); |
264 | // PortSpinBox->setValue( 21); | 265 | // PortSpinBox->setValue( 21); |
265 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); | 266 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); |
266 | PasswordEdit->setText( tr( "" ) ); | 267 | PasswordEdit->setText( tr( "" ) ); |
267 | #endif | 268 | #endif |
269 | |||
268 | filterStr="*"; | 270 | filterStr="*"; |
269 | b=FALSE; | 271 | b=FALSE; |
270 | populateLocalView(); | 272 | populateLocalView(); |
271 | readConfig(); | 273 | readConfig(); |
272 | ServerComboBox->setCurrentItem(currentServerConfig); | 274 | ServerComboBox->setCurrentItem(currentServerConfig); |
273 | TabWidget->setCurrentPage(2); | 275 | TabWidget->setCurrentPage(2); |
274 | } | 276 | } |
275 | 277 | ||
@@ -321,17 +323,17 @@ void OpieFtp::newConnection() | |||
321 | PortSpinBox->setValue( 21); | 323 | PortSpinBox->setValue( 21); |
322 | TabWidget->setCurrentPage(2); | 324 | TabWidget->setCurrentPage(2); |
323 | currentServerConfig = -1; | 325 | currentServerConfig = -1; |
324 | } | 326 | } |
325 | 327 | ||
326 | void OpieFtp::serverComboEdited(const QString & edit) { | 328 | void OpieFtp::serverComboEdited(const QString & edit) { |
327 | if( !edit.isEmpty() ) { | 329 | if( !edit.isEmpty() ) { |
328 | currentServerConfig = -1; | 330 | currentServerConfig = -1; |
329 | qDebug("comboedited"); | 331 | // qDebug("comboedited"); |
330 | } | 332 | } |
331 | } | 333 | } |
332 | 334 | ||
333 | void OpieFtp::connectorBtnToggled(bool On) | 335 | void OpieFtp::connectorBtnToggled(bool On) |
334 | { | 336 | { |
335 | if(On) { | 337 | if(On) { |
336 | connector(); | 338 | connector(); |
337 | } else { | 339 | } else { |
@@ -545,34 +547,40 @@ void OpieFtp::populateLocalView() | |||
545 | fileL.sprintf( "%s",fi->fileName().data() ); | 547 | fileL.sprintf( "%s",fi->fileName().data() ); |
546 | fileDate= fi->lastModified().toString(); | 548 | fileDate= fi->lastModified().toString(); |
547 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 549 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
548 | fileL+="/"; | 550 | fileL+="/"; |
549 | isDir=TRUE; | 551 | isDir=TRUE; |
550 | // qDebug( fileL); | 552 | // qDebug( fileL); |
551 | } | 553 | } |
552 | } | 554 | } |
553 | if(fileL !="./") { | 555 | if(fileL !="./" && fi->exists()) { |
554 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 556 | item= new QListViewItem( Local_View,fileL,fileS , fileDate); |
555 | QPixmap pm; | 557 | QPixmap pm; |
556 | pm= Resource::loadPixmap( "folder" ); | ||
557 | 558 | ||
558 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 559 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
559 | if( !QDir( fi->filePath() ).isReadable()) | 560 | if( !QDir( fi->filePath() ).isReadable()) |
560 | pm = Resource::loadPixmap( "lockedfolder" ); | 561 | pm = Resource::loadPixmap( "lockedfolder" ); |
562 | else | ||
563 | pm= Resource::loadPixmap( "folder" ); | ||
561 | item->setPixmap( 0,pm ); | 564 | item->setPixmap( 0,pm ); |
562 | } else { | 565 | } else { |
563 | if( !fi->isReadable() ) | 566 | if( !fi->isReadable() ) |
564 | pm = Resource::loadPixmap( "locked" ); | 567 | pm = Resource::loadPixmap( "locked" ); |
565 | else | 568 | else { |
566 | pm = Resource::loadPixmap( "fileopen" ); | 569 | MimeType mt(fi->filePath()); |
567 | item->setPixmap( 0,pm); | 570 | pm=mt.pixmap(); |
571 | if(pm.isNull()) | ||
572 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
573 | item->setPixmap( 0,pm); | ||
574 | } | ||
568 | } | 575 | } |
569 | if( fileL.find("->",0,TRUE) != -1) { | 576 | if( fileL.find("->",0,TRUE) != -1) { |
570 | // overlay link image | 577 | // overlay link image |
578 | pm= Resource::loadPixmap( "folder" ); | ||
571 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 579 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
572 | QPainter painter( &pm ); | 580 | QPainter painter( &pm ); |
573 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 581 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
574 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 582 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
575 | item->setPixmap( 0, pm); | 583 | item->setPixmap( 0, pm); |
576 | } | 584 | } |
577 | } | 585 | } |
578 | isDir=FALSE; | 586 | isDir=FALSE; |
@@ -635,102 +643,106 @@ bool OpieFtp::populateRemoteView( ) | |||
635 | } else | 643 | } else |
636 | qDebug("temp file not opened successfullly "+sfile); | 644 | qDebug("temp file not opened successfullly "+sfile); |
637 | Remote_View->setSorting( 4,TRUE); | 645 | Remote_View->setSorting( 4,TRUE); |
638 | return true; | 646 | return true; |
639 | } | 647 | } |
640 | 648 | ||
641 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 649 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
642 | { | 650 | { |
643 | QCopEnvelope ( "QPE/System", "busy()" ); | 651 | if(item) { |
644 | QString oldRemoteCurrentDir = currentRemoteDir; | 652 | QCopEnvelope ( "QPE/System", "busy()" ); |
645 | QString strItem=selectedItem->text(0); | 653 | QString oldRemoteCurrentDir = currentRemoteDir; |
646 | strItem=strItem.simplifyWhiteSpace(); | 654 | QString strItem=selectedItem->text(0); |
647 | if(strItem == "../") { // the user wants to go ^ | 655 | strItem=strItem.simplifyWhiteSpace(); |
648 | if( FtpCDUp( conn) == 0) { | 656 | if(strItem == "../") { // the user wants to go ^ |
649 | QString msg; | 657 | if( FtpCDUp( conn) == 0) { |
650 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 658 | QString msg; |
651 | msg.replace(QRegExp(":"),"\n"); | 659 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
652 | QMessageBox::message(tr("Note"),msg); | 660 | msg.replace(QRegExp(":"),"\n"); |
653 | qDebug(msg); | 661 | QMessageBox::message(tr("Note"),msg); |
654 | } | 662 | qDebug(msg); |
655 | char path[256]; | ||
656 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | ||
657 | QString msg; | ||
658 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | ||
659 | msg.replace(QRegExp(":"),"\n"); | ||
660 | QMessageBox::message(tr("Note"),msg); | ||
661 | qDebug(msg); | ||
662 | } | ||
663 | currentRemoteDir=path; | ||
664 | } else { | ||
665 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | ||
666 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | ||
667 | strItem = strItem.stripWhiteSpace(); | ||
668 | currentRemoteDir = strItem; | ||
669 | if( !remoteChDir( (const QString &)strItem)) { | ||
670 | currentRemoteDir = oldRemoteCurrentDir; | ||
671 | strItem=""; | ||
672 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | ||
673 | } | 663 | } |
674 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 664 | char path[256]; |
675 | qDebug("trying directory"); | 665 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
676 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 666 | QString msg; |
677 | currentRemoteDir = oldRemoteCurrentDir; | 667 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
678 | strItem=""; | 668 | msg.replace(QRegExp(":"),"\n"); |
679 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 669 | QMessageBox::message(tr("Note"),msg); |
670 | qDebug(msg); | ||
671 | } | ||
672 | currentRemoteDir=path; | ||
673 | } else { | ||
674 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | ||
675 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | ||
676 | strItem = strItem.stripWhiteSpace(); | ||
677 | currentRemoteDir = strItem; | ||
678 | if( !remoteChDir( (const QString &)strItem)) { | ||
679 | currentRemoteDir = oldRemoteCurrentDir; | ||
680 | strItem=""; | ||
681 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | ||
682 | } | ||
683 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | ||
684 | qDebug("trying directory"); | ||
685 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | ||
686 | currentRemoteDir = oldRemoteCurrentDir; | ||
687 | strItem=""; | ||
688 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | ||
680 | 689 | ||
690 | } else { | ||
691 | currentRemoteDir = currentRemoteDir+strItem; | ||
692 | } | ||
681 | } else { | 693 | } else { |
682 | currentRemoteDir = currentRemoteDir+strItem; | 694 | qDebug("download "+strItem); |
683 | } | 695 | } |
684 | } else { | ||
685 | qDebug("download "+strItem); | ||
686 | } | 696 | } |
697 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | ||
698 | if(currentRemoteDir.right(1) !="/") | ||
699 | currentRemoteDir +="/"; | ||
700 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | ||
701 | fillRemoteCombo( (const QString &)currentDir); | ||
702 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
687 | } | 703 | } |
688 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | ||
689 | if(currentRemoteDir.right(1) !="/") | ||
690 | currentRemoteDir +="/"; | ||
691 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | ||
692 | fillRemoteCombo( (const QString &)currentDir); | ||
693 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
694 | } | 704 | } |
695 | 705 | ||
696 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 706 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
697 | { | 707 | { |
698 | QString strItem=selectedItem->text(0); | 708 | if(item) { |
699 | QString strSize=selectedItem->text(1); | 709 | QString strItem=selectedItem->text(0); |
700 | strSize=strSize.stripWhiteSpace(); | 710 | QString strSize=selectedItem->text(1); |
701 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 711 | strSize=strSize.stripWhiteSpace(); |
702 | // is symlink | 712 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
703 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 713 | // is symlink |
704 | if(QDir(strItem2).exists() ) { | 714 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
705 | currentDir.cd(strItem2, TRUE); | 715 | if(QDir(strItem2).exists() ) { |
706 | populateLocalView(); | 716 | currentDir.cd(strItem2, TRUE); |
707 | } | ||
708 | } else { // not a symlink | ||
709 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | ||
710 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | ||
711 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | ||
712 | currentDir.cd(strItem,FALSE); | ||
713 | populateLocalView(); | ||
714 | } else { | ||
715 | currentDir.cdUp(); | ||
716 | populateLocalView(); | 717 | populateLocalView(); |
717 | } | 718 | } |
718 | if(QDir(strItem).exists()){ | 719 | } else { // not a symlink |
719 | currentDir.cd(strItem, TRUE); | 720 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
720 | populateLocalView(); | 721 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
721 | } | 722 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
722 | } else { | 723 | currentDir.cd(strItem,FALSE); |
723 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 724 | populateLocalView(); |
724 | if( QFile::exists(strItem ) ) { | 725 | } else { |
725 | qDebug("upload "+strItem); | 726 | currentDir.cdUp(); |
726 | } | 727 | populateLocalView(); |
727 | } //end not symlink | 728 | } |
728 | chdir(strItem.latin1()); | 729 | if(QDir(strItem).exists()){ |
730 | currentDir.cd(strItem, TRUE); | ||
731 | populateLocalView(); | ||
732 | } | ||
733 | } else { | ||
734 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | ||
735 | if( QFile::exists(strItem ) ) { | ||
736 | qDebug("upload "+strItem); | ||
737 | } | ||
738 | } //end not symlink | ||
739 | chdir(strItem.latin1()); | ||
740 | } | ||
729 | } | 741 | } |
730 | } | 742 | } |
731 | 743 | ||
732 | void OpieFtp::doLocalCd() | 744 | void OpieFtp::doLocalCd() |
733 | { | 745 | { |
734 | localListClicked( Local_View->currentItem()); | 746 | localListClicked( Local_View->currentItem()); |
735 | } | 747 | } |
736 | 748 | ||
@@ -959,50 +971,50 @@ void OpieFtp::localRename() | |||
959 | } | 971 | } |
960 | populateLocalView(); | 972 | populateLocalView(); |
961 | } | 973 | } |
962 | 974 | ||
963 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { | 975 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
964 | if (TabWidget->currentPageIndex() == 0) { | 976 | if (TabWidget->currentPageIndex() == 0) { |
965 | chdir( currentPath.latin1() ); | 977 | chdir( currentPath.latin1() ); |
966 | currentDir.cd( currentPath, TRUE); | 978 | currentDir.cd( currentPath, TRUE); |
967 | populateLocalList(); | 979 | populateLocalView(); |
968 | update(); | 980 | update(); |
969 | } else { | 981 | } else { |
970 | // chdir( currentPath.latin1() ); | 982 | // chdir( currentPath.latin1() ); |
971 | // currentDir.cd( currentPath, TRUE); | 983 | // currentDir.cd( currentPath, TRUE); |
972 | // populateList(); | 984 | // populateList(); |
973 | // update(); | 985 | // update(); |
974 | 986 | ||
975 | } | 987 | } |
976 | } | 988 | } |
977 | 989 | ||
978 | void OpieFtp::fillCombo(const QString ¤tPath) { | 990 | void OpieFtp::fillCombo(const QString ¤tPath) { |
979 | 991 | ||
980 | currentPathComboBox->lineEdit()->setText(currentPath); | 992 | currentPathCombo->lineEdit()->setText(currentPath); |
981 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 993 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
982 | currentPathComboBox->clear(); | 994 | currentPathCombo->clear(); |
983 | localDirPathStringList.prepend(currentPath ); | 995 | localDirPathStringList.prepend(currentPath ); |
984 | currentPathComboBox->insertStringList( localDirPathStringList,-1); | 996 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
985 | } | 997 | } |
986 | currentPathComboBox->lineEdit()->setText(currentPath); | 998 | currentPathCombo->lineEdit()->setText(currentPath); |
987 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 999 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
988 | currentPathComboBox->clear(); | 1000 | currentPathCombo->clear(); |
989 | remoteDirPathStringList.prepend(currentPath ); | 1001 | remoteDirPathStringList.prepend(currentPath ); |
990 | currentPathComboBox->insertStringList( remoteDirPathStringList,-1); | 1002 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
991 | } | 1003 | } |
992 | } | 1004 | } |
993 | 1005 | ||
994 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | 1006 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { |
995 | 1007 | ||
996 | dirPathCombo->lineEdit()->setText(currentPath); | 1008 | currentPathCombo->lineEdit()->setText(currentPath); |
997 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1009 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
998 | dirPathCombo->clear(); | 1010 | currentPathCombo->clear(); |
999 | remoteDirPathStringList.prepend(currentPath ); | 1011 | remoteDirPathStringList.prepend(currentPath ); |
1000 | dirPathCombo->insertStringList( remoteDirPathStringList,-1); | 1012 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1001 | } | 1013 | } |
1002 | } | 1014 | } |
1003 | 1015 | ||
1004 | void OpieFtp::currentPathComboChanged() | 1016 | void OpieFtp::currentPathComboChanged() |
1005 | { | 1017 | { |
1006 | QString oldRemoteCurrentDir = currentRemoteDir; | 1018 | QString oldRemoteCurrentDir = currentRemoteDir; |
1007 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1019 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
1008 | if (TabWidget->currentPageIndex() == 0) { | 1020 | if (TabWidget->currentPageIndex() == 0) { |
@@ -1122,17 +1134,17 @@ void OpieFtp::serverComboSelected(int index) | |||
1122 | // remoteServerStr = ServerComboBox->text(index); | 1134 | // remoteServerStr = ServerComboBox->text(index); |
1123 | Config cfg("opieftp"); | 1135 | Config cfg("opieftp"); |
1124 | cfg.setGroup("Server"); | 1136 | cfg.setGroup("Server"); |
1125 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1137 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1126 | 1138 | ||
1127 | temp.setNum(index+1); | 1139 | temp.setNum(index+1); |
1128 | remoteServerStr = cfg.readEntry( temp,""); | 1140 | remoteServerStr = cfg.readEntry( temp,""); |
1129 | cfg.setGroup(temp); | 1141 | cfg.setGroup(temp); |
1130 | qDebug(temp); | 1142 | // qDebug(temp); |
1131 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1143 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1132 | port = remoteServerStr.right( divider - 1); | 1144 | port = remoteServerStr.right( divider - 1); |
1133 | bool ok; | 1145 | bool ok; |
1134 | int portInt = port.toInt(&ok,10); | 1146 | int portInt = port.toInt(&ok,10); |
1135 | if( portInt == 0) portInt = 21; | 1147 | if( portInt == 0) portInt = 21; |
1136 | 1148 | ||
1137 | PortSpinBox->setValue( portInt); | 1149 | PortSpinBox->setValue( portInt); |
1138 | 1150 | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 57599b7..32862c7 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -47,17 +47,17 @@ public: | |||
47 | OpieFtp( ); | 47 | OpieFtp( ); |
48 | ~OpieFtp(); | 48 | ~OpieFtp(); |
49 | 49 | ||
50 | QTabWidget *TabWidget; | 50 | QTabWidget *TabWidget; |
51 | QWidget *tab, *tab_2, *tab_3; | 51 | QWidget *tab, *tab_2, *tab_3; |
52 | QListView *Local_View, *Remote_View; | 52 | QListView *Local_View, *Remote_View; |
53 | 53 | ||
54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
55 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; | 55 | QLineEdit *PasswordEdit, *remotePath; |
56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
57 | QSpinBox* PortSpinBox; | 57 | QSpinBox* PortSpinBox; |
58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; | 58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; |
59 | QDir currentDir; | 59 | QDir currentDir; |
60 | QString currentRemoteDir; | 60 | QString currentRemoteDir; |
61 | QString filterStr; | 61 | QString filterStr; |
62 | QListViewItem * item; | 62 | QListViewItem * item; |
63 | QPushButton *connectServerBtn; | 63 | QPushButton *connectServerBtn; |
@@ -89,24 +89,23 @@ protected slots: | |||
89 | void remoteDelete(); | 89 | void remoteDelete(); |
90 | bool remoteDirList(const QString &); | 90 | bool remoteDirList(const QString &); |
91 | bool remoteChDir(const QString &); | 91 | bool remoteChDir(const QString &); |
92 | void tabChanged(QWidget*); | 92 | void tabChanged(QWidget*); |
93 | void cleanUp(); | 93 | void cleanUp(); |
94 | void remoteRename(); | 94 | void remoteRename(); |
95 | void localRename(); | 95 | void localRename(); |
96 | void currentPathComboChanged(); | 96 | void currentPathComboChanged(); |
97 | void fillCombos(); | 97 | void currentPathComboActivated(const QString &); |
98 | void fillCombo(const QString &); | ||
99 | void currentPathComboActivated(const QString &); | ||
100 | void switchToLocalTab(); | 98 | void switchToLocalTab(); |
101 | void switchToRemoteTab(); | 99 | void switchToRemoteTab(); |
102 | void switchToConfigTab(); | 100 | void switchToConfigTab(); |
103 | void fillCombo(); | 101 | void fillCombos(); |
104 | void fillRemoteCombo(); | 102 | void fillRemoteCombo(const QString&); |
103 | void fillCombo(const QString &); | ||
105 | void serverComboSelected(int); | 104 | void serverComboSelected(int); |
106 | void deleteServer(); | 105 | void deleteServer(); |
107 | void connectorBtnToggled(bool); | 106 | void connectorBtnToggled(bool); |
108 | protected: | 107 | protected: |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | 108 | QStringList remoteDirPathStringList, localDirPathStringList; |
110 | void nullifyCallBack(); | 109 | void nullifyCallBack(); |
111 | QGridLayout* tabLayout; | 110 | QGridLayout* tabLayout; |
112 | QGridLayout* tabLayout_2; | 111 | QGridLayout* tabLayout_2; |