author | llornkcor <llornkcor> | 2002-07-21 13:08:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-21 13:08:16 (UTC) |
commit | 68e2730e7e5a72bbdb5086334485d98ac8dee5c8 (patch) (unidiff) | |
tree | bd1192a9174ff4ee3e8cd349a91eb9ae499d4adc /noncore | |
parent | 81110ef9240a746a1267ac26fee3cb3e878933b1 (diff) | |
download | opie-68e2730e7e5a72bbdb5086334485d98ac8dee5c8.zip opie-68e2730e7e5a72bbdb5086334485d98ac8dee5c8.tar.gz opie-68e2730e7e5a72bbdb5086334485d98ac8dee5c8.tar.bz2 |
code cleanup
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 106 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 3 |
2 files changed, 3 insertions, 106 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index d0ccc3f..96a2d0a 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -72,80 +72,63 @@ | |||
72 | #include <errno.h> | 72 | #include <errno.h> |
73 | 73 | ||
74 | AdvancedFm::AdvancedFm( ) | 74 | AdvancedFm::AdvancedFm( ) |
75 | : QMainWindow( ) | 75 | : QMainWindow( ) |
76 | { | 76 | { |
77 | setCaption( tr( "AdvancedFm" ) ); | 77 | setCaption( tr( "AdvancedFm" ) ); |
78 | // menuTimer( this ); | ||
79 | 78 | ||
80 | QGridLayout *layout = new QGridLayout( this ); | 79 | QGridLayout *layout = new QGridLayout( this ); |
81 | layout->setSpacing( 2); | 80 | layout->setSpacing( 2); |
82 | layout->setMargin( 2); | 81 | layout->setMargin( 2); |
83 | 82 | ||
84 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
85 | 84 | ||
86 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 85 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
87 | // fileMenu = new QPopupMenu( this ); | ||
88 | fileMenu = new QPopupMenu( this ); | 86 | fileMenu = new QPopupMenu( this ); |
89 | viewMenu = new QPopupMenu( this ); | 87 | viewMenu = new QPopupMenu( this ); |
90 | 88 | ||
91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 89 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
92 | 90 | ||
93 | menuBar->insertItem( tr( "File" ), fileMenu); | 91 | menuBar->insertItem( tr( "File" ), fileMenu); |
94 | menuBar->insertItem( tr( "View" ), viewMenu); | 92 | menuBar->insertItem( tr( "View" ), viewMenu); |
95 | 93 | ||
96 | qpeDirButton= new QToolButton(this,"QPEButton"); | 94 | qpeDirButton= new QToolButton(this,"QPEButton"); |
97 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 95 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
98 | // qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton"); | ||
99 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 96 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
100 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 97 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
101 | //qpeDirButton->setFlat(TRUE); | ||
102 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 98 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
103 | 99 | ||
104 | cfButton = new QToolButton( this,"CFButton"); | 100 | cfButton = new QToolButton( this,"CFButton"); |
105 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 101 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
106 | // cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | ||
107 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 102 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
108 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 103 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
109 | //cfButton->setFlat(TRUE); | ||
110 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 104 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
111 | 105 | ||
112 | sdButton = new QToolButton( this,"SDButton"); | 106 | sdButton = new QToolButton( this,"SDButton"); |
113 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); | 107 | sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); |
114 | // sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | ||
115 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 108 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
116 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 109 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
117 | // sdButton->setFlat(TRUE); | ||
118 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 110 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
119 | 111 | ||
120 | cdUpButton = new QToolButton( this,"cdUpButton"); | 112 | cdUpButton = new QToolButton( this,"cdUpButton"); |
121 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 113 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
122 | // cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | ||
123 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 114 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
124 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 115 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
125 | //cdUpButton ->setFlat(TRUE); | ||
126 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 116 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
127 | 117 | ||
128 | docButton = new QToolButton( this,"docsButton"); | 118 | docButton = new QToolButton( this,"docsButton"); |
129 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 119 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
130 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | ||
131 | docButton->setFixedSize( QSize( 20, 20 ) ); | 120 | docButton->setFixedSize( QSize( 20, 20 ) ); |
132 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 121 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
133 | // docButton->setFlat(TRUE); | ||
134 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 122 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
135 | 123 | ||
136 | homeButton = new QToolButton( this,"homeButton"); | 124 | homeButton = new QToolButton( this,"homeButton"); |
137 | homeButton->setPixmap(Resource::loadPixmap("home")); | 125 | homeButton->setPixmap(Resource::loadPixmap("home")); |
138 | // homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | ||
139 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 126 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
140 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 127 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
141 | // homeButton->setFlat(TRUE); | ||
142 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 128 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
143 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | ||
144 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | ||
145 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | ||
146 | 129 | ||
147 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 130 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
148 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 131 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
149 | fileMenu->insertSeparator(); | 132 | fileMenu->insertSeparator(); |
150 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 133 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
151 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 134 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
@@ -184,26 +167,23 @@ AdvancedFm::AdvancedFm( ) | |||
184 | tab = new QWidget( TabWidget, "tab" ); | 167 | tab = new QWidget( TabWidget, "tab" ); |
185 | tabLayout = new QGridLayout( tab ); | 168 | tabLayout = new QGridLayout( tab ); |
186 | tabLayout->setSpacing( 2); | 169 | tabLayout->setSpacing( 2); |
187 | tabLayout->setMargin( 2); | 170 | tabLayout->setMargin( 2); |
188 | 171 | ||
189 | Local_View = new QListView( tab, "Local_View" ); | 172 | Local_View = new QListView( tab, "Local_View" ); |
190 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | ||
191 | Local_View->addColumn( tr("File"),130); | 173 | Local_View->addColumn( tr("File"),130); |
192 | Local_View->addColumn( tr("Size"),-1); | 174 | Local_View->addColumn( tr("Size"),-1); |
193 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 175 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
194 | Local_View->addColumn( tr("Date"),-1); | 176 | Local_View->addColumn( tr("Date"),-1); |
195 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 177 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
196 | Local_View->setAllColumnsShowFocus(TRUE); | 178 | Local_View->setAllColumnsShowFocus(TRUE); |
197 | Local_View->setMultiSelection( TRUE ); | 179 | Local_View->setMultiSelection( TRUE ); |
198 | Local_View->setSelectionMode(QListView::Extended); | 180 | Local_View->setSelectionMode(QListView::Extended); |
199 | 181 | ||
200 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 182 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
201 | 183 | ||
202 | |||
203 | |||
204 | tabLayout->addWidget( Local_View, 0, 0 ); | 184 | tabLayout->addWidget( Local_View, 0, 0 ); |
205 | 185 | ||
206 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 186 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
207 | this,SLOT( localListClicked(QListViewItem *)) ); | 187 | this,SLOT( localListClicked(QListViewItem *)) ); |
208 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 188 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
209 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 189 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
@@ -231,13 +211,12 @@ AdvancedFm::AdvancedFm( ) | |||
231 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 211 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
232 | 212 | ||
233 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 213 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
234 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 214 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
235 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 215 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
236 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 216 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
237 | // connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | ||
238 | 217 | ||
239 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 218 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
240 | 219 | ||
241 | 220 | ||
242 | TabWidget->insertTab( tab_2, tr( "2")); | 221 | TabWidget->insertTab( tab_2, tr( "2")); |
243 | 222 | ||
@@ -264,15 +243,12 @@ QListView *fileTree; | |||
264 | 243 | ||
265 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 244 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
266 | */ | 245 | */ |
267 | 246 | ||
268 | /////////////// | 247 | /////////////// |
269 | 248 | ||
270 | //////////////////// | ||
271 | |||
272 | |||
273 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 249 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
274 | currentDir.setPath( QDir::currentDirPath()); | 250 | currentDir.setPath( QDir::currentDirPath()); |
275 | 251 | ||
276 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 252 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
277 | currentRemoteDir.setPath( QDir::currentDirPath()); | 253 | currentRemoteDir.setPath( QDir::currentDirPath()); |
278 | 254 | ||
@@ -324,69 +300,57 @@ void AdvancedFm::populateLocalView() | |||
324 | QPixmap pm; | 300 | QPixmap pm; |
325 | Local_View->clear(); | 301 | Local_View->clear(); |
326 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 302 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
327 | currentDir.setMatchAllDirs(TRUE); | 303 | currentDir.setMatchAllDirs(TRUE); |
328 | currentDir.setNameFilter(filterStr); | 304 | currentDir.setNameFilter(filterStr); |
329 | QString fileL, fileS, fileDate; | 305 | QString fileL, fileS, fileDate; |
330 | // qDebug(currentDir.canonicalPath()); | ||
331 | // struct stat buf; | ||
332 | // mode_t mode; | ||
333 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 306 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
334 | setCaption("AdvancedFm :: "+fs); | 307 | setCaption("AdvancedFm :: "+fs); |
335 | bool isDir=FALSE; | 308 | bool isDir=FALSE; |
336 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 309 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
337 | QFileInfoListIterator it(*list); | 310 | QFileInfoListIterator it(*list); |
338 | QFileInfo *fi; | 311 | QFileInfo *fi; |
339 | while ( (fi=it.current()) ) { | 312 | while ( (fi=it.current()) ) { |
340 | if (fi->isSymLink() ) { | 313 | if (fi->isSymLink() ) { |
341 | QString symLink=fi->readLink(); | 314 | QString symLink=fi->readLink(); |
342 | // qDebug("Symlink detected "+symLink); | ||
343 | QFileInfo sym( symLink); | 315 | QFileInfo sym( symLink); |
344 | fileS.sprintf( "%10li", sym.size() ); | 316 | fileS.sprintf( "%10li", sym.size() ); |
345 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 317 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
346 | fileDate = sym.lastModified().toString(); | 318 | fileDate = sym.lastModified().toString(); |
347 | } else { | 319 | } else { |
348 | fileS.sprintf( "%10li", fi->size() ); | 320 | fileS.sprintf( "%10li", fi->size() ); |
349 | fileL.sprintf( "%s",fi->fileName().data() ); | 321 | fileL.sprintf( "%s",fi->fileName().data() ); |
350 | fileDate= fi->lastModified().toString(); | 322 | fileDate= fi->lastModified().toString(); |
351 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 323 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
352 | fileL+="/"; | 324 | fileL+="/"; |
353 | isDir=TRUE; | 325 | isDir=TRUE; |
354 | // qDebug( fileL); | ||
355 | } | 326 | } |
356 | } | 327 | } |
357 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 328 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
358 | if(fileL !="./" && fi->exists()) { | 329 | if(fileL !="./" && fi->exists()) { |
359 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 330 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
360 | 331 | ||
361 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 332 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
362 | 333 | ||
363 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 334 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
364 | pm = Resource::loadPixmap( "lockedfolder" ); | 335 | pm = Resource::loadPixmap( "lockedfolder" ); |
365 | else | 336 | else |
366 | pm= Resource::loadPixmap( "folder" ); | 337 | pm= Resource::loadPixmap( "folder" ); |
367 | // item->setPixmap( 0,pm ); | ||
368 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 338 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
369 | pm = Resource::loadPixmap( "exec"); | 339 | pm = Resource::loadPixmap( "exec"); |
370 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 340 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
371 | | fileInfo.permission( QFileInfo::ExeGroup) | 341 | | fileInfo.permission( QFileInfo::ExeGroup) |
372 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 342 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
373 | pm = Resource::loadPixmap( "exec"); | 343 | pm = Resource::loadPixmap( "exec"); |
374 | // else { //is exec | ||
375 | // pm = Resource::loadPixmap( "exec"); | ||
376 | // } | ||
377 | // // item->setPixmap( 0,pm); | ||
378 | } else if( !fi->isReadable() ) { | 344 | } else if( !fi->isReadable() ) { |
379 | pm = Resource::loadPixmap( "locked" ); | 345 | pm = Resource::loadPixmap( "locked" ); |
380 | // item->setPixmap( 0,pm); | ||
381 | } else { //everything else goes by mimetype | 346 | } else { //everything else goes by mimetype |
382 | MimeType mt(fi->filePath()); | 347 | MimeType mt(fi->filePath()); |
383 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 348 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
384 | if(pm.isNull()) | 349 | if(pm.isNull()) |
385 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 350 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
386 | // item->setPixmap( 0,pm); | ||
387 | } | 351 | } |
388 | item->setPixmap( 0,pm); | 352 | item->setPixmap( 0,pm); |
389 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 353 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
390 | // overlay link image | 354 | // overlay link image |
391 | pm= Resource::loadPixmap( "folder" ); | 355 | pm= Resource::loadPixmap( "folder" ); |
392 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 356 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
@@ -399,29 +363,22 @@ void AdvancedFm::populateLocalView() | |||
399 | isDir=FALSE; | 363 | isDir=FALSE; |
400 | ++it; | 364 | ++it; |
401 | } | 365 | } |
402 | 366 | ||
403 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 367 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
404 | struct stat buf; | 368 | struct stat buf; |
405 | // struct stat st; | ||
406 | dev_t devT; | 369 | dev_t devT; |
407 | // mode_t mode; | ||
408 | DIR *dir; | 370 | DIR *dir; |
409 | // int fd = 0; | ||
410 | struct dirent *mydirent; | 371 | struct dirent *mydirent; |
411 | // int i = 1; | ||
412 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 372 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
413 | while ((mydirent = readdir(dir)) != NULL) { | 373 | while ((mydirent = readdir(dir)) != NULL) { |
414 | lstat( mydirent->d_name, &buf); | 374 | lstat( mydirent->d_name, &buf); |
415 | qDebug(mydirent->d_name); | 375 | qDebug(mydirent->d_name); |
416 | // mode = buf.st_mode; | ||
417 | fileL.sprintf("%s", mydirent->d_name); | 376 | fileL.sprintf("%s", mydirent->d_name); |
418 | // fileS.sprintf("%d, %d", ); //this isn't correct | ||
419 | devT = buf.st_dev; | 377 | devT = buf.st_dev; |
420 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 378 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
421 | // fileS.sprintf("%d,%d", devT, devT); | ||
422 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 379 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
423 | if( fileL.find(".") == -1 ){ | 380 | if( fileL.find(".") == -1 ){ |
424 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 381 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
425 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 382 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
426 | item->setPixmap( 0,pm); | 383 | item->setPixmap( 0,pm); |
427 | } | 384 | } |
@@ -434,21 +391,12 @@ void AdvancedFm::populateLocalView() | |||
434 | fillCombo( (const QString &) currentDir.canonicalPath()); | 391 | fillCombo( (const QString &) currentDir.canonicalPath()); |
435 | } | 392 | } |
436 | 393 | ||
437 | 394 | ||
438 | void AdvancedFm::populateRemoteView() | 395 | void AdvancedFm::populateRemoteView() |
439 | { | 396 | { |
440 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | ||
441 | // QListViewItemIterator it( Remote_View ); | ||
442 | // for ( ; it.current(); ++it ) { | ||
443 | // if ( it.current()->isSelected() ) { | ||
444 | // QString strItem = it.current()->text(0); | ||
445 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | ||
446 | // QFileInfo fi(localFile); | ||
447 | // } | ||
448 | // } | ||
449 | QPixmap pm; | 397 | QPixmap pm; |
450 | Remote_View->clear(); | 398 | Remote_View->clear(); |
451 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 399 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
452 | currentRemoteDir.setMatchAllDirs(TRUE); | 400 | currentRemoteDir.setMatchAllDirs(TRUE); |
453 | currentRemoteDir.setNameFilter(filterStr); | 401 | currentRemoteDir.setNameFilter(filterStr); |
454 | QString fileL, fileS, fileDate; | 402 | QString fileL, fileS, fileDate; |
@@ -485,60 +433,49 @@ void AdvancedFm::populateRemoteView() | |||
485 | 433 | ||
486 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 434 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
487 | if( !QDir( fi->filePath() ).isReadable()) | 435 | if( !QDir( fi->filePath() ).isReadable()) |
488 | pm = Resource::loadPixmap( "lockedfolder" ); | 436 | pm = Resource::loadPixmap( "lockedfolder" ); |
489 | else | 437 | else |
490 | pm= Resource::loadPixmap( "folder" ); | 438 | pm= Resource::loadPixmap( "folder" ); |
491 | // item->setPixmap( 0,pm ); | ||
492 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 439 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
493 | pm = Resource::loadPixmap( "exec"); | 440 | pm = Resource::loadPixmap( "exec"); |
494 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 441 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
495 | | fileInfo.permission( QFileInfo::ExeGroup) | 442 | | fileInfo.permission( QFileInfo::ExeGroup) |
496 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 443 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
497 | pm = Resource::loadPixmap( "exec"); | 444 | pm = Resource::loadPixmap( "exec"); |
498 | // item->setPixmap( 0,pm); | ||
499 | } else if( !fi->isReadable() ) { | 445 | } else if( !fi->isReadable() ) { |
500 | pm = Resource::loadPixmap( "locked" ); | 446 | pm = Resource::loadPixmap( "locked" ); |
501 | // item->setPixmap( 0,pm); | ||
502 | } else { | 447 | } else { |
503 | MimeType mt(fi->filePath()); | 448 | MimeType mt(fi->filePath()); |
504 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 449 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
505 | if(pm.isNull()) | 450 | if(pm.isNull()) |
506 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 451 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
507 | // item->setPixmap( 0,pm); | ||
508 | } | 452 | } |
509 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 453 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
510 | // overlay link image | 454 | // overlay link image |
511 | pm= Resource::loadPixmap( "folder" ); | 455 | pm= Resource::loadPixmap( "folder" ); |
512 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 456 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
513 | QPainter painter( &pm ); | 457 | QPainter painter( &pm ); |
514 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 458 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
515 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 459 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
516 | // item->setPixmap( 0, pm); | ||
517 | } | 460 | } |
518 | item->setPixmap( 0, pm); | 461 | item->setPixmap( 0, pm); |
519 | } | 462 | } |
520 | isDir=FALSE; | 463 | isDir=FALSE; |
521 | ++it; | 464 | ++it; |
522 | } | 465 | } |
523 | 466 | ||
524 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 467 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
525 | struct stat buf; | 468 | struct stat buf; |
526 | // struct stat st; | ||
527 | // mode_t mode; | ||
528 | DIR *dir; | 469 | DIR *dir; |
529 | // int fd = 0; | ||
530 | struct dirent *mydirent; | 470 | struct dirent *mydirent; |
531 | // int i = 1; | ||
532 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 471 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
533 | while ((mydirent = readdir(dir)) != NULL) { | 472 | while ((mydirent = readdir(dir)) != NULL) { |
534 | lstat( mydirent->d_name, &buf); | 473 | lstat( mydirent->d_name, &buf); |
535 | qDebug(mydirent->d_name); | 474 | qDebug(mydirent->d_name); |
536 | // mode = buf.st_mode; | ||
537 | fileL.sprintf("%s", mydirent->d_name); | 475 | fileL.sprintf("%s", mydirent->d_name); |
538 | // fileS.sprintf("%d, %d", ); //this isn't correct | ||
539 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 476 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
540 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 477 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
541 | if( fileL.find(".") == -1 ){ | 478 | if( fileL.find(".") == -1 ){ |
542 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 479 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
543 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 480 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
544 | item->setPixmap( 0,pm); | 481 | item->setPixmap( 0,pm); |
@@ -646,39 +583,31 @@ void AdvancedFm::doRemoteCd() | |||
646 | 583 | ||
647 | void AdvancedFm::showHidden() | 584 | void AdvancedFm::showHidden() |
648 | { | 585 | { |
649 | if (b) { | 586 | if (b) { |
650 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 587 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
651 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 588 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
652 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | ||
653 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | ||
654 | b=FALSE; | 589 | b=FALSE; |
655 | 590 | ||
656 | } else { | 591 | } else { |
657 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 592 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
658 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 593 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
659 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | ||
660 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | ||
661 | b=TRUE; | 594 | b=TRUE; |
662 | } | 595 | } |
663 | populateLocalView(); | 596 | populateLocalView(); |
664 | 597 | ||
665 | } | 598 | } |
666 | 599 | ||
667 | void AdvancedFm::showRemoteHidden() | 600 | void AdvancedFm::showRemoteHidden() |
668 | { | 601 | { |
669 | if (b) { | 602 | if (b) { |
670 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 603 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
671 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | ||
672 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | ||
673 | b=TRUE; | 604 | b=TRUE; |
674 | 605 | ||
675 | } else { | 606 | } else { |
676 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 607 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
677 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | ||
678 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | ||
679 | b=FALSE; | 608 | b=FALSE; |
680 | } | 609 | } |
681 | populateRemoteView(); | 610 | populateRemoteView(); |
682 | } | 611 | } |
683 | 612 | ||
684 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 613 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
@@ -705,26 +634,24 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint | |||
705 | qDebug("Start menu timer"); | 634 | qDebug("Start menu timer"); |
706 | break; | 635 | break; |
707 | }; | 636 | }; |
708 | } | 637 | } |
709 | 638 | ||
710 | void AdvancedFm::runThis() { | 639 | void AdvancedFm::runThis() { |
711 | // QFileInfo *fi; | ||
712 | QString fs; | 640 | QString fs; |
713 | if (TabWidget->currentPageIndex() == 0) { | 641 | if (TabWidget->currentPageIndex() == 0) { |
714 | QString curFile = Local_View->currentItem()->text(0); | 642 | QString curFile = Local_View->currentItem()->text(0); |
715 | if(curFile != "../") { | 643 | if(curFile != "../") { |
716 | 644 | ||
717 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 645 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 646 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
719 | qDebug( fileInfo.owner()); | 647 | qDebug( fileInfo.owner()); |
720 | if( (fileInfo.permission( QFileInfo::ExeUser) | 648 | if( (fileInfo.permission( QFileInfo::ExeUser) |
721 | | fileInfo.permission( QFileInfo::ExeGroup) | 649 | | fileInfo.permission( QFileInfo::ExeGroup) |
722 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 650 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
723 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 651 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
724 | // if( fileInfo.isExecutable() | | ||
725 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 652 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
726 | e << curFile; | 653 | e << curFile; |
727 | } else { | 654 | } else { |
728 | curFile = currentDir.canonicalPath()+"/"+curFile; | 655 | curFile = currentDir.canonicalPath()+"/"+curFile; |
729 | DocLnk nf(curFile); | 656 | DocLnk nf(curFile); |
730 | QString execStr = nf.exec(); | 657 | QString execStr = nf.exec(); |
@@ -732,13 +659,12 @@ void AdvancedFm::runThis() { | |||
732 | if( execStr.isEmpty() ) { | 659 | if( execStr.isEmpty() ) { |
733 | } else { | 660 | } else { |
734 | nf.execute(); | 661 | nf.execute(); |
735 | } | 662 | } |
736 | } | 663 | } |
737 | } | 664 | } |
738 | // MimeType mt( curFile); | ||
739 | } else { | 665 | } else { |
740 | QString curFile = Remote_View->currentItem()->text(0); | 666 | QString curFile = Remote_View->currentItem()->text(0); |
741 | if(curFile != "../") { | 667 | if(curFile != "../") { |
742 | 668 | ||
743 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 669 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
744 | qDebug("Filesystemtype is "+fs); | 670 | qDebug("Filesystemtype is "+fs); |
@@ -757,13 +683,12 @@ void AdvancedFm::runThis() { | |||
757 | if( execStr.isEmpty() ) { | 683 | if( execStr.isEmpty() ) { |
758 | } else { | 684 | } else { |
759 | nf.execute(); | 685 | nf.execute(); |
760 | } | 686 | } |
761 | } | 687 | } |
762 | } | 688 | } |
763 | // MimeType mt( curFile); | ||
764 | } | 689 | } |
765 | } | 690 | } |
766 | 691 | ||
767 | void AdvancedFm::runText() { | 692 | void AdvancedFm::runText() { |
768 | if (TabWidget->currentPageIndex() == 0) { | 693 | if (TabWidget->currentPageIndex() == 0) { |
769 | QString curFile = Local_View->currentItem()->text(0); | 694 | QString curFile = Local_View->currentItem()->text(0); |
@@ -1055,13 +980,12 @@ void AdvancedFm::doProperties() { | |||
1055 | } | 980 | } |
1056 | // qDebug("%d",curFileList.count()); | 981 | // qDebug("%d",curFileList.count()); |
1057 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 982 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1058 | qDebug((filePath+*it)); | 983 | qDebug((filePath+*it)); |
1059 | DocLnk lnk( (filePath+*it)); | 984 | DocLnk lnk( (filePath+*it)); |
1060 | LnkProperties prop( &lnk ); | 985 | LnkProperties prop( &lnk ); |
1061 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | ||
1062 | prop.showMaximized(); | 986 | prop.showMaximized(); |
1063 | prop.exec(); | 987 | prop.exec(); |
1064 | } | 988 | } |
1065 | } | 989 | } |
1066 | 990 | ||
1067 | QStringList AdvancedFm::getPath() { | 991 | QStringList AdvancedFm::getPath() { |
@@ -1172,21 +1096,13 @@ void AdvancedFm::copy() | |||
1172 | if( curFileList.count() > 0) { | 1096 | if( curFileList.count() > 0) { |
1173 | QString curFile; | 1097 | QString curFile; |
1174 | if (TabWidget->currentPageIndex() == 0) { | 1098 | if (TabWidget->currentPageIndex() == 0) { |
1175 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1099 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1176 | 1100 | ||
1177 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1101 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1178 | // if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1179 | // destFile+="/"; | ||
1180 | // destFile +=(*it); | ||
1181 | |||
1182 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1102 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1183 | // if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1184 | // curFile +="/"; | ||
1185 | // curFile +=(*it); | ||
1186 | |||
1187 | QFile f(destFile); | 1103 | QFile f(destFile); |
1188 | if( f.exists()) { | 1104 | if( f.exists()) { |
1189 | switch ( QMessageBox::warning(this,tr("Delete"), | 1105 | switch ( QMessageBox::warning(this,tr("Delete"), |
1190 | destFile+tr(" already exists\nDo you really want to delete it?"), | 1106 | destFile+tr(" already exists\nDo you really want to delete it?"), |
1191 | tr("Yes"),tr("No"),0,0,1) ) { | 1107 | tr("Yes"),tr("No"),0,0,1) ) { |
1192 | case 0: | 1108 | case 0: |
@@ -1245,14 +1161,12 @@ void AdvancedFm::copyAs() | |||
1245 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1161 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1246 | 1162 | ||
1247 | if (TabWidget->currentPageIndex() == 0) { | 1163 | if (TabWidget->currentPageIndex() == 0) { |
1248 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1164 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1249 | QString destFile; | 1165 | QString destFile; |
1250 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1166 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1251 | // InputDialog *fileDlg; | ||
1252 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | ||
1253 | fileDlg->setInputText((const QString &) destFile ); | 1167 | fileDlg->setInputText((const QString &) destFile ); |
1254 | fileDlg->exec(); | 1168 | fileDlg->exec(); |
1255 | if( fileDlg->result() == 1 ) { | 1169 | if( fileDlg->result() == 1 ) { |
1256 | QString filename = fileDlg->LineEdit1->text(); | 1170 | QString filename = fileDlg->LineEdit1->text(); |
1257 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1171 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1258 | 1172 | ||
@@ -1325,14 +1239,12 @@ void AdvancedFm::copySameDir() { | |||
1325 | 1239 | ||
1326 | if (TabWidget->currentPageIndex() == 0) { | 1240 | if (TabWidget->currentPageIndex() == 0) { |
1327 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1241 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1328 | QString destFile; | 1242 | QString destFile; |
1329 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1243 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1330 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 1244 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
1331 | // InputDialog *fileDlg; | ||
1332 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | ||
1333 | fileDlg->setInputText((const QString &) destFile ); | 1245 | fileDlg->setInputText((const QString &) destFile ); |
1334 | fileDlg->exec(); | 1246 | fileDlg->exec(); |
1335 | if( fileDlg->result() == 1 ) { | 1247 | if( fileDlg->result() == 1 ) { |
1336 | QString filename = fileDlg->LineEdit1->text(); | 1248 | QString filename = fileDlg->LineEdit1->text(); |
1337 | destFile = currentDir.canonicalPath()+"/"+filename; | 1249 | destFile = currentDir.canonicalPath()+"/"+filename; |
1338 | 1250 | ||
@@ -1528,22 +1440,20 @@ void AdvancedFm::runCommand() { | |||
1528 | fileDlg->setInputText(curFile); | 1440 | fileDlg->setInputText(curFile); |
1529 | fileDlg->exec(); | 1441 | fileDlg->exec(); |
1530 | QString command; | 1442 | QString command; |
1531 | if( fileDlg->result() == 1 ) { | 1443 | if( fileDlg->result() == 1 ) { |
1532 | command = fileDlg->LineEdit1->text(); | 1444 | command = fileDlg->LineEdit1->text(); |
1533 | 1445 | ||
1534 | // int err=0; | ||
1535 | Output *outDlg; | 1446 | Output *outDlg; |
1536 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1447 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1537 | outDlg->showMaximized(); | 1448 | outDlg->showMaximized(); |
1538 | outDlg->show(); | 1449 | outDlg->show(); |
1539 | qApp->processEvents(); | 1450 | qApp->processEvents(); |
1540 | FILE *fp; | 1451 | FILE *fp; |
1541 | char line[130]; | 1452 | char line[130]; |
1542 | sleep(1); | 1453 | sleep(1); |
1543 | // if(command.find("2>",0,TRUE) != -1) | ||
1544 | command +=" 2>&1"; | 1454 | command +=" 2>&1"; |
1545 | fp = popen( (const char *) command, "r"); | 1455 | fp = popen( (const char *) command, "r"); |
1546 | if ( !fp ) { | 1456 | if ( !fp ) { |
1547 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1457 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1548 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 1458 | QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
1549 | pclose(fp); | 1459 | pclose(fp); |
@@ -1586,13 +1496,12 @@ void AdvancedFm::fileStatus() { | |||
1586 | if (TabWidget->currentPageIndex() == 0) { | 1496 | if (TabWidget->currentPageIndex() == 0) { |
1587 | curFile = Local_View->currentItem()->text(0); | 1497 | curFile = Local_View->currentItem()->text(0); |
1588 | } else { | 1498 | } else { |
1589 | curFile = Remote_View->currentItem()->text(0); | 1499 | curFile = Remote_View->currentItem()->text(0); |
1590 | } | 1500 | } |
1591 | QString command = " stat -l "+ curFile +" 2>&1"; | 1501 | QString command = " stat -l "+ curFile +" 2>&1"; |
1592 | // int err=0; | ||
1593 | Output *outDlg; | 1502 | Output *outDlg; |
1594 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1503 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1595 | outDlg->showMaximized(); | 1504 | outDlg->showMaximized(); |
1596 | outDlg->show(); | 1505 | outDlg->show(); |
1597 | qApp->processEvents(); | 1506 | qApp->processEvents(); |
1598 | FILE *fp; | 1507 | FILE *fp; |
@@ -1761,27 +1670,24 @@ void AdvancedFm::QPEButtonPushed() { | |||
1761 | 1670 | ||
1762 | void AdvancedFm::parsetab(const QString &fileName) { | 1671 | void AdvancedFm::parsetab(const QString &fileName) { |
1763 | 1672 | ||
1764 | fileSystemTypeList.clear(); | 1673 | fileSystemTypeList.clear(); |
1765 | fsList.clear(); | 1674 | fsList.clear(); |
1766 | struct mntent *me; | 1675 | struct mntent *me; |
1767 | // if(fileName == "/etc/mtab") { | ||
1768 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 1676 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
1769 | if ( mntfp ) { | 1677 | if ( mntfp ) { |
1770 | while ( (me = getmntent( mntfp )) != 0 ) { | 1678 | while ( (me = getmntent( mntfp )) != 0 ) { |
1771 | QString deviceName = me->mnt_fsname; | 1679 | QString deviceName = me->mnt_fsname; |
1772 | QString filesystemType = me->mnt_type; | 1680 | QString filesystemType = me->mnt_type; |
1773 | QString mountDir = me->mnt_dir; | 1681 | QString mountDir = me->mnt_dir; |
1774 | if(deviceName != "none") { | 1682 | if(deviceName != "none") { |
1775 | if( fsList.contains(filesystemType) == 0 | 1683 | if( fsList.contains(filesystemType) == 0 |
1776 | & filesystemType.find("proc",0,TRUE) == -1 | 1684 | & filesystemType.find("proc",0,TRUE) == -1 |
1777 | & filesystemType.find("cramfs",0,TRUE) == -1 | 1685 | & filesystemType.find("cramfs",0,TRUE) == -1 |
1778 | & filesystemType.find("auto",0,TRUE) == -1) | 1686 | & filesystemType.find("auto",0,TRUE) == -1) |
1779 | fsList << filesystemType; | 1687 | fsList << filesystemType; |
1780 | // deviceList << deviceName; | ||
1781 | // qDebug(mountDir+"::"+filesystemType); | ||
1782 | fileSystemTypeList << mountDir+"::"+filesystemType; | 1688 | fileSystemTypeList << mountDir+"::"+filesystemType; |
1783 | } | 1689 | } |
1784 | } | 1690 | } |
1785 | } | 1691 | } |
1786 | endmntent( mntfp ); | 1692 | endmntent( mntfp ); |
1787 | } | 1693 | } |
@@ -1842,23 +1748,12 @@ void AdvancedFm::doBeam() { | |||
1842 | 1748 | ||
1843 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1749 | void AdvancedFm::fileBeamFinished( Ir *ir) { |
1844 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1750 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1845 | 1751 | ||
1846 | } | 1752 | } |
1847 | 1753 | ||
1848 | |||
1849 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | ||
1850 | // QListViewItemIterator it( Local_View ); | ||
1851 | // for ( ; it.current(); ++it ) { | ||
1852 | // if ( it.current()->isSelected() ) { | ||
1853 | // QString strItem = it.current()->text(0); | ||
1854 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | ||
1855 | // QFileInfo fi(localFile); | ||
1856 | // } | ||
1857 | // } | ||
1858 | |||
1859 | void AdvancedFm::showFileMenu() { | 1754 | void AdvancedFm::showFileMenu() { |
1860 | 1755 | ||
1861 | QString curApp; | 1756 | QString curApp; |
1862 | bool isLocalView = false; | 1757 | bool isLocalView = false; |
1863 | if (TabWidget->currentPageIndex() == 0) { | 1758 | if (TabWidget->currentPageIndex() == 0) { |
1864 | isLocalView = TRUE; | 1759 | isLocalView = TRUE; |
@@ -1868,13 +1763,12 @@ void AdvancedFm::showFileMenu() { | |||
1868 | } | 1763 | } |
1869 | 1764 | ||
1870 | MimeType mt( curApp ); | 1765 | MimeType mt( curApp ); |
1871 | const AppLnk* app = mt.application(); | 1766 | const AppLnk* app = mt.application(); |
1872 | QFile fi(curApp); | 1767 | QFile fi(curApp); |
1873 | 1768 | ||
1874 | // QPopupMenu m; | ||
1875 | QPopupMenu *m = new QPopupMenu(0); | 1769 | QPopupMenu *m = new QPopupMenu(0); |
1876 | 1770 | ||
1877 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 1771 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
1878 | m->insertSeparator(); | 1772 | m->insertSeparator(); |
1879 | if ( QFileInfo(fi).isDir() ) { | 1773 | if ( QFileInfo(fi).isDir() ) { |
1880 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 1774 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 7665fe9..45f00ad 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -107,12 +107,14 @@ protected slots: | |||
107 | protected: | 107 | protected: |
108 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 108 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
109 | QStringList remoteDirPathStringList, localDirPathStringList; | 109 | QStringList remoteDirPathStringList, localDirPathStringList; |
110 | 110 | ||
111 | void keyReleaseEvent( QKeyEvent *); | 111 | void keyReleaseEvent( QKeyEvent *); |
112 | QString getFileSystemType(const QString &); | 112 | QString getFileSystemType(const QString &); |
113 | QString getDiskSpace(const QString &); | ||
114 | |||
113 | void parsetab(const QString &fileName); | 115 | void parsetab(const QString &fileName); |
114 | 116 | ||
115 | protected slots: | 117 | protected slots: |
116 | void showFileMenu(); | 118 | void showFileMenu(); |
117 | void cancelMenuTimer(); | 119 | void cancelMenuTimer(); |
118 | void homeButtonPushed(); | 120 | void homeButtonPushed(); |
@@ -130,11 +132,12 @@ protected slots: | |||
130 | bool copyFile( const QString & , const QString & ); | 132 | bool copyFile( const QString & , const QString & ); |
131 | void move(); | 133 | void move(); |
132 | void fileStatus(); | 134 | void fileStatus(); |
133 | void doAbout(); | 135 | void doAbout(); |
134 | void doBeam(); | 136 | void doBeam(); |
135 | void fileBeamFinished( Ir *); | 137 | void fileBeamFinished( Ir *); |
138 | |||
136 | private: | 139 | private: |
137 | QTimer menuTimer; | 140 | QTimer menuTimer; |
138 | }; | 141 | }; |
139 | 142 | ||
140 | #endif // ADVANCEDFM_H | 143 | #endif // ADVANCEDFM_H |