summaryrefslogtreecommitdiff
Unidiff
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
@@ -144,16 +144,25 @@ void 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 }
@@ -182,16 +191,22 @@ void CategoryTabWidget::addItem( const QString& linkfile )
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;
@@ -243,18 +258,24 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
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 );
@@ -609,17 +630,16 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
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*)));
@@ -669,16 +689,17 @@ void Launcher::showMaximized()
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
@@ -827,16 +848,21 @@ void Launcher::viewSelected(const QString& s)
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"),
@@ -884,17 +910,17 @@ void Launcher::updateLink(const QString& link)
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)" ) {
@@ -1184,25 +1210,25 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data)
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;
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
@@ -67,16 +67,17 @@ public:
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
@@ -100,16 +101,17 @@ public:
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();