summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-26 01:49:06 (UTC)
committer llornkcor <llornkcor>2004-09-26 01:49:06 (UTC)
commit358c159e5d4f28eedfbd8e539e4420324c565eba (patch) (unidiff)
tree59a1280ed80b8b2ebdcf38b90ead208bfd18b628
parentff6c55833c0cba33469f668ca158e96b409b4967 (diff)
downloadopie-358c159e5d4f28eedfbd8e539e4420324c565eba.zip
opie-358c159e5d4f28eedfbd8e539e4420324c565eba.tar.gz
opie-358c159e5d4f28eedfbd8e539e4420324c565eba.tar.bz2
fix view menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 0dc822d..9aa0c77 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -27,111 +27,111 @@
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qlistview.h> 28#include <qlistview.h>
29#include <qmessagebox.h> 29#include <qmessagebox.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31 31
32 32
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <time.h> 34#include <time.h>
35#include <dirent.h> 35#include <dirent.h>
36#include <fcntl.h> 36#include <fcntl.h>
37#include <sys/vfs.h> 37#include <sys/vfs.h>
38#include <mntent.h> 38#include <mntent.h>
39 39
40using namespace Opie::Ui; 40using namespace Opie::Ui;
41 41
42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 42AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
43 : QMainWindow( ) { 43 : QMainWindow( ) {
44 init(); 44 init();
45 renameBox = 0; 45 renameBox = 0;
46 whichTab = 1; 46 whichTab = 1;
47 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); 47 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
48 48
49 initConnections(); 49 initConnections();
50 rePopulate(); 50 rePopulate();
51 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 51 channel = new QCopChannel( "QPE/Application/advancedfm", this );
52 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&)));
53 switchToLocalTab(); 53 switchToLocalTab();
54} 54}
55 55
56AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
57} 57}
58 58
59 59
60void AdvancedFm::cleanUp() { 60void AdvancedFm::cleanUp() {
61 QString sfile=QDir::homeDirPath(); 61 QString sfile=QDir::homeDirPath();
62 if(sfile.right(1) != "/") 62 if(sfile.right(1) != "/")
63 sfile+="/._temp"; 63 sfile+="/._temp";
64 else 64 else
65 sfile+="._temp"; 65 sfile+="._temp";
66 QFile file( sfile); 66 QFile file( sfile);
67 if(file.exists()) 67 if(file.exists())
68 file.remove(); 68 file.remove();
69} 69}
70 70
71void AdvancedFm::tabChanged(QWidget *wd) { 71void AdvancedFm::tabChanged(QWidget *wd) {
72 // qDebug("tabChanged"); 72 // qDebug("tabChanged");
73 if(wd == tab) { 73 if(wd == tab) {
74 whichTab = 1; 74 whichTab = 1;
75 viewMenu->setItemChecked(viewMenu->idAt(0), true);
76 viewMenu->setItemChecked(viewMenu->idAt(1), false);
75 // qDebug("tabchanged: LOCAL VIEW SHOWN"); 77 // qDebug("tabchanged: LOCAL VIEW SHOWN");
76 } 78 }
77 else if(wd == tab_2) { 79 else if(wd == tab_2) {
78 whichTab = 2; 80 whichTab = 2;
81 viewMenu->setItemChecked(viewMenu->idAt(0), false);
82 viewMenu->setItemChecked(viewMenu->idAt(1), true);
79 // qDebug("tabchanged: REMOTE VIEW SHOWN"); 83 // qDebug("tabchanged: REMOTE VIEW SHOWN");
80 } 84 }
81 qApp->processEvents(); 85 qApp->processEvents();
82 QString path = CurrentDir()->canonicalPath(); 86 QString path = CurrentDir()->canonicalPath();
83 // qDebug(path); 87 // qDebug(path);
84 if ( TabWidget->currentWidget() == tab) { 88 if ( TabWidget->currentWidget() == tab) {
85 viewMenu->setItemChecked(viewMenu->idAt(0), true);
86 viewMenu->setItemChecked(viewMenu->idAt(1), false);
87 } else { 89 } else {
88 viewMenu->setItemChecked(viewMenu->idAt(0), false);
89 viewMenu->setItemChecked(viewMenu->idAt(1), true);
90 } 90 }
91 91
92 chdir( path.latin1()); 92 chdir( path.latin1());
93 currentPathCombo->lineEdit()->setText(path); 93 currentPathCombo->lineEdit()->setText(path);
94} 94}
95 95
96 96
97void AdvancedFm::populateView() { 97void AdvancedFm::populateView() {
98 98
99 QPixmap pm; 99 QPixmap pm;
100 QListView *thisView = CurrentView(); 100 QListView *thisView = CurrentView();
101 QDir *thisDir = CurrentDir(); 101 QDir *thisDir = CurrentDir();
102 QString path = thisDir->canonicalPath(); 102 QString path = thisDir->canonicalPath();
103 103
104 thisView->clear(); 104 thisView->clear();
105 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 105 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
106 thisDir->setMatchAllDirs(TRUE); 106 thisDir->setMatchAllDirs(TRUE);
107 thisDir->setNameFilter(filterStr); 107 thisDir->setNameFilter(filterStr);
108 QString fileL, fileS, fileDate; 108 QString fileL, fileS, fileDate;
109 109
110 QString fs = getFileSystemType((const QString &) path); 110 QString fs = getFileSystemType((const QString &) path);
111 setCaption(tr("AdvancedFm :: ")+fs+" :: " 111 setCaption(tr("AdvancedFm :: ")+fs+" :: "
112 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 112 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
113 bool isDir = FALSE; 113 bool isDir = FALSE;
114 114
115 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 115 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
116 QFileInfoListIterator it(*list); 116 QFileInfoListIterator it(*list);
117 QFileInfo *fi; 117 QFileInfo *fi;
118 while ( (fi=it.current()) ) { 118 while ( (fi=it.current()) ) {
119 if (fi->isSymLink() ) { 119 if (fi->isSymLink() ) {
120 QString symLink = fi->readLink(); 120 QString symLink = fi->readLink();
121 QFileInfo sym( symLink); 121 QFileInfo sym( symLink);
122 fileS.sprintf( "%10i", sym.size() ); 122 fileS.sprintf( "%10i", sym.size() );
123 fileL = fi->fileName() +" -> " + sym.filePath().data(); 123 fileL = fi->fileName() +" -> " + sym.filePath().data();
124 fileDate = sym.lastModified().toString(); 124 fileDate = sym.lastModified().toString();
125 } else { 125 } else {
126 fileS.sprintf( "%10i", fi->size() ); 126 fileS.sprintf( "%10i", fi->size() );
127 fileL = fi->fileName(); 127 fileL = fi->fileName();
128 fileDate= fi->lastModified().toString(); 128 fileDate= fi->lastModified().toString();
129 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 129 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
130// if(fileL == "..") 130// if(fileL == "..")
131 fileL += "/"; 131 fileL += "/";
132 isDir=TRUE; 132 isDir=TRUE;
133 } 133 }
134 } 134 }
135 QFileInfo fileInfo( path + "/" + fileL); 135 QFileInfo fileInfo( path + "/" + fileL);
136 136
137 if(fileL !="./" && fi->exists()) { 137 if(fileL !="./" && fi->exists()) {
@@ -320,97 +320,97 @@ QStringList AdvancedFm::getPath() {
320 } 320 }
321 return strList; 321 return strList;
322} 322}
323 323
324void AdvancedFm::changeTo(const QString &dir) { 324void AdvancedFm::changeTo(const QString &dir) {
325 chdir( dir.latin1()); 325 chdir( dir.latin1());
326 CurrentDir()->cd(dir, TRUE); 326 CurrentDir()->cd(dir, TRUE);
327 populateView(); 327 populateView();
328 update(); 328 update();
329} 329}
330 330
331void AdvancedFm::homeButtonPushed() { 331void AdvancedFm::homeButtonPushed() {
332 changeTo(QDir::homeDirPath()); 332 changeTo(QDir::homeDirPath());
333} 333}
334 334
335void AdvancedFm::docButtonPushed() { 335void AdvancedFm::docButtonPushed() {
336 changeTo(QPEApplication::documentDir()); 336 changeTo(QPEApplication::documentDir());
337} 337}
338 338
339void AdvancedFm::SDButtonPushed() { 339void AdvancedFm::SDButtonPushed() {
340 Opie::Core::OStorageInfo info; 340 Opie::Core::OStorageInfo info;
341 changeTo(info.sdPath()); 341 changeTo(info.sdPath());
342} 342}
343 343
344void AdvancedFm::CFButtonPushed() { 344void AdvancedFm::CFButtonPushed() {
345 Opie::Core::OStorageInfo info; 345 Opie::Core::OStorageInfo info;
346 changeTo(info.cfPath()); 346 changeTo(info.cfPath());
347} 347}
348 348
349void AdvancedFm::QPEButtonPushed() { 349void AdvancedFm::QPEButtonPushed() {
350 changeTo(QPEApplication::qpeDir()); 350 changeTo(QPEApplication::qpeDir());
351} 351}
352 352
353void AdvancedFm::doAbout() { 353void AdvancedFm::doAbout() {
354 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>")); 354 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>"));
355} 355}
356 356
357void AdvancedFm::keyPressEvent( QKeyEvent *e) { 357void AdvancedFm::keyPressEvent( QKeyEvent *e) {
358 Q_UNUSED(e); 358 Q_UNUSED(e);
359} 359}
360 360
361void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 361void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
362// if( CurrentView()->hasFocus() ) 362// if( CurrentView()->hasFocus() )
363// e->ignore(); 363// e->ignore();
364 if( currentPathCombo->lineEdit()->hasFocus()) { 364 if( currentPathCombo->lineEdit()->hasFocus()) {
365 // qDebug("shout!"); 365 // qDebug("shout!");
366 } 366 }
367 367
368 else if( e->key() == Key_Left ) 368 else if( e->key() == Key_Left )
369 upDir(); 369 upDir();
370 else if( e->key() == Key_Return || e->key() == Key_Enter) 370 else if( e->key() == Key_Return || e->key() == Key_Enter)
371 navigateToSelected(); 371 navigateToSelected();
372 else if( e->key() == Key_Tab) 372 else if( e->key() == Key_Tab)
373 setOtherTabCurrent(); 373 setOtherTabCurrent();
374 else if( e->key() == Key_Delete ) 374 else if( e->key() == Key_Delete )
375 del(); 375 del();
376 else if( e->key() == Key_A) 376 else if( e->key() == Key_A)
377 copyAs(); 377 copyAs();
378 else if( e->key() == Key_C) 378 else if( e->key() == Key_C)
379 copy(); 379 copy();
380 else if( e->key() == Key_E) 380 else if( e->key() == Key_E)
381 runThis(); 381 runThis();
382 else if( e->key() == Key_G) 382 else if( e->key() == Key_G)
383 currentPathCombo->lineEdit()->setFocus(); 383 currentPathCombo->lineEdit()->setFocus();
384 else if( e->key() == Key_H ) 384 else if( e->key() == Key_H )
385 showHidden(); 385 showHidden();
386 else if( e->key() == Key_I) 386 else if( e->key() == Key_I)
387 fileStatus(); 387 fileStatus();
388 else if( e->key() == Key_M) 388 else if( e->key() == Key_M)
389 move(); 389 move();
390 else if( e->key() == Key_N ) 390 else if( e->key() == Key_N )
391 mkDir(); 391 mkDir();
392 else if( e->key() == Key_P) 392 else if( e->key() == Key_P)
393 filePerms(); 393 filePerms();
394 else if( e->key() == Key_R ) 394 else if( e->key() == Key_R )
395 rn(); 395 rn();
396 else if( e->key() == Key_U ) 396 else if( e->key() == Key_U )
397 upDir(); 397 upDir();
398 else if( e->key() == Key_1) 398 else if( e->key() == Key_1)
399 switchToLocalTab(); 399 switchToLocalTab();
400 else if( e->key() == Key_2) 400 else if( e->key() == Key_2)
401 switchToRemoteTab(); 401 switchToRemoteTab();
402 else if( e->key() == Key_3) 402 else if( e->key() == Key_3)
403 CFButtonPushed(); 403 CFButtonPushed();
404 else if( e->key() == Key_4) 404 else if( e->key() == Key_4)
405 SDButtonPushed(); 405 SDButtonPushed();
406 else if( e->key() == Key_5 ) 406 else if( e->key() == Key_5 )
407 homeButtonPushed(); 407 homeButtonPushed();
408 else if( e->key() == Key_6 ) 408 else if( e->key() == Key_6 )
409 docButtonPushed(); 409 docButtonPushed();
410 else 410 else
411 e->accept(); 411 e->accept();
412} 412}
413 413
414 414
415void AdvancedFm::parsetab(const QString &fileName) { 415void AdvancedFm::parsetab(const QString &fileName) {
416 416