-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 37 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 6 |
2 files changed, 32 insertions, 11 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 523a36c..ed7f4bb 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -422,9 +422,9 @@ void OpieFtp::populateLocalView() } bool OpieFtp::populateRemoteView() { - Remote_View->clear(); + Remote_View->clear(); QFile tmp("./._temp"); QString s, File_Name; QString fileL, fileS, fileDate; new QListViewItem( Remote_View, "../"); @@ -443,9 +443,10 @@ bool OpieFtp::populateRemoteView() if(fileL.find("total",0,TRUE) == -1) new QListViewItem( Remote_View, fileL, fileS, fileDate); } tmp.close(); - } + } else + qDebug("temp file not opened successfullly"); return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) @@ -503,9 +504,9 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) remoteDirList( (const QString &)currentRemoteDir); QCopEnvelope ( "QPE/System", "notBusy()" ); } - void OpieFtp::localListClicked(QListViewItem *selectedItem) +void OpieFtp::localListClicked(QListViewItem *selectedItem) { QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); @@ -539,8 +540,19 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) chdir(strItem.latin1()); } } +void OpieFtp::doLocalCd() +{ + localListClicked( Local_View->currentItem()); +} + +void OpieFtp:: doRemoteCd() +{ + remoteListClicked( Remote_View->currentItem()); + +} + void OpieFtp::showHidden() { if (!b) { currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); @@ -559,10 +571,10 @@ void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, { switch (mouse) { case 1: break; - case 2: - showLocalMenu(); + case 2: + showLocalMenu(item); break; }; } @@ -570,29 +582,36 @@ void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &p { switch (mouse) { case 1: break; - case 2: - showRemoteMenu(); + case 2: + showRemoteMenu(item); break; }; } -void OpieFtp::showRemoteMenu() +void OpieFtp::showRemoteMenu(QListViewItem * item) { QPopupMenu m;// = new QPopupMenu( Local_View ); + if(item->text(0).right(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() +void OpieFtp::showLocalMenu(QListViewItem * item) { QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + m.insertSeparator(); + if(item->text(0).right(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(); diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index e00a398..5d1c63d 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h @@ -60,10 +60,12 @@ public: QListViewItem * item; bool b; protected slots: - void showLocalMenu( ); - void showRemoteMenu( ); + void showLocalMenu( QListViewItem *); + void showRemoteMenu( QListViewItem *); + void doLocalCd(); + void doRemoteCd(); void localUpload(); void remoteDownload(); void newConnection(); void connector(); |