author | llornkcor <llornkcor> | 2002-04-27 22:47:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-27 22:47:48 (UTC) |
commit | 8e3c0aa915801b862f97ba7a7598ef5f3bd350aa (patch) (unidiff) | |
tree | 6fed799512ebdcd4c78a56097c49d354de648690 | |
parent | 392596c06dedf8ddaea7c55745460e631073d15a (diff) | |
download | opie-8e3c0aa915801b862f97ba7a7598ef5f3bd350aa.zip opie-8e3c0aa915801b862f97ba7a7598ef5f3bd350aa.tar.gz opie-8e3c0aa915801b862f97ba7a7598ef5f3bd350aa.tar.bz2 |
fixed some bugs, added multi select, added symlink handling and keyboard shortcuts, but listview steals the event to move selection according to alpha. delete works
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 591 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 8 |
2 files changed, 393 insertions, 206 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 5f47b9b..bb932c5 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -141,52 +141,54 @@ AdvancedFm::AdvancedFm( ) | |||
141 | tabLayout = new QGridLayout( tab ); | 141 | tabLayout = new QGridLayout( tab ); |
142 | tabLayout->setSpacing( 2); | 142 | tabLayout->setSpacing( 2); |
143 | tabLayout->setMargin( 2); | 143 | tabLayout->setMargin( 2); |
144 | 144 | ||
145 | Local_View = new QListView( tab, "Local_View" ); | 145 | Local_View = new QListView( tab, "Local_View" ); |
146 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 146 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
147 | Local_View->addColumn( tr("File"),130); | 147 | Local_View->addColumn( tr("File"),130); |
148 | Local_View->addColumn( tr("Size"),-1); | 148 | Local_View->addColumn( tr("Size"),-1); |
149 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 149 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
150 | Local_View->addColumn( tr("Date"),-1); | 150 | Local_View->addColumn( tr("Date"),-1); |
151 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 151 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
152 | Local_View->setAllColumnsShowFocus(TRUE); | 152 | Local_View->setAllColumnsShowFocus(TRUE); |
153 | // Local_View->setMultiSelection( TRUE ); | 153 | Local_View->setMultiSelection( TRUE ); |
154 | // Local_View->setSelectionMode(QListView::Extended); | 154 | Local_View->setSelectionMode(QListView::Extended); |
155 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 155 | |
156 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | ||
156 | 157 | ||
157 | tabLayout->addWidget( Local_View, 0, 0 ); | 158 | tabLayout->addWidget( Local_View, 0, 0 ); |
158 | 159 | ||
159 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 160 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
160 | this,SLOT( localListClicked(QListViewItem *)) ); | 161 | this,SLOT( localListClicked(QListViewItem *)) ); |
161 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 162 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
162 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 163 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
163 | 164 | ||
164 | TabWidget->insertTab( tab, tr("1")); | 165 | TabWidget->insertTab( tab, tr("1")); |
165 | 166 | ||
166 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 167 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
167 | tabLayout_2 = new QGridLayout( tab_2 ); | 168 | tabLayout_2 = new QGridLayout( tab_2 ); |
168 | tabLayout_2->setSpacing( 2); | 169 | tabLayout_2->setSpacing( 2); |
169 | tabLayout_2->setMargin( 2); | 170 | tabLayout_2->setMargin( 2); |
170 | 171 | ||
171 | Remote_View = new QListView( tab_2, "Remote_View" ); | 172 | Remote_View = new QListView( tab_2, "Remote_View" ); |
172 | Remote_View->addColumn( tr("File"),130); | 173 | Remote_View->addColumn( tr("File"),130); |
173 | Remote_View->addColumn( tr("Size"),-1); | 174 | Remote_View->addColumn( tr("Size"),-1); |
174 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 175 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
175 | Remote_View->addColumn( tr("Date"),-1); | 176 | Remote_View->addColumn( tr("Date"),-1); |
176 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 177 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
177 | Remote_View->setAllColumnsShowFocus(TRUE); | 178 | Remote_View->setAllColumnsShowFocus(TRUE); |
178 | // Remote_View->setMultiSelection( TRUE ); | 179 | Remote_View->setMultiSelection( TRUE ); |
179 | // Remote_View->setSelectionMode(QListView::Extended); | 180 | Remote_View->setSelectionMode(QListView::Extended); |
180 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 181 | |
182 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | ||
181 | 183 | ||
182 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 184 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
183 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 185 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
184 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 186 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
185 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 187 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
186 | 188 | ||
187 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 189 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
188 | 190 | ||
189 | TabWidget->insertTab( tab_2, tr( "2")); | 191 | TabWidget->insertTab( tab_2, tr( "2")); |
190 | 192 | ||
191 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 193 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
192 | this,SLOT(tabChanged(QWidget*))); | 194 | this,SLOT(tabChanged(QWidget*))); |
@@ -360,24 +362,25 @@ void AdvancedFm::populateLocalView() | |||
360 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 362 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
361 | item->setPixmap( 0,pm); | 363 | item->setPixmap( 0,pm); |
362 | } | 364 | } |
363 | } | 365 | } |
364 | 366 | ||
365 | closedir(dir); | 367 | closedir(dir); |
366 | } | 368 | } |
367 | 369 | ||
368 | Local_View->setSorting( 3,FALSE); | 370 | Local_View->setSorting( 3,FALSE); |
369 | fillCombo( (const QString &) currentDir.canonicalPath()); | 371 | fillCombo( (const QString &) currentDir.canonicalPath()); |
370 | } | 372 | } |
371 | 373 | ||
374 | |||
372 | void AdvancedFm::populateRemoteView() | 375 | void AdvancedFm::populateRemoteView() |
373 | { | 376 | { |
374 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 377 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
375 | // QListViewItemIterator it( Remote_View ); | 378 | // QListViewItemIterator it( Remote_View ); |
376 | // for ( ; it.current(); ++it ) { | 379 | // for ( ; it.current(); ++it ) { |
377 | // if ( it.current()->isSelected() ) { | 380 | // if ( it.current()->isSelected() ) { |
378 | // QString strItem = it.current()->text(0); | 381 | // QString strItem = it.current()->text(0); |
379 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 382 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
380 | // QFileInfo fi(localFile); | 383 | // QFileInfo fi(localFile); |
381 | // } | 384 | // } |
382 | // } | 385 | // } |
383 | QPixmap pm; | 386 | QPixmap pm; |
@@ -555,35 +558,38 @@ void AdvancedFm::doLocalCd() | |||
555 | localListClicked( Local_View->currentItem()); | 558 | localListClicked( Local_View->currentItem()); |
556 | } | 559 | } |
557 | 560 | ||
558 | void AdvancedFm::doRemoteCd() | 561 | void AdvancedFm::doRemoteCd() |
559 | { | 562 | { |
560 | localListClicked( Remote_View->currentItem()); | 563 | localListClicked( Remote_View->currentItem()); |
561 | } | 564 | } |
562 | 565 | ||
563 | void AdvancedFm::showHidden() | 566 | void AdvancedFm::showHidden() |
564 | { | 567 | { |
565 | if (b) { | 568 | if (b) { |
566 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 569 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
570 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | ||
567 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 571 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
568 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 572 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
569 | b=TRUE; | 573 | b=FALSE; |
570 | 574 | ||
571 | } else { | 575 | } else { |
572 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 576 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
577 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | ||
573 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 578 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
574 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 579 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
575 | b=FALSE; | 580 | b=TRUE; |
576 | } | 581 | } |
577 | populateLocalView(); | 582 | populateLocalView(); |
583 | |||
578 | } | 584 | } |
579 | 585 | ||
580 | void AdvancedFm::showRemoteHidden() | 586 | void AdvancedFm::showRemoteHidden() |
581 | { | 587 | { |
582 | if (b) { | 588 | if (b) { |
583 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 589 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
584 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 590 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
585 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 591 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
586 | b=TRUE; | 592 | b=TRUE; |
587 | 593 | ||
588 | } else { | 594 | } else { |
589 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 595 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
@@ -612,84 +618,88 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint | |||
612 | case 1: | 618 | case 1: |
613 | break; | 619 | break; |
614 | case 2: | 620 | case 2: |
615 | showRemoteMenu(item); | 621 | showRemoteMenu(item); |
616 | Remote_View->clearSelection(); | 622 | Remote_View->clearSelection(); |
617 | break; | 623 | break; |
618 | }; | 624 | }; |
619 | } | 625 | } |
620 | 626 | ||
621 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 627 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
622 | { | 628 | { |
623 | if(item) { | 629 | if(item) { |
624 | QPopupMenu m; | 630 | QPopupMenu m; |
625 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 631 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
626 | m.insertSeparator(); | 632 | m.insertSeparator(); |
627 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 633 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
628 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 634 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
629 | else | 635 | else |
630 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 636 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
631 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 637 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
632 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 638 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
633 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 639 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
634 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 640 | m.insertSeparator(); |
635 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 641 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
636 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 642 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
637 | m.insertSeparator(); | 643 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
638 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 644 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
639 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 645 | m.insertSeparator(); |
640 | m.insertSeparator(); | 646 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
641 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 647 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
642 | m.insertSeparator(); | 648 | m.insertSeparator(); |
643 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 649 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
644 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 650 | m.insertSeparator(); |
645 | m.setCheckable(TRUE); | 651 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
646 | if (!b) | 652 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
647 | m.setItemChecked(m.idAt(0),TRUE); | 653 | m.setCheckable(TRUE); |
648 | else | 654 | if (!b) |
649 | m.setItemChecked(m.idAt(0),FALSE); | 655 | m.setItemChecked(m.idAt(0),TRUE); |
650 | m.exec( QCursor::pos() ); | 656 | else |
657 | m.setItemChecked(m.idAt(0),FALSE); | ||
658 | m.exec( QCursor::pos() ); | ||
651 | } | 659 | } |
652 | } | 660 | } |
653 | 661 | ||
654 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 662 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
655 | { | 663 | { |
656 | if(item) { | 664 | if(item) { |
657 | QPopupMenu m; | 665 | QPopupMenu m; |
658 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 666 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
659 | m.insertSeparator(); | 667 | m.insertSeparator(); |
660 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 668 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
661 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 669 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
662 | else | 670 | else |
663 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 671 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
664 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 672 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
665 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 673 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
666 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 674 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
667 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 675 | m.insertSeparator(); |
668 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 676 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
669 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 677 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
670 | m.insertSeparator(); | 678 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
671 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 679 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
672 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 680 | m.insertSeparator(); |
673 | m.insertSeparator(); | 681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
674 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
675 | m.insertSeparator(); | 683 | m.insertSeparator(); |
676 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 684 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
677 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 685 | m.insertSeparator(); |
678 | m.setCheckable(TRUE); | 686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
679 | if (!b) | 687 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
680 | m.setItemChecked(m.idAt(0),TRUE); | 688 | m.setCheckable(TRUE); |
681 | else | 689 | if (!b) |
682 | m.setItemChecked(m.idAt(0),FALSE); | 690 | m.setItemChecked(m.idAt(0),TRUE); |
683 | m.exec( QCursor::pos() ); | 691 | else |
692 | m.setItemChecked(m.idAt(0),FALSE); | ||
693 | m.exec( QCursor::pos() ); | ||
684 | } | 694 | } |
685 | } | 695 | } |
686 | 696 | ||
687 | void AdvancedFm::runThis() { | 697 | void AdvancedFm::runThis() { |
688 | // QFileInfo *fi; | 698 | // QFileInfo *fi; |
689 | if (TabWidget->currentPageIndex() == 0) { | 699 | if (TabWidget->currentPageIndex() == 0) { |
690 | QString curFile = Local_View->currentItem()->text(0); | 700 | QString curFile = Local_View->currentItem()->text(0); |
691 | curFile = currentDir.canonicalPath()+"/"+curFile; | 701 | curFile = currentDir.canonicalPath()+"/"+curFile; |
692 | DocLnk nf(curFile); | 702 | DocLnk nf(curFile); |
693 | QString execStr = nf.exec(); | 703 | QString execStr = nf.exec(); |
694 | qDebug( execStr); | 704 | qDebug( execStr); |
695 | if( execStr.isEmpty() ) { | 705 | if( execStr.isEmpty() ) { |
@@ -743,89 +753,106 @@ void AdvancedFm::remoteMakDir() | |||
743 | InputDialog *fileDlg; | 753 | InputDialog *fileDlg; |
744 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 754 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
745 | fileDlg->exec(); | 755 | fileDlg->exec(); |
746 | if( fileDlg->result() == 1 ) { | 756 | if( fileDlg->result() == 1 ) { |
747 | QString filename = fileDlg->LineEdit1->text(); | 757 | QString filename = fileDlg->LineEdit1->text(); |
748 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 758 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
749 | } | 759 | } |
750 | populateRemoteView(); | 760 | populateRemoteView(); |
751 | } | 761 | } |
752 | 762 | ||
753 | void AdvancedFm::localDelete() | 763 | void AdvancedFm::localDelete() |
754 | { | 764 | { |
755 | QString f = Local_View->currentItem()->text(0); | 765 | QStringList curFileList = getPath(); |
756 | if(QDir(f).exists() ) { | 766 | QString myFile; |
757 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 767 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
758 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 768 | myFile = (*it); |
759 | case 0: { | 769 | if( myFile.find(" -> ",0,TRUE) != -1) |
760 | f=currentDir.canonicalPath()+"/"+f; | 770 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
761 | QString cmd="rmdir "+f; | 771 | |
762 | system( cmd.latin1()); | 772 | QString f = currentDir.canonicalPath()+"/"+myFile; |
763 | populateLocalView(); | 773 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
764 | } | 774 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+" ?" |
765 | break; | 775 | ,tr("Yes"),tr("No"),0,0,1) ) { |
766 | case 1: | 776 | case 0: { |
767 | // exit | 777 | QString cmd="rmdir -rf "+f; |
768 | break; | 778 | system( cmd.latin1()); |
769 | }; | 779 | populateLocalView(); |
780 | } | ||
781 | break; | ||
782 | case 1: | ||
783 | // exit | ||
784 | break; | ||
785 | }; | ||
770 | 786 | ||
771 | } else { | 787 | } else { |
772 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 788 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
773 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 789 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
774 | case 0: { | 790 | case 0: { |
775 | f=currentDir.canonicalPath()+"/"+f; | 791 | QString cmd="rm "+f; |
776 | QString cmd="rm "+f; | 792 | QFile file(f); |
777 | system( cmd.latin1()); | 793 | file.remove(); |
778 | populateLocalView(); | 794 | // system( cmd.latin1()); |
779 | } | 795 | populateLocalView(); |
780 | break; | 796 | } |
781 | case 1: | 797 | break; |
782 | // exit | 798 | case 1: |
783 | break; | 799 | // exit |
784 | }; | 800 | break; |
801 | }; | ||
802 | } | ||
803 | |||
785 | } | 804 | } |
786 | } | 805 | } |
787 | 806 | ||
788 | void AdvancedFm::remoteDelete() | 807 | void AdvancedFm::remoteDelete() |
789 | { | 808 | { |
790 | QString f = Remote_View->currentItem()->text(0); | 809 | QStringList curFileList = getPath(); |
791 | if(QDir(f).exists() ) { | 810 | QString myFile; |
792 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 811 | |
793 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 812 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
794 | case 0: { | 813 | myFile = (*it); |
795 | f = currentRemoteDir.canonicalPath()+"/"+f; | 814 | if(myFile.find(" -> ",0,TRUE) != -1) |
796 | QString cmd="rmdir "+f; | 815 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
797 | system( cmd.latin1()); | 816 | QString f = currentRemoteDir.canonicalPath()+"/"+myFile; |
798 | populateRemoteView(); | 817 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
799 | } | 818 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+" ?", |
800 | break; | 819 | tr("Yes"),tr("No"),0,0,1) ) { |
801 | case 1: | 820 | case 0: { |
802 | // exit | 821 | QString cmd="rmdir -rf "+f; |
803 | break; | 822 | system( cmd.latin1()); |
804 | }; | 823 | populateRemoteView(); |
824 | } | ||
825 | break; | ||
826 | case 1: | ||
827 | // exit | ||
828 | break; | ||
829 | }; | ||
805 | 830 | ||
806 | } else { | 831 | } else { |
807 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 832 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
808 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 833 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
809 | case 0: { | 834 | case 0: { |
810 | f = currentRemoteDir.canonicalPath()+"/"+f; | 835 | QString cmd="rm "+f; |
811 | QString cmd="rm "+f; | 836 | QFile file(f); |
812 | system( cmd.latin1()); | 837 | file.remove(); |
813 | populateRemoteView(); | 838 | // system( cmd.latin1()); |
814 | } | 839 | populateRemoteView(); |
815 | break; | 840 | } |
816 | case 1: | 841 | break; |
817 | // exit | 842 | case 1: |
818 | break; | 843 | // exit |
819 | }; | 844 | break; |
845 | }; | ||
846 | } | ||
820 | } | 847 | } |
821 | } | 848 | } |
822 | 849 | ||
823 | void AdvancedFm::localRename() | 850 | void AdvancedFm::localRename() |
824 | { | 851 | { |
825 | QString curFile = Local_View->currentItem()->text(0); | 852 | QString curFile = Local_View->currentItem()->text(0); |
826 | InputDialog *fileDlg; | 853 | InputDialog *fileDlg; |
827 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 854 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
828 | fileDlg->setInputText((const QString &)curFile); | 855 | fileDlg->setInputText((const QString &)curFile); |
829 | fileDlg->exec(); | 856 | fileDlg->exec(); |
830 | if( fileDlg->result() == 1 ) { | 857 | if( fileDlg->result() == 1 ) { |
831 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 858 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
@@ -846,29 +873,31 @@ void AdvancedFm::remoteRename() | |||
846 | if( fileDlg->result() == 1 ) { | 873 | if( fileDlg->result() == 1 ) { |
847 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 874 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
848 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 875 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
849 | if( rename(oldname.latin1(), newName.latin1())== -1) | 876 | if( rename(oldname.latin1(), newName.latin1())== -1) |
850 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 877 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
851 | } | 878 | } |
852 | populateRemoteView(); | 879 | populateRemoteView(); |
853 | } | 880 | } |
854 | 881 | ||
855 | void AdvancedFm::switchToLocalTab() | 882 | void AdvancedFm::switchToLocalTab() |
856 | { | 883 | { |
857 | TabWidget->setCurrentPage(0); | 884 | TabWidget->setCurrentPage(0); |
885 | Local_View->setFocus(); | ||
858 | } | 886 | } |
859 | 887 | ||
860 | void AdvancedFm::switchToRemoteTab() | 888 | void AdvancedFm::switchToRemoteTab() |
861 | { | 889 | { |
862 | TabWidget->setCurrentPage(1); | 890 | TabWidget->setCurrentPage(1); |
891 | Remote_View->setFocus(); | ||
863 | } | 892 | } |
864 | 893 | ||
865 | void AdvancedFm::readConfig() | 894 | void AdvancedFm::readConfig() |
866 | { | 895 | { |
867 | Config cfg("AdvancedFm"); | 896 | Config cfg("AdvancedFm"); |
868 | } | 897 | } |
869 | 898 | ||
870 | void AdvancedFm::writeConfig() | 899 | void AdvancedFm::writeConfig() |
871 | { | 900 | { |
872 | Config cfg("AdvancedFm"); | 901 | Config cfg("AdvancedFm"); |
873 | } | 902 | } |
874 | 903 | ||
@@ -917,48 +946,83 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | |||
917 | currentDir.cd( currentPath, TRUE); | 946 | currentDir.cd( currentPath, TRUE); |
918 | populateLocalView(); | 947 | populateLocalView(); |
919 | update(); | 948 | update(); |
920 | } else { | 949 | } else { |
921 | chdir( currentPath.latin1() ); | 950 | chdir( currentPath.latin1() ); |
922 | currentRemoteDir.cd( currentPath, TRUE); | 951 | currentRemoteDir.cd( currentPath, TRUE); |
923 | populateRemoteView(); | 952 | populateRemoteView(); |
924 | update(); | 953 | update(); |
925 | } | 954 | } |
926 | } | 955 | } |
927 | 956 | ||
928 | void AdvancedFm::filePerms() { | 957 | void AdvancedFm::filePerms() { |
929 | QString curFile = getPath(); | 958 | |
930 | filePermissions *filePerm; | 959 | QStringList curFileList = getPath(); |
931 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); | 960 | QString filePath; |
932 | filePerm->showMaximized(); | 961 | |
933 | filePerm->exec(); | 962 | if (TabWidget->currentPageIndex() == 0) { |
934 | if( filePerm) | 963 | filePath = currentDir.canonicalPath()+"/"; |
935 | delete filePerm; | 964 | } else { |
965 | filePath= currentRemoteDir.canonicalPath()+"/"; | ||
966 | } | ||
967 | |||
968 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | ||
969 | filePermissions *filePerm; | ||
970 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | ||
971 | filePerm->showMaximized(); | ||
972 | filePerm->exec(); | ||
973 | if( filePerm) | ||
974 | delete filePerm; | ||
975 | } | ||
936 | } | 976 | } |
937 | 977 | ||
938 | void AdvancedFm::doProperties() { | 978 | void AdvancedFm::doProperties() { |
939 | 979 | QStringList curFileList = getPath(); | |
940 | DocLnk lnk( getPath()); | 980 | QString filePath; |
941 | LnkProperties prop( &lnk ); | 981 | if (TabWidget->currentPageIndex() == 0) { |
982 | filePath = currentDir.canonicalPath()+"/"; | ||
983 | } else { | ||
984 | filePath= currentRemoteDir.canonicalPath()+"/"; | ||
985 | } | ||
986 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | ||
987 | DocLnk lnk( (filePath+*it)); | ||
988 | LnkProperties prop( &lnk ); | ||
942 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 989 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
943 | prop.showMaximized(); | 990 | prop.showMaximized(); |
944 | prop.exec(); | 991 | prop.exec(); |
992 | } | ||
945 | } | 993 | } |
946 | 994 | ||
947 | QString AdvancedFm::getPath() { | 995 | QStringList AdvancedFm::getPath() { |
996 | QStringList strList; | ||
948 | if (TabWidget->currentPageIndex() == 0) { | 997 | if (TabWidget->currentPageIndex() == 0) { |
949 | return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); | 998 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
999 | QListViewItemIterator it( Local_View ); | ||
1000 | for ( ; it.current(); ++it ) { | ||
1001 | if ( it.current()->isSelected() ) { | ||
1002 | strList << it.current()->text(0); | ||
1003 | } | ||
1004 | } | ||
1005 | return strList; | ||
950 | } else { | 1006 | } else { |
951 | return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 1007 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1008 | QListViewItemIterator it( Remote_View ); | ||
1009 | for ( ; it.current(); ++it ) { | ||
1010 | if ( it.current()->isSelected() ) { | ||
1011 | strList << currentDir.canonicalPath()+"/"+ it.current()->text(0); | ||
1012 | } | ||
1013 | } | ||
1014 | return strList; | ||
952 | } | 1015 | } |
1016 | return ""; | ||
953 | } | 1017 | } |
954 | 1018 | ||
955 | void AdvancedFm::homeButtonPushed() { | 1019 | void AdvancedFm::homeButtonPushed() { |
956 | QString current = QDir::homeDirPath(); | 1020 | QString current = QDir::homeDirPath(); |
957 | chdir( current.latin1() ); | 1021 | chdir( current.latin1() ); |
958 | if (TabWidget->currentPageIndex() == 0) { | 1022 | if (TabWidget->currentPageIndex() == 0) { |
959 | currentDir.cd( current, TRUE); | 1023 | currentDir.cd( current, TRUE); |
960 | populateLocalView(); | 1024 | populateLocalView(); |
961 | } else { | 1025 | } else { |
962 | currentRemoteDir.cd( current, TRUE); | 1026 | currentRemoteDir.cd( current, TRUE); |
963 | populateRemoteView(); | 1027 | populateRemoteView(); |
964 | } | 1028 | } |
@@ -1023,124 +1087,155 @@ void AdvancedFm::upDir() | |||
1023 | QDir dir(current); | 1087 | QDir dir(current); |
1024 | dir.cdUp(); | 1088 | dir.cdUp(); |
1025 | current = dir.canonicalPath(); | 1089 | current = dir.canonicalPath(); |
1026 | chdir( current.latin1() ); | 1090 | chdir( current.latin1() ); |
1027 | currentRemoteDir.cd( current, TRUE); | 1091 | currentRemoteDir.cd( current, TRUE); |
1028 | populateRemoteView(); | 1092 | populateRemoteView(); |
1029 | update(); | 1093 | update(); |
1030 | } | 1094 | } |
1031 | } | 1095 | } |
1032 | 1096 | ||
1033 | void AdvancedFm::copy() | 1097 | void AdvancedFm::copy() |
1034 | { | 1098 | { |
1035 | QString curFile = getPath(); | 1099 | QStringList curFileList = getPath(); |
1100 | QString curFile; | ||
1036 | if (TabWidget->currentPageIndex() == 0) { | 1101 | if (TabWidget->currentPageIndex() == 0) { |
1037 | QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); | 1102 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1038 | QFile f(destFile); | 1103 | |
1039 | if( f.exists()) | 1104 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1040 | f.remove(); | 1105 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1041 | if(!copyFile(destFile, curFile) ) | 1106 | QFile f(destFile); |
1042 | qWarning("nothin doing"); | 1107 | if( f.exists()) |
1108 | f.remove(); | ||
1109 | if(!copyFile(destFile, curFile) ) | ||
1110 | qWarning("nothin doing"); | ||
1111 | } | ||
1043 | populateRemoteView(); | 1112 | populateRemoteView(); |
1044 | TabWidget->setCurrentPage(1); | 1113 | TabWidget->setCurrentPage(1); |
1114 | |||
1045 | } else { | 1115 | } else { |
1046 | QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); | 1116 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1047 | QFile f(destFile); | 1117 | |
1048 | if( f.exists()) | 1118 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1049 | f.remove(); | 1119 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1050 | if(!copyFile(destFile, curFile) ) | 1120 | QFile f(destFile); |
1051 | qWarning("nothin doing"); | 1121 | if( f.exists()) |
1122 | f.remove(); | ||
1123 | if(!copyFile(destFile, curFile) ) | ||
1124 | qWarning("nothin doing"); | ||
1125 | } | ||
1052 | populateLocalView(); | 1126 | populateLocalView(); |
1053 | TabWidget->setCurrentPage(0); | 1127 | TabWidget->setCurrentPage(0); |
1054 | } | 1128 | } |
1055 | } | 1129 | } |
1056 | 1130 | ||
1057 | void AdvancedFm::copyAs() | 1131 | void AdvancedFm::copyAs() |
1058 | { | 1132 | { |
1059 | QString curFile = getPath(); | 1133 | QStringList curFileList = getPath(); |
1134 | QString curFile; | ||
1135 | InputDialog *fileDlg; | ||
1136 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | ||
1137 | |||
1060 | if (TabWidget->currentPageIndex() == 0) { | 1138 | if (TabWidget->currentPageIndex() == 0) { |
1061 | QString destFile = Local_View->currentItem()->text(0); | 1139 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1062 | InputDialog *fileDlg; | 1140 | QString destFile = *it; |
1063 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1141 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1064 | fileDlg->setInputText((const QString &) destFile ); | 1142 | // InputDialog *fileDlg; |
1065 | fileDlg->exec(); | 1143 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1066 | if( fileDlg->result() == 1 ) { | 1144 | fileDlg->setInputText((const QString &) destFile ); |
1067 | QString filename = fileDlg->LineEdit1->text(); | 1145 | fileDlg->exec(); |
1068 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; | 1146 | if( fileDlg->result() == 1 ) { |
1069 | 1147 | QString filename = fileDlg->LineEdit1->text(); | |
1070 | QFile f(destFile); | 1148 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; |
1071 | if( f.exists()) | 1149 | |
1072 | f.remove(); | 1150 | QFile f(destFile); |
1073 | if(!copyFile(destFile, curFile) ) | 1151 | if( f.exists()) |
1074 | qWarning("nothin doing"); | 1152 | f.remove(); |
1153 | if(!copyFile(destFile, curFile) ) | ||
1154 | qWarning("nothin doing"); | ||
1155 | } | ||
1075 | } | 1156 | } |
1157 | |||
1076 | populateRemoteView(); | 1158 | populateRemoteView(); |
1077 | TabWidget->setCurrentPage(1); | 1159 | TabWidget->setCurrentPage(1); |
1078 | } else { | 1160 | } else { |
1079 | QString destFile = Remote_View->currentItem()->text(0); | 1161 | if (TabWidget->currentPageIndex() == 0) { |
1080 | InputDialog *fileDlg; | 1162 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1081 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1163 | |
1082 | fileDlg->setInputText((const QString &) destFile); | 1164 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1083 | fileDlg->exec(); | 1165 | QString destFile = *it; |
1084 | if( fileDlg->result() == 1 ) { | 1166 | fileDlg->setInputText((const QString &) destFile); |
1085 | QString filename = fileDlg->LineEdit1->text(); | 1167 | fileDlg->exec(); |
1086 | destFile = currentDir.canonicalPath()+"/"+destFile; | 1168 | if( fileDlg->result() == 1 ) { |
1087 | 1169 | QString filename = fileDlg->LineEdit1->text(); | |
1088 | QFile f(destFile); | 1170 | destFile = currentDir.canonicalPath()+"/"+destFile; |
1089 | if( f.exists()) | 1171 | |
1090 | f.remove(); | 1172 | QFile f(destFile); |
1091 | if(!copyFile(destFile, curFile) ) | 1173 | if( f.exists()) |
1092 | qWarning("nothin doing"); | 1174 | f.remove(); |
1175 | if(!copyFile(destFile, curFile) ) | ||
1176 | qWarning("nothin doing"); | ||
1177 | } | ||
1178 | } | ||
1179 | populateLocalView(); | ||
1180 | TabWidget->setCurrentPage(0); | ||
1093 | } | 1181 | } |
1094 | populateLocalView(); | ||
1095 | TabWidget->setCurrentPage(0); | ||
1096 | } | 1182 | } |
1097 | } | 1183 | } |
1098 | 1184 | ||
1099 | void AdvancedFm::move() { | 1185 | void AdvancedFm::move() { |
1100 | QString curFile = getPath(); | 1186 | |
1187 | QStringList curFileList = getPath(); | ||
1188 | QString curFile; | ||
1101 | // qDebug(curFile); | 1189 | // qDebug(curFile); |
1102 | QString destFile; | 1190 | QString destFile; |
1191 | |||
1103 | if (TabWidget->currentPageIndex() == 0) { | 1192 | if (TabWidget->currentPageIndex() == 0) { |
1104 | QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); | 1193 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1105 | qDebug("Destination file is "+destFile); | 1194 | QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; |
1106 | 1195 | curFile = currentDir.canonicalPath()+"/"+(*it); | |
1107 | QFile f(destFile); | 1196 | qDebug("Destination file is "+destFile); |
1108 | if( f.exists()) | 1197 | |
1109 | f.remove(); | 1198 | QFile f(destFile); |
1110 | if(!copyFile( destFile, curFile) ) { | 1199 | if( f.exists()) |
1111 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1200 | f.remove(); |
1112 | return; | 1201 | if(!copyFile( destFile, curFile) ) { |
1202 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | ||
1203 | return; | ||
1204 | } | ||
1205 | QFile::remove(curFile); | ||
1113 | } | 1206 | } |
1114 | QFile::remove(curFile); | ||
1115 | TabWidget->setCurrentPage(1); | 1207 | TabWidget->setCurrentPage(1); |
1116 | } else { | 1208 | } else { |
1117 | QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); | 1209 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1118 | qDebug("Destination file is "+destFile); | 1210 | QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; |
1119 | 1211 | qDebug("Destination file is "+destFile); | |
1120 | QFile f(destFile); | 1212 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1121 | if( f.exists()) | 1213 | |
1122 | f.remove(); | 1214 | QFile f(destFile); |
1123 | if(!copyFile(destFile, curFile) ) { | 1215 | if( f.exists()) |
1124 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1216 | f.remove(); |
1125 | return; | 1217 | if(!copyFile(destFile, curFile) ) { |
1218 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | ||
1219 | return; | ||
1220 | } | ||
1221 | QFile::remove(curFile); | ||
1222 | TabWidget->setCurrentPage(0); | ||
1126 | } | 1223 | } |
1127 | QFile::remove(curFile); | ||
1128 | TabWidget->setCurrentPage(0); | ||
1129 | } | 1224 | } |
1130 | populateRemoteView(); | 1225 | populateRemoteView(); |
1131 | populateLocalView(); | 1226 | populateLocalView(); |
1132 | } | 1227 | } |
1133 | 1228 | ||
1134 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1229 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1135 | { | 1230 | { |
1136 | char bf[ 50000 ]; | 1231 | char bf[ 50000 ]; |
1137 | int bytesRead; | 1232 | int bytesRead; |
1138 | bool success = TRUE; | 1233 | bool success = TRUE; |
1139 | struct stat status; | 1234 | struct stat status; |
1140 | 1235 | ||
1141 | QFile s( src ); | 1236 | QFile s( src ); |
1142 | QFile d( dest ); | 1237 | QFile d( dest ); |
1143 | 1238 | ||
1144 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1239 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1145 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1240 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1146 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1241 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
@@ -1284,12 +1379,102 @@ void AdvancedFm::del() { | |||
1284 | if (TabWidget->currentPageIndex() == 0) | 1379 | if (TabWidget->currentPageIndex() == 0) |
1285 | localDelete(); | 1380 | localDelete(); |
1286 | else | 1381 | else |
1287 | remoteDelete(); | 1382 | remoteDelete(); |
1288 | } | 1383 | } |
1289 | 1384 | ||
1290 | void AdvancedFm::doAbout() { | 1385 | void AdvancedFm::doAbout() { |
1291 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | 1386 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" |
1292 | "is copyright 2002 by\n" | 1387 | "is copyright 2002 by\n" |
1293 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1388 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1294 | "and is licensed by the GPL"); | 1389 | "and is licensed by the GPL"); |
1295 | } | 1390 | } |
1391 | |||
1392 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | ||
1393 | { | ||
1394 | switch ( e->key() ) { | ||
1395 | case Key_Delete: | ||
1396 | del(); | ||
1397 | break; | ||
1398 | case Key_H: | ||
1399 | showHidden(); | ||
1400 | break; | ||
1401 | case Key_E: | ||
1402 | runThis(); | ||
1403 | break; | ||
1404 | case Key_C: | ||
1405 | copy(); | ||
1406 | break; | ||
1407 | case Key_A: | ||
1408 | copyAs(); | ||
1409 | break; | ||
1410 | case Key_M: | ||
1411 | move(); | ||
1412 | break; | ||
1413 | case Key_R: | ||
1414 | rn(); | ||
1415 | break; | ||
1416 | case Key_I: | ||
1417 | fileStatus(); | ||
1418 | break; | ||
1419 | case Key_U: | ||
1420 | upDir(); | ||
1421 | break; | ||
1422 | case Key_P: | ||
1423 | filePerms(); | ||
1424 | break; | ||
1425 | case Key_N: | ||
1426 | mkDir(); | ||
1427 | break; | ||
1428 | case Key_1: | ||
1429 | switchToLocalTab(); | ||
1430 | break; | ||
1431 | case Key_2: | ||
1432 | switchToRemoteTab(); | ||
1433 | break; | ||
1434 | case Key_3: | ||
1435 | CFButtonPushed(); | ||
1436 | break; | ||
1437 | case Key_4: | ||
1438 | SDButtonPushed(); | ||
1439 | break; | ||
1440 | case Key_5: | ||
1441 | homeButtonPushed(); | ||
1442 | break; | ||
1443 | case Key_6: | ||
1444 | docButtonPushed(); | ||
1445 | break; | ||
1446 | case Key_7: | ||
1447 | break; | ||
1448 | case Key_8: | ||
1449 | break; | ||
1450 | case Key_9: | ||
1451 | break; | ||
1452 | case Key_0: | ||
1453 | break; | ||
1454 | |||
1455 | |||
1456 | |||
1457 | } | ||
1458 | |||
1459 | } | ||
1460 | |||
1461 | void AdvancedFm::mkSym() { | ||
1462 | QString cmd; | ||
1463 | if (TabWidget->currentPageIndex() == 0) { | ||
1464 | QString curFile = Local_View->currentItem()->text(0); | ||
1465 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | ||
1466 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; | ||
1467 | curFile = currentDir.canonicalPath()+"/"+curFile; | ||
1468 | cmd = "ln -s "+curFile+" "+destName; | ||
1469 | system(cmd.latin1() ); | ||
1470 | populateRemoteView(); | ||
1471 | } else { | ||
1472 | QString curFile = Remote_View->currentItem()->text(0); | ||
1473 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | ||
1474 | QString destName = currentDir.canonicalPath()+"/"+curFile; | ||
1475 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | ||
1476 | cmd = "ln -s "+curFile+" "+destName; | ||
1477 | system(cmd.latin1() ); | ||
1478 | populateLocalView(); | ||
1479 | } | ||
1480 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index a5f26a7..c00713f 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -9,24 +9,25 @@ | |||
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | #include <qstringlist.h> | ||
21 | 22 | ||
22 | class QVBoxLayout; | 23 | class QVBoxLayout; |
23 | class QHBoxLayout; | 24 | class QHBoxLayout; |
24 | class QGridLayout; | 25 | class QGridLayout; |
25 | class QComboBox; | 26 | class QComboBox; |
26 | class QListView; | 27 | class QListView; |
27 | class QListviewItem; | 28 | class QListviewItem; |
28 | class QLabel; | 29 | class QLabel; |
29 | class QProgressBar; | 30 | class QProgressBar; |
30 | class QSpinBox; | 31 | class QSpinBox; |
31 | class QTabWidget; | 32 | class QTabWidget; |
32 | class QWidget; | 33 | class QWidget; |
@@ -84,32 +85,33 @@ protected slots: | |||
84 | /* bool remoteDirList(const QString &); */ | 85 | /* bool remoteDirList(const QString &); */ |
85 | /* bool remoteChDir(const QString &); */ | 86 | /* bool remoteChDir(const QString &); */ |
86 | void tabChanged(QWidget*); | 87 | void tabChanged(QWidget*); |
87 | void cleanUp(); | 88 | void cleanUp(); |
88 | void remoteRename(); | 89 | void remoteRename(); |
89 | void localRename(); | 90 | void localRename(); |
90 | void runThis(); | 91 | void runThis(); |
91 | void runText(); | 92 | void runText(); |
92 | void filePerms(); | 93 | void filePerms(); |
93 | void doProperties(); | 94 | void doProperties(); |
94 | void runCommand(); | 95 | void runCommand(); |
95 | void runCommandStd(); | 96 | void runCommandStd(); |
96 | QString getPath(); | 97 | QStringList getPath(); |
98 | void mkSym(); | ||
97 | void switchToLocalTab(); | 99 | void switchToLocalTab(); |
98 | void switchToRemoteTab(); | 100 | void switchToRemoteTab(); |
99 | 101 | ||
100 | protected: | 102 | protected: |
101 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 103 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
102 | QStringList remoteDirPathStringList, localDirPathStringList; | 104 | QStringList remoteDirPathStringList, localDirPathStringList; |
103 | 105 | void keyReleaseEvent( QKeyEvent *); | |
104 | protected slots: | 106 | protected slots: |
105 | void homeButtonPushed(); | 107 | void homeButtonPushed(); |
106 | void docButtonPushed(); | 108 | void docButtonPushed(); |
107 | void SDButtonPushed(); | 109 | void SDButtonPushed(); |
108 | void CFButtonPushed(); | 110 | void CFButtonPushed(); |
109 | void upDir(); | 111 | void upDir(); |
110 | void currentPathComboChanged(); | 112 | void currentPathComboChanged(); |
111 | void copy(); | 113 | void copy(); |
112 | void copyAs(); | 114 | void copyAs(); |
113 | void currentPathComboActivated(const QString &); | 115 | void currentPathComboActivated(const QString &); |
114 | void fillCombo(const QString &); | 116 | void fillCombo(const QString &); |
115 | bool copyFile( const QString & , const QString & ); | 117 | bool copyFile( const QString & , const QString & ); |