-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 91 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 3 |
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 @@ -83,37 +83,43 @@ AdvancedFm::AdvancedFm( ) menuBar->insertItem( tr( "File" ), fileMenu); menuBar->insertItem( tr( "View" ), viewMenu); + qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); + qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); + connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); + qpeDirButton->setFlat(TRUE); + layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); + cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); cfButton ->setFixedSize( QSize( 20, 20 ) ); connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); cfButton->setFlat(TRUE); - layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); + layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); sdButton->setFixedSize( QSize( 20, 20 ) ); connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); sdButton->setFlat(TRUE); - layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); + layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); cdUpButton ->setFixedSize( QSize( 20, 20 ) ); connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); cdUpButton ->setFlat(TRUE); - layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); + layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); docButton->setFixedSize( QSize( 20, 20 ) ); connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); docButton->setFlat(TRUE); - layout->addMultiCellWidget( docButton, 0, 0, 5, 5); + layout->addMultiCellWidget( docButton, 0, 0, 6, 6); homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); homeButton->setFixedSize( QSize( 20, 20 ) ); connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); homeButton->setFlat(TRUE); - layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); + layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); @@ -134,9 +140,9 @@ AdvancedFm::AdvancedFm( ) viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); viewMenu->setCheckable(TRUE); TabWidget = new QTabWidget( this, "TabWidget" ); - layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); + layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); @@ -212,9 +218,9 @@ AdvancedFm::AdvancedFm( ) b = TRUE; currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); currentPathCombo->setEditable(TRUE); - layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); + layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); connect( currentPathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( currentPathComboActivated( const QString & ) ) ); @@ -223,9 +229,9 @@ AdvancedFm::AdvancedFm( ) this,SLOT(currentPathComboChanged())); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); - layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); + layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); filterStr="*"; b=FALSE; populateLocalView(); @@ -305,18 +311,24 @@ void AdvancedFm::populateLocalView() } } if(fileL !="./" && fi->exists()) { item= new QListViewItem( Local_View, fileL, fileS , fileDate); - if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); item->setPixmap( 0,pm ); } else { - if( !fi->isReadable() ) + if(fi->isExecutable()) { + pm = Resource::loadPixmap( "exec"); + item->setPixmap( 0,pm); + } + else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); + item->setPixmap( 0,pm); + + } else { MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) @@ -422,11 +434,16 @@ void AdvancedFm::populateRemoteView() else pm= Resource::loadPixmap( "folder" ); item->setPixmap( 0,pm ); } else { - if( !fi->isReadable() ) + if(fi->isExecutable()) { + pm = Resource::loadPixmap( "exec"); + item->setPixmap( 0,pm); + } + else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); - else { + item->setPixmap( 0,pm); + } else { MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) pm = Resource::loadPixmap( "UnknownDocument-14" ); @@ -697,26 +714,38 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item) void AdvancedFm::runThis() { // QFileInfo *fi; if (TabWidget->currentPageIndex() == 0) { QString curFile = Local_View->currentItem()->text(0); - curFile = currentDir.canonicalPath()+"/"+curFile; - DocLnk nf(curFile); - QString execStr = nf.exec(); - qDebug( execStr); - if( execStr.isEmpty() ) { + QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); + if(fileInfo.isExecutable()) { + QCopEnvelope e("QPE/System", "execute(QString)" ); + e << curFile; } else { - nf.execute(); + curFile = currentDir.canonicalPath()+"/"+curFile; + DocLnk nf(curFile); + QString execStr = nf.exec(); + qDebug( execStr); + if( execStr.isEmpty() ) { + } else { + nf.execute(); + } } // MimeType mt( curFile); } else { QString curFile = Remote_View->currentItem()->text(0); - curFile = currentRemoteDir.canonicalPath()+"/"+curFile; - DocLnk nf(curFile); - QString execStr = nf.exec(); - qDebug(execStr); - if( execStr.isEmpty() ) { + QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); + if(fileInfo.isExecutable()) { + QCopEnvelope e("QPE/System", "execute(QString)" ); + e << curFile; } else { - nf.execute(); + curFile = currentRemoteDir.canonicalPath()+"/"+curFile; + DocLnk nf(curFile); + QString execStr = nf.exec(); + qDebug(execStr); + if( execStr.isEmpty() ) { + } else { + nf.execute(); + } } // MimeType mt( curFile); } } @@ -1477,4 +1506,18 @@ void AdvancedFm::mkSym() { system(cmd.latin1() ); populateLocalView(); } } + +void AdvancedFm::QPEButtonPushed() { + QString current = QPEApplication::qpeDir(); + chdir( current.latin1() ); + if (TabWidget->currentPageIndex() == 0) { + currentDir.cd( current, TRUE); + populateLocalView(); + } else { + currentRemoteDir.cd( current, TRUE); + populateRemoteView(); + } + update(); + +} 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 @@ -51,9 +51,9 @@ public: QListView *Local_View, *Remote_View; QLineEdit *currentPathEdit; QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; - QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; + QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; QDir currentDir, currentRemoteDir; QComboBox *currentPathCombo; QString filterStr; QListViewItem * item; @@ -107,8 +107,9 @@ protected slots: void homeButtonPushed(); void docButtonPushed(); void SDButtonPushed(); void CFButtonPushed(); + void QPEButtonPushed(); void upDir(); void currentPathComboChanged(); void copy(); void copyAs(); |