author | llornkcor <llornkcor> | 2002-05-05 18:15:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-05 18:15:48 (UTC) |
commit | 5549afd820c485db5ec70ad5bf1faed5821ab04a (patch) (side-by-side diff) | |
tree | fd8372f9928c9b8c556b4d03229e80f3e73cb31f | |
parent | 4cd02e41953be5b271c877197cf9c12ad4785bef (diff) | |
download | opie-5549afd820c485db5ec70ad5bf1faed5821ab04a.zip opie-5549afd820c485db5ec70ad5bf1faed5821ab04a.tar.gz opie-5549afd820c485db5ec70ad5bf1faed5821ab04a.tar.bz2 |
bug fix
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f4ca349..b9e254e 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -522,33 +522,36 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); currentDir.cd(strItem,FALSE); populateLocalView(); } else { currentDir.cdUp(); populateLocalView(); } if(QDir(strItem).exists()){ currentDir.cd(strItem, TRUE); populateLocalView(); } } else { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); if( QFile::exists(strItem ) ) { -// qDebug("upload "+strItem); + qDebug("clicked item "+strItem); + DocLnk doc( strItem, FALSE ); + doc.execute(); + // Local_View->clearSelection(); } } //end not symlink chdir(strItem.latin1()); } } } void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { if(selectedItem) { QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink // is symlink QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); @@ -560,33 +563,36 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); currentRemoteDir.cd(strItem,FALSE); populateRemoteView(); } else { currentRemoteDir.cdUp(); populateRemoteView(); } if(QDir(strItem).exists()){ currentRemoteDir.cd(strItem, TRUE); populateRemoteView(); } } else { strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); if( QFile::exists(strItem ) ) { -// qDebug("upload "+strItem); + qDebug("clicked item "+strItem); + DocLnk doc( strItem, FALSE ); + doc.execute(); + // Remote_View->clearSelection(); } } //end not symlink chdir(strItem.latin1()); } } } void AdvancedFm::doLocalCd() { localListClicked( Local_View->currentItem()); } void AdvancedFm::doRemoteCd() { localListClicked( Remote_View->currentItem()); } @@ -648,33 +654,33 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint case 2: showRemoteMenu(item); Remote_View->clearSelection(); break; }; } void AdvancedFm::showLocalMenu(QListViewItem * item) { if(item) { QPopupMenu m; 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( "Open" ), this, SLOT( runThis() )); + m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); m.insertSeparator(); m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); m.insertItem( tr( "Copy" ), this, SLOT( copy() )); m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); m.insertItem( tr( "Move" ), this, SLOT( move() )); m.insertSeparator(); m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); m.insertSeparator(); m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); @@ -684,33 +690,33 @@ void AdvancedFm::showLocalMenu(QListViewItem * item) m.setItemChecked(m.idAt(0),TRUE); else m.setItemChecked(m.idAt(0),FALSE); m.exec( QCursor::pos() ); } } void AdvancedFm::showRemoteMenu(QListViewItem * item) { if(item) { QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); m.insertSeparator(); 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( "Open" ), this, SLOT( runThis() )); + m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); m.insertSeparator(); m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); m.insertItem( tr( "Copy" ), this, SLOT( copy() )); m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); m.insertItem( tr( "Move" ), this, SLOT( move() )); m.insertSeparator(); m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); m.insertSeparator(); m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); @@ -1024,32 +1030,39 @@ void AdvancedFm::filePerms() { QString filePath; if (TabWidget->currentPageIndex() == 0) { filePath = currentDir.canonicalPath()+"/"; } else { filePath= currentRemoteDir.canonicalPath()+"/"; } for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { filePermissions *filePerm; filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); filePerm->showMaximized(); filePerm->exec(); if( filePerm) delete filePerm; } + if (TabWidget->currentPageIndex() == 0) { + populateLocalView(); + } else { + populateRemoteView(); + } + + } void AdvancedFm::doProperties() { QStringList curFileList = getPath(); QString filePath; if (TabWidget->currentPageIndex() == 0) { filePath = currentDir.canonicalPath()+"/"; } else { filePath= currentRemoteDir.canonicalPath()+"/"; } for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { DocLnk lnk( (filePath+*it)); LnkProperties prop( &lnk ); // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); prop.showMaximized(); prop.exec(); @@ -1389,36 +1402,36 @@ void AdvancedFm::runCommand() { return; } else { while ( fgets( line, sizeof line, fp)) { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } } } void AdvancedFm::runCommandStd() { QString curFile; if (TabWidget->currentPageIndex() == 0) { if( Local_View->currentItem()) - curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); + curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); } else { if(Remote_View->currentItem()) - curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); + curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); } InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); fileDlg->setInputText(curFile); fileDlg->exec(); QString command; if( fileDlg->result() == 1 ) { qApp->processEvents(); command = fileDlg->LineEdit1->text() + " &"; system(command.latin1()); } } void AdvancedFm::fileStatus() { QString curFile; @@ -1543,44 +1556,48 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) break; case Key_9: break; case Key_0: break; } } void AdvancedFm::mkSym() { QString cmd; QStringList curFileList = getPath(); if (TabWidget->currentPageIndex() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); + if(destName.right(1) == "/") destName = destName.left( destName.length() -1); QString curFile = currentDir.canonicalPath()+"/"+(*it); + if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); cmd = "ln -s "+curFile+" "+destName; qDebug(cmd); system(cmd.latin1() ); } populateRemoteView(); TabWidget->setCurrentPage(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destName = currentDir.canonicalPath()+"/"+(*it); + if(destName.right(1) == "/") destName = destName.left( destName.length() -1); QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); cmd = "ln -s "+curFile+" "+destName; qDebug(cmd); system(cmd.latin1() ); } populateLocalView(); TabWidget->setCurrentPage(0); } } void AdvancedFm::QPEButtonPushed() { QString current = QPEApplication::qpeDir(); chdir( current.latin1() ); if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); |