summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-06-17 01:07:27 (UTC)
committer llornkcor <llornkcor>2003-06-17 01:07:27 (UTC)
commitf48df16919769a1abb73eab9d229659a792a6b8a (patch) (side-by-side diff)
treef1368b9f2d7c9656805d13d4f2c92bebf5f6b625
parentfc79272790448b77eeb7e656d80ce1b799c5cd38 (diff)
downloadopie-f48df16919769a1abb73eab9d229659a792a6b8a.zip
opie-f48df16919769a1abb73eab9d229659a792a6b8a.tar.gz
opie-f48df16919769a1abb73eab9d229659a792a6b8a.tar.bz2
fix crash on menu - no item selected
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 668a03d..269449e 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -753,25 +753,26 @@ bool OpieFtp::populateRemoteView( )
item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
file.close();
if( file.exists())
file. remove();
} else
qDebug("temp file not opened successfullly "+sfile);
Remote_View->setSorting( 4,TRUE);
return true;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
- if( selectedItem) {
+ if( selectedItem) {
+ // if(selectedItem!= NULL) {
// QCopEnvelope ( "QPE/System", "busy()" );
QString oldRemoteCurrentDir = currentRemoteDir;
QString strItem=selectedItem->text(0);
strItem=strItem.simplifyWhiteSpace();
if(strItem == "../") { // the user wants to go ^
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// qDebug(msg);
}
@@ -899,48 +900,52 @@ void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int)
void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int )
{
if(mouse == 2) {
showRemoteMenu(item);
}
}
void OpieFtp::showRemoteMenu(QListViewItem * item)
{
QPopupMenu * m;// = new QPopupMenu( Local_View );
m = new QPopupMenu(this);
- 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() ));
+ if(item != NULL ) {
+ if( 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("Rescan"), this, SLOT( populateLocalView() ));
m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
m->insertSeparator();
m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
m->exec( QCursor::pos() );
delete m;
}
void OpieFtp::showLocalMenu(QListViewItem * item)
{
QPopupMenu *m;
m = new QPopupMenu( this);
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() ));
+ if(item != NULL ) {
+ if( 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("Rescan"), this, SLOT( populateRemoteView() ));
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);
m->exec( QCursor::pos() );