-rw-r--r-- | core/launcher/launcher.cpp | 1 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 222592b..b26bd8b 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -430,192 +430,193 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
430 | 430 | ||
431 | connect( tabs, SIGNAL(selected(const QString&)), | 431 | connect( tabs, SIGNAL(selected(const QString&)), |
432 | this, SLOT(viewSelected(const QString&)) ); | 432 | this, SLOT(viewSelected(const QString&)) ); |
433 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 433 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
434 | this, SLOT(select(const AppLnk*))); | 434 | this, SLOT(select(const AppLnk*))); |
435 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 435 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
436 | this, SLOT(properties(AppLnk*))); | 436 | this, SLOT(properties(AppLnk*))); |
437 | 437 | ||
438 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 438 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
439 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 439 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
440 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 440 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
441 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 441 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
442 | #endif | 442 | #endif |
443 | 443 | ||
444 | storage = new StorageInfo( this ); | 444 | storage = new StorageInfo( this ); |
445 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); | 445 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); |
446 | 446 | ||
447 | updateTabs(); | 447 | updateTabs(); |
448 | 448 | ||
449 | preloadApps(); | 449 | preloadApps(); |
450 | 450 | ||
451 | in_lnk_props = FALSE; | 451 | in_lnk_props = FALSE; |
452 | got_lnk_change = FALSE; | 452 | got_lnk_change = FALSE; |
453 | } | 453 | } |
454 | 454 | ||
455 | Launcher::~Launcher() | 455 | Launcher::~Launcher() |
456 | { | 456 | { |
457 | } | 457 | } |
458 | 458 | ||
459 | static bool isVisibleWindow(int wid) | 459 | static bool isVisibleWindow(int wid) |
460 | { | 460 | { |
461 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 461 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
462 | QWSWindow* w; | 462 | QWSWindow* w; |
463 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 463 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
464 | if ( w->winId() == wid ) | 464 | if ( w->winId() == wid ) |
465 | return !w->isFullyObscured(); | 465 | return !w->isFullyObscured(); |
466 | } | 466 | } |
467 | return FALSE; | 467 | return FALSE; |
468 | } | 468 | } |
469 | 469 | ||
470 | void Launcher::showMaximized() | 470 | void Launcher::showMaximized() |
471 | { | 471 | { |
472 | if ( isVisibleWindow( winId() ) ) | 472 | if ( isVisibleWindow( winId() ) ) |
473 | doMaximize(); | 473 | doMaximize(); |
474 | else | 474 | else |
475 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); | 475 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); |
476 | } | 476 | } |
477 | 477 | ||
478 | void Launcher::doMaximize() | 478 | void Launcher::doMaximize() |
479 | { | 479 | { |
480 | QMainWindow::showMaximized(); | 480 | QMainWindow::showMaximized(); |
481 | } | 481 | } |
482 | 482 | ||
483 | void Launcher::updateMimeTypes() | 483 | void Launcher::updateMimeTypes() |
484 | { | 484 | { |
485 | MimeType::clear(); | 485 | MimeType::clear(); |
486 | updateMimeTypes(rootFolder); | 486 | updateMimeTypes(rootFolder); |
487 | } | 487 | } |
488 | 488 | ||
489 | void Launcher::updateMimeTypes(AppLnkSet* folder) | 489 | void Launcher::updateMimeTypes(AppLnkSet* folder) |
490 | { | 490 | { |
491 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 491 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
492 | AppLnk *app = it.current(); | 492 | AppLnk *app = it.current(); |
493 | if ( app->type() == "Folder" ) | 493 | if ( app->type() == "Folder" ) |
494 | updateMimeTypes((AppLnkSet *)app); | 494 | updateMimeTypes((AppLnkSet *)app); |
495 | else { | 495 | else { |
496 | MimeType::registerApp(*app); | 496 | MimeType::registerApp(*app); |
497 | } | 497 | } |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 501 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
502 | { | 502 | { |
503 | delete docsFolder; | 503 | delete docsFolder; |
504 | docsFolder = new DocLnkSet; | 504 | docsFolder = new DocLnkSet; |
505 | // find out wich filesystems are new in this round | 505 | // find out wich filesystems are new in this round |
506 | // We will do this by having a timestamp inside each mountpoint | 506 | // We will do this by having a timestamp inside each mountpoint |
507 | // if the current timestamp doesn't match this is a new file system and | 507 | // if the current timestamp doesn't match this is a new file system and |
508 | // come up with our MediumMountGui :) let the hacking begin | 508 | // come up with our MediumMountGui :) let the hacking begin |
509 | QString newStamp = QDateTime::currentDateTime().toString(); | 509 | QString newStamp = QDateTime::currentDateTime().toString(); |
510 | StorageInfo storage; | 510 | StorageInfo storage; |
511 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 511 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
512 | QListIterator<FileSystem> it ( fileSystems ); | 512 | QListIterator<FileSystem> it ( fileSystems ); |
513 | for ( ; it.current(); ++it ) { | 513 | for ( ; it.current(); ++it ) { |
514 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 514 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
515 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); | 515 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); |
516 | cfg.setGroup("main"); | 516 | cfg.setGroup("main"); |
517 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 517 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
518 | if( stamp == m_timeStamp ){ // ok we know this card | 518 | if( stamp == m_timeStamp ){ // ok we know this card |
519 | cfg.writeEntry("timestamp", newStamp ); | 519 | cfg.writeEntry("timestamp", newStamp ); |
520 | // we need to scan the list now. Hopefully the cache will be there | 520 | // we need to scan the list now. Hopefully the cache will be there |
521 | }else{ // come up with the gui | 521 | }else{ // come up with the gui |
522 | MediumMountGui medium((*it)->path() + "/.opiestorage.cf" ); | 522 | MediumMountGui medium((*it)->path() + "/.opiestorage.cf" ); |
523 | if( medium.check() ){ | 523 | if( medium.check() ){ |
524 | if( medium.exec() ){ //ok | 524 | if( medium.exec() ){ //ok |
525 | // speicher | 525 | // speicher |
526 | cfg.writeEntry("timestamp", newStamp ); | ||
526 | } | 527 | } |
527 | }else{ | 528 | }else{ |
528 | // do something different see what we need to do | 529 | // do something different see what we need to do |
529 | } | 530 | } |
530 | } | 531 | } |
531 | } | 532 | } |
532 | } | 533 | } |
533 | Global::findDocuments(docsFolder); // get rid of this call later | 534 | Global::findDocuments(docsFolder); // get rid of this call later |
534 | m_timeStamp = newStamp; | 535 | m_timeStamp = newStamp; |
535 | } | 536 | } |
536 | 537 | ||
537 | void Launcher::updateTabs() | 538 | void Launcher::updateTabs() |
538 | { | 539 | { |
539 | MimeType::updateApplications(); // ### reads all applnks twice | 540 | MimeType::updateApplications(); // ### reads all applnks twice |
540 | 541 | ||
541 | delete rootFolder; | 542 | delete rootFolder; |
542 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 543 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
543 | 544 | ||
544 | loadDocs(); | 545 | loadDocs(); |
545 | 546 | ||
546 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 547 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
547 | } | 548 | } |
548 | 549 | ||
549 | void Launcher::updateDocs() | 550 | void Launcher::updateDocs() |
550 | { | 551 | { |
551 | loadDocs(); | 552 | loadDocs(); |
552 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 553 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
553 | } | 554 | } |
554 | 555 | ||
555 | void Launcher::viewSelected(const QString& s) | 556 | void Launcher::viewSelected(const QString& s) |
556 | { | 557 | { |
557 | setCaption( s + tr(" - Launcher") ); | 558 | setCaption( s + tr(" - Launcher") ); |
558 | } | 559 | } |
559 | 560 | ||
560 | void Launcher::nextView() | 561 | void Launcher::nextView() |
561 | { | 562 | { |
562 | tabs->nextTab(); | 563 | tabs->nextTab(); |
563 | } | 564 | } |
564 | 565 | ||
565 | 566 | ||
566 | void Launcher::select( const AppLnk *appLnk ) | 567 | void Launcher::select( const AppLnk *appLnk ) |
567 | { | 568 | { |
568 | if ( appLnk->type() == "Folder" ) { | 569 | if ( appLnk->type() == "Folder" ) { |
569 | // Not supported: flat is simpler for the user | 570 | // Not supported: flat is simpler for the user |
570 | } else { | 571 | } else { |
571 | if ( appLnk->exec().isNull() ) { | 572 | if ( appLnk->exec().isNull() ) { |
572 | QMessageBox::information(this,tr("No application"), | 573 | QMessageBox::information(this,tr("No application"), |
573 | tr("<p>No application is defined for this document." | 574 | tr("<p>No application is defined for this document." |
574 | "<p>Type is %1.").arg(appLnk->type())); | 575 | "<p>Type is %1.").arg(appLnk->type())); |
575 | return; | 576 | return; |
576 | } | 577 | } |
577 | tabs->setBusy(TRUE); | 578 | tabs->setBusy(TRUE); |
578 | emit executing( appLnk ); | 579 | emit executing( appLnk ); |
579 | appLnk->execute(); | 580 | appLnk->execute(); |
580 | } | 581 | } |
581 | } | 582 | } |
582 | 583 | ||
583 | void Launcher::externalSelected(const AppLnk *appLnk) | 584 | void Launcher::externalSelected(const AppLnk *appLnk) |
584 | { | 585 | { |
585 | tabs->setBusy(TRUE); | 586 | tabs->setBusy(TRUE); |
586 | emit executing( appLnk ); | 587 | emit executing( appLnk ); |
587 | } | 588 | } |
588 | 589 | ||
589 | void Launcher::properties( AppLnk *appLnk ) | 590 | void Launcher::properties( AppLnk *appLnk ) |
590 | { | 591 | { |
591 | if ( appLnk->type() == "Folder" ) { | 592 | if ( appLnk->type() == "Folder" ) { |
592 | // Not supported: flat is simpler for the user | 593 | // Not supported: flat is simpler for the user |
593 | } else { | 594 | } else { |
594 | in_lnk_props = TRUE; | 595 | in_lnk_props = TRUE; |
595 | got_lnk_change = FALSE; | 596 | got_lnk_change = FALSE; |
596 | LnkProperties prop(appLnk); | 597 | LnkProperties prop(appLnk); |
597 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 598 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
598 | prop.showMaximized(); | 599 | prop.showMaximized(); |
599 | prop.exec(); | 600 | prop.exec(); |
600 | in_lnk_props = FALSE; | 601 | in_lnk_props = FALSE; |
601 | if ( got_lnk_change ) { | 602 | if ( got_lnk_change ) { |
602 | updateLink(lnk_change); | 603 | updateLink(lnk_change); |
603 | } | 604 | } |
604 | } | 605 | } |
605 | } | 606 | } |
606 | 607 | ||
607 | void Launcher::updateLink(const QString& link) | 608 | void Launcher::updateLink(const QString& link) |
608 | { | 609 | { |
609 | if (link.isNull()) | 610 | if (link.isNull()) |
610 | updateTabs(); | 611 | updateTabs(); |
611 | else if (link.isEmpty()) | 612 | else if (link.isEmpty()) |
612 | updateDocs(); | 613 | updateDocs(); |
613 | else | 614 | else |
614 | tabs->updateLink(link); | 615 | tabs->updateLink(link); |
615 | } | 616 | } |
616 | 617 | ||
617 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 618 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
618 | { | 619 | { |
619 | QDataStream stream( data, IO_ReadOnly ); | 620 | QDataStream stream( data, IO_ReadOnly ); |
620 | if ( msg == "linkChanged(QString)" ) { | 621 | if ( msg == "linkChanged(QString)" ) { |
621 | QString link; | 622 | QString link; |
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 00ae980..197bd19 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -38,99 +38,101 @@ class CategoryTabBar : public QTabBar | |||
38 | { | 38 | { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); | 41 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); |
42 | ~CategoryTabBar(); | 42 | ~CategoryTabBar(); |
43 | 43 | ||
44 | protected slots: | 44 | protected slots: |
45 | virtual void layoutTabs(); | 45 | virtual void layoutTabs(); |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | void paint ( QPainter *p, QTab *t, bool f ) const; | 48 | void paint ( QPainter *p, QTab *t, bool f ) const; |
49 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; | 49 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | class CategoryTabWidget : public QVBox { | 52 | class CategoryTabWidget : public QVBox { |
53 | // can't use a QTabWidget, since it won't let us set the frame style. | 53 | // can't use a QTabWidget, since it won't let us set the frame style. |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | public: | 55 | public: |
56 | CategoryTabWidget( QWidget* parent ); | 56 | CategoryTabWidget( QWidget* parent ); |
57 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, | 57 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, |
58 | const QList<FileSystem> &); | 58 | const QList<FileSystem> &); |
59 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); | 59 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); |
60 | void updateLink(const QString& linkfile); | 60 | void updateLink(const QString& linkfile); |
61 | void setBusy(bool on); | 61 | void setBusy(bool on); |
62 | 62 | ||
63 | signals: | 63 | signals: |
64 | void selected(const QString&); | 64 | void selected(const QString&); |
65 | void clicked(const AppLnk*); | 65 | void clicked(const AppLnk*); |
66 | void rightPressed(AppLnk*); | 66 | void rightPressed(AppLnk*); |
67 | 67 | ||
68 | public slots: | 68 | public slots: |
69 | void nextTab(); | 69 | void nextTab(); |
70 | void prevTab(); | 70 | void prevTab(); |
71 | 71 | ||
72 | protected: | 72 | protected: |
73 | void paletteChange( const QPalette &p ); | 73 | void paletteChange( const QPalette &p ); |
74 | 74 | ||
75 | private: | 75 | private: |
76 | CategoryTabBar* categoryBar; | 76 | CategoryTabBar* categoryBar; |
77 | QWidgetStack* stack; | 77 | QWidgetStack* stack; |
78 | LauncherView* docview; | 78 | LauncherView* docview; |
79 | QStringList ids; | 79 | QStringList ids; |
80 | int tabs; | 80 | int tabs; |
81 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); | 81 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); |
82 | void addItem( const QString& ); | 82 | void addItem( const QString& ); |
83 | }; | 83 | }; |
84 | 84 | ||
85 | class Launcher : public QMainWindow | 85 | class Launcher : public QMainWindow |
86 | { | 86 | { |
87 | Q_OBJECT | 87 | Q_OBJECT |
88 | friend class LauncherPrivate; | 88 | friend class LauncherPrivate; |
89 | public: | 89 | public: |
90 | Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 90 | Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
91 | ~Launcher(); | 91 | ~Launcher(); |
92 | 92 | ||
93 | static QString appsFolderName(); | 93 | static QString appsFolderName(); |
94 | 94 | ||
95 | virtual void showMaximized(); | 95 | virtual void showMaximized(); |
96 | static bool mkdir(const QString &path); | 96 | static bool mkdir(const QString &path); |
97 | 97 | ||
98 | public slots: | 98 | public slots: |
99 | void viewSelected(const QString&); | 99 | void viewSelected(const QString&); |
100 | void select( const AppLnk * ); | 100 | void select( const AppLnk * ); |
101 | void externalSelected( const AppLnk *); | 101 | void externalSelected( const AppLnk *); |
102 | void properties( AppLnk * ); | 102 | void properties( AppLnk * ); |
103 | void nextView(); | 103 | void nextView(); |
104 | 104 | ||
105 | signals: | 105 | signals: |
106 | void executing( const AppLnk * ); | 106 | void executing( const AppLnk * ); |
107 | void busy(); | 107 | void busy(); |
108 | void notBusy(const QString&); | 108 | void notBusy(const QString&); |
109 | 109 | ||
110 | private slots: | 110 | private slots: |
111 | void doMaximize(); | 111 | void doMaximize(); |
112 | void systemMessage( const QCString &, const QByteArray &); | 112 | void systemMessage( const QCString &, const QByteArray &); |
113 | void storageChanged(); | 113 | void storageChanged(); |
114 | void cancelSync(); | 114 | void cancelSync(); |
115 | 115 | ||
116 | private: | 116 | private: |
117 | void updateApps(); | 117 | void updateApps(); |
118 | void loadDocs(); | 118 | void loadDocs(); |
119 | void updateDocs(); | 119 | void updateDocs(); |
120 | void updateTabs(); | 120 | void updateTabs(); |
121 | void updateMimeTypes(); | 121 | void updateMimeTypes(); |
122 | void updateMimeTypes(AppLnkSet*); | 122 | void updateMimeTypes(AppLnkSet*); |
123 | void preloadApps(); | 123 | void preloadApps(); |
124 | AppLnkSet *rootFolder; | 124 | AppLnkSet *rootFolder; |
125 | DocLnkSet *docsFolder; | 125 | DocLnkSet *docsFolder; |
126 | CategoryTabWidget *tabs; | 126 | CategoryTabWidget *tabs; |
127 | StorageInfo *storage; | 127 | StorageInfo *storage; |
128 | SyncDialog *syncDialog; | 128 | SyncDialog *syncDialog; |
129 | 129 | ||
130 | void updateLink(const QString& link); | 130 | void updateLink(const QString& link); |
131 | bool in_lnk_props; | 131 | bool in_lnk_props; |
132 | bool got_lnk_change; | 132 | bool got_lnk_change; |
133 | QString lnk_change; | 133 | QString lnk_change; |
134 | QString m_timeStamp; | ||
134 | }; | 135 | }; |
135 | 136 | ||
136 | #endif // LAUNCHERVIEW_H | 137 | #endif // LAUNCHERVIEW_H |
138 | |||