author | llornkcor <llornkcor> | 2002-05-16 13:39:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-16 13:39:56 (UTC) |
commit | 9e411b20fd2a1c347f410c836150aa56c9668707 (patch) (side-by-side diff) | |
tree | 22a1a9f4e6d2d5eaa1bf701a1f5ada84db127ced | |
parent | 7e0215119151e3fd0536e6d4c7f5ad46adc4ef68 (diff) | |
download | opie-9e411b20fd2a1c347f410c836150aa56c9668707.zip opie-9e411b20fd2a1c347f410c836150aa56c9668707.tar.gz opie-9e411b20fd2a1c347f410c836150aa56c9668707.tar.bz2 |
fixed bug with remote rename
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 18952c3..9606269 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -748,385 +748,385 @@ QString fs; // if( fileInfo.isExecutable() | QCopEnvelope e("QPE/System", "execute(QString)" ); e << curFile; } else { curFile = currentDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QString execStr = nf.exec(); qDebug( execStr); if( execStr.isEmpty() ) { } else { nf.execute(); } } // MimeType mt( curFile); } else { QString curFile = Remote_View->currentItem()->text(0); fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); qDebug("Filesystemtype is "+fs); QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { QCopEnvelope e("QPE/System", "execute(QString)" ); e << curFile; } else { curFile = currentRemoteDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QString execStr = nf.exec(); qDebug(execStr); if( execStr.isEmpty() ) { } else { nf.execute(); } } // MimeType mt( curFile); } } void AdvancedFm::runText() { if (TabWidget->currentPageIndex() == 0) { QString curFile = Local_View->currentItem()->text(0); curFile = currentDir.canonicalPath()+"/"+curFile; QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); e << curFile; } else { QString curFile = Remote_View->currentItem()->text(0); curFile = currentRemoteDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); e << curFile; } } void AdvancedFm::localMakDir() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); } populateLocalView(); } void AdvancedFm::remoteMakDir() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); } populateRemoteView(); } void AdvancedFm::localDelete() { QStringList curFileList = getPath(); QString myFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { myFile = (*it); if( myFile.find(" -> ",0,TRUE) != -1) myFile = myFile.left( myFile.find(" -> ",0,TRUE)); QString f = currentDir.canonicalPath(); if(f.right(1).find("/",0,TRUE) == -1) f+="/"; f+=myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ "\nand all it's contents ?" ,tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=f.left(f.length()-1); QString cmd="rm -rf "+f; system( cmd.latin1()); populateLocalView(); } break; case 1: // exit break; }; } else { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { case 0: { QString cmd="rm "+f; QFile file(f); file.remove(); // system( cmd.latin1()); populateLocalView(); } break; case 1: // exit break; }; } } } void AdvancedFm::remoteDelete() { QStringList curFileList = getPath(); QString myFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { myFile = (*it); if(myFile.find(" -> ",0,TRUE) != -1) myFile = myFile.left(myFile.find(" -> ",0,TRUE)); QString f = currentRemoteDir.canonicalPath(); if(f.right(1).find("/",0,TRUE) == -1) f+="/"; f+=myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ "\nand all it's contents ?", tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=f.left(f.length()-1); QString cmd="rm -rf "+f; system( cmd.latin1()); populateRemoteView(); } break; case 1: // exit break; }; } else { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { case 0: { QString cmd="rm "+f; QFile file(f); file.remove(); // system( cmd.latin1()); populateRemoteView(); } break; case 1: // exit break; }; } } } void AdvancedFm::localRename() { QString curFile = Local_View->currentItem()->text(0); InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); fileDlg->setInputText((const QString &)curFile); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString oldname = currentDir.canonicalPath() + "/" + curFile; QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; if( rename(oldname.latin1(), newName.latin1())== -1) QMessageBox::message(tr("Note"),tr("Could not rename")); } populateLocalView(); } void AdvancedFm::remoteRename() { - QString curFile = Local_View->currentItem()->text(0); + QString curFile = remote_View->currentItem()->text(0); InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); fileDlg->setInputText((const QString &)curFile); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; if( rename(oldname.latin1(), newName.latin1())== -1) QMessageBox::message(tr("Note"),tr("Could not rename")); } populateRemoteView(); } void AdvancedFm::switchToLocalTab() { TabWidget->setCurrentPage(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { TabWidget->setCurrentPage(1); Remote_View->setFocus(); } void AdvancedFm::readConfig() { Config cfg("AdvancedFm"); } void AdvancedFm::writeConfig() { Config cfg("AdvancedFm"); } void AdvancedFm::currentPathComboChanged() { if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentDir.setPath( currentPathCombo->lineEdit()->text() ); populateLocalView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); populateRemoteView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } } void AdvancedFm::fillCombo(const QString ¤tPath) { if (TabWidget->currentPageIndex() == 0) { currentPathCombo->lineEdit()->setText( currentPath); if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); localDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( localDirPathStringList,-1); } } else { currentPathCombo->lineEdit()->setText( currentPath); if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); remoteDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( remoteDirPathStringList,-1); } } } void AdvancedFm::currentPathComboActivated(const QString & currentPath) { if (TabWidget->currentPageIndex() == 0) { chdir( currentPath.latin1() ); currentDir.cd( currentPath, TRUE); populateLocalView(); update(); } else { chdir( currentPath.latin1() ); currentRemoteDir.cd( currentPath, TRUE); populateRemoteView(); update(); } } void AdvancedFm::filePerms() { 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 ) { 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()+"/"; } // qDebug("%d",curFileList.count()); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { qDebug((filePath+*it)); DocLnk lnk( (filePath+*it)); LnkProperties prop( &lnk ); // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); prop.showMaximized(); prop.exec(); } } QStringList AdvancedFm::getPath() { QStringList strList; if (TabWidget->currentPageIndex() == 0) { QList<QListViewItem> * getSelectedItems( QListView * Local_View ); QListViewItemIterator it( Local_View ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); } } return strList; } else { QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); QListViewItemIterator it( Remote_View ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); } } return strList; } return ""; } void AdvancedFm::homeButtonPushed() { QString current = QDir::homeDirPath(); chdir( current.latin1() ); if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { currentRemoteDir.cd( current, TRUE); populateRemoteView(); } update(); } void AdvancedFm::docButtonPushed() { QString current = QPEApplication::documentDir(); chdir( current.latin1() ); if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { currentRemoteDir.cd( current, TRUE); populateRemoteView(); } update(); } void AdvancedFm::SDButtonPushed() { QString current = "/mnt/card"; chdir( current.latin1() ); if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); |