-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 220 |
3 files changed, 139 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 12ebbf2..7bccce9 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -59,32 +59,33 @@ public: | |||
59 | // QTabWidget *TabWidget; | 59 | // QTabWidget *TabWidget; |
60 | QWidget *tab, *tab_2, *tab_3; | 60 | QWidget *tab, *tab_2, *tab_3; |
61 | QListView *Local_View, *Remote_View; | 61 | QListView *Local_View, *Remote_View; |
62 | 62 | ||
63 | QLineEdit *currentPathEdit; | 63 | QLineEdit *currentPathEdit; |
64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 64 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 65 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 66 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
67 | QDir currentDir, currentRemoteDir; | 67 | QDir currentDir, currentRemoteDir; |
68 | QComboBox *currentPathCombo; | 68 | QComboBox *currentPathCombo; |
69 | QString filterStr; | 69 | QString filterStr; |
70 | QListViewItem * item; | 70 | QListViewItem * item; |
71 | bool b; | 71 | bool b; |
72 | QStringList fileSystemTypeList, fsList; | 72 | QStringList fileSystemTypeList, fsList; |
73 | int currentServerConfig; | 73 | int currentServerConfig; |
74 | protected slots: | 74 | protected slots: |
75 | void selectAll(); | ||
75 | void addToDocs(); | 76 | void addToDocs(); |
76 | void doLocalCd(); | 77 | void doLocalCd(); |
77 | void doRemoteCd(); | 78 | void doRemoteCd(); |
78 | // void copy(); | 79 | // void copy(); |
79 | void mkDir(); | 80 | void mkDir(); |
80 | void del(); | 81 | void del(); |
81 | void rn(); | 82 | void rn(); |
82 | void populateLocalView(); | 83 | void populateLocalView(); |
83 | void populateRemoteView(); | 84 | void populateRemoteView(); |
84 | void showHidden(); | 85 | void showHidden(); |
85 | void showMenuHidden(); | 86 | void showMenuHidden(); |
86 | void showRemoteHidden(); | 87 | void showRemoteHidden(); |
87 | void writeConfig(); | 88 | void writeConfig(); |
88 | void readConfig(); | 89 | void readConfig(); |
89 | void localListClicked(QListViewItem *); | 90 | void localListClicked(QListViewItem *); |
90 | void remoteListClicked(QListViewItem *); | 91 | void remoteListClicked(QListViewItem *); |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 7188640..f0a0a35 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -74,32 +74,33 @@ void AdvancedFm::init() { | |||
74 | docButton->setFixedSize( QSize( 20, 20 ) ); | 74 | docButton->setFixedSize( QSize( 20, 20 ) ); |
75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
76 | 76 | ||
77 | homeButton = new QToolButton( this,"homeButton"); | 77 | homeButton = new QToolButton( this,"homeButton"); |
78 | homeButton->setPixmap(Resource::loadPixmap("home")); | 78 | homeButton->setPixmap(Resource::loadPixmap("home")); |
79 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 79 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
81 | 81 | ||
82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | fileMenu->insertSeparator(); | 84 | fileMenu->insertSeparator(); |
85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
89 | fileMenu->insertSeparator(); | 89 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | ||
90 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 91 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
91 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 92 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
92 | fileMenu->setCheckable(TRUE); | 93 | fileMenu->setCheckable(TRUE); |
93 | 94 | ||
94 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 95 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
95 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 96 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
96 | viewMenu->insertSeparator(); | 97 | viewMenu->insertSeparator(); |
97 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 98 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
98 | viewMenu->setCheckable(TRUE); | 99 | viewMenu->setCheckable(TRUE); |
99 | 100 | ||
100 | 101 | ||
101 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 102 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
102 | currentPathCombo->setEditable(TRUE); | 103 | currentPathCombo->setEditable(TRUE); |
103 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 104 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 105 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
105 | 106 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 27a119f..bef701a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -186,126 +186,158 @@ void AdvancedFm::localMakDir() { | |||
186 | populateLocalView(); | 186 | populateLocalView(); |
187 | } | 187 | } |
188 | 188 | ||
189 | void AdvancedFm::remoteMakDir() { | 189 | void AdvancedFm::remoteMakDir() { |
190 | InputDialog *fileDlg; | 190 | InputDialog *fileDlg; |
191 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 191 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
192 | fileDlg->exec(); | 192 | fileDlg->exec(); |
193 | if( fileDlg->result() == 1 ) { | 193 | if( fileDlg->result() == 1 ) { |
194 | QString filename = fileDlg->LineEdit1->text(); | 194 | QString filename = fileDlg->LineEdit1->text(); |
195 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 195 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
196 | } | 196 | } |
197 | populateRemoteView(); | 197 | populateRemoteView(); |
198 | } | 198 | } |
199 | 199 | ||
200 | void AdvancedFm::localDelete() { | 200 | void AdvancedFm::localDelete() { |
201 | QStringList curFileList = getPath(); | 201 | QStringList curFileList = getPath(); |
202 | if(curFileList.count() > 0) { | 202 | bool doMsg=true; |
203 | QString myFile; | 203 | int count=curFileList.count(); |
204 | if( count > 0) { | ||
205 | if(count > 1 ){ | ||
206 | QString msg; | ||
207 | msg=tr("Really delete\n%1 files?").arg(count); | ||
208 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
209 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
210 | case 0: | ||
211 | doMsg=false; | ||
212 | break; | ||
213 | case 1: | ||
214 | return; | ||
215 | break; | ||
216 | }; | ||
217 | } | ||
218 | |||
219 | QString myFile; | ||
204 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 220 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
205 | myFile = (*it); | 221 | myFile = (*it); |
206 | if( myFile.find(" -> ",0,TRUE) != -1) | 222 | if( myFile.find(" -> ",0,TRUE) != -1) |
207 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 223 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
208 | 224 | ||
209 | QString f = currentDir.canonicalPath(); | 225 | QString f = currentDir.canonicalPath(); |
210 | if(f.right(1).find("/",0,TRUE) == -1) | 226 | if(f.right(1).find("/",0,TRUE) == -1) |
211 | f+="/"; | 227 | f+="/"; |
212 | f+=myFile; | 228 | f+=myFile; |
213 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 229 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
214 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 230 | switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+ |
215 | "\nand all it's contents ?" | 231 | "\nand all it's contents ?" |
216 | ,tr("Yes"),tr("No"),0,0,1) ) { | 232 | ,tr("Yes"),tr("No"),0,0,1) ) { |
217 | case 0: { | 233 | case 0: { |
218 | f=f.left(f.length()-1); | 234 | f=f.left(f.length()-1); |
219 | QString cmd="rm -rf "+f; | 235 | QString cmd="rm -rf "+f; |
220 | system( cmd.latin1()); | 236 | system( cmd.latin1()); |
221 | populateLocalView(); | 237 | populateLocalView(); |
222 | } | 238 | } |
223 | break; | 239 | break; |
224 | case 1: | 240 | case 1: |
225 | // exit | 241 | // exit |
226 | break; | 242 | break; |
227 | }; | 243 | }; |
228 | 244 | ||
229 | } else { | 245 | } else { |
230 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 246 | if(doMsg) { |
247 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
231 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 248 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
232 | case 0: { | 249 | case 1: |
233 | QString cmd="rm "+f; | 250 | return; |
234 | QFile file(f); | 251 | break; |
235 | file.remove(); | ||
236 | // system( cmd.latin1()); | ||
237 | populateLocalView(); | ||
238 | } | ||
239 | break; | ||
240 | case 1: | ||
241 | // exit | ||
242 | break; | ||
243 | }; | 252 | }; |
253 | } | ||
254 | QString cmd="rm "+f; | ||
255 | QFile file(f); | ||
256 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
257 | file.remove(); | ||
258 | // system( cmd.latin1()); | ||
244 | } | 259 | } |
245 | } | 260 | } |
246 | } | 261 | } |
262 | populateLocalView(); | ||
247 | } | 263 | } |
248 | 264 | ||
249 | void AdvancedFm::remoteDelete() { | 265 | void AdvancedFm::remoteDelete() { |
250 | QStringList curFileList = getPath(); | 266 | QStringList curFileList = getPath(); |
251 | if( curFileList.count() > 0) { | 267 | bool doMsg=true; |
252 | QString myFile; | 268 | int count=curFileList.count(); |
253 | 269 | if( count > 0) { | |
254 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 270 | if(count > 1 ){ |
255 | myFile = (*it); | 271 | QString msg; |
256 | if(myFile.find(" -> ",0,TRUE) != -1) | 272 | msg=tr("Really delete\n%1 files?").arg(count); |
257 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 273 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
258 | QString f = currentRemoteDir.canonicalPath(); | 274 | ,tr("Yes"),tr("No"),0,0,1) ) { |
259 | if(f.right(1).find("/",0,TRUE) == -1) | 275 | case 0: |
260 | f+="/"; | 276 | doMsg=false; |
261 | f+=myFile; | 277 | break; |
262 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 278 | case 1: |
263 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 279 | return; |
264 | "\nand all it's contents ?", | 280 | break; |
265 | tr("Yes"),tr("No"),0,0,1) ) { | 281 | }; |
266 | case 0: { | ||
267 | f=f.left(f.length()-1); | ||
268 | QString cmd="rm -rf "+f; | ||
269 | system( cmd.latin1()); | ||
270 | populateRemoteView(); | ||
271 | } | 282 | } |
272 | break; | ||
273 | case 1: | ||
274 | // exit | ||
275 | break; | ||
276 | }; | ||
277 | 283 | ||
278 | } else { | 284 | QString myFile; |
279 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 285 | |
280 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 286 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
281 | case 0: { | 287 | myFile = (*it); |
282 | QString cmd="rm "+f; | 288 | if(myFile.find(" -> ",0,TRUE) != -1) |
283 | QFile file(f); | 289 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
284 | file.remove(); | 290 | QString f = currentRemoteDir.canonicalPath(); |
285 | // system( cmd.latin1()); | 291 | if(f.right(1).find("/",0,TRUE) == -1) |
286 | populateRemoteView(); | 292 | f+="/"; |
293 | f+=myFile; | ||
294 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | ||
295 | switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ | ||
296 | "\nand all it's contents ?", | ||
297 | tr("Yes"),tr("No"),0,0,1) ) { | ||
298 | case 0: { | ||
299 | f=f.left(f.length()-1); | ||
300 | QString cmd="rm -rf "+f; | ||
301 | system( cmd.latin1()); | ||
302 | populateRemoteView(); | ||
303 | } | ||
304 | break; | ||
305 | case 1: | ||
306 | // exit | ||
307 | break; | ||
308 | }; | ||
309 | |||
310 | } else { | ||
311 | if(doMsg) { | ||
312 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | ||
313 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | ||
314 | case 1: | ||
315 | return; | ||
316 | break; | ||
317 | }; | ||
318 | } | ||
319 | QString cmd="rm "+f; | ||
320 | QFile file(f); | ||
321 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | ||
322 | file.remove(); | ||
323 | // system( cmd.latin1()); | ||
324 | } | ||
287 | } | 325 | } |
288 | break; | ||
289 | case 1: | ||
290 | // exit | ||
291 | break; | ||
292 | }; | ||
293 | } | ||
294 | } | 326 | } |
295 | } | 327 | populateRemoteView(); |
296 | } | 328 | } |
297 | 329 | ||
298 | void AdvancedFm::localRename() { | 330 | void AdvancedFm::localRename() { |
299 | QString curFile = Local_View->currentItem()->text(0); | 331 | QString curFile = Local_View->currentItem()->text(0); |
300 | qDebug("currentItem "+curFile); | 332 | qDebug("currentItem "+curFile); |
301 | if( curFile !="../") { | 333 | if( curFile !="../") { |
302 | InputDialog *fileDlg; | 334 | InputDialog *fileDlg; |
303 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 335 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
304 | fileDlg->setInputText((const QString &)curFile); | 336 | fileDlg->setInputText((const QString &)curFile); |
305 | fileDlg->exec(); | 337 | fileDlg->exec(); |
306 | if( fileDlg->result() == 1 ) { | 338 | if( fileDlg->result() == 1 ) { |
307 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 339 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
308 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 340 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
309 | //+".playlist"; | 341 | //+".playlist"; |
310 | if( rename(oldname.latin1(), newName.latin1())== -1) | 342 | if( rename(oldname.latin1(), newName.latin1())== -1) |
311 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 343 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
@@ -396,93 +428,105 @@ void AdvancedFm::upDir() { | |||
396 | update(); | 428 | update(); |
397 | } else { | 429 | } else { |
398 | QString current = currentRemoteDir.canonicalPath(); | 430 | QString current = currentRemoteDir.canonicalPath(); |
399 | QDir dir(current); | 431 | QDir dir(current); |
400 | dir.cdUp(); | 432 | dir.cdUp(); |
401 | current = dir.canonicalPath(); | 433 | current = dir.canonicalPath(); |
402 | chdir( current.latin1() ); | 434 | chdir( current.latin1() ); |
403 | currentRemoteDir.cd( current, TRUE); | 435 | currentRemoteDir.cd( current, TRUE); |
404 | populateRemoteView(); | 436 | populateRemoteView(); |
405 | update(); | 437 | update(); |
406 | } | 438 | } |
407 | } | 439 | } |
408 | 440 | ||
409 | void AdvancedFm::copy() { | 441 | void AdvancedFm::copy() { |
410 | qApp->processEvents(); | 442 | qApp->processEvents(); |
411 | QStringList curFileList = getPath(); | 443 | QStringList curFileList = getPath(); |
412 | if( curFileList.count() > 0) { | 444 | bool doMsg=true; |
445 | int count=curFileList.count(); | ||
446 | if( count > 0) { | ||
447 | if(count > 1 ){ | ||
448 | QString msg; | ||
449 | msg=tr("Really copy\n%1 files?").arg(count); | ||
450 | switch ( QMessageBox::warning(this,tr("Delete"),msg | ||
451 | ,tr("Yes"),tr("No"),0,0,1) ) { | ||
452 | case 0: | ||
453 | doMsg=false; | ||
454 | break; | ||
455 | case 1: | ||
456 | return; | ||
457 | break; | ||
458 | }; | ||
459 | } | ||
460 | |||
413 | QString curFile, item, destFile; | 461 | QString curFile, item, destFile; |
414 | if (TabWidget->getCurrentTab() == 0) { | 462 | if (TabWidget->getCurrentTab() == 0) { |
415 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 463 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
416 | item=(*it); | 464 | item=(*it); |
417 | |||
418 | if(item.find("->",0,TRUE)) //symlink | 465 | if(item.find("->",0,TRUE)) //symlink |
419 | item = item.left(item.find("->",0,TRUE)); | 466 | item = item.left(item.find("->",0,TRUE)); |
420 | 467 | ||
421 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 468 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
422 | qDebug("Destination file is "+destFile); | 469 | qDebug("Destination file is "+destFile); |
423 | 470 | ||
424 | curFile = currentDir.canonicalPath()+"/"+ item; | 471 | curFile = currentDir.canonicalPath()+"/"+ item; |
425 | qDebug("CurrentFile file is " + curFile); | 472 | qDebug("CurrentFile file is " + curFile); |
426 | 473 | ||
427 | QFile f(destFile); | 474 | QFile f(destFile); |
428 | if( f.exists()) { | 475 | if( f.exists()) { |
429 | switch ( QMessageBox::warning(this,tr("Delete"), | 476 | if(doMsg) { |
430 | destFile+tr(" already exists\nDo you really want to delete it?"), | 477 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
431 | tr("Yes"),tr("No"),0,0,1) ) { | 478 | item+tr("\nexists. Ok to overwrite?"), |
432 | case 0: | 479 | tr("Yes"),tr("No"),0,0,1) ) { |
433 | f.remove(); | 480 | case 1: |
434 | break; | 481 | return; |
435 | case 1: | 482 | break; |
436 | return; | 483 | }; |
437 | break; | 484 | } |
438 | }; | 485 | f.remove(); |
439 | } | 486 | } |
440 | if(!copyFile(destFile, curFile) ) { | 487 | if(!copyFile(destFile, curFile) ) { |
441 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 488 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
442 | return; | 489 | return; |
443 | } | 490 | } |
444 | } | 491 | } |
445 | populateRemoteView(); | 492 | populateRemoteView(); |
446 | TabWidget->setCurrentTab(1); | 493 | TabWidget->setCurrentTab(1); |
447 | 494 | ||
448 | } else { | 495 | } else { |
449 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
450 | item= (*it); | 497 | item= (*it); |
451 | |||
452 | if(item.find("->",0,TRUE)) //symlink | 498 | if(item.find("->",0,TRUE)) //symlink |
453 | item = item.left(item.find("->",0,TRUE)); | 499 | item = item.left(item.find("->",0,TRUE)); |
454 | 500 | ||
455 | destFile = currentDir.canonicalPath()+"/"+ item; | 501 | destFile = currentDir.canonicalPath()+"/"+ item; |
456 | qDebug("Destination file is "+destFile); | 502 | qDebug("Destination file is "+destFile); |
457 | 503 | ||
458 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 504 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
459 | qDebug("CurrentFile file is " + curFile); | 505 | qDebug("CurrentFile file is " + curFile); |
460 | 506 | ||
461 | QFile f(destFile); | 507 | QFile f(destFile); |
462 | if( f.exists()) { | 508 | if( f.exists()) { |
463 | switch ( QMessageBox::warning(this,tr("Delete"), | 509 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
464 | destFile+tr(" already exists\nDo you really want to delete it?"), | 510 | item+tr("\nexists. Ok to overwrite?"), |
465 | tr("Yes"),tr("No"),0,0,1) ) { | 511 | tr("Yes"),tr("No"),0,0,1) ) { |
466 | case 0: | ||
467 | f.remove(); | ||
468 | break; | ||
469 | case 1: | 512 | case 1: |
470 | return; | 513 | return; |
471 | break; | 514 | break; |
472 | }; | 515 | }; |
516 | f.remove(); | ||
473 | } | 517 | } |
474 | if(!copyFile(destFile, curFile) ) { | 518 | if(!copyFile(destFile, curFile) ) { |
475 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 519 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
476 | +curFile +tr("to\n")+destFile); | 520 | +curFile +tr("to\n")+destFile); |
477 | return; | 521 | return; |
478 | 522 | ||
479 | } | 523 | } |
480 | } | 524 | } |
481 | populateLocalView(); | 525 | populateLocalView(); |
482 | TabWidget->setCurrentTab(0); | 526 | TabWidget->setCurrentTab(0); |
483 | } | 527 | } |
484 | 528 | ||
485 | } | 529 | } |
486 | } | 530 | } |
487 | 531 | ||
488 | void AdvancedFm::copyAs() { | 532 | void AdvancedFm::copyAs() { |
@@ -494,34 +538,34 @@ void AdvancedFm::copyAs() { | |||
494 | if (TabWidget->getCurrentTab() == 0) { | 538 | if (TabWidget->getCurrentTab() == 0) { |
495 | qDebug("tab 1"); | 539 | qDebug("tab 1"); |
496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 540 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
497 | QString destFile; | 541 | QString destFile; |
498 | curFile = currentDir.canonicalPath()+"/"+(*it); | 542 | curFile = currentDir.canonicalPath()+"/"+(*it); |
499 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 543 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
500 | 544 | ||
501 | fileDlg->setInputText((const QString &) destFile ); | 545 | fileDlg->setInputText((const QString &) destFile ); |
502 | fileDlg->exec(); | 546 | fileDlg->exec(); |
503 | 547 | ||
504 | if( fileDlg->result() == 1 ) { | 548 | if( fileDlg->result() == 1 ) { |
505 | QString filename = fileDlg->LineEdit1->text(); | 549 | QString filename = fileDlg->LineEdit1->text(); |
506 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 550 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
507 | 551 | ||
508 | QFile f(destFile); | 552 | QFile f(destFile); |
509 | if( f.exists()) { | 553 | if( f.exists()) { |
510 | switch (QMessageBox::warning(this,tr("Delete"), | 554 | switch (QMessageBox::warning(this,tr("File Exists!"), |
511 | destFile+tr(" already exists\nDo you really want to delete it?"), | 555 | item+tr("\nexists. Ok to overwrite?"), |
512 | tr("Yes"),tr("No"),0,0,1) ) { | 556 | tr("Yes"),tr("No"),0,0,1) ) { |
513 | case 0: | 557 | case 0: |
514 | f.remove(); | 558 | f.remove(); |
515 | break; | 559 | break; |
516 | case 1: | 560 | case 1: |
517 | return; | 561 | return; |
518 | break; | 562 | break; |
519 | }; | 563 | }; |
520 | } | 564 | } |
521 | if(!copyFile(destFile, curFile) ) { | 565 | if(!copyFile(destFile, curFile) ) { |
522 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 566 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
523 | +curFile +tr("to\n")+destFile); | 567 | +curFile +tr("to\n")+destFile); |
524 | return; | 568 | return; |
525 | } | 569 | } |
526 | } | 570 | } |
527 | delete fileDlg; | 571 | delete fileDlg; |
@@ -533,34 +577,34 @@ void AdvancedFm::copyAs() { | |||
533 | } else { | 577 | } else { |
534 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 578 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
535 | 579 | ||
536 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 580 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
537 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 581 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
538 | 582 | ||
539 | QString destFile; | 583 | QString destFile; |
540 | fileDlg->setInputText((const QString &) destFile); | 584 | fileDlg->setInputText((const QString &) destFile); |
541 | fileDlg->exec(); | 585 | fileDlg->exec(); |
542 | 586 | ||
543 | if( fileDlg->result() == 1 ) { | 587 | if( fileDlg->result() == 1 ) { |
544 | QString filename = fileDlg->LineEdit1->text(); | 588 | QString filename = fileDlg->LineEdit1->text(); |
545 | destFile = currentDir.canonicalPath()+"/"+filename; | 589 | destFile = currentDir.canonicalPath()+"/"+filename; |
546 | 590 | ||
547 | QFile f( destFile); | 591 | QFile f( destFile); |
548 | if( f.exists()) { | 592 | if( f.exists()) { |
549 | switch ( QMessageBox::warning(this,tr("Delete"), | 593 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
550 | destFile+tr(" already exists\nDo you really want to delete it?"), | 594 | item+tr("\nexists. Ok to overwrite?"), |
551 | tr("Yes"),tr("No"),0,0,1) ) { | 595 | tr("Yes"),tr("No"),0,0,1) ) { |
552 | case 0: | 596 | case 0: |
553 | f.remove(); | 597 | f.remove(); |
554 | break; | 598 | break; |
555 | case 1: | 599 | case 1: |
556 | return; | 600 | return; |
557 | break; | 601 | break; |
558 | }; | 602 | }; |
559 | } | 603 | } |
560 | if(!copyFile(destFile, curFile) ) { | 604 | if(!copyFile(destFile, curFile) ) { |
561 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 605 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
562 | +curFile +tr("to\n")+destFile); | 606 | +curFile +tr("to\n")+destFile); |
563 | return; | 607 | return; |
564 | } | 608 | } |
565 | 609 | ||
566 | } | 610 | } |
@@ -949,16 +993,26 @@ void AdvancedFm::doBeam() { | |||
949 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 993 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
950 | Ir *file = new Ir(this, "IR"); | 994 | Ir *file = new Ir(this, "IR"); |
951 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 995 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
952 | file->send( curFile, curFile ); | 996 | file->send( curFile, curFile ); |
953 | 997 | ||
954 | } | 998 | } |
955 | } | 999 | } |
956 | } | 1000 | } |
957 | } | 1001 | } |
958 | 1002 | ||
959 | } | 1003 | } |
960 | 1004 | ||
961 | void AdvancedFm::fileBeamFinished( Ir *) { | 1005 | void AdvancedFm::fileBeamFinished( Ir *) { |
962 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1006 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
963 | 1007 | ||
964 | } | 1008 | } |
1009 | |||
1010 | void AdvancedFm::selectAll() { | ||
1011 | if (TabWidget->getCurrentTab() == 0) { | ||
1012 | Local_View->selectAll(true); | ||
1013 | Local_View->setSelected( Local_View->firstChild(),false); | ||
1014 | } else { | ||
1015 | Remote_View->selectAll(true); | ||
1016 | Remote_View->setSelected( Remote_View->firstChild(),false); | ||
1017 | } | ||
1018 | } | ||