summaryrefslogtreecommitdiff
path: root/noncore/apps
Unidiff
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp118
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
2 files changed, 83 insertions, 38 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 3a8c22d..f32031b 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -19,24 +19,25 @@
19 19
20#include <qpe/lnkproperties.h> 20#include <qpe/lnkproperties.h>
21#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/mimetype.h> 29#include <qpe/mimetype.h>
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31#include <qpe/ir.h>
31 32
32//#include <opie/ofileselector.h> 33//#include <opie/ofileselector.h>
33#include <qmultilineedit.h> 34#include <qmultilineedit.h>
34 35
35#include <qtextstream.h> 36#include <qtextstream.h>
36#include <qpushbutton.h> 37#include <qpushbutton.h>
37#include <qtoolbutton.h> 38#include <qtoolbutton.h>
38#include <qdatetime.h> 39#include <qdatetime.h>
39#include <qdir.h> 40#include <qdir.h>
40#include <qfile.h> 41#include <qfile.h>
41#include <qstring.h> 42#include <qstring.h>
42#include <qcombobox.h> 43#include <qcombobox.h>
@@ -83,25 +84,25 @@ AdvancedFm::AdvancedFm( )
83 viewMenu = new QPopupMenu( this ); 84 viewMenu = new QPopupMenu( this );
84 85
85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 86 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
86 87
87 menuBar->insertItem( tr( "File" ), fileMenu); 88 menuBar->insertItem( tr( "File" ), fileMenu);
88 menuBar->insertItem( tr( "View" ), viewMenu); 89 menuBar->insertItem( tr( "View" ), viewMenu);
89 90
90 qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); 91 qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton");
91 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 92 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
92 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 93 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
93 qpeDirButton->setFlat(TRUE); 94 qpeDirButton->setFlat(TRUE);
94 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 95 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
95 96
96 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 97 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
97 cfButton ->setFixedSize( QSize( 20, 20 ) ); 98 cfButton ->setFixedSize( QSize( 20, 20 ) );
98 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 99 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
99 cfButton->setFlat(TRUE); 100 cfButton->setFlat(TRUE);
100 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 101 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
101 102
102 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 103 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
103 sdButton->setFixedSize( QSize( 20, 20 ) ); 104 sdButton->setFixedSize( QSize( 20, 20 ) );
104 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 105 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
105 sdButton->setFlat(TRUE); 106 sdButton->setFlat(TRUE);
106 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 107 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
107 108
@@ -201,25 +202,25 @@ AdvancedFm::AdvancedFm( )
201 202
202 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 203 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
203 this,SLOT(tabChanged(QWidget*))); 204 this,SLOT(tabChanged(QWidget*)));
204 205
205// tab_3 = new QWidget( TabWidget, "tab_3" ); 206// tab_3 = new QWidget( TabWidget, "tab_3" );
206// tabLayout_3 = new QGridLayout( tab_3 ); 207// tabLayout_3 = new QGridLayout( tab_3 );
207// tabLayout_3->setSpacing( 2); 208// tabLayout_3->setSpacing( 2);
208// tabLayout_3->setMargin( 2); 209// tabLayout_3->setMargin( 2);
209 210
210// OFileSelector *fileSelector; 211// OFileSelector *fileSelector;
211// fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); 212// fileSelector = new OFileSelector(tab_3,0,0,"/","","*");
212// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); 213// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 );
213 214
214// TabWidget->insertTab( tab_3, tr( "Files" ) ); 215// TabWidget->insertTab( tab_3, tr( "Files" ) );
215 216
216 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 217 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
217 currentDir.setPath( QDir::currentDirPath()); 218 currentDir.setPath( QDir::currentDirPath());
218 219
219 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 220 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
220 currentRemoteDir.setPath( QDir::currentDirPath()); 221 currentRemoteDir.setPath( QDir::currentDirPath());
221 222
222 b = TRUE; 223 b = TRUE;
223 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 224 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
224 currentPathCombo->setEditable(TRUE); 225 currentPathCombo->setEditable(TRUE);
225 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); 226 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
@@ -275,25 +276,25 @@ void AdvancedFm::tabChanged(QWidget *w)
275void AdvancedFm::populateLocalView() 276void AdvancedFm::populateLocalView()
276{ 277{
277 QPixmap pm; 278 QPixmap pm;
278 Local_View->clear(); 279 Local_View->clear();
279 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 280 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
280 currentDir.setMatchAllDirs(TRUE); 281 currentDir.setMatchAllDirs(TRUE);
281 currentDir.setNameFilter(filterStr); 282 currentDir.setNameFilter(filterStr);
282 QString fileL, fileS, fileDate; 283 QString fileL, fileS, fileDate;
283// qDebug(currentDir.canonicalPath()); 284// qDebug(currentDir.canonicalPath());
284// struct stat buf; 285// struct stat buf;
285// mode_t mode; 286// mode_t mode;
286 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 287 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
287 setCaption("AdvancedFm :: "+fs); 288 setCaption("AdvancedFm :: "+fs);
288 bool isDir=FALSE; 289 bool isDir=FALSE;
289 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 290 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
290 QFileInfoListIterator it(*list); 291 QFileInfoListIterator it(*list);
291 QFileInfo *fi; 292 QFileInfo *fi;
292 while ( (fi=it.current()) ) { 293 while ( (fi=it.current()) ) {
293 if (fi->isSymLink() ) { 294 if (fi->isSymLink() ) {
294 QString symLink=fi->readLink(); 295 QString symLink=fi->readLink();
295// qDebug("Symlink detected "+symLink); 296// qDebug("Symlink detected "+symLink);
296 QFileInfo sym( symLink); 297 QFileInfo sym( symLink);
297 fileS.sprintf( "%10li", sym.size() ); 298 fileS.sprintf( "%10li", sym.size() );
298 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 299 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
299 fileDate = sym.lastModified().toString(); 300 fileDate = sym.lastModified().toString();
@@ -301,43 +302,43 @@ void AdvancedFm::populateLocalView()
301 fileS.sprintf( "%10li", fi->size() ); 302 fileS.sprintf( "%10li", fi->size() );
302 fileL.sprintf( "%s",fi->fileName().data() ); 303 fileL.sprintf( "%s",fi->fileName().data() );
303 fileDate= fi->lastModified().toString(); 304 fileDate= fi->lastModified().toString();
304 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 305 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
305 fileL+="/"; 306 fileL+="/";
306 isDir=TRUE; 307 isDir=TRUE;
307// qDebug( fileL); 308// qDebug( fileL);
308 } 309 }
309 } 310 }
310 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 311 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
311 if(fileL !="./" && fi->exists()) { 312 if(fileL !="./" && fi->exists()) {
312 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 313 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
313 314
314 if(isDir || fileL.find("/",0,TRUE) != -1) { 315 if(isDir || fileL.find("/",0,TRUE) != -1) {
315 316
316 if( !QDir( fi->filePath() ).isReadable()) //is directory 317 if( !QDir( fi->filePath() ).isReadable()) //is directory
317 pm = Resource::loadPixmap( "lockedfolder" ); 318 pm = Resource::loadPixmap( "lockedfolder" );
318 else 319 else
319 pm= Resource::loadPixmap( "folder" ); 320 pm= Resource::loadPixmap( "folder" );
320// item->setPixmap( 0,pm ); 321// item->setPixmap( 0,pm );
321 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 322 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
322 pm = Resource::loadPixmap( "exec"); 323 pm = Resource::loadPixmap( "exec");
323 } else if( (fileInfo.permission( QFileInfo::ExeUser) 324 } else if( (fileInfo.permission( QFileInfo::ExeUser)
324 | fileInfo.permission( QFileInfo::ExeGroup) 325 | fileInfo.permission( QFileInfo::ExeGroup)
325 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 326 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
326 pm = Resource::loadPixmap( "exec"); 327 pm = Resource::loadPixmap( "exec");
327// else { //is exec 328// else { //is exec
328// pm = Resource::loadPixmap( "exec"); 329// pm = Resource::loadPixmap( "exec");
329// } 330// }
330// // item->setPixmap( 0,pm); 331// // item->setPixmap( 0,pm);
331 } else if( !fi->isReadable() ) { 332 } else if( !fi->isReadable() ) {
332 pm = Resource::loadPixmap( "locked" ); 333 pm = Resource::loadPixmap( "locked" );
333// item->setPixmap( 0,pm); 334// item->setPixmap( 0,pm);
334 } else { //everything else goes by mimetype 335 } else { //everything else goes by mimetype
335 MimeType mt(fi->filePath()); 336 MimeType mt(fi->filePath());
336 pm=mt.pixmap(); //sets the correct pixmap for mimetype 337 pm=mt.pixmap(); //sets the correct pixmap for mimetype
337 if(pm.isNull()) 338 if(pm.isNull())
338 pm = Resource::loadPixmap( "UnknownDocument-14" ); 339 pm = Resource::loadPixmap( "UnknownDocument-14" );
339// item->setPixmap( 0,pm); 340// item->setPixmap( 0,pm);
340 } 341 }
341 item->setPixmap( 0,pm); 342 item->setPixmap( 0,pm);
342 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 343 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
343 // overlay link image 344 // overlay link image
@@ -370,53 +371,53 @@ void AdvancedFm::populateLocalView()
370 fileL.sprintf("%s", mydirent->d_name); 371 fileL.sprintf("%s", mydirent->d_name);
371// fileS.sprintf("%d, %d", ); //this isn't correct 372// fileS.sprintf("%d, %d", ); //this isn't correct
372 devT = buf.st_dev; 373 devT = buf.st_dev;
373 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 374 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
374// fileS.sprintf("%d,%d", devT, devT); 375// fileS.sprintf("%d,%d", devT, devT);
375 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 376 fileDate.sprintf("%s", ctime( &buf.st_mtime));
376 if( fileL.find(".") == -1 ){ 377 if( fileL.find(".") == -1 ){
377 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 378 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
378 pm = Resource::loadPixmap( "UnknownDocument-14" ); 379 pm = Resource::loadPixmap( "UnknownDocument-14" );
379 item->setPixmap( 0,pm); 380 item->setPixmap( 0,pm);
380 } 381 }
381 } 382 }
382 383
383 closedir(dir); 384 closedir(dir);
384 } 385 }
385 386
386 Local_View->setSorting( 3,FALSE); 387 Local_View->setSorting( 3,FALSE);
387 fillCombo( (const QString &) currentDir.canonicalPath()); 388 fillCombo( (const QString &) currentDir.canonicalPath());
388} 389}
389 390
390 391
391void AdvancedFm::populateRemoteView() 392void AdvancedFm::populateRemoteView()
392{ 393{
393// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 394// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
394// QListViewItemIterator it( Remote_View ); 395// QListViewItemIterator it( Remote_View );
395// for ( ; it.current(); ++it ) { 396// for ( ; it.current(); ++it ) {
396// if ( it.current()->isSelected() ) { 397// if ( it.current()->isSelected() ) {
397// QString strItem = it.current()->text(0); 398// QString strItem = it.current()->text(0);
398// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 399// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
399// QFileInfo fi(localFile); 400// QFileInfo fi(localFile);
400// } 401// }
401// } 402// }
402 QPixmap pm; 403 QPixmap pm;
403 Remote_View->clear(); 404 Remote_View->clear();
404 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 405 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
405 currentRemoteDir.setMatchAllDirs(TRUE); 406 currentRemoteDir.setMatchAllDirs(TRUE);
406 currentRemoteDir.setNameFilter(filterStr); 407 currentRemoteDir.setNameFilter(filterStr);
407 QString fileL, fileS, fileDate; 408 QString fileL, fileS, fileDate;
408 409
409 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 410 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
410 setCaption("AdvancedFm :: "+fs); 411 setCaption("AdvancedFm :: "+fs);
411 bool isDir=FALSE; 412 bool isDir=FALSE;
412 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 413 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
413 QFileInfoListIterator it(*list); 414 QFileInfoListIterator it(*list);
414 QFileInfo *fi; 415 QFileInfo *fi;
415 while ( (fi=it.current()) ) { 416 while ( (fi=it.current()) ) {
416 if (fi->isSymLink() ){ 417 if (fi->isSymLink() ){
417 QString symLink=fi->readLink(); 418 QString symLink=fi->readLink();
418// qDebug("Symlink detected "+symLink); 419// qDebug("Symlink detected "+symLink);
419 QFileInfo sym( symLink); 420 QFileInfo sym( symLink);
420 fileS.sprintf( "%10li", sym.size() ); 421 fileS.sprintf( "%10li", sym.size() );
421 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 422 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
422 fileDate = sym.lastModified().toString(); 423 fileDate = sym.lastModified().toString();
@@ -488,25 +489,25 @@ void AdvancedFm::populateRemoteView()
488 qDebug(mydirent->d_name); 489 qDebug(mydirent->d_name);
489// mode = buf.st_mode; 490// mode = buf.st_mode;
490 fileL.sprintf("%s", mydirent->d_name); 491 fileL.sprintf("%s", mydirent->d_name);
491// fileS.sprintf("%d, %d", ); //this isn't correct 492// fileS.sprintf("%d, %d", ); //this isn't correct
492 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 493 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
493 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 494 fileDate.sprintf("%s", ctime( &buf.st_mtime));
494 if( fileL.find(".") == -1 ){ 495 if( fileL.find(".") == -1 ){
495 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 496 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
496 pm = Resource::loadPixmap( "UnknownDocument-14" ); 497 pm = Resource::loadPixmap( "UnknownDocument-14" );
497 item->setPixmap( 0,pm); 498 item->setPixmap( 0,pm);
498 } 499 }
499 } 500 }
500 501
501 closedir(dir); 502 closedir(dir);
502 } 503 }
503 504
504 Remote_View->setSorting( 3,FALSE); 505 Remote_View->setSorting( 3,FALSE);
505 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 506 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
506} 507}
507 508
508void AdvancedFm::localListClicked(QListViewItem *selectedItem) 509void AdvancedFm::localListClicked(QListViewItem *selectedItem)
509{ 510{
510 if(selectedItem) { 511 if(selectedItem) {
511 QString strItem=selectedItem->text(0); 512 QString strItem=selectedItem->text(0);
512 QString strSize=selectedItem->text(1); 513 QString strSize=selectedItem->text(1);
@@ -605,25 +606,25 @@ void AdvancedFm::showHidden()
605// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 606// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
606// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 607// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
607 b=FALSE; 608 b=FALSE;
608 609
609 } else { 610 } else {
610 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 611 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
611 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 612 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
612// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 613// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
613// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 614// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
614 b=TRUE; 615 b=TRUE;
615 } 616 }
616 populateLocalView(); 617 populateLocalView();
617 618
618} 619}
619 620
620void AdvancedFm::showRemoteHidden() 621void AdvancedFm::showRemoteHidden()
621{ 622{
622 if (b) { 623 if (b) {
623 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 624 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
624// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 625// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
625// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 626// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
626 b=TRUE; 627 b=TRUE;
627 628
628 } else { 629 } else {
629 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 630 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -682,24 +683,26 @@ void AdvancedFm::showLocalMenu(QListViewItem * item)
682 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 683 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
683 m.insertSeparator(); 684 m.insertSeparator();
684 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 685 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
685 m.insertSeparator(); 686 m.insertSeparator();
686 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 687 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
687 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings 688 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
688 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 689 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
689 m.setCheckable(TRUE); 690 m.setCheckable(TRUE);
690 if (!b) 691 if (!b)
691 m.setItemChecked(m.idAt(0),TRUE); 692 m.setItemChecked(m.idAt(0),TRUE);
692 else 693 else
693 m.setItemChecked(m.idAt(0),FALSE); 694 m.setItemChecked(m.idAt(0),FALSE);
695 if(Ir::supported())
696 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
694 m.exec( QCursor::pos() ); 697 m.exec( QCursor::pos() );
695 } 698 }
696} 699}
697 700
698void AdvancedFm::showRemoteMenu(QListViewItem * item) 701void AdvancedFm::showRemoteMenu(QListViewItem * item)
699{ 702{
700 if(item) { 703 if(item) {
701 QPopupMenu m; 704 QPopupMenu m;
702 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 705 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
703 m.insertSeparator(); 706 m.insertSeparator();
704 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 707 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
705 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 708 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
@@ -719,31 +722,33 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item)
719 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 722 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
720 m.insertSeparator(); 723 m.insertSeparator();
721 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 724 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
722 m.insertSeparator(); 725 m.insertSeparator();
723 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 726 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
724 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings 727 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
725 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 728 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
726 m.setCheckable(TRUE); 729 m.setCheckable(TRUE);
727 if (!b) 730 if (!b)
728 m.setItemChecked(m.idAt(0),TRUE); 731 m.setItemChecked(m.idAt(0),TRUE);
729 else 732 else
730 m.setItemChecked(m.idAt(0),FALSE); 733 m.setItemChecked(m.idAt(0),FALSE);
734 if(Ir::supported())
735 m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
731 m.exec( QCursor::pos() ); 736 m.exec( QCursor::pos() );
732 } 737 }
733} 738}
734 739
735void AdvancedFm::runThis() { 740void AdvancedFm::runThis() {
736// QFileInfo *fi; 741// QFileInfo *fi;
737QString fs; 742QString fs;
738 if (TabWidget->currentPageIndex() == 0) { 743 if (TabWidget->currentPageIndex() == 0) {
739 QString curFile = Local_View->currentItem()->text(0); 744 QString curFile = Local_View->currentItem()->text(0);
740 745
741 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 746 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
742 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 747 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
743 qDebug( fileInfo.owner()); 748 qDebug( fileInfo.owner());
744 if( (fileInfo.permission( QFileInfo::ExeUser) 749 if( (fileInfo.permission( QFileInfo::ExeUser)
745 | fileInfo.permission( QFileInfo::ExeGroup) 750 | fileInfo.permission( QFileInfo::ExeGroup)
746 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 751 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
747 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 752 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
748// if( fileInfo.isExecutable() | 753// if( fileInfo.isExecutable() |
749 QCopEnvelope e("QPE/System", "execute(QString)" ); 754 QCopEnvelope e("QPE/System", "execute(QString)" );
@@ -822,25 +827,25 @@ void AdvancedFm::remoteMakDir()
822 } 827 }
823 populateRemoteView(); 828 populateRemoteView();
824} 829}
825 830
826void AdvancedFm::localDelete() 831void AdvancedFm::localDelete()
827{ 832{
828 QStringList curFileList = getPath(); 833 QStringList curFileList = getPath();
829 QString myFile; 834 QString myFile;
830 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 835 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
831 myFile = (*it); 836 myFile = (*it);
832 if( myFile.find(" -> ",0,TRUE) != -1) 837 if( myFile.find(" -> ",0,TRUE) != -1)
833 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 838 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
834 839
835 QString f = currentDir.canonicalPath(); 840 QString f = currentDir.canonicalPath();
836 if(f.right(1).find("/",0,TRUE) == -1) 841 if(f.right(1).find("/",0,TRUE) == -1)
837 f+="/"; 842 f+="/";
838 f+=myFile; 843 f+=myFile;
839 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 844 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
840 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 845 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
841 "\nand all it's contents ?" 846 "\nand all it's contents ?"
842 ,tr("Yes"),tr("No"),0,0,1) ) { 847 ,tr("Yes"),tr("No"),0,0,1) ) {
843 case 0: { 848 case 0: {
844 f=f.left(f.length()-1); 849 f=f.left(f.length()-1);
845 QString cmd="rm -rf "+f; 850 QString cmd="rm -rf "+f;
846 system( cmd.latin1()); 851 system( cmd.latin1());
@@ -928,25 +933,25 @@ void AdvancedFm::localRename()
928 fileDlg->exec(); 933 fileDlg->exec();
929 if( fileDlg->result() == 1 ) { 934 if( fileDlg->result() == 1 ) {
930 QString oldname = currentDir.canonicalPath() + "/" + curFile; 935 QString oldname = currentDir.canonicalPath() + "/" + curFile;
931 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 936 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
932 if( rename(oldname.latin1(), newName.latin1())== -1) 937 if( rename(oldname.latin1(), newName.latin1())== -1)
933 QMessageBox::message(tr("Note"),tr("Could not rename")); 938 QMessageBox::message(tr("Note"),tr("Could not rename"));
934 } 939 }
935 populateLocalView(); 940 populateLocalView();
936} 941}
937 942
938void AdvancedFm::remoteRename() 943void AdvancedFm::remoteRename()
939{ 944{
940 QString curFile = Remote_View->currentItem()->text(0); 945 QString curFile = Local_View->currentItem()->text(0);
941 InputDialog *fileDlg; 946 InputDialog *fileDlg;
942 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 947 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
943 fileDlg->setInputText((const QString &)curFile); 948 fileDlg->setInputText((const QString &)curFile);
944 fileDlg->exec(); 949 fileDlg->exec();
945 if( fileDlg->result() == 1 ) { 950 if( fileDlg->result() == 1 ) {
946 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 951 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
947 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 952 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
948 if( rename(oldname.latin1(), newName.latin1())== -1) 953 if( rename(oldname.latin1(), newName.latin1())== -1)
949 QMessageBox::message(tr("Note"),tr("Could not rename")); 954 QMessageBox::message(tr("Note"),tr("Could not rename"));
950 } 955 }
951 populateRemoteView(); 956 populateRemoteView();
952} 957}
@@ -1042,32 +1047,32 @@ void AdvancedFm::filePerms() {
1042 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 1047 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
1043 filePerm->showMaximized(); 1048 filePerm->showMaximized();
1044 filePerm->exec(); 1049 filePerm->exec();
1045 if( filePerm) 1050 if( filePerm)
1046 delete filePerm; 1051 delete filePerm;
1047 } 1052 }
1048 if (TabWidget->currentPageIndex() == 0) { 1053 if (TabWidget->currentPageIndex() == 0) {
1049 populateLocalView(); 1054 populateLocalView();
1050 } else { 1055 } else {
1051 populateRemoteView(); 1056 populateRemoteView();
1052 } 1057 }
1053 1058
1054 1059
1055} 1060}
1056 1061
1057void AdvancedFm::doProperties() { 1062void AdvancedFm::doProperties() {
1058 QStringList curFileList = getPath(); 1063 QStringList curFileList = getPath();
1059 QString filePath; 1064 QString filePath;
1060 if (TabWidget->currentPageIndex() == 0) { 1065 if (TabWidget->currentPageIndex() == 0) {
1061 1066
1062 filePath = currentDir.canonicalPath()+"/"; 1067 filePath = currentDir.canonicalPath()+"/";
1063 } else { 1068 } else {
1064 filePath= currentRemoteDir.canonicalPath()+"/"; 1069 filePath= currentRemoteDir.canonicalPath()+"/";
1065 } 1070 }
1066 // qDebug("%d",curFileList.count()); 1071 // qDebug("%d",curFileList.count());
1067 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1072 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1068 qDebug((filePath+*it)); 1073 qDebug((filePath+*it));
1069 DocLnk lnk( (filePath+*it)); 1074 DocLnk lnk( (filePath+*it));
1070 LnkProperties prop( &lnk ); 1075 LnkProperties prop( &lnk );
1071// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1076// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1072 prop.showMaximized(); 1077 prop.showMaximized();
1073 prop.exec(); 1078 prop.exec();
@@ -1174,25 +1179,25 @@ void AdvancedFm::upDir()
1174 populateRemoteView(); 1179 populateRemoteView();
1175 update(); 1180 update();
1176 } 1181 }
1177} 1182}
1178 1183
1179void AdvancedFm::copy() 1184void AdvancedFm::copy()
1180{ 1185{
1181 QStringList curFileList = getPath(); 1186 QStringList curFileList = getPath();
1182 QString curFile; 1187 QString curFile;
1183 if (TabWidget->currentPageIndex() == 0) { 1188 if (TabWidget->currentPageIndex() == 0) {
1184 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1189 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1185 1190
1186 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1191 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1187// if(destFile.right(1).find("/",0,TRUE) == -1) 1192// if(destFile.right(1).find("/",0,TRUE) == -1)
1188// destFile+="/"; 1193// destFile+="/";
1189// destFile +=(*it); 1194// destFile +=(*it);
1190 1195
1191 curFile = currentDir.canonicalPath()+"/"+(*it); 1196 curFile = currentDir.canonicalPath()+"/"+(*it);
1192// if(curFile.right(1).find("/",0,TRUE) == -1) 1197// if(curFile.right(1).find("/",0,TRUE) == -1)
1193// curFile +="/"; 1198// curFile +="/";
1194// curFile +=(*it); 1199// curFile +=(*it);
1195 1200
1196 QFile f(destFile); 1201 QFile f(destFile);
1197 if( f.exists()) 1202 if( f.exists())
1198 f.remove(); 1203 f.remove();
@@ -1243,25 +1248,25 @@ void AdvancedFm::copyAs()
1243 QString filename = fileDlg->LineEdit1->text(); 1248 QString filename = fileDlg->LineEdit1->text();
1244 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1249 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1245 1250
1246 QFile f(destFile); 1251 QFile f(destFile);
1247 if( f.exists()) 1252 if( f.exists())
1248 f.remove(); 1253 f.remove();
1249 if(!copyFile(destFile, curFile) ) { 1254 if(!copyFile(destFile, curFile) ) {
1250 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1255 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1251 qWarning("nothin doing"); 1256 qWarning("nothin doing");
1252 } 1257 }
1253 } 1258 }
1254 } 1259 }
1255 1260
1256 populateRemoteView(); 1261 populateRemoteView();
1257 TabWidget->setCurrentPage(1); 1262 TabWidget->setCurrentPage(1);
1258 } else { 1263 } else {
1259 if (TabWidget->currentPageIndex() == 0) { 1264 if (TabWidget->currentPageIndex() == 0) {
1260 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1265 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1261 1266
1262 curFile = currentDir.canonicalPath()+"/"+(*it); 1267 curFile = currentDir.canonicalPath()+"/"+(*it);
1263 QString destFile; 1268 QString destFile;
1264 fileDlg->setInputText((const QString &) destFile); 1269 fileDlg->setInputText((const QString &) destFile);
1265 fileDlg->exec(); 1270 fileDlg->exec();
1266 if( fileDlg->result() == 1 ) { 1271 if( fileDlg->result() == 1 ) {
1267 QString filename = fileDlg->LineEdit1->text(); 1272 QString filename = fileDlg->LineEdit1->text();
@@ -1370,71 +1375,71 @@ void AdvancedFm::move() {
1370 return success; 1375 return success;
1371} 1376}
1372 1377
1373void AdvancedFm::runCommand() { 1378void AdvancedFm::runCommand() {
1374 QString curFile; 1379 QString curFile;
1375 if (TabWidget->currentPageIndex() == 0) { 1380 if (TabWidget->currentPageIndex() == 0) {
1376 if( Local_View->currentItem()) 1381 if( Local_View->currentItem())
1377 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1382 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1378 } else { 1383 } else {
1379 if(Remote_View->currentItem()) 1384 if(Remote_View->currentItem())
1380 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 1385 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1381 } 1386 }
1382 1387
1383 InputDialog *fileDlg; 1388 InputDialog *fileDlg;
1384 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1389 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1385 fileDlg->setInputText(curFile); 1390 fileDlg->setInputText(curFile);
1386 fileDlg->exec(); 1391 fileDlg->exec();
1387 QString command; 1392 QString command;
1388 if( fileDlg->result() == 1 ) { 1393 if( fileDlg->result() == 1 ) {
1389 command = fileDlg->LineEdit1->text(); 1394 command = fileDlg->LineEdit1->text();
1390 1395
1391// int err=0; 1396// int err=0;
1392 Output *outDlg; 1397 Output *outDlg;
1393 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1398 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1394 outDlg->showMaximized(); 1399 outDlg->showMaximized();
1395 outDlg->show(); 1400 outDlg->show();
1396 qApp->processEvents(); 1401 qApp->processEvents();
1397 FILE *fp; 1402 FILE *fp;
1398 char line[130]; 1403 char line[130];
1399 sleep(1); 1404 sleep(1);
1400// if(command.find("2>",0,TRUE) != -1) 1405// if(command.find("2>",0,TRUE) != -1)
1401 command +=" 2>&1"; 1406 command +=" 2>&1";
1402 fp = popen( (const char *) command, "r"); 1407 fp = popen( (const char *) command, "r");
1403 if ( !fp ) { 1408 if ( !fp ) {
1404 qDebug("Could not execute '" + command + "'! err=%d", fp); 1409 qDebug("Could not execute '" + command + "'! err=%d", fp);
1405 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1410 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1406 pclose(fp); 1411 pclose(fp);
1407 return; 1412 return;
1408 } else { 1413 } else {
1409 while ( fgets( line, sizeof line, fp)) { 1414 while ( fgets( line, sizeof line, fp)) {
1410 QString lineStr = line; 1415 QString lineStr = line;
1411 lineStr=lineStr.left(lineStr.length()-1); 1416 lineStr=lineStr.left(lineStr.length()-1);
1412 outDlg->OutputEdit->append(lineStr); 1417 outDlg->OutputEdit->append(lineStr);
1413 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1418 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1414 } 1419 }
1415 } 1420 }
1416 } 1421 }
1417} 1422}
1418 1423
1419void AdvancedFm::runCommandStd() { 1424void AdvancedFm::runCommandStd() {
1420 QString curFile; 1425 QString curFile;
1421 if (TabWidget->currentPageIndex() == 0) { 1426 if (TabWidget->currentPageIndex() == 0) {
1422 if( Local_View->currentItem()) 1427 if( Local_View->currentItem())
1423 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1428 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1424 } else { 1429 } else {
1425 if(Remote_View->currentItem()) 1430 if(Remote_View->currentItem())
1426 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); 1431 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0);
1427 } 1432 }
1428 1433
1429 InputDialog *fileDlg; 1434 InputDialog *fileDlg;
1430 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1435 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1431 fileDlg->setInputText(curFile); 1436 fileDlg->setInputText(curFile);
1432 fileDlg->exec(); 1437 fileDlg->exec();
1433 QString command; 1438 QString command;
1434 if( fileDlg->result() == 1 ) { 1439 if( fileDlg->result() == 1 ) {
1435 qApp->processEvents(); 1440 qApp->processEvents();
1436 command = fileDlg->LineEdit1->text() + " &"; 1441 command = fileDlg->LineEdit1->text() + " &";
1437 system(command.latin1()); 1442 system(command.latin1());
1438 } 1443 }
1439} 1444}
1440 1445
@@ -1446,46 +1451,46 @@ void AdvancedFm::fileStatus() {
1446 curFile = Remote_View->currentItem()->text(0); 1451 curFile = Remote_View->currentItem()->text(0);
1447 } 1452 }
1448 QString command = " stat -l "+ curFile +" 2>&1"; 1453 QString command = " stat -l "+ curFile +" 2>&1";
1449// int err=0; 1454// int err=0;
1450 Output *outDlg; 1455 Output *outDlg;
1451 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1456 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1452 outDlg->showMaximized(); 1457 outDlg->showMaximized();
1453 outDlg->show(); 1458 outDlg->show();
1454 qApp->processEvents(); 1459 qApp->processEvents();
1455 FILE *fp; 1460 FILE *fp;
1456 char line[130]; 1461 char line[130];
1457 sleep(1); 1462 sleep(1);
1458 fp = popen( (const char *) command, "r"); 1463 fp = popen( (const char *) command, "r");
1459 if ( !fp ) { 1464 if ( !fp ) {
1460 qDebug("Could not execute '" + command + "'! err=%d", fp); 1465 qDebug("Could not execute '" + command + "'! err=%d", fp);
1461 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1466 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1462 pclose(fp); 1467 pclose(fp);
1463 return; 1468 return;
1464 } else { 1469 } else {
1465 while ( fgets( line, sizeof line, fp)) { 1470 while ( fgets( line, sizeof line, fp)) {
1466 outDlg->OutputEdit->append(line); 1471 outDlg->OutputEdit->append(line);
1467 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1472 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1468 1473
1469 } 1474 }
1470 1475
1471 } 1476 }
1472} 1477}
1473 1478
1474void AdvancedFm::mkDir() { 1479void AdvancedFm::mkDir() {
1475 if (TabWidget->currentPageIndex() == 0) 1480 if (TabWidget->currentPageIndex() == 0)
1476 localMakDir(); 1481 localMakDir();
1477 else 1482 else
1478 remoteMakDir(); 1483 remoteMakDir();
1479 1484
1480} 1485}
1481 1486
1482void AdvancedFm::rn() { 1487void AdvancedFm::rn() {
1483 if (TabWidget->currentPageIndex() == 0) 1488 if (TabWidget->currentPageIndex() == 0)
1484 localRename(); 1489 localRename();
1485 else 1490 else
1486 remoteRename(); 1491 remoteRename();
1487 1492
1488} 1493}
1489 1494
1490void AdvancedFm::del() { 1495void AdvancedFm::del() {
1491 if (TabWidget->currentPageIndex() == 0) 1496 if (TabWidget->currentPageIndex() == 0)
@@ -1539,39 +1544,39 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1539 break; 1544 break;
1540 case Key_1: 1545 case Key_1:
1541 switchToLocalTab(); 1546 switchToLocalTab();
1542 break; 1547 break;
1543 case Key_2: 1548 case Key_2:
1544 switchToRemoteTab(); 1549 switchToRemoteTab();
1545 break; 1550 break;
1546 case Key_3: 1551 case Key_3:
1547 CFButtonPushed(); 1552 CFButtonPushed();
1548 break; 1553 break;
1549 case Key_4: 1554 case Key_4:
1550 SDButtonPushed(); 1555 SDButtonPushed();
1551 break; 1556 break;
1552 case Key_5: 1557 case Key_5:
1553 homeButtonPushed(); 1558 homeButtonPushed();
1554 break; 1559 break;
1555 case Key_6: 1560 case Key_6:
1556 docButtonPushed(); 1561 docButtonPushed();
1557 break; 1562 break;
1558 case Key_7: 1563 case Key_7:
1559 break; 1564 break;
1560 case Key_8: 1565 case Key_8:
1561 break; 1566 break;
1562 case Key_9: 1567 case Key_9:
1563 break; 1568 break;
1564 case Key_0: 1569 case Key_0:
1565 break; 1570 break;
1566 } 1571 }
1567} 1572}
1568 1573
1569void AdvancedFm::mkSym() { 1574void AdvancedFm::mkSym() {
1570 QString cmd; 1575 QString cmd;
1571 QStringList curFileList = getPath(); 1576 QStringList curFileList = getPath();
1572 1577
1573 if (TabWidget->currentPageIndex() == 0) { 1578 if (TabWidget->currentPageIndex() == 0) {
1574 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1579 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1575 1580
1576 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1581 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1577 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1582 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
@@ -1648,21 +1653,58 @@ QString AdvancedFm::getFileSystemType(const QString &currentText) {
1648 QString temp = (*it); 1653 QString temp = (*it);
1649 QString path = temp.left(temp.find("::",0,TRUE) ); 1654 QString path = temp.left(temp.find("::",0,TRUE) );
1650 path = path.right( path.length()-1); 1655 path = path.right( path.length()-1);
1651 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1656 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1652 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1657 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1653 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1658 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1654 } 1659 }
1655 } 1660 }
1656 return baseFs; 1661 return baseFs;
1657} 1662}
1658 1663
1659 1664
1665void AdvancedFm::doBeam() {
1666 Ir ir;
1667 if(!ir.supported()){
1668 } else {
1669
1670 QStringList curFileList = getPath();
1671
1672 if (TabWidget->currentPageIndex() == 0) {
1673 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1674
1675 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1676 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1677 Ir *file = new Ir(this, "IR");
1678 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1679 file->send( curFile, curFile );
1680 }
1681
1682 } else {
1683 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1684
1685 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1686 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1687 Ir *file = new Ir(this, "IR");
1688 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1689 file->send( curFile, curFile );
1690
1691 }
1692 }
1693 }
1694}
1695
1696void AdvancedFm::fileBeamFinished( Ir *ir) {
1697 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1698
1699}
1700
1701
1660// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1702// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1661// QListViewItemIterator it( Local_View ); 1703// QListViewItemIterator it( Local_View );
1662// for ( ; it.current(); ++it ) { 1704// for ( ; it.current(); ++it ) {
1663// if ( it.current()->isSelected() ) { 1705// if ( it.current()->isSelected() ) {
1664// QString strItem = it.current()->text(0); 1706// QString strItem = it.current()->text(0);
1665// QString localFile = currentDir.canonicalPath()+"/"+strItem; 1707// QString localFile = currentDir.canonicalPath()+"/"+strItem;
1666// QFileInfo fi(localFile); 1708// QFileInfo fi(localFile);
1667// } 1709// }
1668// } 1710// }
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 90619ba..5817fca 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -10,24 +10,25 @@
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14 14
15#include <qvariant.h> 15#include <qvariant.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qdir.h> 18#include <qdir.h>
19#include <qstring.h> 19#include <qstring.h>
20#include <qpoint.h> 20#include <qpoint.h>
21#include <qstringlist.h> 21#include <qstringlist.h>
22#include <qpe/ir.h>
22 23
23class QVBoxLayout; 24class QVBoxLayout;
24class QHBoxLayout; 25class QHBoxLayout;
25class QGridLayout; 26class QGridLayout;
26class QComboBox; 27class QComboBox;
27class QListView; 28class QListView;
28class QListviewItem; 29class QListviewItem;
29class QLabel; 30class QLabel;
30class QProgressBar; 31class QProgressBar;
31class QSpinBox; 32class QSpinBox;
32class QTabWidget; 33class QTabWidget;
33class QWidget; 34class QWidget;
@@ -114,15 +115,17 @@ protected slots:
114 void CFButtonPushed(); 115 void CFButtonPushed();
115 void QPEButtonPushed(); 116 void QPEButtonPushed();
116 void upDir(); 117 void upDir();
117 void currentPathComboChanged(); 118 void currentPathComboChanged();
118 void copy(); 119 void copy();
119 void copyAs(); 120 void copyAs();
120 void currentPathComboActivated(const QString &); 121 void currentPathComboActivated(const QString &);
121 void fillCombo(const QString &); 122 void fillCombo(const QString &);
122 bool copyFile( const QString & , const QString & ); 123 bool copyFile( const QString & , const QString & );
123 void move(); 124 void move();
124 void fileStatus(); 125 void fileStatus();
125 void doAbout(); 126 void doAbout();
127 void doBeam();
128 void fileBeamFinished( Ir *ir);
126}; 129};
127 130
128#endif // ADVANCEDFM_H 131#endif // ADVANCEDFM_H