summaryrefslogtreecommitdiff
path: root/libopie/otabwidget.cpp
Unidiff
Diffstat (limited to 'libopie/otabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabwidget.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index bee3f35..99bf067 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -95,13 +95,13 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab
95 tab->label = QString::null; 95 tab->label = QString::null;
96 } 96 }
97 else 97 else
98 { 98 {
99 tab->label = label; 99 tab->label = label;
100 } 100 }
101 if ( tabBarStyle == IconTab || tabBarStyle == IconList) 101 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
102 { 102 {
103 tab->iconset = new QIconSet( iconset ); 103 tab->iconset = new QIconSet( iconset );
104 } 104 }
105 int tabid = tabBar->addTab( tab ); 105 int tabid = tabBar->addTab( tab );
106 106
107 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 107 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
@@ -155,22 +155,58 @@ void OTabWidget::removePage( QWidget *childwidget )
155 155
156 setUpLayout(); 156 setUpLayout();
157 } 157 }
158 } 158 }
159} 159}
160 160
161void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label)
162{
163 OTabInfo *currtab = tabs.first();
164 while ( currtab && currtab->control() != widget )
165 {
166 currtab = tabs.next();
167 }
168 if ( currtab && currtab->control() == widget )
169 {
170 QTab *tab = tabBar->tab( currtab->id() );
171 QPixmap icon( loadSmooth( iconset ) );
172 tab->setText( label );
173 if ( tabBarStyle == IconTab )
174 tab->setIconSet( icon );
175 int i = 0;
176 while ( i < tabList->count() && tabList->text( i ) != currtab->label() )
177 {
178 i++;
179 }
180 if ( i < tabList->count() && tabList->text( i ) == currtab->label() )
181 {
182 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
183 {
184 tabList->changeItem( icon, label, i );
185 }
186 else
187 {
188 tabList->changeItem( label, i );
189 }
190 }
191 currtab->setLabel( label );
192 currtab->setIcon( iconset );
193 }
194 setUpLayout();
195}
196
161void OTabWidget::setCurrentTab( QWidget *childwidget ) 197void OTabWidget::setCurrentTab( QWidget *childwidget )
162{ 198{
163 OTabInfo *newtab = tabs.first(); 199 OTabInfo *currtab = tabs.first();
164 while ( newtab && newtab->control() != childwidget ) 200 while ( currtab && currtab->control() != childwidget )
165 { 201 {
166 newtab = tabs.next(); 202 currtab = tabs.next();
167 } 203 }
168 if ( newtab && newtab->control() == childwidget ) 204 if ( currtab && currtab->control() == childwidget )
169 { 205 {
170 selectTab( newtab ); 206 selectTab( currtab );
171 } 207 }
172} 208}
173 209
174void OTabWidget::setCurrentTab( const QString &tabname ) 210void OTabWidget::setCurrentTab( const QString &tabname )
175{ 211{
176 OTabInfo *newtab = tabs.first(); 212 OTabInfo *newtab = tabs.first();