-rw-r--r-- | core/launcher/launcher.cpp | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5ec1cf8..ccc2114 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -72,17 +72,17 @@ | |||
72 | #include <mntent.h> | 72 | #include <mntent.h> |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | 75 | ||
76 | static bool isVisibleWindow( int ); | 76 | static bool isVisibleWindow( int ); |
77 | //=========================================================================== | 77 | //=========================================================================== |
78 | 78 | ||
79 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 79 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
80 | QVBox( parent ), docview( 0 ) | 80 | QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(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) ); |
@@ -123,17 +123,17 @@ void LauncherTabWidget::createDocLoadingWidget() | |||
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 | 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(); |
@@ -164,101 +164,104 @@ void LauncherTabWidget::initLayout() | |||
164 | layout()->activate(); | 164 | layout()->activate(); |
165 | docView()->setFocus(); | 165 | docView()->setFocus(); |
166 | categoryBar->showTab("Documents"); | 166 | categoryBar->showTab("Documents"); |
167 | } | 167 | } |
168 | 168 | ||
169 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) | 169 | void 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 | ||
175 | void LauncherTabWidget::raiseTabWidget() | 175 | void 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 | ||
186 | void LauncherTabWidget::tabProperties() | 186 | void 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 | ||
201 | void LauncherTabWidget::deleteView( const QString& id ) | 201 | void 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 | ||
211 | LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 211 | LauncherView* 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 | |||
219 | int n = categoryBar->count(); | 220 | int n = categoryBar->count(); |
221 | |||
220 | stack->addWidget( view, n ); | 222 | stack->addWidget( view, n ); |
221 | 223 | ||
222 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); | 224 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); |
223 | categoryBar->insertTab( tab, n-1 ); | 225 | categoryBar->insertTab( tab, n-1 ); |
224 | 226 | if ( id == "Documents" ) { | |
225 | if ( id == "Documents" ) | 227 | docview = view; |
226 | docview = view; | 228 | m_DocumentTabId = n; |
229 | } | ||
227 | 230 | ||
228 | odebug << "inserting " << id << " at " << n-1 << "" << oendl; | 231 | odebug << "inserting " << id << " at " << n-1 << "" << oendl; |
229 | 232 | ||
230 | Config cfg("Launcher"); | 233 | Config cfg("Launcher"); |
231 | setTabAppearance( tab, cfg ); | 234 | setTabAppearance( tab, cfg ); |
232 | 235 | ||
233 | cfg.setGroup( "GUI" ); | 236 | cfg.setGroup( "GUI" ); |
234 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); | 237 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); |
235 | 238 | ||
236 | return view; | 239 | return view; |
237 | } | 240 | } |
238 | 241 | ||
239 | LauncherView *LauncherTabWidget::view( const QString &id ) | 242 | LauncherView *LauncherTabWidget::view( const QString &id ) |
240 | { | 243 | { |
241 | LauncherTab *t = categoryBar->launcherTab(id); | 244 | LauncherTab *t = categoryBar->launcherTab(id); |
242 | if ( !t ) | 245 | if ( !t ) |
243 | return 0; | 246 | return 0; |
244 | return t->view; | 247 | return t->view; |
245 | } | 248 | } |
246 | 249 | ||
247 | LauncherView *LauncherTabWidget::docView() | 250 | LauncherView *LauncherTabWidget::docView() |
248 | { | 251 | { |
249 | return docview; | 252 | return docview; |
250 | } | 253 | } |
251 | 254 | ||
252 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) | 255 | void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) |
253 | { | 256 | { |
254 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { | 257 | if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { |
255 | docLoadingWidgetEnabled = v; | 258 | docLoadingWidgetEnabled = v; |
256 | raiseTabWidget(); | 259 | raiseTabWidget(); |
257 | } | 260 | } |
258 | } | 261 | } |
259 | 262 | ||
260 | void LauncherTabWidget::setLoadingProgress( int percent ) | 263 | void LauncherTabWidget::setLoadingProgress( int percent ) |
261 | { | 264 | { |
262 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); | 265 | docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); |
263 | } | 266 | } |
264 | 267 | ||
@@ -599,17 +602,16 @@ void Launcher::properties( AppLnk *appLnk ) | |||
599 | { | 602 | { |
600 | if ( appLnk->type() == "Folder" ) { // No tr | 603 | if ( appLnk->type() == "Folder" ) { // No tr |
601 | // Not supported: flat is simpler for the user | 604 | // Not supported: flat is simpler for the user |
602 | } else { | 605 | } else { |
603 | /* ### libqtopia FIXME also moving docLnks... */ | 606 | /* ### libqtopia FIXME also moving docLnks... */ |
604 | LnkProperties prop(appLnk,0 ); | 607 | LnkProperties prop(appLnk,0 ); |
605 | 608 | ||
606 | if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) { | 609 | if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) { |
607 | tabs->docView()->updateTools(); | ||
608 | } | 610 | } |
609 | } | 611 | } |
610 | } | 612 | } |
611 | 613 | ||
612 | void Launcher::storageChanged( const QList<FileSystem> & ) | 614 | void Launcher::storageChanged( const QList<FileSystem> & ) |
613 | { | 615 | { |
614 | // ### update combo boxes if we had a combo box for the storage type | 616 | // ### update combo boxes if we had a combo box for the storage type |
615 | } | 617 | } |
@@ -716,18 +718,23 @@ void Launcher::showDocTab() | |||
716 | 718 | ||
717 | void Launcher::documentRemoved( const DocLnk& doc ) | 719 | void Launcher::documentRemoved( const DocLnk& doc ) |
718 | { | 720 | { |
719 | tabs->docView()->removeLink( doc.linkFile() ); | 721 | tabs->docView()->removeLink( doc.linkFile() ); |
720 | } | 722 | } |
721 | 723 | ||
722 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 724 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) |
723 | { | 725 | { |
726 | #if 0 | ||
724 | documentRemoved( oldDoc ); | 727 | documentRemoved( oldDoc ); |
725 | documentAdded( newDoc ); | 728 | documentAdded( newDoc ); |
729 | // tabs->docView()->updateTools(); | ||
730 | #else | ||
731 | tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc)); | ||
732 | #endif | ||
726 | } | 733 | } |
727 | 734 | ||
728 | void Launcher::allDocumentsRemoved() | 735 | void Launcher::allDocumentsRemoved() |
729 | { | 736 | { |
730 | tabs->docView()->removeAllItems(); | 737 | tabs->docView()->removeAllItems(); |
731 | } | 738 | } |
732 | 739 | ||
733 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) | 740 | void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) |