author | mickeyl <mickeyl> | 2003-11-17 15:16:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-11-17 15:16:13 (UTC) |
commit | c4a6e9c529ea6bcb1c9a42fee33a70300f116c98 (patch) (unidiff) | |
tree | 1ee68a2035b0218ba99662db1dff4c4067064cde /core/launcher | |
parent | 725e2723291fe1d71ca68cb59cec83428d40b8af (diff) | |
download | opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.zip opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.gz opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.bz2 |
This patch makes the famous Documents Tab customizably optional.
Note that the document tab is so tight coupled to the rest
of the launcher that it proved impossible for me to remove the
tab as is. However I could make all the scanning and the displaying
optional.
The customization can be done via the launcher settings applications -
a new doc tab category has been added. Further customization can be
added to that tab.
I also added a doc tab settings application for use with the "first usage wizard"
-rw-r--r-- | core/launcher/documentlist.cpp | 15 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 2 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 35 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 |
4 files changed, 48 insertions, 6 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 7f9366e..dcea4b9 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -20,8 +20,9 @@ | |||
20 | #include "documentlist.h" | 20 | #include "documentlist.h" |
21 | #include "serverinterface.h" | 21 | #include "serverinterface.h" |
22 | #include "launcherglobal.h" | 22 | #include "launcherglobal.h" |
23 | 23 | ||
24 | #include <qtopia/config.h> | ||
24 | #include <qtopia/mimetype.h> | 25 | #include <qtopia/mimetype.h> |
25 | #include <qtopia/resource.h> | 26 | #include <qtopia/resource.h> |
26 | #include <qtopia/global.h> | 27 | #include <qtopia/global.h> |
27 | #include <qtopia/private/categories.h> | 28 | #include <qtopia/private/categories.h> |
@@ -103,9 +104,23 @@ DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, | |||
103 | 104 | ||
104 | void DocumentList::startInitialScan() | 105 | void DocumentList::startInitialScan() |
105 | { | 106 | { |
106 | reloadAppLnks(); | 107 | reloadAppLnks(); |
108 | |||
109 | Config cfg( "Launcher" ); | ||
110 | cfg.setGroup( "DocTab" ); | ||
111 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
112 | if ( docTabEnabled ) | ||
107 | reloadDocLnks(); | 113 | reloadDocLnks(); |
114 | else | ||
115 | { | ||
116 | if ( d->sendDocLnks && d->serverGui ) | ||
117 | { | ||
118 | d->serverGui->documentScanningProgress( 0 ); | ||
119 | d->serverGui->allDocumentsRemoved(); | ||
120 | } | ||
121 | } | ||
122 | |||
108 | } | 123 | } |
109 | 124 | ||
110 | DocumentList::~DocumentList() | 125 | DocumentList::~DocumentList() |
111 | { | 126 | { |
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 57469cf..e07920f 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -77,8 +77,10 @@ struct { | |||
77 | settingsTable [] = | 77 | settingsTable [] = |
78 | { | 78 | { |
79 | { FALSE, "language", "raise()", "accept()", // No tr | 79 | { FALSE, "language", "raise()", "accept()", // No tr |
80 | QT_TR_NOOP("Language") }, | 80 | QT_TR_NOOP("Language") }, |
81 | { FALSE, "doctab", "raise()", "accept()", // No tr | ||
82 | QT_TR_NOOP("DocTab") }, | ||
81 | #ifndef Q_OS_WIN32 | 83 | #ifndef Q_OS_WIN32 |
82 | { FALSE, "systemtime", "raise()", "accept()", // No tr | 84 | { FALSE, "systemtime", "raise()", "accept()", // No tr |
83 | QT_TR_NOOP("Time and Date") }, | 85 | QT_TR_NOOP("Time and Date") }, |
84 | #endif | 86 | #endif |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index d697c43..b312672 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -81,9 +81,9 @@ | |||
81 | static bool isVisibleWindow( int ); | 81 | static bool isVisibleWindow( int ); |
82 | //=========================================================================== | 82 | //=========================================================================== |
83 | 83 | ||
84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 84 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
85 | QVBox( parent ) | 85 | QVBox( parent ), docview( 0 ) |
86 | { | 86 | { |
87 | docLoadingWidgetEnabled = false; | 87 | docLoadingWidgetEnabled = false; |
88 | docLoadingWidget = 0; | 88 | docLoadingWidget = 0; |
89 | docLoadingWidgetProgress = 0; | 89 | docLoadingWidgetProgress = 0; |
@@ -130,22 +130,34 @@ void LauncherTabWidget::createDocLoadingWidget() | |||
130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 130 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
133 | 133 | ||
134 | Config cfg( "Launcher" ); | ||
135 | cfg.setGroup( "DocTab" ); | ||
136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
137 | |||
134 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 138 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
135 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | ||
136 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
137 | |||
138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
139 | docLoadingWidgetProgress->setProgress( 0 ); | 141 | docLoadingWidgetProgress->setProgress( 0 ); |
140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
142 | setProgressStyle(); | 144 | setProgressStyle(); |
143 | 145 | ||
146 | if ( docTabEnabled ) | ||
147 | { | ||
148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | ||
153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | ||
154 | docLoadingWidgetProgress->hide(); | ||
155 | } | ||
156 | |||
144 | QWidget *space2 = new QWidget( docLoadingVBox ); | 157 | QWidget *space2 = new QWidget( docLoadingVBox ); |
145 | docLoadingVBox->setStretchFactor( space2, 1 ); | 158 | docLoadingVBox->setStretchFactor( space2, 1 ); |
146 | 159 | ||
147 | Config cfg("Launcher"); | ||
148 | cfg.setGroup( "Tab Documents" ); // No tr | 160 | cfg.setGroup( "Tab Documents" ); // No tr |
149 | setTabViewAppearance( docLoadingWidget, cfg ); | 161 | setTabViewAppearance( docLoadingWidget, cfg ); |
150 | 162 | ||
151 | stack->addWidget( docLoadingWidget, 0 ); | 163 | stack->addWidget( docLoadingWidget, 0 ); |
@@ -428,8 +440,11 @@ Launcher::Launcher() | |||
428 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 440 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
429 | { | 441 | { |
430 | tabs = 0; | 442 | tabs = 0; |
431 | tb = 0; | 443 | tb = 0; |
444 | Config cfg( "Launcher" ); | ||
445 | cfg.setGroup( "DocTab" ); | ||
446 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | ||
432 | } | 447 | } |
433 | 448 | ||
434 | void Launcher::createGUI() | 449 | void Launcher::createGUI() |
435 | { | 450 | { |
@@ -471,13 +486,13 @@ void Launcher::createGUI() | |||
471 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 486 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
472 | QPixmap pm; | 487 | QPixmap pm; |
473 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 488 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
474 | // It could add this itself if it handles docs | 489 | // It could add this itself if it handles docs |
490 | |||
475 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 491 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
476 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | ||
477 | 492 | ||
493 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | ||
478 | qApp->setMainWidget( this ); | 494 | qApp->setMainWidget( this ); |
479 | |||
480 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 495 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
481 | } | 496 | } |
482 | 497 | ||
483 | Launcher::~Launcher() | 498 | Launcher::~Launcher() |
@@ -733,8 +748,16 @@ void Launcher::applicationScanningProgress( int percent ) | |||
733 | } | 748 | } |
734 | 749 | ||
735 | void Launcher::documentScanningProgress( int percent ) | 750 | void Launcher::documentScanningProgress( int percent ) |
736 | { | 751 | { |
752 | if ( !docTabEnabled ) | ||
753 | { | ||
754 | qDebug( "Launcher: document tab disabled!" ); | ||
755 | tabs->setLoadingProgress( 100 ); | ||
756 | tabs->setLoadingWidgetEnabled( TRUE ); | ||
757 | return; | ||
758 | } | ||
759 | |||
737 | switch ( percent ) { | 760 | switch ( percent ) { |
738 | case 0: { | 761 | case 0: { |
739 | tabs->setLoadingProgress( 0 ); | 762 | tabs->setLoadingProgress( 0 ); |
740 | tabs->setLoadingWidgetEnabled( TRUE ); | 763 | tabs->setLoadingWidgetEnabled( TRUE ); |
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 2917027..1d046ee 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -149,7 +149,9 @@ private: | |||
149 | 149 | ||
150 | LauncherTabWidget *tabs; | 150 | LauncherTabWidget *tabs; |
151 | QStringList ids; | 151 | QStringList ids; |
152 | TaskBar *tb; | 152 | TaskBar *tb; |
153 | |||
154 | bool docTabEnabled; | ||
153 | }; | 155 | }; |
154 | 156 | ||
155 | #endif // LAUNCHERVIEW_H | 157 | #endif // LAUNCHERVIEW_H |