summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-28 21:59:34 (UTC)
committer llornkcor <llornkcor>2002-04-28 21:59:34 (UTC)
commit726d985ddb6a5c7eb25a48efdadb189eb38b9a2a (patch) (side-by-side diff)
treee92814b56ee706ccb1d95a0c2e86294aa79ab2c2
parentd9a38221ea876cae8ef8b015968e14af75e202bb (diff)
downloadopie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.zip
opie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.tar.gz
opie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.tar.bz2
fixed multi symlink handling
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp133
1 files changed, 68 insertions, 65 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index bd513c0..b5fcccf 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -318,13 +318,13 @@ void AdvancedFm::populateLocalView()
else
pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
} else {
- if(fi->isExecutable()) {
- pm = Resource::loadPixmap( "exec");
- item->setPixmap( 0,pm);
- }
- else if( !fi->isReadable() ) {
+// if(fi->isExecutable()) {
+// pm = Resource::loadPixmap( "exec");
+// item->setPixmap( 0,pm);
+// }
+ if( !fi->isReadable() ) {
pm = Resource::loadPixmap( "locked" );
item->setPixmap( 0,pm);
}
@@ -434,13 +434,13 @@ void AdvancedFm::populateRemoteView()
else
pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
} else {
- if(fi->isExecutable()) {
- pm = Resource::loadPixmap( "exec");
- item->setPixmap( 0,pm);
- }
- else if( !fi->isReadable() ) {
+// if(fi->isExecutable()) {
+// pm = Resource::loadPixmap( "exec");
+// item->setPixmap( 0,pm);
+// }
+ if( !fi->isReadable() ) {
pm = Resource::loadPixmap( "locked" );
item->setPixmap( 0,pm);
} else {
MimeType mt(fi->filePath());
@@ -715,38 +715,38 @@ void AdvancedFm::runThis() {
// QFileInfo *fi;
if (TabWidget->currentPageIndex() == 0) {
QString curFile = Local_View->currentItem()->text(0);
QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
- if(fileInfo.isExecutable()) {
- QCopEnvelope e("QPE/System", "execute(QString)" );
- e << curFile;
- } else {
+// 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);
QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
- if(fileInfo.isExecutable()) {
- QCopEnvelope e("QPE/System", "execute(QString)" );
- e << curFile;
- } else {
+// if(fileInfo.isExecutable()) {
+// 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);
}
}
@@ -1045,9 +1045,9 @@ QStringList AdvancedFm::getPath() {
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
- strList << currentDir.canonicalPath()+"/"+ it.current()->text(0);
+ strList << it.current()->text(0);
}
}
return strList;
}
@@ -1138,42 +1138,44 @@ void AdvancedFm::copy()
QString curFile;
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile = currentRemoteDir.canonicalPath();
- if(destFile.right(1).find("/",0,TRUE) == -1)
- destFile+="/";
- destFile +=(*it);
- curFile = currentDir.canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile +=(*it);
+ QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
+// if(destFile.right(1).find("/",0,TRUE) == -1)
+// destFile+="/";
+// destFile +=(*it);
+
+ curFile = currentDir.canonicalPath()+"/"+(*it);
+// if(curFile.right(1).find("/",0,TRUE) == -1)
+// curFile +="/";
+// curFile +=(*it);
+
QFile f(destFile);
if( f.exists())
f.remove();
- if(!copyFile(destFile, curFile) )
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
qWarning("nothin doing");
}
+ }
populateRemoteView();
TabWidget->setCurrentPage(1);
} else {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile = currentDir.canonicalPath();
- if(destFile.right(1).find("/",0,TRUE) == -1)
- destFile+="/";
- destFile +=(*it);
- curFile = currentRemoteDir.canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile +=(*it);
+ QString destFile = currentDir.canonicalPath()+"/"+(*it);
+ curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
+
QFile f(destFile);
if( f.exists())
f.remove();
- if(!copyFile(destFile, curFile) )
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
+
qWarning("nothin doing");
}
+ }
populateLocalView();
TabWidget->setCurrentPage(0);
}
}
@@ -1187,58 +1189,50 @@ void AdvancedFm::copyAs()
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destFile;
- curFile = currentDir.canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile+=(*it);
+ curFile = currentDir.canonicalPath()+"/"+(*it);
// InputDialog *fileDlg;
// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
fileDlg->setInputText((const QString &) destFile );
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
- destFile = currentRemoteDir.canonicalPath();
- if(destFile.right(1).find("/",0,TRUE) == -1)
- destFile+="/";
- destFile +=(*it);
+ destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
QFile f(destFile);
if( f.exists())
f.remove();
- if(!copyFile(destFile, curFile) )
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
qWarning("nothin doing");
}
}
+ }
populateRemoteView();
TabWidget->setCurrentPage(1);
} else {
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- curFile = currentDir.canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile+=(*it);
+ curFile = currentDir.canonicalPath()+"/"+(*it);
QString destFile;
fileDlg->setInputText((const QString &) destFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
- destFile = currentDir.canonicalPath();
- if(destFile.right(1).find("/",0,TRUE) == -1)
- destFile+="/";
- destFile +=(*it);
+ destFile = currentDir.canonicalPath()+"/"+(*it);
QFile f(destFile);
if( f.exists())
f.remove();
- if(!copyFile(destFile, curFile) )
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
qWarning("nothin doing");
}
}
+ }
populateLocalView();
TabWidget->setCurrentPage(0);
}
}
@@ -1533,24 +1527,33 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
}
void AdvancedFm::mkSym() {
QString cmd;
+ QStringList curFileList = getPath();
+
if (TabWidget->currentPageIndex() == 0) {
- QString curFile = Local_View->currentItem()->text(0);
- if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1);
- QString destName = currentRemoteDir.canonicalPath()+"/"+curFile;
- curFile = currentDir.canonicalPath()+"/"+curFile;
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
+ QString curFile = currentDir.canonicalPath()+"/"+(*it);
cmd = "ln -s "+curFile+" "+destName;
+ qDebug(cmd);
system(cmd.latin1() );
+ }
populateRemoteView();
+ TabWidget->setCurrentPage(1);
} else {
- QString curFile = Remote_View->currentItem()->text(0);
- if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1);
- QString destName = currentDir.canonicalPath()+"/"+curFile;
- curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ QString destName = currentDir.canonicalPath()+"/"+(*it);
+ QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
+
cmd = "ln -s "+curFile+" "+destName;
+ qDebug(cmd);
system(cmd.latin1() );
+ }
populateLocalView();
+ TabWidget->setCurrentPage(0);
}
}
void AdvancedFm::QPEButtonPushed() {