summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp8
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp34
3 files changed, 30 insertions, 13 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 92804b2..c653b90 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -310,17 +310,18 @@ void AdvancedFm::populateRemoteView() {
}
void AdvancedFm::localListClicked(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
- QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+ QString strItem2 = dealWithSymName((const QString&)strItem);
+// QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
if(QDir(strItem2).exists() ) {
currentDir.cd(strItem2, TRUE);
populateLocalView();
}
} else { // not a symlink
if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
@@ -356,17 +357,18 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) {
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
- QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+ QString strItem2 = dealWithSymName((const QString&)strItem);
+// QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
currentRemoteDir.cd(strItem2, TRUE);
populateRemoteView();
} else { // not a symlink
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();
@@ -456,17 +458,17 @@ void AdvancedFm::currentPathComboChanged() {
populateRemoteView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
}
void AdvancedFm::fillCombo(const QString &currentPath) {
-
+ qDebug("%d",TabWidget->getCurrentTab());
if (TabWidget->getCurrentTab() == 0) {
// if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentPath);
if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
localDirPathStringList.prepend( currentPath );
currentPathCombo->insertStringList( localDirPathStringList,-1);
}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 9948255..7ced056 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -119,16 +119,17 @@ protected:
void init();
void initConnections();
void keyReleaseEvent( QKeyEvent *);
QString getFileSystemType(const QString &);
QString getDiskSpace(const QString &);
void parsetab(const QString &fileName);
QString checkDiskSpace(const QString &);
+ QString dealWithSymName(const QString &);
protected slots:
void showFileMenu();
void cancelMenuTimer();
void homeButtonPushed();
void docButtonPushed();
void SDButtonPushed();
void CFButtonPushed();
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 0a9f921..f77554a 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -98,23 +98,31 @@ void AdvancedFm::showRemoteHidden() {
} else {
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
// b=FALSE;
}
populateRemoteView();
}
+QString AdvancedFm::dealWithSymName(const QString &fileName) {
+ QString strItem = fileName;
+ return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+}
+
void AdvancedFm::runThis() {
QString fs;
if (TabWidget->getCurrentTab() == 0) {
QString curFile = Local_View->currentItem()->text(0);
+ if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
+ curFile = dealWithSymName((const QString&)curFile);
+
if(curFile != "../") {
- fs= getFileSystemType((const QString &) currentDir.canonicalPath());
+ fs = getFileSystemType((const QString &) currentDir.canonicalPath());
QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
qDebug( fileInfo.owner());
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;
@@ -127,16 +135,18 @@ void AdvancedFm::runThis() {
} else {
nf.execute();
}
}
}
} else {
QString curFile = Remote_View->currentItem()->text(0);
if(curFile != "../") {
+ if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
+ curFile = dealWithSymName((const QString&)curFile);
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") ) {
@@ -155,24 +165,28 @@ void AdvancedFm::runThis() {
}
}
}
void AdvancedFm::runText() {
if (TabWidget->getCurrentTab() == 0) {
QString curFile = Local_View->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;
}
} else {
QString curFile = Remote_View->currentItem()->text(0);
if(curFile != "../") {
curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
+ if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
+ curFile = dealWithSymName((const QString&)curFile);
DocLnk nf(curFile);
QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
e << curFile;
}
}
}
void AdvancedFm::localMakDir() {
@@ -477,17 +491,17 @@ void AdvancedFm::copy() {
tr("Yes"),tr("No"),0,0,1) ) {
case 1:
return;
break;
};
}
f.remove();
}
- if(!copyFile(destFile, curFile) ) {
+ if(!copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
return;
}
}
populateRemoteView();
TabWidget->setCurrentTab(1);
} else {
@@ -508,17 +522,17 @@ void AdvancedFm::copy() {
item+tr("\nexists. Ok to overwrite?"),
tr("Yes"),tr("No"),0,0,1) ) {
case 1:
return;
break;
};
f.remove();
}
- if(!copyFile(destFile, curFile) ) {
+ if(!copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
populateLocalView();
TabWidget->setCurrentTab(0);
@@ -556,17 +570,17 @@ void AdvancedFm::copyAs() {
case 0:
f.remove();
break;
case 1:
return;
break;
};
}
- if(!copyFile(destFile, curFile) ) {
+ if(!copyFile( curFile,destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
}
@@ -596,17 +610,17 @@ void AdvancedFm::copyAs() {
case 0:
f.remove();
break;
case 1:
return;
break;
};
}
- if(!copyFile(destFile, curFile) ) {
+ if(!copyFile( curFile,destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
}
delete fileDlg;
@@ -646,17 +660,17 @@ void AdvancedFm::copySameDir() {
f.remove();
break;
case 1:
return;
break;
};
}
- if(!copyFile(destFile, curFile) ) {
+ 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;
@@ -684,17 +698,17 @@ void AdvancedFm::copySameDir() {
case 0:
f.remove();
break;
case 1:
return;
break;
};
}
- if(!copyFile(destFile, curFile) ) {
+ 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;
}
@@ -725,17 +739,17 @@ void AdvancedFm::move() {
if(curFile.right(1).find("/",0,TRUE) == -1)
curFile +="/";
curFile+= item;
qDebug("CurrentFile file is " + curFile);
QFile f( curFile);
if( f.exists()) {
- if(!copyFile( destFile, curFile) ) {
+ if(!copyFile( curFile,destFile) ) {
QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
return;
} else
QFile::remove(curFile);
}
}
TabWidget->setCurrentTab(1);
@@ -757,31 +771,31 @@ void AdvancedFm::move() {
if(curFile.right(1).find("/",0,TRUE) == -1)
curFile +="/";
curFile+= item;
qDebug("CurrentFile file is " + curFile);
QFile f( curFile);
if( f.exists()) {
- if(!copyFile( destFile, curFile) ) {
+ if(!copyFile( curFile, destFile) ) {
QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile);
return;
} else
QFile::remove( curFile);
}
TabWidget->setCurrentTab(0);
}
}
populateRemoteView();
populateLocalView();
}
}
-bool AdvancedFm::copyFile( const QString & dest, const QString & src ) {
+bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
char bf[ 50000 ];
int bytesRead;
bool success = TRUE;
struct stat status;
QFile s( src );
QFile d( dest );