summaryrefslogtreecommitdiff
Unidiff
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
@@ -83,37 +83,43 @@ AdvancedFm::AdvancedFm( )
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
@@ -134,9 +140,9 @@ AdvancedFm::AdvancedFm( )
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);
@@ -212,9 +218,9 @@ AdvancedFm::AdvancedFm( )
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 & ) ) );
@@ -223,9 +229,9 @@ AdvancedFm::AdvancedFm( )
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();
@@ -305,18 +311,24 @@ void AdvancedFm::populateLocalView()
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())
@@ -422,11 +434,16 @@ void AdvancedFm::populateRemoteView()
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" );
@@ -697,26 +714,38 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item)
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}
@@ -1477,4 +1506,18 @@ void AdvancedFm::mkSym() {
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
@@ -51,9 +51,9 @@ public:
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;
@@ -107,8 +107,9 @@ protected 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();