summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-01 18:38:27 (UTC)
committer llornkcor <llornkcor>2002-06-01 18:38:27 (UTC)
commitbc167b7ef02ccd5f6127d9f9640f4b7af6c5a496 (patch) (unidiff)
treed885205c7c2b6c690db1a9e9ff993fd09b2e78bd
parent2815c0b50bd52d58022eb1d5f4364079a0e99e0a (diff)
downloadopie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.zip
opie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.tar.gz
opie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.tar.bz2
fixed bug woth my eyes no seeing the path combo very well, also fixed bug with popupmenu
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp245
-rw-r--r--noncore/apps/advancedfm/advancedfm.h16
2 files changed, 155 insertions, 106 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index f32031b..869a433 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -73,2 +73,3 @@ AdvancedFm::AdvancedFm( )
73 setCaption( tr( "AdvancedFm" ) ); 73 setCaption( tr( "AdvancedFm" ) );
74// menuTimer( this );
74 75
@@ -146,4 +147,21 @@ AdvancedFm::AdvancedFm( )
146 147
148
149 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
150 currentPathCombo->setEditable(TRUE);
151 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
152 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
153
154 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
155 this, SLOT( currentPathComboActivated( const QString & ) ) );
156
157 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
158 this,SLOT(currentPathComboChanged()));
159
160 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
161
162 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
163
164
147 TabWidget = new QTabWidget( this, "TabWidget" ); 165 TabWidget = new QTabWidget( this, "TabWidget" );
148 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); 166 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
149 167
@@ -167,2 +185,4 @@ AdvancedFm::AdvancedFm( )
167 185
186
187
168 tabLayout->addWidget( Local_View, 0, 0 ); 188 tabLayout->addWidget( Local_View, 0, 0 );
@@ -173,2 +193,3 @@ AdvancedFm::AdvancedFm( )
173 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 193 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
194 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
174 195
@@ -197,2 +218,3 @@ AdvancedFm::AdvancedFm( )
197 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 218 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
219 connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
198 220
@@ -223,16 +245,2 @@ AdvancedFm::AdvancedFm( )
223 b = TRUE; 245 b = TRUE;
224 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
225 currentPathCombo->setEditable(TRUE);
226 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
227 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
228
229 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
230 this, SLOT( currentPathComboActivated( const QString & ) ) );
231
232 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
233 this,SLOT(currentPathComboChanged()));
234
235 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
236
237 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
238 246
@@ -240,2 +248,5 @@ AdvancedFm::AdvancedFm( )
240 b=FALSE; 248 b=FALSE;
249
250 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
251
241 populateLocalView(); 252 populateLocalView();
@@ -643,4 +654,3 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint
643 case 2: 654 case 2:
644 showLocalMenu(item); 655 menuTimer.start( 500, TRUE );
645 Local_View->clearSelection();
646 break; 656 break;
@@ -651,2 +661,3 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint
651{ 661{
662
652 switch (mouse) { 663 switch (mouse) {
@@ -655,4 +666,3 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint
655 case 2: 666 case 2:
656 showRemoteMenu(item); 667 menuTimer.start( 500, TRUE );
657 Remote_View->clearSelection();
658 break; 668 break;
@@ -661,80 +671,2 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint
661 671
662void AdvancedFm::showLocalMenu(QListViewItem * item)
663{
664 if(item) {
665 QPopupMenu m;
666 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
667 m.insertSeparator();
668 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
669 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
670 else
671 m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() ));
672 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
673 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
674 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
675 m.insertSeparator();
676 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
677 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
678 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
679 m.insertItem( tr( "Move" ), this, SLOT( move() ));
680 m.insertSeparator();
681 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
682 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
683 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
684 m.insertSeparator();
685 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
686 m.insertSeparator();
687 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
688 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
689 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
690 m.setCheckable(TRUE);
691 if (!b)
692 m.setItemChecked(m.idAt(0),TRUE);
693 else
694 m.setItemChecked(m.idAt(0),FALSE);
695 if(Ir::supported())
696 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
697 m.exec( QCursor::pos() );
698 }
699}
700
701void AdvancedFm::showRemoteMenu(QListViewItem * item)
702{
703 if(item) {
704 QPopupMenu m;
705 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
706 m.insertSeparator();
707 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
708 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
709 else
710 m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() ));
711 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
712 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
713 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
714 m.insertSeparator();
715 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
716 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
717 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
718 m.insertItem( tr( "Move" ), this, SLOT( move() ));
719 m.insertSeparator();
720 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
721 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
722 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
723 m.insertSeparator();
724 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
725 m.insertSeparator();
726 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
727 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
728 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
729 m.setCheckable(TRUE);
730 if (!b)
731 m.setItemChecked(m.idAt(0),TRUE);
732 else
733 m.setItemChecked(m.idAt(0),FALSE);
734 if(Ir::supported())
735 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
736 m.exec( QCursor::pos() );
737 }
738}
739
740void AdvancedFm::runThis() { 672void AdvancedFm::runThis() {
@@ -744,2 +676,3 @@ QString fs;
744 QString curFile = Local_View->currentItem()->text(0); 676 QString curFile = Local_View->currentItem()->text(0);
677 if(curFile != "../") {
745 678
@@ -765,2 +698,3 @@ QString fs;
765 } 698 }
699 }
766// MimeType mt( curFile); 700// MimeType mt( curFile);
@@ -768,2 +702,4 @@ QString fs;
768 QString curFile = Remote_View->currentItem()->text(0); 702 QString curFile = Remote_View->currentItem()->text(0);
703 if(curFile != "../") {
704
769 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 705 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
@@ -787,2 +723,3 @@ QString fs;
787 } 723 }
724 }
788// MimeType mt( curFile); 725// MimeType mt( curFile);
@@ -794,2 +731,3 @@ void AdvancedFm::runText() {
794 QString curFile = Local_View->currentItem()->text(0); 731 QString curFile = Local_View->currentItem()->text(0);
732 if(curFile != "../") {
795 curFile = currentDir.canonicalPath()+"/"+curFile; 733 curFile = currentDir.canonicalPath()+"/"+curFile;
@@ -797,4 +735,6 @@ void AdvancedFm::runText() {
797 e << curFile; 735 e << curFile;
736 }
798 } else { 737 } else {
799 QString curFile = Remote_View->currentItem()->text(0); 738 QString curFile = Remote_View->currentItem()->text(0);
739 if(curFile != "../") {
800 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 740 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
@@ -805,2 +745,3 @@ void AdvancedFm::runText() {
805} 745}
746}
806 747
@@ -833,2 +774,3 @@ void AdvancedFm::localDelete()
833 QStringList curFileList = getPath(); 774 QStringList curFileList = getPath();
775 if(curFileList.count() > 0) {
834 QString myFile; 776 QString myFile;
@@ -877,2 +819,3 @@ void AdvancedFm::localDelete()
877} 819}
820}
878 821
@@ -881,2 +824,3 @@ void AdvancedFm::remoteDelete()
881 QStringList curFileList = getPath(); 824 QStringList curFileList = getPath();
825 if( curFileList.count() > 0) {
882 QString myFile; 826 QString myFile;
@@ -925,2 +869,3 @@ void AdvancedFm::remoteDelete()
925} 869}
870}
926 871
@@ -929,2 +874,4 @@ void AdvancedFm::localRename()
929 QString curFile = Local_View->currentItem()->text(0); 874 QString curFile = Local_View->currentItem()->text(0);
875 qDebug("currentItem "+curFile);
876 if( curFile !="../") {
930 InputDialog *fileDlg; 877 InputDialog *fileDlg;
@@ -941,2 +888,3 @@ void AdvancedFm::localRename()
941} 888}
889}
942 890
@@ -944,3 +892,4 @@ void AdvancedFm::remoteRename()
944{ 892{
945 QString curFile = Local_View->currentItem()->text(0); 893 QString curFile = Remote_View->currentItem()->text(0);
894 if( curFile !="../") {
946 InputDialog *fileDlg; 895 InputDialog *fileDlg;
@@ -957,2 +906,3 @@ void AdvancedFm::remoteRename()
957} 906}
907}
958 908
@@ -1057,4 +1007,2 @@ void AdvancedFm::filePerms() {
1057 } 1007 }
1058
1059
1060} 1008}
@@ -1065,3 +1013,2 @@ void AdvancedFm::doProperties() {
1065 if (TabWidget->currentPageIndex() == 0) { 1013 if (TabWidget->currentPageIndex() == 0) {
1066
1067 filePath = currentDir.canonicalPath()+"/"; 1014 filePath = currentDir.canonicalPath()+"/";
@@ -1186,2 +1133,3 @@ void AdvancedFm::copy()
1186 QStringList curFileList = getPath(); 1133 QStringList curFileList = getPath();
1134 if( curFileList.count() > 0) {
1187 QString curFile; 1135 QString curFile;
@@ -1230,2 +1178,3 @@ void AdvancedFm::copy()
1230} 1178}
1179}
1231 1180
@@ -1234,2 +1183,3 @@ void AdvancedFm::copyAs()
1234 QStringList curFileList = getPath(); 1183 QStringList curFileList = getPath();
1184 if( curFileList.count() > 0) {
1235 QString curFile; 1185 QString curFile;
@@ -1288,2 +1238,3 @@ void AdvancedFm::copyAs()
1288} 1238}
1239}
1289 1240
@@ -1292,2 +1243,3 @@ void AdvancedFm::move() {
1292 QStringList curFileList = getPath(); 1243 QStringList curFileList = getPath();
1244 if( curFileList.count() > 0) {
1293 QString curFile; 1245 QString curFile;
@@ -1344,2 +1296,3 @@ void AdvancedFm::move() {
1344 } 1296 }
1297 }
1345 1298
@@ -1576,2 +1529,3 @@ void AdvancedFm::mkSym() {
1576 QStringList curFileList = getPath(); 1529 QStringList curFileList = getPath();
1530 if( curFileList.count() > 0) {
1577 1531
@@ -1606,2 +1560,3 @@ void AdvancedFm::mkSym() {
1606} 1560}
1561}
1607 1562
@@ -1670,2 +1625,3 @@ void AdvancedFm::doBeam() {
1670 QStringList curFileList = getPath(); 1625 QStringList curFileList = getPath();
1626 if( curFileList.count() > 0) {
1671 1627
@@ -1695,2 +1651,4 @@ void AdvancedFm::doBeam() {
1695 1651
1652}
1653
1696void AdvancedFm::fileBeamFinished( Ir *ir) { 1654void AdvancedFm::fileBeamFinished( Ir *ir) {
@@ -1710 +1668,86 @@ void AdvancedFm::fileBeamFinished( Ir *ir) {
1710// } 1668// }
1669
1670void AdvancedFm::showFileMenu() {
1671 QString curApp;
1672 bool isLocalView = false;
1673 if (TabWidget->currentPageIndex() == 0) {
1674 isLocalView = TRUE;
1675 curApp = Local_View->currentItem()->text(0);
1676 } else {
1677 curApp = Remote_View->currentItem()->text(0);
1678 }
1679
1680 MimeType mt( curApp );
1681 const AppLnk* app = mt.application();
1682 QFile fi(curApp);
1683
1684 QPopupMenu m;
1685 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
1686 m.insertSeparator();
1687 if ( QFileInfo(fi).isDir() ) {
1688 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
1689 } else {
1690
1691 if ( app )
1692 m.insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( run() ) );
1693 else if( QFileInfo(fi).isExecutable() )
1694 m.insertItem( tr( "Execute" ), this, SLOT( run() ) );
1695
1696 m.insertItem( /*Resource::loadPixmap( "txt" ),*/ tr( "Open as text" ),this, SLOT( runText() ) );
1697 }
1698 m.insertSeparator();
1699
1700
1701 if(isLocalView)
1702 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
1703 else
1704 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
1705
1706 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
1707 m.insertSeparator();
1708
1709 if(isLocalView)
1710 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
1711 else
1712 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
1713
1714 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
1715 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
1716 m.insertItem( tr( "Move" ), this, SLOT( move() ));
1717 m.insertSeparator();
1718
1719 if(isLocalView)
1720 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
1721 else
1722 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
1723
1724 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
1725 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
1726 m.insertSeparator();
1727
1728 if(isLocalView)
1729 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
1730 else
1731 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1732
1733 m.insertSeparator();
1734 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
1735 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
1736 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1737 m.setCheckable(TRUE);
1738 if (!b)
1739 m.setItemChecked(m.idAt(0),TRUE);
1740 else
1741 m.setItemChecked(m.idAt(0),FALSE);
1742 if(Ir::supported())
1743 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
1744 m.exec( QCursor::pos() );
1745}
1746
1747
1748void AdvancedFm::cancelMenuTimer()
1749{
1750qDebug("cancel menu timer");
1751 if( menuTimer.isActive() )
1752 menuTimer.stop();
1753}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 5817fca..0cf94c6 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -14,2 +14,4 @@
14 14
15#include <qpe/ir.h>
16
15#include <qvariant.h> 17#include <qvariant.h>
@@ -17,2 +19,3 @@
17#include <qmainwindow.h> 19#include <qmainwindow.h>
20#include <qstringlist.h>
18#include <qdir.h> 21#include <qdir.h>
@@ -20,4 +23,3 @@
20#include <qpoint.h> 23#include <qpoint.h>
21#include <qstringlist.h> 24#include <qtimer.h>
22#include <qpe/ir.h>
23 25
@@ -41,2 +43,3 @@ class QLineEdit;
41class QPushButton; 43class QPushButton;
44class Ir;
42 45
@@ -64,4 +67,2 @@ public:
64protected slots: 67protected slots:
65 void showLocalMenu( QListViewItem *);
66 void showRemoteMenu( QListViewItem *);
67 void doLocalCd(); 68 void doLocalCd();
@@ -106,2 +107,3 @@ protected:
106 QStringList remoteDirPathStringList, localDirPathStringList; 107 QStringList remoteDirPathStringList, localDirPathStringList;
108
107 void keyReleaseEvent( QKeyEvent *); 109 void keyReleaseEvent( QKeyEvent *);
@@ -111,2 +113,4 @@ protected:
111protected slots: 113protected slots:
114 void showFileMenu();
115 void cancelMenuTimer();
112 void homeButtonPushed(); 116 void homeButtonPushed();
@@ -127,3 +131,5 @@ protected slots:
127 void doBeam(); 131 void doBeam();
128 void fileBeamFinished( Ir *ir); 132 void fileBeamFinished( Ir *);
133private:
134 QTimer menuTimer;
129}; 135};