author | llornkcor <llornkcor> | 2003-06-17 01:07:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-06-17 01:07:27 (UTC) |
commit | f48df16919769a1abb73eab9d229659a792a6b8a (patch) (unidiff) | |
tree | f1368b9f2d7c9656805d13d4f2c92bebf5f6b625 | |
parent | fc79272790448b77eeb7e656d80ce1b799c5cd38 (diff) | |
download | opie-f48df16919769a1abb73eab9d229659a792a6b8a.zip opie-f48df16919769a1abb73eab9d229659a792a6b8a.tar.gz opie-f48df16919769a1abb73eab9d229659a792a6b8a.tar.bz2 |
fix crash on menu - no item selected
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 23 |
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 | |||
@@ -757,17 +757,18 @@ bool OpieFtp::populateRemoteView( ) | |||
757 | } else | 757 | } else |
758 | qDebug("temp file not opened successfullly "+sfile); | 758 | qDebug("temp file not opened successfullly "+sfile); |
759 | Remote_View->setSorting( 4,TRUE); | 759 | Remote_View->setSorting( 4,TRUE); |
760 | return true; | 760 | return true; |
761 | } | 761 | } |
762 | 762 | ||
763 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 763 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
764 | { | 764 | { |
765 | if( selectedItem) { | 765 | if( selectedItem) { |
766 | // if(selectedItem!= NULL) { | ||
766 | // QCopEnvelope ( "QPE/System", "busy()" ); | 767 | // QCopEnvelope ( "QPE/System", "busy()" ); |
767 | QString oldRemoteCurrentDir = currentRemoteDir; | 768 | QString oldRemoteCurrentDir = currentRemoteDir; |
768 | QString strItem=selectedItem->text(0); | 769 | QString strItem=selectedItem->text(0); |
769 | strItem=strItem.simplifyWhiteSpace(); | 770 | strItem=strItem.simplifyWhiteSpace(); |
770 | if(strItem == "../") { // the user wants to go ^ | 771 | if(strItem == "../") { // the user wants to go ^ |
771 | if( FtpCDUp( conn) == 0) { | 772 | if( FtpCDUp( conn) == 0) { |
772 | QString msg; | 773 | QString msg; |
773 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 774 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
@@ -903,40 +904,44 @@ void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, | |||
903 | showRemoteMenu(item); | 904 | showRemoteMenu(item); |
904 | } | 905 | } |
905 | } | 906 | } |
906 | 907 | ||
907 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 908 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
908 | { | 909 | { |
909 | QPopupMenu * m;// = new QPopupMenu( Local_View ); | 910 | QPopupMenu * m;// = new QPopupMenu( Local_View ); |
910 | m = new QPopupMenu(this); | 911 | m = new QPopupMenu(this); |
911 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) | 912 | if(item != NULL ) { |
912 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 913 | if( item->text(0).find("/",0,TRUE) != -1) |
913 | else | 914 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
914 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 915 | else |
916 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | ||
917 | } | ||
915 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 918 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
916 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); | 919 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); |
917 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 920 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
918 | m->insertSeparator(); | 921 | m->insertSeparator(); |
919 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 922 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
920 | m->exec( QCursor::pos() ); | 923 | m->exec( QCursor::pos() ); |
921 | delete m; | 924 | delete m; |
922 | } | 925 | } |
923 | 926 | ||
924 | void OpieFtp::showLocalMenu(QListViewItem * item) | 927 | void OpieFtp::showLocalMenu(QListViewItem * item) |
925 | { | 928 | { |
926 | 929 | ||
927 | QPopupMenu *m; | 930 | QPopupMenu *m; |
928 | m = new QPopupMenu( this); | 931 | m = new QPopupMenu( this); |
929 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 932 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
930 | m->insertSeparator(); | 933 | m->insertSeparator(); |
931 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 934 | if(item != NULL ) { |
932 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 935 | if( item->text(0).find("/",0,TRUE) !=-1) |
933 | else | 936 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
934 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 937 | else |
938 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | ||
939 | } | ||
935 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 940 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
936 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); | 941 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); |
937 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 942 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
938 | m->insertSeparator(); | 943 | m->insertSeparator(); |
939 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 944 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
940 | m->setCheckable(TRUE); | 945 | m->setCheckable(TRUE); |
941 | if (b) | 946 | if (b) |
942 | m->setItemChecked(m->idAt(0),TRUE); | 947 | m->setItemChecked(m->idAt(0),TRUE); |