summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp31
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 4 insertions, 28 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 3bfec7d..3cd2067 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -313,65 +313,65 @@ void AdvancedFm::fillCombo(const QString &currentPath) {
313 } 313 }
314 } else { 314 } else {
315 currentPathCombo->lineEdit()->setText( currentPath); 315 currentPathCombo->lineEdit()->setText( currentPath);
316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
317 currentPathCombo->clear(); 317 currentPathCombo->clear();
318 remoteDirPathStringList.prepend( currentPath ); 318 remoteDirPathStringList.prepend( currentPath );
319 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 319 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
320 } 320 }
321 } 321 }
322} 322}
323 323
324void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 324void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
325 chdir( currentPath.latin1() ); 325 chdir( currentPath.latin1() );
326 CurrentDir()->cd( currentPath, TRUE); 326 CurrentDir()->cd( currentPath, TRUE);
327 populateView(); 327 populateView();
328 update(); 328 update();
329} 329}
330 330
331QStringList AdvancedFm::getPath() { 331QStringList AdvancedFm::getPath() {
332 QStringList strList; 332 QStringList strList;
333 QListView *thisView=CurrentView(); 333 QListView *thisView=CurrentView();
334 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 334 QList<QListViewItem> * getSelectedItems( QListView * thisView );
335 QListViewItemIterator it( thisView ); 335 QListViewItemIterator it( thisView );
336 for ( ; it.current(); ++it ) { 336 for ( ; it.current(); ++it ) {
337 if ( it.current()->isSelected() ) { 337 if ( it.current()->isSelected() ) {
338 strList << it.current()->text(0); 338 strList << it.current()->text(0);
339// odebug << it.current()->text(0) << oendl; 339// odebug << it.current()->text(0) << oendl;
340 } 340 }
341 } 341 }
342 return strList; 342 return strList;
343} 343}
344 344
345void AdvancedFm::changeTo(QString dir) { 345void AdvancedFm::changeTo(const QString dir) {
346 chdir( dir.latin1()); 346 chdir( dir.latin1());
347 CurrentDir()->cd(dir, TRUE); 347 CurrentDir()->cd(dir, TRUE);
348 populateView(); 348 populateView();
349 update(); 349 update();
350} 350}
351 351
352void AdvancedFm::homeButtonPushed() { 352void AdvancedFm::homeButtonPushed() {
353 changeTo(QDir::homeDirPath()); 353 changeTo(QDir::homeDirPath());
354} 354}
355 355
356void AdvancedFm::docButtonPushed() { 356void AdvancedFm::docButtonPushed() {
357 changeTo(QPEApplication::documentDir()); 357 changeTo(QPEApplication::documentDir());
358} 358}
359 359
360void AdvancedFm::SDButtonPushed() { 360void AdvancedFm::SDButtonPushed() {
361 changeTo("/mnt/card");// this can change so fix 361 changeTo("/mnt/card");// this can change so fix
362} 362}
363 363
364void AdvancedFm::CFButtonPushed() { 364void AdvancedFm::CFButtonPushed() {
365 if(zaurusDevice) 365 if(zaurusDevice)
366 changeTo("/mnt/cf"); //zaurus 366 changeTo("/mnt/cf"); //zaurus
367 else 367 else
368 changeTo("/mnt/hda"); //ipaq 368 changeTo("/mnt/hda"); //ipaq
369} 369}
370 370
371void AdvancedFm::QPEButtonPushed() { 371void AdvancedFm::QPEButtonPushed() {
372 changeTo(QPEApplication::qpeDir()); 372 changeTo(QPEApplication::qpeDir());
373} 373}
374 374
375void AdvancedFm::doAbout() { 375void AdvancedFm::doAbout() {
376 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 376 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
377} 377}
@@ -670,65 +670,65 @@ void AdvancedFm::removeCustomDir() {
670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
671 if((*it) != dir) { 671 if((*it) != dir) {
672//current item is not our current dir, so add it to temp list 672//current item is not our current dir, so add it to temp list
673 list2 <<(*it); 673 list2 <<(*it);
674 } else { 674 } else {
675// customDirMenu->removeItem( ramble); 675// customDirMenu->removeItem( ramble);
676 menuButton->remove( ramble); 676 menuButton->remove( ramble);
677 677
678 } 678 }
679 ramble++; 679 ramble++;
680// ramble--; 680// ramble--;
681 } 681 }
682 682
683 cfg.writeEntry("CustomDir", list2, ','); 683 cfg.writeEntry("CustomDir", list2, ',');
684 cfg.write(); 684 cfg.write();
685 } 685 }
686// customDirsToMenu(); 686// customDirsToMenu();
687 687
688} 688}
689 689
690void AdvancedFm::gotoCustomDir(const QString &dir) { 690void AdvancedFm::gotoCustomDir(const QString &dir) {
691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; 691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
692// QString curDir = dir; 692// QString curDir = dir;
693// QDir *thisDir = CurrentDir(); 693// QDir *thisDir = CurrentDir();
694// if( curDir.isEmpty()) { 694// if( curDir.isEmpty()) {
695// } 695// }
696 if( dir == s_addBookmark) { 696 if( dir == s_addBookmark) {
697 addCustomDir(); 697 addCustomDir();
698 } 698 }
699 if( dir == s_removeBookmark) { 699 if( dir == s_removeBookmark) {
700 removeCustomDir( ); 700 removeCustomDir( );
701 } else { 701 } else {
702 gotoDirectory( dir); 702 changeTo( dir);
703// if(QDir( curDir).exists() ) 703// if(QDir( curDir).exists() )
704// { 704// {
705// thisDir->setPath( curDir ); 705// thisDir->setPath( curDir );
706// chdir( curDir.latin1() ); 706// chdir( curDir.latin1() );
707// thisDir->cd( curDir, TRUE); 707// thisDir->cd( curDir, TRUE);
708// populateView(); 708// populateView();
709// } 709// }
710 } 710 }
711} 711}
712 712
713QDir *AdvancedFm::CurrentDir() { 713QDir *AdvancedFm::CurrentDir() {
714 if ( whichTab == 1) { 714 if ( whichTab == 1) {
715 // qDebug("CurrentTab is Local"); 715 // qDebug("CurrentTab is Local");
716 return &currentDir; 716 return &currentDir;
717 } else { 717 } else {
718 // qDebug("CurrentTab is Remote"); 718 // qDebug("CurrentTab is Remote");
719 return &currentRemoteDir; 719 return &currentRemoteDir;
720 } 720 }
721} 721}
722 722
723QDir *AdvancedFm::OtherDir() { 723QDir *AdvancedFm::OtherDir() {
724 // if ( TabWidget->currentWidget() == tab) { 724 // if ( TabWidget->currentWidget() == tab) {
725 if ( whichTab == 1) { 725 if ( whichTab == 1) {
726 return &currentRemoteDir; 726 return &currentRemoteDir;
727 } else { 727 } else {
728 return &currentDir; 728 return &currentDir;
729 } 729 }
730} 730}
731 731
732QListView * AdvancedFm::CurrentView() { 732QListView * AdvancedFm::CurrentView() {
733 // if ( TabWidget->currentWidget() == tab) { 733 // if ( TabWidget->currentWidget() == tab) {
734 if ( whichTab == 1) { 734 if ( whichTab == 1) {
@@ -737,87 +737,64 @@ QListView * AdvancedFm::CurrentView() {
737 } else { 737 } else {
738// owarn << "CurrentView Tab 2" << oendl; 738// owarn << "CurrentView Tab 2" << oendl;
739 // qDebug("CurrentView: remote"); 739 // qDebug("CurrentView: remote");
740 return Remote_View; 740 return Remote_View;
741 } 741 }
742} 742}
743 743
744QListView * AdvancedFm::OtherView() { 744QListView * AdvancedFm::OtherView() {
745 if ( whichTab == 1) 745 if ( whichTab == 1)
746 return Remote_View; 746 return Remote_View;
747 else 747 else
748 return Local_View; 748 return Local_View;
749} 749}
750 750
751void AdvancedFm::setOtherTabCurrent() { 751void AdvancedFm::setOtherTabCurrent() {
752 // qDebug("setOtherTabCurrent() %d",whichTab); 752 // qDebug("setOtherTabCurrent() %d",whichTab);
753 if ( whichTab == 1) { 753 if ( whichTab == 1) {
754 TabWidget->setCurrentWidget(1); 754 TabWidget->setCurrentWidget(1);
755 } else { 755 } else {
756 TabWidget->setCurrentWidget(0); 756 TabWidget->setCurrentWidget(0);
757 } 757 }
758 OtherView()->setFocus(); 758 OtherView()->setFocus();
759 OtherView()->setSelected( CurrentView()->firstChild(), true); 759 OtherView()->setSelected( CurrentView()->firstChild(), true);
760} 760}
761 761
762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
763// odebug << "qcop message "+msg << oendl; 763// odebug << "qcop message "+msg << oendl;
764 QDataStream stream ( data, IO_ReadOnly ); 764 QDataStream stream ( data, IO_ReadOnly );
765 if ( msg == "openDirectory(QString)" ) { 765 if ( msg == "openDirectory(QString)" ) {
766// odebug << "received" << oendl; 766// odebug << "received" << oendl;
767 QString file; 767 QString file;
768 stream >> file; 768 stream >> file;
769 gotoDirectory( (const QString &) file); 769 changeTo( (const QString &) file);
770 } 770 }
771} 771}
772 772
773void AdvancedFm::setDocument(const QString &file) { 773void AdvancedFm::setDocument(const QString &file) {
774 gotoDirectory( file); 774 changeTo( file);
775 775
776} 776}
777 777
778void AdvancedFm::gotoDirectory(const QString &file) {
779// qDebug("goto dir "+file);
780 QString curDir = file;
781 QDir *thisDir = CurrentDir();
782 if(QDir( curDir).exists() ) {
783 thisDir->setPath( curDir );
784 chdir( curDir.latin1() );
785 thisDir->cd( curDir, TRUE);
786 populateView();
787 }
788 else if(QFileInfo(curDir).exists()) {
789 QFileInfo fileInfo(curDir);
790 curDir=fileInfo.dirPath();
791 if(QDir( curDir).exists() ) {
792 thisDir->setPath( curDir );
793 chdir( curDir.latin1() );
794 thisDir->cd( curDir, TRUE);
795 populateView();
796 }
797 findFile(file);
798 }
799
800}
801 778
802void AdvancedFm::findFile(const QString &fileName) { 779void AdvancedFm::findFile(const QString &fileName) {
803 QFileInfo fi(fileName); 780 QFileInfo fi(fileName);
804 QListView *thisView = CurrentView(); 781 QListView *thisView = CurrentView();
805 QListViewItemIterator it( thisView ); 782 QListViewItemIterator it( thisView );
806 for ( ; it.current(); ++it ) { 783 for ( ; it.current(); ++it ) {
807 if(it.current()->text(0) == fi.fileName()) { 784 if(it.current()->text(0) == fi.fileName()) {
808 it.current()->setSelected(true); 785 it.current()->setSelected(true);
809 thisView->ensureItemVisible(it.current()); 786 thisView->ensureItemVisible(it.current());
810 } 787 }
811 } 788 }
812} 789}
813 790
814void AdvancedFm::slotSwitchMenu(int item) { 791void AdvancedFm::slotSwitchMenu(int item) {
815 Q_UNUSED(item); 792 Q_UNUSED(item);
816 // qDebug( "Switch %d",item); 793 // qDebug( "Switch %d",item);
817 // viewMenu->setItemChecked(item, true); 794 // viewMenu->setItemChecked(item, true);
818} 795}
819 796
820void AdvancedFm::navigateToSelected() { 797void AdvancedFm::navigateToSelected() {
821 if( !CurrentView()->currentItem()) return; 798 if( !CurrentView()->currentItem()) return;
822 doDirChange(); 799 doDirChange();
823} 800}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 9dbdc70..00ab909 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -148,47 +148,46 @@ protected slots:
148 void copyTimer(); 148 void copyTimer();
149 void copyAs(); 149 void copyAs();
150 void copyAsTimer(); 150 void copyAsTimer();
151 void copySameDir(); 151 void copySameDir();
152 void copySameDirTimer(); 152 void copySameDirTimer();
153 void move(); 153 void move();
154 void moveTimer(); 154 void moveTimer();
155 155
156 void currentPathComboActivated(const QString &); 156 void currentPathComboActivated(const QString &);
157 void fillCombo(const QString &); 157 void fillCombo(const QString &);
158 bool copyFile( const QString & , const QString & ); 158 bool copyFile( const QString & , const QString & );
159 void fileStatus(); 159 void fileStatus();
160 void doAbout(); 160 void doAbout();
161 void doBeam(); 161 void doBeam();
162 void fileBeamFinished( Ir *); 162 void fileBeamFinished( Ir *);
163 bool copyDirectory( const QString & , const QString & ); 163 bool copyDirectory( const QString & , const QString & );
164// void navigateToSelected(); 164// void navigateToSelected();
165 bool moveDirectory( const QString & , const QString & ); 165 bool moveDirectory( const QString & , const QString & );
166 166
167// void slotSwitchtoLocal(int); 167// void slotSwitchtoLocal(int);
168 168
169private: 169private:
170 MenuButton *menuButton; 170 MenuButton *menuButton;
171 QString oldName, localViewDir, remoteViewDir; 171 QString oldName, localViewDir, remoteViewDir;
172 void startProcess(const QString &); 172 void startProcess(const QString &);
173 bool eventFilter( QObject * , QEvent * ); 173 bool eventFilter( QObject * , QEvent * );
174 void cancelRename(); 174 void cancelRename();
175 void doRename(QListView *); 175 void doRename(QListView *);
176 void okRename(); 176 void okRename();
177 void customDirsToMenu(); 177 void customDirsToMenu();
178 void addCustomDir(); 178 void addCustomDir();
179 void removeCustomDir(); 179 void removeCustomDir();
180 void gotoDirectory(const QString &);
181 void navigateToSelected(); 180 void navigateToSelected();
182 void findFile(const QString &); 181 void findFile(const QString &);
183 182
184private slots: 183private slots:
185 void processEnded(Opie::Core::OProcess *); 184 void processEnded(Opie::Core::OProcess *);
186 void oprocessStderr(Opie::Core::OProcess *, char *, int); 185 void oprocessStderr(Opie::Core::OProcess *, char *, int);
187 void gotoCustomDir(const QString &); 186 void gotoCustomDir(const QString &);
188 void qcopReceive(const QCString&, const QByteArray&); 187 void qcopReceive(const QCString&, const QByteArray&);
189 void setDocument(const QString &); 188 void setDocument(const QString &);
190 // void doMenu(int 189 // void doMenu(int
191 190
192}; 191};
193 192
194#endif // ADVANCEDFM_H 193#endif // ADVANCEDFM_H