summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp41
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp2
3 files changed, 7 insertions, 37 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ec7a08a..f1be471 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,63 +1,66 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <opie2/odebug.h> 15#include <opie2/odebug.h>
16
17#include <opie2/ostorageinfo.h>
18
16#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
17#include <qpe/config.h> 20#include <qpe/config.h>
18#include <qpe/mimetype.h> 21#include <qpe/mimetype.h>
19#include <qpe/applnk.h> 22#include <qpe/applnk.h>
20#include <qpe/resource.h> 23#include <qpe/resource.h>
21#include <qpe/menubutton.h> 24#include <qpe/menubutton.h>
22 25
23#include <qcombobox.h> 26#include <qcombobox.h>
24#include <qpopupmenu.h> 27#include <qpopupmenu.h>
25#include <qlistview.h> 28#include <qlistview.h>
26#include <qmessagebox.h> 29#include <qmessagebox.h>
27#include <qlineedit.h> 30#include <qlineedit.h>
28 31
29 32
30#include <sys/stat.h> 33#include <sys/stat.h>
31#include <time.h> 34#include <time.h>
32#include <dirent.h> 35#include <dirent.h>
33#include <fcntl.h> 36#include <fcntl.h>
34#include <sys/vfs.h> 37#include <sys/vfs.h>
35#include <mntent.h> 38#include <mntent.h>
36 39
37using namespace Opie::Ui; 40using namespace Opie::Ui;
38 41
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
40 : QMainWindow( ) { 43 : QMainWindow( ) {
41 init(); 44 init();
42 renameBox = 0; 45 renameBox = 0;
43 46
44 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); 47 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
45 48
46 initConnections(); 49 initConnections();
47 rePopulate(); 50 rePopulate();
48 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 51 channel = new QCopChannel( "QPE/Application/advancedfm", this );
49 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); 52 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
50 switchToLocalTab(); 53 switchToLocalTab();
51} 54}
52 55
53AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
54} 57}
55 58
56 59
57void AdvancedFm::cleanUp() { 60void AdvancedFm::cleanUp() {
58 QString sfile=QDir::homeDirPath(); 61 QString sfile=QDir::homeDirPath();
59 if(sfile.right(1) != "/") 62 if(sfile.right(1) != "/")
60 sfile+="/._temp"; 63 sfile+="/._temp";
61 else 64 else
62 sfile+="._temp"; 65 sfile+="._temp";
63 QFile file( sfile); 66 QFile file( sfile);
@@ -165,246 +168,229 @@ void AdvancedFm::populateView() {
165 // odebug << " overlay link image" << oendl; 168 // odebug << " overlay link image" << oendl;
166 pm= Resource::loadPixmap( "advancedfm/symlink" ); 169 pm= Resource::loadPixmap( "advancedfm/symlink" );
167 // pm= Resource::loadPixmap( "folder" ); 170 // pm= Resource::loadPixmap( "folder" );
168// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 171// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
169// QPainter painter( &pm ); 172// QPainter painter( &pm );
170// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 173// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
171// pm.setMask( pm.createHeuristicMask( FALSE ) ); 174// pm.setMask( pm.createHeuristicMask( FALSE ) );
172 } 175 }
173 item->setPixmap( 0,pm); 176 item->setPixmap( 0,pm);
174 177
175 } 178 }
176 isDir=FALSE; 179 isDir=FALSE;
177 ++it; 180 ++it;
178 } 181 }
179 182
180 if( path.find("dev",0,TRUE) != -1) { 183 if( path.find("dev",0,TRUE) != -1) {
181 struct stat buf; 184 struct stat buf;
182 dev_t devT; 185 dev_t devT;
183 DIR *dir; 186 DIR *dir;
184 struct dirent *mydirent; 187 struct dirent *mydirent;
185 188
186 if((dir = opendir( path.latin1())) != NULL) 189 if((dir = opendir( path.latin1())) != NULL)
187 while ((mydirent = readdir(dir)) != NULL) { 190 while ((mydirent = readdir(dir)) != NULL) {
188 lstat( mydirent->d_name, &buf); 191 lstat( mydirent->d_name, &buf);
189// odebug << mydirent->d_name << oendl; 192// odebug << mydirent->d_name << oendl;
190 fileL.sprintf("%s", mydirent->d_name); 193 fileL.sprintf("%s", mydirent->d_name);
191 devT = buf.st_dev; 194 devT = buf.st_dev;
192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 195 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
193 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 196 fileDate.sprintf("%s", ctime( &buf.st_mtime));
194 if( fileL.find(".") == -1 ) { 197 if( fileL.find(".") == -1 ) {
195 item= new QListViewItem( thisView, fileL, fileS, fileDate); 198 item= new QListViewItem( thisView, fileL, fileS, fileDate);
196 pm = unknownXpm; 199 pm = unknownXpm;
197 item->setPixmap( 0,pm); 200 item->setPixmap( 0,pm);
198 } 201 }
199 } 202 }
200 203
201 closedir(dir); 204 closedir(dir);
202 } 205 }
203 206
204 thisView->setSorting( 3,FALSE); 207 thisView->setSorting( 3,FALSE);
205 fillCombo( (const QString &) path ); 208 fillCombo( (const QString &) path );
206} 209}
207 210
208void AdvancedFm::rePopulate() { 211void AdvancedFm::rePopulate() {
209 // qDebug("repopulate views"); 212 // qDebug("repopulate views");
210 populateView(); 213 populateView();
211 setOtherTabCurrent(); 214 setOtherTabCurrent();
212 populateView(); 215 populateView();
213
214// int tmpTab = whichTab;
215// // odebug << "" << tmpTab << "" << oendl;
216
217// for(int i =1; i < 3; i++) {
218// TabWidget->setCurrentWidget(i - 1);
219// populateView();
220// }
221// TabWidget->setCurrentWidget( tmpTab - 1);
222} 216}
223 217
224void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 218void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
225 // if ( TabWidget->currentWidget() == tab)
226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
227 // else
228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
229
230
231 if(selectedItem) { 219 if(selectedItem) {
232 QString strItem=selectedItem->text(0); 220 QString strItem=selectedItem->text(0);
233// owarn << strItem << oendl; 221// owarn << strItem << oendl;
234 QString strSize=selectedItem->text(1); 222 QString strSize=selectedItem->text(1);
235 strSize=strSize.stripWhiteSpace(); 223 strSize=strSize.stripWhiteSpace();
236 bool isDirectory = false; 224 bool isDirectory = false;
237 QString strItem2; 225 QString strItem2;
238 226
239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 227 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
240 strItem2 = dealWithSymName((const QString&)strItem); 228 strItem2 = dealWithSymName((const QString&)strItem);
241 if(QDir(strItem2).exists() ) 229 if(QDir(strItem2).exists() )
242 strItem = strItem2; 230 strItem = strItem2;
243 } 231 }
244 232
245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 233 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
246 234
247 if(QDir(strItem).exists()) 235 if(QDir(strItem).exists())
248 isDirectory = true; 236 isDirectory = true;
249 } 237 }
250 238
251 if( isDirectory ) { 239 if( isDirectory ) {
252 CurrentDir()->cd( strItem, TRUE); 240 CurrentDir()->cd( strItem, TRUE);
253 populateView(); 241 populateView();
254 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 242 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
255 } 243 }
256 chdir( strItem.latin1()); 244 chdir( strItem.latin1());
257 } 245 }
258} 246}
259 247
260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 248void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
261 Q_UNUSED(item); 249 Q_UNUSED(item);
262 switch (mouse) { 250 switch (mouse) {
263 case 1: 251 case 1:
264 { 252 {
265 if(renameBox != 0 ) { 253 if(renameBox != 0 ) {
266 cancelRename(); 254 cancelRename();
267 } 255 }
268 } 256 }
269 break; 257 break;
270// case 2: 258// case 2:
271// menuTimer.start( 50, TRUE ); 259// menuTimer.start( 50, TRUE );
272// break; 260// break;
273 }; 261 };
274} 262}
275 263
276 264
277void AdvancedFm::refreshCurrentTab() { 265void AdvancedFm::refreshCurrentTab() {
278 populateView(); 266 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 267 // if ( TabWidget->currentWidget() == tab) {
280
281} 268}
282 269
283void AdvancedFm::switchToLocalTab() { 270void AdvancedFm::switchToLocalTab() {
284 TabWidget->setCurrentWidget(0); 271 TabWidget->setCurrentWidget(0);
285 // Local_View->setFocus(); 272 // Local_View->setFocus();
286 whichTab = 1; 273 whichTab = 1;
287} 274}
288 275
289void AdvancedFm::switchToRemoteTab() { 276void AdvancedFm::switchToRemoteTab() {
290 TabWidget->setCurrentWidget(1); 277 TabWidget->setCurrentWidget(1);
291 // Remote_View->setFocus(); 278 // Remote_View->setFocus();
292 whichTab = 2; 279 whichTab = 2;
293} 280}
294 281
295void AdvancedFm::currentPathComboChanged() { 282void AdvancedFm::currentPathComboChanged() {
296 QString pDir = currentPathCombo->lineEdit()->text(); 283 QString pDir = currentPathCombo->lineEdit()->text();
297 if(QDir(pDir).exists()) { 284 if(QDir(pDir).exists()) {
298 CurrentDir()->setPath(pDir ); 285 CurrentDir()->setPath(pDir );
299 populateView(); 286 populateView();
300 } else { 287 } else {
301 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); 288 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
302 } 289 }
303} 290}
304 291
305void AdvancedFm::fillCombo(const QString &currentPath) { 292void AdvancedFm::fillCombo(const QString &currentPath) {
306 293
307 if ( TabWidget->currentWidget() == tab) { 294 if ( TabWidget->currentWidget() == tab) {
308// if ( whichTab == 1) { 295// if ( whichTab == 1) {
309 currentPathCombo->lineEdit()->setText( currentPath); 296 currentPathCombo->lineEdit()->setText( currentPath);
310 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 297 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
311 currentPathCombo->clear(); 298 currentPathCombo->clear();
312 localDirPathStringList.prepend( currentPath ); 299 localDirPathStringList.prepend( currentPath );
313 currentPathCombo->insertStringList( localDirPathStringList,-1); 300 currentPathCombo->insertStringList( localDirPathStringList,-1);
314 } 301 }
315 } else { 302 } else {
316 currentPathCombo->lineEdit()->setText( currentPath); 303 currentPathCombo->lineEdit()->setText( currentPath);
317 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 304 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
318 currentPathCombo->clear(); 305 currentPathCombo->clear();
319 remoteDirPathStringList.prepend( currentPath ); 306 remoteDirPathStringList.prepend( currentPath );
320 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 307 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
321 } 308 }
322 } 309 }
323} 310}
324 311
325QStringList AdvancedFm::getPath() { 312QStringList AdvancedFm::getPath() {
326 QStringList strList; 313 QStringList strList;
327 QListView *thisView=CurrentView(); 314 QListView *thisView=CurrentView();
328 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 315 QList<QListViewItem> * getSelectedItems( QListView * thisView );
329 QListViewItemIterator it( thisView ); 316 QListViewItemIterator it( thisView );
330 for ( ; it.current(); ++it ) { 317 for ( ; it.current(); ++it ) {
331 if ( it.current()->isSelected() ) { 318 if ( it.current()->isSelected() ) {
332 strList << it.current()->text(0); 319 strList << it.current()->text(0);
333// odebug << it.current()->text(0) << oendl; 320// odebug << it.current()->text(0) << oendl;
334 } 321 }
335 } 322 }
336 return strList; 323 return strList;
337} 324}
338 325
339void AdvancedFm::changeTo(const QString dir) { 326void AdvancedFm::changeTo(const QString dir) {
340 chdir( dir.latin1()); 327 chdir( dir.latin1());
341 CurrentDir()->cd(dir, TRUE); 328 CurrentDir()->cd(dir, TRUE);
342 populateView(); 329 populateView();
343 update(); 330 update();
344} 331}
345 332
346void AdvancedFm::homeButtonPushed() { 333void AdvancedFm::homeButtonPushed() {
347 changeTo(QDir::homeDirPath()); 334 changeTo(QDir::homeDirPath());
348} 335}
349 336
350void AdvancedFm::docButtonPushed() { 337void AdvancedFm::docButtonPushed() {
351 changeTo(QPEApplication::documentDir()); 338 changeTo(QPEApplication::documentDir());
352} 339}
353 340
354void AdvancedFm::SDButtonPushed() { 341void AdvancedFm::SDButtonPushed() {
355 changeTo("/mnt/card");// this can change so fix 342 Opie::Core::OStorageInfo info;
343 changeTo(info.sdPath());
356} 344}
357 345
358void AdvancedFm::CFButtonPushed() { 346void AdvancedFm::CFButtonPushed() {
359 if(zaurusDevice) 347 Opie::Core::OStorageInfo info;
360 changeTo("/mnt/cf"); //zaurus 348 changeTo(info.cfPath());
361 else
362 changeTo("/mnt/hda"); //ipaq
363} 349}
364 350
365void AdvancedFm::QPEButtonPushed() { 351void AdvancedFm::QPEButtonPushed() {
366 changeTo(QPEApplication::qpeDir()); 352 changeTo(QPEApplication::qpeDir());
367} 353}
368 354
369void AdvancedFm::doAbout() { 355void AdvancedFm::doAbout() {
370 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 356 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
371} 357}
372 358
373void AdvancedFm::keyPressEvent( QKeyEvent *e) { 359void AdvancedFm::keyPressEvent( QKeyEvent *e) {
374 Q_UNUSED(e); 360 Q_UNUSED(e);
375} 361}
376 362
377void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 363void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
378// if( CurrentView()->hasFocus() ) 364// if( CurrentView()->hasFocus() )
379// e->ignore(); 365// e->ignore();
380 if( currentPathCombo->lineEdit()->hasFocus()) { 366 if( currentPathCombo->lineEdit()->hasFocus()) {
381 // qDebug("shout!"); 367 // qDebug("shout!");
382 } 368 }
383 369
384 else if( e->key() == Key_Left ) 370 else if( e->key() == Key_Left )
385 upDir(); 371 upDir();
386 else if( e->key() == Key_Return || e->key() == Key_Enter) 372 else if( e->key() == Key_Return || e->key() == Key_Enter)
387 navigateToSelected(); 373 navigateToSelected();
388 else if( e->key() == Key_Tab) 374 else if( e->key() == Key_Tab)
389 setOtherTabCurrent(); 375 setOtherTabCurrent();
390 else if( e->key() == Key_Delete ) 376 else if( e->key() == Key_Delete )
391 del(); 377 del();
392 else if( e->key() == Key_A) 378 else if( e->key() == Key_A)
393 copyAs(); 379 copyAs();
394 else if( e->key() == Key_C) 380 else if( e->key() == Key_C)
395 copy(); 381 copy();
396 else if( e->key() == Key_E) 382 else if( e->key() == Key_E)
397 runThis(); 383 runThis();
398 else if( e->key() == Key_G) 384 else if( e->key() == Key_G)
399 currentPathCombo->lineEdit()->setFocus(); 385 currentPathCombo->lineEdit()->setFocus();
400 else if( e->key() == Key_H ) 386 else if( e->key() == Key_H )
401 showHidden(); 387 showHidden();
402 else if( e->key() == Key_I) 388 else if( e->key() == Key_I)
403 fileStatus(); 389 fileStatus();
404 else if( e->key() == Key_M) 390 else if( e->key() == Key_M)
405 move(); 391 move();
406 else if( e->key() == Key_N ) 392 else if( e->key() == Key_N )
407 mkDir(); 393 mkDir();
408 else if( e->key() == Key_P) 394 else if( e->key() == Key_P)
409 filePerms(); 395 filePerms();
410 else if( e->key() == Key_R ) 396 else if( e->key() == Key_R )
@@ -725,74 +711,61 @@ QDir *AdvancedFm::OtherDir() {
725 } else { 711 } else {
726 return &currentDir; 712 return &currentDir;
727 } 713 }
728} 714}
729 715
730QListView * AdvancedFm::CurrentView() { 716QListView * AdvancedFm::CurrentView() {
731 // if ( TabWidget->currentWidget() == tab) { 717 // if ( TabWidget->currentWidget() == tab) {
732 if ( whichTab == 1) { 718 if ( whichTab == 1) {
733 // qDebug("CurrentView: local"); 719 // qDebug("CurrentView: local");
734 return Local_View; 720 return Local_View;
735 } else { 721 } else {
736// owarn << "CurrentView Tab 2" << oendl; 722// owarn << "CurrentView Tab 2" << oendl;
737 // qDebug("CurrentView: remote"); 723 // qDebug("CurrentView: remote");
738 return Remote_View; 724 return Remote_View;
739 } 725 }
740} 726}
741 727
742QListView * AdvancedFm::OtherView() { 728QListView * AdvancedFm::OtherView() {
743 if ( whichTab == 1) 729 if ( whichTab == 1)
744 return Remote_View; 730 return Remote_View;
745 else 731 else
746 return Local_View; 732 return Local_View;
747} 733}
748 734
749void AdvancedFm::setOtherTabCurrent() { 735void AdvancedFm::setOtherTabCurrent() {
750 // qDebug("setOtherTabCurrent() %d",whichTab); 736 // qDebug("setOtherTabCurrent() %d",whichTab);
751 if ( whichTab == 1) { 737 if ( whichTab == 1) {
752 TabWidget->setCurrentWidget(1); 738 TabWidget->setCurrentWidget(1);
753 } else { 739 } else {
754 TabWidget->setCurrentWidget(0); 740 TabWidget->setCurrentWidget(0);
755 } 741 }
756// OtherView()->setFocus(); 742// OtherView()->setFocus();
757 OtherView()->setSelected( CurrentView()->firstChild(), true); 743 OtherView()->setSelected( CurrentView()->firstChild(), true);
758} 744}
759 745
760void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 746void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
761// odebug << "qcop message "+msg << oendl; 747// odebug << "qcop message "+msg << oendl;
762 QDataStream stream ( data, IO_ReadOnly ); 748 QDataStream stream ( data, IO_ReadOnly );
763 if ( msg == "openDirectory(QString)" ) { 749 if ( msg == "openDirectory(QString)" ) {
764// odebug << "received" << oendl; 750// odebug << "received" << oendl;
765 QString file; 751 QString file;
766 stream >> file; 752 stream >> file;
767 changeTo( (const QString &) file); 753 changeTo( (const QString &) file);
768 } 754 }
769} 755}
770 756
771void AdvancedFm::setDocument(const QString &file) { 757void AdvancedFm::setDocument(const QString &file) {
772 changeTo( file); 758 changeTo( file);
773
774} 759}
775 760
776 761
777void AdvancedFm::findFile(const QString &fileName) {
778 QFileInfo fi(fileName);
779 QListView *thisView = CurrentView();
780 QListViewItemIterator it( thisView );
781 for ( ; it.current(); ++it ) {
782 if(it.current()->text(0) == fi.fileName()) {
783 it.current()->setSelected(true);
784 thisView->ensureItemVisible(it.current());
785 }
786 }
787}
788
789void AdvancedFm::slotSwitchMenu(int item) { 762void AdvancedFm::slotSwitchMenu(int item) {
790 Q_UNUSED(item); 763 Q_UNUSED(item);
791 // qDebug( "Switch %d",item); 764 // qDebug( "Switch %d",item);
792 // viewMenu->setItemChecked(item, true); 765 // viewMenu->setItemChecked(item, true);
793} 766}
794 767
795void AdvancedFm::navigateToSelected() { 768void AdvancedFm::navigateToSelected() {
796 if( !CurrentView()->currentItem()) return; 769 if( !CurrentView()->currentItem()) return;
797 doDirChange(); 770 doDirChange();
798} 771}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 6f7eb96..42f3bc6 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -132,61 +132,60 @@ protected slots:
132 void switchToLocalTab(); 132 void switchToLocalTab();
133 void switchToRemoteTab(); 133 void switchToRemoteTab();
134 void refreshCurrentTab(); 134 void refreshCurrentTab();
135 135
136 void openSearch(); 136 void openSearch();
137 void dirMenuSelected(int); 137 void dirMenuSelected(int);
138 void showFileMenu(); 138 void showFileMenu();
139 void homeButtonPushed(); 139 void homeButtonPushed();
140 void docButtonPushed(); 140 void docButtonPushed();
141 void SDButtonPushed(); 141 void SDButtonPushed();
142 void CFButtonPushed(); 142 void CFButtonPushed();
143 void QPEButtonPushed(); 143 void QPEButtonPushed();
144 void upDir(); 144 void upDir();
145 void currentPathComboChanged(); 145 void currentPathComboChanged();
146 146
147 void copy(); 147 void copy();
148 void copyTimer(); 148 void copyTimer();
149 void copyAs(); 149 void copyAs();
150 void copyAsTimer(); 150 void copyAsTimer();
151 void copySameDir(); 151 void copySameDir();
152 void copySameDirTimer(); 152 void copySameDirTimer();
153 void move(); 153 void move();
154 void moveTimer(); 154 void moveTimer();
155 155
156 void fillCombo(const QString &); 156 void fillCombo(const QString &);
157 bool copyFile( const QString & , const QString & ); 157 bool copyFile( const QString & , const QString & );
158 void fileStatus(); 158 void fileStatus();
159 void doAbout(); 159 void doAbout();
160 void doBeam(); 160 void doBeam();
161 void fileBeamFinished( Ir *); 161 void fileBeamFinished( Ir *);
162 bool copyDirectory( const QString & , const QString & ); 162 bool copyDirectory( const QString & , const QString & );
163// void navigateToSelected(); 163// void navigateToSelected();
164 bool moveDirectory( const QString & , const QString & ); 164 bool moveDirectory( const QString & , const QString & );
165 165
166// void slotSwitchtoLocal(int); 166// void slotSwitchtoLocal(int);
167 167
168private: 168private:
169 MenuButton *menuButton; 169 MenuButton *menuButton;
170 QString oldName, localViewDir, remoteViewDir; 170 QString oldName, localViewDir, remoteViewDir;
171 void startProcess(const QString &); 171 void startProcess(const QString &);
172 bool eventFilter( QObject * , QEvent * ); 172 bool eventFilter( QObject * , QEvent * );
173 void cancelRename(); 173 void cancelRename();
174 void doRename(QListView *); 174 void doRename(QListView *);
175 void okRename(); 175 void okRename();
176 void customDirsToMenu(); 176 void customDirsToMenu();
177 void addCustomDir(); 177 void addCustomDir();
178 void removeCustomDir(); 178 void removeCustomDir();
179 void navigateToSelected(); 179 void navigateToSelected();
180 void findFile(const QString &);
181 180
182private slots: 181private slots:
183 void processEnded(Opie::Core::OProcess *); 182 void processEnded(Opie::Core::OProcess *);
184 void oprocessStderr(Opie::Core::OProcess *, char *, int); 183 void oprocessStderr(Opie::Core::OProcess *, char *, int);
185 void gotoCustomDir(const QString &); 184 void gotoCustomDir(const QString &);
186 void qcopReceive(const QCString&, const QByteArray&); 185 void qcopReceive(const QCString&, const QByteArray&);
187 void setDocument(const QString &); 186 void setDocument(const QString &);
188 // void doMenu(int 187 // void doMenu(int
189 188
190}; 189};
191 190
192#endif // ADVANCEDFM_H 191#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 1047c5a..9be0ceb 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -11,98 +11,96 @@
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14/* OPIE */ 14/* OPIE */
15#include <opie2/odebug.h> 15#include <opie2/odebug.h>
16#include <qpe/storage.h> 16#include <qpe/storage.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <qpe/menubutton.h> 19#include <qpe/menubutton.h>
20using namespace Opie::Core; 20using namespace Opie::Core;
21using namespace Opie::Ui; 21using namespace Opie::Ui;
22 22
23/* QT */ 23/* QT */
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qmenubar.h> 26#include <qmenubar.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qlistview.h> 30#include <qlistview.h>
31 31
32/* STD */ 32/* STD */
33#include <sys/utsname.h> 33#include <sys/utsname.h>
34 34
35void AdvancedFm::init() { 35void AdvancedFm::init() {
36 b = false; 36 b = false;
37 setCaption( tr( "AdvancedFm" ) ); 37 setCaption( tr( "AdvancedFm" ) );
38 38
39 QVBoxLayout *layout = new QVBoxLayout( this ); 39 QVBoxLayout *layout = new QVBoxLayout( this );
40 layout->setSpacing( 2); 40 layout->setSpacing( 2);
41 layout->setMargin( 0); // squeeze 41 layout->setMargin( 0); // squeeze
42 42
43 QMenuBar *menuBar = new QMenuBar(this); 43 QMenuBar *menuBar = new QMenuBar(this);
44 menuBar->setMargin( 0 ); // squeeze 44 menuBar->setMargin( 0 ); // squeeze
45 fileMenu = new QPopupMenu( this ); 45 fileMenu = new QPopupMenu( this );
46 viewMenu = new QPopupMenu( this ); 46 viewMenu = new QPopupMenu( this );
47// customDirMenu = new QPopupMenu( this ); 47// customDirMenu = new QPopupMenu( this );
48 48
49 layout->addWidget( menuBar ); 49 layout->addWidget( menuBar );
50 50
51 menuBar->insertItem( tr( "File" ), fileMenu); 51 menuBar->insertItem( tr( "File" ), fileMenu);
52 menuBar->insertItem( tr( "View" ), viewMenu); 52 menuBar->insertItem( tr( "View" ), viewMenu);
53 53
54 cdUpButton = new QToolButton( 0,"cdUpButton"); 54 cdUpButton = new QToolButton( 0,"cdUpButton");
55 cdUpButton->setPixmap(Resource::loadPixmap("up")); 55 cdUpButton->setPixmap(Resource::loadPixmap("up"));
56 cdUpButton->setAutoRaise( true ); 56 cdUpButton->setAutoRaise( true );
57 menuBar->insertItem( cdUpButton ); 57 menuBar->insertItem( cdUpButton );
58 58
59
60
61 qpeDirButton= new QToolButton( 0,"QPEButton"); 59 qpeDirButton= new QToolButton( 0,"QPEButton");
62 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 60 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
63 qpeDirButton->setAutoRaise( true ); 61 qpeDirButton->setAutoRaise( true );
64 menuBar->insertItem( qpeDirButton ); 62 menuBar->insertItem( qpeDirButton );
65 63
66 cfButton = new QToolButton( 0, "CFButton"); 64 cfButton = new QToolButton( 0, "CFButton");
67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 65 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
68 cfButton->setAutoRaise( true ); 66 cfButton->setAutoRaise( true );
69 menuBar->insertItem( cfButton ); 67 menuBar->insertItem( cfButton );
70 68
71 sdButton = new QToolButton( 0, "SDButton"); 69 sdButton = new QToolButton( 0, "SDButton");
72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 70 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
73 sdButton->setAutoRaise( true ); 71 sdButton->setAutoRaise( true );
74 menuBar->insertItem( sdButton ); 72 menuBar->insertItem( sdButton );
75 73
76 docButton = new QToolButton( 0,"docsButton"); 74 docButton = new QToolButton( 0,"docsButton");
77 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 75 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
78 docButton->setAutoRaise( true ); 76 docButton->setAutoRaise( true );
79 menuBar->insertItem( docButton ); 77 menuBar->insertItem( docButton );
80 78
81 homeButton = new QToolButton( 0, "homeButton"); 79 homeButton = new QToolButton( 0, "homeButton");
82 homeButton->setPixmap(Resource::loadPixmap("home")); 80 homeButton->setPixmap(Resource::loadPixmap("home"));
83 homeButton->setAutoRaise( true ); 81 homeButton->setAutoRaise( true );
84 menuBar->insertItem( homeButton ); 82 menuBar->insertItem( homeButton );
85 83
86 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 84 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
87 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 85 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
88 fileMenu->insertSeparator(); 86 fileMenu->insertSeparator();
89 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); 87 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
90 fileMenu->insertSeparator(); 88 fileMenu->insertSeparator();
91 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 89 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
92 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 90 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
93 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 91 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
94 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 92 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
95 fileMenu->insertSeparator(); 93 fileMenu->insertSeparator();
96 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 94 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
97 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 95 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
98 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 96 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
99 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 97 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
100 fileMenu->setCheckable(TRUE); 98 fileMenu->setCheckable(TRUE);
101 99
102 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); 100 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
103 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); 101 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
104 viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); 102 viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab()));
105// viewMenu->insertSeparator(); 103// viewMenu->insertSeparator();
106// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 104// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
107 viewMenu->setCheckable(true); 105 viewMenu->setCheckable(true);
108 viewMenu->setItemChecked( viewMenu->idAt(0), true); 106 viewMenu->setItemChecked( viewMenu->idAt(0), true);