summaryrefslogtreecommitdiff
path: root/libopie2/opieui/otabwidget.cpp
Unidiff
Diffstat (limited to 'libopie2/opieui/otabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index ec6af9d..f47c90b 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -29,101 +29,101 @@
29 29
30*/ 30*/
31 31
32#include <opie2/otabwidget.h> 32#include <opie2/otabwidget.h>
33 33
34/* OPIE */ 34/* OPIE */
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#include <opie2/otabbar.h> 38#include <opie2/otabbar.h>
39 39
40/* QT */ 40/* QT */
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qwidgetstack.h> 42#include <qwidgetstack.h>
43 43
44using namespace Opie; 44using namespace Opie;
45 45
46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) 46OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p )
47 : QWidget( parent, name ) 47 : QWidget( parent, name )
48{ 48{
49 if ( s == Global ) 49 if ( s == Global )
50 { 50 {
51 Config config( "qpe" ); 51 Config config( "qpe" );
52 config.setGroup( "Appearance" ); 52 config.setGroup( "Appearance" );
53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); 53 s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab );
54 if ( s <= Global || s > IconList) 54 if ( s <= Global || s > IconList)
55 { 55 {
56 s = IconTab; 56 s = IconTab;
57 } 57 }
58 QString pos = config.readEntry( "TabPosition", "Top"); 58 QString pos = config.readEntry( "TabPosition", "Top");
59 if ( pos == "Bottom" ) 59 if ( pos == "Bottom" )
60 { 60 {
61 p = Bottom; 61 p = Bottom;
62 } 62 }
63 else 63 else
64 { 64 {
65 p = Top; 65 p = Top;
66 } 66 }
67 } 67 }
68 68
69 widgetStack = new QWidgetStack( this, "widgetstack" ); 69 widgetStack = new QWidgetStack( this, "widgetstack" );
70 widgetStack->setFrameStyle( QFrame::NoFrame ); 70 widgetStack->setFrameStyle( QFrame::NoFrame );
71 widgetStack->setLineWidth( style().defaultFrameWidth() ); 71 widgetStack->setLineWidth( style().defaultFrameWidth() );
72 72
73 tabBarStack = new QWidgetStack( this, "tabbarstack" ); 73 tabBarStack = new QWidgetStack( this, "tabbarstack" );
74 74
75 tabBar = new OTabBar( tabBarStack, "tabbar" ); 75 tabBar = new OTabBar( tabBarStack, "tabbar" );
76 tabBarStack->addWidget( tabBar, 0 ); 76 tabBarStack->addWidget( tabBar, 0 );
77 connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); 77 connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) );
78 78
79 tabList = new QComboBox( false, tabBarStack, "tablist" ); 79 tabList = new QComboBox( false, tabBarStack, "tablist" );
80 tabBarStack->addWidget( tabList, 1 ); 80 tabBarStack->addWidget( tabList, 1 );
81 connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); 81 connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) );
82 82
83 tabBarPosition = p; 83 tabBarPosition = p;
84 setTabStyle( s ); 84 setTabStyle( s );
85 setTabPosition( p ); 85 setTabPosition( p );
86 86
87 currTab= 0x0; 87 currTab= 0x0;
88} 88}
89 89
90OTabWidget::~OTabWidget() 90OTabWidget::~OTabWidget()
91{} 91{}
92 92
93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) 93void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label )
94{ 94{
95 QPixmap iconset = loadSmooth( icon ); 95 QPixmap iconset = loadSmooth( icon );
96 96
97 QTab *tab = new QTab(); 97 QTab *tab = new QTab();
98 if ( tabBarStyle == IconTab ) 98 if ( tabBarStyle == IconTab )
99 { 99 {
100 tab->label = QString::null; 100 tab->label = QString::null;
101 } 101 }
102 else 102 else
103 { 103 {
104 tab->label = label; 104 tab->label = label;
105 } 105 }
106 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 106 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
107 { 107 {
108 tab->iconset = new QIconSet( iconset ); 108 tab->iconset = new QIconSet( iconset );
109 } 109 }
110 int tabid = tabBar->addTab( tab ); 110 int tabid = tabBar->addTab( tab );
111 111
112 if ( tabBarStyle == IconTab || tabBarStyle == IconList ) 112 if ( tabBarStyle == IconTab || tabBarStyle == IconList )
113 { 113 {
114 tabList->insertItem( iconset, label, -1 ); 114 tabList->insertItem( iconset, label, -1 );
115 } 115 }
116 else 116 else
117 { 117 {
118 tabList->insertItem( label ); 118 tabList->insertItem( label );
119 } 119 }
120 120
121 widgetStack->addWidget( child, tabid ); 121 widgetStack->addWidget( child, tabid );
122 widgetStack->raiseWidget( child ); 122 widgetStack->raiseWidget( child );
123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 123 widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
124 124
125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 125 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
126 tabs.append( tabinfo ); 126 tabs.append( tabinfo );
127 selectTab( tabinfo ); 127 selectTab( tabinfo );
128} 128}
129 129