-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index efcaf84..36de842 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -124,34 +124,34 @@ OpieFtp::OpieFtp( ) | |||
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"),150); | 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 ); | 134 | Local_View->setMultiSelection( TRUE ); |
135 | 135 | ||
136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
137 | 137 | ||
138 | tabLayout->addWidget( Local_View, 0, 0 ); | 138 | tabLayout->addWidget( Local_View, 0, 0 ); |
139 | 139 | ||
140 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 140 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
141 | this,SLOT( localListClicked(QListViewItem *)) ); | 141 | this,SLOT( localListClicked(QListViewItem *)) ); |
142 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 142 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
143 | // this,SLOT( localListClicked(QListViewItem *)) ); | 143 | // this,SLOT( localListClicked(QListViewItem *)) ); |
144 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 144 | // connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
145 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 145 | // this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
146 | 146 | ||
147 | TabWidget->insertTab( tab, tr( "Local" ) ); | 147 | TabWidget->insertTab( tab, tr( "Local" ) ); |
148 | 148 | ||
149 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 149 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
150 | tabLayout_2 = new QGridLayout( tab_2 ); | 150 | tabLayout_2 = new QGridLayout( tab_2 ); |
151 | tabLayout_2->setSpacing( 2); | 151 | tabLayout_2->setSpacing( 2); |
152 | tabLayout_2->setMargin( 2); | 152 | tabLayout_2->setMargin( 2); |
153 | 153 | ||
154 | Remote_View = new QListView( tab_2, "Remote_View" ); | 154 | Remote_View = new QListView( tab_2, "Remote_View" ); |
155 | Remote_View->addColumn( tr("File"),150); | 155 | Remote_View->addColumn( tr("File"),150); |
156 | Remote_View->addColumn( tr("Size"),-1); | 156 | Remote_View->addColumn( tr("Size"),-1); |
157 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 157 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
@@ -252,36 +252,24 @@ OpieFtp::OpieFtp( ) | |||
252 | 252 | ||
253 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 253 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
254 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 254 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
255 | 255 | ||
256 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 256 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
257 | this,SLOT(currentPathComboChanged())); | 257 | this,SLOT(currentPathComboChanged())); |
258 | 258 | ||
259 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 259 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
260 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 260 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
261 | 261 | ||
262 | // fillCombos(); | 262 | // fillCombos(); |
263 | 263 | ||
264 | #ifdef DEVELOPERS_VERSION | ||
265 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | ||
266 | UsernameComboBox->lineEdit()->setText("root"); | ||
267 | PortSpinBox->setValue( 4242); | ||
268 | remotePath->setText( currentRemoteDir = "/"); | ||
269 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | ||
270 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | ||
271 | // PortSpinBox->setValue( 21); | ||
272 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); | ||
273 | PasswordEdit->setText( tr( "" ) ); | ||
274 | #endif | ||
275 | |||
276 | filterStr="*"; | 264 | filterStr="*"; |
277 | b=FALSE; | 265 | b=FALSE; |
278 | populateLocalView(); | 266 | populateLocalView(); |
279 | readConfig(); | 267 | readConfig(); |
280 | ServerComboBox->setCurrentItem(currentServerConfig); | 268 | ServerComboBox->setCurrentItem(currentServerConfig); |
281 | TabWidget->setCurrentPage(2); | 269 | TabWidget->setCurrentPage(2); |
282 | } | 270 | } |
283 | 271 | ||
284 | OpieFtp::~OpieFtp() | 272 | OpieFtp::~OpieFtp() |
285 | { | 273 | { |
286 | } | 274 | } |
287 | 275 | ||
@@ -714,26 +702,28 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
714 | } | 702 | } |
715 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 703 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
716 | if(currentRemoteDir.right(1) !="/") | 704 | if(currentRemoteDir.right(1) !="/") |
717 | currentRemoteDir +="/"; | 705 | currentRemoteDir +="/"; |
718 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 706 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
719 | fillRemoteCombo( (const QString &)currentDir); | 707 | fillRemoteCombo( (const QString &)currentDir); |
720 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 708 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
721 | } | 709 | } |
722 | } | 710 | } |
723 | 711 | ||
724 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 712 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
725 | { | 713 | { |
726 | if(item) { | 714 | // qDebug(selectedItem->text(0)); |
727 | QString strItem=selectedItem->text(0); | 715 | if(item!= NULL) { |
716 | |||
717 | QString strItem=selectedItem->text(0); | ||
728 | QString strSize=selectedItem->text(1); | 718 | QString strSize=selectedItem->text(1); |
729 | strSize=strSize.stripWhiteSpace(); | 719 | strSize=strSize.stripWhiteSpace(); |
730 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 720 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
731 | // is symlink | 721 | // is symlink |
732 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 722 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
733 | if(QDir(strItem2).exists() ) { | 723 | if(QDir(strItem2).exists() ) { |
734 | currentDir.cd(strItem2, TRUE); | 724 | currentDir.cd(strItem2, TRUE); |
735 | populateLocalView(); | 725 | populateLocalView(); |
736 | } | 726 | } |
737 | } else { // not a symlink | 727 | } else { // not a symlink |
738 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 728 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
739 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 729 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
@@ -780,31 +770,28 @@ void OpieFtp::showHidden() | |||
780 | 770 | ||
781 | } else { | 771 | } else { |
782 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 772 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
783 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 773 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
784 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 774 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
785 | b=FALSE; | 775 | b=FALSE; |
786 | } | 776 | } |
787 | populateLocalView(); | 777 | populateLocalView(); |
788 | } | 778 | } |
789 | 779 | ||
790 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 780 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
791 | { | 781 | { |
792 | switch (mouse) { | 782 | // if(item) |
793 | case 1: | 783 | if (mouse == 2) { |
794 | break; | ||
795 | case 2: | ||
796 | showLocalMenu(item); | 784 | showLocalMenu(item); |
797 | break; | 785 | } |
798 | }; | ||
799 | } | 786 | } |
800 | 787 | ||
801 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 788 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
802 | { | 789 | { |
803 | switch (mouse) { | 790 | switch (mouse) { |
804 | case 1: | 791 | case 1: |
805 | break; | 792 | break; |
806 | case 2: | 793 | case 2: |
807 | showRemoteMenu(item); | 794 | showRemoteMenu(item); |
808 | break; | 795 | break; |
809 | }; | 796 | }; |
810 | } | 797 | } |
@@ -816,25 +803,26 @@ void OpieFtp::showRemoteMenu(QListViewItem * item) | |||
816 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 803 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
817 | else | 804 | else |
818 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 805 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
819 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 806 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
820 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 807 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
821 | m.insertSeparator(); | 808 | m.insertSeparator(); |
822 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 809 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
823 | m.exec( QCursor::pos() ); | 810 | m.exec( QCursor::pos() ); |
824 | } | 811 | } |
825 | 812 | ||
826 | void OpieFtp::showLocalMenu(QListViewItem * item) | 813 | void OpieFtp::showLocalMenu(QListViewItem * item) |
827 | { | 814 | { |
828 | QPopupMenu m; | 815 | |
816 | QPopupMenu m; | ||
829 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 817 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
830 | m.insertSeparator(); | 818 | m.insertSeparator(); |
831 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 819 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
832 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 820 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
833 | else | 821 | else |
834 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 822 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
835 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 823 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
836 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 824 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
837 | m.insertSeparator(); | 825 | m.insertSeparator(); |
838 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 826 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
839 | m.setCheckable(TRUE); | 827 | m.setCheckable(TRUE); |
840 | if (b) | 828 | if (b) |