summaryrefslogtreecommitdiff
authorzecke <zecke>2004-07-17 17:48:36 (UTC)
committer zecke <zecke>2004-07-17 17:48:36 (UTC)
commit0f64024dc631d9043d2f6f4f6bcafaac7eddd545 (patch) (unidiff)
tree1919517cd70c2b74caeee24cccb0ac239b867b74
parent8cc200a72b547bb7e313cfa197c72f91dfe0c759 (diff)
downloadopie-0f64024dc631d9043d2f6f4f6bcafaac7eddd545.zip
opie-0f64024dc631d9043d2f6f4f6bcafaac7eddd545.tar.gz
opie-0f64024dc631d9043d2f6f4f6bcafaac7eddd545.tar.bz2
Fix compiler warning about unused variable
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index aa357ca..010a2e9 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,781 +1,781 @@
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 "startmenu.h" 21#include "startmenu.h"
22#include "taskbar.h" 22#include "taskbar.h"
23#include "serverinterface.h" 23#include "serverinterface.h"
24#include "launcherview.h" 24#include "launcherview.h"
25#include "launcher.h" 25#include "launcher.h"
26#include "server.h" 26#include "server.h"
27 27
28/* OPIE */ 28/* OPIE */
29#include <opie2/odebug.h> 29#include <opie2/odebug.h>
30#include <qtopia/global.h> 30#include <qtopia/global.h>
31#ifdef Q_WS_QWS 31#ifdef Q_WS_QWS
32#include <qtopia/qcopenvelope_qws.h> 32#include <qtopia/qcopenvelope_qws.h>
33#endif 33#endif
34#include <qtopia/resource.h> 34#include <qtopia/resource.h>
35#include <qtopia/applnk.h> 35#include <qtopia/applnk.h>
36#include <qtopia/config.h> 36#include <qtopia/config.h>
37#include <qtopia/qpeapplication.h> 37#include <qtopia/qpeapplication.h>
38#include <qtopia/mimetype.h> 38#include <qtopia/mimetype.h>
39#include <qtopia/private/categories.h> 39#include <qtopia/private/categories.h>
40#define QTOPIA_INTERNAL_FSLP 40#define QTOPIA_INTERNAL_FSLP
41#include <qtopia/lnkproperties.h> 41#include <qtopia/lnkproperties.h>
42 42
43/* QT */ 43/* QT */
44#include <qdir.h> 44#include <qdir.h>
45#ifdef Q_WS_QWS 45#ifdef Q_WS_QWS
46#include <qkeyboard_qws.h> 46#include <qkeyboard_qws.h>
47#include <qwindowsystem_qws.h> 47#include <qwindowsystem_qws.h>
48#endif 48#endif
49#include <qtimer.h> 49#include <qtimer.h>
50#include <qcombobox.h> 50#include <qcombobox.h>
51#include <qvbox.h> 51#include <qvbox.h>
52#include <qlayout.h> 52#include <qlayout.h>
53#include <qstyle.h> 53#include <qstyle.h>
54#include <qpushbutton.h> 54#include <qpushbutton.h>
55#include <qtabbar.h> 55#include <qtabbar.h>
56#include <qwidgetstack.h> 56#include <qwidgetstack.h>
57#include <qregexp.h> 57#include <qregexp.h>
58#include <qmessagebox.h> 58#include <qmessagebox.h>
59#include <qframe.h> 59#include <qframe.h>
60#include <qpainter.h> 60#include <qpainter.h>
61#include <qlabel.h> 61#include <qlabel.h>
62#include <qtextstream.h> 62#include <qtextstream.h>
63#include <qpopupmenu.h> 63#include <qpopupmenu.h>
64 64
65/* STD */ 65/* STD */
66#include <stdlib.h> 66#include <stdlib.h>
67#include <assert.h> 67#include <assert.h>
68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
69#include <unistd.h> 69#include <unistd.h>
70#include <stdio.h> 70#include <stdio.h>
71#include <sys/vfs.h> 71#include <sys/vfs.h>
72#include <mntent.h> 72#include <mntent.h>
73#endif 73#endif
74 74
75 75
76static bool isVisibleWindow( int ); 76static bool isVisibleWindow( int );
77//=========================================================================== 77//===========================================================================
78 78
79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
80 QVBox( parent ), docview( 0 ) 80 QVBox( parent ), docview( 0 )
81{ 81{
82 docLoadingWidgetEnabled = false; 82 docLoadingWidgetEnabled = false;
83 docLoadingWidget = 0; 83 docLoadingWidget = 0;
84 docLoadingWidgetProgress = 0; 84 docLoadingWidgetProgress = 0;
85 launcher = parent; 85 launcher = parent;
86 categoryBar = new LauncherTabBar( this ); 86 categoryBar = new LauncherTabBar( this );
87 QPalette pal = categoryBar->palette(); 87 QPalette pal = categoryBar->palette();
88 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 88 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
89 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 89 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
90 categoryBar->setPalette( pal ); 90 categoryBar->setPalette( pal );
91 stack = new QWidgetStack(this); 91 stack = new QWidgetStack(this);
92 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); 92 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) );
93 categoryBar->show(); 93 categoryBar->show();
94 stack->show(); 94 stack->show();
95 95
96#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 96#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); 99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) );
100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
101 this, SLOT(appMessage(const QCString&,const QByteArray&))); 101 this, SLOT(appMessage(const QCString&,const QByteArray&)));
102#endif 102#endif
103 103
104 createDocLoadingWidget(); 104 createDocLoadingWidget();
105} 105}
106 106
107void LauncherTabWidget::createDocLoadingWidget() 107void LauncherTabWidget::createDocLoadingWidget()
108{ 108{
109 // Construct the 'doc loading widget' shown when finding documents 109 // Construct the 'doc loading widget' shown when finding documents
110 110
111 // ### LauncherView class needs changing to be more generic so 111 // ### LauncherView class needs changing to be more generic so
112 // this widget can change its background similar to the iconviews 112 // this widget can change its background similar to the iconviews
113 // so the background for this matches 113 // so the background for this matches
114 docLoadingWidget = new LauncherView( stack ); 114 docLoadingWidget = new LauncherView( stack );
115 docLoadingWidget->hideIcons(); 115 docLoadingWidget->hideIcons();
116 QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); 116 QVBox *docLoadingVBox = new QVBox( docLoadingWidget );
117 117
118 docLoadingVBox->setSpacing( 20 ); 118 docLoadingVBox->setSpacing( 20 );
119 docLoadingVBox->setMargin( 10 ); 119 docLoadingVBox->setMargin( 10 );
120 120
121 QWidget *space1 = new QWidget( docLoadingVBox ); 121 QWidget *space1 = new QWidget( docLoadingVBox );
122 docLoadingVBox->setStretchFactor( space1, 1 ); 122 docLoadingVBox->setStretchFactor( space1, 1 );
123 123
124 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 124 QLabel *waitPixmap = new QLabel( docLoadingVBox );
125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
128 128
129 Config cfg( "Launcher" ); 129 Config cfg( "Launcher" );
130 cfg.setGroup( "DocTab" ); 130 cfg.setGroup( "DocTab" );
131 bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); 131 bool docTabEnabled = cfg.readBoolEntry( "Enable", true );
132 132
133 QLabel *textLabel = new QLabel( docLoadingVBox ); 133 QLabel *textLabel = new QLabel( docLoadingVBox );
134 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 134 textLabel->setAlignment( int( QLabel::AlignCenter ) );
135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
136 docLoadingWidgetProgress->setProgress( 0 ); 136 docLoadingWidgetProgress->setProgress( 0 );
137 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 137 docLoadingWidgetProgress->setCenterIndicator( TRUE );
138 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker 138 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker
139 setProgressStyle(); 139 setProgressStyle();
140 140
141 if ( docTabEnabled ) 141 if ( docTabEnabled )
142 { 142 {
143 textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); 143 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
144 } 144 }
145 else 145 else
146 { 146 {
147 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" 147 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>"
148 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); 148 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) );
149 docLoadingWidgetProgress->hide(); 149 docLoadingWidgetProgress->hide();
150 docLoadingWidgetEnabled = true; 150 docLoadingWidgetEnabled = true;
151 } 151 }
152 152
153 QWidget *space2 = new QWidget( docLoadingVBox ); 153 QWidget *space2 = new QWidget( docLoadingVBox );
154 docLoadingVBox->setStretchFactor( space2, 1 ); 154 docLoadingVBox->setStretchFactor( space2, 1 );
155 155
156 cfg.setGroup( "Tab Documents" ); // No tr 156 cfg.setGroup( "Tab Documents" ); // No tr
157 setTabViewAppearance( docLoadingWidget, cfg ); 157 setTabViewAppearance( docLoadingWidget, cfg );
158 158
159 stack->addWidget( docLoadingWidget, 0 ); 159 stack->addWidget( docLoadingWidget, 0 );
160} 160}
161 161
162void LauncherTabWidget::initLayout() 162void LauncherTabWidget::initLayout()
163{ 163{
164 layout()->activate(); 164 layout()->activate();
165 docView()->setFocus(); 165 docView()->setFocus();
166 categoryBar->showTab("Documents"); 166 categoryBar->showTab("Documents");
167} 167}
168 168
169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&)
170{ 170{
171 if ( message == "nextView()" ) 171 if ( message == "nextView()" )
172 categoryBar->nextTab(); 172 categoryBar->nextTab();
173} 173}
174 174
175void LauncherTabWidget::raiseTabWidget() 175void LauncherTabWidget::raiseTabWidget()
176{ 176{
177 if ( categoryBar->currentView() == docView() 177 if ( categoryBar->currentView() == docView()
178 && docLoadingWidgetEnabled ) { 178 && docLoadingWidgetEnabled ) {
179 stack->raiseWidget( docLoadingWidget ); 179 stack->raiseWidget( docLoadingWidget );
180 docLoadingWidget->updateGeometry(); 180 docLoadingWidget->updateGeometry();
181 } else { 181 } else {
182 stack->raiseWidget( categoryBar->currentView() ); 182 stack->raiseWidget( categoryBar->currentView() );
183 } 183 }
184} 184}
185 185
186void LauncherTabWidget::tabProperties() 186void LauncherTabWidget::tabProperties()
187{ 187{
188 LauncherView *view = categoryBar->currentView(); 188 LauncherView *view = categoryBar->currentView();
189 QPopupMenu *m = new QPopupMenu( this ); 189 QPopupMenu *m = new QPopupMenu( this );
190 m->insertItem( tr("Icon View"), LauncherView::Icon ); 190 m->insertItem( tr("Icon View"), LauncherView::Icon );
191 m->insertItem( tr("List View"), LauncherView::List ); 191 m->insertItem( tr("List View"), LauncherView::List );
192 m->setItemChecked( (int)view->viewMode(), TRUE ); 192 m->setItemChecked( (int)view->viewMode(), TRUE );
193 int rv = m->exec( QCursor::pos() ); 193 int rv = m->exec( QCursor::pos() );
194 if ( rv >= 0 && rv != view->viewMode() ) { 194 if ( rv >= 0 && rv != view->viewMode() ) {
195 view->setViewMode( (LauncherView::ViewMode)rv ); 195 view->setViewMode( (LauncherView::ViewMode)rv );
196 } 196 }
197 197
198 delete m; 198 delete m;
199} 199}
200 200
201void LauncherTabWidget::deleteView( const QString& id ) 201void LauncherTabWidget::deleteView( const QString& id )
202{ 202{
203 LauncherTab *t = categoryBar->launcherTab(id); 203 LauncherTab *t = categoryBar->launcherTab(id);
204 if ( t ) { 204 if ( t ) {
205 stack->removeWidget( t->view ); 205 stack->removeWidget( t->view );
206 delete t->view; 206 delete t->view;
207 categoryBar->removeTab( t ); 207 categoryBar->removeTab( t );
208 } 208 }
209} 209}
210 210
211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
212{ 212{
213 LauncherView* view = new LauncherView( stack ); 213 LauncherView* view = new LauncherView( stack );
214 connect( view, SIGNAL(clicked(const AppLnk*)), 214 connect( view, SIGNAL(clicked(const AppLnk*)),
215 this, SIGNAL(clicked(const AppLnk*))); 215 this, SIGNAL(clicked(const AppLnk*)));
216 connect( view, SIGNAL(rightPressed(AppLnk*)), 216 connect( view, SIGNAL(rightPressed(AppLnk*)),
217 this, SIGNAL(rightPressed(AppLnk*))); 217 this, SIGNAL(rightPressed(AppLnk*)));
218 218
219 int n = categoryBar->count(); 219 int n = categoryBar->count();
220 stack->addWidget( view, n ); 220 stack->addWidget( view, n );
221 221
222 LauncherTab *tab = new LauncherTab( id, view, pm, label ); 222 LauncherTab *tab = new LauncherTab( id, view, pm, label );
223 categoryBar->insertTab( tab, n-1 ); 223 categoryBar->insertTab( tab, n-1 );
224 224
225 if ( id == "Documents" ) 225 if ( id == "Documents" )
226 docview = view; 226 docview = view;
227 227
228 odebug << "inserting " << id << " at " << n-1 << "" << oendl; 228 odebug << "inserting " << id << " at " << n-1 << "" << oendl;
229 229
230 Config cfg("Launcher"); 230 Config cfg("Launcher");
231 setTabAppearance( tab, cfg ); 231 setTabAppearance( tab, cfg );
232 232
233 cfg.setGroup( "GUI" ); 233 cfg.setGroup( "GUI" );
234 view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); 234 view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) );
235 235
236 return view; 236 return view;
237} 237}
238 238
239LauncherView *LauncherTabWidget::view( const QString &id ) 239LauncherView *LauncherTabWidget::view( const QString &id )
240{ 240{
241 LauncherTab *t = categoryBar->launcherTab(id); 241 LauncherTab *t = categoryBar->launcherTab(id);
242 if ( !t ) 242 if ( !t )
243 return 0; 243 return 0;
244 return t->view; 244 return t->view;
245} 245}
246 246
247LauncherView *LauncherTabWidget::docView() 247LauncherView *LauncherTabWidget::docView()
248{ 248{
249 return docview; 249 return docview;
250} 250}
251 251
252void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) 252void LauncherTabWidget::setLoadingWidgetEnabled( bool v )
253{ 253{
254 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { 254 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) {
255 docLoadingWidgetEnabled = v; 255 docLoadingWidgetEnabled = v;
256 raiseTabWidget(); 256 raiseTabWidget();
257 } 257 }
258} 258}
259 259
260void LauncherTabWidget::setLoadingProgress( int percent ) 260void LauncherTabWidget::setLoadingProgress( int percent )
261{ 261{
262 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); 262 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 );
263} 263}
264 264
265// ### this function could more to LauncherView 265// ### this function could more to LauncherView
266void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) 266void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg )
267{ 267{
268 // View 268 // View
269 QString view = cfg.readEntry( "View", "Icon" ); 269 QString view = cfg.readEntry( "View", "Icon" );
270 if ( view == "List" ) // No tr 270 if ( view == "List" ) // No tr
271 v->setViewMode( LauncherView::List ); 271 v->setViewMode( LauncherView::List );
272 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 272 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
273 if ( bgType == "Image" ) { // No tr 273 if ( bgType == "Image" ) { // No tr
274 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 274 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
275 v->setBackgroundType( LauncherView::Image, pm ); 275 v->setBackgroundType( LauncherView::Image, pm );
276 } else if ( bgType == "SolidColor" ) { 276 } else if ( bgType == "SolidColor" ) {
277 QString c = cfg.readEntry( "BackgroundColor" ); 277 QString c = cfg.readEntry( "BackgroundColor" );
278 v->setBackgroundType( LauncherView::SolidColor, c ); 278 v->setBackgroundType( LauncherView::SolidColor, c );
279 } else { 279 } else {
280 v->setBackgroundType( LauncherView::Ruled, QString::null ); 280 v->setBackgroundType( LauncherView::Ruled, QString::null );
281 } 281 }
282 QString textCol = cfg.readEntry( "TextColor" ); 282 QString textCol = cfg.readEntry( "TextColor" );
283 if ( textCol.isEmpty() ) 283 if ( textCol.isEmpty() )
284 v->setTextColor( QColor() ); 284 v->setTextColor( QColor() );
285 else 285 else
286 v->setTextColor( QColor(textCol) ); 286 v->setTextColor( QColor(textCol) );
287// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); 287// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE );
288 288
289 289
290 QStringList font = cfg.readListEntry( "Font", ',' ); 290 QStringList font = cfg.readListEntry( "Font", ',' );
291 if ( font.count() == 4 ) 291 if ( font.count() == 4 )
292 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 292 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
293 293
294 // ### FIXME TabColor TabTextColor 294 // ### FIXME TabColor TabTextColor
295 295
296} 296}
297 297
298// ### Could move to LauncherTab 298// ### Could move to LauncherTab
299void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) 299void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg )
300{ 300{
301 cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr 301 cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr
302 302
303 setTabViewAppearance( tab->view, cfg ); 303 setTabViewAppearance( tab->view, cfg );
304 304
305 // Tabs 305 // Tabs
306 QString tabCol = cfg.readEntry( "TabColor" ); 306 QString tabCol = cfg.readEntry( "TabColor" );
307 if ( tabCol.isEmpty() ) 307 if ( tabCol.isEmpty() )
308 tab->bgColor = QColor(); 308 tab->bgColor = QColor();
309 else 309 else
310 tab->bgColor = QColor(tabCol); 310 tab->bgColor = QColor(tabCol);
311 QString tabTextCol = cfg.readEntry( "TabTextColor" ); 311 QString tabTextCol = cfg.readEntry( "TabTextColor" );
312 if ( tabTextCol.isEmpty() ) 312 if ( tabTextCol.isEmpty() )
313 tab->fgColor = QColor(); 313 tab->fgColor = QColor();
314 else 314 else
315 tab->fgColor = QColor(tabTextCol); 315 tab->fgColor = QColor(tabTextCol);
316} 316}
317 317
318void LauncherTabWidget::paletteChange( const QPalette &p ) 318void LauncherTabWidget::paletteChange( const QPalette &p )
319{ 319{
320 QVBox::paletteChange( p ); 320 QVBox::paletteChange( p );
321 QPalette pal = palette(); 321 QPalette pal = palette();
322 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 322 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
323 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 323 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
324 categoryBar->setPalette( pal ); 324 categoryBar->setPalette( pal );
325 categoryBar->update(); 325 categoryBar->update();
326} 326}
327 327
328void LauncherTabWidget::styleChange( QStyle & ) 328void LauncherTabWidget::styleChange( QStyle & )
329{ 329{
330 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); 330 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) );
331} 331}
332 332
333void LauncherTabWidget::setProgressStyle() 333void LauncherTabWidget::setProgressStyle()
334{ 334{
335 if (docLoadingWidgetProgress) { 335 if (docLoadingWidgetProgress) {
336 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); 336 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box );
337 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); 337 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain );
338 docLoadingWidgetProgress->setMargin( 1 ); 338 docLoadingWidgetProgress->setMargin( 1 );
339 docLoadingWidgetProgress->setLineWidth( 1 ); 339 docLoadingWidgetProgress->setLineWidth( 1 );
340 } 340 }
341} 341}
342 342
343/* 343/*
344 * FIXME 344 * FIXME
345 * The following NULL check is triggered by inserting, then removing a tab on the fly 345 * The following NULL check is triggered by inserting, then removing a tab on the fly
346 * as you would if you had removable media (which I do). Without this check 346 * as you would if you had removable media (which I do). Without this check
347 * the first app launched after a tab removal causes qpe to Segfault. 347 * the first app launched after a tab removal causes qpe to Segfault.
348 * This obviously has a more sinister cause, but this works around it with no 348 * This obviously has a more sinister cause, but this works around it with no
349 * obvious adverse effects. Please FIXME 349 * obvious adverse effects. Please FIXME
350 * bkc - 17/6/2004 350 * bkc - 17/6/2004
351 * 351 *
352 */ 352 */
353 353
354void LauncherTabWidget::setBusy(bool on) 354void LauncherTabWidget::setBusy(bool on)
355{ 355{
356 if ( on ) 356 if ( on )
357 currentView()->setBusy(TRUE); 357 currentView()->setBusy(TRUE);
358 else { 358 else {
359 for ( int i = 0; i < categoryBar->count(); i++ ) { 359 for ( int i = 0; i < categoryBar->count(); i++ ) {
360 if (categoryBar->tab(i)) { 360 if (categoryBar->tab(i)) {
361 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; 361 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view;
362 view->setBusy( FALSE ); 362 view->setBusy( FALSE );
363 } else { 363 } else {
364 odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl; 364 odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl;
365 } 365 }
366 } 366 }
367 } 367 }
368} 368}
369 369
370void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { 370void LauncherTabWidget::setBusyIndicatorType( const QString& str ) {
371 for (int i = 0; i < categoryBar->count(); i++ ) { 371 for (int i = 0; i < categoryBar->count(); i++ ) {
372 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; 372 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view;
373 view->setBusyIndicatorType( str ); 373 view->setBusyIndicatorType( str );
374 } 374 }
375} 375}
376 376
377LauncherView *LauncherTabWidget::currentView(void) 377LauncherView *LauncherTabWidget::currentView(void)
378{ 378{
379 return (LauncherView*)stack->visibleWidget(); 379 return (LauncherView*)stack->visibleWidget();
380} 380}
381 381
382 382
383 383
384void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) 384void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data)
385{ 385{
386 QDataStream stream( data, IO_ReadOnly ); 386 QDataStream stream( data, IO_ReadOnly );
387 if ( msg == "setTabView(QString,int)" ) { 387 if ( msg == "setTabView(QString,int)" ) {
388 QString id; 388 QString id;
389 stream >> id; 389 stream >> id;
390 int mode; 390 int mode;
391 stream >> mode; 391 stream >> mode;
392 if ( view(id) ) 392 if ( view(id) )
393 view(id)->setViewMode( (LauncherView::ViewMode)mode ); 393 view(id)->setViewMode( (LauncherView::ViewMode)mode );
394 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 394 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
395 QString id; 395 QString id;
396 stream >> id; 396 stream >> id;
397 int mode; 397 int mode;
398 stream >> mode; 398 stream >> mode;
399 QString pixmapOrColor; 399 QString pixmapOrColor;
400 stream >> pixmapOrColor; 400 stream >> pixmapOrColor;
401 if ( view(id) ) 401 if ( view(id) )
402 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 402 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
403 if ( id == "Documents" ) 403 if ( id == "Documents" )
404 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 404 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
405 } else if ( msg == "setTextColor(QString,QString)" ) { 405 } else if ( msg == "setTextColor(QString,QString)" ) {
406 QString id; 406 QString id;
407 stream >> id; 407 stream >> id;
408 QString color; 408 QString color;
409 stream >> color; 409 stream >> color;
410 if ( view(id) ) 410 if ( view(id) )
411 view(id)->setTextColor( QColor(color) ); 411 view(id)->setTextColor( QColor(color) );
412 if ( id == "Documents" ) 412 if ( id == "Documents" )
413 docLoadingWidget->setTextColor( QColor(color) ); 413 docLoadingWidget->setTextColor( QColor(color) );
414 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 414 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
415 QString id; 415 QString id;
416 stream >> id; 416 stream >> id;
417 QString fam; 417 QString fam;
418 stream >> fam; 418 stream >> fam;
419 int size; 419 int size;
420 stream >> size; 420 stream >> size;
421 int weight; 421 int weight;
422 stream >> weight; 422 stream >> weight;
423 int italic; 423 int italic;
424 stream >> italic; 424 stream >> italic;
425 if ( view(id) ) { 425 if ( view(id) ) {
426 if ( !fam.isEmpty() ) { 426 if ( !fam.isEmpty() ) {
427 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 427 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
428 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; 428 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
429 } else { 429 } else {
430 view(id)->clearViewFont(); 430 view(id)->clearViewFont();
431 } 431 }
432 } 432 }
433 }else if ( msg == "setBusyIndicatorType(QString)" ) { 433 }else if ( msg == "setBusyIndicatorType(QString)" ) {
434 QString type; 434 QString type;
435 stream >> type; 435 stream >> type;
436 setBusyIndicatorType( type ); 436 setBusyIndicatorType( type );
437 }else if ( msg == "home()" ) { 437 }else if ( msg == "home()" ) {
438 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { 438 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) {
439 if (categoryBar) 439 if (categoryBar)
440 categoryBar->nextTab(); 440 categoryBar->nextTab();
441 }else 441 }else
442 static_cast<QWidget*>(parent())->raise(); 442 static_cast<QWidget*>(parent())->raise();
443 } 443 }
444} 444}
445 445
446 446
447 447
448//--------------------------------------------------------------------------- 448//---------------------------------------------------------------------------
449 449
450Launcher::Launcher() 450Launcher::Launcher()
451 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) 451 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader )
452{ 452{
453 tabs = 0; 453 tabs = 0;
454 tb = 0; 454 tb = 0;
455 Config cfg( "Launcher" ); 455 Config cfg( "Launcher" );
456 cfg.setGroup( "DocTab" ); 456 cfg.setGroup( "DocTab" );
457 docTabEnabled = cfg.readBoolEntry( "Enable", true ); 457 docTabEnabled = cfg.readBoolEntry( "Enable", true );
458} 458}
459 459
460void Launcher::createGUI() 460void Launcher::createGUI()
461{ 461{
462 setCaption( tr("Launcher") ); 462 setCaption( tr("Launcher") );
463 463
464 // we have a pretty good idea how big we'll be 464 // we have a pretty good idea how big we'll be
465 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 465 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
466 466
467 tb = new TaskBar; 467 tb = new TaskBar;
468 tabs = new LauncherTabWidget( this ); 468 tabs = new LauncherTabWidget( this );
469 setCentralWidget( tabs ); 469 setCentralWidget( tabs );
470 470
471 ServerInterface::dockWidget( tb, ServerInterface::Bottom ); 471 ServerInterface::dockWidget( tb, ServerInterface::Bottom );
472 tb->show(); 472 tb->show();
473 473
474 qApp->installEventFilter( this ); 474 qApp->installEventFilter( this );
475 475
476 connect( tb, SIGNAL(tabSelected(const QString&)), 476 connect( tb, SIGNAL(tabSelected(const QString&)),
477 this, SLOT(showTab(const QString&)) ); 477 this, SLOT(showTab(const QString&)) );
478 connect( tabs, SIGNAL(selected(const QString&)), 478 connect( tabs, SIGNAL(selected(const QString&)),
479 this, SLOT(viewSelected(const QString&)) ); 479 this, SLOT(viewSelected(const QString&)) );
480 connect( tabs, SIGNAL(clicked(const AppLnk*)), 480 connect( tabs, SIGNAL(clicked(const AppLnk*)),
481 this, SLOT(select(const AppLnk*))); 481 this, SLOT(select(const AppLnk*)));
482 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 482 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
483 this, SLOT(properties(AppLnk*))); 483 this, SLOT(properties(AppLnk*)));
484 484
485#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 485#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
486 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 486 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
487 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 487 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
488 this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); 488 this, SLOT(systemMessage(const QCString&,const QByteArray&)) );
489#endif 489#endif
490 490
491 // all documents 491 // all documents
492 QImage img( Resource::loadImage( "DocsIcon" ) ); 492 QImage img( Resource::loadImage( "DocsIcon" ) );
493 QPixmap pm; 493 QPixmap pm;
494 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 494 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
495 // It could add this itself if it handles docs 495 // It could add this itself if it handles docs
496 496
497 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); 497 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE );
498 498
499 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); 499 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
500 qApp->setMainWidget( this ); 500 qApp->setMainWidget( this );
501 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 501 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
502} 502}
503 503
504Launcher::~Launcher() 504Launcher::~Launcher()
505{ 505{
506 if ( tb ) 506 if ( tb )
507 destroyGUI(); 507 destroyGUI();
508} 508}
509 509
510 bool Launcher::requiresDocuments() const 510 bool Launcher::requiresDocuments() const
511 { 511 {
512 Config cfg( "Launcher" ); 512 Config cfg( "Launcher" );
513 cfg.setGroup( "DocTab" ); 513 cfg.setGroup( "DocTab" );
514 return cfg.readBoolEntry( "Enable", true ); 514 return cfg.readBoolEntry( "Enable", true );
515} 515}
516 516
517void Launcher::makeVisible() 517void Launcher::makeVisible()
518{ 518{
519 showMaximized(); 519 showMaximized();
520} 520}
521 521
522void Launcher::destroyGUI() 522void Launcher::destroyGUI()
523{ 523{
524 delete tb; 524 delete tb;
525 tb = 0; 525 tb = 0;
526 delete tabs; 526 delete tabs;
527 tabs =0; 527 tabs =0;
528} 528}
529 529
530bool Launcher::eventFilter( QObject*, QEvent *ev ) 530bool Launcher::eventFilter( QObject*, QEvent *ev )
531{ 531{
532#ifdef QT_QWS_CUSTOM 532#ifdef QT_QWS_CUSTOM
533 if ( ev->type() == QEvent::KeyPress ) { 533 if ( ev->type() == QEvent::KeyPress ) {
534 QKeyEvent *ke = (QKeyEvent *)ev; 534 QKeyEvent *ke = (QKeyEvent *)ev;
535 if ( ke->key() == Qt::Key_F11 ) { // menu key 535 if ( ke->key() == Qt::Key_F11 ) { // menu key
536 QWidget *active = qApp->activeWindow(); 536 QWidget *active = qApp->activeWindow();
537 if ( active && active->isPopup() ) 537 if ( active && active->isPopup() )
538 active->close(); 538 active->close();
539 else { 539 else {
540 Global::terminateBuiltin("calibrate"); // No tr 540 Global::terminateBuiltin("calibrate"); // No tr
541 tb->launchStartMenu(); 541 tb->launchStartMenu();
542 } 542 }
543 return TRUE; 543 return TRUE;
544 } 544 }
545 } 545 }
546#else 546#else
547 Q_UNUSED(ev); 547 Q_UNUSED(ev);
548#endif 548#endif
549 return FALSE; 549 return FALSE;
550} 550}
551 551
552static bool isVisibleWindow(int wid) 552static bool isVisibleWindow(int wid)
553{ 553{
554#ifdef Q_WS_QWS 554#ifdef Q_WS_QWS
555 const QList<QWSWindow> &list = qwsServer->clientWindows(); 555 const QList<QWSWindow> &list = qwsServer->clientWindows();
556 QWSWindow* w; 556 QWSWindow* w;
557 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 557 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
558 if ( w->winId() == wid ) 558 if ( w->winId() == wid )
559 return !w->isFullyObscured(); 559 return !w->isFullyObscured();
560 } 560 }
561#endif 561#endif
562 return FALSE; 562 return FALSE;
563} 563}
564 564
565void Launcher::viewSelected(const QString& s) 565void Launcher::viewSelected(const QString& s)
566{ 566{
567 setCaption( s + tr(" - Launcher") ); 567 setCaption( s + tr(" - Launcher") );
568} 568}
569 569
570void Launcher::showTab(const QString& id) 570void Launcher::showTab(const QString& id)
571{ 571{
572 tabs->categoryBar->showTab(id); 572 tabs->categoryBar->showTab(id);
573 raise(); 573 raise();
574} 574}
575 575
576void Launcher::select( const AppLnk *appLnk ) 576void Launcher::select( const AppLnk *appLnk )
577{ 577{
578 if ( appLnk->type() == "Folder" ) { // No tr 578 if ( appLnk->type() == "Folder" ) { // No tr
579 // Not supported: flat is simpler for the user 579 // Not supported: flat is simpler for the user
580 } else { 580 } else {
581 if ( appLnk->exec().isNull() ) { 581 if ( appLnk->exec().isNull() ) {
582 int i = QMessageBox::information(this,tr("No application"), 582 int i = QMessageBox::information(this,tr("No application"),
583 tr("<p>No application is defined for this document." 583 tr("<p>No application is defined for this document."
584 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); 584 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1);
585 585
586 /* ### Fixme */ 586 /* ### Fixme */
587 if ( i == 1 ) 587 if ( i == 1 )
588 Global::execute("textedit",appLnk->file()); 588 Global::execute("textedit",appLnk->file());
589 589
590 return; 590 return;
591 } 591 }
592 tabs->setBusy(TRUE); 592 tabs->setBusy(TRUE);
593 emit executing( appLnk ); 593 emit executing( appLnk );
594 appLnk->execute(); 594 appLnk->execute();
595 } 595 }
596} 596}
597 597
598void Launcher::properties( AppLnk *appLnk ) 598void Launcher::properties( AppLnk *appLnk )
599{ 599{
600 if ( appLnk->type() == "Folder" ) { // No tr 600 if ( appLnk->type() == "Folder" ) { // No tr
601 // Not supported: flat is simpler for the user 601 // Not supported: flat is simpler for the user
602 } else { 602 } else {
603/* ### libqtopia FIXME also moving docLnks... */ 603/* ### libqtopia FIXME also moving docLnks... */
604 LnkProperties prop(appLnk,0 ); 604 LnkProperties prop(appLnk,0 );
605 605
606 QPEApplication::execDialog( &prop ); 606 QPEApplication::execDialog( &prop );
607 } 607 }
608} 608}
609 609
610void Launcher::storageChanged( const QList<FileSystem> &fs ) 610void Launcher::storageChanged( const QList<FileSystem> & )
611{ 611{
612 // ### update combo boxes if we had a combo box for the storage type 612 // ### update combo boxes if we had a combo box for the storage type
613} 613}
614 614
615void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 615void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
616{ 616{
617 QDataStream stream( data, IO_ReadOnly ); 617 QDataStream stream( data, IO_ReadOnly );
618 if ( msg == "busy()" ) { 618 if ( msg == "busy()" ) {
619 tb->startWait(); 619 tb->startWait();
620 } else if ( msg == "notBusy(QString)" ) { 620 } else if ( msg == "notBusy(QString)" ) {
621 QString app; 621 QString app;
622 stream >> app; 622 stream >> app;
623 tabs->setBusy(FALSE); 623 tabs->setBusy(FALSE);
624 tb->stopWait(app); 624 tb->stopWait(app);
625 } else if (msg == "applyStyle()") { 625 } else if (msg == "applyStyle()") {
626 tabs->currentView()->relayout(); 626 tabs->currentView()->relayout();
627 } 627 }
628} 628}
629 629
630// These are the update functions from the server 630// These are the update functions from the server
631void Launcher::typeAdded( const QString& type, const QString& name, 631void Launcher::typeAdded( const QString& type, const QString& name,
632 const QPixmap& pixmap, const QPixmap& ) 632 const QPixmap& pixmap, const QPixmap& )
633{ 633{
634 tabs->newView( type, pixmap, name ); 634 tabs->newView( type, pixmap, name );
635 ids.append( type ); 635 ids.append( type );
636 /* this will be called in applicationScanningProgress with value 100! */ 636 /* this will be called in applicationScanningProgress with value 100! */
637// tb->refreshStartMenu(); 637// tb->refreshStartMenu();
638 638
639 static bool first = TRUE; 639 static bool first = TRUE;
640 if ( first ) { 640 if ( first ) {
641 first = FALSE; 641 first = FALSE;
642 tabs->categoryBar->showTab(type); 642 tabs->categoryBar->showTab(type);
643 } 643 }
644 644
645 tabs->view( type )->setUpdatesEnabled( FALSE ); 645 tabs->view( type )->setUpdatesEnabled( FALSE );
646 tabs->view( type )->setSortEnabled( FALSE ); 646 tabs->view( type )->setSortEnabled( FALSE );
647} 647}
648 648
649void Launcher::typeRemoved( const QString& type ) 649void Launcher::typeRemoved( const QString& type )
650{ 650{
651 tabs->view( type )->removeAllItems(); 651 tabs->view( type )->removeAllItems();
652 tabs->deleteView( type ); 652 tabs->deleteView( type );
653 ids.remove( type ); 653 ids.remove( type );
654 /* this will be called in applicationScanningProgress with value 100! */ 654 /* this will be called in applicationScanningProgress with value 100! */
655// tb->refreshStartMenu(); 655// tb->refreshStartMenu();
656} 656}
657 657
658void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 658void Launcher::applicationAdded( const QString& type, const AppLnk& app )
659{ 659{
660 if ( app.type() == "Separator" ) // No tr 660 if ( app.type() == "Separator" ) // No tr
661 return; 661 return;
662 662
663 LauncherView *view = tabs->view( type ); 663 LauncherView *view = tabs->view( type );
664 if ( view ) 664 if ( view )
665 view->addItem( new AppLnk( app ), FALSE ); 665 view->addItem( new AppLnk( app ), FALSE );
666 else 666 else
667 owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app " 667 owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app "
668 << app.name().latin1() << "!", 668 << app.name().latin1() << "!",
669 669
670 MimeType::registerApp( app ); 670 MimeType::registerApp( app );
671} 671}
672 672
673void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 673void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
674{ 674{
675 LauncherView *view = tabs->view( type ); 675 LauncherView *view = tabs->view( type );
676 if ( view ) 676 if ( view )
677 view->removeLink( app.linkFile() ); 677 view->removeLink( app.linkFile() );
678 else 678 else
679 owarn << "removeAppLnk: No view for " << type << "!" << oendl; 679 owarn << "removeAppLnk: No view for " << type << "!" << oendl;
680} 680}
681 681
682void Launcher::allApplicationsRemoved() 682void Launcher::allApplicationsRemoved()
683{ 683{
684 MimeType::clear(); 684 MimeType::clear();
685 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) 685 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
686 tabs->view( (*it) )->removeAllItems(); 686 tabs->view( (*it) )->removeAllItems();
687} 687}
688 688
689void Launcher::documentAdded( const DocLnk& doc ) 689void Launcher::documentAdded( const DocLnk& doc )
690{ 690{
691 tabs->docView()->addItem( new DocLnk( doc ), FALSE ); 691 tabs->docView()->addItem( new DocLnk( doc ), FALSE );
692} 692}
693 693
694void Launcher::aboutToAddBegin() 694void Launcher::aboutToAddBegin()
695{ 695{
696 tabs->docView()->setUpdatesEnabled( false ); 696 tabs->docView()->setUpdatesEnabled( false );
697} 697}
698 698
699void Launcher::aboutToAddEnd() 699void Launcher::aboutToAddEnd()
700{ 700{
701 tabs->docView()->setUpdatesEnabled( true ); 701 tabs->docView()->setUpdatesEnabled( true );
702} 702}
703 703
704void Launcher::showLoadingDocs() 704void Launcher::showLoadingDocs()
705{ 705{
706 tabs->docView()->hide(); 706 tabs->docView()->hide();
707} 707}
708 708
709void Launcher::showDocTab() 709void Launcher::showDocTab()
710{ 710{
711 if ( tabs->categoryBar->currentView() == tabs->docView() ) 711 if ( tabs->categoryBar->currentView() == tabs->docView() )
712 tabs->docView()->show(); 712 tabs->docView()->show();
713} 713}
714 714
715void Launcher::documentRemoved( const DocLnk& doc ) 715void Launcher::documentRemoved( const DocLnk& doc )
716{ 716{
717 tabs->docView()->removeLink( doc.linkFile() ); 717 tabs->docView()->removeLink( doc.linkFile() );
718} 718}
719 719
720void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) 720void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc )
721{ 721{
722 documentRemoved( oldDoc ); 722 documentRemoved( oldDoc );
723 documentAdded( newDoc ); 723 documentAdded( newDoc );
724} 724}
725 725
726void Launcher::allDocumentsRemoved() 726void Launcher::allDocumentsRemoved()
727{ 727{
728 tabs->docView()->removeAllItems(); 728 tabs->docView()->removeAllItems();
729} 729}
730 730
731void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) 731void Launcher::applicationStateChanged( const QString& name, ApplicationState state )
732{ 732{
733 tb->setApplicationState( name, state ); 733 tb->setApplicationState( name, state );
734} 734}
735 735
736void Launcher::applicationScanningProgress( int percent ) 736void Launcher::applicationScanningProgress( int percent )
737{ 737{
738 switch ( percent ) { 738 switch ( percent ) {
739 case 0: { 739 case 0: {
740 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 740 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
741 tabs->view( (*it) )->setUpdatesEnabled( FALSE ); 741 tabs->view( (*it) )->setUpdatesEnabled( FALSE );
742 tabs->view( (*it) )->setSortEnabled( FALSE ); 742 tabs->view( (*it) )->setSortEnabled( FALSE );
743 } 743 }
744 break; 744 break;
745 } 745 }
746 case 100: { 746 case 100: {
747 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 747 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
748 tabs->view( (*it) )->setUpdatesEnabled( TRUE ); 748 tabs->view( (*it) )->setUpdatesEnabled( TRUE );
749 tabs->view( (*it) )->setSortEnabled( TRUE ); 749 tabs->view( (*it) )->setSortEnabled( TRUE );
750 } 750 }
751 tb->refreshStartMenu(); 751 tb->refreshStartMenu();
752 break; 752 break;
753 } 753 }
754 default: 754 default:
755 break; 755 break;
756 } 756 }
757} 757}
758 758
759void Launcher::documentScanningProgress( int percent ) 759void Launcher::documentScanningProgress( int percent )
760{ 760{
761 switch ( percent ) { 761 switch ( percent ) {
762 case 0: { 762 case 0: {
763 tabs->setLoadingProgress( 0 ); 763 tabs->setLoadingProgress( 0 );
764 tabs->setLoadingWidgetEnabled( TRUE ); 764 tabs->setLoadingWidgetEnabled( TRUE );
765 tabs->docView()->setUpdatesEnabled( FALSE ); 765 tabs->docView()->setUpdatesEnabled( FALSE );
766 tabs->docView()->setSortEnabled( FALSE ); 766 tabs->docView()->setSortEnabled( FALSE );
767 break; 767 break;
768 } 768 }
769 case 100: { 769 case 100: {
770 tabs->docView()->updateTools(); 770 tabs->docView()->updateTools();
771 tabs->docView()->setSortEnabled( TRUE ); 771 tabs->docView()->setSortEnabled( TRUE );
772 tabs->docView()->setUpdatesEnabled( TRUE ); 772 tabs->docView()->setUpdatesEnabled( TRUE );
773 tabs->setLoadingWidgetEnabled( FALSE ); 773 tabs->setLoadingWidgetEnabled( FALSE );
774 break; 774 break;
775 } 775 }
776 default: 776 default:
777 tabs->setLoadingProgress( percent ); 777 tabs->setLoadingProgress( percent );
778 break; 778 break;
779 } 779 }
780} 780}
781 781