-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 | |||
@@ -462,128 +462,129 @@ static bool isVisibleWindow(int wid) | |||
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 ) |
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 | |||
@@ -70,67 +70,69 @@ public slots: | |||
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 | |||