summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp
authorllornkcor <llornkcor>2002-03-28 01:29:02 (UTC)
committer llornkcor <llornkcor>2002-03-28 01:29:02 (UTC)
commitd360439051f476cd847c4d8cec27a52addcd72a2 (patch) (side-by-side diff)
tree764e49aae53298ab9f020accc5a09042fd0ca874 /noncore/net/opieftp
parent2e385535ffffa1a1cebf2f3a842cfe429b0c1909 (diff)
downloadopie-d360439051f476cd847c4d8cec27a52addcd72a2.zip
opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.gz
opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.bz2
added multi selection up/down. may have broken something- who knows...
Diffstat (limited to 'noncore/net/opieftp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index fd6b028..907a812 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -122,46 +122,50 @@ OpieFtp::OpieFtp( )
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"),120);
+ 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);
tabLayout->addWidget( Local_View, 0, 0 );
- connect( Local_View, SIGNAL( clicked( 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)) );
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"),120);
+ 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);
Remote_View->setAllColumnsShowFocus(TRUE);
+ Remote_View->setMultiSelection( TRUE );
+
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
- connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
+ connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
tabLayout_2->addWidget( Remote_View, 0, 0 );
@@ -404,13 +408,17 @@ void OpieFtp::disConnector()
void OpieFtp::localUpload()
{
int fsz;
QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
- QString strItem = Local_View->currentItem()->text(0);
+ 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);
@@ -424,39 +432,45 @@ void OpieFtp::localUpload()
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();
} 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);
FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
-
}
void OpieFtp::remoteDownload()
{
// qApp->processEvents();
int fsz;
QCopEnvelope ( "QPE/System", "busy()" );
- QString strItem = Remote_View->currentItem()->text(0);
-// strItem=strItem.right(strItem.length()-1);
+ QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
+ QListViewItemIterator it( Remote_View );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->isSelected() ) {
+ QString strItem = it.current()->text(0);
+// strItem=strItem.right(strItem.length()-1);
QString localFile = currentDir.canonicalPath();
if(localFile.right(1).find("/",0,TRUE) == -1)
localFile += "/";
localFile += strItem;
// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
@@ -477,12 +491,15 @@ 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);
+ }
+ }
TabWidget->setCurrentPage(0);
populateLocalView();
QCopEnvelope ( "QPE/System", "notBusy()" );
}
bool OpieFtp::remoteDirList(const QString &dir)
@@ -564,13 +581,13 @@ void OpieFtp::populateLocalView()
item->setPixmap( 0,pm );
} else {
if( !fi->isReadable() )
pm = Resource::loadPixmap( "locked" );
else {
MimeType mt(fi->filePath());
- pm=mt.pixmap();
+ pm=mt.pixmap(); //sets the correct pixmap for mimetype
if(pm.isNull())
pm = Resource::loadPixmap( "UnknownDocument-14" );
item->setPixmap( 0,pm);
}
}
if( fileL.find("->",0,TRUE) != -1) {
@@ -586,13 +603,12 @@ void OpieFtp::populateLocalView()
isDir=FALSE;
++it;
}
Local_View->setSorting( 3,FALSE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
fillCombo( (const QString &)currentDir);
-
}
bool OpieFtp::populateRemoteView( )
{
// qDebug("populate remoteview");
QString sfile=QDir::homeDirPath();
@@ -908,13 +924,12 @@ void OpieFtp::remoteDelete()
QString msg;
msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
-
}
break;
};
} else {
switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
,tr("Yes"),tr("No"),0,0,1) ) {