summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-28 13:20:23 (UTC)
committer llornkcor <llornkcor>2002-04-28 13:20:23 (UTC)
commit495103fd36f52dad3a564b924326519c9f52ccaf (patch) (unidiff)
tree22a26ab944ee236c5df7cc2fe8f394fee7b91236
parentee6fdf8783f7a2fa91792e2f0ce0f8350f8cac0d (diff)
downloadopie-495103fd36f52dad3a564b924326519c9f52ccaf.zip
opie-495103fd36f52dad3a564b924326519c9f52ccaf.tar.gz
opie-495103fd36f52dad3a564b924326519c9f52ccaf.tar.bz2
added qpeDir icon, added ability to execute with 'open'
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp91
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
2 files changed, 69 insertions, 25 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index bb932c5..ab31c91 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -81,41 +81,47 @@ AdvancedFm::AdvancedFm( )
81 81
82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
83 83
84 menuBar->insertItem( tr( "File" ), fileMenu); 84 menuBar->insertItem( tr( "File" ), fileMenu);
85 menuBar->insertItem( tr( "View" ), viewMenu); 85 menuBar->insertItem( tr( "View" ), viewMenu);
86 86
87 qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton");
88 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
89 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
90 qpeDirButton->setFlat(TRUE);
91 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
92
87 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 93 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
88 cfButton ->setFixedSize( QSize( 20, 20 ) ); 94 cfButton ->setFixedSize( QSize( 20, 20 ) );
89 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 95 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
90 cfButton->setFlat(TRUE); 96 cfButton->setFlat(TRUE);
91 layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); 97 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
92 98
93 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 99 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
94 sdButton->setFixedSize( QSize( 20, 20 ) ); 100 sdButton->setFixedSize( QSize( 20, 20 ) );
95 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 101 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
96 sdButton->setFlat(TRUE); 102 sdButton->setFlat(TRUE);
97 layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); 103 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
98 104
99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 105 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
100 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 106 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
101 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 107 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
102 cdUpButton ->setFlat(TRUE); 108 cdUpButton ->setFlat(TRUE);
103 layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); 109 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
104 110
105 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 111 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
106 docButton->setFixedSize( QSize( 20, 20 ) ); 112 docButton->setFixedSize( QSize( 20, 20 ) );
107 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 113 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
108 docButton->setFlat(TRUE); 114 docButton->setFlat(TRUE);
109 layout->addMultiCellWidget( docButton, 0, 0, 5, 5); 115 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
110 116
111 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 117 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
112 homeButton->setFixedSize( QSize( 20, 20 ) ); 118 homeButton->setFixedSize( QSize( 20, 20 ) );
113 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 119 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
114 homeButton->setFlat(TRUE); 120 homeButton->setFlat(TRUE);
115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); 121 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 122// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 123// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 124// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
119 125
120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 126 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
121 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 127 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
@@ -132,13 +138,13 @@ AdvancedFm::AdvancedFm( )
132 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 138 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
133 viewMenu->insertSeparator(); 139 viewMenu->insertSeparator();
134 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 140 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
135 viewMenu->setCheckable(TRUE); 141 viewMenu->setCheckable(TRUE);
136 142
137 TabWidget = new QTabWidget( this, "TabWidget" ); 143 TabWidget = new QTabWidget( this, "TabWidget" );
138 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); 144 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7);
139 145
140 tab = new QWidget( TabWidget, "tab" ); 146 tab = new QWidget( TabWidget, "tab" );
141 tabLayout = new QGridLayout( tab ); 147 tabLayout = new QGridLayout( tab );
142 tabLayout->setSpacing( 2); 148 tabLayout->setSpacing( 2);
143 tabLayout->setMargin( 2); 149 tabLayout->setMargin( 2);
144 150
@@ -210,24 +216,24 @@ AdvancedFm::AdvancedFm( )
210 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 216 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
211 currentRemoteDir.setPath( QDir::currentDirPath()); 217 currentRemoteDir.setPath( QDir::currentDirPath());
212 218
213 b = TRUE; 219 b = TRUE;
214 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 220 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
215 currentPathCombo->setEditable(TRUE); 221 currentPathCombo->setEditable(TRUE);
216 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 222 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
217 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 223 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
218 224
219 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 225 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
220 this, SLOT( currentPathComboActivated( const QString & ) ) ); 226 this, SLOT( currentPathComboActivated( const QString & ) ) );
221 227
222 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 228 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
223 this,SLOT(currentPathComboChanged())); 229 this,SLOT(currentPathComboChanged()));
224 230
225 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 231 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
226 232
227 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 233 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
228 234
229 filterStr="*"; 235 filterStr="*";
230 b=FALSE; 236 b=FALSE;
231 populateLocalView(); 237 populateLocalView();
232 populateRemoteView(); 238 populateRemoteView();
233} 239}
@@ -303,22 +309,28 @@ void AdvancedFm::populateLocalView()
303 isDir=TRUE; 309 isDir=TRUE;
304// qDebug( fileL); 310// qDebug( fileL);
305 } 311 }
306 } 312 }
307 if(fileL !="./" && fi->exists()) { 313 if(fileL !="./" && fi->exists()) {
308 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 314 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
309
310 if(isDir || fileL.find("/",0,TRUE) != -1) { 315 if(isDir || fileL.find("/",0,TRUE) != -1) {
311 if( !QDir( fi->filePath() ).isReadable()) 316 if( !QDir( fi->filePath() ).isReadable())
312 pm = Resource::loadPixmap( "lockedfolder" ); 317 pm = Resource::loadPixmap( "lockedfolder" );
313 else 318 else
314 pm= Resource::loadPixmap( "folder" ); 319 pm= Resource::loadPixmap( "folder" );
315 item->setPixmap( 0,pm ); 320 item->setPixmap( 0,pm );
316 } else { 321 } else {
317 if( !fi->isReadable() ) 322 if(fi->isExecutable()) {
323 pm = Resource::loadPixmap( "exec");
324 item->setPixmap( 0,pm);
325 }
326 else if( !fi->isReadable() ) {
318 pm = Resource::loadPixmap( "locked" ); 327 pm = Resource::loadPixmap( "locked" );
328 item->setPixmap( 0,pm);
329
330 }
319 else { 331 else {
320 MimeType mt(fi->filePath()); 332 MimeType mt(fi->filePath());
321 pm=mt.pixmap(); //sets the correct pixmap for mimetype 333 pm=mt.pixmap(); //sets the correct pixmap for mimetype
322 if(pm.isNull()) 334 if(pm.isNull())
323 pm = Resource::loadPixmap( "UnknownDocument-14" ); 335 pm = Resource::loadPixmap( "UnknownDocument-14" );
324 item->setPixmap( 0,pm); 336 item->setPixmap( 0,pm);
@@ -420,15 +432,20 @@ void AdvancedFm::populateRemoteView()
420 if( !QDir( fi->filePath() ).isReadable()) 432 if( !QDir( fi->filePath() ).isReadable())
421 pm = Resource::loadPixmap( "lockedfolder" ); 433 pm = Resource::loadPixmap( "lockedfolder" );
422 else 434 else
423 pm= Resource::loadPixmap( "folder" ); 435 pm= Resource::loadPixmap( "folder" );
424 item->setPixmap( 0,pm ); 436 item->setPixmap( 0,pm );
425 } else { 437 } else {
426 if( !fi->isReadable() ) 438 if(fi->isExecutable()) {
439 pm = Resource::loadPixmap( "exec");
440 item->setPixmap( 0,pm);
441 }
442 else if( !fi->isReadable() ) {
427 pm = Resource::loadPixmap( "locked" ); 443 pm = Resource::loadPixmap( "locked" );
428 else { 444 item->setPixmap( 0,pm);
445 } else {
429 MimeType mt(fi->filePath()); 446 MimeType mt(fi->filePath());
430 pm=mt.pixmap(); //sets the correct pixmap for mimetype 447 pm=mt.pixmap(); //sets the correct pixmap for mimetype
431 if(pm.isNull()) 448 if(pm.isNull())
432 pm = Resource::loadPixmap( "UnknownDocument-14" ); 449 pm = Resource::loadPixmap( "UnknownDocument-14" );
433 item->setPixmap( 0,pm); 450 item->setPixmap( 0,pm);
434 } 451 }
@@ -695,30 +712,42 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item)
695} 712}
696 713
697void AdvancedFm::runThis() { 714void AdvancedFm::runThis() {
698// QFileInfo *fi; 715// QFileInfo *fi;
699 if (TabWidget->currentPageIndex() == 0) { 716 if (TabWidget->currentPageIndex() == 0) {
700 QString curFile = Local_View->currentItem()->text(0); 717 QString curFile = Local_View->currentItem()->text(0);
701 curFile = currentDir.canonicalPath()+"/"+curFile; 718 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
702 DocLnk nf(curFile); 719 if(fileInfo.isExecutable()) {
703 QString execStr = nf.exec(); 720 QCopEnvelope e("QPE/System", "execute(QString)" );
704 qDebug( execStr); 721 e << curFile;
705 if( execStr.isEmpty() ) {
706 } else { 722 } else {
707 nf.execute(); 723 curFile = currentDir.canonicalPath()+"/"+curFile;
724 DocLnk nf(curFile);
725 QString execStr = nf.exec();
726 qDebug( execStr);
727 if( execStr.isEmpty() ) {
728 } else {
729 nf.execute();
730 }
708 } 731 }
709// MimeType mt( curFile); 732// MimeType mt( curFile);
710 } else { 733 } else {
711 QString curFile = Remote_View->currentItem()->text(0); 734 QString curFile = Remote_View->currentItem()->text(0);
712 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 735 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
713 DocLnk nf(curFile); 736 if(fileInfo.isExecutable()) {
714 QString execStr = nf.exec(); 737 QCopEnvelope e("QPE/System", "execute(QString)" );
715 qDebug(execStr); 738 e << curFile;
716 if( execStr.isEmpty() ) {
717 } else { 739 } else {
718 nf.execute(); 740 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
741 DocLnk nf(curFile);
742 QString execStr = nf.exec();
743 qDebug(execStr);
744 if( execStr.isEmpty() ) {
745 } else {
746 nf.execute();
747 }
719 } 748 }
720// MimeType mt( curFile); 749// MimeType mt( curFile);
721 } 750 }
722} 751}
723 752
724void AdvancedFm::runText() { 753void AdvancedFm::runText() {
@@ -1475,6 +1504,20 @@ void AdvancedFm::mkSym() {
1475 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 1504 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
1476 cmd = "ln -s "+curFile+" "+destName; 1505 cmd = "ln -s "+curFile+" "+destName;
1477 system(cmd.latin1() ); 1506 system(cmd.latin1() );
1478 populateLocalView(); 1507 populateLocalView();
1479 } 1508 }
1480} 1509}
1510
1511void AdvancedFm::QPEButtonPushed() {
1512 QString current = QPEApplication::qpeDir();
1513 chdir( current.latin1() );
1514 if (TabWidget->currentPageIndex() == 0) {
1515 currentDir.cd( current, TRUE);
1516 populateLocalView();
1517 } else {
1518 currentRemoteDir.cd( current, TRUE);
1519 populateRemoteView();
1520 }
1521 update();
1522
1523}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c00713f..5c2719e 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -49,13 +49,13 @@ public:
49 QTabWidget *TabWidget; 49 QTabWidget *TabWidget;
50 QWidget *tab, *tab_2, *tab_3; 50 QWidget *tab, *tab_2, *tab_3;
51 QListView *Local_View, *Remote_View; 51 QListView *Local_View, *Remote_View;
52 52
53 QLineEdit *currentPathEdit; 53 QLineEdit *currentPathEdit;
54 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; 54 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
55 QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; 55 QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
56 QDir currentDir, currentRemoteDir; 56 QDir currentDir, currentRemoteDir;
57 QComboBox *currentPathCombo; 57 QComboBox *currentPathCombo;
58 QString filterStr; 58 QString filterStr;
59 QListViewItem * item; 59 QListViewItem * item;
60 bool b; 60 bool b;
61 int currentServerConfig; 61 int currentServerConfig;
@@ -105,12 +105,13 @@ protected:
105 void keyReleaseEvent( QKeyEvent *); 105 void keyReleaseEvent( QKeyEvent *);
106protected slots: 106protected slots:
107 void homeButtonPushed(); 107 void homeButtonPushed();
108 void docButtonPushed(); 108 void docButtonPushed();
109 void SDButtonPushed(); 109 void SDButtonPushed();
110 void CFButtonPushed(); 110 void CFButtonPushed();
111 void QPEButtonPushed();
111 void upDir(); 112 void upDir();
112 void currentPathComboChanged(); 113 void currentPathComboChanged();
113 void copy(); 114 void copy();
114 void copyAs(); 115 void copyAs();
115 void currentPathComboActivated(const QString &); 116 void currentPathComboActivated(const QString &);
116 void fillCombo(const QString &); 117 void fillCombo(const QString &);