summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp89
1 files changed, 43 insertions, 46 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 3e13466..956409f 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -129,13 +129,13 @@ OpieFtp::OpieFtp( )
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 );
-
+ Local_View->setSelectionMode(QlistView::Extended);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
connect( Local_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( localListClicked(QListViewItem *)) );
@@ -158,12 +158,13 @@ OpieFtp::OpieFtp( )
Remote_View->addColumn( tr("Date"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->addColumn( tr("Dir"),-1);
Remote_View->setColumnAlignment(4,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( TRUE );
+ Remote_View->setSelectionMode(QlistView::Extended);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
@@ -282,12 +283,13 @@ void OpieFtp::cleanUp()
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
+ exit(0);
}
void OpieFtp::tabChanged(QWidget *w)
{
if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
@@ -391,55 +393,54 @@ void OpieFtp::disConnector()
FtpQuit(conn);
setCaption("OpieFtp");
currentRemoteDir="/";
Remote_View->clear();
connectServerBtn->setText( tr("Connect"));
connectServerBtn->setOn(FALSE);
-
}
void OpieFtp::localUpload()
{
int fsz;
QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
- QListViewItemIterator it( Local_View );
- for ( ; it.current(); ++it ) {
- if ( it.current()->isSelected() ) {
- QString strItem = it.current()->text(0);
- QString localFile = currentDir.canonicalPath()+"/"+strItem;
- QString remoteFile= currentRemoteDir+strItem;
- QFileInfo fi(localFile);
- if( !fi.isDir()) {
- fsz=fi.size();
- ProgressBar->setTotalSteps(fsz);
-
- FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
- FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
- FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
- FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
- qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
-
- if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
- QString msg;
- msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
- msg.replace(QRegExp(":"),"\n");
- QMessageBox::message(tr("Note"),msg);
- }
- } else {
- QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
+ QListViewItemIterator it( Local_View );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->isSelected() ) {
+ QString strItem = it.current()->text(0);
+ QString localFile = currentDir.canonicalPath()+"/"+strItem;
+ QString remoteFile= currentRemoteDir+strItem;
+ QFileInfo fi(localFile);
+ if( !fi.isDir()) {
+ fsz=fi.size();
+ ProgressBar->setTotalSteps(fsz);
+
+ FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
+ FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
+ FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
+ FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
+ qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
+
+ if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
+ QString msg;
+ msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
+ msg.replace(QRegExp(":"),"\n");
+ QMessageBox::message(tr("Note"),msg);
}
- ProgressBar->reset();
- nullifyCallBack();
- it.current()->setSelected(FALSE);
- } //end currentSelected
- }
- TabWidget->setCurrentPage(1);
- remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
- QCopEnvelope ( "QPE/System", "notBusy()" );
+ } else {
+ QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
+ }
+ ProgressBar->reset();
+ nullifyCallBack();
+ it.current()->setSelected(FALSE);
+ } //end currentSelected
+ }
+ TabWidget->setCurrentPage(1);
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
+ QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::nullifyCallBack()
{
FtpOptions(FTPLIB_CALLBACK, NULL, conn);
FtpOptions(FTPLIB_IDLETIME, NULL, conn);
@@ -482,13 +483,13 @@ void OpieFtp::remoteDownload()
msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
ProgressBar->reset();
nullifyCallBack();
- it.current()->setSelected(FALSE);
+ it.current()->setSelected(FALSE);
}
}
TabWidget->setCurrentPage(0);
populateLocalView();
QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -519,13 +520,13 @@ bool OpieFtp::remoteChDir(const QString &dir)
QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpChdir( dir.latin1(), conn )) {
QString msg;
msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
- qDebug(msg);
+ qDebug(msg);
QCopEnvelope ( "QPE/System", "notBusy()" );
return FALSE;
}
QCopEnvelope ( "QPE/System", "notBusy()" );
return TRUE;
}
@@ -777,26 +778,22 @@ void OpieFtp::showHidden()
populateLocalView();
}
void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
{
// if(item)
-if (mouse == 2) {
- showLocalMenu(item);
+ if (mouse == 2) {
+ showLocalMenu(item);
}
}
void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
{
- switch (mouse) {
- case 1:
- break;
- case 2:
- showRemoteMenu(item);
- break;
- };
+ if(mouse == 2) {
+ showRemoteMenu(item);
+ }
}
void OpieFtp::showRemoteMenu(QListViewItem * item)
{
QPopupMenu m;// = new QPopupMenu( Local_View );
if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1)