-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 @@ -120,42 +120,42 @@ OpieFtp::OpieFtp( ) tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); Local_View->addColumn( tr("File"),150); Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(1,QListView::AlignRight); Local_View->addColumn( tr("Date"),-1); Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); Local_View->setMultiSelection( TRUE ); - QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); + QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); tabLayout->addWidget( Local_View, 0, 0 ); - connect( Local_View, SIGNAL( clicked( QListViewItem*)), - this,SLOT( localListClicked(QListViewItem *)) ); + connect( Local_View, SIGNAL( clicked( QListViewItem*)), + this,SLOT( localListClicked(QListViewItem *)) ); // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), // this,SLOT( localListClicked(QListViewItem *)) ); - connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); +// connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), +// this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); TabWidget->insertTab( tab, tr( "Local" ) ); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing( 2); tabLayout_2->setMargin( 2); Remote_View = new QListView( tab_2, "Remote_View" ); Remote_View->addColumn( tr("File"),150); Remote_View->addColumn( tr("Size"),-1); Remote_View->setColumnAlignment(1,QListView::AlignRight); Remote_View->addColumn( tr("Date"),-1); Remote_View->setColumnAlignment(2,QListView::AlignRight); Remote_View->addColumn( tr("Dir"),-1); Remote_View->setColumnAlignment(4,QListView::AlignRight); @@ -248,44 +248,32 @@ OpieFtp::OpieFtp( ) currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); currentPathCombo->setEditable(TRUE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); connect( currentPathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( currentPathComboActivated( const QString & ) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); ProgressBar = new QProgressBar( this, "ProgressBar" ); layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); // fillCombos(); -#ifdef DEVELOPERS_VERSION - ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); - UsernameComboBox->lineEdit()->setText("root"); - PortSpinBox->setValue( 4242); - remotePath->setText( currentRemoteDir = "/"); -// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); -// UsernameComboBox->lineEdit()->setText("llornkcor"); -// PortSpinBox->setValue( 21); -// remotePath->setText( currentRemoteDir = "/home/llornkcor"); - PasswordEdit->setText( tr( "" ) ); -#endif - filterStr="*"; b=FALSE; populateLocalView(); readConfig(); ServerComboBox->setCurrentItem(currentServerConfig); TabWidget->setCurrentPage(2); } OpieFtp::~OpieFtp() { } void OpieFtp::cleanUp() { if(conn) FtpQuit(conn); @@ -710,34 +698,36 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) } } else { qDebug("download "+strItem); } } remoteDirList( (const QString &)currentRemoteDir); //this also calls populate if(currentRemoteDir.right(1) !="/") currentRemoteDir +="/"; currentPathCombo->lineEdit()->setText( currentRemoteDir ); fillRemoteCombo( (const QString &)currentDir); QCopEnvelope ( "QPE/System", "notBusy()" ); } } void OpieFtp::localListClicked(QListViewItem *selectedItem) { - if(item) { - QString strItem=selectedItem->text(0); +// qDebug(selectedItem->text(0)); + if(item!= NULL) { + + QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink // is symlink QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); if(QDir(strItem2).exists() ) { currentDir.cd(strItem2, TRUE); populateLocalView(); } } else { // not a symlink if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); currentDir.cd(strItem,FALSE); populateLocalView(); } else { @@ -776,69 +766,67 @@ void OpieFtp::showHidden() currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); localMenu->setItemChecked(localMenu->idAt(0),TRUE); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); b=TRUE; } else { currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); localMenu->setItemChecked(localMenu->idAt(0),FALSE); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); b=FALSE; } populateLocalView(); } void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) { - switch (mouse) { - case 1: - break; - case 2: +// if(item) +if (mouse == 2) { showLocalMenu(item); - break; - }; + } } void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) { switch (mouse) { case 1: break; case 2: showRemoteMenu(item); break; }; } void OpieFtp::showRemoteMenu(QListViewItem * item) { QPopupMenu m;// = new QPopupMenu( Local_View ); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); else m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); m.exec( QCursor::pos() ); } void OpieFtp::showLocalMenu(QListViewItem * item) { - QPopupMenu m; + + QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); m.insertSeparator(); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); else m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); m.setCheckable(TRUE); if (b) m.setItemChecked(m.idAt(0),TRUE); else m.setItemChecked(m.idAt(0),FALSE); |