-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 52 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 9 |
2 files changed, 36 insertions, 25 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 | |||
@@ -21,6 +21,7 @@ | |||
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> |
@@ -202,6 +203,7 @@ OpieFtp::OpieFtp( ) | |||
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 | ||
@@ -225,7 +227,6 @@ OpieFtp::OpieFtp( ) | |||
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 | ||
@@ -240,11 +241,11 @@ OpieFtp::OpieFtp( ) | |||
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())); |
@@ -265,6 +266,7 @@ OpieFtp::OpieFtp( ) | |||
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(); |
@@ -326,7 +328,7 @@ void OpieFtp::newConnection() | |||
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 | ||
@@ -550,24 +552,30 @@ void OpieFtp::populateLocalView() | |||
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()); |
570 | pm=mt.pixmap(); | ||
571 | if(pm.isNull()) | ||
572 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
567 | item->setPixmap( 0,pm); | 573 | item->setPixmap( 0,pm); |
568 | } | 574 | } |
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 ); |
@@ -640,6 +648,7 @@ bool OpieFtp::populateRemoteView( ) | |||
640 | 648 | ||
641 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 649 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
642 | { | 650 | { |
651 | if(item) { | ||
643 | QCopEnvelope ( "QPE/System", "busy()" ); | 652 | QCopEnvelope ( "QPE/System", "busy()" ); |
644 | QString oldRemoteCurrentDir = currentRemoteDir; | 653 | QString oldRemoteCurrentDir = currentRemoteDir; |
645 | QString strItem=selectedItem->text(0); | 654 | QString strItem=selectedItem->text(0); |
@@ -692,9 +701,11 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
692 | fillRemoteCombo( (const QString &)currentDir); | 701 | fillRemoteCombo( (const QString &)currentDir); |
693 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 702 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
694 | } | 703 | } |
704 | } | ||
695 | 705 | ||
696 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 706 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
697 | { | 707 | { |
708 | if(item) { | ||
698 | QString strItem=selectedItem->text(0); | 709 | QString strItem=selectedItem->text(0); |
699 | QString strSize=selectedItem->text(1); | 710 | QString strSize=selectedItem->text(1); |
700 | strSize=strSize.stripWhiteSpace(); | 711 | strSize=strSize.stripWhiteSpace(); |
@@ -728,6 +739,7 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) | |||
728 | chdir(strItem.latin1()); | 739 | chdir(strItem.latin1()); |
729 | } | 740 | } |
730 | } | 741 | } |
742 | } | ||
731 | 743 | ||
732 | void OpieFtp::doLocalCd() | 744 | void OpieFtp::doLocalCd() |
733 | { | 745 | { |
@@ -964,7 +976,7 @@ 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() ); |
@@ -977,27 +989,27 @@ void OpieFtp::currentPathComboActivated(const QString & currentPath) { | |||
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 | ||
@@ -1127,7 +1139,7 @@ void OpieFtp::serverComboSelected(int index) | |||
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; |
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 | |||
@@ -52,7 +52,7 @@ public: | |||
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; |
@@ -94,14 +94,13 @@ protected slots: | |||
94 | void remoteRename(); | 94 | void remoteRename(); |
95 | void localRename(); | 95 | void localRename(); |
96 | void currentPathComboChanged(); | 96 | void currentPathComboChanged(); |
97 | void fillCombos(); | ||
98 | void fillCombo(const QString &); | ||
99 | void currentPathComboActivated(const QString &); | 97 | 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); |