summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp31
1 files changed, 4 insertions, 27 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
@@ -333,25 +333,25 @@ QStringList AdvancedFm::getPath() {
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());
@@ -690,25 +690,25 @@ void AdvancedFm::removeCustomDir() {
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) {
@@ -757,56 +757,33 @@ void AdvancedFm::setOtherTabCurrent() {
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}