-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4e14946..3d97ecb 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -169,51 +169,52 @@ OpieFtp::OpieFtp( ) | |||
169 | Local_View->setSelectionMode(QListView::Extended); | 169 | Local_View->setSelectionMode(QListView::Extended); |
170 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 170 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
171 | 171 | ||
172 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 172 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
173 | 173 | ||
174 | tabLayout->addWidget( Local_View, 0, 0 ); | 174 | tabLayout->addWidget( Local_View, 0, 0 ); |
175 | 175 | ||
176 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 176 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
177 | this,SLOT( localListClicked(QListViewItem *)) ); | 177 | this,SLOT( localListClicked(QListViewItem *)) ); |
178 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 178 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
179 | // this,SLOT( localListClicked(QListViewItem *)) ); | 179 | // this,SLOT( localListClicked(QListViewItem *)) ); |
180 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 180 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
181 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 181 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
182 | 182 | ||
183 | TabWidget->insertTab( tab, tr( "Local" ) ); | 183 | TabWidget->insertTab( tab, tr( "Local" ) ); |
184 | 184 | ||
185 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 185 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
186 | tabLayout_2 = new QGridLayout( tab_2 ); | 186 | tabLayout_2 = new QGridLayout( tab_2 ); |
187 | tabLayout_2->setSpacing( 2); | 187 | tabLayout_2->setSpacing( 2); |
188 | tabLayout_2->setMargin( 2); | 188 | tabLayout_2->setMargin( 2); |
189 | 189 | ||
190 | Remote_View = new QListView( tab_2, "Remote_View" ); | 190 | Remote_View = new QListView( tab_2, "Remote_View" ); |
191 | Remote_View->addColumn( tr("File"),150); | 191 | Remote_View->addColumn( tr("File"),150); |
192 | Remote_View->addColumn( tr("Date"),-1); | 192 | Remote_View->addColumn( tr("Date"),-1); |
193 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 193 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
194 | Remote_View->addColumn( tr("Size"),-1); | 194 | Remote_View->addColumn( tr("Size"),-1); |
195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
196 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | ||
196 | Remote_View->addColumn( tr("Dir"),-1); | 197 | Remote_View->addColumn( tr("Dir"),-1); |
197 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 198 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
198 | Remote_View->setAllColumnsShowFocus(TRUE); | 199 | Remote_View->setAllColumnsShowFocus(TRUE); |
199 | 200 | ||
200 | Remote_View->setMultiSelection( FALSE); | 201 | Remote_View->setMultiSelection( FALSE); |
201 | Remote_View->setSelectionMode(QListView::Extended); | 202 | Remote_View->setSelectionMode(QListView::Extended); |
202 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 203 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
203 | 204 | ||
204 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 205 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
205 | 206 | ||
206 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 207 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
207 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 208 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
208 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 209 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
209 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 210 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
210 | 211 | ||
211 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 212 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
212 | 213 | ||
213 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 214 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
214 | 215 | ||
215 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 216 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
216 | tabLayout_3 = new QGridLayout( tab_3 ); | 217 | tabLayout_3 = new QGridLayout( tab_3 ); |
217 | tabLayout_3->setSpacing( 2); | 218 | tabLayout_3->setSpacing( 2); |
218 | tabLayout_3->setMargin( 2); | 219 | tabLayout_3->setMargin( 2); |
219 | 220 | ||
@@ -700,79 +701,81 @@ void OpieFtp::populateLocalView() | |||
700 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 701 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
701 | item->setPixmap( 0, pm); | 702 | item->setPixmap( 0, pm); |
702 | } | 703 | } |
703 | } | 704 | } |
704 | isDir=FALSE; | 705 | isDir=FALSE; |
705 | ++it; | 706 | ++it; |
706 | } | 707 | } |
707 | Local_View->setSorting( 3,FALSE); | 708 | Local_View->setSorting( 3,FALSE); |
708 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 709 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
709 | fillCombo( (const QString &)currentDir); | 710 | fillCombo( (const QString &)currentDir); |
710 | } | 711 | } |
711 | 712 | ||
712 | bool OpieFtp::populateRemoteView( ) | 713 | bool OpieFtp::populateRemoteView( ) |
713 | { | 714 | { |
714 | // qDebug("populate remoteview"); | 715 | // qDebug("populate remoteview"); |
715 | QString sfile=QDir::homeDirPath(); | 716 | QString sfile=QDir::homeDirPath(); |
716 | if(sfile.right(1) != "/") | 717 | if(sfile.right(1) != "/") |
717 | sfile+="/._temp"; | 718 | sfile+="/._temp"; |
718 | else | 719 | else |
719 | sfile+="._temp"; | 720 | sfile+="._temp"; |
720 | QFile file( sfile); | 721 | QFile file( sfile); |
721 | Remote_View->clear(); | 722 | Remote_View->clear(); |
722 | QString s, File_Name; | 723 | QString s, File_Name; |
723 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 724 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
725 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | ||
724 | QString fileL, fileS, fileDate; | 726 | QString fileL, fileS, fileDate; |
725 | if ( file.open(IO_ReadOnly)) { | 727 | if ( file.open(IO_ReadOnly)) { |
726 | QTextStream t( &file ); // use a text stream | 728 | QTextStream t( &file ); // use a text stream |
727 | while ( !t.eof()) { | 729 | while ( !t.eof()) { |
728 | s = t.readLine(); | 730 | s = t.readLine(); |
729 | fileL = s.right(s.length()-55); | 731 | |
730 | fileL = fileL.stripWhiteSpace(); | 732 | if(s.find("total",0,TRUE) == 0) |
733 | continue; | ||
734 | |||
735 | int len, month = monthRe.match(s, 0, &len); | ||
736 | fileDate = s.mid(month + 1, len - 2); // minus spaces | ||
737 | fileL = s.right(s.length() - month - len); | ||
731 | if(s.left(1) == "d") | 738 | if(s.left(1) == "d") |
732 | fileL = fileL+"/"; | 739 | fileL = fileL+"/"; |
733 | // fileL = "/"+fileL+"/"; | 740 | fileS = s.mid(month - 8, 8); // FIXME |
734 | fileS = s.mid( 30, 42-30); | ||
735 | fileS = fileS.stripWhiteSpace(); | 741 | fileS = fileS.stripWhiteSpace(); |
736 | fileDate = s.mid( 42, 55-42); | 742 | |
737 | fileDate = fileDate.stripWhiteSpace(); | ||
738 | if(fileL.find("total",0,TRUE) == -1) { | ||
739 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 743 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
740 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 744 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
741 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 745 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
742 | // if(itemDir) | 746 | // if(itemDir) |
743 | item->moveItem(itemDir); | 747 | item->moveItem(itemDir); |
744 | itemDir=item; | 748 | itemDir=item; |
745 | } else { | 749 | } else { |
746 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 750 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
747 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 751 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
748 | // if(itemFile) | 752 | // if(itemFile) |
749 | item->moveItem(itemDir); | 753 | item->moveItem(itemDir); |
750 | item->moveItem(itemFile); | 754 | item->moveItem(itemFile); |
751 | itemFile=item; | 755 | itemFile=item; |
752 | } | 756 | } |
753 | } | 757 | } |
754 | } | ||
755 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 758 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
756 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 759 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
757 | file.close(); | 760 | file.close(); |
758 | if( file.exists()) | 761 | if( file.exists()) |
759 | file. remove(); | 762 | file. remove(); |
760 | } else | 763 | } else |
761 | qDebug("temp file not opened successfullly "+sfile); | 764 | qDebug("temp file not opened successfullly "+sfile); |
762 | Remote_View->setSorting( 4,TRUE); | 765 | Remote_View->setSorting( 4,TRUE); |
763 | return true; | 766 | return true; |
764 | } | 767 | } |
765 | 768 | ||
766 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 769 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
767 | { | 770 | { |
768 | if( selectedItem) { | 771 | if( selectedItem) { |
769 | // QCopEnvelope ( "QPE/System", "busy()" ); | 772 | // QCopEnvelope ( "QPE/System", "busy()" ); |
770 | QString oldRemoteCurrentDir = currentRemoteDir; | 773 | QString oldRemoteCurrentDir = currentRemoteDir; |
771 | QString strItem=selectedItem->text(0); | 774 | QString strItem=selectedItem->text(0); |
772 | strItem=strItem.simplifyWhiteSpace(); | 775 | strItem=strItem.simplifyWhiteSpace(); |
773 | if(strItem == "../") { // the user wants to go ^ | 776 | if(strItem == "../") { // the user wants to go ^ |
774 | if( FtpCDUp( conn) == 0) { | 777 | if( FtpCDUp( conn) == 0) { |
775 | QString msg; | 778 | QString msg; |
776 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 779 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
777 | msg.replace(QRegExp(":"),"\n"); | 780 | msg.replace(QRegExp(":"),"\n"); |
778 | QMessageBox::message(tr("Note"),msg); | 781 | QMessageBox::message(tr("Note"),msg); |