-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index a6b59c7..98d024d 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -297,396 +297,394 @@ void AdvancedFm::remoteDelete() { 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 Directory"),tr("Really 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; startProcess( (const QString)cmd ); populateRemoteView(); } break; case 1: // exit break; }; } else { if(doMsg) { switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { case 1: return; break; }; } QString cmd="rm "+f; QFile file(f); if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) file.remove(); } } } populateRemoteView(); } void AdvancedFm::localRename() { QString curFile = Local_View->currentItem()->text(0); qDebug("currentItem "+curFile); if( curFile !="../") { 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 = Remote_View->currentItem()->text(0); if( curFile !="../") { 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::filePerms() { QStringList curFileList = getPath(); QString filePath; if (TabWidget->getCurrentTab() == 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->getCurrentTab() == 0) { populateLocalView(); } else { populateRemoteView(); } } void AdvancedFm::doProperties() { #if defined(QT_QWS_OPIE) QStringList curFileList = getPath(); QString filePath; if (TabWidget->getCurrentTab() == 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 ); prop.showMaximized(); prop.exec(); } #endif } void AdvancedFm::upDir() { if (TabWidget->getCurrentTab() == 0) { QString current = currentDir.canonicalPath(); QDir dir(current); dir.cdUp(); current = dir.canonicalPath(); chdir( current.latin1() ); currentDir.cd( current, TRUE); populateLocalView(); update(); } else { QString current = currentRemoteDir.canonicalPath(); QDir dir(current); dir.cdUp(); current = dir.canonicalPath(); chdir( current.latin1() ); currentRemoteDir.cd( current, TRUE); populateRemoteView(); update(); } } void AdvancedFm::copy() { qApp->processEvents(); QStringList curFileList = getPath(); bool doMsg=true; int count=curFileList.count(); if( count > 0) { if(count > 1 ){ QString msg; msg=tr("Really copy\n%1 files?").arg(count); switch ( QMessageBox::warning(this,tr("Delete"),msg ,tr("Yes"),tr("No"),0,0,1) ) { case 0: doMsg=false; break; case 1: return; break; }; } QString curFile, item, destFile; if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); if(item.find("->",0,TRUE)) //symlink item = item.left(item.find("->",0,TRUE)); destFile = currentRemoteDir.canonicalPath()+"/"+ item; qDebug("Destination file is "+destFile); curFile = currentDir.canonicalPath()+"/"+ item; qDebug("CurrentFile file is " + curFile); QFile f(destFile); if( f.exists()) { if(doMsg) { - switch ( QMessageBox::warning(this,tr("File Exists!"), - item+tr("\nexists. Ok to overwrite?"), - tr("Yes"),tr("No"),0,0,1) ) { + switch ( QMessageBox::warning(this,tr("File Exists!"), tr("%1 exists. Ok to overwrite?").arg( item ), tr("Yes"),tr("No"),0,0,1) ) { case 1: return; break; }; } f.remove(); } if(!copyFile( curFile, destFile) ) { - QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); + QMessageBox::message("AdvancedFm",tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); return; } } populateRemoteView(); TabWidget->setCurrentTab(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item= (*it); if(item.find("->",0,TRUE)) //symlink item = item.left(item.find("->",0,TRUE)); destFile = currentDir.canonicalPath()+"/"+ item; qDebug("Destination file is "+destFile); curFile = currentRemoteDir.canonicalPath()+"/"+ item;; qDebug("CurrentFile file is " + curFile); QFile f(destFile); if( f.exists()) { switch ( QMessageBox::warning(this,tr("File Exists!"), item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { case 1: return; break; }; f.remove(); } if(!copyFile( curFile, destFile) ) { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); return; } } populateLocalView(); TabWidget->setCurrentTab(0); } } } void AdvancedFm::copyAs() { qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item; InputDialog *fileDlg; if (TabWidget->getCurrentTab() == 0) { qDebug("tab 1"); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destFile; item=(*it); curFile = currentDir.canonicalPath()+"/"+(*it); fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); fileDlg->setInputText((const QString &) destFile ); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); destFile = currentRemoteDir.canonicalPath()+"/"+filename; QFile f(destFile); if( f.exists()) { switch (QMessageBox::warning(this,tr("File Exists!"), item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { case 0: f.remove(); break; case 1: return; break; }; } if(!copyFile( curFile,destFile) ) { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); return; } } delete fileDlg; } populateRemoteView(); TabWidget->setCurrentTab(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); curFile = currentRemoteDir.canonicalPath()+"/"+(*it); fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); QString destFile; fileDlg->setInputText((const QString &) destFile); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); destFile = currentDir.canonicalPath()+"/"+filename; QFile f( destFile); if( f.exists()) { switch ( QMessageBox::warning(this,tr("File Exists!"), item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { case 0: f.remove(); break; case 1: return; break; }; } if(!copyFile( curFile,destFile) ) { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); return; } } delete fileDlg; } populateLocalView(); TabWidget->setCurrentTab(0); } } void AdvancedFm::copySameDir() { qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item, destFile; InputDialog *fileDlg; if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); curFile = currentDir.canonicalPath()+"/"+ item; fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); fileDlg->setInputText((const QString &) destFile ); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); destFile = currentDir.canonicalPath()+"/"+filename; QFile f(destFile); if( f.exists()) { switch (QMessageBox::warning(this,tr("Delete"), destFile+tr(" already exists.\nDo you really want to delete it?"), tr("Yes"),tr("No"),0,0,1) ) { case 0: f.remove(); break; case 1: return; break; }; } if(!copyFile( curFile,destFile) ) { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); return; } qDebug("copy "+curFile+" as "+destFile); } delete fileDlg; } populateLocalView(); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); curFile = currentRemoteDir.canonicalPath()+"/"+ item; fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); fileDlg->setInputText((const QString &) destFile); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); destFile = currentRemoteDir.canonicalPath()+"/"+filename; |