-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 14 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 109 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 12 |
3 files changed, 109 insertions, 26 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 41e800c..acd50c2 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -194,16 +194,24 @@ void fileBrowser::populateList() | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | if(fileL !="./") { | 196 | if(fileL !="./") { |
197 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 197 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
198 | QPixmap pm; | 198 | QPixmap pm; |
199 | pm= Resource::loadPixmap( "folder" ); | 199 | pm= Resource::loadPixmap( "folder" ); |
200 | if(isDir || fileL.find("/",0,TRUE) != -1) | 200 | |
201 | if(isDir || fileL.find("/",0,TRUE) != -1) { | ||
202 | if( !QDir( fi->filePath() ).isReadable()) | ||
203 | pm = Resource::loadPixmap( "lockedfolder" ); | ||
201 | item->setPixmap( 0,pm ); | 204 | item->setPixmap( 0,pm ); |
202 | else | 205 | } else { |
203 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 206 | if( !fi->isReadable() ) |
207 | pm = Resource::loadPixmap( "locked" ); | ||
208 | else | ||
209 | pm = Resource::loadPixmap( "fileopen" ); | ||
210 | item->setPixmap( 0,pm); | ||
211 | } | ||
204 | if( fileL.find("->",0,TRUE) != -1) { | 212 | if( fileL.find("->",0,TRUE) != -1) { |
205 | // overlay link image | 213 | // overlay link image |
206 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 214 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
207 | QPainter painter( &pm ); | 215 | QPainter painter( &pm ); |
208 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 216 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
209 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 217 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e97a9bf..37e2134 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -19,12 +19,13 @@ | |||
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 | 24 | ||
25 | #include <qstringlist.h> | ||
25 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
26 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
27 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
28 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
29 | #include <qdir.h> | 30 | #include <qdir.h> |
30 | #include <qfile.h> | 31 | #include <qfile.h> |
@@ -233,17 +234,23 @@ OpieFtp::OpieFtp( ) | |||
233 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 234 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
234 | this,SLOT(tabChanged(QWidget*))); | 235 | this,SLOT(tabChanged(QWidget*))); |
235 | 236 | ||
236 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 237 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
237 | currentDir.setPath( QDir::currentDirPath()); | 238 | currentDir.setPath( QDir::currentDirPath()); |
238 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 239 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
239 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | ||
240 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); | ||
241 | 240 | ||
242 | currentPathEdit->setText( currentDir.canonicalPath()); | 241 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
243 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 242 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); |
243 | |||
244 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
245 | |||
246 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | ||
247 | this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) ); | ||
248 | |||
249 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | ||
250 | this,SLOT(currentPathComboChanged())); | ||
244 | 251 | ||
245 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 252 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
246 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 253 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
247 | 254 | ||
248 | // fillCombos(); | 255 | // fillCombos(); |
249 | 256 | ||
@@ -284,19 +291,19 @@ void OpieFtp::cleanUp() | |||
284 | file.remove(); | 291 | file.remove(); |
285 | } | 292 | } |
286 | 293 | ||
287 | void OpieFtp::tabChanged(QWidget *w) | 294 | void OpieFtp::tabChanged(QWidget *w) |
288 | { | 295 | { |
289 | if (TabWidget->currentPageIndex() == 0) { | 296 | if (TabWidget->currentPageIndex() == 0) { |
290 | currentPathEdit->setText( currentDir.canonicalPath()); | 297 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
291 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 298 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
292 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 299 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
293 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 300 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
294 | } | 301 | } |
295 | if (TabWidget->currentPageIndex() == 1) { | 302 | if (TabWidget->currentPageIndex() == 1) { |
296 | currentPathEdit->setText( currentRemoteDir ); | 303 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
297 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 304 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
298 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 305 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
299 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 306 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
300 | } | 307 | } |
301 | if (TabWidget->currentPageIndex() == 2) { | 308 | if (TabWidget->currentPageIndex() == 2) { |
302 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 309 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
@@ -541,23 +548,43 @@ void OpieFtp::populateLocalView() | |||
541 | fileL+="/"; | 548 | fileL+="/"; |
542 | isDir=TRUE; | 549 | isDir=TRUE; |
543 | // qDebug( fileL); | 550 | // qDebug( fileL); |
544 | } | 551 | } |
545 | } | 552 | } |
546 | if(fileL !="./") { | 553 | if(fileL !="./") { |
547 | item = new QListViewItem( Local_View,fileL,fileS, fileDate); | 554 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
548 | if(isDir || fileL.find("/",0,TRUE) != -1) | 555 | QPixmap pm; |
549 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 556 | pm= Resource::loadPixmap( "folder" ); |
550 | else | 557 | |
551 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 558 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
559 | if( !QDir( fi->filePath() ).isReadable()) | ||
560 | pm = Resource::loadPixmap( "lockedfolder" ); | ||
561 | item->setPixmap( 0,pm ); | ||
562 | } else { | ||
563 | if( !fi->isReadable() ) | ||
564 | pm = Resource::loadPixmap( "locked" ); | ||
565 | else | ||
566 | pm = Resource::loadPixmap( "fileopen" ); | ||
567 | item->setPixmap( 0,pm); | ||
568 | } | ||
569 | if( fileL.find("->",0,TRUE) != -1) { | ||
570 | // overlay link image | ||
571 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | ||
572 | QPainter painter( &pm ); | ||
573 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
574 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
575 | item->setPixmap( 0, pm); | ||
576 | } | ||
552 | } | 577 | } |
553 | isDir=FALSE; | 578 | isDir=FALSE; |
554 | ++it; | 579 | ++it; |
555 | } | 580 | } |
556 | Local_View->setSorting( 3,FALSE); | 581 | Local_View->setSorting( 3,FALSE); |
557 | currentPathEdit->setText( currentDir.canonicalPath() ); | 582 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
583 | fillCombo( (const QString &)currentDir); | ||
584 | |||
558 | } | 585 | } |
559 | 586 | ||
560 | bool OpieFtp::populateRemoteView( ) | 587 | bool OpieFtp::populateRemoteView( ) |
561 | { | 588 | { |
562 | // qDebug("populate remoteview"); | 589 | // qDebug("populate remoteview"); |
563 | QString sfile=QDir::homeDirPath(); | 590 | QString sfile=QDir::homeDirPath(); |
@@ -658,13 +685,14 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
658 | qDebug("download "+strItem); | 685 | qDebug("download "+strItem); |
659 | } | 686 | } |
660 | } | 687 | } |
661 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 688 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
662 | if(currentRemoteDir.right(1) !="/") | 689 | if(currentRemoteDir.right(1) !="/") |
663 | currentRemoteDir +="/"; | 690 | currentRemoteDir +="/"; |
664 | currentPathEdit->setText( currentRemoteDir ); | 691 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
692 | fillRemoteCombo( (const QString &)currentDir); | ||
665 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 693 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
666 | } | 694 | } |
667 | 695 | ||
668 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 696 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
669 | { | 697 | { |
670 | QString strItem=selectedItem->text(0); | 698 | QString strItem=selectedItem->text(0); |
@@ -929,33 +957,74 @@ void OpieFtp::localRename() | |||
929 | if( rename(oldname.latin1(), newName.latin1())== -1) | 957 | if( rename(oldname.latin1(), newName.latin1())== -1) |
930 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 958 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
931 | } | 959 | } |
932 | populateLocalView(); | 960 | populateLocalView(); |
933 | } | 961 | } |
934 | 962 | ||
935 | void OpieFtp::currentPathEditChanged() | 963 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
964 | if (TabWidget->currentPageIndex() == 0) { | ||
965 | chdir( currentPath.latin1() ); | ||
966 | currentDir.cd( currentPath, TRUE); | ||
967 | populateLocalList(); | ||
968 | update(); | ||
969 | } else { | ||
970 | // chdir( currentPath.latin1() ); | ||
971 | // currentDir.cd( currentPath, TRUE); | ||
972 | // populateList(); | ||
973 | // update(); | ||
974 | |||
975 | } | ||
976 | } | ||
977 | |||
978 | void OpieFtp::fillCombo(const QString ¤tPath) { | ||
979 | |||
980 | currentPathComboBox->lineEdit()->setText(currentPath); | ||
981 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
982 | currentPathComboBox->clear(); | ||
983 | localDirPathStringList.prepend(currentPath ); | ||
984 | currentPathComboBox->insertStringList( localDirPathStringList,-1); | ||
985 | } | ||
986 | currentPathComboBox->lineEdit()->setText(currentPath); | ||
987 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
988 | currentPathComboBox->clear(); | ||
989 | remoteDirPathStringList.prepend(currentPath ); | ||
990 | currentPathComboBox->insertStringList( remoteDirPathStringList,-1); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | ||
995 | |||
996 | dirPathCombo->lineEdit()->setText(currentPath); | ||
997 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | ||
998 | dirPathCombo->clear(); | ||
999 | remoteDirPathStringList.prepend(currentPath ); | ||
1000 | dirPathCombo->insertStringList( remoteDirPathStringList,-1); | ||
1001 | } | ||
1002 | } | ||
1003 | |||
1004 | void OpieFtp::currentPathComboChanged() | ||
936 | { | 1005 | { |
937 | QString oldRemoteCurrentDir = currentRemoteDir; | 1006 | QString oldRemoteCurrentDir = currentRemoteDir; |
938 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1007 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
939 | if (TabWidget->currentPageIndex() == 0) { | 1008 | if (TabWidget->currentPageIndex() == 0) { |
940 | if(QDir( currentPathEdit->text()).exists()) { | 1009 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
941 | currentDir.setPath( currentPathEdit->text() ); | 1010 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
942 | populateLocalView(); | 1011 | populateLocalView(); |
943 | } else { | 1012 | } else { |
944 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 1013 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
945 | } | 1014 | } |
946 | } | 1015 | } |
947 | if (TabWidget->currentPageIndex() == 1) { | 1016 | if (TabWidget->currentPageIndex() == 1) { |
948 | currentRemoteDir = currentPathEdit->text(); | 1017 | currentRemoteDir = currentPathCombo->lineEdit()->text(); |
949 | if(currentRemoteDir.right(1) !="/") { | 1018 | if(currentRemoteDir.right(1) !="/") { |
950 | currentRemoteDir = currentRemoteDir +"/"; | 1019 | currentRemoteDir = currentRemoteDir +"/"; |
951 | currentPathEdit->setText( currentRemoteDir ); | 1020 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
952 | } | 1021 | } |
953 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { | 1022 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
954 | currentRemoteDir = oldRemoteCurrentDir; | 1023 | currentRemoteDir = oldRemoteCurrentDir; |
955 | currentPathEdit->setText( currentRemoteDir ); | 1024 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
956 | } | 1025 | } |
957 | 1026 | ||
958 | remoteDirList( (const QString &)currentRemoteDir); | 1027 | remoteDirList( (const QString &)currentRemoteDir); |
959 | } | 1028 | } |
960 | } | 1029 | } |
961 | 1030 | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 52ed885..57599b7 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -34,12 +34,13 @@ class QPEToolBar; | |||
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | 39 | class QPushButton; |
40 | class QStringList; | ||
40 | 41 | ||
41 | class OpieFtp : public QMainWindow | 42 | class OpieFtp : public QMainWindow |
42 | { | 43 | { |
43 | Q_OBJECT | 44 | Q_OBJECT |
44 | 45 | ||
45 | public: | 46 | public: |
@@ -47,13 +48,13 @@ public: | |||
47 | ~OpieFtp(); | 48 | ~OpieFtp(); |
48 | 49 | ||
49 | QTabWidget *TabWidget; | 50 | QTabWidget *TabWidget; |
50 | QWidget *tab, *tab_2, *tab_3; | 51 | QWidget *tab, *tab_2, *tab_3; |
51 | QListView *Local_View, *Remote_View; | 52 | QListView *Local_View, *Remote_View; |
52 | 53 | ||
53 | QComboBox *UsernameComboBox, *ServerComboBox; | 54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
54 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; | 55 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; |
55 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
56 | QSpinBox* PortSpinBox; | 57 | QSpinBox* PortSpinBox; |
57 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; | 58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; |
58 | QDir currentDir; | 59 | QDir currentDir; |
59 | QString currentRemoteDir; | 60 | QString currentRemoteDir; |
@@ -89,21 +90,26 @@ protected slots: | |||
89 | bool remoteDirList(const QString &); | 90 | bool remoteDirList(const QString &); |
90 | bool remoteChDir(const QString &); | 91 | bool remoteChDir(const QString &); |
91 | void tabChanged(QWidget*); | 92 | void tabChanged(QWidget*); |
92 | void cleanUp(); | 93 | void cleanUp(); |
93 | void remoteRename(); | 94 | void remoteRename(); |
94 | void localRename(); | 95 | void localRename(); |
95 | void currentPathEditChanged(); | 96 | void currentPathComboChanged(); |
97 | void fillCombos(); | ||
98 | void fillCombo(const QString &); | ||
99 | void currentPathComboActivated(const QString &); | ||
96 | void switchToLocalTab(); | 100 | void switchToLocalTab(); |
97 | void switchToRemoteTab(); | 101 | void switchToRemoteTab(); |
98 | void switchToConfigTab(); | 102 | void switchToConfigTab(); |
99 | void fillCombos(); | 103 | void fillCombo(); |
104 | void fillRemoteCombo(); | ||
100 | void serverComboSelected(int); | 105 | void serverComboSelected(int); |
101 | void deleteServer(); | 106 | void deleteServer(); |
102 | void connectorBtnToggled(bool); | 107 | void connectorBtnToggled(bool); |
103 | protected: | 108 | protected: |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | ||
104 | void nullifyCallBack(); | 110 | void nullifyCallBack(); |
105 | QGridLayout* tabLayout; | 111 | QGridLayout* tabLayout; |
106 | QGridLayout* tabLayout_2; | 112 | QGridLayout* tabLayout_2; |
107 | QGridLayout* tabLayout_3; | 113 | QGridLayout* tabLayout_3; |
108 | 114 | ||
109 | }; | 115 | }; |