summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm
authorllornkcor <llornkcor>2002-11-15 14:20:40 (UTC)
committer llornkcor <llornkcor>2002-11-15 14:20:40 (UTC)
commitb35750b8fe75e055e014e0dd294c714976f5715f (patch) (unidiff)
tree3a57c481f4b416e6bfe7ce6794077a2225165839 /noncore/apps/advancedfm
parentab8d331905b59a86b50cd513123cdde67e4bfb8a (diff)
downloadopie-b35750b8fe75e055e014e0dd294c714976f5715f.zip
opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.gz
opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.bz2
added select all, and changed delete of multi files to ask only once. Changed some messagebox strings
Diffstat (limited to 'noncore/apps/advancedfm') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp220
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
@@ -74,2 +74,3 @@ public:
74protected slots: 74protected slots:
75 void selectAll();
75 void addToDocs(); 76 void addToDocs();
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
@@ -89,2 +89,3 @@ void AdvancedFm::init() {
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() ));
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
@@ -201,4 +201,20 @@ 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 ) {
@@ -213,3 +229,3 @@ void AdvancedFm::localDelete() {
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 ?"
@@ -229,16 +245,15 @@ void AdvancedFm::localDelete() {
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 }
@@ -246,2 +261,3 @@ void AdvancedFm::localDelete() {
246 } 261 }
262 populateLocalView();
247} 263}
@@ -249,48 +265,64 @@ void AdvancedFm::localDelete() {
249void AdvancedFm::remoteDelete() { 265void 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}
@@ -411,8 +443,23 @@ void AdvancedFm::copy() {
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
@@ -428,15 +475,15 @@ void AdvancedFm::copy() {
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;
@@ -450,3 +497,2 @@ void AdvancedFm::copy() {
450 item= (*it); 497 item= (*it);
451
452 if(item.find("->",0,TRUE)) //symlink 498 if(item.find("->",0,TRUE)) //symlink
@@ -462,8 +508,5 @@ void AdvancedFm::copy() {
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:
@@ -472,2 +515,3 @@ void AdvancedFm::copy() {
472 }; 515 };
516 f.remove();
473 } 517 }
@@ -509,4 +553,4 @@ void AdvancedFm::copyAs() {
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) ) {
@@ -548,4 +592,4 @@ void AdvancedFm::copyAs() {
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) ) {
@@ -964 +1008,11 @@ void AdvancedFm::fileBeamFinished( Ir *) {
964} 1008}
1009
1010void 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}