author | harlekin <harlekin> | 2003-04-07 08:50:40 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-04-07 08:50:40 (UTC) |
commit | 7e43e12cf57a39f957096889d6b38563f73402df (patch) (unidiff) | |
tree | e2f01d497421b6cdae28fec9afcbdc6acdfc1433 | |
parent | 1725b536c8a5a939a481196cce1dc35af2d9a63a (diff) | |
download | opie-7e43e12cf57a39f957096889d6b38563f73402df.zip opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.gz opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.bz2 |
show owait and a message in taskbar while scanning for documents
-rw-r--r-- | core/launcher/launcher.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index e74301c..3eb561a 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -26,64 +26,67 @@ | |||
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
30 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/mimetype.h> | 31 | #include <qpe/mimetype.h> |
32 | #include <qpe/storage.h> | 32 | #include <qpe/storage.h> |
33 | #include <qpe/palmtoprecord.h> | 33 | #include <qpe/palmtoprecord.h> |
34 | 34 | ||
35 | #include <qpe/version.h> | 35 | #include <qpe/version.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #ifdef QWS | 38 | #ifdef QWS |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #endif | 40 | #endif |
41 | #include <qtimer.h> | 41 | #include <qtimer.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qvbox.h> | 43 | #include <qvbox.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qstyle.h> | 45 | #include <qstyle.h> |
46 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
47 | #include <qtabbar.h> | 47 | #include <qtabbar.h> |
48 | #include <qwidgetstack.h> | 48 | #include <qwidgetstack.h> |
49 | #include <qlayout.h> | 49 | #include <qlayout.h> |
50 | #include <qregexp.h> | 50 | #include <qregexp.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qframe.h> | 52 | #include <qframe.h> |
53 | #include <qpainter.h> | 53 | #include <qpainter.h> |
54 | #include <qlabel.h> | 54 | #include <qlabel.h> |
55 | #include <qtextstream.h> | 55 | #include <qtextstream.h> |
56 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
57 | 57 | ||
58 | #include <opie/owait.h> | ||
59 | |||
60 | |||
58 | #include "launcherview.h" | 61 | #include "launcherview.h" |
59 | #include "launcher.h" | 62 | #include "launcher.h" |
60 | #include "syncdialog.h" | 63 | #include "syncdialog.h" |
61 | #include "desktop.h" | 64 | #include "desktop.h" |
62 | #include <qpe/lnkproperties.h> | 65 | #include <qpe/lnkproperties.h> |
63 | //#include "mrulist.h" | 66 | //#include "mrulist.h" |
64 | #include "qrsync.h" | 67 | #include "qrsync.h" |
65 | #include <stdlib.h> | 68 | #include <stdlib.h> |
66 | #include <unistd.h> | 69 | #include <unistd.h> |
67 | 70 | ||
68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 71 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
69 | #include <stdio.h> | 72 | #include <stdio.h> |
70 | #include <sys/vfs.h> | 73 | #include <sys/vfs.h> |
71 | #include <mntent.h> | 74 | #include <mntent.h> |
72 | #endif | 75 | #endif |
73 | 76 | ||
74 | #include <qpe/storage.h> | 77 | #include <qpe/storage.h> |
75 | #include "mediummountgui.h" | 78 | #include "mediummountgui.h" |
76 | 79 | ||
77 | namespace { | 80 | namespace { |
78 | QStringList configToMime( Config *cfg ){ | 81 | QStringList configToMime( Config *cfg ){ |
79 | QStringList mimes; | 82 | QStringList mimes; |
80 | bool tmpMime = true; | 83 | bool tmpMime = true; |
81 | cfg->setGroup("mimetypes" ); | 84 | cfg->setGroup("mimetypes" ); |
82 | tmpMime = cfg->readBoolEntry("all" ,true); | 85 | tmpMime = cfg->readBoolEntry("all" ,true); |
83 | if( tmpMime ){ | 86 | if( tmpMime ){ |
84 | mimes << QString::null; | 87 | mimes << QString::null; |
85 | return mimes; | 88 | return mimes; |
86 | }else{ | 89 | }else{ |
87 | tmpMime = cfg->readBoolEntry("audio", true ); | 90 | tmpMime = cfg->readBoolEntry("audio", true ); |
88 | if(tmpMime ) | 91 | if(tmpMime ) |
89 | mimes.append("audio/*" ); | 92 | mimes.append("audio/*" ); |
@@ -331,64 +334,65 @@ void CategoryTabWidget::tabProperties() | |||
331 | m->insertItem( tr("List View"), LauncherView::List ); | 334 | m->insertItem( tr("List View"), LauncherView::List ); |
332 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 335 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
333 | int rv = m->exec( QCursor::pos() ); | 336 | int rv = m->exec( QCursor::pos() ); |
334 | if ( rv >= 0 && rv != view->viewMode() ) { | 337 | if ( rv >= 0 && rv != view->viewMode() ) { |
335 | view->setViewMode( (LauncherView::ViewMode)rv ); | 338 | view->setViewMode( (LauncherView::ViewMode)rv ); |
336 | } | 339 | } |
337 | 340 | ||
338 | delete m; | 341 | delete m; |
339 | } | 342 | } |
340 | 343 | ||
341 | QString CategoryTabWidget::getAllDocLinkInfo() const | 344 | QString CategoryTabWidget::getAllDocLinkInfo() const |
342 | { | 345 | { |
343 | return docview->getAllDocLinkInfo(); | 346 | return docview->getAllDocLinkInfo(); |
344 | } | 347 | } |
345 | 348 | ||
346 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 349 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
347 | { | 350 | { |
348 | LauncherView* view = new LauncherView( stack ); | 351 | LauncherView* view = new LauncherView( stack ); |
349 | connect( view, SIGNAL(clicked(const AppLnk*)), | 352 | connect( view, SIGNAL(clicked(const AppLnk*)), |
350 | this, SIGNAL(clicked(const AppLnk*))); | 353 | this, SIGNAL(clicked(const AppLnk*))); |
351 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 354 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
352 | this, SIGNAL(rightPressed(AppLnk*))); | 355 | this, SIGNAL(rightPressed(AppLnk*))); |
353 | ids.append(id); | 356 | ids.append(id); |
354 | categoryBar->addTab( new CategoryTab( pm, label ) ); | 357 | categoryBar->addTab( new CategoryTab( pm, label ) ); |
355 | stack->addWidget( view, tabs++ ); | 358 | stack->addWidget( view, tabs++ ); |
356 | return view; | 359 | return view; |
357 | } | 360 | } |
358 | 361 | ||
359 | void CategoryTabWidget::updateLink(const QString& linkfile) | 362 | void CategoryTabWidget::updateLink(const QString& linkfile) |
360 | { | 363 | { |
361 | int i=0; | 364 | int i=0; |
362 | LauncherView* view; | 365 | LauncherView* view; |
366 | qApp->processEvents(); | ||
363 | while ((view = (LauncherView*)stack->widget(i++))) { | 367 | while ((view = (LauncherView*)stack->widget(i++))) { |
364 | if ( view->removeLink(linkfile) ) | 368 | if ( view->removeLink(linkfile) ) |
365 | break; | 369 | break; |
366 | } | 370 | } |
367 | addItem(linkfile); | 371 | addItem(linkfile); |
368 | docview->updateTools(); | 372 | docview->updateTools(); |
369 | } | 373 | } |
370 | 374 | ||
371 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 375 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
372 | { | 376 | { |
373 | QVBox::paletteChange( p ); | 377 | QVBox::paletteChange( p ); |
374 | QPalette pal = palette(); | 378 | QPalette pal = palette(); |
375 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 379 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
376 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 380 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
377 | categoryBar->setPalette( pal ); | 381 | categoryBar->setPalette( pal ); |
378 | categoryBar->update(); | 382 | categoryBar->update(); |
379 | } | 383 | } |
380 | 384 | ||
381 | void CategoryTabWidget::setBusy(bool on) | 385 | void CategoryTabWidget::setBusy(bool on) |
382 | { | 386 | { |
383 | if ( on ) | 387 | if ( on ) |
384 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 388 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
385 | else | 389 | else |
386 | for (int i=0; i<tabs; i++) | 390 | for (int i=0; i<tabs; i++) |
387 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 391 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
388 | } | 392 | } |
389 | 393 | ||
390 | LauncherView *CategoryTabWidget::view( const QString &id ) | 394 | LauncherView *CategoryTabWidget::view( const QString &id ) |
391 | { | 395 | { |
392 | int idx = ids.findIndex( id ); | 396 | int idx = ids.findIndex( id ); |
393 | return (LauncherView *)stack->widget(idx); | 397 | return (LauncherView *)stack->widget(idx); |
394 | } | 398 | } |
@@ -699,159 +703,175 @@ void Launcher::doMaximize() | |||
699 | 703 | ||
700 | void Launcher::updateMimeTypes() | 704 | void Launcher::updateMimeTypes() |
701 | { | 705 | { |
702 | MimeType::clear(); | 706 | MimeType::clear(); |
703 | updateMimeTypes(rootFolder); | 707 | updateMimeTypes(rootFolder); |
704 | } | 708 | } |
705 | 709 | ||
706 | void Launcher::updateMimeTypes(AppLnkSet* folder) | 710 | void Launcher::updateMimeTypes(AppLnkSet* folder) |
707 | { | 711 | { |
708 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 712 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
709 | AppLnk *app = it.current(); | 713 | AppLnk *app = it.current(); |
710 | if ( app->type() == "Folder" ) // No tr | 714 | if ( app->type() == "Folder" ) // No tr |
711 | updateMimeTypes((AppLnkSet *)app); | 715 | updateMimeTypes((AppLnkSet *)app); |
712 | else { | 716 | else { |
713 | MimeType::registerApp(*app); | 717 | MimeType::registerApp(*app); |
714 | } | 718 | } |
715 | } | 719 | } |
716 | } | 720 | } |
717 | 721 | ||
718 | /** This is a HACK.... | 722 | /** This is a HACK.... |
719 | * Reason: scanning huge mediums, microdirvers for examples | 723 | * Reason: scanning huge mediums, microdirvers for examples |
720 | * consomes time. To avoid that we invented the MediumMountCheck | 724 | * consomes time. To avoid that we invented the MediumMountCheck |
721 | * | 725 | * |
722 | * a) the user globally disabled medium checking. We can ignore | 726 | * a) the user globally disabled medium checking. We can ignore |
723 | * all removable medium | 727 | * all removable medium |
724 | * b) the user enabled medium checking globally and we need to use this mimefilter | 728 | * b) the user enabled medium checking globally and we need to use this mimefilter |
725 | * c) the user enabled medium checking on a per medium bases | 729 | * c) the user enabled medium checking on a per medium bases |
726 | * c1) we already checked and its not ask again turns | 730 | * c1) we already checked and its not ask again turns |
727 | * c2) we need to ask and then apply the mimefilter | 731 | * c2) we need to ask and then apply the mimefilter |
728 | */ | 732 | */ |
729 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
730 | { | 734 | { |
735 | |||
736 | OWait *owait = new OWait(); | ||
737 | Global::statusMessage( tr( "Finding documents" ) ); | ||
738 | |||
739 | owait->show(); | ||
740 | qApp->processEvents(); | ||
741 | |||
731 | delete docsFolder; | 742 | delete docsFolder; |
732 | docsFolder = new DocLnkSet; | 743 | docsFolder = new DocLnkSet; |
733 | 744 | ||
734 | DocLnkSet *tmp = 0; | 745 | DocLnkSet *tmp = 0; |
735 | QString home = QString(getenv("HOME")) + "/Documents"; | 746 | QString home = QString(getenv("HOME")) + "/Documents"; |
736 | tmp = new DocLnkSet( home , QString::null); | 747 | tmp = new DocLnkSet( home , QString::null); |
737 | docsFolder->appendFrom( *tmp ); | 748 | docsFolder->appendFrom( *tmp ); |
738 | delete tmp; | 749 | delete tmp; |
739 | 750 | ||
740 | // RAM documents | 751 | // RAM documents |
741 | StorageInfo storage; | 752 | StorageInfo storage; |
742 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 753 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
743 | QListIterator<FileSystem> it ( fileSystems ); | 754 | QListIterator<FileSystem> it ( fileSystems ); |
744 | 755 | ||
745 | for ( ; it.current(); ++it ) { | 756 | for ( ; it.current(); ++it ) { |
746 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 757 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
747 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | 758 | tmp = new DocLnkSet( (*it)->path(), QString::null ); |
748 | docsFolder->appendFrom( *tmp ); | 759 | docsFolder->appendFrom( *tmp ); |
749 | delete tmp; | 760 | delete tmp; |
750 | } | 761 | } |
751 | } | 762 | } |
752 | 763 | ||
753 | Config mediumCfg( "medium"); | 764 | Config mediumCfg( "medium"); |
754 | mediumCfg.setGroup("main"); | 765 | mediumCfg.setGroup("main"); |
755 | // a) -zecke we don't want to check | 766 | // a) -zecke we don't want to check |
756 | if(!mediumCfg.readBoolEntry("use", true ) ) | 767 | if(!mediumCfg.readBoolEntry("use", true ) ) |
757 | return; | 768 | return; |
758 | 769 | ||
759 | // find out wich filesystems are new in this round | 770 | // find out wich filesystems are new in this round |
760 | // We will do this by having a timestamp inside each mountpoint | 771 | // We will do this by having a timestamp inside each mountpoint |
761 | // if the current timestamp doesn't match this is a new file system and | 772 | // if the current timestamp doesn't match this is a new file system and |
762 | // come up with our MediumMountGui :) let the hacking begin | 773 | // come up with our MediumMountGui :) let the hacking begin |
763 | int stamp = uidgen.generate(); | 774 | int stamp = uidgen.generate(); |
764 | 775 | ||
765 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 776 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
766 | 777 | ||
767 | // b) | 778 | // b) |
768 | if( mediumCfg.readBoolEntry("global", true ) ){ | 779 | if( mediumCfg.readBoolEntry("global", true ) ){ |
769 | QString mime = configToMime(&mediumCfg).join(";"); | 780 | QString mime = configToMime(&mediumCfg).join(";"); |
770 | for( it.toFirst(); it.current(); ++it ){ | 781 | for( it.toFirst(); it.current(); ++it ){ |
771 | if( (*it)->isRemovable() ){ | 782 | if( (*it)->isRemovable() ){ |
772 | tmp = new DocLnkSet( (*it)->path(), mime ); | 783 | tmp = new DocLnkSet( (*it)->path(), mime ); |
773 | docsFolder->appendFrom( *tmp ); | 784 | docsFolder->appendFrom( *tmp ); |
774 | delete tmp; | 785 | delete tmp; |
775 | } | 786 | } |
776 | } // done | 787 | } // done |
777 | return; // save the else | 788 | return; // save the else |
778 | } | 789 | } |
779 | // c) zecke | 790 | // c) zecke |
780 | for ( it.toFirst(); it.current(); ++it ) { | 791 | for ( it.toFirst(); it.current(); ++it ) { |
781 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 792 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
782 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 793 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
783 | cfg.setGroup("main"); | 794 | cfg.setGroup("main"); |
784 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 795 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
785 | /** This medium is uptodate | 796 | /** This medium is uptodate |
786 | */ | 797 | */ |
787 | if( stamp == m_timeStamp ){ // ok we know this card | 798 | if( stamp == m_timeStamp ){ // ok we know this card |
788 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 799 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
789 | // we need to scan the list now. Hopefully the cache will be there | 800 | // we need to scan the list now. Hopefully the cache will be there |
790 | // read the mimetypes from the config and search for documents | 801 | // read the mimetypes from the config and search for documents |
791 | QStringList mimetypes = configToMime( &cfg); | 802 | QStringList mimetypes = configToMime( &cfg); |
792 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 803 | qApp->processEvents(); |
804 | Global::statusMessage( tr( "Searching documents" ) ); | ||
805 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | ||
793 | docsFolder->appendFrom( *tmp ); | 806 | docsFolder->appendFrom( *tmp ); |
794 | delete tmp; | 807 | delete tmp; |
795 | 808 | ||
796 | }else{ // come up with the gui cause this a new card | 809 | }else{ // come up with the gui cause this a new card |
797 | MediumMountGui medium(&cfg, (*it)->path() ); | 810 | MediumMountGui medium(&cfg, (*it)->path() ); |
798 | if( medium.check() ){ // we did not ask before or ask again is off | 811 | if( medium.check() ){ // we did not ask before or ask again is off |
799 | /** c2) */ | 812 | /** c2) */ |
800 | if( medium.exec() ){ // he clicked yes so search it | 813 | if( medium.exec() ){ // he clicked yes so search it |
801 | // speicher | 814 | // speicher |
802 | //cfg.read(); // cause of a race we need to reread - fixed | 815 | //cfg.read(); // cause of a race we need to reread - fixed |
803 | cfg.setGroup("main"); | 816 | cfg.setGroup("main"); |
804 | cfg.writeEntry("timestamp", newStamp ); | 817 | cfg.writeEntry("timestamp", newStamp ); |
805 | cfg.write(); | 818 | cfg.write(); |
806 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | 819 | |
807 | docsFolder->appendFrom( *tmp ); | 820 | qApp->processEvents(); |
821 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | ||
822 | docsFolder->appendFrom( *tmp ); | ||
808 | delete tmp; | 823 | delete tmp; |
809 | }// no else | 824 | }// no else |
810 | /** c1) */ | 825 | /** c1) */ |
811 | }else{ // we checked | 826 | }else{ // we checked |
812 | // do something different see what we need to do | 827 | // do something different see what we need to do |
813 | // let's see if we should check the device | 828 | // let's see if we should check the device |
814 | cfg.setGroup("main" ); | 829 | cfg.setGroup("main" ); |
815 | bool check = cfg.readBoolEntry("autocheck", true ); | 830 | bool check = cfg.readBoolEntry("autocheck", true ); |
816 | if( check ){ // find the documents | 831 | if( check ){ // find the documents |
817 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 832 | |
833 | qApp->processEvents(); | ||
834 | Global::statusMessage( tr( "Searching documents" ) ); | ||
835 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | ||
818 | docsFolder->appendFrom( *tmp ); | 836 | docsFolder->appendFrom( *tmp ); |
819 | delete tmp; | 837 | delete tmp; |
820 | } | 838 | } |
821 | } | 839 | } |
822 | } | 840 | } |
823 | } | 841 | } |
824 | } | 842 | } |
825 | m_timeStamp = newStamp; | 843 | m_timeStamp = newStamp; |
844 | owait->hide(); | ||
845 | delete owait; | ||
826 | } | 846 | } |
827 | 847 | ||
828 | void Launcher::updateTabs() | 848 | void Launcher::updateTabs() |
829 | { | 849 | { |
830 | MimeType::updateApplications(); // ### reads all applnks twice | 850 | MimeType::updateApplications(); // ### reads all applnks twice |
831 | 851 | ||
832 | delete rootFolder; | 852 | delete rootFolder; |
833 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
834 | 854 | ||
835 | loadDocs(); | 855 | loadDocs(); |
836 | 856 | ||
837 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 857 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
838 | } | 858 | } |
839 | 859 | ||
840 | void Launcher::updateDocs() | 860 | void Launcher::updateDocs() |
841 | { | 861 | { |
842 | loadDocs(); | 862 | loadDocs(); |
843 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 863 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
844 | } | 864 | } |
845 | 865 | ||
846 | void Launcher::viewSelected(const QString& s) | 866 | void Launcher::viewSelected(const QString& s) |
847 | { | 867 | { |
848 | setCaption( s + tr(" - Launcher") ); | 868 | setCaption( s + tr(" - Launcher") ); |
849 | } | 869 | } |
850 | 870 | ||
851 | void Launcher::nextView() | 871 | void Launcher::nextView() |
852 | { | 872 | { |
853 | tabs->nextTab(); | 873 | tabs->nextTab(); |
854 | } | 874 | } |
855 | 875 | ||
856 | void Launcher::showTab(const QString& id) | 876 | void Launcher::showTab(const QString& id) |
857 | { | 877 | { |
@@ -1075,65 +1095,68 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
1075 | stream >> app; | 1095 | stream >> app; |
1076 | Config cfg( "qpe" ); | 1096 | Config cfg( "qpe" ); |
1077 | cfg.setGroup("SyncDate"); | 1097 | cfg.setGroup("SyncDate"); |
1078 | #ifndef QT_NO_COP | 1098 | #ifndef QT_NO_COP |
1079 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 1099 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
1080 | e << app << cfg.readEntry( app ); | 1100 | e << app << cfg.readEntry( app ); |
1081 | #endif | 1101 | #endif |
1082 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 1102 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
1083 | //cfg.readEntry( app ).latin1() ); | 1103 | //cfg.readEntry( app ).latin1() ); |
1084 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 1104 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
1085 | QString app, date; | 1105 | QString app, date; |
1086 | stream >> app >> date; | 1106 | stream >> app >> date; |
1087 | Config cfg( "qpe" ); | 1107 | Config cfg( "qpe" ); |
1088 | cfg.setGroup("SyncDate"); | 1108 | cfg.setGroup("SyncDate"); |
1089 | cfg.writeEntry( app, date ); | 1109 | cfg.writeEntry( app, date ); |
1090 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 1110 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
1091 | } else if ( msg == "startSync(QString)" ) { | 1111 | } else if ( msg == "startSync(QString)" ) { |
1092 | QString what; | 1112 | QString what; |
1093 | stream >> what; | 1113 | stream >> what; |
1094 | delete syncDialog; syncDialog = 0; | 1114 | delete syncDialog; syncDialog = 0; |
1095 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 1115 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
1096 | WStyle_Tool | WStyle_Customize | | 1116 | WStyle_Tool | WStyle_Customize | |
1097 | Qt::WStyle_StaysOnTop ); | 1117 | Qt::WStyle_StaysOnTop ); |
1098 | syncDialog->showMaximized(); | 1118 | syncDialog->showMaximized(); |
1099 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 1119 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
1100 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 1120 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
1101 | SLOT( cancelSync() ) ); | 1121 | SLOT( cancelSync() ) ); |
1102 | } else if ( msg == "stopSync()") { | 1122 | } else if ( msg == "stopSync()") { |
1103 | delete syncDialog; syncDialog = 0; | 1123 | delete syncDialog; syncDialog = 0; |
1104 | } else if ( msg == "getAllDocLinks()" ) { | 1124 | } else if ( msg == "getAllDocLinks()" ) { |
1105 | loadDocs(); | 1125 | loadDocs(); |
1106 | 1126 | ||
1107 | QString contents; | 1127 | // directly show updated docs in document tab |
1128 | updateDocs(); | ||
1129 | |||
1130 | QString contents; | ||
1108 | 1131 | ||
1109 | //Categories cats; | 1132 | //Categories cats; |
1110 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 1133 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
1111 | DocLnk *doc = it.current(); | 1134 | DocLnk *doc = it.current(); |
1112 | QFileInfo fi( doc->file() ); | 1135 | QFileInfo fi( doc->file() ); |
1113 | if ( !fi.exists() ) | 1136 | if ( !fi.exists() ) |
1114 | continue; | 1137 | continue; |
1115 | 1138 | ||
1116 | bool fake = !doc->linkFileKnown(); | 1139 | bool fake = !doc->linkFileKnown(); |
1117 | if ( !fake ) { | 1140 | if ( !fake ) { |
1118 | QFile f( doc->linkFile() ); | 1141 | QFile f( doc->linkFile() ); |
1119 | if ( f.open( IO_ReadOnly ) ) { | 1142 | if ( f.open( IO_ReadOnly ) ) { |
1120 | QTextStream ts( &f ); | 1143 | QTextStream ts( &f ); |
1121 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 1144 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
1122 | contents += ts.read(); | 1145 | contents += ts.read(); |
1123 | f.close(); | 1146 | f.close(); |
1124 | } else | 1147 | } else |
1125 | fake = TRUE; | 1148 | fake = TRUE; |
1126 | } | 1149 | } |
1127 | if (fake) { | 1150 | if (fake) { |
1128 | contents += "[Desktop Entry]\n"; | 1151 | contents += "[Desktop Entry]\n"; |
1129 | contents += "Categories = " + // No tr | 1152 | contents += "Categories = " + // No tr |
1130 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 1153 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
1131 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 1154 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
1132 | contents += "Name = "+doc->name()+"\n"; // No tr | 1155 | contents += "Name = "+doc->name()+"\n"; // No tr |
1133 | contents += "Type = "+doc->type()+"\n"; // No tr | 1156 | contents += "Type = "+doc->type()+"\n"; // No tr |
1134 | } | 1157 | } |
1135 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 1158 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
1136 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 1159 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
1137 | } | 1160 | } |
1138 | 1161 | ||
1139 | //qDebug( "sending length %d", contents.length() ); | 1162 | //qDebug( "sending length %d", contents.length() ); |