-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 345 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 7 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 30 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 317 | ||||
-rw-r--r-- | noncore/apps/advancedfm/filePermissions.cpp | 2 |
5 files changed, 300 insertions, 401 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 91318f1..2fc4b49 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -40,6 +40,8 @@ | |||
40 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | 42 | ||
43 | #include <qpe/qpemessagebox.h> | ||
44 | |||
43 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
44 | #include <time.h> | 46 | #include <time.h> |
45 | #include <dirent.h> | 47 | #include <dirent.h> |
@@ -67,8 +69,7 @@ AdvancedFm::~AdvancedFm() { | |||
67 | } | 69 | } |
68 | 70 | ||
69 | 71 | ||
70 | void AdvancedFm::cleanUp() | 72 | void AdvancedFm::cleanUp() { |
71 | { | ||
72 | QString sfile=QDir::homeDirPath(); | 73 | QString sfile=QDir::homeDirPath(); |
73 | if(sfile.right(1) != "/") | 74 | if(sfile.right(1) != "/") |
74 | sfile+="/._temp"; | 75 | sfile+="/._temp"; |
@@ -79,44 +80,41 @@ void AdvancedFm::cleanUp() | |||
79 | file.remove(); | 80 | file.remove(); |
80 | } | 81 | } |
81 | 82 | ||
82 | void AdvancedFm::tabChanged(QWidget *w) | 83 | void AdvancedFm::tabChanged(QWidget *) { |
83 | { | 84 | // qWarning("tab changed"); |
84 | if( w == tab) | ||
85 | whichTab = 1; | ||
86 | else | ||
87 | whichTab = 2; | ||
88 | |||
89 | // qDebug("tab changed %d", whichTab ); | ||
90 | |||
91 | QString path = CurrentDir()->canonicalPath(); | 85 | QString path = CurrentDir()->canonicalPath(); |
92 | currentPathCombo->lineEdit()->setText( path ); | 86 | currentPathCombo->lineEdit()->setText( path ); |
93 | 87 | ||
94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 88 | if(whichTab == 1) { |
95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 89 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
90 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | ||
91 | } else { | ||
92 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | ||
93 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | ||
94 | } | ||
96 | 95 | ||
97 | QString fs= getFileSystemType( (const QString &) path); | 96 | QString fs= getFileSystemType( (const QString &) path); |
98 | 97 | ||
99 | setCaption("AdvancedFm :: "+fs+" :: " | 98 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
100 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 99 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
101 | chdir( path.latin1()); | 100 | chdir( path.latin1()); |
102 | } | 101 | } |
103 | 102 | ||
104 | 103 | ||
105 | void AdvancedFm::populateView() | 104 | void AdvancedFm::populateView() { |
106 | { | ||
107 | QPixmap pm; | 105 | QPixmap pm; |
108 | QListView *thisView = CurrentView(); | 106 | QListView *thisView = CurrentView(); |
109 | QDir *thisDir = CurrentDir(); | 107 | QDir *thisDir = CurrentDir(); |
110 | QString path = thisDir->canonicalPath(); | 108 | QString path = thisDir->canonicalPath(); |
111 | 109 | // qWarning("path is "+path); | |
112 | thisView->clear(); | 110 | thisView->clear(); |
113 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 111 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
114 | thisDir->setMatchAllDirs(TRUE); | 112 | thisDir->setMatchAllDirs(TRUE); |
115 | thisDir->setNameFilter(filterStr); | 113 | thisDir->setNameFilter(filterStr); |
116 | QString fileL, fileS, fileDate; | 114 | QString fileL, fileS, fileDate; |
117 | QString fs= getFileSystemType((const QString &) path); | 115 | QString fs= getFileSystemType((const QString &) path); |
118 | setCaption("AdvancedFm :: "+fs+" :: " | 116 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
119 | +checkDiskSpace((const QString &) path)+" kB free" ); | 117 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
120 | bool isDir=FALSE; | 118 | bool isDir=FALSE; |
121 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 119 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
122 | QFileInfoListIterator it(*list); | 120 | QFileInfoListIterator it(*list); |
@@ -133,6 +131,7 @@ void AdvancedFm::populateView() | |||
133 | fileL = fi->fileName(); | 131 | fileL = fi->fileName(); |
134 | fileDate= fi->lastModified().toString(); | 132 | fileDate= fi->lastModified().toString(); |
135 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 133 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
134 | // if(fileL == "..") | ||
136 | fileL+="/"; | 135 | fileL+="/"; |
137 | isDir=TRUE; | 136 | isDir=TRUE; |
138 | } | 137 | } |
@@ -211,45 +210,44 @@ void AdvancedFm::populateView() | |||
211 | fillCombo( (const QString &) path ); | 210 | fillCombo( (const QString &) path ); |
212 | } | 211 | } |
213 | 212 | ||
214 | void AdvancedFm::rePopulate() | 213 | void AdvancedFm::rePopulate() { |
215 | { | ||
216 | int tmpTab = whichTab; | ||
217 | qDebug("%d", tmpTab); | ||
218 | |||
219 | for(int i =1; i < 3; i++) | ||
220 | { | ||
221 | TabWidget->setCurrentWidget(i - 1); | ||
222 | populateView(); | 214 | populateView(); |
223 | } | 215 | setOtherTabCurrent(); |
224 | TabWidget->setCurrentWidget( tmpTab - 1); | 216 | populateView(); |
217 | |||
218 | // int tmpTab = whichTab; | ||
219 | // // qDebug("%d", tmpTab); | ||
220 | |||
221 | // for(int i =1; i < 3; i++) { | ||
222 | // TabWidget->setCurrentWidget(i - 1); | ||
223 | // populateView(); | ||
224 | // } | ||
225 | // TabWidget->setCurrentWidget( tmpTab - 1); | ||
225 | } | 226 | } |
226 | 227 | ||
227 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 228 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
228 | { | 229 | //qWarning("listclicked"); |
229 | if(selectedItem) | 230 | if(selectedItem) { |
230 | { | ||
231 | QString strItem=selectedItem->text(0); | 231 | QString strItem=selectedItem->text(0); |
232 | // qWarning(strItem); | ||
232 | QString strSize=selectedItem->text(1); | 233 | QString strSize=selectedItem->text(1); |
233 | strSize=strSize.stripWhiteSpace(); | 234 | strSize=strSize.stripWhiteSpace(); |
234 | bool isDirectory = false; | 235 | bool isDirectory = false; |
235 | QString strItem2; | 236 | QString strItem2; |
236 | 237 | ||
237 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 238 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
238 | { | ||
239 | strItem2 = dealWithSymName((const QString&)strItem); | 239 | strItem2 = dealWithSymName((const QString&)strItem); |
240 | if(QDir(strItem2).exists() ) | 240 | if(QDir(strItem2).exists() ) |
241 | strItem = strItem2; | 241 | strItem = strItem2; |
242 | } | 242 | } |
243 | 243 | ||
244 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 244 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
245 | { | ||
246 | 245 | ||
247 | if(QDir(strItem).exists()) | 246 | if(QDir(strItem).exists()) |
248 | isDirectory = true; | 247 | isDirectory = true; |
249 | } | 248 | } |
250 | 249 | ||
251 | if( isDirectory ) | 250 | if( isDirectory ) { |
252 | { | ||
253 | CurrentDir()->cd( strItem, TRUE); | 251 | CurrentDir()->cd( strItem, TRUE); |
254 | populateView(); | 252 | populateView(); |
255 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 253 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
@@ -258,12 +256,12 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
258 | } | 256 | } |
259 | } | 257 | } |
260 | 258 | ||
261 | void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 259 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
260 | dealWithSchmooSchmaa( item->listView()); | ||
262 | switch (mouse) { | 261 | switch (mouse) { |
263 | case 1: | 262 | case 1: |
264 | { | 263 | { |
265 | if(renameBox != 0 ) | 264 | if(renameBox != 0 ) { |
266 | { | ||
267 | cancelRename(); | 265 | cancelRename(); |
268 | } | 266 | } |
269 | } | 267 | } |
@@ -274,59 +272,48 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) | |||
274 | }; | 272 | }; |
275 | } | 273 | } |
276 | 274 | ||
277 | void AdvancedFm::switchToLocalTab() | 275 | |
278 | { | 276 | void AdvancedFm::switchToLocalTab() { |
277 | //qWarning("switch to local view"); | ||
279 | TabWidget->setCurrentWidget(0); | 278 | TabWidget->setCurrentWidget(0); |
280 | Local_View->setFocus(); | 279 | Local_View->setFocus(); |
281 | } | 280 | } |
282 | 281 | ||
283 | void AdvancedFm::switchToRemoteTab() | 282 | void AdvancedFm::switchToRemoteTab() { |
284 | { | 283 | //qWarning("switch to local view"); |
285 | TabWidget->setCurrentWidget(1); | 284 | TabWidget->setCurrentWidget(1); |
286 | Remote_View->setFocus(); | 285 | Remote_View->setFocus(); |
287 | } | 286 | } |
288 | 287 | ||
289 | void AdvancedFm::readConfig() | 288 | void AdvancedFm::readConfig() { |
290 | { | ||
291 | Config cfg("AdvancedFm"); | 289 | Config cfg("AdvancedFm"); |
292 | } | 290 | } |
293 | 291 | ||
294 | void AdvancedFm::writeConfig() | 292 | void AdvancedFm::writeConfig() { |
295 | { | ||
296 | Config cfg("AdvancedFm"); | 293 | Config cfg("AdvancedFm"); |
297 | } | 294 | } |
298 | 295 | ||
299 | void AdvancedFm::currentPathComboChanged() | 296 | void AdvancedFm::currentPathComboChanged() { |
300 | { | 297 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
301 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) | ||
302 | { | ||
303 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 298 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); |
304 | populateView(); | 299 | populateView(); |
305 | } | 300 | } else { |
306 | else | ||
307 | { | ||
308 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 301 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
309 | } | 302 | } |
310 | } | 303 | } |
311 | 304 | ||
312 | void AdvancedFm::fillCombo(const QString ¤tPath) | 305 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
313 | { | 306 | |
314 | // qDebug("%d",TabWidget->currentTab()); | 307 | if ( whichTab == 1) { |
315 | if ( whichTab == 1) | ||
316 | { | ||
317 | currentPathCombo->lineEdit()->setText( currentPath); | 308 | currentPathCombo->lineEdit()->setText( currentPath); |
318 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 309 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
319 | { | ||
320 | currentPathCombo->clear(); | 310 | currentPathCombo->clear(); |
321 | localDirPathStringList.prepend( currentPath ); | 311 | localDirPathStringList.prepend( currentPath ); |
322 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 312 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
323 | } | 313 | } |
324 | } | 314 | } else { |
325 | else | ||
326 | { | ||
327 | currentPathCombo->lineEdit()->setText( currentPath); | 315 | currentPathCombo->lineEdit()->setText( currentPath); |
328 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) | 316 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
329 | { | ||
330 | currentPathCombo->clear(); | 317 | currentPathCombo->clear(); |
331 | remoteDirPathStringList.prepend( currentPath ); | 318 | remoteDirPathStringList.prepend( currentPath ); |
332 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 319 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
@@ -334,24 +321,20 @@ void AdvancedFm::fillCombo(const QString ¤tPath) | |||
334 | } | 321 | } |
335 | } | 322 | } |
336 | 323 | ||
337 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) | 324 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
338 | { | ||
339 | chdir( currentPath.latin1() ); | 325 | chdir( currentPath.latin1() ); |
340 | CurrentDir()->cd( currentPath, TRUE); | 326 | CurrentDir()->cd( currentPath, TRUE); |
341 | populateView(); | 327 | populateView(); |
342 | update(); | 328 | update(); |
343 | } | 329 | } |
344 | 330 | ||
345 | QStringList AdvancedFm::getPath() | 331 | QStringList AdvancedFm::getPath() { |
346 | { | ||
347 | QStringList strList; | 332 | QStringList strList; |
348 | QListView *thisView=CurrentView(); | 333 | QListView *thisView=CurrentView(); |
349 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 334 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
350 | QListViewItemIterator it( thisView ); | 335 | QListViewItemIterator it( thisView ); |
351 | for ( ; it.current(); ++it ) | 336 | for ( ; it.current(); ++it ) { |
352 | { | 337 | if ( it.current()->isSelected() ) { |
353 | if ( it.current()->isSelected() ) | ||
354 | { | ||
355 | strList << it.current()->text(0); | 338 | strList << it.current()->text(0); |
356 | // qDebug(it.current()->text(0)); | 339 | // qDebug(it.current()->text(0)); |
357 | } | 340 | } |
@@ -359,8 +342,7 @@ QStringList AdvancedFm::getPath() | |||
359 | return strList; | 342 | return strList; |
360 | } | 343 | } |
361 | 344 | ||
362 | void AdvancedFm::homeButtonPushed() | 345 | void AdvancedFm::homeButtonPushed() { |
363 | { | ||
364 | QString current = QDir::homeDirPath(); | 346 | QString current = QDir::homeDirPath(); |
365 | chdir( current.latin1() ); | 347 | chdir( current.latin1() ); |
366 | CurrentDir()->cd( current, TRUE); | 348 | CurrentDir()->cd( current, TRUE); |
@@ -368,8 +350,7 @@ void AdvancedFm::homeButtonPushed() | |||
368 | update(); | 350 | update(); |
369 | } | 351 | } |
370 | 352 | ||
371 | void AdvancedFm::docButtonPushed() | 353 | void AdvancedFm::docButtonPushed() { |
372 | { | ||
373 | QString current = QPEApplication::documentDir(); | 354 | QString current = QPEApplication::documentDir(); |
374 | chdir( current.latin1() ); | 355 | chdir( current.latin1() ); |
375 | CurrentDir()->cd( current, TRUE); | 356 | CurrentDir()->cd( current, TRUE); |
@@ -377,8 +358,7 @@ void AdvancedFm::docButtonPushed() | |||
377 | update(); | 358 | update(); |
378 | } | 359 | } |
379 | 360 | ||
380 | void AdvancedFm::SDButtonPushed() | 361 | void AdvancedFm::SDButtonPushed() { |
381 | { | ||
382 | QString current = "/mnt/card";// this can change so fix | 362 | QString current = "/mnt/card";// this can change so fix |
383 | chdir( current.latin1() ); | 363 | chdir( current.latin1() ); |
384 | CurrentDir()->cd( current, TRUE); | 364 | CurrentDir()->cd( current, TRUE); |
@@ -386,8 +366,7 @@ void AdvancedFm::SDButtonPushed() | |||
386 | update(); | 366 | update(); |
387 | } | 367 | } |
388 | 368 | ||
389 | void AdvancedFm::CFButtonPushed() | 369 | void AdvancedFm::CFButtonPushed() { |
390 | { | ||
391 | QString current; | 370 | QString current; |
392 | if(zaurusDevice) | 371 | if(zaurusDevice) |
393 | current= "/mnt/cf"; //zaurus | 372 | current= "/mnt/cf"; //zaurus |
@@ -400,20 +379,31 @@ void AdvancedFm::CFButtonPushed() | |||
400 | } | 379 | } |
401 | 380 | ||
402 | 381 | ||
403 | void AdvancedFm::doAbout() | 382 | void AdvancedFm::doAbout() { |
404 | { | ||
405 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 383 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
406 | "is copyright 2002-2003 by\n" | 384 | "is copyright 2002-2003 by\n" |
407 | "L.J.Potter<llornkcor@handhelds.org>\n" | 385 | "L.J.Potter<llornkcor@handhelds.org>\n" |
408 | "and is licensed by the GPL")); | 386 | "and is licensed by the GPL")); |
409 | } | 387 | } |
410 | 388 | ||
411 | void AdvancedFm::keyPressEvent( QKeyEvent *e) | 389 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
412 | { | 390 | // qWarning("key %d", e->key()); |
413 | // e->accept(); | 391 | // if( CurrentView()->hasFocus() ) |
414 | if( CurrentView()->hasFocus() ) | ||
415 | { | 392 | { |
416 | switch ( e->key() ) { | 393 | switch ( e->key() ) { |
394 | case Key_Left: | ||
395 | upDir(); | ||
396 | break; | ||
397 | case Key_Next: | ||
398 | break; | ||
399 | case Key_Return: | ||
400 | case Key_Enter: | ||
401 | navigateToSelected(); | ||
402 | break; | ||
403 | case Key_Tab: { | ||
404 | setOtherTabCurrent(); | ||
405 | } | ||
406 | break; | ||
417 | case Key_Delete: | 407 | case Key_Delete: |
418 | del(); | 408 | del(); |
419 | break; | 409 | break; |
@@ -484,15 +474,13 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) | |||
484 | } | 474 | } |
485 | } | 475 | } |
486 | 476 | ||
487 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 477 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
488 | { | ||
489 | if( CurrentView()->hasFocus() ) | 478 | if( CurrentView()->hasFocus() ) |
490 | e->ignore(); | 479 | e->ignore(); |
491 | } | 480 | } |
492 | 481 | ||
493 | 482 | ||
494 | void AdvancedFm::QPEButtonPushed() | 483 | void AdvancedFm::QPEButtonPushed() { |
495 | { | ||
496 | QString current = QPEApplication::qpeDir(); | 484 | QString current = QPEApplication::qpeDir(); |
497 | chdir( current.latin1() ); | 485 | chdir( current.latin1() ); |
498 | CurrentDir()->cd( current, TRUE); | 486 | CurrentDir()->cd( current, TRUE); |
@@ -500,22 +488,18 @@ void AdvancedFm::QPEButtonPushed() | |||
500 | update(); | 488 | update(); |
501 | } | 489 | } |
502 | 490 | ||
503 | void AdvancedFm::parsetab(const QString &fileName) | 491 | void AdvancedFm::parsetab(const QString &fileName) { |
504 | { | ||
505 | 492 | ||
506 | fileSystemTypeList.clear(); | 493 | fileSystemTypeList.clear(); |
507 | fsList.clear(); | 494 | fsList.clear(); |
508 | struct mntent *me; | 495 | struct mntent *me; |
509 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 496 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
510 | if ( mntfp ) | 497 | if ( mntfp ) { |
511 | { | 498 | while ( (me = getmntent( mntfp )) != 0 ) { |
512 | while ( (me = getmntent( mntfp )) != 0 ) | ||
513 | { | ||
514 | QString deviceName = me->mnt_fsname; | 499 | QString deviceName = me->mnt_fsname; |
515 | QString filesystemType = me->mnt_type; | 500 | QString filesystemType = me->mnt_type; |
516 | QString mountDir = me->mnt_dir; | 501 | QString mountDir = me->mnt_dir; |
517 | if(deviceName != "none") | 502 | if(deviceName != "none") { |
518 | { | ||
519 | if( fsList.contains(filesystemType) == 0 | 503 | if( fsList.contains(filesystemType) == 0 |
520 | & filesystemType.find("proc",0,TRUE) == -1 | 504 | & filesystemType.find("proc",0,TRUE) == -1 |
521 | & filesystemType.find("cramfs",0,TRUE) == -1 | 505 | & filesystemType.find("cramfs",0,TRUE) == -1 |
@@ -528,8 +512,7 @@ void AdvancedFm::parsetab(const QString &fileName) | |||
528 | endmntent( mntfp ); | 512 | endmntent( mntfp ); |
529 | } | 513 | } |
530 | 514 | ||
531 | QString AdvancedFm::getFileSystemType(const QString ¤tText) | 515 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
532 | { | ||
533 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 516 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
534 | QString current = currentText;//.right( currentText.length()-1); | 517 | QString current = currentText;//.right( currentText.length()-1); |
535 | QString baseFs; | 518 | QString baseFs; |
@@ -545,8 +528,7 @@ QString AdvancedFm::getFileSystemType(const QString ¤tText) | |||
545 | return baseFs; | 528 | return baseFs; |
546 | } | 529 | } |
547 | 530 | ||
548 | QString AdvancedFm::getDiskSpace( const QString &path) | 531 | QString AdvancedFm::getDiskSpace( const QString &path) { |
549 | { | ||
550 | struct statfs fss; | 532 | struct statfs fss; |
551 | if ( !statfs( path.latin1(), &fss ) ) { | 533 | if ( !statfs( path.latin1(), &fss ) ) { |
552 | int blkSize = fss.f_bsize; | 534 | int blkSize = fss.f_bsize; |
@@ -564,8 +546,7 @@ QString AdvancedFm::getDiskSpace( const QString &path) | |||
564 | } | 546 | } |
565 | 547 | ||
566 | 548 | ||
567 | void AdvancedFm::showFileMenu() | 549 | void AdvancedFm::showFileMenu() { |
568 | { | ||
569 | QString curApp; | 550 | QString curApp; |
570 | curApp = CurrentView()->currentItem()->text(0); | 551 | curApp = CurrentView()->currentItem()->text(0); |
571 | 552 | ||
@@ -577,13 +558,10 @@ void AdvancedFm::showFileMenu() | |||
577 | // QPopupMenu *o = new QPopupMenu(0); | 558 | // QPopupMenu *o = new QPopupMenu(0); |
578 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 559 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
579 | 560 | ||
580 | if ( QFileInfo(fi).isDir() ) | 561 | if ( QFileInfo(fi).isDir() ) { |
581 | { | ||
582 | m->insertSeparator(); | 562 | m->insertSeparator(); |
583 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); | 563 | m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); |
584 | } | 564 | } else { |
585 | else | ||
586 | { | ||
587 | 565 | ||
588 | if ( app ) | 566 | if ( app ) |
589 | m->insertItem( app->pixmap(), tr( "Open in " | 567 | m->insertItem( app->pixmap(), tr( "Open in " |
@@ -634,18 +612,15 @@ void AdvancedFm::showFileMenu() | |||
634 | } | 612 | } |
635 | 613 | ||
636 | 614 | ||
637 | void AdvancedFm::cancelMenuTimer() | 615 | void AdvancedFm::cancelMenuTimer() { |
638 | { | 616 | |
639 | // qDebug("selectionChanged: cancel menu timer"); | ||
640 | if( menuTimer.isActive() ) | 617 | if( menuTimer.isActive() ) |
641 | menuTimer.stop(); | 618 | menuTimer.stop(); |
642 | } | 619 | } |
643 | 620 | ||
644 | QString AdvancedFm::checkDiskSpace(const QString &path) | 621 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
645 | { | ||
646 | struct statfs fss; | 622 | struct statfs fss; |
647 | if ( !statfs( path.latin1(), &fss ) ) | 623 | if ( !statfs( path.latin1(), &fss ) ) { |
648 | { | ||
649 | int blkSize = fss.f_bsize; | 624 | int blkSize = fss.f_bsize; |
650 | // int totalBlks = fs.f_blocks; | 625 | // int totalBlks = fs.f_blocks; |
651 | int availBlks = fss.f_bavail; | 626 | int availBlks = fss.f_bavail; |
@@ -661,8 +636,7 @@ QString AdvancedFm::checkDiskSpace(const QString &path) | |||
661 | return ""; | 636 | return ""; |
662 | } | 637 | } |
663 | 638 | ||
664 | void AdvancedFm::addToDocs() | 639 | void AdvancedFm::addToDocs() { |
665 | { | ||
666 | QStringList strListPaths = getPath(); | 640 | QStringList strListPaths = getPath(); |
667 | QDir *thisDir = CurrentDir(); | 641 | QDir *thisDir = CurrentDir(); |
668 | 642 | ||
@@ -682,8 +656,7 @@ void AdvancedFm::addToDocs() | |||
682 | } | 656 | } |
683 | 657 | ||
684 | 658 | ||
685 | void AdvancedFm::customDirsToMenu() | 659 | void AdvancedFm::customDirsToMenu() { |
686 | { | ||
687 | 660 | ||
688 | Config cfg("AdvancedFm"); | 661 | Config cfg("AdvancedFm"); |
689 | cfg.setGroup("Menu"); | 662 | cfg.setGroup("Menu"); |
@@ -697,9 +670,7 @@ void AdvancedFm::customDirsToMenu() | |||
697 | // } | 670 | // } |
698 | } | 671 | } |
699 | 672 | ||
700 | void AdvancedFm::dirMenuSelected(int item) | 673 | void AdvancedFm::dirMenuSelected(int item) { |
701 | { | ||
702 | qDebug("menu item %d", item); | ||
703 | switch(item) | 674 | switch(item) |
704 | { | 675 | { |
705 | 676 | ||
@@ -721,8 +692,7 @@ void AdvancedFm::dirMenuSelected(int item) | |||
721 | }; | 692 | }; |
722 | } | 693 | } |
723 | 694 | ||
724 | void AdvancedFm::addCustomDir() | 695 | void AdvancedFm::addCustomDir() { |
725 | { | ||
726 | Config cfg("AdvancedFm"); | 696 | Config cfg("AdvancedFm"); |
727 | cfg.setGroup("Menu"); | 697 | cfg.setGroup("Menu"); |
728 | QString dir; | 698 | QString dir; |
@@ -731,15 +701,12 @@ void AdvancedFm::addCustomDir() | |||
731 | dir = CurrentDir()->canonicalPath(); | 701 | dir = CurrentDir()->canonicalPath(); |
732 | 702 | ||
733 | bool addIt=true; | 703 | bool addIt=true; |
734 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 704 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
735 | { | 705 | if( dir == (*it)) { |
736 | if( dir == (*it)) | ||
737 | { | ||
738 | addIt=false; | 706 | addIt=false; |
739 | } | 707 | } |
740 | } | 708 | } |
741 | if(addIt) | 709 | if(addIt) { |
742 | { | ||
743 | menuButton->insertItem(dir); | 710 | menuButton->insertItem(dir); |
744 | // customDirMenu->insertItem(dir); | 711 | // customDirMenu->insertItem(dir); |
745 | list << dir; | 712 | list << dir; |
@@ -749,8 +716,7 @@ void AdvancedFm::addCustomDir() | |||
749 | cfg.write(); | 716 | cfg.write(); |
750 | } | 717 | } |
751 | 718 | ||
752 | void AdvancedFm::removeCustomDir() | 719 | void AdvancedFm::removeCustomDir() { |
753 | { | ||
754 | // qDebug("remove custom dir"); | 720 | // qDebug("remove custom dir"); |
755 | Config cfg("AdvancedFm"); | 721 | Config cfg("AdvancedFm"); |
756 | cfg.setGroup("Menu"); | 722 | cfg.setGroup("Menu"); |
@@ -761,21 +727,15 @@ void AdvancedFm::removeCustomDir() | |||
761 | int ramble=2; | 727 | int ramble=2; |
762 | // int ramble=-24; | 728 | // int ramble=-24; |
763 | //first remove list | 729 | //first remove list |
764 | if(list.grep(dir,true).isEmpty()) | 730 | if(list.grep(dir,true).isEmpty()) { |
765 | { | ||
766 | QMessageBox::message(tr( "AdvancedFm" ), | 731 | QMessageBox::message(tr( "AdvancedFm" ), |
767 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); | 732 | tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); |
768 | } | 733 | } else { |
769 | else | 734 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
770 | { | 735 | if((*it) != dir) { |
771 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 736 | //current item is not our current dir, so add it to temp list |
772 | { | ||
773 | if((*it) != dir)//current item is not our current dir, so add it to temp list | ||
774 | { | ||
775 | list2 <<(*it); | 737 | list2 <<(*it); |
776 | } | 738 | } else { |
777 | else | ||
778 | { | ||
779 | // customDirMenu->removeItem( ramble); | 739 | // customDirMenu->removeItem( ramble); |
780 | menuButton->remove( ramble); | 740 | menuButton->remove( ramble); |
781 | 741 | ||
@@ -791,23 +751,18 @@ void AdvancedFm::removeCustomDir() | |||
791 | 751 | ||
792 | } | 752 | } |
793 | 753 | ||
794 | void AdvancedFm::gotoCustomDir(const QString &dir) | 754 | void AdvancedFm::gotoCustomDir(const QString &dir) { |
795 | { | ||
796 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); | 755 | // qDebug("gotoCustomDir(const QString &dir) " +dir ); |
797 | // QString curDir = dir; | 756 | // QString curDir = dir; |
798 | // QDir *thisDir = CurrentDir(); | 757 | // QDir *thisDir = CurrentDir(); |
799 | // if( curDir.isEmpty()) { | 758 | // if( curDir.isEmpty()) { |
800 | // } | 759 | // } |
801 | if( dir == s_addBookmark) | 760 | if( dir == s_addBookmark) { |
802 | { | ||
803 | addCustomDir(); | 761 | addCustomDir(); |
804 | } | 762 | } |
805 | if( dir == s_removeBookmark) | 763 | if( dir == s_removeBookmark) { |
806 | { | ||
807 | removeCustomDir( ); | 764 | removeCustomDir( ); |
808 | } | 765 | } else { |
809 | else | ||
810 | { | ||
811 | gotoDirectory( dir); | 766 | gotoDirectory( dir); |
812 | // if(QDir( curDir).exists() ) | 767 | // if(QDir( curDir).exists() ) |
813 | // { | 768 | // { |
@@ -819,59 +774,56 @@ void AdvancedFm::gotoCustomDir(const QString &dir) | |||
819 | } | 774 | } |
820 | } | 775 | } |
821 | 776 | ||
822 | QDir *AdvancedFm::CurrentDir() | 777 | QDir *AdvancedFm::CurrentDir() { |
823 | { | 778 | |
824 | if ( whichTab == 1) | 779 | if ( whichTab == 1) { |
825 | { | ||
826 | return ¤tDir; | 780 | return ¤tDir; |
827 | } | 781 | } else { |
828 | else | ||
829 | { | ||
830 | return ¤tRemoteDir; | 782 | return ¤tRemoteDir; |
831 | } | 783 | } |
832 | } | 784 | } |
833 | 785 | ||
834 | QDir *AdvancedFm::OtherDir() | 786 | QDir *AdvancedFm::OtherDir() { |
835 | { | 787 | if ( whichTab == 1) { |
836 | if ( whichTab == 1) | ||
837 | { | ||
838 | return ¤tRemoteDir; | 788 | return ¤tRemoteDir; |
839 | } | 789 | } else { |
840 | else | ||
841 | { | ||
842 | return ¤tDir; | 790 | return ¤tDir; |
843 | } | 791 | } |
844 | } | 792 | } |
845 | 793 | ||
846 | QListView * AdvancedFm::CurrentView() | 794 | QListView * AdvancedFm::CurrentView() { |
847 | { | 795 | if ( whichTab == 1) { |
848 | if ( whichTab == 1) | 796 | // qWarning("CurrentView Tab 1"); |
849 | return Local_View; | 797 | return Local_View; |
850 | else | 798 | } else { |
799 | // qWarning("CurrentView Tab 2"); | ||
851 | return Remote_View; | 800 | return Remote_View; |
852 | } | 801 | } |
802 | } | ||
853 | 803 | ||
854 | QListView * AdvancedFm::OtherView() | 804 | QListView * AdvancedFm::OtherView() { |
855 | { | ||
856 | if ( whichTab == 1) | 805 | if ( whichTab == 1) |
857 | return Remote_View; | 806 | return Remote_View; |
858 | else | 807 | else |
859 | return Local_View; | 808 | return Local_View; |
860 | } | 809 | } |
861 | 810 | ||
862 | void AdvancedFm::setOtherTabCurrent() | 811 | void AdvancedFm::setOtherTabCurrent() { |
863 | { | 812 | // qWarning("setOtherTabCurrent()"); |
864 | if ( whichTab == 1) | 813 | if ( whichTab == 1) { |
865 | TabWidget->setCurrentWidget(1); | 814 | TabWidget->setCurrentWidget(1); |
866 | else | 815 | } else { |
867 | TabWidget->setCurrentWidget(0); | 816 | TabWidget->setCurrentWidget(0); |
868 | } | 817 | } |
818 | OtherView()->setFocus(); | ||
819 | OtherView()->setSelected( CurrentView()->firstChild(), true); | ||
820 | } | ||
869 | 821 | ||
870 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | 822 | void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { |
871 | qDebug("qcop message "+msg ); | 823 | // qDebug("qcop message "+msg ); |
872 | QDataStream stream ( data, IO_ReadOnly ); | 824 | QDataStream stream ( data, IO_ReadOnly ); |
873 | if ( msg == "openDirectory(QString)" ) { | 825 | if ( msg == "openDirectory(QString)" ) { |
874 | qDebug("received"); | 826 | // qDebug("received"); |
875 | QString file; | 827 | QString file; |
876 | stream >> file; | 828 | stream >> file; |
877 | gotoDirectory( (const QString &) file); | 829 | gotoDirectory( (const QString &) file); |
@@ -884,7 +836,7 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | |||
884 | } | 836 | } |
885 | 837 | ||
886 | void AdvancedFm::gotoDirectory(const QString &file) { | 838 | void AdvancedFm::gotoDirectory(const QString &file) { |
887 | 839 | // qWarning("goto dir "+file); | |
888 | QString curDir = file; | 840 | QString curDir = file; |
889 | QDir *thisDir = CurrentDir(); | 841 | QDir *thisDir = CurrentDir(); |
890 | if(QDir( curDir).exists() ) { | 842 | if(QDir( curDir).exists() ) { |
@@ -918,3 +870,22 @@ void AdvancedFm::findFile(const QString &fileName) { | |||
918 | } | 870 | } |
919 | } | 871 | } |
920 | } | 872 | } |
873 | |||
874 | void AdvancedFm::slotSwitchMenu(int ) { | ||
875 | // qDebug("Switch %d", item); | ||
876 | // viewMenu->setItemChecked(item, true); | ||
877 | } | ||
878 | |||
879 | void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { | ||
880 | tabChanged( w); | ||
881 | if( w == Local_View) { | ||
882 | Remote_View->clearFocus(); | ||
883 | } else { | ||
884 | Local_View->clearFocus(); | ||
885 | } | ||
886 | } | ||
887 | |||
888 | void AdvancedFm::navigateToSelected() { | ||
889 | if( !CurrentView()->currentItem()) return; | ||
890 | doDirChange(); | ||
891 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 5e2c769..5f6eabb 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -58,6 +58,7 @@ public: | |||
58 | AdvancedFm(); | 58 | AdvancedFm(); |
59 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
60 | protected slots: | 60 | protected slots: |
61 | void slotSwitchMenu(int); | ||
61 | void selectAll(); | 62 | void selectAll(); |
62 | void addToDocs(); | 63 | void addToDocs(); |
63 | void doDirChange(); | 64 | void doDirChange(); |
@@ -128,8 +129,10 @@ protected: | |||
128 | QListView *CurrentView(); | 129 | QListView *CurrentView(); |
129 | QListView *OtherView(); | 130 | QListView *OtherView(); |
130 | void setOtherTabCurrent(); | 131 | void setOtherTabCurrent(); |
132 | void dealWithSchmooSchmaa(QWidget *); | ||
131 | 133 | ||
132 | protected slots: | 134 | protected slots: |
135 | void openSearch(); | ||
133 | void dirMenuSelected(int); | 136 | void dirMenuSelected(int); |
134 | void showFileMenu(); | 137 | void showFileMenu(); |
135 | void cancelMenuTimer(); | 138 | void cancelMenuTimer(); |
@@ -152,6 +155,8 @@ protected slots: | |||
152 | void doBeam(); | 155 | void doBeam(); |
153 | void fileBeamFinished( Ir *); | 156 | void fileBeamFinished( Ir *); |
154 | 157 | ||
158 | // void slotSwitchtoLocal(int); | ||
159 | |||
155 | private: | 160 | private: |
156 | MenuButton *menuButton; | 161 | MenuButton *menuButton; |
157 | QString oldName; | 162 | QString oldName; |
@@ -165,7 +170,7 @@ private: | |||
165 | void addCustomDir(); | 170 | void addCustomDir(); |
166 | void removeCustomDir(); | 171 | void removeCustomDir(); |
167 | void gotoDirectory(const QString &); | 172 | void gotoDirectory(const QString &); |
168 | void openSearch(); | 173 | void navigateToSelected(); |
169 | void findFile(const QString &); | 174 | void findFile(const QString &); |
170 | 175 | ||
171 | private slots: | 176 | private slots: |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 463b202..ddaa39a 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -98,11 +98,13 @@ void AdvancedFm::init() { | |||
98 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 98 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
99 | fileMenu->setCheckable(TRUE); | 99 | fileMenu->setCheckable(TRUE); |
100 | 100 | ||
101 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 101 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
102 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 102 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
103 | // viewMenu->insertSeparator(); | 103 | // viewMenu->insertSeparator(); |
104 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 104 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
105 | viewMenu->setCheckable(TRUE); | 105 | viewMenu->setCheckable(true); |
106 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | ||
107 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | ||
106 | 108 | ||
107 | s_addBookmark = tr("Bookmark Directory"); | 109 | s_addBookmark = tr("Bookmark Directory"); |
108 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 110 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
@@ -120,13 +122,14 @@ void AdvancedFm::init() { | |||
120 | menuButton->insertItem( s_addBookmark); | 122 | menuButton->insertItem( s_addBookmark); |
121 | menuButton->insertItem( s_removeBookmark); | 123 | menuButton->insertItem( s_removeBookmark); |
122 | menuButton->insertSeparator(); | 124 | menuButton->insertSeparator(); |
125 | menuButton->setFocusPolicy(NoFocus); | ||
123 | 126 | ||
124 | customDirsToMenu(); | 127 | customDirsToMenu(); |
125 | 128 | ||
126 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); | 129 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); |
127 | currentPathCombo->setEditable(TRUE); | 130 | currentPathCombo->setEditable(TRUE); |
128 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 131 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
129 | 132 | currentPathCombo->setFocusPolicy(NoFocus); | |
130 | layout->addWidget( lineBox ); | 133 | layout->addWidget( lineBox ); |
131 | 134 | ||
132 | 135 | ||
@@ -148,6 +151,8 @@ void AdvancedFm::init() { | |||
148 | Local_View->setAllColumnsShowFocus(TRUE); | 151 | Local_View->setAllColumnsShowFocus(TRUE); |
149 | Local_View->setMultiSelection( TRUE ); | 152 | Local_View->setMultiSelection( TRUE ); |
150 | Local_View->setSelectionMode(QListView::Extended); | 153 | Local_View->setSelectionMode(QListView::Extended); |
154 | Local_View->setFocusPolicy(StrongFocus); | ||
155 | Local_View->installEventFilter( this ); | ||
151 | 156 | ||
152 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 157 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
153 | 158 | ||
@@ -170,7 +175,8 @@ void AdvancedFm::init() { | |||
170 | Remote_View->setAllColumnsShowFocus(TRUE); | 175 | Remote_View->setAllColumnsShowFocus(TRUE); |
171 | Remote_View->setMultiSelection( TRUE ); | 176 | Remote_View->setMultiSelection( TRUE ); |
172 | Remote_View->setSelectionMode(QListView::Extended); | 177 | Remote_View->setSelectionMode(QListView::Extended); |
173 | 178 | Remote_View->setFocusPolicy(StrongFocus); | |
179 | Remote_View->installEventFilter( this ); | ||
174 | 180 | ||
175 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 181 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
176 | 182 | ||
@@ -203,16 +209,11 @@ void AdvancedFm::init() { | |||
203 | 209 | ||
204 | /////////////// | 210 | /////////////// |
205 | 211 | ||
206 | 212 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | |
207 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | ||
208 | if (uname(&name) != -1) { | ||
209 | QString release=name.release; | ||
210 | if(release.find("embedix",0,TRUE) !=-1) { | ||
211 | zaurusDevice=TRUE; | 213 | zaurusDevice=TRUE; |
212 | } else { | 214 | else |
213 | zaurusDevice=FALSE; | 215 | zaurusDevice=FALSE; |
214 | } | 216 | |
215 | } | ||
216 | 217 | ||
217 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 218 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
218 | qDebug("not have sd"); | 219 | qDebug("not have sd"); |
@@ -280,7 +281,8 @@ void AdvancedFm::initConnections() | |||
280 | 281 | ||
281 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | 282 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); |
282 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | 283 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); |
283 | 284 | connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int ))); | |
284 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 285 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
285 | 286 | ||
286 | } | 287 | } |
288 | |||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 544350c..c0be948 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -46,61 +46,50 @@ | |||
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | 47 | ||
48 | 48 | ||
49 | void AdvancedFm::doDirChange() | 49 | void AdvancedFm::doDirChange() { |
50 | { | 50 | QString pathItem = CurrentView()->currentItem()->text(0); |
51 | if( pathItem == "../") { | ||
51 | ListClicked( CurrentView()->currentItem()); | 52 | ListClicked( CurrentView()->currentItem()); |
53 | } else { | ||
54 | if( pathItem.find(" -> ",0,TRUE) != -1) | ||
55 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; | ||
56 | // qWarning(pathItem); | ||
57 | gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); | ||
58 | } | ||
52 | } | 59 | } |
53 | 60 | ||
54 | void AdvancedFm::showMenuHidden() | 61 | void AdvancedFm::showMenuHidden() { |
55 | { | 62 | if (b) { |
56 | if (b) | ||
57 | { | ||
58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 63 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 64 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 65 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
61 | // b=FALSE; | 66 | } else { |
62 | |||
63 | } | ||
64 | else | ||
65 | { | ||
66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 67 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
69 | // b=TRUE; | ||
70 | } | 70 | } |
71 | rePopulate(); | 71 | rePopulate(); |
72 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | ||
73 | b = !b; | 72 | b = !b; |
74 | } | 73 | } |
75 | 74 | ||
76 | void AdvancedFm::showHidden() | 75 | void AdvancedFm::showHidden() { |
77 | { | 76 | if (b) { |
78 | if (b) | ||
79 | { | ||
80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 77 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 78 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
82 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 79 | } else { |
83 | // b=FALSE; | ||
84 | |||
85 | } | ||
86 | else | ||
87 | { | ||
88 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
89 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
90 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | ||
91 | // b=TRUE; | ||
92 | } | 82 | } |
93 | rePopulate(); | 83 | rePopulate(); |
94 | } | 84 | } |
95 | 85 | ||
96 | QString AdvancedFm::dealWithSymName(const QString &fileName) | 86 | QString AdvancedFm::dealWithSymName(const QString &fileName) { |
97 | { | ||
98 | QString strItem = fileName; | 87 | QString strItem = fileName; |
99 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 88 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
100 | } | 89 | } |
101 | 90 | ||
102 | void AdvancedFm::runThis() | 91 | void AdvancedFm::runThis() { |
103 | { | 92 | if( !CurrentView()->currentItem()) return; |
104 | QString fs; | 93 | QString fs; |
105 | QDir *thisDir = CurrentDir(); | 94 | QDir *thisDir = CurrentDir(); |
106 | 95 | ||
@@ -111,12 +100,11 @@ void AdvancedFm::runThis() | |||
111 | 100 | ||
112 | curFile = dealWithSymName((const QString&)curFile); | 101 | curFile = dealWithSymName((const QString&)curFile); |
113 | 102 | ||
114 | if(curFile != "../") | 103 | if(curFile != "../") { |
115 | { | ||
116 | 104 | ||
117 | fs = getFileSystemType((const QString &) path); | 105 | fs = getFileSystemType((const QString &) path); |
118 | QFileInfo fileInfo( path + "/" + curFile); | 106 | QFileInfo fileInfo( path + "/" + curFile); |
119 | qDebug( fileInfo.owner()); | 107 | // qDebug( fileInfo.owner()); |
120 | 108 | ||
121 | if( (fileInfo.permission( QFileInfo::ExeUser) | 109 | if( (fileInfo.permission( QFileInfo::ExeUser) |
122 | | fileInfo.permission( QFileInfo::ExeGroup) | 110 | | fileInfo.permission( QFileInfo::ExeGroup) |
@@ -124,29 +112,23 @@ void AdvancedFm::runThis() | |||
124 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 112 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
125 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 113 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
126 | e << curFile; | 114 | e << curFile; |
127 | } | 115 | } else { |
128 | else | ||
129 | { | ||
130 | curFile = path + "/" + curFile; | 116 | curFile = path + "/" + curFile; |
131 | DocLnk nf(curFile); | 117 | DocLnk nf(curFile); |
132 | QString execStr = nf.exec(); | 118 | QString execStr = nf.exec(); |
133 | qDebug( execStr); | 119 | // qDebug( execStr); |
134 | if( execStr.isEmpty() ) | 120 | if( execStr.isEmpty() ) { |
135 | { | 121 | } else { |
136 | } | ||
137 | else | ||
138 | { | ||
139 | nf.execute(); | 122 | nf.execute(); |
140 | } | 123 | } |
141 | } | 124 | } |
142 | } | 125 | } |
143 | } | 126 | } |
144 | 127 | ||
145 | void AdvancedFm::runText() | 128 | void AdvancedFm::runText() { |
146 | { | 129 | if( !CurrentView()->currentItem()) return; |
147 | QString curFile = CurrentView()->currentItem()->text(0); | 130 | QString curFile = CurrentView()->currentItem()->text(0); |
148 | if(curFile != "../") | 131 | if(curFile != "../") { |
149 | { | ||
150 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 132 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
151 | curFile = dealWithSymName((const QString&)curFile); | 133 | curFile = dealWithSymName((const QString&)curFile); |
152 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; | 134 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; |
@@ -155,13 +137,11 @@ void AdvancedFm::runText() | |||
155 | } | 137 | } |
156 | } | 138 | } |
157 | 139 | ||
158 | void AdvancedFm::makeDir() | 140 | void AdvancedFm::makeDir() { |
159 | { | ||
160 | InputDialog *fileDlg; | 141 | InputDialog *fileDlg; |
161 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 142 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
162 | fileDlg->exec(); | 143 | fileDlg->exec(); |
163 | if( fileDlg->result() == 1 ) | 144 | if( fileDlg->result() == 1 ) { |
164 | { | ||
165 | QDir *thisDir = CurrentDir(); | 145 | QDir *thisDir = CurrentDir(); |
166 | QString filename = fileDlg->LineEdit1->text(); | 146 | QString filename = fileDlg->LineEdit1->text(); |
167 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); | 147 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); |
@@ -169,8 +149,7 @@ void AdvancedFm::makeDir() | |||
169 | populateView(); | 149 | populateView(); |
170 | } | 150 | } |
171 | 151 | ||
172 | void AdvancedFm::doDelete() | 152 | void AdvancedFm::doDelete() { |
173 | { | ||
174 | QStringList curFileList = getPath(); | 153 | QStringList curFileList = getPath(); |
175 | bool doMsg=true; | 154 | bool doMsg=true; |
176 | int count = curFileList.count(); | 155 | int count = curFileList.count(); |
@@ -235,12 +214,12 @@ void AdvancedFm::doDelete() | |||
235 | QFile file(f); | 214 | QFile file(f); |
236 | QFileInfo fi(myFile); | 215 | QFileInfo fi(myFile); |
237 | if( fi.fileName().find("../",0,TRUE)==-1) { | 216 | if( fi.fileName().find("../",0,TRUE)==-1) { |
238 | qDebug("remove link files "+myFile); | 217 | // qDebug("remove link files "+myFile); |
239 | 218 | ||
240 | // DocLnk lnk(f); | 219 | // DocLnk lnk(f); |
241 | DocLnk *lnk; | 220 | DocLnk *lnk; |
242 | lnk = new DocLnk(f); | 221 | lnk = new DocLnk(f); |
243 | qDebug("Deleting doclnk " + lnk->linkFile()); | 222 | // qDebug("Deleting doclnk " + lnk->linkFile()); |
244 | if(lnk->isValid()) | 223 | if(lnk->isValid()) |
245 | lnk->removeLinkFile(); | 224 | lnk->removeLinkFile(); |
246 | // delete lnk; | 225 | // delete lnk; |
@@ -252,15 +231,13 @@ void AdvancedFm::doDelete() | |||
252 | populateView(); | 231 | populateView(); |
253 | } | 232 | } |
254 | 233 | ||
255 | void AdvancedFm::filePerms() | 234 | void AdvancedFm::filePerms() { |
256 | { | ||
257 | QStringList curFileList = getPath(); | 235 | QStringList curFileList = getPath(); |
258 | QString filePath; | 236 | QString filePath; |
259 | 237 | ||
260 | filePath = CurrentDir()->canonicalPath()+"/"; | 238 | filePath = CurrentDir()->canonicalPath()+"/"; |
261 | 239 | ||
262 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 240 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
263 | { | ||
264 | filePermissions *filePerm; | 241 | filePermissions *filePerm; |
265 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 242 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
266 | filePerm->showMaximized(); | 243 | filePerm->showMaximized(); |
@@ -271,8 +248,7 @@ void AdvancedFm::filePerms() | |||
271 | populateView(); | 248 | populateView(); |
272 | } | 249 | } |
273 | 250 | ||
274 | void AdvancedFm::doProperties() | 251 | void AdvancedFm::doProperties() { |
275 | { | ||
276 | #if defined(QT_QWS_OPIE) | 252 | #if defined(QT_QWS_OPIE) |
277 | 253 | ||
278 | QStringList curFileList = getPath(); | 254 | QStringList curFileList = getPath(); |
@@ -280,11 +256,10 @@ void AdvancedFm::doProperties() | |||
280 | QString filePath; | 256 | QString filePath; |
281 | filePath = CurrentDir()->canonicalPath()+"/"; | 257 | filePath = CurrentDir()->canonicalPath()+"/"; |
282 | 258 | ||
283 | qDebug("%d",curFileList.count()); | 259 | // qDebug("%d",curFileList.count()); |
284 | 260 | ||
285 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 261 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
286 | { | 262 | // qDebug((filePath+*it)); |
287 | qDebug((filePath+*it)); | ||
288 | DocLnk lnk( (filePath+*it)); | 263 | DocLnk lnk( (filePath+*it)); |
289 | LnkProperties prop( &lnk ); | 264 | LnkProperties prop( &lnk ); |
290 | prop.showMaximized(); | 265 | prop.showMaximized(); |
@@ -294,8 +269,7 @@ void AdvancedFm::doProperties() | |||
294 | 269 | ||
295 | } | 270 | } |
296 | 271 | ||
297 | void AdvancedFm::upDir() | 272 | void AdvancedFm::upDir() { |
298 | { | ||
299 | QDir *thisDir = CurrentDir(); | 273 | QDir *thisDir = CurrentDir(); |
300 | QString current = thisDir->canonicalPath(); | 274 | QString current = thisDir->canonicalPath(); |
301 | QDir dir(current); | 275 | QDir dir(current); |
@@ -308,8 +282,7 @@ void AdvancedFm::upDir() | |||
308 | update(); | 282 | update(); |
309 | } | 283 | } |
310 | 284 | ||
311 | void AdvancedFm::copy() | 285 | void AdvancedFm::copy() { |
312 | { | ||
313 | qApp->processEvents(); | 286 | qApp->processEvents(); |
314 | QStringList curFileList = getPath(); | 287 | QStringList curFileList = getPath(); |
315 | 288 | ||
@@ -335,8 +308,7 @@ void AdvancedFm::copy() | |||
335 | } | 308 | } |
336 | 309 | ||
337 | QString curFile, item, destFile; | 310 | QString curFile, item, destFile; |
338 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 311 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
339 | { | ||
340 | item=(*it); | 312 | item=(*it); |
341 | if(item.find("->",0,TRUE)) //symlink | 313 | if(item.find("->",0,TRUE)) //symlink |
342 | item = item.left(item.find("->",0,TRUE)); | 314 | item = item.left(item.find("->",0,TRUE)); |
@@ -344,18 +316,15 @@ void AdvancedFm::copy() | |||
344 | curFile = thisDir->canonicalPath()+"/"+ item; | 316 | curFile = thisDir->canonicalPath()+"/"+ item; |
345 | destFile = thatDir->canonicalPath()+"/"+ item; | 317 | destFile = thatDir->canonicalPath()+"/"+ item; |
346 | 318 | ||
347 | qDebug("Destination file is "+destFile); | 319 | // qDebug("Destination file is "+destFile); |
348 | qDebug("CurrentFile file is " + curFile); | 320 | // qDebug("CurrentFile file is " + curFile); |
349 | 321 | ||
350 | QFile f(destFile); | 322 | QFile f(destFile); |
351 | if( f.exists()) | 323 | if( f.exists()) { |
352 | { | 324 | if(doMsg) { |
353 | if(doMsg) | ||
354 | { | ||
355 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 325 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
356 | tr("%1 exists. Ok to overwrite?").arg( item ), | 326 | tr("%1 exists. Ok to overwrite?").arg( item ), |
357 | tr("Yes"),tr("No"),0,0,1) ) | 327 | tr("Yes"),tr("No"),0,0,1) ) { |
358 | { | ||
359 | case 1: | 328 | case 1: |
360 | return; | 329 | return; |
361 | break; | 330 | break; |
@@ -370,13 +339,12 @@ void AdvancedFm::copy() | |||
370 | return; | 339 | return; |
371 | } | 340 | } |
372 | } | 341 | } |
342 | rePopulate(); | ||
373 | setOtherTabCurrent(); | 343 | setOtherTabCurrent(); |
374 | populateView(); | ||
375 | } | 344 | } |
376 | } | 345 | } |
377 | 346 | ||
378 | void AdvancedFm::copyAs() | 347 | void AdvancedFm::copyAs() { |
379 | { | ||
380 | qApp->processEvents(); | 348 | qApp->processEvents(); |
381 | 349 | ||
382 | QStringList curFileList = getPath(); | 350 | QStringList curFileList = getPath(); |
@@ -386,8 +354,7 @@ void AdvancedFm::copyAs() | |||
386 | QDir *thisDir = CurrentDir(); | 354 | QDir *thisDir = CurrentDir(); |
387 | QDir *thatDir = OtherDir(); | 355 | QDir *thatDir = OtherDir(); |
388 | 356 | ||
389 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 357 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
390 | { | ||
391 | QString destFile; | 358 | QString destFile; |
392 | item=(*it); | 359 | item=(*it); |
393 | curFile = thisDir->canonicalPath()+"/"+(*it); | 360 | curFile = thisDir->canonicalPath()+"/"+(*it); |
@@ -396,18 +363,15 @@ void AdvancedFm::copyAs() | |||
396 | fileDlg->setInputText((const QString &) destFile ); | 363 | fileDlg->setInputText((const QString &) destFile ); |
397 | fileDlg->exec(); | 364 | fileDlg->exec(); |
398 | 365 | ||
399 | if( fileDlg->result() == 1 ) | 366 | if( fileDlg->result() == 1 ) { |
400 | { | ||
401 | QString filename = fileDlg->LineEdit1->text(); | 367 | QString filename = fileDlg->LineEdit1->text(); |
402 | destFile = thatDir->canonicalPath()+"/"+filename; | 368 | destFile = thatDir->canonicalPath()+"/"+filename; |
403 | 369 | ||
404 | QFile f( destFile); | 370 | QFile f( destFile); |
405 | if( f.exists()) | 371 | if( f.exists()) { |
406 | { | ||
407 | switch (QMessageBox::warning(this,tr("File Exists!"), | 372 | switch (QMessageBox::warning(this,tr("File Exists!"), |
408 | item+tr("\nexists. Ok to overwrite?"), | 373 | item+tr("\nexists. Ok to overwrite?"), |
409 | tr("Yes"),tr("No"),0,0,1) ) | 374 | tr("Yes"),tr("No"),0,0,1) ) { |
410 | { | ||
411 | case 0: | 375 | case 0: |
412 | f.remove(); | 376 | f.remove(); |
413 | break; | 377 | break; |
@@ -425,12 +389,11 @@ void AdvancedFm::copyAs() | |||
425 | delete fileDlg; | 389 | delete fileDlg; |
426 | 390 | ||
427 | } | 391 | } |
392 | rePopulate(); | ||
428 | setOtherTabCurrent(); | 393 | setOtherTabCurrent(); |
429 | populateView(); | ||
430 | } | 394 | } |
431 | 395 | ||
432 | void AdvancedFm::copySameDir() | 396 | void AdvancedFm::copySameDir() { |
433 | { | ||
434 | qApp->processEvents(); | 397 | qApp->processEvents(); |
435 | QStringList curFileList = getPath(); | 398 | QStringList curFileList = getPath(); |
436 | QString curFile, item, destFile; | 399 | QString curFile, item, destFile; |
@@ -438,8 +401,7 @@ void AdvancedFm::copySameDir() | |||
438 | 401 | ||
439 | QDir *thisDir = CurrentDir(); | 402 | QDir *thisDir = CurrentDir(); |
440 | 403 | ||
441 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 404 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
442 | { | ||
443 | item=(*it); | 405 | item=(*it); |
444 | curFile = thisDir->canonicalPath()+"/"+ item; | 406 | curFile = thisDir->canonicalPath()+"/"+ item; |
445 | 407 | ||
@@ -447,15 +409,13 @@ void AdvancedFm::copySameDir() | |||
447 | fileDlg->setInputText((const QString &) destFile ); | 409 | fileDlg->setInputText((const QString &) destFile ); |
448 | fileDlg->exec(); | 410 | fileDlg->exec(); |
449 | 411 | ||
450 | if( fileDlg->result() == 1 ) | 412 | if( fileDlg->result() == 1 ) { |
451 | { | ||
452 | 413 | ||
453 | QString filename = fileDlg->LineEdit1->text(); | 414 | QString filename = fileDlg->LineEdit1->text(); |
454 | destFile = thisDir->canonicalPath()+"/"+filename; | 415 | destFile = thisDir->canonicalPath()+"/"+filename; |
455 | 416 | ||
456 | QFile f(destFile); | 417 | QFile f(destFile); |
457 | if( f.exists()) | 418 | if( f.exists()) { |
458 | { | ||
459 | switch (QMessageBox::warning(this,tr("Delete"), | 419 | switch (QMessageBox::warning(this,tr("Delete"), |
460 | destFile+tr(" already exists.\nDo you really want to delete it?"), | 420 | destFile+tr(" already exists.\nDo you really want to delete it?"), |
461 | tr("Yes"),tr("No"),0,0,1) ) { | 421 | tr("Yes"),tr("No"),0,0,1) ) { |
@@ -474,39 +434,36 @@ void AdvancedFm::copySameDir() | |||
474 | return; | 434 | return; |
475 | } | 435 | } |
476 | 436 | ||
477 | qDebug("copy "+curFile+" as "+destFile); | 437 | // qDebug("copy "+curFile+" as "+destFile); |
478 | } | 438 | } |
479 | delete fileDlg; | 439 | delete fileDlg; |
480 | } | 440 | } |
481 | populateView(); | 441 | populateView(); |
482 | } | 442 | } |
483 | 443 | ||
484 | void AdvancedFm::move() | 444 | void AdvancedFm::move() { |
485 | { | ||
486 | qApp->processEvents(); | 445 | qApp->processEvents(); |
487 | 446 | ||
488 | QStringList curFileList = getPath(); | 447 | QStringList curFileList = getPath(); |
489 | if( curFileList.count() > 0) | 448 | if( curFileList.count() > 0) { |
490 | { | ||
491 | QString curFile, destFile, item; | 449 | QString curFile, destFile, item; |
492 | 450 | ||
493 | QDir *thisDir = CurrentDir(); | 451 | QDir *thisDir = CurrentDir(); |
494 | QDir *thatDir = OtherDir(); | 452 | QDir *thatDir = OtherDir(); |
495 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 453 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
496 | { | ||
497 | item=(*it); | 454 | item=(*it); |
498 | QString destFile = thatDir->canonicalPath(); | 455 | QString destFile = thatDir->canonicalPath(); |
499 | 456 | ||
500 | if(destFile.right(1).find("/",0,TRUE) == -1) | 457 | if(destFile.right(1).find("/",0,TRUE) == -1) |
501 | destFile+="/"; | 458 | destFile+="/"; |
502 | destFile += item; | 459 | destFile += item; |
503 | qDebug("Destination file is "+destFile); | 460 | // qDebug("Destination file is "+destFile); |
504 | 461 | ||
505 | curFile = thisDir->canonicalPath(); | 462 | curFile = thisDir->canonicalPath(); |
506 | if(curFile.right(1).find("/",0,TRUE) == -1) | 463 | if(curFile.right(1).find("/",0,TRUE) == -1) |
507 | curFile +="/"; | 464 | curFile +="/"; |
508 | curFile+= item; | 465 | curFile+= item; |
509 | qDebug("CurrentFile file is " + curFile); | 466 | // qDebug("CurrentFile file is " + curFile); |
510 | 467 | ||
511 | QFile f( curFile); | 468 | QFile f( curFile); |
512 | if( f.exists()) { | 469 | if( f.exists()) { |
@@ -519,13 +476,11 @@ void AdvancedFm::move() | |||
519 | } | 476 | } |
520 | 477 | ||
521 | } | 478 | } |
522 | populateView(); | 479 | rePopulate(); |
523 | setOtherTabCurrent(); | 480 | setOtherTabCurrent(); |
524 | populateView(); | ||
525 | } | 481 | } |
526 | 482 | ||
527 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | 483 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
528 | { | ||
529 | bool success = true; | 484 | bool success = true; |
530 | struct stat status; | 485 | struct stat status; |
531 | QFile srcFile(src); | 486 | QFile srcFile(src); |
@@ -536,14 +491,14 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
536 | struct stat stat_buf; | 491 | struct stat stat_buf; |
537 | off_t offset = 0; | 492 | off_t offset = 0; |
538 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 493 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
539 | qWarning("open failed"); | 494 | // qWarning("open failed"); |
540 | return success = false; | 495 | return success = false; |
541 | } | 496 | } |
542 | read_fd = srcFile.handle(); | 497 | read_fd = srcFile.handle(); |
543 | if(read_fd != -1) { | 498 | if(read_fd != -1) { |
544 | fstat (read_fd, &stat_buf); | 499 | fstat (read_fd, &stat_buf); |
545 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 500 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
546 | qWarning("destfile open failed"); | 501 | // qWarning("destfile open failed"); |
547 | return success = false; | 502 | return success = false; |
548 | } | 503 | } |
549 | write_fd = destFile.handle(); | 504 | write_fd = destFile.handle(); |
@@ -558,7 +513,7 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
558 | case EIO: msg = "Unspecified error while reading from in_fd."; | 513 | case EIO: msg = "Unspecified error while reading from in_fd."; |
559 | }; | 514 | }; |
560 | success = false; | 515 | success = false; |
561 | qWarning(msg); | 516 | // qWarning(msg); |
562 | } | 517 | } |
563 | } else { | 518 | } else { |
564 | success = false; | 519 | success = false; |
@@ -576,8 +531,8 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
576 | return success; | 531 | return success; |
577 | } | 532 | } |
578 | 533 | ||
579 | void AdvancedFm::runCommand() | 534 | void AdvancedFm::runCommand() { |
580 | { | 535 | if( !CurrentView()->currentItem()) return; |
581 | QDir *thisDir = CurrentDir(); | 536 | QDir *thisDir = CurrentDir(); |
582 | 537 | ||
583 | QString curFile; | 538 | QString curFile; |
@@ -589,9 +544,8 @@ void AdvancedFm::runCommand() | |||
589 | fileDlg->exec(); | 544 | fileDlg->exec(); |
590 | //QString command; | 545 | //QString command; |
591 | 546 | ||
592 | if( fileDlg->result() == 1 ) | 547 | if( fileDlg->result() == 1 ) { |
593 | { | 548 | // qDebug(fileDlg->LineEdit1->text()); |
594 | qDebug(fileDlg->LineEdit1->text()); | ||
595 | QStringList command; | 549 | QStringList command; |
596 | 550 | ||
597 | command << "/bin/sh"; | 551 | command << "/bin/sh"; |
@@ -606,8 +560,8 @@ void AdvancedFm::runCommand() | |||
606 | } | 560 | } |
607 | } | 561 | } |
608 | 562 | ||
609 | void AdvancedFm::runCommandStd() | 563 | void AdvancedFm::runCommandStd() { |
610 | { | 564 | if( !CurrentView()->currentItem()) return; |
611 | QString curFile; | 565 | QString curFile; |
612 | QDir *thisDir = CurrentDir(); | 566 | QDir *thisDir = CurrentDir(); |
613 | QListView *thisView = CurrentView(); | 567 | QListView *thisView = CurrentView(); |
@@ -619,15 +573,14 @@ void AdvancedFm::runCommandStd() | |||
619 | fileDlg->setInputText(curFile); | 573 | fileDlg->setInputText(curFile); |
620 | fileDlg->exec(); | 574 | fileDlg->exec(); |
621 | 575 | ||
622 | if( fileDlg->result() == 1 ) | 576 | if( fileDlg->result() == 1 ) { |
623 | { | ||
624 | qApp->processEvents(); | 577 | qApp->processEvents(); |
625 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); | 578 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); |
626 | } | 579 | } |
627 | } | 580 | } |
628 | 581 | ||
629 | void AdvancedFm::fileStatus() | 582 | void AdvancedFm::fileStatus() { |
630 | { | 583 | if( !CurrentView()->currentItem()) return; |
631 | QString curFile; | 584 | QString curFile; |
632 | curFile = CurrentView()->currentItem()->text(0); | 585 | curFile = CurrentView()->currentItem()->text(0); |
633 | 586 | ||
@@ -644,57 +597,48 @@ void AdvancedFm::fileStatus() | |||
644 | } | 597 | } |
645 | 598 | ||
646 | 599 | ||
647 | void AdvancedFm::mkDir() | 600 | void AdvancedFm::mkDir() { |
648 | { | ||
649 | makeDir(); | 601 | makeDir(); |
650 | } | 602 | } |
651 | 603 | ||
652 | void AdvancedFm::rn() | 604 | void AdvancedFm::rn() { |
653 | { | ||
654 | renameIt(); | 605 | renameIt(); |
655 | } | 606 | } |
656 | 607 | ||
657 | void AdvancedFm::del() | 608 | void AdvancedFm::del() { |
658 | { | ||
659 | doDelete(); | 609 | doDelete(); |
660 | } | 610 | } |
661 | 611 | ||
662 | void AdvancedFm::mkSym() | 612 | void AdvancedFm::mkSym() { |
663 | { | ||
664 | QString cmd; | 613 | QString cmd; |
665 | QStringList curFileList = getPath(); | 614 | QStringList curFileList = getPath(); |
666 | if( curFileList.count() > 0) | 615 | if( curFileList.count() > 0) { |
667 | { | ||
668 | QDir *thisDir = CurrentDir(); | 616 | QDir *thisDir = CurrentDir(); |
669 | QDir * thatDir = OtherDir(); | 617 | QDir * thatDir = OtherDir(); |
670 | 618 | ||
671 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 619 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
672 | { | ||
673 | 620 | ||
674 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 621 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
675 | if(destName.right(1) == "/") | 622 | if(destName.right(1) == "/") { |
676 | { | ||
677 | destName = destName.left( destName.length() -1); | 623 | destName = destName.left( destName.length() -1); |
678 | } | 624 | } |
679 | 625 | ||
680 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 626 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
681 | 627 | ||
682 | if( curFile.right(1) == "/") | 628 | if( curFile.right(1) == "/") { |
683 | { | ||
684 | curFile = curFile.left( curFile.length() -1); | 629 | curFile = curFile.left( curFile.length() -1); |
685 | } | 630 | } |
686 | 631 | ||
687 | cmd = "ln -s "+curFile+" "+destName; | 632 | cmd = "ln -s "+curFile+" "+destName; |
688 | qDebug(cmd); | 633 | // qDebug(cmd); |
689 | startProcess( (const QString)cmd ); | 634 | startProcess( (const QString)cmd ); |
690 | } | 635 | } |
636 | rePopulate(); | ||
691 | setOtherTabCurrent(); | 637 | setOtherTabCurrent(); |
692 | populateView(); | ||
693 | } | 638 | } |
694 | } | 639 | } |
695 | 640 | ||
696 | void AdvancedFm::doBeam() | 641 | void AdvancedFm::doBeam() { |
697 | { | ||
698 | Ir ir; | 642 | Ir ir; |
699 | if(!ir.supported()) { | 643 | if(!ir.supported()) { |
700 | } else { | 644 | } else { |
@@ -714,25 +658,17 @@ void AdvancedFm::doBeam() | |||
714 | } | 658 | } |
715 | } | 659 | } |
716 | 660 | ||
717 | void AdvancedFm::fileBeamFinished( Ir *) | 661 | void AdvancedFm::fileBeamFinished( Ir *) { |
718 | { | ||
719 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 662 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
720 | } | 663 | } |
721 | 664 | ||
722 | void AdvancedFm::selectAll() | 665 | void AdvancedFm::selectAll() { |
723 | { | ||
724 | // if (TabWidget->currentTab() == 0) { | ||
725 | QListView *thisView = CurrentView(); | 666 | QListView *thisView = CurrentView(); |
726 | thisView->selectAll(true); | 667 | thisView->selectAll(true); |
727 | thisView->setSelected( thisView->firstChild(),false); | 668 | thisView->setSelected( thisView->firstChild(),false); |
728 | // } else { | ||
729 | // Remote_View->selectAll(true); | ||
730 | // Remote_View->setSelected( Remote_View->firstChild(),false); | ||
731 | // } | ||
732 | } | 669 | } |
733 | 670 | ||
734 | void AdvancedFm::startProcess(const QString & cmd) | 671 | void AdvancedFm::startProcess(const QString & cmd) { |
735 | { | ||
736 | QStringList command; | 672 | QStringList command; |
737 | OProcess *process; | 673 | OProcess *process; |
738 | process = new OProcess(); | 674 | process = new OProcess(); |
@@ -750,79 +686,68 @@ void AdvancedFm::startProcess(const QString & cmd) | |||
750 | qDebug("could not start process"); | 686 | qDebug("could not start process"); |
751 | } | 687 | } |
752 | 688 | ||
753 | void AdvancedFm::processEnded(OProcess *) | 689 | void AdvancedFm::processEnded(OProcess *) { |
754 | { | ||
755 | // populateLocalView(); | ||
756 | populateView(); | 690 | populateView(); |
757 | } | 691 | } |
758 | 692 | ||
759 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) { | 693 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
760 | qWarning("received stderrt %d bytes", buflen); | 694 | // qWarning("received stderrt %d bytes", buflen); |
761 | 695 | ||
762 | QString lineStr = buffer; | 696 | QString lineStr = buffer; |
763 | // lineStr=lineStr.left(lineStr.length()-1); | ||
764 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 697 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
765 | |||
766 | // OutputEdit->append(lineStr); | ||
767 | // OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | ||
768 | } | 698 | } |
769 | 699 | ||
770 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) | 700 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
771 | { | 701 | if ( o->inherits( "QLineEdit" ) ) { |
772 | if ( o->inherits( "QLineEdit" ) ) | 702 | if ( e->type() == QEvent::KeyPress ) { |
773 | { | ||
774 | if ( e->type() == QEvent::KeyPress ) | ||
775 | { | ||
776 | QKeyEvent *ke = (QKeyEvent*)e; | 703 | QKeyEvent *ke = (QKeyEvent*)e; |
777 | if ( ke->key() == Key_Return || | 704 | if ( ke->key() == Key_Return || |
778 | ke->key() == Key_Enter ) | 705 | ke->key() == Key_Enter ) { |
779 | { | ||
780 | okRename(); | 706 | okRename(); |
781 | return true; | 707 | return true; |
782 | } | 708 | } |
783 | else if ( ke->key() == Key_Escape ) | 709 | else if ( ke->key() == Key_Escape ) { |
784 | { | ||
785 | cancelRename(); | 710 | cancelRename(); |
786 | return true; | 711 | return true; |
787 | } | 712 | } |
788 | } | 713 | } |
789 | else if ( e->type() == QEvent::FocusOut ) | 714 | else if ( e->type() == QEvent::FocusOut ) { |
790 | { | ||
791 | cancelRename(); | 715 | cancelRename(); |
792 | return true; | 716 | return true; |
793 | } | 717 | } |
794 | } | 718 | } |
795 | if ( o->inherits( "QListView" ) ) | 719 | if ( o->inherits( "QListView" ) ) { |
796 | { | 720 | if ( e->type() == QEvent::FocusIn ) { |
797 | if ( e->type() == QEvent::FocusOut ) | 721 | if( o == Local_View) { //keep track of which view |
798 | { | 722 | whichTab=1; |
799 | printf("focusIn\n"); | ||
800 | |||
801 | } | 723 | } |
724 | else { | ||
725 | whichTab=2; | ||
726 | } | ||
727 | } | ||
728 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | ||
802 | } | 729 | } |
803 | 730 | ||
804 | return QWidget::eventFilter( o, e ); | 731 | return QWidget::eventFilter( o, e ); |
805 | } | 732 | } |
806 | 733 | ||
807 | 734 | ||
808 | void AdvancedFm::cancelRename() | 735 | void AdvancedFm::cancelRename() { |
809 | { | 736 | // qDebug("cancel rename"); |
810 | qDebug("cancel rename"); | ||
811 | QListView * view; | 737 | QListView * view; |
812 | view = CurrentView(); | 738 | view = CurrentView(); |
813 | 739 | ||
814 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 740 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
815 | delete renameBox; | 741 | delete renameBox; |
816 | renameBox = 0; | 742 | renameBox = 0; |
817 | if ( resetFocus ) | 743 | if ( resetFocus ) { |
818 | { | ||
819 | view->viewport()->setFocusProxy( view); | 744 | view->viewport()->setFocusProxy( view); |
820 | view->setFocus(); | 745 | view->setFocus(); |
821 | } | 746 | } |
822 | } | 747 | } |
823 | 748 | ||
824 | void AdvancedFm::doRename(QListView * view) | 749 | void AdvancedFm::doRename(QListView * view) { |
825 | { | 750 | if( !CurrentView()->currentItem()) return; |
826 | 751 | ||
827 | QRect r = view->itemRect( view->currentItem( )); | 752 | QRect r = view->itemRect( view->currentItem( )); |
828 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 753 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
@@ -842,30 +767,26 @@ void AdvancedFm::doRename(QListView * view) | |||
842 | view->viewport()->setFocusProxy( renameBox ); | 767 | view->viewport()->setFocusProxy( renameBox ); |
843 | renameBox->setFocus(); | 768 | renameBox->setFocus(); |
844 | renameBox->show(); | 769 | renameBox->show(); |
845 | |||
846 | } | 770 | } |
847 | 771 | ||
848 | 772 | ||
849 | void AdvancedFm::renameIt() | 773 | void AdvancedFm::renameIt() { |
850 | { | 774 | if( !CurrentView()->currentItem()) return; |
851 | QListView *thisView = CurrentView(); | 775 | QListView *thisView = CurrentView(); |
852 | oldName = thisView->currentItem()->text(0); | 776 | oldName = thisView->currentItem()->text(0); |
853 | doRename( thisView ); | 777 | doRename( thisView ); |
854 | populateView(); | 778 | populateView(); |
855 | } | 779 | } |
856 | 780 | ||
857 | void AdvancedFm::okRename() | 781 | void AdvancedFm::okRename() { |
858 | { | 782 | if( !CurrentView()->currentItem()) return; |
859 | QString newName = renameBox->text(); | 783 | QString newName = renameBox->text(); |
860 | cancelRename(); | 784 | cancelRename(); |
861 | // int tabs=0; | ||
862 | QListView * view = CurrentView(); | 785 | QListView * view = CurrentView(); |
863 | QString path = CurrentDir()->canonicalPath() + "/"; | 786 | QString path = CurrentDir()->canonicalPath() + "/"; |
864 | oldName = path + oldName; | 787 | oldName = path + oldName; |
865 | newName = path + newName; | 788 | newName = path + newName; |
866 | 789 | ||
867 | if( view->currentItem() == NULL) | ||
868 | return; | ||
869 | if( rename( oldName.latin1(), newName.latin1())== -1) | 790 | if( rename( oldName.latin1(), newName.latin1())== -1) |
870 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 791 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
871 | else | 792 | else |
@@ -877,5 +798,5 @@ void AdvancedFm::okRename() | |||
877 | } | 798 | } |
878 | 799 | ||
879 | void AdvancedFm::openSearch() { | 800 | void AdvancedFm::openSearch() { |
880 | 801 | QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); | |
881 | } | 802 | } |
diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp index 4de6d12..9698de7 100644 --- a/noncore/apps/advancedfm/filePermissions.cpp +++ b/noncore/apps/advancedfm/filePermissions.cpp | |||
@@ -31,7 +31,7 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal | |||
31 | : QDialog( parent, name, modal, fl ) | 31 | : QDialog( parent, name, modal, fl ) |
32 | { | 32 | { |
33 | if ( !name ) | 33 | if ( !name ) |
34 | setName( "filePermissions" ); | 34 | setName( tr("filePermissions") ); |
35 | // qDebug("FilePermissions "+fileName); | 35 | // qDebug("FilePermissions "+fileName); |
36 | /* resize( 236, 210 ); | 36 | /* resize( 236, 210 ); |
37 | setMaximumSize( QSize( 236, 210 ) ); | 37 | setMaximumSize( QSize( 236, 210 ) ); |