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
@@ -79,45 +79,51 @@ AdvancedFm::AdvancedFm( )
79 fileMenu = new QPopupMenu( this ); 79 fileMenu = new QPopupMenu( this );
80 viewMenu = new QPopupMenu( this ); 80 viewMenu = new QPopupMenu( this );
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);
122 fileMenu->insertSeparator(); 128 fileMenu->insertSeparator();
123 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 129 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
@@ -130,17 +136,17 @@ AdvancedFm::AdvancedFm( )
130 136
131 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 137 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
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
145 Local_View = new QListView( tab, "Local_View" ); 151 Local_View = new QListView( tab, "Local_View" );
146// Local_View->setResizePolicy( QListView::AutoOneFit ); 152// Local_View->setResizePolicy( QListView::AutoOneFit );
@@ -208,28 +214,28 @@ AdvancedFm::AdvancedFm( )
208 currentDir.setPath( QDir::currentDirPath()); 214 currentDir.setPath( QDir::currentDirPath());
209 215
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}
234 240
235AdvancedFm::~AdvancedFm() 241AdvancedFm::~AdvancedFm()
@@ -301,26 +307,32 @@ void AdvancedFm::populateLocalView()
301 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 307 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
302 fileL+="/"; 308 fileL+="/";
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);
325 } 337 }
326 } 338 }
@@ -418,19 +430,24 @@ void AdvancedFm::populateRemoteView()
418 430
419 if(isDir || fileL.find("/",0,TRUE) != -1) { 431 if(isDir || fileL.find("/",0,TRUE) != -1) {
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 }
435 } 452 }
436 if( fileL.find("->",0,TRUE) != -1) { 453 if( fileL.find("->",0,TRUE) != -1) {
@@ -693,34 +710,46 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item)
693 m.exec( QCursor::pos() ); 710 m.exec( QCursor::pos() );
694 } 711 }
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() {
725 if (TabWidget->currentPageIndex() == 0) { 754 if (TabWidget->currentPageIndex() == 0) {
726 QString curFile = Local_View->currentItem()->text(0); 755 QString curFile = Local_View->currentItem()->text(0);
@@ -1473,8 +1502,22 @@ void AdvancedFm::mkSym() {
1473 if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); 1502 if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1);
1474 QString destName = currentDir.canonicalPath()+"/"+curFile; 1503 QString destName = currentDir.canonicalPath()+"/"+curFile;
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
@@ -47,17 +47,17 @@ public:
47 ~AdvancedFm(); 47 ~AdvancedFm();
48 48
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;
62protected slots: 62protected slots:
63 void showLocalMenu( QListViewItem *); 63 void showLocalMenu( QListViewItem *);
@@ -103,16 +103,17 @@ protected:
103 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 103 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
104 QStringList remoteDirPathStringList, localDirPathStringList; 104 QStringList remoteDirPathStringList, localDirPathStringList;
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 &);
117 bool copyFile( const QString & , const QString & ); 118 bool copyFile( const QString & , const QString & );
118 void move(); 119 void move();