Diffstat (limited to 'libopie2/opieui/olistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/olistview.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index 8f290d3..ec503dd 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -30,48 +30,49 @@ | |||
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | 32 | ||
33 | #include <qcolor.h> | 33 | #include <qcolor.h> |
34 | #include <qheader.h> | 34 | #include <qheader.h> |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | 39 | ||
40 | #include <opie2/olistview.h> | 40 | #include <opie2/olistview.h> |
41 | 41 | ||
42 | /*====================================================================================== | 42 | /*====================================================================================== |
43 | * OListView | 43 | * OListView |
44 | *======================================================================================*/ | 44 | *======================================================================================*/ |
45 | 45 | ||
46 | OListView::OListView( QWidget *parent, const char *name ) | 46 | OListView::OListView( QWidget *parent, const char *name ) |
47 | :QListView( parent, name ) | 47 | :QListView( parent, name ) |
48 | { | 48 | { |
49 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* | 49 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* |
50 | 50 | ||
51 | m_alternateBackground = QColor( 238, 246, 255 ); | 51 | m_alternateBackground = QColor( 238, 246, 255 ); |
52 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); | 52 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); |
53 | m_fullWidth = true; | 53 | m_fullWidth = true; |
54 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); | ||
54 | } | 55 | } |
55 | 56 | ||
56 | OListView::~OListView() | 57 | OListView::~OListView() |
57 | { | 58 | { |
58 | } | 59 | } |
59 | 60 | ||
60 | void OListView::setFullWidth( bool fullWidth ) | 61 | void OListView::setFullWidth( bool fullWidth ) |
61 | { | 62 | { |
62 | m_fullWidth = m_fullWidth; | 63 | m_fullWidth = m_fullWidth; |
63 | #if QT_VERSION > 290 | 64 | #if QT_VERSION > 290 |
64 | header()->setStretchEnabled( fullWidth, columns()-1 ); | 65 | header()->setStretchEnabled( fullWidth, columns()-1 ); |
65 | #endif | 66 | #endif |
66 | } | 67 | } |
67 | 68 | ||
68 | bool OListView::fullWidth() const | 69 | bool OListView::fullWidth() const |
69 | { | 70 | { |
70 | return m_fullWidth; | 71 | return m_fullWidth; |
71 | } | 72 | } |
72 | 73 | ||
73 | int OListView::addColumn( const QString& label, int width ) | 74 | int OListView::addColumn( const QString& label, int width ) |
74 | { | 75 | { |
75 | int result = QListView::addColumn( label, width ); | 76 | int result = QListView::addColumn( label, width ); |
76 | #if QT_VERSION > 290 | 77 | #if QT_VERSION > 290 |
77 | if (m_fullWidth) { | 78 | if (m_fullWidth) { |
@@ -106,48 +107,53 @@ void OListView::removeColumn( int index ) | |||
106 | } | 107 | } |
107 | 108 | ||
108 | const QColor& OListView::alternateBackground() const | 109 | const QColor& OListView::alternateBackground() const |
109 | { | 110 | { |
110 | return m_alternateBackground; | 111 | return m_alternateBackground; |
111 | } | 112 | } |
112 | 113 | ||
113 | void OListView::setAlternateBackground( const QColor &c ) | 114 | void OListView::setAlternateBackground( const QColor &c ) |
114 | { | 115 | { |
115 | m_alternateBackground = c; | 116 | m_alternateBackground = c; |
116 | repaint(); | 117 | repaint(); |
117 | } | 118 | } |
118 | 119 | ||
119 | const QPen& OListView::columnSeparator() const | 120 | const QPen& OListView::columnSeparator() const |
120 | { | 121 | { |
121 | return m_columnSeparator; | 122 | return m_columnSeparator; |
122 | } | 123 | } |
123 | 124 | ||
124 | void OListView::setColumnSeparator( const QPen& p ) | 125 | void OListView::setColumnSeparator( const QPen& p ) |
125 | { | 126 | { |
126 | m_columnSeparator = p; | 127 | m_columnSeparator = p; |
127 | repaint(); | 128 | repaint(); |
128 | } | 129 | } |
129 | 130 | ||
131 | void OListView::expand(QListViewItem *item) | ||
132 | { | ||
133 | ((OListViewItem*)item)->expand(); | ||
134 | } | ||
135 | |||
130 | OListViewItem* OListView::childFactory() | 136 | OListViewItem* OListView::childFactory() |
131 | { | 137 | { |
132 | return new OListViewItem( this ); | 138 | return new OListViewItem( this ); |
133 | } | 139 | } |
134 | 140 | ||
135 | #ifndef QT_NO_DATASTREAM | 141 | #ifndef QT_NO_DATASTREAM |
136 | void OListView::serializeTo( QDataStream& s ) const | 142 | void OListView::serializeTo( QDataStream& s ) const |
137 | { | 143 | { |
138 | #warning Caution... the binary format is still under construction... | 144 | #warning Caution... the binary format is still under construction... |
139 | qDebug( "storing OListView..." ); | 145 | qDebug( "storing OListView..." ); |
140 | 146 | ||
141 | // store number of columns and the labels | 147 | // store number of columns and the labels |
142 | s << columns(); | 148 | s << columns(); |
143 | for ( int i = 0; i < columns(); ++i ) | 149 | for ( int i = 0; i < columns(); ++i ) |
144 | s << columnText( i ); | 150 | s << columnText( i ); |
145 | 151 | ||
146 | // calculate the number of top-level items to serialize | 152 | // calculate the number of top-level items to serialize |
147 | int items = 0; | 153 | int items = 0; |
148 | QListViewItem* item = firstChild(); | 154 | QListViewItem* item = firstChild(); |
149 | while ( item ) | 155 | while ( item ) |
150 | { | 156 | { |
151 | item = item->nextSibling(); | 157 | item = item->nextSibling(); |
152 | items++; | 158 | items++; |
153 | } | 159 | } |