-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 220 |
4 files changed, 108 insertions, 122 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9721f84..6f017b4 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -318,19 +318,12 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { remoteDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( remoteDirPathStringList,-1); } } } -void AdvancedFm::currentPathComboActivated(const QString & currentPath) { - chdir( currentPath.latin1() ); - CurrentDir()->cd( currentPath, TRUE); - populateView(); - update(); -} - QStringList AdvancedFm::getPath() { QStringList strList; QListView *thisView=CurrentView(); QList<QListViewItem> * getSelectedItems( QListView * thisView ); QListViewItemIterator it( thisView ); for ( ; it.current(); ++it ) { diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 00ab909..6f7eb96 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -150,13 +150,12 @@ protected slots: void copyAsTimer(); void copySameDir(); void copySameDirTimer(); void move(); void moveTimer(); - void currentPathComboActivated(const QString &); void fillCombo(const QString &); bool copyFile( const QString & , const QString & ); void fileStatus(); void doAbout(); void doBeam(); void fileBeamFinished( Ir *); diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index fe565a0..1047c5a 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -252,13 +252,13 @@ void AdvancedFm::initConnections() connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) ); connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) ); connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) ); connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) ); connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) ); - connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( currentPathComboActivated(const QString&) ) ); + connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( changeTo(const QString&) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); connect( Local_View, SIGNAL( clicked(QListViewItem*)), this,SLOT( ListClicked(QListViewItem*)) ); connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 706658e..7b3dcf6 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -47,99 +47,99 @@ void AdvancedFm::doDirChange() { // owarn << pathItem << oendl; changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); } } void AdvancedFm::showMenuHidden() { - if (b) { - CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); - OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); - fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); + if (b) { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); } else { - CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); - OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); - fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); + CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); } - b = !b; - populateView(); + b = !b; + populateView(); } void AdvancedFm::showHidden() { - if (b) { - CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); - OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + if (b) { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); } else { - CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); - OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); } - populateView(); + populateView(); } QString AdvancedFm::dealWithSymName(const QString &fileName) { - QString strItem = fileName; - return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); + QString strItem = fileName; + return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); } void AdvancedFm::runThis() { - if( !CurrentView()->currentItem()) return; - QString fs; - QDir *thisDir = CurrentDir(); + if( !CurrentView()->currentItem()) return; + QString fs; + QDir *thisDir = CurrentDir(); - QString curFile = CurrentView()->currentItem()->text(0); - QString path = thisDir->canonicalPath(); + QString curFile = CurrentView()->currentItem()->text(0); + QString path = thisDir->canonicalPath(); - if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink + if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink - curFile = dealWithSymName((const QString&)curFile); + curFile = dealWithSymName((const QString&)curFile); - if(curFile != "../") { + if(curFile != "../") { - fs = getFileSystemType((const QString &) path); - QFileInfo fileInfo( path + "/" + curFile); + fs = getFileSystemType((const QString &) path); + QFileInfo fileInfo( path + "/" + curFile); // odebug << fileInfo.owner() << oendl; - 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 = path + "/" + curFile; - DocLnk nf(curFile); - QString execStr = nf.exec(); + 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 = path + "/" + curFile; + DocLnk nf(curFile); + QString execStr = nf.exec(); // odebug << execStr << oendl; - if( execStr.isEmpty() ) { + if( execStr.isEmpty() ) { } else { - nf.execute(); + nf.execute(); } } } } void AdvancedFm::runText() { - if( !CurrentView()->currentItem()) return; - QString curFile = CurrentView()->currentItem()->text(0); - if(curFile != "../") { - if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink - curFile = dealWithSymName((const QString&)curFile); - curFile = CurrentDir()->canonicalPath()+"/"+curFile; - QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); - e << curFile; + if( !CurrentView()->currentItem()) return; + QString curFile = CurrentView()->currentItem()->text(0); + if(curFile != "../") { + if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink + curFile = dealWithSymName((const QString&)curFile); + curFile = CurrentDir()->canonicalPath()+"/"+curFile; + QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); + e << curFile; } } void AdvancedFm::makeDir() { - InputDialog *fileDlg; - fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); - fileDlg->exec(); - if( fileDlg->result() == 1 ) { - QDir *thisDir = CurrentDir(); - QString filename = fileDlg->LineEdit1->text(); - thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); - } + InputDialog *fileDlg; + fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); + fileDlg->exec(); + if( fileDlg->result() == 1 ) { + QDir *thisDir = CurrentDir(); + QString filename = fileDlg->LineEdit1->text(); + thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); + } populateView(); } void AdvancedFm::doDelete() { QStringList curFileList = getPath(); bool doMsg=true; @@ -256,86 +256,80 @@ void AdvancedFm::doProperties() { } #endif } void AdvancedFm::upDir() { - QDir *thisDir = CurrentDir(); - QString current = thisDir->canonicalPath(); - QDir dir(current); - dir.cdUp(); - current = dir.canonicalPath(); - chdir( current.latin1() ); - thisDir->cd( current, TRUE); - populateView(); - update(); + QDir dir( CurrentDir()->canonicalPath()); + dir.cdUp(); + changeTo(dir.canonicalPath()); } void AdvancedFm::copyTimer() { QTimer::singleShot(125,this,SLOT(copy())); } void AdvancedFm::copy() { - QStringList curFileList = getPath(); - - QDir *thisDir = CurrentDir(); - QDir *thatDir = OtherDir(); + QStringList curFileList = getPath(); - bool doMsg=true; - int count=curFileList.count(); - if( count > 0) { - if(count > 1 ){ - QString msg; - msg=tr("<p>Really copy %1 files?</p>").arg(count); - switch ( QMessageBox::warning(this,tr("Copy"),msg - ,tr("Yes"),tr("No"),0,0,1) ) - { - case 0: - doMsg=false; - break; - case 1: - return; - break; - }; - } + QDir *thisDir = CurrentDir(); + QDir *thatDir = OtherDir(); + + bool doMsg = true; + int count = curFileList.count(); + if( count > 0) { + if(count > 1 ){ + QString msg; + msg=tr("<p>Really copy %1 files?</p>").arg(count); + switch ( QMessageBox::warning(this,tr("Copy"),msg + ,tr("Yes"),tr("No"),0,0,1) ) + { + case 0: + doMsg=false; + break; + case 1: + return; + break; + }; + } - QString curFile, item, destFile; - 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)); + QString curFile, item, destFile; + 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)); - curFile = thisDir->canonicalPath()+"/"+ item; - destFile = thatDir->canonicalPath()+"/"+ item; + curFile = thisDir->canonicalPath()+"/"+ item; + destFile = thatDir->canonicalPath()+"/"+ item; // odebug << "Destination file is "+destFile << oendl; // odebug << "CurrentFile file is " + curFile << oendl; - QFile f(destFile); - if( f.exists()) { - if(doMsg) { - switch ( QMessageBox::warning(this,tr("File Exists!"), - tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), - tr("Yes"),tr("No"),0,0,1)) { - case 1: - return; - break; - }; - } - f.remove(); - } + QFile f(destFile); + if( f.exists()) { + if(doMsg) { + switch ( QMessageBox::warning(this,tr("File Exists!"), + tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), + tr("Yes"),tr("No"),0,0,1)) { + case 1: + return; + break; + }; + } + f.remove(); + } - if( !copyFile( curFile, destFile) ) { - QMessageBox::message("AdvancedFm", - tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); - return; - } - } - rePopulate(); - } + if( !copyFile( curFile, destFile) ) { + QMessageBox::message("AdvancedFm", + tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); + return; + } + } + rePopulate(); + } } void AdvancedFm::copyAsTimer() { QTimer::singleShot(125,this,SLOT(copyAs())); } |