summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-23 13:14:25 (UTC)
committer harlekin <harlekin>2003-03-23 13:14:25 (UTC)
commit56192a3d601e5364e9b8f4c331d892befb19cbc1 (patch) (unidiff)
tree97966e16e29316a6dc28e2f0c9619192a3757b8f
parentc3b01d2abd00b82b821604827987f2becccf5233 (diff)
downloadopie-56192a3d601e5364e9b8f4c331d892befb19cbc1.zip
opie-56192a3d601e5364e9b8f4c331d892befb19cbc1.tar.gz
opie-56192a3d601e5364e9b8f4c331d892befb19cbc1.tar.bz2
after refresh show the same tab again as before ( for example after a medium is inserted or linkcChanged(QString) has been called
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp34
-rw-r--r--core/launcher/launcher.h2
2 files changed, 32 insertions, 4 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index fc944e1..e74301c 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -128,86 +128,101 @@ CategoryTabWidget::CategoryTabWidget( QWidget* parent ) :
128{ 128{
129 categoryBar = 0; 129 categoryBar = 0;
130 stack = 0; 130 stack = 0;
131} 131}
132 132
133void CategoryTabWidget::prevTab() 133void CategoryTabWidget::prevTab()
134{ 134{
135 if ( categoryBar ) { 135 if ( categoryBar ) {
136 int n = categoryBar->count(); 136 int n = categoryBar->count();
137 int tab = categoryBar->currentTab(); 137 int tab = categoryBar->currentTab();
138 if ( tab >= 0 ) 138 if ( tab >= 0 )
139 categoryBar->setCurrentTab( (tab - 1 + n)%n ); 139 categoryBar->setCurrentTab( (tab - 1 + n)%n );
140 } 140 }
141} 141}
142 142
143void CategoryTabWidget::nextTab() 143void CategoryTabWidget::nextTab()
144{ 144{
145 if ( categoryBar ) { 145 if ( categoryBar ) {
146 int n = categoryBar->count(); 146 int n = categoryBar->count();
147 int tab = categoryBar->currentTab(); 147 int tab = categoryBar->currentTab();
148 categoryBar->setCurrentTab( (tab + 1)%n ); 148 categoryBar->setCurrentTab( (tab + 1)%n );
149 } 149 }
150} 150}
151 151
152
153void CategoryTabWidget::showTab(const QString& id)
154{
155 if ( categoryBar ) {
156 int idx = ids.findIndex( id );
157 categoryBar->setCurrentTab( idx );
158 }
159}
160
152void CategoryTabWidget::addItem( const QString& linkfile ) 161void CategoryTabWidget::addItem( const QString& linkfile )
153{ 162{
154 int i=0; 163 int i=0;
155 AppLnk *app = new AppLnk(linkfile); 164 AppLnk *app = new AppLnk(linkfile);
156 if ( !app->isValid() ) { 165 if ( !app->isValid() ) {
157 delete app; 166 delete app;
158 app=0; 167 app=0;
159 } 168 }
160 if ( !app || !app->file().isEmpty() ) { 169 if ( !app || !app->file().isEmpty() ) {
161 // A document 170 // A document
162 delete app; 171 delete app;
163 app = new DocLnk(linkfile); 172 app = new DocLnk(linkfile);
164 if ( app->fileKnown() ) { 173 if ( app->fileKnown() ) {
165 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 174 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
166 } else { 175 } else {
167 ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); 176 ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
168 delete app; 177 delete app;
169 } 178 }
170 return; 179 return;
171 } 180 }
172 // An application 181 // An application
173 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 182 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
174 if ( !(*it).isEmpty() ) { 183 if ( !(*it).isEmpty() ) {
175 QRegExp tf(*it,FALSE,TRUE); 184 QRegExp tf(*it,FALSE,TRUE);
176 if ( tf.match(app->type()) >= 0 ) { 185 if ( tf.match(app->type()) >= 0 ) {
177 ((LauncherView*)stack->widget(i))->addItem(app); 186 ((LauncherView*)stack->widget(i))->addItem(app);
178 return; 187 return;
179 } 188 }
180 i++; 189 i++;
181 } 190 }
182 } 191 }
183 192
184 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 193 QCopEnvelope e("QPE/TaskBar","reloadApps()");
185} 194}
186 195
187void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 196void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
188 AppLnkSet* docFolder, const QList<FileSystem> &fs) 197 AppLnkSet* docFolder, const QList<FileSystem> &fs)
189{ 198{
199 QString current;
200 if ( categoryBar ) {
201 int c = categoryBar->currentTab();
202 if ( c >= 0 ) current = ids[c];
203 }
204
190 delete categoryBar; 205 delete categoryBar;
191 categoryBar = new CategoryTabBar( this ); 206 categoryBar = new CategoryTabBar( this );
192 QPalette pal = categoryBar->palette(); 207 QPalette pal = categoryBar->palette();
193 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 208 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
194 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 209 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
195 categoryBar->setPalette( pal ); 210 categoryBar->setPalette( pal );
196 211
197 delete stack; 212 delete stack;
198 stack = new QWidgetStack(this); 213 stack = new QWidgetStack(this);
199 tabs=0; 214 tabs=0;
200 215
201 ids.clear(); 216 ids.clear();
202 217
203 Config cfg("Launcher"); 218 Config cfg("Launcher");
204 219
205 QStringList types = rootFolder->types(); 220 QStringList types = rootFolder->types();
206 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 221 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
207 if ( !(*it).isEmpty() ) { 222 if ( !(*it).isEmpty() ) {
208 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); 223 (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
209 setTabAppearance( *it, cfg ); 224 setTabAppearance( *it, cfg );
210 } 225 }
211 } 226 }
212 QListIterator<AppLnk> it( rootFolder->children() ); 227 QListIterator<AppLnk> it( rootFolder->children() );
213 AppLnk* l; 228 AppLnk* l;
@@ -227,50 +242,56 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
227 } 242 }
228 rootFolder->detachChildren(); 243 rootFolder->detachChildren();
229 for (int i=0; i<tabs; i++) 244 for (int i=0; i<tabs; i++)
230 ((LauncherView*)stack->widget(i))->sort(); 245 ((LauncherView*)stack->widget(i))->sort();
231 246
232 // all documents 247 // all documents
233 QImage img( Resource::loadImage( "DocsIcon" ) ); 248 QImage img( Resource::loadImage( "DocsIcon" ) );
234 QPixmap pm; 249 QPixmap pm;
235 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 250 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
236 docview = newView( "Documents", // No tr 251 docview = newView( "Documents", // No tr
237 pm, tr("Documents")); 252 pm, tr("Documents"));
238 docview->populate( docFolder, QString::null ); 253 docview->populate( docFolder, QString::null );
239 docFolder->detachChildren(); 254 docFolder->detachChildren();
240 docview->setFileSystems(fs); 255 docview->setFileSystems(fs);
241 docview->setToolsEnabled(TRUE); 256 docview->setToolsEnabled(TRUE);
242 setTabAppearance( "Documents", cfg ); // No tr 257 setTabAppearance( "Documents", cfg ); // No tr
243 258
244 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); 259 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
245 260
246 ((LauncherView*)stack->widget(0))->setFocus(); 261 ((LauncherView*)stack->widget(0))->setFocus();
247 262
248 cfg. setGroup ( "GUI" ); 263 cfg. setGroup ( "GUI" );
249 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); 264 setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null ));
250 265
266 if ( !current.isNull() ) {
267 showTab(current);
268 }
269
251 categoryBar->show(); 270 categoryBar->show();
252 stack->show(); 271 stack->show();
272
273 QCopEnvelope e("QPE/TaskBar","reloadApps()");
253} 274}
254 275
255void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 276void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
256{ 277{
257 QString grp( "Tab %1" ); // No tr 278 QString grp( "Tab %1" ); // No tr
258 cfg.setGroup( grp.arg(id) ); 279 cfg.setGroup( grp.arg(id) );
259 LauncherView *v = view( id ); 280 LauncherView *v = view( id );
260 int idx = ids.findIndex( id ); 281 int idx = ids.findIndex( id );
261 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); 282 CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx );
262 283
263 // View 284 // View
264 QString view = cfg.readEntry( "View", "Icon" ); 285 QString view = cfg.readEntry( "View", "Icon" );
265 if ( view == "List" ) // No tr 286 if ( view == "List" ) // No tr
266 v->setViewMode( LauncherView::List ); 287 v->setViewMode( LauncherView::List );
267 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 288 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
268 if ( bgType == "Image" ) { // No tr 289 if ( bgType == "Image" ) { // No tr
269 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 290 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
270 v->setBackgroundType( LauncherView::Image, pm ); 291 v->setBackgroundType( LauncherView::Image, pm );
271 } else if ( bgType == "SolidColor" ) { 292 } else if ( bgType == "SolidColor" ) {
272 QString c = cfg.readEntry( "BackgroundColor" ); 293 QString c = cfg.readEntry( "BackgroundColor" );
273 v->setBackgroundType( LauncherView::SolidColor, c ); 294 v->setBackgroundType( LauncherView::SolidColor, c );
274 } 295 }
275 QString textCol = cfg.readEntry( "TextColor" ); 296 QString textCol = cfg.readEntry( "TextColor" );
276 if ( textCol.isEmpty() ) 297 if ( textCol.isEmpty() )
@@ -593,49 +614,48 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
593 } 614 }
594} 615}
595 616
596//--------------------------------------------------------------------------- 617//---------------------------------------------------------------------------
597 618
598Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) 619Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
599 : QMainWindow( parent, name, fl ) 620 : QMainWindow( parent, name, fl )
600{ 621{
601 setCaption( tr("Launcher") ); 622 setCaption( tr("Launcher") );
602 623
603 syncDialog = 0; 624 syncDialog = 0;
604 625
605 // we have a pretty good idea how big we'll be 626 // we have a pretty good idea how big we'll be
606 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 627 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
607 628
608 tabs = 0; 629 tabs = 0;
609 rootFolder = 0; 630 rootFolder = 0;
610 docsFolder = 0; 631 docsFolder = 0;
611 632
612 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know 633 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know
613 //uidgen.store( stamp ); 634 //uidgen.store( stamp );
614 m_timeStamp = QString::number( stamp ); 635 m_timeStamp = QString::number( stamp );
615 636
616 tabs = new CategoryTabWidget( this ); 637 tabs = new CategoryTabWidget( this );
617 tabs->setMaximumWidth( qApp->desktop()->width() );
618 setCentralWidget( tabs ); 638 setCentralWidget( tabs );
619 639
620 connect( tabs, SIGNAL(selected(const QString&)), 640 connect( tabs, SIGNAL(selected(const QString&)),
621 this, SLOT(viewSelected(const QString&)) ); 641 this, SLOT(viewSelected(const QString&)) );
622 connect( tabs, SIGNAL(clicked(const AppLnk*)), 642 connect( tabs, SIGNAL(clicked(const AppLnk*)),
623 this, SLOT(select(const AppLnk*))); 643 this, SLOT(select(const AppLnk*)));
624 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 644 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
625 this, SLOT(properties(AppLnk*))); 645 this, SLOT(properties(AppLnk*)));
626 646
627#if !defined(QT_NO_COP) 647#if !defined(QT_NO_COP)
628 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 648 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
629 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 649 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
630 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 650 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
631 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 651 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
632 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 652 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
633 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); 653 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) );
634#endif 654#endif
635 655
636 storage = new StorageInfo( this ); 656 storage = new StorageInfo( this );
637 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); 657 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
638 658
639 updateTabs(); 659 updateTabs();
640 660
641 preloadApps(); 661 preloadApps();
@@ -653,48 +673,49 @@ Launcher::~Launcher()
653static bool isVisibleWindow(int wid) 673static bool isVisibleWindow(int wid)
654{ 674{
655#ifdef QWS 675#ifdef QWS
656 const QList<QWSWindow> &list = qwsServer->clientWindows(); 676 const QList<QWSWindow> &list = qwsServer->clientWindows();
657 QWSWindow* w; 677 QWSWindow* w;
658 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 678 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
659 if ( w->winId() == wid ) 679 if ( w->winId() == wid )
660 return !w->isFullyObscured(); 680 return !w->isFullyObscured();
661 } 681 }
662#endif 682#endif
663 return FALSE; 683 return FALSE;
664} 684}
665 685
666void Launcher::showMaximized() 686void Launcher::showMaximized()
667{ 687{
668 if ( isVisibleWindow( winId() ) ) 688 if ( isVisibleWindow( winId() ) )
669 doMaximize(); 689 doMaximize();
670 else 690 else
671 QTimer::singleShot( 20, this, SLOT(doMaximize()) ); 691 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
672} 692}
673 693
674void Launcher::doMaximize() 694void Launcher::doMaximize()
675{ 695{
676 QMainWindow::showMaximized(); 696 QMainWindow::showMaximized();
697 tabs->setMaximumWidth( qApp->desktop()->width() );
677} 698}
678 699
679void Launcher::updateMimeTypes() 700void Launcher::updateMimeTypes()
680{ 701{
681 MimeType::clear(); 702 MimeType::clear();
682 updateMimeTypes(rootFolder); 703 updateMimeTypes(rootFolder);
683} 704}
684 705
685void Launcher::updateMimeTypes(AppLnkSet* folder) 706void Launcher::updateMimeTypes(AppLnkSet* folder)
686{ 707{
687 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { 708 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
688 AppLnk *app = it.current(); 709 AppLnk *app = it.current();
689 if ( app->type() == "Folder" ) // No tr 710 if ( app->type() == "Folder" ) // No tr
690 updateMimeTypes((AppLnkSet *)app); 711 updateMimeTypes((AppLnkSet *)app);
691 else { 712 else {
692 MimeType::registerApp(*app); 713 MimeType::registerApp(*app);
693 } 714 }
694 } 715 }
695} 716}
696 717
697/** This is a HACK.... 718/** This is a HACK....
698 * Reason: scanning huge mediums, microdirvers for examples 719 * Reason: scanning huge mediums, microdirvers for examples
699 * consomes time. To avoid that we invented the MediumMountCheck 720 * consomes time. To avoid that we invented the MediumMountCheck
700 * 721 *
@@ -811,48 +832,53 @@ void Launcher::updateTabs()
811 delete rootFolder; 832 delete rootFolder;
812 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 833 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
813 834
814 loadDocs(); 835 loadDocs();
815 836
816 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 837 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
817} 838}
818 839
819void Launcher::updateDocs() 840void Launcher::updateDocs()
820{ 841{
821 loadDocs(); 842 loadDocs();
822 tabs->updateDocs(docsFolder,storage->fileSystems()); 843 tabs->updateDocs(docsFolder,storage->fileSystems());
823} 844}
824 845
825void Launcher::viewSelected(const QString& s) 846void Launcher::viewSelected(const QString& s)
826{ 847{
827 setCaption( s + tr(" - Launcher") ); 848 setCaption( s + tr(" - Launcher") );
828} 849}
829 850
830void Launcher::nextView() 851void Launcher::nextView()
831{ 852{
832 tabs->nextTab(); 853 tabs->nextTab();
833} 854}
834 855
856void Launcher::showTab(const QString& id)
857{
858 tabs->showTab(id);
859 raise();
860}
835 861
836void Launcher::select( const AppLnk *appLnk ) 862void Launcher::select( const AppLnk *appLnk )
837{ 863{
838 if ( appLnk->type() == "Folder" ) { // No tr 864 if ( appLnk->type() == "Folder" ) { // No tr
839 // Not supported: flat is simpler for the user 865 // Not supported: flat is simpler for the user
840 } else { 866 } else {
841 if ( appLnk->exec().isNull() ) { 867 if ( appLnk->exec().isNull() ) {
842 QMessageBox::information(this,tr("No application"), 868 QMessageBox::information(this,tr("No application"),
843 tr("<p>No application is defined for this document." 869 tr("<p>No application is defined for this document."
844 "<p>Type is %1.").arg(appLnk->type())); 870 "<p>Type is %1.").arg(appLnk->type()));
845 return; 871 return;
846 } 872 }
847 tabs->setBusy(TRUE); 873 tabs->setBusy(TRUE);
848 emit executing( appLnk ); 874 emit executing( appLnk );
849 appLnk->execute(); 875 appLnk->execute();
850 } 876 }
851} 877}
852 878
853void Launcher::externalSelected(const AppLnk *appLnk) 879void Launcher::externalSelected(const AppLnk *appLnk)
854{ 880{
855 tabs->setBusy(TRUE); 881 tabs->setBusy(TRUE);
856 emit executing( appLnk ); 882 emit executing( appLnk );
857} 883}
858 884
@@ -868,49 +894,49 @@ void Launcher::properties( AppLnk *appLnk )
868 prop.showMaximized(); 894 prop.showMaximized();
869 prop.exec(); 895 prop.exec();
870 in_lnk_props = FALSE; 896 in_lnk_props = FALSE;
871 if ( got_lnk_change ) { 897 if ( got_lnk_change ) {
872 updateLink(lnk_change); 898 updateLink(lnk_change);
873 } 899 }
874 } 900 }
875} 901}
876 902
877void Launcher::updateLink(const QString& link) 903void Launcher::updateLink(const QString& link)
878{ 904{
879 bool notify_sm = false; 905 bool notify_sm = false;
880 906
881 if (link.isNull()) { 907 if (link.isNull()) {
882 updateTabs(); 908 updateTabs();
883 notify_sm = true; 909 notify_sm = true;
884 } 910 }
885 else if (link.isEmpty()) { 911 else if (link.isEmpty()) {
886 updateDocs(); 912 updateDocs();
887 } 913 }
888 else { 914 else {
889 tabs->updateLink(link); 915 tabs->updateLink(link);
890 notify_sm = true; 916 notify_sm = true;
891 } 917 }
892 918
893 if ( notify_sm ) 919 if ( notify_sm )
894 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); 920 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" );
895} 921}
896 922
897void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 923void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
898{ 924{
899 QDataStream stream( data, IO_ReadOnly ); 925 QDataStream stream( data, IO_ReadOnly );
900 if ( msg == "linkChanged(QString)" ) { 926 if ( msg == "linkChanged(QString)" ) {
901 QString link; 927 QString link;
902 stream >> link; 928 stream >> link;
903 if ( in_lnk_props ) { 929 if ( in_lnk_props ) {
904 got_lnk_change = TRUE; 930 got_lnk_change = TRUE;
905 lnk_change = link; 931 lnk_change = link;
906 } else { 932 } else {
907 updateLink(link); 933 updateLink(link);
908 } 934 }
909 } else if ( msg == "busy()" ) { 935 } else if ( msg == "busy()" ) {
910 emit busy(); 936 emit busy();
911 } else if ( msg == "notBusy(QString)" ) { 937 } else if ( msg == "notBusy(QString)" ) {
912 QString app; 938 QString app;
913 stream >> app; 939 stream >> app;
914 tabs->setBusy(FALSE); 940 tabs->setBusy(FALSE);
915 emit notBusy(app); 941 emit notBusy(app);
916 } else if ( msg == "mkdir(QString)" ) { 942 } else if ( msg == "mkdir(QString)" ) {
@@ -1168,57 +1194,57 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data)
1168 QString color; 1194 QString color;
1169 stream >> color; 1195 stream >> color;
1170 if ( tabs->view(id) ) 1196 if ( tabs->view(id) )
1171 tabs->view(id)->setTextColor( QColor(color) ); 1197 tabs->view(id)->setTextColor( QColor(color) );
1172 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 1198 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
1173 QString id; 1199 QString id;
1174 stream >> id; 1200 stream >> id;
1175 QString fam; 1201 QString fam;
1176 stream >> fam; 1202 stream >> fam;
1177 int size; 1203 int size;
1178 stream >> size; 1204 stream >> size;
1179 int weight; 1205 int weight;
1180 stream >> weight; 1206 stream >> weight;
1181 int italic; 1207 int italic;
1182 stream >> italic; 1208 stream >> italic;
1183 if ( tabs->view(id) ) 1209 if ( tabs->view(id) )
1184 if ( !fam. isEmpty ( )) 1210 if ( !fam. isEmpty ( ))
1185 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 1211 tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
1186 else 1212 else
1187 tabs->view(id)->unsetViewFont(); 1213 tabs->view(id)->unsetViewFont();
1188 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); 1214 qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic );
1189 } 1215 }
1190 else if ( msg == "setBusyIndicatorType(QString)" ) { 1216 else if ( msg == "setBusyIndicatorType(QString)" ) {
1191 QString type; 1217 QString type;
1192 stream >> type; 1218 stream >> type;
1193 tabs->setBusyIndicatorType(type); 1219 tabs->setBusyIndicatorType(type);
1194 } 1220 }
1195 else if ( msg == "home()" ) { 1221 else if ( msg == "home()" ) {
1196 if ( isVisibleWindow( winId ( ))) 1222 if ( isVisibleWindow( winId ( )))
1197 nextView ( ); 1223 nextView ( );
1198 else 1224 else
1199 raise ( ); 1225 raise ( );
1200 1226
1201 } 1227 }
1202} 1228}
1203 1229
1204void Launcher::storageChanged() 1230void Launcher::storageChanged()
1205{ 1231{
1206 if ( in_lnk_props ) { 1232 if ( in_lnk_props ) {
1207 got_lnk_change = TRUE; 1233 got_lnk_change = TRUE;
1208 lnk_change = QString::null; 1234 lnk_change = QString::null;
1209 } else { 1235 } else {
1210 updateLink( QString::null ); 1236 updateLink( QString::null );
1211 } 1237 }
1212} 1238}
1213 1239
1214 1240
1215bool Launcher::mkdir(const QString &localPath) 1241bool Launcher::mkdir(const QString &localPath)
1216{ 1242{
1217 QDir fullDir(localPath); 1243 QDir fullDir(localPath);
1218 if (fullDir.exists()) 1244 if (fullDir.exists())
1219 return true; 1245 return true;
1220 1246
1221 // at this point the directory doesn't exist 1247 // at this point the directory doesn't exist
1222 // go through the directory tree and start creating the direcotories 1248 // go through the directory tree and start creating the direcotories
1223 // that don't exist; if we can't create the directories, return false 1249 // that don't exist; if we can't create the directories, return false
1224 1250
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
index 89bf6f3..c92ef5d 100644
--- a/core/launcher/launcher.h
+++ b/core/launcher/launcher.h
@@ -51,81 +51,83 @@ protected:
51 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; 51 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const;
52}; 52};
53 53
54class CategoryTabWidget : public QVBox { 54class CategoryTabWidget : public QVBox {
55 // can't use a QTabWidget, since it won't let us set the frame style. 55 // can't use a QTabWidget, since it won't let us set the frame style.
56 Q_OBJECT 56 Q_OBJECT
57public: 57public:
58 CategoryTabWidget( QWidget* parent ); 58 CategoryTabWidget( QWidget* parent );
59 void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, 59 void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder,
60 const QList<FileSystem> &); 60 const QList<FileSystem> &);
61 void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); 61 void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs);
62 void updateLink(const QString& linkfile); 62 void updateLink(const QString& linkfile);
63 void setBusy(bool on); 63 void setBusy(bool on);
64 QString getAllDocLinkInfo() const; 64 QString getAllDocLinkInfo() const;
65 LauncherView *view( const QString &id ); 65 LauncherView *view( const QString &id );
66 void setBusyIndicatorType ( const QString &type ); 66 void setBusyIndicatorType ( const QString &type );
67signals: 67signals:
68 void selected(const QString&); 68 void selected(const QString&);
69 void clicked(const AppLnk*); 69 void clicked(const AppLnk*);
70 void rightPressed(AppLnk*); 70 void rightPressed(AppLnk*);
71 71
72public slots: 72public slots:
73 void nextTab(); 73 void nextTab();
74 void prevTab(); 74 void prevTab();
75 void showTab(const QString&);
75 76
76protected slots: 77protected slots:
77 void tabProperties(); 78 void tabProperties();
78 79
79protected: 80protected:
80 void setTabAppearance( const QString &id, Config &cfg ); 81 void setTabAppearance( const QString &id, Config &cfg );
81 void paletteChange( const QPalette &p ); 82 void paletteChange( const QPalette &p );
82 83
83private: 84private:
84 CategoryTabBar* categoryBar; 85 CategoryTabBar* categoryBar;
85 QWidgetStack* stack; 86 QWidgetStack* stack;
86 LauncherView* docview; 87 LauncherView* docview;
87 QStringList ids; 88 QStringList ids;
88 int tabs; 89 int tabs;
89 LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); 90 LauncherView* newView( const QString&, const QPixmap& pm, const QString& label );
90 void addItem( const QString& ); 91 void addItem( const QString& );
91}; 92};
92 93
93class Launcher : public QMainWindow 94class Launcher : public QMainWindow
94{ 95{
95 Q_OBJECT 96 Q_OBJECT
96 friend class LauncherPrivate; 97 friend class LauncherPrivate;
97public: 98public:
98 Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 99 Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
99 ~Launcher(); 100 ~Launcher();
100 101
101 static QString appsFolderName(); 102 static QString appsFolderName();
102 103
103 virtual void showMaximized(); 104 virtual void showMaximized();
104 static bool mkdir(const QString &path); 105 static bool mkdir(const QString &path);
105 106
106public slots: 107public slots:
107 void viewSelected(const QString&); 108 void viewSelected(const QString&);
109 void showTab(const QString&);
108 void select( const AppLnk * ); 110 void select( const AppLnk * );
109 void externalSelected( const AppLnk *); 111 void externalSelected( const AppLnk *);
110 void properties( AppLnk * ); 112 void properties( AppLnk * );
111 void nextView(); 113 void nextView();
112 114
113signals: 115signals:
114 void executing( const AppLnk * ); 116 void executing( const AppLnk * );
115 void busy(); 117 void busy();
116 void notBusy(const QString&); 118 void notBusy(const QString&);
117 119
118private slots: 120private slots:
119 void doMaximize(); 121 void doMaximize();
120 void systemMessage( const QCString &, const QByteArray &); 122 void systemMessage( const QCString &, const QByteArray &);
121 void launcherMessage( const QCString &, const QByteArray &); 123 void launcherMessage( const QCString &, const QByteArray &);
122 void storageChanged(); 124 void storageChanged();
123 void cancelSync(); 125 void cancelSync();
124 126
125private: 127private:
126 void updateApps(); 128 void updateApps();
127 void loadDocs(); 129 void loadDocs();
128 void updateDocs(); 130 void updateDocs();
129 void updateTabs(); 131 void updateTabs();
130 void updateMimeTypes(); 132 void updateMimeTypes();
131 void updateMimeTypes(AppLnkSet*); 133 void updateMimeTypes(AppLnkSet*);