author | llornkcor <llornkcor> | 2003-09-08 22:22:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-09-08 22:22:00 (UTC) |
commit | e485a3bd44b3cc70280e03eb8a7958a5252cdd6a (patch) (unidiff) | |
tree | cce07d76c2a9060a774898af46e7c8dc8c7b3403 /noncore/apps/advancedfm | |
parent | b3299bab3370865e0e498fd2f7f84f3abbd17e77 (diff) | |
download | opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.zip opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.gz opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.bz2 |
changes for osplitter functionality
-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 | |||
@@ -41,4 +41,6 @@ | |||
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> |
@@ -68,6 +70,5 @@ AdvancedFm::~AdvancedFm() { | |||
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) != "/") |
@@ -80,34 +81,31 @@ void AdvancedFm::cleanUp() | |||
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); |
@@ -116,6 +114,6 @@ void AdvancedFm::populateView() | |||
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*/); |
@@ -134,4 +132,5 @@ void AdvancedFm::populateView() | |||
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; |
@@ -212,22 +211,24 @@ void AdvancedFm::populateView() | |||
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(); |
@@ -235,6 +236,5 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
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() ) |
@@ -242,6 +242,5 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
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()) |
@@ -249,6 +248,5 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
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(); |
@@ -259,10 +257,10 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) | |||
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 | } |
@@ -275,57 +273,46 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) | |||
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 ); |
@@ -335,6 +322,5 @@ void AdvancedFm::fillCombo(const QString ¤tPath) | |||
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); |
@@ -343,14 +329,11 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) | |||
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)); |
@@ -360,6 +343,5 @@ QStringList AdvancedFm::getPath() | |||
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() ); |
@@ -369,6 +351,5 @@ void AdvancedFm::homeButtonPushed() | |||
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() ); |
@@ -378,6 +359,5 @@ void AdvancedFm::docButtonPushed() | |||
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() ); |
@@ -387,6 +367,5 @@ void AdvancedFm::SDButtonPushed() | |||
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) |
@@ -401,6 +380,5 @@ void AdvancedFm::CFButtonPushed() | |||
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" |
@@ -409,10 +387,22 @@ void AdvancedFm::doAbout() | |||
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(); |
@@ -485,6 +475,5 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) | |||
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(); |
@@ -492,6 +481,5 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
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() ); |
@@ -501,6 +489,5 @@ void AdvancedFm::QPEButtonPushed() | |||
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(); |
@@ -508,13 +495,10 @@ void AdvancedFm::parsetab(const QString &fileName) | |||
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 |
@@ -529,6 +513,5 @@ void AdvancedFm::parsetab(const QString &fileName) | |||
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); |
@@ -546,6 +529,5 @@ QString AdvancedFm::getFileSystemType(const QString ¤tText) | |||
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 ) ) { |
@@ -565,6 +547,5 @@ QString AdvancedFm::getDiskSpace( const QString &path) | |||
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); |
@@ -578,11 +559,8 @@ void AdvancedFm::showFileMenu() | |||
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 ) |
@@ -635,16 +613,13 @@ void AdvancedFm::showFileMenu() | |||
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; |
@@ -662,6 +637,5 @@ QString AdvancedFm::checkDiskSpace(const QString &path) | |||
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(); |
@@ -683,6 +657,5 @@ void AdvancedFm::addToDocs() | |||
683 | 657 | ||
684 | 658 | ||
685 | void AdvancedFm::customDirsToMenu() | 659 | void AdvancedFm::customDirsToMenu() { |
686 | { | ||
687 | 660 | ||
688 | Config cfg("AdvancedFm"); | 661 | Config cfg("AdvancedFm"); |
@@ -698,7 +671,5 @@ void AdvancedFm::customDirsToMenu() | |||
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 | { |
@@ -722,6 +693,5 @@ void AdvancedFm::dirMenuSelected(int item) | |||
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"); |
@@ -732,13 +702,10 @@ void AdvancedFm::addCustomDir() | |||
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); |
@@ -750,6 +717,5 @@ void AdvancedFm::addCustomDir() | |||
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"); |
@@ -762,19 +728,13 @@ void AdvancedFm::removeCustomDir() | |||
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); |
@@ -792,6 +752,5 @@ void AdvancedFm::removeCustomDir() | |||
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; |
@@ -799,14 +758,10 @@ void AdvancedFm::gotoCustomDir(const QString &dir) | |||
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() ) |
@@ -820,38 +775,32 @@ void AdvancedFm::gotoCustomDir(const QString &dir) | |||
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; |
@@ -860,17 +809,20 @@ QListView * AdvancedFm::OtherView() | |||
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; |
@@ -885,5 +837,5 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { | |||
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(); |
@@ -919,2 +871,21 @@ void AdvancedFm::findFile(const QString &fileName) { | |||
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 | |||
@@ -59,4 +59,5 @@ public: | |||
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(); |
@@ -129,6 +130,8 @@ protected: | |||
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(); |
@@ -153,4 +156,6 @@ protected slots: | |||
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; |
@@ -166,5 +171,5 @@ private: | |||
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 | ||
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 | |||
@@ -99,9 +99,11 @@ void AdvancedFm::init() { | |||
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"); |
@@ -121,4 +123,5 @@ void AdvancedFm::init() { | |||
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(); |
@@ -127,5 +130,5 @@ void AdvancedFm::init() { | |||
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 | ||
@@ -149,4 +152,6 @@ void AdvancedFm::init() { | |||
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); |
@@ -171,5 +176,6 @@ void AdvancedFm::init() { | |||
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); |
@@ -204,14 +210,9 @@ void AdvancedFm::init() { | |||
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()) { |
@@ -281,6 +282,7 @@ void AdvancedFm::initConnections() | |||
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 | |||
@@ -47,59 +47,48 @@ | |||
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(); |
@@ -112,10 +101,9 @@ void AdvancedFm::runThis() | |||
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) |
@@ -125,16 +113,11 @@ void AdvancedFm::runThis() | |||
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 | } |
@@ -143,9 +126,8 @@ void AdvancedFm::runThis() | |||
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); |
@@ -156,11 +138,9 @@ void AdvancedFm::runText() | |||
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(); |
@@ -170,6 +150,5 @@ void AdvancedFm::makeDir() | |||
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; |
@@ -236,10 +215,10 @@ void AdvancedFm::doDelete() | |||
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(); |
@@ -253,6 +232,5 @@ void AdvancedFm::doDelete() | |||
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; |
@@ -260,6 +238,5 @@ void AdvancedFm::filePerms() | |||
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)); |
@@ -272,6 +249,5 @@ void AdvancedFm::filePerms() | |||
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 | ||
@@ -281,9 +257,8 @@ void AdvancedFm::doProperties() | |||
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 ); |
@@ -295,6 +270,5 @@ void AdvancedFm::doProperties() | |||
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(); |
@@ -309,6 +283,5 @@ void AdvancedFm::upDir() | |||
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(); |
@@ -336,6 +309,5 @@ void AdvancedFm::copy() | |||
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 |
@@ -345,16 +317,13 @@ void AdvancedFm::copy() | |||
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; |
@@ -371,11 +340,10 @@ void AdvancedFm::copy() | |||
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 | ||
@@ -387,6 +355,5 @@ void AdvancedFm::copyAs() | |||
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); |
@@ -397,16 +364,13 @@ void AdvancedFm::copyAs() | |||
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(); |
@@ -426,10 +390,9 @@ void AdvancedFm::copyAs() | |||
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(); |
@@ -439,6 +402,5 @@ void AdvancedFm::copySameDir() | |||
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; |
@@ -448,6 +410,5 @@ void AdvancedFm::copySameDir() | |||
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(); |
@@ -455,6 +416,5 @@ void AdvancedFm::copySameDir() | |||
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?"), |
@@ -475,5 +435,5 @@ void AdvancedFm::copySameDir() | |||
475 | } | 435 | } |
476 | 436 | ||
477 | qDebug("copy "+curFile+" as "+destFile); | 437 | // qDebug("copy "+curFile+" as "+destFile); |
478 | } | 438 | } |
479 | delete fileDlg; | 439 | delete fileDlg; |
@@ -482,17 +442,14 @@ void AdvancedFm::copySameDir() | |||
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(); |
@@ -501,5 +458,5 @@ void AdvancedFm::move() | |||
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(); |
@@ -507,5 +464,5 @@ void AdvancedFm::move() | |||
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); |
@@ -520,11 +477,9 @@ void AdvancedFm::move() | |||
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; |
@@ -537,5 +492,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
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 | } |
@@ -544,5 +499,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
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 | } |
@@ -559,5 +514,5 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
559 | }; | 514 | }; |
560 | success = false; | 515 | success = false; |
561 | qWarning(msg); | 516 | // qWarning(msg); |
562 | } | 517 | } |
563 | } else { | 518 | } else { |
@@ -577,6 +532,6 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) | |||
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 | ||
@@ -590,7 +545,6 @@ void AdvancedFm::runCommand() | |||
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 | ||
@@ -607,6 +561,6 @@ void AdvancedFm::runCommand() | |||
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(); |
@@ -620,6 +574,5 @@ void AdvancedFm::runCommandStd() | |||
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()); |
@@ -627,6 +580,6 @@ void AdvancedFm::runCommandStd() | |||
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); |
@@ -645,34 +598,27 @@ void AdvancedFm::fileStatus() | |||
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 | } |
@@ -680,20 +626,18 @@ void AdvancedFm::mkSym() | |||
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()) { |
@@ -715,23 +659,15 @@ void AdvancedFm::doBeam() | |||
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; |
@@ -751,53 +687,44 @@ void AdvancedFm::startProcess(const QString & cmd) | |||
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 | ||
@@ -806,7 +733,6 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) | |||
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(); |
@@ -815,6 +741,5 @@ void AdvancedFm::cancelRename() | |||
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(); |
@@ -822,6 +747,6 @@ void AdvancedFm::cancelRename() | |||
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( )); |
@@ -843,10 +768,9 @@ void AdvancedFm::doRename(QListView * view) | |||
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); |
@@ -855,9 +779,8 @@ void AdvancedFm::renameIt() | |||
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() + "/"; |
@@ -865,6 +788,4 @@ void AdvancedFm::okRename() | |||
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")); |
@@ -878,4 +799,4 @@ void AdvancedFm::okRename() | |||
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 | |||
@@ -32,5 +32,5 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal | |||
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 ); |