author | erik <erik> | 2007-01-26 20:30:32 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-26 20:30:32 (UTC) |
commit | f77da1ae08512b02a3c50a124f823ed77e53dd64 (patch) (unidiff) | |
tree | ac7e414aff95348e0bf2fba3f45b2a06a4eb4623 | |
parent | 4688f98202f590ec6af6c2e66a49dd2f80536083 (diff) | |
download | opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.zip opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.tar.gz opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.tar.bz2 |
Both packageslave.cpp and textedit.cpp have instances of possibly exploitable
race conditions associated to files. The big deal is that it is quite typical
to use strings of pathnames to track files. But because that does not leverage
the filesystem would be attackers may be able to exploit time lags in uses
of filesystem functions (like stat and chmod or open) to get files with
suspect data into the files that the applications are working with.
This commit closes that potential hole even though there are no known exploits.
Better safe then sorry. There is no change in the behavior of the apps.
-rw-r--r-- | core/apps/textedit/textedit.cpp | 45 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 48 |
2 files changed, 49 insertions, 44 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 4bbc62b..1c81a55 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -271,921 +271,918 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
271 | wa->addTo( advancedMenu); | 271 | wa->addTo( advancedMenu); |
272 | 272 | ||
273 | nStart = new QAction( tr("Start with new file"), | 273 | nStart = new QAction( tr("Start with new file"), |
274 | QString::null, 0, this, 0 ); | 274 | QString::null, 0, this, 0 ); |
275 | connect( nStart, SIGNAL( toggled(bool) ), | 275 | connect( nStart, SIGNAL( toggled(bool) ), |
276 | this, SLOT( changeStartConfig(bool) ) ); | 276 | this, SLOT( changeStartConfig(bool) ) ); |
277 | nStart->setToggleAction(true); | 277 | nStart->setToggleAction(true); |
278 | nStart->addTo( advancedMenu ); | 278 | nStart->addTo( advancedMenu ); |
279 | nStart->setEnabled(false); | 279 | nStart->setEnabled(false); |
280 | 280 | ||
281 | nAdvanced = new QAction( tr("Prompt on Exit"), | 281 | nAdvanced = new QAction( tr("Prompt on Exit"), |
282 | QString::null, 0, this, 0 ); | 282 | QString::null, 0, this, 0 ); |
283 | connect( nAdvanced, SIGNAL( toggled(bool) ), | 283 | connect( nAdvanced, SIGNAL( toggled(bool) ), |
284 | this, SLOT( doPrompt(bool) ) ); | 284 | this, SLOT( doPrompt(bool) ) ); |
285 | nAdvanced->setToggleAction(true); | 285 | nAdvanced->setToggleAction(true); |
286 | nAdvanced->addTo( advancedMenu ); | 286 | nAdvanced->addTo( advancedMenu ); |
287 | 287 | ||
288 | desktopAction = new QAction( tr("Always open linked file"), | 288 | desktopAction = new QAction( tr("Always open linked file"), |
289 | QString::null, 0, this, 0 ); | 289 | QString::null, 0, this, 0 ); |
290 | connect( desktopAction, SIGNAL( toggled(bool) ), | 290 | connect( desktopAction, SIGNAL( toggled(bool) ), |
291 | this, SLOT( doDesktop(bool) ) ); | 291 | this, SLOT( doDesktop(bool) ) ); |
292 | desktopAction->setToggleAction(true); | 292 | desktopAction->setToggleAction(true); |
293 | desktopAction->addTo( advancedMenu); | 293 | desktopAction->addTo( advancedMenu); |
294 | 294 | ||
295 | filePermAction = new QAction( tr("File Permissions"), | 295 | filePermAction = new QAction( tr("File Permissions"), |
296 | QString::null, 0, this, 0 ); | 296 | QString::null, 0, this, 0 ); |
297 | connect( filePermAction, SIGNAL( toggled(bool) ), | 297 | connect( filePermAction, SIGNAL( toggled(bool) ), |
298 | this, SLOT( doFilePerms(bool) ) ); | 298 | this, SLOT( doFilePerms(bool) ) ); |
299 | filePermAction->setToggleAction(true); | 299 | filePermAction->setToggleAction(true); |
300 | filePermAction->addTo( advancedMenu); | 300 | filePermAction->addTo( advancedMenu); |
301 | 301 | ||
302 | searchBarAction = new QAction( tr("Search Bar Open"), | 302 | searchBarAction = new QAction( tr("Search Bar Open"), |
303 | QString::null, 0, this, 0 ); | 303 | QString::null, 0, this, 0 ); |
304 | connect( searchBarAction, SIGNAL( toggled(bool) ), | 304 | connect( searchBarAction, SIGNAL( toggled(bool) ), |
305 | this, SLOT( setSearchBar(bool) ) ); | 305 | this, SLOT( setSearchBar(bool) ) ); |
306 | searchBarAction->setToggleAction(true); | 306 | searchBarAction->setToggleAction(true); |
307 | searchBarAction->addTo( advancedMenu); | 307 | searchBarAction->addTo( advancedMenu); |
308 | 308 | ||
309 | nAutoSave = new QAction( tr("Auto Save 5 min."), | 309 | nAutoSave = new QAction( tr("Auto Save 5 min."), |
310 | QString::null, 0, this, 0 ); | 310 | QString::null, 0, this, 0 ); |
311 | connect( nAutoSave, SIGNAL( toggled(bool) ), | 311 | connect( nAutoSave, SIGNAL( toggled(bool) ), |
312 | this, SLOT( doTimer(bool) ) ); | 312 | this, SLOT( doTimer(bool) ) ); |
313 | nAutoSave->setToggleAction(true); | 313 | nAutoSave->setToggleAction(true); |
314 | nAutoSave->addTo( advancedMenu); | 314 | nAutoSave->addTo( advancedMenu); |
315 | 315 | ||
316 | 316 | ||
317 | //font->insertSeparator(); | 317 | //font->insertSeparator(); |
318 | 318 | ||
319 | //font->insertItem(tr("About"), this, SLOT( doAbout()) ); | 319 | //font->insertItem(tr("About"), this, SLOT( doAbout()) ); |
320 | 320 | ||
321 | mb->insertItem( tr( "File" ), file ); | 321 | mb->insertItem( tr( "File" ), file ); |
322 | mb->insertItem( tr( "Edit" ), edit ); | 322 | mb->insertItem( tr( "Edit" ), edit ); |
323 | mb->insertItem( tr( "View" ), font ); | 323 | mb->insertItem( tr( "View" ), font ); |
324 | 324 | ||
325 | searchBar = new QToolBar(this); | 325 | searchBar = new QToolBar(this); |
326 | addToolBar( searchBar, "Search", QMainWindow::Top, true ); | 326 | addToolBar( searchBar, "Search", QMainWindow::Top, true ); |
327 | 327 | ||
328 | searchBar->setHorizontalStretchable( true ); | 328 | searchBar->setHorizontalStretchable( true ); |
329 | 329 | ||
330 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 330 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
331 | searchBar->setStretchableWidget( searchEdit ); | 331 | searchBar->setStretchableWidget( searchEdit ); |
332 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), | 332 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), |
333 | this, SLOT( search() ) ); | 333 | this, SLOT( search() ) ); |
334 | 334 | ||
335 | a = new QAction( tr( "Find Next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), | 335 | a = new QAction( tr( "Find Next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), |
336 | QString::null, 0, this, 0 ); | 336 | QString::null, 0, this, 0 ); |
337 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 337 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
338 | a->addTo( searchBar ); | 338 | a->addTo( searchBar ); |
339 | a->addTo( edit ); | 339 | a->addTo( edit ); |
340 | 340 | ||
341 | a = new QAction( tr( "Close Find" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), | 341 | a = new QAction( tr( "Close Find" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
342 | QString::null, 0, this, 0 ); | 342 | QString::null, 0, this, 0 ); |
343 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 343 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
344 | a->addTo( searchBar ); | 344 | a->addTo( searchBar ); |
345 | 345 | ||
346 | edit->insertSeparator(); | 346 | edit->insertSeparator(); |
347 | a = new QAction( tr( "Delete" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), | 347 | a = new QAction( tr( "Delete" ), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
348 | QString::null, 0, this, 0 ); | 348 | QString::null, 0, this, 0 ); |
349 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); | 349 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); |
350 | a->addTo( edit ); | 350 | a->addTo( edit ); |
351 | 351 | ||
352 | searchBar->hide(); | 352 | searchBar->hide(); |
353 | 353 | ||
354 | editor = new QpeEditor( this ); | 354 | editor = new QpeEditor( this ); |
355 | setCentralWidget( editor ); | 355 | setCentralWidget( editor ); |
356 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 356 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
357 | connect( editor, SIGNAL( textChanged() ), | 357 | connect( editor, SIGNAL( textChanged() ), |
358 | this, SLOT( editorChanged() ) ); | 358 | this, SLOT( editorChanged() ) ); |
359 | 359 | ||
360 | QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); | 360 | QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); |
361 | 361 | ||
362 | Config cfg("TextEdit"); | 362 | Config cfg("TextEdit"); |
363 | cfg. setGroup ( "Font" ); | 363 | cfg. setGroup ( "Font" ); |
364 | 364 | ||
365 | QFont defaultFont = editor-> font ( ); | 365 | QFont defaultFont = editor-> font ( ); |
366 | 366 | ||
367 | QString family = cfg. readEntry ( "Family", defaultFont. family ( )); | 367 | QString family = cfg. readEntry ( "Family", defaultFont. family ( )); |
368 | int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); | 368 | int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); |
369 | int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); | 369 | int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); |
370 | bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); | 370 | bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); |
371 | 371 | ||
372 | defaultFont = QFont ( family, size, weight, italic ); | 372 | defaultFont = QFont ( family, size, weight, italic ); |
373 | editor-> setFont ( defaultFont ); | 373 | editor-> setFont ( defaultFont ); |
374 | // updateCaption(); | 374 | // updateCaption(); |
375 | 375 | ||
376 | cfg.setGroup ( "View" ); | 376 | cfg.setGroup ( "View" ); |
377 | 377 | ||
378 | promptExit = cfg.readBoolEntry ( "PromptExit", false ); | 378 | promptExit = cfg.readBoolEntry ( "PromptExit", false ); |
379 | openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); | 379 | openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); |
380 | filePerms = cfg.readBoolEntry ( "FilePermissions", false ); | 380 | filePerms = cfg.readBoolEntry ( "FilePermissions", false ); |
381 | useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); | 381 | useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); |
382 | startWithNew = cfg.readBoolEntry ( "startNew", true); | 382 | startWithNew = cfg.readBoolEntry ( "startNew", true); |
383 | featureAutoSave = cfg.readBoolEntry( "autosave", false); | 383 | featureAutoSave = cfg.readBoolEntry( "autosave", false); |
384 | 384 | ||
385 | if(useSearchBar) searchBarAction->setOn(true); | 385 | if(useSearchBar) searchBarAction->setOn(true); |
386 | if(promptExit) nAdvanced->setOn( true ); | 386 | if(promptExit) nAdvanced->setOn( true ); |
387 | if(openDesktop) desktopAction->setOn( true ); | 387 | if(openDesktop) desktopAction->setOn( true ); |
388 | if(filePerms) filePermAction->setOn( true ); | 388 | if(filePerms) filePermAction->setOn( true ); |
389 | if(startWithNew) nStart->setOn( true ); | 389 | if(startWithNew) nStart->setOn( true ); |
390 | if(featureAutoSave) nAutoSave->setOn(true); | 390 | if(featureAutoSave) nAutoSave->setOn(true); |
391 | 391 | ||
392 | // { | 392 | // { |
393 | // doTimer(true); | 393 | // doTimer(true); |
394 | // } | 394 | // } |
395 | 395 | ||
396 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); | 396 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); |
397 | wa-> setOn ( wrap ); | 397 | wa-> setOn ( wrap ); |
398 | setWordWrap ( wrap ); | 398 | setWordWrap ( wrap ); |
399 | 399 | ||
400 | ///////////////// | 400 | ///////////////// |
401 | if( qApp->argc() > 1) { | 401 | if( qApp->argc() > 1) { |
402 | currentFileName=qApp->argv()[1]; | 402 | currentFileName=qApp->argv()[1]; |
403 | 403 | ||
404 | QFileInfo fi(currentFileName); | 404 | QFileInfo fi(currentFileName); |
405 | 405 | ||
406 | if(fi.baseName().left(1) == "") { | 406 | if(fi.baseName().left(1) == "") { |
407 | openDotFile(currentFileName); | 407 | openDotFile(currentFileName); |
408 | } else { | 408 | } else { |
409 | openFile(currentFileName); | 409 | openFile(currentFileName); |
410 | } | 410 | } |
411 | } else { | 411 | } else { |
412 | edited1=false; | 412 | edited1=false; |
413 | openDotFile(""); | 413 | openDotFile(""); |
414 | } | 414 | } |
415 | 415 | ||
416 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 416 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
417 | } | 417 | } |
418 | 418 | ||
419 | TextEdit::~TextEdit() { | 419 | TextEdit::~TextEdit() { |
420 | if( edited1 && !promptExit) { | 420 | if( edited1 && !promptExit) { |
421 | switch( savePrompt() ) { | 421 | switch( savePrompt() ) { |
422 | case 1: { | 422 | case 1: { |
423 | saveAs(); | 423 | saveAs(); |
424 | } | 424 | } |
425 | break; | 425 | break; |
426 | }; | 426 | }; |
427 | } | 427 | } |
428 | 428 | ||
429 | delete editor; | 429 | delete editor; |
430 | } | 430 | } |
431 | 431 | ||
432 | void TextEdit::closeEvent(QCloseEvent *) { | 432 | void TextEdit::closeEvent(QCloseEvent *) { |
433 | if( promptExit) { | 433 | if( promptExit) { |
434 | switch( savePrompt() ) { | 434 | switch( savePrompt() ) { |
435 | case 1: { | 435 | case 1: { |
436 | saveAs(); | 436 | saveAs(); |
437 | qApp->quit(); | 437 | qApp->quit(); |
438 | } | 438 | } |
439 | break; | 439 | break; |
440 | 440 | ||
441 | case 2: { | 441 | case 2: { |
442 | qApp->quit(); | 442 | qApp->quit(); |
443 | } | 443 | } |
444 | break; | 444 | break; |
445 | 445 | ||
446 | case -1: | 446 | case -1: |
447 | break; | 447 | break; |
448 | }; | 448 | }; |
449 | } | 449 | } |
450 | else | 450 | else |
451 | qApp->quit(); | 451 | qApp->quit(); |
452 | } | 452 | } |
453 | 453 | ||
454 | void TextEdit::cleanUp() { | 454 | void TextEdit::cleanUp() { |
455 | 455 | ||
456 | Config cfg ( "TextEdit" ); | 456 | Config cfg ( "TextEdit" ); |
457 | cfg. setGroup ( "Font" ); | 457 | cfg. setGroup ( "Font" ); |
458 | QFont f = editor->font(); | 458 | QFont f = editor->font(); |
459 | cfg.writeEntry ( "Family", f. family ( )); | 459 | cfg.writeEntry ( "Family", f. family ( )); |
460 | cfg.writeEntry ( "Size", f. pointSize ( )); | 460 | cfg.writeEntry ( "Size", f. pointSize ( )); |
461 | cfg.writeEntry ( "Weight", f. weight ( )); | 461 | cfg.writeEntry ( "Weight", f. weight ( )); |
462 | cfg.writeEntry ( "Italic", f. italic ( )); | 462 | cfg.writeEntry ( "Italic", f. italic ( )); |
463 | 463 | ||
464 | cfg.setGroup ( "View" ); | 464 | cfg.setGroup ( "View" ); |
465 | cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth ); | 465 | cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth ); |
466 | cfg.writeEntry ( "FileView", viewSelection ); | 466 | cfg.writeEntry ( "FileView", viewSelection ); |
467 | 467 | ||
468 | cfg.writeEntry ( "PromptExit", promptExit ); | 468 | cfg.writeEntry ( "PromptExit", promptExit ); |
469 | cfg.writeEntry ( "OpenDesktop", openDesktop ); | 469 | cfg.writeEntry ( "OpenDesktop", openDesktop ); |
470 | cfg.writeEntry ( "FilePermissions", filePerms ); | 470 | cfg.writeEntry ( "FilePermissions", filePerms ); |
471 | cfg.writeEntry ( "SearchBar", useSearchBar ); | 471 | cfg.writeEntry ( "SearchBar", useSearchBar ); |
472 | cfg.writeEntry ( "startNew", startWithNew ); | 472 | cfg.writeEntry ( "startNew", startWithNew ); |
473 | 473 | ||
474 | } | 474 | } |
475 | 475 | ||
476 | 476 | ||
477 | void TextEdit::accept() { | 477 | void TextEdit::accept() { |
478 | if( edited1) | 478 | if( edited1) |
479 | saveAs(); | 479 | saveAs(); |
480 | qApp->quit(); | 480 | qApp->quit(); |
481 | } | 481 | } |
482 | 482 | ||
483 | void TextEdit::zoomIn() { | 483 | void TextEdit::zoomIn() { |
484 | setFontSize(editor->font().pointSize()+1,false); | 484 | setFontSize(editor->font().pointSize()+1,false); |
485 | } | 485 | } |
486 | 486 | ||
487 | void TextEdit::zoomOut() { | 487 | void TextEdit::zoomOut() { |
488 | setFontSize(editor->font().pointSize()-1,true); | 488 | setFontSize(editor->font().pointSize()-1,true); |
489 | } | 489 | } |
490 | 490 | ||
491 | 491 | ||
492 | void TextEdit::setFontSize(int sz, bool round_down_not_up) { | 492 | void TextEdit::setFontSize(int sz, bool round_down_not_up) { |
493 | int s=10; | 493 | int s=10; |
494 | for (int i=0; i<nfontsizes; i++) { | 494 | for (int i=0; i<nfontsizes; i++) { |
495 | if ( fontsize[i] == sz ) { | 495 | if ( fontsize[i] == sz ) { |
496 | s = sz; | 496 | s = sz; |
497 | break; | 497 | break; |
498 | } else if ( round_down_not_up ) { | 498 | } else if ( round_down_not_up ) { |
499 | if ( fontsize[i] < sz ) | 499 | if ( fontsize[i] < sz ) |
500 | s = fontsize[i]; | 500 | s = fontsize[i]; |
501 | } else { | 501 | } else { |
502 | if ( fontsize[i] > sz ) { | 502 | if ( fontsize[i] > sz ) { |
503 | s = fontsize[i]; | 503 | s = fontsize[i]; |
504 | break; | 504 | break; |
505 | } | 505 | } |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | QFont f = editor->font(); | 509 | QFont f = editor->font(); |
510 | f.setPointSize(s); | 510 | f.setPointSize(s); |
511 | editor->setFont(f); | 511 | editor->setFont(f); |
512 | 512 | ||
513 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 513 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
514 | zout->setEnabled(s != fontsize[0]); | 514 | zout->setEnabled(s != fontsize[0]); |
515 | } | 515 | } |
516 | 516 | ||
517 | void TextEdit::setBold(bool y) { | 517 | void TextEdit::setBold(bool y) { |
518 | QFont f = editor->font(); | 518 | QFont f = editor->font(); |
519 | f.setBold(y); | 519 | f.setBold(y); |
520 | editor->setFont(f); | 520 | editor->setFont(f); |
521 | } | 521 | } |
522 | 522 | ||
523 | void TextEdit::setItalic(bool y) { | 523 | void TextEdit::setItalic(bool y) { |
524 | QFont f = editor->font(); | 524 | QFont f = editor->font(); |
525 | f.setItalic(y); | 525 | f.setItalic(y); |
526 | editor->setFont(f); | 526 | editor->setFont(f); |
527 | } | 527 | } |
528 | 528 | ||
529 | void TextEdit::setWordWrap(bool y) { | 529 | void TextEdit::setWordWrap(bool y) { |
530 | bool state = editor->edited(); | 530 | bool state = editor->edited(); |
531 | QString captionStr = caption(); | 531 | QString captionStr = caption(); |
532 | bool b1 = edited1; | 532 | bool b1 = edited1; |
533 | bool b2 = edited; | 533 | bool b2 = edited; |
534 | 534 | ||
535 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 535 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
536 | editor->setEdited( state ); | 536 | editor->setEdited( state ); |
537 | edited1=b1; | 537 | edited1=b1; |
538 | edited=b2; | 538 | edited=b2; |
539 | setCaption(captionStr); | 539 | setCaption(captionStr); |
540 | } | 540 | } |
541 | 541 | ||
542 | void TextEdit::setSearchBar(bool b) { | 542 | void TextEdit::setSearchBar(bool b) { |
543 | useSearchBar=b; | 543 | useSearchBar=b; |
544 | Config cfg("TextEdit"); | 544 | Config cfg("TextEdit"); |
545 | cfg.setGroup("View"); | 545 | cfg.setGroup("View"); |
546 | cfg.writeEntry ( "SearchBar", b ); | 546 | cfg.writeEntry ( "SearchBar", b ); |
547 | searchBarAction->setOn(b); | 547 | searchBarAction->setOn(b); |
548 | if(b) | 548 | if(b) |
549 | searchBar->show(); | 549 | searchBar->show(); |
550 | else | 550 | else |
551 | searchBar->hide(); | 551 | searchBar->hide(); |
552 | editor->setFocus(); | 552 | editor->setFocus(); |
553 | } | 553 | } |
554 | 554 | ||
555 | void TextEdit::fileNew() { | 555 | void TextEdit::fileNew() { |
556 | // if( !bFromDocView ) { | 556 | // if( !bFromDocView ) { |
557 | // saveAs(); | 557 | // saveAs(); |
558 | // } | 558 | // } |
559 | newFile(DocLnk()); | 559 | newFile(DocLnk()); |
560 | } | 560 | } |
561 | 561 | ||
562 | void TextEdit::fileOpen() { | 562 | void TextEdit::fileOpen() { |
563 | Config cfg("TextEdit"); | 563 | Config cfg("TextEdit"); |
564 | cfg. setGroup ( "View" ); | 564 | cfg. setGroup ( "View" ); |
565 | QMap<QString, QStringList> map; | 565 | QMap<QString, QStringList> map; |
566 | map.insert(tr("All"), QStringList() ); | 566 | map.insert(tr("All"), QStringList() ); |
567 | QStringList text; | 567 | QStringList text; |
568 | text << "text/*"; | 568 | text << "text/*"; |
569 | map.insert(tr("Text"), text ); | 569 | map.insert(tr("Text"), text ); |
570 | text << "*"; | 570 | text << "*"; |
571 | map.insert(tr("All"), text ); | 571 | map.insert(tr("All"), text ); |
572 | QString str = OFileDialog::getOpenFileName( 2, | 572 | QString str = OFileDialog::getOpenFileName( 2, |
573 | QString::null , | 573 | QString::null , |
574 | QString::null, map); | 574 | QString::null, map); |
575 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) | 575 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) |
576 | { | 576 | { |
577 | openFile( str ); | 577 | openFile( str ); |
578 | } | 578 | } |
579 | else | 579 | else |
580 | updateCaption(); | 580 | updateCaption(); |
581 | } | 581 | } |
582 | 582 | ||
583 | void TextEdit::doSearchBar() { | 583 | void TextEdit::doSearchBar() { |
584 | if(!useSearchBar) | 584 | if(!useSearchBar) |
585 | searchBar->hide(); | 585 | searchBar->hide(); |
586 | else | 586 | else |
587 | searchBar->show(); | 587 | searchBar->show(); |
588 | } | 588 | } |
589 | 589 | ||
590 | #if 0 | 590 | #if 0 |
591 | void TextEdit::slotFind() { | 591 | void TextEdit::slotFind() { |
592 | FindDialog frmFind( tr("Text Editor"), this ); | 592 | FindDialog frmFind( tr("Text Editor"), this ); |
593 | connect( &frmFind, SIGNAL(signalFindClicked(const QString&,bool,bool,int)), | 593 | connect( &frmFind, SIGNAL(signalFindClicked(const QString&,bool,bool,int)), |
594 | editor, SLOT(slotDoFind(const QString&,bool,bool))); | 594 | editor, SLOT(slotDoFind(const QString&,bool,bool))); |
595 | 595 | ||
596 | //case sensitive, backwards, [category] | 596 | //case sensitive, backwards, [category] |
597 | 597 | ||
598 | connect( editor, SIGNAL(notFound()), | 598 | connect( editor, SIGNAL(notFound()), |
599 | &frmFind, SLOT(slotNotFound()) ); | 599 | &frmFind, SLOT(slotNotFound()) ); |
600 | connect( editor, SIGNAL(searchWrapped()), | 600 | connect( editor, SIGNAL(searchWrapped()), |
601 | &frmFind, SLOT(slotWrapAround()) ); | 601 | &frmFind, SLOT(slotWrapAround()) ); |
602 | 602 | ||
603 | frmFind.exec(); | 603 | frmFind.exec(); |
604 | 604 | ||
605 | 605 | ||
606 | } | 606 | } |
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | void TextEdit::fileRevert() { | 609 | void TextEdit::fileRevert() { |
610 | clear(); | 610 | clear(); |
611 | fileOpen(); | 611 | fileOpen(); |
612 | } | 612 | } |
613 | 613 | ||
614 | void TextEdit::editCut() { | 614 | void TextEdit::editCut() { |
615 | #ifndef QT_NO_CLIPBOARD | 615 | #ifndef QT_NO_CLIPBOARD |
616 | editor->cut(); | 616 | editor->cut(); |
617 | #endif | 617 | #endif |
618 | } | 618 | } |
619 | 619 | ||
620 | void TextEdit::editCopy() { | 620 | void TextEdit::editCopy() { |
621 | #ifndef QT_NO_CLIPBOARD | 621 | #ifndef QT_NO_CLIPBOARD |
622 | editor->copy(); | 622 | editor->copy(); |
623 | #endif | 623 | #endif |
624 | } | 624 | } |
625 | 625 | ||
626 | void TextEdit::editPaste() { | 626 | void TextEdit::editPaste() { |
627 | #ifndef QT_NO_CLIPBOARD | 627 | #ifndef QT_NO_CLIPBOARD |
628 | editor->paste(); | 628 | editor->paste(); |
629 | #endif | 629 | #endif |
630 | } | 630 | } |
631 | 631 | ||
632 | void TextEdit::editFind() { | 632 | void TextEdit::editFind() { |
633 | searchBar->show(); | 633 | searchBar->show(); |
634 | searchEdit->setFocus(); | 634 | searchEdit->setFocus(); |
635 | } | 635 | } |
636 | 636 | ||
637 | void TextEdit::findNext() { | 637 | void TextEdit::findNext() { |
638 | editor->find( searchEdit->text(), false, false ); | 638 | editor->find( searchEdit->text(), false, false ); |
639 | 639 | ||
640 | } | 640 | } |
641 | 641 | ||
642 | void TextEdit::findClose() { | 642 | void TextEdit::findClose() { |
643 | searchBar->hide(); | 643 | searchBar->hide(); |
644 | } | 644 | } |
645 | 645 | ||
646 | void TextEdit::search() { | 646 | void TextEdit::search() { |
647 | editor->find( searchEdit->text(), false, false ); | 647 | editor->find( searchEdit->text(), false, false ); |
648 | } | 648 | } |
649 | 649 | ||
650 | void TextEdit::newFile( const DocLnk &f ) { | 650 | void TextEdit::newFile( const DocLnk &f ) { |
651 | DocLnk nf = f; | 651 | DocLnk nf = f; |
652 | nf.setType("text/plain"); | 652 | nf.setType("text/plain"); |
653 | clear(); | 653 | clear(); |
654 | setWState (WState_Reserved1 ); | 654 | setWState (WState_Reserved1 ); |
655 | editor->setFocus(); | 655 | editor->setFocus(); |
656 | doc = new DocLnk(nf); | 656 | doc = new DocLnk(nf); |
657 | currentFileName = "Unnamed"; | 657 | currentFileName = "Unnamed"; |
658 | odebug << "newFile "+currentFileName << oendl; | 658 | odebug << "newFile "+currentFileName << oendl; |
659 | updateCaption( currentFileName); | 659 | updateCaption( currentFileName); |
660 | // editor->setEdited( false); | 660 | // editor->setEdited( false); |
661 | } | 661 | } |
662 | 662 | ||
663 | void TextEdit::openDotFile( const QString &f ) { | 663 | void TextEdit::openDotFile( const QString &f ) { |
664 | if(!currentFileName.isEmpty()) { | 664 | if(!currentFileName.isEmpty()) { |
665 | currentFileName=f; | 665 | currentFileName=f; |
666 | 666 | ||
667 | odebug << "openFile dotfile " + currentFileName << oendl; | 667 | odebug << "openFile dotfile " + currentFileName << oendl; |
668 | QString txt; | 668 | QString txt; |
669 | QFile file(f); | 669 | QFile file(f); |
670 | if (!file.open(IO_ReadWrite)) | 670 | if (!file.open(IO_ReadWrite)) |
671 | owarn << "Failed to open file " << file.name() << oendl; | 671 | owarn << "Failed to open file " << file.name() << oendl; |
672 | else { | 672 | else { |
673 | QTextStream t(&file); | 673 | QTextStream t(&file); |
674 | while ( !t.atEnd()) { | 674 | while ( !t.atEnd()) { |
675 | txt+=t.readLine()+"\n"; | 675 | txt+=t.readLine()+"\n"; |
676 | } | 676 | } |
677 | editor->setText(txt); | 677 | editor->setText(txt); |
678 | editor->setEdited( false); | 678 | editor->setEdited( false); |
679 | edited1=false; | 679 | edited1=false; |
680 | edited=false; | 680 | edited=false; |
681 | } | 681 | } |
682 | } | 682 | } |
683 | updateCaption( currentFileName); | 683 | updateCaption( currentFileName); |
684 | } | 684 | } |
685 | 685 | ||
686 | void TextEdit::openFile( const QString &f ) { | 686 | void TextEdit::openFile( const QString &f ) { |
687 | odebug << "filename is "+ f << oendl; | 687 | odebug << "filename is "+ f << oendl; |
688 | QString filer; | 688 | QString filer; |
689 | QFileInfo fi( f); | 689 | QFileInfo fi( f); |
690 | // bFromDocView = true; | 690 | // bFromDocView = true; |
691 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) | 691 | if(f.find(".desktop",0,true) != -1 && !openDesktop ) |
692 | { | 692 | { |
693 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) | 693 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) |
694 | { | 694 | { |
695 | case 0: //desktop | 695 | case 0: //desktop |
696 | filer = f; | 696 | filer = f; |
697 | break; | 697 | break; |
698 | case 1: //linked | 698 | case 1: //linked |
699 | DocLnk sf(f); | 699 | DocLnk sf(f); |
700 | filer = sf.file(); | 700 | filer = sf.file(); |
701 | break; | 701 | break; |
702 | }; | 702 | }; |
703 | } | 703 | } |
704 | else if(fi.baseName().left(1) == "") | 704 | else if(fi.baseName().left(1) == "") |
705 | { | 705 | { |
706 | odebug << "opening dotfile" << oendl; | 706 | odebug << "opening dotfile" << oendl; |
707 | currentFileName=f; | 707 | currentFileName=f; |
708 | openDotFile(currentFileName); | 708 | openDotFile(currentFileName); |
709 | return; | 709 | return; |
710 | } | 710 | } |
711 | /* | 711 | /* |
712 | * The problem is a file where Config(f).isValid() and it does not | 712 | * The problem is a file where Config(f).isValid() and it does not |
713 | * end with .desktop will be treated as desktop file | 713 | * end with .desktop will be treated as desktop file |
714 | */ | 714 | */ |
715 | else if (f.find(".desktop",0,true) != -1 ) | 715 | else if (f.find(".desktop",0,true) != -1 ) |
716 | { | 716 | { |
717 | DocLnk sf(f); | 717 | DocLnk sf(f); |
718 | filer = sf.file(); | 718 | filer = sf.file(); |
719 | if(filer.right(1) == "/") | 719 | if(filer.right(1) == "/") |
720 | filer = f; | 720 | filer = f; |
721 | 721 | ||
722 | } | 722 | } |
723 | else | 723 | else |
724 | filer = f; | 724 | filer = f; |
725 | 725 | ||
726 | DocLnk nf; | 726 | DocLnk nf; |
727 | nf.setType("text/plain"); | 727 | nf.setType("text/plain"); |
728 | nf.setFile(filer); | 728 | nf.setFile(filer); |
729 | currentFileName=filer; | 729 | currentFileName=filer; |
730 | 730 | ||
731 | nf.setName(fi.baseName()); | 731 | nf.setName(fi.baseName()); |
732 | openFile(nf); | 732 | openFile(nf); |
733 | 733 | ||
734 | odebug << "openFile string "+currentFileName << oendl; | 734 | odebug << "openFile string "+currentFileName << oendl; |
735 | 735 | ||
736 | showEditTools(); | 736 | showEditTools(); |
737 | // Show filename in caption | 737 | // Show filename in caption |
738 | QString name = filer; | 738 | QString name = filer; |
739 | int sep = name.findRev( '/' ); | 739 | int sep = name.findRev( '/' ); |
740 | if ( sep > 0 ) | 740 | if ( sep > 0 ) |
741 | name = name.mid( sep+1 ); | 741 | name = name.mid( sep+1 ); |
742 | updateCaption( name ); | 742 | updateCaption( name ); |
743 | } | 743 | } |
744 | 744 | ||
745 | void TextEdit::openFile( const DocLnk &f ) { | 745 | void TextEdit::openFile( const DocLnk &f ) { |
746 | // clear(); | 746 | // clear(); |
747 | // bFromDocView = true; | 747 | // bFromDocView = true; |
748 | FileManager fm; | 748 | FileManager fm; |
749 | QString txt; | 749 | QString txt; |
750 | currentFileName=f.file(); | 750 | currentFileName=f.file(); |
751 | odebug << "openFile doclnk " + currentFileName << oendl; | 751 | odebug << "openFile doclnk " + currentFileName << oendl; |
752 | if ( !fm.loadFile( f, txt ) ) { | 752 | if ( !fm.loadFile( f, txt ) ) { |
753 | // ####### could be a new file | 753 | // ####### could be a new file |
754 | odebug << "Cannot open file" << oendl; | 754 | odebug << "Cannot open file" << oendl; |
755 | } | 755 | } |
756 | // fileNew(); | 756 | // fileNew(); |
757 | if ( doc ) | 757 | if ( doc ) |
758 | delete doc; | 758 | delete doc; |
759 | doc = new DocLnk(f); | 759 | doc = new DocLnk(f); |
760 | editor->setText(txt); | 760 | editor->setText(txt); |
761 | editor->setEdited( false); | 761 | editor->setEdited( false); |
762 | edited1=false; | 762 | edited1=false; |
763 | edited=false; | 763 | edited=false; |
764 | 764 | ||
765 | doc->setName(currentFileName); | 765 | doc->setName(currentFileName); |
766 | updateCaption(); | 766 | updateCaption(); |
767 | setTimer(); | 767 | setTimer(); |
768 | } | 768 | } |
769 | 769 | ||
770 | void TextEdit::showEditTools() { | 770 | void TextEdit::showEditTools() { |
771 | menu->show(); | 771 | menu->show(); |
772 | editBar->show(); | 772 | editBar->show(); |
773 | if(!useSearchBar) | 773 | if(!useSearchBar) |
774 | searchBar->hide(); | 774 | searchBar->hide(); |
775 | else | 775 | else |
776 | searchBar->show(); | 776 | searchBar->show(); |
777 | setWState (WState_Reserved1 ); | 777 | setWState (WState_Reserved1 ); |
778 | } | 778 | } |
779 | 779 | ||
780 | /*! | 780 | /*! |
781 | unprompted save */ | 781 | unprompted save */ |
782 | bool TextEdit::save() { | 782 | bool TextEdit::save() { |
783 | QString name, file; | 783 | QString name, file; |
784 | odebug << "saveAsFile " + currentFileName << oendl; | 784 | odebug << "saveAsFile " + currentFileName << oendl; |
785 | if(currentFileName.isEmpty()) { | 785 | if(currentFileName.isEmpty()) { |
786 | saveAs(); | 786 | saveAs(); |
787 | return false; | 787 | return false; |
788 | } | 788 | } |
789 | name = currentFileName; | 789 | if(doc) { |
790 | if(doc) { | 790 | file = doc->file(); |
791 | file = doc->file(); | 791 | odebug << "saver file "+file << oendl; |
792 | odebug << "saver file "+file << oendl; | 792 | name = doc->name(); |
793 | name = doc->name(); | 793 | odebug << "File named "+name << oendl; |
794 | odebug << "File named "+name << oendl; | 794 | } else { |
795 | } else { | 795 | file = currentFileName; |
796 | file = currentFileName; | ||
797 | name = QFileInfo(currentFileName).baseName(); | 796 | name = QFileInfo(currentFileName).baseName(); |
798 | } | 797 | } |
799 | 798 | ||
800 | QString rt = editor->text(); | 799 | QString rt = editor->text(); |
801 | if( !rt.isEmpty() ) { | 800 | if( !rt.isEmpty() ) { |
802 | if(name.isEmpty()) { | 801 | if(name.isEmpty()) { |
803 | saveAs(); | 802 | saveAs(); |
804 | } else { | 803 | } else { |
805 | currentFileName = name; | 804 | currentFileName = name; |
806 | odebug << "saveFile "+currentFileName << oendl; | 805 | odebug << "saveFile "+currentFileName << oendl; |
807 | 806 | ||
808 | struct stat buf; | 807 | struct stat buf; |
809 | mode_t mode; | 808 | mode_t mode; |
810 | stat(file.latin1(), &buf); | 809 | QFile f(file); |
810 | fstat(f.handle(), &buf); | ||
811 | mode = buf.st_mode; | 811 | mode = buf.st_mode; |
812 | 812 | ||
813 | if(!fileIs) { | 813 | if(!fileIs) { |
814 | doc->setName( name); | 814 | doc->setName( name); |
815 | FileManager fm; | 815 | FileManager fm; |
816 | if ( !fm.saveFile( *doc, rt ) ) { | 816 | if ( !fm.saveFile( *doc, rt ) ) { |
817 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); | 817 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); |
818 | return false; | 818 | return false; |
819 | } | 819 | } |
820 | } else { | 820 | } else { |
821 | odebug << "regular save file" << oendl; | 821 | odebug << "regular save file" << oendl; |
822 | QFile f(file); | 822 | if( f.open(IO_WriteOnly)) { |
823 | if( f.open(IO_WriteOnly)) { | 823 | QCString crt = rt.utf8(); |
824 | QCString crt = rt.utf8(); | 824 | f.writeBlock(crt,crt.length()); |
825 | f.writeBlock(crt,crt.length()); | 825 | } else { |
826 | } else { | 826 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); |
827 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); | 827 | return false; |
828 | return false; | 828 | } |
829 | } | ||
830 | |||
831 | } | 829 | } |
832 | editor->setEdited( false); | 830 | editor->setEdited( false); |
833 | edited1=false; | 831 | edited1=false; |
834 | edited=false; | 832 | edited=false; |
835 | if(caption().left(1)=="*") | 833 | if(caption().left(1)=="*") |
836 | setCaption(caption().right(caption().length()-1)); | 834 | setCaption(caption().right(caption().length()-1)); |
837 | |||
838 | 835 | ||
839 | chmod( file.latin1(), mode); | 836 | fchmod( f.handle(), mode); |
840 | } | 837 | } |
841 | return true; | 838 | return true; |
842 | } | 839 | } |
843 | return false; | 840 | return false; |
844 | } | 841 | } |
845 | 842 | ||
846 | /*! | 843 | /*! |
847 | prompted save */ | 844 | prompted save */ |
848 | bool TextEdit::saveAs() { | 845 | bool TextEdit::saveAs() { |
849 | 846 | ||
850 | if(caption() == tr("Text Editor")) | 847 | if(caption() == tr("Text Editor")) |
851 | return false; | 848 | return false; |
852 | odebug << "saveAsFile " + currentFileName << oendl; | 849 | odebug << "saveAsFile " + currentFileName << oendl; |
853 | 850 | ||
854 | QString rt = editor->text(); | 851 | QString rt = editor->text(); |
855 | odebug << currentFileName << oendl; | 852 | odebug << currentFileName << oendl; |
856 | 853 | ||
857 | if( currentFileName.isEmpty() | 854 | if( currentFileName.isEmpty() |
858 | || currentFileName == tr("Unnamed") | 855 | || currentFileName == tr("Unnamed") |
859 | || currentFileName == tr("Text Editor")) | 856 | || currentFileName == tr("Text Editor")) |
860 | { | 857 | { |
861 | odebug << "do silly TT filename thing" << oendl; | 858 | odebug << "do silly TT filename thing" << oendl; |
862 | QString pt = rt.simplifyWhiteSpace(); | 859 | QString pt = rt.simplifyWhiteSpace(); |
863 | int i = pt.find( ' ' ); | 860 | int i = pt.find( ' ' ); |
864 | QString docname = pt; | 861 | QString docname = pt; |
865 | if ( i > 0 ) docname = pt.left( i ); | 862 | if ( i > 0 ) docname = pt.left( i ); |
866 | 863 | ||
867 | while( docname.startsWith( "." ) ) | 864 | while( docname.startsWith( "." ) ) |
868 | docname = docname.mid( 1 ); | 865 | docname = docname.mid( 1 ); |
869 | docname.replace( QRegExp("/"), "_" ); | 866 | docname.replace( QRegExp("/"), "_" ); |
870 | // Cut the length. Filenames longer than 40 are not helpful | 867 | // Cut the length. Filenames longer than 40 are not helpful |
871 | // and something goes wrong when they get too long. | 868 | // and something goes wrong when they get too long. |
872 | if ( docname.length() > 40 ) docname = docname.left(40); | 869 | if ( docname.length() > 40 ) docname = docname.left(40); |
873 | 870 | ||
874 | if ( docname.isEmpty() ) docname = tr("Unnamed"); | 871 | if ( docname.isEmpty() ) docname = tr("Unnamed"); |
875 | 872 | ||
876 | if(doc) doc->setName(docname); | 873 | if(doc) doc->setName(docname); |
877 | 874 | ||
878 | currentFileName=docname; | 875 | currentFileName=docname; |
879 | } | 876 | } |
880 | 877 | ||
881 | 878 | ||
882 | QMap<QString, QStringList> map; | 879 | QMap<QString, QStringList> map; |
883 | map.insert(tr("All"), QStringList() ); | 880 | map.insert(tr("All"), QStringList() ); |
884 | QStringList text; | 881 | QStringList text; |
885 | text << "text/*"; | 882 | text << "text/*"; |
886 | map.insert(tr("Text"), text ); | 883 | map.insert(tr("Text"), text ); |
887 | text << "*"; | 884 | text << "*"; |
888 | map.insert(tr("All"), text ); | 885 | map.insert(tr("All"), text ); |
889 | 886 | ||
890 | QFileInfo cuFi( currentFileName); | 887 | QFileInfo cuFi( currentFileName); |
891 | QString filee = cuFi.fileName(); | 888 | QString filee = cuFi.fileName(); |
892 | QString dire = cuFi.dirPath(); | 889 | QString dire = cuFi.dirPath(); |
893 | if(dire==".") | 890 | if(dire==".") |
894 | dire = QPEApplication::documentDir(); | 891 | dire = QPEApplication::documentDir(); |
895 | 892 | ||
896 | QString str; | 893 | QString str; |
897 | if( !featureAutoSave) { | 894 | if( !featureAutoSave) { |
898 | str = OFileDialog::getSaveFileName( 2, dire, filee, map); | 895 | str = OFileDialog::getSaveFileName( 2, dire, filee, map); |
899 | } else | 896 | } else |
900 | str = currentFileName; | 897 | str = currentFileName; |
901 | 898 | ||
902 | if(!str.isEmpty()) { | 899 | if(!str.isEmpty()) { |
903 | QString fileNm=str; | 900 | QString fileNm=str; |
904 | 901 | ||
905 | odebug << "saving filename "+fileNm << oendl; | 902 | odebug << "saving filename "+fileNm << oendl; |
906 | QFileInfo fi(fileNm); | 903 | QFileInfo fi(fileNm); |
907 | currentFileName=fi.fileName(); | 904 | currentFileName=fi.fileName(); |
908 | if(doc) | 905 | if(doc) |
909 | delete doc; | 906 | delete doc; |
910 | 907 | ||
911 | DocLnk nf; | 908 | DocLnk nf; |
912 | nf.setType("text/plain"); | 909 | nf.setType("text/plain"); |
913 | nf.setFile( fileNm); | 910 | nf.setFile( fileNm); |
914 | doc = new DocLnk(nf); | 911 | doc = new DocLnk(nf); |
915 | odebug << "Saving file as "+currentFileName << oendl; | 912 | odebug << "Saving file as "+currentFileName << oendl; |
916 | doc->setName( fi.baseName() ); | 913 | doc->setName( fi.baseName() ); |
917 | updateCaption( currentFileName); | 914 | updateCaption( currentFileName); |
918 | 915 | ||
919 | FileManager fm; | 916 | FileManager fm; |
920 | if ( !fm.saveFile( *doc, rt ) ) { | 917 | if ( !fm.saveFile( *doc, rt ) ) { |
921 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); | 918 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); |
922 | return false; | 919 | return false; |
923 | } | 920 | } |
924 | 921 | ||
925 | if( filePerms ) { | 922 | if( filePerms ) { |
926 | filePermissions *filePerm; | 923 | filePermissions *filePerm; |
927 | filePerm = new filePermissions(this, tr("Permissions"),true, 0, | 924 | filePerm = new filePermissions(this, tr("Permissions"),true, 0, |
928 | (const QString &)fileNm); | 925 | (const QString &)fileNm); |
929 | QPEApplication::execDialog( filePerm ); | 926 | QPEApplication::execDialog( filePerm ); |
930 | 927 | ||
931 | delete filePerm; | 928 | delete filePerm; |
932 | } | 929 | } |
933 | editor->setEdited( false); | 930 | editor->setEdited( false); |
934 | edited1 = false; | 931 | edited1 = false; |
935 | edited = false; | 932 | edited = false; |
936 | if(caption().left(1)=="*") | 933 | if(caption().left(1)=="*") |
937 | setCaption(caption().right(caption().length()-1)); | 934 | setCaption(caption().right(caption().length()-1)); |
938 | 935 | ||
939 | return true; | 936 | return true; |
940 | } | 937 | } |
941 | odebug << "returning false" << oendl; | 938 | odebug << "returning false" << oendl; |
942 | currentFileName = ""; | 939 | currentFileName = ""; |
943 | return false; | 940 | return false; |
944 | } //end saveAs | 941 | } //end saveAs |
945 | 942 | ||
946 | void TextEdit::clear() { | 943 | void TextEdit::clear() { |
947 | delete doc; | 944 | delete doc; |
948 | doc = 0; | 945 | doc = 0; |
949 | editor->clear(); | 946 | editor->clear(); |
950 | } | 947 | } |
951 | 948 | ||
952 | void TextEdit::updateCaption( const QString &name ) { | 949 | void TextEdit::updateCaption( const QString &name ) { |
953 | 950 | ||
954 | if ( name.isEmpty() ) | 951 | if ( name.isEmpty() ) |
955 | setCaption( tr("Text Editor") ); | 952 | setCaption( tr("Text Editor") ); |
956 | else { | 953 | else { |
957 | QString s = name; | 954 | QString s = name; |
958 | if ( s.isNull() ) | 955 | if ( s.isNull() ) |
959 | s = doc->name(); | 956 | s = doc->name(); |
960 | if ( s.isEmpty() ) { | 957 | if ( s.isEmpty() ) { |
961 | s = tr( "Unnamed" ); | 958 | s = tr( "Unnamed" ); |
962 | currentFileName=s; | 959 | currentFileName=s; |
963 | } | 960 | } |
964 | // if(s.left(1) == "/") | 961 | // if(s.left(1) == "/") |
965 | // s = s.right(s.length()-1); | 962 | // s = s.right(s.length()-1); |
966 | setCaption( tr("%1 - Text Editor").arg( s ) ); | 963 | setCaption( tr("%1 - Text Editor").arg( s ) ); |
967 | } | 964 | } |
968 | } | 965 | } |
969 | 966 | ||
970 | void TextEdit::setDocument(const QString& fileref) { | 967 | void TextEdit::setDocument(const QString& fileref) { |
971 | if(fileref != "Unnamed") { | 968 | if(fileref != "Unnamed") { |
972 | currentFileName=fileref; | 969 | currentFileName=fileref; |
973 | odebug << "setDocument" << oendl; | 970 | odebug << "setDocument" << oendl; |
974 | QFileInfo fi(currentFileName); | 971 | QFileInfo fi(currentFileName); |
975 | odebug << "basename:"+fi.baseName()+": current filenmame "+currentFileName << oendl; | 972 | odebug << "basename:"+fi.baseName()+": current filenmame "+currentFileName << oendl; |
976 | if( (fi.baseName().left(1)).isEmpty() ) { | 973 | if( (fi.baseName().left(1)).isEmpty() ) { |
977 | openDotFile(currentFileName); | 974 | openDotFile(currentFileName); |
978 | 975 | ||
979 | } else { | 976 | } else { |
980 | odebug << "setDoc open" << oendl; | 977 | odebug << "setDoc open" << oendl; |
981 | bFromDocView = true; | 978 | bFromDocView = true; |
982 | openFile(fileref); | 979 | openFile(fileref); |
983 | editor->setEdited(true); | 980 | editor->setEdited(true); |
984 | edited1=false; | 981 | edited1=false; |
985 | edited=true; | 982 | edited=true; |
986 | // fromSetDocument=false; | 983 | // fromSetDocument=false; |
987 | // doSearchBar(); | 984 | // doSearchBar(); |
988 | } | 985 | } |
989 | } | 986 | } |
990 | updateCaption( currentFileName); | 987 | updateCaption( currentFileName); |
991 | } | 988 | } |
992 | 989 | ||
993 | void TextEdit::changeFont() { | 990 | void TextEdit::changeFont() { |
994 | QDialog *d = new QDialog ( this, "FontDialog", true ); | 991 | QDialog *d = new QDialog ( this, "FontDialog", true ); |
995 | d-> setCaption ( tr( "Choose font" )); | 992 | d-> setCaption ( tr( "Choose font" )); |
996 | QBoxLayout *lay = new QVBoxLayout ( d ); | 993 | QBoxLayout *lay = new QVBoxLayout ( d ); |
997 | OFontSelector *ofs = new OFontSelector ( true, d ); | 994 | OFontSelector *ofs = new OFontSelector ( true, d ); |
998 | lay-> addWidget ( ofs ); | 995 | lay-> addWidget ( ofs ); |
999 | ofs-> setSelectedFont ( editor-> font ( )); | 996 | ofs-> setSelectedFont ( editor-> font ( )); |
1000 | 997 | ||
1001 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) | 998 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) |
1002 | editor-> setFont ( ofs-> selectedFont ( )); | 999 | editor-> setFont ( ofs-> selectedFont ( )); |
1003 | delete d; | 1000 | delete d; |
1004 | 1001 | ||
1005 | } | 1002 | } |
1006 | 1003 | ||
1007 | void TextEdit::editDelete() { | 1004 | void TextEdit::editDelete() { |
1008 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 1005 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
1009 | tr("Do you really want<BR>to <B>delete</B> " | 1006 | tr("Do you really want<BR>to <B>delete</B> " |
1010 | "the current file\nfrom the disk?<BR>This is " | 1007 | "the current file\nfrom the disk?<BR>This is " |
1011 | "<B>irreversable!</B>"), | 1008 | "<B>irreversable!</B>"), |
1012 | tr("Yes"),tr("No"),0,0,1) ) { | 1009 | tr("Yes"),tr("No"),0,0,1) ) { |
1013 | case 0: | 1010 | case 0: |
1014 | if(doc) { | 1011 | if(doc) { |
1015 | doc->removeFiles(); | 1012 | doc->removeFiles(); |
1016 | clear(); | 1013 | clear(); |
1017 | setCaption( tr("Text Editor") ); | 1014 | setCaption( tr("Text Editor") ); |
1018 | } | 1015 | } |
1019 | break; | 1016 | break; |
1020 | case 1: | 1017 | case 1: |
1021 | // exit | 1018 | // exit |
1022 | break; | 1019 | break; |
1023 | }; | 1020 | }; |
1024 | } | 1021 | } |
1025 | 1022 | ||
1026 | void TextEdit::changeStartConfig( bool b ) { | 1023 | void TextEdit::changeStartConfig( bool b ) { |
1027 | startWithNew=b; | 1024 | startWithNew=b; |
1028 | Config cfg("TextEdit"); | 1025 | Config cfg("TextEdit"); |
1029 | cfg.setGroup("View"); | 1026 | cfg.setGroup("View"); |
1030 | cfg.writeEntry("startNew",b); | 1027 | cfg.writeEntry("startNew",b); |
1031 | update(); | 1028 | update(); |
1032 | } | 1029 | } |
1033 | 1030 | ||
1034 | void TextEdit::editorChanged() { | 1031 | void TextEdit::editorChanged() { |
1035 | // odebug << "editor changed" << oendl; | 1032 | // odebug << "editor changed" << oendl; |
1036 | if( /*editor->edited() &&*/ /*edited && */!edited1) { | 1033 | if( /*editor->edited() &&*/ /*edited && */!edited1) { |
1037 | setCaption( "*"+caption()); | 1034 | setCaption( "*"+caption()); |
1038 | edited1=true; | 1035 | edited1=true; |
1039 | } | 1036 | } |
1040 | edited=true; | 1037 | edited=true; |
1041 | } | 1038 | } |
1042 | 1039 | ||
1043 | void TextEdit::receive(const QCString&msg, const QByteArray &) { | 1040 | void TextEdit::receive(const QCString&msg, const QByteArray &) { |
1044 | odebug << "QCop "+msg << oendl; | 1041 | odebug << "QCop "+msg << oendl; |
1045 | if ( msg == "setDocument(QString)" ) { | 1042 | if ( msg == "setDocument(QString)" ) { |
1046 | odebug << "bugger all" << oendl; | 1043 | odebug << "bugger all" << oendl; |
1047 | 1044 | ||
1048 | } | 1045 | } |
1049 | 1046 | ||
1050 | } | 1047 | } |
1051 | 1048 | ||
1052 | void TextEdit::doAbout() { | 1049 | void TextEdit::doAbout() { |
1053 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" | 1050 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" |
1054 | "2000 Trolltech AS, and<BR>" | 1051 | "2000 Trolltech AS, and<BR>" |
1055 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" | 1052 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" |
1056 | "and is licensed under the GPL")); | 1053 | "and is licensed under the GPL")); |
1057 | } | 1054 | } |
1058 | 1055 | ||
1059 | void TextEdit::doPrompt(bool b) { | 1056 | void TextEdit::doPrompt(bool b) { |
1060 | promptExit=b; | 1057 | promptExit=b; |
1061 | Config cfg("TextEdit"); | 1058 | Config cfg("TextEdit"); |
1062 | cfg.setGroup ( "View" ); | 1059 | cfg.setGroup ( "View" ); |
1063 | cfg.writeEntry ( "PromptExit", b); | 1060 | cfg.writeEntry ( "PromptExit", b); |
1064 | } | 1061 | } |
1065 | 1062 | ||
1066 | void TextEdit::doDesktop(bool b) { | 1063 | void TextEdit::doDesktop(bool b) { |
1067 | openDesktop=b; | 1064 | openDesktop=b; |
1068 | Config cfg("TextEdit"); | 1065 | Config cfg("TextEdit"); |
1069 | cfg.setGroup ( "View" ); | 1066 | cfg.setGroup ( "View" ); |
1070 | cfg.writeEntry ( "OpenDesktop", b); | 1067 | cfg.writeEntry ( "OpenDesktop", b); |
1071 | } | 1068 | } |
1072 | 1069 | ||
1073 | void TextEdit::doFilePerms(bool b) { | 1070 | void TextEdit::doFilePerms(bool b) { |
1074 | filePerms=b; | 1071 | filePerms=b; |
1075 | Config cfg("TextEdit"); | 1072 | Config cfg("TextEdit"); |
1076 | cfg.setGroup ( "View" ); | 1073 | cfg.setGroup ( "View" ); |
1077 | cfg.writeEntry ( "FilePermissions", b); | 1074 | cfg.writeEntry ( "FilePermissions", b); |
1078 | } | 1075 | } |
1079 | 1076 | ||
1080 | void TextEdit::editPasteTimeDate() { | 1077 | void TextEdit::editPasteTimeDate() { |
1081 | #ifndef QT_NO_CLIPBOARD | 1078 | #ifndef QT_NO_CLIPBOARD |
1082 | QClipboard *cb = QApplication::clipboard(); | 1079 | QClipboard *cb = QApplication::clipboard(); |
1083 | QDateTime dt = QDateTime::currentDateTime(); | 1080 | QDateTime dt = QDateTime::currentDateTime(); |
1084 | cb->setText( dt.toString()); | 1081 | cb->setText( dt.toString()); |
1085 | editor->paste(); | 1082 | editor->paste(); |
1086 | #endif | 1083 | #endif |
1087 | } | 1084 | } |
1088 | 1085 | ||
1089 | int TextEdit::savePrompt() | 1086 | int TextEdit::savePrompt() |
1090 | { | 1087 | { |
1091 | switch( QMessageBox::information( 0, (tr("Textedit")), | 1088 | switch( QMessageBox::information( 0, (tr("Textedit")), |
1092 | (tr("Textedit detected\n" | 1089 | (tr("Textedit detected\n" |
1093 | "you have unsaved changes\n" | 1090 | "you have unsaved changes\n" |
1094 | "Go ahead and save?\n")), | 1091 | "Go ahead and save?\n")), |
1095 | (tr("Save")), (tr("Don't Save")), (tr("&Cancel")), 2, 2 ) ) | 1092 | (tr("Save")), (tr("Don't Save")), (tr("&Cancel")), 2, 2 ) ) |
1096 | { | 1093 | { |
1097 | case 0: | 1094 | case 0: |
1098 | { | 1095 | { |
1099 | return 1; | 1096 | return 1; |
1100 | } | 1097 | } |
1101 | break; | 1098 | break; |
1102 | 1099 | ||
1103 | case 1: | 1100 | case 1: |
1104 | { | 1101 | { |
1105 | return 2; | 1102 | return 2; |
1106 | } | 1103 | } |
1107 | break; | 1104 | break; |
1108 | 1105 | ||
1109 | case 2: | 1106 | case 2: |
1110 | { | 1107 | { |
1111 | return -1; | 1108 | return -1; |
1112 | } | 1109 | } |
1113 | break; | 1110 | break; |
1114 | }; | 1111 | }; |
1115 | 1112 | ||
1116 | return 0; | 1113 | return 0; |
1117 | } | 1114 | } |
1118 | 1115 | ||
1119 | void TextEdit::timerCrank() | 1116 | void TextEdit::timerCrank() |
1120 | { | 1117 | { |
1121 | if(featureAutoSave && edited1) | 1118 | if(featureAutoSave && edited1) |
1122 | { | 1119 | { |
1123 | if(currentFileName.isEmpty()) | 1120 | if(currentFileName.isEmpty()) |
1124 | { | 1121 | { |
1125 | currentFileName = QDir::homeDirPath()+"/textedit.tmp"; | 1122 | currentFileName = QDir::homeDirPath()+"/textedit.tmp"; |
1126 | saveAs(); | 1123 | saveAs(); |
1127 | } | 1124 | } |
1128 | else | 1125 | else |
1129 | { | 1126 | { |
1130 | // odebug << "autosave" << oendl; | 1127 | // odebug << "autosave" << oendl; |
1131 | save(); | 1128 | save(); |
1132 | } | 1129 | } |
1133 | setTimer(); | 1130 | setTimer(); |
1134 | } | 1131 | } |
1135 | } | 1132 | } |
1136 | 1133 | ||
1137 | void TextEdit::doTimer(bool b) | 1134 | void TextEdit::doTimer(bool b) |
1138 | { | 1135 | { |
1139 | Config cfg("TextEdit"); | 1136 | Config cfg("TextEdit"); |
1140 | cfg.setGroup ( "View" ); | 1137 | cfg.setGroup ( "View" ); |
1141 | cfg.writeEntry ( "autosave", b); | 1138 | cfg.writeEntry ( "autosave", b); |
1142 | featureAutoSave = b; | 1139 | featureAutoSave = b; |
1143 | nAutoSave->setOn(b); | 1140 | nAutoSave->setOn(b); |
1144 | if(b) | 1141 | if(b) |
1145 | { | 1142 | { |
1146 | // odebug << "doTimer true" << oendl; | 1143 | // odebug << "doTimer true" << oendl; |
1147 | setTimer(); | 1144 | setTimer(); |
1148 | } | 1145 | } |
1149 | // else | 1146 | // else |
1150 | // odebug << "doTimer false" << oendl; | 1147 | // odebug << "doTimer false" << oendl; |
1151 | } | 1148 | } |
1152 | 1149 | ||
1153 | void TextEdit::setTimer() | 1150 | void TextEdit::setTimer() |
1154 | { | 1151 | { |
1155 | if(featureAutoSave) | 1152 | if(featureAutoSave) |
1156 | { | 1153 | { |
1157 | // odebug << "setting autosave" << oendl; | 1154 | // odebug << "setting autosave" << oendl; |
1158 | QTimer *timer = new QTimer(this ); | 1155 | QTimer *timer = new QTimer(this ); |
1159 | connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); | 1156 | connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); |
1160 | timer->start( 300000, true); //5 minutes | 1157 | timer->start( 300000, true); //5 minutes |
1161 | } | 1158 | } |
1162 | } | 1159 | } |
1163 | 1160 | ||
1164 | void TextEdit::gotoLine() { | 1161 | void TextEdit::gotoLine() { |
1165 | if( editor->length() < 1) | 1162 | if( editor->length() < 1) |
1166 | return; | 1163 | return; |
1167 | QWidget *d = QApplication::desktop(); | 1164 | QWidget *d = QApplication::desktop(); |
1168 | gotoEdit = new QLineEdit( 0, "Goto line"); | 1165 | gotoEdit = new QLineEdit( 0, "Goto line"); |
1169 | 1166 | ||
1170 | gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2)); | 1167 | gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2)); |
1171 | gotoEdit->setFrame(true); | 1168 | gotoEdit->setFrame(true); |
1172 | gotoEdit->show(); | 1169 | gotoEdit->show(); |
1173 | connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto())); | 1170 | connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto())); |
1174 | } | 1171 | } |
1175 | 1172 | ||
1176 | void TextEdit::doGoto() { | 1173 | void TextEdit::doGoto() { |
1177 | QString number = gotoEdit->text(); | 1174 | QString number = gotoEdit->text(); |
1178 | gotoEdit->hide(); | 1175 | gotoEdit->hide(); |
1179 | 1176 | ||
1180 | delete gotoEdit; | 1177 | delete gotoEdit; |
1181 | gotoEdit = 0; | 1178 | gotoEdit = 0; |
1182 | 1179 | ||
1183 | bool ok; | 1180 | bool ok; |
1184 | int lineNumber = number.toInt(&ok, 10); | 1181 | int lineNumber = number.toInt(&ok, 10); |
1185 | if( editor->numLines() < lineNumber) | 1182 | if( editor->numLines() < lineNumber) |
1186 | QMessageBox::message(tr("Text Edit"),tr("Not enough lines")); | 1183 | QMessageBox::message(tr("Text Edit"),tr("Not enough lines")); |
1187 | else | 1184 | else |
1188 | { | 1185 | { |
1189 | editor->setCursorPosition(lineNumber, 0, false); | 1186 | editor->setCursorPosition(lineNumber, 0, false); |
1190 | } | 1187 | } |
1191 | } | 1188 | } |
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index abbc610..965020e 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp | |||
@@ -1,348 +1,356 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "packageslave.h" | 21 | #include "packageslave.h" |
22 | 22 | ||
23 | /* OPIE */ | 23 | /* OPIE */ |
24 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
25 | #include <qtopia/qprocess.h> | 25 | #include <qtopia/qprocess.h> |
26 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
27 | #include <qtopia/qcopenvelope_qws.h> | 27 | #include <qtopia/qcopenvelope_qws.h> |
28 | #endif | 28 | #endif |
29 | using namespace Opie::Core; | 29 | using namespace Opie::Core; |
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
33 | #include <qcopchannel_qws.h> | 33 | #include <qcopchannel_qws.h> |
34 | #endif | 34 | #endif |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | 36 | ||
37 | /* STD */ | 37 | /* STD */ |
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <sys/stat.h> // mkdir() | 39 | #include <sys/stat.h> // mkdir() |
40 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 40 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
41 | #include <unistd.h> | 41 | #include <unistd.h> |
42 | #include <sys/vfs.h> | 42 | #include <sys/vfs.h> |
43 | #include <mntent.h> | 43 | #include <mntent.h> |
44 | #elif defined(Q_OS_MACX) | 44 | #elif defined(Q_OS_MACX) |
45 | #include <unistd.h> | 45 | #include <unistd.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | PackageHandler::PackageHandler( QObject *parent, char* name ) | 49 | PackageHandler::PackageHandler( QObject *parent, char* name ) |
50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) | 50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) |
51 | { | 51 | { |
52 | // setup qcop channel | 52 | // setup qcop channel |
53 | #ifndef QT_NO_COP | 53 | #ifndef QT_NO_COP |
54 | packageChannel = new QCopChannel( "QPE/Package", this ); | 54 | packageChannel = new QCopChannel( "QPE/Package", this ); |
55 | connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 55 | connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
56 | this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); | 56 | this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); |
57 | #endif | 57 | #endif |
58 | } | 58 | } |
59 | 59 | ||
60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) | 60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) |
61 | { | 61 | { |
62 | QDataStream stream( data, IO_ReadOnly ); | 62 | QDataStream stream( data, IO_ReadOnly ); |
63 | 63 | ||
64 | if ( msg == "installPackage(QString)" ) { | 64 | if ( msg == "installPackage(QString)" ) { |
65 | QString file; | 65 | QString file; |
66 | stream >> file; | 66 | stream >> file; |
67 | installPackage( file ); | 67 | installPackage( file ); |
68 | } else if ( msg == "installPackage(QString,QString)" ) { | 68 | } else if ( msg == "installPackage(QString,QString)" ) { |
69 | QString file, dest; | 69 | QString file, dest; |
70 | stream >> file >> dest; | 70 | stream >> file >> dest; |
71 | installPackage( file, dest ); | 71 | installPackage( file, dest ); |
72 | } else if ( msg == "removePackage(QString)" ) { | 72 | } else if ( msg == "removePackage(QString)" ) { |
73 | QString file; | 73 | QString file; |
74 | stream >> file; | 74 | stream >> file; |
75 | removePackage( file ); | 75 | removePackage( file ); |
76 | } else if ( msg == "addPackageFiles(QString,QString)" ) { | 76 | } else if ( msg == "addPackageFiles(QString,QString)" ) { |
77 | QString location, listfile; | 77 | QString location, listfile; |
78 | stream >> location >> listfile; | 78 | stream >> location >> listfile; |
79 | addPackageFiles( location, listfile); | 79 | addPackageFiles( location, listfile); |
80 | } else if ( msg == "addPackages(QString)" ) { | 80 | } else if ( msg == "addPackages(QString)" ) { |
81 | QString location; | 81 | QString location; |
82 | stream >> location; | 82 | stream >> location; |
83 | addPackages( location ); | 83 | addPackages( location ); |
84 | } else if ( msg == "cleanupPackageFiles(QString)" ) { | 84 | } else if ( msg == "cleanupPackageFiles(QString)" ) { |
85 | QString listfile; | 85 | QString listfile; |
86 | stream >> listfile; | 86 | stream >> listfile; |
87 | cleanupPackageFiles( listfile ); | 87 | cleanupPackageFiles( listfile ); |
88 | } else if ( msg == "cleanupPackages(QString)" ) { | 88 | } else if ( msg == "cleanupPackages(QString)" ) { |
89 | QString location; | 89 | QString location; |
90 | stream >> location; | 90 | stream >> location; |
91 | cleanupPackages( location ); | 91 | cleanupPackages( location ); |
92 | } else if ( msg == "prepareInstall(QString,QString)" ) { | 92 | } else if ( msg == "prepareInstall(QString,QString)" ) { |
93 | QString size, path; | 93 | QString size, path; |
94 | stream >> size; | 94 | stream >> size; |
95 | stream >> path; | 95 | stream >> path; |
96 | prepareInstall( size, path ); | 96 | prepareInstall( size, path ); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | void PackageHandler::installPackage( const QString &package, const QString &dest ) | 100 | void PackageHandler::installPackage( const QString &package, const QString &dest ) |
101 | { | 101 | { |
102 | if ( mNoSpaceLeft ) { | 102 | if ( mNoSpaceLeft ) { |
103 | mNoSpaceLeft = FALSE; | 103 | mNoSpaceLeft = FALSE; |
104 | // Don't emit that for now, I still couldn't test it (Wener) | 104 | // Don't emit that for now, I still couldn't test it (Wener) |
105 | //sendReply( "installFailed(QString)", package ); | 105 | //sendReply( "installFailed(QString)", package ); |
106 | //return; | 106 | //return; |
107 | } | 107 | } |
108 | 108 | ||
109 | QStringList cmd; | 109 | QStringList cmd; |
110 | cmd << "ipkg"; | 110 | cmd << "ipkg"; |
111 | if ( !dest.isEmpty() ) { | 111 | if ( !dest.isEmpty() ) { |
112 | cmd << "-d" << dest; | 112 | cmd << "-d" << dest; |
113 | } | 113 | } |
114 | cmd << "install" << package; | 114 | cmd << "install" << package; |
115 | currentProcess = new QProcess( cmd ); // No tr | 115 | currentProcess = new QProcess( cmd ); // No tr |
116 | connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); | 116 | connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); |
117 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); | 117 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); |
118 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); | 118 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); |
119 | currentPackage = package; | 119 | currentPackage = package; |
120 | 120 | ||
121 | currentProcessError=""; | 121 | currentProcessError=""; |
122 | sendReply( "installStarted(QString)", package ); | 122 | sendReply( "installStarted(QString)", package ); |
123 | currentProcess->start(); | 123 | currentProcess->start(); |
124 | } | 124 | } |
125 | 125 | ||
126 | void PackageHandler::removePackage( const QString &package ) | 126 | void PackageHandler::removePackage( const QString &package ) |
127 | { | 127 | { |
128 | currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr | 128 | currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr |
129 | connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); | 129 | connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); |
130 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); | 130 | connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); |
131 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); | 131 | connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); |
132 | currentPackage = package; | 132 | currentPackage = package; |
133 | 133 | ||
134 | currentProcessError=""; | 134 | currentProcessError=""; |
135 | sendReply( "removeStarted(QString)", package ); | 135 | sendReply( "removeStarted(QString)", package ); |
136 | currentProcess->start(); | 136 | currentProcess->start(); |
137 | } | 137 | } |
138 | 138 | ||
139 | void PackageHandler::sendReply( const QCString& msg, const QString& arg ) | 139 | void PackageHandler::sendReply( const QCString& msg, const QString& arg ) |
140 | { | 140 | { |
141 | #ifndef QT_NO_COP | 141 | #ifndef QT_NO_COP |
142 | QCopEnvelope e( "QPE/Desktop", msg ); | 142 | QCopEnvelope e( "QPE/Desktop", msg ); |
143 | e << arg; | 143 | e << arg; |
144 | #endif | 144 | #endif |
145 | } | 145 | } |
146 | 146 | ||
147 | void PackageHandler::addPackageFiles( const QString &location, | 147 | void PackageHandler::addPackageFiles( const QString &location, |
148 | const QString &listfile ) | 148 | const QString &listfile ) |
149 | { | 149 | { |
150 | QFile f(listfile); | 150 | QFile f(listfile); |
151 | #ifndef Q_OS_WIN32 | 151 | #ifndef Q_OS_WIN32 |
152 | //make a copy so we can remove the symlinks later | 152 | //make a copy so we can remove the symlinks later |
153 | mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); | 153 | mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); |
154 | system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); | 154 | system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); |
155 | #else | 155 | #else |
156 | QDir d; | 156 | QDir d; |
157 | //#### revise | 157 | //#### revise |
158 | odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl; | 158 | odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl; |
159 | d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); | 159 | d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); |
160 | system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); | 160 | system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); |
161 | #endif | 161 | #endif |
162 | 162 | ||
163 | 163 | ||
164 | if ( f.open(IO_ReadOnly) ) { | 164 | if ( f.open(IO_ReadOnly) ) { |
165 | QTextStream ts(&f); | 165 | QTextStream ts(&f); |
166 | 166 | ||
167 | QString s; | 167 | QString s; |
168 | while ( !ts.eof() ) { // until end of file... | 168 | while ( !ts.eof() ) { // until end of file... |
169 | s = ts.readLine(); // line of text excluding '\n' | 169 | s = ts.readLine(); // line of text excluding '\n' |
170 | // for s, do link/mkdir. | 170 | // for s, do link/mkdir. |
171 | if ( s.right(1) == "/" ) { | 171 | if ( s.right(1) == "/" ) { |
172 | odebug << "do mkdir for " << s.ascii() << "" << oendl; | 172 | odebug << "do mkdir for " << s.ascii() << "" << oendl; |
173 | #ifndef Q_OS_WIN32 | 173 | #ifndef Q_OS_WIN32 |
174 | mkdir( s.ascii(), 0777 ); | 174 | mkdir( s.ascii(), 0777 ); |
175 | //possible optimization: symlink directories | 175 | //possible optimization: symlink directories |
176 | //that don't exist already. -- Risky. | 176 | //that don't exist already. -- Risky. |
177 | #else | 177 | #else |
178 | d.mkdir( s.ascii()); | 178 | d.mkdir( s.ascii()); |
179 | #endif | 179 | #endif |
180 | 180 | ||
181 | } else { | 181 | } else { |
182 | #ifndef Q_OS_WIN32 | 182 | #ifndef Q_OS_WIN32 |
183 | odebug << "do symlink for " << s.ascii() << "" << oendl; | 183 | odebug << "do symlink for " << s.ascii() << "" << oendl; |
184 | symlink( (location + s).ascii(), s.ascii() ); | 184 | symlink( (location + s).ascii(), s.ascii() ); |
185 | #else | 185 | #else |
186 | odebug << "Copy file instead of a symlink for WIN32" << oendl; | 186 | odebug << "Copy file instead of a symlink for WIN32" << oendl; |
187 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) | 187 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) |
188 | owarn << "Unable to create symlinkfor " << (location + s).ascii() << oendl; | 188 | owarn << "Unable to create symlinkfor " << (location + s).ascii() << oendl; |
189 | #endif | 189 | #endif |
190 | } | 190 | } |
191 | } | 191 | } |
192 | f.close(); | 192 | f.close(); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | void PackageHandler::addPackages( const QString &location ) | 196 | void PackageHandler::addPackages( const QString &location ) |
197 | { | 197 | { |
198 | // get list of *.list in location/usr/lib/ipkg/info/*.list | 198 | // get list of *.list in location/usr/lib/ipkg/info/*.list |
199 | QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr | 199 | QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr |
200 | QDir::Name, QDir::Files); | 200 | QDir::Name, QDir::Files); |
201 | if ( !dir.exists() ) | 201 | if ( !dir.exists() ) |
202 | return; | 202 | return; |
203 | 203 | ||
204 | QStringList packages = dir.entryList(); | 204 | QStringList packages = dir.entryList(); |
205 | for ( QStringList::Iterator it = packages.begin(); | 205 | for ( QStringList::Iterator it = packages.begin(); |
206 | it != packages.end(); ++it ) { | 206 | it != packages.end(); ++it ) { |
207 | addPackageFiles( location, *it ); | 207 | addPackageFiles( location, *it ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | void PackageHandler::cleanupPackageFiles( const QString &listfile ) | 212 | void PackageHandler::cleanupPackageFiles( const QString &listfile ) |
213 | { | 213 | { |
214 | QFile f(listfile); | 214 | QFile f(listfile); |
215 | 215 | ||
216 | if ( f.open(IO_ReadOnly) ) { | 216 | if ( f.open(IO_ReadOnly) ) { |
217 | QTextStream ts(&f); | 217 | QTextStream ts(&f); |
218 | 218 | ||
219 | QString s; | 219 | QString s; |
220 | while ( !ts.eof() ) { // until end of file... | 220 | while ( !ts.eof() ) { // until end of file... |
221 | s = ts.readLine(); // line of text excluding '\n' | 221 | s = ts.readLine(); // line of text excluding '\n' |
222 | // for s, do link/mkdir. | 222 | // for s, do link/mkdir. |
223 | if ( s.right(1) == "/" ) { | 223 | // @todo Right now we just move on if the name of the file we |
224 | //should rmdir if empty, after all files have been removed | 224 | // find is actually a directory. What we ought to do is check |
225 | } else { | 225 | // to see if the directory is empty and if so remove it. |
226 | if ( s.right(1) != "/" ) { | ||
226 | #ifndef Q_OS_WIN32 | 227 | #ifndef Q_OS_WIN32 |
227 | odebug << "remove symlink for " << s.ascii() << "" << oendl; | 228 | odebug << "remove symlink for " << s << oendl; |
228 | //check if it is a symlink first (don't remove /etc/passwd...) | 229 | QFile symFile(s); |
229 | char buf[10]; //we don't care about the contents | 230 | QFileInfo symFileInfo(symFile); |
230 | if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) | 231 | //check if it is a symlink first (don't remove /etc/passwd...) |
231 | ::unlink( s.ascii() ); | 232 | if ( !symFileInfo.readLink().isNull()) |
233 | if (!symFile.remove()) | ||
234 | owarn << "Unable to remove symlink " << symFile.name() | ||
235 | << " " << __FILE__ << ":" << __LINE__ << oendl; | ||
232 | #else | 236 | #else |
233 | // ### revise | 237 | // @todo If we actually want to be portable to other operating |
234 | owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl; | 238 | // systems we ought to at least have a portable way of removing |
239 | // their notion of symlinks. | ||
240 | owarn << "Unable to remove symlink " << s " " << __FILE__ | ||
241 | << ":" << __LINE__ << oendl; | ||
235 | #endif | 242 | #endif |
243 | } | ||
236 | } | 244 | } |
237 | } | 245 | f.close(); |
238 | f.close(); | ||
239 | 246 | ||
240 | //remove the list file | 247 | //remove the list file |
241 | ::unlink( listfile.ascii() ); | 248 | if (!f.remove()) |
242 | 249 | owarn << "Unable to remove list file " << f.name() << " " | |
250 | << __FILE__ << ":" << __LINE__ << oendl; | ||
243 | } | 251 | } |
244 | } | 252 | } |
245 | 253 | ||
246 | void PackageHandler::cleanupPackages( const QString &location ) | 254 | void PackageHandler::cleanupPackages( const QString &location ) |
247 | { | 255 | { |
248 | // get list of *.list in location/usr/lib/ipkg/info/*.list | 256 | // get list of *.list in location/usr/lib/ipkg/info/*.list |
249 | QDir dir( "/usr/lib/ipkg/info/"+location, "*.list", // No tr | 257 | QDir dir( "/usr/lib/ipkg/info/"+location, "*.list", // No tr |
250 | QDir::Name, QDir::Files); | 258 | QDir::Name, QDir::Files); |
251 | if ( !dir.exists() ) | 259 | if ( !dir.exists() ) |
252 | return; | 260 | return; |
253 | 261 | ||
254 | QStringList packages = dir.entryList(); | 262 | QStringList packages = dir.entryList(); |
255 | for ( QStringList::Iterator it = packages.begin(); | 263 | for ( QStringList::Iterator it = packages.begin(); |
256 | it != packages.end(); ++it ) { | 264 | it != packages.end(); ++it ) { |
257 | cleanupPackageFiles( *it ); | 265 | cleanupPackageFiles( *it ); |
258 | } | 266 | } |
259 | 267 | ||
260 | //remove the backup directory | 268 | //remove the backup directory |
261 | //### | 269 | //### |
262 | } | 270 | } |
263 | 271 | ||
264 | void PackageHandler::prepareInstall( const QString& size, const QString& path ) | 272 | void PackageHandler::prepareInstall( const QString& size, const QString& path ) |
265 | { | 273 | { |
266 | // Check whether there will be enough space to install the next package. | 274 | // Check whether there will be enough space to install the next package. |
267 | bool ok; | 275 | bool ok; |
268 | unsigned int s = size.toUInt( &ok ); | 276 | unsigned int s = size.toUInt( &ok ); |
269 | 277 | ||
270 | if ( !ok ) | 278 | if ( !ok ) |
271 | return; | 279 | return; |
272 | 280 | ||
273 | // Shamelessly stolen from the sysinfo application (Werner) | 281 | // Shamelessly stolen from the sysinfo application (Werner) |
274 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 282 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
275 | struct statfs fs; | 283 | struct statfs fs; |
276 | if ( statfs( path.latin1(), &fs ) == 0 ) | 284 | if ( statfs( path.latin1(), &fs ) == 0 ) |
277 | if ( s > fs.f_bsize * fs.f_bavail ) { | 285 | if ( s > fs.f_bsize * fs.f_bavail ) { |
278 | //odebug << "############### Not enough space left ###############" << oendl; | 286 | //odebug << "############### Not enough space left ###############" << oendl; |
279 | mNoSpaceLeft = TRUE; | 287 | mNoSpaceLeft = TRUE; |
280 | } | 288 | } |
281 | #endif | 289 | #endif |
282 | } | 290 | } |
283 | 291 | ||
284 | void PackageHandler::iProcessExited() | 292 | void PackageHandler::iProcessExited() |
285 | { | 293 | { |
286 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) | 294 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) |
287 | sendReply( "installDone(QString)", currentPackage ); | 295 | sendReply( "installDone(QString)", currentPackage ); |
288 | else { | 296 | else { |
289 | #ifndef QT_NO_COP | 297 | #ifndef QT_NO_COP |
290 | QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" ); | 298 | QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" ); |
291 | e << currentPackage << currentProcess->exitStatus() | 299 | e << currentPackage << currentProcess->exitStatus() |
292 | << currentProcessError; | 300 | << currentProcessError; |
293 | #endif | 301 | #endif |
294 | } | 302 | } |
295 | 303 | ||
296 | delete currentProcess; | 304 | delete currentProcess; |
297 | currentProcess = 0; | 305 | currentProcess = 0; |
298 | 306 | ||
299 | #ifndef QT_NO_COP | 307 | #ifndef QT_NO_COP |
300 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 308 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
301 | QString lf = QString::null; | 309 | QString lf = QString::null; |
302 | e << lf; | 310 | e << lf; |
303 | #endif | 311 | #endif |
304 | unlink( currentPackage ); | 312 | unlink( currentPackage ); |
305 | } | 313 | } |
306 | 314 | ||
307 | void PackageHandler::rmProcessExited() | 315 | void PackageHandler::rmProcessExited() |
308 | { | 316 | { |
309 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) | 317 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) |
310 | sendReply( "removeDone(QString)", currentPackage ); | 318 | sendReply( "removeDone(QString)", currentPackage ); |
311 | else | 319 | else |
312 | sendReply( "removeFailed(QString)", currentPackage ); | 320 | sendReply( "removeFailed(QString)", currentPackage ); |
313 | 321 | ||
314 | #ifndef QT_NO_COP | 322 | #ifndef QT_NO_COP |
315 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 323 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
316 | QString lf = QString::null; | 324 | QString lf = QString::null; |
317 | e << lf; | 325 | e << lf; |
318 | #endif | 326 | #endif |
319 | } | 327 | } |
320 | 328 | ||
321 | void PackageHandler::readyReadStdout() | 329 | void PackageHandler::readyReadStdout() |
322 | { | 330 | { |
323 | while ( currentProcess->canReadLineStdout() ) { | 331 | while ( currentProcess->canReadLineStdout() ) { |
324 | QString line = currentProcess->readLineStdout(); | 332 | QString line = currentProcess->readLineStdout(); |
325 | currentProcessError.append("OUT:"+line); | 333 | currentProcessError.append("OUT:"+line); |
326 | if ( line.contains( "Unpacking" ) ) // No tr | 334 | if ( line.contains( "Unpacking" ) ) // No tr |
327 | sendReply( "installStep(QString)", "one" ); // No tr | 335 | sendReply( "installStep(QString)", "one" ); // No tr |
328 | else if ( line.contains( "Configuring" ) ) // No tr | 336 | else if ( line.contains( "Configuring" ) ) // No tr |
329 | sendReply( "installStep(QString)", "two" ); // No tr | 337 | sendReply( "installStep(QString)", "two" ); // No tr |
330 | } | 338 | } |
331 | } | 339 | } |
332 | 340 | ||
333 | void PackageHandler::readyReadStderr() | 341 | void PackageHandler::readyReadStderr() |
334 | { | 342 | { |
335 | while ( currentProcess->canReadLineStderr() ) { | 343 | while ( currentProcess->canReadLineStderr() ) { |
336 | QString line = currentProcess->readLineStderr(); | 344 | QString line = currentProcess->readLineStderr(); |
337 | currentProcessError.append("ERR:"+line); | 345 | currentProcessError.append("ERR:"+line); |
338 | } | 346 | } |
339 | } | 347 | } |
340 | 348 | ||
341 | void PackageHandler::redoPackages() | 349 | void PackageHandler::redoPackages() |
342 | { | 350 | { |
343 | //get list of filesystems | 351 | //get list of filesystems |
344 | 352 | ||
345 | //call cleanupPackages for the ones that have disappeared | 353 | //call cleanupPackages for the ones that have disappeared |
346 | 354 | ||
347 | //call addPackageFiles for the new ones | 355 | //call addPackageFiles for the new ones |
348 | } | 356 | } |