summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-12-16 04:14:46 (UTC)
committer llornkcor <llornkcor>2002-12-16 04:14:46 (UTC)
commitcc6c77e7014a3056debd6963946265671d41517d (patch) (unidiff)
tree1b8f929dd83a8d64915b91ecb3052c19ff5ac0b5 /noncore
parentb1880703eea8601e06cf3d3e8593b649cd1a485e (diff)
downloadopie-cc6c77e7014a3056debd6963946265671d41517d.zip
opie-cc6c77e7014a3056debd6963946265671d41517d.tar.gz
opie-cc6c77e7014a3056debd6963946265671d41517d.tar.bz2
send as text the real filename is symlink
Diffstat (limited to 'noncore') (more/less context) (show 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.cpp32
3 files changed, 29 insertions, 12 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
@@ -306,25 +306,26 @@ void AdvancedFm::populateRemoteView() {
306 } 306 }
307 307
308 Remote_View->setSorting( 3,FALSE); 308 Remote_View->setSorting( 3,FALSE);
309 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 309 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
310} 310}
311 311
312void AdvancedFm::localListClicked(QListViewItem *selectedItem) { 312void AdvancedFm::localListClicked(QListViewItem *selectedItem) {
313 if(selectedItem) { 313 if(selectedItem) {
314 QString strItem=selectedItem->text(0); 314 QString strItem=selectedItem->text(0);
315 QString strSize=selectedItem->text(1); 315 QString strSize=selectedItem->text(1);
316 strSize=strSize.stripWhiteSpace(); 316 strSize=strSize.stripWhiteSpace();
317 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 317 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
318 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 318 QString strItem2 = dealWithSymName((const QString&)strItem);
319// QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
319 if(QDir(strItem2).exists() ) { 320 if(QDir(strItem2).exists() ) {
320 currentDir.cd(strItem2, TRUE); 321 currentDir.cd(strItem2, TRUE);
321 populateLocalView(); 322 populateLocalView();
322 323
323 } 324 }
324 } else { // not a symlink 325 } else { // not a symlink
325 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 326 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
326 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 327 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
327 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 328 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
328 currentDir.cd(strItem,FALSE); 329 currentDir.cd(strItem,FALSE);
329 populateLocalView(); 330 populateLocalView();
330 Local_View->ensureItemVisible(Local_View->firstChild()); 331 Local_View->ensureItemVisible(Local_View->firstChild());
@@ -352,25 +353,26 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) {
352 } 353 }
353 354
354 } 355 }
355} 356}
356 357
357void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { 358void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
358 359
359 if(selectedItem) { 360 if(selectedItem) {
360 QString strItem=selectedItem->text(0); 361 QString strItem=selectedItem->text(0);
361 QString strSize=selectedItem->text(1); 362 QString strSize=selectedItem->text(1);
362 strSize=strSize.stripWhiteSpace(); 363 strSize=strSize.stripWhiteSpace();
363 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 364 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
364 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 365 QString strItem2 = dealWithSymName((const QString&)strItem);
366// QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
365 currentRemoteDir.cd(strItem2, TRUE); 367 currentRemoteDir.cd(strItem2, TRUE);
366 populateRemoteView(); 368 populateRemoteView();
367 } else { // not a symlink 369 } else { // not a symlink
368 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 370 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
369 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 371 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
370 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 372 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
371 currentRemoteDir.cd(strItem,FALSE); 373 currentRemoteDir.cd(strItem,FALSE);
372 populateRemoteView(); 374 populateRemoteView();
373 Remote_View->ensureItemVisible(Remote_View->firstChild()); 375 Remote_View->ensureItemVisible(Remote_View->firstChild());
374 } else { 376 } else {
375 currentRemoteDir.cdUp(); 377 currentRemoteDir.cdUp();
376 populateRemoteView(); 378 populateRemoteView();
@@ -452,25 +454,25 @@ void AdvancedFm::currentPathComboChanged() {
452 if (TabWidget->getCurrentTab() == 0) { 454 if (TabWidget->getCurrentTab() == 0) {
453// if (TabWidget->currentPageIndex() == 0) { 455// if (TabWidget->currentPageIndex() == 0) {
454 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 456 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
455 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 457 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
456 populateRemoteView(); 458 populateRemoteView();
457 } else { 459 } else {
458 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 460 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
459 } 461 }
460 } 462 }
461} 463}
462 464
463void AdvancedFm::fillCombo(const QString &currentPath) { 465void AdvancedFm::fillCombo(const QString &currentPath) {
464 466 qDebug("%d",TabWidget->getCurrentTab());
465 if (TabWidget->getCurrentTab() == 0) { 467 if (TabWidget->getCurrentTab() == 0) {
466// if (TabWidget->currentPageIndex() == 0) { 468// if (TabWidget->currentPageIndex() == 0) {
467 currentPathCombo->lineEdit()->setText( currentPath); 469 currentPathCombo->lineEdit()->setText( currentPath);
468 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 470 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
469 currentPathCombo->clear(); 471 currentPathCombo->clear();
470 localDirPathStringList.prepend( currentPath ); 472 localDirPathStringList.prepend( currentPath );
471 currentPathCombo->insertStringList( localDirPathStringList,-1); 473 currentPathCombo->insertStringList( localDirPathStringList,-1);
472 } 474 }
473 } else { 475 } else {
474 currentPathCombo->lineEdit()->setText( currentPath); 476 currentPathCombo->lineEdit()->setText( currentPath);
475 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 477 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
476 currentPathCombo->clear(); 478 currentPathCombo->clear();
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
@@ -115,24 +115,25 @@ protected slots:
115protected: 115protected:
116 bool zaurusDevice; 116 bool zaurusDevice;
117 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 117 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
118 QStringList remoteDirPathStringList, localDirPathStringList; 118 QStringList remoteDirPathStringList, localDirPathStringList;
119 119
120 void init(); 120 void init();
121 void initConnections(); 121 void initConnections();
122 void keyReleaseEvent( QKeyEvent *); 122 void keyReleaseEvent( QKeyEvent *);
123 QString getFileSystemType(const QString &); 123 QString getFileSystemType(const QString &);
124 QString getDiskSpace(const QString &); 124 QString getDiskSpace(const QString &);
125 void parsetab(const QString &fileName); 125 void parsetab(const QString &fileName);
126 QString checkDiskSpace(const QString &); 126 QString checkDiskSpace(const QString &);
127 QString dealWithSymName(const QString &);
127 128
128protected slots: 129protected slots:
129 void showFileMenu(); 130 void showFileMenu();
130 void cancelMenuTimer(); 131 void cancelMenuTimer();
131 void homeButtonPushed(); 132 void homeButtonPushed();
132 void docButtonPushed(); 133 void docButtonPushed();
133 void SDButtonPushed(); 134 void SDButtonPushed();
134 void CFButtonPushed(); 135 void CFButtonPushed();
135 void QPEButtonPushed(); 136 void QPEButtonPushed();
136 void upDir(); 137 void upDir();
137 void currentPathComboChanged(); 138 void currentPathComboChanged();
138 void copy(); 139 void copy();
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
@@ -94,28 +94,36 @@ void AdvancedFm::showHidden() {
94void AdvancedFm::showRemoteHidden() { 94void AdvancedFm::showRemoteHidden() {
95 if (b) { 95 if (b) {
96 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 96 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
97// b=TRUE; 97// b=TRUE;
98 98
99 } else { 99 } else {
100 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 100 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
101// b=FALSE; 101// b=FALSE;
102 } 102 }
103 populateRemoteView(); 103 populateRemoteView();
104} 104}
105 105
106QString AdvancedFm::dealWithSymName(const QString &fileName) {
107 QString strItem = fileName;
108 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
109}
110
106void AdvancedFm::runThis() { 111void AdvancedFm::runThis() {
107 QString fs; 112 QString fs;
108 if (TabWidget->getCurrentTab() == 0) { 113 if (TabWidget->getCurrentTab() == 0) {
109 QString curFile = Local_View->currentItem()->text(0); 114 QString curFile = Local_View->currentItem()->text(0);
115 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
116 curFile = dealWithSymName((const QString&)curFile);
117
110 if(curFile != "../") { 118 if(curFile != "../") {
111 119
112 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 120 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
113 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 121 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
114 qDebug( fileInfo.owner()); 122 qDebug( fileInfo.owner());
115 if( (fileInfo.permission( QFileInfo::ExeUser) 123 if( (fileInfo.permission( QFileInfo::ExeUser)
116 | fileInfo.permission( QFileInfo::ExeGroup) 124 | fileInfo.permission( QFileInfo::ExeGroup)
117 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 125 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
118 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 126 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
119 QCopEnvelope e("QPE/System", "execute(QString)" ); 127 QCopEnvelope e("QPE/System", "execute(QString)" );
120 e << curFile; 128 e << curFile;
121 } else { 129 } else {
@@ -123,24 +131,26 @@ void AdvancedFm::runThis() {
123 DocLnk nf(curFile); 131 DocLnk nf(curFile);
124 QString execStr = nf.exec(); 132 QString execStr = nf.exec();
125 qDebug( execStr); 133 qDebug( execStr);
126 if( execStr.isEmpty() ) { 134 if( execStr.isEmpty() ) {
127 } else { 135 } else {
128 nf.execute(); 136 nf.execute();
129 } 137 }
130 } 138 }
131 } 139 }
132 } else { 140 } else {
133 QString curFile = Remote_View->currentItem()->text(0); 141 QString curFile = Remote_View->currentItem()->text(0);
134 if(curFile != "../") { 142 if(curFile != "../") {
143 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
144 curFile = dealWithSymName((const QString&)curFile);
135 145
136 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 146 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
137 qDebug("Filesystemtype is "+fs); 147 qDebug("Filesystemtype is "+fs);
138 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 148 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
139 if( (fileInfo.permission( QFileInfo::ExeUser) 149 if( (fileInfo.permission( QFileInfo::ExeUser)
140 | fileInfo.permission( QFileInfo::ExeGroup) 150 | fileInfo.permission( QFileInfo::ExeGroup)
141 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 151 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
142 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 152 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
143 QCopEnvelope e("QPE/System", "execute(QString)" ); 153 QCopEnvelope e("QPE/System", "execute(QString)" );
144 e << curFile; 154 e << curFile;
145 } else { 155 } else {
146 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 156 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
@@ -151,32 +161,36 @@ void AdvancedFm::runThis() {
151 } else { 161 } else {
152 nf.execute(); 162 nf.execute();
153 } 163 }
154 } 164 }
155 } 165 }
156 } 166 }
157} 167}
158 168
159void AdvancedFm::runText() { 169void AdvancedFm::runText() {
160 if (TabWidget->getCurrentTab() == 0) { 170 if (TabWidget->getCurrentTab() == 0) {
161 QString curFile = Local_View->currentItem()->text(0); 171 QString curFile = Local_View->currentItem()->text(0);
162 if(curFile != "../") { 172 if(curFile != "../") {
173 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
174 curFile = dealWithSymName((const QString&)curFile);
163 curFile = currentDir.canonicalPath()+"/"+curFile; 175 curFile = currentDir.canonicalPath()+"/"+curFile;
164 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 176 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
165 e << curFile; 177 e << curFile;
166 } 178 }
167 } else { 179 } else {
168 QString curFile = Remote_View->currentItem()->text(0); 180 QString curFile = Remote_View->currentItem()->text(0);
169 if(curFile != "../") { 181 if(curFile != "../") {
170 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 182 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
183 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
184 curFile = dealWithSymName((const QString&)curFile);
171 DocLnk nf(curFile); 185 DocLnk nf(curFile);
172 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 186 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
173 e << curFile; 187 e << curFile;
174 } 188 }
175 } 189 }
176} 190}
177 191
178void AdvancedFm::localMakDir() { 192void AdvancedFm::localMakDir() {
179 InputDialog *fileDlg; 193 InputDialog *fileDlg;
180 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 194 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
181 fileDlg->exec(); 195 fileDlg->exec();
182 if( fileDlg->result() == 1 ) { 196 if( fileDlg->result() == 1 ) {
@@ -473,25 +487,25 @@ void AdvancedFm::copy() {
473 if( f.exists()) { 487 if( f.exists()) {
474 if(doMsg) { 488 if(doMsg) {
475 switch ( QMessageBox::warning(this,tr("File Exists!"), 489 switch ( QMessageBox::warning(this,tr("File Exists!"),
476 item+tr("\nexists. Ok to overwrite?"), 490 item+tr("\nexists. Ok to overwrite?"),
477 tr("Yes"),tr("No"),0,0,1) ) { 491 tr("Yes"),tr("No"),0,0,1) ) {
478 case 1: 492 case 1:
479 return; 493 return;
480 break; 494 break;
481 }; 495 };
482 } 496 }
483 f.remove(); 497 f.remove();
484 } 498 }
485 if(!copyFile(destFile, curFile) ) { 499 if(!copyFile( curFile, destFile) ) {
486 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 500 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
487 return; 501 return;
488 } 502 }
489 } 503 }
490 populateRemoteView(); 504 populateRemoteView();
491 TabWidget->setCurrentTab(1); 505 TabWidget->setCurrentTab(1);
492 506
493 } else { 507 } else {
494 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 508 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
495 item= (*it); 509 item= (*it);
496 if(item.find("->",0,TRUE)) //symlink 510 if(item.find("->",0,TRUE)) //symlink
497 item = item.left(item.find("->",0,TRUE)); 511 item = item.left(item.find("->",0,TRUE));
@@ -504,25 +518,25 @@ void AdvancedFm::copy() {
504 518
505 QFile f(destFile); 519 QFile f(destFile);
506 if( f.exists()) { 520 if( f.exists()) {
507 switch ( QMessageBox::warning(this,tr("File Exists!"), 521 switch ( QMessageBox::warning(this,tr("File Exists!"),
508 item+tr("\nexists. Ok to overwrite?"), 522 item+tr("\nexists. Ok to overwrite?"),
509 tr("Yes"),tr("No"),0,0,1) ) { 523 tr("Yes"),tr("No"),0,0,1) ) {
510 case 1: 524 case 1:
511 return; 525 return;
512 break; 526 break;
513 }; 527 };
514 f.remove(); 528 f.remove();
515 } 529 }
516 if(!copyFile(destFile, curFile) ) { 530 if(!copyFile( curFile, destFile) ) {
517 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 531 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
518 +curFile +tr("to\n")+destFile); 532 +curFile +tr("to\n")+destFile);
519 return; 533 return;
520 534
521 } 535 }
522 } 536 }
523 populateLocalView(); 537 populateLocalView();
524 TabWidget->setCurrentTab(0); 538 TabWidget->setCurrentTab(0);
525 } 539 }
526 540
527 } 541 }
528} 542}
@@ -552,25 +566,25 @@ void AdvancedFm::copyAs() {
552 if( f.exists()) { 566 if( f.exists()) {
553 switch (QMessageBox::warning(this,tr("File Exists!"), 567 switch (QMessageBox::warning(this,tr("File Exists!"),
554 item+tr("\nexists. Ok to overwrite?"), 568 item+tr("\nexists. Ok to overwrite?"),
555 tr("Yes"),tr("No"),0,0,1) ) { 569 tr("Yes"),tr("No"),0,0,1) ) {
556 case 0: 570 case 0:
557 f.remove(); 571 f.remove();
558 break; 572 break;
559 case 1: 573 case 1:
560 return; 574 return;
561 break; 575 break;
562 }; 576 };
563 } 577 }
564 if(!copyFile(destFile, curFile) ) { 578 if(!copyFile( curFile,destFile) ) {
565 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 579 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
566 +curFile +tr("to\n")+destFile); 580 +curFile +tr("to\n")+destFile);
567 return; 581 return;
568 } 582 }
569 } 583 }
570 delete fileDlg; 584 delete fileDlg;
571 585
572 } 586 }
573 populateRemoteView(); 587 populateRemoteView();
574 TabWidget->setCurrentTab(1); 588 TabWidget->setCurrentTab(1);
575 589
576 } else { 590 } else {
@@ -592,25 +606,25 @@ void AdvancedFm::copyAs() {
592 if( f.exists()) { 606 if( f.exists()) {
593 switch ( QMessageBox::warning(this,tr("File Exists!"), 607 switch ( QMessageBox::warning(this,tr("File Exists!"),
594 item+tr("\nexists. Ok to overwrite?"), 608 item+tr("\nexists. Ok to overwrite?"),
595 tr("Yes"),tr("No"),0,0,1) ) { 609 tr("Yes"),tr("No"),0,0,1) ) {
596 case 0: 610 case 0:
597 f.remove(); 611 f.remove();
598 break; 612 break;
599 case 1: 613 case 1:
600 return; 614 return;
601 break; 615 break;
602 }; 616 };
603 } 617 }
604 if(!copyFile(destFile, curFile) ) { 618 if(!copyFile( curFile,destFile) ) {
605 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 619 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
606 +curFile +tr("to\n")+destFile); 620 +curFile +tr("to\n")+destFile);
607 return; 621 return;
608 } 622 }
609 623
610 } 624 }
611 delete fileDlg; 625 delete fileDlg;
612 626
613 } 627 }
614 populateLocalView(); 628 populateLocalView();
615 TabWidget->setCurrentTab(0); 629 TabWidget->setCurrentTab(0);
616 } 630 }
@@ -642,25 +656,25 @@ void AdvancedFm::copySameDir() {
642 switch (QMessageBox::warning(this,tr("Delete"), 656 switch (QMessageBox::warning(this,tr("Delete"),
643 destFile+tr(" already exists\nDo you really want to delete it?"), 657 destFile+tr(" already exists\nDo you really want to delete it?"),
644 tr("Yes"),tr("No"),0,0,1) ) { 658 tr("Yes"),tr("No"),0,0,1) ) {
645 case 0: 659 case 0:
646 660
647 f.remove(); 661 f.remove();
648 break; 662 break;
649 case 1: 663 case 1:
650 return; 664 return;
651 break; 665 break;
652 }; 666 };
653 } 667 }
654 if(!copyFile(destFile, curFile) ) { 668 if(!copyFile( curFile,destFile) ) {
655 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 669 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
656 +curFile +tr("to\n")+destFile); 670 +curFile +tr("to\n")+destFile);
657 return; 671 return;
658 } 672 }
659 673
660 qDebug("copy "+curFile+" as "+destFile); 674 qDebug("copy "+curFile+" as "+destFile);
661 } 675 }
662 delete fileDlg; 676 delete fileDlg;
663 } 677 }
664 populateLocalView(); 678 populateLocalView();
665 679
666 } else { 680 } else {
@@ -680,25 +694,25 @@ void AdvancedFm::copySameDir() {
680 if( f.exists()) { 694 if( f.exists()) {
681 switch ( QMessageBox::warning(this,tr("Delete"), 695 switch ( QMessageBox::warning(this,tr("Delete"),
682 destFile+tr(" already exists\nDo you really want to delete it?"), 696 destFile+tr(" already exists\nDo you really want to delete it?"),
683 tr("Yes"),tr("No"),0,0,1) ) { 697 tr("Yes"),tr("No"),0,0,1) ) {
684 case 0: 698 case 0:
685 f.remove(); 699 f.remove();
686 break; 700 break;
687 case 1: 701 case 1:
688 return; 702 return;
689 break; 703 break;
690 }; 704 };
691 } 705 }
692 if(!copyFile(destFile, curFile) ) { 706 if(!copyFile( curFile,destFile) ) {
693 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 707 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
694 +curFile +tr("to\n")+destFile); 708 +curFile +tr("to\n")+destFile);
695 return; 709 return;
696 } 710 }
697 qDebug("copy "+curFile+" as "+destFile); 711 qDebug("copy "+curFile+" as "+destFile);
698 } 712 }
699 delete fileDlg; 713 delete fileDlg;
700 } 714 }
701 populateRemoteView(); 715 populateRemoteView();
702 } 716 }
703} 717}
704 718
@@ -721,25 +735,25 @@ void AdvancedFm::move() {
721 curFile = currentDir.canonicalPath(); 735 curFile = currentDir.canonicalPath();
722 736
723 qDebug("Destination file is "+destFile); 737 qDebug("Destination file is "+destFile);
724 738
725 if(curFile.right(1).find("/",0,TRUE) == -1) 739 if(curFile.right(1).find("/",0,TRUE) == -1)
726 curFile +="/"; 740 curFile +="/";
727 741
728 curFile+= item; 742 curFile+= item;
729 qDebug("CurrentFile file is " + curFile); 743 qDebug("CurrentFile file is " + curFile);
730 744
731 QFile f( curFile); 745 QFile f( curFile);
732 if( f.exists()) { 746 if( f.exists()) {
733 if(!copyFile( destFile, curFile) ) { 747 if(!copyFile( curFile,destFile) ) {
734 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 748 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
735 return; 749 return;
736 } else 750 } else
737 QFile::remove(curFile); 751 QFile::remove(curFile);
738 } 752 }
739 } 753 }
740 754
741 TabWidget->setCurrentTab(1); 755 TabWidget->setCurrentTab(1);
742 756
743 } else { //view 2 757 } else { //view 2
744 758
745 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 759 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
@@ -753,39 +767,39 @@ void AdvancedFm::move() {
753 767
754 qDebug("Destination file is "+destFile); 768 qDebug("Destination file is "+destFile);
755 769
756 curFile = currentRemoteDir.canonicalPath(); 770 curFile = currentRemoteDir.canonicalPath();
757 771
758 if(curFile.right(1).find("/",0,TRUE) == -1) 772 if(curFile.right(1).find("/",0,TRUE) == -1)
759 curFile +="/"; 773 curFile +="/";
760 curFile+= item; 774 curFile+= item;
761 qDebug("CurrentFile file is " + curFile); 775 qDebug("CurrentFile file is " + curFile);
762 776
763 QFile f( curFile); 777 QFile f( curFile);
764 if( f.exists()) { 778 if( f.exists()) {
765 if(!copyFile( destFile, curFile) ) { 779 if(!copyFile( curFile, destFile) ) {
766 QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); 780 QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile);
767 return; 781 return;
768 } else 782 } else
769 QFile::remove( curFile); 783 QFile::remove( curFile);
770 } 784 }
771 TabWidget->setCurrentTab(0); 785 TabWidget->setCurrentTab(0);
772 } 786 }
773 } 787 }
774 populateRemoteView(); 788 populateRemoteView();
775 populateLocalView(); 789 populateLocalView();
776 } 790 }
777} 791}
778 792
779bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { 793bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
780 char bf[ 50000 ]; 794 char bf[ 50000 ];
781 int bytesRead; 795 int bytesRead;
782 bool success = TRUE; 796 bool success = TRUE;
783 struct stat status; 797 struct stat status;
784 798
785 QFile s( src ); 799 QFile s( src );
786 QFile d( dest ); 800 QFile d( dest );
787 801
788 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 802 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
789 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 803 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
790 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 804 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
791 success = FALSE; 805 success = FALSE;