author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
104 files changed, 1617 insertions, 1358 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 72c4e60..4172cd0 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -25,150 +25,160 @@ | |||
25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this | 25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this |
26 | ** licensing are not clear to you. | 26 | ** licensing are not clear to you. |
27 | ** | 27 | ** |
28 | ** As a special exception, permission is given to link this program | 28 | ** As a special exception, permission is given to link this program |
29 | ** with any edition of Qt, and distribute the resulting executable, | 29 | ** with any edition of Qt, and distribute the resulting executable, |
30 | ** without including the source code for Qt in the source distribution. | 30 | ** without including the source code for Qt in the source distribution. |
31 | ** | 31 | ** |
32 | **********************************************************************/ | 32 | **********************************************************************/ |
33 | 33 | ||
34 | #include "KDGanttMinimizeSplitter.h" | 34 | #include "KDGanttMinimizeSplitter.h" |
35 | #ifndef QT_NO_SPLITTER___ | 35 | #ifndef QT_NO_SPLITTER___ |
36 | 36 | ||
37 | #include "qpainter.h" | 37 | #include "qpainter.h" |
38 | #include "qdrawutil.h" | 38 | #include "qdrawutil.h" |
39 | #include "qbitmap.h" | 39 | #include "qbitmap.h" |
40 | #if QT_VERSION >= 0x030000 | 40 | #if QT_VERSION >= 0x030000 |
41 | #include "qptrlist.h" | 41 | #include "q3ptrlist.h" |
42 | #include "qmemarray.h" | 42 | #include "q3memarray.h" |
43 | #else | 43 | #else |
44 | #include <qlist.h> | 44 | #include <qlist.h> |
45 | #include <qarray.h> | 45 | #include <qarray.h> |
46 | #define QPtrList QList | 46 | #define Q3PtrList QList |
47 | #define QMemArray QArray | 47 | #define Q3MemArray QArray |
48 | #endif | 48 | #endif |
49 | #include "qlayoutengine_p.h" | 49 | #include "qlayoutengine_p.h" |
50 | #include "qobjectlist.h" | 50 | #include "qobject.h" |
51 | #include "qstyle.h" | 51 | #include "qstyle.h" |
52 | #include "qapplication.h" //sendPostedEvents | 52 | #include "qapplication.h" //sendPostedEvents |
53 | #include <qvaluelist.h> | 53 | #include <q3valuelist.h> |
54 | #include <qcursor.h> | 54 | #include <qcursor.h> |
55 | #include <qframe.h> | 55 | #include <q3frame.h> |
56 | #include <QDesktopWidget> | ||
57 | //Added by qt3to4: | ||
58 | #include <Q3PointArray> | ||
59 | #include <QPixmap> | ||
60 | #include <QResizeEvent> | ||
61 | #include <QMouseEvent> | ||
62 | #include <QChildEvent> | ||
63 | #include <QEvent> | ||
64 | #include <QPaintEvent> | ||
56 | #ifndef KDGANTT_MASTER_CVS | 65 | #ifndef KDGANTT_MASTER_CVS |
57 | //#include "KDGanttMinimizeSplitter.moc" | 66 | //#include "KDGanttMinimizeSplitter.moc" |
58 | #endif | 67 | #endif |
59 | 68 | ||
60 | 69 | ||
61 | 70 | ||
62 | #ifndef DOXYGEN_SKIP_INTERNAL | 71 | #ifndef DOXYGEN_SKIP_INTERNAL |
63 | 72 | ||
64 | #if QT_VERSION >= 232 | 73 | #if QT_VERSION >= 232 |
65 | static int mouseOffset; | 74 | static int mouseOffset; |
66 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky | 75 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky |
67 | 76 | ||
68 | class KDRubberBand: public QFrame | 77 | class KDRubberBand: public Q3Frame |
69 | { | 78 | { |
70 | public: | 79 | public: |
71 | KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;} | 80 | KDRubberBand( QWidget *parent, const char * name, Qt::WFlags f ) :Q3Frame ( parent, name, f ) {;} |
72 | 81 | ||
73 | protected: | 82 | protected: |
74 | virtual void mousePressEvent ( QMouseEvent * ) | 83 | virtual void mousePressEvent ( QMouseEvent * ) |
75 | { | 84 | { |
76 | close(); | 85 | close(); |
77 | }; | 86 | }; |
78 | 87 | ||
79 | }; | 88 | }; |
80 | 89 | ||
81 | KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, | 90 | KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, |
82 | KDGanttMinimizeSplitter *parent, const char * name ) | 91 | KDGanttMinimizeSplitter *parent, const char * name ) |
83 | : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) | 92 | : _activeButton( 0 ), _collapsed( false ) |
84 | { | 93 | { |
85 | 94 | setObjectName(name); | |
95 | setParent(parent); | ||
86 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { | 96 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { |
87 | mSizeHint = QSize(7,7); | 97 | mSizeHint = QSize(7,7); |
88 | mUseOffset = true; | 98 | mUseOffset = true; |
89 | } else { | 99 | } else { |
90 | mSizeHint = QSize(6,6); | 100 | mSizeHint = QSize(6,6); |
91 | mUseOffset = false; | 101 | mUseOffset = false; |
92 | } | 102 | } |
93 | s = parent; | 103 | s = parent; |
94 | setOrientation(o); | 104 | setOrientation(o); |
95 | setMouseTracking( true ); | 105 | setMouseTracking( true ); |
96 | mMouseDown = false; | 106 | mMouseDown = false; |
97 | //setMaximumHeight( 5 ); // test only | 107 | //setMaximumHeight( 5 ); // test only |
98 | } | 108 | } |
99 | 109 | ||
100 | QSize KDGanttSplitterHandle::sizeHint() const | 110 | QSize KDGanttSplitterHandle::sizeHint() const |
101 | { | 111 | { |
102 | return mSizeHint; | 112 | return mSizeHint; |
103 | } | 113 | } |
104 | 114 | ||
105 | void KDGanttSplitterHandle::setOrientation( Qt::Orientation o ) | 115 | void KDGanttSplitterHandle::setOrientation( Qt::Orientation o ) |
106 | { | 116 | { |
107 | orient = o; | 117 | orient = o; |
108 | #ifndef QT_NO_CURSOR | 118 | #ifndef QT_NO_CURSOR |
109 | if ( o == KDGanttMinimizeSplitter::Horizontal ) | 119 | if ( o == Qt::Horizontal ) |
110 | setCursor( splitHCursor ); | 120 | setCursor( Qt::splitHCursor ); |
111 | else | 121 | else |
112 | setCursor( splitVCursor ); | 122 | setCursor( Qt::splitVCursor ); |
113 | #endif | 123 | #endif |
114 | } | 124 | } |
115 | 125 | ||
116 | 126 | ||
117 | void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e ) | 127 | void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e ) |
118 | { | 128 | { |
119 | updateCursor( e->pos() ); | 129 | updateCursor( e->pos() ); |
120 | if ( !(e->state()&LeftButton) ) | 130 | if ( !(e->state()&Qt::LeftButton) ) |
121 | return; | 131 | return; |
122 | 132 | ||
123 | if ( _activeButton != 0) | 133 | if ( _activeButton != 0) |
124 | return; | 134 | return; |
125 | 135 | ||
126 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) | 136 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) |
127 | - mouseOffset; | 137 | - mouseOffset; |
128 | if ( opaque() ) { | 138 | if ( opaque() ) { |
129 | s->moveSplitter( pos, id() ); | 139 | s->moveSplitter( pos, id() ); |
130 | } else { | 140 | } else { |
131 | int min = pos; int max = pos; | 141 | int min = pos; int max = pos; |
132 | s->getRange( id(), &min, &max ); | 142 | s->getRange( id(), &min, &max ); |
133 | s->setRubberband( QMAX( min, QMIN(max, pos ))); | 143 | s->setRubberband( QMAX( min, QMIN(max, pos ))); |
134 | } | 144 | } |
135 | _collapsed = false; | 145 | _collapsed = false; |
136 | } | 146 | } |
137 | 147 | ||
138 | void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e ) | 148 | void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e ) |
139 | { | 149 | { |
140 | if ( e->button() == LeftButton ) { | 150 | if ( e->button() == Qt::LeftButton ) { |
141 | _activeButton = onButton( e->pos() ); | 151 | _activeButton = onButton( e->pos() ); |
142 | mouseOffset = s->pick(e->pos()); | 152 | mouseOffset = s->pick(e->pos()); |
143 | mMouseDown = true; | 153 | mMouseDown = true; |
144 | repaint(); | 154 | repaint(); |
145 | updateCursor( e->pos() ); | 155 | updateCursor( e->pos() ); |
146 | } | 156 | } |
147 | } | 157 | } |
148 | 158 | ||
149 | void KDGanttSplitterHandle::updateCursor( const QPoint& p) | 159 | void KDGanttSplitterHandle::updateCursor( const QPoint& p) |
150 | { | 160 | { |
151 | if ( onButton( p ) != 0 ) { | 161 | if ( onButton( p ) != 0 ) { |
152 | setCursor( arrowCursor ); | 162 | setCursor( Qt::arrowCursor ); |
153 | } | 163 | } |
154 | else { | 164 | else { |
155 | if ( orient == KDGanttMinimizeSplitter::Horizontal ) | 165 | if ( orient == Qt::Horizontal ) |
156 | setCursor( splitHCursor ); | 166 | setCursor( Qt::splitHCursor ); |
157 | else | 167 | else |
158 | setCursor( splitVCursor ); | 168 | setCursor( Qt::splitVCursor ); |
159 | } | 169 | } |
160 | } | 170 | } |
161 | void KDGanttSplitterHandle::toggle() | 171 | void KDGanttSplitterHandle::toggle() |
162 | { | 172 | { |
163 | int pos; | 173 | int pos; |
164 | int min, max; | 174 | int min, max; |
165 | if ( !_collapsed ) { | 175 | if ( !_collapsed ) { |
166 | s->expandPos( id(), &min, &max ); | 176 | s->expandPos( id(), &min, &max ); |
167 | if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left | 177 | if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left |
168 | || s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { | 178 | || s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { |
169 | pos = min; | 179 | pos = min; |
170 | } | 180 | } |
171 | else { | 181 | else { |
172 | pos = max; | 182 | pos = max; |
173 | } | 183 | } |
174 | 184 | ||
@@ -182,76 +192,76 @@ void KDGanttSplitterHandle::toggle() | |||
182 | } | 192 | } |
183 | repaint(); | 193 | repaint(); |
184 | } | 194 | } |
185 | 195 | ||
186 | void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) | 196 | void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) |
187 | { | 197 | { |
188 | mMouseDown = false; | 198 | mMouseDown = false; |
189 | if ( _activeButton != 0 ) { | 199 | if ( _activeButton != 0 ) { |
190 | if ( onButton( e->pos() ) == _activeButton ) | 200 | if ( onButton( e->pos() ) == _activeButton ) |
191 | { | 201 | { |
192 | toggle(); | 202 | toggle(); |
193 | } | 203 | } |
194 | _activeButton = 0; | 204 | _activeButton = 0; |
195 | updateCursor( e->pos() ); | 205 | updateCursor( e->pos() ); |
196 | } | 206 | } |
197 | else { | 207 | else { |
198 | if ( !opaque() && e->button() == LeftButton ) { | 208 | if ( !opaque() && e->button() == Qt::LeftButton ) { |
199 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) | 209 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) |
200 | - mouseOffset; | 210 | - mouseOffset; |
201 | s->setRubberband( -1 ); | 211 | s->setRubberband( -1 ); |
202 | s->moveSplitter( pos, id() ); | 212 | s->moveSplitter( pos, id() ); |
203 | } | 213 | } |
204 | } | 214 | } |
205 | if ( s->rubberBand() ) { | 215 | if ( s->rubberBand() ) { |
206 | //qDebug("hide rubberband "); | 216 | //qDebug("hide rubberband "); |
207 | s->rubberBand()->close(); | 217 | s->rubberBand()->close(); |
208 | } | 218 | } |
209 | repaint(); | 219 | repaint(); |
210 | } | 220 | } |
211 | 221 | ||
212 | int KDGanttSplitterHandle::onButton( const QPoint& p ) | 222 | int KDGanttSplitterHandle::onButton( const QPoint& p ) |
213 | { | 223 | { |
214 | QValueList<QPointArray> list = buttonRegions(); | 224 | Q3ValueList<Q3PointArray> list = buttonRegions(); |
215 | int index = 1; | 225 | int index = 1; |
216 | int add = 12; | 226 | int add = 12; |
217 | for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { | 227 | for( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { |
218 | QRect rect = (*it).boundingRect(); | 228 | QRect rect = (*it).boundingRect(); |
219 | rect.setLeft( rect.left()- add ); | 229 | rect.setLeft( rect.left()- add ); |
220 | rect.setRight( rect.right() + add); | 230 | rect.setRight( rect.right() + add); |
221 | rect.setTop( rect.top()- add ); | 231 | rect.setTop( rect.top()- add ); |
222 | rect.setBottom( rect.bottom() + add); | 232 | rect.setBottom( rect.bottom() + add); |
223 | if ( rect.contains( p ) ) { | 233 | if ( rect.contains( p ) ) { |
224 | return index; | 234 | return index; |
225 | } | 235 | } |
226 | index++; | 236 | index++; |
227 | } | 237 | } |
228 | return 0; | 238 | return 0; |
229 | } | 239 | } |
230 | 240 | ||
231 | 241 | ||
232 | QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() | 242 | Q3ValueList<Q3PointArray> KDGanttSplitterHandle::buttonRegions() |
233 | { | 243 | { |
234 | QValueList<QPointArray> list; | 244 | Q3ValueList<Q3PointArray> list; |
235 | 245 | ||
236 | int sw = 8; | 246 | int sw = 8; |
237 | int yyy = 1; | 247 | int yyy = 1; |
238 | int xxx = 1; | 248 | int xxx = 1; |
239 | int voffset[] = { (int) -sw*3, (int) sw*3 }; | 249 | int voffset[] = { (int) -sw*3, (int) sw*3 }; |
240 | for ( int i = 0; i < 2; i++ ) { | 250 | for ( int i = 0; i < 2; i++ ) { |
241 | QPointArray arr; | 251 | Q3PointArray arr; |
242 | if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || | 252 | if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || |
243 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { | 253 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { |
244 | int mid = height()/2 + voffset[i]; | 254 | int mid = height()/2 + voffset[i]; |
245 | arr.setPoints( 3, | 255 | arr.setPoints( 3, |
246 | 1-xxx, mid - sw + 4, | 256 | 1-xxx, mid - sw + 4, |
247 | sw-3-xxx, mid, | 257 | sw-3-xxx, mid, |
248 | 1-xxx, mid + sw -4); | 258 | 1-xxx, mid + sw -4); |
249 | } | 259 | } |
250 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || | 260 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || |
251 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { | 261 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { |
252 | int mid = height()/2 + voffset[i]; | 262 | int mid = height()/2 + voffset[i]; |
253 | arr.setPoints( 3, | 263 | arr.setPoints( 3, |
254 | sw-4, mid - sw + 4, | 264 | sw-4, mid - sw + 4, |
255 | 0, mid, | 265 | 0, mid, |
256 | sw-4, mid + sw - 4); | 266 | sw-4, mid + sw - 4); |
257 | } | 267 | } |
@@ -298,37 +308,37 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) | |||
298 | int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size | 308 | int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size |
299 | 309 | ||
300 | // arrow color | 310 | // arrow color |
301 | QColor col; | 311 | QColor col; |
302 | if ( _activeButton ) | 312 | if ( _activeButton ) |
303 | col = colorGroup().background().dark( 250 ); | 313 | col = colorGroup().background().dark( 250 ); |
304 | else { | 314 | else { |
305 | if ( mMouseDown ) | 315 | if ( mMouseDown ) |
306 | col = Qt::white; | 316 | col = Qt::white; |
307 | else | 317 | else |
308 | col = colorGroup().background().dark( 150 ); | 318 | col = colorGroup().background().dark( 150 ); |
309 | } | 319 | } |
310 | //QColor col = backgroundColor().dark( 130 ); | 320 | //QColor col = backgroundColor().dark( 130 ); |
311 | p.setBrush( col ); | 321 | p.setBrush( col ); |
312 | p.setPen( col ); | 322 | p.setPen( col ); |
313 | 323 | ||
314 | QValueList<QPointArray> list = buttonRegions(); | 324 | Q3ValueList<Q3PointArray> list = buttonRegions(); |
315 | int index = 1; | 325 | int index = 1; |
316 | if ( mUseOffset ) | 326 | if ( mUseOffset ) |
317 | p.translate( 0, 1 ); | 327 | p.translate( 0, 1 ); |
318 | for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { | 328 | for ( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { |
319 | if ( index == _activeButton ) { | 329 | if ( index == _activeButton ) { |
320 | 330 | ||
321 | /* | 331 | /* |
322 | if ( ! _collapsed ) { | 332 | if ( ! _collapsed ) { |
323 | p.save(); | 333 | p.save(); |
324 | // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), | 334 | // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), |
325 | // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); | 335 | // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); |
326 | p.translate( -1, 0 ); | 336 | p.translate( -1, 0 ); |
327 | p.drawPolygon( *it, true ); | 337 | p.drawPolygon( *it, true ); |
328 | p.restore(); } else | 338 | p.restore(); } else |
329 | */ | 339 | */ |
330 | p.drawPolygon( *it, true ); | 340 | p.drawPolygon( *it, true ); |
331 | 341 | ||
332 | } | 342 | } |
333 | else { | 343 | else { |
334 | /* | 344 | /* |
@@ -364,38 +374,38 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) | |||
364 | #endif | 374 | #endif |
365 | 375 | ||
366 | class QSplitterLayoutStruct | 376 | class QSplitterLayoutStruct |
367 | { | 377 | { |
368 | public: | 378 | public: |
369 | KDGanttMinimizeSplitter::ResizeMode mode; | 379 | KDGanttMinimizeSplitter::ResizeMode mode; |
370 | QCOORD sizer; | 380 | QCOORD sizer; |
371 | bool isSplitter; | 381 | bool isSplitter; |
372 | QWidget *wid; | 382 | QWidget *wid; |
373 | }; | 383 | }; |
374 | 384 | ||
375 | class QSplitterData | 385 | class QSplitterData |
376 | { | 386 | { |
377 | public: | 387 | public: |
378 | QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {} | 388 | QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {} |
379 | 389 | ||
380 | QPtrList<QSplitterLayoutStruct> list; | 390 | Q3PtrList<QSplitterLayoutStruct> list; |
381 | bool opaque; | 391 | bool opaque; |
382 | bool firstShow; | 392 | bool firstShow; |
383 | }; | 393 | }; |
384 | 394 | ||
385 | void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, | 395 | void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos, |
386 | int space, int spacer ); | 396 | int space, int spacer ); |
387 | #endif // DOXYGEN_SKIP_INTERNAL | 397 | #endif // DOXYGEN_SKIP_INTERNAL |
388 | 398 | ||
389 | 399 | ||
390 | /*! | 400 | /*! |
391 | \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h | 401 | \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h |
392 | \brief The KDGanttMinimizeSplitter class implements a splitter | 402 | \brief The KDGanttMinimizeSplitter class implements a splitter |
393 | widget with minimize buttons. | 403 | widget with minimize buttons. |
394 | 404 | ||
395 | This class (and its documentation) is largely a copy of Qt's | 405 | This class (and its documentation) is largely a copy of Qt's |
396 | QSplitter; the copying was necessary because QSplitter is not | 406 | QSplitter; the copying was necessary because QSplitter is not |
397 | extensible at all. QSplitter and its documentation are licensed | 407 | extensible at all. QSplitter and its documentation are licensed |
398 | according to the GPL and the Qt Professional License (if you hold | 408 | according to the GPL and the Qt Professional License (if you hold |
399 | such a license) and are (C) Trolltech AS. | 409 | such a license) and are (C) Trolltech AS. |
400 | 410 | ||
401 | A splitter lets the user control the size of child widgets by | 411 | A splitter lets the user control the size of child widgets by |
@@ -448,113 +458,114 @@ static QSize minSizeHint( const QWidget* w ) | |||
448 | QSize s; | 458 | QSize s; |
449 | if ( min.height() <= 0 || min.width() <= 0 ) | 459 | if ( min.height() <= 0 || min.width() <= 0 ) |
450 | s = w->minimumSizeHint(); | 460 | s = w->minimumSizeHint(); |
451 | if ( min.height() > 0 ) | 461 | if ( min.height() > 0 ) |
452 | s.setHeight( min.height() ); | 462 | s.setHeight( min.height() ); |
453 | if ( min.width() > 0 ) | 463 | if ( min.width() > 0 ) |
454 | s.setWidth( min.width() ); | 464 | s.setWidth( min.width() ); |
455 | return s.expandedTo(QSize(0,0)); | 465 | return s.expandedTo(QSize(0,0)); |
456 | } | 466 | } |
457 | 467 | ||
458 | 468 | ||
459 | /*! | 469 | /*! |
460 | Constructs a horizontal splitter with the \a parent and \a | 470 | Constructs a horizontal splitter with the \a parent and \a |
461 | name arguments being passed on to the QFrame constructor. | 471 | name arguments being passed on to the QFrame constructor. |
462 | */ | 472 | */ |
463 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) | 473 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) |
464 | :QFrame(parent,name,WPaintUnclipped) | 474 | :Q3Frame(parent,name) |
465 | { | 475 | { |
476 | setAttribute(Qt::WA_PaintUnclipped); | ||
466 | mRubberBand = 0; | 477 | mRubberBand = 0; |
467 | mFirstHandle = 0; | 478 | mFirstHandle = 0; |
468 | #if QT_VERSION >= 232 | 479 | #if QT_VERSION >= 232 |
469 | orient = Horizontal; | 480 | orient = Qt::Horizontal; |
470 | init(); | 481 | init(); |
471 | #endif | 482 | #endif |
472 | } | 483 | } |
473 | 484 | ||
474 | /*! | 485 | /*! |
475 | Constructs a splitter with orientation \a o with the \a parent | 486 | Constructs a splitter with orientation \a o with the \a parent |
476 | and \a name arguments being passed on to the QFrame constructor. | 487 | and \a name arguments being passed on to the QFrame constructor. |
477 | */ | 488 | */ |
478 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) | 489 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, QWidget *parent, const char *name ) |
479 | :QFrame(parent,name,WPaintUnclipped) | 490 | :Q3Frame(parent,name) |
480 | { | 491 | { |
481 | 492 | setAttribute(Qt::WA_PaintUnclipped); | |
482 | mRubberBand = 0; | 493 | mRubberBand = 0; |
483 | mFirstHandle = 0; | 494 | mFirstHandle = 0; |
484 | #if QT_VERSION >= 232 | 495 | #if QT_VERSION >= 232 |
485 | orient = o; | 496 | orient = o; |
486 | init(); | 497 | init(); |
487 | #endif | 498 | #endif |
488 | } | 499 | } |
489 | 500 | ||
490 | /*! | 501 | /*! |
491 | Destroys the splitter and any children. | 502 | Destroys the splitter and any children. |
492 | */ | 503 | */ |
493 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() | 504 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() |
494 | { | 505 | { |
495 | #if QT_VERSION >= 232 | 506 | #if QT_VERSION >= 232 |
496 | data->list.setAutoDelete( TRUE ); | 507 | data->list.setAutoDelete( TRUE ); |
497 | delete data; | 508 | delete data; |
498 | #endif | 509 | #endif |
499 | if ( mRubberBand ) | 510 | if ( mRubberBand ) |
500 | delete mRubberBand; | 511 | delete mRubberBand; |
501 | } | 512 | } |
502 | 513 | ||
503 | 514 | ||
504 | #if QT_VERSION >= 232 | 515 | #if QT_VERSION >= 232 |
505 | void KDGanttMinimizeSplitter::init() | 516 | void KDGanttMinimizeSplitter::init() |
506 | { | 517 | { |
507 | data = new QSplitterData; | 518 | data = new QSplitterData; |
508 | if ( orient == Horizontal ) | 519 | if ( orient == Qt::Horizontal ) |
509 | setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) ); | 520 | setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) ); |
510 | else | 521 | else |
511 | setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) ); | 522 | setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) ); |
512 | #ifndef DESKTOP_VERSION | 523 | #ifndef DESKTOP_VERSION |
513 | setOpaqueResize( false ); | 524 | setOpaqueResize( false ); |
514 | #else | 525 | #else |
515 | setOpaqueResize( true ); | 526 | setOpaqueResize( true ); |
516 | #endif | 527 | #endif |
517 | } | 528 | } |
518 | #endif | 529 | #endif |
519 | 530 | ||
520 | 531 | ||
521 | void KDGanttMinimizeSplitter::toggle() | 532 | void KDGanttMinimizeSplitter::toggle() |
522 | { | 533 | { |
523 | if ( mFirstHandle ) | 534 | if ( mFirstHandle ) |
524 | mFirstHandle->toggle(); | 535 | mFirstHandle->toggle(); |
525 | else | 536 | else |
526 | qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available "); | 537 | qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available "); |
527 | 538 | ||
528 | } | 539 | } |
529 | 540 | ||
530 | 541 | ||
531 | /*! | 542 | /*! |
532 | \brief the orientation of the splitter | 543 | \brief the orientation of the splitter |
533 | 544 | ||
534 | By default the orientation is horizontal (the widgets are side by side). | 545 | By default the orientation is horizontal (the widgets are side by side). |
535 | The possible orientations are Qt:Vertical and Qt::Horizontal (the default). | 546 | The possible orientations are Qt:Vertical and Qt::Horizontal (the default). |
536 | */ | 547 | */ |
537 | void KDGanttMinimizeSplitter::setOrientation( Orientation o ) | 548 | void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o ) |
538 | { | 549 | { |
539 | #if QT_VERSION >= 232 | 550 | #if QT_VERSION >= 232 |
540 | if ( orient == o ) | 551 | if ( orient == o ) |
541 | return; | 552 | return; |
542 | orient = o; | 553 | orient = o; |
543 | 554 | ||
544 | if ( orient == Horizontal ) | 555 | if ( orient == Qt::Horizontal ) |
545 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 556 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
546 | else | 557 | else |
547 | setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 558 | setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
548 | 559 | ||
549 | QSplitterLayoutStruct *s = data->list.first(); | 560 | QSplitterLayoutStruct *s = data->list.first(); |
550 | while ( s ) { | 561 | while ( s ) { |
551 | if ( s->isSplitter ) | 562 | if ( s->isSplitter ) |
552 | ((KDGanttSplitterHandle*)s->wid)->setOrientation( o ); | 563 | ((KDGanttSplitterHandle*)s->wid)->setOrientation( o ); |
553 | s = data->list.next(); // ### next at end of loop, no iterator | 564 | s = data->list.next(); // ### next at end of loop, no iterator |
554 | } | 565 | } |
555 | recalc( isVisible() ); | 566 | recalc( isVisible() ); |
556 | #endif | 567 | #endif |
557 | } | 568 | } |
558 | 569 | ||
559 | 570 | ||
560 | #if QT_VERSION >= 232 | 571 | #if QT_VERSION >= 232 |
@@ -573,81 +584,87 @@ void KDGanttMinimizeSplitter::resizeEvent( QResizeEvent * ) | |||
573 | 584 | ||
574 | It is the responsibility of the caller of this function to make sure | 585 | It is the responsibility of the caller of this function to make sure |
575 | that \a w is not already in the splitter and to call recalcId if | 586 | that \a w is not already in the splitter and to call recalcId if |
576 | needed. (If \a first is TRUE, then recalcId is very probably | 587 | needed. (If \a first is TRUE, then recalcId is very probably |
577 | needed.) | 588 | needed.) |
578 | */ | 589 | */ |
579 | QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool first ) | 590 | QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool first ) |
580 | { | 591 | { |
581 | QSplitterLayoutStruct *s; | 592 | QSplitterLayoutStruct *s; |
582 | KDGanttSplitterHandle *newHandle = 0; | 593 | KDGanttSplitterHandle *newHandle = 0; |
583 | if ( data->list.count() > 0 ) { | 594 | if ( data->list.count() > 0 ) { |
584 | s = new QSplitterLayoutStruct; | 595 | s = new QSplitterLayoutStruct; |
585 | s->mode = KeepSize; | 596 | s->mode = KeepSize; |
586 | QString tmp = "qt_splithandle_"; | 597 | QString tmp = "qt_splithandle_"; |
587 | tmp += w->name(); | 598 | tmp += w->name(); |
588 | newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() ); | 599 | newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() ); |
589 | if ( ! mFirstHandle ) | 600 | if ( ! mFirstHandle ) |
590 | mFirstHandle = newHandle; | 601 | mFirstHandle = newHandle; |
591 | s->wid = newHandle; | 602 | s->wid = newHandle; |
592 | newHandle->setId(data->list.count()); | 603 | newHandle->setId(data->list.count()); |
593 | s->isSplitter = TRUE; | 604 | s->isSplitter = TRUE; |
594 | s->sizer = pick( newHandle->sizeHint() ); | 605 | s->sizer = pick( newHandle->sizeHint() ); |
595 | if ( first ) | 606 | if ( first ) |
596 | data->list.insert( 0, s ); | 607 | data->list.insert( 0, s ); |
597 | else | 608 | else |
598 | data->list.append( s ); | 609 | data->list.append( s ); |
599 | } | 610 | } |
600 | s = new QSplitterLayoutStruct; | 611 | s = new QSplitterLayoutStruct; |
601 | s->mode = Stretch; | 612 | s->mode = Stretch; |
602 | s->wid = w; | 613 | s->wid = w; |
603 | if ( !testWState( WState_Resized ) && w->sizeHint().isValid() ) | 614 | if ( !testAttribute( Qt::WA_Resized ) && w->sizeHint().isValid() ) |
604 | s->sizer = pick( w->sizeHint() ); | 615 | s->sizer = pick( w->sizeHint() ); |
605 | else | 616 | else |
606 | s->sizer = pick( w->size() ); | 617 | s->sizer = pick( w->size() ); |
607 | s->isSplitter = FALSE; | 618 | s->isSplitter = FALSE; |
608 | if ( first ) | 619 | if ( first ) |
609 | data->list.insert( 0, s ); | 620 | data->list.insert( 0, s ); |
610 | else | 621 | else |
611 | data->list.append( s ); | 622 | data->list.append( s ); |
612 | if ( newHandle && isVisible() ) | 623 | if ( newHandle && isVisible() ) |
613 | newHandle->show(); //will trigger sending of post events | 624 | newHandle->show(); //will trigger sending of post events |
614 | return s; | 625 | return s; |
615 | } | 626 | } |
616 | 627 | ||
617 | 628 | ||
618 | /*! | 629 | /*! |
619 | Tells the splitter that a child widget has been inserted or removed. | 630 | Tells the splitter that a child widget has been inserted or removed. |
620 | The event is passed in \a c. | 631 | The event is passed in \a c. |
621 | */ | 632 | */ |
622 | void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | 633 | void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) |
623 | { | 634 | { |
624 | if ( c->type() == QEvent::ChildInserted ) { | 635 | if ( c->type() == QEvent::ChildAdded ) { |
625 | if ( !c->child()->isWidgetType() ) | 636 | if ( !c->child()->isWidgetType() ) |
626 | return; | 637 | return; |
627 | 638 | ||
628 | if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) ) | 639 | QWidget *cw = (QWidget*)c->child(); |
640 | |||
641 | if ( (cw->windowFlags())&Qt::Window ) | ||
642 | return; | ||
643 | |||
644 | // avoid infinite recursion | ||
645 | if(cw->objectName().startsWith("qt_splithandle_")) | ||
629 | return; | 646 | return; |
630 | 647 | ||
631 | QSplitterLayoutStruct *s = data->list.first(); | 648 | QSplitterLayoutStruct *s = data->list.first(); |
632 | while ( s ) { | 649 | while ( s ) { |
633 | if ( s->wid == c->child() ) | 650 | if ( s->wid == cw ) |
634 | return; | 651 | return; |
635 | s = data->list.next(); | 652 | s = data->list.next(); |
636 | } | 653 | } |
637 | addWidget( (QWidget*)c->child() ); | 654 | addWidget( cw ); |
638 | recalc( isVisible() ); | 655 | recalc( isVisible() ); |
639 | 656 | ||
640 | } else if ( c->type() == QEvent::ChildRemoved ) { | 657 | } else if ( c->type() == QEvent::ChildRemoved ) { |
641 | QSplitterLayoutStruct *p = 0; | 658 | QSplitterLayoutStruct *p = 0; |
642 | if ( data->list.count() > 1 ) | 659 | if ( data->list.count() > 1 ) |
643 | p = data->list.at(1); //remove handle _after_ first widget. | 660 | p = data->list.at(1); //remove handle _after_ first widget. |
644 | QSplitterLayoutStruct *s = data->list.first(); | 661 | QSplitterLayoutStruct *s = data->list.first(); |
645 | while ( s ) { | 662 | while ( s ) { |
646 | if ( s->wid == c->child() ) { | 663 | if ( s->wid == c->child() ) { |
647 | data->list.removeRef( s ); | 664 | data->list.removeRef( s ); |
648 | delete s; | 665 | delete s; |
649 | if ( p && p->isSplitter ) { | 666 | if ( p && p->isSplitter ) { |
650 | data->list.removeRef( p ); | 667 | data->list.removeRef( p ); |
651 | delete p->wid; //will call childEvent | 668 | delete p->wid; //will call childEvent |
652 | delete p; | 669 | delete p; |
653 | } | 670 | } |
@@ -657,118 +674,118 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
657 | } | 674 | } |
658 | p = s; | 675 | p = s; |
659 | s = data->list.next(); | 676 | s = data->list.next(); |
660 | } | 677 | } |
661 | } | 678 | } |
662 | } | 679 | } |
663 | 680 | ||
664 | 681 | ||
665 | /*! | 682 | /*! |
666 | Shows a rubber band at position \a p. If \a p is negative, the | 683 | Shows a rubber band at position \a p. If \a p is negative, the |
667 | rubber band is removed. | 684 | rubber band is removed. |
668 | */ | 685 | */ |
669 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 686 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
670 | { | 687 | { |
671 | #ifdef DESKTOP_VERSION | 688 | #ifdef DESKTOP_VERSION |
672 | QPainter paint( this ); | 689 | QPainter paint( this ); |
673 | paint.setPen( gray ); | 690 | paint.setPen( Qt::gray ); |
674 | paint.setBrush( gray ); | 691 | paint.setBrush( Qt::gray ); |
675 | paint.setRasterOp( XorROP ); | 692 | paint.setCompositionMode( QPainter::CompositionMode_Xor ); |
676 | QRect r = contentsRect(); | 693 | QRect r = contentsRect(); |
677 | const int rBord = 3; //Themable???? | 694 | const int rBord = 3; //Themable???? |
678 | #if QT_VERSION >= 0x030000 | 695 | #if QT_VERSION >= 0x030000 |
679 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 696 | int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this); |
680 | #else | 697 | #else |
681 | int sw = style().splitterWidth(); | 698 | int sw = style().splitterWidth(); |
682 | #endif | 699 | #endif |
683 | if ( orient == Horizontal ) { | 700 | if ( orient == Qt::Horizontal ) { |
684 | if ( opaqueOldPos >= 0 ) | 701 | if ( opaqueOldPos >= 0 ) |
685 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 702 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
686 | 2*rBord, r.height() ); | 703 | 2*rBord, r.height() ); |
687 | if ( p >= 0 ) | 704 | if ( p >= 0 ) |
688 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 705 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
689 | } else { | 706 | } else { |
690 | if ( opaqueOldPos >= 0 ) | 707 | if ( opaqueOldPos >= 0 ) |
691 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 708 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
692 | r.width(), 2*rBord ); | 709 | r.width(), 2*rBord ); |
693 | if ( p >= 0 ) | 710 | if ( p >= 0 ) |
694 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 711 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
695 | } | 712 | } |
696 | opaqueOldPos = p; | 713 | opaqueOldPos = p; |
697 | #else | 714 | #else |
698 | if ( !mRubberBand ) { | 715 | if ( !mRubberBand ) { |
699 | mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | 716 | mRubberBand = new KDRubberBand( 0, "rubber", Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); |
700 | mRubberBand->setFrameStyle( Box | Raised ); | 717 | mRubberBand->setFrameStyle( Box | Raised ); |
701 | //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); | 718 | //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); |
702 | mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); | 719 | mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); |
703 | } | 720 | } |
704 | QRect r = contentsRect(); | 721 | QRect r = contentsRect(); |
705 | static int rBord = 0; //Themable???? | 722 | static int rBord = 0; //Themable???? |
706 | if ( !rBord ) { | 723 | if ( !rBord ) { |
707 | if (QApplication::desktop()->width() <= 320 ) | 724 | if (QApplication::desktop()->width() <= 320 ) |
708 | rBord = 3; | 725 | rBord = 3; |
709 | else | 726 | else |
710 | rBord = 4; | 727 | rBord = 4; |
711 | } | 728 | } |
712 | int sw = style().splitterWidth(); | 729 | int sw = style().splitterWidth(); |
713 | if ( orient == Horizontal ) { | 730 | if ( orient == Qt::Horizontal ) { |
714 | if ( p >= 0 ) { | 731 | if ( p >= 0 ) { |
715 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | 732 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); |
716 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | 733 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); |
717 | } | 734 | } |
718 | } else { | 735 | } else { |
719 | if ( p >= 0 ) { | 736 | if ( p >= 0 ) { |
720 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | 737 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); |
721 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | 738 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); |
722 | } | 739 | } |
723 | } | 740 | } |
724 | opaqueOldPos = p; | 741 | opaqueOldPos = p; |
725 | if ( ! mRubberBand->isVisible() ) { | 742 | if ( ! mRubberBand->isVisible() ) { |
726 | mRubberBand->show(); | 743 | mRubberBand->show(); |
727 | } | 744 | } |
728 | #endif | 745 | #endif |
729 | } | 746 | } |
730 | 747 | ||
731 | 748 | ||
732 | /*! \reimp */ | 749 | /*! \reimp */ |
733 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 750 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
734 | { | 751 | { |
735 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 752 | if ( e->type() == QEvent::LayoutRequest || ( e->type() == QEvent::Show && data->firstShow ) ) { |
736 | recalc( isVisible() ); | 753 | recalc( isVisible() ); |
737 | if ( e->type() == QEvent::Show ) | 754 | if ( e->type() == QEvent::Show ) |
738 | data->firstShow = FALSE; | 755 | data->firstShow = FALSE; |
739 | } | 756 | } |
740 | return QWidget::event( e ); | 757 | return QWidget::event( e ); |
741 | } | 758 | } |
742 | 759 | ||
743 | 760 | ||
744 | /*! | 761 | /*! |
745 | \obsolete | 762 | \obsolete |
746 | 763 | ||
747 | Draws the splitter handle in the rectangle described by \a x, \a y, | 764 | Draws the splitter handle in the rectangle described by \a x, \a y, |
748 | \a w, \a h using painter \a p. | 765 | \a w, \a h using painter \a p. |
749 | \sa QStyle::drawPrimitive() | 766 | \sa QStyle::drawPrimitive() |
750 | */ | 767 | */ |
751 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 768 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
752 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 769 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
753 | { | 770 | { |
754 | #if 0 | 771 | #if 0 |
755 | // LR | 772 | // LR |
756 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 773 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
757 | (orientation() == Qt::Horizontal ? | 774 | (orientation() == Qt::Horizontal ? |
758 | QStyle::Style_Horizontal : 0)); | 775 | QStyle::State_Horizontal : 0)); |
759 | #endif | 776 | #endif |
760 | } | 777 | } |
761 | 778 | ||
762 | 779 | ||
763 | /*! | 780 | /*! |
764 | Returns the id of the splitter to the right of or below the widget \a w, | 781 | Returns the id of the splitter to the right of or below the widget \a w, |
765 | or 0 if there is no such splitter | 782 | or 0 if there is no such splitter |
766 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). | 783 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). |
767 | */ | 784 | */ |
768 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const | 785 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const |
769 | { | 786 | { |
770 | QSplitterLayoutStruct *s = data->list.first(); | 787 | QSplitterLayoutStruct *s = data->list.first(); |
771 | bool seen_w = FALSE; | 788 | bool seen_w = FALSE; |
772 | while ( s ) { | 789 | while ( s ) { |
773 | if ( s->isSplitter && seen_w ) | 790 | if ( s->isSplitter && seen_w ) |
774 | return data->list.at(); | 791 | return data->list.at(); |
@@ -783,93 +800,93 @@ int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const | |||
783 | /*! | 800 | /*! |
784 | Moves the left/top edge of the splitter handle with id \a id as | 801 | Moves the left/top edge of the splitter handle with id \a id as |
785 | close as possible to position \a p, which is the distance from the | 802 | close as possible to position \a p, which is the distance from the |
786 | left (or top) edge of the widget. | 803 | left (or top) edge of the widget. |
787 | 804 | ||
788 | For Arabic and Hebrew the layout is reversed, and using this | 805 | For Arabic and Hebrew the layout is reversed, and using this |
789 | function to set the position of the splitter might lead to | 806 | function to set the position of the splitter might lead to |
790 | unexpected results, since in Arabic and Hebrew the position of | 807 | unexpected results, since in Arabic and Hebrew the position of |
791 | splitter one is to the left of the position of splitter zero. | 808 | splitter one is to the left of the position of splitter zero. |
792 | 809 | ||
793 | \sa idAfter() | 810 | \sa idAfter() |
794 | */ | 811 | */ |
795 | void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id ) | 812 | void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id ) |
796 | { | 813 | { |
797 | p = adjustPos( p, id ); | 814 | p = adjustPos( p, id ); |
798 | QSplitterLayoutStruct *s = data->list.at(id); | 815 | QSplitterLayoutStruct *s = data->list.at(id); |
799 | int oldP = orient == Horizontal ? s->wid->x() : s->wid->y(); | 816 | int oldP = orient == Qt::Horizontal ? s->wid->x() : s->wid->y(); |
800 | bool upLeft; | 817 | bool upLeft; |
801 | if ( false && orient == Horizontal ) { | 818 | if ( false && orient == Qt::Horizontal ) { |
802 | p += s->wid->width(); | 819 | p += s->wid->width(); |
803 | upLeft = p > oldP; | 820 | upLeft = p > oldP; |
804 | } else | 821 | } else |
805 | upLeft = p < oldP; | 822 | upLeft = p < oldP; |
806 | 823 | ||
807 | moveAfter( p, id, upLeft ); | 824 | moveAfter( p, id, upLeft ); |
808 | moveBefore( p-1, id-1, upLeft ); | 825 | moveBefore( p-1, id-1, upLeft ); |
809 | 826 | ||
810 | storeSizes(); | 827 | storeSizes(); |
811 | } | 828 | } |
812 | 829 | ||
813 | 830 | ||
814 | void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter ) | 831 | void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter ) |
815 | { | 832 | { |
816 | if ( orient == Horizontal ) { | 833 | if ( orient == Qt::Horizontal ) { |
817 | if ( false && orient == Horizontal && !isSplitter ) | 834 | if ( false && orient == Qt::Horizontal && !isSplitter ) |
818 | p = contentsRect().width() - p - s; | 835 | p = contentsRect().width() - p - s; |
819 | w->setGeometry( p, contentsRect().y(), s, contentsRect().height() ); | 836 | w->setGeometry( p, contentsRect().y(), s, contentsRect().height() ); |
820 | } else | 837 | } else |
821 | w->setGeometry( contentsRect().x(), p, contentsRect().width(), s ); | 838 | w->setGeometry( contentsRect().x(), p, contentsRect().width(), s ); |
822 | } | 839 | } |
823 | 840 | ||
824 | 841 | ||
825 | /* | 842 | /* |
826 | Places the right/bottom edge of the widget at \a id at position \a pos. | 843 | Places the right/bottom edge of the widget at \a id at position \a pos. |
827 | 844 | ||
828 | \sa idAfter() | 845 | \sa idAfter() |
829 | */ | 846 | */ |
830 | void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft ) | 847 | void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft ) |
831 | { | 848 | { |
832 | if( id < 0 ) | 849 | if( id < 0 ) |
833 | return; | 850 | return; |
834 | QSplitterLayoutStruct *s = data->list.at(id); | 851 | QSplitterLayoutStruct *s = data->list.at(id); |
835 | if ( !s ) | 852 | if ( !s ) |
836 | return; | 853 | return; |
837 | QWidget *w = s->wid; | 854 | QWidget *w = s->wid; |
838 | if ( w->isHidden() ) { | 855 | if ( w->isHidden() ) { |
839 | moveBefore( pos, id-1, upLeft ); | 856 | moveBefore( pos, id-1, upLeft ); |
840 | } else if ( s->isSplitter ) { | 857 | } else if ( s->isSplitter ) { |
841 | int pos1, pos2; | 858 | int pos1, pos2; |
842 | int dd = s->sizer; | 859 | int dd = s->sizer; |
843 | if( false && orient == Horizontal ) { | 860 | if( false && orient == Qt::Horizontal ) { |
844 | pos1 = pos; | 861 | pos1 = pos; |
845 | pos2 = pos + dd; | 862 | pos2 = pos + dd; |
846 | } else { | 863 | } else { |
847 | pos2 = pos - dd; | 864 | pos2 = pos - dd; |
848 | pos1 = pos2 + 1; | 865 | pos1 = pos2 + 1; |
849 | } | 866 | } |
850 | if ( upLeft ) { | 867 | if ( upLeft ) { |
851 | setG( w, pos1, dd, TRUE ); | 868 | setG( w, pos1, dd, TRUE ); |
852 | moveBefore( pos2, id-1, upLeft ); | 869 | moveBefore( pos2, id-1, upLeft ); |
853 | } else { | 870 | } else { |
854 | moveBefore( pos2, id-1, upLeft ); | 871 | moveBefore( pos2, id-1, upLeft ); |
855 | setG( w, pos1, dd, TRUE ); | 872 | setG( w, pos1, dd, TRUE ); |
856 | } | 873 | } |
857 | } else { | 874 | } else { |
858 | int dd, newLeft, nextPos; | 875 | int dd, newLeft, nextPos; |
859 | if( false && orient == Horizontal ) { | 876 | if( false && orient == Qt::Horizontal ) { |
860 | dd = w->geometry().right() - pos; | 877 | dd = w->geometry().right() - pos; |
861 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); | 878 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); |
862 | newLeft = pos+1; | 879 | newLeft = pos+1; |
863 | nextPos = newLeft + dd; | 880 | nextPos = newLeft + dd; |
864 | } else { | 881 | } else { |
865 | dd = pos - pick( w->pos() ) + 1; | 882 | dd = pos - pick( w->pos() ) + 1; |
866 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); | 883 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); |
867 | newLeft = pos-dd+1; | 884 | newLeft = pos-dd+1; |
868 | nextPos = newLeft - 1; | 885 | nextPos = newLeft - 1; |
869 | } | 886 | } |
870 | setG( w, newLeft, dd, TRUE ); | 887 | setG( w, newLeft, dd, TRUE ); |
871 | moveBefore( nextPos, id-1, upLeft ); | 888 | moveBefore( nextPos, id-1, upLeft ); |
872 | } | 889 | } |
873 | } | 890 | } |
874 | 891 | ||
875 | 892 | ||
@@ -880,50 +897,50 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft ) | |||
880 | */ | 897 | */ |
881 | void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft ) | 898 | void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft ) |
882 | { | 899 | { |
883 | QSplitterLayoutStruct *s = id < int(data->list.count()) ? | 900 | QSplitterLayoutStruct *s = id < int(data->list.count()) ? |
884 | data->list.at(id) : 0; | 901 | data->list.at(id) : 0; |
885 | if ( !s ) | 902 | if ( !s ) |
886 | return; | 903 | return; |
887 | QWidget *w = s->wid; | 904 | QWidget *w = s->wid; |
888 | if ( w->isHidden() ) { | 905 | if ( w->isHidden() ) { |
889 | moveAfter( pos, id+1, upLeft ); | 906 | moveAfter( pos, id+1, upLeft ); |
890 | } else if ( pick( w->pos() ) == pos ) { | 907 | } else if ( pick( w->pos() ) == pos ) { |
891 | //No need to do anything if it's already there. | 908 | //No need to do anything if it's already there. |
892 | return; | 909 | return; |
893 | } else if ( s->isSplitter ) { | 910 | } else if ( s->isSplitter ) { |
894 | int dd = s->sizer; | 911 | int dd = s->sizer; |
895 | int pos1, pos2; | 912 | int pos1, pos2; |
896 | if( false && orient == Horizontal ) { | 913 | if( false && orient == Qt::Horizontal ) { |
897 | pos2 = pos - dd; | 914 | pos2 = pos - dd; |
898 | pos1 = pos2 + 1; | 915 | pos1 = pos2 + 1; |
899 | } else { | 916 | } else { |
900 | pos1 = pos; | 917 | pos1 = pos; |
901 | pos2 = pos + dd; | 918 | pos2 = pos + dd; |
902 | } | 919 | } |
903 | if ( upLeft ) { | 920 | if ( upLeft ) { |
904 | setG( w, pos1, dd, TRUE ); | 921 | setG( w, pos1, dd, TRUE ); |
905 | moveAfter( pos2, id+1, upLeft ); | 922 | moveAfter( pos2, id+1, upLeft ); |
906 | } else { | 923 | } else { |
907 | moveAfter( pos2, id+1, upLeft ); | 924 | moveAfter( pos2, id+1, upLeft ); |
908 | setG( w, pos1, dd, TRUE ); | 925 | setG( w, pos1, dd, TRUE ); |
909 | } | 926 | } |
910 | } else { | 927 | } else { |
911 | int left = pick( w->pos() ); | 928 | int left = pick( w->pos() ); |
912 | int right, dd,/* newRight,*/ newLeft, nextPos; | 929 | int right, dd,/* newRight,*/ newLeft, nextPos; |
913 | if ( false && orient == Horizontal ) { | 930 | if ( false && orient == Qt::Horizontal ) { |
914 | dd = pos - left + 1; | 931 | dd = pos - left + 1; |
915 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); | 932 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); |
916 | newLeft = pos-dd+1; | 933 | newLeft = pos-dd+1; |
917 | nextPos = newLeft - 1; | 934 | nextPos = newLeft - 1; |
918 | } else { | 935 | } else { |
919 | right = pick( w->geometry().bottomRight() ); | 936 | right = pick( w->geometry().bottomRight() ); |
920 | dd = right - pos + 1; | 937 | dd = right - pos + 1; |
921 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); | 938 | dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); |
922 | /*newRight = pos+dd-1;*/ | 939 | /*newRight = pos+dd-1;*/ |
923 | newLeft = pos; | 940 | newLeft = pos; |
924 | nextPos = newLeft + dd; | 941 | nextPos = newLeft + dd; |
925 | } | 942 | } |
926 | setG( w, newLeft, dd, TRUE ); | 943 | setG( w, newLeft, dd, TRUE ); |
927 | /*if( right != newRight )*/ | 944 | /*if( right != newRight )*/ |
928 | moveAfter( nextPos, id+1, upLeft ); | 945 | moveAfter( nextPos, id+1, upLeft ); |
929 | } | 946 | } |
@@ -975,35 +992,35 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) | |||
975 | maxB += pick( s->wid->maximumSize() ); | 992 | maxB += pick( s->wid->maximumSize() ); |
976 | } | 993 | } |
977 | } | 994 | } |
978 | for ( i = id; i < n; i++ ) { | 995 | for ( i = id; i < n; i++ ) { |
979 | QSplitterLayoutStruct *s = data->list.at(i); | 996 | QSplitterLayoutStruct *s = data->list.at(i); |
980 | if ( s->wid->isHidden() ) { | 997 | if ( s->wid->isHidden() ) { |
981 | //ignore | 998 | //ignore |
982 | } else if ( s->isSplitter ) { | 999 | } else if ( s->isSplitter ) { |
983 | minA += s->sizer; | 1000 | minA += s->sizer; |
984 | maxA += s->sizer; | 1001 | maxA += s->sizer; |
985 | } else { | 1002 | } else { |
986 | minA += pick( minSize(s->wid) ); | 1003 | minA += pick( minSize(s->wid) ); |
987 | maxA += pick( s->wid->maximumSize() ); | 1004 | maxA += pick( s->wid->maximumSize() ); |
988 | } | 1005 | } |
989 | } | 1006 | } |
990 | QRect r = contentsRect(); | 1007 | QRect r = contentsRect(); |
991 | if ( orient == Horizontal && false ) { | 1008 | if ( orient == Qt::Horizontal && false ) { |
992 | #if QT_VERSION >= 0x030000 | 1009 | #if QT_VERSION >= 0x030000 |
993 | int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 1010 | int splitterWidth = style()->pixelMetric(QStyle::PM_SplitterWidth, 0,this); |
994 | #else | 1011 | #else |
995 | int splitterWidth = style().splitterWidth(); | 1012 | int splitterWidth = style().splitterWidth(); |
996 | #endif | 1013 | #endif |
997 | 1014 | ||
998 | if ( min ) | 1015 | if ( min ) |
999 | *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; | 1016 | *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; |
1000 | if ( max ) | 1017 | if ( max ) |
1001 | *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth; | 1018 | *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth; |
1002 | } else { | 1019 | } else { |
1003 | if ( min ) | 1020 | if ( min ) |
1004 | *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); | 1021 | *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); |
1005 | if ( max ) | 1022 | if ( max ) |
1006 | *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); | 1023 | *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); |
1007 | } | 1024 | } |
1008 | } | 1025 | } |
1009 | 1026 | ||
@@ -1017,33 +1034,33 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) | |||
1017 | int KDGanttMinimizeSplitter::adjustPos( int p, int id ) | 1034 | int KDGanttMinimizeSplitter::adjustPos( int p, int id ) |
1018 | { | 1035 | { |
1019 | int min = 0; | 1036 | int min = 0; |
1020 | int max = 0; | 1037 | int max = 0; |
1021 | getRange( id, &min, &max ); | 1038 | getRange( id, &min, &max ); |
1022 | p = QMAX( min, QMIN( p, max ) ); | 1039 | p = QMAX( min, QMIN( p, max ) ); |
1023 | 1040 | ||
1024 | return p; | 1041 | return p; |
1025 | } | 1042 | } |
1026 | 1043 | ||
1027 | 1044 | ||
1028 | void KDGanttMinimizeSplitter::doResize() | 1045 | void KDGanttMinimizeSplitter::doResize() |
1029 | { | 1046 | { |
1030 | QRect r = contentsRect(); | 1047 | QRect r = contentsRect(); |
1031 | int i; | 1048 | int i; |
1032 | int n = data->list.count(); | 1049 | int n = data->list.count(); |
1033 | QMemArray<QLayoutStruct> a( n ); | 1050 | Q3MemArray<QLayoutStruct> a( n ); |
1034 | for ( i = 0; i< n; i++ ) { | 1051 | for ( i = 0; i< n; i++ ) { |
1035 | a[i].init(); | 1052 | a[i].init(); |
1036 | QSplitterLayoutStruct *s = data->list.at(i); | 1053 | QSplitterLayoutStruct *s = data->list.at(i); |
1037 | if ( s->wid->isHidden() ) { | 1054 | if ( s->wid->isHidden() ) { |
1038 | a[i].stretch = 0; | 1055 | a[i].stretch = 0; |
1039 | a[i].sizeHint = a[i].minimumSize = 0; | 1056 | a[i].sizeHint = a[i].minimumSize = 0; |
1040 | a[i].maximumSize = 0; | 1057 | a[i].maximumSize = 0; |
1041 | } else if ( s->isSplitter ) { | 1058 | } else if ( s->isSplitter ) { |
1042 | a[i].stretch = 0; | 1059 | a[i].stretch = 0; |
1043 | a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer; | 1060 | a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer; |
1044 | a[i].empty = FALSE; | 1061 | a[i].empty = FALSE; |
1045 | } else if ( s->mode == KeepSize ) { | 1062 | } else if ( s->mode == KeepSize ) { |
1046 | a[i].stretch = 0; | 1063 | a[i].stretch = 0; |
1047 | a[i].minimumSize = pick( minSize(s->wid) ); | 1064 | a[i].minimumSize = pick( minSize(s->wid) ); |
1048 | a[i].sizeHint = s->sizer; | 1065 | a[i].sizeHint = s->sizer; |
1049 | a[i].maximumSize = pick( s->wid->maximumSize() ); | 1066 | a[i].maximumSize = pick( s->wid->maximumSize() ); |
@@ -1119,33 +1136,33 @@ void KDGanttMinimizeSplitter::recalc( bool update ) | |||
1119 | } | 1136 | } |
1120 | } | 1137 | } |
1121 | if ( empty ) { | 1138 | if ( empty ) { |
1122 | if ( parentWidget() != 0 && parentWidget()->inherits("KDGanttMinimizeSplitter") ) { | 1139 | if ( parentWidget() != 0 && parentWidget()->inherits("KDGanttMinimizeSplitter") ) { |
1123 | // nested splitters; be nice | 1140 | // nested splitters; be nice |
1124 | maxl = maxt = 0; | 1141 | maxl = maxt = 0; |
1125 | } else { | 1142 | } else { |
1126 | // KDGanttMinimizeSplitter with no children yet | 1143 | // KDGanttMinimizeSplitter with no children yet |
1127 | maxl = QWIDGETSIZE_MAX; | 1144 | maxl = QWIDGETSIZE_MAX; |
1128 | } | 1145 | } |
1129 | } else { | 1146 | } else { |
1130 | maxl = QMIN( maxl, QWIDGETSIZE_MAX ); | 1147 | maxl = QMIN( maxl, QWIDGETSIZE_MAX ); |
1131 | } | 1148 | } |
1132 | if ( maxt < mint ) | 1149 | if ( maxt < mint ) |
1133 | maxt = mint; | 1150 | maxt = mint; |
1134 | 1151 | ||
1135 | if ( orient == Horizontal ) { | 1152 | if ( orient == Qt::Horizontal ) { |
1136 | setMaximumSize( maxl, maxt ); | 1153 | setMaximumSize( maxl, maxt ); |
1137 | setMinimumSize( minl, mint ); | 1154 | setMinimumSize( minl, mint ); |
1138 | } else { | 1155 | } else { |
1139 | setMaximumSize( maxt, maxl ); | 1156 | setMaximumSize( maxt, maxl ); |
1140 | setMinimumSize( mint, minl ); | 1157 | setMinimumSize( mint, minl ); |
1141 | } | 1158 | } |
1142 | if ( update ) | 1159 | if ( update ) |
1143 | doResize(); | 1160 | doResize(); |
1144 | } | 1161 | } |
1145 | 1162 | ||
1146 | /*! | 1163 | /*! |
1147 | Sets resize mode of \a w to \a mode. | 1164 | Sets resize mode of \a w to \a mode. |
1148 | 1165 | ||
1149 | \sa ResizeMode | 1166 | \sa ResizeMode |
1150 | */ | 1167 | */ |
1151 | 1168 | ||
@@ -1254,80 +1271,74 @@ void KDGanttMinimizeSplitter::recalcId() | |||
1254 | int n = data->list.count(); | 1271 | int n = data->list.count(); |
1255 | for ( int i = 0; i < n; i++ ) { | 1272 | for ( int i = 0; i < n; i++ ) { |
1256 | QSplitterLayoutStruct *s = data->list.at(i); | 1273 | QSplitterLayoutStruct *s = data->list.at(i); |
1257 | if ( s->isSplitter ) | 1274 | if ( s->isSplitter ) |
1258 | ((KDGanttSplitterHandle*)s->wid)->setId(i); | 1275 | ((KDGanttSplitterHandle*)s->wid)->setId(i); |
1259 | } | 1276 | } |
1260 | } | 1277 | } |
1261 | 1278 | ||
1262 | 1279 | ||
1263 | /*!\reimp | 1280 | /*!\reimp |
1264 | */ | 1281 | */ |
1265 | QSize KDGanttMinimizeSplitter::sizeHint() const | 1282 | QSize KDGanttMinimizeSplitter::sizeHint() const |
1266 | { | 1283 | { |
1267 | constPolish(); | 1284 | constPolish(); |
1268 | int l = 0; | 1285 | int l = 0; |
1269 | int t = 0; | 1286 | int t = 0; |
1270 | if ( children() ) { | 1287 | if ( !children().empty() ) { |
1271 | const QObjectList * c = children(); | 1288 | const QObjectList c = children(); |
1272 | QObjectListIt it( *c ); | 1289 | for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) { |
1273 | QObject * o; | 1290 | QObject * o = *i; |
1274 | |||
1275 | while( (o=it.current()) != 0 ) { | ||
1276 | ++it; | ||
1277 | if ( o->isWidgetType() && | 1291 | if ( o->isWidgetType() && |
1278 | !((QWidget*)o)->isHidden() ) { | 1292 | !((QWidget*)o)->isHidden() ) { |
1279 | QSize s = ((QWidget*)o)->sizeHint(); | 1293 | QSize s = ((QWidget*)o)->sizeHint(); |
1280 | if ( s.isValid() ) { | 1294 | if ( s.isValid() ) { |
1281 | l += pick( s ); | 1295 | l += pick( s ); |
1282 | t = QMAX( t, trans( s ) ); | 1296 | t = QMAX( t, trans( s ) ); |
1283 | } | 1297 | } |
1284 | } | 1298 | } |
1285 | } | 1299 | } |
1286 | } | 1300 | } |
1287 | return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l ); | 1301 | return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l ); |
1288 | } | 1302 | } |
1289 | 1303 | ||
1290 | 1304 | ||
1291 | /*! | 1305 | /*! |
1292 | \reimp | 1306 | \reimp |
1293 | */ | 1307 | */ |
1294 | 1308 | ||
1295 | QSize KDGanttMinimizeSplitter::minimumSizeHint() const | 1309 | QSize KDGanttMinimizeSplitter::minimumSizeHint() const |
1296 | { | 1310 | { |
1297 | constPolish(); | 1311 | constPolish(); |
1298 | int l = 0; | 1312 | int l = 0; |
1299 | int t = 0; | 1313 | int t = 0; |
1300 | if ( children() ) { | 1314 | if ( !children().empty() ) { |
1301 | const QObjectList * c = children(); | 1315 | const QObjectList c = children(); |
1302 | QObjectListIt it( *c ); | 1316 | for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) { |
1303 | QObject * o; | 1317 | QObject * o = *i; |
1304 | |||
1305 | while( (o=it.current()) != 0 ) { | ||
1306 | ++it; | ||
1307 | if ( o->isWidgetType() && | 1318 | if ( o->isWidgetType() && |
1308 | !((QWidget*)o)->isHidden() ) { | 1319 | !((QWidget*)o)->isHidden() ) { |
1309 | QSize s = minSizeHint((QWidget*)o); | 1320 | QSize s = minSizeHint((QWidget*)o); |
1310 | if ( s.isValid() ) { | 1321 | if ( s.isValid() ) { |
1311 | l += pick( s ); | 1322 | l += pick( s ); |
1312 | t = QMAX( t, trans( s ) ); | 1323 | t = QMAX( t, trans( s ) ); |
1313 | } | 1324 | } |
1314 | } | 1325 | } |
1315 | } | 1326 | } |
1316 | } | 1327 | } |
1317 | return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l ); | 1328 | return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l ); |
1318 | } | 1329 | } |
1319 | 1330 | ||
1320 | 1331 | ||
1321 | /* | 1332 | /* |
1322 | Calculates stretch parameters from current sizes | 1333 | Calculates stretch parameters from current sizes |
1323 | */ | 1334 | */ |
1324 | 1335 | ||
1325 | void KDGanttMinimizeSplitter::storeSizes() | 1336 | void KDGanttMinimizeSplitter::storeSizes() |
1326 | { | 1337 | { |
1327 | QSplitterLayoutStruct *s = data->list.first(); | 1338 | QSplitterLayoutStruct *s = data->list.first(); |
1328 | while ( s ) { | 1339 | while ( s ) { |
1329 | if ( !s->isSplitter ) | 1340 | if ( !s->isSplitter ) |
1330 | s->sizer = pick( s->wid->size() ); | 1341 | s->sizer = pick( s->wid->size() ); |
1331 | s = data->list.next(); | 1342 | s = data->list.next(); |
1332 | } | 1343 | } |
1333 | } | 1344 | } |
@@ -1389,143 +1400,144 @@ bool KDGanttMinimizeSplitter::isHidden( QWidget *w ) const | |||
1389 | produce a splitter with the same layout as this one. | 1400 | produce a splitter with the same layout as this one. |
1390 | 1401 | ||
1391 | Note that if you want to iterate over the list, you should | 1402 | Note that if you want to iterate over the list, you should |
1392 | iterate over a copy, e.g. | 1403 | iterate over a copy, e.g. |
1393 | \code | 1404 | \code |
1394 | QValueList<int> list = mySplitter.sizes(); | 1405 | QValueList<int> list = mySplitter.sizes(); |
1395 | QValueList<int>::Iterator it = list.begin(); | 1406 | QValueList<int>::Iterator it = list.begin(); |
1396 | while( it != list.end() ) { | 1407 | while( it != list.end() ) { |
1397 | myProcessing( *it ); | 1408 | myProcessing( *it ); |
1398 | ++it; | 1409 | ++it; |
1399 | } | 1410 | } |
1400 | \endcode | 1411 | \endcode |
1401 | 1412 | ||
1402 | \sa setSizes() | 1413 | \sa setSizes() |
1403 | */ | 1414 | */ |
1404 | 1415 | ||
1405 | QValueList<int> KDGanttMinimizeSplitter::sizes() const | 1416 | Q3ValueList<int> KDGanttMinimizeSplitter::sizes() const |
1406 | { | 1417 | { |
1418 | /* TODO: hacker | ||
1407 | if ( !testWState(WState_Polished) ) { | 1419 | if ( !testWState(WState_Polished) ) { |
1408 | QWidget* that = (QWidget*) this; | 1420 | QWidget* that = (QWidget*) this; |
1409 | that->polish(); | 1421 | that->polish(); |
1410 | } | 1422 | } */ |
1411 | QValueList<int> list; | 1423 | Q3ValueList<int> list; |
1412 | QSplitterLayoutStruct *s = data->list.first(); | 1424 | QSplitterLayoutStruct *s = data->list.first(); |
1413 | while ( s ) { | 1425 | while ( s ) { |
1414 | if ( !s->isSplitter ) | 1426 | if ( !s->isSplitter ) |
1415 | list.append( s->sizer ); | 1427 | list.append( s->sizer ); |
1416 | s = data->list.next(); | 1428 | s = data->list.next(); |
1417 | } | 1429 | } |
1418 | return list; | 1430 | return list; |
1419 | } | 1431 | } |
1420 | 1432 | ||
1421 | 1433 | ||
1422 | 1434 | ||
1423 | /*! | 1435 | /*! |
1424 | Sets the size parameters to the values given in \a list. | 1436 | Sets the size parameters to the values given in \a list. |
1425 | If the splitter is horizontal, the values set the sizes from | 1437 | If the splitter is horizontal, the values set the sizes from |
1426 | left to right. If it is vertical, the sizes are applied from | 1438 | left to right. If it is vertical, the sizes are applied from |
1427 | top to bottom. | 1439 | top to bottom. |
1428 | Extra values in \a list are ignored. | 1440 | Extra values in \a list are ignored. |
1429 | 1441 | ||
1430 | If \a list contains too few values, the result is undefined | 1442 | If \a list contains too few values, the result is undefined |
1431 | but the program will still be well-behaved. | 1443 | but the program will still be well-behaved. |
1432 | 1444 | ||
1433 | \sa sizes() | 1445 | \sa sizes() |
1434 | */ | 1446 | */ |
1435 | 1447 | ||
1436 | void KDGanttMinimizeSplitter::setSizes( QValueList<int> list ) | 1448 | void KDGanttMinimizeSplitter::setSizes( Q3ValueList<int> list ) |
1437 | { | 1449 | { |
1438 | processChildEvents(); | 1450 | processChildEvents(); |
1439 | QValueList<int>::Iterator it = list.begin(); | 1451 | Q3ValueList<int>::Iterator it = list.begin(); |
1440 | QSplitterLayoutStruct *s = data->list.first(); | 1452 | QSplitterLayoutStruct *s = data->list.first(); |
1441 | while ( s && it != list.end() ) { | 1453 | while ( s && it != list.end() ) { |
1442 | if ( !s->isSplitter ) { | 1454 | if ( !s->isSplitter ) { |
1443 | s->sizer = *it; | 1455 | s->sizer = *it; |
1444 | ++it; | 1456 | ++it; |
1445 | } | 1457 | } |
1446 | s = data->list.next(); | 1458 | s = data->list.next(); |
1447 | } | 1459 | } |
1448 | doResize(); | 1460 | doResize(); |
1449 | } | 1461 | } |
1450 | 1462 | ||
1451 | 1463 | ||
1452 | /*! | 1464 | /*! |
1453 | Gets all posted child events, ensuring that the internal state of | 1465 | Gets all posted child events, ensuring that the internal state of |
1454 | the splitter is consistent. | 1466 | the splitter is consistent. |
1455 | */ | 1467 | */ |
1456 | 1468 | ||
1457 | void KDGanttMinimizeSplitter::processChildEvents() | 1469 | void KDGanttMinimizeSplitter::processChildEvents() |
1458 | { | 1470 | { |
1459 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); | 1471 | QApplication::sendPostedEvents( this, QEvent::ChildAdded ); |
1460 | } | 1472 | } |
1461 | 1473 | ||
1462 | 1474 | ||
1463 | /*! | 1475 | /*! |
1464 | \reimp | 1476 | \reimp |
1465 | */ | 1477 | */ |
1466 | 1478 | ||
1467 | void KDGanttMinimizeSplitter::styleChange( QStyle& old ) | 1479 | void KDGanttMinimizeSplitter::styleChange( QStyle& old ) |
1468 | { | 1480 | { |
1469 | 1481 | ||
1470 | #if QT_VERSION >= 0x030000 | 1482 | #if QT_VERSION >= 0x030000 |
1471 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 1483 | int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this); |
1472 | #else | 1484 | #else |
1473 | int sw = style().splitterWidth(); | 1485 | int sw = style().splitterWidth(); |
1474 | #endif | 1486 | #endif |
1475 | QSplitterLayoutStruct *s = data->list.first(); | 1487 | QSplitterLayoutStruct *s = data->list.first(); |
1476 | while ( s ) { | 1488 | while ( s ) { |
1477 | if ( s->isSplitter ) | 1489 | if ( s->isSplitter ) |
1478 | s->sizer = sw; | 1490 | s->sizer = sw; |
1479 | s = data->list.next(); | 1491 | s = data->list.next(); |
1480 | } | 1492 | } |
1481 | doResize(); | 1493 | doResize(); |
1482 | QFrame::styleChange( old ); | 1494 | Q3Frame::styleChange( old ); |
1483 | } | 1495 | } |
1484 | 1496 | ||
1485 | #endif | 1497 | #endif |
1486 | 1498 | ||
1487 | /*! | 1499 | /*! |
1488 | Specifies the direction of the minimize buttons. | 1500 | Specifies the direction of the minimize buttons. |
1489 | If the orientation of the splitter is horizontal then with | 1501 | If the orientation of the splitter is horizontal then with |
1490 | KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, | 1502 | KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, |
1491 | otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down | 1503 | otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down |
1492 | should be used. | 1504 | should be used. |
1493 | */ | 1505 | */ |
1494 | void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction ) | 1506 | void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction ) |
1495 | { | 1507 | { |
1496 | _direction = direction; | 1508 | _direction = direction; |
1497 | } | 1509 | } |
1498 | 1510 | ||
1499 | /*! | 1511 | /*! |
1500 | Returns the direction of the minimize buttons. | 1512 | Returns the direction of the minimize buttons. |
1501 | */ | 1513 | */ |
1502 | KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const | 1514 | KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const |
1503 | { | 1515 | { |
1504 | return _direction; | 1516 | return _direction; |
1505 | } | 1517 | } |
1506 | 1518 | ||
1507 | /* | 1519 | /* |
1508 | This is a copy of qGeomCalc() in qlayoutengine.cpp which | 1520 | This is a copy of qGeomCalc() in qlayoutengine.cpp which |
1509 | unfortunately isn't exported. | 1521 | unfortunately isn't exported. |
1510 | */ | 1522 | */ |
1511 | static inline int toFixed( int i ) { return i * 256; } | 1523 | static inline int toFixed( int i ) { return i * 256; } |
1512 | static inline int fRound( int i ) { | 1524 | static inline int fRound( int i ) { |
1513 | return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256; | 1525 | return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256; |
1514 | } | 1526 | } |
1515 | void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, | 1527 | void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos, |
1516 | int space, int spacer ) | 1528 | int space, int spacer ) |
1517 | { | 1529 | { |
1518 | typedef int fixed; | 1530 | typedef int fixed; |
1519 | int cHint = 0; | 1531 | int cHint = 0; |
1520 | int cMin = 0; | 1532 | int cMin = 0; |
1521 | int cMax = 0; | 1533 | int cMax = 0; |
1522 | int sumStretch = 0; | 1534 | int sumStretch = 0; |
1523 | int spacerCount = 0; | 1535 | int spacerCount = 0; |
1524 | 1536 | ||
1525 | bool wannaGrow = FALSE; // anyone who really wants to grow? | 1537 | bool wannaGrow = FALSE; // anyone who really wants to grow? |
1526 | // bool canShrink = FALSE; // anyone who could be persuaded to shrink? | 1538 | // bool canShrink = FALSE; // anyone who could be persuaded to shrink? |
1527 | 1539 | ||
1528 | int i; | 1540 | int i; |
1529 | for ( i = start; i < start + count; i++ ) { | 1541 | for ( i = start; i < start + count; i++ ) { |
1530 | chain[i].done = FALSE; | 1542 | chain[i].done = FALSE; |
1531 | cHint += chain[i].sizeHint; | 1543 | cHint += chain[i].sizeHint; |
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h index 3042e0a..338d965 100644 --- a/microkde/KDGanttMinimizeSplitter.h +++ b/microkde/KDGanttMinimizeSplitter.h | |||
@@ -1,16 +1,23 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3PointArray> | ||
3 | #include <QPaintEvent> | ||
4 | #include <QResizeEvent> | ||
5 | #include <QChildEvent> | ||
6 | #include <QMouseEvent> | ||
7 | #include <QEvent> | ||
1 | /* -*- Mode: C++ -*- | 8 | /* -*- Mode: C++ -*- |
2 | $Id$ | 9 | $Id$ |
3 | */ | 10 | */ |
4 | 11 | ||
5 | /**************************************************************************** | 12 | /**************************************************************************** |
6 | ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved. | 13 | ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved. |
7 | ** | 14 | ** |
8 | ** This file is part of the KDGantt library. | 15 | ** This file is part of the KDGantt library. |
9 | ** | 16 | ** |
10 | ** This file may be distributed and/or modified under the terms of the | 17 | ** This file may be distributed and/or modified under the terms of the |
11 | ** GNU General Public License version 2 as published by the Free Software | 18 | ** GNU General Public License version 2 as published by the Free Software |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 19 | ** Foundation and appearing in the file LICENSE.GPL included in the |
13 | ** packaging of this file. | 20 | ** packaging of this file. |
14 | ** | 21 | ** |
15 | ** Licensees holding valid commercial KDGantt licenses may use this file in | 22 | ** Licensees holding valid commercial KDGantt licenses may use this file in |
16 | ** accordance with the KDGantt Commercial License Agreement provided with | 23 | ** accordance with the KDGantt Commercial License Agreement provided with |
@@ -22,76 +29,76 @@ | |||
22 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for | 29 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for |
23 | ** information about KDGantt Commercial License Agreements. | 30 | ** information about KDGantt Commercial License Agreements. |
24 | ** | 31 | ** |
25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this | 32 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this |
26 | ** licensing are not clear to you. | 33 | ** licensing are not clear to you. |
27 | ** | 34 | ** |
28 | ** As a special exception, permission is given to link this program | 35 | ** As a special exception, permission is given to link this program |
29 | ** with any edition of Qt, and distribute the resulting executable, | 36 | ** with any edition of Qt, and distribute the resulting executable, |
30 | ** without including the source code for Qt in the source distribution. | 37 | ** without including the source code for Qt in the source distribution. |
31 | ** | 38 | ** |
32 | **********************************************************************/ | 39 | **********************************************************************/ |
33 | 40 | ||
34 | #ifndef KDGANTTMINIMIZESPLITTER_H | 41 | #ifndef KDGANTTMINIMIZESPLITTER_H |
35 | #define KDGANTTMINIMIZESPLITTER_H | 42 | #define KDGANTTMINIMIZESPLITTER_H |
36 | 43 | ||
37 | #ifndef QT_H | 44 | #ifndef QT_H |
38 | #include "qframe.h" | 45 | #include "q3frame.h" |
39 | #include "qvaluelist.h" | 46 | #include "q3valuelist.h" |
40 | #endif // QT_H | 47 | #endif // QT_H |
41 | 48 | ||
42 | #ifndef QT_NO_SPLITTER___ | 49 | #ifndef QT_NO_SPLITTER___ |
43 | class QSplitterData; | 50 | class QSplitterData; |
44 | class QSplitterLayoutStruct; | 51 | class QSplitterLayoutStruct; |
45 | class KDGanttSplitterHandle; | 52 | class KDGanttSplitterHandle; |
46 | class KDRubberBand; | 53 | class KDRubberBand; |
47 | class KDGanttMinimizeSplitter : public QFrame | 54 | class KDGanttMinimizeSplitter : public Q3Frame |
48 | { | 55 | { |
49 | Q_OBJECT | 56 | Q_OBJECT |
50 | // Q_ENUMS( Direction ) | 57 | // Q_ENUMS( Direction ) |
51 | // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) | 58 | // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) |
52 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) | 59 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) |
53 | 60 | ||
54 | public: | 61 | public: |
55 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; | 62 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; |
56 | enum Direction { Left, Right, Up, Down }; | 63 | enum Direction { Left, Right, Up, Down }; |
57 | 64 | ||
58 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); | 65 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); |
59 | KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 ); | 66 | KDGanttMinimizeSplitter( Qt::Orientation, QWidget* parent=0, const char* name=0 ); |
60 | ~KDGanttMinimizeSplitter(); | 67 | ~KDGanttMinimizeSplitter(); |
61 | 68 | ||
62 | virtual void setOrientation( Orientation ); | 69 | virtual void setOrientation( Qt::Orientation ); |
63 | Orientation orientation() const { return orient; } | 70 | Qt::Orientation orientation() const { return orient; } |
64 | 71 | ||
65 | void setMinimizeDirection( Direction ); | 72 | void setMinimizeDirection( Direction ); |
66 | Direction minimizeDirection() const; | 73 | Direction minimizeDirection() const; |
67 | 74 | ||
68 | #if QT_VERSION >= 232 | 75 | #if QT_VERSION >= 232 |
69 | virtual void setResizeMode( QWidget *w, ResizeMode ); | 76 | virtual void setResizeMode( QWidget *w, ResizeMode ); |
70 | virtual void setOpaqueResize( bool = TRUE ); | 77 | virtual void setOpaqueResize( bool = TRUE ); |
71 | bool opaqueResize() const; | 78 | bool opaqueResize() const; |
72 | 79 | ||
73 | void moveToFirst( QWidget * ); | 80 | void moveToFirst( QWidget * ); |
74 | void moveToLast( QWidget * ); | 81 | void moveToLast( QWidget * ); |
75 | 82 | ||
76 | void refresh() { recalc( TRUE ); } | 83 | void refresh() { recalc( TRUE ); } |
77 | QSize sizeHint() const; | 84 | QSize sizeHint() const; |
78 | QSize minimumSizeHint() const; | 85 | QSize minimumSizeHint() const; |
79 | 86 | ||
80 | QValueList<int> sizes() const; | 87 | Q3ValueList<int> sizes() const; |
81 | void setSizes( QValueList<int> ); | 88 | void setSizes( Q3ValueList<int> ); |
82 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} | 89 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} |
83 | void expandPos( int id, int* min, int* max ); | 90 | void expandPos( int id, int* min, int* max ); |
84 | KDRubberBand* rubberBand() { return mRubberBand ;} | 91 | KDRubberBand* rubberBand() { return mRubberBand ;} |
85 | public slots: | 92 | public slots: |
86 | void toggle(); | 93 | void toggle(); |
87 | protected: | 94 | protected: |
88 | void childEvent( QChildEvent * ); | 95 | void childEvent( QChildEvent * ); |
89 | 96 | ||
90 | bool event( QEvent * ); | 97 | bool event( QEvent * ); |
91 | void resizeEvent( QResizeEvent * ); | 98 | void resizeEvent( QResizeEvent * ); |
92 | 99 | ||
93 | int idAfter( QWidget* ) const; | 100 | int idAfter( QWidget* ) const; |
94 | 101 | ||
95 | void moveSplitter( QCOORD pos, int id ); | 102 | void moveSplitter( QCOORD pos, int id ); |
96 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, | 103 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, |
97 | QCOORD w, QCOORD h ); | 104 | QCOORD w, QCOORD h ); |
@@ -101,46 +108,46 @@ protected: | |||
101 | void getRange( int id, int*, int* ); | 108 | void getRange( int id, int*, int* ); |
102 | 109 | ||
103 | private: | 110 | private: |
104 | KDRubberBand* mRubberBand; | 111 | KDRubberBand* mRubberBand; |
105 | void init(); | 112 | void init(); |
106 | void recalc( bool update = FALSE ); | 113 | void recalc( bool update = FALSE ); |
107 | void doResize(); | 114 | void doResize(); |
108 | void storeSizes(); | 115 | void storeSizes(); |
109 | void processChildEvents(); | 116 | void processChildEvents(); |
110 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); | 117 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); |
111 | void recalcId(); | 118 | void recalcId(); |
112 | void moveBefore( int pos, int id, bool upLeft ); | 119 | void moveBefore( int pos, int id, bool upLeft ); |
113 | void moveAfter( int pos, int id, bool upLeft ); | 120 | void moveAfter( int pos, int id, bool upLeft ); |
114 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); | 121 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); |
115 | 122 | ||
116 | QCOORD pick( const QPoint &p ) const | 123 | QCOORD pick( const QPoint &p ) const |
117 | { return orient == Horizontal ? p.x() : p.y(); } | 124 | { return orient == Qt::Horizontal ? p.x() : p.y(); } |
118 | QCOORD pick( const QSize &s ) const | 125 | QCOORD pick( const QSize &s ) const |
119 | { return orient == Horizontal ? s.width() : s.height(); } | 126 | { return orient == Qt::Horizontal ? s.width() : s.height(); } |
120 | 127 | ||
121 | QCOORD trans( const QPoint &p ) const | 128 | QCOORD trans( const QPoint &p ) const |
122 | { return orient == Vertical ? p.x() : p.y(); } | 129 | { return orient == Qt::Vertical ? p.x() : p.y(); } |
123 | QCOORD trans( const QSize &s ) const | 130 | QCOORD trans( const QSize &s ) const |
124 | { return orient == Vertical ? s.width() : s.height(); } | 131 | { return orient == Qt::Vertical ? s.width() : s.height(); } |
125 | KDGanttSplitterHandle* mFirstHandle; | 132 | KDGanttSplitterHandle* mFirstHandle; |
126 | QSplitterData *data; | 133 | QSplitterData *data; |
127 | #endif | 134 | #endif |
128 | 135 | ||
129 | private: | 136 | private: |
130 | Orientation orient; | 137 | Qt::Orientation orient; |
131 | Direction _direction; | 138 | Direction _direction; |
132 | #ifndef DOXYGEN_SKIP_INTERNAL | 139 | #ifndef DOXYGEN_SKIP_INTERNAL |
133 | friend class KDGanttSplitterHandle; | 140 | friend class KDGanttSplitterHandle; |
134 | #endif | 141 | #endif |
135 | private:// Disabled copy constructor and operator= | 142 | private:// Disabled copy constructor and operator= |
136 | #if defined(Q_DISABLE_COPY) | 143 | #if defined(Q_DISABLE_COPY) |
137 | KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); | 144 | KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); |
138 | KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); | 145 | KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); |
139 | #endif | 146 | #endif |
140 | }; | 147 | }; |
141 | 148 | ||
142 | #ifndef DOXYGEN_SKIP_INTERNAL | 149 | #ifndef DOXYGEN_SKIP_INTERNAL |
143 | // This class was continued from a verbatim copy of the | 150 | // This class was continued from a verbatim copy of the |
144 | // QSplitterHandle pertaining to the Qt Enterprise License and the | 151 | // QSplitterHandle pertaining to the Qt Enterprise License and the |
145 | // GPL. It has only been renamed to KDGanttSplitterHandler in order to | 152 | // GPL. It has only been renamed to KDGanttSplitterHandler in order to |
146 | // avoid a symbol clash on some platforms. | 153 | // avoid a symbol clash on some platforms. |
@@ -150,33 +157,33 @@ class KDGanttSplitterHandle : public QWidget | |||
150 | #if QT_VERSION >= 232 | 157 | #if QT_VERSION >= 232 |
151 | public: | 158 | public: |
152 | KDGanttSplitterHandle( Qt::Orientation o, | 159 | KDGanttSplitterHandle( Qt::Orientation o, |
153 | KDGanttMinimizeSplitter *parent, const char* name=0 ); | 160 | KDGanttMinimizeSplitter *parent, const char* name=0 ); |
154 | void setOrientation( Qt::Orientation o ); | 161 | void setOrientation( Qt::Orientation o ); |
155 | Qt::Orientation orientation() const { return orient; } | 162 | Qt::Orientation orientation() const { return orient; } |
156 | 163 | ||
157 | bool opaque() const { return s->opaqueResize(); } | 164 | bool opaque() const { return s->opaqueResize(); } |
158 | 165 | ||
159 | QSize sizeHint() const; | 166 | QSize sizeHint() const; |
160 | void toggle(); | 167 | void toggle(); |
161 | 168 | ||
162 | int id() const { return myId; } // data->list.at(id())->wid == this | 169 | int id() const { return myId; } // data->list.at(id())->wid == this |
163 | void setId( int i ) { myId = i; } | 170 | void setId( int i ) { myId = i; } |
164 | 171 | ||
165 | protected: | 172 | protected: |
166 | QValueList<QPointArray> buttonRegions(); | 173 | Q3ValueList<Q3PointArray> buttonRegions(); |
167 | void paintEvent( QPaintEvent * ); | 174 | void paintEvent( QPaintEvent * ); |
168 | void mouseMoveEvent( QMouseEvent * ); | 175 | void mouseMoveEvent( QMouseEvent * ); |
169 | void mousePressEvent( QMouseEvent * ); | 176 | void mousePressEvent( QMouseEvent * ); |
170 | void mouseReleaseEvent( QMouseEvent * ); | 177 | void mouseReleaseEvent( QMouseEvent * ); |
171 | int onButton( const QPoint& p ); | 178 | int onButton( const QPoint& p ); |
172 | void updateCursor( const QPoint& p ); | 179 | void updateCursor( const QPoint& p ); |
173 | 180 | ||
174 | private: | 181 | private: |
175 | bool mMouseDown; | 182 | bool mMouseDown; |
176 | QSize mSizeHint; | 183 | QSize mSizeHint; |
177 | bool mUseOffset; | 184 | bool mUseOffset; |
178 | Qt::Orientation orient; | 185 | Qt::Orientation orient; |
179 | bool opaq; | 186 | bool opaq; |
180 | int myId; | 187 | int myId; |
181 | 188 | ||
182 | KDGanttMinimizeSplitter *s; | 189 | KDGanttMinimizeSplitter *s; |
diff --git a/microkde/fncolordialog.h b/microkde/fncolordialog.h index 615d2ed..52356be 100755 --- a/microkde/fncolordialog.h +++ b/microkde/fncolordialog.h | |||
@@ -22,38 +22,38 @@ | |||
22 | 22 | ||
23 | */ | 23 | */ |
24 | #ifndef FNPALETTEDIALOG_H | 24 | #ifndef FNPALETTEDIALOG_H |
25 | #define FNPALETTEDIALOG_H | 25 | #define FNPALETTEDIALOG_H |
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qcolor.h> | 29 | #include <qcolor.h> |
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
34 | 34 | ||
35 | //----------------------------------------------------------------------------- | 35 | //----------------------------------------------------------------------------- |
36 | // FNPaletteBase | 36 | // FNPaletteBase |
37 | //----------------------------------------------------------------------------- | 37 | //----------------------------------------------------------------------------- |
38 | class Q_EXPORT FNPaletteBase : public QWidget | 38 | class /* Q_EXPORT */ FNPaletteBase : public QWidget |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | 42 | ||
43 | FNPaletteBase(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 43 | FNPaletteBase(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0); |
44 | 44 | ||
45 | 45 | ||
46 | virtual ~FNPaletteBase(); | 46 | virtual ~FNPaletteBase(); |
47 | 47 | ||
48 | 48 | ||
49 | void setBGColor(QColor c) { | 49 | void setBGColor(QColor c) { |
50 | bgcolor_ = c; | 50 | bgcolor_ = c; |
51 | selection_ = c; | 51 | selection_ = c; |
52 | redraw(); | 52 | redraw(); |
53 | }; | 53 | }; |
54 | QColor color() const { | 54 | QColor color() const { |
55 | return selection_; | 55 | return selection_; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | protected: | 58 | protected: |
59 | virtual void paintEvent(QPaintEvent*); | 59 | virtual void paintEvent(QPaintEvent*); |
@@ -65,70 +65,70 @@ protected: | |||
65 | QColor selection_; | 65 | QColor selection_; |
66 | private: | 66 | private: |
67 | QPixmap wbuf_; | 67 | QPixmap wbuf_; |
68 | QColor bgcolor_; | 68 | QColor bgcolor_; |
69 | bool _isblock; | 69 | bool _isblock; |
70 | 70 | ||
71 | signals: | 71 | signals: |
72 | void clicked(FNPaletteBase* sender); | 72 | void clicked(FNPaletteBase* sender); |
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | //----------------------------------------------------------------------------- | 78 | //----------------------------------------------------------------------------- |
79 | // FNColorPalette | 79 | // FNColorPalette |
80 | //----------------------------------------------------------------------------- | 80 | //----------------------------------------------------------------------------- |
81 | class Q_EXPORT FNColorPalette : public FNPaletteBase | 81 | class /* Q_EXPORT */ FNColorPalette : public FNPaletteBase |
82 | { | 82 | { |
83 | Q_OBJECT | 83 | Q_OBJECT |
84 | public: | 84 | public: |
85 | FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 85 | FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0); |
86 | virtual ~FNColorPalette(); | 86 | virtual ~FNColorPalette(); |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | 90 | ||
91 | 91 | ||
92 | //----------------------------------------------------------------------------- | 92 | //----------------------------------------------------------------------------- |
93 | // FNHSVPalette | 93 | // FNHSVPalette |
94 | //----------------------------------------------------------------------------- | 94 | //----------------------------------------------------------------------------- |
95 | class Q_EXPORT FNHSVPalette : public FNPaletteBase | 95 | class /*Q_EXPORT */ FNHSVPalette : public FNPaletteBase |
96 | { | 96 | { |
97 | Q_OBJECT | 97 | Q_OBJECT |
98 | public: | 98 | public: |
99 | FNHSVPalette(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 99 | FNHSVPalette(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0); |
100 | virtual ~FNHSVPalette(); | 100 | virtual ~FNHSVPalette(); |
101 | public slots: | 101 | public slots: |
102 | void hueChanged(int v); | 102 | void hueChanged(int v); |
103 | protected: | 103 | protected: |
104 | virtual void drawImpl(QPainter& pa); | 104 | virtual void drawImpl(QPainter& pa); |
105 | int _hue; | 105 | int _hue; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | //----------------------------------------------------------------------------- | 111 | //----------------------------------------------------------------------------- |
112 | // FNColorDialog | 112 | // FNColorDialog |
113 | //----------------------------------------------------------------------------- | 113 | //----------------------------------------------------------------------------- |
114 | class Q_EXPORT FNColorDialog : public QDialog | 114 | class /*Q_EXPORT */FNColorDialog : public QDialog |
115 | { | 115 | { |
116 | Q_OBJECT | 116 | Q_OBJECT |
117 | public: | 117 | public: |
118 | FNColorDialog(QWidget* parent=0, const char* name=0, WFlags f=0); | 118 | FNColorDialog(QWidget* parent=0, const char* name=0, Qt::WFlags f=0); |
119 | virtual ~FNColorDialog(); | 119 | virtual ~FNColorDialog(); |
120 | void setColor(QColor c); | 120 | void setColor(QColor c); |
121 | QColor color() const; | 121 | QColor color() const; |
122 | public slots: | 122 | public slots: |
123 | virtual void basePaletteClicked(FNPaletteBase*); | 123 | virtual void basePaletteClicked(FNPaletteBase*); |
124 | virtual void hsvPaletteClicked(FNPaletteBase*); | 124 | virtual void hsvPaletteClicked(FNPaletteBase*); |
125 | void rgbChanged(int); | 125 | void rgbChanged(int); |
126 | private: | 126 | private: |
127 | FNHSVPalette* _palette; | 127 | FNHSVPalette* _palette; |
128 | FNColorPalette* _base[16]; | 128 | FNColorPalette* _base[16]; |
129 | QSlider* _hue; | 129 | QSlider* _hue; |
130 | FNColorPalette* _select; | 130 | FNColorPalette* _select; |
131 | QSpinBox* _r; | 131 | QSpinBox* _r; |
132 | QSpinBox* _g; | 132 | QSpinBox* _g; |
133 | QSpinBox* _b; | 133 | QSpinBox* _b; |
134 | bool _isblock; | 134 | bool _isblock; |
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index d7c12bb..b058d54 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp | |||
@@ -1,29 +1,32 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | #include "kapplication.h" | 4 | #include "kapplication.h" |
5 | #include "ktextedit.h" | 5 | #include "ktextedit.h" |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qfile.h> | 8 | #include <qfile.h> |
9 | #include <qtextstream.h> | 9 | #include <q3textstream.h> |
10 | #include <qdialog.h> | 10 | #include <qdialog.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include <qtextbrowser.h> | 12 | #include <q3textbrowser.h> |
13 | #include <qregexp.h> | 13 | #include <qregexp.h> |
14 | #include <QDesktopWidget> | ||
15 | //Added by qt3to4: | ||
16 | #include <Q3VBoxLayout> | ||
14 | 17 | ||
15 | int KApplication::random() | 18 | int KApplication::random() |
16 | { | 19 | { |
17 | return rand(); | 20 | return rand(); |
18 | } | 21 | } |
19 | 22 | ||
20 | //US | 23 | //US |
21 | QString KApplication::randomString(int length) | 24 | QString KApplication::randomString(int length) |
22 | { | 25 | { |
23 | if (length <=0 ) return QString::null; | 26 | if (length <=0 ) return QString::null; |
24 | 27 | ||
25 | QString str; | 28 | QString str; |
26 | while (length--) | 29 | while (length--) |
27 | { | 30 | { |
28 | int r=random() % 62; | 31 | int r=random() % 62; |
29 | r+=48; | 32 | r+=48; |
@@ -62,107 +65,107 @@ void KApplication::testCoords( int* x, int* y, int* wid, int * hei ) | |||
62 | *y = 20; | 65 | *y = 20; |
63 | if ( *hei > dHei ) | 66 | if ( *hei > dHei ) |
64 | *hei = dHei; | 67 | *hei = dHei; |
65 | } | 68 | } |
66 | } | 69 | } |
67 | void KApplication::showFile(QString caption, QString fn) | 70 | void KApplication::showFile(QString caption, QString fn) |
68 | { | 71 | { |
69 | QString text; | 72 | QString text; |
70 | QString fileName; | 73 | QString fileName; |
71 | #ifndef DESKTOP_VERSION | 74 | #ifndef DESKTOP_VERSION |
72 | fileName = getenv("QPEDIR"); | 75 | fileName = getenv("QPEDIR"); |
73 | fileName += "/pics/" + fn ; | 76 | fileName += "/pics/" + fn ; |
74 | #else | 77 | #else |
75 | fileName = qApp->applicationDirPath () + "/" + fn; | 78 | fileName = qApp->applicationDirPath () + "/" + fn; |
76 | #endif | 79 | #endif |
77 | QFile file( fileName ); | 80 | QFile file( fileName ); |
78 | if (!file.open( IO_ReadOnly ) ) { | 81 | if (!file.open( QIODevice::ReadOnly ) ) { |
79 | return ; | 82 | return ; |
80 | } | 83 | } |
81 | QTextStream ts( &file ); | 84 | Q3TextStream ts( &file ); |
82 | text = ts.read(); | 85 | text = ts.read(); |
83 | file.close(); | 86 | file.close(); |
84 | KApplication::showText( caption, text ); | 87 | KApplication::showText( caption, text ); |
85 | 88 | ||
86 | } | 89 | } |
87 | 90 | ||
88 | bool KApplication::convert2latin1(QString fileName) | 91 | bool KApplication::convert2latin1(QString fileName) |
89 | { | 92 | { |
90 | QString text; | 93 | QString text; |
91 | QFile file( fileName ); | 94 | QFile file( fileName ); |
92 | if (!file.open( IO_ReadOnly ) ) { | 95 | if (!file.open( QIODevice::ReadOnly ) ) { |
93 | return false; | 96 | return false; |
94 | 97 | ||
95 | } | 98 | } |
96 | QTextStream ts( &file ); | 99 | Q3TextStream ts( &file ); |
97 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 100 | ts.setEncoding( Q3TextStream::UnicodeUTF8 ); |
98 | text = ts.read(); | 101 | text = ts.read(); |
99 | file.close(); | 102 | file.close(); |
100 | if (!file.open( IO_WriteOnly ) ) { | 103 | if (!file.open( QIODevice::WriteOnly ) ) { |
101 | return false; | 104 | return false; |
102 | } | 105 | } |
103 | QTextStream tsIn( &file ); | 106 | Q3TextStream tsIn( &file ); |
104 | tsIn.setEncoding( QTextStream::Latin1 ); | 107 | tsIn.setEncoding( Q3TextStream::Latin1 ); |
105 | tsIn << text.latin1(); | 108 | tsIn << text.latin1(); |
106 | file.close(); | 109 | file.close(); |
107 | return true; | 110 | return true; |
108 | 111 | ||
109 | 112 | ||
110 | } | 113 | } |
111 | void KApplication::showText(QString caption, QString text) | 114 | void KApplication::showText(QString caption, QString text) |
112 | { | 115 | { |
113 | QDialog dia( 0, "name", true ); ; | 116 | QDialog dia( 0, "name", true ); ; |
114 | dia.setCaption( caption ); | 117 | dia.setCaption( caption ); |
115 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 118 | Q3VBoxLayout* lay = new Q3VBoxLayout( &dia ); |
116 | lay->setSpacing( 3 ); | 119 | lay->setSpacing( 3 ); |
117 | lay->setMargin( 3 ); | 120 | lay->setMargin( 3 ); |
118 | KTextEdit tb ( &dia ); | 121 | KTextEdit tb ( &dia ); |
119 | tb.setWordWrap( QMultiLineEdit::WidgetWidth ); | 122 | tb.setWordWrap( Q3MultiLineEdit::WidgetWidth ); |
120 | lay->addWidget( &tb ); | 123 | lay->addWidget( &tb ); |
121 | tb.setText( text ); | 124 | tb.setText( text ); |
122 | #ifdef DESKTOP_VERSION | 125 | #ifdef DESKTOP_VERSION |
123 | dia.resize( 640, 480); | 126 | dia.resize( 640, 480); |
124 | #else | 127 | #else |
125 | dia.showMaximized(); | 128 | dia.showMaximized(); |
126 | #endif | 129 | #endif |
127 | dia.exec(); | 130 | dia.exec(); |
128 | 131 | ||
129 | } | 132 | } |
130 | 133 | ||
131 | #include <qlabel.h> | 134 | #include <qlabel.h> |
132 | #include <qpushbutton.h> | 135 | #include <qpushbutton.h> |
133 | #include <qlayout.h> | 136 | #include <qlayout.h> |
134 | #include <qdir.h> | 137 | #include <qdir.h> |
135 | #include <qradiobutton.h> | 138 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 139 | #include <q3buttongroup.h> |
137 | #include "kglobal.h" | 140 | #include "kglobal.h" |
138 | #include "klocale.h" | 141 | #include "klocale.h" |
139 | 142 | ||
140 | class KBackupPrefs : public QDialog | 143 | class KBackupPrefs : public QDialog |
141 | { | 144 | { |
142 | public: | 145 | public: |
143 | KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) : | 146 | KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) : |
144 | QDialog( parent, name, true ) | 147 | QDialog( parent, name, true ) |
145 | { | 148 | { |
146 | setCaption( i18n("Backup Failed!") ); | 149 | setCaption( i18n("Backup Failed!") ); |
147 | QVBoxLayout* lay = new QVBoxLayout( this ); | 150 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
148 | lay->setSpacing( 3 ); | 151 | lay->setSpacing( 3 ); |
149 | lay->setMargin( 3 ); | 152 | lay->setMargin( 3 ); |
150 | QLabel * lab = new QLabel( message, this ); | 153 | QLabel * lab = new QLabel( message, this ); |
151 | lay->addWidget( lab ); | 154 | lay->addWidget( lab ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this ); | 155 | Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Choose action"), this ); |
153 | lay->addWidget( format ); | 156 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 157 | format->setExclusive ( true ) ; |
155 | vcal = new QRadioButton(i18n("Try again now"), format ); | 158 | vcal = new QRadioButton(i18n("Try again now"), format ); |
156 | tcal = new QRadioButton(i18n("Try again later"), format ); | 159 | tcal = new QRadioButton(i18n("Try again later"), format ); |
157 | ical = new QRadioButton(i18n("Try again tomorrow"), format ); | 160 | ical = new QRadioButton(i18n("Try again tomorrow"), format ); |
158 | ocal = new QRadioButton(i18n("Disable backup"), format ); | 161 | ocal = new QRadioButton(i18n("Disable backup"), format ); |
159 | vcal->setChecked( true ); | 162 | vcal->setChecked( true ); |
160 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
161 | lay->addWidget(ok ); | 164 | lay->addWidget(ok ); |
162 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 165 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
163 | } | 166 | } |
164 | 167 | ||
165 | bool again() { return vcal->isChecked(); } | 168 | bool again() { return vcal->isChecked(); } |
166 | bool later() { return tcal->isChecked(); } | 169 | bool later() { return tcal->isChecked(); } |
167 | bool againTomorrow() { return ical->isChecked(); } | 170 | bool againTomorrow() { return ical->isChecked(); } |
168 | private: | 171 | private: |
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp index 197bea2..16618fc 100644 --- a/microkde/kcolorbutton.cpp +++ b/microkde/kcolorbutton.cpp | |||
@@ -1,24 +1,27 @@ | |||
1 | #include "kcolorbutton.h" | 1 | #include "kcolorbutton.h" |
2 | #include "kcolordialog.h" | 2 | #include "kcolordialog.h" |
3 | #include "qapplication.h" | 3 | #include "qapplication.h" |
4 | #include <QDesktopWidget> | ||
4 | 5 | ||
5 | 6 | ||
6 | #include "qlayout.h" | 7 | #include "qlayout.h" |
7 | #ifdef DESKTOP_VERSION | 8 | #ifdef DESKTOP_VERSION |
8 | #include <qcolordialog.h> | 9 | #include <qcolordialog.h> |
10 | //Added by qt3to4: | ||
11 | #include <QPixmap> | ||
9 | #endif | 12 | #endif |
10 | void KColorButton:: edit() | 13 | void KColorButton:: edit() |
11 | { | 14 | { |
12 | 15 | ||
13 | #ifdef DESKTOP_VERSION | 16 | #ifdef DESKTOP_VERSION |
14 | QColor col = QColorDialog::getColor ( mColor ); | 17 | QColor col = QColorDialog::getColor ( mColor ); |
15 | if ( col.isValid () ) { | 18 | if ( col.isValid () ) { |
16 | mColor = col; | 19 | mColor = col; |
17 | setColor ( mColor ); | 20 | setColor ( mColor ); |
18 | emit changed ( mColor ); | 21 | emit changed ( mColor ); |
19 | emit changedID ( mColor, id ); | 22 | emit changedID ( mColor, id ); |
20 | } | 23 | } |
21 | #else | 24 | #else |
22 | KColorDialog* k = new KColorDialog( this ); | 25 | KColorDialog* k = new KColorDialog( this ); |
23 | k->setColor( mColor ); | 26 | k->setColor( mColor ); |
24 | int res = k->exec(); | 27 | int res = k->exec(); |
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index 940196e..12063ca 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp | |||
@@ -1,19 +1,21 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | 2 | #include <q3textstream.h> |
3 | #include <qwidget.h> | 3 | #include <qwidget.h> |
4 | //Added by qt3to4: | ||
5 | #include <Q3ValueList> | ||
4 | 6 | ||
5 | #include "kdebug.h" | 7 | #include "kdebug.h" |
6 | 8 | ||
7 | #include "kurl.h" | 9 | #include "kurl.h" |
8 | #include "kstandarddirs.h" | 10 | #include "kstandarddirs.h" |
9 | #include "kconfig.h" | 11 | #include "kconfig.h" |
10 | 12 | ||
11 | QString KConfig::mGroup = ""; | 13 | QString KConfig::mGroup = ""; |
12 | //QString KConfig::mGroup = "General"; | 14 | //QString KConfig::mGroup = "General"; |
13 | 15 | ||
14 | KConfig::KConfig( const QString &fileName ) | 16 | KConfig::KConfig( const QString &fileName ) |
15 | : mFileName( fileName ), mDirty( false ) | 17 | : mFileName( fileName ), mDirty( false ) |
16 | { | 18 | { |
17 | 19 | ||
18 | mTempGroup = ""; | 20 | mTempGroup = ""; |
19 | load(); | 21 | load(); |
@@ -40,37 +42,37 @@ QString KConfig::tempGroup() const { | |||
40 | 42 | ||
41 | void KConfig::setGroup( const QString &group ) | 43 | void KConfig::setGroup( const QString &group ) |
42 | { | 44 | { |
43 | 45 | ||
44 | 46 | ||
45 | mGroup = group; | 47 | mGroup = group; |
46 | 48 | ||
47 | if ( mGroup.right( 1 ) != "/" ) mGroup += "/"; | 49 | if ( mGroup.right( 1 ) != "/" ) mGroup += "/"; |
48 | } | 50 | } |
49 | 51 | ||
50 | //US | 52 | //US |
51 | QString KConfig::group() const { | 53 | QString KConfig::group() const { |
52 | return mGroup; | 54 | return mGroup; |
53 | } | 55 | } |
54 | 56 | ||
55 | //US added method | 57 | //US added method |
56 | QValueList<int> KConfig::readIntListEntry( const QString & key) | 58 | Q3ValueList<int> KConfig::readIntListEntry( const QString & key) |
57 | { | 59 | { |
58 | // qDebug("KConfig::readIntListEntry key=%s:", key.latin1()); | 60 | // qDebug("KConfig::readIntListEntry key=%s:", key.latin1()); |
59 | 61 | ||
60 | QValueList<int> result; | 62 | Q3ValueList<int> result; |
61 | 63 | ||
62 | QMap<QString,QString>::ConstIterator mit = mStringMap.find( mGroup + key ); | 64 | QMap<QString,QString>::ConstIterator mit = mStringMap.find( mGroup + key ); |
63 | 65 | ||
64 | if ( mit == mStringMap.end() ) { | 66 | if ( mit == mStringMap.end() ) { |
65 | return result; | 67 | return result; |
66 | } | 68 | } |
67 | 69 | ||
68 | QStringList valuesAsStrings = QStringList::split(":", *mit ); | 70 | QStringList valuesAsStrings = QStringList::split(":", *mit ); |
69 | bool ok = false; | 71 | bool ok = false; |
70 | bool ok2 = true; | 72 | bool ok2 = true; |
71 | int val; | 73 | int val; |
72 | 74 | ||
73 | for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) { | 75 | for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) { |
74 | val = (*sit).toInt(&ok); | 76 | val = (*sit).toInt(&ok); |
75 | result << val; | 77 | result << val; |
76 | if (ok == false) { | 78 | if (ok == false) { |
@@ -98,33 +100,33 @@ int KConfig::readNumEntry( const QString & key, int def ) | |||
98 | return def; | 100 | return def; |
99 | } | 101 | } |
100 | 102 | ||
101 | QString KConfig::readEntry( const QString &key, const QString &def ) | 103 | QString KConfig::readEntry( const QString &key, const QString &def ) |
102 | { | 104 | { |
103 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); | 105 | QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); |
104 | 106 | ||
105 | if ( it == mStringMap.end() ) { | 107 | if ( it == mStringMap.end() ) { |
106 | return def; | 108 | return def; |
107 | } | 109 | } |
108 | 110 | ||
109 | return QString::fromUtf8((*it).latin1()); | 111 | return QString::fromUtf8((*it).latin1()); |
110 | } | 112 | } |
111 | 113 | ||
112 | QSize KConfig::readSizeEntry( const QString &key, QSize* def ) | 114 | QSize KConfig::readSizeEntry( const QString &key, QSize* def ) |
113 | { | 115 | { |
114 | QValueList<int> intlist = readIntListEntry(key); | 116 | Q3ValueList<int> intlist = readIntListEntry(key); |
115 | 117 | ||
116 | if (intlist.count() < 2) | 118 | if (intlist.count() < 2) |
117 | { | 119 | { |
118 | if (def) | 120 | if (def) |
119 | return *def; | 121 | return *def; |
120 | else | 122 | else |
121 | return QSize(); | 123 | return QSize(); |
122 | } | 124 | } |
123 | 125 | ||
124 | QSize ret; | 126 | QSize ret; |
125 | ret.setWidth(intlist[0]); | 127 | ret.setWidth(intlist[0]); |
126 | ret.setHeight(intlist[1]); | 128 | ret.setHeight(intlist[1]); |
127 | 129 | ||
128 | return ret; | 130 | return ret; |
129 | } | 131 | } |
130 | 132 | ||
@@ -181,37 +183,37 @@ QFont KConfig::readFontEntry( const QString & e, QFont *def ) | |||
181 | return f; | 183 | return f; |
182 | } | 184 | } |
183 | 185 | ||
184 | QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def ) | 186 | QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def ) |
185 | { | 187 | { |
186 | QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key ); | 188 | QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key ); |
187 | 189 | ||
188 | if ( it == mDateTimeMap.end() ) { | 190 | if ( it == mDateTimeMap.end() ) { |
189 | if ( def ) return *def; | 191 | if ( def ) return *def; |
190 | else return QDateTime(); | 192 | else return QDateTime(); |
191 | } | 193 | } |
192 | 194 | ||
193 | return *it; | 195 | return *it; |
194 | } | 196 | } |
195 | 197 | ||
196 | //US added method | 198 | //US added method |
197 | void KConfig::writeEntry( const QString &key, const QValueList<int> &value) | 199 | void KConfig::writeEntry( const QString &key, const Q3ValueList<int> &value) |
198 | { | 200 | { |
199 | QStringList valuesAsStrings; | 201 | QStringList valuesAsStrings; |
200 | 202 | ||
201 | QValueList<int>::ConstIterator it; | 203 | Q3ValueList<int>::ConstIterator it; |
202 | 204 | ||
203 | for( it = value.begin(); it != value.end(); ++it ) | 205 | for( it = value.begin(); it != value.end(); ++it ) |
204 | { | 206 | { |
205 | valuesAsStrings << QString::number(*it); | 207 | valuesAsStrings << QString::number(*it); |
206 | } | 208 | } |
207 | 209 | ||
208 | mStringMap.insert( mGroup + key, valuesAsStrings.join(":") ); | 210 | mStringMap.insert( mGroup + key, valuesAsStrings.join(":") ); |
209 | mDirty = true; | 211 | mDirty = true; |
210 | } | 212 | } |
211 | 213 | ||
212 | void KConfig::writeEntry( const QString & key , int num ) | 214 | void KConfig::writeEntry( const QString & key , int num ) |
213 | { | 215 | { |
214 | writeEntry( key, QString::number ( num ) ); | 216 | writeEntry( key, QString::number ( num ) ); |
215 | } | 217 | } |
216 | 218 | ||
217 | void KConfig::writeEntry( const QString &key, const QString &value ) | 219 | void KConfig::writeEntry( const QString &key, const QString &value ) |
@@ -233,71 +235,71 @@ void KConfig::writeEntry( const QString &key, bool value) | |||
233 | mBoolMap.insert( mGroup + key, value ); | 235 | mBoolMap.insert( mGroup + key, value ); |
234 | 236 | ||
235 | mDirty = true; | 237 | mDirty = true; |
236 | } | 238 | } |
237 | 239 | ||
238 | void KConfig::writeEntry( const QString & e, const QColor & c ) | 240 | void KConfig::writeEntry( const QString & e, const QColor & c ) |
239 | { | 241 | { |
240 | QStringList l; | 242 | QStringList l; |
241 | l.append( QString::number ( c.red() ) ); | 243 | l.append( QString::number ( c.red() ) ); |
242 | l.append( QString::number ( c.green() ) ); | 244 | l.append( QString::number ( c.green() ) ); |
243 | l.append( QString::number ( c.blue() ) ); | 245 | l.append( QString::number ( c.blue() ) ); |
244 | writeEntry( e.utf8(), l ); | 246 | writeEntry( e.utf8(), l ); |
245 | } | 247 | } |
246 | 248 | ||
247 | void KConfig::writeEntry( const QString & e, const QSize & s ) | 249 | void KConfig::writeEntry( const QString & e, const QSize & s ) |
248 | { | 250 | { |
249 | QValueList<int> intlist; | 251 | Q3ValueList<int> intlist; |
250 | intlist << s.width() << s.height(); | 252 | intlist << s.width() << s.height(); |
251 | writeEntry( e, intlist ); | 253 | writeEntry( e, intlist ); |
252 | } | 254 | } |
253 | 255 | ||
254 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 256 | void KConfig::writeEntry( const QString & e , const QFont & f ) |
255 | { | 257 | { |
256 | QStringList font; | 258 | QStringList font; |
257 | font.append( f.family()); | 259 | font.append( f.family()); |
258 | font.append( (!f.bold ()?"nonbold":"bold") ); | 260 | font.append( (!f.bold ()?"nonbold":"bold") ); |
259 | font.append( QString::number ( f.pointSize () ) ); | 261 | font.append( QString::number ( f.pointSize () ) ); |
260 | font.append( !f.italic ()?"nonitalic":"italic" ); | 262 | font.append( !f.italic ()?"nonitalic":"italic" ); |
261 | writeEntry( e, font ); | 263 | writeEntry( e, font ); |
262 | } | 264 | } |
263 | 265 | ||
264 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 266 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) |
265 | { | 267 | { |
266 | mDateTimeMap.insert( mGroup + key, dt ); | 268 | mDateTimeMap.insert( mGroup + key, dt ); |
267 | } | 269 | } |
268 | 270 | ||
269 | void KConfig::load() | 271 | void KConfig::load() |
270 | { | 272 | { |
271 | 273 | ||
272 | 274 | ||
273 | QFile f( mFileName ); | 275 | QFile f( mFileName ); |
274 | if ( !f.open( IO_ReadOnly ) ) { | 276 | if ( !f.open( QIODevice::ReadOnly ) ) { |
275 | //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); | 277 | //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); |
276 | return; | 278 | return; |
277 | } | 279 | } |
278 | 280 | ||
279 | mBoolMap.clear(); | 281 | mBoolMap.clear(); |
280 | mStringMap.clear(); | 282 | mStringMap.clear(); |
281 | 283 | ||
282 | QTextStream t( &f ); | 284 | Q3TextStream t( &f ); |
283 | t.setEncoding( QTextStream::Latin1 ); | 285 | t.setEncoding( Q3TextStream::Latin1 ); |
284 | QString line = t.readLine(); | 286 | QString line = t.readLine(); |
285 | 287 | ||
286 | while ( !line.isNull() ) { | 288 | while ( !line.isNull() ) { |
287 | QStringList tokens = QStringList::split( ",", line ); | 289 | QStringList tokens = line.split(','); |
288 | if ( tokens[0] == "bool" ) { | 290 | if ( tokens[0] == "bool" ) { |
289 | bool value = false; | 291 | bool value = false; |
290 | if ( tokens[2] == "1" ) value = true; | 292 | if ( tokens[2] == "1" ) value = true; |
291 | mBoolMap.insert( tokens[1], value ); | 293 | mBoolMap.insert( tokens[1], value ); |
292 | } else if ( tokens[0] == "QString" ) { | 294 | } else if ( tokens[0] == "QString" ) { |
293 | QString value = tokens[2]; | 295 | QString value = tokens[2]; |
294 | mStringMap.insert( tokens[1], value ); | 296 | mStringMap.insert( tokens[1], value ); |
295 | } else if ( tokens[0] == "QDateTime" ) { | 297 | } else if ( tokens[0] == "QDateTime" ) { |
296 | #if 0 | 298 | #if 0 |
297 | int year = tokens[2].toInt(); | 299 | int year = tokens[2].toInt(); |
298 | QDateTime dt( QDate( year, | 300 | QDateTime dt( QDate( year, |
299 | tokens[3].toInt(), | 301 | tokens[3].toInt(), |
300 | tokens[4].toInt() ), | 302 | tokens[4].toInt() ), |
301 | QTime( tokens[5].toInt(), tokens[6].toInt(), | 303 | QTime( tokens[5].toInt(), tokens[6].toInt(), |
302 | tokens[7].toInt() ) ); | 304 | tokens[7].toInt() ) ); |
303 | mDateTimeMap.insert( tokens[1], dt ); | 305 | mDateTimeMap.insert( tokens[1], dt ); |
@@ -310,41 +312,41 @@ void KConfig::load() | |||
310 | 312 | ||
311 | void KConfig::sync() | 313 | void KConfig::sync() |
312 | { | 314 | { |
313 | 315 | ||
314 | if ( !mDirty ) return; | 316 | if ( !mDirty ) return; |
315 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); | 317 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); |
316 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; | 318 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; |
317 | 319 | ||
318 | //US I took the following code from a newer version of KDE | 320 | //US I took the following code from a newer version of KDE |
319 | // Create the containing dir if needed | 321 | // Create the containing dir if needed |
320 | KURL path; | 322 | KURL path; |
321 | path.setPath(mFileName); | 323 | path.setPath(mFileName); |
322 | QString dir=path.directory(); | 324 | QString dir=path.directory(); |
323 | KStandardDirs::makeDir(dir); | 325 | KStandardDirs::makeDir(dir); |
324 | 326 | ||
325 | QFile f( mFileName ); | 327 | QFile f( mFileName ); |
326 | if ( !f.open( IO_WriteOnly ) ) { | 328 | if ( !f.open( QIODevice::WriteOnly ) ) { |
327 | 329 | ||
328 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); | 330 | qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); |
329 | 331 | ||
330 | return; | 332 | return; |
331 | } | 333 | } |
332 | 334 | ||
333 | QTextStream t( &f ); | 335 | Q3TextStream t( &f ); |
334 | t.setEncoding( QTextStream::Latin1 ); | 336 | t.setEncoding( Q3TextStream::Latin1 ); |
335 | QMap<QString,bool>::ConstIterator itBool; | 337 | QMap<QString,bool>::ConstIterator itBool; |
336 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { | 338 | for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { |
337 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; | 339 | t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; |
338 | } | 340 | } |
339 | 341 | ||
340 | QMap<QString,QString>::ConstIterator itString; | 342 | QMap<QString,QString>::ConstIterator itString; |
341 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { | 343 | for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { |
342 | t << "QString," << itString.key() << "," << (*itString ) << endl; | 344 | t << "QString," << itString.key() << "," << (*itString ) << endl; |
343 | } | 345 | } |
344 | 346 | ||
345 | QMap<QString,QDateTime>::ConstIterator itDateTime; | 347 | QMap<QString,QDateTime>::ConstIterator itDateTime; |
346 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { | 348 | for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { |
347 | QDateTime dt = *itDateTime; | 349 | QDateTime dt = *itDateTime; |
348 | t << "QDateTime," << itDateTime.key() << "," | 350 | t << "QDateTime," << itDateTime.key() << "," |
349 | << dt.date().year() << "," | 351 | << dt.date().year() << "," |
350 | << dt.date().month() << "," | 352 | << dt.date().month() << "," |
diff --git a/microkde/kconfig.h b/microkde/kconfig.h index 1a1038f..7b91e44 100644 --- a/microkde/kconfig.h +++ b/microkde/kconfig.h | |||
@@ -1,22 +1,22 @@ | |||
1 | #ifndef MINIKDE_KCONFIG_H | 1 | #ifndef MINIKDE_KCONFIG_H |
2 | #define MINIKDE_KCONFIG_H | 2 | #define MINIKDE_KCONFIG_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qvaluelist.h> | 6 | #include <q3valuelist.h> |
7 | #include <qcolor.h> | 7 | #include <qcolor.h> |
8 | #include <qfont.h> | 8 | #include <qfont.h> |
9 | #include <qmap.h> | 9 | #include <qmap.h> |
10 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
11 | 11 | ||
12 | class KConfig | 12 | class KConfig |
13 | { | 13 | { |
14 | public: | 14 | public: |
15 | KConfig( const QString & ); | 15 | KConfig( const QString & ); |
16 | ~KConfig(); | 16 | ~KConfig(); |
17 | 17 | ||
18 | void setTempGroup( const QString &group ); | 18 | void setTempGroup( const QString &group ); |
19 | QString tempGroup() const; | 19 | QString tempGroup() const; |
20 | 20 | ||
21 | void setGroup( const QString & ); | 21 | void setGroup( const QString & ); |
22 | 22 | ||
@@ -44,45 +44,45 @@ class KConfig | |||
44 | */ | 44 | */ |
45 | bool deleteGroup( const QString& group); | 45 | bool deleteGroup( const QString& group); |
46 | 46 | ||
47 | //US I took the following hasGroup method from a newer version from KDE. | 47 | //US I took the following hasGroup method from a newer version from KDE. |
48 | /** | 48 | /** |
49 | * Returns true if the specified group is known about. | 49 | * Returns true if the specified group is known about. |
50 | * | 50 | * |
51 | * @param group The group to search for. | 51 | * @param group The group to search for. |
52 | * @return Whether the group exists. | 52 | * @return Whether the group exists. |
53 | */ | 53 | */ |
54 | bool hasGroup(const QString &group) const; | 54 | bool hasGroup(const QString &group) const; |
55 | 55 | ||
56 | 56 | ||
57 | QString getFileName(); | 57 | QString getFileName(); |
58 | 58 | ||
59 | //US added method readIntListEntry | 59 | //US added method readIntListEntry |
60 | QValueList<int> readIntListEntry( const QString &); | 60 | Q3ValueList<int> readIntListEntry( const QString &); |
61 | 61 | ||
62 | int readNumEntry( const QString &, int def=0 ); | 62 | int readNumEntry( const QString &, int def=0 ); |
63 | QString readEntry( const QString &, const QString &def=QString::null ); | 63 | QString readEntry( const QString &, const QString &def=QString::null ); |
64 | QStringList readListEntry( const QString & ); | 64 | QStringList readListEntry( const QString & ); |
65 | bool readBoolEntry( const QString &, bool def=false ); | 65 | bool readBoolEntry( const QString &, bool def=false ); |
66 | QColor readColorEntry( const QString &, QColor * ); | 66 | QColor readColorEntry( const QString &, QColor * ); |
67 | QFont readFontEntry( const QString &, QFont * ); | 67 | QFont readFontEntry( const QString &, QFont * ); |
68 | QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 ); | 68 | QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 ); |
69 | QSize readSizeEntry(const QString &, QSize* ); | 69 | QSize readSizeEntry(const QString &, QSize* ); |
70 | bool hasKey( const QString &); | 70 | bool hasKey( const QString &); |
71 | 71 | ||
72 | void writeEntry( const QString &, const QValueList<int>& ); | 72 | void writeEntry( const QString &, const Q3ValueList<int>& ); |
73 | void writeEntry( const QString &, int ); | 73 | void writeEntry( const QString &, int ); |
74 | void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); } | 74 | void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); } |
75 | void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); } | 75 | void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); } |
76 | void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); } | 76 | void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); } |
77 | void writeEntry( const QString &, const QString & ); | 77 | void writeEntry( const QString &, const QString & ); |
78 | void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); } | 78 | void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); } |
79 | void writeEntry( const QString &, const QStringList & ); | 79 | void writeEntry( const QString &, const QStringList & ); |
80 | void writeEntry( const QString &, bool ); | 80 | void writeEntry( const QString &, bool ); |
81 | void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); } | 81 | void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); } |
82 | void writeEntry( const QString &, const QColor & ); | 82 | void writeEntry( const QString &, const QColor & ); |
83 | void writeEntry( const QString &, const QFont & ); | 83 | void writeEntry( const QString &, const QFont & ); |
84 | void writeEntry( const QString &, const QDateTime & ); | 84 | void writeEntry( const QString &, const QDateTime & ); |
85 | void writeEntry( const QString &, const QSize & ); | 85 | void writeEntry( const QString &, const QSize & ); |
86 | 86 | ||
87 | void deleteEntry( const QString &); | 87 | void deleteEntry( const QString &); |
88 | 88 | ||
diff --git a/microkde/kdatepickernew.cpp b/microkde/kdatepickernew.cpp index f60a422..8f8001e 100644 --- a/microkde/kdatepickernew.cpp +++ b/microkde/kdatepickernew.cpp | |||
@@ -300,33 +300,33 @@ KDatePicker::weekSelected(int week) | |||
300 | date = calendar->addDays(date, 1); | 300 | date = calendar->addDays(date, 1); |
301 | 301 | ||
302 | // date is now first day in week 1 some day in week 1 | 302 | // date is now first day in week 1 some day in week 1 |
303 | date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7); | 303 | date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7); |
304 | 304 | ||
305 | setDate(date); | 305 | setDate(date); |
306 | } | 306 | } |
307 | 307 | ||
308 | void | 308 | void |
309 | KDatePicker::selectMonthClicked() | 309 | KDatePicker::selectMonthClicked() |
310 | { | 310 | { |
311 | // every year can have different month names (in some calendar systems) | 311 | // every year can have different month names (in some calendar systems) |
312 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); | 312 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); |
313 | QDate date = table->getDate(); | 313 | QDate date = table->getDate(); |
314 | int i, month, months = calendar->monthsInYear(date); | 314 | int i, month, months = calendar->monthsInYear(date); |
315 | 315 | ||
316 | QPopupMenu popup(selectMonth); | 316 | Q3PopupMenu popup(selectMonth); |
317 | 317 | ||
318 | for (i = 1; i <= months; i++) | 318 | for (i = 1; i <= months; i++) |
319 | popup.insertItem(calendar->monthName(i, calendar->year(date)), i); | 319 | popup.insertItem(calendar->monthName(i, calendar->year(date)), i); |
320 | 320 | ||
321 | popup.setActiveItem(calendar->month(date) - 1); | 321 | popup.setActiveItem(calendar->month(date) - 1); |
322 | 322 | ||
323 | if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled | 323 | if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled |
324 | 324 | ||
325 | int day = calendar->day(date); | 325 | int day = calendar->day(date); |
326 | // ----- construct a valid date in this month: | 326 | // ----- construct a valid date in this month: |
327 | //date.setYMD(date.year(), month, 1); | 327 | //date.setYMD(date.year(), month, 1); |
328 | //date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); | 328 | //date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); |
329 | calendar->setYMD(date, calendar->year(date), month, | 329 | calendar->setYMD(date, calendar->year(date), month, |
330 | QMIN(day, calendar->daysInMonth(date))); | 330 | QMIN(day, calendar->daysInMonth(date))); |
331 | // ----- set this month | 331 | // ----- set this month |
332 | setDate(date); | 332 | setDate(date); |
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 353f78d..10dc449 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -31,184 +31,191 @@ | |||
31 | // | 31 | // |
32 | // When a date is selected by the user, it emits a signal: | 32 | // When a date is selected by the user, it emits a signal: |
33 | // dateSelected(QDate) | 33 | // dateSelected(QDate) |
34 | 34 | ||
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kglobalsettings.h> | 36 | #include <kglobalsettings.h> |
37 | #include <kapplication.h> | 37 | #include <kapplication.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <knotifyclient.h> | 40 | #include <knotifyclient.h> |
41 | #include "kdatetbl.h" | 41 | #include "kdatetbl.h" |
42 | #include <qdatetime.h> | 42 | #include <qdatetime.h> |
43 | #include <qstring.h> | 43 | #include <qstring.h> |
44 | #include <qpen.h> | 44 | #include <qpen.h> |
45 | #include <qpainter.h> | 45 | #include <qpainter.h> |
46 | #include <qdialog.h> | 46 | #include <qdialog.h> |
47 | #include <QDesktopWidget> | ||
48 | //Added by qt3to4: | ||
49 | #include <QResizeEvent> | ||
50 | #include <QFocusEvent> | ||
51 | #include <Q3Frame> | ||
52 | #include <QMouseEvent> | ||
53 | #include <QKeyEvent> | ||
54 | #include <QEvent> | ||
47 | #include <assert.h> | 55 | #include <assert.h> |
48 | #include <qapplication.h> | 56 | #include <qapplication.h> |
49 | 57 | ||
50 | KDateValidator::KDateValidator(QWidget* parent, const char* name) | 58 | KDateValidator::KDateValidator(QWidget* parent, const char* name) |
51 | : QValidator(parent, name) | 59 | : QValidator(parent, name) |
52 | { | 60 | { |
53 | } | 61 | } |
54 | 62 | ||
55 | QValidator::State | 63 | QValidator::State |
56 | KDateValidator::validate(QString& text, int&) const | 64 | KDateValidator::validate(QString& text, int&) const |
57 | { | 65 | { |
58 | QDate temp; | 66 | QDate temp; |
59 | // ----- everything is tested in date(): | 67 | // ----- everything is tested in date(): |
60 | return date(text, temp); | 68 | return date(text, temp); |
61 | } | 69 | } |
62 | 70 | ||
63 | QValidator::State | 71 | QValidator::State |
64 | KDateValidator::date(const QString& text, QDate& d) const | 72 | KDateValidator::date(const QString& text, QDate& d) const |
65 | { | 73 | { |
66 | QDate tmp = KGlobal::locale()->readDate(text); | 74 | QDate tmp = KGlobal::locale()->readDate(text); |
67 | if (!tmp.isNull()) | 75 | if (!tmp.isNull()) |
68 | { | 76 | { |
69 | d = tmp; | 77 | d = tmp; |
70 | return Acceptable; | 78 | return Acceptable; |
71 | } else | 79 | } else |
72 | return Valid; | 80 | return QValidator::Intermediate; |
73 | } | 81 | } |
74 | 82 | ||
75 | void | 83 | void |
76 | KDateValidator::fixup( QString& ) const | 84 | KDateValidator::fixup( QString& ) const |
77 | { | 85 | { |
78 | 86 | ||
79 | } | 87 | } |
80 | 88 | ||
81 | KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f) | 89 | KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, Qt::WFlags f) |
82 | : QGridView(parent, name, f) | 90 | : Q3GridView(parent, name, f) |
83 | { | 91 | { |
84 | setFont( KGlobalSettings::generalFont() ); | 92 | setFont( KGlobalSettings::generalFont() ); |
85 | if(!date_.isValid()) | 93 | if(!date_.isValid()) |
86 | { | 94 | { |
87 | date_=QDate::currentDate(); | 95 | date_=QDate::currentDate(); |
88 | } | 96 | } |
89 | setFocusPolicy( QWidget::StrongFocus ); | 97 | setFocusPolicy( Qt::StrongFocus ); |
90 | setNumRows(7); // 6 weeks max + headline | 98 | setNumRows(7); // 6 weeks max + headline |
91 | setNumCols(7); // 7 days a week | 99 | setNumCols(7); // 7 days a week |
92 | setHScrollBarMode(AlwaysOff); | 100 | setHScrollBarMode(AlwaysOff); |
93 | setVScrollBarMode(AlwaysOff); | 101 | setVScrollBarMode(AlwaysOff); |
94 | viewport()->setBackgroundColor(QColor(220,245,255)); | 102 | viewport()->setBackgroundColor(QColor(220,245,255)); |
95 | #if 0 | 103 | #if 0 |
96 | viewport()->setEraseColor(lightGray); | 104 | viewport()->setEraseColor(Qt::lightGray); |
97 | #endif | 105 | #endif |
98 | mMarkCurrent = false; | 106 | mMarkCurrent = false; |
99 | setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth | 107 | setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth |
100 | } | 108 | } |
101 | 109 | ||
102 | void | 110 | void |
103 | KDateTable::paintCell(QPainter *painter, int row, int col) | 111 | KDateTable::paintCell(QPainter *painter, int row, int col) |
104 | { | 112 | { |
105 | QRect rect; | 113 | QRect rect; |
106 | QString text; | 114 | QString text; |
107 | QPen pen; | 115 | QPen pen; |
108 | int w=cellWidth(); | 116 | int w=cellWidth(); |
109 | int h=cellHeight(); | 117 | int h=cellHeight(); |
110 | int pos; | 118 | int pos; |
111 | QBrush brushBlue(blue); | 119 | QBrush brushBlue(Qt::blue); |
112 | QBrush brushLightblue(QColor(220,245,255)); | 120 | QBrush brushLightblue(QColor(220,245,255)); |
113 | QFont _font=font(); | 121 | QFont _font=font(); |
114 | // ----- | 122 | // ----- |
115 | if(row==0) | 123 | if(row==0) |
116 | { // we are drawing the headline | 124 | { // we are drawing the headline |
117 | _font.setBold(true); | 125 | _font.setBold(true); |
118 | painter->setFont(_font); | 126 | painter->setFont(_font); |
119 | bool normalday = true; | 127 | bool normalday = true; |
120 | QString daystr; | 128 | QString daystr; |
121 | if (KGlobal::locale()->weekStartsMonday()) | 129 | if (KGlobal::locale()->weekStartsMonday()) |
122 | { | 130 | { |
123 | daystr = KGlobal::locale()->weekDayName(col+1, true); | 131 | daystr = KGlobal::locale()->weekDayName(col+1, true); |
124 | if (col == 5 || col == 6) | 132 | if (col == 5 || col == 6) |
125 | normalday = false; | 133 | normalday = false; |
126 | } else { | 134 | } else { |
127 | daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true); | 135 | daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true); |
128 | if (col == 0 || col == 6) | 136 | if (col == 0 || col == 6) |
129 | normalday = false; | 137 | normalday = false; |
130 | } | 138 | } |
131 | if (!normalday) | 139 | if (!normalday) |
132 | { | 140 | { |
133 | painter->setPen(QColor(220,245,255)); | 141 | painter->setPen(QColor(220,245,255)); |
134 | painter->setBrush(brushLightblue); | 142 | painter->setBrush(brushLightblue); |
135 | painter->drawRect(0, 0, w, h); | 143 | painter->drawRect(0, 0, w, h); |
136 | painter->setPen(blue); | 144 | painter->setPen(Qt::blue); |
137 | } else { | 145 | } else { |
138 | painter->setPen(blue); | 146 | painter->setPen(Qt::blue); |
139 | painter->setBrush(brushBlue); | 147 | painter->setBrush(brushBlue); |
140 | painter->drawRect(0, 0, w, h); | 148 | painter->drawRect(0, 0, w, h); |
141 | painter->setPen(white); | 149 | painter->setPen(Qt::white); |
142 | } | 150 | } |
143 | painter->drawText(0, 0, w, h-1, AlignCenter, | 151 | painter->drawText(0, 0, w, h-1, Qt::AlignCenter, |
144 | daystr, -1, &rect); | 152 | daystr, -1, &rect); |
145 | painter->setPen(black); | 153 | painter->setPen(Qt::black); |
146 | painter->moveTo(0, h-1); | 154 | painter->drawLine(0, h-1, w-1, h-1); |
147 | painter->lineTo(w-1, h-1); | ||
148 | // ----- draw the weekday: | 155 | // ----- draw the weekday: |
149 | } else { | 156 | } else { |
150 | painter->setFont(_font); | 157 | painter->setFont(_font); |
151 | pos=7*(row-1)+col; | 158 | pos=7*(row-1)+col; |
152 | if (KGlobal::locale()->weekStartsMonday()) | 159 | if (KGlobal::locale()->weekStartsMonday()) |
153 | pos++; | 160 | pos++; |
154 | if(pos<firstday || (firstday+numdays<=pos)) | 161 | if(pos<firstday || (firstday+numdays<=pos)) |
155 | { // we are either | 162 | { // we are either |
156 | // ° painting a day of the previous month or | 163 | // ° painting a day of the previous month or |
157 | // ° painting a day of the following month | 164 | // ° painting a day of the following month |
158 | if(pos<firstday) | 165 | if(pos<firstday) |
159 | { // previous month | 166 | { // previous month |
160 | text.setNum(numDaysPrevMonth+pos-firstday+1); | 167 | text.setNum(numDaysPrevMonth+pos-firstday+1); |
161 | } else { // following month | 168 | } else { // following month |
162 | text.setNum(pos-firstday-numdays+1); | 169 | text.setNum(pos-firstday-numdays+1); |
163 | } | 170 | } |
164 | painter->setPen(gray); | 171 | painter->setPen(Qt::gray); |
165 | } else { // paint a day of the current month | 172 | } else { // paint a day of the current month |
166 | text.setNum(pos-firstday+1); | 173 | text.setNum(pos-firstday+1); |
167 | painter->setPen(black); | 174 | painter->setPen(Qt::black); |
168 | } | 175 | } |
169 | 176 | ||
170 | pen=painter->pen(); | 177 | pen=painter->pen(); |
171 | if(firstday+date.day()-1==pos) | 178 | if(firstday+date.day()-1==pos) |
172 | { | 179 | { |
173 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) | 180 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) |
174 | painter->setPen(green); | 181 | painter->setPen(Qt::green); |
175 | else | 182 | else |
176 | painter->setPen(red); | 183 | painter->setPen(Qt::red); |
177 | if(hasFocus()) | 184 | if(hasFocus()) |
178 | { | 185 | { |
179 | painter->setBrush(darkRed); | 186 | painter->setBrush(Qt::darkRed); |
180 | pen=white; | 187 | pen=QColor(Qt::white); |
181 | } else { | 188 | } else { |
182 | painter->setBrush(darkGray); | 189 | painter->setBrush(Qt::darkGray); |
183 | pen=white; | 190 | pen=QColor(Qt::white); |
184 | } | 191 | } |
185 | } else { | 192 | } else { |
186 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) | 193 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) |
187 | { | 194 | { |
188 | painter->setPen(green); | 195 | painter->setPen(Qt::green); |
189 | painter->setBrush(darkGreen); | 196 | painter->setBrush(Qt::darkGreen); |
190 | pen=white; | 197 | pen=QColor(Qt::white); |
191 | } else { | 198 | } else { |
192 | painter->setBrush(QColor(220,245,255)); | 199 | painter->setBrush(QColor(220,245,255)); |
193 | painter->setPen(QColor(220,245,255)); | 200 | painter->setPen(QColor(220,245,255)); |
194 | } | 201 | } |
195 | } | 202 | } |
196 | painter->drawRect(0, 0, w, h); | 203 | painter->drawRect(0, 0, w, h); |
197 | painter->setPen(pen); | 204 | painter->setPen(pen); |
198 | painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); | 205 | painter->drawText(0, 0, w, h, Qt::AlignCenter, text, -1, &rect); |
199 | } | 206 | } |
200 | /* | 207 | /* |
201 | if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); | 208 | if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); |
202 | if(rect.height()>maxCell.height()) { | 209 | if(rect.height()>maxCell.height()) { |
203 | maxCell.setHeight(rect.height()); | 210 | maxCell.setHeight(rect.height()); |
204 | } | 211 | } |
205 | */ | 212 | */ |
206 | } | 213 | } |
207 | 214 | ||
208 | void | 215 | void |
209 | KDateTable::keyPressEvent( QKeyEvent *e ) | 216 | KDateTable::keyPressEvent( QKeyEvent *e ) |
210 | { | 217 | { |
211 | /* | 218 | /* |
212 | // not working properly | 219 | // not working properly |
213 | if ( e->key() == Qt::Key_Prior ) { | 220 | if ( e->key() == Qt::Key_Prior ) { |
214 | if ( date.month() == 1 ) { | 221 | if ( date.month() == 1 ) { |
@@ -261,33 +268,33 @@ KDateTable::keyPressEvent( QKeyEvent *e ) | |||
261 | } | 268 | } |
262 | if ( irgnore ) { | 269 | if ( irgnore ) { |
263 | e->ignore(); | 270 | e->ignore(); |
264 | return; | 271 | return; |
265 | } | 272 | } |
266 | 273 | ||
267 | pos += add; | 274 | pos += add; |
268 | setDate(date.addDays( add )); | 275 | setDate(date.addDays( add )); |
269 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 276 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
270 | updateCell(pos/7+1, pos%7); // Update the selected cell | 277 | updateCell(pos/7+1, pos%7); // Update the selected cell |
271 | 278 | ||
272 | } | 279 | } |
273 | 280 | ||
274 | void | 281 | void |
275 | KDateTable::viewportResizeEvent(QResizeEvent * e) | 282 | KDateTable::viewportResizeEvent(QResizeEvent * e) |
276 | { | 283 | { |
277 | QGridView::viewportResizeEvent(e); | 284 | Q3GridView::viewportResizeEvent(e); |
278 | 285 | ||
279 | setCellWidth(viewport()->width()/7); | 286 | setCellWidth(viewport()->width()/7); |
280 | setCellHeight(viewport()->height()/7); | 287 | setCellHeight(viewport()->height()/7); |
281 | } | 288 | } |
282 | 289 | ||
283 | void | 290 | void |
284 | KDateTable::setFontSize(int size) | 291 | KDateTable::setFontSize(int size) |
285 | { | 292 | { |
286 | int count; | 293 | int count; |
287 | QRect rect; | 294 | QRect rect; |
288 | // ----- store rectangles: | 295 | // ----- store rectangles: |
289 | fontsize=size; | 296 | fontsize=size; |
290 | QFont _font = font(); | 297 | QFont _font = font(); |
291 | _font.setPointSize(fontsize); | 298 | _font.setPointSize(fontsize); |
292 | setFont( _font ); | 299 | setFont( _font ); |
293 | _font.setBold( true ); | 300 | _font.setBold( true ); |
@@ -396,164 +403,164 @@ KDateTable::setDate(const QDate& date_) | |||
396 | { | 403 | { |
397 | repaintContents(false); | 404 | repaintContents(false); |
398 | } | 405 | } |
399 | emit(dateChanged(date)); | 406 | emit(dateChanged(date)); |
400 | return true; | 407 | return true; |
401 | } | 408 | } |
402 | 409 | ||
403 | const QDate& | 410 | const QDate& |
404 | KDateTable::getDate() const | 411 | KDateTable::getDate() const |
405 | { | 412 | { |
406 | return date; | 413 | return date; |
407 | } | 414 | } |
408 | 415 | ||
409 | void KDateTable::focusInEvent( QFocusEvent *e ) | 416 | void KDateTable::focusInEvent( QFocusEvent *e ) |
410 | { | 417 | { |
411 | repaintContents(false); | 418 | repaintContents(false); |
412 | QGridView::focusInEvent( e ); | 419 | Q3GridView::focusInEvent( e ); |
413 | } | 420 | } |
414 | 421 | ||
415 | void KDateTable::focusOutEvent( QFocusEvent *e ) | 422 | void KDateTable::focusOutEvent( QFocusEvent *e ) |
416 | { | 423 | { |
417 | repaintContents(false); | 424 | repaintContents(false); |
418 | QGridView::focusOutEvent( e ); | 425 | Q3GridView::focusOutEvent( e ); |
419 | } | 426 | } |
420 | 427 | ||
421 | QSize | 428 | QSize |
422 | KDateTable::sizeHint() const | 429 | KDateTable::sizeHint() const |
423 | { | 430 | { |
424 | if(maxCell.height()>0 && maxCell.width()>0) | 431 | if(maxCell.height()>0 && maxCell.width()>0) |
425 | { | 432 | { |
426 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), | 433 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), |
427 | (maxCell.height()+4)*numRows()+2*frameWidth()); | 434 | (maxCell.height()+4)*numRows()+2*frameWidth()); |
428 | } else { | 435 | } else { |
429 | return QSize(-1, -1); | 436 | return QSize(-1, -1); |
430 | } | 437 | } |
431 | } | 438 | } |
432 | 439 | ||
433 | KDateInternalMonthPicker::KDateInternalMonthPicker | 440 | KDateInternalMonthPicker::KDateInternalMonthPicker |
434 | (QWidget* parent, const char* name) | 441 | (QWidget* parent, const char* name) |
435 | : QGridView(parent, name), | 442 | : Q3GridView(parent, name), |
436 | result(0) // invalid | 443 | result(0) // invalid |
437 | { | 444 | { |
438 | QRect rect; | 445 | QRect rect; |
439 | QFont font; | 446 | QFont font; |
440 | // ----- | 447 | // ----- |
441 | activeCol = -1; | 448 | activeCol = -1; |
442 | activeRow = -1; | 449 | activeRow = -1; |
443 | font=KGlobalSettings::generalFont(); | 450 | font=KGlobalSettings::generalFont(); |
444 | int fontsize = 10; | 451 | int fontsize = 10; |
445 | int add = 2; | 452 | int add = 2; |
446 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 453 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
447 | add += 8; | 454 | add += 8; |
448 | if ( QApplication::desktop()->width() > 640 ) | 455 | if ( QApplication::desktop()->width() > 640 ) |
449 | add += 6; | 456 | add += 6; |
450 | font.setPointSize(fontsize+add); | 457 | font.setPointSize(fontsize+add); |
451 | setFont(font); | 458 | setFont(font); |
452 | setHScrollBarMode(AlwaysOff); | 459 | setHScrollBarMode(AlwaysOff); |
453 | setVScrollBarMode(AlwaysOff); | 460 | setVScrollBarMode(AlwaysOff); |
454 | setFrameStyle(QFrame::NoFrame); | 461 | setFrameStyle(Q3Frame::NoFrame); |
455 | setNumRows(4); | 462 | setNumRows(4); |
456 | setNumCols(3); | 463 | setNumCols(3); |
457 | // enable to find drawing failures: | 464 | // enable to find drawing failures: |
458 | // setTableFlags(Tbl_clipCellPainting); | 465 | // setTableFlags(Tbl_clipCellPainting); |
459 | #if 0 | 466 | #if 0 |
460 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 467 | viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker |
461 | #endif | 468 | #endif |
462 | // ----- find the preferred size | 469 | // ----- find the preferred size |
463 | // (this is slow, possibly, but unfortunatly it is needed here): | 470 | // (this is slow, possibly, but unfortunatly it is needed here): |
464 | QFontMetrics metrics(font); | 471 | QFontMetrics metrics(font); |
465 | for(int i=1; i <= 12; ++i) | 472 | for(int i=1; i <= 12; ++i) |
466 | { | 473 | { |
467 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 474 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
468 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 475 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
469 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 476 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
470 | } | 477 | } |
471 | 478 | ||
472 | } | 479 | } |
473 | 480 | ||
474 | QSize | 481 | QSize |
475 | KDateInternalMonthPicker::sizeHint() const | 482 | KDateInternalMonthPicker::sizeHint() const |
476 | { | 483 | { |
477 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 484 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
478 | (max.height()+6)*numRows()+2*frameWidth()); | 485 | (max.height()+6)*numRows()+2*frameWidth()); |
479 | } | 486 | } |
480 | 487 | ||
481 | int | 488 | int |
482 | KDateInternalMonthPicker::getResult() const | 489 | KDateInternalMonthPicker::getResult() const |
483 | { | 490 | { |
484 | return result; | 491 | return result; |
485 | } | 492 | } |
486 | 493 | ||
487 | void | 494 | void |
488 | KDateInternalMonthPicker::setupPainter(QPainter *p) | 495 | KDateInternalMonthPicker::setupPainter(QPainter *p) |
489 | { | 496 | { |
490 | p->setPen(black); | 497 | p->setPen(Qt::black); |
491 | } | 498 | } |
492 | 499 | ||
493 | void | 500 | void |
494 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) | 501 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) |
495 | { | 502 | { |
496 | setCellWidth(width()/3); | 503 | setCellWidth(width()/3); |
497 | setCellHeight(height()/4); | 504 | setCellHeight(height()/4); |
498 | } | 505 | } |
499 | 506 | ||
500 | void | 507 | void |
501 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) | 508 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) |
502 | { | 509 | { |
503 | int index; | 510 | int index; |
504 | QString text; | 511 | QString text; |
505 | // ----- find the number of the cell: | 512 | // ----- find the number of the cell: |
506 | index=3*row+col+1; | 513 | index=3*row+col+1; |
507 | text=KGlobal::locale()->monthName(index, false); | 514 | text=KGlobal::locale()->monthName(index, false); |
508 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 515 | painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text); |
509 | if ( activeCol == col && activeRow == row ) | 516 | if ( activeCol == col && activeRow == row ) |
510 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); | 517 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); |
511 | } | 518 | } |
512 | 519 | ||
513 | void | 520 | void |
514 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) | 521 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) |
515 | { | 522 | { |
516 | if(!isEnabled() || e->button() != LeftButton) | 523 | if(!isEnabled() || e->button() != Qt::LeftButton) |
517 | { | 524 | { |
518 | KNotifyClient::beep(); | 525 | KNotifyClient::beep(); |
519 | return; | 526 | return; |
520 | } | 527 | } |
521 | // ----- | 528 | // ----- |
522 | int row, col; | 529 | int row, col; |
523 | QPoint mouseCoord; | 530 | QPoint mouseCoord; |
524 | // ----- | 531 | // ----- |
525 | mouseCoord = e->pos(); | 532 | mouseCoord = e->pos(); |
526 | row=rowAt(mouseCoord.y()); | 533 | row=rowAt(mouseCoord.y()); |
527 | col=columnAt(mouseCoord.x()); | 534 | col=columnAt(mouseCoord.x()); |
528 | 535 | ||
529 | if(row<0 || col<0) | 536 | if(row<0 || col<0) |
530 | { // the user clicked on the frame of the table | 537 | { // the user clicked on the frame of the table |
531 | activeCol = -1; | 538 | activeCol = -1; |
532 | activeRow = -1; | 539 | activeRow = -1; |
533 | } else { | 540 | } else { |
534 | activeCol = col; | 541 | activeCol = col; |
535 | activeRow = row; | 542 | activeRow = row; |
536 | updateCell( row, col /*, false */ ); | 543 | updateCell( row, col /*, false */ ); |
537 | } | 544 | } |
538 | } | 545 | } |
539 | 546 | ||
540 | void | 547 | void |
541 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) | 548 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) |
542 | { | 549 | { |
543 | if (e->state() & LeftButton) | 550 | if (e->state() & Qt::LeftButton) |
544 | { | 551 | { |
545 | int row, col; | 552 | int row, col; |
546 | QPoint mouseCoord; | 553 | QPoint mouseCoord; |
547 | // ----- | 554 | // ----- |
548 | mouseCoord = e->pos(); | 555 | mouseCoord = e->pos(); |
549 | row=rowAt(mouseCoord.y()); | 556 | row=rowAt(mouseCoord.y()); |
550 | col=columnAt(mouseCoord.x()); | 557 | col=columnAt(mouseCoord.x()); |
551 | int tmpRow = -1, tmpCol = -1; | 558 | int tmpRow = -1, tmpCol = -1; |
552 | if(row<0 || col<0) | 559 | if(row<0 || col<0) |
553 | { // the user clicked on the frame of the table | 560 | { // the user clicked on the frame of the table |
554 | if ( activeCol > -1 ) | 561 | if ( activeCol > -1 ) |
555 | { | 562 | { |
556 | tmpRow = activeRow; | 563 | tmpRow = activeRow; |
557 | tmpCol = activeCol; | 564 | tmpCol = activeCol; |
558 | } | 565 | } |
559 | activeCol = -1; | 566 | activeCol = -1; |
@@ -601,33 +608,33 @@ KDateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e) | |||
601 | } | 608 | } |
602 | 609 | ||
603 | 610 | ||
604 | 611 | ||
605 | KDateInternalYearSelector::KDateInternalYearSelector | 612 | KDateInternalYearSelector::KDateInternalYearSelector |
606 | (int fontsize, QWidget* parent, const char* name) | 613 | (int fontsize, QWidget* parent, const char* name) |
607 | : QLineEdit(parent, name), | 614 | : QLineEdit(parent, name), |
608 | val(new QIntValidator(this)), | 615 | val(new QIntValidator(this)), |
609 | result(0) | 616 | result(0) |
610 | { | 617 | { |
611 | QFont font; | 618 | QFont font; |
612 | // ----- | 619 | // ----- |
613 | font=KGlobalSettings::generalFont(); | 620 | font=KGlobalSettings::generalFont(); |
614 | font.setPointSize(fontsize); | 621 | font.setPointSize(fontsize); |
615 | setFont(font); | 622 | setFont(font); |
616 | #if 0 | 623 | #if 0 |
617 | setFrameStyle(QFrame::NoFrame); | 624 | setFrameStyle(Q3Frame::NoFrame); |
618 | #endif | 625 | #endif |
619 | // we have to respect the limits of QDate here, I fear: | 626 | // we have to respect the limits of QDate here, I fear: |
620 | val->setRange(0, 8000); | 627 | val->setRange(0, 8000); |
621 | setValidator(val); | 628 | setValidator(val); |
622 | connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot())); | 629 | connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot())); |
623 | } | 630 | } |
624 | 631 | ||
625 | void | 632 | void |
626 | KDateInternalYearSelector::yearEnteredSlot() | 633 | KDateInternalYearSelector::yearEnteredSlot() |
627 | { | 634 | { |
628 | bool ok; | 635 | bool ok; |
629 | int year; | 636 | int year; |
630 | QDate date; | 637 | QDate date; |
631 | // ----- check if this is a valid year: | 638 | // ----- check if this is a valid year: |
632 | year=text().toInt(&ok); | 639 | year=text().toInt(&ok); |
633 | if(!ok) | 640 | if(!ok) |
@@ -648,44 +655,44 @@ KDateInternalYearSelector::yearEnteredSlot() | |||
648 | int | 655 | int |
649 | KDateInternalYearSelector::getYear() | 656 | KDateInternalYearSelector::getYear() |
650 | { | 657 | { |
651 | return result; | 658 | return result; |
652 | } | 659 | } |
653 | 660 | ||
654 | void | 661 | void |
655 | KDateInternalYearSelector::setYear(int year) | 662 | KDateInternalYearSelector::setYear(int year) |
656 | { | 663 | { |
657 | QString temp; | 664 | QString temp; |
658 | // ----- | 665 | // ----- |
659 | temp.setNum(year); | 666 | temp.setNum(year); |
660 | setText(temp); | 667 | setText(temp); |
661 | } | 668 | } |
662 | 669 | ||
663 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) | 670 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) |
664 | : QFrame(parent, name, WType_Popup), | 671 | : Q3Frame(parent, name, Qt::WType_Popup), |
665 | result(0), // rejected | 672 | result(0), // rejected |
666 | main(0) | 673 | main(0) |
667 | { | 674 | { |
668 | setFrameStyle(QFrame::Box|QFrame::Raised); | 675 | setFrameStyle(Q3Frame::Box|Q3Frame::Raised); |
669 | setMidLineWidth(2); | 676 | setMidLineWidth(2); |
670 | } | 677 | } |
671 | 678 | ||
672 | void | 679 | void |
673 | KPopupFrame::keyPressEvent(QKeyEvent* e) | 680 | KPopupFrame::keyPressEvent(QKeyEvent* e) |
674 | { | 681 | { |
675 | if(e->key()==Key_Escape) | 682 | if(e->key()==Qt::Key_Escape) |
676 | { | 683 | { |
677 | result=0; // rejected | 684 | result=0; // rejected |
678 | qApp->exit_loop(); | 685 | qApp->exit_loop(); |
679 | } | 686 | } |
680 | } | 687 | } |
681 | 688 | ||
682 | void | 689 | void |
683 | KPopupFrame::close(int r) | 690 | KPopupFrame::close(int r) |
684 | { | 691 | { |
685 | result=r; | 692 | result=r; |
686 | qApp->exit_loop(); | 693 | qApp->exit_loop(); |
687 | } | 694 | } |
688 | 695 | ||
689 | void | 696 | void |
690 | KPopupFrame::setMainWidget(QWidget* m) | 697 | KPopupFrame::setMainWidget(QWidget* m) |
691 | { | 698 | { |
@@ -743,61 +750,61 @@ int | |||
743 | KPopupFrame::exec(int x, int y) | 750 | KPopupFrame::exec(int x, int y) |
744 | { | 751 | { |
745 | return exec(QPoint(x, y)); | 752 | return exec(QPoint(x, y)); |
746 | } | 753 | } |
747 | 754 | ||
748 | void KPopupFrame::virtual_hook( int, void* ) | 755 | void KPopupFrame::virtual_hook( int, void* ) |
749 | { /*BASE::virtual_hook( id, data );*/ } | 756 | { /*BASE::virtual_hook( id, data );*/ } |
750 | 757 | ||
751 | void KDateTable::virtual_hook( int, void* ) | 758 | void KDateTable::virtual_hook( int, void* ) |
752 | { /*BASE::virtual_hook( id, data );*/ } | 759 | { /*BASE::virtual_hook( id, data );*/ } |
753 | 760 | ||
754 | //#include "kdatetbl.moc" | 761 | //#include "kdatetbl.moc" |
755 | 762 | ||
756 | 763 | ||
757 | KDateInternalWeekPicker::KDateInternalWeekPicker | 764 | KDateInternalWeekPicker::KDateInternalWeekPicker |
758 | (QWidget* parent, const char* name) | 765 | (QWidget* parent, const char* name) |
759 | : QGridView(parent, name), | 766 | : Q3GridView(parent, name), |
760 | result(0) // invalid | 767 | result(0) // invalid |
761 | { | 768 | { |
762 | QRect rect; | 769 | QRect rect; |
763 | QFont font; | 770 | QFont font; |
764 | // ----- | 771 | // ----- |
765 | activeCol = -1; | 772 | activeCol = -1; |
766 | activeRow = -1; | 773 | activeRow = -1; |
767 | font=KGlobalSettings::generalFont(); | 774 | font=KGlobalSettings::generalFont(); |
768 | int fontsize = 10; | 775 | int fontsize = 10; |
769 | int add = 2; | 776 | int add = 2; |
770 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 777 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
771 | add += 6; | 778 | add += 6; |
772 | font.setPointSize(fontsize+add); | 779 | font.setPointSize(fontsize+add); |
773 | setFont(font); | 780 | setFont(font); |
774 | setHScrollBarMode(AlwaysOff); | 781 | setHScrollBarMode(AlwaysOff); |
775 | setVScrollBarMode(AlwaysOff); | 782 | setVScrollBarMode(AlwaysOff); |
776 | setFrameStyle(QFrame::NoFrame); | 783 | setFrameStyle(Q3Frame::NoFrame); |
777 | if ( QApplication::desktop()->height() > 240 ) { | 784 | if ( QApplication::desktop()->height() > 240 ) { |
778 | setNumRows(13); | 785 | setNumRows(13); |
779 | setNumCols(4); | 786 | setNumCols(4); |
780 | } else { | 787 | } else { |
781 | setNumRows(4); | 788 | setNumRows(4); |
782 | setNumCols(13); | 789 | setNumCols(13); |
783 | } | 790 | } |
784 | // enable to find drawing failures: | 791 | // enable to find drawing failures: |
785 | // setTableFlags(Tbl_clipCellPainting); | 792 | // setTableFlags(Tbl_clipCellPainting); |
786 | #if 0 | 793 | #if 0 |
787 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 794 | viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker |
788 | #endif | 795 | #endif |
789 | // ----- find the preferred size | 796 | // ----- find the preferred size |
790 | // (this is slow, possibly, but unfortunatly it is needed here): | 797 | // (this is slow, possibly, but unfortunatly it is needed here): |
791 | QFontMetrics metrics(font); | 798 | QFontMetrics metrics(font); |
792 | for(int i=1; i <= 52; ++i) | 799 | for(int i=1; i <= 52; ++i) |
793 | { | 800 | { |
794 | rect=metrics.boundingRect(QString::number( i )); | 801 | rect=metrics.boundingRect(QString::number( i )); |
795 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 802 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
796 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 803 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
797 | } | 804 | } |
798 | if ( QApplication::desktop()->width() > 640 ) { | 805 | if ( QApplication::desktop()->width() > 640 ) { |
799 | 806 | ||
800 | max.setWidth(max.width()+6); | 807 | max.setWidth(max.width()+6); |
801 | max.setHeight(max.height()+8); | 808 | max.setHeight(max.height()+8); |
802 | } | 809 | } |
803 | } | 810 | } |
@@ -805,86 +812,86 @@ KDateInternalWeekPicker::KDateInternalWeekPicker | |||
805 | QSize | 812 | QSize |
806 | KDateInternalWeekPicker::sizeHint() const | 813 | KDateInternalWeekPicker::sizeHint() const |
807 | { | 814 | { |
808 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 815 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
809 | (max.height()+6)*numRows()+2*frameWidth()); | 816 | (max.height()+6)*numRows()+2*frameWidth()); |
810 | } | 817 | } |
811 | 818 | ||
812 | int | 819 | int |
813 | KDateInternalWeekPicker::getResult() const | 820 | KDateInternalWeekPicker::getResult() const |
814 | { | 821 | { |
815 | return result; | 822 | return result; |
816 | } | 823 | } |
817 | 824 | ||
818 | void | 825 | void |
819 | KDateInternalWeekPicker::setupPainter(QPainter *p) | 826 | KDateInternalWeekPicker::setupPainter(QPainter *p) |
820 | { | 827 | { |
821 | p->setPen(black); | 828 | p->setPen(Qt::black); |
822 | } | 829 | } |
823 | 830 | ||
824 | void | 831 | void |
825 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) | 832 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) |
826 | { | 833 | { |
827 | setCellWidth(width()/ numCols()); | 834 | setCellWidth(width()/ numCols()); |
828 | setCellHeight(height()/ numRows()); | 835 | setCellHeight(height()/ numRows()); |
829 | } | 836 | } |
830 | 837 | ||
831 | void | 838 | void |
832 | KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) | 839 | KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) |
833 | { | 840 | { |
834 | int index; | 841 | int index; |
835 | QString text; | 842 | QString text; |
836 | // ----- find the number of the cell: | 843 | // ----- find the number of the cell: |
837 | index=numCols()*row+col+1; | 844 | index=numCols()*row+col+1; |
838 | text=QString::number( index ); | 845 | text=QString::number( index ); |
839 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 846 | painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text); |
840 | if ( activeCol == col && activeRow == row ) | 847 | if ( activeCol == col && activeRow == row ) |
841 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); | 848 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); |
842 | } | 849 | } |
843 | 850 | ||
844 | void | 851 | void |
845 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) | 852 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) |
846 | { | 853 | { |
847 | if(!isEnabled() || e->button() != LeftButton) | 854 | if(!isEnabled() || e->button() != Qt::LeftButton) |
848 | { | 855 | { |
849 | KNotifyClient::beep(); | 856 | KNotifyClient::beep(); |
850 | return; | 857 | return; |
851 | } | 858 | } |
852 | // ----- | 859 | // ----- |
853 | int row, col; | 860 | int row, col; |
854 | QPoint mouseCoord; | 861 | QPoint mouseCoord; |
855 | // ----- | 862 | // ----- |
856 | mouseCoord = e->pos(); | 863 | mouseCoord = e->pos(); |
857 | row=rowAt(mouseCoord.y()); | 864 | row=rowAt(mouseCoord.y()); |
858 | col=columnAt(mouseCoord.x()); | 865 | col=columnAt(mouseCoord.x()); |
859 | 866 | ||
860 | if(row<0 || col<0) | 867 | if(row<0 || col<0) |
861 | { // the user clicked on the frame of the table | 868 | { // the user clicked on the frame of the table |
862 | activeCol = -1; | 869 | activeCol = -1; |
863 | activeRow = -1; | 870 | activeRow = -1; |
864 | } else { | 871 | } else { |
865 | activeCol = col; | 872 | activeCol = col; |
866 | activeRow = row; | 873 | activeRow = row; |
867 | updateCell( row, col /*, false */ ); | 874 | updateCell( row, col /*, false */ ); |
868 | } | 875 | } |
869 | } | 876 | } |
870 | 877 | ||
871 | void | 878 | void |
872 | KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) | 879 | KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) |
873 | { | 880 | { |
874 | if (e->state() & LeftButton) | 881 | if (e->state() & Qt::LeftButton) |
875 | { | 882 | { |
876 | int row, col; | 883 | int row, col; |
877 | QPoint mouseCoord; | 884 | QPoint mouseCoord; |
878 | // ----- | 885 | // ----- |
879 | mouseCoord = e->pos(); | 886 | mouseCoord = e->pos(); |
880 | row=rowAt(mouseCoord.y()); | 887 | row=rowAt(mouseCoord.y()); |
881 | col=columnAt(mouseCoord.x()); | 888 | col=columnAt(mouseCoord.x()); |
882 | int tmpRow = -1, tmpCol = -1; | 889 | int tmpRow = -1, tmpCol = -1; |
883 | if(row<0 || col<0) | 890 | if(row<0 || col<0) |
884 | { // the user clicked on the frame of the table | 891 | { // the user clicked on the frame of the table |
885 | if ( activeCol > -1 ) | 892 | if ( activeCol > -1 ) |
886 | { | 893 | { |
887 | tmpRow = activeRow; | 894 | tmpRow = activeRow; |
888 | tmpCol = activeCol; | 895 | tmpCol = activeCol; |
889 | } | 896 | } |
890 | activeCol = -1; | 897 | activeCol = -1; |
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h index 87808df..2d3d2cf 100644 --- a/microkde/kdatetbl.h +++ b/microkde/kdatetbl.h | |||
@@ -8,43 +8,49 @@ | |||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KDATETBL_H | 20 | #ifndef KDATETBL_H |
21 | #define KDATETBL_H | 21 | #define KDATETBL_H |
22 | 22 | ||
23 | #include <qvalidator.h> | 23 | #include <qvalidator.h> |
24 | #include <qgridview.h> | 24 | #include <q3gridview.h> |
25 | #include <qlineedit.h> | 25 | #include <qlineedit.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | //Added by qt3to4: | ||
28 | #include <QResizeEvent> | ||
29 | #include <QMouseEvent> | ||
30 | #include <Q3Frame> | ||
31 | #include <QKeyEvent> | ||
32 | #include <QFocusEvent> | ||
27 | 33 | ||
28 | /** | 34 | /** |
29 | * A table containing month names. It is used to pick a month directly. | 35 | * A table containing month names. It is used to pick a month directly. |
30 | * @internal | 36 | * @internal |
31 | * @version $Id$ | 37 | * @version $Id$ |
32 | * @author Tim Gilman, Mirko Boehm | 38 | * @author Tim Gilman, Mirko Boehm |
33 | */ | 39 | */ |
34 | class KDateInternalMonthPicker : public QGridView | 40 | class KDateInternalMonthPicker : public Q3GridView |
35 | { | 41 | { |
36 | Q_OBJECT | 42 | Q_OBJECT |
37 | protected: | 43 | protected: |
38 | /** | 44 | /** |
39 | * Store the month that has been clicked [1..12]. | 45 | * Store the month that has been clicked [1..12]. |
40 | */ | 46 | */ |
41 | int result; | 47 | int result; |
42 | /** | 48 | /** |
43 | * the cell under mouse cursor when LBM is pressed | 49 | * the cell under mouse cursor when LBM is pressed |
44 | */ | 50 | */ |
45 | short int activeCol; | 51 | short int activeCol; |
46 | short int activeRow; | 52 | short int activeRow; |
47 | /** | 53 | /** |
48 | * Contains the largest rectangle needed by the month names. | 54 | * Contains the largest rectangle needed by the month names. |
49 | */ | 55 | */ |
50 | QRect max; | 56 | QRect max; |
@@ -114,33 +120,33 @@ public: | |||
114 | KDateInternalYearSelector(int fontsize, | 120 | KDateInternalYearSelector(int fontsize, |
115 | QWidget* parent=0, | 121 | QWidget* parent=0, |
116 | const char* name=0); | 122 | const char* name=0); |
117 | int getYear(); | 123 | int getYear(); |
118 | void setYear(int year); | 124 | void setYear(int year); |
119 | 125 | ||
120 | private: | 126 | private: |
121 | class KDateInternalYearPrivate; | 127 | class KDateInternalYearPrivate; |
122 | KDateInternalYearPrivate *d; | 128 | KDateInternalYearPrivate *d; |
123 | }; | 129 | }; |
124 | 130 | ||
125 | /** | 131 | /** |
126 | * Frame with popup menu behaviour. | 132 | * Frame with popup menu behaviour. |
127 | * @author Tim Gilman, Mirko Boehm | 133 | * @author Tim Gilman, Mirko Boehm |
128 | * @version $Id$ | 134 | * @version $Id$ |
129 | */ | 135 | */ |
130 | class KPopupFrame : public QFrame | 136 | class KPopupFrame : public Q3Frame |
131 | { | 137 | { |
132 | Q_OBJECT | 138 | Q_OBJECT |
133 | protected: | 139 | protected: |
134 | /** | 140 | /** |
135 | * The result. It is returned from exec() when the popup window closes. | 141 | * The result. It is returned from exec() when the popup window closes. |
136 | */ | 142 | */ |
137 | int result; | 143 | int result; |
138 | /** | 144 | /** |
139 | * Catch key press events. | 145 | * Catch key press events. |
140 | */ | 146 | */ |
141 | void keyPressEvent(QKeyEvent* e); | 147 | void keyPressEvent(QKeyEvent* e); |
142 | /** | 148 | /** |
143 | * The only subwidget that uses the whole dialog window. | 149 | * The only subwidget that uses the whole dialog window. |
144 | */ | 150 | */ |
145 | QWidget *main; | 151 | QWidget *main; |
146 | public slots: | 152 | public slots: |
@@ -169,75 +175,75 @@ public: | |||
169 | void resizeEvent(QResizeEvent*); | 175 | void resizeEvent(QResizeEvent*); |
170 | /** | 176 | /** |
171 | * Open the popup window at position pos. | 177 | * Open the popup window at position pos. |
172 | */ | 178 | */ |
173 | void popup(const QPoint &pos); | 179 | void popup(const QPoint &pos); |
174 | /** | 180 | /** |
175 | * Execute the popup window. | 181 | * Execute the popup window. |
176 | */ | 182 | */ |
177 | int exec(QPoint p); | 183 | int exec(QPoint p); |
178 | /** | 184 | /** |
179 | * Dito. | 185 | * Dito. |
180 | */ | 186 | */ |
181 | int exec(int x, int y); | 187 | int exec(int x, int y); |
182 | 188 | ||
183 | private: | 189 | private: |
184 | 190 | ||
185 | virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); } | 191 | virtual bool close(bool alsoDelete) { return Q3Frame::close(alsoDelete); } |
186 | protected: | 192 | protected: |
187 | virtual void virtual_hook( int id, void* data ); | 193 | virtual void virtual_hook( int id, void* data ); |
188 | private: | 194 | private: |
189 | class KPopupFramePrivate; | 195 | class KPopupFramePrivate; |
190 | KPopupFramePrivate *d; | 196 | KPopupFramePrivate *d; |
191 | }; | 197 | }; |
192 | 198 | ||
193 | /** | 199 | /** |
194 | * Validates user-entered dates. | 200 | * Validates user-entered dates. |
195 | */ | 201 | */ |
196 | class KDateValidator : public QValidator | 202 | class KDateValidator : public QValidator |
197 | { | 203 | { |
198 | public: | 204 | public: |
199 | KDateValidator(QWidget* parent=0, const char* name=0); | 205 | KDateValidator(QWidget* parent=0, const char* name=0); |
200 | virtual State validate(QString&, int&) const; | 206 | virtual State validate(QString&, int&) const; |
201 | virtual void fixup ( QString & input ) const; | 207 | virtual void fixup ( QString & input ) const; |
202 | State date(const QString&, QDate&) const; | 208 | State date(const QString&, QDate&) const; |
203 | }; | 209 | }; |
204 | 210 | ||
205 | /** | 211 | /** |
206 | * Date selection table. | 212 | * Date selection table. |
207 | * This is a support class for the KDatePicker class. It just | 213 | * This is a support class for the KDatePicker class. It just |
208 | * draws the calender table without titles, but could theoretically | 214 | * draws the calender table without titles, but could theoretically |
209 | * be used as a standalone. | 215 | * be used as a standalone. |
210 | * | 216 | * |
211 | * When a date is selected by the user, it emits a signal: | 217 | * When a date is selected by the user, it emits a signal: |
212 | * dateSelected(QDate) | 218 | * dateSelected(QDate) |
213 | * | 219 | * |
214 | * @internal | 220 | * @internal |
215 | * @version $Id$ | 221 | * @version $Id$ |
216 | * @author Tim Gilman, Mirko Boehm | 222 | * @author Tim Gilman, Mirko Boehm |
217 | */ | 223 | */ |
218 | class KDateTable : public QGridView | 224 | class KDateTable : public Q3GridView |
219 | { | 225 | { |
220 | Q_OBJECT | 226 | Q_OBJECT |
221 | public: | 227 | public: |
222 | /** | 228 | /** |
223 | * The constructor. | 229 | * The constructor. |
224 | */ | 230 | */ |
225 | KDateTable(QWidget *parent=0, | 231 | KDateTable(QWidget *parent=0, |
226 | QDate date=QDate::currentDate(), | 232 | QDate date=QDate::currentDate(), |
227 | const char* name=0, WFlags f=0); | 233 | const char* name=0, Qt::WFlags f=0); |
228 | /** | 234 | /** |
229 | * Returns a recommended size for the widget. | 235 | * Returns a recommended size for the widget. |
230 | * To save some time, the size of the largest used cell content is | 236 | * To save some time, the size of the largest used cell content is |
231 | * calculated in each paintCell() call, since all calculations have | 237 | * calculated in each paintCell() call, since all calculations have |
232 | * to be done there anyway. The size is stored in maxCell. The | 238 | * to be done there anyway. The size is stored in maxCell. The |
233 | * sizeHint() simply returns a multiple of maxCell. | 239 | * sizeHint() simply returns a multiple of maxCell. |
234 | */ | 240 | */ |
235 | virtual QSize sizeHint() const; | 241 | virtual QSize sizeHint() const; |
236 | /** | 242 | /** |
237 | * Set the font size of the date table. | 243 | * Set the font size of the date table. |
238 | */ | 244 | */ |
239 | void setFontSize(int size); | 245 | void setFontSize(int size); |
240 | /** | 246 | /** |
241 | * Select and display this date. | 247 | * Select and display this date. |
242 | */ | 248 | */ |
243 | bool setDate(const QDate&); | 249 | bool setDate(const QDate&); |
@@ -294,33 +300,33 @@ signals: | |||
294 | * The selected date changed. | 300 | * The selected date changed. |
295 | */ | 301 | */ |
296 | void dateChanged(QDate); | 302 | void dateChanged(QDate); |
297 | /** | 303 | /** |
298 | * A date has been selected by clicking on the table. | 304 | * A date has been selected by clicking on the table. |
299 | */ | 305 | */ |
300 | void tableClicked(); | 306 | void tableClicked(); |
301 | 307 | ||
302 | protected: | 308 | protected: |
303 | virtual void virtual_hook( int id, void* data ); | 309 | virtual void virtual_hook( int id, void* data ); |
304 | private: | 310 | private: |
305 | class KDateTablePrivate; | 311 | class KDateTablePrivate; |
306 | KDateTablePrivate *d; | 312 | KDateTablePrivate *d; |
307 | }; | 313 | }; |
308 | 314 | ||
309 | #endif // KDATETBL_H | 315 | #endif // KDATETBL_H |
310 | class KDateInternalWeekPicker : public QGridView | 316 | class KDateInternalWeekPicker : public Q3GridView |
311 | { | 317 | { |
312 | Q_OBJECT | 318 | Q_OBJECT |
313 | protected: | 319 | protected: |
314 | /** | 320 | /** |
315 | * Store the month that has been clicked [1..12]. | 321 | * Store the month that has been clicked [1..12]. |
316 | */ | 322 | */ |
317 | int result; | 323 | int result; |
318 | /** | 324 | /** |
319 | * the cell under mouse cursor when LBM is pressed | 325 | * the cell under mouse cursor when LBM is pressed |
320 | */ | 326 | */ |
321 | short int activeCol; | 327 | short int activeCol; |
322 | short int activeRow; | 328 | short int activeRow; |
323 | /** | 329 | /** |
324 | * Contains the largest rectangle needed by the month names. | 330 | * Contains the largest rectangle needed by the month names. |
325 | */ | 331 | */ |
326 | QRect max; | 332 | QRect max; |
diff --git a/microkde/kdebug.h b/microkde/kdebug.h index bb9cfe3..534943c 100644 --- a/microkde/kdebug.h +++ b/microkde/kdebug.h | |||
@@ -1,22 +1,24 @@ | |||
1 | #ifndef MINIKDE_KDEBUG_H | 1 | #ifndef MINIKDE_KDEBUG_H |
2 | #define MINIKDE_KDEBUG_H | 2 | #define MINIKDE_KDEBUG_H |
3 | 3 | ||
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | 5 | ||
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3CString> | ||
7 | 9 | ||
8 | 10 | ||
9 | 11 | ||
10 | class kdbgstream; | 12 | class kdbgstream; |
11 | typedef kdbgstream & (*KDBGFUNC)(kdbgstream &); // manipulator function | 13 | typedef kdbgstream & (*KDBGFUNC)(kdbgstream &); // manipulator function |
12 | 14 | ||
13 | class kdbgstream { | 15 | class kdbgstream { |
14 | public: | 16 | public: |
15 | kdbgstream(unsigned int _area, unsigned int _level, bool _print = true) : | 17 | kdbgstream(unsigned int _area, unsigned int _level, bool _print = true) : |
16 | area(_area), level(_level), print( _print ) { print = false; } | 18 | area(_area), level(_level), print( _print ) { print = false; } |
17 | /* kdbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = false) : | 19 | /* kdbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = false) : |
18 | output(QString::fromLatin1(initialString)), area(_area), level(_level), print(_print) { print = false; }*/ | 20 | output(QString::fromLatin1(initialString)), area(_area), level(_level), print(_print) { print = false; }*/ |
19 | ~kdbgstream() | 21 | ~kdbgstream() |
20 | { | 22 | { |
21 | // if (!output.isEmpty()) { | 23 | // if (!output.isEmpty()) { |
22 | // fprintf(stderr,"ASSERT: debug output not ended with \\n\n"); | 24 | // fprintf(stderr,"ASSERT: debug output not ended with \\n\n"); |
@@ -51,33 +53,33 @@ class kdbgstream { | |||
51 | kdbgstream &operator<<(unsigned int) { | 53 | kdbgstream &operator<<(unsigned int) { |
52 | 54 | ||
53 | return *this; | 55 | return *this; |
54 | } | 56 | } |
55 | kdbgstream &operator<<(long) { | 57 | kdbgstream &operator<<(long) { |
56 | return *this; | 58 | return *this; |
57 | } | 59 | } |
58 | kdbgstream &operator<<(unsigned long) { | 60 | kdbgstream &operator<<(unsigned long) { |
59 | return *this; | 61 | return *this; |
60 | } | 62 | } |
61 | kdbgstream &operator<<(const QString&) { | 63 | kdbgstream &operator<<(const QString&) { |
62 | return *this; | 64 | return *this; |
63 | } | 65 | } |
64 | kdbgstream &operator<<(const char*) { | 66 | kdbgstream &operator<<(const char*) { |
65 | return *this; | 67 | return *this; |
66 | } | 68 | } |
67 | kdbgstream &operator<<(const QCString&) { | 69 | kdbgstream &operator<<(const Q3CString&) { |
68 | return *this; | 70 | return *this; |
69 | } | 71 | } |
70 | kdbgstream& operator<<(KDBGFUNC f) { | 72 | kdbgstream& operator<<(KDBGFUNC f) { |
71 | return (*f)(*this); | 73 | return (*f)(*this); |
72 | } | 74 | } |
73 | kdbgstream& operator<<(double) { | 75 | kdbgstream& operator<<(double) { |
74 | if (!print) return *this; | 76 | if (!print) return *this; |
75 | return *this; | 77 | return *this; |
76 | } | 78 | } |
77 | void flush() { | 79 | void flush() { |
78 | return; | 80 | return; |
79 | } | 81 | } |
80 | private: | 82 | private: |
81 | QString output; | 83 | QString output; |
82 | unsigned int area, level; | 84 | unsigned int area, level; |
83 | bool print; | 85 | bool print; |
diff --git a/microkde/kdecore/kcatalogue.cpp b/microkde/kdecore/kcatalogue.cpp index 97ac326..1600b08 100644 --- a/microkde/kdecore/kcatalogue.cpp +++ b/microkde/kdecore/kcatalogue.cpp | |||
@@ -7,32 +7,34 @@ | |||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | //US #include <config.h> | 20 | //US #include <config.h> |
21 | 21 | ||
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | //Added by qt3to4: | ||
24 | #include <Q3CString> | ||
23 | 25 | ||
24 | #include <kdebug.h> | 26 | #include <kdebug.h> |
25 | 27 | ||
26 | #include "kcatalogue.h" | 28 | #include "kcatalogue.h" |
27 | 29 | ||
28 | char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file, | 30 | char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file, |
29 | const char *msgid); | 31 | const char *msgid); |
30 | void k_nl_unload_domain (struct loaded_domain *domain); | 32 | void k_nl_unload_domain (struct loaded_domain *domain); |
31 | 33 | ||
32 | #ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp | 34 | #ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp |
33 | struct kde_loaded_l10nfile | 35 | struct kde_loaded_l10nfile |
34 | { | 36 | { |
35 | const char *filename; | 37 | const char *filename; |
36 | int decided; | 38 | int decided; |
37 | 39 | ||
38 | const void *data; | 40 | const void *data; |
@@ -75,33 +77,33 @@ KCatalogue::~KCatalogue() | |||
75 | 77 | ||
76 | delete d; | 78 | delete d; |
77 | } | 79 | } |
78 | 80 | ||
79 | QString KCatalogue::name() const | 81 | QString KCatalogue::name() const |
80 | { | 82 | { |
81 | return d->name; | 83 | return d->name; |
82 | } | 84 | } |
83 | 85 | ||
84 | void KCatalogue::setFileName( const QString & fileName ) | 86 | void KCatalogue::setFileName( const QString & fileName ) |
85 | { | 87 | { |
86 | // nothing to do if the file name is already the same | 88 | // nothing to do if the file name is already the same |
87 | if ( this->fileName() == fileName ) return; | 89 | if ( this->fileName() == fileName ) return; |
88 | 90 | ||
89 | doUnload(); | 91 | doUnload(); |
90 | 92 | ||
91 | QCString newFileName = QFile::encodeName( fileName ); | 93 | Q3CString newFileName = QFile::encodeName( fileName ); |
92 | 94 | ||
93 | if ( !fileName.isEmpty() ) | 95 | if ( !fileName.isEmpty() ) |
94 | { | 96 | { |
95 | // set file name | 97 | // set file name |
96 | char *filename = new char[ newFileName.length() + 1 ]; | 98 | char *filename = new char[ newFileName.length() + 1 ]; |
97 | ::qstrcpy( filename, newFileName ); | 99 | ::qstrcpy( filename, newFileName ); |
98 | d->domain.filename = filename; | 100 | d->domain.filename = filename; |
99 | } | 101 | } |
100 | } | 102 | } |
101 | 103 | ||
102 | QString KCatalogue::fileName() const | 104 | QString KCatalogue::fileName() const |
103 | { | 105 | { |
104 | return QFile::decodeName( d->domain.filename ); | 106 | return QFile::decodeName( d->domain.filename ); |
105 | } | 107 | } |
106 | 108 | ||
107 | const char * KCatalogue::translate(const char * msgid) const | 109 | const char * KCatalogue::translate(const char * msgid) const |
diff --git a/microkde/kdecore/kconfigbase.h b/microkde/kdecore/kconfigbase.h index 7e56d11..1ef6a04 100644 --- a/microkde/kdecore/kconfigbase.h +++ b/microkde/kdecore/kconfigbase.h | |||
@@ -13,32 +13,34 @@ | |||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | // $Id$ | 23 | // $Id$ |
24 | 24 | ||
25 | #ifndef _KCONFIGBASE_H | 25 | #ifndef _KCONFIGBASE_H |
26 | #define _KCONFIGBASE_H | 26 | #define _KCONFIGBASE_H |
27 | 27 | ||
28 | #include "kconfig.h" | 28 | #include "kconfig.h" |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | /** | 32 | /** |
31 | * Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig | 33 | * Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig |
32 | * groups. | 34 | * groups. |
33 | * | 35 | * |
34 | * Careful programmers always set the group of a | 36 | * Careful programmers always set the group of a |
35 | * @ref KConfig @ref KSimpleConfig object to the group they want to read from | 37 | * @ref KConfig @ref KSimpleConfig object to the group they want to read from |
36 | * and set it back to the old one of afterwards. This is usually | 38 | * and set it back to the old one of afterwards. This is usually |
37 | * written as: | 39 | * written as: |
38 | * <pre> | 40 | * <pre> |
39 | * | 41 | * |
40 | * QString oldgroup config->group(); | 42 | * QString oldgroup config->group(); |
41 | * config->setGroup( "TheGroupThatIWant" ); | 43 | * config->setGroup( "TheGroupThatIWant" ); |
42 | * ... | 44 | * ... |
43 | * config->writeEntry( "Blah", "Blubb" ); | 45 | * config->writeEntry( "Blah", "Blubb" ); |
44 | * | 46 | * |
@@ -69,33 +71,33 @@ public: | |||
69 | * object you want to work with and a string indicating the _new_ | 71 | * object you want to work with and a string indicating the _new_ |
70 | * group. | 72 | * group. |
71 | * | 73 | * |
72 | * @param config The KConfigBase-derived object this | 74 | * @param config The KConfigBase-derived object this |
73 | * KConfigGroupSaver works on. | 75 | * KConfigGroupSaver works on. |
74 | * @param group The new group that the config object should switch to. | 76 | * @param group The new group that the config object should switch to. |
75 | */ | 77 | */ |
76 | KConfigGroupSaver( KConfig* config, QString group ) | 78 | KConfigGroupSaver( KConfig* config, QString group ) |
77 | /* KDE 4 : make the second parameter const QString & */ | 79 | /* KDE 4 : make the second parameter const QString & */ |
78 | : _config(config), _oldgroup(config->group()) | 80 | : _config(config), _oldgroup(config->group()) |
79 | { _config->setGroup( group ); } | 81 | { _config->setGroup( group ); } |
80 | 82 | ||
81 | KConfigGroupSaver( KConfig* config, const char *group ) | 83 | KConfigGroupSaver( KConfig* config, const char *group ) |
82 | : _config(config), _oldgroup(config->group()) | 84 | : _config(config), _oldgroup(config->group()) |
83 | { _config->setGroup( group ); } | 85 | { _config->setGroup( group ); } |
84 | 86 | ||
85 | KConfigGroupSaver( KConfig* config, const QCString &group ) | 87 | KConfigGroupSaver( KConfig* config, const Q3CString &group ) |
86 | : _config(config), _oldgroup(config->group()) | 88 | : _config(config), _oldgroup(config->group()) |
87 | { _config->setGroup( group ); } | 89 | { _config->setGroup( group ); } |
88 | 90 | ||
89 | ~KConfigGroupSaver() { _config->setGroup( _oldgroup ); } | 91 | ~KConfigGroupSaver() { _config->setGroup( _oldgroup ); } |
90 | 92 | ||
91 | KConfig* config() { return _config; }; | 93 | KConfig* config() { return _config; }; |
92 | 94 | ||
93 | private: | 95 | private: |
94 | KConfig* _config; | 96 | KConfig* _config; |
95 | QString _oldgroup; | 97 | QString _oldgroup; |
96 | 98 | ||
97 | KConfigGroupSaver(const KConfigGroupSaver&); | 99 | KConfigGroupSaver(const KConfigGroupSaver&); |
98 | KConfigGroupSaver& operator=(const KConfigGroupSaver&); | 100 | KConfigGroupSaver& operator=(const KConfigGroupSaver&); |
99 | 101 | ||
100 | }; | 102 | }; |
101 | 103 | ||
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp index 6d0475a..0b54eb6 100644 --- a/microkde/kdecore/klibloader.cpp +++ b/microkde/kdecore/klibloader.cpp | |||
@@ -7,58 +7,61 @@ | |||
7 | License version 2 as published by the Free Software Foundation. | 7 | License version 2 as published by the Free Software Foundation. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | //US #include <config.h> | 19 | //US #include <config.h> |
20 | #include <qclipboard.h> | 20 | #include <qclipboard.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qobjectdict.h> | 23 | #include <q3objectdict.h> |
24 | #include <qwidgetlist.h> | ||
25 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qwidget.h> | ||
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
28 | #include <Q3PtrList> | ||
26 | 29 | ||
27 | #include "kapplication.h" | 30 | #include "kapplication.h" |
28 | #include "klibloader.h" | 31 | #include "klibloader.h" |
29 | #include "kstandarddirs.h" | 32 | #include "kstandarddirs.h" |
30 | #include "kdebug.h" | 33 | #include "kdebug.h" |
31 | #include "klocale.h" | 34 | #include "klocale.h" |
32 | 35 | ||
33 | /*US | 36 | /*US |
34 | #ifndef NDEBUG | 37 | #ifndef NDEBUG |
35 | #include "ltdl.h" | 38 | #include "ltdl.h" |
36 | #endif | 39 | #endif |
37 | */ | 40 | */ |
38 | 41 | ||
39 | //US do everything through qlibrary | 42 | //US do everything through qlibrary |
40 | #ifndef DESKTOP_VERSION | 43 | #ifndef DESKTOP_VERSION |
41 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
42 | #include <qtopia/qlibrary.h> | 45 | #include <qtopia/qlibrary.h> |
43 | #else | 46 | #else |
44 | #include <qlibrary.h> | 47 | #include <qlibrary.h> |
45 | #endif | 48 | #endif |
46 | 49 | ||
47 | 50 | ||
48 | template class QAsciiDict<KLibrary>; | 51 | template class Q3AsciiDict<KLibrary>; |
49 | 52 | ||
50 | #include <stdlib.h> //getenv | 53 | #include <stdlib.h> //getenv |
51 | 54 | ||
52 | /*US | 55 | /*US |
53 | #if HAVE_DLFCN_H | 56 | #if HAVE_DLFCN_H |
54 | # include <dlfcn.h> | 57 | # include <dlfcn.h> |
55 | #endif | 58 | #endif |
56 | 59 | ||
57 | #ifdef RTLD_GLOBAL | 60 | #ifdef RTLD_GLOBAL |
58 | # define LT_GLOBAL RTLD_GLOBAL | 61 | # define LT_GLOBAL RTLD_GLOBAL |
59 | #else | 62 | #else |
60 | # ifdef DL_GLOBAL | 63 | # ifdef DL_GLOBAL |
61 | # define LT_GLOBAL DL_GLOBAL | 64 | # define LT_GLOBAL DL_GLOBAL |
62 | # endif | 65 | # endif |
63 | #endif | 66 | #endif |
64 | #ifndef LT_GLOBAL | 67 | #ifndef LT_GLOBAL |
@@ -107,65 +110,65 @@ KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* h | |||
107 | m_libname = libname; | 110 | m_libname = libname; |
108 | m_filename = filename; | 111 | m_filename = filename; |
109 | m_handle = handle; | 112 | m_handle = handle; |
110 | m_factory = 0; | 113 | m_factory = 0; |
111 | m_timer = 0; | 114 | m_timer = 0; |
112 | } | 115 | } |
113 | 116 | ||
114 | KLibrary::~KLibrary() | 117 | KLibrary::~KLibrary() |
115 | { | 118 | { |
116 | // kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl; | 119 | // kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl; |
117 | if ( m_timer && m_timer->isActive() ) | 120 | if ( m_timer && m_timer->isActive() ) |
118 | m_timer->stop(); | 121 | m_timer->stop(); |
119 | 122 | ||
120 | // If any object is remaining, delete | 123 | // If any object is remaining, delete |
121 | if ( m_objs.count() > 0 ) | 124 | if ( m_objs.count() > 0 ) |
122 | { | 125 | { |
123 | QPtrListIterator<QObject> it( m_objs ); | 126 | Q3PtrListIterator<QObject> it( m_objs ); |
124 | for ( ; it.current() ; ++it ) | 127 | for ( ; it.current() ; ++it ) |
125 | { | 128 | { |
126 | kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl; | 129 | kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl; |
127 | disconnect( it.current(), SIGNAL( destroyed() ), | 130 | disconnect( it.current(), SIGNAL( destroyed() ), |
128 | this, SLOT( slotObjectDestroyed() ) ); | 131 | this, SLOT( slotObjectDestroyed() ) ); |
129 | } | 132 | } |
130 | m_objs.setAutoDelete(true); | 133 | m_objs.setAutoDelete(true); |
131 | m_objs.clear(); | 134 | m_objs.clear(); |
132 | } | 135 | } |
133 | 136 | ||
134 | if ( m_factory ) { | 137 | if ( m_factory ) { |
135 | //kdDebug(150) << " ... deleting the factory " << m_factory << endl; | 138 | //kdDebug(150) << " ... deleting the factory " << m_factory << endl; |
136 | delete m_factory; | 139 | delete m_factory; |
137 | } | 140 | } |
138 | } | 141 | } |
139 | 142 | ||
140 | QString KLibrary::name() const | 143 | QString KLibrary::name() const |
141 | { | 144 | { |
142 | return m_libname; | 145 | return m_libname; |
143 | } | 146 | } |
144 | 147 | ||
145 | QString KLibrary::fileName() const | 148 | QString KLibrary::fileName() const |
146 | { | 149 | { |
147 | return m_filename; | 150 | return m_filename; |
148 | } | 151 | } |
149 | 152 | ||
150 | KLibFactory* KLibrary::factory() | 153 | KLibFactory* KLibrary::factory() |
151 | { | 154 | { |
152 | if ( m_factory ) | 155 | if ( m_factory ) |
153 | return m_factory; | 156 | return m_factory; |
154 | 157 | ||
155 | QCString symname; | 158 | Q3CString symname; |
156 | symname.sprintf("init_%s", name().latin1() ); | 159 | symname.sprintf("init_%s", name().latin1() ); |
157 | 160 | ||
158 | void* sym = symbol( symname ); | 161 | void* sym = symbol( symname ); |
159 | if ( !sym ) | 162 | if ( !sym ) |
160 | { | 163 | { |
161 | qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data()); | 164 | qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data()); |
162 | #ifndef NDEBUG | 165 | #ifndef NDEBUG |
163 | //US qDebug("KLibrary: errorcode: %s", lt_dlerror()); | 166 | //US qDebug("KLibrary: errorcode: %s", lt_dlerror()); |
164 | #endif | 167 | #endif |
165 | kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl; | 168 | kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl; |
166 | return 0; | 169 | return 0; |
167 | } | 170 | } |
168 | 171 | ||
169 | typedef KLibFactory* (*t_func)(); | 172 | typedef KLibFactory* (*t_func)(); |
170 | t_func func = (t_func)sym; | 173 | t_func func = (t_func)sym; |
171 | m_factory = func(); | 174 | m_factory = func(); |
@@ -292,34 +295,34 @@ KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h) | |||
292 | } else if (lt_dlsym(handle, "__kde_do_unload") != 0) { | 295 | } else if (lt_dlsym(handle, "__kde_do_unload") != 0) { |
293 | unload_mode = UNLOAD; | 296 | unload_mode = UNLOAD; |
294 | } | 297 | } |
295 | */ | 298 | */ |
296 | //US use instead: | 299 | //US use instead: |
297 | if (h->resolve("__kde_do_not_unload") != 0) { | 300 | if (h->resolve("__kde_do_not_unload") != 0) { |
298 | // kdDebug(150) << "Will not unload " << name << endl; | 301 | // kdDebug(150) << "Will not unload " << name << endl; |
299 | unload_mode = DONT_UNLOAD; | 302 | unload_mode = DONT_UNLOAD; |
300 | } else if (h->resolve("__kde_do_unload") != 0) { | 303 | } else if (h->resolve("__kde_do_unload") != 0) { |
301 | unload_mode = UNLOAD; | 304 | unload_mode = UNLOAD; |
302 | } | 305 | } |
303 | } | 306 | } |
304 | 307 | ||
305 | class KLibLoaderPrivate | 308 | class KLibLoaderPrivate |
306 | { | 309 | { |
307 | public: | 310 | public: |
308 | QPtrList<KLibWrapPrivate> loaded_stack; | 311 | Q3PtrList<KLibWrapPrivate> loaded_stack; |
309 | QPtrList<KLibWrapPrivate> pending_close; | 312 | Q3PtrList<KLibWrapPrivate> pending_close; |
310 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; | 313 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; |
311 | 314 | ||
312 | QString errorMessage; | 315 | QString errorMessage; |
313 | }; | 316 | }; |
314 | 317 | ||
315 | KLibLoader* KLibLoader::s_self = 0; | 318 | KLibLoader* KLibLoader::s_self = 0; |
316 | 319 | ||
317 | KLibLoader* KLibLoader::self() | 320 | KLibLoader* KLibLoader::self() |
318 | { | 321 | { |
319 | if ( !s_self ) | 322 | if ( !s_self ) |
320 | s_self = new KLibLoader; | 323 | s_self = new KLibLoader; |
321 | return s_self; | 324 | return s_self; |
322 | } | 325 | } |
323 | 326 | ||
324 | void KLibLoader::cleanUp() | 327 | void KLibLoader::cleanUp() |
325 | { | 328 | { |
@@ -335,49 +338,49 @@ KLibLoader::KLibLoader( QObject* parent, const char* name ) | |||
335 | { | 338 | { |
336 | s_self = this; | 339 | s_self = this; |
337 | d = new KLibLoaderPrivate; | 340 | d = new KLibLoaderPrivate; |
338 | //US lt_dlinit(); | 341 | //US lt_dlinit(); |
339 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; | 342 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; |
340 | if (getenv("KDE_NOUNLOAD") != 0) | 343 | if (getenv("KDE_NOUNLOAD") != 0) |
341 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; | 344 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; |
342 | else if (getenv("KDE_DOUNLOAD") != 0) | 345 | else if (getenv("KDE_DOUNLOAD") != 0) |
343 | d->unload_mode = KLibLoaderPrivate::UNLOAD; | 346 | d->unload_mode = KLibLoaderPrivate::UNLOAD; |
344 | d->loaded_stack.setAutoDelete( true ); | 347 | d->loaded_stack.setAutoDelete( true ); |
345 | } | 348 | } |
346 | 349 | ||
347 | KLibLoader::~KLibLoader() | 350 | KLibLoader::~KLibLoader() |
348 | { | 351 | { |
349 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; | 352 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; |
350 | 353 | ||
351 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); | 354 | Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs ); |
352 | for (; it.current(); ++it ) | 355 | for (; it.current(); ++it ) |
353 | { | 356 | { |
354 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name | 357 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name |
355 | << " (" << it.current()->lib << ")" << endl; | 358 | << " (" << it.current()->lib << ")" << endl; |
356 | d->pending_close.append(it.current()); | 359 | d->pending_close.append(it.current()); |
357 | } | 360 | } |
358 | 361 | ||
359 | close_pending(0); | 362 | close_pending(0); |
360 | 363 | ||
361 | delete d; | 364 | delete d; |
362 | } | 365 | } |
363 | 366 | ||
364 | //static | 367 | //static |
365 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) | 368 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) |
366 | { | 369 | { |
367 | QCString libname( name ); | 370 | Q3CString libname( name ); |
368 | 371 | ||
369 | // only append ".la" if there is no extension | 372 | // only append ".la" if there is no extension |
370 | // this allows to load non-libtool libraries as well | 373 | // this allows to load non-libtool libraries as well |
371 | // (mhk, 20000228) | 374 | // (mhk, 20000228) |
372 | int pos = libname.findRev('/'); | 375 | int pos = libname.findRev('/'); |
373 | if (pos < 0) | 376 | if (pos < 0) |
374 | pos = 0; | 377 | pos = 0; |
375 | /*US | 378 | /*US |
376 | if (libname.find('.', pos) < 0) { | 379 | if (libname.find('.', pos) < 0) { |
377 | libname += ".la"; | 380 | libname += ".la"; |
378 | } | 381 | } |
379 | */ | 382 | */ |
380 | //US in the microedition we work only with shared libraries. | 383 | //US in the microedition we work only with shared libraries. |
381 | 384 | ||
382 | if (libname.find('.', pos) < 0) { | 385 | if (libname.find('.', pos) < 0) { |
383 | #ifdef _WIN32_ | 386 | #ifdef _WIN32_ |
@@ -408,33 +411,33 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta | |||
408 | //qDebug("libfile = %s ",libfile.latin1() ); | 411 | //qDebug("libfile = %s ",libfile.latin1() ); |
409 | 412 | ||
410 | if ( libfile.isEmpty() ) | 413 | if ( libfile.isEmpty() ) |
411 | { | 414 | { |
412 | //US libfile = instance->dirs()->findResource( "lib", libname ); | 415 | //US libfile = instance->dirs()->findResource( "lib", libname ); |
413 | libfile = KGlobal::dirs()->findResource( "lib", libname ); | 416 | libfile = KGlobal::dirs()->findResource( "lib", libname ); |
414 | //qDebug("libfile2 = %s ",libfile.latin1() ); | 417 | //qDebug("libfile2 = %s ",libfile.latin1() ); |
415 | #ifndef NDEBUG | 418 | #ifndef NDEBUG |
416 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules | 419 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules |
417 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; | 420 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; |
418 | #endif | 421 | #endif |
419 | } | 422 | } |
420 | if ( libfile.isEmpty() ) | 423 | if ( libfile.isEmpty() ) |
421 | { | 424 | { |
422 | #ifndef NDEBUG | 425 | #ifndef NDEBUG |
423 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; | 426 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; |
424 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); | 427 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(QString(libname)); |
425 | 428 | ||
426 | qDebug("KLibLoader::library could not find library: %s", libname.data()); | 429 | qDebug("KLibLoader::library could not find library: %s", libname.data()); |
427 | #endif | 430 | #endif |
428 | 431 | ||
429 | } | 432 | } |
430 | else | 433 | else |
431 | self()->d->errorMessage = QString::null; | 434 | self()->d->errorMessage = QString::null; |
432 | } | 435 | } |
433 | 436 | ||
434 | //qDebug("return libfile = %s ",libfile.latin1() ); | 437 | //qDebug("return libfile = %s ",libfile.latin1() ); |
435 | return libfile; | 438 | return libfile; |
436 | } | 439 | } |
437 | 440 | ||
438 | 441 | ||
439 | KLibrary* KLibLoader::globalLibrary( const char *name ) | 442 | KLibrary* KLibLoader::globalLibrary( const char *name ) |
440 | { | 443 | { |
@@ -456,33 +459,33 @@ return tmp; | |||
456 | 459 | ||
457 | 460 | ||
458 | KLibrary* KLibLoader::library( const char *name ) | 461 | KLibrary* KLibLoader::library( const char *name ) |
459 | { | 462 | { |
460 | if (!name) | 463 | if (!name) |
461 | return 0; | 464 | return 0; |
462 | 465 | ||
463 | KLibWrapPrivate* wrap = m_libs[name]; | 466 | KLibWrapPrivate* wrap = m_libs[name]; |
464 | if (wrap) { | 467 | if (wrap) { |
465 | /* Nothing to do to load the library. */ | 468 | /* Nothing to do to load the library. */ |
466 | wrap->ref_count++; | 469 | wrap->ref_count++; |
467 | return wrap->lib; | 470 | return wrap->lib; |
468 | } | 471 | } |
469 | 472 | ||
470 | /* Test if this library was loaded at some time, but got | 473 | /* Test if this library was loaded at some time, but got |
471 | unloaded meanwhile, whithout being dlclose()'ed. */ | 474 | unloaded meanwhile, whithout being dlclose()'ed. */ |
472 | QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); | 475 | Q3PtrListIterator<KLibWrapPrivate> it(d->loaded_stack); |
473 | for (; it.current(); ++it) { | 476 | for (; it.current(); ++it) { |
474 | if (it.current()->name == name) | 477 | if (it.current()->name == name) |
475 | wrap = it.current(); | 478 | wrap = it.current(); |
476 | } | 479 | } |
477 | 480 | ||
478 | if (wrap) { | 481 | if (wrap) { |
479 | d->pending_close.removeRef(wrap); | 482 | d->pending_close.removeRef(wrap); |
480 | if (!wrap->lib) { | 483 | if (!wrap->lib) { |
481 | /* This lib only was in loaded_stack, but not in m_libs. */ | 484 | /* This lib only was in loaded_stack, but not in m_libs. */ |
482 | wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); | 485 | wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); |
483 | } | 486 | } |
484 | wrap->ref_count++; | 487 | wrap->ref_count++; |
485 | } else { | 488 | } else { |
486 | QString libfile = findLibrary( name ); | 489 | QString libfile = findLibrary( name ); |
487 | if ( libfile.isEmpty() ) | 490 | if ( libfile.isEmpty() ) |
488 | return 0; | 491 | return 0; |
@@ -537,52 +540,52 @@ void KLibLoader::unloadLibrary( const char *libname ) | |||
537 | close_pending( wrap ); | 540 | close_pending( wrap ); |
538 | } | 541 | } |
539 | 542 | ||
540 | KLibFactory* KLibLoader::factory( const char* name ) | 543 | KLibFactory* KLibLoader::factory( const char* name ) |
541 | { | 544 | { |
542 | KLibrary* lib = library( name ); | 545 | KLibrary* lib = library( name ); |
543 | if ( !lib ) | 546 | if ( !lib ) |
544 | return 0; | 547 | return 0; |
545 | 548 | ||
546 | return lib->factory(); | 549 | return lib->factory(); |
547 | } | 550 | } |
548 | 551 | ||
549 | void KLibLoader::slotLibraryDestroyed() | 552 | void KLibLoader::slotLibraryDestroyed() |
550 | { | 553 | { |
551 | const KLibrary *lib = static_cast<const KLibrary *>( sender() ); | 554 | const KLibrary *lib = static_cast<const KLibrary *>( sender() ); |
552 | 555 | ||
553 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); | 556 | Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs ); |
554 | for (; it.current(); ++it ) | 557 | for (; it.current(); ++it ) |
555 | if ( it.current()->lib == lib ) | 558 | if ( it.current()->lib == lib ) |
556 | { | 559 | { |
557 | KLibWrapPrivate *wrap = it.current(); | 560 | KLibWrapPrivate *wrap = it.current(); |
558 | wrap->lib = 0; /* the KLibrary object is already away */ | 561 | wrap->lib = 0; /* the KLibrary object is already away */ |
559 | m_libs.remove( it.currentKey() ); | 562 | m_libs.remove( it.currentKey() ); |
560 | close_pending( wrap ); | 563 | close_pending( wrap ); |
561 | return; | 564 | return; |
562 | } | 565 | } |
563 | } | 566 | } |
564 | 567 | ||
565 | void KLibLoader::close_pending(KLibWrapPrivate *wrap) | 568 | void KLibLoader::close_pending(KLibWrapPrivate *wrap) |
566 | { | 569 | { |
567 | if (wrap && !d->pending_close.containsRef( wrap )) | 570 | if (wrap && !d->pending_close.containsRef( wrap )) |
568 | d->pending_close.append( wrap ); | 571 | d->pending_close.append( wrap ); |
569 | 572 | ||
570 | /* First delete all KLibrary objects in pending_close, but _don't_ unload | 573 | /* First delete all KLibrary objects in pending_close, but _don't_ unload |
571 | the DSO behind it. */ | 574 | the DSO behind it. */ |
572 | QPtrListIterator<KLibWrapPrivate> it(d->pending_close); | 575 | Q3PtrListIterator<KLibWrapPrivate> it(d->pending_close); |
573 | for (; it.current(); ++it) { | 576 | for (; it.current(); ++it) { |
574 | wrap = it.current(); | 577 | wrap = it.current(); |
575 | if (wrap->lib) { | 578 | if (wrap->lib) { |
576 | disconnect( wrap->lib, SIGNAL( destroyed() ), | 579 | disconnect( wrap->lib, SIGNAL( destroyed() ), |
577 | this, SLOT( slotLibraryDestroyed() ) ); | 580 | this, SLOT( slotLibraryDestroyed() ) ); |
578 | delete wrap->lib; | 581 | delete wrap->lib; |
579 | wrap->lib = 0; | 582 | wrap->lib = 0; |
580 | } | 583 | } |
581 | } | 584 | } |
582 | 585 | ||
583 | if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; | 586 | if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; |
584 | 587 | ||
585 | bool deleted_one = false; | 588 | bool deleted_one = false; |
586 | while ((wrap = d->loaded_stack.first())) { | 589 | while ((wrap = d->loaded_stack.first())) { |
587 | /* Let's first see, if we want to try to unload this lib. | 590 | /* Let's first see, if we want to try to unload this lib. |
588 | If the env. var KDE_DOUNLOAD is set, we try to unload every lib. | 591 | If the env. var KDE_DOUNLOAD is set, we try to unload every lib. |
diff --git a/microkde/kdecore/klibloader.h b/microkde/kdecore/klibloader.h index ed57109..53d146e 100644 --- a/microkde/kdecore/klibloader.h +++ b/microkde/kdecore/klibloader.h | |||
@@ -8,64 +8,64 @@ | |||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | #ifndef KLIBLOADER_H | 18 | #ifndef KLIBLOADER_H |
19 | #define KLIBLOADER_H | 19 | #define KLIBLOADER_H |
20 | 20 | ||
21 | #include <qobject.h> | 21 | #include <qobject.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qasciidict.h> | 24 | #include <q3asciidict.h> |
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | 27 | ||
28 | #include <stdlib.h> // For backwards compatibility | 28 | #include <stdlib.h> // For backwards compatibility |
29 | 29 | ||
30 | class KInstance; | 30 | class KInstance; |
31 | class QTimer; | 31 | class QTimer; |
32 | class KLibrary; | 32 | class KLibrary; |
33 | class KLibFactory; | 33 | class KLibFactory; |
34 | class KLibFactoryPrivate; | 34 | class KLibFactoryPrivate; |
35 | class KLibLoaderPrivate; | 35 | class KLibLoaderPrivate; |
36 | class KLibraryPrivate; | 36 | class KLibraryPrivate; |
37 | 37 | ||
38 | class QLibrary; | 38 | class QLibrary; |
39 | 39 | ||
40 | #define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \ | 40 | #define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \ |
41 | extern "C" { void *init_##libname() { return new factory; } } | 41 | extern "C" { void *init_##libname() { return new factory; } } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * @short Represents a dynamically loaded library. | 44 | * @short Represents a dynamically loaded library. |
45 | * | 45 | * |
46 | * KLibrary allows you to look up symbols of the shared library. | 46 | * KLibrary allows you to look up symbols of the shared library. |
47 | * Use @ref KLibLoader to create a new instance of KLibrary. | 47 | * Use @ref KLibLoader to create a new instance of KLibrary. |
48 | * | 48 | * |
49 | * @see KLibLoader | 49 | * @see KLibLoader |
50 | * @author Torben Weis <weis@kde.org> | 50 | * @author Torben Weis <weis@kde.org> |
51 | */ | 51 | */ |
52 | class KLibrary : public QObject | 52 | class KLibrary : public QObject |
53 | { | 53 | { |
54 | friend class KLibLoader; | 54 | friend class KLibLoader; |
55 | friend class QAsciiDict<KLibrary>; | 55 | friend class Q3AsciiDict<KLibrary>; |
56 | 56 | ||
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | /** | 59 | /** |
60 | * @internal | 60 | * @internal |
61 | * Don't create KLibrary objects on your own. Instead use @ref KLibLoader. | 61 | * Don't create KLibrary objects on your own. Instead use @ref KLibLoader. |
62 | */ | 62 | */ |
63 | //US KLibrary( const QString& libname, const QString& filename, void * handle ); | 63 | //US KLibrary( const QString& libname, const QString& filename, void * handle ); |
64 | KLibrary( const QString& libname, const QString& filename, QLibrary* handle ); | 64 | KLibrary( const QString& libname, const QString& filename, QLibrary* handle ); |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Returns the name of the library. | 67 | * Returns the name of the library. |
68 | * @return The name of the library like "libkspread". | 68 | * @return The name of the library like "libkspread". |
69 | */ | 69 | */ |
70 | QString name() const; | 70 | QString name() const; |
71 | 71 | ||
@@ -114,33 +114,33 @@ private slots: | |||
114 | void slotObjectCreated( QObject *obj ); | 114 | void slotObjectCreated( QObject *obj ); |
115 | void slotObjectDestroyed(); | 115 | void slotObjectDestroyed(); |
116 | void slotTimeout(); | 116 | void slotTimeout(); |
117 | 117 | ||
118 | private: | 118 | private: |
119 | /** | 119 | /** |
120 | * @internal | 120 | * @internal |
121 | * Don't destruct KLibrary objects yourself. Instead use @ref unload() instead. | 121 | * Don't destruct KLibrary objects yourself. Instead use @ref unload() instead. |
122 | */ | 122 | */ |
123 | ~KLibrary(); | 123 | ~KLibrary(); |
124 | 124 | ||
125 | QString m_libname; | 125 | QString m_libname; |
126 | QString m_filename; | 126 | QString m_filename; |
127 | KLibFactory* m_factory; | 127 | KLibFactory* m_factory; |
128 | //US void * m_handle; | 128 | //US void * m_handle; |
129 | QLibrary* m_handle; | 129 | QLibrary* m_handle; |
130 | QPtrList<QObject> m_objs; | 130 | Q3PtrList<QObject> m_objs; |
131 | QTimer *m_timer; | 131 | QTimer *m_timer; |
132 | KLibraryPrivate *d; | 132 | KLibraryPrivate *d; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | class KLibWrapPrivate; | 135 | class KLibWrapPrivate; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * The KLibLoader allows you to load libraries dynamically at runtime. | 138 | * The KLibLoader allows you to load libraries dynamically at runtime. |
139 | * Dependent libraries are loaded automatically. | 139 | * Dependent libraries are loaded automatically. |
140 | * | 140 | * |
141 | * KLibLoader follows the singleton pattern. You can not create multiple | 141 | * KLibLoader follows the singleton pattern. You can not create multiple |
142 | * instances. Use @ref self() to get a pointer to the loader. | 142 | * instances. Use @ref self() to get a pointer to the loader. |
143 | * | 143 | * |
144 | * @see KLibrary | 144 | * @see KLibrary |
145 | * @author Torben Weis <weis@kde.org> | 145 | * @author Torben Weis <weis@kde.org> |
146 | */ | 146 | */ |
@@ -274,33 +274,33 @@ public: | |||
274 | * Made public for code that doesn't use KLibLoader itself, but still | 274 | * Made public for code that doesn't use KLibLoader itself, but still |
275 | * wants to open modules. | 275 | * wants to open modules. |
276 | * @param name of the library. If it is not a path, the function searches in | 276 | * @param name of the library. If it is not a path, the function searches in |
277 | * the "module" and "lib" resources. If there is no extension, | 277 | * the "module" and "lib" resources. If there is no extension, |
278 | * ".la" will be appended. | 278 | * ".la" will be appended. |
279 | * @param instance a KInstance used to get the standard paths | 279 | * @param instance a KInstance used to get the standard paths |
280 | */ | 280 | */ |
281 | static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ ); | 281 | static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ ); |
282 | 282 | ||
283 | protected: | 283 | protected: |
284 | KLibLoader( QObject* parent = 0, const char* name = 0 ); | 284 | KLibLoader( QObject* parent = 0, const char* name = 0 ); |
285 | 285 | ||
286 | private slots: | 286 | private slots: |
287 | void slotLibraryDestroyed(); | 287 | void slotLibraryDestroyed(); |
288 | private: | 288 | private: |
289 | void close_pending( KLibWrapPrivate * ); | 289 | void close_pending( KLibWrapPrivate * ); |
290 | QAsciiDict<KLibWrapPrivate> m_libs; | 290 | Q3AsciiDict<KLibWrapPrivate> m_libs; |
291 | 291 | ||
292 | static KLibLoader* s_self; | 292 | static KLibLoader* s_self; |
293 | 293 | ||
294 | protected: | 294 | protected: |
295 | virtual void virtual_hook( int id, void* data ); | 295 | virtual void virtual_hook( int id, void* data ); |
296 | private: | 296 | private: |
297 | KLibLoaderPrivate *d; | 297 | KLibLoaderPrivate *d; |
298 | }; | 298 | }; |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * If you develop a library that is to be loaded dynamically at runtime, then | 301 | * If you develop a library that is to be loaded dynamically at runtime, then |
302 | * you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY | 302 | * you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY |
303 | * macro is provided for this purpose: | 303 | * macro is provided for this purpose: |
304 | * <pre> | 304 | * <pre> |
305 | * K_EXPORT_COMPONENT_FACTORY( libkspread, KSpreadFactory ) | 305 | * K_EXPORT_COMPONENT_FACTORY( libkspread, KSpreadFactory ) |
306 | * </pre> | 306 | * </pre> |
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 1d8ae9f..dd310fa 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -1,92 +1,93 @@ | |||
1 | #include <qregexp.h> | 1 | #include <qregexp.h> |
2 | #include <qapplication.h> | 2 | #include <qapplication.h> |
3 | #include <QDesktopWidget> | ||
3 | 4 | ||
4 | #include "kdebug.h" | 5 | #include "kdebug.h" |
5 | #include "kcalendarsystemgregorian.h" | 6 | #include "kcalendarsystemgregorian.h" |
6 | 7 | ||
7 | #include "klocale.h" | 8 | #include "klocale.h" |
8 | 9 | ||
9 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
10 | 11 | ||
11 | //#define COLLECT_TRANSLATION | 12 | //#define COLLECT_TRANSLATION |
12 | 13 | ||
13 | 14 | ||
14 | QDict<QString> *mLocaleDict = 0; | 15 | Q3Dict<QString> *mLocaleDict = 0; |
15 | void setLocaleDict( QDict<QString> * dict ) | 16 | void setLocaleDict( Q3Dict<QString> * dict ) |
16 | { | 17 | { |
17 | mLocaleDict = dict; | 18 | mLocaleDict = dict; |
18 | 19 | ||
19 | } | 20 | } |
20 | 21 | ||
21 | #ifdef COLLECT_TRANSLATION | 22 | #ifdef COLLECT_TRANSLATION |
22 | 23 | ||
23 | QStringList missingTrans; | 24 | QStringList missingTrans; |
24 | QStringList existingTrans1; | 25 | QStringList existingTrans1; |
25 | QStringList existingTrans2; | 26 | QStringList existingTrans2; |
26 | 27 | ||
27 | void addMissing(const char *text) | 28 | void addMissing(const char *text) |
28 | { | 29 | { |
29 | 30 | ||
30 | QString mis ( text ); | 31 | QString mis ( text ); |
31 | if ( !missingTrans.contains( mis ) ) | 32 | if ( !missingTrans.contains( mis ) ) |
32 | missingTrans.append(mis); | 33 | missingTrans.append(mis); |
33 | 34 | ||
34 | } | 35 | } |
35 | void addExist(const char *text,QString trans ) | 36 | void addExist(const char *text,QString trans ) |
36 | { | 37 | { |
37 | //return; | 38 | //return; |
38 | QString mis ( text ); | 39 | QString mis ( text ); |
39 | if ( !existingTrans1.contains( mis ) ) { | 40 | if ( !existingTrans1.contains( mis ) ) { |
40 | existingTrans1.append(mis); | 41 | existingTrans1.append(mis); |
41 | existingTrans2.append(trans); | 42 | existingTrans2.append(trans); |
42 | 43 | ||
43 | } | 44 | } |
44 | 45 | ||
45 | } | 46 | } |
46 | 47 | ||
47 | #include <qfile.h> | 48 | #include <qfile.h> |
48 | #include <qtextstream.h> | 49 | #include <q3textstream.h> |
49 | #include <qtextcodec.h> | 50 | #include <qtextcodec.h> |
50 | #endif | 51 | #endif |
51 | void dumpMissing() | 52 | void dumpMissing() |
52 | { | 53 | { |
53 | #ifdef COLLECT_TRANSLATION | 54 | #ifdef COLLECT_TRANSLATION |
54 | QString fileName = "/tmp/usernewtrans.txt"; | 55 | QString fileName = "/tmp/usernewtrans.txt"; |
55 | QFile file( fileName ); | 56 | QFile file( fileName ); |
56 | if (!file.open( IO_WriteOnly ) ) { | 57 | if (!file.open( QIODevice::WriteOnly ) ) { |
57 | return ; | 58 | return ; |
58 | } | 59 | } |
59 | QTextStream ts( &file ); | 60 | Q3TextStream ts( &file ); |
60 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 61 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
61 | 62 | ||
62 | int i; | 63 | int i; |
63 | for ( i = 0; i< missingTrans.count(); ++i ) { | 64 | for ( i = 0; i< missingTrans.count(); ++i ) { |
64 | 65 | ||
65 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); | 66 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); |
66 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; | 67 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; |
67 | 68 | ||
68 | } | 69 | } |
69 | file.close(); | 70 | file.close(); |
70 | { | 71 | { |
71 | QString fileName = "/tmp/usertrans.txt"; | 72 | QString fileName = "/tmp/usertrans.txt"; |
72 | QFile file( fileName ); | 73 | QFile file( fileName ); |
73 | if (!file.open( IO_WriteOnly ) ) { | 74 | if (!file.open( QIODevice::WriteOnly ) ) { |
74 | return ; | 75 | return ; |
75 | } | 76 | } |
76 | QTextStream ts( &file ); | 77 | Q3TextStream ts( &file ); |
77 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 78 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
78 | 79 | ||
79 | int i; | 80 | int i; |
80 | for ( i = 0; i< existingTrans1.count(); ++i ) { | 81 | for ( i = 0; i< existingTrans1.count(); ++i ) { |
81 | 82 | ||
82 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); | 83 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); |
83 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); | 84 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); |
84 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; | 85 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; |
85 | 86 | ||
86 | } | 87 | } |
87 | file.close(); | 88 | file.close(); |
88 | } | 89 | } |
89 | #endif | 90 | #endif |
90 | } | 91 | } |
91 | QString i18n(const char *text) | 92 | QString i18n(const char *text) |
92 | { | 93 | { |
@@ -454,33 +455,33 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat | |||
454 | QString ret( buffer, index ); | 455 | QString ret( buffer, index ); |
455 | delete [] buffer; | 456 | delete [] buffer; |
456 | return ret; | 457 | return ret; |
457 | } | 458 | } |
458 | 459 | ||
459 | QString KLocale::formatDateTime(const QDateTime &pDateTime, | 460 | QString KLocale::formatDateTime(const QDateTime &pDateTime, |
460 | bool shortFormat, | 461 | bool shortFormat, |
461 | bool includeSeconds, | 462 | bool includeSeconds, |
462 | IntDateFormat intIntDateFormat) const | 463 | IntDateFormat intIntDateFormat) const |
463 | { | 464 | { |
464 | QString format("%1 %2"); | 465 | QString format("%1 %2"); |
465 | 466 | ||
466 | if ( intIntDateFormat == Default ) | 467 | if ( intIntDateFormat == Default ) |
467 | format = "%1 %2"; | 468 | format = "%1 %2"; |
468 | else if ( intIntDateFormat == Format1 ) | 469 | else if ( intIntDateFormat == Format1 ) |
469 | format = "%1 %2"; | 470 | format = "%1 %2"; |
470 | else if ( intIntDateFormat == ISODate ) | 471 | else if ( intIntDateFormat == Qt::ISODate ) |
471 | format = "%1T%2"; | 472 | format = "%1T%2"; |
472 | 473 | ||
473 | QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) | 474 | QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) |
474 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); | 475 | .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); |
475 | 476 | ||
476 | //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); | 477 | //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); |
477 | 478 | ||
478 | return res; | 479 | return res; |
479 | } | 480 | } |
480 | 481 | ||
481 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const | 482 | QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const |
482 | { | 483 | { |
483 | return formatDateTime(pDateTime, true, true, intIntDateFormat); | 484 | return formatDateTime(pDateTime, true, true, intIntDateFormat); |
484 | } | 485 | } |
485 | 486 | ||
486 | QDate KLocale::readDate(const QString &intstr, bool* ok) const | 487 | QDate KLocale::readDate(const QString &intstr, bool* ok) const |
@@ -514,33 +515,33 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con | |||
514 | 515 | ||
515 | QChar c = fmt.at(fmtpos++); | 516 | QChar c = fmt.at(fmtpos++); |
516 | 517 | ||
517 | if (c != '%') { | 518 | if (c != '%') { |
518 | if (c.isSpace()) | 519 | if (c.isSpace()) |
519 | strpos++; | 520 | strpos++; |
520 | else if (c != str.at(strpos++)) | 521 | else if (c != str.at(strpos++)) |
521 | goto error; | 522 | goto error; |
522 | continue; | 523 | continue; |
523 | } | 524 | } |
524 | 525 | ||
525 | // remove space at the begining | 526 | // remove space at the begining |
526 | if (str.length() > strpos && str.at(strpos).isSpace()) | 527 | if (str.length() > strpos && str.at(strpos).isSpace()) |
527 | strpos++; | 528 | strpos++; |
528 | 529 | ||
529 | c = fmt.at(fmtpos++); | 530 | c = fmt.at(fmtpos++); |
530 | switch (c) | 531 | switch (c.unicode()) |
531 | { | 532 | { |
532 | case 'a': | 533 | case 'a': |
533 | case 'A': | 534 | case 'A': |
534 | // this will just be ignored | 535 | // this will just be ignored |
535 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition | 536 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition |
536 | for (int j = 1; j < 8; j++) { | 537 | for (int j = 1; j < 8; j++) { |
537 | QString s = weekDayName(j, c == 'a').lower(); | 538 | QString s = weekDayName(j, c == 'a').lower(); |
538 | int len = s.length(); | 539 | int len = s.length(); |
539 | if (str.mid(strpos, len) == s) | 540 | if (str.mid(strpos, len) == s) |
540 | strpos += len; | 541 | strpos += len; |
541 | } | 542 | } |
542 | break; | 543 | break; |
543 | } | 544 | } |
544 | case 'b': | 545 | case 'b': |
545 | case 'B': | 546 | case 'B': |
546 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition | 547 | { // Cristian Tache: porting to Win: Block added because of "j" redefinition |
@@ -625,33 +626,33 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const | |||
625 | QChar c = Format.at(Formatpos++); | 626 | QChar c = Format.at(Formatpos++); |
626 | 627 | ||
627 | if (c != '%') | 628 | if (c != '%') |
628 | { | 629 | { |
629 | if (c.isSpace()) | 630 | if (c.isSpace()) |
630 | strpos++; | 631 | strpos++; |
631 | else if (c != str.at(strpos++)) | 632 | else if (c != str.at(strpos++)) |
632 | goto error; | 633 | goto error; |
633 | continue; | 634 | continue; |
634 | } | 635 | } |
635 | 636 | ||
636 | // remove space at the begining | 637 | // remove space at the begining |
637 | if (str.length() > strpos && str.at(strpos).isSpace()) | 638 | if (str.length() > strpos && str.at(strpos).isSpace()) |
638 | strpos++; | 639 | strpos++; |
639 | 640 | ||
640 | c = Format.at(Formatpos++); | 641 | c = Format.at(Formatpos++); |
641 | switch (c) | 642 | switch (c.unicode()) |
642 | { | 643 | { |
643 | case 'p': | 644 | case 'p': |
644 | { | 645 | { |
645 | QString s; | 646 | QString s; |
646 | s = i18n("pm").lower(); | 647 | s = i18n("pm").lower(); |
647 | int len = s.length(); | 648 | int len = s.length(); |
648 | if (str.mid(strpos, len) == s) | 649 | if (str.mid(strpos, len) == s) |
649 | { | 650 | { |
650 | pm = true; | 651 | pm = true; |
651 | strpos += len; | 652 | strpos += len; |
652 | } | 653 | } |
653 | else | 654 | else |
654 | { | 655 | { |
655 | s = i18n("am").lower(); | 656 | s = i18n("am").lower(); |
656 | len = s.length(); | 657 | len = s.length(); |
657 | if (str.mid(strpos, len) == s) { | 658 | if (str.mid(strpos, len) == s) { |
@@ -721,33 +722,33 @@ QDateTime KLocale::readDateTime(const QString &intstr, | |||
721 | 722 | ||
722 | // AT the moment we can not read any other format then ISODate | 723 | // AT the moment we can not read any other format then ISODate |
723 | if ( intIntDateFormat != ISODate ) | 724 | if ( intIntDateFormat != ISODate ) |
724 | { | 725 | { |
725 | qDebug("KLocale::readDateTime, only ISODate is supported."); | 726 | qDebug("KLocale::readDateTime, only ISODate is supported."); |
726 | return QDateTime(); | 727 | return QDateTime(); |
727 | } | 728 | } |
728 | 729 | ||
729 | int pos = intstr.find("T"); | 730 | int pos = intstr.find("T"); |
730 | QString date = intstr.left(pos); | 731 | QString date = intstr.left(pos); |
731 | QString time = intstr.mid(pos+1); | 732 | QString time = intstr.mid(pos+1); |
732 | 733 | ||
733 | QString dformat = dateFormat(intIntDateFormat); | 734 | QString dformat = dateFormat(intIntDateFormat); |
734 | QString tformat = timeFormat(intIntDateFormat); | 735 | QString tformat = timeFormat(intIntDateFormat); |
735 | 736 | ||
736 | QDate m_date = readDate(date, dformat, &ok1); | 737 | QDate m_date = readDate(date, dformat, &ok1); |
737 | QTime m_time = readTime(time, tformat, &ok2); | 738 | QTime m_time = readTime(time, !tformat.isEmpty(), &ok2); |
738 | 739 | ||
739 | QDateTime m_dt; | 740 | QDateTime m_dt; |
740 | 741 | ||
741 | if (ok) | 742 | if (ok) |
742 | { | 743 | { |
743 | if ((ok1 == false) || (ok2 == false)) | 744 | if ((ok1 == false) || (ok2 == false)) |
744 | *ok = false; | 745 | *ok = false; |
745 | else | 746 | else |
746 | *ok = true; | 747 | *ok = true; |
747 | } | 748 | } |
748 | 749 | ||
749 | //only set values if both operations returned true. | 750 | //only set values if both operations returned true. |
750 | if ((ok1 == true) && (ok2 == true)) | 751 | if ((ok1 == true) && (ok2 == true)) |
751 | { | 752 | { |
752 | m_dt.setDate(m_date); | 753 | m_dt.setDate(m_date); |
753 | m_dt.setTime(m_time); | 754 | m_dt.setTime(m_time); |
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h index 58e0b39..840fc9d 100644 --- a/microkde/kdecore/klocale.h +++ b/microkde/kdecore/klocale.h | |||
@@ -1,30 +1,30 @@ | |||
1 | #ifndef MINIKDE_KLOCALE_H | 1 | #ifndef MINIKDE_KLOCALE_H |
2 | #define MINIKDE_KLOCALE_H | 2 | #define MINIKDE_KLOCALE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qdatetime.h> | 6 | #include <qdatetime.h> |
7 | #include <qdict.h> | 7 | #include <q3dict.h> |
8 | 8 | ||
9 | #ifndef I18N_NOOP | 9 | #ifndef I18N_NOOP |
10 | #define I18N_NOOP(x) (x) | 10 | #define I18N_NOOP(x) (x) |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | class KCalendarSystem; | 13 | class KCalendarSystem; |
14 | void setLocaleDict( QDict<QString> * dict ); | 14 | void setLocaleDict( Q3Dict<QString> * dict ); |
15 | QString i18n(const char *text); | 15 | QString i18n(const char *text); |
16 | QString i18n(const char *hint, const char *text); | 16 | QString i18n(const char *hint, const char *text); |
17 | QString i18n(const char *text1, const char *textn, int num); | 17 | QString i18n(const char *text1, const char *textn, int num); |
18 | 18 | ||
19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict | 19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict |
20 | // with our i18n method. we use uic -tr tr2i18n to redirect | 20 | // with our i18n method. we use uic -tr tr2i18n to redirect |
21 | // to the right i18n() function | 21 | // to the right i18n() function |
22 | inline QString tr2i18n(const char* message, const char* =0) { | 22 | inline QString tr2i18n(const char* message, const char* =0) { |
23 | return i18n( message); | 23 | return i18n( message); |
24 | } | 24 | } |
25 | 25 | ||
26 | class KLocale | 26 | class KLocale |
27 | { | 27 | { |
28 | public: | 28 | public: |
29 | KLocale(); | 29 | KLocale(); |
30 | 30 | ||
diff --git a/microkde/kdecore/kmdcodec.cpp b/microkde/kdecore/kmdcodec.cpp index bc03569..db11e52 100644 --- a/microkde/kdecore/kmdcodec.cpp +++ b/microkde/kdecore/kmdcodec.cpp | |||
@@ -26,32 +26,34 @@ | |||
26 | The encoding and decoding utilities in KCodecs with the exception of | 26 | The encoding and decoding utilities in KCodecs with the exception of |
27 | quoted-printable are based on the java implementation in HTTPClient | 27 | quoted-printable are based on the java implementation in HTTPClient |
28 | package by Ronald Tschal� Copyright (C) 1996-1999. | 28 | package by Ronald Tschal� Copyright (C) 1996-1999. |
29 | 29 | ||
30 | The quoted-printable codec as described in RFC 2045, section 6.7. is by | 30 | The quoted-printable codec as described in RFC 2045, section 6.7. is by |
31 | Rik Hemsley (C) 2001. | 31 | Rik Hemsley (C) 2001. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | //US #include <config.h> | 34 | //US #include <config.h> |
35 | 35 | ||
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | 39 | ||
40 | #include <kdebug.h> | 40 | #include <kdebug.h> |
41 | #include "kmdcodec.h" | 41 | #include "kmdcodec.h" |
42 | //Added by qt3to4: | ||
43 | #include <Q3CString> | ||
42 | 44 | ||
43 | #define KMD5_S11 7 | 45 | #define KMD5_S11 7 |
44 | #define KMD5_S12 12 | 46 | #define KMD5_S12 12 |
45 | #define KMD5_S13 17 | 47 | #define KMD5_S13 17 |
46 | #define KMD5_S14 22 | 48 | #define KMD5_S14 22 |
47 | #define KMD5_S21 5 | 49 | #define KMD5_S21 5 |
48 | #define KMD5_S22 9 | 50 | #define KMD5_S22 9 |
49 | #define KMD5_S23 14 | 51 | #define KMD5_S23 14 |
50 | #define KMD5_S24 20 | 52 | #define KMD5_S24 20 |
51 | #define KMD5_S31 4 | 53 | #define KMD5_S31 4 |
52 | #define KMD5_S32 11 | 54 | #define KMD5_S32 11 |
53 | #define KMD5_S33 16 | 55 | #define KMD5_S33 16 |
54 | #define KMD5_S34 23 | 56 | #define KMD5_S34 23 |
55 | #define KMD5_S41 6 | 57 | #define KMD5_S41 6 |
56 | #define KMD5_S42 10 | 58 | #define KMD5_S42 10 |
57 | #define KMD5_S43 15 | 59 | #define KMD5_S43 15 |
@@ -134,40 +136,40 @@ const unsigned int KCodecs::maxQPLineLength = 70; | |||
134 | // strchr(3) for broken systems. | 136 | // strchr(3) for broken systems. |
135 | static int rikFindChar(register const char * _s, const char c) | 137 | static int rikFindChar(register const char * _s, const char c) |
136 | { | 138 | { |
137 | register const char * s = _s; | 139 | register const char * s = _s; |
138 | 140 | ||
139 | while (true) | 141 | while (true) |
140 | { | 142 | { |
141 | if ((0 == *s) || (c == *s)) break; ++s; | 143 | if ((0 == *s) || (c == *s)) break; ++s; |
142 | if ((0 == *s) || (c == *s)) break; ++s; | 144 | if ((0 == *s) || (c == *s)) break; ++s; |
143 | if ((0 == *s) || (c == *s)) break; ++s; | 145 | if ((0 == *s) || (c == *s)) break; ++s; |
144 | if ((0 == *s) || (c == *s)) break; ++s; | 146 | if ((0 == *s) || (c == *s)) break; ++s; |
145 | } | 147 | } |
146 | 148 | ||
147 | return s - _s; | 149 | return s - _s; |
148 | } | 150 | } |
149 | 151 | ||
150 | QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) | 152 | Q3CString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) |
151 | { | 153 | { |
152 | QByteArray out; | 154 | QByteArray out; |
153 | quotedPrintableEncode (in, out, useCRLF); | 155 | quotedPrintableEncode (in, out, useCRLF); |
154 | return QCString (out.data(), out.size()+1); | 156 | return Q3CString (out.data(), out.size()+1); |
155 | } | 157 | } |
156 | 158 | ||
157 | QCString KCodecs::quotedPrintableEncode(const QCString& str, bool useCRLF) | 159 | Q3CString KCodecs::quotedPrintableEncode(const Q3CString& str, bool useCRLF) |
158 | { | 160 | { |
159 | if (str.isEmpty()) | 161 | if (str.isEmpty()) |
160 | return ""; | 162 | return ""; |
161 | 163 | ||
162 | QByteArray in (str.length()); | 164 | QByteArray in (str.length()); |
163 | memcpy (in.data(), str.data(), str.length()); | 165 | memcpy (in.data(), str.data(), str.length()); |
164 | return quotedPrintableEncode(in, useCRLF); | 166 | return quotedPrintableEncode(in, useCRLF); |
165 | } | 167 | } |
166 | 168 | ||
167 | void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF) | 169 | void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF) |
168 | { | 170 | { |
169 | out.resize (0); | 171 | out.resize (0); |
170 | if (in.isEmpty()) | 172 | if (in.isEmpty()) |
171 | return; | 173 | return; |
172 | 174 | ||
173 | char *cursor; | 175 | char *cursor; |
@@ -267,40 +269,40 @@ void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool | |||
267 | if (useCRLF) { | 269 | if (useCRLF) { |
268 | *cursor++ = '='; | 270 | *cursor++ = '='; |
269 | *cursor++ = '\r'; | 271 | *cursor++ = '\r'; |
270 | *cursor++ = '\n'; | 272 | *cursor++ = '\n'; |
271 | } else { | 273 | } else { |
272 | *cursor++ = '='; | 274 | *cursor++ = '='; |
273 | *cursor++ = '\n'; | 275 | *cursor++ = '\n'; |
274 | } | 276 | } |
275 | 277 | ||
276 | lineLength = 0; | 278 | lineLength = 0; |
277 | } | 279 | } |
278 | } | 280 | } |
279 | 281 | ||
280 | out.truncate(cursor - out.data()); | 282 | out.truncate(cursor - out.data()); |
281 | } | 283 | } |
282 | 284 | ||
283 | QCString KCodecs::quotedPrintableDecode(const QByteArray & in) | 285 | Q3CString KCodecs::quotedPrintableDecode(const QByteArray & in) |
284 | { | 286 | { |
285 | QByteArray out; | 287 | QByteArray out; |
286 | quotedPrintableDecode (in, out); | 288 | quotedPrintableDecode (in, out); |
287 | return QCString (out.data(), out.size()+1); | 289 | return Q3CString (out.data(), out.size()+1); |
288 | } | 290 | } |
289 | 291 | ||
290 | QCString KCodecs::quotedPrintableDecode(const QCString & str) | 292 | Q3CString KCodecs::quotedPrintableDecode(const Q3CString & str) |
291 | { | 293 | { |
292 | if (str.isEmpty()) | 294 | if (str.isEmpty()) |
293 | return ""; | 295 | return ""; |
294 | 296 | ||
295 | QByteArray in (str.length()); | 297 | QByteArray in (str.length()); |
296 | memcpy (in.data(), str.data(), str.length()); | 298 | memcpy (in.data(), str.data(), str.length()); |
297 | return quotedPrintableDecode (in); | 299 | return quotedPrintableDecode (in); |
298 | } | 300 | } |
299 | 301 | ||
300 | void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out) | 302 | void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out) |
301 | { | 303 | { |
302 | // clear out the output buffer | 304 | // clear out the output buffer |
303 | out.resize (0); | 305 | out.resize (0); |
304 | if (in.isEmpty()) | 306 | if (in.isEmpty()) |
305 | return; | 307 | return; |
306 | 308 | ||
@@ -342,47 +344,47 @@ void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out) | |||
342 | { | 344 | { |
343 | *cursor++ = char((hexChar0 * 16) | hexChar1); | 345 | *cursor++ = char((hexChar0 * 16) | hexChar1); |
344 | i += 2; | 346 | i += 2; |
345 | } | 347 | } |
346 | } | 348 | } |
347 | } | 349 | } |
348 | } | 350 | } |
349 | else | 351 | else |
350 | { | 352 | { |
351 | *cursor++ = c; | 353 | *cursor++ = c; |
352 | } | 354 | } |
353 | } | 355 | } |
354 | 356 | ||
355 | out.truncate(cursor - out.data()); | 357 | out.truncate(cursor - out.data()); |
356 | } | 358 | } |
357 | 359 | ||
358 | QCString KCodecs::base64Encode( const QCString& str, bool insertLFs ) | 360 | Q3CString KCodecs::base64Encode( const Q3CString& str, bool insertLFs ) |
359 | { | 361 | { |
360 | if ( str.isEmpty() ) | 362 | if ( str.isEmpty() ) |
361 | return ""; | 363 | return ""; |
362 | 364 | ||
363 | QByteArray in (str.length()); | 365 | QByteArray in (str.length()); |
364 | memcpy( in.data(), str.data(), str.length() ); | 366 | memcpy( in.data(), str.data(), str.length() ); |
365 | return base64Encode( in, insertLFs ); | 367 | return base64Encode( in, insertLFs ); |
366 | } | 368 | } |
367 | 369 | ||
368 | QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) | 370 | Q3CString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) |
369 | { | 371 | { |
370 | QByteArray out; | 372 | QByteArray out; |
371 | base64Encode( in, out, insertLFs ); | 373 | base64Encode( in, out, insertLFs ); |
372 | return QCString( out.data(), out.size()+1 ); | 374 | return Q3CString( out.data(), out.size()+1 ); |
373 | } | 375 | } |
374 | 376 | ||
375 | void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, | 377 | void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, |
376 | bool insertLFs ) | 378 | bool insertLFs ) |
377 | { | 379 | { |
378 | // clear out the output buffer | 380 | // clear out the output buffer |
379 | out.resize (0); | 381 | out.resize (0); |
380 | if ( in.isEmpty() ) | 382 | if ( in.isEmpty() ) |
381 | return; | 383 | return; |
382 | 384 | ||
383 | unsigned int sidx = 0; | 385 | unsigned int sidx = 0; |
384 | unsigned int didx = 0; | 386 | unsigned int didx = 0; |
385 | const char* data = in.data(); | 387 | const char* data = in.data(); |
386 | const unsigned int len = in.size(); | 388 | const unsigned int len = in.size(); |
387 | 389 | ||
388 | unsigned int out_len = ((len+2)/3)*4; | 390 | unsigned int out_len = ((len+2)/3)*4; |
@@ -392,86 +394,83 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, | |||
392 | // pre request basis. | 394 | // pre request basis. |
393 | insertLFs = (insertLFs && out_len > 76); | 395 | insertLFs = (insertLFs && out_len > 76); |
394 | if ( insertLFs ) | 396 | if ( insertLFs ) |
395 | out_len += ((out_len-1)/76); | 397 | out_len += ((out_len-1)/76); |
396 | 398 | ||
397 | int count = 0; | 399 | int count = 0; |
398 | out.resize( out_len ); | 400 | out.resize( out_len ); |
399 | 401 | ||
400 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion | 402 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion |
401 | if ( len > 1 ) | 403 | if ( len > 1 ) |
402 | { | 404 | { |
403 | while (sidx < len-2) | 405 | while (sidx < len-2) |
404 | { | 406 | { |
405 | if ( insertLFs ) | 407 | if ( insertLFs ) |
406 | { | 408 | { |
407 | if ( count && (count%76) == 0 ) | 409 | if ( count && (count%76) == 0 ) |
408 | out.at(didx++) = '\n'; | 410 | out[didx++] = '\n'; |
409 | count += 4; | 411 | count += 4; |
410 | } | 412 | } |
411 | out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; | 413 | out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077]; |
412 | out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | | 414 | out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 | |
413 | (data[sidx] << 4) & 077]; | 415 | (data[sidx] << 4) & 077]; |
414 | out.at(didx++) = Base64EncMap[(data[sidx+2] >> 6) & 003 | | 416 | out[didx++] = Base64EncMap[(data[sidx+2] >> 6) & 003 | |
415 | (data[sidx+1] << 2) & 077]; | 417 | (data[sidx+1] << 2) & 077]; |
416 | out.at(didx++) = Base64EncMap[data[sidx+2] & 077]; | 418 | out[didx++] = Base64EncMap[data[sidx+2] & 077]; |
417 | sidx += 3; | 419 | sidx += 3; |
418 | } | 420 | } |
419 | } | 421 | } |
420 | 422 | ||
421 | if (sidx < len) | 423 | if (sidx < len) |
422 | { | 424 | { |
423 | if ( insertLFs && (count > 0) && (count%76) == 0 ) | 425 | if ( insertLFs && (count > 0) && (count%76) == 0 ) |
424 | out.at(didx++) = '\n'; | 426 | out[didx++] = '\n'; |
425 | 427 | ||
426 | out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; | 428 | out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077]; |
427 | if (sidx < len-1) | 429 | if (sidx < len-1) |
428 | { | 430 | { |
429 | out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | | 431 | out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 | |
430 | (data[sidx] << 4) & 077]; | 432 | (data[sidx] << 4) & 077]; |
431 | out.at(didx++) = Base64EncMap[(data[sidx+1] << 2) & 077]; | 433 | out[didx++] = Base64EncMap[(data[sidx+1] << 2) & 077]; |
432 | } | 434 | } |
433 | else | 435 | else |
434 | { | 436 | { |
435 | out.at(didx++) = Base64EncMap[(data[sidx] << 4) & 077]; | 437 | out[didx++] = Base64EncMap[(data[sidx] << 4) & 077]; |
436 | } | 438 | } |
437 | } | 439 | } |
438 | 440 | ||
439 | // Add padding | 441 | // Add padding |
440 | while (didx < out.size()) | 442 | while (didx < out.size()) |
441 | { | 443 | out[didx++] = '='; |
442 | out.at(didx) = '='; | ||
443 | didx++; | ||
444 | } | ||
445 | } | 444 | } |
446 | 445 | ||
447 | QCString KCodecs::base64Decode( const QCString& str ) | 446 | Q3CString KCodecs::base64Decode( const Q3CString& str ) |
448 | { | 447 | { |
449 | if ( str.isEmpty() ) | 448 | if ( str.isEmpty() ) |
450 | return ""; | 449 | return ""; |
451 | 450 | ||
452 | QByteArray in( str.length() ); | 451 | QByteArray in( str.length() ); |
453 | memcpy( in.data(), str.data(), str.length() ); | 452 | memcpy( in.data(), str.data(), str.length() ); |
454 | return base64Decode( in ); | 453 | return base64Decode( in ); |
455 | } | 454 | } |
456 | 455 | ||
457 | QCString KCodecs::base64Decode( const QByteArray& in ) | 456 | Q3CString KCodecs::base64Decode( const QByteArray& in ) |
458 | { | 457 | { |
459 | QByteArray out; | 458 | QByteArray out; |
460 | base64Decode( in, out ); | 459 | base64Decode( in, out ); |
461 | return QCString( out.data(), out.size()+1 ); | 460 | return Q3CString( out.data(), out.size()+1 ); |
462 | } | 461 | } |
463 | 462 | ||
464 | void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) | 463 | void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) |
465 | { | 464 | { |
466 | out.resize(0); | 465 | out.resize(0); |
467 | if ( in.isEmpty() ) | 466 | if ( in.isEmpty() ) |
468 | return; | 467 | return; |
469 | 468 | ||
470 | unsigned int count = 0; | 469 | unsigned int count = 0; |
471 | unsigned int len = in.size(), tail = len; | 470 | unsigned int len = in.size(), tail = len; |
472 | const char* data = in.data(); | 471 | const char* data = in.data(); |
473 | 472 | ||
474 | // Deal with possible *nix "BEGIN" marker!! | 473 | // Deal with possible *nix "BEGIN" marker!! |
475 | while ( count < len && (data[count] == '\n' || data[count] == '\r' || | 474 | while ( count < len && (data[count] == '\n' || data[count] == '\r' || |
476 | data[count] == '\t' || data[count] == ' ') ) | 475 | data[count] == '\t' || data[count] == ' ') ) |
477 | count++; | 476 | count++; |
@@ -492,182 +491,182 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) | |||
492 | // Find the tail end of the actual encoded data even if | 491 | // Find the tail end of the actual encoded data even if |
493 | // there is/are trailing CR and/or LF. | 492 | // there is/are trailing CR and/or LF. |
494 | while ( data[tail-1] == '=' || data[tail-1] == '\n' || | 493 | while ( data[tail-1] == '=' || data[tail-1] == '\n' || |
495 | data[tail-1] == '\r' ) | 494 | data[tail-1] == '\r' ) |
496 | if ( data[--tail] != '=' ) len = tail; | 495 | if ( data[--tail] != '=' ) len = tail; |
497 | 496 | ||
498 | unsigned int outIdx = 0; | 497 | unsigned int outIdx = 0; |
499 | out.resize( (count=len) ); | 498 | out.resize( (count=len) ); |
500 | for (unsigned int idx = 0; idx < count; idx++) | 499 | for (unsigned int idx = 0; idx < count; idx++) |
501 | { | 500 | { |
502 | // Adhere to RFC 2045 and ignore characters | 501 | // Adhere to RFC 2045 and ignore characters |
503 | // that are not part of the encoding table. | 502 | // that are not part of the encoding table. |
504 | unsigned char ch = data[idx]; | 503 | unsigned char ch = data[idx]; |
505 | if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) || | 504 | if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) || |
506 | (ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=') | 505 | (ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=') |
507 | { | 506 | { |
508 | out.at(outIdx++) = Base64DecMap[ch]; | 507 | out[outIdx++] = Base64DecMap[ch]; |
509 | } | 508 | } |
510 | else | 509 | else |
511 | { | 510 | { |
512 | len--; | 511 | len--; |
513 | tail--; | 512 | tail--; |
514 | } | 513 | } |
515 | } | 514 | } |
516 | 515 | ||
517 | // kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl; | 516 | // kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl; |
518 | 517 | ||
519 | // 4-byte to 3-byte conversion | 518 | // 4-byte to 3-byte conversion |
520 | len = (tail>(len/4)) ? tail-(len/4) : 0; | 519 | len = (tail>(len/4)) ? tail-(len/4) : 0; |
521 | unsigned int sidx = 0, didx = 0; | 520 | unsigned int sidx = 0, didx = 0; |
522 | if ( len > 1 ) | 521 | if ( len > 1 ) |
523 | { | 522 | { |
524 | while (didx < len-2) | 523 | while (didx < len-2) |
525 | { | 524 | { |
526 | out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); | 525 | out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); |
527 | out.at(didx+1) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); | 526 | out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); |
528 | out.at(didx+2) = (((out.at(sidx+2) << 6) & 255) | (out.at(sidx+3) & 077)); | 527 | out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077)); |
529 | sidx += 4; | 528 | sidx += 4; |
530 | didx += 3; | 529 | didx += 3; |
531 | } | 530 | } |
532 | } | 531 | } |
533 | 532 | ||
534 | if (didx < len) | 533 | if (didx < len) |
535 | out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); | 534 | out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); |
536 | 535 | ||
537 | if (++didx < len ) | 536 | if (++didx < len ) |
538 | out.at(didx) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); | 537 | out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); |
539 | 538 | ||
540 | // Resize the output buffer | 539 | // Resize the output buffer |
541 | if ( len == 0 || len < out.size() ) | 540 | if ( len == 0 || len < out.size() ) |
542 | out.resize(len); | 541 | out.resize(len); |
543 | } | 542 | } |
544 | 543 | ||
545 | QCString KCodecs::uuencode( const QCString& str ) | 544 | Q3CString KCodecs::uuencode( const Q3CString& str ) |
546 | { | 545 | { |
547 | if ( str.isEmpty() ) | 546 | if ( str.isEmpty() ) |
548 | return ""; | 547 | return ""; |
549 | 548 | ||
550 | QByteArray in; | 549 | QByteArray in; |
551 | in.resize( str.length() ); | 550 | in.resize( str.length() ); |
552 | memcpy( in.data(), str.data(), str.length() ); | 551 | memcpy( in.data(), str.data(), str.length() ); |
553 | return uuencode( in ); | 552 | return uuencode( in ); |
554 | } | 553 | } |
555 | 554 | ||
556 | QCString KCodecs::uuencode( const QByteArray& in ) | 555 | Q3CString KCodecs::uuencode( const QByteArray& in ) |
557 | { | 556 | { |
558 | QByteArray out; | 557 | QByteArray out; |
559 | uuencode( in, out ); | 558 | uuencode( in, out ); |
560 | return QCString( out.data(), out.size()+1 ); | 559 | return Q3CString( out.data(), out.size()+1 ); |
561 | } | 560 | } |
562 | 561 | ||
563 | void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) | 562 | void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) |
564 | { | 563 | { |
565 | out.resize( 0 ); | 564 | out.resize( 0 ); |
566 | if( in.isEmpty() ) | 565 | if( in.isEmpty() ) |
567 | return; | 566 | return; |
568 | 567 | ||
569 | unsigned int sidx = 0; | 568 | unsigned int sidx = 0; |
570 | unsigned int didx = 0; | 569 | unsigned int didx = 0; |
571 | unsigned int line_len = 45; | 570 | unsigned int line_len = 45; |
572 | 571 | ||
573 | const char nl[] = "\n"; | 572 | const char nl[] = "\n"; |
574 | const char* data = in.data(); | 573 | const char* data = in.data(); |
575 | const unsigned int nl_len = strlen(nl); | 574 | const unsigned int nl_len = strlen(nl); |
576 | const unsigned int len = in.size(); | 575 | const unsigned int len = in.size(); |
577 | 576 | ||
578 | out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) ); | 577 | out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) ); |
579 | // split into lines, adding line-length and line terminator | 578 | // split into lines, adding line-length and line terminator |
580 | while (sidx+line_len < len) | 579 | while (sidx+line_len < len) |
581 | { | 580 | { |
582 | // line length | 581 | // line length |
583 | out.at(didx++) = UUEncMap[line_len]; | 582 | out[didx++] = UUEncMap[line_len]; |
584 | 583 | ||
585 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion | 584 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion |
586 | for (unsigned int end = sidx+line_len; sidx < end; sidx += 3) | 585 | for (unsigned int end = sidx+line_len; sidx < end; sidx += 3) |
587 | { | 586 | { |
588 | out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; | 587 | out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; |
589 | out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | | 588 | out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | |
590 | (data[sidx] << 4) & 077]; | 589 | (data[sidx] << 4) & 077]; |
591 | out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | | 590 | out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 | |
592 | (data[sidx+1] << 2) & 077]; | 591 | (data[sidx+1] << 2) & 077]; |
593 | out.at(didx++) = UUEncMap[data[sidx+2] & 077]; | 592 | out[didx++] = UUEncMap[data[sidx+2] & 077]; |
594 | } | 593 | } |
595 | 594 | ||
596 | // line terminator | 595 | // line terminator |
597 | //for (unsigned int idx=0; idx < nl_len; idx++) | 596 | //for (unsigned int idx=0; idx < nl_len; idx++) |
598 | //out.at(didx++) = nl[idx]; | 597 | //out[didx++] = nl[idx]; |
599 | memcpy(out.data()+didx, nl, nl_len); | 598 | memcpy(out.data()+didx, nl, nl_len); |
600 | didx += nl_len; | 599 | didx += nl_len; |
601 | } | 600 | } |
602 | 601 | ||
603 | // line length | 602 | // line length |
604 | out.at(didx++) = UUEncMap[len-sidx]; | 603 | out[didx++] = UUEncMap[len-sidx]; |
605 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion | 604 | // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion |
606 | while (sidx+2 < len) | 605 | while (sidx+2 < len) |
607 | { | 606 | { |
608 | out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; | 607 | out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; |
609 | out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | | 608 | out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | |
610 | (data[sidx] << 4) & 077]; | 609 | (data[sidx] << 4) & 077]; |
611 | out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | | 610 | out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 | |
612 | (data[sidx+1] << 2) & 077]; | 611 | (data[sidx+1] << 2) & 077]; |
613 | out.at(didx++) = UUEncMap[data[sidx+2] & 077]; | 612 | out[didx++] = UUEncMap[data[sidx+2] & 077]; |
614 | sidx += 3; | 613 | sidx += 3; |
615 | } | 614 | } |
616 | 615 | ||
617 | if (sidx < len-1) | 616 | if (sidx < len-1) |
618 | { | 617 | { |
619 | out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; | 618 | out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; |
620 | out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | | 619 | out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 | |
621 | (data[sidx] << 4) & 077]; | 620 | (data[sidx] << 4) & 077]; |
622 | out.at(didx++) = UUEncMap[(data[sidx+1] << 2) & 077]; | 621 | out[didx++] = UUEncMap[(data[sidx+1] << 2) & 077]; |
623 | out.at(didx++) = UUEncMap[0]; | 622 | out[didx++] = UUEncMap[0]; |
624 | } | 623 | } |
625 | else if (sidx < len) | 624 | else if (sidx < len) |
626 | { | 625 | { |
627 | out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; | 626 | out[didx++] = UUEncMap[(data[sidx] >> 2) & 077]; |
628 | out.at(didx++) = UUEncMap[(data[sidx] << 4) & 077]; | 627 | out[didx++] = UUEncMap[(data[sidx] << 4) & 077]; |
629 | out.at(didx++) = UUEncMap[0]; | 628 | out[didx++] = UUEncMap[0]; |
630 | out.at(didx++) = UUEncMap[0]; | 629 | out[didx++] = UUEncMap[0]; |
631 | } | 630 | } |
632 | 631 | ||
633 | // line terminator | 632 | // line terminator |
634 | memcpy(out.data()+didx, nl, nl_len); | 633 | memcpy(out.data()+didx, nl, nl_len); |
635 | didx += nl_len; | 634 | didx += nl_len; |
636 | 635 | ||
637 | // sanity check | 636 | // sanity check |
638 | if ( didx != out.size() ) | 637 | if ( didx != out.size() ) |
639 | out.resize( 0 ); | 638 | out.resize( 0 ); |
640 | } | 639 | } |
641 | 640 | ||
642 | QCString KCodecs::uudecode( const QCString& str ) | 641 | Q3CString KCodecs::uudecode( const Q3CString& str ) |
643 | { | 642 | { |
644 | if ( str.isEmpty() ) | 643 | if ( str.isEmpty() ) |
645 | return ""; | 644 | return ""; |
646 | 645 | ||
647 | QByteArray in; | 646 | QByteArray in; |
648 | in.resize( str.length() ); | 647 | in.resize( str.length() ); |
649 | memcpy( in.data(), str.data(), str.length() ); | 648 | memcpy( in.data(), str.data(), str.length() ); |
650 | return uudecode( in ); | 649 | return uudecode( in ); |
651 | } | 650 | } |
652 | 651 | ||
653 | QCString KCodecs::uudecode( const QByteArray& in ) | 652 | Q3CString KCodecs::uudecode( const QByteArray& in ) |
654 | { | 653 | { |
655 | QByteArray out; | 654 | QByteArray out; |
656 | uudecode( in, out ); | 655 | uudecode( in, out ); |
657 | return QCString( out.data(), out.size()+1 ); | 656 | return Q3CString( out.data(), out.size()+1 ); |
658 | } | 657 | } |
659 | 658 | ||
660 | void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) | 659 | void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) |
661 | { | 660 | { |
662 | out.resize( 0 ); | 661 | out.resize( 0 ); |
663 | if( in.isEmpty() ) | 662 | if( in.isEmpty() ) |
664 | return; | 663 | return; |
665 | 664 | ||
666 | unsigned int sidx = 0; | 665 | unsigned int sidx = 0; |
667 | unsigned int didx = 0; | 666 | unsigned int didx = 0; |
668 | unsigned int len = in.size(); | 667 | unsigned int len = in.size(); |
669 | unsigned int line_len, end; | 668 | unsigned int line_len, end; |
670 | const char* data = in.data(); | 669 | const char* data = in.data(); |
671 | 670 | ||
672 | // Deal with *nix "BEGIN"/"END" separators!! | 671 | // Deal with *nix "BEGIN"/"END" separators!! |
673 | unsigned int count = 0; | 672 | unsigned int count = 0; |
@@ -692,51 +691,51 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) | |||
692 | 691 | ||
693 | out.resize( len/4*3 ); | 692 | out.resize( len/4*3 ); |
694 | while ( sidx < len ) | 693 | while ( sidx < len ) |
695 | { | 694 | { |
696 | // get line length (in number of encoded octets) | 695 | // get line length (in number of encoded octets) |
697 | line_len = UUDecMap[ (unsigned char) data[sidx++]]; | 696 | line_len = UUDecMap[ (unsigned char) data[sidx++]]; |
698 | // ascii printable to 0-63 and 4-byte to 3-byte conversion | 697 | // ascii printable to 0-63 and 4-byte to 3-byte conversion |
699 | end = didx+line_len; | 698 | end = didx+line_len; |
700 | char A, B, C, D; | 699 | char A, B, C, D; |
701 | if (end > 2) { | 700 | if (end > 2) { |
702 | while (didx < end-2) | 701 | while (didx < end-2) |
703 | { | 702 | { |
704 | A = UUDecMap[(unsigned char) data[sidx]]; | 703 | A = UUDecMap[(unsigned char) data[sidx]]; |
705 | B = UUDecMap[(unsigned char) data[sidx+1]]; | 704 | B = UUDecMap[(unsigned char) data[sidx+1]]; |
706 | C = UUDecMap[(unsigned char) data[sidx+2]]; | 705 | C = UUDecMap[(unsigned char) data[sidx+2]]; |
707 | D = UUDecMap[(unsigned char) data[sidx+3]]; | 706 | D = UUDecMap[(unsigned char) data[sidx+3]]; |
708 | out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); | 707 | out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) ); |
709 | out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); | 708 | out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) ); |
710 | out.at(didx++) = ( ((C << 6) & 255) | (D & 077) ); | 709 | out[didx++] = ( ((C << 6) & 255) | (D & 077) ); |
711 | sidx += 4; | 710 | sidx += 4; |
712 | } | 711 | } |
713 | } | 712 | } |
714 | 713 | ||
715 | if (didx < end) | 714 | if (didx < end) |
716 | { | 715 | { |
717 | A = UUDecMap[(unsigned char) data[sidx]]; | 716 | A = UUDecMap[(unsigned char) data[sidx]]; |
718 | B = UUDecMap[(unsigned char) data[sidx+1]]; | 717 | B = UUDecMap[(unsigned char) data[sidx+1]]; |
719 | out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); | 718 | out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) ); |
720 | } | 719 | } |
721 | 720 | ||
722 | if (didx < end) | 721 | if (didx < end) |
723 | { | 722 | { |
724 | B = UUDecMap[(unsigned char) data[sidx+1]]; | 723 | B = UUDecMap[(unsigned char) data[sidx+1]]; |
725 | C = UUDecMap[(unsigned char) data[sidx+2]]; | 724 | C = UUDecMap[(unsigned char) data[sidx+2]]; |
726 | out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); | 725 | out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) ); |
727 | } | 726 | } |
728 | 727 | ||
729 | // skip padding | 728 | // skip padding |
730 | while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r') | 729 | while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r') |
731 | sidx++; | 730 | sidx++; |
732 | 731 | ||
733 | // skip end of line | 732 | // skip end of line |
734 | while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r')) | 733 | while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r')) |
735 | sidx++; | 734 | sidx++; |
736 | 735 | ||
737 | // skip the "END" separator when present. | 736 | // skip the "END" separator when present. |
738 | if ( hasLF && QString( data+sidx).left(3).lower() == "end" ) | 737 | if ( hasLF && QString( data+sidx).left(3).lower() == "end" ) |
739 | break; | 738 | break; |
740 | } | 739 | } |
741 | 740 | ||
742 | if ( didx < out.size() ) | 741 | if ( didx < out.size() ) |
@@ -748,44 +747,44 @@ KMD5::KMD5() | |||
748 | { | 747 | { |
749 | init(); | 748 | init(); |
750 | } | 749 | } |
751 | 750 | ||
752 | KMD5::KMD5(const char *in, int len) | 751 | KMD5::KMD5(const char *in, int len) |
753 | { | 752 | { |
754 | init(); | 753 | init(); |
755 | update(in, len); | 754 | update(in, len); |
756 | } | 755 | } |
757 | 756 | ||
758 | KMD5::KMD5(const QByteArray& in) | 757 | KMD5::KMD5(const QByteArray& in) |
759 | { | 758 | { |
760 | init(); | 759 | init(); |
761 | update( in ); | 760 | update( in ); |
762 | } | 761 | } |
763 | 762 | ||
764 | KMD5::KMD5(const QCString& in) | 763 | KMD5::KMD5(const Q3CString& in) |
765 | { | 764 | { |
766 | init(); | 765 | init(); |
767 | update( in ); | 766 | update( in ); |
768 | } | 767 | } |
769 | 768 | ||
770 | void KMD5::update(const QByteArray& in) | 769 | void KMD5::update(const QByteArray& in) |
771 | { | 770 | { |
772 | update(in.data(), int(in.size())); | 771 | update(in.data(), int(in.size())); |
773 | } | 772 | } |
774 | 773 | ||
775 | void KMD5::update(const QCString& in) | 774 | void KMD5::update(const Q3CString& in) |
776 | { | 775 | { |
777 | update(in.data(), int(in.length())); | 776 | update(in.data(), int(in.length())); |
778 | } | 777 | } |
779 | 778 | ||
780 | void KMD5::update(const unsigned char* in, int len) | 779 | void KMD5::update(const unsigned char* in, int len) |
781 | { | 780 | { |
782 | if (len < 0) | 781 | if (len < 0) |
783 | len = qstrlen(reinterpret_cast<const char*>(in)); | 782 | len = qstrlen(reinterpret_cast<const char*>(in)); |
784 | 783 | ||
785 | if (!len) | 784 | if (!len) |
786 | return; | 785 | return; |
787 | 786 | ||
788 | if (m_finalized) { | 787 | if (m_finalized) { |
789 | kdWarning() << "KMD5::update called after state was finalized!" << endl; | 788 | kdWarning() << "KMD5::update called after state was finalized!" << endl; |
790 | return; | 789 | return; |
791 | } | 790 | } |
@@ -860,75 +859,75 @@ void KMD5::finalize () | |||
860 | encode (m_digest, m_state, 16); | 859 | encode (m_digest, m_state, 16); |
861 | //memcpy( m_digest, m_state, 16 ); | 860 | //memcpy( m_digest, m_state, 16 ); |
862 | 861 | ||
863 | // Fill sensitive information with zero's | 862 | // Fill sensitive information with zero's |
864 | memset ( (void *)m_buffer, 0, sizeof(*m_buffer)); | 863 | memset ( (void *)m_buffer, 0, sizeof(*m_buffer)); |
865 | 864 | ||
866 | m_finalized = true; | 865 | m_finalized = true; |
867 | } | 866 | } |
868 | 867 | ||
869 | 868 | ||
870 | bool KMD5::verify( const KMD5::Digest& digest) | 869 | bool KMD5::verify( const KMD5::Digest& digest) |
871 | { | 870 | { |
872 | finalize(); | 871 | finalize(); |
873 | return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest))); | 872 | return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest))); |
874 | } | 873 | } |
875 | 874 | ||
876 | bool KMD5::verify( const QCString& hexdigest) | 875 | bool KMD5::verify( const Q3CString& hexdigest) |
877 | { | 876 | { |
878 | finalize(); | 877 | finalize(); |
879 | return (0 == strcmp(hexDigest().data(), hexdigest)); | 878 | return (0 == strcmp(hexDigest().data(), hexdigest)); |
880 | } | 879 | } |
881 | 880 | ||
882 | const KMD5::Digest& KMD5::rawDigest() | 881 | const KMD5::Digest& KMD5::rawDigest() |
883 | { | 882 | { |
884 | finalize(); | 883 | finalize(); |
885 | return m_digest; | 884 | return m_digest; |
886 | } | 885 | } |
887 | 886 | ||
888 | void KMD5::rawDigest( KMD5::Digest& bin ) | 887 | void KMD5::rawDigest( KMD5::Digest& bin ) |
889 | { | 888 | { |
890 | finalize(); | 889 | finalize(); |
891 | memcpy( bin, m_digest, 16 ); | 890 | memcpy( bin, m_digest, 16 ); |
892 | } | 891 | } |
893 | 892 | ||
894 | 893 | ||
895 | QCString KMD5::hexDigest() | 894 | Q3CString KMD5::hexDigest() |
896 | { | 895 | { |
897 | QCString s(33); | 896 | Q3CString s(33); |
898 | 897 | ||
899 | finalize(); | 898 | finalize(); |
900 | sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", | 899 | sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", |
901 | m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], | 900 | m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], |
902 | m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], | 901 | m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], |
903 | m_digest[12], m_digest[13], m_digest[14], m_digest[15]); | 902 | m_digest[12], m_digest[13], m_digest[14], m_digest[15]); |
904 | 903 | ||
905 | return s; | 904 | return s; |
906 | } | 905 | } |
907 | 906 | ||
908 | void KMD5::hexDigest(QCString& s) | 907 | void KMD5::hexDigest(Q3CString& s) |
909 | { | 908 | { |
910 | finalize(); | 909 | finalize(); |
911 | s.resize(33); | 910 | s.resize(33); |
912 | sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", | 911 | sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", |
913 | m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], | 912 | m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], |
914 | m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], | 913 | m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], |
915 | m_digest[12], m_digest[13], m_digest[14], m_digest[15]); | 914 | m_digest[12], m_digest[13], m_digest[14], m_digest[15]); |
916 | } | 915 | } |
917 | 916 | ||
918 | QCString KMD5::base64Digest() | 917 | Q3CString KMD5::base64Digest() |
919 | { | 918 | { |
920 | QByteArray ba(16); | 919 | QByteArray ba(16); |
921 | 920 | ||
922 | finalize(); | 921 | finalize(); |
923 | memcpy(ba.data(), m_digest, 16); | 922 | memcpy(ba.data(), m_digest, 16); |
924 | return KCodecs::base64Encode(ba); | 923 | return KCodecs::base64Encode(ba); |
925 | } | 924 | } |
926 | 925 | ||
927 | 926 | ||
928 | void KMD5::init() | 927 | void KMD5::init() |
929 | { | 928 | { |
930 | d = 0; | 929 | d = 0; |
931 | reset(); | 930 | reset(); |
932 | } | 931 | } |
933 | 932 | ||
934 | void KMD5::reset() | 933 | void KMD5::reset() |
@@ -943,33 +942,33 @@ void KMD5::reset() | |||
943 | m_state[2] = 0x98badcfe; | 942 | m_state[2] = 0x98badcfe; |
944 | m_state[3] = 0x10325476; | 943 | m_state[3] = 0x10325476; |
945 | 944 | ||
946 | memset ( m_buffer, 0, sizeof(*m_buffer)); | 945 | memset ( m_buffer, 0, sizeof(*m_buffer)); |
947 | memset ( m_digest, 0, sizeof(*m_digest)); | 946 | memset ( m_digest, 0, sizeof(*m_digest)); |
948 | } | 947 | } |
949 | 948 | ||
950 | void KMD5::transform( const unsigned char block[64] ) | 949 | void KMD5::transform( const unsigned char block[64] ) |
951 | { | 950 | { |
952 | 951 | ||
953 | Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16]; | 952 | Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16]; |
954 | 953 | ||
955 | decode (x, block, 64); | 954 | decode (x, block, 64); |
956 | //memcpy( x, block, 64 ); | 955 | //memcpy( x, block, 64 ); |
957 | 956 | ||
958 | //US Q_ASSERT(!m_finalized); // not just a user error, since the method is private | 957 | //US Q_ASSERT(!m_finalized); // not just a user error, since the method is private |
959 | ASSERT(!m_finalized); // not just a user error, since the method is private | 958 | Q_ASSERT(!m_finalized); // not just a user error, since the method is private |
960 | 959 | ||
961 | /* Round 1 */ | 960 | /* Round 1 */ |
962 | FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */ | 961 | FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */ |
963 | FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */ | 962 | FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */ |
964 | FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */ | 963 | FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */ |
965 | FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */ | 964 | FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */ |
966 | FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */ | 965 | FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */ |
967 | FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */ | 966 | FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */ |
968 | FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */ | 967 | FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */ |
969 | FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */ | 968 | FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */ |
970 | FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */ | 969 | FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */ |
971 | FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */ | 970 | FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */ |
972 | FF (c, d, a, b, x[10], KMD5_S13, 0xffff5bb1); /* 11 */ | 971 | FF (c, d, a, b, x[10], KMD5_S13, 0xffff5bb1); /* 11 */ |
973 | FF (b, c, d, a, x[11], KMD5_S14, 0x895cd7be); /* 12 */ | 972 | FF (b, c, d, a, x[11], KMD5_S14, 0x895cd7be); /* 12 */ |
974 | FF (a, b, c, d, x[12], KMD5_S11, 0x6b901122); /* 13 */ | 973 | FF (a, b, c, d, x[12], KMD5_S11, 0x6b901122); /* 13 */ |
975 | FF (d, a, b, c, x[13], KMD5_S12, 0xfd987193); /* 14 */ | 974 | FF (d, a, b, c, x[13], KMD5_S12, 0xfd987193); /* 14 */ |
diff --git a/microkde/kdecore/kmdcodec.h b/microkde/kdecore/kmdcodec.h index 2c4d611..616b683 100644 --- a/microkde/kdecore/kmdcodec.h +++ b/microkde/kdecore/kmdcodec.h | |||
@@ -26,32 +26,34 @@ | |||
26 | The encoding and decoding utilities in KCodecs with the exception of | 26 | The encoding and decoding utilities in KCodecs with the exception of |
27 | quoted-printable are based on the java implementation in HTTPClient | 27 | quoted-printable are based on the java implementation in HTTPClient |
28 | package by Ronald Tschalär Copyright (C) 1996-1999. | 28 | package by Ronald Tschalär Copyright (C) 1996-1999. |
29 | 29 | ||
30 | The quoted-printable codec as described in RFC 2045, section 6.7. is by | 30 | The quoted-printable codec as described in RFC 2045, section 6.7. is by |
31 | Rik Hemsley (C) 2001. | 31 | Rik Hemsley (C) 2001. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef _KMDBASE_H | 34 | #ifndef _KMDBASE_H |
35 | #define _KMDBASE_H | 35 | #define _KMDBASE_H |
36 | 36 | ||
37 | #define KBase64 KCodecs | 37 | #define KBase64 KCodecs |
38 | 38 | ||
39 | #include <qglobal.h> | 39 | #include <qglobal.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qiodevice.h> | 41 | #include <qiodevice.h> |
42 | //Added by qt3to4: | ||
43 | #include <Q3CString> | ||
42 | 44 | ||
43 | /** | 45 | /** |
44 | * A wrapper class for the most commonly used encoding and | 46 | * A wrapper class for the most commonly used encoding and |
45 | * decoding algorithms. Currently there is support for encoding | 47 | * decoding algorithms. Currently there is support for encoding |
46 | * and decoding input using base64, uu and the quoted-printable | 48 | * and decoding input using base64, uu and the quoted-printable |
47 | * specifications. | 49 | * specifications. |
48 | * | 50 | * |
49 | * @sect Usage: | 51 | * @sect Usage: |
50 | * | 52 | * |
51 | * <PRE> | 53 | * <PRE> |
52 | * QCString input = "Aladdin:open sesame"; | 54 | * QCString input = "Aladdin:open sesame"; |
53 | * QCString result = KCodecs::base64Encode(input); | 55 | * QCString result = KCodecs::base64Encode(input); |
54 | * cout << "Result: " << result.data() << endl; | 56 | * cout << "Result: " << result.data() << endl; |
55 | * | 57 | * |
56 | * Output should be | 58 | * Output should be |
57 | * Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ== | 59 | * Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
@@ -68,92 +70,92 @@ | |||
68 | * @author Dawit Alemayehu <adawit@kde.org> | 70 | * @author Dawit Alemayehu <adawit@kde.org> |
69 | * @author Rik Hemsley <rik@kde.org> | 71 | * @author Rik Hemsley <rik@kde.org> |
70 | */ | 72 | */ |
71 | class KCodecs | 73 | class KCodecs |
72 | { | 74 | { |
73 | public: | 75 | public: |
74 | 76 | ||
75 | /** | 77 | /** |
76 | * Encodes the given data using the quoted-printable algorithm. | 78 | * Encodes the given data using the quoted-printable algorithm. |
77 | * | 79 | * |
78 | * @param in data to be encoded. | 80 | * @param in data to be encoded. |
79 | * @param useCRLF if true the input data is expected to have | 81 | * @param useCRLF if true the input data is expected to have |
80 | * CRLF line breaks and the output will have CRLF line | 82 | * CRLF line breaks and the output will have CRLF line |
81 | * breaks, too. | 83 | * breaks, too. |
82 | * @return quoted-printable encoded data. | 84 | * @return quoted-printable encoded data. |
83 | */ | 85 | */ |
84 | static QCString quotedPrintableEncode(const QByteArray & in, | 86 | static Q3CString quotedPrintableEncode(const QByteArray & in, |
85 | bool useCRLF = true); | 87 | bool useCRLF = true); |
86 | 88 | ||
87 | /** | 89 | /** |
88 | * @overload | 90 | * @overload |
89 | * | 91 | * |
90 | * Same as above except it accepts a null terminated | 92 | * Same as above except it accepts a null terminated |
91 | * string instead an array. | 93 | * string instead an array. |
92 | * | 94 | * |
93 | * @param str data to be encoded. | 95 | * @param str data to be encoded. |
94 | * @param useCRLF if true the input data is expected to have | 96 | * @param useCRLF if true the input data is expected to have |
95 | * CRLF line breaks and the output will have CRLF line | 97 | * CRLF line breaks and the output will have CRLF line |
96 | * breaks, too. | 98 | * breaks, too. |
97 | * @return quoted-printable encoded data. | 99 | * @return quoted-printable encoded data. |
98 | */ | 100 | */ |
99 | static QCString quotedPrintableEncode(const QCString & str, | 101 | static Q3CString quotedPrintableEncode(const Q3CString & str, |
100 | bool useCRLF = true); | 102 | bool useCRLF = true); |
101 | 103 | ||
102 | /** | 104 | /** |
103 | * Encodes the given data using the quoted-printable algorithm. | 105 | * Encodes the given data using the quoted-printable algorithm. |
104 | * | 106 | * |
105 | * Use this function if you want the result of the encoding | 107 | * Use this function if you want the result of the encoding |
106 | * to be placed in another array which cuts down the number | 108 | * to be placed in another array which cuts down the number |
107 | * of copy operation that have to be performed in the process. | 109 | * of copy operation that have to be performed in the process. |
108 | * This is also the preferred method for encoding binary data. | 110 | * This is also the preferred method for encoding binary data. |
109 | * | 111 | * |
110 | * NOTE: the output array is first reset and then resized | 112 | * NOTE: the output array is first reset and then resized |
111 | * appropriately before use, hence, all data stored in the | 113 | * appropriately before use, hence, all data stored in the |
112 | * output array will be lost. | 114 | * output array will be lost. |
113 | * | 115 | * |
114 | * @param in data to be encoded. | 116 | * @param in data to be encoded. |
115 | * @param out decoded data. | 117 | * @param out decoded data. |
116 | * @param useCRLF if true the input data is expected to have | 118 | * @param useCRLF if true the input data is expected to have |
117 | * CRLF line breaks and the output will have CRLF line | 119 | * CRLF line breaks and the output will have CRLF line |
118 | * breaks, too. | 120 | * breaks, too. |
119 | * @return quoted-printable encoded data. | 121 | * @return quoted-printable encoded data. |
120 | */ | 122 | */ |
121 | static void quotedPrintableEncode(const QByteArray & in, QByteArray& out, | 123 | static void quotedPrintableEncode(const QByteArray & in, QByteArray& out, |
122 | bool useCRLF); | 124 | bool useCRLF); |
123 | 125 | ||
124 | /** | 126 | /** |
125 | * Decodes a quoted-printable encoded string. | 127 | * Decodes a quoted-printable encoded string. |
126 | * | 128 | * |
127 | * Accepts data with CRLF or standard unix line breaks. | 129 | * Accepts data with CRLF or standard unix line breaks. |
128 | * | 130 | * |
129 | * @param in the data to be decoded. | 131 | * @param in the data to be decoded. |
130 | * @return decoded data. | 132 | * @return decoded data. |
131 | */ | 133 | */ |
132 | static QCString quotedPrintableDecode(const QByteArray & in); | 134 | static Q3CString quotedPrintableDecode(const QByteArray & in); |
133 | 135 | ||
134 | /** | 136 | /** |
135 | * @overload | 137 | * @overload |
136 | * | 138 | * |
137 | * Same as above except it accepts a null terminated | 139 | * Same as above except it accepts a null terminated |
138 | * string instead an array. | 140 | * string instead an array. |
139 | * | 141 | * |
140 | * @param str the data to be decoded. | 142 | * @param str the data to be decoded. |
141 | * @return decoded data. | 143 | * @return decoded data. |
142 | */ | 144 | */ |
143 | static QCString quotedPrintableDecode(const QCString & str); | 145 | static Q3CString quotedPrintableDecode(const Q3CString & str); |
144 | 146 | ||
145 | /** | 147 | /** |
146 | * Decodes a quoted-printable encoded data. | 148 | * Decodes a quoted-printable encoded data. |
147 | * | 149 | * |
148 | * Accepts data with CRLF or standard unix line breaks. | 150 | * Accepts data with CRLF or standard unix line breaks. |
149 | * Use this function if you want the result of the decoding | 151 | * Use this function if you want the result of the decoding |
150 | * to be placed in another array which cuts down the number | 152 | * to be placed in another array which cuts down the number |
151 | * of copy operation that have to be performed in the process. | 153 | * of copy operation that have to be performed in the process. |
152 | * This is also the preferred method for decoding an encoded | 154 | * This is also the preferred method for decoding an encoded |
153 | * binary data. | 155 | * binary data. |
154 | * | 156 | * |
155 | * NOTE: the output array is first reset and then resized | 157 | * NOTE: the output array is first reset and then resized |
156 | * appropriately before use, hence, all data stored in the | 158 | * appropriately before use, hence, all data stored in the |
157 | * output array will be lost. | 159 | * output array will be lost. |
158 | * | 160 | * |
159 | * @param in data to be encoded. | 161 | * @param in data to be encoded. |
@@ -162,84 +164,84 @@ public: | |||
162 | * @return quoted-printable encoded data. | 164 | * @return quoted-printable encoded data. |
163 | */ | 165 | */ |
164 | static void quotedPrintableDecode(const QByteArray & in, QByteArray& out); | 166 | static void quotedPrintableDecode(const QByteArray & in, QByteArray& out); |
165 | 167 | ||
166 | 168 | ||
167 | /** | 169 | /** |
168 | * Encodes the given data using the uuencode algorithm. | 170 | * Encodes the given data using the uuencode algorithm. |
169 | * | 171 | * |
170 | * The output is split into lines starting with the number of | 172 | * The output is split into lines starting with the number of |
171 | * encoded octets in the line and ending with a newline. No | 173 | * encoded octets in the line and ending with a newline. No |
172 | * line is longer than 45 octets (60 characters), excluding the | 174 | * line is longer than 45 octets (60 characters), excluding the |
173 | * line terminator. | 175 | * line terminator. |
174 | * | 176 | * |
175 | * @param in the data to be uuencoded | 177 | * @param in the data to be uuencoded |
176 | * @return a uuencoded data. | 178 | * @return a uuencoded data. |
177 | */ | 179 | */ |
178 | static QCString uuencode( const QByteArray& in ); | 180 | static Q3CString uuencode( const QByteArray& in ); |
179 | 181 | ||
180 | /** | 182 | /** |
181 | * @overload | 183 | * @overload |
182 | * | 184 | * |
183 | * Same as the above functions except it accepts | 185 | * Same as the above functions except it accepts |
184 | * a null terminated string instead an array. | 186 | * a null terminated string instead an array. |
185 | * | 187 | * |
186 | * @param str the string to be uuencoded. | 188 | * @param str the string to be uuencoded. |
187 | * @return the encoded string. | 189 | * @return the encoded string. |
188 | */ | 190 | */ |
189 | static QCString uuencode( const QCString& str ); | 191 | static Q3CString uuencode( const Q3CString& str ); |
190 | 192 | ||
191 | /** | 193 | /** |
192 | * Encodes the given data using the uuencode algorithm. | 194 | * Encodes the given data using the uuencode algorithm. |
193 | * | 195 | * |
194 | * Use this function if you want the result of the encoding | 196 | * Use this function if you want the result of the encoding |
195 | * to be placed in another array and cut down the number of | 197 | * to be placed in another array and cut down the number of |
196 | * copy operation that have to be performed in the process. | 198 | * copy operation that have to be performed in the process. |
197 | * This is the preffered method for encoding binary data. | 199 | * This is the preffered method for encoding binary data. |
198 | * | 200 | * |
199 | * NOTE: the output array is first reset and then resized | 201 | * NOTE: the output array is first reset and then resized |
200 | * appropriately before use, hence, all data stored in the | 202 | * appropriately before use, hence, all data stored in the |
201 | * output array will be lost. | 203 | * output array will be lost. |
202 | * | 204 | * |
203 | * @param in the data to be uuencoded. | 205 | * @param in the data to be uuencoded. |
204 | * @param out the container for the uudecoded data. | 206 | * @param out the container for the uudecoded data. |
205 | */ | 207 | */ |
206 | static void uuencode( const QByteArray& in, QByteArray& out ); | 208 | static void uuencode( const QByteArray& in, QByteArray& out ); |
207 | 209 | ||
208 | /** | 210 | /** |
209 | * Decodes the given data using the uuencode algorithm. | 211 | * Decodes the given data using the uuencode algorithm. |
210 | * | 212 | * |
211 | * Any 'begin' and 'end' lines like those generated by | 213 | * Any 'begin' and 'end' lines like those generated by |
212 | * the utilities in unix and unix-like OS will be | 214 | * the utilities in unix and unix-like OS will be |
213 | * automatically ignored. | 215 | * automatically ignored. |
214 | * | 216 | * |
215 | * @param in the data uuencoded data to be decoded. | 217 | * @param in the data uuencoded data to be decoded. |
216 | * @return a decoded string. | 218 | * @return a decoded string. |
217 | */ | 219 | */ |
218 | static QCString uudecode( const QByteArray& in ); | 220 | static Q3CString uudecode( const QByteArray& in ); |
219 | 221 | ||
220 | /** | 222 | /** |
221 | * @overload | 223 | * @overload |
222 | * | 224 | * |
223 | * Same as the above functions except it accepts | 225 | * Same as the above functions except it accepts |
224 | * a null terminated string instead an array. | 226 | * a null terminated string instead an array. |
225 | * | 227 | * |
226 | * @param str the string to be decoded. | 228 | * @param str the string to be decoded. |
227 | * @return a uudecoded string. | 229 | * @return a uudecoded string. |
228 | */ | 230 | */ |
229 | static QCString uudecode( const QCString& str ); | 231 | static Q3CString uudecode( const Q3CString& str ); |
230 | 232 | ||
231 | /** | 233 | /** |
232 | * Decodes the given data using the uudecode algorithm. | 234 | * Decodes the given data using the uudecode algorithm. |
233 | * | 235 | * |
234 | * Use this function if you want the result of the decoding | 236 | * Use this function if you want the result of the decoding |
235 | * to be placed in another array which cuts down the number | 237 | * to be placed in another array which cuts down the number |
236 | * of copy operation that have to be performed in the process. | 238 | * of copy operation that have to be performed in the process. |
237 | * This is the preferred method for decoding binary data. | 239 | * This is the preferred method for decoding binary data. |
238 | * | 240 | * |
239 | * Any 'begin' and 'end' lines like those generated by | 241 | * Any 'begin' and 'end' lines like those generated by |
240 | * the utilities in unix and unix-like OS will be | 242 | * the utilities in unix and unix-like OS will be |
241 | * automatically ignored. | 243 | * automatically ignored. |
242 | * | 244 | * |
243 | * NOTE: the output array is first reset and then resized | 245 | * NOTE: the output array is first reset and then resized |
244 | * appropriately before use, hence, all data stored in the | 246 | * appropriately before use, hence, all data stored in the |
245 | * output array will be lost. | 247 | * output array will be lost. |
@@ -250,89 +252,89 @@ public: | |||
250 | static void uudecode( const QByteArray& in, QByteArray& out ); | 252 | static void uudecode( const QByteArray& in, QByteArray& out ); |
251 | 253 | ||
252 | 254 | ||
253 | /** | 255 | /** |
254 | * Encodes the given data using the base64 algorithm. | 256 | * Encodes the given data using the base64 algorithm. |
255 | * | 257 | * |
256 | * The boolean argument determines if the encoded data is | 258 | * The boolean argument determines if the encoded data is |
257 | * going to be restricted to 76 characters or less per line | 259 | * going to be restricted to 76 characters or less per line |
258 | * as specified by RFC 2045. If @p insertLFs is true, then | 260 | * as specified by RFC 2045. If @p insertLFs is true, then |
259 | * there will be 76 characters or less per line. | 261 | * there will be 76 characters or less per line. |
260 | * | 262 | * |
261 | * @param in the data to be encoded. | 263 | * @param in the data to be encoded. |
262 | * @param insertLFs limit the number of characters per line. | 264 | * @param insertLFs limit the number of characters per line. |
263 | * | 265 | * |
264 | * @return a base64 encoded string. | 266 | * @return a base64 encoded string. |
265 | */ | 267 | */ |
266 | static QCString base64Encode( const QByteArray& in, bool insertLFs = false); | 268 | static Q3CString base64Encode( const QByteArray& in, bool insertLFs = false); |
267 | 269 | ||
268 | /** | 270 | /** |
269 | * @overload | 271 | * @overload |
270 | * | 272 | * |
271 | * Same as the above functions except it accepts | 273 | * Same as the above functions except it accepts |
272 | * a null terminated string instead an array. | 274 | * a null terminated string instead an array. |
273 | * | 275 | * |
274 | * @param str the string to be encoded. | 276 | * @param str the string to be encoded. |
275 | * @param insertLFs limit the number of characters per line. | 277 | * @param insertLFs limit the number of characters per line. |
276 | * @return the decoded string. | 278 | * @return the decoded string. |
277 | */ | 279 | */ |
278 | static QCString base64Encode( const QCString& str, bool insertLFs = false ); | 280 | static Q3CString base64Encode( const Q3CString& str, bool insertLFs = false ); |
279 | 281 | ||
280 | /** | 282 | /** |
281 | * Encodes the given data using the base64 algorithm. | 283 | * Encodes the given data using the base64 algorithm. |
282 | * | 284 | * |
283 | * Use this function if you want the result of the encoding | 285 | * Use this function if you want the result of the encoding |
284 | * to be placed in another array which cuts down the number | 286 | * to be placed in another array which cuts down the number |
285 | * of copy operation that have to be performed in the process. | 287 | * of copy operation that have to be performed in the process. |
286 | * This is also the preferred method for encoding binary data. | 288 | * This is also the preferred method for encoding binary data. |
287 | * | 289 | * |
288 | * The boolean argument determines if the encoded data is going | 290 | * The boolean argument determines if the encoded data is going |
289 | * to be restricted to 76 characters or less per line as specified | 291 | * to be restricted to 76 characters or less per line as specified |
290 | * by RFC 2045. If @p insertLFs is true, then there will be 76 | 292 | * by RFC 2045. If @p insertLFs is true, then there will be 76 |
291 | * characters or less per line. | 293 | * characters or less per line. |
292 | * | 294 | * |
293 | * NOTE: the output array is first reset and then resized | 295 | * NOTE: the output array is first reset and then resized |
294 | * appropriately before use, hence, all data stored in the | 296 | * appropriately before use, hence, all data stored in the |
295 | * output array will be lost. | 297 | * output array will be lost. |
296 | * | 298 | * |
297 | * @param in the data to be encoded using base64. | 299 | * @param in the data to be encoded using base64. |
298 | * @param out the container for the encoded data. | 300 | * @param out the container for the encoded data. |
299 | * @param insertLFs limit the number of characters per line. | 301 | * @param insertLFs limit the number of characters per line. |
300 | */ | 302 | */ |
301 | static void base64Encode( const QByteArray& in, QByteArray& out, | 303 | static void base64Encode( const QByteArray& in, QByteArray& out, |
302 | bool insertLFs = false ); | 304 | bool insertLFs = false ); |
303 | 305 | ||
304 | /** | 306 | /** |
305 | * Decodes the given data that was encoded using the | 307 | * Decodes the given data that was encoded using the |
306 | * base64 algorithm. | 308 | * base64 algorithm. |
307 | * | 309 | * |
308 | * @param in the base64-encoded data to be decoded. | 310 | * @param in the base64-encoded data to be decoded. |
309 | * @return the decoded data. | 311 | * @return the decoded data. |
310 | */ | 312 | */ |
311 | static QCString base64Decode( const QByteArray& in ); | 313 | static Q3CString base64Decode( const QByteArray& in ); |
312 | 314 | ||
313 | /** | 315 | /** |
314 | * @overload | 316 | * @overload |
315 | * | 317 | * |
316 | * Same as the above functions except it accepts | 318 | * Same as the above functions except it accepts |
317 | * a null terminated string instead an array. | 319 | * a null terminated string instead an array. |
318 | * | 320 | * |
319 | * @param str the base64-encoded string. | 321 | * @param str the base64-encoded string. |
320 | * @return the decoded string. | 322 | * @return the decoded string. |
321 | */ | 323 | */ |
322 | static QCString base64Decode( const QCString& str ); | 324 | static Q3CString base64Decode( const Q3CString& str ); |
323 | 325 | ||
324 | /** | 326 | /** |
325 | * Decodes the given data that was encoded with the base64 | 327 | * Decodes the given data that was encoded with the base64 |
326 | * algorithm. | 328 | * algorithm. |
327 | * | 329 | * |
328 | * Use this function if you want the result of the decoding | 330 | * Use this function if you want the result of the decoding |
329 | * to be placed in another array which cuts down the number | 331 | * to be placed in another array which cuts down the number |
330 | * of copy operation that have to be performed in the process. | 332 | * of copy operation that have to be performed in the process. |
331 | * This is also the preferred method for decoding an encoded | 333 | * This is also the preferred method for decoding an encoded |
332 | * binary data. | 334 | * binary data. |
333 | * | 335 | * |
334 | * NOTE: the output array is first reset and then resized | 336 | * NOTE: the output array is first reset and then resized |
335 | * appropriately before use, hence, all data stored in the | 337 | * appropriately before use, hence, all data stored in the |
336 | * output array will be lost. | 338 | * output array will be lost. |
337 | * | 339 | * |
338 | * @param in the encoded data to be decoded. | 340 | * @param in the encoded data to be decoded. |
@@ -418,62 +420,62 @@ public: | |||
418 | * it trusts the given length (does not stop on NUL byte). | 420 | * it trusts the given length (does not stop on NUL byte). |
419 | */ | 421 | */ |
420 | KMD5(const char* in, int len = -1); | 422 | KMD5(const char* in, int len = -1); |
421 | 423 | ||
422 | /** | 424 | /** |
423 | * @overload | 425 | * @overload |
424 | * | 426 | * |
425 | * Same as above except it accepts a QByteArray as its argument. | 427 | * Same as above except it accepts a QByteArray as its argument. |
426 | */ | 428 | */ |
427 | KMD5(const QByteArray& a ); | 429 | KMD5(const QByteArray& a ); |
428 | 430 | ||
429 | /** | 431 | /** |
430 | * @overload | 432 | * @overload |
431 | * | 433 | * |
432 | * Same as above except it accepts a QByteArray as its argument. | 434 | * Same as above except it accepts a QByteArray as its argument. |
433 | */ | 435 | */ |
434 | KMD5(const QCString& a ); | 436 | KMD5(const Q3CString& a ); |
435 | 437 | ||
436 | /** | 438 | /** |
437 | * Updates the message to be digested. Be sure to add all data | 439 | * Updates the message to be digested. Be sure to add all data |
438 | * before you read the digest. After reading the digest, you | 440 | * before you read the digest. After reading the digest, you |
439 | * can <b>not</b> add more data! | 441 | * can <b>not</b> add more data! |
440 | * | 442 | * |
441 | * @param in message to be added to digest | 443 | * @param in message to be added to digest |
442 | * @param len the length of the given message. | 444 | * @param len the length of the given message. |
443 | */ | 445 | */ |
444 | void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); } | 446 | void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); } |
445 | 447 | ||
446 | /** | 448 | /** |
447 | * @overload | 449 | * @overload |
448 | */ | 450 | */ |
449 | void update(const unsigned char* in, int len = -1); | 451 | void update(const unsigned char* in, int len = -1); |
450 | 452 | ||
451 | /** | 453 | /** |
452 | * @overload | 454 | * @overload |
453 | * | 455 | * |
454 | * @param in message to be added to the digest (QByteArray). | 456 | * @param in message to be added to the digest (QByteArray). |
455 | */ | 457 | */ |
456 | void update(const QByteArray& in ); | 458 | void update(const QByteArray& in ); |
457 | 459 | ||
458 | /** | 460 | /** |
459 | * @overload | 461 | * @overload |
460 | * | 462 | * |
461 | * @param in message to be added to the digest (QByteArray). | 463 | * @param in message to be added to the digest (QByteArray). |
462 | */ | 464 | */ |
463 | void update(const QCString& in ); | 465 | void update(const Q3CString& in ); |
464 | 466 | ||
465 | /** | 467 | /** |
466 | * @overload | 468 | * @overload |
467 | * | 469 | * |
468 | * reads the data from an I/O device, i.e. from a file (QFile). | 470 | * reads the data from an I/O device, i.e. from a file (QFile). |
469 | * | 471 | * |
470 | * NOTE that the file must be open for reading. | 472 | * NOTE that the file must be open for reading. |
471 | * | 473 | * |
472 | * @param file a pointer to FILE as returned by calls like f{d,re}open | 474 | * @param file a pointer to FILE as returned by calls like f{d,re}open |
473 | * | 475 | * |
474 | * @returns false if an error occured during reading. | 476 | * @returns false if an error occured during reading. |
475 | */ | 477 | */ |
476 | bool update(QIODevice& file); | 478 | bool update(QIODevice& file); |
477 | 479 | ||
478 | /** | 480 | /** |
479 | * Calling this function will reset the calculated message digest. | 481 | * Calling this function will reset the calculated message digest. |
@@ -489,55 +491,55 @@ public: | |||
489 | 491 | ||
490 | /** | 492 | /** |
491 | * Fills the given array with the binary representation of the | 493 | * Fills the given array with the binary representation of the |
492 | * message digest. | 494 | * message digest. |
493 | * | 495 | * |
494 | * Use this method if you do not want to worry about making | 496 | * Use this method if you do not want to worry about making |
495 | * copy of the digest once you obtain it. | 497 | * copy of the digest once you obtain it. |
496 | * | 498 | * |
497 | * @param bin an array of 16 characters ( char[16] ) | 499 | * @param bin an array of 16 characters ( char[16] ) |
498 | */ | 500 | */ |
499 | void rawDigest( KMD5::Digest& bin ); | 501 | void rawDigest( KMD5::Digest& bin ); |
500 | 502 | ||
501 | /** | 503 | /** |
502 | * Returns the value of the calculated message digest in | 504 | * Returns the value of the calculated message digest in |
503 | * a hexadecimal representation. | 505 | * a hexadecimal representation. |
504 | */ | 506 | */ |
505 | QCString hexDigest (); | 507 | Q3CString hexDigest (); |
506 | 508 | ||
507 | /** | 509 | /** |
508 | * @overload | 510 | * @overload |
509 | */ | 511 | */ |
510 | void hexDigest(QCString&); | 512 | void hexDigest(Q3CString&); |
511 | 513 | ||
512 | /** | 514 | /** |
513 | * Returns the value of the calculated message digest in | 515 | * Returns the value of the calculated message digest in |
514 | * a base64-encoded representation. | 516 | * a base64-encoded representation. |
515 | */ | 517 | */ |
516 | QCString base64Digest (); | 518 | Q3CString base64Digest (); |
517 | 519 | ||
518 | /** | 520 | /** |
519 | * returns true if the calculated digest for the given | 521 | * returns true if the calculated digest for the given |
520 | * message matches the given one. | 522 | * message matches the given one. |
521 | */ | 523 | */ |
522 | bool verify( const KMD5::Digest& digest); | 524 | bool verify( const KMD5::Digest& digest); |
523 | 525 | ||
524 | /** | 526 | /** |
525 | * @overload | 527 | * @overload |
526 | */ | 528 | */ |
527 | bool verify(const QCString&); | 529 | bool verify(const Q3CString&); |
528 | 530 | ||
529 | protected: | 531 | protected: |
530 | /** | 532 | /** |
531 | * Performs the real update work. Note | 533 | * Performs the real update work. Note |
532 | * that length is implied to be 64. | 534 | * that length is implied to be 64. |
533 | */ | 535 | */ |
534 | void transform( const unsigned char buffer[64] ); | 536 | void transform( const unsigned char buffer[64] ); |
535 | 537 | ||
536 | /** | 538 | /** |
537 | * finalizes the digest | 539 | * finalizes the digest |
538 | */ | 540 | */ |
539 | void finalize(); | 541 | void finalize(); |
540 | 542 | ||
541 | private: | 543 | private: |
542 | KMD5(const KMD5& u); | 544 | KMD5(const KMD5& u); |
543 | KMD5& operator=(const KMD5& md); | 545 | KMD5& operator=(const KMD5& md); |
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp index 0220a34..d4010fa 100644 --- a/microkde/kdecore/kprefs.cpp +++ b/microkde/kdecore/kprefs.cpp | |||
@@ -8,32 +8,34 @@ | |||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include <qcolor.h> | 23 | #include <qcolor.h> |
24 | //Added by qt3to4: | ||
25 | #include <Q3ValueList> | ||
24 | 26 | ||
25 | #include <kconfig.h> | 27 | #include <kconfig.h> |
26 | #include <kstandarddirs.h> | 28 | #include <kstandarddirs.h> |
27 | #include <kglobal.h> | 29 | #include <kglobal.h> |
28 | #include <kdebug.h> | 30 | #include <kdebug.h> |
29 | 31 | ||
30 | #include "kprefs.h" | 32 | #include "kprefs.h" |
31 | 33 | ||
32 | class KPrefsItemBool : public KPrefsItem { | 34 | class KPrefsItemBool : public KPrefsItem { |
33 | public: | 35 | public: |
34 | KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true); | 36 | KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true); |
35 | virtual ~KPrefsItemBool() {} | 37 | virtual ~KPrefsItemBool() {} |
36 | 38 | ||
37 | void setDefault(); | 39 | void setDefault(); |
38 | void readConfig(KConfig *); | 40 | void readConfig(KConfig *); |
39 | void writeConfig(KConfig *); | 41 | void writeConfig(KConfig *); |
@@ -127,43 +129,43 @@ class KPrefsItemStringList : public KPrefsItem { | |||
127 | KPrefsItemStringList(const QString &group,const QString &name,QStringList *, | 129 | KPrefsItemStringList(const QString &group,const QString &name,QStringList *, |
128 | const QStringList &defaultValue=QStringList()); | 130 | const QStringList &defaultValue=QStringList()); |
129 | virtual ~KPrefsItemStringList() {} | 131 | virtual ~KPrefsItemStringList() {} |
130 | 132 | ||
131 | void setDefault(); | 133 | void setDefault(); |
132 | void readConfig(KConfig *); | 134 | void readConfig(KConfig *); |
133 | void writeConfig(KConfig *); | 135 | void writeConfig(KConfig *); |
134 | 136 | ||
135 | private: | 137 | private: |
136 | QStringList *mReference; | 138 | QStringList *mReference; |
137 | QStringList mDefault; | 139 | QStringList mDefault; |
138 | }; | 140 | }; |
139 | 141 | ||
140 | 142 | ||
141 | class KPrefsItemIntList : public KPrefsItem { | 143 | class KPrefsItemIntList : public KPrefsItem { |
142 | public: | 144 | public: |
143 | KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *, | 145 | KPrefsItemIntList(const QString &group,const QString &name,Q3ValueList<int> *, |
144 | const QValueList<int> &defaultValue=QValueList<int>()); | 146 | const Q3ValueList<int> &defaultValue=Q3ValueList<int>()); |
145 | virtual ~KPrefsItemIntList() {} | 147 | virtual ~KPrefsItemIntList() {} |
146 | 148 | ||
147 | void setDefault(); | 149 | void setDefault(); |
148 | void readConfig(KConfig *); | 150 | void readConfig(KConfig *); |
149 | void writeConfig(KConfig *); | 151 | void writeConfig(KConfig *); |
150 | 152 | ||
151 | private: | 153 | private: |
152 | QValueList<int> *mReference; | 154 | Q3ValueList<int> *mReference; |
153 | QValueList<int> mDefault; | 155 | Q3ValueList<int> mDefault; |
154 | }; | 156 | }; |
155 | 157 | ||
156 | 158 | ||
157 | KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name, | 159 | KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name, |
158 | bool *reference,bool defaultValue) : | 160 | bool *reference,bool defaultValue) : |
159 | KPrefsItem(group,name) | 161 | KPrefsItem(group,name) |
160 | { | 162 | { |
161 | mReference = reference; | 163 | mReference = reference; |
162 | mDefault = defaultValue; | 164 | mDefault = defaultValue; |
163 | } | 165 | } |
164 | 166 | ||
165 | void KPrefsItemBool::setDefault() | 167 | void KPrefsItemBool::setDefault() |
166 | { | 168 | { |
167 | *mReference = mDefault; | 169 | *mReference = mDefault; |
168 | } | 170 | } |
169 | 171 | ||
@@ -351,33 +353,33 @@ void KPrefsItemStringList::setDefault() | |||
351 | } | 353 | } |
352 | 354 | ||
353 | void KPrefsItemStringList::writeConfig(KConfig *config) | 355 | void KPrefsItemStringList::writeConfig(KConfig *config) |
354 | { | 356 | { |
355 | config->setGroup(mGroup); | 357 | config->setGroup(mGroup); |
356 | config->writeEntry(mName,*mReference); | 358 | config->writeEntry(mName,*mReference); |
357 | } | 359 | } |
358 | 360 | ||
359 | void KPrefsItemStringList::readConfig(KConfig *config) | 361 | void KPrefsItemStringList::readConfig(KConfig *config) |
360 | { | 362 | { |
361 | config->setGroup(mGroup); | 363 | config->setGroup(mGroup); |
362 | *mReference = config->readListEntry(mName); | 364 | *mReference = config->readListEntry(mName); |
363 | } | 365 | } |
364 | 366 | ||
365 | 367 | ||
366 | KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, | 368 | KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, |
367 | QValueList<int> *reference,const QValueList<int> &defaultValue) : | 369 | Q3ValueList<int> *reference,const Q3ValueList<int> &defaultValue) : |
368 | KPrefsItem(group,name) | 370 | KPrefsItem(group,name) |
369 | { | 371 | { |
370 | mReference = reference; | 372 | mReference = reference; |
371 | mDefault = defaultValue; | 373 | mDefault = defaultValue; |
372 | } | 374 | } |
373 | 375 | ||
374 | void KPrefsItemIntList::setDefault() | 376 | void KPrefsItemIntList::setDefault() |
375 | { | 377 | { |
376 | *mReference = mDefault; | 378 | *mReference = mDefault; |
377 | } | 379 | } |
378 | 380 | ||
379 | void KPrefsItemIntList::writeConfig(KConfig *config) | 381 | void KPrefsItemIntList::writeConfig(KConfig *config) |
380 | { | 382 | { |
381 | config->setGroup(mGroup); | 383 | config->setGroup(mGroup); |
382 | config->writeEntry(mName,*mReference); | 384 | config->writeEntry(mName,*mReference); |
383 | } | 385 | } |
@@ -492,21 +494,21 @@ void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaul | |||
492 | void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue) | 494 | void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue) |
493 | { | 495 | { |
494 | addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false)); | 496 | addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false)); |
495 | } | 497 | } |
496 | 498 | ||
497 | void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) | 499 | void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) |
498 | { | 500 | { |
499 | addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true)); | 501 | addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true)); |
500 | } | 502 | } |
501 | 503 | ||
502 | void KPrefs::addItemStringList(const QString &key,QStringList *reference, | 504 | void KPrefs::addItemStringList(const QString &key,QStringList *reference, |
503 | const QStringList &defaultValue) | 505 | const QStringList &defaultValue) |
504 | { | 506 | { |
505 | addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue)); | 507 | addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue)); |
506 | } | 508 | } |
507 | 509 | ||
508 | void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference, | 510 | void KPrefs::addItemIntList(const QString &key,Q3ValueList<int> *reference, |
509 | const QValueList<int> &defaultValue) | 511 | const Q3ValueList<int> &defaultValue) |
510 | { | 512 | { |
511 | addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue)); | 513 | addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue)); |
512 | } | 514 | } |
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h index 95d2724..d9d1572 100644 --- a/microkde/kdecore/kprefs.h +++ b/microkde/kdecore/kprefs.h | |||
@@ -8,37 +8,39 @@ | |||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef _KPREFS_H | 20 | #ifndef _KPREFS_H |
21 | #define _KPREFS_H | 21 | #define _KPREFS_H |
22 | // $Id$ | 22 | // $Id$ |
23 | 23 | ||
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | #include <qcolor.h> | 25 | #include <qcolor.h> |
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qsize.h> | 27 | #include <qsize.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
29 | 31 | ||
30 | class KConfig; | 32 | class KConfig; |
31 | 33 | ||
32 | /** | 34 | /** |
33 | @short Class for storing a preferences setting | 35 | @short Class for storing a preferences setting |
34 | @author Cornelius Schumacher | 36 | @author Cornelius Schumacher |
35 | @see KPref | 37 | @see KPref |
36 | 38 | ||
37 | This class represents one preferences setting as used by @ref KPrefs. | 39 | This class represents one preferences setting as used by @ref KPrefs. |
38 | Subclasses of KPrefsItem implement storage functions for a certain type of | 40 | Subclasses of KPrefsItem implement storage functions for a certain type of |
39 | setting. Normally you don't have to use this class directly. Use the special | 41 | setting. Normally you don't have to use this class directly. Use the special |
40 | addItem() functions of KPrefs instead. If you subclass this class you will | 42 | addItem() functions of KPrefs instead. If you subclass this class you will |
41 | have to register instances with the function KPrefs::addItem(). | 43 | have to register instances with the function KPrefs::addItem(). |
42 | */ | 44 | */ |
43 | class KPrefsItem { | 45 | class KPrefsItem { |
44 | public: | 46 | public: |
@@ -270,47 +272,47 @@ class KPrefs { | |||
270 | when the config file does not yet contain the key of | 272 | when the config file does not yet contain the key of |
271 | this item. | 273 | this item. |
272 | */ | 274 | */ |
273 | void addItemStringList(const QString &key,QStringList *reference, | 275 | void addItemStringList(const QString &key,QStringList *reference, |
274 | const QStringList &defaultValue=QStringList()); | 276 | const QStringList &defaultValue=QStringList()); |
275 | 277 | ||
276 | /** | 278 | /** |
277 | Register an item of type QValueList<int>. | 279 | Register an item of type QValueList<int>. |
278 | 280 | ||
279 | @param key Key used in config file. | 281 | @param key Key used in config file. |
280 | @param reference Pointer to the variable, which is set by readConfig() | 282 | @param reference Pointer to the variable, which is set by readConfig() |
281 | and setDefaults() calls and read by writeConfig() calls. | 283 | and setDefaults() calls and read by writeConfig() calls. |
282 | @param defaultValue Default value, which is used by setDefaults() and | 284 | @param defaultValue Default value, which is used by setDefaults() and |
283 | when the config file does not yet contain the key of | 285 | when the config file does not yet contain the key of |
284 | this item. | 286 | this item. |
285 | */ | 287 | */ |
286 | void addItemIntList(const QString &key,QValueList<int> *reference, | 288 | void addItemIntList(const QString &key,Q3ValueList<int> *reference, |
287 | const QValueList<int> &defaultValue=QValueList<int>()); | 289 | const Q3ValueList<int> &defaultValue=Q3ValueList<int>()); |
288 | 290 | ||
289 | protected: | 291 | protected: |
290 | /** | 292 | /** |
291 | Implemented by subclasses that use special defaults. | 293 | Implemented by subclasses that use special defaults. |
292 | */ | 294 | */ |
293 | virtual void usrSetDefaults() {}; | 295 | virtual void usrSetDefaults() {}; |
294 | /** | 296 | /** |
295 | Implemented by subclasses that read special config values. | 297 | Implemented by subclasses that read special config values. |
296 | */ | 298 | */ |
297 | virtual void usrReadConfig() {}; | 299 | virtual void usrReadConfig() {}; |
298 | /** | 300 | /** |
299 | Implemented by subclasses that write special config values. | 301 | Implemented by subclasses that write special config values. |
300 | */ | 302 | */ |
301 | virtual void usrWriteConfig() {}; | 303 | virtual void usrWriteConfig() {}; |
302 | 304 | ||
303 | /** | 305 | /** |
304 | Return the @ref KConfig object used for reading and writing the settings. | 306 | Return the @ref KConfig object used for reading and writing the settings. |
305 | */ | 307 | */ |
306 | KConfig *config() const; | 308 | KConfig *config() const; |
307 | 309 | ||
308 | private: | 310 | private: |
309 | static QString *mCurrentGroup; | 311 | static QString *mCurrentGroup; |
310 | 312 | ||
311 | KConfig *mConfig; // pointer to KConfig object | 313 | KConfig *mConfig; // pointer to KConfig object |
312 | 314 | ||
313 | QPtrList<KPrefsItem> mItems; | 315 | Q3PtrList<KPrefsItem> mItems; |
314 | }; | 316 | }; |
315 | 317 | ||
316 | #endif | 318 | #endif |
diff --git a/microkde/kdecore/kshortcut.h b/microkde/kdecore/kshortcut.h index 4813734..244d590 100644 --- a/microkde/kdecore/kshortcut.h +++ b/microkde/kdecore/kshortcut.h | |||
@@ -550,33 +550,33 @@ class KShortcut | |||
550 | enum { MAX_SEQUENCES = 2 }; | 550 | enum { MAX_SEQUENCES = 2 }; |
551 | 551 | ||
552 | /** | 552 | /** |
553 | * Creates a new null shortcut. | 553 | * Creates a new null shortcut. |
554 | * @see null() | 554 | * @see null() |
555 | * @see isNull() | 555 | * @see isNull() |
556 | * @see clear() | 556 | * @see clear() |
557 | */ | 557 | */ |
558 | KShortcut() {} | 558 | KShortcut() {} |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * Creates a new shortcut with the given Qt key code | 561 | * Creates a new shortcut with the given Qt key code |
562 | * as the only key sequence. | 562 | * as the only key sequence. |
563 | * @param keyQt the qt keycode | 563 | * @param keyQt the qt keycode |
564 | * @see Qt::Key | 564 | * @see Qt::Key |
565 | */ | 565 | */ |
566 | KShortcut( int keyQt ) {} | 566 | KShortcut( int /*keyQt */) {} |
567 | 567 | ||
568 | /** | 568 | /** |
569 | * Creates a new shortcut that contains only the given qt key | 569 | * Creates a new shortcut that contains only the given qt key |
570 | * sequence. | 570 | * sequence. |
571 | * @param keySeq the qt key sequence to add | 571 | * @param keySeq the qt key sequence to add |
572 | */ | 572 | */ |
573 | //USKShortcut( const QKeySequence& keySeq ) {} | 573 | //USKShortcut( const QKeySequence& keySeq ) {} |
574 | 574 | ||
575 | /** | 575 | /** |
576 | * Creates a new shortcut that contains only the given key | 576 | * Creates a new shortcut that contains only the given key |
577 | * in its only sequence. | 577 | * in its only sequence. |
578 | * @param key the key to add | 578 | * @param key the key to add |
579 | */ | 579 | */ |
580 | //USKShortcut( const KKey& key ); | 580 | //USKShortcut( const KKey& key ); |
581 | 581 | ||
582 | /** | 582 | /** |
@@ -586,42 +586,42 @@ class KShortcut | |||
586 | */ | 586 | */ |
587 | //USKShortcut( const KKeySequence& keySeq ); | 587 | //USKShortcut( const KKeySequence& keySeq ); |
588 | 588 | ||
589 | /** | 589 | /** |
590 | * Copies the given shortcut. | 590 | * Copies the given shortcut. |
591 | * @param shortcut the shortcut to add | 591 | * @param shortcut the shortcut to add |
592 | */ | 592 | */ |
593 | //USKShortcut( const KShortcut& shortcut ); | 593 | //USKShortcut( const KShortcut& shortcut ); |
594 | 594 | ||
595 | /** | 595 | /** |
596 | * Creates a new key sequence that contains the given key sequence. | 596 | * Creates a new key sequence that contains the given key sequence. |
597 | * The description consists of semicolon-separated keys as | 597 | * The description consists of semicolon-separated keys as |
598 | * used in @ref KKeySequence::KKeySequence(const QString&). | 598 | * used in @ref KKeySequence::KKeySequence(const QString&). |
599 | * @param shortcut the description of the key | 599 | * @param shortcut the description of the key |
600 | * @see KKeySequence::KKeySequence(const QString&) | 600 | * @see KKeySequence::KKeySequence(const QString&) |
601 | */ | 601 | */ |
602 | KShortcut( const char* shortcut ) {} | 602 | KShortcut( const char* /*shortcut */) {} |
603 | 603 | ||
604 | /** | 604 | /** |
605 | * Creates a new key sequence that contains the given key sequence. | 605 | * Creates a new key sequence that contains the given key sequence. |
606 | * The description consists of semicolon-separated keys as | 606 | * The description consists of semicolon-separated keys as |
607 | * used in @ref KKeySequence::KKeySequence(const QString&). | 607 | * used in @ref KKeySequence::KKeySequence(const QString&). |
608 | * @param shortcut the description of the key | 608 | * @param shortcut the description of the key |
609 | * @see KKeySequence::KKeySequence(const QString&) | 609 | * @see KKeySequence::KKeySequence(const QString&) |
610 | */ | 610 | */ |
611 | KShortcut( const QString& shortcut ) {} | 611 | KShortcut( const QString& /*shortcut */) {} |
612 | ~KShortcut() {} | 612 | ~KShortcut() {} |
613 | 613 | ||
614 | /** | 614 | /** |
615 | * Clears the shortcut. The shortcut is null after calling this | 615 | * Clears the shortcut. The shortcut is null after calling this |
616 | * function. | 616 | * function. |
617 | * @see isNull() | 617 | * @see isNull() |
618 | */ | 618 | */ |
619 | //USvoid clear(); | 619 | //USvoid clear(); |
620 | 620 | ||
621 | /** | 621 | /** |
622 | * Initializes the shortcut with the given Qt key code | 622 | * Initializes the shortcut with the given Qt key code |
623 | * as the only key sequence. | 623 | * as the only key sequence. |
624 | * @param keyQt the qt keycode | 624 | * @param keyQt the qt keycode |
625 | * @see Qt::Key | 625 | * @see Qt::Key |
626 | */ | 626 | */ |
627 | //USbool init( int keyQt ); | 627 | //USbool init( int keyQt ); |
@@ -803,33 +803,33 @@ class KShortcut | |||
803 | * will be taken. | 803 | * will be taken. |
804 | */ | 804 | */ |
805 | //USoperator QKeySequence () const; | 805 | //USoperator QKeySequence () const; |
806 | 806 | ||
807 | /** | 807 | /** |
808 | * Returns a description of the shortcut as semicolon-separated | 808 | * Returns a description of the shortcut as semicolon-separated |
809 | * ket sequences, as returned by @ref KKeySequence::toString(). | 809 | * ket sequences, as returned by @ref KKeySequence::toString(). |
810 | * @return the string represenation of this shortcut | 810 | * @return the string represenation of this shortcut |
811 | * @see KKey::toString() | 811 | * @see KKey::toString() |
812 | * @see KKeySequence::toString() | 812 | * @see KKeySequence::toString() |
813 | */ | 813 | */ |
814 | //USQString toString() const; | 814 | //USQString toString() const; |
815 | 815 | ||
816 | /** | 816 | /** |
817 | * @internal | 817 | * @internal |
818 | */ | 818 | */ |
819 | QString toStringInternal( const KShortcut* pcutDefault = 0 ) const | 819 | QString toStringInternal( const KShortcut* /*pcutDefault*/ = 0 ) const |
820 | { | 820 | { |
821 | return "EMPTY IMPL."; | 821 | return "EMPTY IMPL."; |
822 | } | 822 | } |
823 | 823 | ||
824 | /** | 824 | /** |
825 | * Returns a null shortcut. | 825 | * Returns a null shortcut. |
826 | * @return the null shortcut | 826 | * @return the null shortcut |
827 | * @see isNull() | 827 | * @see isNull() |
828 | * @see clear() | 828 | * @see clear() |
829 | */ | 829 | */ |
830 | //USstatic KShortcut& null(); | 830 | //USstatic KShortcut& null(); |
831 | 831 | ||
832 | //US protected: | 832 | //US protected: |
833 | //USuint m_nSeqs; | 833 | //USuint m_nSeqs; |
834 | //USKKeySequence m_rgseq[MAX_SEQUENCES]; | 834 | //USKKeySequence m_rgseq[MAX_SEQUENCES]; |
835 | 835 | ||
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index d5bfefd..f10934b 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -24,81 +24,83 @@ | |||
24 | * Generated:Thu Mar 5 16:05:28 EST 1998 | 24 | * Generated:Thu Mar 5 16:05:28 EST 1998 |
25 | */ | 25 | */ |
26 | 26 | ||
27 | //US #include "config.h" | 27 | //US #include "config.h" |
28 | 28 | ||
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <assert.h> | 30 | #include <assert.h> |
31 | //US#include <errno.h> | 31 | //US#include <errno.h> |
32 | //US #ifdef HAVE_SYS_STAT_H | 32 | //US #ifdef HAVE_SYS_STAT_H |
33 | //US #include <sys/stat.h> | 33 | //US #include <sys/stat.h> |
34 | //US #endif | 34 | //US #endif |
35 | //US#include <sys/types.h> | 35 | //US#include <sys/types.h> |
36 | //US#include <dirent.h> | 36 | //US#include <dirent.h> |
37 | //US#include <pwd.h> | 37 | //US#include <pwd.h> |
38 | 38 | ||
39 | #include <qregexp.h> | 39 | #include <qregexp.h> |
40 | #include <qasciidict.h> | 40 | #include <q3asciidict.h> |
41 | #include <qdict.h> | 41 | #include <q3dict.h> |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qfileinfo.h> | 43 | #include <qfileinfo.h> |
44 | #include <qstring.h> | 44 | #include <qstring.h> |
45 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | 47 | ||
48 | #include <qstringlist.h> | 48 | #include <qstringlist.h> |
49 | //Added by qt3to4: | ||
50 | #include <Q3CString> | ||
49 | 51 | ||
50 | #include "kstandarddirs.h" | 52 | #include "kstandarddirs.h" |
51 | #include "kconfig.h" | 53 | #include "kconfig.h" |
52 | #include "kdebug.h" | 54 | #include "kdebug.h" |
53 | //US #include "kinstance.h" | 55 | //US #include "kinstance.h" |
54 | #include "kshell.h" | 56 | #include "kshell.h" |
55 | //US#include <sys/param.h> | 57 | //US#include <sys/param.h> |
56 | //US#include <unistd.h> | 58 | //US#include <unistd.h> |
57 | 59 | ||
58 | //US | 60 | //US |
59 | QString KStandardDirs::mAppDir = QString::null; | 61 | QString KStandardDirs::mAppDir = QString::null; |
60 | 62 | ||
61 | 63 | ||
62 | template class QDict<QStringList>; | 64 | template class Q3Dict<QStringList>; |
63 | 65 | ||
64 | #if 0 | 66 | #if 0 |
65 | #include <qtextedit.h> | 67 | #include <q3textedit.h> |
66 | void ddd( QString op ) | 68 | void ddd( QString op ) |
67 | { | 69 | { |
68 | static QTextEdit * dot = 0; | 70 | static Q3TextEdit * dot = 0; |
69 | if ( ! dot ) | 71 | if ( ! dot ) |
70 | dot = new QTextEdit(); | 72 | dot = new Q3TextEdit(); |
71 | 73 | ||
72 | dot->show(); | 74 | dot->show(); |
73 | 75 | ||
74 | dot->append( op ); | 76 | dot->append( op ); |
75 | 77 | ||
76 | } | 78 | } |
77 | #endif | 79 | #endif |
78 | class KStandardDirs::KStandardDirsPrivate | 80 | class KStandardDirs::KStandardDirsPrivate |
79 | { | 81 | { |
80 | public: | 82 | public: |
81 | KStandardDirsPrivate() | 83 | KStandardDirsPrivate() |
82 | : restrictionsActive(false), | 84 | : restrictionsActive(false), |
83 | dataRestrictionActive(false) | 85 | dataRestrictionActive(false) |
84 | { } | 86 | { } |
85 | 87 | ||
86 | bool restrictionsActive; | 88 | bool restrictionsActive; |
87 | bool dataRestrictionActive; | 89 | bool dataRestrictionActive; |
88 | QAsciiDict<bool> restrictions; | 90 | Q3AsciiDict<bool> restrictions; |
89 | QStringList xdgdata_prefixes; | 91 | QStringList xdgdata_prefixes; |
90 | QStringList xdgconf_prefixes; | 92 | QStringList xdgconf_prefixes; |
91 | }; | 93 | }; |
92 | 94 | ||
93 | static const char* const types[] = {"html", "icon", "apps", "sound", | 95 | static const char* const types[] = {"html", "icon", "apps", "sound", |
94 | "data", "locale", "services", "mime", | 96 | "data", "locale", "services", "mime", |
95 | "servicetypes", "config", "exe", "tmp", | 97 | "servicetypes", "config", "exe", "tmp", |
96 | "wallpaper", "lib", "pixmap", "templates", | 98 | "wallpaper", "lib", "pixmap", "templates", |
97 | "module", "qtplugins", | 99 | "module", "qtplugins", |
98 | "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; | 100 | "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; |
99 | 101 | ||
100 | static int tokenize( QStringList& token, const QString& str, | 102 | static int tokenize( QStringList& token, const QString& str, |
101 | const QString& delim ); | 103 | const QString& delim ); |
102 | 104 | ||
103 | KStandardDirs::KStandardDirs( ) : addedCustoms(false) | 105 | KStandardDirs::KStandardDirs( ) : addedCustoms(false) |
104 | { | 106 | { |
@@ -432,33 +434,33 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
432 | { | 434 | { |
433 | 435 | ||
434 | //US QString fn( QFile::decodeName(ep->d_name)); | 436 | //US QString fn( QFile::decodeName(ep->d_name)); |
435 | QString fn = (*it); // dp.entryList already decodes | 437 | QString fn = (*it); // dp.entryList already decodes |
436 | it++; | 438 | it++; |
437 | if ( fn.isNull() ) | 439 | if ( fn.isNull() ) |
438 | break; | 440 | break; |
439 | 441 | ||
440 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) | 442 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) |
441 | continue; | 443 | continue; |
442 | 444 | ||
443 | /*US | 445 | /*US |
444 | if (!recursive && !regexp.exactMatch(fn)) | 446 | if (!recursive && !regexp.exactMatch(fn)) |
445 | continue; // No match | 447 | continue; // No match |
446 | */ | 448 | */ |
447 | //US this should do the same: | 449 | //US this should do the same: |
448 | int pos = regexp.match(fn); | 450 | int pos = regexp.exactMatch(fn); |
449 | if (!recursive && !pos == 0) | 451 | if (!recursive && !pos == 0) |
450 | continue; // No match | 452 | continue; // No match |
451 | 453 | ||
452 | QString pathfn = path + fn; | 454 | QString pathfn = path + fn; |
453 | /*US | 455 | /*US |
454 | if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { | 456 | if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { |
455 | kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; | 457 | kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; |
456 | continue; // Couldn't stat (e.g. no read permissions) | 458 | continue; // Couldn't stat (e.g. no read permissions) |
457 | } | 459 | } |
458 | 460 | ||
459 | if ( recursive ) | 461 | if ( recursive ) |
460 | { | 462 | { |
461 | if ( S_ISDIR( buff.st_mode )) { | 463 | if ( S_ISDIR( buff.st_mode )) { |
462 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); | 464 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); |
463 | } | 465 | } |
464 | */ | 466 | */ |
@@ -469,33 +471,33 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
469 | //US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; | 471 | //US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; |
470 | continue; // Couldn't stat (e.g. no read permissions) | 472 | continue; // Couldn't stat (e.g. no read permissions) |
471 | } | 473 | } |
472 | 474 | ||
473 | if ( recursive ) | 475 | if ( recursive ) |
474 | { | 476 | { |
475 | if ( pathfnInfo.isDir()) { | 477 | if ( pathfnInfo.isDir()) { |
476 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); | 478 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); |
477 | } | 479 | } |
478 | 480 | ||
479 | 481 | ||
480 | /*US | 482 | /*US |
481 | if (!regexp.exactMatch(fn)) | 483 | if (!regexp.exactMatch(fn)) |
482 | continue; // No match | 484 | continue; // No match |
483 | */ | 485 | */ |
484 | //US this should do the same: | 486 | //US this should do the same: |
485 | pos = regexp.match(fn); | 487 | pos = regexp.exactMatch(fn); |
486 | if (!pos == 0) | 488 | if (!pos == 0) |
487 | continue; // No match | 489 | continue; // No match |
488 | } | 490 | } |
489 | 491 | ||
490 | //US if ( S_ISREG( buff.st_mode)) | 492 | //US if ( S_ISREG( buff.st_mode)) |
491 | if ( pathfnInfo.isFile()) | 493 | if ( pathfnInfo.isFile()) |
492 | { | 494 | { |
493 | if (!uniq || !relList.contains(relPart + fn)) | 495 | if (!uniq || !relList.contains(relPart + fn)) |
494 | { | 496 | { |
495 | list.append( pathfn ); | 497 | list.append( pathfn ); |
496 | relList.append( relPart + fn ); | 498 | relList.append( relPart + fn ); |
497 | } | 499 | } |
498 | } | 500 | } |
499 | } | 501 | } |
500 | //US closedir( dp ); | 502 | //US closedir( dp ); |
501 | } | 503 | } |
@@ -1095,33 +1097,33 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1095 | 1097 | ||
1096 | QString target = dir; | 1098 | QString target = dir; |
1097 | uint len = target.length(); | 1099 | uint len = target.length(); |
1098 | 1100 | ||
1099 | // append trailing slash if missing | 1101 | // append trailing slash if missing |
1100 | if (dir.at(len - 1) != '/') | 1102 | if (dir.at(len - 1) != '/') |
1101 | target += '/'; | 1103 | target += '/'; |
1102 | 1104 | ||
1103 | QString base(""); | 1105 | QString base(""); |
1104 | uint i = 1; | 1106 | uint i = 1; |
1105 | 1107 | ||
1106 | while( i < len ) | 1108 | while( i < len ) |
1107 | { | 1109 | { |
1108 | //US struct stat st; | 1110 | //US struct stat st; |
1109 | int pos = target.find('/', i); | 1111 | int pos = target.find('/', i); |
1110 | base += target.mid(i - 1, pos - i + 1); | 1112 | base += target.mid(i - 1, pos - i + 1); |
1111 | QCString baseEncoded = QFile::encodeName(base); | 1113 | Q3CString baseEncoded = QFile::encodeName(base); |
1112 | // bail out if we encountered a problem | 1114 | // bail out if we encountered a problem |
1113 | //US if (stat(baseEncoded, &st) != 0) | 1115 | //US if (stat(baseEncoded, &st) != 0) |
1114 | QFileInfo baseEncodedInfo(baseEncoded); | 1116 | QFileInfo baseEncodedInfo(baseEncoded); |
1115 | if (!baseEncodedInfo.exists()) | 1117 | if (!baseEncodedInfo.exists()) |
1116 | { | 1118 | { |
1117 | // Directory does not exist.... | 1119 | // Directory does not exist.... |
1118 | // Or maybe a dangling symlink ? | 1120 | // Or maybe a dangling symlink ? |
1119 | //US if (lstat(baseEncoded, &st) == 0) | 1121 | //US if (lstat(baseEncoded, &st) == 0) |
1120 | if (baseEncodedInfo.isSymLink()) { | 1122 | if (baseEncodedInfo.isSymLink()) { |
1121 | //US (void)unlink(baseEncoded); // try removing | 1123 | //US (void)unlink(baseEncoded); // try removing |
1122 | QFile(baseEncoded).remove(); | 1124 | QFile(baseEncoded).remove(); |
1123 | } | 1125 | } |
1124 | 1126 | ||
1125 | //US if ( mkdir(baseEncoded, (mode_t) mode) != 0) | 1127 | //US if ( mkdir(baseEncoded, (mode_t) mode) != 0) |
1126 | QDir dirObj; | 1128 | QDir dirObj; |
1127 | if ( dirObj.mkdir(baseEncoded) != true ) | 1129 | if ( dirObj.mkdir(baseEncoded) != true ) |
@@ -1195,33 +1197,33 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1195 | qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); | 1197 | qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); |
1196 | return false; | 1198 | return false; |
1197 | } | 1199 | } |
1198 | } | 1200 | } |
1199 | 1201 | ||
1200 | i = pos + 1; | 1202 | i = pos + 1; |
1201 | } | 1203 | } |
1202 | return true; | 1204 | return true; |
1203 | 1205 | ||
1204 | } | 1206 | } |
1205 | 1207 | ||
1206 | QString readEnvPath(const char *env) | 1208 | QString readEnvPath(const char *env) |
1207 | { | 1209 | { |
1208 | //#ifdef _WIN32_ | 1210 | //#ifdef _WIN32_ |
1209 | // return ""; | 1211 | // return ""; |
1210 | //#else | 1212 | //#else |
1211 | QCString c_path; | 1213 | Q3CString c_path; |
1212 | if ( getenv(env) != NULL ) | 1214 | if ( getenv(env) != NULL ) |
1213 | c_path = QString ( getenv(env) ); | 1215 | c_path = QString ( getenv(env) ); |
1214 | if (c_path.isEmpty()) | 1216 | if (c_path.isEmpty()) |
1215 | return QString::null; | 1217 | return QString::null; |
1216 | return QFile::decodeName(c_path); | 1218 | return QFile::decodeName(c_path); |
1217 | //#endif | 1219 | //#endif |
1218 | 1220 | ||
1219 | } | 1221 | } |
1220 | 1222 | ||
1221 | void KStandardDirs::addKDEDefaults() | 1223 | void KStandardDirs::addKDEDefaults() |
1222 | { | 1224 | { |
1223 | 1225 | ||
1224 | //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); | 1226 | //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); |
1225 | //return; | 1227 | //return; |
1226 | QStringList kdedirList; | 1228 | QStringList kdedirList; |
1227 | 1229 | ||
diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h index 901384e..f0e28fc 100644 --- a/microkde/kdecore/kstandarddirs.h +++ b/microkde/kdecore/kstandarddirs.h | |||
@@ -11,33 +11,33 @@ | |||
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef SSK_KSTDDIRS_H | 23 | #ifndef SSK_KSTDDIRS_H |
24 | #define SSK_KSTDDIRS_H | 24 | #define SSK_KSTDDIRS_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qdict.h> | 27 | #include <q3dict.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | 30 | ||
31 | class KConfig; | 31 | class KConfig; |
32 | class KStandardDirsPrivate; | 32 | class KStandardDirsPrivate; |
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @short Site-independent access to standard KDE directories. | 36 | * @short Site-independent access to standard KDE directories. |
37 | * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org> | 37 | * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org> |
38 | * @version $Id$ | 38 | * @version $Id$ |
39 | * | 39 | * |
40 | * This is one of the most central classes in kdelibs as | 40 | * This is one of the most central classes in kdelibs as |
41 | * it provides a basic service: It knows where the files | 41 | * it provides a basic service: It knows where the files |
42 | * reside on the user's hard disk. And it's meant to be the | 42 | * reside on the user's hard disk. And it's meant to be the |
43 | * only one that knows -- to make the real location as | 43 | * only one that knows -- to make the real location as |
@@ -561,37 +561,37 @@ public: | |||
561 | * '/./', '/../' and extra '/' characters in @p dirname | 561 | * '/./', '/../' and extra '/' characters in @p dirname |
562 | * and returns the canonicalized absolute pathname. | 562 | * and returns the canonicalized absolute pathname. |
563 | * The resulting path will have no symbolic link, '/./' | 563 | * The resulting path will have no symbolic link, '/./' |
564 | * or '/../' components. | 564 | * or '/../' components. |
565 | * @since 3.1 | 565 | * @since 3.1 |
566 | */ | 566 | */ |
567 | static QString realPath(const QString &dirname); | 567 | static QString realPath(const QString &dirname); |
568 | 568 | ||
569 | static void setAppDir( const QString & ); | 569 | static void setAppDir( const QString & ); |
570 | static QString appDir(); | 570 | static QString appDir(); |
571 | 571 | ||
572 | private: | 572 | private: |
573 | 573 | ||
574 | QStringList prefixes; | 574 | QStringList prefixes; |
575 | 575 | ||
576 | // Directory dictionaries | 576 | // Directory dictionaries |
577 | QDict<QStringList> absolutes; | 577 | Q3Dict<QStringList> absolutes; |
578 | QDict<QStringList> relatives; | 578 | Q3Dict<QStringList> relatives; |
579 | 579 | ||
580 | mutable QDict<QStringList> dircache; | 580 | mutable Q3Dict<QStringList> dircache; |
581 | mutable QDict<QString> savelocations; | 581 | mutable Q3Dict<QString> savelocations; |
582 | 582 | ||
583 | // Disallow assignment and copy-construction | 583 | // Disallow assignment and copy-construction |
584 | KStandardDirs( const KStandardDirs& ); | 584 | KStandardDirs( const KStandardDirs& ); |
585 | KStandardDirs& operator= ( const KStandardDirs& ); | 585 | KStandardDirs& operator= ( const KStandardDirs& ); |
586 | 586 | ||
587 | bool addedCustoms; | 587 | bool addedCustoms; |
588 | 588 | ||
589 | class KStandardDirsPrivate; | 589 | class KStandardDirsPrivate; |
590 | KStandardDirsPrivate *d; | 590 | KStandardDirsPrivate *d; |
591 | //US | 591 | //US |
592 | static QString mAppDir; | 592 | static QString mAppDir; |
593 | 593 | ||
594 | void checkConfig() const; | 594 | void checkConfig() const; |
595 | void applyDataRestrictions(const QString &) const; | 595 | void applyDataRestrictions(const QString &) const; |
596 | //US void createSpecialResource(const char*); | 596 | //US void createSpecialResource(const char*); |
597 | }; | 597 | }; |
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp index d38a6d5..c2df381 100644 --- a/microkde/kdeui/kaction.cpp +++ b/microkde/kdeui/kaction.cpp | |||
@@ -15,49 +15,52 @@ | |||
15 | This library is distributed in the hope that it will be useful, | 15 | This library is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | Library General Public License for more details. | 18 | Library General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU Library General Public License | 20 | You should have received a copy of the GNU Library General Public License |
21 | along with this library; see the file COPYING.LIB. If not, write to | 21 | along with this library; see the file COPYING.LIB. If not, write to |
22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. | 23 | Boston, MA 02111-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "kaction.h" | 26 | #include "kaction.h" |
27 | 27 | ||
28 | #include <assert.h> | 28 | #include <assert.h> |
29 | 29 | ||
30 | #include <qtooltip.h> | 30 | #include <qtooltip.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3CString> | ||
33 | #include <Q3ValueList> | ||
31 | //US#include <qwhatsthis.h> | 34 | //US#include <qwhatsthis.h> |
32 | //US#include <kaccel.h> | 35 | //US#include <kaccel.h> |
33 | //US#include <kaccelbase.h> | 36 | //US#include <kaccelbase.h> |
34 | #include <kapplication.h> | 37 | #include <kapplication.h> |
35 | #include <kdebug.h> | 38 | #include <kdebug.h> |
36 | #include <kguiitem.h> | 39 | #include <kguiitem.h> |
37 | //US#include <kmainwindow.h> | 40 | //US#include <kmainwindow.h> |
38 | //US#include <kmenubar.h> | 41 | //US#include <kmenubar.h> |
39 | //US#include <kpopupmenu.h> | 42 | //US#include <kpopupmenu.h> |
40 | #include <ktoolbar.h> | 43 | #include <ktoolbar.h> |
41 | #include <ktoolbarbutton.h> | 44 | #include <ktoolbarbutton.h> |
42 | 45 | ||
43 | //US added this includefiles | 46 | //US added this includefiles |
44 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
45 | #include <qtoolbar.h> | 48 | #include <q3toolbar.h> |
46 | #include <qpopupmenu.h> | 49 | #include <q3popupmenu.h> |
47 | #include <qiconset.h> | 50 | #include <qicon.h> |
48 | 51 | ||
49 | /** | 52 | /** |
50 | * How it works. | 53 | * How it works. |
51 | * KActionCollection is an organizing container for KActions. | 54 | * KActionCollection is an organizing container for KActions. |
52 | * KActionCollection keeps track of the information necessary to handle | 55 | * KActionCollection keeps track of the information necessary to handle |
53 | * configuration and shortcuts. | 56 | * configuration and shortcuts. |
54 | * | 57 | * |
55 | * Focus Widget pointer: | 58 | * Focus Widget pointer: |
56 | * This is the widget which is the focus for action shortcuts. | 59 | * This is the widget which is the focus for action shortcuts. |
57 | * It is set either by passing a QWidget* to the KActionCollection constructor | 60 | * It is set either by passing a QWidget* to the KActionCollection constructor |
58 | * or by calling setWidget() if the widget wasn't known when the object was | 61 | * or by calling setWidget() if the widget wasn't known when the object was |
59 | * initially constructed (as in KXMLGUIClient and KParts::PartBase) | 62 | * initially constructed (as in KXMLGUIClient and KParts::PartBase) |
60 | * | 63 | * |
61 | * Shortcuts: | 64 | * Shortcuts: |
62 | * An action's shortcut will not not be connected unless a focus widget has | 65 | * An action's shortcut will not not be connected unless a focus widget has |
63 | * been specified in KActionCollection. | 66 | * been specified in KActionCollection. |
@@ -74,76 +77,76 @@ int KAction::getToolButtonID() | |||
74 | } | 77 | } |
75 | 78 | ||
76 | //--------------------------------------------------------------------- | 79 | //--------------------------------------------------------------------- |
77 | // KAction::KActionPrivate | 80 | // KAction::KActionPrivate |
78 | //--------------------------------------------------------------------- | 81 | //--------------------------------------------------------------------- |
79 | 82 | ||
80 | class KAction::KActionPrivate : public KGuiItem | 83 | class KAction::KActionPrivate : public KGuiItem |
81 | { | 84 | { |
82 | public: | 85 | public: |
83 | KActionPrivate() : KGuiItem() | 86 | KActionPrivate() : KGuiItem() |
84 | { | 87 | { |
85 | m_kaccel = 0; | 88 | m_kaccel = 0; |
86 | m_configurable = true; | 89 | m_configurable = true; |
87 | } | 90 | } |
88 | 91 | ||
89 | KAccel *m_kaccel; | 92 | KAccel *m_kaccel; |
90 | QValueList<KAccel*> m_kaccelList; | 93 | Q3ValueList<KAccel*> m_kaccelList; |
91 | 94 | ||
92 | QString m_groupText; | 95 | QString m_groupText; |
93 | QString m_group; | 96 | QString m_group; |
94 | 97 | ||
95 | KShortcut m_cut; | 98 | KShortcut m_cut; |
96 | KShortcut m_cutDefault; | 99 | KShortcut m_cutDefault; |
97 | 100 | ||
98 | bool m_configurable; | 101 | bool m_configurable; |
99 | 102 | ||
100 | struct Container | 103 | struct Container |
101 | { | 104 | { |
102 | Container() { m_container = 0; m_representative = 0; m_id = 0; } | 105 | Container() { m_container = 0; m_representative = 0; m_id = 0; } |
103 | Container( const Container& s ) { m_container = s.m_container; | 106 | Container( const Container& s ) { m_container = s.m_container; |
104 | m_id = s.m_id; m_representative = s.m_representative; } | 107 | m_id = s.m_id; m_representative = s.m_representative; } |
105 | QWidget* m_container; | 108 | QWidget* m_container; |
106 | int m_id; | 109 | int m_id; |
107 | QWidget* m_representative; | 110 | QWidget* m_representative; |
108 | }; | 111 | }; |
109 | 112 | ||
110 | QValueList<Container> m_containers; | 113 | Q3ValueList<Container> m_containers; |
111 | }; | 114 | }; |
112 | 115 | ||
113 | //--------------------------------------------------------------------- | 116 | //--------------------------------------------------------------------- |
114 | // KAction | 117 | // KAction |
115 | //--------------------------------------------------------------------- | 118 | //--------------------------------------------------------------------- |
116 | KAction::KAction( const QString& text, const KShortcut& cut, | 119 | KAction::KAction( const QString& text, const KShortcut& cut, |
117 | const QObject* receiver, const char* slot, | 120 | const QObject* receiver, const char* slot, |
118 | KActionCollection* parent, const char* name ) | 121 | KActionCollection* parent, const char* name ) |
119 | : QObject( parent, name ) | 122 | : QObject( parent, name ) |
120 | { | 123 | { |
121 | initPrivate( text, cut, receiver, slot ); | 124 | initPrivate( text, cut, receiver, slot ); |
122 | } | 125 | } |
123 | 126 | ||
124 | KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut, | 127 | KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut, |
125 | const QObject* receiver, const char* slot, | 128 | const QObject* receiver, const char* slot, |
126 | KActionCollection* parent, const char* name ) | 129 | KActionCollection* parent, const char* name ) |
127 | : QObject( parent, name ) | 130 | : QObject( parent, name ) |
128 | { | 131 | { |
129 | initPrivate( text, cut, receiver, slot ); | 132 | initPrivate( text, cut, receiver, slot ); |
130 | d->setIconName( sIconName ); | 133 | d->setIconName( sIconName ); |
131 | } | 134 | } |
132 | 135 | ||
133 | KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 136 | KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
134 | const QObject* receiver, const char* slot, | 137 | const QObject* receiver, const char* slot, |
135 | KActionCollection* parent, const char* name ) | 138 | KActionCollection* parent, const char* name ) |
136 | : QObject( parent, name ) | 139 | : QObject( parent, name ) |
137 | { | 140 | { |
138 | initPrivate( text, cut, receiver, slot ); | 141 | initPrivate( text, cut, receiver, slot ); |
139 | d->setIconSet( pix ); | 142 | d->setIconSet( pix ); |
140 | } | 143 | } |
141 | KAction::KAction( const KGuiItem& item, const KShortcut& cut, | 144 | KAction::KAction( const KGuiItem& item, const KShortcut& cut, |
142 | const QObject* receiver, const char* slot, | 145 | const QObject* receiver, const char* slot, |
143 | KActionCollection* parent, const char* name ) | 146 | KActionCollection* parent, const char* name ) |
144 | : QObject( parent, name ) | 147 | : QObject( parent, name ) |
145 | { | 148 | { |
146 | initPrivate( item.text(), cut, receiver, slot ); | 149 | initPrivate( item.text(), cut, receiver, slot ); |
147 | if( item.hasIconSet() ) | 150 | if( item.hasIconSet() ) |
148 | setIcon( item.iconName() ); | 151 | setIcon( item.iconName() ); |
149 | setToolTip( item.toolTip() ); | 152 | setToolTip( item.toolTip() ); |
@@ -151,51 +154,51 @@ KAction::KAction( const KGuiItem& item, const KShortcut& cut, | |||
151 | } | 154 | } |
152 | 155 | ||
153 | // KDE 4: remove | 156 | // KDE 4: remove |
154 | KAction::KAction( const QString& text, const KShortcut& cut, | 157 | KAction::KAction( const QString& text, const KShortcut& cut, |
155 | QObject* parent, const char* name ) | 158 | QObject* parent, const char* name ) |
156 | : QObject( parent, name ) | 159 | : QObject( parent, name ) |
157 | { | 160 | { |
158 | initPrivate( text, cut, 0, 0 ); | 161 | initPrivate( text, cut, 0, 0 ); |
159 | } | 162 | } |
160 | KAction::KAction( const QString& text, const KShortcut& cut, | 163 | KAction::KAction( const QString& text, const KShortcut& cut, |
161 | const QObject* receiver, | 164 | const QObject* receiver, |
162 | const char* slot, QObject* parent, const char* name ) | 165 | const char* slot, QObject* parent, const char* name ) |
163 | : QObject( parent, name ) | 166 | : QObject( parent, name ) |
164 | { | 167 | { |
165 | initPrivate( text, cut, receiver, slot ); | 168 | initPrivate( text, cut, receiver, slot ); |
166 | } | 169 | } |
167 | KAction::KAction( const QString& text, const QIconSet& pix, | 170 | KAction::KAction( const QString& text, const QIcon& pix, |
168 | const KShortcut& cut, | 171 | const KShortcut& cut, |
169 | QObject* parent, const char* name ) | 172 | QObject* parent, const char* name ) |
170 | : QObject( parent, name ) | 173 | : QObject( parent, name ) |
171 | { | 174 | { |
172 | initPrivate( text, cut, 0, 0 ); | 175 | initPrivate( text, cut, 0, 0 ); |
173 | setIconSet( pix ); | 176 | setIconSet( pix ); |
174 | } | 177 | } |
175 | 178 | ||
176 | KAction::KAction( const QString& text, const QString& pix, | 179 | KAction::KAction( const QString& text, const QString& pix, |
177 | const KShortcut& cut, | 180 | const KShortcut& cut, |
178 | QObject* parent, const char* name ) | 181 | QObject* parent, const char* name ) |
179 | : QObject( parent, name ) | 182 | : QObject( parent, name ) |
180 | { | 183 | { |
181 | initPrivate( text, cut, 0, 0 ); | 184 | initPrivate( text, cut, 0, 0 ); |
182 | d->setIconName( pix ); | 185 | d->setIconName( pix ); |
183 | } | 186 | } |
184 | 187 | ||
185 | KAction::KAction( const QString& text, const QIconSet& pix, | 188 | KAction::KAction( const QString& text, const QIcon& pix, |
186 | const KShortcut& cut, | 189 | const KShortcut& cut, |
187 | const QObject* receiver, const char* slot, QObject* parent, | 190 | const QObject* receiver, const char* slot, QObject* parent, |
188 | const char* name ) | 191 | const char* name ) |
189 | : QObject( parent, name ) | 192 | : QObject( parent, name ) |
190 | { | 193 | { |
191 | initPrivate( text, cut, receiver, slot ); | 194 | initPrivate( text, cut, receiver, slot ); |
192 | setIconSet( pix ); | 195 | setIconSet( pix ); |
193 | } | 196 | } |
194 | 197 | ||
195 | KAction::KAction( const QString& text, const QString& pix, | 198 | KAction::KAction( const QString& text, const QString& pix, |
196 | const KShortcut& cut, | 199 | const KShortcut& cut, |
197 | const QObject* receiver, const char* slot, QObject* parent, | 200 | const QObject* receiver, const char* slot, QObject* parent, |
198 | const char* name ) | 201 | const char* name ) |
199 | : QObject( parent, name ) | 202 | : QObject( parent, name ) |
200 | { | 203 | { |
201 | initPrivate( text, cut, receiver, slot ); | 204 | initPrivate( text, cut, receiver, slot ); |
@@ -493,45 +496,45 @@ void KAction::removeKAccel( KAccel* kaccel ) | |||
493 | } | 496 | } |
494 | */ | 497 | */ |
495 | } | 498 | } |
496 | 499 | ||
497 | // KDE 4: remove | 500 | // KDE 4: remove |
498 | void KAction::setAccel( int keyQt ) | 501 | void KAction::setAccel( int keyQt ) |
499 | { | 502 | { |
500 | setShortcut( KShortcut(keyQt) ); | 503 | setShortcut( KShortcut(keyQt) ); |
501 | } | 504 | } |
502 | // KDE 4: remove end | 505 | // KDE 4: remove end |
503 | 506 | ||
504 | void KAction::updateShortcut( int i ) | 507 | void KAction::updateShortcut( int i ) |
505 | { | 508 | { |
506 | int id = itemId( i ); | 509 | int id = itemId( i ); |
507 | 510 | ||
508 | QWidget* w = container( i ); | 511 | QWidget* w = container( i ); |
509 | if ( w->inherits( "QPopupMenu" ) ) { | 512 | if ( w->inherits( "Q3PopupMenu" ) ) { |
510 | QPopupMenu* menu = static_cast<QPopupMenu*>(w); | 513 | Q3PopupMenu* menu = static_cast<Q3PopupMenu*>(w); |
511 | updateShortcut( menu, id ); | 514 | updateShortcut( menu, id ); |
512 | } | 515 | } |
513 | else if ( w->inherits( "QMenuBar" ) ) | 516 | else if ( w->inherits( "QMenuBar" ) ) |
514 | //US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); | 517 | //US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); |
515 | //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); | 518 | //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); |
516 | 519 | ||
517 | ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); | 520 | ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); |
518 | 521 | ||
519 | } | 522 | } |
520 | 523 | ||
521 | void KAction::updateShortcut( QPopupMenu* menu, int id ) | 524 | void KAction::updateShortcut( Q3PopupMenu* menu, int id ) |
522 | { | 525 | { |
523 | /*US | 526 | /*US |
524 | //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; | 527 | //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; |
525 | // If the action has a KAccel object, | 528 | // If the action has a KAccel object, |
526 | // show the string representation of its shortcut. | 529 | // show the string representation of its shortcut. |
527 | if ( d->m_kaccel || d->m_kaccelList.count() ) { | 530 | if ( d->m_kaccel || d->m_kaccelList.count() ) { |
528 | QString s = menu->text( id ); | 531 | QString s = menu->text( id ); |
529 | int i = s.find( '\t' ); | 532 | int i = s.find( '\t' ); |
530 | if ( i >= 0 ) | 533 | if ( i >= 0 ) |
531 | s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() ); | 534 | s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() ); |
532 | else | 535 | else |
533 | s += "\t" + d->m_cut.seq(0).toString(); | 536 | s += "\t" + d->m_cut.seq(0).toString(); |
534 | 537 | ||
535 | menu->changeItem( id, s ); | 538 | menu->changeItem( id, s ); |
536 | } | 539 | } |
537 | // Otherwise insert the shortcut itself into the popup menu. | 540 | // Otherwise insert the shortcut itself into the popup menu. |
@@ -608,60 +611,60 @@ void KAction::setToolTip( const QString& tt ) | |||
608 | { | 611 | { |
609 | //qDebug("KAction::setToolTip ...1 has top be fixed"); | 612 | //qDebug("KAction::setToolTip ...1 has top be fixed"); |
610 | d->setToolTip( tt ); | 613 | d->setToolTip( tt ); |
611 | 614 | ||
612 | int len = containerCount(); | 615 | int len = containerCount(); |
613 | for( int i = 0; i < len; ++i ) | 616 | for( int i = 0; i < len; ++i ) |
614 | updateToolTip( i ); | 617 | updateToolTip( i ); |
615 | } | 618 | } |
616 | 619 | ||
617 | void KAction::updateToolTip( int i ) | 620 | void KAction::updateToolTip( int i ) |
618 | { | 621 | { |
619 | //qDebug("KAction::updateToolTip ...1 has top be fixed"); | 622 | //qDebug("KAction::updateToolTip ...1 has top be fixed"); |
620 | QWidget *w = container( i ); | 623 | QWidget *w = container( i ); |
621 | 624 | ||
622 | if ( w->inherits( "KToolBar" ) ) | 625 | if ( w->inherits( "KToolBar" ) ) |
623 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); | 626 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); |
624 | else if ( w->inherits( "QToolBar" ) ) | 627 | else if ( w->inherits( "Q3ToolBar" ) ) |
625 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); | 628 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); |
626 | } | 629 | } |
627 | 630 | ||
628 | QString KAction::toolTip() const | 631 | QString KAction::toolTip() const |
629 | { | 632 | { |
630 | return d->toolTip(); | 633 | return d->toolTip(); |
631 | } | 634 | } |
632 | 635 | ||
633 | int KAction::plug( QWidget *w, int index ) | 636 | int KAction::plug( QWidget *w, int index ) |
634 | { | 637 | { |
635 | //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; | 638 | //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; |
636 | if (w == 0) { | 639 | if (w == 0) { |
637 | kdWarning(129) << "KAction::plug called with 0 argument\n"; | 640 | kdWarning(129) << "KAction::plug called with 0 argument\n"; |
638 | return -1; | 641 | return -1; |
639 | } | 642 | } |
640 | 643 | ||
641 | 644 | ||
642 | 645 | ||
643 | // Check if action is permitted | 646 | // Check if action is permitted |
644 | //US if (kapp && !kapp->authorizeKAction(name())) | 647 | //US if (kapp && !kapp->authorizeKAction(name())) |
645 | //US return -1; | 648 | //US return -1; |
646 | 649 | ||
647 | plugShortcut(); | 650 | plugShortcut(); |
648 | 651 | ||
649 | if ( w->inherits("QPopupMenu") ) | 652 | if ( w->inherits("Q3PopupMenu") ) |
650 | { | 653 | { |
651 | QPopupMenu* menu = static_cast<QPopupMenu*>( w ); | 654 | Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( w ); |
652 | int id; | 655 | int id; |
653 | // Don't insert shortcut into menu if it's already in a KAccel object. | 656 | // Don't insert shortcut into menu if it's already in a KAccel object. |
654 | //qDebug("KAction::plug warning: real shortcuts not available yet. "); | 657 | //qDebug("KAction::plug warning: real shortcuts not available yet. "); |
655 | //US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); | 658 | //US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); |
656 | int keyQt = 0; | 659 | int keyQt = 0; |
657 | 660 | ||
658 | if ( d->hasIcon() ) | 661 | if ( d->hasIcon() ) |
659 | { | 662 | { |
660 | /*US | 663 | /*US |
661 | KInstance *instance; | 664 | KInstance *instance; |
662 | if ( m_parentCollection ) | 665 | if ( m_parentCollection ) |
663 | instance = m_parentCollection->instance(); | 666 | instance = m_parentCollection->instance(); |
664 | else | 667 | else |
665 | instance = KGlobal::instance(); | 668 | instance = KGlobal::instance(); |
666 | */ | 669 | */ |
667 | id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet | 670 | id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet |
@@ -708,63 +711,63 @@ int KAction::plug( QWidget *w, int index ) | |||
708 | */ | 711 | */ |
709 | if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly | 712 | if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly |
710 | { | 713 | { |
711 | bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this, | 714 | bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this, |
712 | SLOT( slotActivated() ), | 715 | SLOT( slotActivated() ), |
713 | d->isEnabled(), d->plainText(), index ); | 716 | d->isEnabled(), d->plainText(), index ); |
714 | } | 717 | } |
715 | else | 718 | else |
716 | { | 719 | { |
717 | QString icon = d->iconName(); | 720 | QString icon = d->iconName(); |
718 | if ( icon.isEmpty() ) | 721 | if ( icon.isEmpty() ) |
719 | icon = "unknown"; | 722 | icon = "unknown"; |
720 | bar->insertButton( icon, id_, SIGNAL( clicked() ), this, | 723 | bar->insertButton( icon, id_, SIGNAL( clicked() ), this, |
721 | SLOT( slotActivated() ), | 724 | SLOT( slotActivated() ), |
722 | d->isEnabled(), d->plainText(), index/*US, instance*/ ); | 725 | d->isEnabled(), d->plainText(), index/*US, instance*/ ); |
723 | } | 726 | } |
724 | bar->getButton( id_ )->setName( QCString("toolbutton_")+name() ); | 727 | bar->getButton( id_ )->setName( Q3CString("toolbutton_")+name() ); |
725 | 728 | ||
726 | //US if ( !d->whatsThis().isEmpty() ) | 729 | //US if ( !d->whatsThis().isEmpty() ) |
727 | //US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() ); | 730 | //US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() ); |
728 | if ( !d->toolTip().isEmpty() ) | 731 | if ( !d->toolTip().isEmpty() ) |
729 | QToolTip::add( bar->getButton(id_), d->toolTip() ); | 732 | QToolTip::add( bar->getButton(id_), d->toolTip() ); |
730 | 733 | ||
731 | addContainer( bar, id_ ); | 734 | addContainer( bar, id_ ); |
732 | 735 | ||
733 | connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); | 736 | connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); |
734 | 737 | ||
735 | if ( m_parentCollection ) | 738 | if ( m_parentCollection ) |
736 | m_parentCollection->connectHighlight( bar, this ); | 739 | m_parentCollection->connectHighlight( bar, this ); |
737 | 740 | ||
738 | return containerCount() - 1; | 741 | return containerCount() - 1; |
739 | 742 | ||
740 | } | 743 | } |
741 | 744 | ||
742 | return -1; | 745 | return -1; |
743 | } | 746 | } |
744 | 747 | ||
745 | void KAction::unplug( QWidget *w ) | 748 | void KAction::unplug( QWidget *w ) |
746 | { | 749 | { |
747 | int i = findContainer( w ); | 750 | int i = findContainer( w ); |
748 | if ( i == -1 ) | 751 | if ( i == -1 ) |
749 | return; | 752 | return; |
750 | int id = itemId( i ); | 753 | int id = itemId( i ); |
751 | 754 | ||
752 | if ( w->inherits( "QPopupMenu" ) ) | 755 | if ( w->inherits( "Q3PopupMenu" ) ) |
753 | { | 756 | { |
754 | QPopupMenu *menu = static_cast<QPopupMenu *>( w ); | 757 | Q3PopupMenu *menu = static_cast<Q3PopupMenu *>( w ); |
755 | menu->removeItem( id ); | 758 | menu->removeItem( id ); |
756 | } | 759 | } |
757 | else if ( w->inherits( "KToolBar" ) ) | 760 | else if ( w->inherits( "KToolBar" ) ) |
758 | { | 761 | { |
759 | KToolBar *bar = static_cast<KToolBar *>( w ); | 762 | KToolBar *bar = static_cast<KToolBar *>( w ); |
760 | bar->removeItemDelayed( id ); | 763 | bar->removeItemDelayed( id ); |
761 | } | 764 | } |
762 | else if ( w->inherits( "QMenuBar" ) ) | 765 | else if ( w->inherits( "QMenuBar" ) ) |
763 | { | 766 | { |
764 | QMenuBar *bar = static_cast<QMenuBar *>( w ); | 767 | QMenuBar *bar = static_cast<QMenuBar *>( w ); |
765 | bar->removeItem( id ); | 768 | bar->removeItem( id ); |
766 | } | 769 | } |
767 | 770 | ||
768 | removeContainer( i ); | 771 | removeContainer( i ); |
769 | 772 | ||
770 | if ( m_parentCollection ) | 773 | if ( m_parentCollection ) |
@@ -849,34 +852,34 @@ void KAction::setEnabled(bool enable) | |||
849 | //US for ( uint i = 0; i < d->m_kaccelList.count(); i++ ) | 852 | //US for ( uint i = 0; i < d->m_kaccelList.count(); i++ ) |
850 | //US d->m_kaccelList[i]->setEnabled( name(), enable ); | 853 | //US d->m_kaccelList[i]->setEnabled( name(), enable ); |
851 | 854 | ||
852 | d->setEnabled( enable ); | 855 | d->setEnabled( enable ); |
853 | 856 | ||
854 | int len = containerCount(); | 857 | int len = containerCount(); |
855 | for( int i = 0; i < len; ++i ) | 858 | for( int i = 0; i < len; ++i ) |
856 | updateEnabled( i ); | 859 | updateEnabled( i ); |
857 | 860 | ||
858 | emit enabled( d->isEnabled() ); | 861 | emit enabled( d->isEnabled() ); |
859 | } | 862 | } |
860 | 863 | ||
861 | void KAction::updateEnabled( int i ) | 864 | void KAction::updateEnabled( int i ) |
862 | { | 865 | { |
863 | QWidget *w = container( i ); | 866 | QWidget *w = container( i ); |
864 | 867 | ||
865 | if ( w->inherits("QPopupMenu") ) | 868 | if ( w->inherits("Q3PopupMenu") ) |
866 | static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); | 869 | static_cast<Q3PopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); |
867 | else if ( w->inherits("QMenuBar") ) | 870 | else if ( w->inherits("QMenuBar") ) |
868 | static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); | 871 | static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); |
869 | else if ( w->inherits( "KToolBar" ) ) | 872 | else if ( w->inherits( "KToolBar" ) ) |
870 | { | 873 | { |
871 | static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); | 874 | static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); |
872 | } | 875 | } |
873 | } | 876 | } |
874 | 877 | ||
875 | void KAction::setShortcutConfigurable( bool b ) | 878 | void KAction::setShortcutConfigurable( bool b ) |
876 | { | 879 | { |
877 | d->m_configurable = b; | 880 | d->m_configurable = b; |
878 | } | 881 | } |
879 | 882 | ||
880 | void KAction::setText( const QString& text ) | 883 | void KAction::setText( const QString& text ) |
881 | { | 884 | { |
882 | /*US | 885 | /*US |
@@ -893,36 +896,36 @@ void KAction::setText( const QString& text ) | |||
893 | if (pAction) | 896 | if (pAction) |
894 | pAction->setLabel( text ); | 897 | pAction->setLabel( text ); |
895 | } | 898 | } |
896 | */ | 899 | */ |
897 | d->setText( text ); | 900 | d->setText( text ); |
898 | 901 | ||
899 | int len = containerCount(); | 902 | int len = containerCount(); |
900 | for( int i = 0; i < len; ++i ) | 903 | for( int i = 0; i < len; ++i ) |
901 | updateText( i ); | 904 | updateText( i ); |
902 | 905 | ||
903 | } | 906 | } |
904 | 907 | ||
905 | void KAction::updateText( int i ) | 908 | void KAction::updateText( int i ) |
906 | { | 909 | { |
907 | QWidget *w = container( i ); | 910 | QWidget *w = container( i ); |
908 | 911 | ||
909 | if ( w->inherits( "QPopupMenu" ) ) { | 912 | if ( w->inherits( "Q3PopupMenu" ) ) { |
910 | int id = itemId( i ); | 913 | int id = itemId( i ); |
911 | static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); | 914 | static_cast<Q3PopupMenu*>(w)->changeItem( id, d->text() ); |
912 | updateShortcut( static_cast<QPopupMenu*>(w), id ); | 915 | updateShortcut( static_cast<Q3PopupMenu*>(w), id ); |
913 | } | 916 | } |
914 | else if ( w->inherits( "QMenuBar" ) ) | 917 | else if ( w->inherits( "QMenuBar" ) ) |
915 | static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); | 918 | static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); |
916 | else if ( w->inherits( "KToolBar" ) ) | 919 | else if ( w->inherits( "KToolBar" ) ) |
917 | { | 920 | { |
918 | //qDebug("KAction::updateText ...3 has top be fixed"); | 921 | //qDebug("KAction::updateText ...3 has top be fixed"); |
919 | QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); | 922 | QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); |
920 | if ( button->inherits( "KToolBarButton" ) ) | 923 | if ( button->inherits( "KToolBarButton" ) ) |
921 | static_cast<KToolBarButton *>(button)->setText( d->plainText() ); | 924 | static_cast<KToolBarButton *>(button)->setText( d->plainText() ); |
922 | 925 | ||
923 | } | 926 | } |
924 | } | 927 | } |
925 | 928 | ||
926 | QString KAction::text() const | 929 | QString KAction::text() const |
927 | { | 930 | { |
928 | return d->text(); | 931 | return d->text(); |
@@ -934,108 +937,108 @@ QString KAction::plainText() const | |||
934 | } | 937 | } |
935 | 938 | ||
936 | void KAction::setIcon( const QString &icon ) | 939 | void KAction::setIcon( const QString &icon ) |
937 | { | 940 | { |
938 | d->setIconName( icon ); | 941 | d->setIconName( icon ); |
939 | 942 | ||
940 | // now handle any toolbars | 943 | // now handle any toolbars |
941 | int len = containerCount(); | 944 | int len = containerCount(); |
942 | for ( int i = 0; i < len; ++i ) | 945 | for ( int i = 0; i < len; ++i ) |
943 | updateIcon( i ); | 946 | updateIcon( i ); |
944 | } | 947 | } |
945 | 948 | ||
946 | void KAction::updateIcon( int id ) | 949 | void KAction::updateIcon( int id ) |
947 | { | 950 | { |
948 | QWidget* w = container( id ); | 951 | QWidget* w = container( id ); |
949 | 952 | ||
950 | if ( w->inherits( "QPopupMenu" ) ) { | 953 | if ( w->inherits( "Q3PopupMenu" ) ) { |
951 | int itemId_ = itemId( id ); | 954 | int itemId_ = itemId( id ); |
952 | static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); | 955 | static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); |
953 | updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); | 956 | updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ ); |
954 | } | 957 | } |
955 | else if ( w->inherits( "QMenuBar" ) ) | 958 | else if ( w->inherits( "QMenuBar" ) ) |
956 | static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() ); | 959 | static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() ); |
957 | else if ( w->inherits( "KToolBar" ) ) | 960 | else if ( w->inherits( "KToolBar" ) ) |
958 | static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); | 961 | static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); |
959 | else if ( w->inherits( "QToolBar" ) ) | 962 | else if ( w->inherits( "Q3ToolBar" ) ) |
960 | { | 963 | { |
961 | qDebug("KAction::updateIcon has top be fixed"); | 964 | qDebug("KAction::updateIcon has top be fixed"); |
962 | //US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); | 965 | //US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); |
963 | } | 966 | } |
964 | } | 967 | } |
965 | 968 | ||
966 | QString KAction::icon() const | 969 | QString KAction::icon() const |
967 | { | 970 | { |
968 | return d->iconName( ); | 971 | return d->iconName( ); |
969 | } | 972 | } |
970 | 973 | ||
971 | void KAction::setIconSet( const QIconSet &iconset ) | 974 | void KAction::setIconSet( const QIcon &iconset ) |
972 | { | 975 | { |
973 | d->setIconSet( iconset ); | 976 | d->setIconSet( iconset ); |
974 | 977 | ||
975 | int len = containerCount(); | 978 | int len = containerCount(); |
976 | for( int i = 0; i < len; ++i ) | 979 | for( int i = 0; i < len; ++i ) |
977 | updateIconSet( i ); | 980 | updateIconSet( i ); |
978 | } | 981 | } |
979 | 982 | ||
980 | 983 | ||
981 | void KAction::updateIconSet( int id ) | 984 | void KAction::updateIconSet( int id ) |
982 | { | 985 | { |
983 | QWidget *w = container( id ); | 986 | QWidget *w = container( id ); |
984 | 987 | ||
985 | if ( w->inherits( "QPopupMenu" ) ) | 988 | if ( w->inherits( "Q3PopupMenu" ) ) |
986 | { | 989 | { |
987 | int itemId_ = itemId( id ); | 990 | int itemId_ = itemId( id ); |
988 | static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); | 991 | static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); |
989 | updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); | 992 | updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ ); |
990 | } | 993 | } |
991 | else if ( w->inherits( "QMenuBar" ) ) | 994 | else if ( w->inherits( "QMenuBar" ) ) |
992 | static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() ); | 995 | static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() ); |
993 | else if ( w->inherits( "KToolBar" ) ) | 996 | else if ( w->inherits( "KToolBar" ) ) |
994 | { | 997 | { |
995 | if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better ) | 998 | if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better ) |
996 | static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() ); | 999 | static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() ); |
997 | else | 1000 | else |
998 | static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) ); | 1001 | static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) ); |
999 | } | 1002 | } |
1000 | } | 1003 | } |
1001 | 1004 | ||
1002 | QIconSet KAction::iconSet( KIcon::Group group, int size ) const | 1005 | QIcon KAction::iconSet( KIcon::Group group, int size ) const |
1003 | { | 1006 | { |
1004 | return d->iconSet( group, size ); | 1007 | return d->iconSet( group, size ); |
1005 | } | 1008 | } |
1006 | 1009 | ||
1007 | bool KAction::hasIcon() const | 1010 | bool KAction::hasIcon() const |
1008 | { | 1011 | { |
1009 | return d->hasIcon(); | 1012 | return d->hasIcon(); |
1010 | } | 1013 | } |
1011 | 1014 | ||
1012 | 1015 | ||
1013 | void KAction::setWhatsThis( const QString& text ) | 1016 | void KAction::setWhatsThis( const QString& text ) |
1014 | { | 1017 | { |
1015 | d->setWhatsThis( text ); | 1018 | d->setWhatsThis( text ); |
1016 | 1019 | ||
1017 | int len = containerCount(); | 1020 | int len = containerCount(); |
1018 | for( int i = 0; i < len; ++i ) | 1021 | for( int i = 0; i < len; ++i ) |
1019 | updateWhatsThis( i ); | 1022 | updateWhatsThis( i ); |
1020 | } | 1023 | } |
1021 | 1024 | ||
1022 | void KAction::updateWhatsThis( int i ) | 1025 | void KAction::updateWhatsThis( int i ) |
1023 | { | 1026 | { |
1024 | qDebug("KAction::updateWhatsThis ...1 has top be fixed"); | 1027 | qDebug("KAction::updateWhatsThis ...1 has top be fixed"); |
1025 | QPopupMenu* pm = popupMenu( i ); | 1028 | Q3PopupMenu* pm = popupMenu( i ); |
1026 | if ( pm ) | 1029 | if ( pm ) |
1027 | { | 1030 | { |
1028 | pm->setWhatsThis( itemId( i ), d->whatsThis() ); | 1031 | pm->setWhatsThis( itemId( i ), d->whatsThis() ); |
1029 | return; | 1032 | return; |
1030 | } | 1033 | } |
1031 | 1034 | ||
1032 | KToolBar *tb = toolBar( i ); | 1035 | KToolBar *tb = toolBar( i ); |
1033 | if ( tb ) | 1036 | if ( tb ) |
1034 | { | 1037 | { |
1035 | QWidget *w = tb->getButton( itemId( i ) ); | 1038 | QWidget *w = tb->getButton( itemId( i ) ); |
1036 | //US QWhatsThis::remove( w ); | 1039 | //US QWhatsThis::remove( w ); |
1037 | //US QWhatsThis::add( w, d->whatsThis() ); | 1040 | //US QWhatsThis::add( w, d->whatsThis() ); |
1038 | return; | 1041 | return; |
1039 | } | 1042 | } |
1040 | } | 1043 | } |
1041 | 1044 | ||
@@ -1051,36 +1054,36 @@ QString KAction::whatsThisWithIcon() const | |||
1051 | return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text); | 1054 | return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text); |
1052 | return text; | 1055 | return text; |
1053 | } | 1056 | } |
1054 | 1057 | ||
1055 | QWidget* KAction::container( int index ) const | 1058 | QWidget* KAction::container( int index ) const |
1056 | { | 1059 | { |
1057 | assert( index < containerCount() ); | 1060 | assert( index < containerCount() ); |
1058 | return d->m_containers[ index ].m_container; | 1061 | return d->m_containers[ index ].m_container; |
1059 | } | 1062 | } |
1060 | 1063 | ||
1061 | KToolBar* KAction::toolBar( int index ) const | 1064 | KToolBar* KAction::toolBar( int index ) const |
1062 | { | 1065 | { |
1063 | //US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container ); | 1066 | //US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container ); |
1064 | return (KToolBar *)( d->m_containers[ index ].m_container ); | 1067 | return (KToolBar *)( d->m_containers[ index ].m_container ); |
1065 | } | 1068 | } |
1066 | 1069 | ||
1067 | QPopupMenu* KAction::popupMenu( int index ) const | 1070 | Q3PopupMenu* KAction::popupMenu( int index ) const |
1068 | { | 1071 | { |
1069 | //US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container ); | 1072 | //US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container ); |
1070 | return (QPopupMenu *)( d->m_containers[ index ].m_container ); | 1073 | return (Q3PopupMenu *)( d->m_containers[ index ].m_container ); |
1071 | } | 1074 | } |
1072 | 1075 | ||
1073 | QWidget* KAction::representative( int index ) const | 1076 | QWidget* KAction::representative( int index ) const |
1074 | { | 1077 | { |
1075 | return d->m_containers[ index ].m_representative; | 1078 | return d->m_containers[ index ].m_representative; |
1076 | } | 1079 | } |
1077 | 1080 | ||
1078 | int KAction::itemId( int index ) const | 1081 | int KAction::itemId( int index ) const |
1079 | { | 1082 | { |
1080 | return d->m_containers[ index ].m_id; | 1083 | return d->m_containers[ index ].m_id; |
1081 | } | 1084 | } |
1082 | 1085 | ||
1083 | int KAction::containerCount() const | 1086 | int KAction::containerCount() const |
1084 | { | 1087 | { |
1085 | return d->m_containers.count(); | 1088 | return d->m_containers.count(); |
1086 | } | 1089 | } |
@@ -1142,48 +1145,48 @@ void KAction::slotDestroyed() | |||
1142 | } | 1145 | } |
1143 | } | 1146 | } |
1144 | */ | 1147 | */ |
1145 | int i; | 1148 | int i; |
1146 | do | 1149 | do |
1147 | { | 1150 | { |
1148 | i = findContainer( static_cast<const QWidget*>( o ) ); | 1151 | i = findContainer( static_cast<const QWidget*>( o ) ); |
1149 | if ( i != -1 ) | 1152 | if ( i != -1 ) |
1150 | removeContainer( i ); | 1153 | removeContainer( i ); |
1151 | } while ( i != -1 ); | 1154 | } while ( i != -1 ); |
1152 | 1155 | ||
1153 | } | 1156 | } |
1154 | 1157 | ||
1155 | int KAction::findContainer( const QWidget* widget ) const | 1158 | int KAction::findContainer( const QWidget* widget ) const |
1156 | { | 1159 | { |
1157 | int pos = 0; | 1160 | int pos = 0; |
1158 | QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); | 1161 | Q3ValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); |
1159 | while( it != d->m_containers.end() ) | 1162 | while( it != d->m_containers.end() ) |
1160 | { | 1163 | { |
1161 | if ( (*it).m_representative == widget || (*it).m_container == widget ) | 1164 | if ( (*it).m_representative == widget || (*it).m_container == widget ) |
1162 | return pos; | 1165 | return pos; |
1163 | ++it; | 1166 | ++it; |
1164 | ++pos; | 1167 | ++pos; |
1165 | } | 1168 | } |
1166 | 1169 | ||
1167 | return -1; | 1170 | return -1; |
1168 | } | 1171 | } |
1169 | 1172 | ||
1170 | void KAction::removeContainer( int index ) | 1173 | void KAction::removeContainer( int index ) |
1171 | { | 1174 | { |
1172 | int i = 0; | 1175 | int i = 0; |
1173 | QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); | 1176 | Q3ValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); |
1174 | while( it != d->m_containers.end() ) | 1177 | while( it != d->m_containers.end() ) |
1175 | { | 1178 | { |
1176 | if ( i == index ) | 1179 | if ( i == index ) |
1177 | { | 1180 | { |
1178 | d->m_containers.remove( it ); | 1181 | d->m_containers.remove( it ); |
1179 | return; | 1182 | return; |
1180 | } | 1183 | } |
1181 | ++it; | 1184 | ++it; |
1182 | ++i; | 1185 | ++i; |
1183 | } | 1186 | } |
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | // FIXME: Remove this (ellis) | 1189 | // FIXME: Remove this (ellis) |
1187 | void KAction::slotKeycodeChanged() | 1190 | void KAction::slotKeycodeChanged() |
1188 | { | 1191 | { |
1189 | qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed"); | 1192 | qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed"); |
diff --git a/microkde/kdeui/kaction.h b/microkde/kdeui/kaction.h index 13e2e1e..5c690ec 100644 --- a/microkde/kdeui/kaction.h +++ b/microkde/kdeui/kaction.h | |||
@@ -16,47 +16,49 @@ | |||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Library General Public License for more details. | 17 | Library General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | //$Id$ | 24 | //$Id$ |
25 | 25 | ||
26 | #ifndef __kaction_h__ | 26 | #ifndef __kaction_h__ |
27 | #define __kaction_h__ | 27 | #define __kaction_h__ |
28 | 28 | ||
29 | 29 | ||
30 | //US #include <qkeysequence.h> | 30 | //US #include <qkeysequence.h> |
31 | #include <qobject.h> | 31 | #include <qobject.h> |
32 | #include <qvaluelist.h> | 32 | #include <q3valuelist.h> |
33 | #include <qguardedptr.h> | 33 | #include <qpointer.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3PopupMenu> | ||
34 | #include <kguiitem.h> | 36 | #include <kguiitem.h> |
35 | #include <kshortcut.h> | 37 | #include <kshortcut.h> |
36 | #include <kstdaction.h> | 38 | #include <kstdaction.h> |
37 | //US#include <kicontheme.h> | 39 | //US#include <kicontheme.h> |
38 | 40 | ||
39 | //US added the following files | 41 | //US added the following files |
40 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
41 | 43 | ||
42 | class QMenuBar; | 44 | class QMenuBar; |
43 | class QPopupMenu; | 45 | class Q3PopupMenu; |
44 | //USclass QComboBox; | 46 | //USclass QComboBox; |
45 | //USclass QPoint; | 47 | //USclass QPoint; |
46 | class QIconSet; | 48 | class QIcon; |
47 | class QString; | 49 | class QString; |
48 | class KToolBar; | 50 | class KToolBar; |
49 | 51 | ||
50 | class KAccel; | 52 | class KAccel; |
51 | //USclass KAccelActions; | 53 | //USclass KAccelActions; |
52 | //USclass KConfig; | 54 | //USclass KConfig; |
53 | //USclass KConfigBase; | 55 | //USclass KConfigBase; |
54 | //USclass KURL; | 56 | //USclass KURL; |
55 | //USclass KInstance; | 57 | //USclass KInstance; |
56 | //USclass KToolBar; | 58 | //USclass KToolBar; |
57 | class KActionCollection; | 59 | class KActionCollection; |
58 | //USclass KPopupMenu; | 60 | //USclass KPopupMenu; |
59 | class KMainWindow; | 61 | class KMainWindow; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * The KAction class (and derived and super classes) provides a way to | 64 | * The KAction class (and derived and super classes) provides a way to |
@@ -246,33 +248,33 @@ public: | |||
246 | * | 248 | * |
247 | * If you do not want or have a keyboard shortcut, set the | 249 | * If you do not want or have a keyboard shortcut, set the |
248 | * @p cut param to 0. | 250 | * @p cut param to 0. |
249 | * | 251 | * |
250 | * This is the other common KAction used. Use it when you | 252 | * This is the other common KAction used. Use it when you |
251 | * @p do have a corresponding icon. | 253 | * @p do have a corresponding icon. |
252 | * | 254 | * |
253 | * @param text The text that will be displayed. | 255 | * @param text The text that will be displayed. |
254 | * @param pix The icon to display. | 256 | * @param pix The icon to display. |
255 | * @param cut The corresponding keyboard shortcut. | 257 | * @param cut The corresponding keyboard shortcut. |
256 | * @param receiver The SLOT's parent. | 258 | * @param receiver The SLOT's parent. |
257 | * @param slot The SLOT to invoke to execute this action. | 259 | * @param slot The SLOT to invoke to execute this action. |
258 | * @param parent This action's parent. | 260 | * @param parent This action's parent. |
259 | * @param name An internal name for this action. | 261 | * @param name An internal name for this action. |
260 | */ | 262 | */ |
261 | 263 | ||
262 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 264 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
263 | const QObject* receiver, const char* slot, | 265 | const QObject* receiver, const char* slot, |
264 | KActionCollection* parent, const char* name ); | 266 | KActionCollection* parent, const char* name ); |
265 | 267 | ||
266 | /** | 268 | /** |
267 | * Constructs an action with text, icon, potential keyboard | 269 | * Constructs an action with text, icon, potential keyboard |
268 | * shortcut, and a SLOT to call when this action is invoked by | 270 | * shortcut, and a SLOT to call when this action is invoked by |
269 | * the user. The icon is loaded on demand later based on where it | 271 | * the user. The icon is loaded on demand later based on where it |
270 | * is plugged in. | 272 | * is plugged in. |
271 | * | 273 | * |
272 | * If you do not want or have a keyboard shortcut, set the | 274 | * If you do not want or have a keyboard shortcut, set the |
273 | * @p cut param to 0. | 275 | * @p cut param to 0. |
274 | * | 276 | * |
275 | * This is the other common KAction used. Use it when you | 277 | * This is the other common KAction used. Use it when you |
276 | * @p do have a corresponding icon. | 278 | * @p do have a corresponding icon. |
277 | * | 279 | * |
278 | * @param text The text that will be displayed. | 280 | * @param text The text that will be displayed. |
@@ -295,43 +297,43 @@ public: | |||
295 | */ | 297 | */ |
296 | KAction( const KGuiItem& item, const KShortcut& cut, | 298 | KAction( const KGuiItem& item, const KShortcut& cut, |
297 | const QObject* receiver, const char* slot, | 299 | const QObject* receiver, const char* slot, |
298 | KActionCollection* parent, const char* name ); | 300 | KActionCollection* parent, const char* name ); |
299 | /** | 301 | /** |
300 | * @obsolete | 302 | * @obsolete |
301 | */ | 303 | */ |
302 | KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); | 304 | KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); |
303 | /** | 305 | /** |
304 | * @obsolete | 306 | * @obsolete |
305 | */ | 307 | */ |
306 | KAction( const QString& text, const KShortcut& cut, | 308 | KAction( const QString& text, const KShortcut& cut, |
307 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 309 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
308 | /** | 310 | /** |
309 | * @obsolete | 311 | * @obsolete |
310 | */ | 312 | */ |
311 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 313 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
312 | QObject* parent = 0, const char* name = 0 ); | 314 | QObject* parent = 0, const char* name = 0 ); |
313 | /** | 315 | /** |
314 | * @obsolete | 316 | * @obsolete |
315 | */ | 317 | */ |
316 | KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 318 | KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
317 | QObject* parent = 0, const char* name = 0 ); | 319 | QObject* parent = 0, const char* name = 0 ); |
318 | /** | 320 | /** |
319 | * @obsolete | 321 | * @obsolete |
320 | */ | 322 | */ |
321 | KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 323 | KAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
322 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 324 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
323 | /** | 325 | /** |
324 | * @obsolete | 326 | * @obsolete |
325 | */ | 327 | */ |
326 | KAction( const QString& text, const QString& pix, const KShortcut& cut, | 328 | KAction( const QString& text, const QString& pix, const KShortcut& cut, |
327 | const QObject* receiver, const char* slot, QObject* parent, | 329 | const QObject* receiver, const char* slot, QObject* parent, |
328 | const char* name = 0 ); | 330 | const char* name = 0 ); |
329 | /** | 331 | /** |
330 | * @obsolete | 332 | * @obsolete |
331 | */ | 333 | */ |
332 | KAction( QObject* parent = 0, const char* name = 0 ); | 334 | KAction( QObject* parent = 0, const char* name = 0 ); |
333 | 335 | ||
334 | /** | 336 | /** |
335 | * Standard destructor | 337 | * Standard destructor |
336 | */ | 338 | */ |
337 | virtual ~KAction(); | 339 | virtual ~KAction(); |
@@ -448,36 +450,36 @@ public: | |||
448 | virtual QString group() const; | 450 | virtual QString group() const; |
449 | 451 | ||
450 | /** | 452 | /** |
451 | * Get the What's this text for the action. | 453 | * Get the What's this text for the action. |
452 | */ | 454 | */ |
453 | virtual QString whatsThis() const; | 455 | virtual QString whatsThis() const; |
454 | 456 | ||
455 | /** | 457 | /** |
456 | * Get the tooltip text for the action. | 458 | * Get the tooltip text for the action. |
457 | */ | 459 | */ |
458 | virtual QString toolTip() const; | 460 | virtual QString toolTip() const; |
459 | 461 | ||
460 | /** | 462 | /** |
461 | * Get the QIconSet from which the icons used to display this action will | 463 | * Get the QIconSet from which the icons used to display this action will |
462 | * be chosen. | 464 | * be chosen. |
463 | */ | 465 | */ |
464 | virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const; | 466 | virtual QIcon iconSet( KIcon::Group group, int size=0 ) const; |
465 | 467 | ||
466 | #ifndef KDE_NO_COMPAT | 468 | #ifndef KDE_NO_COMPAT |
467 | QIconSet iconSet() const | 469 | QIcon iconSet() const |
468 | { | 470 | { |
469 | return iconSet( KIcon::Small ); | 471 | return iconSet( KIcon::Small ); |
470 | } | 472 | } |
471 | #endif | 473 | #endif |
472 | 474 | ||
473 | virtual QString icon() const; | 475 | virtual QString icon() const; |
474 | 476 | ||
475 | KActionCollection *parentCollection() const; | 477 | KActionCollection *parentCollection() const; |
476 | 478 | ||
477 | /** | 479 | /** |
478 | * @internal | 480 | * @internal |
479 | * Generate a toolbar button id. Made public for reimplementations. | 481 | * Generate a toolbar button id. Made public for reimplementations. |
480 | */ | 482 | */ |
481 | static int getToolButtonID(); | 483 | static int getToolButtonID(); |
482 | 484 | ||
483 | 485 | ||
@@ -505,70 +507,70 @@ public slots: | |||
505 | * The What's this text can include QML markup as well as raw text. | 507 | * The What's this text can include QML markup as well as raw text. |
506 | */ | 508 | */ |
507 | virtual void setWhatsThis( const QString& text ); | 509 | virtual void setWhatsThis( const QString& text ); |
508 | 510 | ||
509 | /** | 511 | /** |
510 | * Sets the tooltip text for the action. | 512 | * Sets the tooltip text for the action. |
511 | * This will be used as a tooltip for a toolbar button, as a | 513 | * This will be used as a tooltip for a toolbar button, as a |
512 | * statusbar help-text for a menu item, and it also appears | 514 | * statusbar help-text for a menu item, and it also appears |
513 | * in the toolbar editor, to describe the action. | 515 | * in the toolbar editor, to describe the action. |
514 | */ | 516 | */ |
515 | virtual void setToolTip( const QString& ); | 517 | virtual void setToolTip( const QString& ); |
516 | 518 | ||
517 | /** | 519 | /** |
518 | * Sets the QIconSet from which the icons used to display this action will | 520 | * Sets the QIconSet from which the icons used to display this action will |
519 | * be chosen. | 521 | * be chosen. |
520 | */ | 522 | */ |
521 | virtual void setIconSet( const QIconSet &iconSet ); | 523 | virtual void setIconSet( const QIcon &iconSet ); |
522 | 524 | ||
523 | virtual void setIcon( const QString& icon ); | 525 | virtual void setIcon( const QString& icon ); |
524 | 526 | ||
525 | /** | 527 | /** |
526 | * Enables or disables this action. All uses of this action (eg. in menus | 528 | * Enables or disables this action. All uses of this action (eg. in menus |
527 | * or toolbars) will be updated to reflect the state of the action. | 529 | * or toolbars) will be updated to reflect the state of the action. |
528 | */ | 530 | */ |
529 | virtual void setEnabled(bool enable); | 531 | virtual void setEnabled(bool enable); |
530 | 532 | ||
531 | /** | 533 | /** |
532 | * Indicate whether the user may configure the action's shortcut. | 534 | * Indicate whether the user may configure the action's shortcut. |
533 | */ | 535 | */ |
534 | virtual void setShortcutConfigurable( bool ); | 536 | virtual void setShortcutConfigurable( bool ); |
535 | 537 | ||
536 | /** | 538 | /** |
537 | * Emulate user's interaction programmatically, by activating the action. | 539 | * Emulate user's interaction programmatically, by activating the action. |
538 | * The implementation simply emits activated(). | 540 | * The implementation simply emits activated(). |
539 | */ | 541 | */ |
540 | virtual void activate(); | 542 | virtual void activate(); |
541 | 543 | ||
542 | protected slots: | 544 | protected slots: |
543 | virtual void slotDestroyed(); | 545 | virtual void slotDestroyed(); |
544 | virtual void slotKeycodeChanged(); | 546 | virtual void slotKeycodeChanged(); |
545 | virtual void slotActivated(); | 547 | virtual void slotActivated(); |
546 | 548 | ||
547 | protected: | 549 | protected: |
548 | KToolBar* toolBar( int index ) const; | 550 | KToolBar* toolBar( int index ) const; |
549 | QPopupMenu* popupMenu( int index ) const; | 551 | Q3PopupMenu* popupMenu( int index ) const; |
550 | void removeContainer( int index ); | 552 | void removeContainer( int index ); |
551 | int findContainer( const QWidget* widget ) const; | 553 | int findContainer( const QWidget* widget ) const; |
552 | void plugMainWindowAccel( QWidget *w ); | 554 | void plugMainWindowAccel( QWidget *w ); |
553 | 555 | ||
554 | void addContainer( QWidget* parent, int id ); | 556 | void addContainer( QWidget* parent, int id ); |
555 | void addContainer( QWidget* parent, QWidget* representative ); | 557 | void addContainer( QWidget* parent, QWidget* representative ); |
556 | 558 | ||
557 | virtual void updateShortcut( int i ); | 559 | virtual void updateShortcut( int i ); |
558 | virtual void updateShortcut( QPopupMenu* menu, int id ); | 560 | virtual void updateShortcut( Q3PopupMenu* menu, int id ); |
559 | virtual void updateGroup( int id ); | 561 | virtual void updateGroup( int id ); |
560 | virtual void updateText(int i ); | 562 | virtual void updateText(int i ); |
561 | virtual void updateEnabled(int i); | 563 | virtual void updateEnabled(int i); |
562 | virtual void updateIconSet(int i); | 564 | virtual void updateIconSet(int i); |
563 | virtual void updateIcon( int i); | 565 | virtual void updateIcon( int i); |
564 | virtual void updateToolTip( int id ); | 566 | virtual void updateToolTip( int id ); |
565 | virtual void updateWhatsThis( int i ); | 567 | virtual void updateWhatsThis( int i ); |
566 | 568 | ||
567 | KActionCollection *m_parentCollection; | 569 | KActionCollection *m_parentCollection; |
568 | QString whatsThisWithIcon() const; | 570 | QString whatsThisWithIcon() const; |
569 | 571 | ||
570 | signals: | 572 | signals: |
571 | void activated(); | 573 | void activated(); |
572 | void enabled( bool ); | 574 | void enabled( bool ); |
573 | 575 | ||
574 | private: | 576 | private: |
diff --git a/microkde/kdeui/kactionclasses.cpp b/microkde/kdeui/kactionclasses.cpp index 82e6c8b..c611865 100644 --- a/microkde/kdeui/kactionclasses.cpp +++ b/microkde/kdeui/kactionclasses.cpp | |||
@@ -15,88 +15,90 @@ | |||
15 | This library is distributed in the hope that it will be useful, | 15 | This library is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | Library General Public License for more details. | 18 | Library General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU Library General Public License | 20 | You should have received a copy of the GNU Library General Public License |
21 | along with this library; see the file COPYING.LIB. If not, write to | 21 | along with this library; see the file COPYING.LIB. If not, write to |
22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. | 23 | Boston, MA 02111-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "kactionclasses.h" | 26 | #include "kactionclasses.h" |
27 | 27 | ||
28 | #include <assert.h> | 28 | #include <assert.h> |
29 | 29 | ||
30 | #include <qfontdatabase.h> | 30 | #include <qfontdatabase.h> |
31 | #include <qobjectlist.h> | 31 | #include <qobject.h> |
32 | //US#include <qwhatsthis.h> | 32 | //US#include <qwhatsthis.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3ValueList> | ||
34 | 36 | ||
35 | //US#include <kaccel.h> | 37 | //US#include <kaccel.h> |
36 | //US#include <kapplication.h> | 38 | //US#include <kapplication.h> |
37 | #include <kconfig.h> | 39 | #include <kconfig.h> |
38 | #include <kdebug.h> | 40 | #include <kdebug.h> |
39 | //US#include <kfontcombo.h> | 41 | //US#include <kfontcombo.h> |
40 | //US#include <kmainwindow.h> | 42 | //US#include <kmainwindow.h> |
41 | //US#include <kmenubar.h> | 43 | //US#include <kmenubar.h> |
42 | //US#include <kpopupmenu.h> | 44 | //US#include <kpopupmenu.h> |
43 | #include <kcombobox.h> | 45 | #include <kcombobox.h> |
44 | #include <ktoolbar.h> | 46 | #include <ktoolbar.h> |
45 | #include <ktoolbarbutton.h> | 47 | #include <ktoolbarbutton.h> |
46 | #include <kurl.h> | 48 | #include <kurl.h> |
47 | 49 | ||
48 | //US added the following includefiles | 50 | //US added the following includefiles |
49 | #include <kconfigbase.h> | 51 | #include <kconfigbase.h> |
50 | #include <qwidget.h> | 52 | #include <qwidget.h> |
51 | #include <qpopupmenu.h> | 53 | #include <q3popupmenu.h> |
52 | #include <qmenubar.h> | 54 | #include <qmenubar.h> |
53 | #include <qmainwindow.h> | 55 | #include <q3mainwindow.h> |
54 | #include <qtoolbar.h> | 56 | #include <q3toolbar.h> |
55 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
56 | #include <qmainwindow.h> | 58 | #include <q3mainwindow.h> |
57 | 59 | #include <qcoreapplication.h> | |
58 | 60 | ||
59 | static QFontDatabase *fontDataBase = 0; | 61 | static QFontDatabase *fontDataBase = 0; |
60 | 62 | ||
61 | static void cleanupFontDatabase() | 63 | static void cleanupFontDatabase() |
62 | { | 64 | { |
63 | delete fontDataBase; | 65 | delete fontDataBase; |
64 | fontDataBase = 0; | 66 | fontDataBase = 0; |
65 | } | 67 | } |
66 | 68 | ||
67 | static void get_fonts( QStringList &lst ) | 69 | static void get_fonts( QStringList &lst ) |
68 | { | 70 | { |
69 | if ( !fontDataBase ) { | 71 | if ( !fontDataBase ) { |
70 | fontDataBase = new QFontDatabase(); | 72 | fontDataBase = new QFontDatabase(); |
71 | qAddPostRoutine( cleanupFontDatabase ); | 73 | qAddPostRoutine( cleanupFontDatabase ); |
72 | } | 74 | } |
73 | lst.clear(); | 75 | lst.clear(); |
74 | QStringList families = fontDataBase->families(); | 76 | QStringList families = fontDataBase->families(); |
75 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) | 77 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) |
76 | { | 78 | { |
77 | QString family = *it; | 79 | QString family = *it; |
78 | if ( family. contains('-') ) // remove foundry | 80 | if ( family. contains('-') ) // remove foundry |
79 | family = family.right( family.length() - family.find('-' ) - 1); | 81 | family = family.right( family.length() - family.find('-' ) - 1); |
80 | if ( !lst.contains( family ) ) | 82 | if ( !lst.contains( family ) ) |
81 | lst.append( family ); | 83 | lst.append( family ); |
82 | } | 84 | } |
83 | lst.sort(); | 85 | lst.sort(); |
84 | } | 86 | } |
85 | 87 | ||
86 | static QValueList<int> get_standard_font_sizes() | 88 | static Q3ValueList<int> get_standard_font_sizes() |
87 | { | 89 | { |
88 | if ( !fontDataBase ) { | 90 | if ( !fontDataBase ) { |
89 | fontDataBase = new QFontDatabase(); | 91 | fontDataBase = new QFontDatabase(); |
90 | qAddPostRoutine( cleanupFontDatabase ); | 92 | qAddPostRoutine( cleanupFontDatabase ); |
91 | } | 93 | } |
92 | return fontDataBase->standardSizes(); | 94 | return fontDataBase->standardSizes(); |
93 | } | 95 | } |
94 | 96 | ||
95 | class KToggleAction::KToggleActionPrivate | 97 | class KToggleAction::KToggleActionPrivate |
96 | { | 98 | { |
97 | public: | 99 | public: |
98 | KToggleActionPrivate() | 100 | KToggleActionPrivate() |
99 | { | 101 | { |
100 | m_checked = false; | 102 | m_checked = false; |
101 | } | 103 | } |
102 | 104 | ||
@@ -107,149 +109,148 @@ public: | |||
107 | KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, | 109 | KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, |
108 | QObject* parent, | 110 | QObject* parent, |
109 | const char* name ) | 111 | const char* name ) |
110 | : KAction( text, cut, parent, name ) | 112 | : KAction( text, cut, parent, name ) |
111 | { | 113 | { |
112 | d = new KToggleActionPrivate; | 114 | d = new KToggleActionPrivate; |
113 | } | 115 | } |
114 | 116 | ||
115 | KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, | 117 | KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, |
116 | const QObject* receiver, const char* slot, | 118 | const QObject* receiver, const char* slot, |
117 | QObject* parent, const char* name ) | 119 | QObject* parent, const char* name ) |
118 | : KAction( text, cut, receiver, slot, parent, name ) | 120 | : KAction( text, cut, receiver, slot, parent, name ) |
119 | { | 121 | { |
120 | d = new KToggleActionPrivate; | 122 | d = new KToggleActionPrivate; |
121 | } | 123 | } |
122 | 124 | ||
123 | KToggleAction::KToggleAction( const QString& text, const QIconSet& pix, | 125 | KToggleAction::KToggleAction( const QString& text, const QIcon& pix, |
124 | const KShortcut& cut, | 126 | const KShortcut& cut, |
125 | QObject* parent, const char* name ) | 127 | QObject* parent, const char* name ) |
126 | : KAction( text, pix, cut, parent, name ) | 128 | : KAction( text, pix, cut, parent, name ) |
127 | { | 129 | { |
128 | d = new KToggleActionPrivate; | 130 | d = new KToggleActionPrivate; |
129 | } | 131 | } |
130 | 132 | ||
131 | KToggleAction::KToggleAction( const QString& text, const QString& pix, | 133 | KToggleAction::KToggleAction( const QString& text, const QString& pix, |
132 | const KShortcut& cut, | 134 | const KShortcut& cut, |
133 | QObject* parent, const char* name ) | 135 | QObject* parent, const char* name ) |
134 | : KAction( text, pix, cut, parent, name ) | 136 | : KAction( text, pix, cut, parent, name ) |
135 | { | 137 | { |
136 | d = new KToggleActionPrivate; | 138 | d = new KToggleActionPrivate; |
137 | } | 139 | } |
138 | 140 | ||
139 | KToggleAction::KToggleAction( const QString& text, const QIconSet& pix, | 141 | KToggleAction::KToggleAction( const QString& text, const QIcon& pix, |
140 | const KShortcut& cut, | 142 | const KShortcut& cut, |
141 | const QObject* receiver, | 143 | const QObject* receiver, |
142 | const char* slot, QObject* parent, | 144 | const char* slot, QObject* parent, |
143 | const char* name ) | 145 | const char* name ) |
144 | : KAction( text, pix, cut, receiver, slot, parent, name ) | 146 | : KAction( text, pix, cut, receiver, slot, parent, name ) |
145 | { | 147 | { |
146 | d = new KToggleActionPrivate; | 148 | d = new KToggleActionPrivate; |
147 | } | 149 | } |
148 | 150 | ||
149 | KToggleAction::KToggleAction( const QString& text, const QString& pix, | 151 | KToggleAction::KToggleAction( const QString& text, const QString& pix, |
150 | const KShortcut& cut, | 152 | const KShortcut& cut, |
151 | const QObject* receiver, | 153 | const QObject* receiver, |
152 | const char* slot, QObject* parent, | 154 | const char* slot, QObject* parent, |
153 | const char* name ) | 155 | const char* name ) |
154 | : KAction( text, pix, cut, receiver, slot, parent, name ) | 156 | : KAction( text, pix, cut, receiver, slot, parent, name ) |
155 | { | 157 | { |
156 | d = new KToggleActionPrivate; | 158 | d = new KToggleActionPrivate; |
157 | } | 159 | } |
158 | 160 | ||
159 | KToggleAction::KToggleAction( QObject* parent, const char* name ) | 161 | KToggleAction::KToggleAction( QObject* parent, const char* name ) |
160 | : KAction( parent, name ) | 162 | : KAction( parent, name ) |
161 | { | 163 | { |
162 | d = new KToggleActionPrivate; | 164 | d = new KToggleActionPrivate; |
163 | } | 165 | } |
164 | 166 | ||
165 | KToggleAction::~KToggleAction() | 167 | KToggleAction::~KToggleAction() |
166 | { | 168 | { |
167 | delete d; | 169 | delete d; |
168 | } | 170 | } |
169 | 171 | ||
170 | int KToggleAction::plug( QWidget* widget, int index ) | 172 | int KToggleAction::plug( QWidget* widget, int index ) |
171 | { | 173 | { |
172 | if ( !widget->inherits("QPopupMenu") && !widget->inherits("KToolBar") ) | 174 | if ( !widget->inherits("Q3PopupMenu") && !widget->inherits("KToolBar") ) |
173 | { | 175 | { |
174 | kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl; | 176 | kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl; |
175 | return -1; | 177 | return -1; |
176 | } | 178 | } |
177 | 179 | ||
178 | /*US | 180 | /*US |
179 | if (kapp && !kapp->authorizeKAction(name())) | 181 | if (kapp && !kapp->authorizeKAction(name())) |
180 | return -1; | 182 | return -1; |
181 | */ | 183 | */ |
182 | 184 | ||
183 | int _index = KAction::plug( widget, index ); | 185 | int _index = KAction::plug( widget, index ); |
184 | if ( _index == -1 ) | 186 | if ( _index == -1 ) |
185 | return _index; | 187 | return _index; |
186 | 188 | ||
187 | if ( widget->inherits("QPopupMenu") ) | 189 | if ( widget->inherits("Q3PopupMenu") ) |
188 | { | 190 | { |
189 | int id = itemId( _index ); | 191 | int id = itemId( _index ); |
190 | 192 | ||
191 | static_cast<QPopupMenu*>(widget)->setItemChecked( id, d->m_checked ); | 193 | static_cast<Q3PopupMenu*>(widget)->setItemChecked( id, d->m_checked ); |
192 | } else if ( widget->inherits( "KToolBar" ) ) { | 194 | } else if ( widget->inherits( "KToolBar" ) ) { |
193 | 195 | ||
194 | KToolBar *bar = static_cast<KToolBar *>( widget ); | 196 | KToolBar *bar = static_cast<KToolBar *>( widget ); |
195 | 197 | ||
196 | bar->setToggle( itemId( _index ), true ); | 198 | bar->setToggle( itemId( _index ), true ); |
197 | bar->setButton( itemId( _index ), isChecked() ); | 199 | bar->setButton( itemId( _index ), isChecked() ); |
198 | } | 200 | } |
199 | 201 | ||
200 | return _index; | 202 | return _index; |
201 | } | 203 | } |
202 | 204 | ||
203 | void KToggleAction::setChecked( bool c ) | 205 | void KToggleAction::setChecked( bool c ) |
204 | { | 206 | { |
205 | if ( c == d->m_checked ) | 207 | if ( c == d->m_checked ) |
206 | return; | 208 | return; |
207 | //kdDebug(129) << "KToggleAction::setChecked(" << c << ") " << this << " " << name() << endl; | 209 | //kdDebug(129) << "KToggleAction::setChecked(" << c << ") " << this << " " << name() << endl; |
208 | 210 | ||
209 | d->m_checked = c; | 211 | d->m_checked = c; |
210 | 212 | ||
211 | int len = containerCount(); | 213 | int len = containerCount(); |
212 | 214 | ||
213 | for( int i = 0; i < len; ++i ) | 215 | for( int i = 0; i < len; ++i ) |
214 | updateChecked( i ); | 216 | updateChecked( i ); |
215 | 217 | ||
216 | if ( c && parent() && !exclusiveGroup().isEmpty() ) { | 218 | if ( c && parent() && !exclusiveGroup().isEmpty() ) { |
217 | const QObjectList *list = parent()->children(); | 219 | const QObjectList list = parent()->children(); |
218 | if ( list ) { | 220 | if ( !list.empty() ) { |
219 | QObjectListIt it( *list ); | 221 | for(QObjectList::const_iterator it=list.begin();it!=list.end();++it) { |
220 | for( ; it.current(); ++it ) { | 222 | if ( (*it)->inherits( "KToggleAction" ) && (*it) != this && |
221 | if ( it.current()->inherits( "KToggleAction" ) && it.current() != this && | 223 | static_cast<KToggleAction*>((*it))->exclusiveGroup() == exclusiveGroup() ) { |
222 | static_cast<KToggleAction*>(it.current())->exclusiveGroup() == exclusiveGroup() ) { | 224 | KToggleAction *a = static_cast<KToggleAction*>(*it); |
223 | KToggleAction *a = static_cast<KToggleAction*>(it.current()); | ||
224 | if( a->isChecked() ) { | 225 | if( a->isChecked() ) { |
225 | a->setChecked( false ); | 226 | a->setChecked( false ); |
226 | emit a->toggled( false ); | 227 | emit a->toggled( false ); |
227 | } | 228 | } |
228 | } | 229 | } |
229 | } | 230 | } |
230 | } | 231 | } |
231 | } | 232 | } |
232 | } | 233 | } |
233 | 234 | ||
234 | void KToggleAction::updateChecked( int id ) | 235 | void KToggleAction::updateChecked( int id ) |
235 | { | 236 | { |
236 | QWidget *w = container( id ); | 237 | QWidget *w = container( id ); |
237 | 238 | ||
238 | if ( w->inherits( "QPopupMenu" ) ) | 239 | if ( w->inherits( "Q3PopupMenu" ) ) |
239 | static_cast<QPopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked ); | 240 | static_cast<Q3PopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked ); |
240 | else if ( w->inherits( "QMenuBar" ) ) | 241 | else if ( w->inherits( "QMenuBar" ) ) |
241 | static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked ); | 242 | static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked ); |
242 | else if ( w->inherits( "KToolBar" ) ) | 243 | else if ( w->inherits( "KToolBar" ) ) |
243 | { | 244 | { |
244 | QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) ); | 245 | QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) ); |
245 | if ( r && r->inherits( "KToolBarButton" ) ) | 246 | if ( r && r->inherits( "KToolBarButton" ) ) |
246 | static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked ); | 247 | static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked ); |
247 | } | 248 | } |
248 | } | 249 | } |
249 | 250 | ||
250 | void KToggleAction::slotActivated() | 251 | void KToggleAction::slotActivated() |
251 | { | 252 | { |
252 | setChecked( !isChecked() ); | 253 | setChecked( !isChecked() ); |
253 | emit activated(); | 254 | emit activated(); |
254 | emit toggled( isChecked() ); | 255 | emit toggled( isChecked() ); |
255 | } | 256 | } |
@@ -270,47 +271,47 @@ QString KToggleAction::exclusiveGroup() const | |||
270 | } | 271 | } |
271 | 272 | ||
272 | 273 | ||
273 | KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, | 274 | KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, |
274 | QObject* parent, const char* name ) | 275 | QObject* parent, const char* name ) |
275 | : KToggleAction( text, cut, parent, name ) | 276 | : KToggleAction( text, cut, parent, name ) |
276 | { | 277 | { |
277 | } | 278 | } |
278 | 279 | ||
279 | KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, | 280 | KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, |
280 | const QObject* receiver, const char* slot, | 281 | const QObject* receiver, const char* slot, |
281 | QObject* parent, const char* name ) | 282 | QObject* parent, const char* name ) |
282 | : KToggleAction( text, cut, receiver, slot, parent, name ) | 283 | : KToggleAction( text, cut, receiver, slot, parent, name ) |
283 | { | 284 | { |
284 | } | 285 | } |
285 | 286 | ||
286 | KRadioAction::KRadioAction( const QString& text, const QIconSet& pix, | 287 | KRadioAction::KRadioAction( const QString& text, const QIcon& pix, |
287 | const KShortcut& cut, | 288 | const KShortcut& cut, |
288 | QObject* parent, const char* name ) | 289 | QObject* parent, const char* name ) |
289 | : KToggleAction( text, pix, cut, parent, name ) | 290 | : KToggleAction( text, pix, cut, parent, name ) |
290 | { | 291 | { |
291 | } | 292 | } |
292 | 293 | ||
293 | KRadioAction::KRadioAction( const QString& text, const QString& pix, | 294 | KRadioAction::KRadioAction( const QString& text, const QString& pix, |
294 | const KShortcut& cut, | 295 | const KShortcut& cut, |
295 | QObject* parent, const char* name ) | 296 | QObject* parent, const char* name ) |
296 | : KToggleAction( text, pix, cut, parent, name ) | 297 | : KToggleAction( text, pix, cut, parent, name ) |
297 | { | 298 | { |
298 | } | 299 | } |
299 | 300 | ||
300 | KRadioAction::KRadioAction( const QString& text, const QIconSet& pix, | 301 | KRadioAction::KRadioAction( const QString& text, const QIcon& pix, |
301 | const KShortcut& cut, | 302 | const KShortcut& cut, |
302 | const QObject* receiver, const char* slot, | 303 | const QObject* receiver, const char* slot, |
303 | QObject* parent, const char* name ) | 304 | QObject* parent, const char* name ) |
304 | : KToggleAction( text, pix, cut, receiver, slot, parent, name ) | 305 | : KToggleAction( text, pix, cut, receiver, slot, parent, name ) |
305 | { | 306 | { |
306 | } | 307 | } |
307 | 308 | ||
308 | KRadioAction::KRadioAction( const QString& text, const QString& pix, | 309 | KRadioAction::KRadioAction( const QString& text, const QString& pix, |
309 | const KShortcut& cut, | 310 | const KShortcut& cut, |
310 | const QObject* receiver, const char* slot, | 311 | const QObject* receiver, const char* slot, |
311 | QObject* parent, const char* name ) | 312 | QObject* parent, const char* name ) |
312 | : KToggleAction( text, pix, cut, receiver, slot, parent, name ) | 313 | : KToggleAction( text, pix, cut, receiver, slot, parent, name ) |
313 | { | 314 | { |
314 | } | 315 | } |
315 | 316 | ||
316 | KRadioAction::KRadioAction( QObject* parent, const char* name ) | 317 | KRadioAction::KRadioAction( QObject* parent, const char* name ) |
@@ -336,33 +337,33 @@ void KRadioAction::slotActivated() | |||
336 | KToggleAction::slotActivated(); | 337 | KToggleAction::slotActivated(); |
337 | } | 338 | } |
338 | 339 | ||
339 | class KSelectAction::KSelectActionPrivate | 340 | class KSelectAction::KSelectActionPrivate |
340 | { | 341 | { |
341 | public: | 342 | public: |
342 | KSelectActionPrivate() | 343 | KSelectActionPrivate() |
343 | { | 344 | { |
344 | m_edit = false; | 345 | m_edit = false; |
345 | m_menuAccelsEnabled = true; | 346 | m_menuAccelsEnabled = true; |
346 | m_menu = 0; | 347 | m_menu = 0; |
347 | m_current = -1; | 348 | m_current = -1; |
348 | m_comboWidth = -1; | 349 | m_comboWidth = -1; |
349 | } | 350 | } |
350 | bool m_edit; | 351 | bool m_edit; |
351 | bool m_menuAccelsEnabled; | 352 | bool m_menuAccelsEnabled; |
352 | QPopupMenu *m_menu; | 353 | Q3PopupMenu *m_menu; |
353 | int m_current; | 354 | int m_current; |
354 | int m_comboWidth; | 355 | int m_comboWidth; |
355 | QStringList m_list; | 356 | QStringList m_list; |
356 | 357 | ||
357 | QString makeMenuText( const QString &_text ) | 358 | QString makeMenuText( const QString &_text ) |
358 | { | 359 | { |
359 | if ( m_menuAccelsEnabled ) | 360 | if ( m_menuAccelsEnabled ) |
360 | return _text; | 361 | return _text; |
361 | QString text = _text; | 362 | QString text = _text; |
362 | uint i = 0; | 363 | uint i = 0; |
363 | while ( i < text.length() ) { | 364 | while ( i < text.length() ) { |
364 | if ( text.at( i ) == '&' ) { | 365 | if ( text.at( i ) == '&' ) { |
365 | text.insert( i, '&' ); | 366 | text.insert( i, '&' ); |
366 | i += 2; | 367 | i += 2; |
367 | } | 368 | } |
368 | else | 369 | else |
@@ -374,49 +375,49 @@ public: | |||
374 | 375 | ||
375 | KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, | 376 | KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, |
376 | QObject* parent, const char* name ) | 377 | QObject* parent, const char* name ) |
377 | : KAction( text, cut, parent, name ) | 378 | : KAction( text, cut, parent, name ) |
378 | { | 379 | { |
379 | d = new KSelectActionPrivate; | 380 | d = new KSelectActionPrivate; |
380 | } | 381 | } |
381 | 382 | ||
382 | KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, | 383 | KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, |
383 | const QObject* receiver, const char* slot, | 384 | const QObject* receiver, const char* slot, |
384 | QObject* parent, const char* name ) | 385 | QObject* parent, const char* name ) |
385 | : KAction( text, cut, receiver, slot, parent, name ) | 386 | : KAction( text, cut, receiver, slot, parent, name ) |
386 | { | 387 | { |
387 | d = new KSelectActionPrivate; | 388 | d = new KSelectActionPrivate; |
388 | } | 389 | } |
389 | 390 | ||
390 | KSelectAction::KSelectAction( const QString& text, const QIconSet& pix, | 391 | KSelectAction::KSelectAction( const QString& text, const QIcon& pix, |
391 | const KShortcut& cut, | 392 | const KShortcut& cut, |
392 | QObject* parent, const char* name ) | 393 | QObject* parent, const char* name ) |
393 | : KAction( text, pix, cut, parent, name ) | 394 | : KAction( text, pix, cut, parent, name ) |
394 | { | 395 | { |
395 | d = new KSelectActionPrivate; | 396 | d = new KSelectActionPrivate; |
396 | } | 397 | } |
397 | 398 | ||
398 | KSelectAction::KSelectAction( const QString& text, const QString& pix, | 399 | KSelectAction::KSelectAction( const QString& text, const QString& pix, |
399 | const KShortcut& cut, | 400 | const KShortcut& cut, |
400 | QObject* parent, const char* name ) | 401 | QObject* parent, const char* name ) |
401 | : KAction( text, pix, cut, parent, name ) | 402 | : KAction( text, pix, cut, parent, name ) |
402 | { | 403 | { |
403 | d = new KSelectActionPrivate; | 404 | d = new KSelectActionPrivate; |
404 | } | 405 | } |
405 | 406 | ||
406 | KSelectAction::KSelectAction( const QString& text, const QIconSet& pix, | 407 | KSelectAction::KSelectAction( const QString& text, const QIcon& pix, |
407 | const KShortcut& cut, | 408 | const KShortcut& cut, |
408 | const QObject* receiver, | 409 | const QObject* receiver, |
409 | const char* slot, QObject* parent, | 410 | const char* slot, QObject* parent, |
410 | const char* name ) | 411 | const char* name ) |
411 | : KAction( text, pix, cut, receiver, slot, parent, name ) | 412 | : KAction( text, pix, cut, receiver, slot, parent, name ) |
412 | { | 413 | { |
413 | d = new KSelectActionPrivate; | 414 | d = new KSelectActionPrivate; |
414 | } | 415 | } |
415 | 416 | ||
416 | KSelectAction::KSelectAction( const QString& text, const QString& pix, | 417 | KSelectAction::KSelectAction( const QString& text, const QString& pix, |
417 | const KShortcut& cut, | 418 | const KShortcut& cut, |
418 | const QObject* receiver, | 419 | const QObject* receiver, |
419 | const char* slot, QObject* parent, | 420 | const char* slot, QObject* parent, |
420 | const char* name ) | 421 | const char* name ) |
421 | : KAction( text, pix, cut, receiver, slot, parent, name ) | 422 | : KAction( text, pix, cut, receiver, slot, parent, name ) |
422 | { | 423 | { |
@@ -426,33 +427,33 @@ KSelectAction::KSelectAction( const QString& text, const QString& pix, | |||
426 | KSelectAction::KSelectAction( QObject* parent, const char* name ) | 427 | KSelectAction::KSelectAction( QObject* parent, const char* name ) |
427 | : KAction( parent, name ) | 428 | : KAction( parent, name ) |
428 | { | 429 | { |
429 | d = new KSelectActionPrivate; | 430 | d = new KSelectActionPrivate; |
430 | } | 431 | } |
431 | 432 | ||
432 | KSelectAction::~KSelectAction() | 433 | KSelectAction::~KSelectAction() |
433 | { | 434 | { |
434 | assert(d); | 435 | assert(d); |
435 | delete d->m_menu; | 436 | delete d->m_menu; |
436 | delete d; d = 0; | 437 | delete d; d = 0; |
437 | } | 438 | } |
438 | 439 | ||
439 | void KSelectAction::setCurrentItem( int id ) | 440 | void KSelectAction::setCurrentItem( int id ) |
440 | { | 441 | { |
441 | if ( id >= (int)d->m_list.count() ) { | 442 | if ( id >= (int)d->m_list.count() ) { |
442 | ASSERT(id < (int)d->m_list.count()); | 443 | Q_ASSERT(id < (int)d->m_list.count()); |
443 | return; | 444 | return; |
444 | } | 445 | } |
445 | 446 | ||
446 | if ( d->m_menu ) | 447 | if ( d->m_menu ) |
447 | { | 448 | { |
448 | if ( d->m_current >= 0 ) | 449 | if ( d->m_current >= 0 ) |
449 | d->m_menu->setItemChecked( d->m_current, false ); | 450 | d->m_menu->setItemChecked( d->m_current, false ); |
450 | if ( id >= 0 ) | 451 | if ( id >= 0 ) |
451 | { | 452 | { |
452 | //US qDebug("KSelectAction::setCurrentItem %i", id); | 453 | //US qDebug("KSelectAction::setCurrentItem %i", id); |
453 | d->m_menu->setItemChecked( id, true ); | 454 | d->m_menu->setItemChecked( id, true ); |
454 | } | 455 | } |
455 | } | 456 | } |
456 | 457 | ||
457 | d->m_current = id; | 458 | d->m_current = id; |
458 | 459 | ||
@@ -466,39 +467,39 @@ void KSelectAction::setCurrentItem( int id ) | |||
466 | // emit activated( currentText() ); | 467 | // emit activated( currentText() ); |
467 | } | 468 | } |
468 | 469 | ||
469 | void KSelectAction::setComboWidth( int width ) | 470 | void KSelectAction::setComboWidth( int width ) |
470 | { | 471 | { |
471 | if ( width < 0 ) | 472 | if ( width < 0 ) |
472 | return; | 473 | return; |
473 | 474 | ||
474 | d->m_comboWidth=width; | 475 | d->m_comboWidth=width; |
475 | 476 | ||
476 | int len = containerCount(); | 477 | int len = containerCount(); |
477 | 478 | ||
478 | for( int i = 0; i < len; ++i ) | 479 | for( int i = 0; i < len; ++i ) |
479 | updateComboWidth( i ); | 480 | updateComboWidth( i ); |
480 | 481 | ||
481 | } | 482 | } |
482 | QPopupMenu* KSelectAction::popupMenu() const | 483 | Q3PopupMenu* KSelectAction::popupMenu() const |
483 | { | 484 | { |
484 | kdDebug(129) << "KSelectAction::popupMenu()" << endl; // remove -- ellis | 485 | kdDebug(129) << "KSelectAction::popupMenu()" << endl; // remove -- ellis |
485 | if ( !d->m_menu ) | 486 | if ( !d->m_menu ) |
486 | { | 487 | { |
487 | //US d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()"); | 488 | //US d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()"); |
488 | d->m_menu = new QPopupMenu(0L, "QSelectAction::popupMenu()"); | 489 | d->m_menu = new Q3PopupMenu(0L, "QSelectAction::popupMenu()"); |
489 | setupMenu(); | 490 | setupMenu(); |
490 | if ( d->m_current >= 0 ) | 491 | if ( d->m_current >= 0 ) |
491 | d->m_menu->setItemChecked( d->m_current, true ); | 492 | d->m_menu->setItemChecked( d->m_current, true ); |
492 | } | 493 | } |
493 | 494 | ||
494 | return d->m_menu; | 495 | return d->m_menu; |
495 | } | 496 | } |
496 | 497 | ||
497 | void KSelectAction::setupMenu() const | 498 | void KSelectAction::setupMenu() const |
498 | { | 499 | { |
499 | if ( !d->m_menu ) | 500 | if ( !d->m_menu ) |
500 | return; | 501 | return; |
501 | d->m_menu->clear(); | 502 | d->m_menu->clear(); |
502 | 503 | ||
503 | QStringList::ConstIterator it = d->m_list.begin(); | 504 | QStringList::ConstIterator it = d->m_list.begin(); |
504 | for( uint id = 0; it != d->m_list.end(); ++it, ++id ) { | 505 | for( uint id = 0; it != d->m_list.end(); ++it, ++id ) { |
@@ -630,38 +631,38 @@ void KSelectAction::updateItems( int id ) | |||
630 | cb->insertItem( *it ); | 631 | cb->insertItem( *it ); |
631 | // Ok, this currently doesn't work due to a bug in QComboBox | 632 | // Ok, this currently doesn't work due to a bug in QComboBox |
632 | // (the sizehint is cached for ever and never recalculated) | 633 | // (the sizehint is cached for ever and never recalculated) |
633 | // Bug reported (against Qt 2.3.1). | 634 | // Bug reported (against Qt 2.3.1). |
634 | cb->setMinimumWidth( cb->sizeHint().width() ); | 635 | cb->setMinimumWidth( cb->sizeHint().width() ); |
635 | } | 636 | } |
636 | } | 637 | } |
637 | 638 | ||
638 | } | 639 | } |
639 | 640 | ||
640 | int KSelectAction::plug( QWidget *widget, int index ) | 641 | int KSelectAction::plug( QWidget *widget, int index ) |
641 | { | 642 | { |
642 | //US if (kapp && !kapp->authorizeKAction(name())) | 643 | //US if (kapp && !kapp->authorizeKAction(name())) |
643 | //US return -1; | 644 | //US return -1; |
644 | 645 | ||
645 | kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis | 646 | kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis |
646 | if ( widget->inherits("QPopupMenu") ) | 647 | if ( widget->inherits("Q3PopupMenu") ) |
647 | { | 648 | { |
648 | // Create the PopupMenu and store it in m_menu | 649 | // Create the PopupMenu and store it in m_menu |
649 | (void)popupMenu(); | 650 | (void)popupMenu(); |
650 | 651 | ||
651 | QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); | 652 | Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); |
652 | int id; | 653 | int id; |
653 | 654 | ||
654 | if ( hasIconSet() ) | 655 | if ( hasIconSet() ) |
655 | id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index ); | 656 | id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index ); |
656 | else | 657 | else |
657 | id = menu->insertItem( text(), d->m_menu, -1, index ); | 658 | id = menu->insertItem( text(), d->m_menu, -1, index ); |
658 | 659 | ||
659 | if ( !isEnabled() ) | 660 | if ( !isEnabled() ) |
660 | menu->setItemEnabled( id, false ); | 661 | menu->setItemEnabled( id, false ); |
661 | 662 | ||
662 | QString wth = whatsThis(); | 663 | QString wth = whatsThis(); |
663 | if ( !wth.isEmpty() ) | 664 | if ( !wth.isEmpty() ) |
664 | menu->setWhatsThis( id, wth ); | 665 | menu->setWhatsThis( id, wth ); |
665 | 666 | ||
666 | addContainer( menu, id ); | 667 | addContainer( menu, id ); |
667 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); | 668 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); |
@@ -669,33 +670,33 @@ int KSelectAction::plug( QWidget *widget, int index ) | |||
669 | return containerCount() - 1; | 670 | return containerCount() - 1; |
670 | } | 671 | } |
671 | else if ( widget->inherits("KToolBar") ) | 672 | else if ( widget->inherits("KToolBar") ) |
672 | { | 673 | { |
673 | 674 | ||
674 | KToolBar* bar = static_cast<KToolBar*>( widget ); | 675 | KToolBar* bar = static_cast<KToolBar*>( widget ); |
675 | int id_ = KAction::getToolButtonID(); | 676 | int id_ = KAction::getToolButtonID(); |
676 | bar->insertCombo( comboItems(), id_, isEditable(), | 677 | bar->insertCombo( comboItems(), id_, isEditable(), |
677 | SIGNAL( activated( const QString & ) ), this, | 678 | SIGNAL( activated( const QString & ) ), this, |
678 | SLOT( slotActivated( const QString & ) ), isEnabled(), | 679 | SLOT( slotActivated( const QString & ) ), isEnabled(), |
679 | toolTip(), -1, index ); | 680 | toolTip(), -1, index ); |
680 | 681 | ||
681 | KComboBox *cb = bar->getCombo( id_ ); | 682 | KComboBox *cb = bar->getCombo( id_ ); |
682 | if ( cb ) | 683 | if ( cb ) |
683 | { | 684 | { |
684 | cb->setMaximumHeight( 34 ); | 685 | cb->setMaximumHeight( 34 ); |
685 | if (!isEditable()) cb->setFocusPolicy(QWidget::NoFocus); | 686 | if (!isEditable()) cb->setFocusPolicy(Qt::NoFocus); |
686 | cb->setMinimumWidth( cb->sizeHint().width() ); | 687 | cb->setMinimumWidth( cb->sizeHint().width() ); |
687 | if ( d->m_comboWidth > 0 ) | 688 | if ( d->m_comboWidth > 0 ) |
688 | { | 689 | { |
689 | cb->setMinimumWidth( d->m_comboWidth ); | 690 | cb->setMinimumWidth( d->m_comboWidth ); |
690 | cb->setMaximumWidth( d->m_comboWidth ); | 691 | cb->setMaximumWidth( d->m_comboWidth ); |
691 | } | 692 | } |
692 | cb->setInsertionPolicy( QComboBox::NoInsertion ); | 693 | cb->setInsertionPolicy( QComboBox::NoInsertion ); |
693 | //US QWhatsThis::add( cb, whatsThis() ); | 694 | //US QWhatsThis::add( cb, whatsThis() ); |
694 | } | 695 | } |
695 | 696 | ||
696 | addContainer( bar, id_ ); | 697 | addContainer( bar, id_ ); |
697 | 698 | ||
698 | connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); | 699 | connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); |
699 | 700 | ||
700 | updateCurrentItem( containerCount() - 1 ); | 701 | updateCurrentItem( containerCount() - 1 ); |
701 | 702 | ||
@@ -839,49 +840,49 @@ KListAction::KListAction( const QString& text, const KShortcut& cut, | |||
839 | QObject* parent, const char* name ) | 840 | QObject* parent, const char* name ) |
840 | : KSelectAction( text, cut, parent, name ) | 841 | : KSelectAction( text, cut, parent, name ) |
841 | { | 842 | { |
842 | d = new KListActionPrivate; | 843 | d = new KListActionPrivate; |
843 | } | 844 | } |
844 | 845 | ||
845 | KListAction::KListAction( const QString& text, const KShortcut& cut, | 846 | KListAction::KListAction( const QString& text, const KShortcut& cut, |
846 | const QObject* receiver, const char* slot, | 847 | const QObject* receiver, const char* slot, |
847 | QObject* parent, const char* name ) | 848 | QObject* parent, const char* name ) |
848 | : KSelectAction( text, cut, parent, name ) | 849 | : KSelectAction( text, cut, parent, name ) |
849 | { | 850 | { |
850 | d = new KListActionPrivate; | 851 | d = new KListActionPrivate; |
851 | if ( receiver ) | 852 | if ( receiver ) |
852 | connect( this, SIGNAL( activated( int ) ), receiver, slot ); | 853 | connect( this, SIGNAL( activated( int ) ), receiver, slot ); |
853 | } | 854 | } |
854 | 855 | ||
855 | KListAction::KListAction( const QString& text, const QIconSet& pix, | 856 | KListAction::KListAction( const QString& text, const QIcon& pix, |
856 | const KShortcut& cut, | 857 | const KShortcut& cut, |
857 | QObject* parent, const char* name ) | 858 | QObject* parent, const char* name ) |
858 | : KSelectAction( text, pix, cut, parent, name ) | 859 | : KSelectAction( text, pix, cut, parent, name ) |
859 | { | 860 | { |
860 | d = new KListActionPrivate; | 861 | d = new KListActionPrivate; |
861 | } | 862 | } |
862 | 863 | ||
863 | KListAction::KListAction( const QString& text, const QString& pix, | 864 | KListAction::KListAction( const QString& text, const QString& pix, |
864 | const KShortcut& cut, | 865 | const KShortcut& cut, |
865 | QObject* parent, const char* name ) | 866 | QObject* parent, const char* name ) |
866 | : KSelectAction( text, pix, cut, parent, name ) | 867 | : KSelectAction( text, pix, cut, parent, name ) |
867 | { | 868 | { |
868 | d = new KListActionPrivate; | 869 | d = new KListActionPrivate; |
869 | } | 870 | } |
870 | 871 | ||
871 | KListAction::KListAction( const QString& text, const QIconSet& pix, | 872 | KListAction::KListAction( const QString& text, const QIcon& pix, |
872 | const KShortcut& cut, const QObject* receiver, | 873 | const KShortcut& cut, const QObject* receiver, |
873 | const char* slot, QObject* parent, | 874 | const char* slot, QObject* parent, |
874 | const char* name ) | 875 | const char* name ) |
875 | : KSelectAction( text, pix, cut, parent, name ) | 876 | : KSelectAction( text, pix, cut, parent, name ) |
876 | { | 877 | { |
877 | d = new KListActionPrivate; | 878 | d = new KListActionPrivate; |
878 | if ( receiver ) | 879 | if ( receiver ) |
879 | connect( this, SIGNAL( activated( int ) ), receiver, slot ); | 880 | connect( this, SIGNAL( activated( int ) ), receiver, slot ); |
880 | } | 881 | } |
881 | 882 | ||
882 | KListAction::KListAction( const QString& text, const QString& pix, | 883 | KListAction::KListAction( const QString& text, const QString& pix, |
883 | const KShortcut& cut, const QObject* receiver, | 884 | const KShortcut& cut, const QObject* receiver, |
884 | const char* slot, QObject* parent, | 885 | const char* slot, QObject* parent, |
885 | const char* name ) | 886 | const char* name ) |
886 | : KSelectAction( text, pix, cut, parent, name ) | 887 | : KSelectAction( text, pix, cut, parent, name ) |
887 | { | 888 | { |
@@ -952,59 +953,59 @@ KRecentFilesAction::KRecentFilesAction( const QString& text, | |||
952 | const char* slot, | 953 | const char* slot, |
953 | QObject* parent, const char* name, | 954 | QObject* parent, const char* name, |
954 | uint maxItems ) | 955 | uint maxItems ) |
955 | : KListAction( text, cut, parent, name) | 956 | : KListAction( text, cut, parent, name) |
956 | { | 957 | { |
957 | d = new KRecentFilesActionPrivate; | 958 | d = new KRecentFilesActionPrivate; |
958 | d->m_maxItems = maxItems; | 959 | d->m_maxItems = maxItems; |
959 | 960 | ||
960 | init(); | 961 | init(); |
961 | 962 | ||
962 | if ( receiver ) | 963 | if ( receiver ) |
963 | connect( this, SIGNAL(urlSelected(const KURL&)), | 964 | connect( this, SIGNAL(urlSelected(const KURL&)), |
964 | receiver, slot ); | 965 | receiver, slot ); |
965 | } | 966 | } |
966 | 967 | ||
967 | KRecentFilesAction::KRecentFilesAction( const QString& text, | 968 | KRecentFilesAction::KRecentFilesAction( const QString& text, |
968 | const QIconSet& pix, | 969 | const QIcon& pix, |
969 | const KShortcut& cut, | 970 | const KShortcut& cut, |
970 | QObject* parent, const char* name, | 971 | QObject* parent, const char* name, |
971 | uint maxItems ) | 972 | uint maxItems ) |
972 | : KListAction( text, pix, cut, parent, name) | 973 | : KListAction( text, pix, cut, parent, name) |
973 | { | 974 | { |
974 | d = new KRecentFilesActionPrivate; | 975 | d = new KRecentFilesActionPrivate; |
975 | d->m_maxItems = maxItems; | 976 | d->m_maxItems = maxItems; |
976 | 977 | ||
977 | init(); | 978 | init(); |
978 | } | 979 | } |
979 | 980 | ||
980 | KRecentFilesAction::KRecentFilesAction( const QString& text, | 981 | KRecentFilesAction::KRecentFilesAction( const QString& text, |
981 | const QString& pix, | 982 | const QString& pix, |
982 | const KShortcut& cut, | 983 | const KShortcut& cut, |
983 | QObject* parent, const char* name, | 984 | QObject* parent, const char* name, |
984 | uint maxItems ) | 985 | uint maxItems ) |
985 | : KListAction( text, pix, cut, parent, name) | 986 | : KListAction( text, pix, cut, parent, name) |
986 | { | 987 | { |
987 | d = new KRecentFilesActionPrivate; | 988 | d = new KRecentFilesActionPrivate; |
988 | d->m_maxItems = maxItems; | 989 | d->m_maxItems = maxItems; |
989 | 990 | ||
990 | init(); | 991 | init(); |
991 | } | 992 | } |
992 | 993 | ||
993 | KRecentFilesAction::KRecentFilesAction( const QString& text, | 994 | KRecentFilesAction::KRecentFilesAction( const QString& text, |
994 | const QIconSet& pix, | 995 | const QIcon& pix, |
995 | const KShortcut& cut, | 996 | const KShortcut& cut, |
996 | const QObject* receiver, | 997 | const QObject* receiver, |
997 | const char* slot, | 998 | const char* slot, |
998 | QObject* parent, const char* name, | 999 | QObject* parent, const char* name, |
999 | uint maxItems ) | 1000 | uint maxItems ) |
1000 | : KListAction( text, pix, cut, parent, name) | 1001 | : KListAction( text, pix, cut, parent, name) |
1001 | { | 1002 | { |
1002 | d = new KRecentFilesActionPrivate; | 1003 | d = new KRecentFilesActionPrivate; |
1003 | d->m_maxItems = maxItems; | 1004 | d->m_maxItems = maxItems; |
1004 | 1005 | ||
1005 | init(); | 1006 | init(); |
1006 | 1007 | ||
1007 | if ( receiver ) | 1008 | if ( receiver ) |
1008 | connect( this, SIGNAL(urlSelected(const KURL&)), | 1009 | connect( this, SIGNAL(urlSelected(const KURL&)), |
1009 | receiver, slot ); | 1010 | receiver, slot ); |
1010 | } | 1011 | } |
@@ -1188,55 +1189,55 @@ KFontAction::KFontAction( const QString& text, | |||
1188 | get_fonts( d->m_fonts ); | 1189 | get_fonts( d->m_fonts ); |
1189 | KSelectAction::setItems( d->m_fonts ); | 1190 | KSelectAction::setItems( d->m_fonts ); |
1190 | setEditable( true ); | 1191 | setEditable( true ); |
1191 | } | 1192 | } |
1192 | 1193 | ||
1193 | KFontAction::KFontAction( const QString& text, const KShortcut& cut, | 1194 | KFontAction::KFontAction( const QString& text, const KShortcut& cut, |
1194 | const QObject* receiver, const char* slot, | 1195 | const QObject* receiver, const char* slot, |
1195 | QObject* parent, const char* name ) | 1196 | QObject* parent, const char* name ) |
1196 | : KSelectAction( text, cut, receiver, slot, parent, name ) | 1197 | : KSelectAction( text, cut, receiver, slot, parent, name ) |
1197 | { | 1198 | { |
1198 | d = new KFontActionPrivate; | 1199 | d = new KFontActionPrivate; |
1199 | get_fonts( d->m_fonts ); | 1200 | get_fonts( d->m_fonts ); |
1200 | KSelectAction::setItems( d->m_fonts ); | 1201 | KSelectAction::setItems( d->m_fonts ); |
1201 | setEditable( true ); | 1202 | setEditable( true ); |
1202 | } | 1203 | } |
1203 | 1204 | ||
1204 | KFontAction::KFontAction( const QString& text, const QIconSet& pix, | 1205 | KFontAction::KFontAction( const QString& text, const QIcon& pix, |
1205 | const KShortcut& cut, | 1206 | const KShortcut& cut, |
1206 | QObject* parent, const char* name ) | 1207 | QObject* parent, const char* name ) |
1207 | : KSelectAction( text, pix, cut, parent, name ) | 1208 | : KSelectAction( text, pix, cut, parent, name ) |
1208 | { | 1209 | { |
1209 | d = new KFontActionPrivate; | 1210 | d = new KFontActionPrivate; |
1210 | get_fonts( d->m_fonts ); | 1211 | get_fonts( d->m_fonts ); |
1211 | KSelectAction::setItems( d->m_fonts ); | 1212 | KSelectAction::setItems( d->m_fonts ); |
1212 | setEditable( true ); | 1213 | setEditable( true ); |
1213 | } | 1214 | } |
1214 | 1215 | ||
1215 | KFontAction::KFontAction( const QString& text, const QString& pix, | 1216 | KFontAction::KFontAction( const QString& text, const QString& pix, |
1216 | const KShortcut& cut, | 1217 | const KShortcut& cut, |
1217 | QObject* parent, const char* name ) | 1218 | QObject* parent, const char* name ) |
1218 | : KSelectAction( text, pix, cut, parent, name ) | 1219 | : KSelectAction( text, pix, cut, parent, name ) |
1219 | { | 1220 | { |
1220 | d = new KFontActionPrivate; | 1221 | d = new KFontActionPrivate; |
1221 | get_fonts( d->m_fonts ); | 1222 | get_fonts( d->m_fonts ); |
1222 | KSelectAction::setItems( d->m_fonts ); | 1223 | KSelectAction::setItems( d->m_fonts ); |
1223 | setEditable( true ); | 1224 | setEditable( true ); |
1224 | } | 1225 | } |
1225 | 1226 | ||
1226 | KFontAction::KFontAction( const QString& text, const QIconSet& pix, | 1227 | KFontAction::KFontAction( const QString& text, const QIcon& pix, |
1227 | const KShortcut& cut, | 1228 | const KShortcut& cut, |
1228 | const QObject* receiver, const char* slot, | 1229 | const QObject* receiver, const char* slot, |
1229 | QObject* parent, const char* name ) | 1230 | QObject* parent, const char* name ) |
1230 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) | 1231 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) |
1231 | { | 1232 | { |
1232 | d = new KFontActionPrivate; | 1233 | d = new KFontActionPrivate; |
1233 | get_fonts( d->m_fonts ); | 1234 | get_fonts( d->m_fonts ); |
1234 | KSelectAction::setItems( d->m_fonts ); | 1235 | KSelectAction::setItems( d->m_fonts ); |
1235 | setEditable( true ); | 1236 | setEditable( true ); |
1236 | } | 1237 | } |
1237 | 1238 | ||
1238 | KFontAction::KFontAction( const QString& text, const QString& pix, | 1239 | KFontAction::KFontAction( const QString& text, const QString& pix, |
1239 | const KShortcut& cut, | 1240 | const KShortcut& cut, |
1240 | const QObject* receiver, const char* slot, | 1241 | const QObject* receiver, const char* slot, |
1241 | QObject* parent, const char* name ) | 1242 | QObject* parent, const char* name ) |
1242 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) | 1243 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) |
@@ -1348,49 +1349,49 @@ KFontSizeAction::KFontSizeAction( const QString& text, | |||
1348 | const KShortcut& cut, | 1349 | const KShortcut& cut, |
1349 | QObject* parent, const char* name ) | 1350 | QObject* parent, const char* name ) |
1350 | : KSelectAction( text, cut, parent, name ) | 1351 | : KSelectAction( text, cut, parent, name ) |
1351 | { | 1352 | { |
1352 | init(); | 1353 | init(); |
1353 | } | 1354 | } |
1354 | 1355 | ||
1355 | KFontSizeAction::KFontSizeAction( const QString& text, | 1356 | KFontSizeAction::KFontSizeAction( const QString& text, |
1356 | const KShortcut& cut, | 1357 | const KShortcut& cut, |
1357 | const QObject* receiver, const char* slot, | 1358 | const QObject* receiver, const char* slot, |
1358 | QObject* parent, const char* name ) | 1359 | QObject* parent, const char* name ) |
1359 | : KSelectAction( text, cut, receiver, slot, parent, name ) | 1360 | : KSelectAction( text, cut, receiver, slot, parent, name ) |
1360 | { | 1361 | { |
1361 | init(); | 1362 | init(); |
1362 | } | 1363 | } |
1363 | 1364 | ||
1364 | KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix, | 1365 | KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix, |
1365 | const KShortcut& cut, | 1366 | const KShortcut& cut, |
1366 | QObject* parent, const char* name ) | 1367 | QObject* parent, const char* name ) |
1367 | : KSelectAction( text, pix, cut, parent, name ) | 1368 | : KSelectAction( text, pix, cut, parent, name ) |
1368 | { | 1369 | { |
1369 | init(); | 1370 | init(); |
1370 | } | 1371 | } |
1371 | 1372 | ||
1372 | KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, | 1373 | KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, |
1373 | const KShortcut& cut, | 1374 | const KShortcut& cut, |
1374 | QObject* parent, const char* name ) | 1375 | QObject* parent, const char* name ) |
1375 | : KSelectAction( text, pix, cut, parent, name ) | 1376 | : KSelectAction( text, pix, cut, parent, name ) |
1376 | { | 1377 | { |
1377 | init(); | 1378 | init(); |
1378 | } | 1379 | } |
1379 | 1380 | ||
1380 | KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix, | 1381 | KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix, |
1381 | const KShortcut& cut, | 1382 | const KShortcut& cut, |
1382 | const QObject* receiver, | 1383 | const QObject* receiver, |
1383 | const char* slot, QObject* parent, | 1384 | const char* slot, QObject* parent, |
1384 | const char* name ) | 1385 | const char* name ) |
1385 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) | 1386 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) |
1386 | { | 1387 | { |
1387 | init(); | 1388 | init(); |
1388 | } | 1389 | } |
1389 | 1390 | ||
1390 | KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, | 1391 | KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, |
1391 | const KShortcut& cut, | 1392 | const KShortcut& cut, |
1392 | const QObject* receiver, | 1393 | const QObject* receiver, |
1393 | const char* slot, QObject* parent, | 1394 | const char* slot, QObject* parent, |
1394 | const char* name ) | 1395 | const char* name ) |
1395 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) | 1396 | : KSelectAction( text, pix, cut, receiver, slot, parent, name ) |
1396 | { | 1397 | { |
@@ -1401,69 +1402,69 @@ KFontSizeAction::KFontSizeAction( QObject* parent, const char* name ) | |||
1401 | : KSelectAction( parent, name ) | 1402 | : KSelectAction( parent, name ) |
1402 | { | 1403 | { |
1403 | init(); | 1404 | init(); |
1404 | } | 1405 | } |
1405 | 1406 | ||
1406 | KFontSizeAction::~KFontSizeAction() | 1407 | KFontSizeAction::~KFontSizeAction() |
1407 | { | 1408 | { |
1408 | delete d; | 1409 | delete d; |
1409 | d = 0; | 1410 | d = 0; |
1410 | } | 1411 | } |
1411 | 1412 | ||
1412 | void KFontSizeAction::init() | 1413 | void KFontSizeAction::init() |
1413 | { | 1414 | { |
1414 | d = new KFontSizeActionPrivate; | 1415 | d = new KFontSizeActionPrivate; |
1415 | 1416 | ||
1416 | setEditable( true ); | 1417 | setEditable( true ); |
1417 | QValueList<int> sizes = get_standard_font_sizes(); | 1418 | Q3ValueList<int> sizes = get_standard_font_sizes(); |
1418 | QStringList lst; | 1419 | QStringList lst; |
1419 | for ( QValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it ) | 1420 | for ( Q3ValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it ) |
1420 | lst.append( QString::number( *it ) ); | 1421 | lst.append( QString::number( *it ) ); |
1421 | 1422 | ||
1422 | setItems( lst ); | 1423 | setItems( lst ); |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | void KFontSizeAction::setFontSize( int size ) | 1426 | void KFontSizeAction::setFontSize( int size ) |
1426 | { | 1427 | { |
1427 | if ( size == fontSize() ) { | 1428 | if ( size == fontSize() ) { |
1428 | setCurrentItem( items().findIndex( QString::number( size ) ) ); | 1429 | setCurrentItem( items().findIndex( QString::number( size ) ) ); |
1429 | return; | 1430 | return; |
1430 | } | 1431 | } |
1431 | 1432 | ||
1432 | if ( size < 1 ) { | 1433 | if ( size < 1 ) { |
1433 | kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl; | 1434 | kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl; |
1434 | return; | 1435 | return; |
1435 | } | 1436 | } |
1436 | 1437 | ||
1437 | int index = items().findIndex( QString::number( size ) ); | 1438 | int index = items().findIndex( QString::number( size ) ); |
1438 | if ( index == -1 ) { | 1439 | if ( index == -1 ) { |
1439 | // Insert at the correct position in the list (to keep sorting) | 1440 | // Insert at the correct position in the list (to keep sorting) |
1440 | QValueList<int> lst; | 1441 | Q3ValueList<int> lst; |
1441 | // Convert to list of ints | 1442 | // Convert to list of ints |
1442 | QStringList itemsList = items(); | 1443 | QStringList itemsList = items(); |
1443 | for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it) | 1444 | for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it) |
1444 | lst.append( (*it).toInt() ); | 1445 | lst.append( (*it).toInt() ); |
1445 | // New size | 1446 | // New size |
1446 | lst.append( size ); | 1447 | lst.append( size ); |
1447 | // Sort the list | 1448 | // Sort the list |
1448 | qDebug("KFontSizeAction::setFontSize heapsort not found."); | 1449 | qDebug("KFontSizeAction::setFontSize heapsort not found."); |
1449 | //US has to be fixed | 1450 | //US has to be fixed |
1450 | //US qHeapSort( lst ); | 1451 | //US qHeapSort( lst ); |
1451 | // Convert back to string list | 1452 | // Convert back to string list |
1452 | QStringList strLst; | 1453 | QStringList strLst; |
1453 | for (QValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it) | 1454 | for (Q3ValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it) |
1454 | strLst.append( QString::number(*it) ); | 1455 | strLst.append( QString::number(*it) ); |
1455 | KSelectAction::setItems( strLst ); | 1456 | KSelectAction::setItems( strLst ); |
1456 | // Find new current item | 1457 | // Find new current item |
1457 | index = lst.findIndex( size ); | 1458 | index = lst.findIndex( size ); |
1458 | setCurrentItem( index ); | 1459 | setCurrentItem( index ); |
1459 | } | 1460 | } |
1460 | else | 1461 | else |
1461 | setCurrentItem( index ); | 1462 | setCurrentItem( index ); |
1462 | 1463 | ||
1463 | 1464 | ||
1464 | //emit KAction::activated(); | 1465 | //emit KAction::activated(); |
1465 | //emit activated( index ); | 1466 | //emit activated( index ); |
1466 | //emit activated( QString::number( size ) ); | 1467 | //emit activated( QString::number( size ) ); |
1467 | //emit fontSizeChanged( size ); | 1468 | //emit fontSizeChanged( size ); |
1468 | } | 1469 | } |
1469 | 1470 | ||
@@ -1479,93 +1480,93 @@ void KFontSizeAction::slotActivated( int index ) | |||
1479 | emit fontSizeChanged( items()[ index ].toInt() ); | 1480 | emit fontSizeChanged( items()[ index ].toInt() ); |
1480 | } | 1481 | } |
1481 | 1482 | ||
1482 | void KFontSizeAction::slotActivated( const QString& size ) | 1483 | void KFontSizeAction::slotActivated( const QString& size ) |
1483 | { | 1484 | { |
1484 | setFontSize( size.toInt() ); // insert sorted first | 1485 | setFontSize( size.toInt() ); // insert sorted first |
1485 | KSelectAction::slotActivated( size ); | 1486 | KSelectAction::slotActivated( size ); |
1486 | emit fontSizeChanged( size.toInt() ); | 1487 | emit fontSizeChanged( size.toInt() ); |
1487 | } | 1488 | } |
1488 | 1489 | ||
1489 | class KActionMenu::KActionMenuPrivate | 1490 | class KActionMenu::KActionMenuPrivate |
1490 | { | 1491 | { |
1491 | public: | 1492 | public: |
1492 | KActionMenuPrivate() | 1493 | KActionMenuPrivate() |
1493 | { | 1494 | { |
1494 | //US m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate"); | 1495 | //US m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate"); |
1495 | m_popup = new QPopupMenu(0L,"KActionMenu::KActionMenuPrivate"); | 1496 | m_popup = new Q3PopupMenu(0L,"KActionMenu::KActionMenuPrivate"); |
1496 | m_delayed = true; | 1497 | m_delayed = true; |
1497 | m_stickyMenu = true; | 1498 | m_stickyMenu = true; |
1498 | } | 1499 | } |
1499 | ~KActionMenuPrivate() | 1500 | ~KActionMenuPrivate() |
1500 | { | 1501 | { |
1501 | delete m_popup; m_popup = 0; | 1502 | delete m_popup; m_popup = 0; |
1502 | } | 1503 | } |
1503 | 1504 | ||
1504 | //US KPopupMenu *m_popup; | 1505 | //US KPopupMenu *m_popup; |
1505 | QPopupMenu *m_popup; | 1506 | Q3PopupMenu *m_popup; |
1506 | bool m_delayed; | 1507 | bool m_delayed; |
1507 | bool m_stickyMenu; | 1508 | bool m_stickyMenu; |
1508 | }; | 1509 | }; |
1509 | 1510 | ||
1510 | KActionMenu::KActionMenu( QObject* parent, const char* name ) | 1511 | KActionMenu::KActionMenu( QObject* parent, const char* name ) |
1511 | : KAction( parent, name ) | 1512 | : KAction( parent, name ) |
1512 | { | 1513 | { |
1513 | d = new KActionMenuPrivate; | 1514 | d = new KActionMenuPrivate; |
1514 | setShortcutConfigurable( false ); | 1515 | setShortcutConfigurable( false ); |
1515 | } | 1516 | } |
1516 | 1517 | ||
1517 | KActionMenu::KActionMenu( const QString& text, QObject* parent, | 1518 | KActionMenu::KActionMenu( const QString& text, QObject* parent, |
1518 | const char* name ) | 1519 | const char* name ) |
1519 | : KAction( text, 0, parent, name ) | 1520 | : KAction( text, 0, parent, name ) |
1520 | { | 1521 | { |
1521 | d = new KActionMenuPrivate; | 1522 | d = new KActionMenuPrivate; |
1522 | setShortcutConfigurable( false ); | 1523 | setShortcutConfigurable( false ); |
1523 | } | 1524 | } |
1524 | 1525 | ||
1525 | KActionMenu::KActionMenu( const QString& text, const QIconSet& icon, | 1526 | KActionMenu::KActionMenu( const QString& text, const QIcon& icon, |
1526 | QObject* parent, const char* name ) | 1527 | QObject* parent, const char* name ) |
1527 | : KAction( text, icon, 0, parent, name ) | 1528 | : KAction( text, icon, 0, parent, name ) |
1528 | { | 1529 | { |
1529 | d = new KActionMenuPrivate; | 1530 | d = new KActionMenuPrivate; |
1530 | setShortcutConfigurable( false ); | 1531 | setShortcutConfigurable( false ); |
1531 | } | 1532 | } |
1532 | 1533 | ||
1533 | KActionMenu::KActionMenu( const QString& text, const QString& icon, | 1534 | KActionMenu::KActionMenu( const QString& text, const QString& icon, |
1534 | QObject* parent, const char* name ) | 1535 | QObject* parent, const char* name ) |
1535 | : KAction( text, icon, 0, parent, name ) | 1536 | : KAction( text, icon, 0, parent, name ) |
1536 | { | 1537 | { |
1537 | d = new KActionMenuPrivate; | 1538 | d = new KActionMenuPrivate; |
1538 | setShortcutConfigurable( false ); | 1539 | setShortcutConfigurable( false ); |
1539 | } | 1540 | } |
1540 | 1541 | ||
1541 | KActionMenu::~KActionMenu() | 1542 | KActionMenu::~KActionMenu() |
1542 | { | 1543 | { |
1543 | unplugAll(); | 1544 | unplugAll(); |
1544 | kdDebug(129) << "KActionMenu::~KActionMenu()" << endl; // ellis | 1545 | kdDebug(129) << "KActionMenu::~KActionMenu()" << endl; // ellis |
1545 | delete d; d = 0; | 1546 | delete d; d = 0; |
1546 | } | 1547 | } |
1547 | 1548 | ||
1548 | void KActionMenu::popup( const QPoint& global ) | 1549 | void KActionMenu::popup( const QPoint& global ) |
1549 | { | 1550 | { |
1550 | popupMenu()->popup( global ); | 1551 | popupMenu()->popup( global ); |
1551 | } | 1552 | } |
1552 | 1553 | ||
1553 | 1554 | ||
1554 | //US KPopupMenu* KActionMenu::popupMenu() const | 1555 | //US KPopupMenu* KActionMenu::popupMenu() const |
1555 | QPopupMenu* KActionMenu::popupMenu() const | 1556 | Q3PopupMenu* KActionMenu::popupMenu() const |
1556 | { | 1557 | { |
1557 | return d->m_popup; | 1558 | return d->m_popup; |
1558 | } | 1559 | } |
1559 | 1560 | ||
1560 | void KActionMenu::insert( KAction* cmd, int index ) | 1561 | void KActionMenu::insert( KAction* cmd, int index ) |
1561 | { | 1562 | { |
1562 | if ( cmd ) | 1563 | if ( cmd ) |
1563 | cmd->plug( d->m_popup, index ); | 1564 | cmd->plug( d->m_popup, index ); |
1564 | } | 1565 | } |
1565 | 1566 | ||
1566 | void KActionMenu::remove( KAction* cmd ) | 1567 | void KActionMenu::remove( KAction* cmd ) |
1567 | { | 1568 | { |
1568 | if ( cmd ) | 1569 | if ( cmd ) |
1569 | cmd->unplug( d->m_popup ); | 1570 | cmd->unplug( d->m_popup ); |
1570 | } | 1571 | } |
1571 | 1572 | ||
@@ -1579,35 +1580,35 @@ void KActionMenu::setDelayed(bool _delayed) { | |||
1579 | 1580 | ||
1580 | bool KActionMenu::stickyMenu() const { | 1581 | bool KActionMenu::stickyMenu() const { |
1581 | return d->m_stickyMenu; | 1582 | return d->m_stickyMenu; |
1582 | } | 1583 | } |
1583 | 1584 | ||
1584 | void KActionMenu::setStickyMenu(bool sticky) { | 1585 | void KActionMenu::setStickyMenu(bool sticky) { |
1585 | d->m_stickyMenu = sticky; | 1586 | d->m_stickyMenu = sticky; |
1586 | } | 1587 | } |
1587 | 1588 | ||
1588 | int KActionMenu::plug( QWidget* widget, int index ) | 1589 | int KActionMenu::plug( QWidget* widget, int index ) |
1589 | { | 1590 | { |
1590 | /*US | 1591 | /*US |
1591 | if (kapp && !kapp->authorizeKAction(name())) | 1592 | if (kapp && !kapp->authorizeKAction(name())) |
1592 | return -1; | 1593 | return -1; |
1593 | */ | 1594 | */ |
1594 | kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis | 1595 | kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis |
1595 | if ( widget->inherits("QPopupMenu") ) | 1596 | if ( widget->inherits("Q3PopupMenu") ) |
1596 | { | 1597 | { |
1597 | QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); | 1598 | Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); |
1598 | int id; | 1599 | int id; |
1599 | if ( hasIconSet() ) | 1600 | if ( hasIconSet() ) |
1600 | id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index ); | 1601 | id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index ); |
1601 | else | 1602 | else |
1602 | id = menu->insertItem( text(), d->m_popup, -1, index ); | 1603 | id = menu->insertItem( text(), d->m_popup, -1, index ); |
1603 | 1604 | ||
1604 | if ( !isEnabled() ) | 1605 | if ( !isEnabled() ) |
1605 | menu->setItemEnabled( id, false ); | 1606 | menu->setItemEnabled( id, false ); |
1606 | 1607 | ||
1607 | addContainer( menu, id ); | 1608 | addContainer( menu, id ); |
1608 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); | 1609 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); |
1609 | 1610 | ||
1610 | if ( m_parentCollection ) | 1611 | if ( m_parentCollection ) |
1611 | m_parentCollection->connectHighlight( menu, this ); | 1612 | m_parentCollection->connectHighlight( menu, this ); |
1612 | 1613 | ||
1613 | return containerCount() - 1; | 1614 | return containerCount() - 1; |
@@ -1768,38 +1769,38 @@ int KToolBarPopupAction::plug( QWidget *widget, int index ) | |||
1768 | bar->setDelayedPopup( id_, popupMenu(), stickyMenu() ); | 1769 | bar->setDelayedPopup( id_, popupMenu(), stickyMenu() ); |
1769 | } else { | 1770 | } else { |
1770 | bar->getButton(id_)->setPopup(popupMenu(), stickyMenu()); | 1771 | bar->getButton(id_)->setPopup(popupMenu(), stickyMenu()); |
1771 | } | 1772 | } |
1772 | /*US | 1773 | /*US |
1773 | if ( !whatsThis().isEmpty() ) | 1774 | if ( !whatsThis().isEmpty() ) |
1774 | QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() ); | 1775 | QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() ); |
1775 | */ | 1776 | */ |
1776 | return containerCount() - 1; | 1777 | return containerCount() - 1; |
1777 | } | 1778 | } |
1778 | 1779 | ||
1779 | 1780 | ||
1780 | return KAction::plug( widget, index ); | 1781 | return KAction::plug( widget, index ); |
1781 | } | 1782 | } |
1782 | 1783 | ||
1783 | //US KPopupMenu *KToolBarPopupAction::popupMenu() const | 1784 | //US KPopupMenu *KToolBarPopupAction::popupMenu() const |
1784 | QPopupMenu *KToolBarPopupAction::popupMenu() const | 1785 | Q3PopupMenu *KToolBarPopupAction::popupMenu() const |
1785 | { | 1786 | { |
1786 | if ( !m_popup ) { | 1787 | if ( !m_popup ) { |
1787 | KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this); | 1788 | KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this); |
1788 | //US that->m_popup = new KPopupMenu; | 1789 | //US that->m_popup = new KPopupMenu; |
1789 | that->m_popup = new QPopupMenu; | 1790 | that->m_popup = new Q3PopupMenu; |
1790 | } | 1791 | } |
1791 | return m_popup; | 1792 | return m_popup; |
1792 | } | 1793 | } |
1793 | 1794 | ||
1794 | //////// | 1795 | //////// |
1795 | 1796 | ||
1796 | KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName, | 1797 | KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName, |
1797 | const QString& text, KActionCollection* parent, const char* name ) | 1798 | const QString& text, KActionCollection* parent, const char* name ) |
1798 | : KToggleAction( text, KShortcut(), parent, name ) | 1799 | : KToggleAction( text, KShortcut(), parent, name ) |
1799 | , m_toolBarName( toolBarName ) | 1800 | , m_toolBarName( toolBarName ) |
1800 | , m_toolBar( 0L ) | 1801 | , m_toolBar( 0L ) |
1801 | { | 1802 | { |
1802 | } | 1803 | } |
1803 | 1804 | ||
1804 | KToggleToolBarAction::KToggleToolBarAction( KToolBar *toolBar, const QString &text, | 1805 | KToggleToolBarAction::KToggleToolBarAction( KToolBar *toolBar, const QString &text, |
1805 | KActionCollection *parent, const char *name ) | 1806 | KActionCollection *parent, const char *name ) |
@@ -1940,56 +1941,56 @@ void KWidgetAction::unplug( QWidget *w ) | |||
1940 | if( !m_widget || !isPlugged() ) | 1941 | if( !m_widget || !isPlugged() ) |
1941 | return; | 1942 | return; |
1942 | 1943 | ||
1943 | KToolBar* toolBar = (KToolBar*)m_widget->parent(); | 1944 | KToolBar* toolBar = (KToolBar*)m_widget->parent(); |
1944 | if ( toolBar == w ) | 1945 | if ( toolBar == w ) |
1945 | { | 1946 | { |
1946 | disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) ); | 1947 | disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) ); |
1947 | m_widget->reparent( 0L, QPoint(), false ); // false = showit | 1948 | m_widget->reparent( 0L, QPoint(), false ); // false = showit |
1948 | } | 1949 | } |
1949 | KAction::unplug( w ); | 1950 | KAction::unplug( w ); |
1950 | } | 1951 | } |
1951 | 1952 | ||
1952 | void KWidgetAction::slotToolbarDestroyed() | 1953 | void KWidgetAction::slotToolbarDestroyed() |
1953 | { | 1954 | { |
1954 | //Q_ASSERT( m_widget ); // When exiting the app the widget could be destroyed before the toolbar. | 1955 | //Q_ASSERT( m_widget ); // When exiting the app the widget could be destroyed before the toolbar. |
1955 | 1956 | ||
1956 | ASSERT( isPlugged() ); | 1957 | Q_ASSERT( isPlugged() ); |
1957 | if( !m_widget || !isPlugged() ) | 1958 | if( !m_widget || !isPlugged() ) |
1958 | return; | 1959 | return; |
1959 | 1960 | ||
1960 | // Don't let a toolbar being destroyed, delete my widget. | 1961 | // Don't let a toolbar being destroyed, delete my widget. |
1961 | m_widget->reparent( 0L, QPoint(), false /*showIt*/ ); | 1962 | m_widget->reparent( 0L, QPoint(), false /*showIt*/ ); |
1962 | } | 1963 | } |
1963 | 1964 | ||
1964 | //////// | 1965 | //////// |
1965 | 1966 | ||
1966 | KActionSeparator::KActionSeparator( QObject *parent, const char *name ) | 1967 | KActionSeparator::KActionSeparator( QObject *parent, const char *name ) |
1967 | : KAction( parent, name ) | 1968 | : KAction( parent, name ) |
1968 | { | 1969 | { |
1969 | } | 1970 | } |
1970 | 1971 | ||
1971 | KActionSeparator::~KActionSeparator() | 1972 | KActionSeparator::~KActionSeparator() |
1972 | { | 1973 | { |
1973 | } | 1974 | } |
1974 | 1975 | ||
1975 | int KActionSeparator::plug( QWidget *widget, int index ) | 1976 | int KActionSeparator::plug( QWidget *widget, int index ) |
1976 | { | 1977 | { |
1977 | if ( widget->inherits("QPopupMenu") ) | 1978 | if ( widget->inherits("Q3PopupMenu") ) |
1978 | { | 1979 | { |
1979 | QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); | 1980 | Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); |
1980 | 1981 | ||
1981 | int id = menu->insertSeparator( index ); | 1982 | int id = menu->insertSeparator( index ); |
1982 | 1983 | ||
1983 | addContainer( menu, id ); | 1984 | addContainer( menu, id ); |
1984 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); | 1985 | connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); |
1985 | 1986 | ||
1986 | return containerCount() - 1; | 1987 | return containerCount() - 1; |
1987 | } | 1988 | } |
1988 | else if ( widget->inherits( "QMenuBar" ) ) | 1989 | else if ( widget->inherits( "QMenuBar" ) ) |
1989 | { | 1990 | { |
1990 | QMenuBar *menuBar = static_cast<QMenuBar *>( widget ); | 1991 | QMenuBar *menuBar = static_cast<QMenuBar *>( widget ); |
1991 | 1992 | ||
1992 | int id = menuBar->insertSeparator( index ); | 1993 | int id = menuBar->insertSeparator( index ); |
1993 | 1994 | ||
1994 | addContainer( menuBar, id ); | 1995 | addContainer( menuBar, id ); |
1995 | 1996 | ||
diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h index f6e7a0f..a9b9104 100644 --- a/microkde/kdeui/kactionclasses.h +++ b/microkde/kdeui/kactionclasses.h | |||
@@ -21,53 +21,56 @@ | |||
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | //$Id$ | 24 | //$Id$ |
25 | 25 | ||
26 | #ifndef __kactionclasses_h__ | 26 | #ifndef __kactionclasses_h__ |
27 | #define __kactionclasses_h__ | 27 | #define __kactionclasses_h__ |
28 | 28 | ||
29 | #include <kaction.h> | 29 | #include <kaction.h> |
30 | 30 | ||
31 | //US#include <qkeysequence.h> | 31 | //US#include <qkeysequence.h> |
32 | //US#include <qobject.h> | 32 | //US#include <qobject.h> |
33 | //US#include <qvaluelist.h> | 33 | //US#include <qvaluelist.h> |
34 | //US#include <qguardedptr.h> | 34 | //US#include <qguardedptr.h> |
35 | //US#include <kguiitem.h> | 35 | //US#include <kguiitem.h> |
36 | #include <kshortcut.h> | 36 | #include <kshortcut.h> |
37 | //Added by qt3to4: | ||
38 | #include <Q3CString> | ||
39 | #include <Q3PopupMenu> | ||
37 | //US#include <kstdaction.h> | 40 | //US#include <kstdaction.h> |
38 | //US#include <kicontheme.h> | 41 | //US#include <kicontheme.h> |
39 | 42 | ||
40 | class QMenuBar; | 43 | class QMenuBar; |
41 | class QPopupMenu; | 44 | class Q3PopupMenu; |
42 | //USclass QComboBox; | 45 | //USclass QComboBox; |
43 | //USclass QPoint; | 46 | //USclass QPoint; |
44 | //USclass QIconSet; | 47 | //USclass QIconSet; |
45 | //USclass QString; | 48 | //USclass QString; |
46 | //USclass KToolBar; | 49 | //USclass KToolBar; |
47 | 50 | ||
48 | //USclass KAccel; | 51 | //USclass KAccel; |
49 | //USclass KAccelActions; | 52 | //USclass KAccelActions; |
50 | class KConfig; | 53 | class KConfig; |
51 | //USclass KConfigBase; | 54 | //USclass KConfigBase; |
52 | class KURL; | 55 | class KURL; |
53 | //USclass KInstance; | 56 | //USclass KInstance; |
54 | 57 | ||
55 | 58 | ||
56 | //US class KToolBar needs to be replaced | 59 | //US class KToolBar needs to be replaced |
57 | class KToolBar; | 60 | #include "ktoolbar.h" |
58 | class KActionCollection; | 61 | class KActionCollection; |
59 | 62 | ||
60 | //US class KPopupMenu needs to be replaced | 63 | //US class KPopupMenu needs to be replaced |
61 | //US class KPopupMenu; | 64 | //US class KPopupMenu; |
62 | //USclass KMainWindow; | 65 | //USclass KMainWindow; |
63 | 66 | ||
64 | /** | 67 | /** |
65 | * Checkbox like action. | 68 | * Checkbox like action. |
66 | * | 69 | * |
67 | * This action provides two states: checked or not. | 70 | * This action provides two states: checked or not. |
68 | * | 71 | * |
69 | * @short Checkbox like action. | 72 | * @short Checkbox like action. |
70 | */ | 73 | */ |
71 | class KToggleAction : public KAction | 74 | class KToggleAction : public KAction |
72 | { | 75 | { |
73 | Q_OBJECT | 76 | Q_OBJECT |
@@ -92,55 +95,55 @@ public: | |||
92 | * @param cut The corresponding keyboard accelerator (shortcut). | 95 | * @param cut The corresponding keyboard accelerator (shortcut). |
93 | * @param receiver The SLOT's parent. | 96 | * @param receiver The SLOT's parent. |
94 | * @param slot The SLOT to invoke to execute this action. | 97 | * @param slot The SLOT to invoke to execute this action. |
95 | * @param parent This action's parent. | 98 | * @param parent This action's parent. |
96 | * @param name An internal name for this action. | 99 | * @param name An internal name for this action. |
97 | */ | 100 | */ |
98 | KToggleAction( const QString& text, const KShortcut& cut, | 101 | KToggleAction( const QString& text, const KShortcut& cut, |
99 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 102 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
100 | 103 | ||
101 | /** | 104 | /** |
102 | * @param text The text that will be displayed. | 105 | * @param text The text that will be displayed. |
103 | * @param pix The icons that go with this action. | 106 | * @param pix The icons that go with this action. |
104 | * @param cut The corresponding keyboard accelerator (shortcut). | 107 | * @param cut The corresponding keyboard accelerator (shortcut). |
105 | * @param parent This action's parent. | 108 | * @param parent This action's parent. |
106 | * @param name An internal name for this action. | 109 | * @param name An internal name for this action. |
107 | */ | 110 | */ |
108 | KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 111 | KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
109 | QObject* parent = 0, const char* name = 0 ); | 112 | QObject* parent = 0, const char* name = 0 ); |
110 | 113 | ||
111 | /** | 114 | /** |
112 | * @param text The text that will be displayed. | 115 | * @param text The text that will be displayed. |
113 | * @param pix The dynamically loaded icon that goes with this action. | 116 | * @param pix The dynamically loaded icon that goes with this action. |
114 | * @param cut The corresponding keyboard accelerator (shortcut). | 117 | * @param cut The corresponding keyboard accelerator (shortcut). |
115 | * @param parent This action's parent. | 118 | * @param parent This action's parent. |
116 | * @param name An internal name for this action. | 119 | * @param name An internal name for this action. |
117 | */ | 120 | */ |
118 | KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 121 | KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
119 | QObject* parent = 0, const char* name = 0 ); | 122 | QObject* parent = 0, const char* name = 0 ); |
120 | 123 | ||
121 | /** | 124 | /** |
122 | * @param text The text that will be displayed. | 125 | * @param text The text that will be displayed. |
123 | * @param pix The icons that go with this action. | 126 | * @param pix The icons that go with this action. |
124 | * @param cut The corresponding keyboard accelerator (shortcut). | 127 | * @param cut The corresponding keyboard accelerator (shortcut). |
125 | * @param receiver The SLOT's parent. | 128 | * @param receiver The SLOT's parent. |
126 | * @param slot The SLOT to invoke to execute this action. | 129 | * @param slot The SLOT to invoke to execute this action. |
127 | * @param parent This action's parent. | 130 | * @param parent This action's parent. |
128 | * @param name An internal name for this action. | 131 | * @param name An internal name for this action. |
129 | */ | 132 | */ |
130 | KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 133 | KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
131 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 134 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
132 | 135 | ||
133 | /** | 136 | /** |
134 | * @param text The text that will be displayed. | 137 | * @param text The text that will be displayed. |
135 | * @param pix The dynamically loaded icon that goes with this action. | 138 | * @param pix The dynamically loaded icon that goes with this action. |
136 | * @param cut The corresponding keyboard accelerator (shortcut). | 139 | * @param cut The corresponding keyboard accelerator (shortcut). |
137 | * @param receiver The SLOT's parent. | 140 | * @param receiver The SLOT's parent. |
138 | * @param slot The SLOT to invoke to execute this action. | 141 | * @param slot The SLOT to invoke to execute this action. |
139 | * @param parent This action's parent. | 142 | * @param parent This action's parent. |
140 | * @param name An internal name for this action. | 143 | * @param name An internal name for this action. |
141 | */ | 144 | */ |
142 | KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, | 145 | KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, |
143 | const QObject* receiver, const char* slot, | 146 | const QObject* receiver, const char* slot, |
144 | QObject* parent, const char* name = 0 ); | 147 | QObject* parent, const char* name = 0 ); |
145 | 148 | ||
146 | /** | 149 | /** |
@@ -233,55 +236,55 @@ public: | |||
233 | * @param cut The corresponding keyboard accelerator (shortcut). | 236 | * @param cut The corresponding keyboard accelerator (shortcut). |
234 | * @param receiver The SLOT's parent. | 237 | * @param receiver The SLOT's parent. |
235 | * @param slot The SLOT to invoke to execute this action. | 238 | * @param slot The SLOT to invoke to execute this action. |
236 | * @param parent This action's parent. | 239 | * @param parent This action's parent. |
237 | * @param name An internal name for this action. | 240 | * @param name An internal name for this action. |
238 | */ | 241 | */ |
239 | KRadioAction( const QString& text, const KShortcut& cut, | 242 | KRadioAction( const QString& text, const KShortcut& cut, |
240 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 243 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
241 | 244 | ||
242 | /** | 245 | /** |
243 | * @param text The text that will be displayed. | 246 | * @param text The text that will be displayed. |
244 | * @param pix The icons that go with this action. | 247 | * @param pix The icons that go with this action. |
245 | * @param cut The corresponding keyboard accelerator (shortcut). | 248 | * @param cut The corresponding keyboard accelerator (shortcut). |
246 | * @param parent This action's parent. | 249 | * @param parent This action's parent. |
247 | * @param name An internal name for this action. | 250 | * @param name An internal name for this action. |
248 | */ | 251 | */ |
249 | KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 252 | KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
250 | QObject* parent = 0, const char* name = 0 ); | 253 | QObject* parent = 0, const char* name = 0 ); |
251 | 254 | ||
252 | /** | 255 | /** |
253 | * @param text The text that will be displayed. | 256 | * @param text The text that will be displayed. |
254 | * @param pix The dynamically loaded icon that goes with this action. | 257 | * @param pix The dynamically loaded icon that goes with this action. |
255 | * @param cut The corresponding keyboard accelerator (shortcut). | 258 | * @param cut The corresponding keyboard accelerator (shortcut). |
256 | * @param parent This action's parent. | 259 | * @param parent This action's parent. |
257 | * @param name An internal name for this action. | 260 | * @param name An internal name for this action. |
258 | */ | 261 | */ |
259 | KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 262 | KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
260 | QObject* parent = 0, const char* name = 0 ); | 263 | QObject* parent = 0, const char* name = 0 ); |
261 | 264 | ||
262 | /** | 265 | /** |
263 | * @param text The text that will be displayed. | 266 | * @param text The text that will be displayed. |
264 | * @param pix The icons that go with this action. | 267 | * @param pix The icons that go with this action. |
265 | * @param cut The corresponding keyboard accelerator (shortcut). | 268 | * @param cut The corresponding keyboard accelerator (shortcut). |
266 | * @param receiver The SLOT's parent. | 269 | * @param receiver The SLOT's parent. |
267 | * @param slot The SLOT to invoke to execute this action. | 270 | * @param slot The SLOT to invoke to execute this action. |
268 | * @param parent This action's parent. | 271 | * @param parent This action's parent. |
269 | * @param name An internal name for this action. | 272 | * @param name An internal name for this action. |
270 | */ | 273 | */ |
271 | KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 274 | KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
272 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 275 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
273 | 276 | ||
274 | /** | 277 | /** |
275 | * @param text The text that will be displayed. | 278 | * @param text The text that will be displayed. |
276 | * @param pix The dynamically loaded icon that goes with this action. | 279 | * @param pix The dynamically loaded icon that goes with this action. |
277 | * @param cut The corresponding keyboard accelerator (shortcut). | 280 | * @param cut The corresponding keyboard accelerator (shortcut). |
278 | * @param receiver The SLOT's parent. | 281 | * @param receiver The SLOT's parent. |
279 | * @param slot The SLOT to invoke to execute this action. | 282 | * @param slot The SLOT to invoke to execute this action. |
280 | * @param parent This action's parent. | 283 | * @param parent This action's parent. |
281 | * @param name An internal name for this action. | 284 | * @param name An internal name for this action. |
282 | */ | 285 | */ |
283 | KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, | 286 | KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, |
284 | const QObject* receiver, const char* slot, | 287 | const QObject* receiver, const char* slot, |
285 | QObject* parent, const char* name = 0 ); | 288 | QObject* parent, const char* name = 0 ); |
286 | 289 | ||
287 | /** | 290 | /** |
@@ -339,55 +342,55 @@ public: | |||
339 | * @param cut The corresponding keyboard accelerator (shortcut). | 342 | * @param cut The corresponding keyboard accelerator (shortcut). |
340 | * @param receiver The SLOT's parent. | 343 | * @param receiver The SLOT's parent. |
341 | * @param slot The SLOT to invoke to execute this action. | 344 | * @param slot The SLOT to invoke to execute this action. |
342 | * @param parent This action's parent. | 345 | * @param parent This action's parent. |
343 | * @param name An internal name for this action. | 346 | * @param name An internal name for this action. |
344 | */ | 347 | */ |
345 | KSelectAction( const QString& text, const KShortcut& cut, | 348 | KSelectAction( const QString& text, const KShortcut& cut, |
346 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 349 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
347 | 350 | ||
348 | /** | 351 | /** |
349 | * @param text The text that will be displayed. | 352 | * @param text The text that will be displayed. |
350 | * @param pix The icons that go with this action. | 353 | * @param pix The icons that go with this action. |
351 | * @param cut The corresponding keyboard accelerator (shortcut). | 354 | * @param cut The corresponding keyboard accelerator (shortcut). |
352 | * @param parent This action's parent. | 355 | * @param parent This action's parent. |
353 | * @param name An internal name for this action. | 356 | * @param name An internal name for this action. |
354 | */ | 357 | */ |
355 | KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 358 | KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
356 | QObject* parent = 0, const char* name = 0 ); | 359 | QObject* parent = 0, const char* name = 0 ); |
357 | 360 | ||
358 | /** | 361 | /** |
359 | * @param text The text that will be displayed. | 362 | * @param text The text that will be displayed. |
360 | * @param pix The dynamically loaded icon that goes with this action. | 363 | * @param pix The dynamically loaded icon that goes with this action. |
361 | * @param cut The corresponding keyboard accelerator (shortcut). | 364 | * @param cut The corresponding keyboard accelerator (shortcut). |
362 | * @param parent This action's parent. | 365 | * @param parent This action's parent. |
363 | * @param name An internal name for this action. | 366 | * @param name An internal name for this action. |
364 | */ | 367 | */ |
365 | KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 368 | KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
366 | QObject* parent = 0, const char* name = 0 ); | 369 | QObject* parent = 0, const char* name = 0 ); |
367 | 370 | ||
368 | /** | 371 | /** |
369 | * @param text The text that will be displayed. | 372 | * @param text The text that will be displayed. |
370 | * @param pix The icons that go with this action. | 373 | * @param pix The icons that go with this action. |
371 | * @param cut The corresponding keyboard accelerator (shortcut). | 374 | * @param cut The corresponding keyboard accelerator (shortcut). |
372 | * @param receiver The SLOT's parent. | 375 | * @param receiver The SLOT's parent. |
373 | * @param slot The SLOT to invoke to execute this action. | 376 | * @param slot The SLOT to invoke to execute this action. |
374 | * @param parent This action's parent. | 377 | * @param parent This action's parent. |
375 | * @param name An internal name for this action. | 378 | * @param name An internal name for this action. |
376 | */ | 379 | */ |
377 | KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 380 | KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
378 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); | 381 | const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); |
379 | 382 | ||
380 | /** | 383 | /** |
381 | * @param text The text that will be displayed. | 384 | * @param text The text that will be displayed. |
382 | * @param pix The dynamically loaded icon that goes with this action. | 385 | * @param pix The dynamically loaded icon that goes with this action. |
383 | * @param cut The corresponding keyboard accelerator (shortcut). | 386 | * @param cut The corresponding keyboard accelerator (shortcut). |
384 | * @param receiver The SLOT's parent. | 387 | * @param receiver The SLOT's parent. |
385 | * @param slot The SLOT to invoke to execute this action. | 388 | * @param slot The SLOT to invoke to execute this action. |
386 | * @param parent This action's parent. | 389 | * @param parent This action's parent. |
387 | * @param name An internal name for this action. | 390 | * @param name An internal name for this action. |
388 | */ | 391 | */ |
389 | KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, | 392 | KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, |
390 | const QObject* receiver, const char* slot, | 393 | const QObject* receiver, const char* slot, |
391 | QObject* parent, const char* name = 0 ); | 394 | QObject* parent, const char* name = 0 ); |
392 | 395 | ||
393 | /** | 396 | /** |
@@ -425,33 +428,33 @@ public: | |||
425 | * Use setItems to set them. | 428 | * Use setItems to set them. |
426 | */ | 429 | */ |
427 | virtual QStringList items() const; | 430 | virtual QStringList items() const; |
428 | 431 | ||
429 | virtual void changeItem( int index, const QString& text ); | 432 | virtual void changeItem( int index, const QString& text ); |
430 | 433 | ||
431 | virtual QString currentText() const; | 434 | virtual QString currentText() const; |
432 | 435 | ||
433 | virtual int currentItem() const; | 436 | virtual int currentItem() const; |
434 | 437 | ||
435 | /** | 438 | /** |
436 | * When this action is plugged into a toolbar, it creates a combobox. | 439 | * When this action is plugged into a toolbar, it creates a combobox. |
437 | * This returns the maximum width set by setComboWidth | 440 | * This returns the maximum width set by setComboWidth |
438 | */ | 441 | */ |
439 | virtual int comboWidth() const; | 442 | virtual int comboWidth() const; |
440 | 443 | ||
441 | QPopupMenu* popupMenu() const; | 444 | Q3PopupMenu* popupMenu() const; |
442 | 445 | ||
443 | /** | 446 | /** |
444 | * Deprecated. See @ref setMenuAccelsEnabled . | 447 | * Deprecated. See @ref setMenuAccelsEnabled . |
445 | * @since 3.1 | 448 | * @since 3.1 |
446 | */ | 449 | */ |
447 | void setRemoveAmpersandsInCombo( bool b ); | 450 | void setRemoveAmpersandsInCombo( bool b ); |
448 | /// @since 3.1 | 451 | /// @since 3.1 |
449 | bool removeAmpersandsInCombo() const; | 452 | bool removeAmpersandsInCombo() const; |
450 | 453 | ||
451 | /** | 454 | /** |
452 | * Sets whether any occurence of the ampersand character ( & ) in items | 455 | * Sets whether any occurence of the ampersand character ( & ) in items |
453 | * should be interpreted as keyboard accelerator for items displayed in a | 456 | * should be interpreted as keyboard accelerator for items displayed in a |
454 | * menu or not. | 457 | * menu or not. |
455 | * @since 3.1 | 458 | * @since 3.1 |
456 | */ | 459 | */ |
457 | void setMenuAccelsEnabled( bool b ); | 460 | void setMenuAccelsEnabled( bool b ); |
@@ -554,55 +557,55 @@ public: | |||
554 | * @param cut The corresponding keyboard accelerator (shortcut). | 557 | * @param cut The corresponding keyboard accelerator (shortcut). |
555 | * @param receiver The SLOT's parent. | 558 | * @param receiver The SLOT's parent. |
556 | * @param slot The SLOT to invoke to execute this action. | 559 | * @param slot The SLOT to invoke to execute this action. |
557 | * @param parent This action's parent. | 560 | * @param parent This action's parent. |
558 | * @param name An internal name for this action. | 561 | * @param name An internal name for this action. |
559 | */ | 562 | */ |
560 | KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, | 563 | KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, |
561 | const char* slot, QObject* parent, const char* name = 0 ); | 564 | const char* slot, QObject* parent, const char* name = 0 ); |
562 | 565 | ||
563 | /** | 566 | /** |
564 | * @param text The text that will be displayed. | 567 | * @param text The text that will be displayed. |
565 | * @param pix The icons that go with this action. | 568 | * @param pix The icons that go with this action. |
566 | * @param cut The corresponding keyboard accelerator (shortcut). | 569 | * @param cut The corresponding keyboard accelerator (shortcut). |
567 | * @param parent This action's parent. | 570 | * @param parent This action's parent. |
568 | * @param name An internal name for this action. | 571 | * @param name An internal name for this action. |
569 | */ | 572 | */ |
570 | KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 573 | KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
571 | QObject* parent = 0, const char* name = 0 ); | 574 | QObject* parent = 0, const char* name = 0 ); |
572 | 575 | ||
573 | /** | 576 | /** |
574 | * @param text The text that will be displayed. | 577 | * @param text The text that will be displayed. |
575 | * @param pix The dynamically loaded icon that goes with this action. | 578 | * @param pix The dynamically loaded icon that goes with this action. |
576 | * @param cut The corresponding keyboard accelerator (shortcut). | 579 | * @param cut The corresponding keyboard accelerator (shortcut). |
577 | * @param parent This action's parent. | 580 | * @param parent This action's parent. |
578 | * @param name An internal name for this action. | 581 | * @param name An internal name for this action. |
579 | */ | 582 | */ |
580 | KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 583 | KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
581 | QObject* parent = 0, const char* name = 0 ); | 584 | QObject* parent = 0, const char* name = 0 ); |
582 | 585 | ||
583 | /** | 586 | /** |
584 | * @param text The text that will be displayed. | 587 | * @param text The text that will be displayed. |
585 | * @param pix The icons that go with this action. | 588 | * @param pix The icons that go with this action. |
586 | * @param cut The corresponding keyboard accelerator (shortcut). | 589 | * @param cut The corresponding keyboard accelerator (shortcut). |
587 | * @param receiver The SLOT's parent. | 590 | * @param receiver The SLOT's parent. |
588 | * @param slot The SLOT to invoke to execute this action. | 591 | * @param slot The SLOT to invoke to execute this action. |
589 | * @param parent This action's parent. | 592 | * @param parent This action's parent. |
590 | * @param name An internal name for this action. | 593 | * @param name An internal name for this action. |
591 | */ | 594 | */ |
592 | KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 595 | KListAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
593 | const QObject* receiver, const char* slot, QObject* parent, | 596 | const QObject* receiver, const char* slot, QObject* parent, |
594 | const char* name = 0 ); | 597 | const char* name = 0 ); |
595 | 598 | ||
596 | /** | 599 | /** |
597 | * @param text The text that will be displayed. | 600 | * @param text The text that will be displayed. |
598 | * @param pix The dynamically loaded icon that goes with this action. | 601 | * @param pix The dynamically loaded icon that goes with this action. |
599 | * @param cut The corresponding keyboard accelerator (shortcut). | 602 | * @param cut The corresponding keyboard accelerator (shortcut). |
600 | * @param receiver The SLOT's parent. | 603 | * @param receiver The SLOT's parent. |
601 | * @param slot The SLOT to invoke to execute this action. | 604 | * @param slot The SLOT to invoke to execute this action. |
602 | * @param parent This action's parent. | 605 | * @param parent This action's parent. |
603 | * @param name An internal name for this action. | 606 | * @param name An internal name for this action. |
604 | */ | 607 | */ |
605 | KListAction( const QString& text, const QString& pix, const KShortcut& cut, | 608 | KListAction( const QString& text, const QString& pix, const KShortcut& cut, |
606 | const QObject* receiver, const char* slot, QObject* parent, | 609 | const QObject* receiver, const char* slot, QObject* parent, |
607 | const char* name = 0 ); | 610 | const char* name = 0 ); |
608 | 611 | ||
@@ -672,60 +675,60 @@ public: | |||
672 | * @param name An internal name for this action. | 675 | * @param name An internal name for this action. |
673 | * @param maxItems The maximum number of files to display | 676 | * @param maxItems The maximum number of files to display |
674 | */ | 677 | */ |
675 | KRecentFilesAction( const QString& text, const KShortcut& cut, | 678 | KRecentFilesAction( const QString& text, const KShortcut& cut, |
676 | const QObject* receiver, const char* slot, | 679 | const QObject* receiver, const char* slot, |
677 | QObject* parent, const char* name = 0, | 680 | QObject* parent, const char* name = 0, |
678 | uint maxItems = 10 ); | 681 | uint maxItems = 10 ); |
679 | 682 | ||
680 | /** | 683 | /** |
681 | * @param text The text that will be displayed. | 684 | * @param text The text that will be displayed. |
682 | * @param pix The icons that go with this action. | 685 | * @param pix The icons that go with this action. |
683 | * @param cut The corresponding keyboard accelerator (shortcut). | 686 | * @param cut The corresponding keyboard accelerator (shortcut). |
684 | * @param parent This action's parent. | 687 | * @param parent This action's parent. |
685 | * @param name An internal name for this action. | 688 | * @param name An internal name for this action. |
686 | * @param maxItems The maximum number of files to display | 689 | * @param maxItems The maximum number of files to display |
687 | */ | 690 | */ |
688 | KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 691 | KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
689 | QObject* parent, const char* name = 0, | 692 | QObject* parent, const char* name = 0, |
690 | uint maxItems = 10 ); | 693 | uint maxItems = 10 ); |
691 | 694 | ||
692 | /** | 695 | /** |
693 | * @param text The text that will be displayed. | 696 | * @param text The text that will be displayed. |
694 | * @param pix The dynamically loaded icon that goes with this action. | 697 | * @param pix The dynamically loaded icon that goes with this action. |
695 | * @param cut The corresponding keyboard accelerator (shortcut). | 698 | * @param cut The corresponding keyboard accelerator (shortcut). |
696 | * @param parent This action's parent. | 699 | * @param parent This action's parent. |
697 | * @param name An internal name for this action. | 700 | * @param name An internal name for this action. |
698 | * @param maxItems The maximum number of files to display | 701 | * @param maxItems The maximum number of files to display |
699 | */ | 702 | */ |
700 | KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, | 703 | KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, |
701 | QObject* parent, const char* name = 0, | 704 | QObject* parent, const char* name = 0, |
702 | uint maxItems = 10 ); | 705 | uint maxItems = 10 ); |
703 | 706 | ||
704 | /** | 707 | /** |
705 | * @param text The text that will be displayed. | 708 | * @param text The text that will be displayed. |
706 | * @param pix The icons that go with this action. | 709 | * @param pix The icons that go with this action. |
707 | * @param cut The corresponding keyboard accelerator (shortcut). | 710 | * @param cut The corresponding keyboard accelerator (shortcut). |
708 | * @param receiver The SLOT's parent. | 711 | * @param receiver The SLOT's parent. |
709 | * @param slot The SLOT to invoke when a URL is selected. | 712 | * @param slot The SLOT to invoke when a URL is selected. |
710 | * Its signature is of the form slotURLSelected( const KURL & ). | 713 | * Its signature is of the form slotURLSelected( const KURL & ). |
711 | * @param parent This action's parent. | 714 | * @param parent This action's parent. |
712 | * @param name An internal name for this action. | 715 | * @param name An internal name for this action. |
713 | * @param maxItems The maximum number of files to display | 716 | * @param maxItems The maximum number of files to display |
714 | */ | 717 | */ |
715 | KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 718 | KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
716 | const QObject* receiver, const char* slot, | 719 | const QObject* receiver, const char* slot, |
717 | QObject* parent, const char* name = 0, | 720 | QObject* parent, const char* name = 0, |
718 | uint maxItems = 10 ); | 721 | uint maxItems = 10 ); |
719 | 722 | ||
720 | /** | 723 | /** |
721 | * @param text The text that will be displayed. | 724 | * @param text The text that will be displayed. |
722 | * @param pix The dynamically loaded icon that goes with this action. | 725 | * @param pix The dynamically loaded icon that goes with this action. |
723 | * @param cut The corresponding keyboard accelerator (shortcut). | 726 | * @param cut The corresponding keyboard accelerator (shortcut). |
724 | * @param receiver The SLOT's parent. | 727 | * @param receiver The SLOT's parent. |
725 | * @param slot The SLOT to invoke when a URL is selected. | 728 | * @param slot The SLOT to invoke when a URL is selected. |
726 | * Its signature is of the form slotURLSelected( const KURL & ). | 729 | * Its signature is of the form slotURLSelected( const KURL & ). |
727 | * @param parent This action's parent. | 730 | * @param parent This action's parent. |
728 | * @param name An internal name for this action. | 731 | * @param name An internal name for this action. |
729 | * @param maxItems The maximum number of files to display | 732 | * @param maxItems The maximum number of files to display |
730 | */ | 733 | */ |
731 | KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, | 734 | KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, |
@@ -821,37 +824,37 @@ private: | |||
821 | void init(); | 824 | void init(); |
822 | 825 | ||
823 | class KRecentFilesActionPrivate; | 826 | class KRecentFilesActionPrivate; |
824 | KRecentFilesActionPrivate *d; | 827 | KRecentFilesActionPrivate *d; |
825 | }; | 828 | }; |
826 | 829 | ||
827 | class KFontAction : public KSelectAction | 830 | class KFontAction : public KSelectAction |
828 | { | 831 | { |
829 | Q_OBJECT | 832 | Q_OBJECT |
830 | Q_PROPERTY( QString font READ font WRITE setFont ) | 833 | Q_PROPERTY( QString font READ font WRITE setFont ) |
831 | public: | 834 | public: |
832 | KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, | 835 | KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, |
833 | const char* name = 0 ); | 836 | const char* name = 0 ); |
834 | KFontAction( const QString& text, const KShortcut& cut, | 837 | KFontAction( const QString& text, const KShortcut& cut, |
835 | const QObject* receiver, const char* slot, QObject* parent, | 838 | const QObject* receiver, const char* slot, QObject* parent, |
836 | const char* name = 0 ); | 839 | const char* name = 0 ); |
837 | KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 840 | KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
838 | QObject* parent = 0, const char* name = 0 ); | 841 | QObject* parent = 0, const char* name = 0 ); |
839 | KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 842 | KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
840 | QObject* parent = 0, const char* name = 0 ); | 843 | QObject* parent = 0, const char* name = 0 ); |
841 | KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 844 | KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
842 | const QObject* receiver, const char* slot, QObject* parent, | 845 | const QObject* receiver, const char* slot, QObject* parent, |
843 | const char* name = 0 ); | 846 | const char* name = 0 ); |
844 | KFontAction( const QString& text, const QString& pix, const KShortcut& cut, | 847 | KFontAction( const QString& text, const QString& pix, const KShortcut& cut, |
845 | const QObject* receiver, const char* slot, QObject* parent, | 848 | const QObject* receiver, const char* slot, QObject* parent, |
846 | const char* name = 0 ); | 849 | const char* name = 0 ); |
847 | 850 | ||
848 | KFontAction( QObject* parent = 0, const char* name = 0 ); | 851 | KFontAction( QObject* parent = 0, const char* name = 0 ); |
849 | ~KFontAction(); | 852 | ~KFontAction(); |
850 | 853 | ||
851 | QString font() const { | 854 | QString font() const { |
852 | return currentText(); | 855 | return currentText(); |
853 | } | 856 | } |
854 | 857 | ||
855 | int plug( QWidget*, int index = -1 ); | 858 | int plug( QWidget*, int index = -1 ); |
856 | 859 | ||
857 | public slots: | 860 | public slots: |
@@ -860,37 +863,37 @@ public slots: | |||
860 | protected: | 863 | protected: |
861 | virtual void virtual_hook( int id, void* data ); | 864 | virtual void virtual_hook( int id, void* data ); |
862 | private: | 865 | private: |
863 | class KFontActionPrivate; | 866 | class KFontActionPrivate; |
864 | KFontActionPrivate *d; | 867 | KFontActionPrivate *d; |
865 | }; | 868 | }; |
866 | 869 | ||
867 | class KFontSizeAction : public KSelectAction | 870 | class KFontSizeAction : public KSelectAction |
868 | { | 871 | { |
869 | Q_OBJECT | 872 | Q_OBJECT |
870 | Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize ) | 873 | Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize ) |
871 | public: | 874 | public: |
872 | KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, | 875 | KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, |
873 | const char* name = 0 ); | 876 | const char* name = 0 ); |
874 | KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, | 877 | KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, |
875 | const char* slot, QObject* parent, const char* name = 0 ); | 878 | const char* slot, QObject* parent, const char* name = 0 ); |
876 | KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), | 879 | KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), |
877 | QObject* parent = 0, const char* name = 0 ); | 880 | QObject* parent = 0, const char* name = 0 ); |
878 | KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), | 881 | KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), |
879 | QObject* parent = 0, const char* name = 0 ); | 882 | QObject* parent = 0, const char* name = 0 ); |
880 | KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut, | 883 | KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut, |
881 | const QObject* receiver, const char* slot, | 884 | const QObject* receiver, const char* slot, |
882 | QObject* parent, const char* name = 0 ); | 885 | QObject* parent, const char* name = 0 ); |
883 | KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, | 886 | KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, |
884 | const QObject* receiver, const char* slot, | 887 | const QObject* receiver, const char* slot, |
885 | QObject* parent, const char* name = 0 ); | 888 | QObject* parent, const char* name = 0 ); |
886 | KFontSizeAction( QObject* parent = 0, const char* name = 0 ); | 889 | KFontSizeAction( QObject* parent = 0, const char* name = 0 ); |
887 | 890 | ||
888 | virtual ~KFontSizeAction(); | 891 | virtual ~KFontSizeAction(); |
889 | 892 | ||
890 | virtual int fontSize() const; | 893 | virtual int fontSize() const; |
891 | 894 | ||
892 | public slots: | 895 | public slots: |
893 | virtual void setFontSize( int size ); | 896 | virtual void setFontSize( int size ); |
894 | 897 | ||
895 | protected slots: | 898 | protected slots: |
896 | virtual void slotActivated( int ); | 899 | virtual void slotActivated( int ); |
@@ -918,44 +921,44 @@ private: | |||
918 | * Plugged in a popupmenu, it will create a submenu. | 921 | * Plugged in a popupmenu, it will create a submenu. |
919 | * Plugged in a toolbar, it will create a button with a popup menu. | 922 | * Plugged in a toolbar, it will create a button with a popup menu. |
920 | * | 923 | * |
921 | * This is the action used by the XMLGUI since it holds other actions. | 924 | * This is the action used by the XMLGUI since it holds other actions. |
922 | * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. | 925 | * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. |
923 | * See also setDelayed about the main action. | 926 | * See also setDelayed about the main action. |
924 | */ | 927 | */ |
925 | class KActionMenu : public KAction | 928 | class KActionMenu : public KAction |
926 | { | 929 | { |
927 | Q_OBJECT | 930 | Q_OBJECT |
928 | Q_PROPERTY( bool delayed READ delayed WRITE setDelayed ) | 931 | Q_PROPERTY( bool delayed READ delayed WRITE setDelayed ) |
929 | Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu ) | 932 | Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu ) |
930 | 933 | ||
931 | public: | 934 | public: |
932 | KActionMenu( const QString& text, QObject* parent = 0, | 935 | KActionMenu( const QString& text, QObject* parent = 0, |
933 | const char* name = 0 ); | 936 | const char* name = 0 ); |
934 | KActionMenu( const QString& text, const QIconSet& icon, | 937 | KActionMenu( const QString& text, const QIcon& icon, |
935 | QObject* parent = 0, const char* name = 0 ); | 938 | QObject* parent = 0, const char* name = 0 ); |
936 | KActionMenu( const QString& text, const QString& icon, | 939 | KActionMenu( const QString& text, const QString& icon, |
937 | QObject* parent = 0, const char* name = 0 ); | 940 | QObject* parent = 0, const char* name = 0 ); |
938 | KActionMenu( QObject* parent = 0, const char* name = 0 ); | 941 | KActionMenu( QObject* parent = 0, const char* name = 0 ); |
939 | virtual ~KActionMenu(); | 942 | virtual ~KActionMenu(); |
940 | 943 | ||
941 | virtual void insert( KAction*, int index = -1 ); | 944 | virtual void insert( KAction*, int index = -1 ); |
942 | virtual void remove( KAction* ); | 945 | virtual void remove( KAction* ); |
943 | 946 | ||
944 | //US KPopupMenu* popupMenu() const; | 947 | //US KPopupMenu* popupMenu() const; |
945 | QPopupMenu* popupMenu() const; | 948 | Q3PopupMenu* popupMenu() const; |
946 | void popup( const QPoint& global ); | 949 | void popup( const QPoint& global ); |
947 | 950 | ||
948 | /** | 951 | /** |
949 | * Returns true if this action creates a delayed popup menu | 952 | * Returns true if this action creates a delayed popup menu |
950 | * when plugged in a KToolbar. | 953 | * when plugged in a KToolbar. |
951 | */ | 954 | */ |
952 | bool delayed() const; | 955 | bool delayed() const; |
953 | /** | 956 | /** |
954 | * If set to true, this action will create a delayed popup menu | 957 | * If set to true, this action will create a delayed popup menu |
955 | * when plugged in a KToolbar. Otherwise it creates a normal popup. | 958 | * when plugged in a KToolbar. Otherwise it creates a normal popup. |
956 | * Default: delayed | 959 | * Default: delayed |
957 | * | 960 | * |
958 | * Remember that if the "main" action (the toolbar button itself) | 961 | * Remember that if the "main" action (the toolbar button itself) |
959 | * cannot be clicked, then you should call setDelayed(false). | 962 | * cannot be clicked, then you should call setDelayed(false). |
960 | * | 963 | * |
961 | * On the opposite, if the main action can be clicked, it can only happen | 964 | * On the opposite, if the main action can be clicked, it can only happen |
@@ -1054,64 +1057,64 @@ public: | |||
1054 | */ | 1057 | */ |
1055 | 1058 | ||
1056 | KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut, | 1059 | KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut, |
1057 | const QObject* receiver, const char* slot, | 1060 | const QObject* receiver, const char* slot, |
1058 | KActionCollection* parent, const char* name ); | 1061 | KActionCollection* parent, const char* name ); |
1059 | 1062 | ||
1060 | virtual ~KToolBarPopupAction(); | 1063 | virtual ~KToolBarPopupAction(); |
1061 | 1064 | ||
1062 | virtual int plug( QWidget *widget, int index = -1 ); | 1065 | virtual int plug( QWidget *widget, int index = -1 ); |
1063 | 1066 | ||
1064 | /** | 1067 | /** |
1065 | * The popup menu that is shown when clicking (some time) on the toolbar | 1068 | * The popup menu that is shown when clicking (some time) on the toolbar |
1066 | * button. You may want to plug items into it on creation, or connect to | 1069 | * button. You may want to plug items into it on creation, or connect to |
1067 | * aboutToShow for a more dynamic menu. | 1070 | * aboutToShow for a more dynamic menu. |
1068 | */ | 1071 | */ |
1069 | //US KPopupMenu *popupMenu() const; | 1072 | //US KPopupMenu *popupMenu() const; |
1070 | QPopupMenu *popupMenu() const; | 1073 | Q3PopupMenu *popupMenu() const; |
1071 | 1074 | ||
1072 | /** | 1075 | /** |
1073 | * Returns true if this action creates a delayed popup menu | 1076 | * Returns true if this action creates a delayed popup menu |
1074 | * when plugged in a KToolbar. | 1077 | * when plugged in a KToolbar. |
1075 | */ | 1078 | */ |
1076 | bool delayed() const; | 1079 | bool delayed() const; |
1077 | /** | 1080 | /** |
1078 | * If set to true, this action will create a delayed popup menu | 1081 | * If set to true, this action will create a delayed popup menu |
1079 | * when plugged in a KToolbar. Otherwise it creates a normal popup. | 1082 | * when plugged in a KToolbar. Otherwise it creates a normal popup. |
1080 | * Default: delayed. | 1083 | * Default: delayed. |
1081 | */ | 1084 | */ |
1082 | void setDelayed(bool delayed); | 1085 | void setDelayed(bool delayed); |
1083 | /** | 1086 | /** |
1084 | * Returns true if this action creates a sticky popup menu. | 1087 | * Returns true if this action creates a sticky popup menu. |
1085 | * See @ref setStickyMenu. | 1088 | * See @ref setStickyMenu. |
1086 | */ | 1089 | */ |
1087 | bool stickyMenu() const; | 1090 | bool stickyMenu() const; |
1088 | /** | 1091 | /** |
1089 | * If set to true, this action will create a sticky popup menu | 1092 | * If set to true, this action will create a sticky popup menu |
1090 | * when plugged in a KToolbar. | 1093 | * when plugged in a KToolbar. |
1091 | * "Sticky", means it's visible until a selection is made or the mouse is | 1094 | * "Sticky", means it's visible until a selection is made or the mouse is |
1092 | * clicked elsewhere. This feature allows you to make a selection without | 1095 | * clicked elsewhere. This feature allows you to make a selection without |
1093 | * having to press and hold down the mouse while making a selection. | 1096 | * having to press and hold down the mouse while making a selection. |
1094 | * Only available if delayed() is true. | 1097 | * Only available if delayed() is true. |
1095 | * Default: sticky. | 1098 | * Default: sticky. |
1096 | */ | 1099 | */ |
1097 | void setStickyMenu(bool sticky); | 1100 | void setStickyMenu(bool sticky); |
1098 | 1101 | ||
1099 | private: | 1102 | private: |
1100 | //US KPopupMenu *m_popup; | 1103 | //US KPopupMenu *m_popup; |
1101 | QPopupMenu *m_popup; | 1104 | Q3PopupMenu *m_popup; |
1102 | bool m_delayed:1; | 1105 | bool m_delayed:1; |
1103 | bool m_stickyMenu:1; | 1106 | bool m_stickyMenu:1; |
1104 | protected: | 1107 | protected: |
1105 | virtual void virtual_hook( int id, void* data ); | 1108 | virtual void virtual_hook( int id, void* data ); |
1106 | private: | 1109 | private: |
1107 | class KToolBarPopupActionPrivate; | 1110 | class KToolBarPopupActionPrivate; |
1108 | KToolBarPopupActionPrivate *d; | 1111 | KToolBarPopupActionPrivate *d; |
1109 | }; | 1112 | }; |
1110 | 1113 | ||
1111 | /** | 1114 | /** |
1112 | * An action that takes care of everything associated with | 1115 | * An action that takes care of everything associated with |
1113 | * showing or hiding a toolbar by a menu action. It will | 1116 | * showing or hiding a toolbar by a menu action. It will |
1114 | * show or hide the toolbar with the given name when | 1117 | * show or hide the toolbar with the given name when |
1115 | * activated, and check or uncheck itself if the toolbar | 1118 | * activated, and check or uncheck itself if the toolbar |
1116 | * is manually shown or hidden. | 1119 | * is manually shown or hidden. |
1117 | * | 1120 | * |
@@ -1134,34 +1137,34 @@ public: | |||
1134 | KToggleToolBarAction( const char* toolBarName, const QString& text, | 1137 | KToggleToolBarAction( const char* toolBarName, const QString& text, |
1135 | KActionCollection* parent, const char* name ); | 1138 | KActionCollection* parent, const char* name ); |
1136 | KToggleToolBarAction( KToolBar *toolBar, const QString &text, | 1139 | KToggleToolBarAction( KToolBar *toolBar, const QString &text, |
1137 | KActionCollection *parent, const char *name ); | 1140 | KActionCollection *parent, const char *name ); |
1138 | virtual ~KToggleToolBarAction(); | 1141 | virtual ~KToggleToolBarAction(); |
1139 | 1142 | ||
1140 | virtual int plug( QWidget*, int index = -1 ); | 1143 | virtual int plug( QWidget*, int index = -1 ); |
1141 | 1144 | ||
1142 | KToolBar *toolBar() { | 1145 | KToolBar *toolBar() { |
1143 | return m_toolBar; | 1146 | return m_toolBar; |
1144 | } | 1147 | } |
1145 | 1148 | ||
1146 | public slots: | 1149 | public slots: |
1147 | virtual void setChecked( bool ); | 1150 | virtual void setChecked( bool ); |
1148 | 1151 | ||
1149 | private: | 1152 | private: |
1150 | QCString m_toolBarName; | 1153 | Q3CString m_toolBarName; |
1151 | QGuardedPtr<KToolBar> m_toolBar; | 1154 | QPointer<KToolBar> m_toolBar; |
1152 | protected: | 1155 | protected: |
1153 | virtual void virtual_hook( int id, void* data ); | 1156 | virtual void virtual_hook( int id, void* data ); |
1154 | private: | 1157 | private: |
1155 | class KToggleToolBarActionPrivate; | 1158 | class KToggleToolBarActionPrivate; |
1156 | KToggleToolBarActionPrivate *d; | 1159 | KToggleToolBarActionPrivate *d; |
1157 | }; | 1160 | }; |
1158 | 1161 | ||
1159 | /** | 1162 | /** |
1160 | * An action that automatically embeds a widget into a | 1163 | * An action that automatically embeds a widget into a |
1161 | * toolbar. | 1164 | * toolbar. |
1162 | */ | 1165 | */ |
1163 | class KWidgetAction : public KAction | 1166 | class KWidgetAction : public KAction |
1164 | { | 1167 | { |
1165 | Q_OBJECT | 1168 | Q_OBJECT |
1166 | public: | 1169 | public: |
1167 | /** | 1170 | /** |
@@ -1182,33 +1185,33 @@ public: | |||
1182 | 1185 | ||
1183 | void setAutoSized( bool ); | 1186 | void setAutoSized( bool ); |
1184 | 1187 | ||
1185 | /** | 1188 | /** |
1186 | * Plug the action. The widget passed to the constructor | 1189 | * Plug the action. The widget passed to the constructor |
1187 | * will be reparented to w, which must inherit KToolBar. | 1190 | * will be reparented to w, which must inherit KToolBar. |
1188 | */ | 1191 | */ |
1189 | virtual int plug( QWidget* w, int index = -1 ); | 1192 | virtual int plug( QWidget* w, int index = -1 ); |
1190 | /** | 1193 | /** |
1191 | * Unplug the action. Ensures that the action is not | 1194 | * Unplug the action. Ensures that the action is not |
1192 | * destroyed. It will be hidden and reparented to 0L instead. | 1195 | * destroyed. It will be hidden and reparented to 0L instead. |
1193 | */ | 1196 | */ |
1194 | virtual void unplug( QWidget *w ); | 1197 | virtual void unplug( QWidget *w ); |
1195 | protected slots: | 1198 | protected slots: |
1196 | void slotToolbarDestroyed(); | 1199 | void slotToolbarDestroyed(); |
1197 | private: | 1200 | private: |
1198 | QGuardedPtr<QWidget> m_widget; | 1201 | QPointer<QWidget> m_widget; |
1199 | bool m_autoSized; | 1202 | bool m_autoSized; |
1200 | protected: | 1203 | protected: |
1201 | virtual void virtual_hook( int id, void* data ); | 1204 | virtual void virtual_hook( int id, void* data ); |
1202 | private: | 1205 | private: |
1203 | class KWidgetActionPrivate; | 1206 | class KWidgetActionPrivate; |
1204 | KWidgetActionPrivate *d; | 1207 | KWidgetActionPrivate *d; |
1205 | }; | 1208 | }; |
1206 | 1209 | ||
1207 | class KActionSeparator : public KAction | 1210 | class KActionSeparator : public KAction |
1208 | { | 1211 | { |
1209 | Q_OBJECT | 1212 | Q_OBJECT |
1210 | public: | 1213 | public: |
1211 | KActionSeparator( QObject* parent = 0, const char* name = 0 ); | 1214 | KActionSeparator( QObject* parent = 0, const char* name = 0 ); |
1212 | virtual ~KActionSeparator(); | 1215 | virtual ~KActionSeparator(); |
1213 | 1216 | ||
1214 | virtual int plug( QWidget*, int index = -1 ); | 1217 | virtual int plug( QWidget*, int index = -1 ); |
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index 69e5d02..4d66c7f 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp | |||
@@ -13,80 +13,82 @@ | |||
13 | License version 2 as published by the Free Software Foundation. | 13 | License version 2 as published by the Free Software Foundation. |
14 | 14 | ||
15 | This library is distributed in the hope that it will be useful, | 15 | This library is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | Library General Public License for more details. | 18 | Library General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU Library General Public License | 20 | You should have received a copy of the GNU Library General Public License |
21 | along with this library; see the file COPYING.LIB. If not, write to | 21 | along with this library; see the file COPYING.LIB. If not, write to |
22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. | 23 | Boston, MA 02111-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "kactioncollection.h" | 26 | #include "kactioncollection.h" |
27 | //US#include "kactionshortcutlist.h" | 27 | //US#include "kactionshortcutlist.h" |
28 | 28 | ||
29 | #include <qptrdict.h> | 29 | #include <q3ptrdict.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3ValueList> | ||
30 | //US#include <qvariant.h> | 32 | //US#include <qvariant.h> |
31 | 33 | ||
32 | //US#include <kaccel.h> | 34 | //US#include <kaccel.h> |
33 | //US#include <kaccelbase.h> | 35 | //US#include <kaccelbase.h> |
34 | //US#include <kapplication.h> | 36 | //US#include <kapplication.h> |
35 | #include <kdebug.h> | 37 | #include <kdebug.h> |
36 | //US#include <kxmlguifactory.h> | 38 | //US#include <kxmlguifactory.h> |
37 | 39 | ||
38 | //US I included the following files | 40 | //US I included the following files |
39 | #include <qasciidict.h> | 41 | #include <q3asciidict.h> |
40 | #include <qptrlist.h> | 42 | #include <q3ptrlist.h> |
41 | #include "kaction.h" | 43 | #include "kaction.h" |
42 | #include <kglobal.h> | 44 | #include <kglobal.h> |
43 | #include <qobject.h> | 45 | #include <qobject.h> |
44 | #include <qwidget.h> | 46 | #include <qwidget.h> |
45 | 47 | ||
46 | class KActionCollection::KActionCollectionPrivate | 48 | class KActionCollection::KActionCollectionPrivate |
47 | { | 49 | { |
48 | public: | 50 | public: |
49 | KActionCollectionPrivate() | 51 | KActionCollectionPrivate() |
50 | { | 52 | { |
51 | //US m_instance = 0; | 53 | //US m_instance = 0; |
52 | //m_bOneKAccelOnly = false; | 54 | //m_bOneKAccelOnly = false; |
53 | //m_iWidgetCurrent = 0; | 55 | //m_iWidgetCurrent = 0; |
54 | m_bAutoConnectShortcuts = true; | 56 | m_bAutoConnectShortcuts = true; |
55 | m_widget = 0; | 57 | m_widget = 0; |
56 | m_kaccel = m_builderKAccel = 0; | 58 | m_kaccel = m_builderKAccel = 0; |
57 | m_dctHighlightContainers.setAutoDelete( true ); | 59 | m_dctHighlightContainers.setAutoDelete( true ); |
58 | m_highlight = false; | 60 | m_highlight = false; |
59 | m_currentHighlightAction = 0; | 61 | m_currentHighlightAction = 0; |
60 | m_statusCleared = true; | 62 | m_statusCleared = true; |
61 | } | 63 | } |
62 | 64 | ||
63 | //US KInstance *m_instance; | 65 | //US KInstance *m_instance; |
64 | //US QString m_sXMLFile; | 66 | //US QString m_sXMLFile; |
65 | bool m_bAutoConnectShortcuts; | 67 | bool m_bAutoConnectShortcuts; |
66 | //bool m_bOneKAccelOnly; | 68 | //bool m_bOneKAccelOnly; |
67 | //int m_iWidgetCurrent; | 69 | //int m_iWidgetCurrent; |
68 | //QValueList<QWidget*> m_widgetList; | 70 | //QValueList<QWidget*> m_widgetList; |
69 | //QValueList<KAccel*> m_kaccelList; | 71 | //QValueList<KAccel*> m_kaccelList; |
70 | QValueList<KActionCollection*> m_docList; | 72 | Q3ValueList<KActionCollection*> m_docList; |
71 | QWidget *m_widget; | 73 | QWidget *m_widget; |
72 | KAccel *m_kaccel; | 74 | KAccel *m_kaccel; |
73 | KAccel *m_builderKAccel; | 75 | KAccel *m_builderKAccel; |
74 | 76 | ||
75 | QAsciiDict<KAction> m_actionDict; | 77 | Q3AsciiDict<KAction> m_actionDict; |
76 | QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; | 78 | Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers; |
77 | bool m_highlight; | 79 | bool m_highlight; |
78 | KAction *m_currentHighlightAction; | 80 | KAction *m_currentHighlightAction; |
79 | bool m_statusCleared; | 81 | bool m_statusCleared; |
80 | }; | 82 | }; |
81 | 83 | ||
82 | KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, | 84 | KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, |
83 | KInstance *instance */) | 85 | KInstance *instance */) |
84 | : QObject( (QObject*)parent, name ) | 86 | : QObject( (QObject*)parent, name ) |
85 | { | 87 | { |
86 | kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis | 88 | kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis |
87 | d = new KActionCollectionPrivate; | 89 | d = new KActionCollectionPrivate; |
88 | if( parent ) | 90 | if( parent ) |
89 | setWidget( parent ); | 91 | setWidget( parent ); |
90 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 92 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
91 | //US setInstance( instance ); | 93 | //US setInstance( instance ); |
92 | } | 94 | } |
@@ -120,33 +122,33 @@ KActionCollection::KActionCollection( QObject *parent, const char *name /*US, | |||
120 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 122 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
121 | //US setInstance( instance ); | 123 | //US setInstance( instance ); |
122 | } | 124 | } |
123 | 125 | ||
124 | KActionCollection::KActionCollection( const KActionCollection © ) | 126 | KActionCollection::KActionCollection( const KActionCollection © ) |
125 | : QObject() | 127 | : QObject() |
126 | { | 128 | { |
127 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; | 129 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; |
128 | d = new KActionCollectionPrivate; | 130 | d = new KActionCollectionPrivate; |
129 | *this = copy; | 131 | *this = copy; |
130 | } | 132 | } |
131 | // KDE 4: remove end | 133 | // KDE 4: remove end |
132 | 134 | ||
133 | KActionCollection::~KActionCollection() | 135 | KActionCollection::~KActionCollection() |
134 | { | 136 | { |
135 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; | 137 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; |
136 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { | 138 | for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { |
137 | KAction* pAction = it.current(); | 139 | KAction* pAction = it.current(); |
138 | if ( pAction->m_parentCollection == this ) | 140 | if ( pAction->m_parentCollection == this ) |
139 | pAction->m_parentCollection = 0L; | 141 | pAction->m_parentCollection = 0L; |
140 | } | 142 | } |
141 | 143 | ||
142 | //US delete d->m_kaccel; | 144 | //US delete d->m_kaccel; |
143 | //US delete d->m_builderKAccel; | 145 | //US delete d->m_builderKAccel; |
144 | delete d; d = 0; | 146 | delete d; d = 0; |
145 | } | 147 | } |
146 | 148 | ||
147 | void KActionCollection::setWidget( QWidget* w ) | 149 | void KActionCollection::setWidget( QWidget* w ) |
148 | { | 150 | { |
149 | //if ( d->m_actionDict.count() > 0 ) { | 151 | //if ( d->m_actionDict.count() > 0 ) { |
150 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; | 152 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; |
151 | // kdDebug(129) << kdBacktrace() << endl; | 153 | // kdDebug(129) << kdBacktrace() << endl; |
152 | //} | 154 | //} |
@@ -352,126 +354,126 @@ KAction* KActionCollection::_take( KAction* action ) | |||
352 | if( qstrcmp( name, "unnamed" ) == 0 ) | 354 | if( qstrcmp( name, "unnamed" ) == 0 ) |
353 | { | 355 | { |
354 | sprintf(unnamed_name, "unnamed-%p", (void *) action); | 356 | sprintf(unnamed_name, "unnamed-%p", (void *) action); |
355 | name = unnamed_name; | 357 | name = unnamed_name; |
356 | } | 358 | } |
357 | 359 | ||
358 | KAction *a = d->m_actionDict.take( name ); | 360 | KAction *a = d->m_actionDict.take( name ); |
359 | if ( !a || a != action ) | 361 | if ( !a || a != action ) |
360 | return 0; | 362 | return 0; |
361 | 363 | ||
362 | emit removed( action ); | 364 | emit removed( action ); |
363 | return a; | 365 | return a; |
364 | } | 366 | } |
365 | 367 | ||
366 | void KActionCollection::_clear() | 368 | void KActionCollection::_clear() |
367 | { | 369 | { |
368 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 370 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
369 | while ( it.current() ) | 371 | while ( it.current() ) |
370 | _remove( it.current() ); | 372 | _remove( it.current() ); |
371 | } | 373 | } |
372 | 374 | ||
373 | void KActionCollection::insert( KAction* action ) { _insert( action ); } | 375 | void KActionCollection::insert( KAction* action ) { _insert( action ); } |
374 | void KActionCollection::remove( KAction* action ) { _remove( action ); } | 376 | void KActionCollection::remove( KAction* action ) { _remove( action ); } |
375 | KAction* KActionCollection::take( KAction* action ) { return _take( action ); } | 377 | KAction* KActionCollection::take( KAction* action ) { return _take( action ); } |
376 | void KActionCollection::clear() { _clear(); } | 378 | void KActionCollection::clear() { _clear(); } |
377 | KAccel* KActionCollection::accel() { return kaccel(); } | 379 | KAccel* KActionCollection::accel() { return kaccel(); } |
378 | const KAccel* KActionCollection::accel() const { return kaccel(); } | 380 | const KAccel* KActionCollection::accel() const { return kaccel(); } |
379 | KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; } | 381 | KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; } |
380 | 382 | ||
381 | KAction* KActionCollection::action( const char* name, const char* classname ) const | 383 | KAction* KActionCollection::action( const char* name, const char* classname ) const |
382 | { | 384 | { |
383 | KAction* pAction = 0; | 385 | KAction* pAction = 0; |
384 | 386 | ||
385 | if ( !classname && name ) | 387 | if ( !classname && name ) |
386 | pAction = d->m_actionDict[ name ]; | 388 | pAction = d->m_actionDict[ name ]; |
387 | 389 | ||
388 | else { | 390 | else { |
389 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 391 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
390 | for( ; it.current(); ++it ) | 392 | for( ; it.current(); ++it ) |
391 | { | 393 | { |
392 | if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) && | 394 | if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) && |
393 | ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) { | 395 | ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) { |
394 | pAction = it.current(); | 396 | pAction = it.current(); |
395 | break; | 397 | break; |
396 | } | 398 | } |
397 | } | 399 | } |
398 | } | 400 | } |
399 | 401 | ||
400 | if( !pAction ) { | 402 | if( !pAction ) { |
401 | for( uint i = 0; i < d->m_docList.count() && !pAction; i++ ) | 403 | for( uint i = 0; i < d->m_docList.count() && !pAction; i++ ) |
402 | pAction = d->m_docList[i]->action( name, classname ); | 404 | pAction = d->m_docList[i]->action( name, classname ); |
403 | } | 405 | } |
404 | 406 | ||
405 | return pAction; | 407 | return pAction; |
406 | } | 408 | } |
407 | 409 | ||
408 | KAction* KActionCollection::action( int index ) const | 410 | KAction* KActionCollection::action( int index ) const |
409 | { | 411 | { |
410 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 412 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
411 | it += index; | 413 | it += index; |
412 | return it.current(); | 414 | return it.current(); |
413 | // return d->m_actions.at( index ); | 415 | // return d->m_actions.at( index ); |
414 | } | 416 | } |
415 | /*US | 417 | /*US |
416 | bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) | 418 | bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) |
417 | { | 419 | { |
418 | return KActionShortcutList(this).readSettings( sConfigGroup, pConfig ); | 420 | return KActionShortcutList(this).readSettings( sConfigGroup, pConfig ); |
419 | } | 421 | } |
420 | 422 | ||
421 | bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const | 423 | bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const |
422 | { | 424 | { |
423 | return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig ); | 425 | return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig ); |
424 | } | 426 | } |
425 | */ | 427 | */ |
426 | uint KActionCollection::count() const | 428 | uint KActionCollection::count() const |
427 | { | 429 | { |
428 | return d->m_actionDict.count(); | 430 | return d->m_actionDict.count(); |
429 | } | 431 | } |
430 | 432 | ||
431 | QStringList KActionCollection::groups() const | 433 | QStringList KActionCollection::groups() const |
432 | { | 434 | { |
433 | QStringList lst; | 435 | QStringList lst; |
434 | 436 | ||
435 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 437 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
436 | for( ; it.current(); ++it ) | 438 | for( ; it.current(); ++it ) |
437 | if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) ) | 439 | if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) ) |
438 | lst.append( it.current()->group() ); | 440 | lst.append( it.current()->group() ); |
439 | 441 | ||
440 | return lst; | 442 | return lst; |
441 | } | 443 | } |
442 | 444 | ||
443 | KActionPtrList KActionCollection::actions( const QString& group ) const | 445 | KActionPtrList KActionCollection::actions( const QString& group ) const |
444 | { | 446 | { |
445 | KActionPtrList lst; | 447 | KActionPtrList lst; |
446 | 448 | ||
447 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 449 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
448 | for( ; it.current(); ++it ) | 450 | for( ; it.current(); ++it ) |
449 | if ( it.current()->group() == group ) | 451 | if ( it.current()->group() == group ) |
450 | lst.append( it.current() ); | 452 | lst.append( it.current() ); |
451 | else if ( it.current()->group().isEmpty() && group.isEmpty() ) | 453 | else if ( it.current()->group().isEmpty() && group.isEmpty() ) |
452 | lst.append( it.current() ); | 454 | lst.append( it.current() ); |
453 | 455 | ||
454 | return lst; | 456 | return lst; |
455 | } | 457 | } |
456 | 458 | ||
457 | KActionPtrList KActionCollection::actions() const | 459 | KActionPtrList KActionCollection::actions() const |
458 | { | 460 | { |
459 | KActionPtrList lst; | 461 | KActionPtrList lst; |
460 | 462 | ||
461 | QAsciiDictIterator<KAction> it( d->m_actionDict ); | 463 | Q3AsciiDictIterator<KAction> it( d->m_actionDict ); |
462 | for( ; it.current(); ++it ) | 464 | for( ; it.current(); ++it ) |
463 | lst.append( it.current() ); | 465 | lst.append( it.current() ); |
464 | 466 | ||
465 | return lst; | 467 | return lst; |
466 | } | 468 | } |
467 | 469 | ||
468 | /*US we have no instance object. Use KGlobal instead | 470 | /*US we have no instance object. Use KGlobal instead |
469 | void KActionCollection::setInstance( KInstance *instance ) | 471 | void KActionCollection::setInstance( KInstance *instance ) |
470 | { | 472 | { |
471 | if ( instance ) | 473 | if ( instance ) |
472 | d->m_instance = instance; | 474 | d->m_instance = instance; |
473 | qDebug("KActionCollection::setInstance has to be fixed"); | 475 | qDebug("KActionCollection::setInstance has to be fixed"); |
474 | else | 476 | else |
475 | d->m_instance = KGlobal::instance(); | 477 | d->m_instance = KGlobal::instance(); |
476 | } | 478 | } |
477 | 479 | ||
@@ -495,67 +497,67 @@ const QString& KActionCollection::xmlFile() const | |||
495 | 497 | ||
496 | void KActionCollection::setHighlightingEnabled( bool enable ) | 498 | void KActionCollection::setHighlightingEnabled( bool enable ) |
497 | { | 499 | { |
498 | d->m_highlight = enable; | 500 | d->m_highlight = enable; |
499 | } | 501 | } |
500 | 502 | ||
501 | bool KActionCollection::highlightingEnabled() const | 503 | bool KActionCollection::highlightingEnabled() const |
502 | { | 504 | { |
503 | return d->m_highlight; | 505 | return d->m_highlight; |
504 | } | 506 | } |
505 | 507 | ||
506 | void KActionCollection::connectHighlight( QWidget *container, KAction *action ) | 508 | void KActionCollection::connectHighlight( QWidget *container, KAction *action ) |
507 | { | 509 | { |
508 | if ( !d->m_highlight ) | 510 | if ( !d->m_highlight ) |
509 | return; | 511 | return; |
510 | 512 | ||
511 | QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; | 513 | Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; |
512 | 514 | ||
513 | if ( !actionList ) | 515 | if ( !actionList ) |
514 | { | 516 | { |
515 | actionList = new QPtrList<KAction>; | 517 | actionList = new Q3PtrList<KAction>; |
516 | 518 | ||
517 | if ( container->inherits( "QPopupMenu" ) ) | 519 | if ( container->inherits( "Q3PopupMenu" ) ) |
518 | { | 520 | { |
519 | connect( container, SIGNAL( highlighted( int ) ), | 521 | connect( container, SIGNAL( highlighted( int ) ), |
520 | this, SLOT( slotMenuItemHighlighted( int ) ) ); | 522 | this, SLOT( slotMenuItemHighlighted( int ) ) ); |
521 | connect( container, SIGNAL( aboutToHide() ), | 523 | connect( container, SIGNAL( aboutToHide() ), |
522 | this, SLOT( slotMenuAboutToHide() ) ); | 524 | this, SLOT( slotMenuAboutToHide() ) ); |
523 | } | 525 | } |
524 | //US else if ( container->inherits( "KToolBar" ) ) | 526 | //US else if ( container->inherits( "KToolBar" ) ) |
525 | else if ( container->inherits( "QToolBar" ) ) | 527 | else if ( container->inherits( "Q3ToolBar" ) ) |
526 | { | 528 | { |
527 | connect( container, SIGNAL( highlighted( int, bool ) ), | 529 | connect( container, SIGNAL( highlighted( int, bool ) ), |
528 | this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) ); | 530 | this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) ); |
529 | } | 531 | } |
530 | 532 | ||
531 | connect( container, SIGNAL( destroyed() ), | 533 | connect( container, SIGNAL( destroyed() ), |
532 | this, SLOT( slotDestroyed() ) ); | 534 | this, SLOT( slotDestroyed() ) ); |
533 | 535 | ||
534 | d->m_dctHighlightContainers.insert( container, actionList ); | 536 | d->m_dctHighlightContainers.insert( container, actionList ); |
535 | } | 537 | } |
536 | 538 | ||
537 | actionList->append( action ); | 539 | actionList->append( action ); |
538 | } | 540 | } |
539 | 541 | ||
540 | void KActionCollection::disconnectHighlight( QWidget *container, KAction *action ) | 542 | void KActionCollection::disconnectHighlight( QWidget *container, KAction *action ) |
541 | { | 543 | { |
542 | if ( !d->m_highlight ) | 544 | if ( !d->m_highlight ) |
543 | return; | 545 | return; |
544 | 546 | ||
545 | QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; | 547 | Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; |
546 | 548 | ||
547 | if ( !actionList ) | 549 | if ( !actionList ) |
548 | return; | 550 | return; |
549 | 551 | ||
550 | actionList->removeRef( action ); | 552 | actionList->removeRef( action ); |
551 | 553 | ||
552 | if ( actionList->count() == 0 ) | 554 | if ( actionList->count() == 0 ) |
553 | d->m_dctHighlightContainers.remove( container ); | 555 | d->m_dctHighlightContainers.remove( container ); |
554 | } | 556 | } |
555 | 557 | ||
556 | void KActionCollection::slotMenuItemHighlighted( int id ) | 558 | void KActionCollection::slotMenuItemHighlighted( int id ) |
557 | { | 559 | { |
558 | if ( !d->m_highlight ) | 560 | if ( !d->m_highlight ) |
559 | return; | 561 | return; |
560 | 562 | ||
561 | if ( d->m_currentHighlightAction ) | 563 | if ( d->m_currentHighlightAction ) |
@@ -612,78 +614,78 @@ void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight ) | |||
612 | if ( highlight ) | 614 | if ( highlight ) |
613 | d->m_currentHighlightAction = action; | 615 | d->m_currentHighlightAction = action; |
614 | else | 616 | else |
615 | { | 617 | { |
616 | d->m_currentHighlightAction = 0; | 618 | d->m_currentHighlightAction = 0; |
617 | // emit clearStatusText(); | 619 | // emit clearStatusText(); |
618 | } | 620 | } |
619 | } | 621 | } |
620 | 622 | ||
621 | void KActionCollection::slotDestroyed() | 623 | void KActionCollection::slotDestroyed() |
622 | { | 624 | { |
623 | d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) ); | 625 | d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) ); |
624 | } | 626 | } |
625 | 627 | ||
626 | KAction *KActionCollection::findAction( QWidget *container, int id ) | 628 | KAction *KActionCollection::findAction( QWidget *container, int id ) |
627 | { | 629 | { |
628 | QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; | 630 | Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; |
629 | 631 | ||
630 | if ( !actionList ) | 632 | if ( !actionList ) |
631 | return 0; | 633 | return 0; |
632 | 634 | ||
633 | QPtrListIterator<KAction> it( *actionList ); | 635 | Q3PtrListIterator<KAction> it( *actionList ); |
634 | for (; it.current(); ++it ) | 636 | for (; it.current(); ++it ) |
635 | if ( it.current()->isPlugged( container, id ) ) | 637 | if ( it.current()->isPlugged( container, id ) ) |
636 | return it.current(); | 638 | return it.current(); |
637 | 639 | ||
638 | return 0; | 640 | return 0; |
639 | } | 641 | } |
640 | 642 | ||
641 | // KDE 4: remove | 643 | // KDE 4: remove |
642 | KActionCollection KActionCollection::operator+(const KActionCollection &c ) const | 644 | KActionCollection KActionCollection::operator+(const KActionCollection &c ) const |
643 | { | 645 | { |
644 | kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl; | 646 | kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl; |
645 | KActionCollection ret( *this ); | 647 | KActionCollection ret( *this ); |
646 | 648 | ||
647 | QValueList<KAction *> actions = c.actions(); | 649 | Q3ValueList<KAction *> actions = c.actions(); |
648 | QValueList<KAction *>::ConstIterator it = actions.begin(); | 650 | Q3ValueList<KAction *>::ConstIterator it = actions.begin(); |
649 | QValueList<KAction *>::ConstIterator end = actions.end(); | 651 | Q3ValueList<KAction *>::ConstIterator end = actions.end(); |
650 | for (; it != end; ++it ) | 652 | for (; it != end; ++it ) |
651 | ret.insert( *it ); | 653 | ret.insert( *it ); |
652 | 654 | ||
653 | return ret; | 655 | return ret; |
654 | } | 656 | } |
655 | 657 | ||
656 | KActionCollection &KActionCollection::operator=( const KActionCollection © ) | 658 | KActionCollection &KActionCollection::operator=( const KActionCollection © ) |
657 | { | 659 | { |
658 | kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl; | 660 | kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl; |
659 | //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly; | 661 | //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly; |
660 | //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent; | 662 | //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent; |
661 | //d->m_widgetList = copy.d->m_widgetList; | 663 | //d->m_widgetList = copy.d->m_widgetList; |
662 | //d->m_kaccelList = copy.d->m_kaccelList; | 664 | //d->m_kaccelList = copy.d->m_kaccelList; |
663 | d->m_widget = copy.d->m_widget; | 665 | d->m_widget = copy.d->m_widget; |
664 | d->m_kaccel = copy.d->m_kaccel; | 666 | d->m_kaccel = copy.d->m_kaccel; |
665 | d->m_actionDict = copy.d->m_actionDict; | 667 | d->m_actionDict = copy.d->m_actionDict; |
666 | //US setInstance( copy.instance() ); | 668 | //US setInstance( copy.instance() ); |
667 | return *this; | 669 | return *this; |
668 | } | 670 | } |
669 | 671 | ||
670 | KActionCollection &KActionCollection::operator+=( const KActionCollection &c ) | 672 | KActionCollection &KActionCollection::operator+=( const KActionCollection &c ) |
671 | { | 673 | { |
672 | kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl; | 674 | kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl; |
673 | QAsciiDictIterator<KAction> it(c.d->m_actionDict); | 675 | Q3AsciiDictIterator<KAction> it(c.d->m_actionDict); |
674 | for ( ; it.current(); ++it ) | 676 | for ( ; it.current(); ++it ) |
675 | insert( it.current() ); | 677 | insert( it.current() ); |
676 | 678 | ||
677 | return *this; | 679 | return *this; |
678 | } | 680 | } |
679 | // KDE 4: remove end | 681 | // KDE 4: remove end |
680 | 682 | ||
681 | //--------------------------------------------------------------------- | 683 | //--------------------------------------------------------------------- |
682 | // KActionShortcutList | 684 | // KActionShortcutList |
683 | //--------------------------------------------------------------------- | 685 | //--------------------------------------------------------------------- |
684 | /*US | 686 | /*US |
685 | KActionShortcutList::KActionShortcutList( KActionCollection* pColl ) | 687 | KActionShortcutList::KActionShortcutList( KActionCollection* pColl ) |
686 | : m_actions( *pColl ) | 688 | : m_actions( *pColl ) |
687 | { } | 689 | { } |
688 | KActionShortcutList::~KActionShortcutList() | 690 | KActionShortcutList::~KActionShortcutList() |
689 | { } | 691 | { } |
diff --git a/microkde/kdeui/kactioncollection.h b/microkde/kdeui/kactioncollection.h index b9466d0..50cb02a 100644 --- a/microkde/kdeui/kactioncollection.h +++ b/microkde/kdeui/kactioncollection.h | |||
@@ -17,63 +17,65 @@ | |||
17 | Library General Public License for more details. | 17 | Library General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | //$Id$ | 24 | //$Id$ |
25 | 25 | ||
26 | #ifndef __kactioncollection_h__ | 26 | #ifndef __kactioncollection_h__ |
27 | #define __kactioncollection_h__ | 27 | #define __kactioncollection_h__ |
28 | 28 | ||
29 | #include <kaction.h> | 29 | #include <kaction.h> |
30 | 30 | ||
31 | //US #include <qkeysequence.h> | 31 | //US #include <qkeysequence.h> |
32 | #include <qobject.h> | 32 | #include <qobject.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3ValueList> | ||
33 | //US#include <qvaluelist.h> | 35 | //US#include <qvaluelist.h> |
34 | //US#include <qguardedptr.h> | 36 | //US#include <qguardedptr.h> |
35 | //US #include <kguiitem.h> | 37 | //US #include <kguiitem.h> |
36 | //US#include <kshortcut.h> | 38 | //US#include <kshortcut.h> |
37 | //US#include <kstdaction.h> | 39 | //US#include <kstdaction.h> |
38 | //US#include <kicontheme.h> | 40 | //US#include <kicontheme.h> |
39 | 41 | ||
40 | //USclass QMenuBar; | 42 | //USclass QMenuBar; |
41 | //USclass QPopupMenu; | 43 | //USclass QPopupMenu; |
42 | //USclass QComboBox; | 44 | //USclass QComboBox; |
43 | //USclass QPoint; | 45 | //USclass QPoint; |
44 | //USclass QIconSet; | 46 | //USclass QIconSet; |
45 | //USclass QString; | 47 | //USclass QString; |
46 | //USclass KToolBar; | 48 | //USclass KToolBar; |
47 | 49 | ||
48 | //USclass KAccel; | 50 | //USclass KAccel; |
49 | //USclass KAccelActions; | 51 | //USclass KAccelActions; |
50 | //USclass KConfig; | 52 | //USclass KConfig; |
51 | //USclass KConfigBase; | 53 | //USclass KConfigBase; |
52 | //USclass KURL; | 54 | //USclass KURL; |
53 | //USclass KInstance; | 55 | //USclass KInstance; |
54 | //USclass KToolBar; | 56 | //USclass KToolBar; |
55 | //USclass KActionCollection; | 57 | //USclass KActionCollection; |
56 | //USclass KPopupMenu; | 58 | //USclass KPopupMenu; |
57 | //USclass KMainWindow; | 59 | //USclass KMainWindow; |
58 | 60 | ||
59 | //US added inclidefiles | 61 | //US added inclidefiles |
60 | class QWidget; | 62 | class QWidget; |
61 | 63 | ||
62 | 64 | ||
63 | typedef QValueList<KAction *> KActionPtrList; | 65 | typedef Q3ValueList<KAction *> KActionPtrList; |
64 | 66 | ||
65 | /** | 67 | /** |
66 | * A managed set of KAction objects. | 68 | * A managed set of KAction objects. |
67 | */ | 69 | */ |
68 | class KActionCollection : public QObject | 70 | class KActionCollection : public QObject |
69 | { | 71 | { |
70 | friend class KAction; | 72 | friend class KAction; |
71 | friend class KXMLGUIClient; | 73 | friend class KXMLGUIClient; |
72 | 74 | ||
73 | Q_OBJECT | 75 | Q_OBJECT |
74 | public: | 76 | public: |
75 | KActionCollection( QWidget *parent, const char *name = 0/*US , KInstance *instance = 0 */); | 77 | KActionCollection( QWidget *parent, const char *name = 0/*US , KInstance *instance = 0 */); |
76 | /** | 78 | /** |
77 | * Use this constructor if you want the collection's actions to restrict | 79 | * Use this constructor if you want the collection's actions to restrict |
78 | * their accelerator keys to @p watch rather than the @p parent. If | 80 | * their accelerator keys to @p watch rather than the @p parent. If |
79 | * you don't require shortcuts, you can pass a null to the @p watch parameter. | 81 | * you don't require shortcuts, you can pass a null to the @p watch parameter. |
diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp index 83d622a..3ea6703 100644 --- a/microkde/kdeui/kbuttonbox.cpp +++ b/microkde/kdeui/kbuttonbox.cpp | |||
@@ -36,57 +36,59 @@ | |||
36 | * | 36 | * |
37 | * 01/17/98 Mario Weilguni <mweilguni@sime.com> | 37 | * 01/17/98 Mario Weilguni <mweilguni@sime.com> |
38 | * Fixed a bug in sizeHint() | 38 | * Fixed a bug in sizeHint() |
39 | * Improved the handling of Motif default buttons | 39 | * Improved the handling of Motif default buttons |
40 | * | 40 | * |
41 | * 01/09/98 Mario Weilguni <mweilguni@sime.com> | 41 | * 01/09/98 Mario Weilguni <mweilguni@sime.com> |
42 | * The last button was to far right away from the right/bottom border. | 42 | * The last button was to far right away from the right/bottom border. |
43 | * Fixed this. Removed old code. Buttons get now a minimum width. | 43 | * Fixed this. Removed old code. Buttons get now a minimum width. |
44 | * Programmer may now override minimum width and height of a button. | 44 | * Programmer may now override minimum width and height of a button. |
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | 47 | ||
48 | //US #include "kbuttonbox.moc" | 48 | //US #include "kbuttonbox.moc" |
49 | 49 | ||
50 | #include <kbuttonbox.h> | 50 | #include <kbuttonbox.h> |
51 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
52 | #include <qptrlist.h> | 52 | #include <q3ptrlist.h> |
53 | //Added by qt3to4: | ||
54 | #include <QResizeEvent> | ||
53 | #include <assert.h> | 55 | #include <assert.h> |
54 | 56 | ||
55 | #define minButtonWidth 50 | 57 | #define minButtonWidth 50 |
56 | 58 | ||
57 | class KButtonBox::Item { | 59 | class KButtonBox::Item { |
58 | public: | 60 | public: |
59 | QPushButton *button; | 61 | QPushButton *button; |
60 | bool noexpand; | 62 | bool noexpand; |
61 | unsigned short stretch; | 63 | unsigned short stretch; |
62 | unsigned short actual_size; | 64 | unsigned short actual_size; |
63 | }; | 65 | }; |
64 | 66 | ||
65 | template class QPtrList<KButtonBox::Item>; | 67 | template class Q3PtrList<KButtonBox::Item>; |
66 | 68 | ||
67 | class KButtonBoxPrivate { | 69 | class KButtonBoxPrivate { |
68 | public: | 70 | public: |
69 | unsigned short border; | 71 | unsigned short border; |
70 | unsigned short autoborder; | 72 | unsigned short autoborder; |
71 | unsigned short orientation; | 73 | unsigned short orientation; |
72 | bool activated; | 74 | bool activated; |
73 | QPtrList<KButtonBox::Item> buttons; | 75 | Q3PtrList<KButtonBox::Item> buttons; |
74 | }; | 76 | }; |
75 | 77 | ||
76 | KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation, | 78 | KButtonBox::KButtonBox(QWidget *parent, Qt::Orientation _orientation, |
77 | int border, int autoborder) | 79 | int border, int autoborder) |
78 | : QWidget(parent) | 80 | : QWidget(parent) |
79 | { | 81 | { |
80 | data = new KButtonBoxPrivate; | 82 | data = new KButtonBoxPrivate; |
81 | assert(data != 0); | 83 | assert(data != 0); |
82 | 84 | ||
83 | data->orientation = _orientation; | 85 | data->orientation = _orientation; |
84 | data->border = border; | 86 | data->border = border; |
85 | data->autoborder = autoborder < 0 ? border : autoborder; | 87 | data->autoborder = autoborder < 0 ? border : autoborder; |
86 | data->buttons.setAutoDelete(TRUE); | 88 | data->buttons.setAutoDelete(TRUE); |
87 | } | 89 | } |
88 | 90 | ||
89 | KButtonBox::~KButtonBox() { | 91 | KButtonBox::~KButtonBox() { |
90 | delete data; | 92 | delete data; |
91 | } | 93 | } |
92 | 94 | ||
@@ -136,33 +138,33 @@ void KButtonBox::layout() { | |||
136 | Item *item = data->buttons.at(i); | 138 | Item *item = data->buttons.at(i); |
137 | QPushButton *b = item->button; | 139 | QPushButton *b = item->button; |
138 | if(b != 0) { | 140 | if(b != 0) { |
139 | if(item->noexpand) | 141 | if(item->noexpand) |
140 | b->setFixedSize(buttonSizeHint(b)); | 142 | b->setFixedSize(buttonSizeHint(b)); |
141 | else | 143 | else |
142 | b->setFixedSize(bs); | 144 | b->setFixedSize(bs); |
143 | } | 145 | } |
144 | } | 146 | } |
145 | 147 | ||
146 | setMinimumSize(sizeHint()); | 148 | setMinimumSize(sizeHint()); |
147 | } | 149 | } |
148 | 150 | ||
149 | void KButtonBox::placeButtons() { | 151 | void KButtonBox::placeButtons() { |
150 | unsigned int i; | 152 | unsigned int i; |
151 | 153 | ||
152 | if(data->orientation == Horizontal) { | 154 | if(data->orientation == Qt::Horizontal) { |
153 | // calculate free size and stretches | 155 | // calculate free size and stretches |
154 | int fs = width() - 2 * data->border; | 156 | int fs = width() - 2 * data->border; |
155 | int stretch = 0; | 157 | int stretch = 0; |
156 | for(i = 0; i < data->buttons.count(); i++) { | 158 | for(i = 0; i < data->buttons.count(); i++) { |
157 | Item *item = data->buttons.at(i); | 159 | Item *item = data->buttons.at(i); |
158 | if(item->button != 0) { | 160 | if(item->button != 0) { |
159 | fs -= item->button->width(); | 161 | fs -= item->button->width(); |
160 | 162 | ||
161 | // Last button? | 163 | // Last button? |
162 | if(i != data->buttons.count() - 1) | 164 | if(i != data->buttons.count() - 1) |
163 | fs -= data->autoborder; | 165 | fs -= data->autoborder; |
164 | } else | 166 | } else |
165 | stretch +=item->stretch; | 167 | stretch +=item->stretch; |
166 | } | 168 | } |
167 | 169 | ||
168 | // distribute buttons | 170 | // distribute buttons |
@@ -238,52 +240,52 @@ QSize KButtonBox::sizeHint() const { | |||
238 | return QSize(0, 0); | 240 | return QSize(0, 0); |
239 | else { | 241 | else { |
240 | dw = 2 * data->border; | 242 | dw = 2 * data->border; |
241 | 243 | ||
242 | QSize bs = bestButtonSize(); | 244 | QSize bs = bestButtonSize(); |
243 | for(i = 0; i < data->buttons.count(); i++) { | 245 | for(i = 0; i < data->buttons.count(); i++) { |
244 | KButtonBox *that = (KButtonBox*)this; | 246 | KButtonBox *that = (KButtonBox*)this; |
245 | Item *item = that->data->buttons.at(i); | 247 | Item *item = that->data->buttons.at(i); |
246 | QPushButton *b = item->button; | 248 | QPushButton *b = item->button; |
247 | if(b != 0) { | 249 | if(b != 0) { |
248 | QSize s; | 250 | QSize s; |
249 | if(item->noexpand) | 251 | if(item->noexpand) |
250 | s = that->buttonSizeHint(b); | 252 | s = that->buttonSizeHint(b); |
251 | else | 253 | else |
252 | s = bs; | 254 | s = bs; |
253 | 255 | ||
254 | if(data->orientation == Horizontal) | 256 | if(data->orientation == Qt::Horizontal) |
255 | dw += s.width(); | 257 | dw += s.width(); |
256 | else | 258 | else |
257 | dw += s.height(); | 259 | dw += s.height(); |
258 | 260 | ||
259 | if( i != data->buttons.count() - 1 ) | 261 | if( i != data->buttons.count() - 1 ) |
260 | dw += data->autoborder; | 262 | dw += data->autoborder; |
261 | } | 263 | } |
262 | } | 264 | } |
263 | 265 | ||
264 | if(data->orientation == Horizontal) | 266 | if(data->orientation == Qt::Horizontal) |
265 | return QSize(dw, bs.height() + 2 * data->border); | 267 | return QSize(dw, bs.height() + 2 * data->border); |
266 | else | 268 | else |
267 | return QSize(bs.width() + 2 * data->border, dw); | 269 | return QSize(bs.width() + 2 * data->border, dw); |
268 | } | 270 | } |
269 | } | 271 | } |
270 | 272 | ||
271 | QSizePolicy KButtonBox::sizePolicy() const | 273 | QSizePolicy KButtonBox::sizePolicy() const |
272 | { | 274 | { |
273 | return data->orientation == Horizontal? | 275 | return data->orientation == Qt::Horizontal? |
274 | QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : | 276 | QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : |
275 | QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); | 277 | QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); |
276 | } | 278 | } |
277 | 279 | ||
278 | /* | 280 | /* |
279 | * Returns the best size for a button. If a button is less than | 281 | * Returns the best size for a button. If a button is less than |
280 | * minButtonWidth pixels wide, return minButtonWidth pixels | 282 | * minButtonWidth pixels wide, return minButtonWidth pixels |
281 | * as minimum width | 283 | * as minimum width |
282 | */ | 284 | */ |
283 | QSize KButtonBox::buttonSizeHint(QPushButton *b) const { | 285 | QSize KButtonBox::buttonSizeHint(QPushButton *b) const { |
284 | QSize s = b->sizeHint(); | 286 | QSize s = b->sizeHint(); |
285 | QSize ms = b->minimumSize(); | 287 | QSize ms = b->minimumSize(); |
286 | if(s.width() < minButtonWidth) | 288 | if(s.width() < minButtonWidth) |
287 | s.setWidth(minButtonWidth); | 289 | s.setWidth(minButtonWidth); |
288 | 290 | ||
289 | // allows the programmer to override the settings | 291 | // allows the programmer to override the settings |
diff --git a/microkde/kdeui/kbuttonbox.h b/microkde/kdeui/kbuttonbox.h index 1104366..2e0f41d 100644 --- a/microkde/kdeui/kbuttonbox.h +++ b/microkde/kdeui/kbuttonbox.h | |||
@@ -8,60 +8,62 @@ | |||
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef __KBUTTONBOX__H__ | 20 | #ifndef __KBUTTONBOX__H__ |
21 | #define __KBUTTONBOX__H__ | 21 | #define __KBUTTONBOX__H__ |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | //Added by qt3to4: | ||
25 | #include <QResizeEvent> | ||
24 | class QPushButton; | 26 | class QPushButton; |
25 | 27 | ||
26 | class KButtonBoxPrivate; | 28 | class KButtonBoxPrivate; |
27 | /** | 29 | /** |
28 | * Container widget for buttons. | 30 | * Container widget for buttons. |
29 | * | 31 | * |
30 | * This class uses Qt layout control to place the buttons; can handle | 32 | * This class uses Qt layout control to place the buttons; can handle |
31 | * both vertical and horizontal button placement. The default border | 33 | * both vertical and horizontal button placement. The default border |
32 | * is now @p 0 (making it easier to deal with layouts). The space | 34 | * is now @p 0 (making it easier to deal with layouts). The space |
33 | * between buttons is now more Motif compliant. | 35 | * between buttons is now more Motif compliant. |
34 | * | 36 | * |
35 | * @author Mario Weilguni <mweilguni@sime.com> | 37 | * @author Mario Weilguni <mweilguni@sime.com> |
36 | * @version $Id$ | 38 | * @version $Id$ |
37 | **/ | 39 | **/ |
38 | 40 | ||
39 | class KButtonBox : public QWidget | 41 | class KButtonBox : public QWidget |
40 | { | 42 | { |
41 | Q_OBJECT | 43 | Q_OBJECT |
42 | 44 | ||
43 | public: | 45 | public: |
44 | /** | 46 | /** |
45 | * Create an empty container for buttons. | 47 | * Create an empty container for buttons. |
46 | * | 48 | * |
47 | * If @p _orientation is @p Vertical, the buttons inserted with | 49 | * If @p _orientation is @p Vertical, the buttons inserted with |
48 | * @ref addButton() are laid out from top to bottom, otherwise they | 50 | * @ref addButton() are laid out from top to bottom, otherwise they |
49 | * are laid out from left to right. | 51 | * are laid out from left to right. |
50 | */ | 52 | */ |
51 | KButtonBox(QWidget *parent, Orientation _orientation = Horizontal, | 53 | KButtonBox(QWidget *parent, Qt::Orientation _orientation = Qt::Horizontal, |
52 | int border = 0, int _autoborder = 6); | 54 | int border = 0, int _autoborder = 6); |
53 | 55 | ||
54 | /** | 56 | /** |
55 | * Free private data field | 57 | * Free private data field |
56 | */ | 58 | */ |
57 | ~KButtonBox(); | 59 | ~KButtonBox(); |
58 | 60 | ||
59 | /** | 61 | /** |
60 | * @return The minimum size needed to fit all buttons. | 62 | * @return The minimum size needed to fit all buttons. |
61 | * | 63 | * |
62 | * This size is | 64 | * This size is |
63 | * calculated by the width/height of all buttons plus border/autoborder. | 65 | * calculated by the width/height of all buttons plus border/autoborder. |
64 | */ | 66 | */ |
65 | virtual QSize sizeHint() const; | 67 | virtual QSize sizeHint() const; |
66 | /** | 68 | /** |
67 | * @reimplemented | 69 | * @reimplemented |
diff --git a/microkde/kdeui/kguiitem.cpp b/microkde/kdeui/kguiitem.cpp index 828c5e6..c91ffb7 100644 --- a/microkde/kdeui/kguiitem.cpp +++ b/microkde/kdeui/kguiitem.cpp | |||
@@ -7,33 +7,33 @@ | |||
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qregexp.h> | 21 | #include <qregexp.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qiconset.h> | 23 | #include <qicon.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | 25 | ||
26 | #include <assert.h> | 26 | #include <assert.h> |
27 | //US #include <kiconloader.h> | 27 | //US #include <kiconloader.h> |
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include "kguiitem.h" | 30 | #include "kguiitem.h" |
31 | 31 | ||
32 | class KGuiItem::KGuiItemPrivate | 32 | class KGuiItem::KGuiItemPrivate |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | KGuiItemPrivate() | 35 | KGuiItemPrivate() |
36 | { | 36 | { |
37 | m_enabled = true; | 37 | m_enabled = true; |
38 | m_hasIcon = false; | 38 | m_hasIcon = false; |
39 | } | 39 | } |
@@ -49,53 +49,53 @@ public: | |||
49 | m_iconSet = rhs.m_iconSet; | 49 | m_iconSet = rhs.m_iconSet; |
50 | m_iconName = rhs.m_iconName; | 50 | m_iconName = rhs.m_iconName; |
51 | m_toolTip = rhs.m_toolTip; | 51 | m_toolTip = rhs.m_toolTip; |
52 | m_whatsThis = rhs.m_whatsThis; | 52 | m_whatsThis = rhs.m_whatsThis; |
53 | m_statusText = rhs.m_statusText; | 53 | m_statusText = rhs.m_statusText; |
54 | m_enabled = rhs.m_enabled; | 54 | m_enabled = rhs.m_enabled; |
55 | m_hasIcon = rhs.m_hasIcon; | 55 | m_hasIcon = rhs.m_hasIcon; |
56 | 56 | ||
57 | return *this; | 57 | return *this; |
58 | } | 58 | } |
59 | 59 | ||
60 | QString m_text; | 60 | QString m_text; |
61 | QString m_toolTip; | 61 | QString m_toolTip; |
62 | QString m_whatsThis; | 62 | QString m_whatsThis; |
63 | QString m_statusText; | 63 | QString m_statusText; |
64 | QString m_iconName; | 64 | QString m_iconName; |
65 | QIconSet m_iconSet; | 65 | QIcon m_iconSet; |
66 | bool m_hasIcon : 1; | 66 | bool m_hasIcon : 1; |
67 | bool m_enabled : 1; | 67 | bool m_enabled : 1; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | 70 | ||
71 | KGuiItem::KGuiItem() { | 71 | KGuiItem::KGuiItem() { |
72 | d = new KGuiItemPrivate; | 72 | d = new KGuiItemPrivate; |
73 | } | 73 | } |
74 | 74 | ||
75 | KGuiItem::KGuiItem( const QString &text, const QString &iconName, | 75 | KGuiItem::KGuiItem( const QString &text, const QString &iconName, |
76 | const QString &toolTip, const QString &whatsThis ) | 76 | const QString &toolTip, const QString &whatsThis ) |
77 | { | 77 | { |
78 | d = new KGuiItemPrivate; | 78 | d = new KGuiItemPrivate; |
79 | d->m_text = text; | 79 | d->m_text = text; |
80 | d->m_toolTip = toolTip; | 80 | d->m_toolTip = toolTip; |
81 | d->m_whatsThis = whatsThis; | 81 | d->m_whatsThis = whatsThis; |
82 | setIconName( iconName ); | 82 | setIconName( iconName ); |
83 | } | 83 | } |
84 | 84 | ||
85 | KGuiItem::KGuiItem( const QString &text, const QIconSet &iconSet, | 85 | KGuiItem::KGuiItem( const QString &text, const QIcon &iconSet, |
86 | const QString &toolTip, const QString &whatsThis ) | 86 | const QString &toolTip, const QString &whatsThis ) |
87 | { | 87 | { |
88 | d = new KGuiItemPrivate; | 88 | d = new KGuiItemPrivate; |
89 | d->m_text = text; | 89 | d->m_text = text; |
90 | d->m_toolTip = toolTip; | 90 | d->m_toolTip = toolTip; |
91 | d->m_whatsThis = whatsThis; | 91 | d->m_whatsThis = whatsThis; |
92 | setIconSet( iconSet ); | 92 | setIconSet( iconSet ); |
93 | } | 93 | } |
94 | 94 | ||
95 | KGuiItem::KGuiItem( const KGuiItem &rhs ) | 95 | KGuiItem::KGuiItem( const KGuiItem &rhs ) |
96 | : d( 0 ) | 96 | : d( 0 ) |
97 | { | 97 | { |
98 | (*this) = rhs; | 98 | (*this) = rhs; |
99 | } | 99 | } |
100 | 100 | ||
101 | KGuiItem &KGuiItem::operator=( const KGuiItem &rhs ) { | 101 | KGuiItem &KGuiItem::operator=( const KGuiItem &rhs ) { |
@@ -111,95 +111,95 @@ KGuiItem &KGuiItem::operator=( const KGuiItem &rhs ) { | |||
111 | } | 111 | } |
112 | 112 | ||
113 | KGuiItem::~KGuiItem() { | 113 | KGuiItem::~KGuiItem() { |
114 | delete d; | 114 | delete d; |
115 | } | 115 | } |
116 | 116 | ||
117 | QString KGuiItem::text() const { | 117 | QString KGuiItem::text() const { |
118 | return d->m_text; | 118 | return d->m_text; |
119 | } | 119 | } |
120 | QString KGuiItem::plainText() const { | 120 | QString KGuiItem::plainText() const { |
121 | QString stripped( d->m_text ); | 121 | QString stripped( d->m_text ); |
122 | stripped.replace( QRegExp( "&(?!&)" ), QString::null ); | 122 | stripped.replace( QRegExp( "&(?!&)" ), QString::null ); |
123 | 123 | ||
124 | return stripped; | 124 | return stripped; |
125 | } | 125 | } |
126 | 126 | ||
127 | QIconSet KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const | 127 | QIcon KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const |
128 | { | 128 | { |
129 | if( d->m_hasIcon ) | 129 | if( d->m_hasIcon ) |
130 | { | 130 | { |
131 | if( !d->m_iconName.isEmpty()) | 131 | if( !d->m_iconName.isEmpty()) |
132 | { | 132 | { |
133 | // some caching here would(?) come handy | 133 | // some caching here would(?) come handy |
134 | //US return instance->iconLoader()->loadIconSet( d->m_iconName, group, size ); | 134 | //US return instance->iconLoader()->loadIconSet( d->m_iconName, group, size ); |
135 | return KGlobal::iconLoader()->loadIconSet( d->m_iconName); | 135 | return KGlobal::iconLoader()->loadIconSet( d->m_iconName); |
136 | // here is a little problem that with delayed icon loading | 136 | // here is a little problem that with delayed icon loading |
137 | // we can't check if the icon really exists ... so what ... | 137 | // we can't check if the icon really exists ... so what ... |
138 | // if( set.isNull() ) | 138 | // if( set.isNull() ) |
139 | // { | 139 | // { |
140 | // d->m_hasIcon = false; | 140 | // d->m_hasIcon = false; |
141 | // return QIconSet(); | 141 | // return QIconSet(); |
142 | // } | 142 | // } |
143 | // return set; | 143 | // return set; |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | return d->m_iconSet; | 147 | return d->m_iconSet; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | else | 150 | else |
151 | return QIconSet(); | 151 | return QIcon(); |
152 | } | 152 | } |
153 | 153 | ||
154 | QString KGuiItem::iconName() const | 154 | QString KGuiItem::iconName() const |
155 | { | 155 | { |
156 | return d->m_iconName; | 156 | return d->m_iconName; |
157 | } | 157 | } |
158 | 158 | ||
159 | QString KGuiItem::toolTip() const { | 159 | QString KGuiItem::toolTip() const { |
160 | return d->m_toolTip; | 160 | return d->m_toolTip; |
161 | } | 161 | } |
162 | QString KGuiItem::whatsThis() const { | 162 | QString KGuiItem::whatsThis() const { |
163 | return d->m_whatsThis; | 163 | return d->m_whatsThis; |
164 | } | 164 | } |
165 | 165 | ||
166 | bool KGuiItem::isEnabled() const | 166 | bool KGuiItem::isEnabled() const |
167 | { | 167 | { |
168 | return d->m_enabled; | 168 | return d->m_enabled; |
169 | } | 169 | } |
170 | 170 | ||
171 | bool KGuiItem::hasIcon() const | 171 | bool KGuiItem::hasIcon() const |
172 | { | 172 | { |
173 | return d->m_hasIcon; | 173 | return d->m_hasIcon; |
174 | } | 174 | } |
175 | 175 | ||
176 | void KGuiItem::setText( const QString &text ) { | 176 | void KGuiItem::setText( const QString &text ) { |
177 | d->m_text=text; | 177 | d->m_text=text; |
178 | } | 178 | } |
179 | 179 | ||
180 | void KGuiItem::setIconSet( const QIconSet &iconset ) | 180 | void KGuiItem::setIconSet( const QIcon &iconset ) |
181 | { | 181 | { |
182 | d->m_iconSet = iconset; | 182 | d->m_iconSet = iconset; |
183 | d->m_iconName = QString::null; | 183 | d->m_iconName = QString::null; |
184 | d->m_hasIcon = !iconset.isNull(); | 184 | d->m_hasIcon = !iconset.isNull(); |
185 | } | 185 | } |
186 | 186 | ||
187 | void KGuiItem::setIconName( const QString &iconName ) | 187 | void KGuiItem::setIconName( const QString &iconName ) |
188 | { | 188 | { |
189 | d->m_iconName = iconName; | 189 | d->m_iconName = iconName; |
190 | d->m_iconSet = QIconSet(); | 190 | d->m_iconSet = QIcon(); |
191 | d->m_hasIcon = !iconName.isEmpty(); | 191 | d->m_hasIcon = !iconName.isEmpty(); |
192 | } | 192 | } |
193 | 193 | ||
194 | void KGuiItem::setToolTip( const QString &toolTip) { | 194 | void KGuiItem::setToolTip( const QString &toolTip) { |
195 | d->m_toolTip = toolTip; | 195 | d->m_toolTip = toolTip; |
196 | } | 196 | } |
197 | void KGuiItem::setWhatsThis( const QString &whatsThis ) { | 197 | void KGuiItem::setWhatsThis( const QString &whatsThis ) { |
198 | d->m_whatsThis = whatsThis; | 198 | d->m_whatsThis = whatsThis; |
199 | } | 199 | } |
200 | void KGuiItem::setEnabled( bool enabled ){ | 200 | void KGuiItem::setEnabled( bool enabled ){ |
201 | d->m_enabled = enabled; | 201 | d->m_enabled = enabled; |
202 | } | 202 | } |
203 | 203 | ||
204 | /* vim: et sw=4 | 204 | /* vim: et sw=4 |
205 | */ | 205 | */ |
diff --git a/microkde/kdeui/kguiitem.h b/microkde/kdeui/kguiitem.h index 0079bb4..6f92137 100644 --- a/microkde/kdeui/kguiitem.h +++ b/microkde/kdeui/kguiitem.h | |||
@@ -10,78 +10,78 @@ | |||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | Many thanks to Simon tronical Hausmann | 19 | Many thanks to Simon tronical Hausmann |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef __kguiitem_h__ | 22 | #ifndef __kguiitem_h__ |
23 | #define __kguiitem_h__ | 23 | #define __kguiitem_h__ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qiconset.h> | 26 | #include <qicon.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qvaluelist.h> | 28 | #include <q3valuelist.h> |
29 | //US#include <kicontheme.h> | 29 | //US#include <kicontheme.h> |
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | 31 | ||
32 | //US added the following files | 32 | //US added the following files |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | 34 | ||
35 | class KGuiItem | 35 | class KGuiItem |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | KGuiItem(); | 38 | KGuiItem(); |
39 | 39 | ||
40 | KGuiItem( const QString &text, | 40 | KGuiItem( const QString &text, |
41 | const QString &iconName = QString::null, | 41 | const QString &iconName = QString::null, |
42 | const QString &toolTip = QString::null, | 42 | const QString &toolTip = QString::null, |
43 | const QString &whatsThis = QString::null ); | 43 | const QString &whatsThis = QString::null ); |
44 | 44 | ||
45 | KGuiItem( const QString &text, const QIconSet &iconSet, | 45 | KGuiItem( const QString &text, const QIcon &iconSet, |
46 | const QString &toolTip = QString::null, | 46 | const QString &toolTip = QString::null, |
47 | const QString &whatsThis = QString::null ); | 47 | const QString &whatsThis = QString::null ); |
48 | 48 | ||
49 | KGuiItem( const KGuiItem &rhs ); | 49 | KGuiItem( const KGuiItem &rhs ); |
50 | KGuiItem &operator=( const KGuiItem &rhs ); | 50 | KGuiItem &operator=( const KGuiItem &rhs ); |
51 | 51 | ||
52 | ~KGuiItem(); | 52 | ~KGuiItem(); |
53 | 53 | ||
54 | QString text() const; | 54 | QString text() const; |
55 | QString plainText() const; | 55 | QString plainText() const; |
56 | QIconSet iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const; | 56 | QIcon iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const; |
57 | 57 | ||
58 | #ifndef KDE_NO_COMPAT | 58 | #ifndef KDE_NO_COMPAT |
59 | QIconSet iconSet() const { return iconSet( KIcon::Small); } | 59 | QIcon iconSet() const { return iconSet( KIcon::Small); } |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | QString iconName() const; | 62 | QString iconName() const; |
63 | QString toolTip() const; | 63 | QString toolTip() const; |
64 | QString whatsThis() const; | 64 | QString whatsThis() const; |
65 | bool isEnabled() const; | 65 | bool isEnabled() const; |
66 | bool hasIcon() const; | 66 | bool hasIcon() const; |
67 | #ifndef KDE_NO_COMPAT | 67 | #ifndef KDE_NO_COMPAT |
68 | bool hasIconSet() const { return hasIcon(); } | 68 | bool hasIconSet() const { return hasIcon(); } |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | void setText( const QString &text ); | 71 | void setText( const QString &text ); |
72 | void setIconSet( const QIconSet &iconset ); | 72 | void setIconSet( const QIcon &iconset ); |
73 | void setIconName( const QString &iconName ); | 73 | void setIconName( const QString &iconName ); |
74 | void setToolTip( const QString &tooltip ); | 74 | void setToolTip( const QString &tooltip ); |
75 | void setWhatsThis( const QString &whatsThis ); | 75 | void setWhatsThis( const QString &whatsThis ); |
76 | void setEnabled( bool enable ); | 76 | void setEnabled( bool enable ); |
77 | 77 | ||
78 | private: | 78 | private: |
79 | class KGuiItemPrivate; | 79 | class KGuiItemPrivate; |
80 | KGuiItemPrivate *d; | 80 | KGuiItemPrivate *d; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | /* vim: et sw=4 | 83 | /* vim: et sw=4 |
84 | */ | 84 | */ |
85 | 85 | ||
86 | #endif | 86 | #endif |
87 | 87 | ||
diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp index 462c44f..3d9173d 100644 --- a/microkde/kdeui/kjanuswidget.cpp +++ b/microkde/kdeui/kjanuswidget.cpp | |||
@@ -9,41 +9,49 @@ | |||
9 | * | 9 | * |
10 | * This library is distributed in the hope that it will be useful, | 10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. | 13 | * Library General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU Library General Public License | 15 | * You should have received a copy of the GNU Library General Public License |
16 | * along with this library; see the file COPYING.LIB. If not, write to | 16 | * along with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | * Boston, MA 02111-1307, USA. | 18 | * Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include <qbitmap.h> | 22 | #include <qbitmap.h> |
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qwidgetstack.h> | 25 | #include <q3widgetstack.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlistview.h> | 27 | #include <q3listview.h> |
28 | #include <qhbox.h> | 28 | #include <q3hbox.h> |
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | #include <qgrid.h> | 30 | #include <q3grid.h> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qobjectlist.h> | 32 | #include <qobject.h> |
33 | #include <qstringlist.h> | 33 | #include <qstringlist.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3Frame> | ||
39 | #include <QEvent> | ||
40 | #include <Q3VBoxLayout> | ||
41 | #include <QShowEvent> | ||
34 | /*US | 42 | /*US |
35 | #include <qbitmap.h> | 43 | #include <qbitmap.h> |
36 | #include <qgrid.h> | 44 | #include <qgrid.h> |
37 | #include <qhbox.h> | 45 | #include <qhbox.h> |
38 | #include <qheader.h> | 46 | #include <qheader.h> |
39 | #include <qlabel.h> | 47 | #include <qlabel.h> |
40 | #include <qlayout.h> | 48 | #include <qlayout.h> |
41 | #include <qobjectlist.h> | 49 | #include <qobjectlist.h> |
42 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
43 | #include <qsplitter.h> | 51 | #include <qsplitter.h> |
44 | #include <qtabwidget.h> | 52 | #include <qtabwidget.h> |
45 | #include <qvbox.h> | 53 | #include <qvbox.h> |
46 | #include <qwidgetstack.h> | 54 | #include <qwidgetstack.h> |
47 | #include <qpainter.h> | 55 | #include <qpainter.h> |
48 | #include <qstyle.h> | 56 | #include <qstyle.h> |
49 | 57 | ||
@@ -52,167 +60,167 @@ | |||
52 | #include <kglobal.h> | 60 | #include <kglobal.h> |
53 | #include <kglobalsettings.h> | 61 | #include <kglobalsettings.h> |
54 | #include <kseparator.h> | 62 | #include <kseparator.h> |
55 | #include <kdebug.h> | 63 | #include <kdebug.h> |
56 | #include "kjanuswidget.h" | 64 | #include "kjanuswidget.h" |
57 | #include <klistview.h> | 65 | #include <klistview.h> |
58 | 66 | ||
59 | */ | 67 | */ |
60 | 68 | ||
61 | #include <kseparator.h> | 69 | #include <kseparator.h> |
62 | #include <kdialog.h> // Access to some static members | 70 | #include <kdialog.h> // Access to some static members |
63 | #include <kdebug.h> | 71 | #include <kdebug.h> |
64 | #include <klistview.h> | 72 | #include <klistview.h> |
65 | 73 | ||
66 | #include "kjanuswidget.h" | 74 | #include "kjanuswidget.h" |
67 | 75 | ||
68 | class KJanusWidget::IconListItem : public QListBoxItem | 76 | class KJanusWidget::IconListItem : public Q3ListBoxItem |
69 | { | 77 | { |
70 | public: | 78 | public: |
71 | IconListItem( QListBox *listbox, const QPixmap &pixmap, | 79 | IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, |
72 | const QString &text ); | 80 | const QString &text ); |
73 | virtual int height( const QListBox *lb ) const; | 81 | virtual int height( const Q3ListBox *lb ) const; |
74 | virtual int width( const QListBox *lb ) const; | 82 | virtual int width( const Q3ListBox *lb ) const; |
75 | int expandMinimumWidth( int width ); | 83 | int expandMinimumWidth( int width ); |
76 | 84 | ||
77 | protected: | 85 | protected: |
78 | const QPixmap &defaultPixmap(); | 86 | const QPixmap &defaultPixmap(); |
79 | void paint( QPainter *painter ); | 87 | void paint( QPainter *painter ); |
80 | 88 | ||
81 | private: | 89 | private: |
82 | QPixmap mPixmap; | 90 | QPixmap mPixmap; |
83 | int mMinimumWidth; | 91 | int mMinimumWidth; |
84 | }; | 92 | }; |
85 | 93 | ||
86 | class KJanusWidget::KJanusWidgetPrivate | 94 | class KJanusWidget::KJanusWidgetPrivate |
87 | { | 95 | { |
88 | public: | 96 | public: |
89 | KJanusWidgetPrivate() : mNextPageIndex(0) { } | 97 | KJanusWidgetPrivate() : mNextPageIndex(0) { } |
90 | 98 | ||
91 | int mNextPageIndex; // The next page index. | 99 | int mNextPageIndex; // The next page index. |
92 | 100 | ||
93 | // Dictionary for multipage modes. | 101 | // Dictionary for multipage modes. |
94 | QMap<int,QWidget*> mIntToPage; | 102 | QMap<int,QWidget*> mIntToPage; |
95 | // Reverse dictionary. Used because showPage() may be performance critical. | 103 | // Reverse dictionary. Used because showPage() may be performance critical. |
96 | QMap<QWidget*,int> mPageToInt; | 104 | QMap<QWidget*,int> mPageToInt; |
97 | // Dictionary of title string associated with page. | 105 | // Dictionary of title string associated with page. |
98 | QMap<int, QString> mIntToTitle; | 106 | QMap<int, QString> mIntToTitle; |
99 | }; | 107 | }; |
100 | 108 | ||
101 | template class QPtrList<QListViewItem>; | 109 | template class Q3PtrList<Q3ListViewItem>; |
102 | 110 | ||
103 | 111 | ||
104 | KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) | 112 | KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) |
105 | : QWidget( parent, name ), | 113 | : QWidget( parent, name ), |
106 | mValid(false), mPageList(0), | 114 | mValid(false), mPageList(0), |
107 | mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), | 115 | mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), |
108 | mShowIconsInTreeList(false), d(0) | 116 | mShowIconsInTreeList(false), d(0) |
109 | { | 117 | { |
110 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 118 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this ); |
111 | if( mFace == TreeList || mFace == IconList ) | 119 | if( mFace == TreeList || mFace == IconList ) |
112 | { | 120 | { |
113 | d = new KJanusWidgetPrivate; | 121 | d = new KJanusWidgetPrivate; |
114 | 122 | ||
115 | QFrame *page = 0; | 123 | Q3Frame *page = 0; |
116 | if( mFace == TreeList ) | 124 | if( mFace == TreeList ) |
117 | { | 125 | { |
118 | //US | 126 | //US |
119 | qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet"); | 127 | qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet"); |
120 | /*US | 128 | /*US |
121 | QSplitter *splitter = new QSplitter( this ); | 129 | QSplitter *splitter = new QSplitter( this ); |
122 | topLayout->addWidget( splitter, 10 ); | 130 | topLayout->addWidget( splitter, 10 ); |
123 | mTreeListResizeMode = QSplitter::KeepSize; | 131 | mTreeListResizeMode = QSplitter::KeepSize; |
124 | 132 | ||
125 | mTreeList = new KListView( splitter ); | 133 | mTreeList = new KListView( splitter ); |
126 | mTreeList->addColumn( QString::null ); | 134 | mTreeList->addColumn( QString::null ); |
127 | mTreeList->header()->hide(); | 135 | mTreeList->header()->hide(); |
128 | mTreeList->setRootIsDecorated(true); | 136 | mTreeList->setRootIsDecorated(true); |
129 | mTreeList->setSorting( -1 ); | 137 | mTreeList->setSorting( -1 ); |
130 | connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) ); | 138 | connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) ); |
131 | connect( mTreeList, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *))); | 139 | connect( mTreeList, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *))); |
132 | 140 | ||
133 | // | 141 | // |
134 | // Page area. Title at top with a separator below and a pagestack using | 142 | // Page area. Title at top with a separator below and a pagestack using |
135 | // all available space at bottom. | 143 | // all available space at bottom. |
136 | // | 144 | // |
137 | QFrame *p = new QFrame( splitter ); | 145 | QFrame *p = new QFrame( splitter ); |
138 | 146 | ||
139 | QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 ); | 147 | QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 ); |
140 | hbox->addSpacing( KDialog::marginHint() ); | 148 | hbox->addSpacing( KDialog::marginHint() ); |
141 | 149 | ||
142 | page = new QFrame( p ); | 150 | page = new QFrame( p ); |
143 | hbox->addWidget( page, 10 ); | 151 | hbox->addWidget( page, 10 ); |
144 | */ | 152 | */ |
145 | } | 153 | } |
146 | else | 154 | else |
147 | { | 155 | { |
148 | QHBoxLayout *hbox = new QHBoxLayout( topLayout ); | 156 | Q3HBoxLayout *hbox = new Q3HBoxLayout( topLayout ); |
149 | mIconList = new IconListBox( this ); | 157 | mIconList = new IconListBox( this ); |
150 | 158 | ||
151 | QFont listFont( mIconList->font() ); | 159 | QFont listFont( mIconList->font() ); |
152 | listFont.setBold( true ); | 160 | listFont.setBold( true ); |
153 | mIconList->setFont( listFont ); | 161 | mIconList->setFont( listFont ); |
154 | 162 | ||
155 | mIconList->verticalScrollBar()->installEventFilter( this ); | 163 | mIconList->verticalScrollBar()->installEventFilter( this ); |
156 | hbox->addWidget( mIconList ); | 164 | hbox->addWidget( mIconList ); |
157 | connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); | 165 | connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); |
158 | hbox->addSpacing( KDialog::marginHint() ); | 166 | hbox->addSpacing( KDialog::marginHint() ); |
159 | page = new QFrame( this ); | 167 | page = new Q3Frame( this ); |
160 | hbox->addWidget( page, 10 ); | 168 | hbox->addWidget( page, 10 ); |
161 | } | 169 | } |
162 | 170 | ||
163 | // | 171 | // |
164 | // Rest of page area. Title at top with a separator below and a | 172 | // Rest of page area. Title at top with a separator below and a |
165 | // pagestack using all available space at bottom. | 173 | // pagestack using all available space at bottom. |
166 | // | 174 | // |
167 | 175 | ||
168 | QVBoxLayout *vbox = new QVBoxLayout( page, 0, KDialog::spacingHint() ); | 176 | Q3VBoxLayout *vbox = new Q3VBoxLayout( page, 0, KDialog::spacingHint() ); |
169 | 177 | ||
170 | mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" ); | 178 | mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" ); |
171 | vbox->addWidget( mTitleLabel ); | 179 | vbox->addWidget( mTitleLabel ); |
172 | 180 | ||
173 | QFont titleFont( mTitleLabel->font() ); | 181 | QFont titleFont( mTitleLabel->font() ); |
174 | titleFont.setBold( true ); | 182 | titleFont.setBold( true ); |
175 | mTitleLabel->setFont( titleFont ); | 183 | mTitleLabel->setFont( titleFont ); |
176 | 184 | ||
177 | mTitleSep = new KSeparator( page ); | 185 | mTitleSep = new KSeparator( page ); |
178 | mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain ); | 186 | mTitleSep->setFrameStyle( Q3Frame::HLine|Q3Frame::Plain ); |
179 | vbox->addWidget( mTitleSep ); | 187 | vbox->addWidget( mTitleSep ); |
180 | 188 | ||
181 | mPageStack = new QWidgetStack( page ); | 189 | mPageStack = new Q3WidgetStack( page ); |
182 | connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), | 190 | connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), |
183 | SIGNAL(aboutToShowPage(QWidget *))); | 191 | SIGNAL(aboutToShowPage(QWidget *))); |
184 | vbox->addWidget( mPageStack, 10 ); | 192 | vbox->addWidget( mPageStack, 10 ); |
185 | } | 193 | } |
186 | else if( mFace == Tabbed ) | 194 | else if( mFace == Tabbed ) |
187 | { | 195 | { |
188 | d = new KJanusWidgetPrivate; | 196 | d = new KJanusWidgetPrivate; |
189 | 197 | ||
190 | mTabControl = new QTabWidget( this ); | 198 | mTabControl = new QTabWidget( this ); |
191 | mTabControl->setMargin (KDialog::marginHint()); | 199 | mTabControl->setMargin (KDialog::marginHint()); |
192 | topLayout->addWidget( mTabControl, 10 ); | 200 | topLayout->addWidget( mTabControl, 10 ); |
193 | } | 201 | } |
194 | else if( mFace == Swallow ) | 202 | else if( mFace == Swallow ) |
195 | { | 203 | { |
196 | mSwallowPage = new QWidget( this ); | 204 | mSwallowPage = new QWidget( this ); |
197 | topLayout->addWidget( mSwallowPage, 10 ); | 205 | topLayout->addWidget( mSwallowPage, 10 ); |
198 | } | 206 | } |
199 | else | 207 | else |
200 | { | 208 | { |
201 | mFace = Plain; | 209 | mFace = Plain; |
202 | mPlainPage = new QFrame( this ); | 210 | mPlainPage = new Q3Frame( this ); |
203 | topLayout->addWidget( mPlainPage, 10 ); | 211 | topLayout->addWidget( mPlainPage, 10 ); |
204 | } | 212 | } |
205 | /*US | 213 | /*US |
206 | if ( kapp ) | 214 | if ( kapp ) |
207 | connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged())); | 215 | connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged())); |
208 | */ | 216 | */ |
209 | mValid = true; | 217 | mValid = true; |
210 | setSwallowedWidget(0); // Set default size if 'mFace' is Swallow. | 218 | setSwallowedWidget(0); // Set default size if 'mFace' is Swallow. |
211 | } | 219 | } |
212 | 220 | ||
213 | 221 | ||
214 | KJanusWidget::~KJanusWidget() | 222 | KJanusWidget::~KJanusWidget() |
215 | { | 223 | { |
216 | 224 | ||
217 | /*US the destroyed signal caused a segmentation fault while closing the dialog and destructing | 225 | /*US the destroyed signal caused a segmentation fault while closing the dialog and destructing |
218 | all pages. Why not just remove all pages in the destructor?? | 226 | all pages. Why not just remove all pages in the destructor?? |
@@ -232,247 +240,247 @@ KJanusWidget::~KJanusWidget() | |||
232 | qDebug("KJanusWidget::~KJanusWidget so far "); | 240 | qDebug("KJanusWidget::~KJanusWidget so far "); |
233 | */ | 241 | */ |
234 | //US end | 242 | //US end |
235 | 243 | ||
236 | delete d; | 244 | delete d; |
237 | 245 | ||
238 | 246 | ||
239 | } | 247 | } |
240 | 248 | ||
241 | 249 | ||
242 | bool KJanusWidget::isValid() const | 250 | bool KJanusWidget::isValid() const |
243 | { | 251 | { |
244 | return( mValid ); | 252 | return( mValid ); |
245 | } | 253 | } |
246 | 254 | ||
247 | 255 | ||
248 | QFrame *KJanusWidget::plainPage() | 256 | Q3Frame *KJanusWidget::plainPage() |
249 | { | 257 | { |
250 | return( mPlainPage ); | 258 | return( mPlainPage ); |
251 | } | 259 | } |
252 | 260 | ||
253 | 261 | ||
254 | int KJanusWidget::face() const | 262 | int KJanusWidget::face() const |
255 | { | 263 | { |
256 | return( mFace ); | 264 | return( mFace ); |
257 | } | 265 | } |
258 | 266 | ||
259 | QWidget *KJanusWidget::FindParent() | 267 | QWidget *KJanusWidget::FindParent() |
260 | { | 268 | { |
261 | if( mFace == Tabbed ) { | 269 | if( mFace == Tabbed ) { |
262 | return mTabControl; | 270 | return mTabControl; |
263 | } | 271 | } |
264 | else { | 272 | else { |
265 | return this; | 273 | return this; |
266 | } | 274 | } |
267 | } | 275 | } |
268 | 276 | ||
269 | QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header, | 277 | Q3Frame *KJanusWidget::addPage( const QStringList &items, const QString &header, |
270 | const QPixmap &pixmap ) | 278 | const QPixmap &pixmap ) |
271 | { | 279 | { |
272 | if( mValid == false ) | 280 | if( mValid == false ) |
273 | { | 281 | { |
274 | kdDebug() << "addPage: Invalid object" << endl; | 282 | kdDebug() << "addPage: Invalid object" << endl; |
275 | return( 0 ); | 283 | return( 0 ); |
276 | } | 284 | } |
277 | 285 | ||
278 | QFrame *page = new QFrame( FindParent(), "page" ); | 286 | Q3Frame *page = new Q3Frame( FindParent(), "page" ); |
279 | addPageWidget( page, items, header, pixmap ); | 287 | addPageWidget( page, items, header, pixmap ); |
280 | 288 | ||
281 | return page; | 289 | return page; |
282 | } | 290 | } |
283 | 291 | ||
284 | void KJanusWidget::pageGone( QObject *obj ) | 292 | void KJanusWidget::pageGone( QObject *obj ) |
285 | { | 293 | { |
286 | // QObject* obj = (QObject*)sender(); | 294 | // QObject* obj = (QObject*)sender(); |
287 | removePage( static_cast<QWidget*>( obj ) ); | 295 | removePage( static_cast<QWidget*>( obj ) ); |
288 | } | 296 | } |
289 | 297 | ||
290 | void KJanusWidget::slotReopen( QListViewItem * item ) | 298 | void KJanusWidget::slotReopen( Q3ListViewItem * item ) |
291 | { | 299 | { |
292 | if( item ) | 300 | if( item ) |
293 | item->setOpen( true ); | 301 | item->setOpen( true ); |
294 | } | 302 | } |
295 | 303 | ||
296 | QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header, | 304 | Q3Frame *KJanusWidget::addPage( const QString &itemName, const QString &header, |
297 | const QPixmap &pixmap ) | 305 | const QPixmap &pixmap ) |
298 | { | 306 | { |
299 | 307 | ||
300 | QStringList items; | 308 | QStringList items; |
301 | items << itemName; | 309 | items << itemName; |
302 | return addPage(items, header, pixmap); | 310 | return addPage(items, header, pixmap); |
303 | } | 311 | } |
304 | 312 | ||
305 | 313 | ||
306 | 314 | ||
307 | QVBox *KJanusWidget::addVBoxPage( const QStringList &items, | 315 | Q3VBox *KJanusWidget::addVBoxPage( const QStringList &items, |
308 | const QString &header, | 316 | const QString &header, |
309 | const QPixmap &pixmap ) | 317 | const QPixmap &pixmap ) |
310 | { | 318 | { |
311 | if( mValid == false ) | 319 | if( mValid == false ) |
312 | { | 320 | { |
313 | qDebug("addPage: Invalid object "); | 321 | qDebug("addPage: Invalid object "); |
314 | 322 | ||
315 | return( 0 ); | 323 | return( 0 ); |
316 | } | 324 | } |
317 | 325 | ||
318 | QVBox *page = new QVBox(FindParent() , "vbox_page" ); | 326 | Q3VBox *page = new Q3VBox(FindParent() , "vbox_page" ); |
319 | page->setSpacing( KDialog::spacingHintSmall() ); | 327 | page->setSpacing( KDialog::spacingHintSmall() ); |
320 | addPageWidget( page, items, header, pixmap ); | 328 | addPageWidget( page, items, header, pixmap ); |
321 | 329 | ||
322 | return page; | 330 | return page; |
323 | } | 331 | } |
324 | 332 | ||
325 | QVBox *KJanusWidget::addVBoxPage( const QString &itemName, | 333 | Q3VBox *KJanusWidget::addVBoxPage( const QString &itemName, |
326 | const QString &header, | 334 | const QString &header, |
327 | const QPixmap &pixmap ) | 335 | const QPixmap &pixmap ) |
328 | { | 336 | { |
329 | QStringList items; | 337 | QStringList items; |
330 | items << itemName; | 338 | items << itemName; |
331 | return addVBoxPage(items, header, pixmap); | 339 | return addVBoxPage(items, header, pixmap); |
332 | } | 340 | } |
333 | 341 | ||
334 | QHBox *KJanusWidget::addHBoxPage( const QStringList &items, | 342 | Q3HBox *KJanusWidget::addHBoxPage( const QStringList &items, |
335 | const QString &header, | 343 | const QString &header, |
336 | const QPixmap &pixmap ) | 344 | const QPixmap &pixmap ) |
337 | { | 345 | { |
338 | if( mValid == false ) { | 346 | if( mValid == false ) { |
339 | kdDebug() << "addPage: Invalid object" << endl; | 347 | kdDebug() << "addPage: Invalid object" << endl; |
340 | return( 0 ); | 348 | return( 0 ); |
341 | } | 349 | } |
342 | 350 | ||
343 | QHBox *page = new QHBox(FindParent(), "hbox_page"); | 351 | Q3HBox *page = new Q3HBox(FindParent(), "hbox_page"); |
344 | page->setSpacing( KDialog::spacingHint() ); | 352 | page->setSpacing( KDialog::spacingHint() ); |
345 | addPageWidget( page, items, header, pixmap ); | 353 | addPageWidget( page, items, header, pixmap ); |
346 | 354 | ||
347 | return page; | 355 | return page; |
348 | } | 356 | } |
349 | 357 | ||
350 | QHBox *KJanusWidget::addHBoxPage( const QString &itemName, | 358 | Q3HBox *KJanusWidget::addHBoxPage( const QString &itemName, |
351 | const QString &header, | 359 | const QString &header, |
352 | const QPixmap &pixmap ) | 360 | const QPixmap &pixmap ) |
353 | { | 361 | { |
354 | QStringList items; | 362 | QStringList items; |
355 | items << itemName; | 363 | items << itemName; |
356 | return addHBoxPage(items, header, pixmap); | 364 | return addHBoxPage(items, header, pixmap); |
357 | } | 365 | } |
358 | 366 | ||
359 | QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | 367 | Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, |
360 | const QStringList &items, | 368 | const QStringList &items, |
361 | const QString &header, | 369 | const QString &header, |
362 | const QPixmap &pixmap ) | 370 | const QPixmap &pixmap ) |
363 | { | 371 | { |
364 | if( mValid == false ) | 372 | if( mValid == false ) |
365 | { | 373 | { |
366 | kdDebug() << "addPage: Invalid object" << endl; | 374 | kdDebug() << "addPage: Invalid object" << endl; |
367 | return( 0 ); | 375 | return( 0 ); |
368 | } | 376 | } |
369 | 377 | ||
370 | QGrid *page = new QGrid( n, dir, FindParent(), "page" ); | 378 | Q3Grid *page = new Q3Grid( n, dir, FindParent(), "page" ); |
371 | page->setSpacing( KDialog::spacingHint() ); | 379 | page->setSpacing( KDialog::spacingHint() ); |
372 | addPageWidget( page, items, header, pixmap ); | 380 | addPageWidget( page, items, header, pixmap ); |
373 | 381 | ||
374 | return page; | 382 | return page; |
375 | } | 383 | } |
376 | 384 | ||
377 | 385 | ||
378 | QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, | 386 | Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, |
379 | const QString &itemName, | 387 | const QString &itemName, |
380 | const QString &header, | 388 | const QString &header, |
381 | const QPixmap &pixmap ) | 389 | const QPixmap &pixmap ) |
382 | { | 390 | { |
383 | QStringList items; | 391 | QStringList items; |
384 | items << itemName; | 392 | items << itemName; |
385 | return addGridPage(n, dir, items, header, pixmap); | 393 | return addGridPage(n, dir, items, header, pixmap); |
386 | } | 394 | } |
387 | 395 | ||
388 | void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page) | 396 | void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page) |
389 | { | 397 | { |
390 | bool isTop = true; | 398 | bool isTop = true; |
391 | QListViewItem *curTop = 0, *child, *last, *newChild; | 399 | Q3ListViewItem *curTop = 0, *child, *last, *newChild; |
392 | unsigned int index = 1; | 400 | unsigned int index = 1; |
393 | QStringList curPath; | 401 | QStringList curPath; |
394 | 402 | ||
395 | for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) { | 403 | for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) { |
396 | QString name = (*it); | 404 | QString name = (*it); |
397 | bool isPath = ( index != items.count() ); | 405 | bool isPath = ( index != items.count() ); |
398 | 406 | ||
399 | // Find the first child. | 407 | // Find the first child. |
400 | if (isTop) { | 408 | if (isTop) { |
401 | child = mTreeList->firstChild(); | 409 | child = mTreeList->firstChild(); |
402 | } | 410 | } |
403 | else { | 411 | else { |
404 | child = curTop->firstChild(); | 412 | child = curTop->firstChild(); |
405 | } | 413 | } |
406 | 414 | ||
407 | // Now search for a child with the current Name, and if it we doesn't | 415 | // Now search for a child with the current Name, and if it we doesn't |
408 | // find it, then remember the location of the last child. | 416 | // find it, then remember the location of the last child. |
409 | for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling()); | 417 | for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling()); |
410 | 418 | ||
411 | if (last == 0 && child == 0) { | 419 | if (last == 0 && child == 0) { |
412 | // This node didn't have any children at all, lets just insert the | 420 | // This node didn't have any children at all, lets just insert the |
413 | // new child. | 421 | // new child. |
414 | if (isTop) | 422 | if (isTop) |
415 | newChild = new QListViewItem(mTreeList, name); | 423 | newChild = new Q3ListViewItem(mTreeList, name); |
416 | else | 424 | else |
417 | newChild = new QListViewItem(curTop, name); | 425 | newChild = new Q3ListViewItem(curTop, name); |
418 | 426 | ||
419 | } | 427 | } |
420 | else if (child != 0) { | 428 | else if (child != 0) { |
421 | // we found the given name in this child. | 429 | // we found the given name in this child. |
422 | if (!isPath) { | 430 | if (!isPath) { |
423 | kdDebug() << "The element inserted was already in the TreeList box!" << endl; | 431 | kdDebug() << "The element inserted was already in the TreeList box!" << endl; |
424 | return; | 432 | return; |
425 | } | 433 | } |
426 | else { | 434 | else { |
427 | // Ok we found the folder | 435 | // Ok we found the folder |
428 | newChild = child; | 436 | newChild = child; |
429 | } | 437 | } |
430 | } | 438 | } |
431 | else { | 439 | else { |
432 | // the node had some children, but we didn't find the given name | 440 | // the node had some children, but we didn't find the given name |
433 | if (isTop) | 441 | if (isTop) |
434 | newChild = new QListViewItem(mTreeList, last, name); | 442 | newChild = new Q3ListViewItem(mTreeList, last, name); |
435 | else | 443 | else |
436 | newChild = new QListViewItem(curTop, last, name); | 444 | newChild = new Q3ListViewItem(curTop, last, name); |
437 | } | 445 | } |
438 | 446 | ||
439 | // Now make the element expandable if it is a path component, and make | 447 | // Now make the element expandable if it is a path component, and make |
440 | // ready for next loop | 448 | // ready for next loop |
441 | if (isPath) { | 449 | if (isPath) { |
442 | newChild->setExpandable(true); | 450 | newChild->setExpandable(true); |
443 | curTop = newChild; | 451 | curTop = newChild; |
444 | isTop = false; | 452 | isTop = false; |
445 | curPath << name; | 453 | curPath << name; |
446 | 454 | ||
447 | QString key = curPath.join("_/_"); | 455 | QString key = curPath.join("_/_"); |
448 | if (mFolderIconMap.contains(key)) { | 456 | if (mFolderIconMap.contains(key)) { |
449 | QPixmap p = mFolderIconMap[key]; | 457 | QPixmap p = mFolderIconMap[key]; |
450 | newChild->setPixmap(0,p); | 458 | newChild->setPixmap(0,p); |
451 | } | 459 | } |
452 | } | 460 | } |
453 | else { | 461 | else { |
454 | if (mShowIconsInTreeList) { | 462 | if (mShowIconsInTreeList) { |
455 | newChild->setPixmap(0, pixmap); | 463 | newChild->setPixmap(0, pixmap); |
456 | } | 464 | } |
457 | mTreeListToPageStack.insert(newChild, page); | 465 | mTreeListToPageStack.insert(newChild, page); |
458 | } | 466 | } |
459 | } | 467 | } |
460 | } | 468 | } |
461 | 469 | ||
462 | void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items, | 470 | void KJanusWidget::addPageWidget( Q3Frame *page, const QStringList &items, |
463 | const QString &header,const QPixmap &pixmap ) | 471 | const QString &header,const QPixmap &pixmap ) |
464 | { | 472 | { |
465 | /*US the following signal causes a segmentation fault while closing the dialog. | 473 | /*US the following signal causes a segmentation fault while closing the dialog. |
466 | Why not just remove all pages in the destructor?? | 474 | Why not just remove all pages in the destructor?? |
467 | */ | 475 | */ |
468 | //US connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); | 476 | //US connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); |
469 | // we have the SIGNAL(destroyed(QObject*) only in Qt3 | 477 | // we have the SIGNAL(destroyed(QObject*) only in Qt3 |
470 | #ifdef DESKTOP_VERSION | 478 | #ifdef DESKTOP_VERSION |
471 | // connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); | 479 | // connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); |
472 | #endif | 480 | #endif |
473 | if( mFace == Tabbed ) | 481 | if( mFace == Tabbed ) |
474 | { | 482 | { |
475 | mTabControl->addTab (page, items.last()); | 483 | mTabControl->addTab (page, items.last()); |
476 | d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page); | 484 | d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page); |
477 | d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex; | 485 | d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex; |
478 | d->mNextPageIndex++; | 486 | d->mNextPageIndex++; |
@@ -537,41 +545,41 @@ void KJanusWidget::setFolderIcon(const QStringList &path, const QPixmap &pixmap) | |||
537 | 545 | ||
538 | 546 | ||
539 | bool KJanusWidget::setSwallowedWidget( QWidget *widget ) | 547 | bool KJanusWidget::setSwallowedWidget( QWidget *widget ) |
540 | { | 548 | { |
541 | if( mFace != Swallow || mValid == false ) | 549 | if( mFace != Swallow || mValid == false ) |
542 | { | 550 | { |
543 | return( false ); | 551 | return( false ); |
544 | } | 552 | } |
545 | 553 | ||
546 | // | 554 | // |
547 | // Remove current layout and make a new. | 555 | // Remove current layout and make a new. |
548 | // | 556 | // |
549 | if( mSwallowPage->layout() != 0 ) | 557 | if( mSwallowPage->layout() != 0 ) |
550 | { | 558 | { |
551 | delete mSwallowPage->layout(); | 559 | delete mSwallowPage->layout(); |
552 | } | 560 | } |
553 | QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 ); | 561 | Q3GridLayout *gbox = new Q3GridLayout( mSwallowPage, 1, 1, 0 ); |
554 | 562 | ||
555 | // | 563 | // |
556 | // Hide old children | 564 | // Hide old children |
557 | // | 565 | // |
558 | QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please | 566 | QObjectList l = mSwallowPage->children(); // silence please |
559 | for( uint i=0; i < l->count(); i++ ) | 567 | for( uint i=0; i < l.count(); i++ ) |
560 | { | 568 | { |
561 | QObject *o = l->at(i); | 569 | QObject *o = l.at(i); |
562 | if( o->isWidgetType() ) | 570 | if( o->isWidgetType() ) |
563 | { | 571 | { |
564 | ((QWidget*)o)->hide(); | 572 | ((QWidget*)o)->hide(); |
565 | } | 573 | } |
566 | } | 574 | } |
567 | 575 | ||
568 | // | 576 | // |
569 | // Add new child or make default size | 577 | // Add new child or make default size |
570 | // | 578 | // |
571 | if( widget == 0 ) | 579 | if( widget == 0 ) |
572 | { | 580 | { |
573 | gbox->addRowSpacing(0,100); | 581 | gbox->addRowSpacing(0,100); |
574 | gbox->addColSpacing(0,100); | 582 | gbox->addColSpacing(0,100); |
575 | mSwallowPage->setMinimumSize(100,100); | 583 | mSwallowPage->setMinimumSize(100,100); |
576 | } | 584 | } |
577 | else | 585 | else |
@@ -584,42 +592,42 @@ bool KJanusWidget::setSwallowedWidget( QWidget *widget ) | |||
584 | gbox->activate(); | 592 | gbox->activate(); |
585 | mSwallowPage->setMinimumSize( widget->minimumSize() ); | 593 | mSwallowPage->setMinimumSize( widget->minimumSize() ); |
586 | } | 594 | } |
587 | 595 | ||
588 | return( true ); | 596 | return( true ); |
589 | } | 597 | } |
590 | 598 | ||
591 | bool KJanusWidget::slotShowPage() | 599 | bool KJanusWidget::slotShowPage() |
592 | { | 600 | { |
593 | if( mValid == false ) | 601 | if( mValid == false ) |
594 | { | 602 | { |
595 | return( false ); | 603 | return( false ); |
596 | } | 604 | } |
597 | 605 | ||
598 | if( mFace == TreeList ) | 606 | if( mFace == TreeList ) |
599 | { | 607 | { |
600 | QListViewItem *node = mTreeList->selectedItem(); | 608 | Q3ListViewItem *node = mTreeList->selectedItem(); |
601 | if( node == 0 ) { return( false ); } | 609 | if( node == 0 ) { return( false ); } |
602 | 610 | ||
603 | QWidget *stackItem = mTreeListToPageStack[node]; | 611 | QWidget *stackItem = mTreeListToPageStack[node]; |
604 | // Make sure to call through the virtual function showPage(int) | 612 | // Make sure to call through the virtual function showPage(int) |
605 | return showPage(d->mPageToInt[stackItem]); | 613 | return showPage(d->mPageToInt[stackItem]); |
606 | } | 614 | } |
607 | else if( mFace == IconList ) | 615 | else if( mFace == IconList ) |
608 | { | 616 | { |
609 | QListBoxItem *node = mIconList->item( mIconList->currentItem() ); | 617 | Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); |
610 | if( node == 0 ) { return( false ); } | 618 | if( node == 0 ) { return( false ); } |
611 | QWidget *stackItem = mIconListToPageStack[node]; | 619 | QWidget *stackItem = mIconListToPageStack[node]; |
612 | // Make sure to call through the virtual function showPage(int) | 620 | // Make sure to call through the virtual function showPage(int) |
613 | return showPage(d->mPageToInt[stackItem]); | 621 | return showPage(d->mPageToInt[stackItem]); |
614 | } | 622 | } |
615 | 623 | ||
616 | return( false ); | 624 | return( false ); |
617 | } | 625 | } |
618 | 626 | ||
619 | 627 | ||
620 | bool KJanusWidget::showPage( int index ) | 628 | bool KJanusWidget::showPage( int index ) |
621 | { | 629 | { |
622 | if( d == 0 || mValid == false ) | 630 | if( d == 0 || mValid == false ) |
623 | { | 631 | { |
624 | return( false ); | 632 | return( false ); |
625 | } | 633 | } |
@@ -633,79 +641,79 @@ bool KJanusWidget::showPage( int index ) | |||
633 | bool KJanusWidget::showPage( QWidget *w ) | 641 | bool KJanusWidget::showPage( QWidget *w ) |
634 | { | 642 | { |
635 | if( w == 0 || mValid == false ) | 643 | if( w == 0 || mValid == false ) |
636 | { | 644 | { |
637 | return( false ); | 645 | return( false ); |
638 | } | 646 | } |
639 | 647 | ||
640 | if( mFace == TreeList || mFace == IconList ) | 648 | if( mFace == TreeList || mFace == IconList ) |
641 | { | 649 | { |
642 | mPageStack->raiseWidget( w ); | 650 | mPageStack->raiseWidget( w ); |
643 | mActivePageWidget = w; | 651 | mActivePageWidget = w; |
644 | 652 | ||
645 | int index = d->mPageToInt[w]; | 653 | int index = d->mPageToInt[w]; |
646 | mTitleLabel->setText( d->mIntToTitle[index] ); | 654 | mTitleLabel->setText( d->mIntToTitle[index] ); |
647 | if( mFace == TreeList ) | 655 | if( mFace == TreeList ) |
648 | { | 656 | { |
649 | QMap<QListViewItem *, QWidget *>::Iterator it; | 657 | QMap<Q3ListViewItem *, QWidget *>::Iterator it; |
650 | for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ | 658 | for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ |
651 | QListViewItem *key = it.key(); | 659 | Q3ListViewItem *key = it.key(); |
652 | QWidget *val = it.data(); | 660 | QWidget *val = it.data(); |
653 | if (val == w) { | 661 | if (val == w) { |
654 | mTreeList->setSelected(key, true ); | 662 | mTreeList->setSelected(key, true ); |
655 | break; | 663 | break; |
656 | } | 664 | } |
657 | } | 665 | } |
658 | } | 666 | } |
659 | else | 667 | else |
660 | { | 668 | { |
661 | QMap<QListBoxItem *, QWidget *>::Iterator it; | 669 | QMap<Q3ListBoxItem *, QWidget *>::Iterator it; |
662 | for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ | 670 | for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ |
663 | QListBoxItem *key = it.key(); | 671 | Q3ListBoxItem *key = it.key(); |
664 | QWidget *val = it.data(); | 672 | QWidget *val = it.data(); |
665 | if (val == w) { | 673 | if (val == w) { |
666 | mIconList->setSelected( key, true ); | 674 | mIconList->setSelected( key, true ); |
667 | break; | 675 | break; |
668 | } | 676 | } |
669 | } | 677 | } |
670 | } | 678 | } |
671 | } | 679 | } |
672 | else if( mFace == Tabbed ) | 680 | else if( mFace == Tabbed ) |
673 | { | 681 | { |
674 | mTabControl->showPage(w); | 682 | mTabControl->showPage(w); |
675 | mActivePageWidget = w; | 683 | mActivePageWidget = w; |
676 | } | 684 | } |
677 | else | 685 | else |
678 | { | 686 | { |
679 | return( false ); | 687 | return( false ); |
680 | } | 688 | } |
681 | 689 | ||
682 | return( true ); | 690 | return( true ); |
683 | } | 691 | } |
684 | 692 | ||
685 | 693 | ||
686 | int KJanusWidget::activePageIndex() const | 694 | int KJanusWidget::activePageIndex() const |
687 | { | 695 | { |
688 | if( mFace == TreeList) { | 696 | if( mFace == TreeList) { |
689 | QListViewItem *node = mTreeList->selectedItem(); | 697 | Q3ListViewItem *node = mTreeList->selectedItem(); |
690 | if( node == 0 ) { return -1; } | 698 | if( node == 0 ) { return -1; } |
691 | QWidget *stackItem = mTreeListToPageStack[node]; | 699 | QWidget *stackItem = mTreeListToPageStack[node]; |
692 | return d->mPageToInt[stackItem]; | 700 | return d->mPageToInt[stackItem]; |
693 | } | 701 | } |
694 | else if (mFace == IconList) { | 702 | else if (mFace == IconList) { |
695 | QListBoxItem *node = mIconList->item( mIconList->currentItem() ); | 703 | Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); |
696 | if( node == 0 ) { return( false ); } | 704 | if( node == 0 ) { return( false ); } |
697 | QWidget *stackItem = mIconListToPageStack[node]; | 705 | QWidget *stackItem = mIconListToPageStack[node]; |
698 | return d->mPageToInt[stackItem]; | 706 | return d->mPageToInt[stackItem]; |
699 | } | 707 | } |
700 | else if( mFace == Tabbed ) { | 708 | else if( mFace == Tabbed ) { |
701 | QWidget *widget = mTabControl->currentPage(); | 709 | QWidget *widget = mTabControl->currentPage(); |
702 | return( widget == 0 ? -1 : d->mPageToInt[widget] ); | 710 | return( widget == 0 ? -1 : d->mPageToInt[widget] ); |
703 | } | 711 | } |
704 | else { | 712 | else { |
705 | return( -1 ); | 713 | return( -1 ); |
706 | } | 714 | } |
707 | } | 715 | } |
708 | 716 | ||
709 | 717 | ||
710 | int KJanusWidget::pageIndex( QWidget *widget ) const | 718 | int KJanusWidget::pageIndex( QWidget *widget ) const |
711 | { | 719 | { |
@@ -748,33 +756,33 @@ void KJanusWidget::slotFontChanged() | |||
748 | titleFont.setBold( true ); | 756 | titleFont.setBold( true ); |
749 | mTitleLabel->setFont( titleFont ); | 757 | mTitleLabel->setFont( titleFont ); |
750 | } | 758 | } |
751 | 759 | ||
752 | if( mFace == IconList ) | 760 | if( mFace == IconList ) |
753 | { | 761 | { |
754 | QFont listFont( mIconList->font() ); | 762 | QFont listFont( mIconList->font() ); |
755 | listFont.setBold( true ); | 763 | listFont.setBold( true ); |
756 | mIconList->setFont( listFont ); | 764 | mIconList->setFont( listFont ); |
757 | mIconList->invalidateHeight(); | 765 | mIconList->invalidateHeight(); |
758 | mIconList->invalidateWidth(); | 766 | mIconList->invalidateWidth(); |
759 | } | 767 | } |
760 | } | 768 | } |
761 | */ | 769 | */ |
762 | 770 | ||
763 | // makes the treelist behave like the list of kcontrol | 771 | // makes the treelist behave like the list of kcontrol |
764 | void KJanusWidget::slotItemClicked(QListViewItem *it) | 772 | void KJanusWidget::slotItemClicked(Q3ListViewItem *it) |
765 | { | 773 | { |
766 | if(it && (it->childCount()>0)) | 774 | if(it && (it->childCount()>0)) |
767 | it->setOpen(!it->isOpen()); | 775 | it->setOpen(!it->isOpen()); |
768 | } | 776 | } |
769 | 777 | ||
770 | void KJanusWidget::setFocus() | 778 | void KJanusWidget::setFocus() |
771 | { | 779 | { |
772 | if( mValid == false ) { return; } | 780 | if( mValid == false ) { return; } |
773 | if( mFace == TreeList ) | 781 | if( mFace == TreeList ) |
774 | { | 782 | { |
775 | mTreeList->setFocus(); | 783 | mTreeList->setFocus(); |
776 | } | 784 | } |
777 | if( mFace == IconList ) | 785 | if( mFace == IconList ) |
778 | { | 786 | { |
779 | mIconList->setFocus(); | 787 | mIconList->setFocus(); |
780 | } | 788 | } |
@@ -882,37 +890,37 @@ void KJanusWidget::setShowIconsInTreeList( bool state ) | |||
882 | { | 890 | { |
883 | mShowIconsInTreeList = state; | 891 | mShowIconsInTreeList = state; |
884 | } | 892 | } |
885 | 893 | ||
886 | void KJanusWidget::setRootIsDecorated( bool state ) | 894 | void KJanusWidget::setRootIsDecorated( bool state ) |
887 | { | 895 | { |
888 | if( mFace == TreeList ) { | 896 | if( mFace == TreeList ) { |
889 | mTreeList->setRootIsDecorated(state); | 897 | mTreeList->setRootIsDecorated(state); |
890 | } | 898 | } |
891 | } | 899 | } |
892 | 900 | ||
893 | void KJanusWidget::unfoldTreeList( bool persist ) | 901 | void KJanusWidget::unfoldTreeList( bool persist ) |
894 | { | 902 | { |
895 | if( mFace == TreeList ) | 903 | if( mFace == TreeList ) |
896 | { | 904 | { |
897 | if( persist ) | 905 | if( persist ) |
898 | connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); | 906 | connect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); |
899 | else | 907 | else |
900 | disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); | 908 | disconnect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); |
901 | 909 | ||
902 | for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) | 910 | for( Q3ListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) |
903 | item->setOpen( true ); | 911 | item->setOpen( true ); |
904 | } | 912 | } |
905 | } | 913 | } |
906 | 914 | ||
907 | void KJanusWidget::showEvent( QShowEvent * ) | 915 | void KJanusWidget::showEvent( QShowEvent * ) |
908 | { | 916 | { |
909 | if( mFace == TreeList ) | 917 | if( mFace == TreeList ) |
910 | { | 918 | { |
911 | /*US | 919 | /*US |
912 | QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); | 920 | QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); |
913 | splitter->setResizeMode( mTreeList, mTreeListResizeMode ); | 921 | splitter->setResizeMode( mTreeList, mTreeListResizeMode ); |
914 | */ | 922 | */ |
915 | } | 923 | } |
916 | } | 924 | } |
917 | 925 | ||
918 | 926 | ||
@@ -940,66 +948,66 @@ bool KJanusWidget::eventFilter( QObject *o, QEvent *e ) | |||
940 | { | 948 | { |
941 | int lw = item->width( mIconList ); | 949 | int lw = item->width( mIconList ); |
942 | mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 ); | 950 | mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 ); |
943 | } | 951 | } |
944 | } | 952 | } |
945 | return QWidget::eventFilter( o, e ); | 953 | return QWidget::eventFilter( o, e ); |
946 | } | 954 | } |
947 | 955 | ||
948 | 956 | ||
949 | 957 | ||
950 | // | 958 | // |
951 | // Code for the icon list box | 959 | // Code for the icon list box |
952 | // | 960 | // |
953 | 961 | ||
954 | 962 | ||
955 | KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, | 963 | KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, |
956 | WFlags f ) | 964 | Qt::WFlags f ) |
957 | :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), | 965 | :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), |
958 | mWidthValid(false) | 966 | mWidthValid(false) |
959 | { | 967 | { |
960 | } | 968 | } |
961 | 969 | ||
962 | 970 | ||
963 | void KJanusWidget::IconListBox::updateMinimumHeight() | 971 | void KJanusWidget::IconListBox::updateMinimumHeight() |
964 | { | 972 | { |
965 | if( mShowAll == true && mHeightValid == false ) | 973 | if( mShowAll == true && mHeightValid == false ) |
966 | { | 974 | { |
967 | int h = frameWidth()*2; | 975 | int h = frameWidth()*2; |
968 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 976 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
969 | { | 977 | { |
970 | h += i->height( this ); | 978 | h += i->height( this ); |
971 | } | 979 | } |
972 | setMinimumHeight( h ); | 980 | setMinimumHeight( h ); |
973 | mHeightValid = true; | 981 | mHeightValid = true; |
974 | } | 982 | } |
975 | } | 983 | } |
976 | 984 | ||
977 | 985 | ||
978 | void KJanusWidget::IconListBox::updateWidth() | 986 | void KJanusWidget::IconListBox::updateWidth() |
979 | { | 987 | { |
980 | if( mWidthValid == false ) | 988 | if( mWidthValid == false ) |
981 | { | 989 | { |
982 | int maxWidth = 10; | 990 | int maxWidth = 10; |
983 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 991 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
984 | { | 992 | { |
985 | int w = ((IconListItem *)i)->width(this); | 993 | int w = ((IconListItem *)i)->width(this); |
986 | maxWidth = QMAX( w, maxWidth ); | 994 | maxWidth = QMAX( w, maxWidth ); |
987 | } | 995 | } |
988 | 996 | ||
989 | for( QListBoxItem *i = item(0); i != 0; i = i->next() ) | 997 | for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) |
990 | { | 998 | { |
991 | ((IconListItem *)i)->expandMinimumWidth( maxWidth ); | 999 | ((IconListItem *)i)->expandMinimumWidth( maxWidth ); |
992 | } | 1000 | } |
993 | 1001 | ||
994 | if( verticalScrollBar()->isVisible() ) | 1002 | if( verticalScrollBar()->isVisible() ) |
995 | { | 1003 | { |
996 | maxWidth += verticalScrollBar()->sizeHint().width(); | 1004 | maxWidth += verticalScrollBar()->sizeHint().width(); |
997 | } | 1005 | } |
998 | 1006 | ||
999 | setFixedWidth( maxWidth + frameWidth()*2 ); | 1007 | setFixedWidth( maxWidth + frameWidth()*2 ); |
1000 | mWidthValid = true; | 1008 | mWidthValid = true; |
1001 | } | 1009 | } |
1002 | } | 1010 | } |
1003 | 1011 | ||
1004 | 1012 | ||
1005 | void KJanusWidget::IconListBox::invalidateHeight() | 1013 | void KJanusWidget::IconListBox::invalidateHeight() |
@@ -1009,35 +1017,35 @@ void KJanusWidget::IconListBox::invalidateHeight() | |||
1009 | 1017 | ||
1010 | 1018 | ||
1011 | void KJanusWidget::IconListBox::invalidateWidth() | 1019 | void KJanusWidget::IconListBox::invalidateWidth() |
1012 | { | 1020 | { |
1013 | mWidthValid = false; | 1021 | mWidthValid = false; |
1014 | } | 1022 | } |
1015 | 1023 | ||
1016 | 1024 | ||
1017 | void KJanusWidget::IconListBox::setShowAll( bool showAll ) | 1025 | void KJanusWidget::IconListBox::setShowAll( bool showAll ) |
1018 | { | 1026 | { |
1019 | mShowAll = showAll; | 1027 | mShowAll = showAll; |
1020 | mHeightValid = false; | 1028 | mHeightValid = false; |
1021 | } | 1029 | } |
1022 | 1030 | ||
1023 | 1031 | ||
1024 | 1032 | ||
1025 | KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap, | 1033 | KJanusWidget::IconListItem::IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, |
1026 | const QString &text ) | 1034 | const QString &text ) |
1027 | : QListBoxItem( listbox ) | 1035 | : Q3ListBoxItem( listbox ) |
1028 | { | 1036 | { |
1029 | mPixmap = pixmap; | 1037 | mPixmap = pixmap; |
1030 | if( mPixmap.isNull() == true ) | 1038 | if( mPixmap.isNull() == true ) |
1031 | { | 1039 | { |
1032 | mPixmap = defaultPixmap(); | 1040 | mPixmap = defaultPixmap(); |
1033 | } | 1041 | } |
1034 | setText( text ); | 1042 | setText( text ); |
1035 | mMinimumWidth = 0; | 1043 | mMinimumWidth = 0; |
1036 | } | 1044 | } |
1037 | 1045 | ||
1038 | 1046 | ||
1039 | int KJanusWidget::IconListItem::expandMinimumWidth( int width ) | 1047 | int KJanusWidget::IconListItem::expandMinimumWidth( int width ) |
1040 | { | 1048 | { |
1041 | mMinimumWidth = QMAX( mMinimumWidth, width ); | 1049 | mMinimumWidth = QMAX( mMinimumWidth, width ); |
1042 | return( mMinimumWidth ); | 1050 | return( mMinimumWidth ); |
1043 | } | 1051 | } |
@@ -1070,87 +1078,87 @@ const QPixmap &KJanusWidget::IconListItem::defaultPixmap() | |||
1070 | 1078 | ||
1071 | void KJanusWidget::IconListItem::paint( QPainter *painter ) | 1079 | void KJanusWidget::IconListItem::paint( QPainter *painter ) |
1072 | { | 1080 | { |
1073 | QFontMetrics fm = painter->fontMetrics(); | 1081 | QFontMetrics fm = painter->fontMetrics(); |
1074 | //int wt = fm.boundingRect(text()).width(); | 1082 | //int wt = fm.boundingRect(text()).width(); |
1075 | int wp = mPixmap.width(); | 1083 | int wp = mPixmap.width(); |
1076 | int ht = fm.lineSpacing(); | 1084 | int ht = fm.lineSpacing(); |
1077 | int hp = mPixmap.height(); | 1085 | int hp = mPixmap.height(); |
1078 | 1086 | ||
1079 | painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap ); | 1087 | painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap ); |
1080 | if( text().isEmpty() == false ) | 1088 | if( text().isEmpty() == false ) |
1081 | { | 1089 | { |
1082 | painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() ); | 1090 | painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() ); |
1083 | } | 1091 | } |
1084 | } | 1092 | } |
1085 | 1093 | ||
1086 | int KJanusWidget::IconListItem::height( const QListBox *lb ) const | 1094 | int KJanusWidget::IconListItem::height( const Q3ListBox *lb ) const |
1087 | { | 1095 | { |
1088 | if( text().isEmpty() == true ) | 1096 | if( text().isEmpty() == true ) |
1089 | { | 1097 | { |
1090 | return( mPixmap.height() ); | 1098 | return( mPixmap.height() ); |
1091 | } | 1099 | } |
1092 | else | 1100 | else |
1093 | { | 1101 | { |
1094 | return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 ); | 1102 | return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 ); |
1095 | } | 1103 | } |
1096 | } | 1104 | } |
1097 | 1105 | ||
1098 | 1106 | ||
1099 | int KJanusWidget::IconListItem::width( const QListBox *lb ) const | 1107 | int KJanusWidget::IconListItem::width( const Q3ListBox *lb ) const |
1100 | { | 1108 | { |
1101 | int wt = lb->fontMetrics().boundingRect(text()).width()+10; | 1109 | int wt = lb->fontMetrics().boundingRect(text()).width()+10; |
1102 | int wp = mPixmap.width() + 10; | 1110 | int wp = mPixmap.width() + 10; |
1103 | int w = QMAX( wt, wp ); | 1111 | int w = QMAX( wt, wp ); |
1104 | return( QMAX( w, mMinimumWidth ) ); | 1112 | return( QMAX( w, mMinimumWidth ) ); |
1105 | } | 1113 | } |
1106 | 1114 | ||
1107 | 1115 | ||
1108 | void KJanusWidget::virtual_hook( int, void* ) | 1116 | void KJanusWidget::virtual_hook( int, void* ) |
1109 | { /*BASE::virtual_hook( id, data );*/ } | 1117 | { /*BASE::virtual_hook( id, data );*/ } |
1110 | 1118 | ||
1111 | // TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to | 1119 | // TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to |
1112 | // delete the node. | 1120 | // delete the node. |
1113 | void KJanusWidget::removePage( QWidget *page ) | 1121 | void KJanusWidget::removePage( QWidget *page ) |
1114 | { | 1122 | { |
1115 | //US qDebug("KJanusWidget::removePage 1 %lu , %lu, %lu", d, page, &(d->mPageToInt)); | 1123 | //US qDebug("KJanusWidget::removePage 1 %lu , %lu, %lu", d, page, &(d->mPageToInt)); |
1116 | if (!d || !(d->mPageToInt.contains(page))) | 1124 | if (!d || !(d->mPageToInt.contains(page))) |
1117 | { | 1125 | { |
1118 | return; | 1126 | return; |
1119 | } | 1127 | } |
1120 | 1128 | ||
1121 | int index = d->mPageToInt[page]; | 1129 | int index = d->mPageToInt[page]; |
1122 | 1130 | ||
1123 | if ( mFace == TreeList ) | 1131 | if ( mFace == TreeList ) |
1124 | { | 1132 | { |
1125 | QMap<QListViewItem*, QWidget *>::Iterator i; | 1133 | QMap<Q3ListViewItem*, QWidget *>::Iterator i; |
1126 | for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) | 1134 | for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) |
1127 | if (i.data()==page) | 1135 | if (i.data()==page) |
1128 | { | 1136 | { |
1129 | delete i.key(); | 1137 | delete i.key(); |
1130 | mPageStack->removeWidget(page); | 1138 | mPageStack->removeWidget(page); |
1131 | mTreeListToPageStack.remove(i); | 1139 | mTreeListToPageStack.remove(i); |
1132 | d->mIntToTitle.remove(index); | 1140 | d->mIntToTitle.remove(index); |
1133 | d->mPageToInt.remove(page); | 1141 | d->mPageToInt.remove(page); |
1134 | d->mIntToPage.remove(index); | 1142 | d->mIntToPage.remove(index); |
1135 | break; | 1143 | break; |
1136 | } | 1144 | } |
1137 | } | 1145 | } |
1138 | else if ( mFace == IconList ) | 1146 | else if ( mFace == IconList ) |
1139 | { | 1147 | { |
1140 | QMap<QListBoxItem*, QWidget *>::Iterator i; | 1148 | QMap<Q3ListBoxItem*, QWidget *>::Iterator i; |
1141 | for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) | 1149 | for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) |
1142 | if (i.data()==page) | 1150 | if (i.data()==page) |
1143 | { | 1151 | { |
1144 | delete i.key(); | 1152 | delete i.key(); |
1145 | mPageStack->removeWidget(page); | 1153 | mPageStack->removeWidget(page); |
1146 | mIconListToPageStack.remove(i); | 1154 | mIconListToPageStack.remove(i); |
1147 | d->mIntToTitle.remove(index); | 1155 | d->mIntToTitle.remove(index); |
1148 | d->mPageToInt.remove(page); | 1156 | d->mPageToInt.remove(page); |
1149 | d->mIntToPage.remove(index); | 1157 | d->mIntToPage.remove(index); |
1150 | break; | 1158 | break; |
1151 | } | 1159 | } |
1152 | } | 1160 | } |
1153 | else // Tabbed | 1161 | else // Tabbed |
1154 | { | 1162 | { |
1155 | mTabControl->removePage(page); | 1163 | mTabControl->removePage(page); |
1156 | d->mPageToInt.remove(page); | 1164 | d->mPageToInt.remove(page); |
diff --git a/microkde/kdeui/kjanuswidget.h b/microkde/kdeui/kjanuswidget.h index 6d3f23d..72465ea 100644 --- a/microkde/kdeui/kjanuswidget.h +++ b/microkde/kdeui/kjanuswidget.h | |||
@@ -7,56 +7,62 @@ | |||
7 | * version 2 of the License, or (at your option) any later version. | 7 | * version 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * This library is distributed in the hope that it will be useful, | 9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. | 12 | * Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to | 15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. | 17 | * Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KJANUS_WIDGET_H_ | 20 | #ifndef _KJANUS_WIDGET_H_ |
21 | #define _KJANUS_WIDGET_H_ | 21 | #define _KJANUS_WIDGET_H_ |
22 | 22 | ||
23 | #include <qptrlist.h> | 23 | #include <q3ptrlist.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | #include <qgrid.h> | 26 | #include <q3grid.h> |
27 | //Added by qt3to4: | ||
28 | #include <QShowEvent> | ||
29 | #include <Q3Frame> | ||
30 | #include <QPixmap> | ||
31 | #include <QLabel> | ||
32 | #include <QEvent> | ||
27 | #include <klistbox.h> | 33 | #include <klistbox.h> |
28 | 34 | ||
29 | /*US | 35 | /*US |
30 | #include <qptrlist.h> | 36 | #include <qptrlist.h> |
31 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
32 | #include <qsplitter.h> | 38 | #include <qsplitter.h> |
33 | 39 | ||
34 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
35 | #include <qmap.h> | 41 | #include <qmap.h> |
36 | 42 | ||
37 | */ | 43 | */ |
38 | 44 | ||
39 | class KSeparator; | 45 | class KSeparator; |
40 | class KListView; | 46 | class KListView; |
41 | class QWidgetStack; | 47 | class Q3WidgetStack; |
42 | class QLabel; | 48 | class QLabel; |
43 | class QTabWidget; | 49 | class QTabWidget; |
44 | class QListViewItem; | 50 | class Q3ListViewItem; |
45 | class QVBox; | 51 | class Q3VBox; |
46 | class QHBox; | 52 | class Q3HBox; |
47 | 53 | ||
48 | /** | 54 | /** |
49 | * Provides a number of ready to use layouts (faces). It is used | 55 | * Provides a number of ready to use layouts (faces). It is used |
50 | * as an internal widget in @ref KDialogBase, but can also used as a | 56 | * as an internal widget in @ref KDialogBase, but can also used as a |
51 | * widget of its own. | 57 | * widget of its own. |
52 | * | 58 | * |
53 | * It provides TreeList, IconList, Tabbed, Plain and Swallow layouts. | 59 | * It provides TreeList, IconList, Tabbed, Plain and Swallow layouts. |
54 | * | 60 | * |
55 | * The TreeList face provides a list in the left area and pages in the | 61 | * The TreeList face provides a list in the left area and pages in the |
56 | * right. The area are separated by a movable splitter. The style is somewhat | 62 | * right. The area are separated by a movable splitter. The style is somewhat |
57 | * similar to the layout in the Control Center. A page is raised by | 63 | * similar to the layout in the Control Center. A page is raised by |
58 | * selecting the corresponding tree list item. | 64 | * selecting the corresponding tree list item. |
59 | * | 65 | * |
60 | * The IconList face provides an icon list in the left area and pages in the | 66 | * The IconList face provides an icon list in the left area and pages in the |
61 | * right. For each entry the Icon is on top with the text below. The style | 67 | * right. For each entry the Icon is on top with the text below. The style |
62 | * is somewhat similar to the layout of the Eudora configuation dialog box. | 68 | * is somewhat similar to the layout of the Eudora configuation dialog box. |
@@ -89,33 +95,33 @@ class QHBox; | |||
89 | * Pages that have been added in TreeList, IconList or Tabbed mode can be | 95 | * Pages that have been added in TreeList, IconList or Tabbed mode can be |
90 | * removed by simply deleting the page. However, it would be preferable to use | 96 | * removed by simply deleting the page. However, it would be preferable to use |
91 | * the QObject::deleteLater() function on the page as the main event loop | 97 | * the QObject::deleteLater() function on the page as the main event loop |
92 | * may have optimized UI update events of the page by scheduling them for later. | 98 | * may have optimized UI update events of the page by scheduling them for later. |
93 | * | 99 | * |
94 | * @short Easy to use widget with many layouts | 100 | * @short Easy to use widget with many layouts |
95 | * @author Espen Sand (espen@kde.org) | 101 | * @author Espen Sand (espen@kde.org) |
96 | */ | 102 | */ |
97 | class KJanusWidget : public QWidget | 103 | class KJanusWidget : public QWidget |
98 | { | 104 | { |
99 | Q_OBJECT | 105 | Q_OBJECT |
100 | 106 | ||
101 | private: | 107 | private: |
102 | class IconListBox : public KListBox | 108 | class IconListBox : public KListBox |
103 | { | 109 | { |
104 | public: | 110 | public: |
105 | IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 ); | 111 | IconListBox( QWidget *parent=0, const char *name=0, Qt::WFlags f=0 ); |
106 | void updateMinimumHeight(); | 112 | void updateMinimumHeight(); |
107 | void updateWidth(); | 113 | void updateWidth(); |
108 | void invalidateHeight(); | 114 | void invalidateHeight(); |
109 | void invalidateWidth(); | 115 | void invalidateWidth(); |
110 | void setShowAll( bool showAll ); | 116 | void setShowAll( bool showAll ); |
111 | 117 | ||
112 | private: | 118 | private: |
113 | bool mShowAll; | 119 | bool mShowAll; |
114 | bool mHeightValid; | 120 | bool mHeightValid; |
115 | bool mWidthValid; | 121 | bool mWidthValid; |
116 | }; | 122 | }; |
117 | 123 | ||
118 | public: | 124 | public: |
119 | enum Face | 125 | enum Face |
120 | { | 126 | { |
121 | TreeList = 0, | 127 | TreeList = 0, |
@@ -180,195 +186,195 @@ class KJanusWidget : public QWidget | |||
180 | */ | 186 | */ |
181 | virtual QSize minimumSizeHint() const; | 187 | virtual QSize minimumSizeHint() const; |
182 | 188 | ||
183 | /** | 189 | /** |
184 | * Returns the recommended size for the widget in order to be displayed | 190 | * Returns the recommended size for the widget in order to be displayed |
185 | * properly. | 191 | * properly. |
186 | * | 192 | * |
187 | * @return The recommended size. | 193 | * @return The recommended size. |
188 | */ | 194 | */ |
189 | virtual QSize sizeHint() const; | 195 | virtual QSize sizeHint() const; |
190 | 196 | ||
191 | /** | 197 | /** |
192 | * Returns the empty widget that is available in Plain mode. | 198 | * Returns the empty widget that is available in Plain mode. |
193 | * | 199 | * |
194 | * @return The widget or 0 if the face in not Plain. | 200 | * @return The widget or 0 if the face in not Plain. |
195 | */ | 201 | */ |
196 | virtual QFrame *plainPage(); | 202 | virtual Q3Frame *plainPage(); |
197 | 203 | ||
198 | /** | 204 | /** |
199 | * Add a new page when the class is used in TreeList, IconList or Tabbed | 205 | * Add a new page when the class is used in TreeList, IconList or Tabbed |
200 | * mode. The returned widget is empty and you must add your widgets | 206 | * mode. The returned widget is empty and you must add your widgets |
201 | * as children to this widget. In most cases you must create a layout | 207 | * as children to this widget. In most cases you must create a layout |
202 | * manager and associate it with this widget as well. | 208 | * manager and associate it with this widget as well. |
203 | * | 209 | * |
204 | * Deleting the returned frame will cause the listitem or tab to be | 210 | * Deleting the returned frame will cause the listitem or tab to be |
205 | * removed (you can re-add a page with the same name later. | 211 | * removed (you can re-add a page with the same name later. |
206 | * | 212 | * |
207 | * @param item String used in the list or Tab item. | 213 | * @param item String used in the list or Tab item. |
208 | * @param header A longer string used in TreeList and IconList mode to | 214 | * @param header A longer string used in TreeList and IconList mode to |
209 | * describe the contents of a page. If empty, the item string | 215 | * describe the contents of a page. If empty, the item string |
210 | * will be used instead. | 216 | * will be used instead. |
211 | * @param pixmap Used in IconList mode or in TreeList mode. You should | 217 | * @param pixmap Used in IconList mode or in TreeList mode. You should |
212 | * prefer a pixmap with size 32x32 pixels. | 218 | * prefer a pixmap with size 32x32 pixels. |
213 | * | 219 | * |
214 | * @return The empty page or 0 if the face is not TreeList, IconList or | 220 | * @return The empty page or 0 if the face is not TreeList, IconList or |
215 | * Tabbed. | 221 | * Tabbed. |
216 | */ | 222 | */ |
217 | virtual QFrame *addPage(const QString &item,const QString &header=QString::null, | 223 | virtual Q3Frame *addPage(const QString &item,const QString &header=QString::null, |
218 | const QPixmap &pixmap=QPixmap() ); | 224 | const QPixmap &pixmap=QPixmap() ); |
219 | 225 | ||
220 | /** | 226 | /** |
221 | * This is like addPage just above, with the difference that the first | 227 | * This is like addPage just above, with the difference that the first |
222 | * element is a list of strings. These strings are used to form a path | 228 | * element is a list of strings. These strings are used to form a path |
223 | * of folders down to the given page. The initial elements are names | 229 | * of folders down to the given page. The initial elements are names |
224 | * for the folders, while the last element is the name of the page. | 230 | * for the folders, while the last element is the name of the page. |
225 | * Note: This does yet only work for the TreeList face. Later this may | 231 | * Note: This does yet only work for the TreeList face. Later this may |
226 | * be added for the IconList face too. In other faces than the | 232 | * be added for the IconList face too. In other faces than the |
227 | * TreeList, all the strings except the last one is ignored. | 233 | * TreeList, all the strings except the last one is ignored. |
228 | * Deleting the returned frame will cause the listitem or tab to be | 234 | * Deleting the returned frame will cause the listitem or tab to be |
229 | * removed (you can re-add a page with the same name later. | 235 | * removed (you can re-add a page with the same name later. |
230 | * | 236 | * |
231 | * Deleting the returned frame will cause the listitem or tab to be | 237 | * Deleting the returned frame will cause the listitem or tab to be |
232 | * removed (you can re-add a page with the same name later. | 238 | * removed (you can re-add a page with the same name later. |
233 | **/ | 239 | **/ |
234 | virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null, | 240 | virtual Q3Frame *addPage(const QStringList &items, const QString &header=QString::null, |
235 | const QPixmap &pixmap=QPixmap() ); | 241 | const QPixmap &pixmap=QPixmap() ); |
236 | 242 | ||
237 | /** | 243 | /** |
238 | * Add a new page when the class is used in TreeList, IconList or Tabbed | 244 | * Add a new page when the class is used in TreeList, IconList or Tabbed |
239 | * mode. The returned widget is empty and you must add your widgets | 245 | * mode. The returned widget is empty and you must add your widgets |
240 | * as children to this widget. The returned widget is a @ref QVBox | 246 | * as children to this widget. The returned widget is a @ref QVBox |
241 | * so it contains a QVBoxLayout layout that lines up the child widgets | 247 | * so it contains a QVBoxLayout layout that lines up the child widgets |
242 | * are vertically. | 248 | * are vertically. |
243 | * | 249 | * |
244 | * Deleting the returned frame will cause the listitem or tab to be | 250 | * Deleting the returned frame will cause the listitem or tab to be |
245 | * removed (you can re-add a page with the same name later. | 251 | * removed (you can re-add a page with the same name later. |
246 | * | 252 | * |
247 | * @param item String used in the list or Tab item. | 253 | * @param item String used in the list or Tab item. |
248 | * @param header A longer string used in TreeList and IconList mode to | 254 | * @param header A longer string used in TreeList and IconList mode to |
249 | * describe the contents of a page. If empty, the item string | 255 | * describe the contents of a page. If empty, the item string |
250 | * will be used instead. | 256 | * will be used instead. |
251 | * @param pixmap Used in IconList mode or in TreeList mode. You should | 257 | * @param pixmap Used in IconList mode or in TreeList mode. You should |
252 | * prefer a pixmap with size 32x32 pixels. | 258 | * prefer a pixmap with size 32x32 pixels. |
253 | * | 259 | * |
254 | * @return The empty page or 0 if the face is not TreeList, IconList or | 260 | * @return The empty page or 0 if the face is not TreeList, IconList or |
255 | * Tabbed. */ | 261 | * Tabbed. */ |
256 | virtual QVBox *addVBoxPage( const QString &item, | 262 | virtual Q3VBox *addVBoxPage( const QString &item, |
257 | const QString &header=QString::null, | 263 | const QString &header=QString::null, |
258 | const QPixmap &pixmap=QPixmap() ); | 264 | const QPixmap &pixmap=QPixmap() ); |
259 | 265 | ||
260 | /** | 266 | /** |
261 | * This is like addVBoxPage just above, with the difference that the first | 267 | * This is like addVBoxPage just above, with the difference that the first |
262 | * element is a list of strings. These strings are used to form a path | 268 | * element is a list of strings. These strings are used to form a path |
263 | * of folders down to the given page. The initial elements are names | 269 | * of folders down to the given page. The initial elements are names |
264 | * for the folders, while the last element is the name of the page. | 270 | * for the folders, while the last element is the name of the page. |
265 | * Note: This does yet only work for the TreeList face. Later this may | 271 | * Note: This does yet only work for the TreeList face. Later this may |
266 | * be added for the IconList face too. In other faces than the | 272 | * be added for the IconList face too. In other faces than the |
267 | * TreeList, all the strings except the last one is ignored. | 273 | * TreeList, all the strings except the last one is ignored. |
268 | * | 274 | * |
269 | * Deleting the returned frame will cause the listitem or tab to be | 275 | * Deleting the returned frame will cause the listitem or tab to be |
270 | * removed (you can re-add a page with the same name later. | 276 | * removed (you can re-add a page with the same name later. |
271 | **/ | 277 | **/ |
272 | virtual QVBox *addVBoxPage( const QStringList &items, | 278 | virtual Q3VBox *addVBoxPage( const QStringList &items, |
273 | const QString &header=QString::null, | 279 | const QString &header=QString::null, |
274 | const QPixmap &pixmap=QPixmap() ); | 280 | const QPixmap &pixmap=QPixmap() ); |
275 | 281 | ||
276 | /** | 282 | /** |
277 | * Add a new page when the class is used in TreeList, IconList or Tabbed | 283 | * Add a new page when the class is used in TreeList, IconList or Tabbed |
278 | * mode. The returned widget is empty and you must add your widgets | 284 | * mode. The returned widget is empty and you must add your widgets |
279 | * as children to this widget. The returned widget is a @ref QHBox | 285 | * as children to this widget. The returned widget is a @ref QHBox |
280 | * so it contains a QHBoxLayout layout that lines up the child widgets | 286 | * so it contains a QHBoxLayout layout that lines up the child widgets |
281 | * are horizontally. | 287 | * are horizontally. |
282 | * | 288 | * |
283 | * Deleting the returned frame will cause the listitem or tab to be | 289 | * Deleting the returned frame will cause the listitem or tab to be |
284 | * removed (you can re-add a page with the same name later. | 290 | * removed (you can re-add a page with the same name later. |
285 | * | 291 | * |
286 | * @param item String used in the list or Tab item. | 292 | * @param item String used in the list or Tab item. |
287 | * @param header A longer string used in TreeList and IconList mode to | 293 | * @param header A longer string used in TreeList and IconList mode to |
288 | * describe the contents of a page. If empty, the item string | 294 | * describe the contents of a page. If empty, the item string |
289 | * will be used instead. | 295 | * will be used instead. |
290 | * @param pixmap Used in IconList mode or in TreeList mode. You should | 296 | * @param pixmap Used in IconList mode or in TreeList mode. You should |
291 | * prefer a pixmap with size 32x32 pixels. | 297 | * prefer a pixmap with size 32x32 pixels. |
292 | * | 298 | * |
293 | * @return The empty page or 0 if the face is not TreeList, IconList or | 299 | * @return The empty page or 0 if the face is not TreeList, IconList or |
294 | * Tabbed. | 300 | * Tabbed. |
295 | */ | 301 | */ |
296 | virtual QHBox *addHBoxPage( const QString &itemName, | 302 | virtual Q3HBox *addHBoxPage( const QString &itemName, |
297 | const QString &header=QString::null, | 303 | const QString &header=QString::null, |
298 | const QPixmap &pixmap=QPixmap() ); | 304 | const QPixmap &pixmap=QPixmap() ); |
299 | 305 | ||
300 | /** | 306 | /** |
301 | * This is like addHBoxPage just above, with the difference that the first | 307 | * This is like addHBoxPage just above, with the difference that the first |
302 | * element is a list of strings. These strings are used to form a path | 308 | * element is a list of strings. These strings are used to form a path |
303 | * of folders down to the given page. The initial elements are names | 309 | * of folders down to the given page. The initial elements are names |
304 | * for the folders, while the last element is the name of the page. | 310 | * for the folders, while the last element is the name of the page. |
305 | * Note: This does yet only work for the TreeList face. Later this may | 311 | * Note: This does yet only work for the TreeList face. Later this may |
306 | * be added for the IconList face too. In other faces than the | 312 | * be added for the IconList face too. In other faces than the |
307 | * TreeList, all the strings except the last one is ignored. | 313 | * TreeList, all the strings except the last one is ignored. |
308 | * | 314 | * |
309 | * Deleting the returned frame will cause the listitem or tab to be | 315 | * Deleting the returned frame will cause the listitem or tab to be |
310 | * removed (you can re-add a page with the same name later. | 316 | * removed (you can re-add a page with the same name later. |
311 | **/ | 317 | **/ |
312 | virtual QHBox *addHBoxPage( const QStringList &items, | 318 | virtual Q3HBox *addHBoxPage( const QStringList &items, |
313 | const QString &header=QString::null, | 319 | const QString &header=QString::null, |
314 | const QPixmap &pixmap=QPixmap() ); | 320 | const QPixmap &pixmap=QPixmap() ); |
315 | 321 | ||
316 | /** | 322 | /** |
317 | * Add a new page when the class is used in either TreeList or Tabbed | 323 | * Add a new page when the class is used in either TreeList or Tabbed |
318 | * mode. The returned widget is empty and you must add your widgets | 324 | * mode. The returned widget is empty and you must add your widgets |
319 | * as children to this widget. The returned widget is a @ref QGrid | 325 | * as children to this widget. The returned widget is a @ref QGrid |
320 | * so it contains a QGridLayout layout that places up the child widgets | 326 | * so it contains a QGridLayout layout that places up the child widgets |
321 | * in a grid. | 327 | * in a grid. |
322 | * | 328 | * |
323 | * Deleting the returned frame will cause the listitem or tab to be | 329 | * Deleting the returned frame will cause the listitem or tab to be |
324 | * removed (you can re-add a page with the same name later. | 330 | * removed (you can re-add a page with the same name later. |
325 | * | 331 | * |
326 | * @param n Specifies the number of columns if 'dir' is QGrid::Horizontal | 332 | * @param n Specifies the number of columns if 'dir' is QGrid::Horizontal |
327 | * or the number of rows if 'dir' is QGrid::Vertical. | 333 | * or the number of rows if 'dir' is QGrid::Vertical. |
328 | * @param dir Can be QGrid::Horizontal or QGrid::Vertical. | 334 | * @param dir Can be QGrid::Horizontal or QGrid::Vertical. |
329 | * @param item String used in the list or Tab item. | 335 | * @param item String used in the list or Tab item. |
330 | * @param header A longer string used in TreeList and IconList mode to | 336 | * @param header A longer string used in TreeList and IconList mode to |
331 | * describe the contents of a page. If empty, the item string | 337 | * describe the contents of a page. If empty, the item string |
332 | * will be used instead. | 338 | * will be used instead. |
333 | * @param pixmap Used in IconList mode or in TreeList mode. You should | 339 | * @param pixmap Used in IconList mode or in TreeList mode. You should |
334 | * prefer a pixmap with size 32x32 pixels. | 340 | * prefer a pixmap with size 32x32 pixels. |
335 | * | 341 | * |
336 | * @return The empty page or 0 if the face is not TreeList, IconList or | 342 | * @return The empty page or 0 if the face is not TreeList, IconList or |
337 | * Tabbed. | 343 | * Tabbed. |
338 | */ | 344 | */ |
339 | //US changed Orientation into Direction for compatibility | 345 | //US changed Orientation into Direction for compatibility |
340 | virtual QGrid *addGridPage( int n, QGrid::Direction dir, | 346 | virtual Q3Grid *addGridPage( int n, Qt::Orientation dir, |
341 | const QString &itemName, | 347 | const QString &itemName, |
342 | const QString &header=QString::null, | 348 | const QString &header=QString::null, |
343 | const QPixmap &pixmap=QPixmap() ); | 349 | const QPixmap &pixmap=QPixmap() ); |
344 | 350 | ||
345 | /** | 351 | /** |
346 | * This is like addGridPage just above, with the difference that the first | 352 | * This is like addGridPage just above, with the difference that the first |
347 | * element is a list of strings. These strings are used to form a path | 353 | * element is a list of strings. These strings are used to form a path |
348 | * of folders down to the given page. The initial elements are names | 354 | * of folders down to the given page. The initial elements are names |
349 | * for the folders, while the last element is the name of the page. | 355 | * for the folders, while the last element is the name of the page. |
350 | * Note: This does yet only work for the TreeList face. Later this may | 356 | * Note: This does yet only work for the TreeList face. Later this may |
351 | * be added for the IconList face too. In other faces than the | 357 | * be added for the IconList face too. In other faces than the |
352 | * TreeList, all the strings except the last one is ignored. | 358 | * TreeList, all the strings except the last one is ignored. |
353 | * | 359 | * |
354 | * Deleting the returned frame will cause the listitem or tab to be | 360 | * Deleting the returned frame will cause the listitem or tab to be |
355 | * removed (you can re-add a page with the same name later. | 361 | * removed (you can re-add a page with the same name later. |
356 | **/ | 362 | **/ |
357 | //US changed Orientation into Direction for compatibility | 363 | //US changed Orientation into Direction for compatibility |
358 | virtual QGrid *addGridPage( int n, QGrid::Direction dir, | 364 | virtual Q3Grid *addGridPage( int n, Qt::Orientation dir, |
359 | const QStringList &items, | 365 | const QStringList &items, |
360 | const QString &header=QString::null, | 366 | const QString &header=QString::null, |
361 | const QPixmap &pixmap=QPixmap() ); | 367 | const QPixmap &pixmap=QPixmap() ); |
362 | 368 | ||
363 | /** | 369 | /** |
364 | * @short Removes a page created with @ref addPage, @ref addVBoxPage, | 370 | * @short Removes a page created with @ref addPage, @ref addVBoxPage, |
365 | * @ref addHBoxPage or @ref addGridPage. If the page has already | 371 | * @ref addHBoxPage or @ref addGridPage. If the page has already |
366 | * been deleted or has already been removed, nothing happens. The widget | 372 | * been deleted or has already been removed, nothing happens. The widget |
367 | * itself is not deleted. | 373 | * itself is not deleted. |
368 | * | 374 | * |
369 | * @param page The widget returned by @ref addPage , @ref addVBoxPage , | 375 | * @param page The widget returned by @ref addPage , @ref addVBoxPage , |
370 | * @ref addHBoxPage or @ref addGridPage . | 376 | * @ref addHBoxPage or @ref addGridPage . |
371 | */ | 377 | */ |
372 | void removePage( QWidget *page ); | 378 | void removePage( QWidget *page ); |
373 | 379 | ||
374 | 380 | ||
@@ -504,62 +510,62 @@ class KJanusWidget : public QWidget | |||
504 | */ | 510 | */ |
505 | virtual void showEvent( QShowEvent * ); | 511 | virtual void showEvent( QShowEvent * ); |
506 | 512 | ||
507 | /** | 513 | /** |
508 | * This function is used internally when in IconList mode. If you | 514 | * This function is used internally when in IconList mode. If you |
509 | * reimplement this class a make your own event filter, make sure to | 515 | * reimplement this class a make your own event filter, make sure to |
510 | * call this function from your filter. | 516 | * call this function from your filter. |
511 | * | 517 | * |
512 | * @param o Object that has received an event. | 518 | * @param o Object that has received an event. |
513 | * @param e The event. | 519 | * @param e The event. |
514 | */ | 520 | */ |
515 | virtual bool eventFilter( QObject *o, QEvent *e ); | 521 | virtual bool eventFilter( QObject *o, QEvent *e ); |
516 | 522 | ||
517 | private slots: | 523 | private slots: |
518 | bool slotShowPage(); | 524 | bool slotShowPage(); |
519 | //US not yet implemented void slotFontChanged(); | 525 | //US not yet implemented void slotFontChanged(); |
520 | void slotItemClicked(QListViewItem *it); | 526 | void slotItemClicked(Q3ListViewItem *it); |
521 | void pageGone( QObject *obj); // signal from the added page's "destroyed" signal | 527 | void pageGone( QObject *obj); // signal from the added page's "destroyed" signal |
522 | void slotReopen(QListViewItem *item); | 528 | void slotReopen(Q3ListViewItem *item); |
523 | 529 | ||
524 | protected: | 530 | protected: |
525 | bool showPage( QWidget *w ); | 531 | bool showPage( QWidget *w ); |
526 | void addPageWidget( QFrame *page, const QStringList &items, | 532 | void addPageWidget( Q3Frame *page, const QStringList &items, |
527 | const QString &header, const QPixmap &pixmap ); | 533 | const QString &header, const QPixmap &pixmap ); |
528 | void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page); | 534 | void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page); |
529 | QWidget *FindParent(); | 535 | QWidget *FindParent(); |
530 | 536 | ||
531 | private: | 537 | private: |
532 | bool mValid; | 538 | bool mValid; |
533 | 539 | ||
534 | // Obsolete members. Remove in KDE 4. | 540 | // Obsolete members. Remove in KDE 4. |
535 | QPtrList<QWidget> *mPageList; | 541 | Q3PtrList<QWidget> *mPageList; |
536 | QStringList *mTitleList; | 542 | QStringList *mTitleList; |
537 | 543 | ||
538 | int mFace; | 544 | int mFace; |
539 | KListView *mTreeList; | 545 | KListView *mTreeList; |
540 | IconListBox *mIconList; | 546 | IconListBox *mIconList; |
541 | QWidgetStack *mPageStack; | 547 | Q3WidgetStack *mPageStack; |
542 | QLabel *mTitleLabel; | 548 | QLabel *mTitleLabel; |
543 | QTabWidget *mTabControl; | 549 | QTabWidget *mTabControl; |
544 | QFrame *mPlainPage; | 550 | Q3Frame *mPlainPage; |
545 | QWidget *mSwallowPage; | 551 | QWidget *mSwallowPage; |
546 | QWidget *mActivePageWidget; | 552 | QWidget *mActivePageWidget; |
547 | KSeparator *mTitleSep; | 553 | KSeparator *mTitleSep; |
548 | //US QSplitter::ResizeMode mTreeListResizeMode; | 554 | //US QSplitter::ResizeMode mTreeListResizeMode; |
549 | bool mShowIconsInTreeList; | 555 | bool mShowIconsInTreeList; |
550 | QMap<QListViewItem *, QWidget *> mTreeListToPageStack; | 556 | QMap<Q3ListViewItem *, QWidget *> mTreeListToPageStack; |
551 | QMap<QListBoxItem *, QWidget *> mIconListToPageStack; | 557 | QMap<Q3ListBoxItem *, QWidget *> mIconListToPageStack; |
552 | QMap<QString, QPixmap> mFolderIconMap; | 558 | QMap<QString, QPixmap> mFolderIconMap; |
553 | QMap<QString, QStringList> mChildrenNames; | 559 | QMap<QString, QStringList> mChildrenNames; |
554 | QMap<QString, QWidget *> mChildPages; | 560 | QMap<QString, QWidget *> mChildPages; |
555 | 561 | ||
556 | public: | 562 | public: |
557 | class IconListItem; | 563 | class IconListItem; |
558 | protected: | 564 | protected: |
559 | virtual void virtual_hook( int id, void* data ); | 565 | virtual void virtual_hook( int id, void* data ); |
560 | private: | 566 | private: |
561 | class KJanusWidgetPrivate; | 567 | class KJanusWidgetPrivate; |
562 | KJanusWidgetPrivate *d; | 568 | KJanusWidgetPrivate *d; |
563 | }; | 569 | }; |
564 | 570 | ||
565 | #endif | 571 | #endif |
diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp index c65b892..71020b3 100644 --- a/microkde/kdeui/klistbox.cpp +++ b/microkde/kdeui/klistbox.cpp | |||
@@ -3,77 +3,83 @@ | |||
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | #include <qtimer.h> | 18 | #include <qtimer.h> |
19 | //Added by qt3to4: | ||
20 | #include <QEvent> | ||
21 | #include <QMouseEvent> | ||
22 | #include <QKeyEvent> | ||
23 | #include <QFocusEvent> | ||
19 | 24 | ||
20 | #include <kglobalsettings.h> | 25 | #include <kglobalsettings.h> |
21 | //US#include <kcursor.h> | 26 | //US#include <kcursor.h> |
22 | #include <kapplication.h> | 27 | #include <kapplication.h> |
23 | //US#include <kipc.h> | 28 | //US#include <kipc.h> |
24 | #include <kdebug.h> | 29 | #include <kdebug.h> |
25 | 30 | ||
26 | #include "klistbox.h" | 31 | #include "klistbox.h" |
27 | 32 | ||
28 | #ifdef Q_WS_X11 | 33 | #ifdef Q_WS_X11 |
34 | #include <QX11Info> | ||
29 | #include <X11/Xlib.h> | 35 | #include <X11/Xlib.h> |
30 | #endif | 36 | #endif |
31 | #ifdef _WIN32_ | 37 | #ifdef _WIN32_ |
32 | #define Q_WS_QWS | 38 | #define Q_WS_QWS |
33 | #endif | 39 | #endif |
34 | KListBox::KListBox( QWidget *parent, const char *name, WFlags f ) | 40 | KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f ) |
35 | : QListBox( parent, name, f ) | 41 | : Q3ListBox( parent, name, f ) |
36 | { | 42 | { |
37 | connect( this, SIGNAL( onViewport() ), | 43 | connect( this, SIGNAL( onViewport() ), |
38 | this, SLOT( slotOnViewport() ) ); | 44 | this, SLOT( slotOnViewport() ) ); |
39 | connect( this, SIGNAL( onItem( QListBoxItem * ) ), | 45 | connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ), |
40 | this, SLOT( slotOnItem( QListBoxItem * ) ) ); | 46 | this, SLOT( slotOnItem( Q3ListBoxItem * ) ) ); |
41 | 47 | ||
42 | connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *, | 48 | connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *, |
43 | const QPoint & ) ), | 49 | const QPoint & ) ), |
44 | this, SLOT( slotMouseButtonClicked( int, QListBoxItem *, | 50 | this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *, |
45 | const QPoint & ) ) ); | 51 | const QPoint & ) ) ); |
46 | /*US | 52 | /*US |
47 | 53 | ||
48 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 54 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
49 | if (kapp) | 55 | if (kapp) |
50 | { | 56 | { |
51 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 57 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
52 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 58 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
53 | } | 59 | } |
54 | */ | 60 | */ |
55 | m_pCurrentItem = 0L; | 61 | m_pCurrentItem = 0L; |
56 | //US set single to true | 62 | //US set single to true |
57 | m_bUseSingle = true; | 63 | m_bUseSingle = true; |
58 | m_pAutoSelect = new QTimer( this ); | 64 | m_pAutoSelect = new QTimer( this ); |
59 | connect( m_pAutoSelect, SIGNAL( timeout() ), | 65 | connect( m_pAutoSelect, SIGNAL( timeout() ), |
60 | this, SLOT( slotAutoSelect() ) ); | 66 | this, SLOT( slotAutoSelect() ) ); |
61 | } | 67 | } |
62 | 68 | ||
63 | void KListBox::slotOnItem( QListBoxItem *item ) | 69 | void KListBox::slotOnItem( Q3ListBoxItem *item ) |
64 | { | 70 | { |
65 | /*US | 71 | /*US |
66 | if ( item && m_bChangeCursorOverItem && m_bUseSingle ) | 72 | if ( item && m_bChangeCursorOverItem && m_bUseSingle ) |
67 | viewport()->setCursor( KCursor().handCursor() ); | 73 | viewport()->setCursor( KCursor().handCursor() ); |
68 | */ | 74 | */ |
69 | if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) { | 75 | if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) { |
70 | m_pAutoSelect->start( m_autoSelectDelay, true ); | 76 | m_pAutoSelect->start( m_autoSelectDelay, true ); |
71 | m_pCurrentItem = item; | 77 | m_pCurrentItem = item; |
72 | } | 78 | } |
73 | } | 79 | } |
74 | 80 | ||
75 | void KListBox::slotOnViewport() | 81 | void KListBox::slotOnViewport() |
76 | { | 82 | { |
77 | /*US | 83 | /*US |
78 | if ( m_bChangeCursorOverItem ) | 84 | if ( m_bChangeCursorOverItem ) |
79 | viewport()->unsetCursor(); | 85 | viewport()->unsetCursor(); |
@@ -126,189 +132,189 @@ void KListBox::slotSettingsChanged(int category) | |||
126 | */ | 132 | */ |
127 | void KListBox::slotAutoSelect() | 133 | void KListBox::slotAutoSelect() |
128 | { | 134 | { |
129 | // check that the item still exists | 135 | // check that the item still exists |
130 | if( index( m_pCurrentItem ) == -1 ) | 136 | if( index( m_pCurrentItem ) == -1 ) |
131 | return; | 137 | return; |
132 | 138 | ||
133 | //Give this widget the keyboard focus. | 139 | //Give this widget the keyboard focus. |
134 | if( !hasFocus() ) | 140 | if( !hasFocus() ) |
135 | setFocus(); | 141 | setFocus(); |
136 | 142 | ||
137 | #ifdef Q_WS_X11 //FIXME | 143 | #ifdef Q_WS_X11 //FIXME |
138 | Window root; | 144 | Window root; |
139 | Window child; | 145 | Window child; |
140 | int root_x, root_y, win_x, win_y; | 146 | int root_x, root_y, win_x, win_y; |
141 | uint keybstate; | 147 | uint keybstate; |
142 | XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, | 148 | XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, |
143 | &root_x, &root_y, &win_x, &win_y, &keybstate ); | 149 | &root_x, &root_y, &win_x, &win_y, &keybstate ); |
144 | #endif | 150 | #endif |
145 | 151 | ||
146 | QListBoxItem* previousItem = item( currentItem() ); | 152 | Q3ListBoxItem* previousItem = item( currentItem() ); |
147 | setCurrentItem( m_pCurrentItem ); | 153 | setCurrentItem( m_pCurrentItem ); |
148 | 154 | ||
149 | if( m_pCurrentItem ) { | 155 | if( m_pCurrentItem ) { |
150 | #ifndef Q_WS_QWS //FIXME | 156 | #ifndef Q_WS_QWS //FIXME |
151 | //Shift pressed? | 157 | //Shift pressed? |
152 | if( (keybstate & ShiftMask) ) { | 158 | if( (keybstate & ShiftMask) ) { |
153 | #endif | 159 | #endif |
154 | bool block = signalsBlocked(); | 160 | bool block = signalsBlocked(); |
155 | blockSignals( true ); | 161 | blockSignals( true ); |
156 | 162 | ||
157 | #ifndef Q_WS_QWS //FIXME | 163 | #ifndef Q_WS_QWS //FIXME |
158 | //No Ctrl? Then clear before! | 164 | //No Ctrl? Then clear before! |
159 | if( !(keybstate & ControlMask) ) | 165 | if( !(keybstate & ControlMask) ) |
160 | clearSelection(); | 166 | clearSelection(); |
161 | #endif | 167 | #endif |
162 | 168 | ||
163 | //US in my QT version it is called isSelected() So what is right? | 169 | //US in my QT version it is called isSelected() So what is right? |
164 | //US bool select = !m_pCurrentItem->isSelected(); | 170 | //US bool select = !m_pCurrentItem->isSelected(); |
165 | bool select = !m_pCurrentItem->selected(); | 171 | bool select = !m_pCurrentItem->selected(); |
166 | bool update = viewport()->isUpdatesEnabled(); | 172 | bool update = viewport()->isUpdatesEnabled(); |
167 | viewport()->setUpdatesEnabled( false ); | 173 | viewport()->setUpdatesEnabled( false ); |
168 | 174 | ||
169 | bool down = index( previousItem ) < index( m_pCurrentItem ); | 175 | bool down = index( previousItem ) < index( m_pCurrentItem ); |
170 | QListBoxItem* it = down ? previousItem : m_pCurrentItem; | 176 | Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem; |
171 | for (;it ; it = it->next() ) { | 177 | for (;it ; it = it->next() ) { |
172 | if ( down && it == m_pCurrentItem ) { | 178 | if ( down && it == m_pCurrentItem ) { |
173 | setSelected( m_pCurrentItem, select ); | 179 | setSelected( m_pCurrentItem, select ); |
174 | break; | 180 | break; |
175 | } | 181 | } |
176 | if ( !down && it == previousItem ) { | 182 | if ( !down && it == previousItem ) { |
177 | setSelected( previousItem, select ); | 183 | setSelected( previousItem, select ); |
178 | break; | 184 | break; |
179 | } | 185 | } |
180 | setSelected( it, select ); | 186 | setSelected( it, select ); |
181 | } | 187 | } |
182 | 188 | ||
183 | blockSignals( block ); | 189 | blockSignals( block ); |
184 | viewport()->setUpdatesEnabled( update ); | 190 | viewport()->setUpdatesEnabled( update ); |
185 | triggerUpdate( false ); | 191 | triggerUpdate( false ); |
186 | 192 | ||
187 | emit selectionChanged(); | 193 | emit selectionChanged(); |
188 | 194 | ||
189 | if( selectionMode() == QListBox::Single ) | 195 | if( selectionMode() == Q3ListBox::Single ) |
190 | emit selectionChanged( m_pCurrentItem ); | 196 | emit selectionChanged( m_pCurrentItem ); |
191 | } | 197 | } |
192 | #ifndef Q_WS_QWS //FIXME | 198 | #ifndef Q_WS_QWS //FIXME |
193 | else if( (keybstate & ControlMask) ) | 199 | else if( (keybstate & ControlMask) ) |
194 | setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() ); | 200 | setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() ); |
195 | #endif | 201 | #endif |
196 | else { | 202 | else { |
197 | bool block = signalsBlocked(); | 203 | bool block = signalsBlocked(); |
198 | blockSignals( true ); | 204 | blockSignals( true ); |
199 | 205 | ||
200 | //US in my QT version it is called isSelected() So what is right? | 206 | //US in my QT version it is called isSelected() So what is right? |
201 | //US if( !m_pCurrentItem->isSelected() ) | 207 | //US if( !m_pCurrentItem->isSelected() ) |
202 | if( !m_pCurrentItem->selected() ) | 208 | if( !m_pCurrentItem->selected() ) |
203 | clearSelection(); | 209 | clearSelection(); |
204 | 210 | ||
205 | blockSignals( block ); | 211 | blockSignals( block ); |
206 | 212 | ||
207 | setSelected( m_pCurrentItem, true ); | 213 | setSelected( m_pCurrentItem, true ); |
208 | } | 214 | } |
209 | #ifndef Q_WS_QWS //FIXME | 215 | #ifndef Q_WS_QWS //FIXME |
210 | } | 216 | } |
211 | else | 217 | else |
212 | kdDebug() << "Thats not supposed to happen!!!!" << endl; | 218 | kdDebug() << "Thats not supposed to happen!!!!" << endl; |
213 | #endif | 219 | #endif |
214 | } | 220 | } |
215 | 221 | ||
216 | void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) | 222 | void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos ) |
217 | { | 223 | { |
218 | #ifdef Q_WS_X11 //FIXME | 224 | #ifdef Q_WS_X11 //FIXME |
219 | Window root; | 225 | Window root; |
220 | Window child; | 226 | Window child; |
221 | int root_x, root_y, win_x, win_y; | 227 | int root_x, root_y, win_x, win_y; |
222 | uint keybstate; | 228 | uint keybstate; |
223 | XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, | 229 | XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, |
224 | &root_x, &root_y, &win_x, &win_y, &keybstate ); | 230 | &root_x, &root_y, &win_x, &win_y, &keybstate ); |
225 | #endif | 231 | #endif |
226 | 232 | ||
227 | m_pAutoSelect->stop(); | 233 | m_pAutoSelect->stop(); |
228 | 234 | ||
229 | #ifndef Q_WS_QWS //FIXME | 235 | #ifndef Q_WS_QWS //FIXME |
230 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed | 236 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed |
231 | if( !( m_bUseSingle && ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { | 237 | if( !( m_bUseSingle && ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { |
232 | #endif | 238 | #endif |
233 | emit executed( item ); | 239 | emit executed( item ); |
234 | emit executed( item, pos ); | 240 | emit executed( item, pos ); |
235 | #ifndef Q_WS_QWS //FIXME | 241 | #ifndef Q_WS_QWS //FIXME |
236 | } | 242 | } |
237 | #endif | 243 | #endif |
238 | } | 244 | } |
239 | 245 | ||
240 | // | 246 | // |
241 | // 2000-16-01 Espen Sand | 247 | // 2000-16-01 Espen Sand |
242 | // This widget is used in dialogs. It should ignore | 248 | // This widget is used in dialogs. It should ignore |
243 | // F1 (and combinations) and Escape since these are used | 249 | // F1 (and combinations) and Escape since these are used |
244 | // to start help or close the dialog. This functionality | 250 | // to start help or close the dialog. This functionality |
245 | // should be done in QListView but it is not (at least now) | 251 | // should be done in QListView but it is not (at least now) |
246 | // | 252 | // |
247 | void KListBox::keyPressEvent(QKeyEvent *e) | 253 | void KListBox::keyPressEvent(QKeyEvent *e) |
248 | { | 254 | { |
249 | if( e->key() == Key_Escape ) | 255 | if( e->key() == Qt::Key_Escape ) |
250 | { | 256 | { |
251 | e->ignore(); | 257 | e->ignore(); |
252 | } | 258 | } |
253 | else if( e->key() == Key_F1 ) | 259 | else if( e->key() == Qt::Key_F1 ) |
254 | { | 260 | { |
255 | e->ignore(); | 261 | e->ignore(); |
256 | } | 262 | } |
257 | else | 263 | else |
258 | { | 264 | { |
259 | QListBox::keyPressEvent(e); | 265 | Q3ListBox::keyPressEvent(e); |
260 | } | 266 | } |
261 | } | 267 | } |
262 | 268 | ||
263 | void KListBox::focusOutEvent( QFocusEvent *fe ) | 269 | void KListBox::focusOutEvent( QFocusEvent *fe ) |
264 | { | 270 | { |
265 | m_pAutoSelect->stop(); | 271 | m_pAutoSelect->stop(); |
266 | 272 | ||
267 | QListBox::focusOutEvent( fe ); | 273 | Q3ListBox::focusOutEvent( fe ); |
268 | } | 274 | } |
269 | 275 | ||
270 | void KListBox::leaveEvent( QEvent *e ) | 276 | void KListBox::leaveEvent( QEvent *e ) |
271 | { | 277 | { |
272 | m_pAutoSelect->stop(); | 278 | m_pAutoSelect->stop(); |
273 | 279 | ||
274 | QListBox::leaveEvent( e ); | 280 | Q3ListBox::leaveEvent( e ); |
275 | } | 281 | } |
276 | 282 | ||
277 | void KListBox::contentsMousePressEvent( QMouseEvent *e ) | 283 | void KListBox::contentsMousePressEvent( QMouseEvent *e ) |
278 | { | 284 | { |
279 | if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) { | 285 | if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) { |
280 | bool block = signalsBlocked(); | 286 | bool block = signalsBlocked(); |
281 | blockSignals( true ); | 287 | blockSignals( true ); |
282 | 288 | ||
283 | clearSelection(); | 289 | clearSelection(); |
284 | 290 | ||
285 | blockSignals( block ); | 291 | blockSignals( block ); |
286 | } | 292 | } |
287 | 293 | ||
288 | QListBox::contentsMousePressEvent( e ); | 294 | Q3ListBox::contentsMousePressEvent( e ); |
289 | } | 295 | } |
290 | 296 | ||
291 | void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) | 297 | void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) |
292 | { | 298 | { |
293 | QListBox::contentsMouseDoubleClickEvent( e ); | 299 | Q3ListBox::contentsMouseDoubleClickEvent( e ); |
294 | 300 | ||
295 | QListBoxItem* item = itemAt( e->pos() ); | 301 | Q3ListBoxItem* item = itemAt( e->pos() ); |
296 | 302 | ||
297 | if( item ) { | 303 | if( item ) { |
298 | emit doubleClicked( item, e->globalPos() ); | 304 | emit doubleClicked( item, e->globalPos() ); |
299 | 305 | ||
300 | if( (e->button() == LeftButton) && !m_bUseSingle ) | 306 | if( (e->button() == Qt::LeftButton) && !m_bUseSingle ) |
301 | emitExecute( item, e->globalPos() ); | 307 | emitExecute( item, e->globalPos() ); |
302 | } | 308 | } |
303 | } | 309 | } |
304 | 310 | ||
305 | void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ) | 311 | void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos ) |
306 | { | 312 | { |
307 | if( (btn == LeftButton) && item ) | 313 | if( (btn == Qt::LeftButton) && item ) |
308 | emitExecute( item, pos ); | 314 | emitExecute( item, pos ); |
309 | } | 315 | } |
310 | 316 | ||
311 | void KListBox::virtual_hook( int, void* ) | 317 | void KListBox::virtual_hook( int, void* ) |
312 | { /*BASE::virtual_hook( id, data );*/ } | 318 | { /*BASE::virtual_hook( id, data );*/ } |
313 | 319 | ||
314 | //US #include "klistbox.moc" | 320 | //US #include "klistbox.moc" |
diff --git a/microkde/kdeui/klistbox.h b/microkde/kdeui/klistbox.h index 8023780..5ec514b 100644 --- a/microkde/kdeui/klistbox.h +++ b/microkde/kdeui/klistbox.h | |||
@@ -5,137 +5,142 @@ | |||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | #ifndef KLISTBOX_H | 18 | #ifndef KLISTBOX_H |
19 | #define KLISTBOX_H | 19 | #define KLISTBOX_H |
20 | 20 | ||
21 | #include <qlistbox.h> | 21 | #include <q3listbox.h> |
22 | //Added by qt3to4: | ||
23 | #include <QMouseEvent> | ||
24 | #include <QFocusEvent> | ||
25 | #include <QKeyEvent> | ||
26 | #include <QEvent> | ||
22 | 27 | ||
23 | /** | 28 | /** |
24 | * Extends the functionality of @ref QListBox to honor the system | 29 | * Extends the functionality of @ref QListBox to honor the system |
25 | * wide settings for Single Click/Double Click mode, Auto Selection and | 30 | * wide settings for Single Click/Double Click mode, Auto Selection and |
26 | * Change Cursor over Link. | 31 | * Change Cursor over Link. |
27 | * | 32 | * |
28 | * There is a new signal @ref executed(). It gets connected to either | 33 | * There is a new signal @ref executed(). It gets connected to either |
29 | * @ref QListBox::clicked() or @ref QListBox::doubleClicked() | 34 | * @ref QListBox::clicked() or @ref QListBox::doubleClicked() |
30 | * depending on the KDE wide Single Click/Double Click settings. It is | 35 | * depending on the KDE wide Single Click/Double Click settings. It is |
31 | * strongly recomended that you use this signal instead of the above | 36 | * strongly recomended that you use this signal instead of the above |
32 | * mentioned. This way you don't need to care about the current | 37 | * mentioned. This way you don't need to care about the current |
33 | * settings. If you want to get informed when the user selects | 38 | * settings. If you want to get informed when the user selects |
34 | * something connect to the @ref QListBox::selectionChanged() signal. | 39 | * something connect to the @ref QListBox::selectionChanged() signal. |
35 | * | 40 | * |
36 | * @short A variant of @ref QListBox that honors KDE's system-wide settings. | 41 | * @short A variant of @ref QListBox that honors KDE's system-wide settings. |
37 | **/ | 42 | **/ |
38 | class KListBox : public QListBox | 43 | class KListBox : public Q3ListBox |
39 | { | 44 | { |
40 | Q_OBJECT | 45 | Q_OBJECT |
41 | 46 | ||
42 | public: | 47 | public: |
43 | KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 48 | KListBox( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 ); |
44 | 49 | ||
45 | signals: | 50 | signals: |
46 | 51 | ||
47 | /** | 52 | /** |
48 | * Emitted whenever the user executes an listbox item. | 53 | * Emitted whenever the user executes an listbox item. |
49 | * | 54 | * |
50 | * That means depending on the KDE wide Single Click/Double Click | 55 | * That means depending on the KDE wide Single Click/Double Click |
51 | * setting the user clicked or double clicked on that item. | 56 | * setting the user clicked or double clicked on that item. |
52 | * @param item is the pointer to the executed listbox item. | 57 | * @param item is the pointer to the executed listbox item. |
53 | * | 58 | * |
54 | * Note that you may not delete any @ref QListBoxItem objects in slots | 59 | * Note that you may not delete any @ref QListBoxItem objects in slots |
55 | * connected to this signal. | 60 | * connected to this signal. |
56 | */ | 61 | */ |
57 | void executed( QListBoxItem *item ); | 62 | void executed( Q3ListBoxItem *item ); |
58 | 63 | ||
59 | /** | 64 | /** |
60 | * Emitted whenever the user executes an listbox item. | 65 | * Emitted whenever the user executes an listbox item. |
61 | * | 66 | * |
62 | * That means depending on the KDE wide Single Click/Double Click | 67 | * That means depending on the KDE wide Single Click/Double Click |
63 | * setting the user clicked or double clicked on that item. | 68 | * setting the user clicked or double clicked on that item. |
64 | * @param item is the pointer to the executed listbox item. | 69 | * @param item is the pointer to the executed listbox item. |
65 | * @param pos is the position where the user has clicked | 70 | * @param pos is the position where the user has clicked |
66 | * | 71 | * |
67 | * Note that you may not delete any @ref QListBoxItem objects in slots | 72 | * Note that you may not delete any @ref QListBoxItem objects in slots |
68 | * connected to this signal. | 73 | * connected to this signal. |
69 | */ | 74 | */ |
70 | void executed( QListBoxItem *item, const QPoint &pos ); | 75 | void executed( Q3ListBoxItem *item, const QPoint &pos ); |
71 | 76 | ||
72 | /** | 77 | /** |
73 | * This signal gets emitted whenever the user double clicks into the | 78 | * This signal gets emitted whenever the user double clicks into the |
74 | * listbox. | 79 | * listbox. |
75 | * | 80 | * |
76 | * @param item The pointer to the clicked listbox item. | 81 | * @param item The pointer to the clicked listbox item. |
77 | * @param pos The position where the user has clicked. | 82 | * @param pos The position where the user has clicked. |
78 | * | 83 | * |
79 | * Note that you may not delete any @ref QListBoxItem objects in slots | 84 | * Note that you may not delete any @ref QListBoxItem objects in slots |
80 | * connected to this signal. | 85 | * connected to this signal. |
81 | * | 86 | * |
82 | * This signal is more or less here for the sake of completeness. | 87 | * This signal is more or less here for the sake of completeness. |
83 | * You should normally not need to use this. In most cases it's better | 88 | * You should normally not need to use this. In most cases it's better |
84 | * to use @ref executed() instead. | 89 | * to use @ref executed() instead. |
85 | */ | 90 | */ |
86 | void doubleClicked( QListBoxItem *item, const QPoint &pos ); | 91 | void doubleClicked( Q3ListBoxItem *item, const QPoint &pos ); |
87 | 92 | ||
88 | protected slots: | 93 | protected slots: |
89 | void slotOnItem( QListBoxItem *item ); | 94 | void slotOnItem( Q3ListBoxItem *item ); |
90 | void slotOnViewport(); | 95 | void slotOnViewport(); |
91 | 96 | ||
92 | //US void slotSettingsChanged(int); | 97 | //US void slotSettingsChanged(int); |
93 | 98 | ||
94 | /** | 99 | /** |
95 | * Auto selection happend. | 100 | * Auto selection happend. |
96 | */ | 101 | */ |
97 | void slotAutoSelect(); | 102 | void slotAutoSelect(); |
98 | 103 | ||
99 | protected: | 104 | protected: |
100 | void emitExecute( QListBoxItem *item, const QPoint &pos ); | 105 | void emitExecute( Q3ListBoxItem *item, const QPoint &pos ); |
101 | 106 | ||
102 | /** | 107 | /** |
103 | * @reimplemented | 108 | * @reimplemented |
104 | */ | 109 | */ |
105 | virtual void keyPressEvent(QKeyEvent *e); | 110 | virtual void keyPressEvent(QKeyEvent *e); |
106 | /** | 111 | /** |
107 | * @reimplemented | 112 | * @reimplemented |
108 | */ | 113 | */ |
109 | virtual void focusOutEvent( QFocusEvent *fe ); | 114 | virtual void focusOutEvent( QFocusEvent *fe ); |
110 | /** | 115 | /** |
111 | * @reimplemented | 116 | * @reimplemented |
112 | */ | 117 | */ |
113 | virtual void leaveEvent( QEvent *e ); | 118 | virtual void leaveEvent( QEvent *e ); |
114 | /** | 119 | /** |
115 | * @reimplemented | 120 | * @reimplemented |
116 | */ | 121 | */ |
117 | virtual void contentsMousePressEvent( QMouseEvent *e ); | 122 | virtual void contentsMousePressEvent( QMouseEvent *e ); |
118 | /** | 123 | /** |
119 | * @reimplemented | 124 | * @reimplemented |
120 | */ | 125 | */ |
121 | virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e ); | 126 | virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e ); |
122 | 127 | ||
123 | bool m_bUseSingle; | 128 | bool m_bUseSingle; |
124 | //US bool m_bChangeCursorOverItem; | 129 | //US bool m_bChangeCursorOverItem; |
125 | 130 | ||
126 | QListBoxItem* m_pCurrentItem; | 131 | Q3ListBoxItem* m_pCurrentItem; |
127 | 132 | ||
128 | QTimer* m_pAutoSelect; | 133 | QTimer* m_pAutoSelect; |
129 | int m_autoSelectDelay; | 134 | int m_autoSelectDelay; |
130 | 135 | ||
131 | private slots: | 136 | private slots: |
132 | void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ); | 137 | void slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos ); |
133 | 138 | ||
134 | protected: | 139 | protected: |
135 | virtual void virtual_hook( int id, void* data ); | 140 | virtual void virtual_hook( int id, void* data ); |
136 | private: | 141 | private: |
137 | class KListBoxPrivate; | 142 | class KListBoxPrivate; |
138 | KListBoxPrivate *d; | 143 | KListBoxPrivate *d; |
139 | }; | 144 | }; |
140 | 145 | ||
141 | #endif | 146 | #endif |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 60f3084..0e98160 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -5,82 +5,97 @@ | |||
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdragobject.h> | 21 | #include <q3dragobject.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qheader.h> | 23 | #include <q3header.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qstyle.h> | 26 | #include <qstyle.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | //Added by qt3to4: | ||
29 | #include <QDragLeaveEvent> | ||
30 | #include <QKeyEvent> | ||
31 | #include <Q3ValueList> | ||
32 | #include <Q3PtrList> | ||
33 | #include <QPixmap> | ||
34 | #include <QDragEnterEvent> | ||
35 | #include <QDragMoveEvent> | ||
36 | #include <QDropEvent> | ||
37 | #include <QResizeEvent> | ||
38 | #include <QFocusEvent> | ||
39 | #include <QMouseEvent> | ||
40 | #include <QEvent> | ||
41 | #include <QPaintEvent> | ||
28 | 42 | ||
29 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
30 | #include <kconfig.h> | 44 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 45 | #include <kconfigbase.h> |
32 | //US #include <kcursor.h> | 46 | //US #include <kcursor.h> |
33 | #include <kapplication.h> | 47 | #include <kapplication.h> |
34 | //US #include <kipc.h> | 48 | //US #include <kipc.h> |
35 | #include <kdebug.h> | 49 | #include <kdebug.h> |
36 | #ifdef _WIN32_ | 50 | #ifdef _WIN32_ |
37 | #define Q_WS_QWS | 51 | #define Q_WS_QWS |
38 | #endif | 52 | #endif |
39 | #ifndef _WIN32_ | 53 | #ifndef _WIN32_ |
40 | #define private public | 54 | #define private public |
41 | #include <qlistview.h> | 55 | #include <q3listview.h> |
42 | #undef private | 56 | #undef private |
43 | #endif | 57 | #endif |
44 | #include "klistview.h" | 58 | #include "klistview.h" |
45 | //US #include "klistviewlineedit.h" | 59 | //US #include "klistviewlineedit.h" |
46 | #ifndef DESKTOP_VERSION | 60 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/qpeapplication.h> | 61 | #include <qpe/qpeapplication.h> |
48 | #endif | 62 | #endif |
63 | #include <Q3Action> | ||
49 | 64 | ||
50 | // /*US | 65 | // /*US |
51 | class KListView::Tooltip : public QToolTip | 66 | class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */ |
52 | { | 67 | { |
53 | public: | 68 | public: |
54 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); | 69 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); |
55 | virtual ~Tooltip () {} | 70 | virtual ~Tooltip () {} |
56 | 71 | ||
57 | protected: | 72 | protected: |
58 | // */ | 73 | // */ |
59 | /** | 74 | /** |
60 | * Reimplemented from QToolTip for internal reasons. | 75 | * Reimplemented from QToolTip for internal reasons. |
61 | */ | 76 | */ |
62 | // /*US | 77 | // /*US |
63 | virtual void maybeTip (const QPoint&); | 78 | virtual void maybeTip (const QPoint&); |
64 | 79 | ||
65 | private: | 80 | private: |
66 | KListView* mParent; | 81 | KListView* mParent; |
67 | }; | 82 | }; |
68 | 83 | ||
69 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) | 84 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) |
70 | : QToolTip (parent, group), | 85 | : /* XXX:hacker:XXX: QToolTip (parent, group), */ |
71 | mParent (parent) | 86 | mParent (parent) |
72 | { | 87 | { |
73 | } | 88 | } |
74 | 89 | ||
75 | void KListView::Tooltip::maybeTip (const QPoint&) | 90 | void KListView::Tooltip::maybeTip (const QPoint&) |
76 | { | 91 | { |
77 | // FIXME | 92 | // FIXME |
78 | } | 93 | } |
79 | // */ | 94 | // */ |
80 | 95 | ||
81 | class KListView::KListViewPrivate | 96 | class KListView::KListViewPrivate |
82 | { | 97 | { |
83 | public: | 98 | public: |
84 | KListViewPrivate (KListView* listview) | 99 | KListViewPrivate (KListView* listview) |
85 | : pCurrentItem (0L), | 100 | : pCurrentItem (0L), |
86 | autoSelectDelay(1), | 101 | autoSelectDelay(1), |
@@ -110,46 +125,46 @@ public: | |||
110 | selectionDirection(0), | 125 | selectionDirection(0), |
111 | tooltipColumn (0), | 126 | tooltipColumn (0), |
112 | selectionMode (Single), | 127 | selectionMode (Single), |
113 | contextMenuKey ( Qt::Key_Menu ),//KGlobalSettings::contextMenuKey()), | 128 | contextMenuKey ( Qt::Key_Menu ),//KGlobalSettings::contextMenuKey()), |
114 | showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()), | 129 | showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()), |
115 | mDropVisualizerWidth (4) | 130 | mDropVisualizerWidth (4) |
116 | { | 131 | { |
117 | renameable += 0; | 132 | renameable += 0; |
118 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); | 133 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); |
119 | } | 134 | } |
120 | 135 | ||
121 | ~KListViewPrivate () | 136 | ~KListViewPrivate () |
122 | { | 137 | { |
123 | //US delete editor; | 138 | //US delete editor; |
124 | } | 139 | } |
125 | 140 | ||
126 | QListViewItem* pCurrentItem; | 141 | Q3ListViewItem* pCurrentItem; |
127 | 142 | ||
128 | QTimer autoSelect; | 143 | QTimer autoSelect; |
129 | int autoSelectDelay; | 144 | int autoSelectDelay; |
130 | 145 | ||
131 | QTimer dragExpand; | 146 | QTimer dragExpand; |
132 | QListViewItem* dragOverItem; | 147 | Q3ListViewItem* dragOverItem; |
133 | QPoint dragOverPoint; | 148 | QPoint dragOverPoint; |
134 | 149 | ||
135 | QPoint startDragPos; | 150 | QPoint startDragPos; |
136 | int dragDelay; | 151 | int dragDelay; |
137 | 152 | ||
138 | //US KListViewLineEdit *editor; | 153 | //US KListViewLineEdit *editor; |
139 | QValueList<int> renameable; | 154 | Q3ValueList<int> renameable; |
140 | 155 | ||
141 | bool cursorInExecuteArea:1; | 156 | bool cursorInExecuteArea:1; |
142 | bool bUseSingle:1; | 157 | bool bUseSingle:1; |
143 | bool bChangeCursorOverItem:1; | 158 | bool bChangeCursorOverItem:1; |
144 | bool itemsMovable:1; | 159 | bool itemsMovable:1; |
145 | bool selectedBySimpleMove : 1; | 160 | bool selectedBySimpleMove : 1; |
146 | bool selectedUsingMouse:1; | 161 | bool selectedUsingMouse:1; |
147 | bool itemsRenameable:1; | 162 | bool itemsRenameable:1; |
148 | bool validDrag:1; | 163 | bool validDrag:1; |
149 | bool dragEnabled:1; | 164 | bool dragEnabled:1; |
150 | bool autoOpen:1; | 165 | bool autoOpen:1; |
151 | bool dropVisualizer:1; | 166 | bool dropVisualizer:1; |
152 | bool dropHighlighter:1; | 167 | bool dropHighlighter:1; |
153 | bool createChildren:1; | 168 | bool createChildren:1; |
154 | bool pressedOnSelected:1; | 169 | bool pressedOnSelected:1; |
155 | bool wasShiftEvent:1; | 170 | bool wasShiftEvent:1; |
@@ -157,34 +172,34 @@ public: | |||
157 | bool sortAscending:1; | 172 | bool sortAscending:1; |
158 | bool tabRename:1; | 173 | bool tabRename:1; |
159 | 174 | ||
160 | int sortColumn; | 175 | int sortColumn; |
161 | 176 | ||
162 | //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX | 177 | //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX |
163 | int selectionDirection; | 178 | int selectionDirection; |
164 | int tooltipColumn; | 179 | int tooltipColumn; |
165 | 180 | ||
166 | SelectionModeExt selectionMode; | 181 | SelectionModeExt selectionMode; |
167 | int contextMenuKey; | 182 | int contextMenuKey; |
168 | bool showContextMenusOnPress; | 183 | bool showContextMenusOnPress; |
169 | 184 | ||
170 | QRect mOldDropVisualizer; | 185 | QRect mOldDropVisualizer; |
171 | int mDropVisualizerWidth; | 186 | int mDropVisualizerWidth; |
172 | QRect mOldDropHighlighter; | 187 | QRect mOldDropHighlighter; |
173 | QListViewItem *afterItemDrop; | 188 | Q3ListViewItem *afterItemDrop; |
174 | QListViewItem *parentItemDrop; | 189 | Q3ListViewItem *parentItemDrop; |
175 | 190 | ||
176 | QColor alternateBackground; | 191 | QColor alternateBackground; |
177 | }; | 192 | }; |
178 | 193 | ||
179 | /*US | 194 | /*US |
180 | KListViewLineEdit::KListViewLineEdit(KListView *parent) | 195 | KListViewLineEdit::KListViewLineEdit(KListView *parent) |
181 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) | 196 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) |
182 | { | 197 | { |
183 | setFrame( false ); | 198 | setFrame( false ); |
184 | hide(); | 199 | hide(); |
185 | connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); | 200 | connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); |
186 | } | 201 | } |
187 | 202 | ||
188 | KListViewLineEdit::~KListViewLineEdit() | 203 | KListViewLineEdit::~KListViewLineEdit() |
189 | { | 204 | { |
190 | } | 205 | } |
@@ -213,67 +228,67 @@ void KListViewLineEdit::load(QListViewItem *i, int c) | |||
213 | 228 | ||
214 | if ( i->pixmap( col ) ) {// add width of pixmap | 229 | if ( i->pixmap( col ) ) {// add width of pixmap |
215 | int d = i->pixmap( col )->width(); | 230 | int d = i->pixmap( col )->width(); |
216 | fieldX += d; | 231 | fieldX += d; |
217 | fieldW -= d; | 232 | fieldW -= d; |
218 | } | 233 | } |
219 | 234 | ||
220 | setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); | 235 | setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); |
221 | show(); | 236 | show(); |
222 | setFocus(); | 237 | setFocus(); |
223 | } | 238 | } |
224 | */ | 239 | */ |
225 | /*Helper functions to for | 240 | /*Helper functions to for |
226 | *tabOrderedRename functionality. | 241 | *tabOrderedRename functionality. |
227 | */ | 242 | */ |
228 | 243 | ||
229 | static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) | 244 | static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir) |
230 | { | 245 | { |
231 | if (pi) | 246 | if (pi) |
232 | { | 247 | { |
233 | //Find the next renameable column in the current row | 248 | //Find the next renameable column in the current row |
234 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) | 249 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) |
235 | if (pl->isRenameable(start)) | 250 | if (pl->isRenameable(start)) |
236 | return start; | 251 | return start; |
237 | } | 252 | } |
238 | 253 | ||
239 | return -1; | 254 | return -1; |
240 | } | 255 | } |
241 | 256 | ||
242 | static QListViewItem *prevItem (QListViewItem *pi) | 257 | static Q3ListViewItem *prevItem (Q3ListViewItem *pi) |
243 | { | 258 | { |
244 | QListViewItem *pa = pi->itemAbove(); | 259 | Q3ListViewItem *pa = pi->itemAbove(); |
245 | 260 | ||
246 | /*Does what the QListViewItem::previousSibling() | 261 | /*Does what the QListViewItem::previousSibling() |
247 | *of my dreams would do. | 262 | *of my dreams would do. |
248 | */ | 263 | */ |
249 | if (pa && pa->parent() == pi->parent()) | 264 | if (pa && pa->parent() == pi->parent()) |
250 | return pa; | 265 | return pa; |
251 | 266 | ||
252 | return NULL; | 267 | return NULL; |
253 | } | 268 | } |
254 | 269 | ||
255 | static QListViewItem *lastQChild (QListViewItem *pi) | 270 | static Q3ListViewItem *lastQChild (Q3ListViewItem *pi) |
256 | { | 271 | { |
257 | if (pi) | 272 | if (pi) |
258 | { | 273 | { |
259 | /*Since there's no QListViewItem::lastChild(). | 274 | /*Since there's no QListViewItem::lastChild(). |
260 | *This finds the last sibling for the given | 275 | *This finds the last sibling for the given |
261 | *item. | 276 | *item. |
262 | */ | 277 | */ |
263 | for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) | 278 | for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) |
264 | pi = pt; | 279 | pi = pt; |
265 | } | 280 | } |
266 | 281 | ||
267 | return pi; | 282 | return pi; |
268 | } | 283 | } |
269 | /*US | 284 | /*US |
270 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) | 285 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) |
271 | { | 286 | { |
272 | const int ncols = p->columns(); | 287 | const int ncols = p->columns(); |
273 | const int dir = forward ? +1 : -1; | 288 | const int dir = forward ? +1 : -1; |
274 | const int restart = forward ? 0 : (ncols - 1); | 289 | const int restart = forward ? 0 : (ncols - 1); |
275 | QListViewItem *top = (pitem && pitem->parent()) | 290 | QListViewItem *top = (pitem && pitem->parent()) |
276 | ? pitem->parent()->firstChild() | 291 | ? pitem->parent()->firstChild() |
277 | : p->firstChild(); | 292 | : p->firstChild(); |
278 | QListViewItem *pi = pitem; | 293 | QListViewItem *pi = pitem; |
279 | 294 | ||
@@ -315,36 +330,36 @@ void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool f | |||
315 | } | 330 | } |
316 | */ | 331 | */ |
317 | 332 | ||
318 | /*US | 333 | /*US |
319 | #ifdef KeyPress | 334 | #ifdef KeyPress |
320 | #undef KeyPress | 335 | #undef KeyPress |
321 | #endif | 336 | #endif |
322 | 337 | ||
323 | bool KListViewLineEdit::event (QEvent *pe) | 338 | bool KListViewLineEdit::event (QEvent *pe) |
324 | { | 339 | { |
325 | if (pe->type() == QEvent::KeyPress) | 340 | if (pe->type() == QEvent::KeyPress) |
326 | { | 341 | { |
327 | QKeyEvent *k = (QKeyEvent *) pe; | 342 | QKeyEvent *k = (QKeyEvent *) pe; |
328 | 343 | ||
329 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && | 344 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && |
330 | p->tabOrderedRenaming() && p->itemsRenameable() && | 345 | p->tabOrderedRenaming() && p->itemsRenameable() && |
331 | !(k->state() & ControlButton || k->state() & AltButton)) | 346 | !(k->state() & Qt::ControlButton || k->state() & AltButton)) |
332 | { | 347 | { |
333 | selectNextCell(item, col, | 348 | selectNextCell(item, col, |
334 | (k->key() == Key_Tab && !(k->state() & ShiftButton))); | 349 | (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton))); |
335 | return true; | 350 | return true; |
336 | } | 351 | } |
337 | } | 352 | } |
338 | 353 | ||
339 | return KLineEdit::event(pe); | 354 | return KLineEdit::event(pe); |
340 | } | 355 | } |
341 | 356 | ||
342 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) | 357 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) |
343 | { | 358 | { |
344 | if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) | 359 | if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) |
345 | terminate(true); | 360 | terminate(true); |
346 | else if(e->key() == Qt::Key_Escape) | 361 | else if(e->key() == Qt::Key_Escape) |
347 | terminate(false); | 362 | terminate(false); |
348 | else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) | 363 | else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) |
349 | { | 364 | { |
350 | terminate(true); | 365 | terminate(true); |
@@ -393,166 +408,166 @@ void KListViewLineEdit::paintEvent( QPaintEvent *e ) | |||
393 | p.drawRect( rect() ); | 408 | p.drawRect( rect() ); |
394 | } | 409 | } |
395 | } | 410 | } |
396 | 411 | ||
397 | // selection changed -> terminate. As our "item" can be already deleted, | 412 | // selection changed -> terminate. As our "item" can be already deleted, |
398 | // we can't call terminate(false), because that would emit done() with | 413 | // we can't call terminate(false), because that would emit done() with |
399 | // a dangling pointer to "item". | 414 | // a dangling pointer to "item". |
400 | void KListViewLineEdit::slotSelectionChanged() | 415 | void KListViewLineEdit::slotSelectionChanged() |
401 | { | 416 | { |
402 | item = 0; | 417 | item = 0; |
403 | col = 0; | 418 | col = 0; |
404 | hide(); | 419 | hide(); |
405 | } | 420 | } |
406 | */ | 421 | */ |
407 | 422 | ||
408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) | 423 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 424 | : Q3ListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 425 | d (new KListViewPrivate (this)) |
411 | { | 426 | { |
412 | #ifndef DESKTOP_VERSION | 427 | #ifndef DESKTOP_VERSION |
413 | if ( emulateRightMouse ) | 428 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 429 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
415 | #endif | 430 | #endif |
416 | //US setDragAutoScroll(true); | 431 | //US setDragAutoScroll(true); |
417 | 432 | ||
418 | connect( this, SIGNAL( onViewport() ), | 433 | connect( this, SIGNAL( onViewport() ), |
419 | this, SLOT( slotOnViewport() ) ); | 434 | this, SLOT( slotOnViewport() ) ); |
420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 435 | connect( this, SIGNAL( onItem( Q3ListViewItem * ) ), |
421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 436 | this, SLOT( slotOnItem( Q3ListViewItem * ) ) ); |
422 | 437 | ||
423 | connect (this, SIGNAL(contentsMoving(int,int)), | 438 | connect (this, SIGNAL(contentsMoving(int,int)), |
424 | this, SLOT(cleanDropVisualizer())); | 439 | this, SLOT(cleanDropVisualizer())); |
425 | connect (this, SIGNAL(contentsMoving(int,int)), | 440 | connect (this, SIGNAL(contentsMoving(int,int)), |
426 | this, SLOT(cleanItemHighlighter())); | 441 | this, SLOT(cleanItemHighlighter())); |
427 | 442 | ||
428 | /*US | 443 | /*US |
429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 444 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
430 | 445 | ||
431 | if (kapp) | 446 | if (kapp) |
432 | { | 447 | { |
433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 448 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 449 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
435 | } | 450 | } |
436 | */ | 451 | */ |
437 | slotSettingsChanged(1); //US do this to initialize the connections | 452 | slotSettingsChanged(1); //US do this to initialize the connections |
438 | 453 | ||
439 | 454 | ||
440 | connect(&d->autoSelect, SIGNAL( timeout() ), | 455 | connect(&d->autoSelect, SIGNAL( timeout() ), |
441 | this, SLOT( slotAutoSelect() ) ); | 456 | this, SLOT( slotAutoSelect() ) ); |
442 | connect(&d->dragExpand, SIGNAL( timeout() ), | 457 | connect(&d->dragExpand, SIGNAL( timeout() ), |
443 | this, SLOT( slotDragExpand() ) ); | 458 | this, SLOT( slotDragExpand() ) ); |
444 | 459 | ||
445 | // context menu handling | 460 | // context menu handling |
446 | if (d->showContextMenusOnPress) | 461 | if (d->showContextMenusOnPress) |
447 | { | 462 | { |
448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 463 | connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)), |
449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 464 | this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); |
450 | } | 465 | } |
451 | else | 466 | else |
452 | { | 467 | { |
453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 468 | connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)), |
454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 469 | this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); |
455 | } | 470 | } |
456 | 471 | ||
457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 472 | connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)), |
458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 473 | this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*))); |
459 | 474 | ||
460 | 475 | ||
461 | //qDebug("KListView::KListView make alternate color configurable"); | 476 | //qDebug("KListView::KListView make alternate color configurable"); |
462 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 477 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
463 | } | 478 | } |
464 | 479 | ||
465 | 480 | ||
466 | 481 | ||
467 | KListView::~KListView() | 482 | KListView::~KListView() |
468 | { | 483 | { |
469 | delete d; | 484 | delete d; |
470 | } | 485 | } |
471 | 486 | ||
472 | bool KListView::isExecuteArea( const QPoint& point ) | 487 | bool KListView::isExecuteArea( const QPoint& point ) |
473 | { | 488 | { |
474 | if ( itemAt( point ) ) | 489 | if ( itemAt( point ) ) |
475 | return isExecuteArea( point.x() ); | 490 | return isExecuteArea( point.x() ); |
476 | 491 | ||
477 | return false; | 492 | return false; |
478 | } | 493 | } |
479 | QSize KListView::sizeHint() const | 494 | QSize KListView::sizeHint() const |
480 | { | 495 | { |
481 | //qDebug("KListView::QSize sizeHint() "); | 496 | //qDebug("KListView::QSize sizeHint() "); |
482 | #ifdef DESKTOP_VERSION | 497 | #ifdef DESKTOP_VERSION |
483 | return QListView::sizeHint(); | 498 | return Q3ListView::sizeHint(); |
484 | #else | 499 | #else |
485 | return QSize ( 40, 40 ); | 500 | return QSize ( 40, 40 ); |
486 | #endif | 501 | #endif |
487 | 502 | ||
488 | } | 503 | } |
489 | bool KListView::isExecuteArea( int x ) | 504 | bool KListView::isExecuteArea( int x ) |
490 | { | 505 | { |
491 | if( allColumnsShowFocus() ) | 506 | if( allColumnsShowFocus() ) |
492 | return true; | 507 | return true; |
493 | else { | 508 | else { |
494 | int offset = 0; | 509 | int offset = 0; |
495 | int width = columnWidth( 0 ); | 510 | int width = columnWidth( 0 ); |
496 | int pos = header()->mapToIndex( 0 ); | 511 | int pos = header()->mapToIndex( 0 ); |
497 | 512 | ||
498 | for ( int index = 0; index < pos; index++ ) | 513 | for ( int index = 0; index < pos; index++ ) |
499 | offset += columnWidth( header()->mapToSection( index ) ); | 514 | offset += columnWidth( header()->mapToSection( index ) ); |
500 | 515 | ||
501 | x += contentsX(); // in case of a horizontal scrollbar | 516 | x += contentsX(); // in case of a horizontal scrollbar |
502 | return ( x > offset && x < ( offset + width ) ); | 517 | return ( x > offset && x < ( offset + width ) ); |
503 | } | 518 | } |
504 | } | 519 | } |
505 | 520 | ||
506 | void KListView::slotOnItem( QListViewItem *item ) | 521 | void KListView::slotOnItem( Q3ListViewItem *item ) |
507 | { | 522 | { |
508 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 523 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
509 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 524 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
510 | d->autoSelect.start( d->autoSelectDelay, true ); | 525 | d->autoSelect.start( d->autoSelectDelay, true ); |
511 | d->pCurrentItem = item; | 526 | d->pCurrentItem = item; |
512 | } | 527 | } |
513 | } | 528 | } |
514 | 529 | ||
515 | void KListView::slotOnViewport() | 530 | void KListView::slotOnViewport() |
516 | { | 531 | { |
517 | if ( d->bChangeCursorOverItem ) | 532 | if ( d->bChangeCursorOverItem ) |
518 | viewport()->unsetCursor(); | 533 | viewport()->unsetCursor(); |
519 | 534 | ||
520 | d->autoSelect.stop(); | 535 | d->autoSelect.stop(); |
521 | d->pCurrentItem = 0L; | 536 | d->pCurrentItem = 0L; |
522 | } | 537 | } |
523 | 538 | ||
524 | void KListView::slotSettingsChanged(int category) | 539 | void KListView::slotSettingsChanged(int category) |
525 | { | 540 | { |
526 | //qDebug("KListView::slotSettingsChanged has to be verified"); | 541 | //qDebug("KListView::slotSettingsChanged has to be verified"); |
527 | 542 | ||
528 | 543 | ||
529 | switch (category) | 544 | switch (category) |
530 | { | 545 | { |
531 | //US I create my private category (=1) to set the settings | 546 | //US I create my private category (=1) to set the settings |
532 | case 1: | 547 | case 1: |
533 | d->dragDelay = 2; | 548 | d->dragDelay = 2; |
534 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); | 549 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); |
535 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); | 550 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); |
536 | 551 | ||
537 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 552 | disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), |
538 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 553 | this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int))); |
539 | 554 | ||
540 | if( d->bUseSingle ) | 555 | if( d->bUseSingle ) |
541 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 556 | connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), |
542 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 557 | this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int))); |
543 | 558 | ||
544 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 559 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
545 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 560 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
546 | 561 | ||
547 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 562 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
548 | viewport()->unsetCursor(); | 563 | viewport()->unsetCursor(); |
549 | 564 | ||
550 | break; | 565 | break; |
551 | 566 | ||
552 | /*US | 567 | /*US |
553 | case KApplication::SETTINGS_MOUSE: | 568 | case KApplication::SETTINGS_MOUSE: |
554 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 569 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
555 | d->bUseSingle = KGlobalSettings::singleClick(); | 570 | d->bUseSingle = KGlobalSettings::singleClick(); |
556 | 571 | ||
557 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 572 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
558 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 573 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
@@ -598,345 +613,345 @@ void KListView::slotSettingsChanged(int category) | |||
598 | void KListView::slotAutoSelect() | 613 | void KListView::slotAutoSelect() |
599 | { | 614 | { |
600 | // check that the item still exists | 615 | // check that the item still exists |
601 | if( itemIndex( d->pCurrentItem ) == -1 ) | 616 | if( itemIndex( d->pCurrentItem ) == -1 ) |
602 | return; | 617 | return; |
603 | 618 | ||
604 | if (!isActiveWindow()) | 619 | if (!isActiveWindow()) |
605 | { | 620 | { |
606 | d->autoSelect.stop(); | 621 | d->autoSelect.stop(); |
607 | return; | 622 | return; |
608 | } | 623 | } |
609 | 624 | ||
610 | //Give this widget the keyboard focus. | 625 | //Give this widget the keyboard focus. |
611 | if( !hasFocus() ) | 626 | if( !hasFocus() ) |
612 | setFocus(); | 627 | setFocus(); |
613 | 628 | ||
614 | QListViewItem* previousItem = currentItem(); | 629 | Q3ListViewItem* previousItem = currentItem(); |
615 | setCurrentItem( d->pCurrentItem ); | 630 | setCurrentItem( d->pCurrentItem ); |
616 | 631 | ||
617 | #if 0 | 632 | #if 0 |
618 | #ifndef Q_WS_QWS | 633 | #ifndef Q_WS_QWS |
619 | // FIXME(E): Implement for Qt Embedded | 634 | // FIXME(E): Implement for Qt Embedded |
620 | if( d->pCurrentItem ) { | 635 | if( d->pCurrentItem ) { |
621 | //Shift pressed? | 636 | //Shift pressed? |
622 | if( (keybstate & ShiftMask) ) { | 637 | if( (keybstate & ShiftMask) ) { |
623 | bool block = signalsBlocked(); | 638 | bool block = signalsBlocked(); |
624 | blockSignals( true ); | 639 | blockSignals( true ); |
625 | 640 | ||
626 | //No Ctrl? Then clear before! | 641 | //No Ctrl? Then clear before! |
627 | if( !(keybstate & ControlMask) ) | 642 | if( !(keybstate & ControlMask) ) |
628 | clearSelection(); | 643 | clearSelection(); |
629 | 644 | ||
630 | bool select = !d->pCurrentItem->isSelected(); | 645 | bool select = !d->pCurrentItem->isSelected(); |
631 | bool update = viewport()->isUpdatesEnabled(); | 646 | bool update = viewport()->isUpdatesEnabled(); |
632 | viewport()->setUpdatesEnabled( false ); | 647 | viewport()->setUpdatesEnabled( false ); |
633 | 648 | ||
634 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); | 649 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); |
635 | QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); | 650 | Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); |
636 | for ( ; lit.current(); ++lit ) { | 651 | for ( ; lit.current(); ++lit ) { |
637 | if ( down && lit.current() == d->pCurrentItem ) { | 652 | if ( down && lit.current() == d->pCurrentItem ) { |
638 | d->pCurrentItem->setSelected( select ); | 653 | d->pCurrentItem->setSelected( select ); |
639 | break; | 654 | break; |
640 | } | 655 | } |
641 | if ( !down && lit.current() == previousItem ) { | 656 | if ( !down && lit.current() == previousItem ) { |
642 | previousItem->setSelected( select ); | 657 | previousItem->setSelected( select ); |
643 | break; | 658 | break; |
644 | } | 659 | } |
645 | lit.current()->setSelected( select ); | 660 | lit.current()->setSelected( select ); |
646 | } | 661 | } |
647 | 662 | ||
648 | blockSignals( block ); | 663 | blockSignals( block ); |
649 | viewport()->setUpdatesEnabled( update ); | 664 | viewport()->setUpdatesEnabled( update ); |
650 | triggerUpdate(); | 665 | triggerUpdate(); |
651 | 666 | ||
652 | emit selectionChanged(); | 667 | emit selectionChanged(); |
653 | 668 | ||
654 | if( selectionMode() == QListView::Single ) | 669 | if( selectionMode() == Q3ListView::Single ) |
655 | emit selectionChanged( d->pCurrentItem ); | 670 | emit selectionChanged( d->pCurrentItem ); |
656 | } | 671 | } |
657 | else if( (keybstate & ControlMask) ) | 672 | else if( (keybstate & ControlMask) ) |
658 | setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); | 673 | setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); |
659 | else { | 674 | else { |
660 | bool block = signalsBlocked(); | 675 | bool block = signalsBlocked(); |
661 | blockSignals( true ); | 676 | blockSignals( true ); |
662 | 677 | ||
663 | if( !d->pCurrentItem->isSelected() ) | 678 | if( !d->pCurrentItem->isSelected() ) |
664 | clearSelection(); | 679 | clearSelection(); |
665 | 680 | ||
666 | blockSignals( block ); | 681 | blockSignals( block ); |
667 | 682 | ||
668 | setSelected( d->pCurrentItem, true ); | 683 | setSelected( d->pCurrentItem, true ); |
669 | } | 684 | } |
670 | } | 685 | } |
671 | else | 686 | else |
672 | kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl; | 687 | kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl; |
673 | #endif | 688 | #endif |
674 | #endif | 689 | #endif |
675 | } | 690 | } |
676 | 691 | ||
677 | void KListView::slotHeaderChanged() | 692 | void KListView::slotHeaderChanged() |
678 | { | 693 | { |
679 | if (d->fullWidth && columns()) | 694 | if (d->fullWidth && columns()) |
680 | { | 695 | { |
681 | int w = 0; | 696 | int w = 0; |
682 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); | 697 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); |
683 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); | 698 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); |
684 | } | 699 | } |
685 | } | 700 | } |
686 | 701 | ||
687 | void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) | 702 | void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c) |
688 | { | 703 | { |
689 | // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); | 704 | // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); |
690 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { | 705 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { |
691 | 706 | ||
692 | // Double click mode ? | 707 | // Double click mode ? |
693 | if ( !d->bUseSingle ) | 708 | if ( !d->bUseSingle ) |
694 | { | 709 | { |
695 | emit executed( item ); | 710 | emit executed( item ); |
696 | emit executed( item, pos, c ); | 711 | emit executed( item, pos, c ); |
697 | } | 712 | } |
698 | else | 713 | else |
699 | { | 714 | { |
700 | //US special implementation for embedded systems | 715 | //US special implementation for embedded systems |
701 | d->autoSelect.stop(); | 716 | d->autoSelect.stop(); |
702 | 717 | ||
703 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed | 718 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed |
704 | if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { | 719 | if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) { |
705 | // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { | 720 | // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { |
706 | 721 | ||
707 | emit executed( item ); | 722 | emit executed( item ); |
708 | emit executed( item, pos, c ); | 723 | emit executed( item, pos, c ); |
709 | } | 724 | } |
710 | } | 725 | } |
711 | } | 726 | } |
712 | } | 727 | } |
713 | 728 | ||
714 | void KListView::focusInEvent( QFocusEvent *fe ) | 729 | void KListView::focusInEvent( QFocusEvent *fe ) |
715 | { | 730 | { |
716 | // kdDebug()<<"KListView::focusInEvent()"<<endl; | 731 | // kdDebug()<<"KListView::focusInEvent()"<<endl; |
717 | QListView::focusInEvent( fe ); | 732 | Q3ListView::focusInEvent( fe ); |
718 | if ((d->selectedBySimpleMove) | 733 | if ((d->selectedBySimpleMove) |
719 | && (d->selectionMode == FileManager) | 734 | && (d->selectionMode == FileManager) |
720 | && (fe->reason()!=QFocusEvent::Popup) | 735 | && (fe->reason()!=QFocusEvent::Popup) |
721 | && (fe->reason()!=QFocusEvent::ActiveWindow) | 736 | && (fe->reason()!=QFocusEvent::ActiveWindow) |
722 | && (currentItem()!=0)) | 737 | && (currentItem()!=0)) |
723 | { | 738 | { |
724 | currentItem()->setSelected(true); | 739 | currentItem()->setSelected(true); |
725 | currentItem()->repaint(); | 740 | currentItem()->repaint(); |
726 | emit selectionChanged(); | 741 | emit selectionChanged(); |
727 | }; | 742 | }; |
728 | } | 743 | } |
729 | 744 | ||
730 | void KListView::focusOutEvent( QFocusEvent *fe ) | 745 | void KListView::focusOutEvent( QFocusEvent *fe ) |
731 | { | 746 | { |
732 | cleanDropVisualizer(); | 747 | cleanDropVisualizer(); |
733 | cleanItemHighlighter(); | 748 | cleanItemHighlighter(); |
734 | 749 | ||
735 | d->autoSelect.stop(); | 750 | d->autoSelect.stop(); |
736 | 751 | ||
737 | if ((d->selectedBySimpleMove) | 752 | if ((d->selectedBySimpleMove) |
738 | && (d->selectionMode == FileManager) | 753 | && (d->selectionMode == FileManager) |
739 | && (fe->reason()!=QFocusEvent::Popup) | 754 | && (fe->reason()!=QFocusEvent::Popup) |
740 | && (fe->reason()!=QFocusEvent::ActiveWindow) | 755 | && (fe->reason()!=QFocusEvent::ActiveWindow) |
741 | && (currentItem()!=0) | 756 | && (currentItem()!=0) |
742 | /*US && (!d->editor->isVisible()) */ | 757 | /*US && (!d->editor->isVisible()) */ |
743 | ) | 758 | ) |
744 | { | 759 | { |
745 | currentItem()->setSelected(false); | 760 | currentItem()->setSelected(false); |
746 | currentItem()->repaint(); | 761 | currentItem()->repaint(); |
747 | emit selectionChanged(); | 762 | emit selectionChanged(); |
748 | }; | 763 | }; |
749 | 764 | ||
750 | QListView::focusOutEvent( fe ); | 765 | Q3ListView::focusOutEvent( fe ); |
751 | } | 766 | } |
752 | 767 | ||
753 | void KListView::leaveEvent( QEvent *e ) | 768 | void KListView::leaveEvent( QEvent *e ) |
754 | { | 769 | { |
755 | d->autoSelect.stop(); | 770 | d->autoSelect.stop(); |
756 | 771 | ||
757 | QListView::leaveEvent( e ); | 772 | Q3ListView::leaveEvent( e ); |
758 | } | 773 | } |
759 | 774 | ||
760 | bool KListView::event( QEvent *e ) | 775 | bool KListView::event( QEvent *e ) |
761 | { | 776 | { |
762 | if (e->type() == QEvent::ApplicationPaletteChange) { | 777 | if (e->type() == QEvent::ApplicationPaletteChange) { |
763 | //qDebug("KListView::event make alternate color configurable"); | 778 | //qDebug("KListView::event make alternate color configurable"); |
764 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); | 779 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); |
765 | d->alternateBackground = QColor(240, 240, 240); | 780 | d->alternateBackground = QColor(240, 240, 240); |
766 | } | 781 | } |
767 | 782 | ||
768 | return QListView::event(e); | 783 | return Q3ListView::event(e); |
769 | } | 784 | } |
770 | 785 | ||
771 | void KListView::contentsMousePressEvent( QMouseEvent *e ) | 786 | void KListView::contentsMousePressEvent( QMouseEvent *e ) |
772 | { | 787 | { |
773 | //qDebug("KListView::contentsMousePressEvent"); | 788 | //qDebug("KListView::contentsMousePressEvent"); |
774 | if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) | 789 | if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) |
775 | { | 790 | { |
776 | bool block = signalsBlocked(); | 791 | bool block = signalsBlocked(); |
777 | blockSignals( true ); | 792 | blockSignals( true ); |
778 | 793 | ||
779 | clearSelection(); | 794 | clearSelection(); |
780 | 795 | ||
781 | blockSignals( block ); | 796 | blockSignals( block ); |
782 | } | 797 | } |
783 | else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) | 798 | else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) |
784 | { | 799 | { |
785 | d->selectedBySimpleMove=false; | 800 | d->selectedBySimpleMove=false; |
786 | d->selectedUsingMouse=true; | 801 | d->selectedUsingMouse=true; |
787 | if (currentItem()!=0) | 802 | if (currentItem()!=0) |
788 | { | 803 | { |
789 | currentItem()->setSelected(false); | 804 | currentItem()->setSelected(false); |
790 | currentItem()->repaint(); | 805 | currentItem()->repaint(); |
791 | // emit selectionChanged(); | 806 | // emit selectionChanged(); |
792 | }; | 807 | }; |
793 | }; | 808 | }; |
794 | 809 | ||
795 | QPoint p( contentsToViewport( e->pos() ) ); | 810 | QPoint p( contentsToViewport( e->pos() ) ); |
796 | QListViewItem *at = itemAt (p); | 811 | Q3ListViewItem *at = itemAt (p); |
797 | 812 | ||
798 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) | 813 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) |
799 | bool rootDecoClicked = at | 814 | bool rootDecoClicked = at |
800 | && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + | 815 | && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + |
801 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) | 816 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) |
802 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); | 817 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); |
803 | 818 | ||
804 | if (e->button() == LeftButton && !rootDecoClicked) | 819 | if (e->button() == Qt::LeftButton && !rootDecoClicked) |
805 | { | 820 | { |
806 | //Start a drag | 821 | //Start a drag |
807 | d->startDragPos = e->pos(); | 822 | d->startDragPos = e->pos(); |
808 | 823 | ||
809 | if (at) | 824 | if (at) |
810 | { | 825 | { |
811 | d->validDrag = true; | 826 | d->validDrag = true; |
812 | d->pressedOnSelected = at->isSelected(); | 827 | d->pressedOnSelected = at->isSelected(); |
813 | } | 828 | } |
814 | } | 829 | } |
815 | 830 | ||
816 | QListView::contentsMousePressEvent( e ); | 831 | Q3ListView::contentsMousePressEvent( e ); |
817 | } | 832 | } |
818 | 833 | ||
819 | void KListView::contentsMouseMoveEvent( QMouseEvent *e ) | 834 | void KListView::contentsMouseMoveEvent( QMouseEvent *e ) |
820 | { | 835 | { |
821 | if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { | 836 | if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { |
822 | QListView::contentsMouseMoveEvent (e); | 837 | Q3ListView::contentsMouseMoveEvent (e); |
823 | return; | 838 | return; |
824 | } | 839 | } |
825 | 840 | ||
826 | QPoint vp = contentsToViewport(e->pos()); | 841 | QPoint vp = contentsToViewport(e->pos()); |
827 | QListViewItem *item = itemAt( vp ); | 842 | Q3ListViewItem *item = itemAt( vp ); |
828 | 843 | ||
829 | //do we process cursor changes at all? | 844 | //do we process cursor changes at all? |
830 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) | 845 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) |
831 | { | 846 | { |
832 | //Cursor moved on a new item or in/out the execute area | 847 | //Cursor moved on a new item or in/out the execute area |
833 | if( (item != d->pCurrentItem) || | 848 | if( (item != d->pCurrentItem) || |
834 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) | 849 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) |
835 | { | 850 | { |
836 | d->cursorInExecuteArea = isExecuteArea(vp); | 851 | d->cursorInExecuteArea = isExecuteArea(vp); |
837 | //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); | 852 | //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); |
838 | /*US | 853 | /*US |
839 | if( d->cursorInExecuteArea ) //cursor moved in execute area | 854 | if( d->cursorInExecuteArea ) //cursor moved in execute area |
840 | viewport()->setCursor( KCursor::handCursor() ); | 855 | viewport()->setCursor( KCursor::handCursor() ); |
841 | else //cursor moved out of execute area | 856 | else //cursor moved out of execute area |
842 | viewport()->unsetCursor(); | 857 | viewport()->unsetCursor(); |
843 | */ | 858 | */ |
844 | } | 859 | } |
845 | } | 860 | } |
846 | 861 | ||
847 | bool dragOn = dragEnabled(); | 862 | bool dragOn = dragEnabled(); |
848 | QPoint newPos = e->pos(); | 863 | QPoint newPos = e->pos(); |
849 | if (dragOn && d->validDrag && | 864 | if (dragOn && d->validDrag && |
850 | (newPos.x() > d->startDragPos.x()+d->dragDelay || | 865 | (newPos.x() > d->startDragPos.x()+d->dragDelay || |
851 | newPos.x() < d->startDragPos.x()-d->dragDelay || | 866 | newPos.x() < d->startDragPos.x()-d->dragDelay || |
852 | newPos.y() > d->startDragPos.y()+d->dragDelay || | 867 | newPos.y() > d->startDragPos.y()+d->dragDelay || |
853 | newPos.y() < d->startDragPos.y()-d->dragDelay)) | 868 | newPos.y() < d->startDragPos.y()-d->dragDelay)) |
854 | //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) | 869 | //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) |
855 | { | 870 | { |
856 | QListView::contentsMouseReleaseEvent( 0 ); | 871 | Q3ListView::contentsMouseReleaseEvent( 0 ); |
857 | startDrag(); | 872 | startDrag(); |
858 | d->startDragPos = QPoint(); | 873 | d->startDragPos = QPoint(); |
859 | d->validDrag = false; | 874 | d->validDrag = false; |
860 | } | 875 | } |
861 | } | 876 | } |
862 | 877 | ||
863 | void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) | 878 | void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) |
864 | { | 879 | { |
865 | if (e->button() == LeftButton) | 880 | if (e->button() == Qt::LeftButton) |
866 | { | 881 | { |
867 | // If the row was already selected, maybe we want to start an in-place editing | 882 | // If the row was already selected, maybe we want to start an in-place editing |
868 | if ( d->pressedOnSelected && itemsRenameable() ) | 883 | if ( d->pressedOnSelected && itemsRenameable() ) |
869 | { | 884 | { |
870 | QPoint p( contentsToViewport( e->pos() ) ); | 885 | QPoint p( contentsToViewport( e->pos() ) ); |
871 | QListViewItem *at = itemAt (p); | 886 | Q3ListViewItem *at = itemAt (p); |
872 | if ( at ) | 887 | if ( at ) |
873 | { | 888 | { |
874 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) | 889 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) |
875 | bool rootDecoClicked = | 890 | bool rootDecoClicked = |
876 | ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + | 891 | ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + |
877 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) | 892 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) |
878 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); | 893 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); |
879 | 894 | ||
880 | if (!rootDecoClicked) | 895 | if (!rootDecoClicked) |
881 | { | 896 | { |
882 | int col = header()->mapToLogical( header()->cellAt( p.x() ) ); | 897 | int col = header()->mapToLogical( header()->cellAt( p.x() ) ); |
883 | if ( d->renameable.contains(col) ) | 898 | if ( d->renameable.contains(col) ) |
884 | rename(at, col); | 899 | rename(at, col); |
885 | } | 900 | } |
886 | } | 901 | } |
887 | } | 902 | } |
888 | 903 | ||
889 | d->pressedOnSelected = false; | 904 | d->pressedOnSelected = false; |
890 | d->validDrag = false; | 905 | d->validDrag = false; |
891 | d->startDragPos = QPoint(); | 906 | d->startDragPos = QPoint(); |
892 | } | 907 | } |
893 | QListView::contentsMouseReleaseEvent( e ); | 908 | Q3ListView::contentsMouseReleaseEvent( e ); |
894 | } | 909 | } |
895 | 910 | ||
896 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) | 911 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) |
897 | { | 912 | { |
898 | //qDebug("KListView::contentsMouseDoubleClickEvent"); | 913 | //qDebug("KListView::contentsMouseDoubleClickEvent"); |
899 | // We don't want to call the parent method because it does setOpen, | 914 | // We don't want to call the parent method because it does setOpen, |
900 | // whereas we don't do it in single click mode... (David) | 915 | // whereas we don't do it in single click mode... (David) |
901 | //QListView::contentsMouseDoubleClickEvent( e ); | 916 | //QListView::contentsMouseDoubleClickEvent( e ); |
902 | 917 | ||
903 | QPoint vp = contentsToViewport(e->pos()); | 918 | QPoint vp = contentsToViewport(e->pos()); |
904 | QListViewItem *item = itemAt( vp ); | 919 | Q3ListViewItem *item = itemAt( vp ); |
905 | emit QListView::doubleClicked( item ); // we do it now | 920 | emit Q3ListView::doubleClicked( item ); // we do it now |
906 | 921 | ||
907 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; | 922 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; |
908 | 923 | ||
909 | if( item ) { | 924 | if( item ) { |
910 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); | 925 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); |
911 | 926 | ||
912 | emit doubleClicked( item, e->globalPos(), col ); | 927 | emit doubleClicked( item, e->globalPos(), col ); |
913 | 928 | ||
914 | if( (e->button() == LeftButton) && !d->bUseSingle ) { | 929 | if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) { |
915 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); | 930 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); |
916 | 931 | ||
917 | emitExecute( e->button(), item, e->globalPos(), col); | 932 | emitExecute( e->button(), item, e->globalPos(), col); |
918 | } | 933 | } |
919 | } | 934 | } |
920 | } | 935 | } |
921 | 936 | ||
922 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) | 937 | void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ) |
923 | { | 938 | { |
924 | //qDebug("KListView::slotMouseButtonClicked"); | 939 | //qDebug("KListView::slotMouseButtonClicked"); |
925 | 940 | ||
926 | if( (btn == LeftButton) && item ) { | 941 | if( (btn == Qt::LeftButton) && item ) { |
927 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); | 942 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); |
928 | 943 | ||
929 | emitExecute(btn, item, pos, c); | 944 | emitExecute(btn, item, pos, c); |
930 | } | 945 | } |
931 | } | 946 | } |
932 | 947 | ||
933 | void KListView::contentsDropEvent(QDropEvent* e) | 948 | void KListView::contentsDropEvent(QDropEvent* e) |
934 | { | 949 | { |
935 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 950 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
936 | /*US | 951 | /*US |
937 | cleanDropVisualizer(); | 952 | cleanDropVisualizer(); |
938 | cleanItemHighlighter(); | 953 | cleanItemHighlighter(); |
939 | d->dragExpand.stop(); | 954 | d->dragExpand.stop(); |
940 | 955 | ||
941 | if (acceptDrag (e)) | 956 | if (acceptDrag (e)) |
942 | { | 957 | { |
@@ -948,72 +963,72 @@ qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | |||
948 | if (e->source() == viewport() && itemsMovable()) | 963 | if (e->source() == viewport() && itemsMovable()) |
949 | movableDropEvent(parent, afterme); | 964 | movableDropEvent(parent, afterme); |
950 | else | 965 | else |
951 | { | 966 | { |
952 | 967 | ||
953 | emit dropped(e, afterme); | 968 | emit dropped(e, afterme); |
954 | emit dropped(this, e, afterme); | 969 | emit dropped(this, e, afterme); |
955 | emit dropped(e, parent, afterme); | 970 | emit dropped(e, parent, afterme); |
956 | emit dropped(this, e, parent, afterme); | 971 | emit dropped(this, e, parent, afterme); |
957 | 972 | ||
958 | } | 973 | } |
959 | } | 974 | } |
960 | */ | 975 | */ |
961 | 976 | ||
962 | } | 977 | } |
963 | 978 | ||
964 | void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) | 979 | void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme) |
965 | { | 980 | { |
966 | QPtrList<QListViewItem> items, afterFirsts, afterNows; | 981 | Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows; |
967 | QListViewItem *current=currentItem(); | 982 | Q3ListViewItem *current=currentItem(); |
968 | bool hasMoved=false; | 983 | bool hasMoved=false; |
969 | for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) | 984 | for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) |
970 | { | 985 | { |
971 | iNext=i->itemBelow(); | 986 | iNext=i->itemBelow(); |
972 | if (!i->isSelected()) | 987 | if (!i->isSelected()) |
973 | continue; | 988 | continue; |
974 | 989 | ||
975 | // don't drop an item after itself, or else | 990 | // don't drop an item after itself, or else |
976 | // it moves to the top of the list | 991 | // it moves to the top of the list |
977 | if (i==afterme) | 992 | if (i==afterme) |
978 | continue; | 993 | continue; |
979 | 994 | ||
980 | i->setSelected(false); | 995 | i->setSelected(false); |
981 | 996 | ||
982 | QListViewItem *afterFirst = i->itemAbove(); | 997 | Q3ListViewItem *afterFirst = i->itemAbove(); |
983 | 998 | ||
984 | if (!hasMoved) | 999 | if (!hasMoved) |
985 | { | 1000 | { |
986 | emit aboutToMove(); | 1001 | emit aboutToMove(); |
987 | hasMoved=true; | 1002 | hasMoved=true; |
988 | } | 1003 | } |
989 | 1004 | ||
990 | moveItem(i, parent, afterme); | 1005 | moveItem(i, parent, afterme); |
991 | 1006 | ||
992 | // ###### This should include the new parent !!! -> KDE 3.0 | 1007 | // ###### This should include the new parent !!! -> KDE 3.0 |
993 | // If you need this right now, have a look at keditbookmarks. | 1008 | // If you need this right now, have a look at keditbookmarks. |
994 | emit moved(i, afterFirst, afterme); | 1009 | emit moved(i, afterFirst, afterme); |
995 | 1010 | ||
996 | items.append (i); | 1011 | items.append (i); |
997 | afterFirsts.append (afterFirst); | 1012 | afterFirsts.append (afterFirst); |
998 | afterNows.append (afterme); | 1013 | afterNows.append (afterme); |
999 | 1014 | ||
1000 | afterme = i; | 1015 | afterme = i; |
1001 | } | 1016 | } |
1002 | clearSelection(); | 1017 | clearSelection(); |
1003 | for (QListViewItem *i=items.first(); i != 0; i=items.next() ) | 1018 | for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() ) |
1004 | i->setSelected(true); | 1019 | i->setSelected(true); |
1005 | if (current) | 1020 | if (current) |
1006 | setCurrentItem(current); | 1021 | setCurrentItem(current); |
1007 | 1022 | ||
1008 | emit moved(items,afterFirsts,afterNows); | 1023 | emit moved(items,afterFirsts,afterNows); |
1009 | 1024 | ||
1010 | if (firstChild()) | 1025 | if (firstChild()) |
1011 | emit moved(); | 1026 | emit moved(); |
1012 | } | 1027 | } |
1013 | 1028 | ||
1014 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) | 1029 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) |
1015 | { | 1030 | { |
1016 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 1031 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
1017 | /*US | 1032 | /*US |
1018 | if (acceptDrag(event)) | 1033 | if (acceptDrag(event)) |
1019 | { | 1034 | { |
@@ -1073,139 +1088,139 @@ void KListView::contentsDragLeaveEvent (QDragLeaveEvent*) | |||
1073 | 1088 | ||
1074 | void KListView::cleanDropVisualizer() | 1089 | void KListView::cleanDropVisualizer() |
1075 | { | 1090 | { |
1076 | if (d->mOldDropVisualizer.isValid()) | 1091 | if (d->mOldDropVisualizer.isValid()) |
1077 | { | 1092 | { |
1078 | QRect rect=d->mOldDropVisualizer; | 1093 | QRect rect=d->mOldDropVisualizer; |
1079 | d->mOldDropVisualizer = QRect(); | 1094 | d->mOldDropVisualizer = QRect(); |
1080 | viewport()->repaint(rect, true); | 1095 | viewport()->repaint(rect, true); |
1081 | } | 1096 | } |
1082 | } | 1097 | } |
1083 | 1098 | ||
1084 | int KListView::depthToPixels( int depth ) | 1099 | int KListView::depthToPixels( int depth ) |
1085 | { | 1100 | { |
1086 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); | 1101 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); |
1087 | } | 1102 | } |
1088 | 1103 | ||
1089 | void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) | 1104 | void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after) |
1090 | { | 1105 | { |
1091 | QPoint p (contentsToViewport(pos)); | 1106 | QPoint p (contentsToViewport(pos)); |
1092 | 1107 | ||
1093 | // Get the position to put it in | 1108 | // Get the position to put it in |
1094 | QListViewItem *atpos = itemAt(p); | 1109 | Q3ListViewItem *atpos = itemAt(p); |
1095 | 1110 | ||
1096 | QListViewItem *above; | 1111 | Q3ListViewItem *above; |
1097 | if (!atpos) // put it at the end | 1112 | if (!atpos) // put it at the end |
1098 | above = lastItem(); | 1113 | above = lastItem(); |
1099 | else | 1114 | else |
1100 | { | 1115 | { |
1101 | // Get the closest item before us ('atpos' or the one above, if any) | 1116 | // Get the closest item before us ('atpos' or the one above, if any) |
1102 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) | 1117 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) |
1103 | above = atpos->itemAbove(); | 1118 | above = atpos->itemAbove(); |
1104 | else | 1119 | else |
1105 | above = atpos; | 1120 | above = atpos; |
1106 | } | 1121 | } |
1107 | 1122 | ||
1108 | if (above) | 1123 | if (above) |
1109 | { | 1124 | { |
1110 | // Now, we know we want to go after "above". But as a child or as a sibling ? | 1125 | // Now, we know we want to go after "above". But as a child or as a sibling ? |
1111 | // We have to ask the "above" item if it accepts children. | 1126 | // We have to ask the "above" item if it accepts children. |
1112 | if (above->isExpandable()) | 1127 | if (above->isExpandable()) |
1113 | { | 1128 | { |
1114 | // The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children | 1129 | // The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children |
1115 | if (p.x() >= depthToPixels( above->depth() + 1 ) || | 1130 | if (p.x() >= depthToPixels( above->depth() + 1 ) || |
1116 | (above->isOpen() && above->childCount() > 0) ) | 1131 | (above->isOpen() && above->childCount() > 0) ) |
1117 | { | 1132 | { |
1118 | parent = above; | 1133 | parent = above; |
1119 | after = 0L; | 1134 | after = 0L; |
1120 | return; | 1135 | return; |
1121 | } | 1136 | } |
1122 | } | 1137 | } |
1123 | 1138 | ||
1124 | // Ok, there's one more level of complexity. We may want to become a new | 1139 | // Ok, there's one more level of complexity. We may want to become a new |
1125 | // sibling, but of an upper-level group, rather than the "above" item | 1140 | // sibling, but of an upper-level group, rather than the "above" item |
1126 | QListViewItem * betterAbove = above->parent(); | 1141 | Q3ListViewItem * betterAbove = above->parent(); |
1127 | QListViewItem * last = above; | 1142 | Q3ListViewItem * last = above; |
1128 | while ( betterAbove ) | 1143 | while ( betterAbove ) |
1129 | { | 1144 | { |
1130 | // We are allowed to become a sibling of "betterAbove" only if we are | 1145 | // We are allowed to become a sibling of "betterAbove" only if we are |
1131 | // after its last child | 1146 | // after its last child |
1132 | if ( last->nextSibling() == 0 ) | 1147 | if ( last->nextSibling() == 0 ) |
1133 | { | 1148 | { |
1134 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) | 1149 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) |
1135 | above = betterAbove; // store this one, but don't stop yet, there may be a better one | 1150 | above = betterAbove; // store this one, but don't stop yet, there may be a better one |
1136 | else | 1151 | else |
1137 | break; // not enough on the left, so stop | 1152 | break; // not enough on the left, so stop |
1138 | last = betterAbove; | 1153 | last = betterAbove; |
1139 | betterAbove = betterAbove->parent(); // up one level | 1154 | betterAbove = betterAbove->parent(); // up one level |
1140 | } else | 1155 | } else |
1141 | break; // we're among the child of betterAbove, not after the last one | 1156 | break; // we're among the child of betterAbove, not after the last one |
1142 | } | 1157 | } |
1143 | } | 1158 | } |
1144 | // set as sibling | 1159 | // set as sibling |
1145 | after = above; | 1160 | after = above; |
1146 | parent = after ? after->parent() : 0L ; | 1161 | parent = after ? after->parent() : 0L ; |
1147 | } | 1162 | } |
1148 | 1163 | ||
1149 | QListViewItem* KListView::lastChild () const | 1164 | Q3ListViewItem* KListView::lastChild () const |
1150 | { | 1165 | { |
1151 | QListViewItem* lastchild = firstChild(); | 1166 | Q3ListViewItem* lastchild = firstChild(); |
1152 | 1167 | ||
1153 | if (lastchild) | 1168 | if (lastchild) |
1154 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); | 1169 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); |
1155 | 1170 | ||
1156 | return lastchild; | 1171 | return lastchild; |
1157 | } | 1172 | } |
1158 | 1173 | ||
1159 | QListViewItem *KListView::lastItem() const | 1174 | Q3ListViewItem *KListView::lastItem() const |
1160 | { | 1175 | { |
1161 | QListViewItem* last = lastChild(); | 1176 | Q3ListViewItem* last = lastChild(); |
1162 | 1177 | ||
1163 | for (QListViewItemIterator it (last); it.current(); ++it) | 1178 | for (Q3ListViewItemIterator it (last); it.current(); ++it) |
1164 | last = it.current(); | 1179 | last = it.current(); |
1165 | 1180 | ||
1166 | return last; | 1181 | return last; |
1167 | } | 1182 | } |
1168 | 1183 | ||
1169 | KLineEdit *KListView::renameLineEdit() const | 1184 | KLineEdit *KListView::renameLineEdit() const |
1170 | { | 1185 | { |
1171 | //US return d->editor; | 1186 | //US return d->editor; |
1172 | qDebug("KListView::renameLineEdit returns 0. Might crash"); | 1187 | qDebug("KListView::renameLineEdit returns 0. Might crash"); |
1173 | return 0; | 1188 | return 0; |
1174 | } | 1189 | } |
1175 | 1190 | ||
1176 | void KListView::startDrag() | 1191 | void KListView::startDrag() |
1177 | { | 1192 | { |
1178 | qDebug("KListView::startDrag drag&drop not supported yet."); | 1193 | qDebug("KListView::startDrag drag&drop not supported yet."); |
1179 | /*US | 1194 | /*US |
1180 | QDragObject *drag = dragObject(); | 1195 | QDragObject *drag = dragObject(); |
1181 | 1196 | ||
1182 | if (!drag) | 1197 | if (!drag) |
1183 | return; | 1198 | return; |
1184 | 1199 | ||
1185 | if (drag->drag() && drag->target() != viewport()) | 1200 | if (drag->drag() && drag->target() != viewport()) |
1186 | emit moved(); | 1201 | emit moved(); |
1187 | */ | 1202 | */ |
1188 | } | 1203 | } |
1189 | 1204 | ||
1190 | QDragObject *KListView::dragObject() | 1205 | Q3DragObject *KListView::dragObject() |
1191 | { | 1206 | { |
1192 | if (!currentItem()) | 1207 | if (!currentItem()) |
1193 | return 0; | 1208 | return 0; |
1194 | 1209 | ||
1195 | return new QStoredDrag("application/x-qlistviewitem", viewport()); | 1210 | return new Q3StoredDrag("application/x-qlistviewitem", viewport()); |
1196 | } | 1211 | } |
1197 | 1212 | ||
1198 | void KListView::setItemsMovable(bool b) | 1213 | void KListView::setItemsMovable(bool b) |
1199 | { | 1214 | { |
1200 | d->itemsMovable=b; | 1215 | d->itemsMovable=b; |
1201 | } | 1216 | } |
1202 | 1217 | ||
1203 | bool KListView::itemsMovable() const | 1218 | bool KListView::itemsMovable() const |
1204 | { | 1219 | { |
1205 | return d->itemsMovable; | 1220 | return d->itemsMovable; |
1206 | } | 1221 | } |
1207 | 1222 | ||
1208 | void KListView::setItemsRenameable(bool b) | 1223 | void KListView::setItemsRenameable(bool b) |
1209 | { | 1224 | { |
1210 | d->itemsRenameable=b; | 1225 | d->itemsRenameable=b; |
1211 | } | 1226 | } |
@@ -1233,45 +1248,45 @@ void KListView::setAutoOpen(bool b) | |||
1233 | 1248 | ||
1234 | bool KListView::autoOpen() const | 1249 | bool KListView::autoOpen() const |
1235 | { | 1250 | { |
1236 | return d->autoOpen; | 1251 | return d->autoOpen; |
1237 | } | 1252 | } |
1238 | 1253 | ||
1239 | bool KListView::dropVisualizer() const | 1254 | bool KListView::dropVisualizer() const |
1240 | { | 1255 | { |
1241 | return d->dropVisualizer; | 1256 | return d->dropVisualizer; |
1242 | } | 1257 | } |
1243 | 1258 | ||
1244 | void KListView::setDropVisualizer(bool b) | 1259 | void KListView::setDropVisualizer(bool b) |
1245 | { | 1260 | { |
1246 | d->dropVisualizer=b; | 1261 | d->dropVisualizer=b; |
1247 | } | 1262 | } |
1248 | 1263 | ||
1249 | QPtrList<QListViewItem> KListView::selectedItems() const | 1264 | Q3PtrList<Q3ListViewItem> KListView::selectedItems() const |
1250 | { | 1265 | { |
1251 | QPtrList<QListViewItem> list; | 1266 | Q3PtrList<Q3ListViewItem> list; |
1252 | for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) | 1267 | for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) |
1253 | if (i->isSelected()) list.append(i); | 1268 | if (i->isSelected()) list.append(i); |
1254 | return list; | 1269 | return list; |
1255 | } | 1270 | } |
1256 | 1271 | ||
1257 | 1272 | ||
1258 | void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) | 1273 | void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after) |
1259 | { | 1274 | { |
1260 | // sanity check - don't move a item into it's own child structure | 1275 | // sanity check - don't move a item into it's own child structure |
1261 | QListViewItem *i = parent; | 1276 | Q3ListViewItem *i = parent; |
1262 | while(i) | 1277 | while(i) |
1263 | { | 1278 | { |
1264 | if(i == item) | 1279 | if(i == item) |
1265 | return; | 1280 | return; |
1266 | i = i->parent(); | 1281 | i = i->parent(); |
1267 | } | 1282 | } |
1268 | 1283 | ||
1269 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor | 1284 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor |
1270 | // in here, without ever deleting the item. | 1285 | // in here, without ever deleting the item. |
1271 | if (item->parent()) | 1286 | if (item->parent()) |
1272 | item->parent()->takeItem(item); | 1287 | item->parent()->takeItem(item); |
1273 | else | 1288 | else |
1274 | takeItem(item); | 1289 | takeItem(item); |
1275 | 1290 | ||
1276 | if (parent) | 1291 | if (parent) |
1277 | parent->insertItem(item); | 1292 | parent->insertItem(item); |
@@ -1283,140 +1298,140 @@ void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewIt | |||
1283 | } | 1298 | } |
1284 | 1299 | ||
1285 | void KListView::contentsDragEnterEvent(QDragEnterEvent *event) | 1300 | void KListView::contentsDragEnterEvent(QDragEnterEvent *event) |
1286 | { | 1301 | { |
1287 | qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); | 1302 | qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); |
1288 | /*US | 1303 | /*US |
1289 | if (acceptDrag (event)) | 1304 | if (acceptDrag (event)) |
1290 | event->accept(); | 1305 | event->accept(); |
1291 | */ | 1306 | */ |
1292 | } | 1307 | } |
1293 | 1308 | ||
1294 | void KListView::setDropVisualizerWidth (int w) | 1309 | void KListView::setDropVisualizerWidth (int w) |
1295 | { | 1310 | { |
1296 | d->mDropVisualizerWidth = w > 0 ? w : 1; | 1311 | d->mDropVisualizerWidth = w > 0 ? w : 1; |
1297 | } | 1312 | } |
1298 | 1313 | ||
1299 | QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, | 1314 | QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent, |
1300 | QListViewItem *after) | 1315 | Q3ListViewItem *after) |
1301 | { | 1316 | { |
1302 | QRect insertmarker; | 1317 | QRect insertmarker; |
1303 | 1318 | ||
1304 | if (!after && !parent) | 1319 | if (!after && !parent) |
1305 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); | 1320 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); |
1306 | else | 1321 | else |
1307 | { | 1322 | { |
1308 | int level = 0; | 1323 | int level = 0; |
1309 | if (after) | 1324 | if (after) |
1310 | { | 1325 | { |
1311 | QListViewItem* it = 0L; | 1326 | Q3ListViewItem* it = 0L; |
1312 | if (after->isOpen()) | 1327 | if (after->isOpen()) |
1313 | { | 1328 | { |
1314 | // Look for the last child (recursively) | 1329 | // Look for the last child (recursively) |
1315 | it = after->firstChild(); | 1330 | it = after->firstChild(); |
1316 | if (it) | 1331 | if (it) |
1317 | while (it->nextSibling() || it->firstChild()) | 1332 | while (it->nextSibling() || it->firstChild()) |
1318 | if ( it->nextSibling() ) | 1333 | if ( it->nextSibling() ) |
1319 | it = it->nextSibling(); | 1334 | it = it->nextSibling(); |
1320 | else | 1335 | else |
1321 | it = it->firstChild(); | 1336 | it = it->firstChild(); |
1322 | } | 1337 | } |
1323 | 1338 | ||
1324 | insertmarker = itemRect (it ? it : after); | 1339 | insertmarker = itemRect (it ? it : after); |
1325 | level = after->depth(); | 1340 | level = after->depth(); |
1326 | } | 1341 | } |
1327 | else if (parent) | 1342 | else if (parent) |
1328 | { | 1343 | { |
1329 | insertmarker = itemRect (parent); | 1344 | insertmarker = itemRect (parent); |
1330 | level = parent->depth() + 1; | 1345 | level = parent->depth() + 1; |
1331 | } | 1346 | } |
1332 | insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); | 1347 | insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); |
1333 | insertmarker.setRight (viewport()->width()); | 1348 | insertmarker.setRight (viewport()->width()); |
1334 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); | 1349 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); |
1335 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); | 1350 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); |
1336 | } | 1351 | } |
1337 | 1352 | ||
1338 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) | 1353 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) |
1339 | // Remove for KDE 3.0. | 1354 | // Remove for KDE 3.0. |
1340 | if (p) | 1355 | if (p) |
1341 | p->fillRect(insertmarker, Dense4Pattern); | 1356 | p->fillRect(insertmarker, Qt::Dense4Pattern); |
1342 | 1357 | ||
1343 | return insertmarker; | 1358 | return insertmarker; |
1344 | } | 1359 | } |
1345 | 1360 | ||
1346 | QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) | 1361 | QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item) |
1347 | { | 1362 | { |
1348 | QRect r; | 1363 | QRect r; |
1349 | 1364 | ||
1350 | if (item) | 1365 | if (item) |
1351 | { | 1366 | { |
1352 | r = itemRect(item); | 1367 | r = itemRect(item); |
1353 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); | 1368 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); |
1354 | if (painter) { | 1369 | if (painter) { |
1355 | //US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), | 1370 | //US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), |
1356 | //US QStyle::Style_FocusAtBorder, colorGroup().highlight()); | 1371 | //US QStyle::Style_FocusAtBorder, colorGroup().highlight()); |
1357 | const QColor* pHighl = &(colorGroup().highlight()); | 1372 | const QColor* pHighl = &(colorGroup().highlight()); |
1358 | //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); | 1373 | //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); |
1359 | 1374 | ||
1360 | qDebug("KListView::drawItemHighlighter has to be verified"); | 1375 | qDebug("KListView::drawItemHighlighter has to be verified"); |
1361 | 1376 | ||
1362 | } | 1377 | } |
1363 | 1378 | ||
1364 | } | 1379 | } |
1365 | 1380 | ||
1366 | return r; | 1381 | return r; |
1367 | } | 1382 | } |
1368 | 1383 | ||
1369 | void KListView::cleanItemHighlighter () | 1384 | void KListView::cleanItemHighlighter () |
1370 | { | 1385 | { |
1371 | if (d->mOldDropHighlighter.isValid()) | 1386 | if (d->mOldDropHighlighter.isValid()) |
1372 | { | 1387 | { |
1373 | QRect rect=d->mOldDropHighlighter; | 1388 | QRect rect=d->mOldDropHighlighter; |
1374 | d->mOldDropHighlighter = QRect(); | 1389 | d->mOldDropHighlighter = QRect(); |
1375 | viewport()->repaint(rect, true); | 1390 | viewport()->repaint(rect, true); |
1376 | } | 1391 | } |
1377 | } | 1392 | } |
1378 | 1393 | ||
1379 | void KListView::rename(QListViewItem *item, int c) | 1394 | void KListView::rename(Q3ListViewItem *item, int c) |
1380 | { | 1395 | { |
1381 | if (d->renameable.contains(c)) | 1396 | if (d->renameable.contains(c)) |
1382 | { | 1397 | { |
1383 | ensureItemVisible(item); | 1398 | ensureItemVisible(item); |
1384 | //US d->editor->load(item,c); | 1399 | //US d->editor->load(item,c); |
1385 | qDebug("KListView::rename has to be verified"); | 1400 | qDebug("KListView::rename has to be verified"); |
1386 | 1401 | ||
1387 | } | 1402 | } |
1388 | } | 1403 | } |
1389 | 1404 | ||
1390 | bool KListView::isRenameable (int col) const | 1405 | bool KListView::isRenameable (int col) const |
1391 | { | 1406 | { |
1392 | return d->renameable.contains(col); | 1407 | return d->renameable.contains(col); |
1393 | } | 1408 | } |
1394 | 1409 | ||
1395 | void KListView::setRenameable (int col, bool yesno) | 1410 | void KListView::setRenameable (int col, bool yesno) |
1396 | { | 1411 | { |
1397 | if (col>=header()->count()) return; | 1412 | if (col>=header()->count()) return; |
1398 | 1413 | ||
1399 | d->renameable.remove(col); | 1414 | d->renameable.remove(col); |
1400 | if (yesno && d->renameable.find(col)==d->renameable.end()) | 1415 | if (yesno && d->renameable.find(col)==d->renameable.end()) |
1401 | d->renameable+=col; | 1416 | d->renameable+=col; |
1402 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) | 1417 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) |
1403 | d->renameable.remove(col); | 1418 | d->renameable.remove(col); |
1404 | } | 1419 | } |
1405 | 1420 | ||
1406 | void KListView::doneEditing(QListViewItem *item, int row) | 1421 | void KListView::doneEditing(Q3ListViewItem *item, int row) |
1407 | { | 1422 | { |
1408 | emit itemRenamed(item, item->text(row), row); | 1423 | emit itemRenamed(item, item->text(row), row); |
1409 | emit itemRenamed(item); | 1424 | emit itemRenamed(item); |
1410 | } | 1425 | } |
1411 | 1426 | ||
1412 | bool KListView::acceptDrag(QDropEvent* e) const | 1427 | bool KListView::acceptDrag(QDropEvent* e) const |
1413 | { | 1428 | { |
1414 | qDebug("KListView::acceptDrag drag&drop not supported yet"); | 1429 | qDebug("KListView::acceptDrag drag&drop not supported yet"); |
1415 | //US return acceptDrops() && itemsMovable() && (e->source()==viewport()); | 1430 | //US return acceptDrops() && itemsMovable() && (e->source()==viewport()); |
1416 | return false; | 1431 | return false; |
1417 | } | 1432 | } |
1418 | 1433 | ||
1419 | void KListView::setCreateChildren(bool b) | 1434 | void KListView::setCreateChildren(bool b) |
1420 | { | 1435 | { |
1421 | d->createChildren=b; | 1436 | d->createChildren=b; |
1422 | } | 1437 | } |
@@ -1434,219 +1449,219 @@ int KListView::tooltipColumn() const | |||
1434 | 1449 | ||
1435 | void KListView::setTooltipColumn(int column) | 1450 | void KListView::setTooltipColumn(int column) |
1436 | { | 1451 | { |
1437 | d->tooltipColumn=column; | 1452 | d->tooltipColumn=column; |
1438 | } | 1453 | } |
1439 | 1454 | ||
1440 | void KListView::setDropHighlighter(bool b) | 1455 | void KListView::setDropHighlighter(bool b) |
1441 | { | 1456 | { |
1442 | d->dropHighlighter=b; | 1457 | d->dropHighlighter=b; |
1443 | } | 1458 | } |
1444 | 1459 | ||
1445 | bool KListView::dropHighlighter() const | 1460 | bool KListView::dropHighlighter() const |
1446 | { | 1461 | { |
1447 | return d->dropHighlighter; | 1462 | return d->dropHighlighter; |
1448 | } | 1463 | } |
1449 | 1464 | ||
1450 | bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const | 1465 | bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const |
1451 | { | 1466 | { |
1452 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); | 1467 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); |
1453 | } | 1468 | } |
1454 | 1469 | ||
1455 | QString KListView::tooltip(QListViewItem *item, int column) const | 1470 | QString KListView::tooltip(Q3ListViewItem *item, int column) const |
1456 | { | 1471 | { |
1457 | return item->text(column); | 1472 | return item->text(column); |
1458 | } | 1473 | } |
1459 | 1474 | ||
1460 | void KListView::setTabOrderedRenaming(bool b) | 1475 | void KListView::setTabOrderedRenaming(bool b) |
1461 | { | 1476 | { |
1462 | d->tabRename = b; | 1477 | d->tabRename = b; |
1463 | } | 1478 | } |
1464 | 1479 | ||
1465 | bool KListView::tabOrderedRenaming() const | 1480 | bool KListView::tabOrderedRenaming() const |
1466 | { | 1481 | { |
1467 | return d->tabRename; | 1482 | return d->tabRename; |
1468 | } | 1483 | } |
1469 | 1484 | ||
1470 | void KListView::keyPressEvent (QKeyEvent* e) | 1485 | void KListView::keyPressEvent (QKeyEvent* e) |
1471 | { | 1486 | { |
1472 | //don't we need a contextMenuModifier too ? (aleXXX) | 1487 | //don't we need a contextMenuModifier too ? (aleXXX) |
1473 | if (e->key() == d->contextMenuKey) | 1488 | if (e->key() == d->contextMenuKey) |
1474 | { | 1489 | { |
1475 | emit menuShortCutPressed (this, currentItem()); | 1490 | emit menuShortCutPressed (this, currentItem()); |
1476 | return; | 1491 | return; |
1477 | } | 1492 | } |
1478 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) | 1493 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) |
1479 | { | 1494 | { |
1480 | emit signalDelete ( ); | 1495 | emit signalDelete ( ); |
1481 | return; | 1496 | return; |
1482 | } | 1497 | } |
1483 | 1498 | ||
1484 | if (d->selectionMode != FileManager) | 1499 | if (d->selectionMode != FileManager) |
1485 | QListView::keyPressEvent (e); | 1500 | Q3ListView::keyPressEvent (e); |
1486 | else | 1501 | else |
1487 | fileManagerKeyPressEvent (e); | 1502 | fileManagerKeyPressEvent (e); |
1488 | } | 1503 | } |
1489 | 1504 | ||
1490 | void KListView::activateAutomaticSelection() | 1505 | void KListView::activateAutomaticSelection() |
1491 | { | 1506 | { |
1492 | d->selectedBySimpleMove=true; | 1507 | d->selectedBySimpleMove=true; |
1493 | d->selectedUsingMouse=false; | 1508 | d->selectedUsingMouse=false; |
1494 | if (currentItem()!=0) | 1509 | if (currentItem()!=0) |
1495 | { | 1510 | { |
1496 | selectAll(false); | 1511 | selectAll(false); |
1497 | currentItem()->setSelected(true); | 1512 | currentItem()->setSelected(true); |
1498 | currentItem()->repaint(); | 1513 | currentItem()->repaint(); |
1499 | emit selectionChanged(); | 1514 | emit selectionChanged(); |
1500 | }; | 1515 | }; |
1501 | } | 1516 | } |
1502 | 1517 | ||
1503 | void KListView::deactivateAutomaticSelection() | 1518 | void KListView::deactivateAutomaticSelection() |
1504 | { | 1519 | { |
1505 | d->selectedBySimpleMove=false; | 1520 | d->selectedBySimpleMove=false; |
1506 | } | 1521 | } |
1507 | 1522 | ||
1508 | bool KListView::automaticSelection() const | 1523 | bool KListView::automaticSelection() const |
1509 | { | 1524 | { |
1510 | return d->selectedBySimpleMove; | 1525 | return d->selectedBySimpleMove; |
1511 | } | 1526 | } |
1512 | 1527 | ||
1513 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | 1528 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) |
1514 | { | 1529 | { |
1515 | //don't care whether it's on the keypad or not | 1530 | //don't care whether it's on the keypad or not |
1516 | int e_state=(e->state() & ~Keypad); | 1531 | int e_state=(e->state() & ~Qt::Keypad); |
1517 | 1532 | ||
1518 | int oldSelectionDirection(d->selectionDirection); | 1533 | int oldSelectionDirection(d->selectionDirection); |
1519 | 1534 | ||
1520 | if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1535 | if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) |
1521 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) | 1536 | && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)) |
1522 | { | 1537 | { |
1523 | if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) | 1538 | if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) |
1524 | selectAll(FALSE); | 1539 | selectAll(FALSE); |
1525 | d->selectionDirection=0; | 1540 | d->selectionDirection=0; |
1526 | d->wasShiftEvent = (e_state == ShiftButton); | 1541 | d->wasShiftEvent = (e_state == Qt::ShiftButton); |
1527 | }; | 1542 | }; |
1528 | 1543 | ||
1529 | //d->wasShiftEvent = (e_state == ShiftButton); | 1544 | //d->wasShiftEvent = (e_state == Qt::ShiftButton); |
1530 | 1545 | ||
1531 | 1546 | ||
1532 | QListViewItem* item = currentItem(); | 1547 | Q3ListViewItem* item = currentItem(); |
1533 | if (item==0) return; | 1548 | if (item==0) return; |
1534 | 1549 | ||
1535 | QListViewItem* repaintItem1 = item; | 1550 | Q3ListViewItem* repaintItem1 = item; |
1536 | QListViewItem* repaintItem2 = 0L; | 1551 | Q3ListViewItem* repaintItem2 = 0L; |
1537 | QListViewItem* visItem = 0L; | 1552 | Q3ListViewItem* visItem = 0L; |
1538 | 1553 | ||
1539 | QListViewItem* nextItem = 0L; | 1554 | Q3ListViewItem* nextItem = 0L; |
1540 | int items = 0; | 1555 | int items = 0; |
1541 | 1556 | ||
1542 | bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); | 1557 | bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton)); |
1543 | int selectedItems(0); | 1558 | int selectedItems(0); |
1544 | for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) | 1559 | for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) |
1545 | if (tmpItem->isSelected()) selectedItems++; | 1560 | if (tmpItem->isSelected()) selectedItems++; |
1546 | 1561 | ||
1547 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) | 1562 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) |
1548 | && (e_state==NoButton) | 1563 | && (e_state==Qt::NoButton) |
1549 | && ((e->key()==Key_Down) | 1564 | && ((e->key()==Qt::Key_Down) |
1550 | || (e->key()==Key_Up) | 1565 | || (e->key()==Qt::Key_Up) |
1551 | || (e->key()==Key_Next) | 1566 | || (e->key()==Qt::Key_Next) |
1552 | || (e->key()==Key_Prior) | 1567 | || (e->key()==Qt::Key_Prior) |
1553 | || (e->key()==Key_Home) | 1568 | || (e->key()==Qt::Key_Home) |
1554 | || (e->key()==Key_End))) | 1569 | || (e->key()==Qt::Key_End))) |
1555 | { | 1570 | { |
1556 | d->selectedBySimpleMove=true; | 1571 | d->selectedBySimpleMove=true; |
1557 | d->selectedUsingMouse=false; | 1572 | d->selectedUsingMouse=false; |
1558 | } | 1573 | } |
1559 | else if (selectedItems>1) | 1574 | else if (selectedItems>1) |
1560 | d->selectedBySimpleMove=false; | 1575 | d->selectedBySimpleMove=false; |
1561 | 1576 | ||
1562 | bool emitSelectionChanged(false); | 1577 | bool emitSelectionChanged(false); |
1563 | 1578 | ||
1564 | switch (e->key()) | 1579 | switch (e->key()) |
1565 | { | 1580 | { |
1566 | case Key_Escape: | 1581 | case Qt::Key_Escape: |
1567 | selectAll(FALSE); | 1582 | selectAll(FALSE); |
1568 | emitSelectionChanged=TRUE; | 1583 | emitSelectionChanged=TRUE; |
1569 | break; | 1584 | break; |
1570 | 1585 | ||
1571 | case Key_Space: | 1586 | case Qt::Key_Space: |
1572 | //toggle selection of current item | 1587 | //toggle selection of current item |
1573 | if (d->selectedBySimpleMove) | 1588 | if (d->selectedBySimpleMove) |
1574 | d->selectedBySimpleMove=false; | 1589 | d->selectedBySimpleMove=false; |
1575 | item->setSelected(!item->isSelected()); | 1590 | item->setSelected(!item->isSelected()); |
1576 | emitSelectionChanged=TRUE; | 1591 | emitSelectionChanged=TRUE; |
1577 | break; | 1592 | break; |
1578 | 1593 | ||
1579 | case Key_Insert: | 1594 | case Qt::Key_Insert: |
1580 | //toggle selection of current item and move to the next item | 1595 | //toggle selection of current item and move to the next item |
1581 | if (d->selectedBySimpleMove) | 1596 | if (d->selectedBySimpleMove) |
1582 | { | 1597 | { |
1583 | d->selectedBySimpleMove=false; | 1598 | d->selectedBySimpleMove=false; |
1584 | if (!item->isSelected()) item->setSelected(TRUE); | 1599 | if (!item->isSelected()) item->setSelected(TRUE); |
1585 | } | 1600 | } |
1586 | else | 1601 | else |
1587 | { | 1602 | { |
1588 | item->setSelected(!item->isSelected()); | 1603 | item->setSelected(!item->isSelected()); |
1589 | }; | 1604 | }; |
1590 | 1605 | ||
1591 | nextItem=item->itemBelow(); | 1606 | nextItem=item->itemBelow(); |
1592 | 1607 | ||
1593 | if (nextItem!=0) | 1608 | if (nextItem!=0) |
1594 | { | 1609 | { |
1595 | repaintItem2=nextItem; | 1610 | repaintItem2=nextItem; |
1596 | visItem=nextItem; | 1611 | visItem=nextItem; |
1597 | setCurrentItem(nextItem); | 1612 | setCurrentItem(nextItem); |
1598 | }; | 1613 | }; |
1599 | d->selectionDirection=1; | 1614 | d->selectionDirection=1; |
1600 | emitSelectionChanged=TRUE; | 1615 | emitSelectionChanged=TRUE; |
1601 | break; | 1616 | break; |
1602 | 1617 | ||
1603 | case Key_Down: | 1618 | case Qt::Key_Down: |
1604 | nextItem=item->itemBelow(); | 1619 | nextItem=item->itemBelow(); |
1605 | //toggle selection of current item and move to the next item | 1620 | //toggle selection of current item and move to the next item |
1606 | if (shiftOrCtrl) | 1621 | if (shiftOrCtrl) |
1607 | { | 1622 | { |
1608 | d->selectionDirection=1; | 1623 | d->selectionDirection=1; |
1609 | if (d->selectedBySimpleMove) | 1624 | if (d->selectedBySimpleMove) |
1610 | d->selectedBySimpleMove=false; | 1625 | d->selectedBySimpleMove=false; |
1611 | else | 1626 | else |
1612 | { | 1627 | { |
1613 | if (oldSelectionDirection!=-1) | 1628 | if (oldSelectionDirection!=-1) |
1614 | { | 1629 | { |
1615 | item->setSelected(!item->isSelected()); | 1630 | item->setSelected(!item->isSelected()); |
1616 | emitSelectionChanged=TRUE; | 1631 | emitSelectionChanged=TRUE; |
1617 | }; | 1632 | }; |
1618 | }; | 1633 | }; |
1619 | } | 1634 | } |
1620 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) | 1635 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) |
1621 | { | 1636 | { |
1622 | item->setSelected(false); | 1637 | item->setSelected(false); |
1623 | emitSelectionChanged=TRUE; | 1638 | emitSelectionChanged=TRUE; |
1624 | }; | 1639 | }; |
1625 | 1640 | ||
1626 | if (nextItem!=0) | 1641 | if (nextItem!=0) |
1627 | { | 1642 | { |
1628 | if (d->selectedBySimpleMove) | 1643 | if (d->selectedBySimpleMove) |
1629 | nextItem->setSelected(true); | 1644 | nextItem->setSelected(true); |
1630 | repaintItem2=nextItem; | 1645 | repaintItem2=nextItem; |
1631 | visItem=nextItem; | 1646 | visItem=nextItem; |
1632 | setCurrentItem(nextItem); | 1647 | setCurrentItem(nextItem); |
1633 | }; | 1648 | }; |
1634 | break; | 1649 | break; |
1635 | 1650 | ||
1636 | case Key_Up: | 1651 | case Qt::Key_Up: |
1637 | nextItem=item->itemAbove(); | 1652 | nextItem=item->itemAbove(); |
1638 | d->selectionDirection=-1; | 1653 | d->selectionDirection=-1; |
1639 | //move to the prev. item and toggle selection of this one | 1654 | //move to the prev. item and toggle selection of this one |
1640 | // => No, can't select the last item, with this. For symmetry, let's | 1655 | // => No, can't select the last item, with this. For symmetry, let's |
1641 | // toggle selection and THEN move up, just like we do in down (David) | 1656 | // toggle selection and THEN move up, just like we do in down (David) |
1642 | if (shiftOrCtrl) | 1657 | if (shiftOrCtrl) |
1643 | { | 1658 | { |
1644 | if (d->selectedBySimpleMove) | 1659 | if (d->selectedBySimpleMove) |
1645 | d->selectedBySimpleMove=false; | 1660 | d->selectedBySimpleMove=false; |
1646 | else | 1661 | else |
1647 | { | 1662 | { |
1648 | if (oldSelectionDirection!=1) | 1663 | if (oldSelectionDirection!=1) |
1649 | { | 1664 | { |
1650 | item->setSelected(!item->isSelected()); | 1665 | item->setSelected(!item->isSelected()); |
1651 | emitSelectionChanged=TRUE; | 1666 | emitSelectionChanged=TRUE; |
1652 | }; | 1667 | }; |
@@ -1655,80 +1670,80 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1655 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) | 1670 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) |
1656 | { | 1671 | { |
1657 | item->setSelected(false); | 1672 | item->setSelected(false); |
1658 | emitSelectionChanged=TRUE; | 1673 | emitSelectionChanged=TRUE; |
1659 | }; | 1674 | }; |
1660 | 1675 | ||
1661 | if (nextItem!=0) | 1676 | if (nextItem!=0) |
1662 | { | 1677 | { |
1663 | if (d->selectedBySimpleMove) | 1678 | if (d->selectedBySimpleMove) |
1664 | nextItem->setSelected(true); | 1679 | nextItem->setSelected(true); |
1665 | repaintItem2=nextItem; | 1680 | repaintItem2=nextItem; |
1666 | visItem=nextItem; | 1681 | visItem=nextItem; |
1667 | setCurrentItem(nextItem); | 1682 | setCurrentItem(nextItem); |
1668 | }; | 1683 | }; |
1669 | break; | 1684 | break; |
1670 | 1685 | ||
1671 | case Key_End: | 1686 | case Qt::Key_End: |
1672 | //move to the last item and toggle selection of all items inbetween | 1687 | //move to the last item and toggle selection of all items inbetween |
1673 | nextItem=item; | 1688 | nextItem=item; |
1674 | if (d->selectedBySimpleMove) | 1689 | if (d->selectedBySimpleMove) |
1675 | item->setSelected(false); | 1690 | item->setSelected(false); |
1676 | if (shiftOrCtrl) | 1691 | if (shiftOrCtrl) |
1677 | d->selectedBySimpleMove=false; | 1692 | d->selectedBySimpleMove=false; |
1678 | 1693 | ||
1679 | while(nextItem!=0) | 1694 | while(nextItem!=0) |
1680 | { | 1695 | { |
1681 | if (shiftOrCtrl) | 1696 | if (shiftOrCtrl) |
1682 | nextItem->setSelected(!nextItem->isSelected()); | 1697 | nextItem->setSelected(!nextItem->isSelected()); |
1683 | if (nextItem->itemBelow()==0) | 1698 | if (nextItem->itemBelow()==0) |
1684 | { | 1699 | { |
1685 | if (d->selectedBySimpleMove) | 1700 | if (d->selectedBySimpleMove) |
1686 | nextItem->setSelected(true); | 1701 | nextItem->setSelected(true); |
1687 | repaintItem2=nextItem; | 1702 | repaintItem2=nextItem; |
1688 | visItem=nextItem; | 1703 | visItem=nextItem; |
1689 | setCurrentItem(nextItem); | 1704 | setCurrentItem(nextItem); |
1690 | } | 1705 | } |
1691 | nextItem=nextItem->itemBelow(); | 1706 | nextItem=nextItem->itemBelow(); |
1692 | } | 1707 | } |
1693 | emitSelectionChanged=TRUE; | 1708 | emitSelectionChanged=TRUE; |
1694 | break; | 1709 | break; |
1695 | 1710 | ||
1696 | case Key_Home: | 1711 | case Qt::Key_Home: |
1697 | // move to the first item and toggle selection of all items inbetween | 1712 | // move to the first item and toggle selection of all items inbetween |
1698 | nextItem = firstChild(); | 1713 | nextItem = firstChild(); |
1699 | visItem = nextItem; | 1714 | visItem = nextItem; |
1700 | repaintItem2 = visItem; | 1715 | repaintItem2 = visItem; |
1701 | if (d->selectedBySimpleMove) | 1716 | if (d->selectedBySimpleMove) |
1702 | item->setSelected(false); | 1717 | item->setSelected(false); |
1703 | if (shiftOrCtrl) | 1718 | if (shiftOrCtrl) |
1704 | { | 1719 | { |
1705 | d->selectedBySimpleMove=false; | 1720 | d->selectedBySimpleMove=false; |
1706 | 1721 | ||
1707 | while ( nextItem != item ) | 1722 | while ( nextItem != item ) |
1708 | { | 1723 | { |
1709 | nextItem->setSelected( !nextItem->isSelected() ); | 1724 | nextItem->setSelected( !nextItem->isSelected() ); |
1710 | nextItem = nextItem->itemBelow(); | 1725 | nextItem = nextItem->itemBelow(); |
1711 | } | 1726 | } |
1712 | item->setSelected( !item->isSelected() ); | 1727 | item->setSelected( !item->isSelected() ); |
1713 | } | 1728 | } |
1714 | setCurrentItem( firstChild() ); | 1729 | setCurrentItem( firstChild() ); |
1715 | emitSelectionChanged=TRUE; | 1730 | emitSelectionChanged=TRUE; |
1716 | break; | 1731 | break; |
1717 | 1732 | ||
1718 | case Key_Next: | 1733 | case Qt::Key_Next: |
1719 | items=visibleHeight()/item->height(); | 1734 | items=visibleHeight()/item->height(); |
1720 | nextItem=item; | 1735 | nextItem=item; |
1721 | if (d->selectedBySimpleMove) | 1736 | if (d->selectedBySimpleMove) |
1722 | item->setSelected(false); | 1737 | item->setSelected(false); |
1723 | if (shiftOrCtrl) | 1738 | if (shiftOrCtrl) |
1724 | { | 1739 | { |
1725 | d->selectedBySimpleMove=false; | 1740 | d->selectedBySimpleMove=false; |
1726 | d->selectionDirection=1; | 1741 | d->selectionDirection=1; |
1727 | }; | 1742 | }; |
1728 | 1743 | ||
1729 | for (int i=0; i<items; i++) | 1744 | for (int i=0; i<items; i++) |
1730 | { | 1745 | { |
1731 | if (shiftOrCtrl) | 1746 | if (shiftOrCtrl) |
1732 | nextItem->setSelected(!nextItem->isSelected()); | 1747 | nextItem->setSelected(!nextItem->isSelected()); |
1733 | //the end | 1748 | //the end |
1734 | if ((i==items-1) || (nextItem->itemBelow()==0)) | 1749 | if ((i==items-1) || (nextItem->itemBelow()==0)) |
@@ -1738,33 +1753,33 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1738 | nextItem->setSelected(!nextItem->isSelected()); | 1753 | nextItem->setSelected(!nextItem->isSelected()); |
1739 | if (d->selectedBySimpleMove) | 1754 | if (d->selectedBySimpleMove) |
1740 | nextItem->setSelected(true); | 1755 | nextItem->setSelected(true); |
1741 | ensureItemVisible(nextItem); | 1756 | ensureItemVisible(nextItem); |
1742 | setCurrentItem(nextItem); | 1757 | setCurrentItem(nextItem); |
1743 | update(); | 1758 | update(); |
1744 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1759 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1745 | { | 1760 | { |
1746 | emit selectionChanged(); | 1761 | emit selectionChanged(); |
1747 | } | 1762 | } |
1748 | return; | 1763 | return; |
1749 | } | 1764 | } |
1750 | nextItem=nextItem->itemBelow(); | 1765 | nextItem=nextItem->itemBelow(); |
1751 | } | 1766 | } |
1752 | break; | 1767 | break; |
1753 | 1768 | ||
1754 | case Key_Prior: | 1769 | case Qt::Key_Prior: |
1755 | items=visibleHeight()/item->height(); | 1770 | items=visibleHeight()/item->height(); |
1756 | nextItem=item; | 1771 | nextItem=item; |
1757 | if (d->selectedBySimpleMove) | 1772 | if (d->selectedBySimpleMove) |
1758 | item->setSelected(false); | 1773 | item->setSelected(false); |
1759 | if (shiftOrCtrl) | 1774 | if (shiftOrCtrl) |
1760 | { | 1775 | { |
1761 | d->selectionDirection=-1; | 1776 | d->selectionDirection=-1; |
1762 | d->selectedBySimpleMove=false; | 1777 | d->selectedBySimpleMove=false; |
1763 | }; | 1778 | }; |
1764 | 1779 | ||
1765 | for (int i=0; i<items; i++) | 1780 | for (int i=0; i<items; i++) |
1766 | { | 1781 | { |
1767 | if ((nextItem!=item) &&(shiftOrCtrl)) | 1782 | if ((nextItem!=item) &&(shiftOrCtrl)) |
1768 | nextItem->setSelected(!nextItem->isSelected()); | 1783 | nextItem->setSelected(!nextItem->isSelected()); |
1769 | //the end | 1784 | //the end |
1770 | if ((i==items-1) || (nextItem->itemAbove()==0)) | 1785 | if ((i==items-1) || (nextItem->itemAbove()==0)) |
@@ -1772,51 +1787,51 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1772 | { | 1787 | { |
1773 | if (d->selectedBySimpleMove) | 1788 | if (d->selectedBySimpleMove) |
1774 | nextItem->setSelected(true); | 1789 | nextItem->setSelected(true); |
1775 | ensureItemVisible(nextItem); | 1790 | ensureItemVisible(nextItem); |
1776 | setCurrentItem(nextItem); | 1791 | setCurrentItem(nextItem); |
1777 | update(); | 1792 | update(); |
1778 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1793 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1779 | { | 1794 | { |
1780 | emit selectionChanged(); | 1795 | emit selectionChanged(); |
1781 | } | 1796 | } |
1782 | return; | 1797 | return; |
1783 | } | 1798 | } |
1784 | nextItem=nextItem->itemAbove(); | 1799 | nextItem=nextItem->itemAbove(); |
1785 | } | 1800 | } |
1786 | break; | 1801 | break; |
1787 | 1802 | ||
1788 | case Key_Minus: | 1803 | case Qt::Key_Minus: |
1789 | if ( item->isOpen() ) | 1804 | if ( item->isOpen() ) |
1790 | setOpen( item, FALSE ); | 1805 | setOpen( item, FALSE ); |
1791 | break; | 1806 | break; |
1792 | case Key_Plus: | 1807 | case Qt::Key_Plus: |
1793 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1808 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1794 | setOpen( item, TRUE ); | 1809 | setOpen( item, TRUE ); |
1795 | break; | 1810 | break; |
1796 | default: | 1811 | default: |
1797 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1812 | bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) |
1798 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1813 | && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)); |
1799 | 1814 | ||
1800 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1815 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1801 | if (realKey && selectCurrentItem) | 1816 | if (realKey && selectCurrentItem) |
1802 | item->setSelected(false); | 1817 | item->setSelected(false); |
1803 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1818 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1804 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1819 | Q3ListView::SelectionMode oldSelectionMode = selectionMode(); |
1805 | setSelectionMode (QListView::Multi); | 1820 | setSelectionMode (Q3ListView::Multi); |
1806 | QListView::keyPressEvent (e); | 1821 | Q3ListView::keyPressEvent (e); |
1807 | setSelectionMode (oldSelectionMode); | 1822 | setSelectionMode (oldSelectionMode); |
1808 | if (realKey && selectCurrentItem) | 1823 | if (realKey && selectCurrentItem) |
1809 | { | 1824 | { |
1810 | currentItem()->setSelected(true); | 1825 | currentItem()->setSelected(true); |
1811 | emitSelectionChanged=TRUE; | 1826 | emitSelectionChanged=TRUE; |
1812 | } | 1827 | } |
1813 | repaintItem2=currentItem(); | 1828 | repaintItem2=currentItem(); |
1814 | if (realKey) | 1829 | if (realKey) |
1815 | visItem=currentItem(); | 1830 | visItem=currentItem(); |
1816 | break; | 1831 | break; |
1817 | } | 1832 | } |
1818 | 1833 | ||
1819 | if (visItem) | 1834 | if (visItem) |
1820 | ensureItemVisible(visItem); | 1835 | ensureItemVisible(visItem); |
1821 | 1836 | ||
1822 | QRect ir; | 1837 | QRect ir; |
@@ -1837,135 +1852,135 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1837 | repaintItem2->repaint();*/ | 1852 | repaintItem2->repaint();*/ |
1838 | update(); | 1853 | update(); |
1839 | if (emitSelectionChanged) | 1854 | if (emitSelectionChanged) |
1840 | emit selectionChanged(); | 1855 | emit selectionChanged(); |
1841 | } | 1856 | } |
1842 | 1857 | ||
1843 | void KListView::setSelectionModeExt (SelectionModeExt mode) | 1858 | void KListView::setSelectionModeExt (SelectionModeExt mode) |
1844 | { | 1859 | { |
1845 | d->selectionMode = mode; | 1860 | d->selectionMode = mode; |
1846 | 1861 | ||
1847 | switch (mode) | 1862 | switch (mode) |
1848 | { | 1863 | { |
1849 | case Single: | 1864 | case Single: |
1850 | case Multi: | 1865 | case Multi: |
1851 | case Extended: | 1866 | case Extended: |
1852 | case NoSelection: | 1867 | case NoSelection: |
1853 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1868 | setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode))); |
1854 | break; | 1869 | break; |
1855 | 1870 | ||
1856 | case FileManager: | 1871 | case FileManager: |
1857 | setSelectionMode (QListView::Extended); | 1872 | setSelectionMode (Q3ListView::Extended); |
1858 | break; | 1873 | break; |
1859 | 1874 | ||
1860 | default: | 1875 | default: |
1861 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1876 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1862 | break; | 1877 | break; |
1863 | } | 1878 | } |
1864 | } | 1879 | } |
1865 | 1880 | ||
1866 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1881 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1867 | { | 1882 | { |
1868 | return d->selectionMode; | 1883 | return d->selectionMode; |
1869 | } | 1884 | } |
1870 | 1885 | ||
1871 | int KListView::itemIndex( const QListViewItem *item ) const | 1886 | int KListView::itemIndex( const Q3ListViewItem *item ) const |
1872 | { | 1887 | { |
1873 | if ( !item ) | 1888 | if ( !item ) |
1874 | return -1; | 1889 | return -1; |
1875 | 1890 | ||
1876 | if ( item == firstChild() ) | 1891 | if ( item == firstChild() ) |
1877 | return 0; | 1892 | return 0; |
1878 | else { | 1893 | else { |
1879 | QListViewItemIterator it(firstChild()); | 1894 | Q3ListViewItemIterator it(firstChild()); |
1880 | uint j = 0; | 1895 | uint j = 0; |
1881 | for (; it.current() && it.current() != item; ++it, ++j ); | 1896 | for (; it.current() && it.current() != item; ++it, ++j ); |
1882 | 1897 | ||
1883 | if( !it.current() ) | 1898 | if( !it.current() ) |
1884 | return -1; | 1899 | return -1; |
1885 | 1900 | ||
1886 | return j; | 1901 | return j; |
1887 | } | 1902 | } |
1888 | } | 1903 | } |
1889 | 1904 | ||
1890 | QListViewItem* KListView::itemAtIndex(int index) | 1905 | Q3ListViewItem* KListView::itemAtIndex(int index) |
1891 | { | 1906 | { |
1892 | if (index<0) | 1907 | if (index<0) |
1893 | return 0; | 1908 | return 0; |
1894 | 1909 | ||
1895 | int j(0); | 1910 | int j(0); |
1896 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1911 | for (Q3ListViewItemIterator it=firstChild(); it.current(); it++) |
1897 | { | 1912 | { |
1898 | if (j==index) | 1913 | if (j==index) |
1899 | return it.current(); | 1914 | return it.current(); |
1900 | j++; | 1915 | j++; |
1901 | }; | 1916 | }; |
1902 | return 0; | 1917 | return 0; |
1903 | } | 1918 | } |
1904 | 1919 | ||
1905 | 1920 | ||
1906 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1921 | void KListView::emitContextMenu (KListView*, Q3ListViewItem* i) |
1907 | { | 1922 | { |
1908 | QPoint p; | 1923 | QPoint p; |
1909 | // qDebug("KListView::emitContextMenu "); | 1924 | // qDebug("KListView::emitContextMenu "); |
1910 | 1925 | ||
1911 | if (i) | 1926 | if (i) |
1912 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1927 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1913 | else | 1928 | else |
1914 | p = mapToGlobal(rect().center()); | 1929 | p = mapToGlobal(rect().center()); |
1915 | 1930 | ||
1916 | emit contextMenu (this, i, p); | 1931 | emit contextMenu (this, i, p); |
1917 | } | 1932 | } |
1918 | 1933 | ||
1919 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) | 1934 | void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col) |
1920 | { | 1935 | { |
1921 | QListViewItem* item = i; | 1936 | Q3ListViewItem* item = i; |
1922 | int c = col; | 1937 | int c = col; |
1923 | // do not trust the values for QListViewItem* i and int col; | 1938 | // do not trust the values for QListViewItem* i and int col; |
1924 | // qDebug("KListView::emitContextMenu col"); | 1939 | // qDebug("KListView::emitContextMenu col"); |
1925 | if ( col == -1 ) { | 1940 | if ( col == -1 ) { |
1926 | QPoint pp = viewport()->mapFromGlobal(p); | 1941 | QPoint pp = viewport()->mapFromGlobal(p); |
1927 | item = itemAt( pp); | 1942 | item = itemAt( pp); |
1928 | c = header()->sectionAt(pp.x() ); | 1943 | c = header()->sectionAt(pp.x() ); |
1929 | } | 1944 | } |
1930 | emit contextRequest( item, p, c ); | 1945 | emit contextRequest( item, p, c ); |
1931 | emit contextMenu (this, item, p); | 1946 | emit contextMenu (this, item, p); |
1932 | } | 1947 | } |
1933 | 1948 | ||
1934 | void KListView::setAcceptDrops (bool val) | 1949 | void KListView::setAcceptDrops (bool val) |
1935 | { | 1950 | { |
1936 | QListView::setAcceptDrops (val); | 1951 | Q3ListView::setAcceptDrops (val); |
1937 | viewport()->setAcceptDrops (val); | 1952 | viewport()->setAcceptDrops (val); |
1938 | } | 1953 | } |
1939 | 1954 | ||
1940 | int KListView::dropVisualizerWidth () const | 1955 | int KListView::dropVisualizerWidth () const |
1941 | { | 1956 | { |
1942 | return d->mDropVisualizerWidth; | 1957 | return d->mDropVisualizerWidth; |
1943 | } | 1958 | } |
1944 | 1959 | ||
1945 | 1960 | ||
1946 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1961 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1947 | { | 1962 | { |
1948 | QListView::viewportPaintEvent(e); | 1963 | Q3ListView::viewportPaintEvent(e); |
1949 | 1964 | ||
1950 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1965 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1951 | { | 1966 | { |
1952 | QPainter painter(viewport()); | 1967 | QPainter painter(viewport()); |
1953 | 1968 | ||
1954 | // This is where we actually draw the drop-visualizer | 1969 | // This is where we actually draw the drop-visualizer |
1955 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1970 | painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern); |
1956 | } | 1971 | } |
1957 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1972 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1958 | { | 1973 | { |
1959 | QPainter painter(viewport()); | 1974 | QPainter painter(viewport()); |
1960 | 1975 | ||
1961 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1976 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1962 | 1977 | ||
1963 | // This is where we actually draw the drop-highlighter | 1978 | // This is where we actually draw the drop-highlighter |
1964 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), | 1979 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), |
1965 | //US QStyle::Style_FocusAtBorder); | 1980 | //US QStyle::Style_FocusAtBorder); |
1966 | 1981 | ||
1967 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); | 1982 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); |
1968 | 1983 | ||
1969 | 1984 | ||
1970 | } | 1985 | } |
1971 | } | 1986 | } |
@@ -1975,59 +1990,59 @@ void KListView::setFullWidth() | |||
1975 | setFullWidth(true); | 1990 | setFullWidth(true); |
1976 | } | 1991 | } |
1977 | 1992 | ||
1978 | void KListView::setFullWidth(bool fullWidth) | 1993 | void KListView::setFullWidth(bool fullWidth) |
1979 | { | 1994 | { |
1980 | d->fullWidth = fullWidth; | 1995 | d->fullWidth = fullWidth; |
1981 | //US header()->setStretchEnabled(fullWidth, columns()-1); | 1996 | //US header()->setStretchEnabled(fullWidth, columns()-1); |
1982 | } | 1997 | } |
1983 | 1998 | ||
1984 | bool KListView::fullWidth() const | 1999 | bool KListView::fullWidth() const |
1985 | { | 2000 | { |
1986 | return d->fullWidth; | 2001 | return d->fullWidth; |
1987 | } | 2002 | } |
1988 | 2003 | ||
1989 | int KListView::addColumn(const QString& label, int width) | 2004 | int KListView::addColumn(const QString& label, int width) |
1990 | { | 2005 | { |
1991 | int result = QListView::addColumn(label, width); | 2006 | int result = Q3ListView::addColumn(label, width); |
1992 | if (d->fullWidth) { | 2007 | if (d->fullWidth) { |
1993 | //US header()->setStretchEnabled(false, columns()-2); | 2008 | //US header()->setStretchEnabled(false, columns()-2); |
1994 | //US header()->setStretchEnabled(true, columns()-1); | 2009 | //US header()->setStretchEnabled(true, columns()-1); |
1995 | } | 2010 | } |
1996 | return result; | 2011 | return result; |
1997 | } | 2012 | } |
1998 | 2013 | ||
1999 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 2014 | int KListView::addColumn(const QIcon& iconset, const QString& label, int width) |
2000 | { | 2015 | { |
2001 | int result = QListView::addColumn(iconset, label, width); | 2016 | int result = Q3ListView::addColumn(iconset, label, width); |
2002 | if (d->fullWidth) { | 2017 | if (d->fullWidth) { |
2003 | //US header()->setStretchEnabled(false, columns()-2); | 2018 | //US header()->setStretchEnabled(false, columns()-2); |
2004 | //US header()->setStretchEnabled(true, columns()-1); | 2019 | //US header()->setStretchEnabled(true, columns()-1); |
2005 | } | 2020 | } |
2006 | return result; | 2021 | return result; |
2007 | } | 2022 | } |
2008 | 2023 | ||
2009 | void KListView::removeColumn(int index) | 2024 | void KListView::removeColumn(int index) |
2010 | { | 2025 | { |
2011 | QListView::removeColumn(index); | 2026 | Q3ListView::removeColumn(index); |
2012 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 2027 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
2013 | } | 2028 | } |
2014 | 2029 | ||
2015 | void KListView::viewportResizeEvent(QResizeEvent* e) | 2030 | void KListView::viewportResizeEvent(QResizeEvent* e) |
2016 | { | 2031 | { |
2017 | QListView::viewportResizeEvent(e); | 2032 | Q3ListView::viewportResizeEvent(e); |
2018 | } | 2033 | } |
2019 | 2034 | ||
2020 | const QColor &KListView::alternateBackground() const | 2035 | const QColor &KListView::alternateBackground() const |
2021 | { | 2036 | { |
2022 | return d->alternateBackground; | 2037 | return d->alternateBackground; |
2023 | } | 2038 | } |
2024 | 2039 | ||
2025 | void KListView::setAlternateBackground(const QColor &c) | 2040 | void KListView::setAlternateBackground(const QColor &c) |
2026 | { | 2041 | { |
2027 | d->alternateBackground = c; | 2042 | d->alternateBackground = c; |
2028 | repaint(); | 2043 | repaint(); |
2029 | } | 2044 | } |
2030 | 2045 | ||
2031 | void KListView::saveLayout(KConfig *config, const QString &group) const | 2046 | void KListView::saveLayout(KConfig *config, const QString &group) const |
2032 | { | 2047 | { |
2033 | KConfigGroupSaver saver(config, group); | 2048 | KConfigGroupSaver saver(config, group); |
@@ -2057,97 +2072,97 @@ void KListView::restoreLayout(KConfig *config, const QString &group) | |||
2057 | header()->moveSection(i++, (*it).toInt()); | 2072 | header()->moveSection(i++, (*it).toInt()); |
2058 | 2073 | ||
2059 | /*US I changed the following code, because hasKey is not available. | 2074 | /*US I changed the following code, because hasKey is not available. |
2060 | !!! check if my version is correct | 2075 | !!! check if my version is correct |
2061 | if (config->hasKey("SortColumn")) | 2076 | if (config->hasKey("SortColumn")) |
2062 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2077 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2063 | */ | 2078 | */ |
2064 | QStringList langLst = config->readListEntry( "SortColumn" ); | 2079 | QStringList langLst = config->readListEntry( "SortColumn" ); |
2065 | if (!langLst.isEmpty()) | 2080 | if (!langLst.isEmpty()) |
2066 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2081 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2067 | } | 2082 | } |
2068 | 2083 | ||
2069 | void KListView::setSorting(int column, bool ascending) | 2084 | void KListView::setSorting(int column, bool ascending) |
2070 | { | 2085 | { |
2071 | d->sortColumn = column; | 2086 | d->sortColumn = column; |
2072 | d->sortAscending = ascending; | 2087 | d->sortAscending = ascending; |
2073 | QListView::setSorting(column, ascending); | 2088 | Q3ListView::setSorting(column, ascending); |
2074 | } | 2089 | } |
2075 | 2090 | ||
2076 | int KListView::columnSorted(void) const | 2091 | int KListView::columnSorted(void) const |
2077 | { | 2092 | { |
2078 | return d->sortColumn; | 2093 | return d->sortColumn; |
2079 | } | 2094 | } |
2080 | 2095 | ||
2081 | bool KListView::ascendingSort(void) const | 2096 | bool KListView::ascendingSort(void) const |
2082 | { | 2097 | { |
2083 | return d->sortAscending; | 2098 | return d->sortAscending; |
2084 | } | 2099 | } |
2085 | 2100 | ||
2086 | KListViewItem::KListViewItem(QListView *parent) | 2101 | KListViewItem::KListViewItem(Q3ListView *parent) |
2087 | : QListViewItem(parent) | 2102 | : Q3ListViewItem(parent) |
2088 | { | 2103 | { |
2089 | init(); | 2104 | init(); |
2090 | } | 2105 | } |
2091 | 2106 | ||
2092 | KListViewItem::KListViewItem(QListViewItem *parent) | 2107 | KListViewItem::KListViewItem(Q3ListViewItem *parent) |
2093 | : QListViewItem(parent) | 2108 | : Q3ListViewItem(parent) |
2094 | { | 2109 | { |
2095 | init(); | 2110 | init(); |
2096 | } | 2111 | } |
2097 | 2112 | ||
2098 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2113 | KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after) |
2099 | : QListViewItem(parent, after) | 2114 | : Q3ListViewItem(parent, after) |
2100 | { | 2115 | { |
2101 | init(); | 2116 | init(); |
2102 | } | 2117 | } |
2103 | 2118 | ||
2104 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2119 | KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after) |
2105 | : QListViewItem(parent, after) | 2120 | : Q3ListViewItem(parent, after) |
2106 | { | 2121 | { |
2107 | init(); | 2122 | init(); |
2108 | } | 2123 | } |
2109 | 2124 | ||
2110 | KListViewItem::KListViewItem(QListView *parent, | 2125 | KListViewItem::KListViewItem(Q3ListView *parent, |
2111 | QString label1, QString label2, QString label3, QString label4, | 2126 | QString label1, QString label2, QString label3, QString label4, |
2112 | QString label5, QString label6, QString label7, QString label8) | 2127 | QString label5, QString label6, QString label7, QString label8) |
2113 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2128 | : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2114 | { | 2129 | { |
2115 | init(); | 2130 | init(); |
2116 | } | 2131 | } |
2117 | 2132 | ||
2118 | KListViewItem::KListViewItem(QListViewItem *parent, | 2133 | KListViewItem::KListViewItem(Q3ListViewItem *parent, |
2119 | QString label1, QString label2, QString label3, QString label4, | 2134 | QString label1, QString label2, QString label3, QString label4, |
2120 | QString label5, QString label6, QString label7, QString label8) | 2135 | QString label5, QString label6, QString label7, QString label8) |
2121 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2136 | : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2122 | { | 2137 | { |
2123 | init(); | 2138 | init(); |
2124 | } | 2139 | } |
2125 | 2140 | ||
2126 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, | 2141 | KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after, |
2127 | QString label1, QString label2, QString label3, QString label4, | 2142 | QString label1, QString label2, QString label3, QString label4, |
2128 | QString label5, QString label6, QString label7, QString label8) | 2143 | QString label5, QString label6, QString label7, QString label8) |
2129 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2144 | : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2130 | { | 2145 | { |
2131 | init(); | 2146 | init(); |
2132 | } | 2147 | } |
2133 | 2148 | ||
2134 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, | 2149 | KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, |
2135 | QString label1, QString label2, QString label3, QString label4, | 2150 | QString label1, QString label2, QString label3, QString label4, |
2136 | QString label5, QString label6, QString label7, QString label8) | 2151 | QString label5, QString label6, QString label7, QString label8) |
2137 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2152 | : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2138 | { | 2153 | { |
2139 | init(); | 2154 | init(); |
2140 | } | 2155 | } |
2141 | 2156 | ||
2142 | KListViewItem::~KListViewItem() | 2157 | KListViewItem::~KListViewItem() |
2143 | { | 2158 | { |
2144 | } | 2159 | } |
2145 | 2160 | ||
2146 | void KListViewItem::init() | 2161 | void KListViewItem::init() |
2147 | { | 2162 | { |
2148 | m_known = false; | 2163 | m_known = false; |
2149 | } | 2164 | } |
2150 | 2165 | ||
2151 | const QColor &KListViewItem::backgroundColor() | 2166 | const QColor &KListViewItem::backgroundColor() |
2152 | { | 2167 | { |
2153 | if (isAlternate()) | 2168 | if (isAlternate()) |
@@ -2199,38 +2214,38 @@ bool KListViewItem::isAlternate() | |||
2199 | } | 2214 | } |
2200 | return false; | 2215 | return false; |
2201 | } | 2216 | } |
2202 | 2217 | ||
2203 | void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 2218 | void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
2204 | { | 2219 | { |
2205 | QColorGroup _cg = cg; | 2220 | QColorGroup _cg = cg; |
2206 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); | 2221 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); |
2207 | if (pm && !pm->isNull()) | 2222 | if (pm && !pm->isNull()) |
2208 | { | 2223 | { |
2209 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); | 2224 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); |
2210 | QPoint o = p->brushOrigin(); | 2225 | QPoint o = p->brushOrigin(); |
2211 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); | 2226 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); |
2212 | } | 2227 | } |
2213 | else if (isAlternate()) { | 2228 | else if (isAlternate()) { |
2214 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) | 2229 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) |
2215 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) | 2230 | if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground) |
2216 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); | 2231 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); |
2217 | else | 2232 | else |
2218 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); | 2233 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); |
2219 | } | 2234 | } |
2220 | QListViewItem::paintCell(p, _cg, column, width, alignment); | 2235 | Q3ListViewItem::paintCell(p, _cg, column, width, alignment); |
2221 | } | 2236 | } |
2222 | 2237 | ||
2223 | //US we do not have a "global KDE" variable to setup singleClick functionality | 2238 | //US we do not have a "global KDE" variable to setup singleClick functionality |
2224 | void KListView::setSingleClick(bool s) | 2239 | void KListView::setSingleClick(bool s) |
2225 | { | 2240 | { |
2226 | d->bUseSingle = s; | 2241 | d->bUseSingle = s; |
2227 | slotSettingsChanged(1); | 2242 | slotSettingsChanged(1); |
2228 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); | 2243 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); |
2229 | } | 2244 | } |
2230 | 2245 | ||
2231 | 2246 | ||
2232 | void KListView::virtual_hook( int, void* ) | 2247 | void KListView::virtual_hook( int, void* ) |
2233 | { /*BASE::virtual_hook( id, data );*/ } | 2248 | { /*BASE::virtual_hook( id, data );*/ } |
2234 | 2249 | ||
2235 | //US #include "klistview.moc" | 2250 | //US #include "klistview.moc" |
2236 | //US #include "klistviewlineedit.moc" | 2251 | //US #include "klistviewlineedit.moc" |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index 9f0d9fd..2176525 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -7,70 +7,81 @@ | |||
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KLISTVIEW_H | 20 | #ifndef KLISTVIEW_H |
21 | #define KLISTVIEW_H | 21 | #define KLISTVIEW_H |
22 | 22 | ||
23 | #include <qlistview.h> | 23 | #include <q3listview.h> |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | //Added by qt3to4: | ||
27 | #include <QDragMoveEvent> | ||
28 | #include <QDropEvent> | ||
29 | #include <QDragLeaveEvent> | ||
30 | #include <QPaintEvent> | ||
31 | #include <QResizeEvent> | ||
32 | #include <QFocusEvent> | ||
33 | #include <QMouseEvent> | ||
34 | #include <QKeyEvent> | ||
35 | #include <QEvent> | ||
36 | #include <QDragEnterEvent> | ||
26 | 37 | ||
27 | //US | 38 | //US |
28 | class QDropEvent; | 39 | class QDropEvent; |
29 | class QDragLeaveEvent; | 40 | class QDragLeaveEvent; |
30 | class QDragMoveEvent; | 41 | class QDragMoveEvent; |
31 | class QDragEnterEvent; | 42 | class QDragEnterEvent; |
32 | 43 | ||
33 | class QDragObject; | 44 | class Q3DragObject; |
34 | class KConfig; | 45 | class KConfig; |
35 | class KLineEdit; | 46 | class KLineEdit; |
36 | /** | 47 | /** |
37 | * This Widget extends the functionality of QListView to honor the system | 48 | * This Widget extends the functionality of QListView to honor the system |
38 | * wide settings for Single Click/Double Click mode, AutoSelection and | 49 | * wide settings for Single Click/Double Click mode, AutoSelection and |
39 | * ChangeCursorOverLink (TM). | 50 | * ChangeCursorOverLink (TM). |
40 | * | 51 | * |
41 | * There is a new signal executed(). It gets connected to either | 52 | * There is a new signal executed(). It gets connected to either |
42 | * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE | 53 | * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE |
43 | * wide Single Click/Double Click settings. It is strongly recommended that | 54 | * wide Single Click/Double Click settings. It is strongly recommended that |
44 | * you use this signal instead of the above mentioned. This way you dont | 55 | * you use this signal instead of the above mentioned. This way you dont |
45 | * need to care about the current settings. | 56 | * need to care about the current settings. |
46 | * If you want to get informed when the user selects something connect to the | 57 | * If you want to get informed when the user selects something connect to the |
47 | * QListView::selectionChanged() signal. | 58 | * QListView::selectionChanged() signal. |
48 | * | 59 | * |
49 | * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) | 60 | * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) |
50 | * and connect it to a suitable slot. | 61 | * and connect it to a suitable slot. |
51 | * To see where you are dropping, @ref setDropVisualizer(true). | 62 | * To see where you are dropping, @ref setDropVisualizer(true). |
52 | * And also you'll need @ref acceptDrag(QDropEvent*) | 63 | * And also you'll need @ref acceptDrag(QDropEvent*) |
53 | * | 64 | * |
54 | * KListView is drag-enabled, too: to benefit from that you've got derive from it. | 65 | * KListView is drag-enabled, too: to benefit from that you've got derive from it. |
55 | * Reimplement @ref dragObject() and (possibly) @ref startDrag(), | 66 | * Reimplement @ref dragObject() and (possibly) @ref startDrag(), |
56 | * and @ref setDragEnabled(true). | 67 | * and @ref setDragEnabled(true). |
57 | * | 68 | * |
58 | * @version $Id$ | 69 | * @version $Id$ |
59 | */ | 70 | */ |
60 | class KListView : public QListView | 71 | class KListView : public Q3ListView |
61 | { | 72 | { |
62 | Q_OBJECT | 73 | Q_OBJECT |
63 | Q_ENUMS( SelectionModeExt ) | 74 | Q_ENUMS( SelectionModeExt ) |
64 | Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) | 75 | Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) |
65 | Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) | 76 | Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) |
66 | Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) | 77 | Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) |
67 | Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) | 78 | Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) |
68 | Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) | 79 | Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) |
69 | Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) | 80 | Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) |
70 | //US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) | 81 | //US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) |
71 | Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) | 82 | Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) |
72 | Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) | 83 | Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) |
73 | 84 | ||
74 | Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt ) | 85 | Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt ) |
75 | 86 | ||
76 | public: | 87 | public: |
@@ -93,41 +104,41 @@ public: | |||
93 | * item to the (including) the first item | 104 | * item to the (including) the first item |
94 | * @li CTRL+PgDn: toggle selection from (including) the current | 105 | * @li CTRL+PgDn: toggle selection from (including) the current |
95 | * item to (excluding) the item one page down | 106 | * item to (excluding) the item one page down |
96 | * @li CTRL+PgUp: toggle selection from (excluding) the current | 107 | * @li CTRL+PgUp: toggle selection from (excluding) the current |
97 | * item to (including) the item one page up | 108 | * item to (including) the item one page up |
98 | * | 109 | * |
99 | * The combinations work the same with SHIFT instead of CTRL, except | 110 | * The combinations work the same with SHIFT instead of CTRL, except |
100 | * that if you start selecting something using SHIFT everything selected | 111 | * that if you start selecting something using SHIFT everything selected |
101 | * before will be deselected first. | 112 | * before will be deselected first. |
102 | * | 113 | * |
103 | * Additionally the current item is always selected automatically when | 114 | * Additionally the current item is always selected automatically when |
104 | * navigating using the keyboard, except other items were selected explicitely. | 115 | * navigating using the keyboard, except other items were selected explicitely. |
105 | * | 116 | * |
106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected | 117 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected |
107 | */ | 118 | */ |
108 | enum SelectionModeExt { | 119 | enum SelectionModeExt { |
109 | Single = QListView::Single, | 120 | Single = Q3ListView::Single, |
110 | Multi = QListView::Multi, | 121 | Multi = Q3ListView::Multi, |
111 | Extended = QListView::Extended, | 122 | Extended = Q3ListView::Extended, |
112 | NoSelection = QListView::NoSelection, | 123 | NoSelection = Q3ListView::NoSelection, |
113 | FileManager | 124 | FileManager |
114 | }; | 125 | }; |
115 | void repaintContents( bool erase = true ) | 126 | void repaintContents( bool erase = true ) |
116 | { | 127 | { |
117 | QScrollView::repaintContents( contentsX(), contentsY(), | 128 | Q3ScrollView::repaintContents( contentsX(), contentsY(), |
118 | visibleWidth(), visibleHeight(), erase ); | 129 | visibleWidth(), visibleHeight(), erase ); |
119 | }; | 130 | }; |
120 | /** | 131 | /** |
121 | * Constructor. | 132 | * Constructor. |
122 | * | 133 | * |
123 | * The parameters @p parent and @p name are handled by | 134 | * The parameters @p parent and @p name are handled by |
124 | * @ref QListView, as usual. | 135 | * @ref QListView, as usual. |
125 | */ | 136 | */ |
126 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); | 137 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |
127 | 138 | ||
128 | /** | 139 | /** |
129 | * Destructor. | 140 | * Destructor. |
130 | */ | 141 | */ |
131 | virtual ~KListView(); | 142 | virtual ~KListView(); |
132 | 143 | ||
133 | virtual QSize sizeHint() const; | 144 | virtual QSize sizeHint() const; |
@@ -148,52 +159,52 @@ public: | |||
148 | * whole item or only the first column. | 159 | * whole item or only the first column. |
149 | * @return true if point is inside execute area of an item, false in all | 160 | * @return true if point is inside execute area of an item, false in all |
150 | * other cases including the case that it is over the viewport. | 161 | * other cases including the case that it is over the viewport. |
151 | */ | 162 | */ |
152 | virtual bool isExecuteArea( const QPoint& point ); | 163 | virtual bool isExecuteArea( const QPoint& point ); |
153 | 164 | ||
154 | /** | 165 | /** |
155 | * Same thing, but from an x coordinate only. This only checks if x is in | 166 | * Same thing, but from an x coordinate only. This only checks if x is in |
156 | * the first column (if all columns don't show focus), without testing if | 167 | * the first column (if all columns don't show focus), without testing if |
157 | * the y coordinate is over an item or not. | 168 | * the y coordinate is over an item or not. |
158 | */ | 169 | */ |
159 | bool isExecuteArea( int x ); | 170 | bool isExecuteArea( int x ); |
160 | 171 | ||
161 | /** | 172 | /** |
162 | * @return a list containing the currently selected items. | 173 | * @return a list containing the currently selected items. |
163 | */ | 174 | */ |
164 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) | 175 | Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) |
165 | 176 | ||
166 | /** | 177 | /** |
167 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. | 178 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. |
168 | */ | 179 | */ |
169 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); | 180 | void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after); |
170 | 181 | ||
171 | /** | 182 | /** |
172 | * @return the last item (not child!) of this listview. | 183 | * @return the last item (not child!) of this listview. |
173 | * | 184 | * |
174 | * @see lastChild() | 185 | * @see lastChild() |
175 | */ | 186 | */ |
176 | QListViewItem *lastItem() const; | 187 | Q3ListViewItem *lastItem() const; |
177 | 188 | ||
178 | /** | 189 | /** |
179 | * @return the last child of this listview. | 190 | * @return the last child of this listview. |
180 | * | 191 | * |
181 | * @see lastItem() | 192 | * @see lastItem() |
182 | */ | 193 | */ |
183 | QListViewItem* lastChild () const; | 194 | Q3ListViewItem* lastChild () const; |
184 | 195 | ||
185 | /** | 196 | /** |
186 | * @return the lineedit used for inline renaming. | 197 | * @return the lineedit used for inline renaming. |
187 | * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit | 198 | * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit |
188 | * | 199 | * |
189 | * @since 3.2 | 200 | * @since 3.2 |
190 | */ | 201 | */ |
191 | KLineEdit* renameLineEdit() const; | 202 | KLineEdit* renameLineEdit() const; |
192 | 203 | ||
193 | /** | 204 | /** |
194 | * @returns if it is legal to move items in the list view. True by default. | 205 | * @returns if it is legal to move items in the list view. True by default. |
195 | * | 206 | * |
196 | * @see #setDragEnabled() | 207 | * @see #setDragEnabled() |
197 | * @see #setItemsMovable() | 208 | * @see #setItemsMovable() |
198 | */ | 209 | */ |
199 | bool itemsMovable() const; | 210 | bool itemsMovable() const; |
@@ -263,71 +274,71 @@ public: | |||
263 | */ | 274 | */ |
264 | int dropVisualizerWidth () const; | 275 | int dropVisualizerWidth () const; |
265 | 276 | ||
266 | /** | 277 | /** |
267 | * @return the "extended" selection mode of this listview. | 278 | * @return the "extended" selection mode of this listview. |
268 | * | 279 | * |
269 | * @see SelectionModeExt | 280 | * @see SelectionModeExt |
270 | * @see setSelectionModeExt | 281 | * @see setSelectionModeExt |
271 | */ | 282 | */ |
272 | SelectionModeExt selectionModeExt () const; | 283 | SelectionModeExt selectionModeExt () const; |
273 | 284 | ||
274 | /** | 285 | /** |
275 | * Returns the index of @p item within the item tree or -1 if | 286 | * Returns the index of @p item within the item tree or -1 if |
276 | * @p item doesn't exist in this list view. This function takes | 287 | * @p item doesn't exist in this list view. This function takes |
277 | * all items into account not only the visible ones. | 288 | * all items into account not only the visible ones. |
278 | */ | 289 | */ |
279 | int itemIndex( const QListViewItem *item ) const; | 290 | int itemIndex( const Q3ListViewItem *item ) const; |
280 | 291 | ||
281 | /** | 292 | /** |
282 | * Returns the item of @p index within the item tree or 0 if | 293 | * Returns the item of @p index within the item tree or 0 if |
283 | * @p index doesn't exist in this list view. This function takes | 294 | * @p index doesn't exist in this list view. This function takes |
284 | * all items into account not only the visible ones. | 295 | * all items into account not only the visible ones. |
285 | */ | 296 | */ |
286 | QListViewItem* itemAtIndex(int index); | 297 | Q3ListViewItem* itemAtIndex(int index); |
287 | 298 | ||
288 | /** | 299 | /** |
289 | * @deprecated | 300 | * @deprecated |
290 | * @see #setFullWidth() | 301 | * @see #setFullWidth() |
291 | */ | 302 | */ |
292 | void setFullWidth(); | 303 | void setFullWidth(); |
293 | 304 | ||
294 | /** | 305 | /** |
295 | * Let the last column fit exactly all the available width. | 306 | * Let the last column fit exactly all the available width. |
296 | * | 307 | * |
297 | * @see #fullWidth() | 308 | * @see #fullWidth() |
298 | */ | 309 | */ |
299 | void setFullWidth(bool fullWidth); | 310 | void setFullWidth(bool fullWidth); |
300 | 311 | ||
301 | /** | 312 | /** |
302 | * Returns whether the last column is set to fit the available width. | 313 | * Returns whether the last column is set to fit the available width. |
303 | * | 314 | * |
304 | * @see #setFullWidth() | 315 | * @see #setFullWidth() |
305 | */ | 316 | */ |
306 | bool fullWidth() const; | 317 | bool fullWidth() const; |
307 | 318 | ||
308 | /** | 319 | /** |
309 | * Reimplemented for full width support | 320 | * Reimplemented for full width support |
310 | * | 321 | * |
311 | * @see #removeColumn() | 322 | * @see #removeColumn() |
312 | */ | 323 | */ |
313 | virtual int addColumn(const QString& label, int width = -1); | 324 | virtual int addColumn(const QString& label, int width = -1); |
314 | /** | 325 | /** |
315 | * Reimplemented for full width support | 326 | * Reimplemented for full width support |
316 | */ | 327 | */ |
317 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); | 328 | virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1); |
318 | /** | 329 | /** |
319 | * Reimplemented for full width support | 330 | * Reimplemented for full width support |
320 | * | 331 | * |
321 | * @see #addColumn() | 332 | * @see #addColumn() |
322 | */ | 333 | */ |
323 | virtual void removeColumn(int index); | 334 | virtual void removeColumn(int index); |
324 | 335 | ||
325 | /** | 336 | /** |
326 | * sets the alternate background background color. | 337 | * sets the alternate background background color. |
327 | * This only has an effect if the items are KListViewItems | 338 | * This only has an effect if the items are KListViewItems |
328 | * | 339 | * |
329 | * @param c the color to use for every other item. Set to an invalid | 340 | * @param c the color to use for every other item. Set to an invalid |
330 | * colour to disable alternate colours. | 341 | * colour to disable alternate colours. |
331 | * | 342 | * |
332 | * @see #alternateBackground() | 343 | * @see #alternateBackground() |
333 | **/ | 344 | **/ |
@@ -375,198 +386,198 @@ public: | |||
375 | 386 | ||
376 | //US we do not have a "global KDE" variable to setup singleClick functionality | 387 | //US we do not have a "global KDE" variable to setup singleClick functionality |
377 | void setSingleClick(bool s); | 388 | void setSingleClick(bool s); |
378 | 389 | ||
379 | 390 | ||
380 | signals: | 391 | signals: |
381 | 392 | ||
382 | /** | 393 | /** |
383 | * This signal is emitted whenever the user executes an listview item. | 394 | * This signal is emitted whenever the user executes an listview item. |
384 | * That means depending on the KDE wide Single Click/Double Click | 395 | * That means depending on the KDE wide Single Click/Double Click |
385 | * setting the user clicked or double clicked on that item. | 396 | * setting the user clicked or double clicked on that item. |
386 | * @param item is the pointer to the executed listview item. | 397 | * @param item is the pointer to the executed listview item. |
387 | * | 398 | * |
388 | * Note that you may not delete any @ref QListViewItem objects in slots | 399 | * Note that you may not delete any @ref QListViewItem objects in slots |
389 | * connected to this signal. | 400 | * connected to this signal. |
390 | */ | 401 | */ |
391 | void executed( QListViewItem *item ); | 402 | void executed( Q3ListViewItem *item ); |
392 | 403 | ||
393 | /** | 404 | /** |
394 | * This signal is emitted whenever the user executes an listview item. | 405 | * This signal is emitted whenever the user executes an listview item. |
395 | * That means depending on the KDE wide Single Click/Double Click | 406 | * That means depending on the KDE wide Single Click/Double Click |
396 | * setting the user clicked or double clicked on that item. | 407 | * setting the user clicked or double clicked on that item. |
397 | * @param item is the pointer to the executed listview item. | 408 | * @param item is the pointer to the executed listview item. |
398 | * @param pos is the position where the user has clicked | 409 | * @param pos is the position where the user has clicked |
399 | * @param c is the column into which the user clicked. | 410 | * @param c is the column into which the user clicked. |
400 | * | 411 | * |
401 | * Note that you may not delete any @ref QListViewItem objects in slots | 412 | * Note that you may not delete any @ref QListViewItem objects in slots |
402 | * connected to this signal. | 413 | * connected to this signal. |
403 | */ | 414 | */ |
404 | void executed( QListViewItem *item, const QPoint &pos, int c ); | 415 | void executed( Q3ListViewItem *item, const QPoint &pos, int c ); |
405 | 416 | ||
406 | /** | 417 | /** |
407 | * This signal gets emitted whenever the user double clicks into the | 418 | * This signal gets emitted whenever the user double clicks into the |
408 | * listview. | 419 | * listview. |
409 | * @param item is the pointer to the clicked listview item. | 420 | * @param item is the pointer to the clicked listview item. |
410 | * @param pos is the position where the user has clicked, and | 421 | * @param pos is the position where the user has clicked, and |
411 | * @param c is the column into which the user clicked. | 422 | * @param c is the column into which the user clicked. |
412 | * | 423 | * |
413 | * Note that you may not delete any @ref QListViewItem objects in slots | 424 | * Note that you may not delete any @ref QListViewItem objects in slots |
414 | * connected to this signal. | 425 | * connected to this signal. |
415 | * | 426 | * |
416 | * This signal is more or less here for the sake of completeness. | 427 | * This signal is more or less here for the sake of completeness. |
417 | * You should normally not need to use this. In most cases its better | 428 | * You should normally not need to use this. In most cases its better |
418 | * to use @ref #executed() instead. | 429 | * to use @ref #executed() instead. |
419 | */ | 430 | */ |
420 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); | 431 | void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c ); |
421 | void contextRequest( QListViewItem *item, const QPoint &pos, int c ); | 432 | void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c ); |
422 | 433 | ||
423 | /** | 434 | /** |
424 | * This signal gets emitted whenever something acceptable is | 435 | * This signal gets emitted whenever something acceptable is |
425 | * dropped onto the listview. | 436 | * dropped onto the listview. |
426 | * | 437 | * |
427 | * @param e is the drop event itself (it has already been accepted) | 438 | * @param e is the drop event itself (it has already been accepted) |
428 | * @param after is the item after which the drop occured (or 0L, if | 439 | * @param after is the item after which the drop occured (or 0L, if |
429 | * the drop was above all items) | 440 | * the drop was above all items) |
430 | * | 441 | * |
431 | * @see #acceptDrop() | 442 | * @see #acceptDrop() |
432 | */ | 443 | */ |
433 | void dropped (QDropEvent * e, QListViewItem *after); | 444 | void dropped (QDropEvent * e, Q3ListViewItem *after); |
434 | 445 | ||
435 | /** | 446 | /** |
436 | * This signal gets emitted whenever something acceptable is | 447 | * This signal gets emitted whenever something acceptable is |
437 | * dropped onto the listview. | 448 | * dropped onto the listview. |
438 | * | 449 | * |
439 | * This is an overloaded version of the above (provided to simplify | 450 | * This is an overloaded version of the above (provided to simplify |
440 | * processing drops outside of the class). | 451 | * processing drops outside of the class). |
441 | * | 452 | * |
442 | * @param list is the listview | 453 | * @param list is the listview |
443 | * @param e is the drop event itself (it has already been accepted) | 454 | * @param e is the drop event itself (it has already been accepted) |
444 | * @param after is the item after which the drop occured (or 0L, if | 455 | * @param after is the item after which the drop occured (or 0L, if |
445 | * the drop was above all items | 456 | * the drop was above all items |
446 | */ | 457 | */ |
447 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); | 458 | void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after); |
448 | 459 | ||
449 | /** | 460 | /** |
450 | * This signal gets emitted whenever something acceptable is | 461 | * This signal gets emitted whenever something acceptable is |
451 | * dropped onto the listview. | 462 | * dropped onto the listview. |
452 | * | 463 | * |
453 | * This function also provides a parent, in the event that your listview | 464 | * This function also provides a parent, in the event that your listview |
454 | * is a tree | 465 | * is a tree |
455 | * @param list is the listview | 466 | * @param list is the listview |
456 | * @param e is the drop event itself (it has already been accepted) | 467 | * @param e is the drop event itself (it has already been accepted) |
457 | * @param parent the item that is to be the parent of the new item | 468 | * @param parent the item that is to be the parent of the new item |
458 | * @param after is the item after which the drop occured (or 0L, if | 469 | * @param after is the item after which the drop occured (or 0L, if |
459 | * the drop was above all items | 470 | * the drop was above all items |
460 | */ | 471 | */ |
461 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 472 | void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); |
462 | 473 | ||
463 | /** | 474 | /** |
464 | * This signal gets emitted whenever something acceptable is | 475 | * This signal gets emitted whenever something acceptable is |
465 | * dropped onto the listview. | 476 | * dropped onto the listview. |
466 | * | 477 | * |
467 | * This function also provides a parent, in the event that your listview | 478 | * This function also provides a parent, in the event that your listview |
468 | * is a tree | 479 | * is a tree |
469 | * @param e is the drop event itself (it has already been accepted) | 480 | * @param e is the drop event itself (it has already been accepted) |
470 | * @param parent the item that is to be the parent of the new item | 481 | * @param parent the item that is to be the parent of the new item |
471 | * @param after is the item after which the drop occured (or 0L, if | 482 | * @param after is the item after which the drop occured (or 0L, if |
472 | * the drop was above all items | 483 | * the drop was above all items |
473 | */ | 484 | */ |
474 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 485 | void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); |
475 | 486 | ||
476 | /** | 487 | /** |
477 | * This signal is emitted when ever the user moves an item in the list via | 488 | * This signal is emitted when ever the user moves an item in the list via |
478 | * DnD. | 489 | * DnD. |
479 | * If more than one item is moved at the same time, this signal is only emitted | 490 | * If more than one item is moved at the same time, this signal is only emitted |
480 | * once. | 491 | * once. |
481 | */ | 492 | */ |
482 | void moved(); | 493 | void moved(); |
483 | 494 | ||
484 | /** | 495 | /** |
485 | * Connect to this signal if you want to do some preprocessing before | 496 | * Connect to this signal if you want to do some preprocessing before |
486 | * a move is made, for example, to disable sorting | 497 | * a move is made, for example, to disable sorting |
487 | * | 498 | * |
488 | * This is sent only once per each groups of moves. That is, for each | 499 | * This is sent only once per each groups of moves. That is, for each |
489 | * drop that is a move this will be emitted once, before KListView calls | 500 | * drop that is a move this will be emitted once, before KListView calls |
490 | * @see moveItem() | 501 | * @see moveItem() |
491 | */ | 502 | */ |
492 | void aboutToMove(); | 503 | void aboutToMove(); |
493 | 504 | ||
494 | /** | 505 | /** |
495 | * This signal is emitted when ever the user moves an item in the list via | 506 | * This signal is emitted when ever the user moves an item in the list via |
496 | * DnD. | 507 | * DnD. |
497 | * If more than one item is moved at the same time, @p afterFirst and | 508 | * If more than one item is moved at the same time, @p afterFirst and |
498 | * @p afterNow will reflect what was true before the move. | 509 | * @p afterNow will reflect what was true before the move. |
499 | * This differs from @ref moved(), so be careful. All the items will have been | 510 | * This differs from @ref moved(), so be careful. All the items will have been |
500 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME | 511 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME |
501 | * @param item the item that was moved | 512 | * @param item the item that was moved |
502 | * @param afterFirst the item that parameter item was in before the move, in the list | 513 | * @param afterFirst the item that parameter item was in before the move, in the list |
503 | * @param afterNow the item it's currently after. | 514 | * @param afterNow the item it's currently after. |
504 | */ | 515 | */ |
505 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); | 516 | void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow); |
506 | 517 | ||
507 | 518 | ||
508 | /** | 519 | /** |
509 | * This signal is emitted after all the items have been moved. It reports info for | 520 | * This signal is emitted after all the items have been moved. It reports info for |
510 | * each and every item moved, in order. The first element in @p items associates | 521 | * each and every item moved, in order. The first element in @p items associates |
511 | * with the first of afterFirst and afterNow. | 522 | * with the first of afterFirst and afterNow. |
512 | */ | 523 | */ |
513 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); | 524 | void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow); |
514 | 525 | ||
515 | /** | 526 | /** |
516 | * This signal gets emitted when an item is renamed via in-place renaming. | 527 | * This signal gets emitted when an item is renamed via in-place renaming. |
517 | * | 528 | * |
518 | * @param item is the renamed item. | 529 | * @param item is the renamed item. |
519 | * @param str is the new value of column @p col. | 530 | * @param str is the new value of column @p col. |
520 | * @param col is the renamed column. | 531 | * @param col is the renamed column. |
521 | */ | 532 | */ |
522 | void itemRenamed(QListViewItem* item, const QString &str, int col); | 533 | void itemRenamed(Q3ListViewItem* item, const QString &str, int col); |
523 | 534 | ||
524 | /** | 535 | /** |
525 | * Same as above, but without the extra information. | 536 | * Same as above, but without the extra information. |
526 | */ | 537 | */ |
527 | void itemRenamed(QListViewItem* item); | 538 | void itemRenamed(Q3ListViewItem* item); |
528 | void signalDelete(); | 539 | void signalDelete(); |
529 | 540 | ||
530 | /** | 541 | /** |
531 | * This signal is emitted when the shortcut key for popup-menus is pressed. | 542 | * This signal is emitted when the shortcut key for popup-menus is pressed. |
532 | * | 543 | * |
533 | * Normally you should not use this, just connect a slot to signal | 544 | * Normally you should not use this, just connect a slot to signal |
534 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly | 545 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly |
535 | * handle showing context menus regardless of settings. | 546 | * handle showing context menus regardless of settings. |
536 | * | 547 | * |
537 | * @param list is this listview. | 548 | * @param list is this listview. |
538 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. | 549 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. |
539 | */ | 550 | */ |
540 | void menuShortCutPressed (KListView* list, QListViewItem* item); | 551 | void menuShortCutPressed (KListView* list, Q3ListViewItem* item); |
541 | 552 | ||
542 | /** | 553 | /** |
543 | * This signal is emitted whenever a context-menu should be shown for item @p i. | 554 | * This signal is emitted whenever a context-menu should be shown for item @p i. |
544 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). | 555 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). |
545 | * | 556 | * |
546 | * @param l is this listview. | 557 | * @param l is this listview. |
547 | * @param i is the item for which the menu should be shown. May be 0L. | 558 | * @param i is the item for which the menu should be shown. May be 0L. |
548 | * @param p is the point at which the menu should be shown. | 559 | * @param p is the point at which the menu should be shown. |
549 | */ | 560 | */ |
550 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); | 561 | void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p); |
551 | 562 | ||
552 | public slots: | 563 | public slots: |
553 | /** | 564 | /** |
554 | * Rename column @p c of @p item. | 565 | * Rename column @p c of @p item. |
555 | */ | 566 | */ |
556 | virtual void rename(QListViewItem *item, int c); | 567 | virtual void rename(Q3ListViewItem *item, int c); |
557 | 568 | ||
558 | /** | 569 | /** |
559 | * By default, if you called setItemsRenameable(true), | 570 | * By default, if you called setItemsRenameable(true), |
560 | * only the first column is renameable. | 571 | * only the first column is renameable. |
561 | * Use this function to enable the feature on other columns. | 572 | * Use this function to enable the feature on other columns. |
562 | * | 573 | * |
563 | * If you want more intelligent (dynamic) selection, | 574 | * If you want more intelligent (dynamic) selection, |
564 | * you'll have to derive from KListView, | 575 | * you'll have to derive from KListView, |
565 | * and override @ref rename() and call only call it | 576 | * and override @ref rename() and call only call it |
566 | * if you want the item to be renamed. | 577 | * if you want the item to be renamed. |
567 | */ | 578 | */ |
568 | void setRenameable (int column, bool yesno=true); | 579 | void setRenameable (int column, bool yesno=true); |
569 | 580 | ||
570 | /** | 581 | /** |
571 | * Set whether items in the list view can be moved. | 582 | * Set whether items in the list view can be moved. |
572 | * It is enabled by default. | 583 | * It is enabled by default. |
@@ -660,86 +671,86 @@ protected: | |||
660 | * viewport coordinates. | 671 | * viewport coordinates. |
661 | */ | 672 | */ |
662 | inline bool below (const QRect& rect, const QPoint& p) | 673 | inline bool below (const QRect& rect, const QPoint& p) |
663 | { | 674 | { |
664 | return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); | 675 | return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); |
665 | } | 676 | } |
666 | 677 | ||
667 | /** | 678 | /** |
668 | * An overloaded version of below(const QRect&, const QPoint&). | 679 | * An overloaded version of below(const QRect&, const QPoint&). |
669 | * | 680 | * |
670 | * It differs from the above only in what arguments it takes. | 681 | * It differs from the above only in what arguments it takes. |
671 | * | 682 | * |
672 | * @param i the item whose rect() is passed to the above function. | 683 | * @param i the item whose rect() is passed to the above function. |
673 | * @param p is translated from contents coordinates to viewport coordinates | 684 | * @param p is translated from contents coordinates to viewport coordinates |
674 | * before being passed to the above function. | 685 | * before being passed to the above function. |
675 | */ | 686 | */ |
676 | inline bool below (QListViewItem* i, const QPoint& p) | 687 | inline bool below (Q3ListViewItem* i, const QPoint& p) |
677 | { | 688 | { |
678 | return below (itemRect(i), contentsToViewport(p)); | 689 | return below (itemRect(i), contentsToViewport(p)); |
679 | } | 690 | } |
680 | 691 | ||
681 | /** | 692 | /** |
682 | * Reimplemented to reload the alternate background in palette changes. | 693 | * Reimplemented to reload the alternate background in palette changes. |
683 | * @internal | 694 | * @internal |
684 | */ | 695 | */ |
685 | virtual bool event( QEvent * ); | 696 | virtual bool event( QEvent * ); |
686 | 697 | ||
687 | /** | 698 | /** |
688 | * Emit signal @ref #executed. | 699 | * Emit signal @ref #executed. |
689 | * @internal | 700 | * @internal |
690 | */ | 701 | */ |
691 | //US I added buttonstate to pass the current keyboard status | 702 | //US I added buttonstate to pass the current keyboard status |
692 | void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); | 703 | void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c); |
693 | 704 | ||
694 | /** | 705 | /** |
695 | * Reimplemented for internal reasons. | 706 | * Reimplemented for internal reasons. |
696 | * Further reimplementations should call this function or else | 707 | * Further reimplementations should call this function or else |
697 | * some features may not work correctly. | 708 | * some features may not work correctly. |
698 | * | 709 | * |
699 | * The API is unaffected. | 710 | * The API is unaffected. |
700 | */ | 711 | */ |
701 | virtual void focusInEvent(QFocusEvent* fe); | 712 | virtual void focusInEvent(QFocusEvent* fe); |
702 | 713 | ||
703 | /** | 714 | /** |
704 | * Reimplemented for internal reasons. | 715 | * Reimplemented for internal reasons. |
705 | * Further reimplementations should call this function or else | 716 | * Further reimplementations should call this function or else |
706 | * some features may not work correctly. | 717 | * some features may not work correctly. |
707 | * | 718 | * |
708 | * The API is unaffected. | 719 | * The API is unaffected. |
709 | */ | 720 | */ |
710 | virtual void focusOutEvent( QFocusEvent *fe ); | 721 | virtual void focusOutEvent( QFocusEvent *fe ); |
711 | 722 | ||
712 | /** | 723 | /** |
713 | * Reimplemented for internal reasons. | 724 | * Reimplemented for internal reasons. |
714 | * Further reimplementations should call this function or else | 725 | * Further reimplementations should call this function or else |
715 | * some features may not work correctly. | 726 | * some features may not work correctly. |
716 | * | 727 | * |
717 | * The API is unaffected. | 728 | * The API is unaffected. |
718 | */ | 729 | */ |
719 | virtual void leaveEvent( QEvent *e ); | 730 | virtual void leaveEvent( QEvent *e ); |
720 | 731 | ||
721 | /** | 732 | /** |
722 | * @return the tooltip for @p column of @p item. | 733 | * @return the tooltip for @p column of @p item. |
723 | */ | 734 | */ |
724 | virtual QString tooltip(QListViewItem* item, int column) const; | 735 | virtual QString tooltip(Q3ListViewItem* item, int column) const; |
725 | 736 | ||
726 | /** | 737 | /** |
727 | * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. | 738 | * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. |
728 | */ | 739 | */ |
729 | virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const; | 740 | virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const; |
730 | 741 | ||
731 | /** | 742 | /** |
732 | * Reimplemented for internal reasons. | 743 | * Reimplemented for internal reasons. |
733 | * Further reimplementations should call this function or else | 744 | * Further reimplementations should call this function or else |
734 | * some features may not work correctly. | 745 | * some features may not work correctly. |
735 | * | 746 | * |
736 | * The API is unaffected. | 747 | * The API is unaffected. |
737 | */ | 748 | */ |
738 | virtual void contentsDragMoveEvent (QDragMoveEvent *event); | 749 | virtual void contentsDragMoveEvent (QDragMoveEvent *event); |
739 | 750 | ||
740 | /** | 751 | /** |
741 | * Reimplemented for internal reasons. | 752 | * Reimplemented for internal reasons. |
742 | * Further reimplementations should call this function or else | 753 | * Further reimplementations should call this function or else |
743 | * some features may not work correctly. | 754 | * some features may not work correctly. |
744 | * | 755 | * |
745 | * The API is unaffected. | 756 | * The API is unaffected. |
@@ -792,57 +803,57 @@ protected: | |||
792 | virtual void contentsDropEvent (QDropEvent*); | 803 | virtual void contentsDropEvent (QDropEvent*); |
793 | 804 | ||
794 | /** | 805 | /** |
795 | * Reimplemented for internal reasons. | 806 | * Reimplemented for internal reasons. |
796 | * Further reimplementations should call this function or else | 807 | * Further reimplementations should call this function or else |
797 | * some features may not work correctly. | 808 | * some features may not work correctly. |
798 | * | 809 | * |
799 | * The API is unaffected. | 810 | * The API is unaffected. |
800 | */ | 811 | */ |
801 | virtual void contentsDragEnterEvent (QDragEnterEvent *); | 812 | virtual void contentsDragEnterEvent (QDragEnterEvent *); |
802 | 813 | ||
803 | /** | 814 | /** |
804 | * @return a dragobject encoding the current selection. | 815 | * @return a dragobject encoding the current selection. |
805 | * | 816 | * |
806 | * @see setDragEnabled() | 817 | * @see setDragEnabled() |
807 | */ | 818 | */ |
808 | virtual QDragObject *dragObject(); | 819 | virtual Q3DragObject *dragObject(); |
809 | 820 | ||
810 | /** | 821 | /** |
811 | * @return true if the @p event provides some acceptable | 822 | * @return true if the @p event provides some acceptable |
812 | * format. | 823 | * format. |
813 | * A common mistake is to forget the "const" in your reimplementation | 824 | * A common mistake is to forget the "const" in your reimplementation |
814 | */ | 825 | */ |
815 | virtual bool acceptDrag (QDropEvent* event) const; | 826 | virtual bool acceptDrag (QDropEvent* event) const; |
816 | 827 | ||
817 | /** | 828 | /** |
818 | * Paint the drag line. If painter is null, don't try to :) | 829 | * Paint the drag line. If painter is null, don't try to :) |
819 | * | 830 | * |
820 | * If after == 0 then the marker should be drawn at the top. | 831 | * If after == 0 then the marker should be drawn at the top. |
821 | * | 832 | * |
822 | * @return the rectangle that you painted to. | 833 | * @return the rectangle that you painted to. |
823 | */ | 834 | */ |
824 | virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after); | 835 | virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after); |
825 | 836 | ||
826 | /** | 837 | /** |
827 | * Paint the drag rectangle. If painter is null, don't try to :) | 838 | * Paint the drag rectangle. If painter is null, don't try to :) |
828 | * | 839 | * |
829 | * | 840 | * |
830 | * @return the rectangle that you painted to. | 841 | * @return the rectangle that you painted to. |
831 | */ | 842 | */ |
832 | virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item); | 843 | virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item); |
833 | 844 | ||
834 | /** | 845 | /** |
835 | * This method calls @ref dragObject() and starts the drag. | 846 | * This method calls @ref dragObject() and starts the drag. |
836 | * | 847 | * |
837 | * Reimplement it to do fancy stuff like setting a pixmap or | 848 | * Reimplement it to do fancy stuff like setting a pixmap or |
838 | * using a non-default DragMode | 849 | * using a non-default DragMode |
839 | */ | 850 | */ |
840 | virtual void startDrag(); | 851 | virtual void startDrag(); |
841 | 852 | ||
842 | /** | 853 | /** |
843 | * Reimplemented for internal reasons. | 854 | * Reimplemented for internal reasons. |
844 | * Further reimplementations should call this function or else | 855 | * Further reimplementations should call this function or else |
845 | * some features may not work correctly. | 856 | * some features may not work correctly. |
846 | * | 857 | * |
847 | * The API is unaffected. | 858 | * The API is unaffected. |
848 | */ | 859 | */ |
@@ -873,153 +884,153 @@ protected: | |||
873 | * Returns false if items were selected explicitely, e.g. using the mouse. | 884 | * Returns false if items were selected explicitely, e.g. using the mouse. |
874 | */ | 885 | */ |
875 | bool automaticSelection() const; | 886 | bool automaticSelection() const; |
876 | 887 | ||
877 | /** | 888 | /** |
878 | * Reimplemented for setFullWidth() | 889 | * Reimplemented for setFullWidth() |
879 | */ | 890 | */ |
880 | virtual void viewportResizeEvent(QResizeEvent* e); | 891 | virtual void viewportResizeEvent(QResizeEvent* e); |
881 | 892 | ||
882 | protected slots: | 893 | protected slots: |
883 | /** | 894 | /** |
884 | * Update internal settings whenever the global ones change. | 895 | * Update internal settings whenever the global ones change. |
885 | * @internal | 896 | * @internal |
886 | */ | 897 | */ |
887 | void slotSettingsChanged(int); | 898 | void slotSettingsChanged(int); |
888 | 899 | ||
889 | void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ); | 900 | void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ); |
890 | void doneEditing(QListViewItem *item, int row); | 901 | void doneEditing(Q3ListViewItem *item, int row); |
891 | 902 | ||
892 | /** | 903 | /** |
893 | * Repaint the rect where I was drawing the drop line. | 904 | * Repaint the rect where I was drawing the drop line. |
894 | */ | 905 | */ |
895 | void cleanDropVisualizer(); | 906 | void cleanDropVisualizer(); |
896 | 907 | ||
897 | /** | 908 | /** |
898 | * Repaint the rect where I was drawing the drop rectangle. | 909 | * Repaint the rect where I was drawing the drop rectangle. |
899 | */ | 910 | */ |
900 | void cleanItemHighlighter(); | 911 | void cleanItemHighlighter(); |
901 | 912 | ||
902 | /** | 913 | /** |
903 | * Emit the @ref contextMenu signal. This slot is for mouse actions. | 914 | * Emit the @ref contextMenu signal. This slot is for mouse actions. |
904 | */ | 915 | */ |
905 | void emitContextMenu (QListViewItem*, const QPoint&, int); | 916 | void emitContextMenu (Q3ListViewItem*, const QPoint&, int); |
906 | 917 | ||
907 | /** | 918 | /** |
908 | * Emit the @ref #contextMenu signal. This slot is for key presses. | 919 | * Emit the @ref #contextMenu signal. This slot is for key presses. |
909 | */ | 920 | */ |
910 | void emitContextMenu (KListView*, QListViewItem*); | 921 | void emitContextMenu (KListView*, Q3ListViewItem*); |
911 | 922 | ||
912 | /** | 923 | /** |
913 | * Accessory slot for AutoSelect | 924 | * Accessory slot for AutoSelect |
914 | * @internal | 925 | * @internal |
915 | */ | 926 | */ |
916 | void slotOnItem( QListViewItem *item ); | 927 | void slotOnItem( Q3ListViewItem *item ); |
917 | 928 | ||
918 | /** | 929 | /** |
919 | * Accessory slot for AutoSelect/ChangeCursorOverItem | 930 | * Accessory slot for AutoSelect/ChangeCursorOverItem |
920 | * @internal | 931 | * @internal |
921 | */ | 932 | */ |
922 | void slotOnViewport(); | 933 | void slotOnViewport(); |
923 | 934 | ||
924 | /** | 935 | /** |
925 | * Process AutoSelection. | 936 | * Process AutoSelection. |
926 | * @internal | 937 | * @internal |
927 | */ | 938 | */ |
928 | void slotAutoSelect(); | 939 | void slotAutoSelect(); |
929 | 940 | ||
930 | void slotDragExpand(); | 941 | void slotDragExpand(); |
931 | 942 | ||
932 | /** | 943 | /** |
933 | * Reacts to header changes in full width mode | 944 | * Reacts to header changes in full width mode |
934 | * @internal | 945 | * @internal |
935 | */ | 946 | */ |
936 | void slotHeaderChanged(); | 947 | void slotHeaderChanged(); |
937 | 948 | ||
938 | protected: | 949 | protected: |
939 | /** | 950 | /** |
940 | * Handle dropEvent when itemsMovable() is set to true. | 951 | * Handle dropEvent when itemsMovable() is set to true. |
941 | */ | 952 | */ |
942 | virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme); | 953 | virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme); |
943 | 954 | ||
944 | /** | 955 | /** |
945 | * Where is the nearest QListViewItem that I'm going to drop? | 956 | * Where is the nearest QListViewItem that I'm going to drop? |
946 | * | 957 | * |
947 | * FIXME KDE 4.0: Make this method const so it can be called from an | 958 | * FIXME KDE 4.0: Make this method const so it can be called from an |
948 | * acceptDrag method without ugly casts | 959 | * acceptDrag method without ugly casts |
949 | */ | 960 | */ |
950 | virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after); | 961 | virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after); |
951 | 962 | ||
952 | /** | 963 | /** |
953 | * A special keyPressEvent (for FileManager selection mode). | 964 | * A special keyPressEvent (for FileManager selection mode). |
954 | */ | 965 | */ |
955 | void fileManagerKeyPressEvent (QKeyEvent*); | 966 | void fileManagerKeyPressEvent (QKeyEvent*); |
956 | 967 | ||
957 | /** | 968 | /** |
958 | * Convert the depth of an item into its indentation in pixels | 969 | * Convert the depth of an item into its indentation in pixels |
959 | */ | 970 | */ |
960 | int depthToPixels( int depth ); | 971 | int depthToPixels( int depth ); |
961 | 972 | ||
962 | private: | 973 | private: |
963 | class Tooltip; | 974 | class Tooltip; |
964 | protected: | 975 | protected: |
965 | virtual void virtual_hook( int id, void* data ); | 976 | virtual void virtual_hook( int id, void* data ); |
966 | private: | 977 | private: |
967 | class KListViewPrivate; | 978 | class KListViewPrivate; |
968 | KListViewPrivate *d; | 979 | KListViewPrivate *d; |
969 | }; | 980 | }; |
970 | 981 | ||
971 | /** | 982 | /** |
972 | * A listview item with support for alternate background colours. It is | 983 | * A listview item with support for alternate background colours. It is |
973 | * a drop-in replacement for @ref QListViewItem | 984 | * a drop-in replacement for @ref QListViewItem |
974 | * | 985 | * |
975 | * @short listview item with alternate background colour support | 986 | * @short listview item with alternate background colour support |
976 | */ | 987 | */ |
977 | class KListViewItem : public QListViewItem | 988 | class KListViewItem : public Q3ListViewItem |
978 | { | 989 | { |
979 | public: | 990 | public: |
980 | /** | 991 | /** |
981 | * constructors. The semantics remain as in @ref QListViewItem. | 992 | * constructors. The semantics remain as in @ref QListViewItem. |
982 | * Although they accept a @ref QListViewItem as parent, please | 993 | * Although they accept a @ref QListViewItem as parent, please |
983 | * don't mix KListViewItem (or subclasses) with QListViewItem | 994 | * don't mix KListViewItem (or subclasses) with QListViewItem |
984 | * (or subclasses). | 995 | * (or subclasses). |
985 | */ | 996 | */ |
986 | KListViewItem(QListView *parent); | 997 | KListViewItem(Q3ListView *parent); |
987 | KListViewItem(QListViewItem *parent); | 998 | KListViewItem(Q3ListViewItem *parent); |
988 | KListViewItem(QListView *parent, QListViewItem *after); | 999 | KListViewItem(Q3ListView *parent, Q3ListViewItem *after); |
989 | KListViewItem(QListViewItem *parent, QListViewItem *after); | 1000 | KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after); |
990 | 1001 | ||
991 | KListViewItem(QListView *parent, | 1002 | KListViewItem(Q3ListView *parent, |
992 | QString, QString = QString::null, | 1003 | QString, QString = QString::null, |
993 | QString = QString::null, QString = QString::null, | 1004 | QString = QString::null, QString = QString::null, |
994 | QString = QString::null, QString = QString::null, | 1005 | QString = QString::null, QString = QString::null, |
995 | QString = QString::null, QString = QString::null); | 1006 | QString = QString::null, QString = QString::null); |
996 | 1007 | ||
997 | KListViewItem(QListViewItem *parent, | 1008 | KListViewItem(Q3ListViewItem *parent, |
998 | QString, QString = QString::null, | 1009 | QString, QString = QString::null, |
999 | QString = QString::null, QString = QString::null, | 1010 | QString = QString::null, QString = QString::null, |
1000 | QString = QString::null, QString = QString::null, | 1011 | QString = QString::null, QString = QString::null, |
1001 | QString = QString::null, QString = QString::null); | 1012 | QString = QString::null, QString = QString::null); |
1002 | 1013 | ||
1003 | KListViewItem(QListView *parent, QListViewItem *after, | 1014 | KListViewItem(Q3ListView *parent, Q3ListViewItem *after, |
1004 | QString, QString = QString::null, | 1015 | QString, QString = QString::null, |
1005 | QString = QString::null, QString = QString::null, | 1016 | QString = QString::null, QString = QString::null, |
1006 | QString = QString::null, QString = QString::null, | 1017 | QString = QString::null, QString = QString::null, |
1007 | QString = QString::null, QString = QString::null); | 1018 | QString = QString::null, QString = QString::null); |
1008 | 1019 | ||
1009 | KListViewItem(QListViewItem *parent, QListViewItem *after, | 1020 | KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, |
1010 | QString, QString = QString::null, | 1021 | QString, QString = QString::null, |
1011 | QString = QString::null, QString = QString::null, | 1022 | QString = QString::null, QString = QString::null, |
1012 | QString = QString::null, QString = QString::null, | 1023 | QString = QString::null, QString = QString::null, |
1013 | QString = QString::null, QString = QString::null); | 1024 | QString = QString::null, QString = QString::null); |
1014 | 1025 | ||
1015 | virtual ~KListViewItem(); | 1026 | virtual ~KListViewItem(); |
1016 | 1027 | ||
1017 | /** | 1028 | /** |
1018 | * retuns true if this item is to be drawn with the alternate background | 1029 | * retuns true if this item is to be drawn with the alternate background |
1019 | */ | 1030 | */ |
1020 | bool isAlternate(); | 1031 | bool isAlternate(); |
1021 | /** | 1032 | /** |
1022 | * returns the background colour for this item | 1033 | * returns the background colour for this item |
1023 | */ | 1034 | */ |
1024 | const QColor &backgroundColor(); | 1035 | const QColor &backgroundColor(); |
1025 | 1036 | ||
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index fa678f2..bac0db8 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp | |||
@@ -8,66 +8,72 @@ | |||
8 | (C) 2002 Joseph Wenninger (jowenn@kde.org) | 8 | (C) 2002 Joseph Wenninger (jowenn@kde.org) |
9 | 9 | ||
10 | This library is free software; you can redistribute it and/or | 10 | This library is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU Library General Public | 11 | modify it under the terms of the GNU Library General Public |
12 | License version 2 as published by the Free Software Foundation. | 12 | License version 2 as published by the Free Software Foundation. |
13 | 13 | ||
14 | This library is distributed in the hope that it will be useful, | 14 | This library is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | Library General Public License for more details. | 17 | Library General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | #include <qobjectlist.h> | 24 | #include <qobject.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qstatusbar.h> | 28 | #include <qstatusbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //Added by qt3to4: | ||
31 | #include <QCloseEvent> | ||
32 | #include <QPaintEvent> | ||
33 | #include <QResizeEvent> | ||
34 | #include <QChildEvent> | ||
35 | #include <Q3PtrList> | ||
30 | 36 | ||
31 | 37 | ||
32 | #include "kdebug.h" | 38 | #include "kdebug.h" |
33 | #include "kmainwindow.h" | 39 | #include "kmainwindow.h" |
34 | #include "kglobalsettings.h" | 40 | #include "kglobalsettings.h" |
35 | #include "kactioncollection.h" | 41 | #include "kactioncollection.h" |
36 | 42 | ||
37 | class KMainWindowPrivate { | 43 | class KMainWindowPrivate { |
38 | public: | 44 | public: |
39 | //US bool showHelpMenu:1; | 45 | //US bool showHelpMenu:1; |
40 | 46 | ||
41 | bool autoSaveSettings:1; | 47 | bool autoSaveSettings:1; |
42 | bool settingsDirty:1; | 48 | bool settingsDirty:1; |
43 | bool autoSaveWindowSize:1; | 49 | bool autoSaveWindowSize:1; |
44 | bool care_about_geometry:1; | 50 | bool care_about_geometry:1; |
45 | QString autoSaveGroup; | 51 | QString autoSaveGroup; |
46 | //US KAccel * kaccel; | 52 | //US KAccel * kaccel; |
47 | //US KMainWindowInterface *m_interface; | 53 | //US KMainWindowInterface *m_interface; |
48 | KDEPrivate::ToolBarHandler *toolBarHandler; | 54 | KDEPrivate::ToolBarHandler *toolBarHandler; |
49 | QTimer* settingsTimer; | 55 | QTimer* settingsTimer; |
50 | KToggleAction *showStatusBarAction; | 56 | KToggleAction *showStatusBarAction; |
51 | QRect defaultWindowSize; | 57 | QRect defaultWindowSize; |
52 | }; | 58 | }; |
53 | 59 | ||
54 | static bool no_query_exit = false; | 60 | static bool no_query_exit = false; |
55 | 61 | ||
56 | KMainWindow::KMainWindow( QWidget* parent, const char *name ) | 62 | KMainWindow::KMainWindow( QWidget* parent, const char *name ) |
57 | : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ | 63 | : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ |
58 | { | 64 | { |
59 | mQToolBar = 0; | 65 | mQToolBar = 0; |
60 | initKMainWindow(name); | 66 | initKMainWindow(name); |
61 | } | 67 | } |
62 | 68 | ||
63 | void KMainWindow::parseGeometry(bool parsewidth) | 69 | void KMainWindow::parseGeometry(bool parsewidth) |
64 | { | 70 | { |
65 | //US the following code is not getting used in the embedded version !! So disable it for now | 71 | //US the following code is not getting used in the embedded version !! So disable it for now |
66 | /*US | 72 | /*US |
67 | 73 | ||
68 | assert ( !kapp->geometryArgument().isNull() ); | 74 | assert ( !kapp->geometryArgument().isNull() ); |
69 | assert ( d->care_about_geometry ); | 75 | assert ( d->care_about_geometry ); |
70 | 76 | ||
71 | #ifndef Q_WS_QWS | 77 | #ifndef Q_WS_QWS |
72 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) | 78 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) |
73 | int x, y; | 79 | int x, y; |
@@ -263,33 +269,33 @@ application config. | |||
263 | } | 269 | } |
264 | 270 | ||
265 | void KMainWindow::setCaption( const QString &caption ) | 271 | void KMainWindow::setCaption( const QString &caption ) |
266 | { | 272 | { |
267 | //US setPlainCaption( kapp->makeStdCaption(caption) ); | 273 | //US setPlainCaption( kapp->makeStdCaption(caption) ); |
268 | setPlainCaption( caption ); | 274 | setPlainCaption( caption ); |
269 | } | 275 | } |
270 | 276 | ||
271 | void KMainWindow::setCaption( const QString &caption, bool modified ) | 277 | void KMainWindow::setCaption( const QString &caption, bool modified ) |
272 | { | 278 | { |
273 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); | 279 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); |
274 | setPlainCaption( caption + "modified:" ); | 280 | setPlainCaption( caption + "modified:" ); |
275 | } | 281 | } |
276 | 282 | ||
277 | void KMainWindow::setPlainCaption( const QString &caption ) | 283 | void KMainWindow::setPlainCaption( const QString &caption ) |
278 | { | 284 | { |
279 | QMainWindow::setCaption( caption ); | 285 | Q3MainWindow::setCaption( caption ); |
280 | #ifndef Q_WS_QWS | 286 | #ifndef Q_WS_QWS |
281 | //US the following is disabled for the embedded version | 287 | //US the following is disabled for the embedded version |
282 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); | 288 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); |
283 | //US info.setName( caption.utf8().data() ); | 289 | //US info.setName( caption.utf8().data() ); |
284 | #endif | 290 | #endif |
285 | } | 291 | } |
286 | 292 | ||
287 | void KMainWindow::slotStateChanged(const QString &newstate) | 293 | void KMainWindow::slotStateChanged(const QString &newstate) |
288 | { | 294 | { |
289 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); | 295 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); |
290 | } | 296 | } |
291 | 297 | ||
292 | /* | 298 | /* |
293 | * Get rid of this for KDE 4.0 | 299 | * Get rid of this for KDE 4.0 |
294 | */ | 300 | */ |
295 | void KMainWindow::slotStateChanged(const QString &newstate, | 301 | void KMainWindow::slotStateChanged(const QString &newstate, |
@@ -408,81 +414,82 @@ void KMainWindow::setStandardToolBarMenuEnabled( bool enable ) | |||
408 | } | 414 | } |
409 | 415 | ||
410 | bool KMainWindow::isStandardToolBarMenuEnabled() const | 416 | bool KMainWindow::isStandardToolBarMenuEnabled() const |
411 | { | 417 | { |
412 | return ( d->toolBarHandler != 0 ); | 418 | return ( d->toolBarHandler != 0 ); |
413 | } | 419 | } |
414 | 420 | ||
415 | void KMainWindow::createStandardStatusBarAction(){ | 421 | void KMainWindow::createStandardStatusBarAction(){ |
416 | if(!d->showStatusBarAction){ | 422 | if(!d->showStatusBarAction){ |
417 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); | 423 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); |
418 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); | 424 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); |
419 | if(internalStatusBar()) | 425 | if(internalStatusBar()) |
420 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); | 426 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); |
421 | } | 427 | } |
422 | } | 428 | } |
423 | 429 | ||
424 | QToolBar *KMainWindow::tBar( ) | 430 | Q3ToolBar *KMainWindow::tBar( ) |
425 | { | 431 | { |
426 | if ( ! mQToolBar ) | 432 | if ( ! mQToolBar ) |
427 | mQToolBar = new QToolBar( this ); | 433 | mQToolBar = new Q3ToolBar( this ); |
428 | return mQToolBar; | 434 | return mQToolBar; |
429 | } | 435 | } |
430 | 436 | ||
431 | KToolBar *KMainWindow::toolBar( const char * name ) | 437 | KToolBar *KMainWindow::toolBar( const char * name ) |
432 | { | 438 | { |
433 | 439 | ||
434 | if (!name) | 440 | if (!name) |
435 | name = "mainToolBar"; | 441 | name = "mainToolBar"; |
436 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); | 442 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); |
437 | if ( tb ) | 443 | if ( tb ) |
438 | return tb; | 444 | return tb; |
439 | bool honor_mode = (name == "mainToolBar"); | 445 | bool honor_mode = (name == "mainToolBar"); |
440 | 446 | ||
441 | /*US | 447 | /*US |
442 | if ( builderClient() ) | 448 | if ( builderClient() ) |
443 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor | 449 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor |
444 | else | 450 | else |
445 | */ | 451 | */ |
446 | return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI | 452 | return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI |
447 | } | 453 | } |
448 | 454 | ||
449 | QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() | 455 | Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator() |
450 | { | 456 | { |
451 | toolbarList.clear(); | 457 | toolbarList.clear(); |
452 | QPtrList<QToolBar> lst; | 458 | QList<Q3ToolBar*> lst; |
453 | for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { | 459 | for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) { |
454 | lst = toolBars( (ToolBarDock)i ); | 460 | lst = toolBars( (Qt::ToolBarDock)i ); |
455 | for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { | 461 | for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) { |
462 | Q3ToolBar *tb = *i; | ||
456 | if ( !tb->inherits( "KToolBar" ) ) | 463 | if ( !tb->inherits( "KToolBar" ) ) |
457 | continue; | 464 | continue; |
458 | toolbarList.append( (KToolBar*)tb ); | 465 | toolbarList.append( (KToolBar*)tb ); |
459 | } | 466 | } |
460 | } | 467 | } |
461 | return QPtrListIterator<KToolBar>( toolbarList ); | 468 | return Q3PtrListIterator<KToolBar>( toolbarList ); |
462 | } | 469 | } |
463 | 470 | ||
464 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) | 471 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) |
465 | { | 472 | { |
466 | d->autoSaveSettings = true; | 473 | d->autoSaveSettings = true; |
467 | d->autoSaveGroup = groupName; | 474 | d->autoSaveGroup = groupName; |
468 | d->autoSaveWindowSize = saveWindowSize; | 475 | d->autoSaveWindowSize = saveWindowSize; |
469 | // Get notified when the user moves a toolbar around | 476 | // Get notified when the user moves a toolbar around |
470 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), | 477 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), |
471 | //US this, SLOT( setSettingsDirty() ) ); | 478 | //US this, SLOT( setSettingsDirty() ) ); |
472 | connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), | 479 | connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ), |
473 | this, SLOT( setSettingsDirty() ) ); | 480 | this, SLOT( setSettingsDirty() ) ); |
474 | 481 | ||
475 | 482 | ||
476 | // Get default values | 483 | // Get default values |
477 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 484 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
478 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); | 485 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); |
479 | QRect desk = KGlobalSettings::desktopGeometry(0); | 486 | QRect desk = KGlobalSettings::desktopGeometry(0); |
480 | 487 | ||
481 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); | 488 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); |
482 | // Now read the previously saved settings | 489 | // Now read the previously saved settings |
483 | applyMainWindowSettings( KGlobal::config(), groupName ); | 490 | applyMainWindowSettings( KGlobal::config(), groupName ); |
484 | } | 491 | } |
485 | 492 | ||
486 | 493 | ||
487 | void KMainWindow::resetAutoSaveSettings() | 494 | void KMainWindow::resetAutoSaveSettings() |
488 | { | 495 | { |
@@ -490,33 +497,33 @@ void KMainWindow::resetAutoSaveSettings() | |||
490 | if ( d->settingsTimer ) | 497 | if ( d->settingsTimer ) |
491 | d->settingsTimer->stop(); | 498 | d->settingsTimer->stop(); |
492 | } | 499 | } |
493 | 500 | ||
494 | bool KMainWindow::autoSaveSettings() const | 501 | bool KMainWindow::autoSaveSettings() const |
495 | { | 502 | { |
496 | return d->autoSaveSettings; | 503 | return d->autoSaveSettings; |
497 | } | 504 | } |
498 | 505 | ||
499 | QString KMainWindow::autoSaveGroup() const | 506 | QString KMainWindow::autoSaveGroup() const |
500 | { | 507 | { |
501 | return d->autoSaveGroup; | 508 | return d->autoSaveGroup; |
502 | } | 509 | } |
503 | 510 | ||
504 | void KMainWindow::saveAutoSaveSettings() | 511 | void KMainWindow::saveAutoSaveSettings() |
505 | { | 512 | { |
506 | ASSERT( d->autoSaveSettings ); | 513 | Q_ASSERT( d->autoSaveSettings ); |
507 | //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; | 514 | //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; |
508 | saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); | 515 | saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); |
509 | KGlobal::config()->sync(); | 516 | KGlobal::config()->sync(); |
510 | d->settingsDirty = false; | 517 | d->settingsDirty = false; |
511 | if ( d->settingsTimer ) | 518 | if ( d->settingsTimer ) |
512 | d->settingsTimer->stop(); | 519 | d->settingsTimer->stop(); |
513 | } | 520 | } |
514 | 521 | ||
515 | void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) | 522 | void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) |
516 | { | 523 | { |
517 | // disabling the updates prevents unnecessary redraws | 524 | // disabling the updates prevents unnecessary redraws |
518 | setUpdatesEnabled( false ); | 525 | setUpdatesEnabled( false ); |
519 | 526 | ||
520 | // just in case we are rebuilding, let's remove our old client | 527 | // just in case we are rebuilding, let's remove our old client |
521 | //US guiFactory()->removeClient( this ); | 528 | //US guiFactory()->removeClient( this ); |
522 | 529 | ||
@@ -626,33 +633,33 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG | |||
626 | entryList.clear(); | 633 | entryList.clear(); |
627 | if ( mb->isHidden() ) | 634 | if ( mb->isHidden() ) |
628 | entryList.append("Disabled"); | 635 | entryList.append("Disabled"); |
629 | else | 636 | else |
630 | entryList.append("Enabled"); | 637 | entryList.append("Enabled"); |
631 | 638 | ||
632 | // By default we don't hide. | 639 | // By default we don't hide. |
633 | if(mb->isHidden()) | 640 | if(mb->isHidden()) |
634 | //US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';'); | 641 | //US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';'); |
635 | config->writeEntry(QString::fromLatin1("MenuBar"), entryList); | 642 | config->writeEntry(QString::fromLatin1("MenuBar"), entryList); |
636 | else | 643 | else |
637 | config->deleteEntry(QString::fromLatin1("MenuBar")); | 644 | config->deleteEntry(QString::fromLatin1("MenuBar")); |
638 | } | 645 | } |
639 | 646 | ||
640 | int n = 1; // Toolbar counter. toolbars are counted from 1, | 647 | int n = 1; // Toolbar counter. toolbars are counted from 1, |
641 | KToolBar *toolbar = 0; | 648 | KToolBar *toolbar = 0; |
642 | QPtrListIterator<KToolBar> it( toolBarIterator() ); | 649 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); |
643 | while ( ( toolbar = it.current() ) ) { | 650 | while ( ( toolbar = it.current() ) ) { |
644 | ++it; | 651 | ++it; |
645 | QString group; | 652 | QString group; |
646 | if (!configGroup.isEmpty()) | 653 | if (!configGroup.isEmpty()) |
647 | { | 654 | { |
648 | // Give a number to the toolbar, but prefer a name if there is one, | 655 | // Give a number to the toolbar, but prefer a name if there is one, |
649 | // because there's no real guarantee on the ordering of toolbars | 656 | // because there's no real guarantee on the ordering of toolbars |
650 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); | 657 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); |
651 | group.prepend(" Toolbar"); | 658 | group.prepend(" Toolbar"); |
652 | group.prepend(configGroup); | 659 | group.prepend(configGroup); |
653 | } | 660 | } |
654 | toolbar->saveSettings(config, group); | 661 | toolbar->saveSettings(config, group); |
655 | n++; | 662 | n++; |
656 | } | 663 | } |
657 | if (!configGroup.isEmpty()) | 664 | if (!configGroup.isEmpty()) |
658 | config->setGroup(oldGroup); | 665 | config->setGroup(oldGroup); |
@@ -701,75 +708,77 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config | |||
701 | //US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';'); | 708 | //US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';'); |
702 | entryList = config->readListEntry (QString::fromLatin1("StatusBar")); | 709 | entryList = config->readListEntry (QString::fromLatin1("StatusBar")); |
703 | entry = entryList.first(); | 710 | entry = entryList.first(); |
704 | if (entry == QString::fromLatin1("Disabled")) | 711 | if (entry == QString::fromLatin1("Disabled")) |
705 | sb->hide(); | 712 | sb->hide(); |
706 | else | 713 | else |
707 | sb->show(); | 714 | sb->show(); |
708 | if(d->showStatusBarAction) | 715 | if(d->showStatusBarAction) |
709 | d->showStatusBarAction->setChecked(!sb->isHidden()); | 716 | d->showStatusBarAction->setChecked(!sb->isHidden()); |
710 | } | 717 | } |
711 | 718 | ||
712 | QMenuBar* mb = internalMenuBar(); | 719 | QMenuBar* mb = internalMenuBar(); |
713 | if (mb) { | 720 | if (mb) { |
714 | entryList.clear(); | 721 | entryList.clear(); |
715 | //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); | 722 | //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); |
716 | entryList = config->readListEntry (QString::fromLatin1("MenuBar")); | 723 | entryList = config->readListEntry (QString::fromLatin1("MenuBar")); |
717 | entry = entryList.first(); | 724 | if(!entryList.empty()) { |
718 | if (entry==QString::fromLatin1("Disabled")) | 725 | entry = entryList.first(); |
719 | { | 726 | if (entry==QString::fromLatin1("Disabled")) |
720 | mb->hide(); | 727 | { |
721 | } else | 728 | mb->hide(); |
722 | { | 729 | } else |
723 | mb->show(); | 730 | { |
724 | } | 731 | mb->show(); |
732 | } | ||
733 | } | ||
725 | } | 734 | } |
726 | 735 | ||
727 | int n = 1; // Toolbar counter. toolbars are counted from 1, | 736 | int n = 1; // Toolbar counter. toolbars are counted from 1, |
728 | KToolBar *toolbar; | 737 | KToolBar *toolbar; |
729 | QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator | 738 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator |
730 | 739 | ||
731 | for ( ; it.current(); ++it) { | 740 | for ( ; it.current(); ++it) { |
732 | toolbar= it.current(); | 741 | toolbar= it.current(); |
733 | QString group; | 742 | QString group; |
734 | if (!configGroup.isEmpty()) | 743 | if (!configGroup.isEmpty()) |
735 | { | 744 | { |
736 | // Give a number to the toolbar, but prefer a name if there is one, | 745 | // Give a number to the toolbar, but prefer a name if there is one, |
737 | // because there's no real guarantee on the ordering of toolbars | 746 | // because there's no real guarantee on the ordering of toolbars |
738 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); | 747 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); |
739 | group.prepend(" Toolbar"); | 748 | group.prepend(" Toolbar"); |
740 | group.prepend(configGroup); | 749 | group.prepend(configGroup); |
741 | } | 750 | } |
742 | toolbar->applySettings(config, group); | 751 | toolbar->applySettings(config, group); |
743 | n++; | 752 | n++; |
744 | } | 753 | } |
745 | 754 | ||
746 | finalizeGUI( true ); | 755 | finalizeGUI( true ); |
747 | } | 756 | } |
748 | 757 | ||
749 | void KMainWindow::finalizeGUI( bool force ) | 758 | void KMainWindow::finalizeGUI( bool force ) |
750 | { | 759 | { |
751 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; | 760 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; |
752 | // The whole reason for this is that moveToolBar relies on the indexes | 761 | // The whole reason for this is that moveToolBar relies on the indexes |
753 | // of the other toolbars, so in theory it should be called only once per | 762 | // of the other toolbars, so in theory it should be called only once per |
754 | // toolbar, but in increasing order of indexes. | 763 | // toolbar, but in increasing order of indexes. |
755 | // Since we can't do that immediately, we move them, and _then_ | 764 | // Since we can't do that immediately, we move them, and _then_ |
756 | // we call positionYourself again for each of them, but this time | 765 | // we call positionYourself again for each of them, but this time |
757 | // the toolbariterator should give them in the proper order. | 766 | // the toolbariterator should give them in the proper order. |
758 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. | 767 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. |
759 | QPtrListIterator<KToolBar> it( toolBarIterator() ); | 768 | Q3PtrListIterator<KToolBar> it( toolBarIterator() ); |
760 | for ( ; it.current() ; ++ it ) | 769 | for ( ; it.current() ; ++ it ) |
761 | it.current()->positionYourself( force ); | 770 | it.current()->positionYourself( force ); |
762 | 771 | ||
763 | d->settingsDirty = false; | 772 | d->settingsDirty = false; |
764 | } | 773 | } |
765 | 774 | ||
766 | void KMainWindow::saveWindowSize( KConfig * config ) const | 775 | void KMainWindow::saveWindowSize( KConfig * config ) const |
767 | { | 776 | { |
768 | /*US | 777 | /*US |
769 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 778 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
770 | QRect desk = QApplication::desktop()->screenGeometry(scnum); | 779 | QRect desk = QApplication::desktop()->screenGeometry(scnum); |
771 | */ | 780 | */ |
772 | QRect desk = KGlobalSettings::desktopGeometry(0); | 781 | QRect desk = KGlobalSettings::desktopGeometry(0); |
773 | 782 | ||
774 | QRect size( desk.width(), width(), desk.height(), height() ); | 783 | QRect size( desk.width(), width(), desk.height(), height() ); |
775 | if(size != d->defaultWindowSize){ | 784 | if(size != d->defaultWindowSize){ |
@@ -838,125 +847,113 @@ void KMainWindow::setSettingsDirty() | |||
838 | } | 847 | } |
839 | 848 | ||
840 | bool KMainWindow::settingsDirty() const | 849 | bool KMainWindow::settingsDirty() const |
841 | { | 850 | { |
842 | return d->settingsDirty; | 851 | return d->settingsDirty; |
843 | } | 852 | } |
844 | 853 | ||
845 | QString KMainWindow::settingsGroup() const | 854 | QString KMainWindow::settingsGroup() const |
846 | { | 855 | { |
847 | return d->autoSaveGroup; | 856 | return d->autoSaveGroup; |
848 | } | 857 | } |
849 | 858 | ||
850 | void KMainWindow::resizeEvent( QResizeEvent * e) | 859 | void KMainWindow::resizeEvent( QResizeEvent * e) |
851 | { | 860 | { |
852 | if ( d->autoSaveWindowSize ) | 861 | if ( d->autoSaveWindowSize ) |
853 | setSettingsDirty(); | 862 | setSettingsDirty(); |
854 | QMainWindow::resizeEvent( e ); | 863 | Q3MainWindow::resizeEvent( e ); |
855 | } | 864 | } |
856 | 865 | ||
857 | bool KMainWindow::hasMenuBar() | 866 | bool KMainWindow::hasMenuBar() |
858 | { | 867 | { |
859 | return (internalMenuBar()); | 868 | return (internalMenuBar()); |
860 | } | 869 | } |
861 | 870 | ||
862 | //US KMenuBar *KMainWindow::menuBar() | 871 | //US KMenuBar *KMainWindow::menuBar() |
863 | QMenuBar *KMainWindow::menuBar() | 872 | QMenuBar *KMainWindow::menuBar() |
864 | { | 873 | { |
865 | //US KMenuBar * mb = internalMenuBar(); | 874 | //US KMenuBar * mb = internalMenuBar(); |
866 | QMenuBar * mb = internalMenuBar(); | 875 | QMenuBar * mb = internalMenuBar(); |
867 | if ( !mb ) { | 876 | if ( !mb ) { |
868 | //US mb = new KMenuBar( this ); | 877 | //US mb = new KMenuBar( this ); |
869 | mb = new QMenuBar( this ); | 878 | mb = new QMenuBar( this ); |
870 | // trigger a re-layout and trigger a call to the private | 879 | // trigger a re-layout and trigger a call to the private |
871 | // setMenuBar method. | 880 | // setMenuBar method. |
872 | QMainWindow::menuBar(); | 881 | Q3MainWindow::menuBar(); |
873 | } | 882 | } |
874 | return mb; | 883 | return mb; |
875 | } | 884 | } |
876 | 885 | ||
877 | //US KStatusBar *KMainWindow::statusBar() | 886 | //US KStatusBar *KMainWindow::statusBar() |
878 | QStatusBar *KMainWindow::statusBar() | 887 | QStatusBar *KMainWindow::statusBar() |
879 | { | 888 | { |
880 | //US KStatusBar * sb = internalStatusBar(); | 889 | //US KStatusBar * sb = internalStatusBar(); |
881 | QStatusBar * sb = internalStatusBar(); | 890 | QStatusBar * sb = internalStatusBar(); |
882 | if ( !sb ) { | 891 | if ( !sb ) { |
883 | //US sb = new KStatusBar( this ); | 892 | //US sb = new KStatusBar( this ); |
884 | sb = new QStatusBar( this ); | 893 | sb = new QStatusBar( this ); |
885 | // trigger a re-layout and trigger a call to the private | 894 | // trigger a re-layout and trigger a call to the private |
886 | // setStatusBar method. | 895 | // setStatusBar method. |
887 | QMainWindow::statusBar(); | 896 | Q3MainWindow::statusBar(); |
888 | } | 897 | } |
889 | return sb; | 898 | return sb; |
890 | } | 899 | } |
891 | 900 | ||
892 | void KMainWindow::shuttingDown() | 901 | void KMainWindow::shuttingDown() |
893 | { | 902 | { |
894 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy | 903 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy |
895 | // when queryExit() shows a dialog. Check before removing! | 904 | // when queryExit() shows a dialog. Check before removing! |
896 | static bool reentrancy_protection = false; | 905 | static bool reentrancy_protection = false; |
897 | if (!reentrancy_protection) | 906 | if (!reentrancy_protection) |
898 | { | 907 | { |
899 | reentrancy_protection = true; | 908 | reentrancy_protection = true; |
900 | // call the virtual queryExit | 909 | // call the virtual queryExit |
901 | queryExit(); | 910 | queryExit(); |
902 | reentrancy_protection = false; | 911 | reentrancy_protection = false; |
903 | } | 912 | } |
904 | 913 | ||
905 | } | 914 | } |
906 | 915 | ||
907 | //US KMenuBar *KMainWindow::internalMenuBar() | 916 | //US KMenuBar *KMainWindow::internalMenuBar() |
908 | QMenuBar *KMainWindow::internalMenuBar() | 917 | QMenuBar *KMainWindow::internalMenuBar() |
909 | { | 918 | { |
910 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); | 919 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); |
911 | QObjectList *l = queryList( "QMenuBar", 0, false, false ); | 920 | QObjectList l = queryList( "QMenuBar", 0, false, false ); |
912 | if ( !l || !l->first() ) { | 921 | if(l.empty()) |
913 | delete l; | 922 | return 0; |
914 | return 0; | 923 | return (QMenuBar*)l.front(); |
915 | } | ||
916 | |||
917 | //US KMenuBar *m = (KMenuBar*)l->first(); | ||
918 | QMenuBar *m = (QMenuBar*)l->first(); | ||
919 | delete l; | ||
920 | return m; | ||
921 | } | 924 | } |
922 | 925 | ||
923 | //US KStatusBar *KMainWindow::internalStatusBar() | 926 | //US KStatusBar *KMainWindow::internalStatusBar() |
924 | QStatusBar *KMainWindow::internalStatusBar() | 927 | QStatusBar *KMainWindow::internalStatusBar() |
925 | { | 928 | { |
926 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); | 929 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); |
927 | QObjectList *l = queryList( "QStatusBar", 0, false, false ); | 930 | QObjectList l = queryList( "QStatusBar", 0, false, false ); |
928 | if ( !l || !l->first() ) { | 931 | if(l.empty()) |
929 | delete l; | 932 | return 0; |
930 | return 0; | 933 | return (QStatusBar*)l.front(); |
931 | } | ||
932 | |||
933 | //US KStatusBar *s = (KStatusBar*)l->first(); | ||
934 | QStatusBar *s = (QStatusBar*)l->first(); | ||
935 | delete l; | ||
936 | return s; | ||
937 | } | 934 | } |
938 | 935 | ||
939 | void KMainWindow::childEvent( QChildEvent* e) | 936 | void KMainWindow::childEvent( QChildEvent* e) |
940 | { | 937 | { |
941 | QMainWindow::childEvent( e ); | 938 | Q3MainWindow::childEvent( e ); |
942 | } | 939 | } |
943 | 940 | ||
944 | void KMainWindow::paintEvent( QPaintEvent * e) | 941 | void KMainWindow::paintEvent( QPaintEvent * e) |
945 | { | 942 | { |
946 | QMainWindow::paintEvent( e ); | 943 | Q3MainWindow::paintEvent( e ); |
947 | } | 944 | } |
948 | 945 | ||
949 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) | 946 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) |
950 | { | 947 | { |
951 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); | 948 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); |
952 | if (tb && !tb->isHidden()) { | 949 | if (tb && !tb->isHidden()) { |
953 | switch( tb->barPos() ) | 950 | switch( tb->barPos() ) |
954 | { | 951 | { |
955 | case KToolBar::Top: | 952 | case KToolBar::Top: |
956 | case KToolBar::Bottom: | 953 | case KToolBar::Bottom: |
957 | size += QSize(0, tb->sizeHint().height()); | 954 | size += QSize(0, tb->sizeHint().height()); |
958 | break; | 955 | break; |
959 | 956 | ||
960 | case KToolBar::Left: | 957 | case KToolBar::Left: |
961 | case KToolBar::Right: | 958 | case KToolBar::Right: |
962 | size += QSize(toolBar()->sizeHint().width(), 0); | 959 | size += QSize(toolBar()->sizeHint().width(), 0); |
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h index 2dc8033..a3ac82f 100644 --- a/microkde/kdeui/kmainwindow.h +++ b/microkde/kdeui/kmainwindow.h | |||
@@ -1,16 +1,21 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <QResizeEvent> | ||
3 | #include <QChildEvent> | ||
4 | #include <QCloseEvent> | ||
5 | #include <QPaintEvent> | ||
1 | /* | 6 | /* |
2 | This file is part of the KDE libraries | 7 | This file is part of the KDE libraries |
3 | 8 | ||
4 | This library is free software; you can redistribute it and/or | 9 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 10 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 11 | License version 2 as published by the Free Software Foundation. |
7 | 12 | ||
8 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 16 | Library General Public License for more details. |
12 | 17 | ||
13 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
@@ -37,38 +42,38 @@ class KHelpMenu; | |||
37 | class KStatusBar; | 42 | class KStatusBar; |
38 | class QStatusBar; | 43 | class QStatusBar; |
39 | class KMenuBar; | 44 | class KMenuBar; |
40 | class KMWSessionManaged; | 45 | class KMWSessionManaged; |
41 | class KAccel; | 46 | class KAccel; |
42 | class KToolBarMenuAction; | 47 | class KToolBarMenuAction; |
43 | */ | 48 | */ |
44 | 49 | ||
45 | class QMenuBar; | 50 | class QMenuBar; |
46 | class QStatusBar; | 51 | class QStatusBar; |
47 | class KMainWindowPrivate; | 52 | class KMainWindowPrivate; |
48 | class KAction; | 53 | class KAction; |
49 | 54 | ||
50 | #include <ktoolbar.h> | 55 | #include <ktoolbar.h> |
51 | #include <ktoolbarhandler.h> | 56 | #include <ktoolbarhandler.h> |
52 | #include <kxmlguiclient.h> | 57 | #include <kxmlguiclient.h> |
53 | #include <qmainwindow.h> | 58 | #include <q3mainwindow.h> |
54 | #include <qptrlist.h> | 59 | #include <q3ptrlist.h> |
55 | 60 | ||
56 | class KActionCollection; | 61 | class KActionCollection; |
57 | 62 | ||
58 | class KMainWindow : public QMainWindow, virtual public KXMLGUIClient | 63 | class KMainWindow : public Q3MainWindow, virtual public KXMLGUIClient |
59 | { | 64 | { |
60 | Q_OBJECT | 65 | Q_OBJECT |
61 | 66 | ||
62 | private: | 67 | private: |
63 | //US create private defaultconstructor | 68 | //US create private defaultconstructor |
64 | KMainWindow() {;}; | 69 | KMainWindow() {;}; |
65 | 70 | ||
66 | 71 | ||
67 | public: | 72 | public: |
68 | /** | 73 | /** |
69 | * Construct a main window. | 74 | * Construct a main window. |
70 | * | 75 | * |
71 | * @param parent The widget parent. This is usually 0 but it may also be the window | 76 | * @param parent The widget parent. This is usually 0 but it may also be the window |
72 | * group leader. In that case, the KMainWindow becomes sort of a | 77 | * group leader. In that case, the KMainWindow becomes sort of a |
73 | * secondary window. | 78 | * secondary window. |
74 | * | 79 | * |
@@ -307,38 +312,38 @@ public: | |||
307 | * List of members of KMainWindow class. | 312 | * List of members of KMainWindow class. |
308 | */ | 313 | */ |
309 | //US static QPtrList<KMainWindow>* memberList; | 314 | //US static QPtrList<KMainWindow>* memberList; |
310 | 315 | ||
311 | /** | 316 | /** |
312 | * Returns a pointer to the toolbar with the specified name. | 317 | * Returns a pointer to the toolbar with the specified name. |
313 | * This refers to toolbars created dynamically from the XML UI | 318 | * This refers to toolbars created dynamically from the XML UI |
314 | * framework. If the toolbar does not exist one will be created. | 319 | * framework. If the toolbar does not exist one will be created. |
315 | * | 320 | * |
316 | * @param name The internal name of the toolbar. If no name is | 321 | * @param name The internal name of the toolbar. If no name is |
317 | * specified "mainToolBar" is assumed. | 322 | * specified "mainToolBar" is assumed. |
318 | * | 323 | * |
319 | * @return A pointer to the toolbar | 324 | * @return A pointer to the toolbar |
320 | **/ | 325 | **/ |
321 | KToolBar *toolBar( const char *name=0 ); | 326 | KToolBar *toolBar( const char *name=0 ); |
322 | // method for getting rid of KDE-Crap | 327 | // method for getting rid of KDE-Crap |
323 | QToolBar *tBar( ); | 328 | Q3ToolBar *tBar( ); |
324 | 329 | ||
325 | /** | 330 | /** |
326 | * @return An iterator over the list of all toolbars for this window. | 331 | * @return An iterator over the list of all toolbars for this window. |
327 | */ | 332 | */ |
328 | QPtrListIterator<KToolBar> toolBarIterator(); | 333 | Q3PtrListIterator<KToolBar> toolBarIterator(); |
329 | 334 | ||
330 | /** | 335 | /** |
331 | * @return A KAccel instance bound to this mainwindow. Used automatically | 336 | * @return A KAccel instance bound to this mainwindow. Used automatically |
332 | * by KAction to make keybindings work in all cases. | 337 | * by KAction to make keybindings work in all cases. |
333 | */ | 338 | */ |
334 | KAccel *accel(); | 339 | KAccel *accel(); |
335 | 340 | ||
336 | void setFrameBorderWidth( int ) {} | 341 | void setFrameBorderWidth( int ) {} |
337 | 342 | ||
338 | /** | 343 | /** |
339 | * Call this to enable "auto-save" of toolbar/menubar/statusbar settings | 344 | * Call this to enable "auto-save" of toolbar/menubar/statusbar settings |
340 | * (and optionally window size). | 345 | * (and optionally window size). |
341 | * If the *bars were moved around/shown/hidden when the window is closed, | 346 | * If the *bars were moved around/shown/hidden when the window is closed, |
342 | * saveMainWindowSettings( KGlobal::config(), groupName ) will be called. | 347 | * saveMainWindowSettings( KGlobal::config(), groupName ) will be called. |
343 | * | 348 | * |
344 | * @param groupName a name that identifies this "type of window". | 349 | * @param groupName a name that identifies this "type of window". |
@@ -745,33 +750,33 @@ protected slots: | |||
745 | * { | 750 | * { |
746 | * <activate your custom dialog> | 751 | * <activate your custom dialog> |
747 | * } | 752 | * } |
748 | * </pre> | 753 | * </pre> |
749 | */ | 754 | */ |
750 | //US virtual void showAboutApplication(); | 755 | //US virtual void showAboutApplication(); |
751 | 756 | ||
752 | private slots: | 757 | private slots: |
753 | /** | 758 | /** |
754 | * Called when the app is shutting down. | 759 | * Called when the app is shutting down. |
755 | */ | 760 | */ |
756 | void shuttingDown(); | 761 | void shuttingDown(); |
757 | 762 | ||
758 | void saveAutoSaveSettings(); | 763 | void saveAutoSaveSettings(); |
759 | 764 | ||
760 | private: | 765 | private: |
761 | QToolBar * mQToolBar; | 766 | Q3ToolBar * mQToolBar; |
762 | //US KMenuBar *internalMenuBar(); | 767 | //US KMenuBar *internalMenuBar(); |
763 | QMenuBar *internalMenuBar(); | 768 | QMenuBar *internalMenuBar(); |
764 | //US KStatusBar *internalStatusBar(); | 769 | //US KStatusBar *internalStatusBar(); |
765 | QStatusBar *internalStatusBar(); | 770 | QStatusBar *internalStatusBar(); |
766 | 771 | ||
767 | KMainWindowPrivate *d; | 772 | KMainWindowPrivate *d; |
768 | void initKMainWindow(const char *name); | 773 | void initKMainWindow(const char *name); |
769 | 774 | ||
770 | QPtrList<KToolBar> toolbarList; | 775 | Q3PtrList<KToolBar> toolbarList; |
771 | 776 | ||
772 | protected: | 777 | protected: |
773 | virtual void virtual_hook( int id, void* data ); | 778 | virtual void virtual_hook( int id, void* data ); |
774 | 779 | ||
775 | }; | 780 | }; |
776 | 781 | ||
777 | #endif | 782 | #endif |
diff --git a/microkde/kdeui/knuminput.cpp b/microkde/kdeui/knuminput.cpp index 335d6f4..da01a20 100644 --- a/microkde/kdeui/knuminput.cpp +++ b/microkde/kdeui/knuminput.cpp | |||
@@ -29,32 +29,35 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | //US #include <config.h> | 31 | //US #include <config.h> |
32 | #ifdef HAVE_LIMITS_H | 32 | #ifdef HAVE_LIMITS_H |
33 | #include <limits.h> | 33 | #include <limits.h> |
34 | #endif | 34 | #endif |
35 | #include <assert.h> | 35 | #include <assert.h> |
36 | #include <math.h> | 36 | #include <math.h> |
37 | #include <algorithm> | 37 | #include <algorithm> |
38 | 38 | ||
39 | #include <qlabel.h> | 39 | #include <qlabel.h> |
40 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
41 | #include <qsize.h> | 41 | #include <qsize.h> |
42 | #include <qslider.h> | 42 | #include <qslider.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | #include <qstyle.h> | 44 | #include <qstyle.h> |
45 | //Added by qt3to4: | ||
46 | #include <QResizeEvent> | ||
47 | #include <QEvent> | ||
45 | 48 | ||
46 | #include <kglobal.h> | 49 | #include <kglobal.h> |
47 | #include <klocale.h> | 50 | #include <klocale.h> |
48 | #include <kdebug.h> | 51 | #include <kdebug.h> |
49 | 52 | ||
50 | #include "knumvalidator.h" | 53 | #include "knumvalidator.h" |
51 | #include "knuminput.h" | 54 | #include "knuminput.h" |
52 | 55 | ||
53 | static inline int calcDiffByTen( int x, int y ) { | 56 | static inline int calcDiffByTen( int x, int y ) { |
54 | // calculate ( x - y ) / 10 without overflowing ints: | 57 | // calculate ( x - y ) / 10 without overflowing ints: |
55 | return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10; | 58 | return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10; |
56 | } | 59 | } |
57 | 60 | ||
58 | // ---------------------------------------------------------------------------- | 61 | // ---------------------------------------------------------------------------- |
59 | 62 | ||
60 | KNumInput::KNumInput(QWidget* parent, const char* name) | 63 | KNumInput::KNumInput(QWidget* parent, const char* name) |
@@ -93,58 +96,58 @@ KNumInput::~KNumInput() | |||
93 | m_prev->m_next = m_next; | 96 | m_prev->m_next = m_next; |
94 | 97 | ||
95 | if(m_next) | 98 | if(m_next) |
96 | m_next->m_prev = m_prev; | 99 | m_next->m_prev = m_prev; |
97 | } | 100 | } |
98 | 101 | ||
99 | void KNumInput::setLabel(const QString & label, int a) | 102 | void KNumInput::setLabel(const QString & label, int a) |
100 | { | 103 | { |
101 | if(label.isEmpty()) { | 104 | if(label.isEmpty()) { |
102 | delete m_label; | 105 | delete m_label; |
103 | m_label = 0; | 106 | m_label = 0; |
104 | m_alignment = 0; | 107 | m_alignment = 0; |
105 | } | 108 | } |
106 | else { | 109 | else { |
107 | if (m_label) m_label->setText(label); | 110 | if (m_label) m_label->setText(label); |
108 | else m_label = new QLabel(label, this, "KNumInput::QLabel"); | 111 | else m_label = new QLabel(label, this, "KNumInput::QLabel"); |
109 | m_label->setAlignment((a & (~(AlignTop|AlignBottom|AlignVCenter))) | 112 | m_label->setAlignment((a & (~(Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter))) |
110 | | AlignVCenter); | 113 | | Qt::AlignVCenter); |
111 | // if no vertical alignment set, use Top alignment | 114 | // if no vertical alignment set, use Top alignment |
112 | if(!(a & (AlignTop|AlignBottom|AlignVCenter))) | 115 | if(!(a & (Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter))) |
113 | a |= AlignTop; | 116 | a |= Qt::AlignTop; |
114 | m_alignment = a; | 117 | m_alignment = a; |
115 | } | 118 | } |
116 | 119 | ||
117 | layout(true); | 120 | layout(true); |
118 | } | 121 | } |
119 | 122 | ||
120 | QString KNumInput::label() const | 123 | QString KNumInput::label() const |
121 | { | 124 | { |
122 | if (m_label) return m_label->text(); | 125 | if (m_label) return m_label->text(); |
123 | return QString::null; | 126 | return QString::null; |
124 | } | 127 | } |
125 | 128 | ||
126 | void KNumInput::layout(bool deep) | 129 | void KNumInput::layout(bool deep) |
127 | { | 130 | { |
128 | int w1 = m_colw1; | 131 | int w1 = m_colw1; |
129 | int w2 = m_colw2; | 132 | int w2 = m_colw2; |
130 | 133 | ||
131 | // label sizeHint | 134 | // label sizeHint |
132 | m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0)); | 135 | m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0)); |
133 | 136 | ||
134 | if(m_label && (m_alignment & AlignVCenter)) | 137 | if(m_label && (m_alignment & Qt::AlignVCenter)) |
135 | m_colw1 = m_sizeLabel.width() + 4; | 138 | m_colw1 = m_sizeLabel.width() + 4; |
136 | else | 139 | else |
137 | m_colw1 = 0; | 140 | m_colw1 = 0; |
138 | 141 | ||
139 | // slider sizeHint | 142 | // slider sizeHint |
140 | m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0)); | 143 | m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0)); |
141 | 144 | ||
142 | doLayout(); | 145 | doLayout(); |
143 | 146 | ||
144 | if(!deep) { | 147 | if(!deep) { |
145 | m_colw1 = w1; | 148 | m_colw1 = w1; |
146 | m_colw2 = w2; | 149 | m_colw2 = w2; |
147 | return; | 150 | return; |
148 | } | 151 | } |
149 | 152 | ||
150 | KNumInput* p = this; | 153 | KNumInput* p = this; |
@@ -189,76 +192,76 @@ QSize KNumInput::sizeHint() const | |||
189 | { | 192 | { |
190 | return minimumSizeHint(); | 193 | return minimumSizeHint(); |
191 | } | 194 | } |
192 | 195 | ||
193 | void KNumInput::setSteps(int minor, int major) | 196 | void KNumInput::setSteps(int minor, int major) |
194 | { | 197 | { |
195 | if(m_slider) | 198 | if(m_slider) |
196 | m_slider->setSteps( minor, major ); | 199 | m_slider->setSteps( minor, major ); |
197 | } | 200 | } |
198 | 201 | ||
199 | 202 | ||
200 | // ---------------------------------------------------------------------------- | 203 | // ---------------------------------------------------------------------------- |
201 | 204 | ||
202 | KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name) | 205 | KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name) |
203 | : QSpinBox(0, 99, 1, parent, name) | 206 | : QSpinBox(0, 99, 1, parent, name) |
204 | { | 207 | { |
205 | editor()->setAlignment(AlignRight); | 208 | setAlignment(Qt::AlignRight); |
206 | val_base = 10; | 209 | val_base = 10; |
207 | setValue(0); | 210 | setValue(0); |
208 | } | 211 | } |
209 | 212 | ||
210 | KIntSpinBox::~KIntSpinBox() | 213 | KIntSpinBox::~KIntSpinBox() |
211 | { | 214 | { |
212 | } | 215 | } |
213 | 216 | ||
214 | KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base, | 217 | KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base, |
215 | QWidget* parent, const char* name) | 218 | QWidget* parent, const char* name) |
216 | : QSpinBox(lower, upper, step, parent, name) | 219 | : QSpinBox(lower, upper, step, parent, name) |
217 | { | 220 | { |
218 | editor()->setAlignment(AlignRight); | 221 | setAlignment(Qt::AlignRight); |
219 | val_base = base; | 222 | val_base = base; |
220 | setValue(value); | 223 | setValue(value); |
221 | } | 224 | } |
222 | 225 | ||
223 | void KIntSpinBox::setBase(int base) | 226 | void KIntSpinBox::setBase(int base) |
224 | { | 227 | { |
225 | val_base = base; | 228 | val_base = base; |
226 | } | 229 | } |
227 | 230 | ||
228 | 231 | ||
229 | int KIntSpinBox::base() const | 232 | int KIntSpinBox::base() const |
230 | { | 233 | { |
231 | return val_base; | 234 | return val_base; |
232 | } | 235 | } |
233 | 236 | ||
234 | QString KIntSpinBox::mapValueToText(int v) | 237 | QString KIntSpinBox::mapValueToText(int v) |
235 | { | 238 | { |
236 | return QString::number(v, val_base); | 239 | return QString::number(v, val_base); |
237 | } | 240 | } |
238 | 241 | ||
239 | int KIntSpinBox::mapTextToValue(bool* ok) | 242 | int KIntSpinBox::mapTextToValue(bool* ok) |
240 | { | 243 | { |
241 | return cleanText().toInt(ok, val_base); | 244 | return cleanText().toInt(ok, val_base); |
242 | } | 245 | } |
243 | 246 | ||
244 | void KIntSpinBox::setEditFocus(bool mark) | 247 | void KIntSpinBox::setEditFocus(bool mark) |
245 | { | 248 | { |
246 | editor()->setFocus(); | 249 | setFocus(); |
247 | if(mark) | 250 | if(mark) |
248 | editor()->selectAll(); | 251 | selectAll(); |
249 | } | 252 | } |
250 | 253 | ||
251 | 254 | ||
252 | // ---------------------------------------------------------------------------- | 255 | // ---------------------------------------------------------------------------- |
253 | 256 | ||
254 | class KIntNumInput::KIntNumInputPrivate { | 257 | class KIntNumInput::KIntNumInputPrivate { |
255 | public: | 258 | public: |
256 | int referencePoint; | 259 | int referencePoint; |
257 | short blockRelative; | 260 | short blockRelative; |
258 | KIntNumInputPrivate( int r ) | 261 | KIntNumInputPrivate( int r ) |
259 | : referencePoint( r ), | 262 | : referencePoint( r ), |
260 | blockRelative( 0 ) {} | 263 | blockRelative( 0 ) {} |
261 | }; | 264 | }; |
262 | 265 | ||
263 | 266 | ||
264 | KIntNumInput::KIntNumInput(KNumInput* below, int val, QWidget* parent, | 267 | KIntNumInput::KIntNumInput(KNumInput* below, int val, QWidget* parent, |
@@ -312,76 +315,76 @@ void KIntNumInput::spinValueChanged(int val) | |||
312 | emit valueChanged(val); | 315 | emit valueChanged(val); |
313 | } | 316 | } |
314 | 317 | ||
315 | void KIntNumInput::slotEmitRelativeValueChanged( int value ) { | 318 | void KIntNumInput::slotEmitRelativeValueChanged( int value ) { |
316 | if ( d->blockRelative || !d->referencePoint ) return; | 319 | if ( d->blockRelative || !d->referencePoint ) return; |
317 | emit relativeValueChanged( double( value ) / double( d->referencePoint ) ); | 320 | emit relativeValueChanged( double( value ) / double( d->referencePoint ) ); |
318 | } | 321 | } |
319 | 322 | ||
320 | void KIntNumInput::setRange(int lower, int upper, int step, bool slider) | 323 | void KIntNumInput::setRange(int lower, int upper, int step, bool slider) |
321 | { | 324 | { |
322 | upper = kMax(upper, lower); | 325 | upper = kMax(upper, lower); |
323 | lower = kMin(upper, lower); | 326 | lower = kMin(upper, lower); |
324 | m_spin->setMinValue(lower); | 327 | m_spin->setMinValue(lower); |
325 | m_spin->setMaxValue(upper); | 328 | m_spin->setMaxValue(upper); |
326 | m_spin->setLineStep(step); | 329 | m_spin->setLineStep(step); |
327 | 330 | ||
328 | step = m_spin->lineStep(); // maybe QRangeControl didn't like out lineStep? | 331 | step = m_spin->singleStep(); // maybe QRangeControl didn't like out lineStep? |
329 | 332 | ||
330 | if(slider) { | 333 | if(slider) { |
331 | if (m_slider) | 334 | if (m_slider) |
332 | m_slider->setRange(lower, upper); | 335 | m_slider->setRange(lower, upper); |
333 | else { | 336 | else { |
334 | m_slider = new QSlider(lower, upper, step, m_spin->value(), | 337 | m_slider = new QSlider(lower, upper, step, m_spin->value(), |
335 | QSlider::Horizontal, this); | 338 | Qt::Horizontal, this); |
336 | m_slider->setTickmarks(QSlider::Below); | 339 | m_slider->setTickmarks(QSlider::Below); |
337 | connect(m_slider, SIGNAL(valueChanged(int)), | 340 | connect(m_slider, SIGNAL(valueChanged(int)), |
338 | m_spin, SLOT(setValue(int))); | 341 | m_spin, SLOT(setValue(int))); |
339 | } | 342 | } |
340 | 343 | ||
341 | // calculate (upper-lower)/10 without overflowing int's: | 344 | // calculate (upper-lower)/10 without overflowing int's: |
342 | int major = calcDiffByTen( upper, lower ); | 345 | int major = calcDiffByTen( upper, lower ); |
343 | if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4 | 346 | if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4 |
344 | 347 | ||
345 | m_slider->setSteps(step, major); | 348 | m_slider->setSteps(step, major); |
346 | m_slider->setTickInterval(major); | 349 | m_slider->setTickInterval(major); |
347 | } | 350 | } |
348 | else { | 351 | else { |
349 | delete m_slider; | 352 | delete m_slider; |
350 | m_slider = 0; | 353 | m_slider = 0; |
351 | } | 354 | } |
352 | 355 | ||
353 | // check that reference point is still inside valid range: | 356 | // check that reference point is still inside valid range: |
354 | setReferencePoint( referencePoint() ); | 357 | setReferencePoint( referencePoint() ); |
355 | 358 | ||
356 | layout(true); | 359 | layout(true); |
357 | } | 360 | } |
358 | 361 | ||
359 | void KIntNumInput::setMinValue(int min) | 362 | void KIntNumInput::setMinValue(int min) |
360 | { | 363 | { |
361 | setRange(min, m_spin->maxValue(), m_spin->lineStep(), m_slider); | 364 | setRange(min, m_spin->maxValue(), m_spin->singleStep(), m_slider); |
362 | } | 365 | } |
363 | 366 | ||
364 | int KIntNumInput::minValue() const | 367 | int KIntNumInput::minValue() const |
365 | { | 368 | { |
366 | return m_spin->minValue(); | 369 | return m_spin->minValue(); |
367 | } | 370 | } |
368 | 371 | ||
369 | void KIntNumInput::setMaxValue(int max) | 372 | void KIntNumInput::setMaxValue(int max) |
370 | { | 373 | { |
371 | setRange(m_spin->minValue(), max, m_spin->lineStep(), m_slider); | 374 | setRange(m_spin->minValue(), max, m_spin->singleStep(), m_slider); |
372 | } | 375 | } |
373 | 376 | ||
374 | int KIntNumInput::maxValue() const | 377 | int KIntNumInput::maxValue() const |
375 | { | 378 | { |
376 | return m_spin->maxValue(); | 379 | return m_spin->maxValue(); |
377 | } | 380 | } |
378 | 381 | ||
379 | void KIntNumInput::setSuffix(const QString &suffix) | 382 | void KIntNumInput::setSuffix(const QString &suffix) |
380 | { | 383 | { |
381 | m_spin->setSuffix(suffix); | 384 | m_spin->setSuffix(suffix); |
382 | 385 | ||
383 | layout(true); | 386 | layout(true); |
384 | } | 387 | } |
385 | 388 | ||
386 | QString KIntNumInput::suffix() const | 389 | QString KIntNumInput::suffix() const |
387 | { | 390 | { |
@@ -402,78 +405,78 @@ QString KIntNumInput::prefix() const | |||
402 | 405 | ||
403 | void KIntNumInput::setEditFocus(bool mark) | 406 | void KIntNumInput::setEditFocus(bool mark) |
404 | { | 407 | { |
405 | m_spin->setEditFocus(mark); | 408 | m_spin->setEditFocus(mark); |
406 | } | 409 | } |
407 | 410 | ||
408 | QSize KIntNumInput::minimumSizeHint() const | 411 | QSize KIntNumInput::minimumSizeHint() const |
409 | { | 412 | { |
410 | constPolish(); | 413 | constPolish(); |
411 | 414 | ||
412 | int w; | 415 | int w; |
413 | int h; | 416 | int h; |
414 | 417 | ||
415 | h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height()); | 418 | h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height()); |
416 | 419 | ||
417 | // if in extra row, then count it here | 420 | // if in extra row, then count it here |
418 | if(m_label && (m_alignment & (AlignBottom|AlignTop))) | 421 | if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop))) |
419 | h += 4 + m_sizeLabel.height(); | 422 | h += 4 + m_sizeLabel.height(); |
420 | else | 423 | else |
421 | // label is in the same row as the other widgets | 424 | // label is in the same row as the other widgets |
422 | h = QMAX(h, m_sizeLabel.height() + 2); | 425 | h = QMAX(h, m_sizeLabel.height() + 2); |
423 | 426 | ||
424 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; | 427 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; |
425 | w += m_colw1 + m_colw2; | 428 | w += m_colw1 + m_colw2; |
426 | 429 | ||
427 | if(m_alignment & (AlignTop|AlignBottom)) | 430 | if(m_alignment & (Qt::AlignTop|Qt::AlignBottom)) |
428 | w = QMAX(w, m_sizeLabel.width() + 4); | 431 | w = QMAX(w, m_sizeLabel.width() + 4); |
429 | 432 | ||
430 | return QSize(w, h); | 433 | return QSize(w, h); |
431 | } | 434 | } |
432 | 435 | ||
433 | void KIntNumInput::doLayout() | 436 | void KIntNumInput::doLayout() |
434 | { | 437 | { |
435 | m_sizeSpin = m_spin->sizeHint(); | 438 | m_sizeSpin = m_spin->sizeHint(); |
436 | m_colw2 = m_sizeSpin.width(); | 439 | m_colw2 = m_sizeSpin.width(); |
437 | 440 | ||
438 | if (m_label) | 441 | if (m_label) |
439 | m_label->setBuddy(m_spin); | 442 | m_label->setBuddy(m_spin); |
440 | } | 443 | } |
441 | 444 | ||
442 | void KIntNumInput::resizeEvent(QResizeEvent* e) | 445 | void KIntNumInput::resizeEvent(QResizeEvent* e) |
443 | { | 446 | { |
444 | int w = m_colw1; | 447 | int w = m_colw1; |
445 | int h = 0; | 448 | int h = 0; |
446 | 449 | ||
447 | if(m_label && (m_alignment & AlignTop)) { | 450 | if(m_label && (m_alignment & Qt::AlignTop)) { |
448 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); | 451 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); |
449 | h += m_sizeLabel.height() + 4; | 452 | h += m_sizeLabel.height() + 4; |
450 | } | 453 | } |
451 | 454 | ||
452 | if(m_label && (m_alignment & AlignVCenter)) | 455 | if(m_label && (m_alignment & Qt::AlignVCenter)) |
453 | m_label->setGeometry(0, 0, w, m_sizeSpin.height()); | 456 | m_label->setGeometry(0, 0, w, m_sizeSpin.height()); |
454 | 457 | ||
455 | m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height()); | 458 | m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height()); |
456 | w += m_colw2 + 8; | 459 | w += m_colw2 + 8; |
457 | 460 | ||
458 | if(m_slider) | 461 | if(m_slider) |
459 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height()); | 462 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height()); |
460 | 463 | ||
461 | h += m_sizeSpin.height() + 2; | 464 | h += m_sizeSpin.height() + 2; |
462 | 465 | ||
463 | if(m_label && (m_alignment & AlignBottom)) | 466 | if(m_label && (m_alignment & Qt::AlignBottom)) |
464 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); | 467 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); |
465 | } | 468 | } |
466 | 469 | ||
467 | KIntNumInput::~KIntNumInput() | 470 | KIntNumInput::~KIntNumInput() |
468 | { | 471 | { |
469 | delete d; | 472 | delete d; |
470 | } | 473 | } |
471 | 474 | ||
472 | void KIntNumInput::setValue(int val) | 475 | void KIntNumInput::setValue(int val) |
473 | { | 476 | { |
474 | m_spin->setValue(val); | 477 | m_spin->setValue(val); |
475 | // slider value is changed by spinValueChanged | 478 | // slider value is changed by spinValueChanged |
476 | } | 479 | } |
477 | 480 | ||
478 | void KIntNumInput::setRelativeValue( double r ) { | 481 | void KIntNumInput::setRelativeValue( double r ) { |
479 | if ( !d->referencePoint ) return; | 482 | if ( !d->referencePoint ) return; |
@@ -633,70 +636,70 @@ void KDoubleNumInput::sliderMoved(int val) | |||
633 | void KDoubleNumInput::slotEmitRelativeValueChanged( double value ) | 636 | void KDoubleNumInput::slotEmitRelativeValueChanged( double value ) |
634 | { | 637 | { |
635 | if ( !d->referencePoint ) return; | 638 | if ( !d->referencePoint ) return; |
636 | emit relativeValueChanged( value / d->referencePoint ); | 639 | emit relativeValueChanged( value / d->referencePoint ); |
637 | } | 640 | } |
638 | 641 | ||
639 | QSize KDoubleNumInput::minimumSizeHint() const | 642 | QSize KDoubleNumInput::minimumSizeHint() const |
640 | { | 643 | { |
641 | constPolish(); | 644 | constPolish(); |
642 | 645 | ||
643 | int w; | 646 | int w; |
644 | int h; | 647 | int h; |
645 | 648 | ||
646 | h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height()); | 649 | h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height()); |
647 | 650 | ||
648 | // if in extra row, then count it here | 651 | // if in extra row, then count it here |
649 | if(m_label && (m_alignment & (AlignBottom|AlignTop))) | 652 | if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop))) |
650 | h += 4 + m_sizeLabel.height(); | 653 | h += 4 + m_sizeLabel.height(); |
651 | else | 654 | else |
652 | // label is in the same row as the other widgets | 655 | // label is in the same row as the other widgets |
653 | h = QMAX(h, m_sizeLabel.height() + 2); | 656 | h = QMAX(h, m_sizeLabel.height() + 2); |
654 | 657 | ||
655 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; | 658 | w = m_slider ? m_slider->sizeHint().width() + 8 : 0; |
656 | w += m_colw1 + m_colw2; | 659 | w += m_colw1 + m_colw2; |
657 | 660 | ||
658 | if(m_alignment & (AlignTop|AlignBottom)) | 661 | if(m_alignment & (Qt::AlignTop|Qt::AlignBottom)) |
659 | w = QMAX(w, m_sizeLabel.width() + 4); | 662 | w = QMAX(w, m_sizeLabel.width() + 4); |
660 | 663 | ||
661 | return QSize(w, h); | 664 | return QSize(w, h); |
662 | } | 665 | } |
663 | 666 | ||
664 | void KDoubleNumInput::resizeEvent(QResizeEvent* e) | 667 | void KDoubleNumInput::resizeEvent(QResizeEvent* e) |
665 | { | 668 | { |
666 | int w = m_colw1; | 669 | int w = m_colw1; |
667 | int h = 0; | 670 | int h = 0; |
668 | 671 | ||
669 | if(m_label && (m_alignment & AlignTop)) { | 672 | if(m_label && (m_alignment & Qt::AlignTop)) { |
670 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); | 673 | m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); |
671 | h += m_sizeLabel.height() + 4; | 674 | h += m_sizeLabel.height() + 4; |
672 | } | 675 | } |
673 | 676 | ||
674 | if(m_label && (m_alignment & AlignVCenter)) | 677 | if(m_label && (m_alignment & Qt::AlignVCenter)) |
675 | m_label->setGeometry(0, 0, w, m_sizeEdit.height()); | 678 | m_label->setGeometry(0, 0, w, m_sizeEdit.height()); |
676 | 679 | ||
677 | d->spin->setGeometry(w, h, m_slider ? m_colw2 | 680 | d->spin->setGeometry(w, h, m_slider ? m_colw2 |
678 | : e->size().width() - w, m_sizeEdit.height()); | 681 | : e->size().width() - w, m_sizeEdit.height()); |
679 | w += m_colw2 + 8; | 682 | w += m_colw2 + 8; |
680 | 683 | ||
681 | if(m_slider) | 684 | if(m_slider) |
682 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height()); | 685 | m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height()); |
683 | 686 | ||
684 | h += m_sizeEdit.height() + 2; | 687 | h += m_sizeEdit.height() + 2; |
685 | 688 | ||
686 | if(m_label && (m_alignment & AlignBottom)) | 689 | if(m_label && (m_alignment & Qt::AlignBottom)) |
687 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); | 690 | m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); |
688 | } | 691 | } |
689 | 692 | ||
690 | void KDoubleNumInput::doLayout() | 693 | void KDoubleNumInput::doLayout() |
691 | { | 694 | { |
692 | m_sizeEdit = d->spin->sizeHint(); | 695 | m_sizeEdit = d->spin->sizeHint(); |
693 | m_colw2 = m_sizeEdit.width(); | 696 | m_colw2 = m_sizeEdit.width(); |
694 | } | 697 | } |
695 | 698 | ||
696 | void KDoubleNumInput::setValue(double val) | 699 | void KDoubleNumInput::setValue(double val) |
697 | { | 700 | { |
698 | d->spin->setValue( val ); | 701 | d->spin->setValue( val ); |
699 | } | 702 | } |
700 | 703 | ||
701 | void KDoubleNumInput::setRelativeValue( double r ) | 704 | void KDoubleNumInput::setRelativeValue( double r ) |
702 | { | 705 | { |
@@ -717,40 +720,40 @@ void KDoubleNumInput::setRange(double lower, double upper, double step, | |||
717 | bool slider) | 720 | bool slider) |
718 | { | 721 | { |
719 | if( m_slider ) { | 722 | if( m_slider ) { |
720 | // don't update the slider to avoid an endless recursion | 723 | // don't update the slider to avoid an endless recursion |
721 | QSpinBox * spin = d->spin; | 724 | QSpinBox * spin = d->spin; |
722 | disconnect(spin, SIGNAL(valueChanged(int)), | 725 | disconnect(spin, SIGNAL(valueChanged(int)), |
723 | m_slider, SLOT(setValue(int)) ); | 726 | m_slider, SLOT(setValue(int)) ); |
724 | } | 727 | } |
725 | d->spin->setRange( lower, upper, step, d->spin->precision() ); | 728 | d->spin->setRange( lower, upper, step, d->spin->precision() ); |
726 | 729 | ||
727 | if(slider) { | 730 | if(slider) { |
728 | // upcast to base type to get the min/maxValue in int form: | 731 | // upcast to base type to get the min/maxValue in int form: |
729 | QSpinBox * spin = d->spin; | 732 | QSpinBox * spin = d->spin; |
730 | int slmax = spin->maxValue(); | 733 | int slmax = spin->maxValue(); |
731 | int slmin = spin->minValue(); | 734 | int slmin = spin->minValue(); |
732 | int slvalue = spin->value(); | 735 | int slvalue = spin->value(); |
733 | int slstep = spin->lineStep(); | 736 | int slstep = spin->singleStep(); |
734 | if (m_slider) { | 737 | if (m_slider) { |
735 | m_slider->setRange(slmin, slmax); | 738 | m_slider->setRange(slmin, slmax); |
736 | m_slider->setLineStep(slstep); | 739 | m_slider->setLineStep(slstep); |
737 | m_slider->setValue(slvalue); | 740 | m_slider->setValue(slvalue); |
738 | } else { | 741 | } else { |
739 | m_slider = new QSlider(slmin, slmax, slstep, slvalue, | 742 | m_slider = new QSlider(slmin, slmax, slstep, slvalue, |
740 | QSlider::Horizontal, this); | 743 | Qt::Horizontal, this); |
741 | m_slider->setTickmarks(QSlider::Below); | 744 | m_slider->setTickmarks(QSlider::Below); |
742 | // feedback line: when one moves, the other moves, too: | 745 | // feedback line: when one moves, the other moves, too: |
743 | connect(m_slider, SIGNAL(valueChanged(int)), | 746 | connect(m_slider, SIGNAL(valueChanged(int)), |
744 | SLOT(sliderMoved(int)) ); | 747 | SLOT(sliderMoved(int)) ); |
745 | } | 748 | } |
746 | connect(spin, SIGNAL(valueChanged(int)), | 749 | connect(spin, SIGNAL(valueChanged(int)), |
747 | m_slider, SLOT(setValue(int)) ); | 750 | m_slider, SLOT(setValue(int)) ); |
748 | // calculate ( slmax - slmin ) / 10 without overflowing ints: | 751 | // calculate ( slmax - slmin ) / 10 without overflowing ints: |
749 | int major = calcDiffByTen( slmax, slmin ); | 752 | int major = calcDiffByTen( slmax, slmin ); |
750 | if ( !major ) major = slstep; // ### needed? | 753 | if ( !major ) major = slstep; // ### needed? |
751 | m_slider->setTickInterval(major); | 754 | m_slider->setTickInterval(major); |
752 | } else { | 755 | } else { |
753 | delete m_slider; | 756 | delete m_slider; |
754 | m_slider = 0; | 757 | m_slider = 0; |
755 | } | 758 | } |
756 | 759 | ||
@@ -899,43 +902,43 @@ public: | |||
899 | *ok = true; | 902 | *ok = true; |
900 | return int( value * f + ( value < 0 ? -0.5 : 0.5 ) ); | 903 | return int( value * f + ( value < 0 ? -0.5 : 0.5 ) ); |
901 | } | 904 | } |
902 | } | 905 | } |
903 | 906 | ||
904 | double mapToDouble( int value ) const { | 907 | double mapToDouble( int value ) const { |
905 | return double(value) * basicStep(); | 908 | return double(value) * basicStep(); |
906 | } | 909 | } |
907 | 910 | ||
908 | int mPrecision; | 911 | int mPrecision; |
909 | KDoubleValidator * mValidator; | 912 | KDoubleValidator * mValidator; |
910 | }; | 913 | }; |
911 | 914 | ||
912 | KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name ) | 915 | KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name ) |
913 | : QSpinBox( parent, name ) | 916 | : QSpinBox( parent, name ) |
914 | { | 917 | { |
915 | editor()->setAlignment( Qt::AlignRight ); | 918 | setAlignment( Qt::AlignRight ); |
916 | d = new Private(); | 919 | d = new Private(); |
917 | updateValidator(); | 920 | updateValidator(); |
918 | } | 921 | } |
919 | 922 | ||
920 | KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step, | 923 | KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step, |
921 | double value, int precision, | 924 | double value, int precision, |
922 | QWidget * parent, const char * name ) | 925 | QWidget * parent, const char * name ) |
923 | : QSpinBox( parent, name ) | 926 | : QSpinBox( parent, name ) |
924 | { | 927 | { |
925 | editor()->setAlignment( Qt::AlignRight ); | 928 | setAlignment( Qt::AlignRight ); |
926 | d = new Private(); | 929 | d = new Private(); |
927 | setRange( lower, upper, step, precision ); | 930 | setRange( lower, upper, step, precision ); |
928 | setValue( value ); | 931 | setValue( value ); |
929 | connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) ); | 932 | connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) ); |
930 | } | 933 | } |
931 | 934 | ||
932 | KDoubleSpinBox::~KDoubleSpinBox() { | 935 | KDoubleSpinBox::~KDoubleSpinBox() { |
933 | delete d; d = 0; | 936 | delete d; d = 0; |
934 | } | 937 | } |
935 | 938 | ||
936 | bool KDoubleSpinBox::acceptLocalizedNumbers() const { | 939 | bool KDoubleSpinBox::acceptLocalizedNumbers() const { |
937 | if ( !d->mValidator ) return true; // we'll set one that does; | 940 | if ( !d->mValidator ) return true; // we'll set one that does; |
938 | // can't do it now, since we're const | 941 | // can't do it now, since we're const |
939 | return d->mValidator->acceptLocalizedNumbers(); | 942 | return d->mValidator->acceptLocalizedNumbers(); |
940 | } | 943 | } |
941 | 944 | ||
@@ -1014,33 +1017,33 @@ void KDoubleSpinBox::setMinValue( double value ) { | |||
1014 | } | 1017 | } |
1015 | 1018 | ||
1016 | 1019 | ||
1017 | double KDoubleSpinBox::maxValue() const { | 1020 | double KDoubleSpinBox::maxValue() const { |
1018 | return d->mapToDouble( base::maxValue() ); | 1021 | return d->mapToDouble( base::maxValue() ); |
1019 | } | 1022 | } |
1020 | 1023 | ||
1021 | void KDoubleSpinBox::setMaxValue( double value ) { | 1024 | void KDoubleSpinBox::setMaxValue( double value ) { |
1022 | bool ok = false; | 1025 | bool ok = false; |
1023 | int max = d->mapToInt( value, &ok ); | 1026 | int max = d->mapToInt( value, &ok ); |
1024 | if ( !ok ) return; | 1027 | if ( !ok ) return; |
1025 | base::setMaxValue( max ); | 1028 | base::setMaxValue( max ); |
1026 | updateValidator(); | 1029 | updateValidator(); |
1027 | } | 1030 | } |
1028 | 1031 | ||
1029 | double KDoubleSpinBox::lineStep() const { | 1032 | double KDoubleSpinBox::lineStep() const { |
1030 | return d->mapToDouble( base::lineStep() ); | 1033 | return d->mapToDouble( base::singleStep() ); |
1031 | } | 1034 | } |
1032 | 1035 | ||
1033 | void KDoubleSpinBox::setLineStep( double step ) { | 1036 | void KDoubleSpinBox::setLineStep( double step ) { |
1034 | bool ok = false; | 1037 | bool ok = false; |
1035 | if ( step > maxValue() - minValue() ) | 1038 | if ( step > maxValue() - minValue() ) |
1036 | base::setLineStep( 1 ); | 1039 | base::setLineStep( 1 ); |
1037 | else | 1040 | else |
1038 | base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) ); | 1041 | base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) ); |
1039 | } | 1042 | } |
1040 | 1043 | ||
1041 | QString KDoubleSpinBox::mapValueToText( int value ) { | 1044 | QString KDoubleSpinBox::mapValueToText( int value ) { |
1042 | if ( acceptLocalizedNumbers() ) | 1045 | if ( acceptLocalizedNumbers() ) |
1043 | return KGlobal::locale() | 1046 | return KGlobal::locale() |
1044 | ->formatNumber( d->mapToDouble( value ), d->mPrecision ); | 1047 | ->formatNumber( d->mapToDouble( value ), d->mPrecision ); |
1045 | else | 1048 | else |
1046 | return QString().setNum( d->mapToDouble( value ), 'f', d->mPrecision ); | 1049 | return QString().setNum( d->mapToDouble( value ), 'f', d->mPrecision ); |
@@ -1059,33 +1062,33 @@ int KDoubleSpinBox::mapTextToValue( bool * ok ) { | |||
1059 | value = minValue(); | 1062 | value = minValue(); |
1060 | return d->mapToInt( value, ok ); | 1063 | return d->mapToInt( value, ok ); |
1061 | } | 1064 | } |
1062 | 1065 | ||
1063 | void KDoubleSpinBox::setValidator( const QValidator * ) { | 1066 | void KDoubleSpinBox::setValidator( const QValidator * ) { |
1064 | // silently discard the new validator. We don't want another one ;-) | 1067 | // silently discard the new validator. We don't want another one ;-) |
1065 | } | 1068 | } |
1066 | 1069 | ||
1067 | void KDoubleSpinBox::slotValueChanged( int value ) { | 1070 | void KDoubleSpinBox::slotValueChanged( int value ) { |
1068 | emit valueChanged( d->mapToDouble( value ) ); | 1071 | emit valueChanged( d->mapToDouble( value ) ); |
1069 | } | 1072 | } |
1070 | 1073 | ||
1071 | void KDoubleSpinBox::updateValidator() { | 1074 | void KDoubleSpinBox::updateValidator() { |
1072 | if ( !d->mValidator ) { | 1075 | if ( !d->mValidator ) { |
1073 | d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(), | 1076 | d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(), |
1074 | this, "d->mValidator" ); | 1077 | this, "d->mValidator" ); |
1075 | base::setValidator( d->mValidator ); | 1078 | lineEdit()->setValidator( d->mValidator ); |
1076 | } else | 1079 | } else |
1077 | d->mValidator->setRange( minValue(), maxValue(), precision() ); | 1080 | d->mValidator->setRange( minValue(), maxValue(), precision() ); |
1078 | } | 1081 | } |
1079 | 1082 | ||
1080 | void KNumInput::virtual_hook( int, void* ) | 1083 | void KNumInput::virtual_hook( int, void* ) |
1081 | { /*BASE::virtual_hook( id, data );*/ } | 1084 | { /*BASE::virtual_hook( id, data );*/ } |
1082 | 1085 | ||
1083 | void KIntNumInput::virtual_hook( int id, void* data ) | 1086 | void KIntNumInput::virtual_hook( int id, void* data ) |
1084 | { KNumInput::virtual_hook( id, data ); } | 1087 | { KNumInput::virtual_hook( id, data ); } |
1085 | 1088 | ||
1086 | void KDoubleNumInput::virtual_hook( int id, void* data ) | 1089 | void KDoubleNumInput::virtual_hook( int id, void* data ) |
1087 | { KNumInput::virtual_hook( id, data ); } | 1090 | { KNumInput::virtual_hook( id, data ); } |
1088 | 1091 | ||
1089 | void KIntSpinBox::virtual_hook( int, void* ) | 1092 | void KIntSpinBox::virtual_hook( int, void* ) |
1090 | { /*BASE::virtual_hook( id, data );*/ } | 1093 | { /*BASE::virtual_hook( id, data );*/ } |
1091 | 1094 | ||
diff --git a/microkde/kdeui/knuminput.h b/microkde/kdeui/knuminput.h index 123fefa..9f9e200 100644 --- a/microkde/kdeui/knuminput.h +++ b/microkde/kdeui/knuminput.h | |||
@@ -16,32 +16,37 @@ | |||
16 | * This library is distributed in the hope that it will be useful, | 16 | * This library is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. | 19 | * Library General Public License for more details. |
20 | * | 20 | * |
21 | * You should have received a copy of the GNU Library General Public License | 21 | * You should have received a copy of the GNU Library General Public License |
22 | * along with this library; see the file COPYING.LIB. If not, write to | 22 | * along with this library; see the file COPYING.LIB. If not, write to |
23 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 23 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
24 | * Boston, MA 02111-1307, USA. | 24 | * Boston, MA 02111-1307, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef K_NUMINPUT_H | 27 | #ifndef K_NUMINPUT_H |
28 | #define K_NUMINPUT_H | 28 | #define K_NUMINPUT_H |
29 | 29 | ||
30 | #include <qwidget.h> | 30 | #include <qwidget.h> |
31 | #include <qspinbox.h> | 31 | #include <qspinbox.h> |
32 | #include <QLineEdit> | ||
33 | //Added by qt3to4: | ||
34 | #include <QResizeEvent> | ||
35 | #include <QLabel> | ||
36 | #include <QEvent> | ||
32 | 37 | ||
33 | class QLabel; | 38 | class QLabel; |
34 | class QSlider; | 39 | class QSlider; |
35 | class QLineEdit; | 40 | class QLineEdit; |
36 | class QLayout; | 41 | class QLayout; |
37 | class QValidator; | 42 | class QValidator; |
38 | 43 | ||
39 | class KIntSpinBox; | 44 | class KIntSpinBox; |
40 | 45 | ||
41 | /* ------------------------------------------------------------------------ */ | 46 | /* ------------------------------------------------------------------------ */ |
42 | 47 | ||
43 | /** | 48 | /** |
44 | * You need to inherit from this class if you want to implement K*NumInput | 49 | * You need to inherit from this class if you want to implement K*NumInput |
45 | * for a different variable type | 50 | * for a different variable type |
46 | * | 51 | * |
47 | */ | 52 | */ |
@@ -68,33 +73,33 @@ public: | |||
68 | * | 73 | * |
69 | * @param label The text of the label. | 74 | * @param label The text of the label. |
70 | * Use QString::null to remove an existing one. | 75 | * Use QString::null to remove an existing one. |
71 | * | 76 | * |
72 | * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and | 77 | * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and |
73 | * @p AlignTop, @p AlignVCenter, @p AlignBottom. | 78 | * @p AlignTop, @p AlignVCenter, @p AlignBottom. |
74 | * default is @p AlignLeft | @p AlignTop. | 79 | * default is @p AlignLeft | @p AlignTop. |
75 | * | 80 | * |
76 | * The vertical alignment flags have special meaning with this | 81 | * The vertical alignment flags have special meaning with this |
77 | * widget: | 82 | * widget: |
78 | * | 83 | * |
79 | * @li @p AlignTop The label is placed above the edit/slider | 84 | * @li @p AlignTop The label is placed above the edit/slider |
80 | * @li @p AlignVCenter The label is placed left beside the edit | 85 | * @li @p AlignVCenter The label is placed left beside the edit |
81 | * @li @p AlignBottom The label is placed below the edit/slider | 86 | * @li @p AlignBottom The label is placed below the edit/slider |
82 | * | 87 | * |
83 | */ | 88 | */ |
84 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 89 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
85 | 90 | ||
86 | /** | 91 | /** |
87 | * @return the text of the label. | 92 | * @return the text of the label. |
88 | */ | 93 | */ |
89 | QString label() const; | 94 | QString label() const; |
90 | 95 | ||
91 | /** | 96 | /** |
92 | * @return if the num input has a slider. | 97 | * @return if the num input has a slider. |
93 | * @since 3.1 | 98 | * @since 3.1 |
94 | */ | 99 | */ |
95 | bool showSlider() const { return m_slider; } | 100 | bool showSlider() const { return m_slider; } |
96 | 101 | ||
97 | /** | 102 | /** |
98 | * Sets the spacing of tickmarks for the slider. | 103 | * Sets the spacing of tickmarks for the slider. |
99 | * | 104 | * |
100 | * @param minor Minor tickmark separation. | 105 | * @param minor Minor tickmark separation. |
@@ -289,33 +294,33 @@ public: | |||
289 | /** | 294 | /** |
290 | * @return the maximum value. | 295 | * @return the maximum value. |
291 | */ | 296 | */ |
292 | int maxValue() const; | 297 | int maxValue() const; |
293 | 298 | ||
294 | /** | 299 | /** |
295 | * Sets the special value text. If set, the SpinBox will display | 300 | * Sets the special value text. If set, the SpinBox will display |
296 | * this text instead of the numeric value whenever the current | 301 | * this text instead of the numeric value whenever the current |
297 | * value is equal to minVal(). Typically this is used for indicating | 302 | * value is equal to minVal(). Typically this is used for indicating |
298 | * that the choice has a special (default) meaning. | 303 | * that the choice has a special (default) meaning. |
299 | */ | 304 | */ |
300 | void setSpecialValueText(const QString& text); | 305 | void setSpecialValueText(const QString& text); |
301 | 306 | ||
302 | /** | 307 | /** |
303 | * @reimplemented | 308 | * @reimplemented |
304 | */ | 309 | */ |
305 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 310 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
306 | 311 | ||
307 | /** | 312 | /** |
308 | * This method returns the minimum size necessary to display the | 313 | * This method returns the minimum size necessary to display the |
309 | * control. The minimum size is enough to show all the labels | 314 | * control. The minimum size is enough to show all the labels |
310 | * in the current font (font change may invalidate the return value). | 315 | * in the current font (font change may invalidate the return value). |
311 | * | 316 | * |
312 | * @return the minimum size necessary to show the control | 317 | * @return the minimum size necessary to show the control |
313 | */ | 318 | */ |
314 | virtual QSize minimumSizeHint() const; | 319 | virtual QSize minimumSizeHint() const; |
315 | 320 | ||
316 | public slots: | 321 | public slots: |
317 | /** | 322 | /** |
318 | * Sets the value of the control. | 323 | * Sets the value of the control. |
319 | */ | 324 | */ |
320 | void setValue(int); | 325 | void setValue(int); |
321 | 326 | ||
@@ -575,33 +580,33 @@ public: | |||
575 | * @return the current value in units of @ref #referencePoint. | 580 | * @return the current value in units of @ref #referencePoint. |
576 | * @since 3.1 | 581 | * @since 3.1 |
577 | */ | 582 | */ |
578 | double relativeValue() const; | 583 | double relativeValue() const; |
579 | 584 | ||
580 | /** | 585 | /** |
581 | * Sets the special value text. If set, the spin box will display | 586 | * Sets the special value text. If set, the spin box will display |
582 | * this text instead of the numeric value whenever the current | 587 | * this text instead of the numeric value whenever the current |
583 | * value is equal to @ref #minVal(). Typically this is used for indicating | 588 | * value is equal to @ref #minVal(). Typically this is used for indicating |
584 | * that the choice has a special (default) meaning. | 589 | * that the choice has a special (default) meaning. |
585 | */ | 590 | */ |
586 | void setSpecialValueText(const QString& text); | 591 | void setSpecialValueText(const QString& text); |
587 | 592 | ||
588 | /** | 593 | /** |
589 | * @reimplemented | 594 | * @reimplemented |
590 | */ | 595 | */ |
591 | virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); | 596 | virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); |
592 | /** | 597 | /** |
593 | * @reimplemented | 598 | * @reimplemented |
594 | */ | 599 | */ |
595 | virtual QSize minimumSizeHint() const; | 600 | virtual QSize minimumSizeHint() const; |
596 | /** | 601 | /** |
597 | * @reimplemented | 602 | * @reimplemented |
598 | */ | 603 | */ |
599 | virtual bool eventFilter(QObject*, QEvent*); | 604 | virtual bool eventFilter(QObject*, QEvent*); |
600 | 605 | ||
601 | public slots: | 606 | public slots: |
602 | /** | 607 | /** |
603 | * Sets the value of the control. | 608 | * Sets the value of the control. |
604 | */ | 609 | */ |
605 | void setValue(double); | 610 | void setValue(double); |
606 | 611 | ||
607 | /** | 612 | /** |
@@ -745,32 +750,36 @@ public: | |||
745 | virtual ~KIntSpinBox(); | 750 | virtual ~KIntSpinBox(); |
746 | 751 | ||
747 | /** | 752 | /** |
748 | * Sets the base in which the numbers in the spin box are represented. | 753 | * Sets the base in which the numbers in the spin box are represented. |
749 | */ | 754 | */ |
750 | void setBase(int base); | 755 | void setBase(int base); |
751 | /** | 756 | /** |
752 | * @return the base in which numbers in the spin box are represented. | 757 | * @return the base in which numbers in the spin box are represented. |
753 | */ | 758 | */ |
754 | int base() const; | 759 | int base() const; |
755 | /** | 760 | /** |
756 | * sets focus and optionally marks all text | 761 | * sets focus and optionally marks all text |
757 | * | 762 | * |
758 | */ | 763 | */ |
759 | void setEditFocus(bool mark); | 764 | void setEditFocus(bool mark); |
760 | 765 | ||
766 | void setValidator(const QValidator *v) { | ||
767 | lineEdit()->setValidator(v); | ||
768 | } | ||
769 | |||
761 | protected: | 770 | protected: |
762 | 771 | ||
763 | /** | 772 | /** |
764 | * Overloaded the method in QSpinBox | 773 | * Overloaded the method in QSpinBox |
765 | * to make use of the base given in the constructor. | 774 | * to make use of the base given in the constructor. |
766 | */ | 775 | */ |
767 | virtual QString mapValueToText(int); | 776 | virtual QString mapValueToText(int); |
768 | 777 | ||
769 | /** | 778 | /** |
770 | * Overloaded the method in QSpinBox | 779 | * Overloaded the method in QSpinBox |
771 | * to make use of the base given in the constructor. | 780 | * to make use of the base given in the constructor. |
772 | */ | 781 | */ |
773 | virtual int mapTextToValue(bool*); | 782 | virtual int mapTextToValue(bool*); |
774 | 783 | ||
775 | private: | 784 | private: |
776 | int val_base; | 785 | int val_base; |
diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp index 96d2a87..7e1503c 100644 --- a/microkde/kdeui/kpopupmenu.cpp +++ b/microkde/kdeui/kpopupmenu.cpp | |||
@@ -1,19 +1,22 @@ | |||
1 | 1 | ||
2 | #include <kpopupmenu.h> | 2 | #include <kpopupmenu.h> |
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | //Added by qt3to4: | ||
5 | #include <QFocusEvent> | ||
6 | #include <Q3PopupMenu> | ||
4 | 7 | ||
5 | 8 | ||
6 | KPopupMenu::KPopupMenu ( QWidget * parent, const char * name ) | 9 | KPopupMenu::KPopupMenu ( QWidget * parent, const char * name ) |
7 | : QPopupMenu ( parent, name ) {;} | 10 | : Q3PopupMenu ( parent, name ) {;} |
8 | 11 | ||
9 | 12 | ||
10 | 13 | ||
11 | KMenuBar::KMenuBar ( QWidget * parent, const char * name ) | 14 | KMenuBar::KMenuBar ( QWidget * parent, const char * name ) |
12 | : QPEMenuBar ( parent, name ) {} | 15 | : QPEMenuBar ( parent, name ) {} |
13 | 16 | ||
14 | void KMenuBar::focusOutEvent ( QFocusEvent * e) | 17 | void KMenuBar::focusOutEvent ( QFocusEvent * e) |
15 | { | 18 | { |
16 | QPEMenuBar::focusOutEvent( e ); | 19 | QPEMenuBar::focusOutEvent( e ); |
17 | QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) ); | 20 | QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) ); |
18 | 21 | ||
19 | } | 22 | } |
diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h index fd00f36..1c903ad 100644 --- a/microkde/kdeui/kpopupmenu.h +++ b/microkde/kdeui/kpopupmenu.h | |||
@@ -1,28 +1,30 @@ | |||
1 | #ifndef KPOPUPMENU_H | 1 | #ifndef KPOPUPMENU_H |
2 | #define KPOPUPMENU_H | 2 | #define KPOPUPMENU_H |
3 | 3 | ||
4 | #include <qpopupmenu.h> | 4 | #include <q3popupmenu.h> |
5 | //Added by qt3to4: | ||
6 | #include <QFocusEvent> | ||
5 | #ifdef DESKTOP_VERSION | 7 | #ifdef DESKTOP_VERSION |
6 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
7 | #define QPEMenuBar QMenuBar | 9 | #define QPEMenuBar QMenuBar |
8 | #else | 10 | #else |
9 | #include <qpe/qpemenubar.h> | 11 | #include <qpe/qpemenubar.h> |
10 | #endif | 12 | #endif |
11 | 13 | ||
12 | class KPopupMenu : public QPopupMenu | 14 | class KPopupMenu : public Q3PopupMenu |
13 | { | 15 | { |
14 | Q_OBJECT | 16 | Q_OBJECT |
15 | public: | 17 | public: |
16 | KPopupMenu ( QWidget * parent=0, const char * name=0 ); | 18 | KPopupMenu ( QWidget * parent=0, const char * name=0 ); |
17 | 19 | ||
18 | }; | 20 | }; |
19 | 21 | ||
20 | 22 | ||
21 | class KMenuBar : public QPEMenuBar | 23 | class KMenuBar : public QPEMenuBar |
22 | { | 24 | { |
23 | Q_OBJECT | 25 | Q_OBJECT |
24 | public: | 26 | public: |
25 | KMenuBar ( QWidget * parent=0, const char * name=0 ); | 27 | KMenuBar ( QWidget * parent=0, const char * name=0 ); |
26 | signals: | 28 | signals: |
27 | void lostFocus(); | 29 | void lostFocus(); |
28 | protected: | 30 | protected: |
diff --git a/microkde/kdeui/kseparator.cpp b/microkde/kdeui/kseparator.cpp index d028420..66000f0 100644 --- a/microkde/kdeui/kseparator.cpp +++ b/microkde/kdeui/kseparator.cpp | |||
@@ -5,76 +5,78 @@ | |||
5 | * it under the terms of the GNU Library General Public License as published by | 5 | * it under the terms of the GNU Library General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU Library General Public License for more details. | 12 | * GNU Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qstyle.h> | 20 | #include <qstyle.h> |
21 | //Added by qt3to4: | ||
22 | #include <Q3Frame> | ||
21 | 23 | ||
22 | #include <kdebug.h> | 24 | #include <kdebug.h> |
23 | //US #include <kapplication.h> | 25 | //US #include <kapplication.h> |
24 | 26 | ||
25 | //US #include "kseparator.moc" | 27 | //US #include "kseparator.moc" |
26 | 28 | ||
27 | #include "kseparator.h" | 29 | #include "kseparator.h" |
28 | 30 | ||
29 | KSeparator::KSeparator(QWidget* parent, const char* name, WFlags f) | 31 | KSeparator::KSeparator(QWidget* parent, const char* name, Qt::WFlags f) |
30 | : QFrame(parent, name, f) | 32 | : Q3Frame(parent, name, f) |
31 | { | 33 | { |
32 | setLineWidth(1); | 34 | setLineWidth(1); |
33 | setMidLineWidth(0); | 35 | setMidLineWidth(0); |
34 | setOrientation( HLine ); | 36 | setOrientation( HLine ); |
35 | } | 37 | } |
36 | 38 | ||
37 | 39 | ||
38 | 40 | ||
39 | KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, WFlags f) | 41 | KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, Qt::WFlags f) |
40 | : QFrame(parent, name, f) | 42 | : Q3Frame(parent, name, f) |
41 | { | 43 | { |
42 | setLineWidth(1); | 44 | setLineWidth(1); |
43 | setMidLineWidth(0); | 45 | setMidLineWidth(0); |
44 | setOrientation( orientation ); | 46 | setOrientation( orientation ); |
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | 50 | ||
49 | void KSeparator::setOrientation(int orientation) | 51 | void KSeparator::setOrientation(int orientation) |
50 | { | 52 | { |
51 | switch(orientation) | 53 | switch(orientation) |
52 | { | 54 | { |
53 | case Vertical: | 55 | case Qt::Vertical: |
54 | case VLine: | 56 | case VLine: |
55 | setFrameStyle( QFrame::VLine | QFrame::Sunken ); | 57 | setFrameStyle( Q3Frame::VLine | Q3Frame::Sunken ); |
56 | setMinimumSize(2, 0); | 58 | setMinimumSize(2, 0); |
57 | break; | 59 | break; |
58 | 60 | ||
59 | default: | 61 | default: |
60 | kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl; | 62 | kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl; |
61 | 63 | ||
62 | case Horizontal: | 64 | case Qt::Horizontal: |
63 | case HLine: | 65 | case HLine: |
64 | setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 66 | setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken ); |
65 | setMinimumSize(0, 2); | 67 | setMinimumSize(0, 2); |
66 | break; | 68 | break; |
67 | } | 69 | } |
68 | } | 70 | } |
69 | 71 | ||
70 | 72 | ||
71 | 73 | ||
72 | int KSeparator::orientation() const | 74 | int KSeparator::orientation() const |
73 | { | 75 | { |
74 | if ( frameStyle() & VLine ) | 76 | if ( frameStyle() & VLine ) |
75 | return VLine; | 77 | return VLine; |
76 | 78 | ||
77 | if ( frameStyle() & HLine ) | 79 | if ( frameStyle() & HLine ) |
78 | return HLine; | 80 | return HLine; |
79 | 81 | ||
80 | return 0; | 82 | return 0; |
diff --git a/microkde/kdeui/kseparator.h b/microkde/kdeui/kseparator.h index 6d2712a..c673475 100644 --- a/microkde/kdeui/kseparator.h +++ b/microkde/kdeui/kseparator.h | |||
@@ -7,57 +7,57 @@ | |||
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU Library General Public License for more details. | 12 | * GNU Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef __KSEPARATOR_H__ | 20 | #ifndef __KSEPARATOR_H__ |
21 | #define __KSEPARATOR_H__ | 21 | #define __KSEPARATOR_H__ |
22 | 22 | ||
23 | #include <qframe.h> | 23 | #include <q3frame.h> |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Standard horizontal or vertical separator. | 26 | * Standard horizontal or vertical separator. |
27 | * | 27 | * |
28 | * @author Michael Roth <mroth@wirlweb.de> | 28 | * @author Michael Roth <mroth@wirlweb.de> |
29 | * @version $Id$ | 29 | * @version $Id$ |
30 | */ | 30 | */ |
31 | class KSeparator : public QFrame | 31 | class KSeparator : public Q3Frame |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) | 34 | Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) |
35 | public: | 35 | public: |
36 | /** | 36 | /** |
37 | * Constructor. | 37 | * Constructor. |
38 | **/ | 38 | **/ |
39 | KSeparator(QWidget* parent=0, const char* name=0, WFlags f=0); | 39 | KSeparator(QWidget* parent=0, const char* name=0, Qt::WFlags f=0); |
40 | /** | 40 | /** |
41 | * Constructor. | 41 | * Constructor. |
42 | * | 42 | * |
43 | * @param orientation Set the orientation of the separator. | 43 | * @param orientation Set the orientation of the separator. |
44 | * Possible values are HLine or Horizontal and VLine or Vertical. | 44 | * Possible values are HLine or Horizontal and VLine or Vertical. |
45 | **/ | 45 | **/ |
46 | KSeparator(int orientation, QWidget* parent=0, const char* name=0, | 46 | KSeparator(int orientation, QWidget* parent=0, const char* name=0, |
47 | WFlags f=0); | 47 | Qt::WFlags f=0); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Returns the orientation of the separator. | 50 | * Returns the orientation of the separator. |
51 | * | 51 | * |
52 | * Possible values are VLine and HLine. | 52 | * Possible values are VLine and HLine. |
53 | **/ | 53 | **/ |
54 | int orientation() const; | 54 | int orientation() const; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Set the orientation of the separator to @p orient | 57 | * Set the orientation of the separator to @p orient |
58 | * | 58 | * |
59 | * Possible values are VLine and HLine. | 59 | * Possible values are VLine and HLine. |
60 | */ | 60 | */ |
61 | void setOrientation(int orient); | 61 | void setOrientation(int orient); |
62 | 62 | ||
63 | /** | 63 | /** |
diff --git a/microkde/kdeui/ksqueezedtextlabel.cpp b/microkde/kdeui/ksqueezedtextlabel.cpp index 37fa29a..e2c61fd 100644 --- a/microkde/kdeui/ksqueezedtextlabel.cpp +++ b/microkde/kdeui/ksqueezedtextlabel.cpp | |||
@@ -5,32 +5,35 @@ | |||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "ksqueezedtextlabel.h" | 19 | #include "ksqueezedtextlabel.h" |
20 | #include <qtooltip.h> | 20 | #include <qtooltip.h> |
21 | //Added by qt3to4: | ||
22 | #include <QResizeEvent> | ||
23 | #include <QLabel> | ||
21 | 24 | ||
22 | KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name ) | 25 | KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name ) |
23 | : QLabel ( parent, name ) { | 26 | : QLabel ( parent, name ) { |
24 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); | 27 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); |
25 | fullText = text; | 28 | fullText = text; |
26 | squeezeTextToLabel(); | 29 | squeezeTextToLabel(); |
27 | } | 30 | } |
28 | 31 | ||
29 | KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name ) | 32 | KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name ) |
30 | : QLabel ( parent, name ) { | 33 | : QLabel ( parent, name ) { |
31 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); | 34 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); |
32 | } | 35 | } |
33 | 36 | ||
34 | void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) { | 37 | void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) { |
35 | squeezeTextToLabel(); | 38 | squeezeTextToLabel(); |
36 | } | 39 | } |
diff --git a/microkde/kdeui/ksqueezedtextlabel.h b/microkde/kdeui/ksqueezedtextlabel.h index 1634adc..487d0b0 100644 --- a/microkde/kdeui/ksqueezedtextlabel.h +++ b/microkde/kdeui/ksqueezedtextlabel.h | |||
@@ -7,32 +7,34 @@ | |||
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef KSQUEEZEDTEXTLABEL_H | 19 | #ifndef KSQUEEZEDTEXTLABEL_H |
20 | #define KSQUEEZEDTEXTLABEL_H | 20 | #define KSQUEEZEDTEXTLABEL_H |
21 | 21 | ||
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | //Added by qt3to4: | ||
24 | #include <QResizeEvent> | ||
23 | 25 | ||
24 | /** | 26 | /** |
25 | * A label class that squeezes its text into the label | 27 | * A label class that squeezes its text into the label |
26 | * | 28 | * |
27 | * If the text is too long to fit into the label it is divided into | 29 | * If the text is too long to fit into the label it is divided into |
28 | * remaining left and right parts which are separated by three dots. | 30 | * remaining left and right parts which are separated by three dots. |
29 | * | 31 | * |
30 | * Example: | 32 | * Example: |
31 | * http://www.kde.org/documentation/index.html could be squeezed to | 33 | * http://www.kde.org/documentation/index.html could be squeezed to |
32 | * http://www.kde...ion/index.html | 34 | * http://www.kde...ion/index.html |
33 | 35 | ||
34 | * @short A replacement for QLabel that squeezes its text | 36 | * @short A replacement for QLabel that squeezes its text |
35 | * @author Ronny Standtke <Ronny.Standtke@gmx.de> | 37 | * @author Ronny Standtke <Ronny.Standtke@gmx.de> |
36 | * @version $Id$ | 38 | * @version $Id$ |
37 | * | 39 | * |
38 | */ | 40 | */ |
diff --git a/microkde/kdeui/kstdaction.cpp b/microkde/kdeui/kstdaction.cpp index cfd7b54..f0d162d 100644 --- a/microkde/kdeui/kstdaction.cpp +++ b/microkde/kdeui/kstdaction.cpp | |||
@@ -6,33 +6,33 @@ | |||
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "kstdaction.h" | 19 | #include "kstdaction.h" |
20 | 20 | ||
21 | #include <qtoolbutton.h> | 21 | #include <qtoolbutton.h> |
22 | #include <qwhatsthis.h> | 22 | #include <q3whatsthis.h> |
23 | 23 | ||
24 | //US #include <kaboutdata.h> | 24 | //US #include <kaboutdata.h> |
25 | #include <kaction.h> | 25 | #include <kaction.h> |
26 | #include <kapplication.h> | 26 | #include <kapplication.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <kiconloader.h> | 29 | #include <kiconloader.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | //US #include <kstdaccel.h> | 31 | //US #include <kstdaccel.h> |
32 | //US #include <kmainwindow.h> | 32 | //US #include <kmainwindow.h> |
33 | 33 | ||
34 | namespace KStdAction | 34 | namespace KStdAction |
35 | { | 35 | { |
36 | 36 | ||
37 | struct KStdActionInfo | 37 | struct KStdActionInfo |
38 | { | 38 | { |
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 027e5e9..02db316 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -12,241 +12,252 @@ | |||
12 | modify it under the terms of the GNU Library General Public | 12 | modify it under the terms of the GNU Library General Public |
13 | License version 2 as published by the Free Software Foundation. | 13 | License version 2 as published by the Free Software Foundation. |
14 | 14 | ||
15 | This library is distributed in the hope that it will be useful, | 15 | This library is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | Library General Public License for more details. | 18 | Library General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU Library General Public License | 20 | You should have received a copy of the GNU Library General Public License |
21 | along with this library; see the file COPYING.LIB. If not, write to | 21 | along with this library; see the file COPYING.LIB. If not, write to |
22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. | 23 | Boston, MA 02111-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifdef KDE_USE_FINAL | 26 | #ifdef KDE_USE_FINAL |
27 | #undef Always | 27 | #undef Always |
28 | #include <qdockwindow.h> | 28 | #include <q3dockwindow.h> |
29 | #endif | 29 | #endif |
30 | 30 | //Added by qt3to4: | |
31 | #include <Q3ValueList> | ||
32 | #include <Q3PtrList> | ||
33 | #include <QPixmap> | ||
34 | #include <Q3Frame> | ||
35 | #include <QResizeEvent> | ||
36 | #include <QMouseEvent> | ||
37 | #include <QChildEvent> | ||
38 | #include <QEvent> | ||
39 | #include <QShowEvent> | ||
40 | #include <QDesktopWidget> | ||
41 | #include <QBoxLayout> | ||
31 | 42 | ||
32 | 43 | ||
33 | #include "ktoolbar.h" | 44 | #include "ktoolbar.h" |
34 | #include "kmainwindow.h" | 45 | #include "kmainwindow.h" |
35 | 46 | ||
36 | #include <string.h> | 47 | #include <string.h> |
37 | 48 | ||
38 | #include <qpainter.h> | 49 | #include <qpainter.h> |
39 | #include <qtooltip.h> | 50 | #include <qtooltip.h> |
40 | #include <qdrawutil.h> | 51 | #include <qdrawutil.h> |
41 | #include <qstring.h> | 52 | #include <qstring.h> |
42 | #include <qrect.h> | 53 | #include <qrect.h> |
43 | #include <qobjectlist.h> | 54 | #include <qobject.h> |
44 | #include <qtimer.h> | 55 | #include <qtimer.h> |
45 | #include <qstyle.h> | 56 | #include <qstyle.h> |
46 | #include <qapplication.h> | 57 | #include <qapplication.h> |
47 | 58 | ||
48 | //US #include <config.h> | 59 | //US #include <config.h> |
49 | 60 | ||
50 | #include "klineedit.h" | 61 | #include "klineedit.h" |
51 | #include "kseparator.h" | 62 | #include "kseparator.h" |
52 | #include <klocale.h> | 63 | #include <klocale.h> |
53 | #include <kapplication.h> | 64 | #include <kapplication.h> |
54 | #include <kaction.h> | 65 | #include <kaction.h> |
55 | #include <kstdaction.h> | 66 | #include <kstdaction.h> |
56 | #include <kglobal.h> | 67 | #include <kglobal.h> |
57 | #include <kconfig.h> | 68 | #include <kconfig.h> |
58 | #include <kiconloader.h> | 69 | #include <kiconloader.h> |
59 | #include <kcombobox.h> | 70 | #include <kcombobox.h> |
60 | //US #include <kpopupmenu.h> | 71 | //US #include <kpopupmenu.h> |
61 | //US #include <kanimwidget.h> | 72 | //US #include <kanimwidget.h> |
62 | //US #include <kipc.h> | 73 | //US #include <kipc.h> |
63 | //US #include <kwin.h> | 74 | //US #include <kwin.h> |
64 | #include <kdebug.h> | 75 | #include <kdebug.h> |
65 | #include <qlayout.h> | 76 | #include <qlayout.h> |
66 | 77 | ||
67 | #include "ktoolbarbutton.h" | 78 | #include "ktoolbarbutton.h" |
68 | 79 | ||
69 | //US | 80 | //US |
70 | #include "kconfigbase.h" | 81 | #include "kconfigbase.h" |
71 | 82 | ||
72 | #include <qpopupmenu.h> | 83 | #include <q3popupmenu.h> |
73 | #include <qmainwindow.h> | 84 | #include <q3mainwindow.h> |
74 | 85 | ||
75 | enum { | 86 | enum { |
76 | CONTEXT_TOP = 0, | 87 | CONTEXT_TOP = 0, |
77 | CONTEXT_LEFT = 1, | 88 | CONTEXT_LEFT = 1, |
78 | CONTEXT_RIGHT = 2, | 89 | CONTEXT_RIGHT = 2, |
79 | CONTEXT_BOTTOM = 3, | 90 | CONTEXT_BOTTOM = 3, |
80 | CONTEXT_FLOAT = 4, | 91 | CONTEXT_FLOAT = 4, |
81 | CONTEXT_FLAT = 5, | 92 | CONTEXT_FLAT = 5, |
82 | CONTEXT_ICONS = 6, | 93 | CONTEXT_ICONS = 6, |
83 | CONTEXT_TEXT = 7, | 94 | CONTEXT_TEXT = 7, |
84 | CONTEXT_TEXTRIGHT = 8, | 95 | CONTEXT_TEXTRIGHT = 8, |
85 | CONTEXT_TEXTUNDER = 9, | 96 | CONTEXT_TEXTUNDER = 9, |
86 | CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before | 97 | CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before |
87 | }; | 98 | }; |
88 | 99 | ||
89 | class KToolBarPrivate | 100 | class KToolBarPrivate |
90 | { | 101 | { |
91 | public: | 102 | public: |
92 | KToolBarPrivate() { | 103 | KToolBarPrivate() { |
93 | m_iconSize = 0; | 104 | m_iconSize = 0; |
94 | m_iconText = KToolBar::IconOnly; | 105 | m_iconText = KToolBar::IconOnly; |
95 | m_highlight = true; | 106 | m_highlight = true; |
96 | m_transparent = true; | 107 | m_transparent = true; |
97 | m_honorStyle = false; | 108 | m_honorStyle = false; |
98 | 109 | ||
99 | m_enableContext = true; | 110 | m_enableContext = true; |
100 | 111 | ||
101 | m_xmlguiClient = 0; | 112 | m_xmlguiClient = 0; |
102 | m_configurePlugged = false; | 113 | m_configurePlugged = false; |
103 | 114 | ||
104 | //US oldPos = Qt::DockUnmanaged; | 115 | //US oldPos = Qt::DockUnmanaged; |
105 | oldPos = QMainWindow::Unmanaged; | 116 | oldPos = Qt::Unmanaged; |
106 | 117 | ||
107 | modified = m_isHorizontal = positioned = FALSE; | 118 | modified = m_isHorizontal = positioned = FALSE; |
108 | 119 | ||
109 | HiddenDefault = false; | 120 | HiddenDefault = false; |
110 | IconSizeDefault = 0; | 121 | IconSizeDefault = 0; |
111 | IconTextDefault = "IconOnly"; | 122 | IconTextDefault = "IconOnly"; |
112 | IndexDefault = -1; | 123 | IndexDefault = -1; |
113 | NewLineDefault = false; | 124 | NewLineDefault = false; |
114 | OffsetDefault = -1; | 125 | OffsetDefault = -1; |
115 | PositionDefault = "Top"; | 126 | PositionDefault = "Top"; |
116 | idleButtons.setAutoDelete(true); | 127 | idleButtons.setAutoDelete(true); |
117 | } | 128 | } |
118 | 129 | ||
119 | int m_iconSize; | 130 | int m_iconSize; |
120 | KToolBar::IconText m_iconText; | 131 | KToolBar::IconText m_iconText; |
121 | bool m_highlight : 1; | 132 | bool m_highlight : 1; |
122 | bool m_transparent : 1; | 133 | bool m_transparent : 1; |
123 | bool m_honorStyle : 1; | 134 | bool m_honorStyle : 1; |
124 | bool m_isHorizontal : 1; | 135 | bool m_isHorizontal : 1; |
125 | bool m_enableContext : 1; | 136 | bool m_enableContext : 1; |
126 | bool m_configurePlugged : 1; | 137 | bool m_configurePlugged : 1; |
127 | bool modified : 1; | 138 | bool modified : 1; |
128 | bool positioned : 1; | 139 | bool positioned : 1; |
129 | 140 | ||
130 | QWidget *m_parent; | 141 | QWidget *m_parent; |
131 | 142 | ||
132 | QMainWindow::ToolBarDock oldPos; | 143 | Qt::ToolBarDock oldPos; |
133 | 144 | ||
134 | KXMLGUIClient *m_xmlguiClient; | 145 | KXMLGUIClient *m_xmlguiClient; |
135 | 146 | ||
136 | struct ToolBarInfo | 147 | struct ToolBarInfo |
137 | { | 148 | { |
138 | //US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} | 149 | //US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} |
139 | ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} | 150 | ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} |
140 | //US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} | 151 | //US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} |
141 | ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} | 152 | ToolBarInfo( Qt::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} |
142 | int index, offset; | 153 | int index, offset; |
143 | bool newline; | 154 | bool newline; |
144 | //US Qt::Dock dock; | 155 | //US Qt::Dock dock; |
145 | QMainWindow::ToolBarDock dock; | 156 | Qt::ToolBarDock dock; |
146 | }; | 157 | }; |
147 | 158 | ||
148 | ToolBarInfo toolBarInfo; | 159 | ToolBarInfo toolBarInfo; |
149 | QValueList<int> iconSizes; | 160 | Q3ValueList<int> iconSizes; |
150 | QTimer repaintTimer; | 161 | QTimer repaintTimer; |
151 | 162 | ||
152 | // Default Values. | 163 | // Default Values. |
153 | bool HiddenDefault; | 164 | bool HiddenDefault; |
154 | int IconSizeDefault; | 165 | int IconSizeDefault; |
155 | QString IconTextDefault; | 166 | QString IconTextDefault; |
156 | int IndexDefault; | 167 | int IndexDefault; |
157 | bool NewLineDefault; | 168 | bool NewLineDefault; |
158 | int OffsetDefault; | 169 | int OffsetDefault; |
159 | QString PositionDefault; | 170 | QString PositionDefault; |
160 | 171 | ||
161 | QPtrList<QWidget> idleButtons; | 172 | Q3PtrList<QWidget> idleButtons; |
162 | }; | 173 | }; |
163 | 174 | ||
164 | KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, | 175 | KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent, |
165 | const char* name ) | 176 | const char* name ) |
166 | :QFrame( parent, name ), line( l ) | 177 | :Q3Frame( parent, name ), line( l ) |
167 | { | 178 | { |
168 | connect( parent, SIGNAL(orientationChanged(Orientation)), | 179 | connect( parent, SIGNAL(orientationChanged(Qt::Orientation)), |
169 | this, SLOT(setOrientation(Orientation)) ); | 180 | this, SLOT(setOrientation(Qt::Orientation)) ); |
170 | setOrientation( o ); | 181 | setOrientation( o ); |
171 | setBackgroundMode( parent->backgroundMode() ); | 182 | setBackgroundMode( parent->backgroundMode() ); |
172 | setBackgroundOrigin( ParentOrigin ); | 183 | setBackgroundOrigin( ParentOrigin ); |
173 | } | 184 | } |
174 | 185 | ||
175 | void KToolBarSeparator::setOrientation( Orientation o ) | 186 | void KToolBarSeparator::setOrientation( Qt::Orientation o ) |
176 | { | 187 | { |
177 | orient = o; | 188 | orient = o; |
178 | if ( line ) { | 189 | if ( line ) { |
179 | if ( orientation() == Vertical ) | 190 | if ( orientation() == Qt::Vertical ) |
180 | setFrameStyle( HLine + Sunken ); | 191 | setFrameStyle( HLine + Sunken ); |
181 | else | 192 | else |
182 | setFrameStyle( VLine + Sunken ); | 193 | setFrameStyle( VLine + Sunken ); |
183 | } else { | 194 | } else { |
184 | setFrameStyle( NoFrame ); | 195 | setFrameStyle( NoFrame ); |
185 | } | 196 | } |
186 | } | 197 | } |
187 | 198 | ||
188 | void KToolBarSeparator::styleChange( QStyle& ) | 199 | void KToolBarSeparator::styleChange( QStyle& ) |
189 | { | 200 | { |
190 | setOrientation( orient ); | 201 | setOrientation( orient ); |
191 | } | 202 | } |
192 | 203 | ||
193 | QSize KToolBarSeparator::sizeHint() const | 204 | QSize KToolBarSeparator::sizeHint() const |
194 | { | 205 | { |
195 | return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); | 206 | return orientation() == Qt::Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); |
196 | } | 207 | } |
197 | 208 | ||
198 | QSizePolicy KToolBarSeparator::sizePolicy() const | 209 | QSizePolicy KToolBarSeparator::sizePolicy() const |
199 | { | 210 | { |
200 | return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); | 211 | return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); |
201 | } | 212 | } |
202 | 213 | ||
203 | KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) | 214 | KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) |
204 | #ifdef DESKTOP_VERSION | 215 | #ifdef DESKTOP_VERSION |
205 | : QToolBar( QString::fromLatin1( name ), | 216 | : Q3ToolBar( QString::fromLatin1( name ), |
206 | parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, | 217 | parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0, |
207 | parent, FALSE, | 218 | parent, FALSE, |
208 | name ? name : "mainToolBar") | 219 | name ? name : "mainToolBar") |
209 | #else | 220 | #else |
210 | : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, | 221 | : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0, |
211 | QString::fromLatin1( name )) | 222 | QString::fromLatin1( name )) |
212 | 223 | ||
213 | 224 | ||
214 | #endif | 225 | #endif |
215 | { | 226 | { |
216 | init( readConfig, honorStyle ); | 227 | init( readConfig, honorStyle ); |
217 | } | 228 | } |
218 | 229 | ||
219 | KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) | 230 | KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) |
220 | #ifdef DESKTOP_VERSION | 231 | #ifdef DESKTOP_VERSION |
221 | : QToolBar( QString::fromLatin1( name ), | 232 | : Q3ToolBar( QString::fromLatin1( name ), |
222 | parentWindow, dock, newLine, | 233 | parentWindow, dock, newLine, |
223 | name ? name : "mainToolBar") | 234 | name ? name : "mainToolBar") |
224 | #else | 235 | #else |
225 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) | 236 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) |
226 | 237 | ||
227 | 238 | ||
228 | #endif | 239 | #endif |
229 | 240 | ||
230 | { | 241 | { |
231 | init( readConfig, honorStyle ); | 242 | init( readConfig, honorStyle ); |
232 | } | 243 | } |
233 | 244 | ||
234 | KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) | 245 | KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) |
235 | #ifdef DESKTOP_VERSION | 246 | #ifdef DESKTOP_VERSION |
236 | : QToolBar( QString::fromLatin1( name ), | 247 | : Q3ToolBar( QString::fromLatin1( name ), |
237 | parentWindow, dock, newLine, | 248 | parentWindow, dock, newLine, |
238 | name ? name : "mainToolBar") | 249 | name ? name : "mainToolBar") |
239 | #else | 250 | #else |
240 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) | 251 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) |
241 | 252 | ||
242 | 253 | ||
243 | #endif | 254 | #endif |
244 | 255 | ||
245 | { | 256 | { |
246 | init( readConfig, honorStyle ); | 257 | init( readConfig, honorStyle ); |
247 | } | 258 | } |
248 | 259 | ||
249 | KToolBar::~KToolBar() | 260 | KToolBar::~KToolBar() |
250 | { | 261 | { |
251 | inshutdownprocess = true; | 262 | inshutdownprocess = true; |
252 | emit toolbarDestroyed(); | 263 | emit toolbarDestroyed(); |
@@ -267,34 +278,34 @@ void KToolBar::init( bool readConfig, bool honorStyle ) | |||
267 | this, SLOT( rebuildLayout() ) ); | 278 | this, SLOT( rebuildLayout() ) ); |
268 | connect( &(d->repaintTimer), SIGNAL( timeout() ), | 279 | connect( &(d->repaintTimer), SIGNAL( timeout() ), |
269 | this, SLOT( slotRepaint() ) ); | 280 | this, SLOT( slotRepaint() ) ); |
270 | /*US | 281 | /*US |
271 | if ( kapp ) { // may be null when started inside designer | 282 | if ( kapp ) { // may be null when started inside designer |
272 | connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); | 283 | connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); |
273 | // request notification of changes in icon style | 284 | // request notification of changes in icon style |
274 | kapp->addKipcEventMask(KIPC::IconChanged); | 285 | kapp->addKipcEventMask(KIPC::IconChanged); |
275 | connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); | 286 | connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); |
276 | } | 287 | } |
277 | */ | 288 | */ |
278 | // finally, read in our configurable settings | 289 | // finally, read in our configurable settings |
279 | if ( readConfig ) | 290 | if ( readConfig ) |
280 | slotReadConfig(); | 291 | slotReadConfig(); |
281 | 292 | ||
282 | if ( mainWindow() ) | 293 | if ( mainWindow() ) |
283 | connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), | 294 | connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ), |
284 | this, SLOT( toolBarPosChanged( QToolBar * ) ) ); | 295 | this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) ); |
285 | 296 | ||
286 | // Hack to make sure we recalculate our size when we dock. | 297 | // Hack to make sure we recalculate our size when we dock. |
287 | //US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); | 298 | //US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); |
288 | } | 299 | } |
289 | 300 | ||
290 | int KToolBar::insertButton(const QString& icon, int id, bool enabled, | 301 | int KToolBar::insertButton(const QString& icon, int id, bool enabled, |
291 | const QString& text, int index/*US, KInstance *_instance*/ ) | 302 | const QString& text, int index/*US, KInstance *_instance*/ ) |
292 | { | 303 | { |
293 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); | 304 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); |
294 | 305 | ||
295 | insertWidgetInternal( button, index, id ); | 306 | insertWidgetInternal( button, index, id ); |
296 | button->setEnabled( enabled ); | 307 | button->setEnabled( enabled ); |
297 | doConnections( button ); | 308 | doConnections( button ); |
298 | return index; | 309 | return index; |
299 | } | 310 | } |
300 | 311 | ||
@@ -328,45 +339,45 @@ int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled, | |||
328 | #endif | 339 | #endif |
329 | 340 | ||
330 | int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, | 341 | int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, |
331 | const QObject *receiver, const char *slot, | 342 | const QObject *receiver, const char *slot, |
332 | bool enabled, const QString& text, | 343 | bool enabled, const QString& text, |
333 | int index ) | 344 | int index ) |
334 | { | 345 | { |
335 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); | 346 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); |
336 | insertWidgetInternal( button, index, id ); | 347 | insertWidgetInternal( button, index, id ); |
337 | button->setEnabled( enabled ); | 348 | button->setEnabled( enabled ); |
338 | connect( button, signal, receiver, slot ); | 349 | connect( button, signal, receiver, slot ); |
339 | doConnections( button ); | 350 | doConnections( button ); |
340 | return index; | 351 | return index; |
341 | } | 352 | } |
342 | 353 | ||
343 | 354 | ||
344 | int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, | 355 | int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *popup, |
345 | bool enabled, const QString &text, int index ) | 356 | bool enabled, const QString &text, int index ) |
346 | { | 357 | { |
347 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); | 358 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); |
348 | insertWidgetInternal( button, index, id ); | 359 | insertWidgetInternal( button, index, id ); |
349 | button->setEnabled( enabled ); | 360 | button->setEnabled( enabled ); |
350 | button->setPopup( popup ); | 361 | button->setPopup( popup ); |
351 | doConnections( button ); | 362 | doConnections( button ); |
352 | return index; | 363 | return index; |
353 | } | 364 | } |
354 | 365 | ||
355 | 366 | ||
356 | int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, | 367 | int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup, |
357 | bool enabled, const QString &text, int index ) | 368 | bool enabled, const QString &text, int index ) |
358 | { | 369 | { |
359 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); | 370 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); |
360 | insertWidgetInternal( button, index, id ); | 371 | insertWidgetInternal( button, index, id ); |
361 | button->setEnabled( enabled ); | 372 | button->setEnabled( enabled ); |
362 | button->setPopup( popup ); | 373 | button->setPopup( popup ); |
363 | doConnections( button ); | 374 | doConnections( button ); |
364 | return index; | 375 | return index; |
365 | } | 376 | } |
366 | 377 | ||
367 | 378 | ||
368 | int KToolBar::insertLined (const QString& text, int id, | 379 | int KToolBar::insertLined (const QString& text, int id, |
369 | const char *signal, | 380 | const char *signal, |
370 | const QObject *receiver, const char *slot, | 381 | const QObject *receiver, const char *slot, |
371 | bool enabled , | 382 | bool enabled , |
372 | const QString& toolTipText, | 383 | const QString& toolTipText, |
@@ -527,45 +538,45 @@ void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap ) | |||
527 | if ( button ) | 538 | if ( button ) |
528 | button->setPixmap( _pixmap ); | 539 | button->setPixmap( _pixmap ); |
529 | } | 540 | } |
530 | 541 | ||
531 | 542 | ||
532 | void KToolBar::setButtonIcon( int id, const QString& _icon ) | 543 | void KToolBar::setButtonIcon( int id, const QString& _icon ) |
533 | { | 544 | { |
534 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 545 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
535 | if ( it == id2widget.end() ) | 546 | if ( it == id2widget.end() ) |
536 | return; | 547 | return; |
537 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 548 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
538 | KToolBarButton * button = (KToolBarButton *)( *it ); | 549 | KToolBarButton * button = (KToolBarButton *)( *it ); |
539 | if ( button ) | 550 | if ( button ) |
540 | button->setIcon( _icon ); | 551 | button->setIcon( _icon ); |
541 | } | 552 | } |
542 | 553 | ||
543 | void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) | 554 | void KToolBar::setButtonIconSet( int id, const QIcon& iconset ) |
544 | { | 555 | { |
545 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 556 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
546 | if ( it == id2widget.end() ) | 557 | if ( it == id2widget.end() ) |
547 | return; | 558 | return; |
548 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 559 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
549 | KToolBarButton * button = (KToolBarButton *)( *it ); | 560 | KToolBarButton * button = (KToolBarButton *)( *it ); |
550 | if ( button ) | 561 | if ( button ) |
551 | button->setIconSet( iconset ); | 562 | button->setIconSet( iconset ); |
552 | } | 563 | } |
553 | 564 | ||
554 | 565 | ||
555 | void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) | 566 | void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle ) |
556 | { | 567 | { |
557 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 568 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
558 | if ( it == id2widget.end() ) | 569 | if ( it == id2widget.end() ) |
559 | return; | 570 | return; |
560 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 571 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
561 | KToolBarButton * button = (KToolBarButton *)( *it ); | 572 | KToolBarButton * button = (KToolBarButton *)( *it ); |
562 | if ( button ) | 573 | if ( button ) |
563 | button->setDelayedPopup( _popup, toggle ); | 574 | button->setDelayedPopup( _popup, toggle ); |
564 | } | 575 | } |
565 | 576 | ||
566 | 577 | ||
567 | void KToolBar::setAutoRepeat (int id, bool flag) | 578 | void KToolBar::setAutoRepeat (int id, bool flag) |
568 | { | 579 | { |
569 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 580 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
570 | if ( it == id2widget.end() ) | 581 | if ( it == id2widget.end() ) |
571 | return; | 582 | return; |
@@ -774,33 +785,33 @@ QWidget *KToolBar::getWidget (int id) | |||
774 | { | 785 | { |
775 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 786 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
776 | return ( it == id2widget.end() ) ? 0 : (*it); | 787 | return ( it == id2widget.end() ) ? 0 : (*it); |
777 | } | 788 | } |
778 | 789 | ||
779 | 790 | ||
780 | void KToolBar::setItemAutoSized (int id, bool yes ) | 791 | void KToolBar::setItemAutoSized (int id, bool yes ) |
781 | { | 792 | { |
782 | QWidget *w = getWidget(id); | 793 | QWidget *w = getWidget(id); |
783 | if ( w && yes ) | 794 | if ( w && yes ) |
784 | setStretchableWidget( w ); | 795 | setStretchableWidget( w ); |
785 | } | 796 | } |
786 | 797 | ||
787 | 798 | ||
788 | void KToolBar::clear () | 799 | void KToolBar::clear () |
789 | { | 800 | { |
790 | QToolBar::clear(); | 801 | Q3ToolBar::clear(); |
791 | widget2id.clear(); | 802 | widget2id.clear(); |
792 | id2widget.clear(); | 803 | id2widget.clear(); |
793 | } | 804 | } |
794 | 805 | ||
795 | 806 | ||
796 | void KToolBar::removeItem(int id) | 807 | void KToolBar::removeItem(int id) |
797 | { | 808 | { |
798 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 809 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
799 | if ( it == id2widget.end() ) | 810 | if ( it == id2widget.end() ) |
800 | { | 811 | { |
801 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; | 812 | kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; |
802 | return; | 813 | return; |
803 | } | 814 | } |
804 | QWidget * w = (*it); | 815 | QWidget * w = (*it); |
805 | id2widget.remove( id ); | 816 | id2widget.remove( id ); |
806 | widget2id.remove( w ); | 817 | widget2id.remove( w ); |
@@ -863,47 +874,47 @@ bool KToolBar::fullSize() const | |||
863 | return isHorizontalStretchable() || isVerticalStretchable(); | 874 | return isHorizontalStretchable() || isVerticalStretchable(); |
864 | } | 875 | } |
865 | 876 | ||
866 | 877 | ||
867 | void KToolBar::enableMoving(bool flag ) | 878 | void KToolBar::enableMoving(bool flag ) |
868 | { | 879 | { |
869 | //US setMovingEnabled(flag); | 880 | //US setMovingEnabled(flag); |
870 | this->mainWindow()->setToolBarsMovable(flag); | 881 | this->mainWindow()->setToolBarsMovable(flag); |
871 | } | 882 | } |
872 | 883 | ||
873 | 884 | ||
874 | void KToolBar::setBarPos (BarPosition bpos) | 885 | void KToolBar::setBarPos (BarPosition bpos) |
875 | { | 886 | { |
876 | if ( !mainWindow() ) | 887 | if ( !mainWindow() ) |
877 | return; | 888 | return; |
878 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); | 889 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); |
879 | mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); | 890 | mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos ); |
880 | } | 891 | } |
881 | 892 | ||
882 | 893 | ||
883 | const KToolBar::BarPosition KToolBar::barPos() | 894 | const KToolBar::BarPosition KToolBar::barPos() |
884 | { | 895 | { |
885 | if ( !(QMainWindow*)mainWindow() ) | 896 | if ( !(Q3MainWindow*)mainWindow() ) |
886 | return KToolBar::Top; | 897 | return KToolBar::Top; |
887 | //US Dock dock; | 898 | //US Dock dock; |
888 | QMainWindow::ToolBarDock dock; | 899 | Qt::ToolBarDock dock; |
889 | int dm1, dm2; | 900 | int dm1, dm2; |
890 | bool dm3; | 901 | bool dm3; |
891 | ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); | 902 | ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 ); |
892 | //US if ( dock == DockUnmanaged ) { | 903 | //US if ( dock == DockUnmanaged ) { |
893 | if ( dock == QMainWindow::Unmanaged ) { | 904 | if ( dock == Qt::Unmanaged ) { |
894 | return (KToolBar::BarPosition)Top; | 905 | return (KToolBar::BarPosition)Top; |
895 | } | 906 | } |
896 | return (BarPosition)dock; | 907 | return (BarPosition)dock; |
897 | } | 908 | } |
898 | 909 | ||
899 | 910 | ||
900 | bool KToolBar::enable(BarStatus stat) | 911 | bool KToolBar::enable(BarStatus stat) |
901 | { | 912 | { |
902 | bool mystat = isVisible(); | 913 | bool mystat = isVisible(); |
903 | 914 | ||
904 | if ( (stat == Toggle && mystat) || stat == Hide ) | 915 | if ( (stat == Toggle && mystat) || stat == Hide ) |
905 | hide(); | 916 | hide(); |
906 | else | 917 | else |
907 | show(); | 918 | show(); |
908 | 919 | ||
909 | return isVisible() == mystat; | 920 | return isVisible() == mystat; |
@@ -954,33 +965,33 @@ void KToolBar::setIconText(IconText icontext, bool update) | |||
954 | { | 965 | { |
955 | bool doUpdate=false; | 966 | bool doUpdate=false; |
956 | 967 | ||
957 | if (icontext != d->m_iconText) { | 968 | if (icontext != d->m_iconText) { |
958 | d->m_iconText = icontext; | 969 | d->m_iconText = icontext; |
959 | doUpdate=true; | 970 | doUpdate=true; |
960 | } | 971 | } |
961 | 972 | ||
962 | if (update == false) | 973 | if (update == false) |
963 | return; | 974 | return; |
964 | 975 | ||
965 | if (doUpdate) | 976 | if (doUpdate) |
966 | emit modechange(); // tell buttons what happened | 977 | emit modechange(); // tell buttons what happened |
967 | 978 | ||
968 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) | 979 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) |
969 | if ( mainWindow() ) { | 980 | if ( mainWindow() ) { |
970 | QMainWindow *mw = mainWindow(); | 981 | Q3MainWindow *mw = mainWindow(); |
971 | mw->setUpdatesEnabled( FALSE ); | 982 | mw->setUpdatesEnabled( FALSE ); |
972 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 983 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
973 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 984 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
974 | mw->setUpdatesEnabled( TRUE ); | 985 | mw->setUpdatesEnabled( TRUE ); |
975 | } | 986 | } |
976 | } | 987 | } |
977 | 988 | ||
978 | 989 | ||
979 | KToolBar::IconText KToolBar::iconText() const | 990 | KToolBar::IconText KToolBar::iconText() const |
980 | { | 991 | { |
981 | return d->m_iconText; | 992 | return d->m_iconText; |
982 | } | 993 | } |
983 | 994 | ||
984 | 995 | ||
985 | void KToolBar::setIconSize(int size) | 996 | void KToolBar::setIconSize(int size) |
986 | { | 997 | { |
@@ -991,33 +1002,33 @@ void KToolBar::setIconSize(int size, bool update) | |||
991 | { | 1002 | { |
992 | bool doUpdate=false; | 1003 | bool doUpdate=false; |
993 | 1004 | ||
994 | if ( size != d->m_iconSize ) { | 1005 | if ( size != d->m_iconSize ) { |
995 | d->m_iconSize = size; | 1006 | d->m_iconSize = size; |
996 | doUpdate=true; | 1007 | doUpdate=true; |
997 | } | 1008 | } |
998 | 1009 | ||
999 | if (update == false) | 1010 | if (update == false) |
1000 | return; | 1011 | return; |
1001 | 1012 | ||
1002 | if (doUpdate) | 1013 | if (doUpdate) |
1003 | emit modechange(); // tell buttons what happened | 1014 | emit modechange(); // tell buttons what happened |
1004 | 1015 | ||
1005 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) | 1016 | // ugly hack to force a QMainWindow::triggerLayout( TRUE ) |
1006 | if ( mainWindow() ) { | 1017 | if ( mainWindow() ) { |
1007 | QMainWindow *mw = mainWindow(); | 1018 | Q3MainWindow *mw = mainWindow(); |
1008 | mw->setUpdatesEnabled( FALSE ); | 1019 | mw->setUpdatesEnabled( FALSE ); |
1009 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 1020 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
1010 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); | 1021 | mw->setToolBarsMovable( !mw->toolBarsMovable() ); |
1011 | mw->setUpdatesEnabled( TRUE ); | 1022 | mw->setUpdatesEnabled( TRUE ); |
1012 | } | 1023 | } |
1013 | } | 1024 | } |
1014 | 1025 | ||
1015 | 1026 | ||
1016 | int KToolBar::iconSize() const | 1027 | int KToolBar::iconSize() const |
1017 | { | 1028 | { |
1018 | /*US | 1029 | /*US |
1019 | if ( !d->m_iconSize ) // default value? | 1030 | if ( !d->m_iconSize ) // default value? |
1020 | { | 1031 | { |
1021 | if (!::qstrcmp(QObject::name(), "mainToolBar")) | 1032 | if (!::qstrcmp(QObject::name(), "mainToolBar")) |
1022 | return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); | 1033 | return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); |
1023 | else | 1034 | else |
@@ -1049,36 +1060,36 @@ void KToolBar::setItemNoStyle(int id, bool no_style ) | |||
1049 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 1060 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
1050 | if ( it == id2widget.end() ) | 1061 | if ( it == id2widget.end() ) |
1051 | return; | 1062 | return; |
1052 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 1063 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
1053 | KToolBarButton * button = (KToolBarButton *)( *it ); | 1064 | KToolBarButton * button = (KToolBarButton *)( *it ); |
1054 | if (button) | 1065 | if (button) |
1055 | button->setNoStyle( no_style ); | 1066 | button->setNoStyle( no_style ); |
1056 | } | 1067 | } |
1057 | 1068 | ||
1058 | 1069 | ||
1059 | void KToolBar::setFlat (bool flag) | 1070 | void KToolBar::setFlat (bool flag) |
1060 | { | 1071 | { |
1061 | if ( !mainWindow() ) | 1072 | if ( !mainWindow() ) |
1062 | return; | 1073 | return; |
1063 | if ( flag ) | 1074 | if ( flag ) |
1064 | //US mainWindow()->moveDockWindow( this, DockMinimized ); | 1075 | //US mainWindow()->moveDockWindow( this, DockMinimized ); |
1065 | mainWindow()->moveToolBar( this, QMainWindow::Minimized ); | 1076 | mainWindow()->moveToolBar( this, Qt::Minimized ); |
1066 | else | 1077 | else |
1067 | //US mainWindow()->moveDockWindow( this, DockTop ); | 1078 | //US mainWindow()->moveDockWindow( this, DockTop ); |
1068 | mainWindow()->moveToolBar( this, QMainWindow::Top ); | 1079 | mainWindow()->moveToolBar( this, Qt::Top ); |
1069 | // And remember to save the new look later | 1080 | // And remember to save the new look later |
1070 | /*US | 1081 | /*US |
1071 | if ( mainWindow()->inherits( "KMainWindow" ) ) | 1082 | if ( mainWindow()->inherits( "KMainWindow" ) ) |
1072 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1083 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1073 | */ | 1084 | */ |
1074 | } | 1085 | } |
1075 | 1086 | ||
1076 | 1087 | ||
1077 | int KToolBar::count() const | 1088 | int KToolBar::count() const |
1078 | { | 1089 | { |
1079 | return id2widget.count(); | 1090 | return id2widget.count(); |
1080 | } | 1091 | } |
1081 | 1092 | ||
1082 | 1093 | ||
1083 | void KToolBar::saveState() | 1094 | void KToolBar::saveState() |
1084 | { | 1095 | { |
@@ -1236,60 +1247,60 @@ QString KToolBar::text() const | |||
1236 | 1247 | ||
1237 | 1248 | ||
1238 | void KToolBar::doConnections( KToolBarButton *button ) | 1249 | void KToolBar::doConnections( KToolBarButton *button ) |
1239 | { | 1250 | { |
1240 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); | 1251 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); |
1241 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); | 1252 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); |
1242 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); | 1253 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); |
1243 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); | 1254 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); |
1244 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); | 1255 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); |
1245 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); | 1256 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); |
1246 | } | 1257 | } |
1247 | 1258 | ||
1248 | void KToolBar::mousePressEvent ( QMouseEvent *m ) | 1259 | void KToolBar::mousePressEvent ( QMouseEvent *m ) |
1249 | { | 1260 | { |
1250 | if ( !mainWindow() ) | 1261 | if ( !mainWindow() ) |
1251 | return; | 1262 | return; |
1252 | QMainWindow *mw = mainWindow(); | 1263 | Q3MainWindow *mw = mainWindow(); |
1253 | if ( mw->toolBarsMovable() && d->m_enableContext ) { | 1264 | if ( mw->toolBarsMovable() && d->m_enableContext ) { |
1254 | if ( m->button() == RightButton ) { | 1265 | if ( m->button() == Qt::RightButton ) { |
1255 | int i = contextMenu()->exec( m->globalPos(), 0 ); | 1266 | int i = contextMenu()->exec( m->globalPos(), 0 ); |
1256 | switch ( i ) { | 1267 | switch ( i ) { |
1257 | case -1: | 1268 | case -1: |
1258 | return; // popup cancelled | 1269 | return; // popup cancelled |
1259 | case CONTEXT_LEFT: | 1270 | case CONTEXT_LEFT: |
1260 | //US mw->moveDockWindow( this, DockLeft ); | 1271 | //US mw->moveDockWindow( this, DockLeft ); |
1261 | mw->moveToolBar( this, QMainWindow::Left ); | 1272 | mw->moveToolBar( this, Qt::Left ); |
1262 | break; | 1273 | break; |
1263 | case CONTEXT_RIGHT: | 1274 | case CONTEXT_RIGHT: |
1264 | //US mw->moveDockWindow( this, DockRight ); | 1275 | //US mw->moveDockWindow( this, DockRight ); |
1265 | mw->moveToolBar( this, QMainWindow::Right ); | 1276 | mw->moveToolBar( this, Qt::Right ); |
1266 | break; | 1277 | break; |
1267 | case CONTEXT_TOP: | 1278 | case CONTEXT_TOP: |
1268 | //US mw->moveDockWindow( this, DockTop ); | 1279 | //US mw->moveDockWindow( this, DockTop ); |
1269 | mw->moveToolBar( this, QMainWindow::Top ); | 1280 | mw->moveToolBar( this, Qt::Top ); |
1270 | break; | 1281 | break; |
1271 | case CONTEXT_BOTTOM: | 1282 | case CONTEXT_BOTTOM: |
1272 | //US mw->moveDockWindow( this, DockBottom ); | 1283 | //US mw->moveDockWindow( this, DockBottom ); |
1273 | mw->moveToolBar( this, QMainWindow::Bottom ); | 1284 | mw->moveToolBar( this, Qt::Bottom ); |
1274 | break; | 1285 | break; |
1275 | case CONTEXT_FLOAT: | 1286 | case CONTEXT_FLOAT: |
1276 | break; | 1287 | break; |
1277 | case CONTEXT_FLAT: | 1288 | case CONTEXT_FLAT: |
1278 | //US mw->moveDockWindow( this, DockMinimized ); | 1289 | //US mw->moveDockWindow( this, DockMinimized ); |
1279 | mw->moveToolBar( this, QMainWindow::Minimized ); | 1290 | mw->moveToolBar( this, Qt::Minimized ); |
1280 | break; | 1291 | break; |
1281 | case CONTEXT_ICONS: | 1292 | case CONTEXT_ICONS: |
1282 | setIconText( IconOnly ); | 1293 | setIconText( IconOnly ); |
1283 | break; | 1294 | break; |
1284 | case CONTEXT_TEXTRIGHT: | 1295 | case CONTEXT_TEXTRIGHT: |
1285 | setIconText( IconTextRight ); | 1296 | setIconText( IconTextRight ); |
1286 | break; | 1297 | break; |
1287 | case CONTEXT_TEXT: | 1298 | case CONTEXT_TEXT: |
1288 | setIconText( TextOnly ); | 1299 | setIconText( TextOnly ); |
1289 | break; | 1300 | break; |
1290 | case CONTEXT_TEXTUNDER: | 1301 | case CONTEXT_TEXTUNDER: |
1291 | setIconText( IconTextBottom ); | 1302 | setIconText( IconTextBottom ); |
1292 | break; | 1303 | break; |
1293 | default: | 1304 | default: |
1294 | if ( i >= CONTEXT_ICONSIZES ) | 1305 | if ( i >= CONTEXT_ICONSIZES ) |
1295 | setIconSize( i - CONTEXT_ICONSIZES ); | 1306 | setIconSize( i - CONTEXT_ICONSIZES ); |
@@ -1319,143 +1330,143 @@ void KToolBar::rebuildLayout() | |||
1319 | // clear the old layout | 1330 | // clear the old layout |
1320 | QLayoutIterator it = l->iterator(); | 1331 | QLayoutIterator it = l->iterator(); |
1321 | 1332 | ||
1322 | while ( it.current() ) { | 1333 | while ( it.current() ) { |
1323 | it.deleteCurrent(); | 1334 | it.deleteCurrent(); |
1324 | } | 1335 | } |
1325 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { | 1336 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { |
1326 | if ( w == rightAligned ) { | 1337 | if ( w == rightAligned ) { |
1327 | continue; | 1338 | continue; |
1328 | } | 1339 | } |
1329 | if ( w->inherits( "KToolBarSeparator" ) && | 1340 | if ( w->inherits( "KToolBarSeparator" ) && |
1330 | !( (KToolBarSeparator*)w )->showLine() ) { | 1341 | !( (KToolBarSeparator*)w )->showLine() ) { |
1331 | l->addSpacing( 6 ); | 1342 | l->addSpacing( 6 ); |
1332 | w->hide(); | 1343 | w->hide(); |
1333 | continue; | 1344 | continue; |
1334 | } | 1345 | } |
1335 | if ( w->inherits( "QPopupMenu" ) ) | 1346 | if ( w->inherits( "Q3PopupMenu" ) ) |
1336 | continue; | 1347 | continue; |
1337 | l->addWidget( w ); | 1348 | l->addWidget( w ); |
1338 | w->show(); | 1349 | w->show(); |
1339 | } | 1350 | } |
1340 | if ( rightAligned ) { | 1351 | if ( rightAligned ) { |
1341 | l->addStretch(); | 1352 | l->addStretch(); |
1342 | l->addWidget( rightAligned ); | 1353 | l->addWidget( rightAligned ); |
1343 | rightAligned->show(); | 1354 | rightAligned->show(); |
1344 | } | 1355 | } |
1345 | 1356 | ||
1346 | if ( fullSize() ) { | 1357 | if ( fullSize() ) { |
1347 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). | 1358 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). |
1348 | //if ( !stretchableWidget && widgets.last() && | 1359 | //if ( !stretchableWidget && widgets.last() && |
1349 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) | 1360 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) |
1350 | // setStretchableWidget( widgets.last() ); | 1361 | // setStretchableWidget( widgets.last() ); |
1351 | if ( !rightAligned ) | 1362 | if ( !rightAligned ) |
1352 | l->addStretch(); | 1363 | l->addStretch(); |
1353 | if ( stretchableWidget ) | 1364 | if ( stretchableWidget ) |
1354 | l->setStretchFactor( stretchableWidget, 10 ); | 1365 | l->setStretchFactor( stretchableWidget, 10 ); |
1355 | } | 1366 | } |
1356 | l->invalidate(); | 1367 | l->invalidate(); |
1357 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); | 1368 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); |
1358 | //#endif //DESKTOP_VERSION | 1369 | //#endif //DESKTOP_VERSION |
1359 | } | 1370 | } |
1360 | 1371 | ||
1361 | void KToolBar::childEvent( QChildEvent *e ) | 1372 | void KToolBar::childEvent( QChildEvent *e ) |
1362 | { | 1373 | { |
1363 | 1374 | ||
1364 | if ( e->child()->isWidgetType() ) { | 1375 | if ( e->child()->isWidgetType() ) { |
1365 | QWidget * w = (QWidget*)e->child(); | 1376 | QWidget * w = (QWidget*)e->child(); |
1366 | if ( e->type() == QEvent::ChildInserted ) { | 1377 | if ( e->type() == QEvent::ChildInserted ) { |
1367 | if ( !e->child()->inherits( "QPopupMenu" ) && | 1378 | if ( !e->child()->inherits( "Q3PopupMenu" ) && |
1368 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { | 1379 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { |
1369 | 1380 | ||
1370 | // prevent items that have been explicitly inserted by insert*() from | 1381 | // prevent items that have been explicitly inserted by insert*() from |
1371 | // being inserted again | 1382 | // being inserted again |
1372 | if ( !widget2id.contains( w ) ) | 1383 | if ( !widget2id.contains( w ) ) |
1373 | { | 1384 | { |
1374 | int dummy = -1; | 1385 | int dummy = -1; |
1375 | insertWidgetInternal( w, dummy, -1 ); | 1386 | insertWidgetInternal( w, dummy, -1 ); |
1376 | } | 1387 | } |
1377 | } | 1388 | } |
1378 | } else { | 1389 | } else if( e->type() == QEvent::ChildRemoved ) { |
1379 | removeWidgetInternal( w ); | 1390 | removeWidgetInternal( w ); |
1380 | } | 1391 | } |
1381 | if ( isVisibleTo( 0 ) ) | 1392 | /* TODO:hacker: if ( isVisibleTo( 0 ) ) |
1382 | { | 1393 | { |
1383 | QBoxLayout *l = boxLayout(); | 1394 | QBoxLayout *l = boxLayout(); |
1384 | // QLayout *l = layout(); | 1395 | // QLayout *l = layout(); |
1385 | 1396 | ||
1386 | // clear the old layout so that we don't get unnecassery layout | 1397 | // clear the old layout so that we don't get unnecassery layout |
1387 | // changes till we have rebuild the thing | 1398 | // changes till we have rebuild the thing |
1388 | QLayoutIterator it = l->iterator(); | 1399 | QLayoutIterator it = l->iterator(); |
1389 | while ( it.current() ) { | 1400 | while ( it.current() ) { |
1390 | it.deleteCurrent(); | 1401 | it.deleteCurrent(); |
1391 | } | 1402 | } |
1392 | layoutTimer->start( 50, TRUE ); | 1403 | layoutTimer->start( 50, TRUE ); |
1393 | } | 1404 | } */ |
1394 | } | 1405 | } |
1395 | QToolBar::childEvent( e ); | 1406 | Q3ToolBar::childEvent( e ); |
1396 | } | 1407 | } |
1397 | 1408 | ||
1398 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) | 1409 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) |
1399 | { | 1410 | { |
1400 | // we can't have it in widgets, or something is really wrong | 1411 | // we can't have it in widgets, or something is really wrong |
1401 | //widgets.removeRef( w ); | 1412 | //widgets.removeRef( w ); |
1402 | 1413 | ||
1403 | connect( w, SIGNAL( destroyed() ), | 1414 | connect( w, SIGNAL( destroyed() ), |
1404 | this, SLOT( widgetDestroyed() ) ); | 1415 | this, SLOT( widgetDestroyed() ) ); |
1405 | if ( index == -1 || index > (int)widgets.count() ) { | 1416 | if ( index == -1 || index > (int)widgets.count() ) { |
1406 | widgets.append( w ); | 1417 | widgets.append( w ); |
1407 | index = (int)widgets.count(); | 1418 | index = (int)widgets.count(); |
1408 | } | 1419 | } |
1409 | else | 1420 | else |
1410 | widgets.insert( index, w ); | 1421 | widgets.insert( index, w ); |
1411 | if ( id == -1 ) | 1422 | if ( id == -1 ) |
1412 | id = id2widget.count(); | 1423 | id = id2widget.count(); |
1413 | id2widget.insert( id, w ); | 1424 | id2widget.insert( id, w ); |
1414 | widget2id.insert( w, id ); | 1425 | widget2id.insert( w, id ); |
1415 | } | 1426 | } |
1416 | void KToolBar::repaintMe() | 1427 | void KToolBar::repaintMe() |
1417 | { | 1428 | { |
1418 | setUpdatesEnabled( true ); | 1429 | setUpdatesEnabled( true ); |
1419 | QToolBar::repaint( true ); | 1430 | Q3ToolBar::repaint( true ); |
1420 | qDebug(" KToolBar::repaintMe() "); | 1431 | qDebug(" KToolBar::repaintMe() "); |
1421 | } | 1432 | } |
1422 | 1433 | ||
1423 | void KToolBar::showEvent( QShowEvent *e ) | 1434 | void KToolBar::showEvent( QShowEvent *e ) |
1424 | { | 1435 | { |
1425 | rebuildLayout(); | 1436 | rebuildLayout(); |
1426 | QToolBar::showEvent( e ); | 1437 | Q3ToolBar::showEvent( e ); |
1427 | } | 1438 | } |
1428 | 1439 | ||
1429 | void KToolBar::setStretchableWidget( QWidget *w ) | 1440 | void KToolBar::setStretchableWidget( QWidget *w ) |
1430 | { | 1441 | { |
1431 | QToolBar::setStretchableWidget( w ); | 1442 | Q3ToolBar::setStretchableWidget( w ); |
1432 | stretchableWidget = w; | 1443 | stretchableWidget = w; |
1433 | } | 1444 | } |
1434 | 1445 | ||
1435 | QSizePolicy KToolBar::sizePolicy() const | 1446 | QSizePolicy KToolBar::sizePolicy() const |
1436 | { | 1447 | { |
1437 | if ( orientation() == Horizontal ) | 1448 | if ( orientation() == Qt::Horizontal ) |
1438 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); | 1449 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); |
1439 | else | 1450 | else |
1440 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); | 1451 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); |
1441 | } | 1452 | } |
1442 | 1453 | ||
1443 | QSize KToolBar::sizeHint() const | 1454 | QSize KToolBar::sizeHint() const |
1444 | { | 1455 | { |
1445 | QSize sh = QToolBar::sizeHint(); | 1456 | QSize sh = Q3ToolBar::sizeHint(); |
1446 | //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); | 1457 | //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); |
1447 | if ( sh.height() <= 20 || sh.width() < 60 ) | 1458 | if ( sh.height() <= 20 || sh.width() < 60 ) |
1448 | return QSize( sizeHintW, sizeHintH ); | 1459 | return QSize( sizeHintW, sizeHintH ); |
1449 | KToolBar* ttt = (KToolBar*) this; | 1460 | KToolBar* ttt = (KToolBar*) this; |
1450 | ttt->sizeHintW = sh.width(); | 1461 | ttt->sizeHintW = sh.width(); |
1451 | ttt->sizeHintH = sh.height(); | 1462 | ttt->sizeHintH = sh.height(); |
1452 | return sh; | 1463 | return sh; |
1453 | //return QToolBar::sizeHint(); | 1464 | //return QToolBar::sizeHint(); |
1454 | #if 0 | 1465 | #if 0 |
1455 | QWidget::polish(); | 1466 | QWidget::polish(); |
1456 | static int iii = 0; | 1467 | static int iii = 0; |
1457 | ++iii; | 1468 | ++iii; |
1458 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); | 1469 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); |
1459 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); | 1470 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); |
1460 | switch( barPos() ) | 1471 | switch( barPos() ) |
1461 | { | 1472 | { |
@@ -1495,69 +1506,69 @@ QSize KToolBar::sizeHint() const | |||
1495 | else | 1506 | else |
1496 | { | 1507 | { |
1497 | QSize sh = w->sizeHint(); | 1508 | QSize sh = w->sizeHint(); |
1498 | if (!sh.isValid()) | 1509 | if (!sh.isValid()) |
1499 | sh = w->minimumSize(); | 1510 | sh = w->minimumSize(); |
1500 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); | 1511 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); |
1501 | minSize += QSize(0, sh.height()+1); | 1512 | minSize += QSize(0, sh.height()+1); |
1502 | } | 1513 | } |
1503 | } | 1514 | } |
1504 | /*US | 1515 | /*US |
1505 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 1516 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
1506 | */ | 1517 | */ |
1507 | minSize += QSize(margin*2, margin*2); | 1518 | minSize += QSize(margin*2, margin*2); |
1508 | break; | 1519 | break; |
1509 | 1520 | ||
1510 | default: | 1521 | default: |
1511 | minSize = QToolBar::sizeHint(); | 1522 | minSize = Q3ToolBar::sizeHint(); |
1512 | break; | 1523 | break; |
1513 | } | 1524 | } |
1514 | return minSize; | 1525 | return minSize; |
1515 | #endif | 1526 | #endif |
1516 | } | 1527 | } |
1517 | 1528 | ||
1518 | QSize KToolBar::minimumSize() const | 1529 | QSize KToolBar::minimumSize() const |
1519 | { | 1530 | { |
1520 | return minimumSizeHint(); | 1531 | return minimumSizeHint(); |
1521 | } | 1532 | } |
1522 | 1533 | ||
1523 | QSize KToolBar::minimumSizeHint() const | 1534 | QSize KToolBar::minimumSizeHint() const |
1524 | { | 1535 | { |
1525 | return sizeHint(); | 1536 | return sizeHint(); |
1526 | } | 1537 | } |
1527 | 1538 | ||
1528 | bool KToolBar::highlight() const | 1539 | bool KToolBar::highlight() const |
1529 | { | 1540 | { |
1530 | return d->m_highlight; | 1541 | return d->m_highlight; |
1531 | } | 1542 | } |
1532 | 1543 | ||
1533 | void KToolBar::hide() | 1544 | void KToolBar::hide() |
1534 | { | 1545 | { |
1535 | QToolBar::hide(); | 1546 | Q3ToolBar::hide(); |
1536 | } | 1547 | } |
1537 | 1548 | ||
1538 | void KToolBar::show() | 1549 | void KToolBar::show() |
1539 | { | 1550 | { |
1540 | QToolBar::show(); | 1551 | Q3ToolBar::show(); |
1541 | } | 1552 | } |
1542 | 1553 | ||
1543 | void KToolBar::resizeEvent( QResizeEvent *e ) | 1554 | void KToolBar::resizeEvent( QResizeEvent *e ) |
1544 | { | 1555 | { |
1545 | bool b = isUpdatesEnabled(); | 1556 | bool b = isUpdatesEnabled(); |
1546 | setUpdatesEnabled( FALSE ); | 1557 | setUpdatesEnabled( FALSE ); |
1547 | QToolBar::resizeEvent( e ); | 1558 | Q3ToolBar::resizeEvent( e ); |
1548 | if (b) | 1559 | if (b) |
1549 | d->repaintTimer.start( 100, true ); | 1560 | d->repaintTimer.start( 100, true ); |
1550 | } | 1561 | } |
1551 | 1562 | ||
1552 | void KToolBar::slotIconChanged(int group) | 1563 | void KToolBar::slotIconChanged(int group) |
1553 | { | 1564 | { |
1554 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) | 1565 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) |
1555 | return; | 1566 | return; |
1556 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) | 1567 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) |
1557 | return; | 1568 | return; |
1558 | 1569 | ||
1559 | emit modechange(); | 1570 | emit modechange(); |
1560 | if (isVisible()) | 1571 | if (isVisible()) |
1561 | updateGeometry(); | 1572 | updateGeometry(); |
1562 | } | 1573 | } |
1563 | 1574 | ||
@@ -1713,33 +1724,33 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr | |||
1713 | else | 1724 | else |
1714 | icon_text = IconOnly; | 1725 | icon_text = IconOnly; |
1715 | 1726 | ||
1716 | // check if the icon/text has changed | 1727 | // check if the icon/text has changed |
1717 | if (icon_text != d->m_iconText) { | 1728 | if (icon_text != d->m_iconText) { |
1718 | //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; | 1729 | //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; |
1719 | setIconText(icon_text, false); | 1730 | setIconText(icon_text, false); |
1720 | doUpdate = true; | 1731 | doUpdate = true; |
1721 | } | 1732 | } |
1722 | 1733 | ||
1723 | // ...and check if the icon size has changed | 1734 | // ...and check if the icon size has changed |
1724 | if (iconsize != d->m_iconSize) { | 1735 | if (iconsize != d->m_iconSize) { |
1725 | setIconSize(iconsize, false); | 1736 | setIconSize(iconsize, false); |
1726 | doUpdate = true; | 1737 | doUpdate = true; |
1727 | } | 1738 | } |
1728 | 1739 | ||
1729 | QMainWindow *mw = mainWindow(); | 1740 | Q3MainWindow *mw = mainWindow(); |
1730 | 1741 | ||
1731 | // ...and if we should highlight | 1742 | // ...and if we should highlight |
1732 | if ( highlight != d->m_highlight ) { | 1743 | if ( highlight != d->m_highlight ) { |
1733 | d->m_highlight = highlight; | 1744 | d->m_highlight = highlight; |
1734 | doUpdate = true; | 1745 | doUpdate = true; |
1735 | } | 1746 | } |
1736 | 1747 | ||
1737 | // ...and if we should move transparently | 1748 | // ...and if we should move transparently |
1738 | if ( mw && transparent != (!mw->opaqueMoving()) ) { | 1749 | if ( mw && transparent != (!mw->opaqueMoving()) ) { |
1739 | mw->setOpaqueMoving( !transparent ); | 1750 | mw->setOpaqueMoving( !transparent ); |
1740 | } | 1751 | } |
1741 | 1752 | ||
1742 | if (doUpdate) | 1753 | if (doUpdate) |
1743 | emit modechange(); // tell buttons what happened | 1754 | emit modechange(); // tell buttons what happened |
1744 | if (isVisible ()) | 1755 | if (isVisible ()) |
1745 | updateGeometry(); | 1756 | updateGeometry(); |
@@ -1792,55 +1803,55 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup) | |||
1792 | bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault); | 1803 | bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault); |
1793 | 1804 | ||
1794 | /*US Dock pos(DockTop); | 1805 | /*US Dock pos(DockTop); |
1795 | if ( position == "Top" ) | 1806 | if ( position == "Top" ) |
1796 | pos = DockTop; | 1807 | pos = DockTop; |
1797 | else if ( position == "Bottom" ) | 1808 | else if ( position == "Bottom" ) |
1798 | pos = DockBottom; | 1809 | pos = DockBottom; |
1799 | else if ( position == "Left" ) | 1810 | else if ( position == "Left" ) |
1800 | pos = DockLeft; | 1811 | pos = DockLeft; |
1801 | else if ( position == "Right" ) | 1812 | else if ( position == "Right" ) |
1802 | pos = DockRight; | 1813 | pos = DockRight; |
1803 | else if ( position == "Floating" ) | 1814 | else if ( position == "Floating" ) |
1804 | pos = DockTornOff; | 1815 | pos = DockTornOff; |
1805 | else if ( position == "Flat" ) | 1816 | else if ( position == "Flat" ) |
1806 | pos = DockMinimized; | 1817 | pos = DockMinimized; |
1807 | */ | 1818 | */ |
1808 | QMainWindow::ToolBarDock pos(QMainWindow::Top); | 1819 | Qt::ToolBarDock pos(Qt::DockTop); |
1809 | if ( position == "Top" ) | 1820 | if ( position == "Top" ) |
1810 | pos = QMainWindow::Top; | 1821 | pos = Qt::Top; |
1811 | else if ( position == "Bottom" ) | 1822 | else if ( position == "Bottom" ) |
1812 | pos = QMainWindow::Bottom; | 1823 | pos = Qt::Bottom; |
1813 | else if ( position == "Left" ) | 1824 | else if ( position == "Left" ) |
1814 | pos = QMainWindow::Left; | 1825 | pos = Qt::Left; |
1815 | else if ( position == "Right" ) | 1826 | else if ( position == "Right" ) |
1816 | pos = QMainWindow::Right; | 1827 | pos = Qt::Right; |
1817 | else if ( position == "Floating" ) | 1828 | else if ( position == "Floating" ) |
1818 | pos = QMainWindow::TornOff; | 1829 | pos = Qt::TornOff; |
1819 | else if ( position == "Flat" ) | 1830 | else if ( position == "Flat" ) |
1820 | pos = QMainWindow::Minimized; | 1831 | pos = Qt::Minimized; |
1821 | 1832 | ||
1822 | //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; | 1833 | //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; |
1823 | if (hidden) | 1834 | if (hidden) |
1824 | hide(); | 1835 | hide(); |
1825 | else | 1836 | else |
1826 | show(); | 1837 | show(); |
1827 | 1838 | ||
1828 | if ( mainWindow() ) | 1839 | if ( mainWindow() ) |
1829 | { | 1840 | { |
1830 | QMainWindow *mw = mainWindow(); | 1841 | Q3MainWindow *mw = mainWindow(); |
1831 | 1842 | ||
1832 | //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; | 1843 | //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; |
1833 | d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); | 1844 | d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); |
1834 | 1845 | ||
1835 | // moveDockWindow calls QDockArea which does a reparent() on us with | 1846 | // moveDockWindow calls QDockArea which does a reparent() on us with |
1836 | // showIt = true, so we loose our visibility status | 1847 | // showIt = true, so we loose our visibility status |
1837 | bool doHide = isHidden(); | 1848 | bool doHide = isHidden(); |
1838 | 1849 | ||
1839 | //US mw->moveDockWindow( this, pos, newLine, index, offset ); | 1850 | //US mw->moveDockWindow( this, pos, newLine, index, offset ); |
1840 | mw->moveToolBar( this, pos, newLine, index, offset ); | 1851 | mw->moveToolBar( this, pos, newLine, index, offset ); |
1841 | 1852 | ||
1842 | //kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl; | 1853 | //kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl; |
1843 | if ( doHide ) | 1854 | if ( doHide ) |
1844 | hide(); | 1855 | hide(); |
1845 | } | 1856 | } |
1846 | if (isVisible ()) | 1857 | if (isVisible ()) |
@@ -1849,58 +1860,58 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup) | |||
1849 | } | 1860 | } |
1850 | 1861 | ||
1851 | bool KToolBar::event( QEvent *e ) | 1862 | bool KToolBar::event( QEvent *e ) |
1852 | { | 1863 | { |
1853 | if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() ) | 1864 | if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() ) |
1854 | d->repaintTimer.start( 100, true ); | 1865 | d->repaintTimer.start( 100, true ); |
1855 | 1866 | ||
1856 | if (e->type() == QEvent::ChildInserted ) | 1867 | if (e->type() == QEvent::ChildInserted ) |
1857 | { | 1868 | { |
1858 | // By pass QToolBar::event, | 1869 | // By pass QToolBar::event, |
1859 | // it will show() the inserted child and we don't want to | 1870 | // it will show() the inserted child and we don't want to |
1860 | // do that until we have rebuild the layout. | 1871 | // do that until we have rebuild the layout. |
1861 | childEvent((QChildEvent *)e); | 1872 | childEvent((QChildEvent *)e); |
1862 | return true; | 1873 | return true; |
1863 | } | 1874 | } |
1864 | 1875 | ||
1865 | return QToolBar::event( e ); | 1876 | return Q3ToolBar::event( e ); |
1866 | } | 1877 | } |
1867 | 1878 | ||
1868 | void KToolBar::slotRepaint() | 1879 | void KToolBar::slotRepaint() |
1869 | { | 1880 | { |
1870 | setUpdatesEnabled( FALSE ); | 1881 | setUpdatesEnabled( FALSE ); |
1871 | // Send a resizeEvent to update the "toolbar extension arrow" | 1882 | // Send a resizeEvent to update the "toolbar extension arrow" |
1872 | // (The button you get when your toolbar-items don't fit in | 1883 | // (The button you get when your toolbar-items don't fit in |
1873 | // the available space) | 1884 | // the available space) |
1874 | QResizeEvent ev(size(), size()); | 1885 | QResizeEvent ev(size(), size()); |
1875 | resizeEvent(&ev); | 1886 | resizeEvent(&ev); |
1876 | //#ifdef DESKTOP_VERSION | 1887 | //#ifdef DESKTOP_VERSION |
1877 | QApplication::sendPostedEvents( this, QEvent::LayoutHint ); | 1888 | QApplication::sendPostedEvents( this, QEvent::LayoutHint ); |
1878 | //#endif //DESKTOP_VERSION | 1889 | //#endif //DESKTOP_VERSION |
1879 | setUpdatesEnabled( TRUE ); | 1890 | setUpdatesEnabled( TRUE ); |
1880 | repaint( TRUE ); | 1891 | repaint( TRUE ); |
1881 | } | 1892 | } |
1882 | 1893 | ||
1883 | void KToolBar::toolBarPosChanged( QToolBar *tb ) | 1894 | void KToolBar::toolBarPosChanged( Q3ToolBar *tb ) |
1884 | { | 1895 | { |
1885 | if ( tb != this ) | 1896 | if ( tb != this ) |
1886 | return; | 1897 | return; |
1887 | //US if ( d->oldPos == DockMinimized ) | 1898 | //US if ( d->oldPos == DockMinimized ) |
1888 | if ( d->oldPos == QMainWindow::Minimized ) | 1899 | if ( d->oldPos == Qt::Minimized ) |
1889 | rebuildLayout(); | 1900 | rebuildLayout(); |
1890 | d->oldPos = (QMainWindow::ToolBarDock)barPos(); | 1901 | d->oldPos = (Qt::ToolBarDock)barPos(); |
1891 | /*US | 1902 | /*US |
1892 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) | 1903 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) |
1893 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1904 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1894 | */ | 1905 | */ |
1895 | } | 1906 | } |
1896 | 1907 | ||
1897 | /*US | 1908 | /*US |
1898 | void KToolBar::loadState( const QDomElement &element ) | 1909 | void KToolBar::loadState( const QDomElement &element ) |
1899 | { | 1910 | { |
1900 | //kdDebug(220) << "KToolBar::loadState " << this << endl; | 1911 | //kdDebug(220) << "KToolBar::loadState " << this << endl; |
1901 | if ( !mainWindow() ) | 1912 | if ( !mainWindow() ) |
1902 | return; | 1913 | return; |
1903 | 1914 | ||
1904 | { | 1915 | { |
1905 | QCString text = element.namedItem( "text" ).toElement().text().utf8(); | 1916 | QCString text = element.namedItem( "text" ).toElement().text().utf8(); |
1906 | if ( text.isEmpty() ) | 1917 | if ( text.isEmpty() ) |
@@ -2018,33 +2029,33 @@ void KToolBar::getAttributes( QString &position, QString &icontext, int &index ) | |||
2018 | case KToolBar::Left: | 2029 | case KToolBar::Left: |
2019 | position = "Left"; | 2030 | position = "Left"; |
2020 | break; | 2031 | break; |
2021 | case KToolBar::Right: | 2032 | case KToolBar::Right: |
2022 | position = "Right"; | 2033 | position = "Right"; |
2023 | break; | 2034 | break; |
2024 | case KToolBar::Floating: | 2035 | case KToolBar::Floating: |
2025 | position = "Floating"; | 2036 | position = "Floating"; |
2026 | break; | 2037 | break; |
2027 | case KToolBar::Top: | 2038 | case KToolBar::Top: |
2028 | default: | 2039 | default: |
2029 | position = "Top"; | 2040 | position = "Top"; |
2030 | break; | 2041 | break; |
2031 | } | 2042 | } |
2032 | 2043 | ||
2033 | if ( mainWindow() ) { | 2044 | if ( mainWindow() ) { |
2034 | QMainWindow::ToolBarDock dock; | 2045 | Qt::ToolBarDock dock; |
2035 | bool newLine; | 2046 | bool newLine; |
2036 | int offset; | 2047 | int offset; |
2037 | mainWindow()->getLocation( this, dock, index, newLine, offset ); | 2048 | mainWindow()->getLocation( this, dock, index, newLine, offset ); |
2038 | } | 2049 | } |
2039 | 2050 | ||
2040 | switch (d->m_iconText) { | 2051 | switch (d->m_iconText) { |
2041 | case KToolBar::IconTextRight: | 2052 | case KToolBar::IconTextRight: |
2042 | icontext = "IconTextRight"; | 2053 | icontext = "IconTextRight"; |
2043 | break; | 2054 | break; |
2044 | case KToolBar::IconTextBottom: | 2055 | case KToolBar::IconTextBottom: |
2045 | icontext = "IconTextBottom"; | 2056 | icontext = "IconTextBottom"; |
2046 | break; | 2057 | break; |
2047 | case KToolBar::TextOnly: | 2058 | case KToolBar::TextOnly: |
2048 | icontext = "TextOnly"; | 2059 | icontext = "TextOnly"; |
2049 | break; | 2060 | break; |
2050 | case KToolBar::IconOnly: | 2061 | case KToolBar::IconOnly: |
@@ -2087,78 +2098,78 @@ void KToolBar::positionYourself( bool force ) | |||
2087 | bool doHide = isHidden(); | 2098 | bool doHide = isHidden(); |
2088 | //kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl; | 2099 | //kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl; |
2089 | /*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock, | 2100 | /*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock, |
2090 | d->toolBarInfo.newline, | 2101 | d->toolBarInfo.newline, |
2091 | d->toolBarInfo.index, | 2102 | d->toolBarInfo.index, |
2092 | d->toolBarInfo.offset ); | 2103 | d->toolBarInfo.offset ); |
2093 | */ | 2104 | */ |
2094 | mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); | 2105 | mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); |
2095 | 2106 | ||
2096 | if ( doHide ) | 2107 | if ( doHide ) |
2097 | hide(); | 2108 | hide(); |
2098 | // This method can only have an effect once - unless force is set | 2109 | // This method can only have an effect once - unless force is set |
2099 | d->positioned = TRUE; | 2110 | d->positioned = TRUE; |
2100 | } | 2111 | } |
2101 | 2112 | ||
2102 | //US KPopupMenu *KToolBar::contextMenu() | 2113 | //US KPopupMenu *KToolBar::contextMenu() |
2103 | QPopupMenu *KToolBar::contextMenu() | 2114 | Q3PopupMenu *KToolBar::contextMenu() |
2104 | { | 2115 | { |
2105 | if ( context ) | 2116 | if ( context ) |
2106 | return context; | 2117 | return context; |
2107 | 2118 | ||
2108 | // Construct our context popup menu. Name it qt_dockwidget_internal so it | 2119 | // Construct our context popup menu. Name it qt_dockwidget_internal so it |
2109 | // won't be deleted by QToolBar::clear(). | 2120 | // won't be deleted by QToolBar::clear(). |
2110 | //US context = new KPopupMenu( this, "qt_dockwidget_internal" ); | 2121 | //US context = new KPopupMenu( this, "qt_dockwidget_internal" ); |
2111 | context = new QPopupMenu( this, "qt_dockwidget_internal" ); | 2122 | context = new Q3PopupMenu( this, "qt_dockwidget_internal" ); |
2112 | //US context->insertTitle(i18n("Toolbar Menu")); | 2123 | //US context->insertTitle(i18n("Toolbar Menu")); |
2113 | 2124 | ||
2114 | //US KPopupMenu *orient = new KPopupMenu( context, "orient" ); | 2125 | //US KPopupMenu *orient = new KPopupMenu( context, "orient" ); |
2115 | QPopupMenu *orient = new QPopupMenu( context, "orient" ); | 2126 | Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" ); |
2116 | orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); | 2127 | orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); |
2117 | orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT ); | 2128 | orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT ); |
2118 | orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT ); | 2129 | orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT ); |
2119 | orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM ); | 2130 | orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM ); |
2120 | orient->insertSeparator(-1); | 2131 | orient->insertSeparator(-1); |
2121 | //orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT ); | 2132 | //orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT ); |
2122 | orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT ); | 2133 | orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT ); |
2123 | 2134 | ||
2124 | //US KPopupMenu *mode = new KPopupMenu( context, "mode" ); | 2135 | //US KPopupMenu *mode = new KPopupMenu( context, "mode" ); |
2125 | QPopupMenu *mode = new QPopupMenu( context, "mode" ); | 2136 | Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" ); |
2126 | mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); | 2137 | mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); |
2127 | mode->insertItem( i18n("Text Only"), CONTEXT_TEXT ); | 2138 | mode->insertItem( i18n("Text Only"), CONTEXT_TEXT ); |
2128 | mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT ); | 2139 | mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT ); |
2129 | mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER ); | 2140 | mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER ); |
2130 | 2141 | ||
2131 | //US KPopupMenu *size = new KPopupMenu( context, "size" ); | 2142 | //US KPopupMenu *size = new KPopupMenu( context, "size" ); |
2132 | QPopupMenu *size = new QPopupMenu( context, "size" ); | 2143 | Q3PopupMenu *size = new Q3PopupMenu( context, "size" ); |
2133 | size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); | 2144 | size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); |
2134 | // Query the current theme for available sizes | 2145 | // Query the current theme for available sizes |
2135 | QValueList<int> avSizes; | 2146 | Q3ValueList<int> avSizes; |
2136 | /*US | 2147 | /*US |
2137 | KIconTheme *theme = KGlobal::instance()->iconLoader()->theme(); | 2148 | KIconTheme *theme = KGlobal::instance()->iconLoader()->theme(); |
2138 | if (!::qstrcmp(QObject::name(), "mainToolBar")) | 2149 | if (!::qstrcmp(QObject::name(), "mainToolBar")) |
2139 | avSizes = theme->querySizes( KIcon::MainToolbar); | 2150 | avSizes = theme->querySizes( KIcon::MainToolbar); |
2140 | else | 2151 | else |
2141 | avSizes = theme->querySizes( KIcon::Toolbar); | 2152 | avSizes = theme->querySizes( KIcon::Toolbar); |
2142 | */ | 2153 | */ |
2143 | avSizes << 16; | 2154 | avSizes << 16; |
2144 | avSizes << 32; | 2155 | avSizes << 32; |
2145 | 2156 | ||
2146 | d->iconSizes = avSizes; | 2157 | d->iconSizes = avSizes; |
2147 | 2158 | ||
2148 | QValueList<int>::Iterator it; | 2159 | Q3ValueList<int>::Iterator it; |
2149 | for (it=avSizes.begin(); it!=avSizes.end(); it++) { | 2160 | for (it=avSizes.begin(); it!=avSizes.end(); it++) { |
2150 | QString text; | 2161 | QString text; |
2151 | if ( *it < 19 ) | 2162 | if ( *it < 19 ) |
2152 | text = i18n("Small (%1x%2)").arg(*it).arg(*it); | 2163 | text = i18n("Small (%1x%2)").arg(*it).arg(*it); |
2153 | else if (*it < 25) | 2164 | else if (*it < 25) |
2154 | text = i18n("Medium (%1x%2)").arg(*it).arg(*it); | 2165 | text = i18n("Medium (%1x%2)").arg(*it).arg(*it); |
2155 | else | 2166 | else |
2156 | text = i18n("Large (%1x%2)").arg(*it).arg(*it); | 2167 | text = i18n("Large (%1x%2)").arg(*it).arg(*it); |
2157 | //we use the size as an id, with an offset | 2168 | //we use the size as an id, with an offset |
2158 | size->insertItem( text, CONTEXT_ICONSIZES + *it ); | 2169 | size->insertItem( text, CONTEXT_ICONSIZES + *it ); |
2159 | } | 2170 | } |
2160 | 2171 | ||
2161 | context->insertItem( i18n("Orientation"), orient ); | 2172 | context->insertItem( i18n("Orientation"), orient ); |
2162 | orient->setItemChecked(CONTEXT_TOP, true); | 2173 | orient->setItemChecked(CONTEXT_TOP, true); |
2163 | context->insertItem( i18n("Text Position"), mode ); | 2174 | context->insertItem( i18n("Text Position"), mode ); |
2164 | context->setItemChecked(CONTEXT_ICONS, true); | 2175 | context->setItemChecked(CONTEXT_ICONS, true); |
@@ -2205,34 +2216,34 @@ void KToolBar::slotContextAboutToShow() | |||
2205 | { | 2216 | { |
2206 | case IconOnly: | 2217 | case IconOnly: |
2207 | default: | 2218 | default: |
2208 | context->setItemChecked(CONTEXT_ICONS, true); | 2219 | context->setItemChecked(CONTEXT_ICONS, true); |
2209 | break; | 2220 | break; |
2210 | case IconTextRight: | 2221 | case IconTextRight: |
2211 | context->setItemChecked(CONTEXT_TEXTRIGHT, true); | 2222 | context->setItemChecked(CONTEXT_TEXTRIGHT, true); |
2212 | break; | 2223 | break; |
2213 | case TextOnly: | 2224 | case TextOnly: |
2214 | context->setItemChecked(CONTEXT_TEXT, true); | 2225 | context->setItemChecked(CONTEXT_TEXT, true); |
2215 | break; | 2226 | break; |
2216 | case IconTextBottom: | 2227 | case IconTextBottom: |
2217 | context->setItemChecked(CONTEXT_TEXTUNDER, true); | 2228 | context->setItemChecked(CONTEXT_TEXTUNDER, true); |
2218 | break; | 2229 | break; |
2219 | } | 2230 | } |
2220 | 2231 | ||
2221 | QValueList<int>::ConstIterator iIt = d->iconSizes.begin(); | 2232 | Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin(); |
2222 | QValueList<int>::ConstIterator iEnd = d->iconSizes.end(); | 2233 | Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end(); |
2223 | for (; iIt != iEnd; ++iIt ) | 2234 | for (; iIt != iEnd; ++iIt ) |
2224 | context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false ); | 2235 | context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false ); |
2225 | 2236 | ||
2226 | context->setItemChecked( CONTEXT_ICONSIZES, false ); | 2237 | context->setItemChecked( CONTEXT_ICONSIZES, false ); |
2227 | 2238 | ||
2228 | context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true ); | 2239 | context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true ); |
2229 | 2240 | ||
2230 | for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i ) | 2241 | for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i ) |
2231 | context->setItemChecked( i, false ); | 2242 | context->setItemChecked( i, false ); |
2232 | 2243 | ||
2233 | switch ( barPos() ) | 2244 | switch ( barPos() ) |
2234 | { | 2245 | { |
2235 | case KToolBar::Flat: | 2246 | case KToolBar::Flat: |
2236 | context->setItemChecked( CONTEXT_FLAT, true ); | 2247 | context->setItemChecked( CONTEXT_FLAT, true ); |
2237 | break; | 2248 | break; |
2238 | case KToolBar::Bottom: | 2249 | case KToolBar::Bottom: |
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 3319fa8..4e00abd 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h | |||
@@ -13,134 +13,142 @@ | |||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KTOOLBAR_H | 24 | #ifndef KTOOLBAR_H |
25 | #define KTOOLBAR_H | 25 | #define KTOOLBAR_H |
26 | 26 | ||
27 | #ifndef DESKTOP_VERSION | 27 | #ifndef DESKTOP_VERSION |
28 | #define private public | 28 | #define private public |
29 | #include <qtoolbar.h> | 29 | #include <q3toolbar.h> |
30 | #undef private | 30 | #undef private |
31 | #include <qpe/qpetoolbar.h> | 31 | #include <qpe/qpetoolbar.h> |
32 | #else | 32 | #else |
33 | #include <qtoolbar.h> | 33 | #include <q3toolbar.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <q3mainwindow.h> |
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qmap.h> | 39 | #include <qmap.h> |
40 | #include <qptrlist.h> | 40 | #include <q3ptrlist.h> |
41 | //Added by qt3to4: | ||
42 | #include <QPixmap> | ||
43 | #include <QResizeEvent> | ||
44 | #include <Q3PopupMenu> | ||
45 | #include <QMouseEvent> | ||
46 | #include <QChildEvent> | ||
47 | #include <QEvent> | ||
48 | #include <QShowEvent> | ||
41 | #include <kglobal.h> | 49 | #include <kglobal.h> |
42 | #include <qguardedptr.h> | 50 | #include <qpointer.h> |
43 | #include <qframe.h> | 51 | #include <q3frame.h> |
44 | #include <qiconset.h> | 52 | #include <qicon.h> |
45 | 53 | ||
46 | class QDomElement; | 54 | class QDomElement; |
47 | class QSize; | 55 | class QSize; |
48 | class QPixmap; | 56 | class QPixmap; |
49 | class QPopupMenu; | 57 | class Q3PopupMenu; |
50 | class QStringList; | 58 | class QStringList; |
51 | class QDomDocument; | 59 | class QDomDocument; |
52 | class QTimer; | 60 | class QTimer; |
53 | 61 | ||
54 | class KLineEdit; | 62 | class KLineEdit; |
55 | class KToolBar; | 63 | class KToolBar; |
56 | class KToolBarButton; | 64 | class KToolBarButton; |
57 | class KToolBoxManager; | 65 | class KToolBoxManager; |
58 | //US class KAnimWidget; | 66 | //US class KAnimWidget; |
59 | //US class KPopupMenu; | 67 | //US class KPopupMenu; |
60 | //US class KInstance; | 68 | //US class KInstance; |
61 | class KComboBox; | 69 | class KComboBox; |
62 | class KXMLGUIClient; | 70 | class KXMLGUIClient; |
63 | 71 | ||
64 | class KToolBarPrivate; | 72 | class KToolBarPrivate; |
65 | 73 | ||
66 | class KToolBarSeparator : public QFrame | 74 | class KToolBarSeparator : public Q3Frame |
67 | { | 75 | { |
68 | Q_OBJECT | 76 | Q_OBJECT |
69 | public: | 77 | public: |
70 | KToolBarSeparator( Orientation, bool l, QToolBar *parent, const char* name=0 ); | 78 | KToolBarSeparator( Qt::Orientation, bool l, Q3ToolBar *parent, const char* name=0 ); |
71 | 79 | ||
72 | QSize sizeHint() const; | 80 | QSize sizeHint() const; |
73 | Orientation orientation() const { return orient; } | 81 | Qt::Orientation orientation() const { return orient; } |
74 | QSizePolicy sizePolicy() const; | 82 | QSizePolicy sizePolicy() const; |
75 | bool showLine() const { return line; } | 83 | bool showLine() const { return line; } |
76 | public slots: | 84 | public slots: |
77 | void setOrientation( Orientation ); | 85 | void setOrientation( Qt::Orientation ); |
78 | protected: | 86 | protected: |
79 | void styleChange( QStyle& ); | 87 | void styleChange( QStyle& ); |
80 | private: | 88 | private: |
81 | Orientation orient; | 89 | Qt::Orientation orient; |
82 | bool line; | 90 | bool line; |
83 | }; | 91 | }; |
84 | 92 | ||
85 | 93 | ||
86 | /** | 94 | /** |
87 | * A KDE-style toolbar. | 95 | * A KDE-style toolbar. |
88 | * | 96 | * |
89 | * KToolBar can be dragged around in and between different docks. | 97 | * KToolBar can be dragged around in and between different docks. |
90 | * | 98 | * |
91 | * A KToolBar can contain all sorts of widgets. | 99 | * A KToolBar can contain all sorts of widgets. |
92 | * | 100 | * |
93 | * KToolBar can be used as a standalone widget, but @ref KMainWindow | 101 | * KToolBar can be used as a standalone widget, but @ref KMainWindow |
94 | * provides easy factories and management of one or more toolbars. | 102 | * provides easy factories and management of one or more toolbars. |
95 | * Once you have a KToolBar object, you can insert items into it with the | 103 | * Once you have a KToolBar object, you can insert items into it with the |
96 | * insert... methods, or remove them with the @ref removeItem() method. This | 104 | * insert... methods, or remove them with the @ref removeItem() method. This |
97 | * can be done at any time; the toolbar will be automatically updated. | 105 | * can be done at any time; the toolbar will be automatically updated. |
98 | * There are also many methods to set per-child properties like alignment | 106 | * There are also many methods to set per-child properties like alignment |
99 | * and toggle behaviour. | 107 | * and toggle behaviour. |
100 | * | 108 | * |
101 | * KToolBar uses a global config group to load toolbar settings on | 109 | * KToolBar uses a global config group to load toolbar settings on |
102 | * construction. It will reread this config group on a | 110 | * construction. It will reread this config group on a |
103 | * @ref KApplication::appearanceChanged() signal. | 111 | * @ref KApplication::appearanceChanged() signal. |
104 | * | 112 | * |
105 | * @short Floatable toolbar with auto resize. | 113 | * @short Floatable toolbar with auto resize. |
106 | * @version $Id$ | 114 | * @version $Id$ |
107 | * @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>. | 115 | * @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>. |
108 | */ | 116 | */ |
109 | 117 | ||
110 | // strange things are happening ... so I have to use strange define methods ... | 118 | // strange things are happening ... so I have to use strange define methods ... |
111 | // porting KToolBar back to Qt2 really needs some strange hacks | 119 | // porting KToolBar back to Qt2 really needs some strange hacks |
112 | 120 | ||
113 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
114 | #define QToolBar QPEToolBar | 122 | #define Q3ToolBar QPEToolBar |
115 | #endif | 123 | #endif |
116 | 124 | ||
117 | class KToolBar : public QToolBar | 125 | class KToolBar : public Q3ToolBar |
118 | { | 126 | { |
119 | Q_OBJECT | 127 | Q_OBJECT |
120 | 128 | ||
121 | 129 | ||
122 | Q_ENUMS( IconText BarPosition ) | 130 | Q_ENUMS( IconText BarPosition ) |
123 | 131 | ||
124 | Q_PROPERTY( IconText iconText READ iconText WRITE setIconText ) | 132 | Q_PROPERTY( IconText iconText READ iconText WRITE setIconText ) |
125 | Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos ) | 133 | Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos ) |
126 | Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize ) | 134 | Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize ) |
127 | Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize ) | 135 | Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize ) |
128 | Q_PROPERTY( QString text READ text WRITE setText ) | 136 | Q_PROPERTY( QString text READ text WRITE setText ) |
129 | #ifndef DESKTOP_VERSION | 137 | #ifndef DESKTOP_VERSION |
130 | #undef QToolBar | 138 | #undef Q3ToolBar |
131 | #endif | 139 | #endif |
132 | public: | 140 | public: |
133 | enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom}; | 141 | enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom}; |
134 | /** | 142 | /** |
135 | * The state of the status bar. | 143 | * The state of the status bar. |
136 | * @deprecated | 144 | * @deprecated |
137 | **/ | 145 | **/ |
138 | enum BarStatus{Toggle, Show, Hide}; | 146 | enum BarStatus{Toggle, Show, Hide}; |
139 | /** | 147 | /** |
140 | * Possible bar positions. | 148 | * Possible bar positions. |
141 | **/ | 149 | **/ |
142 | enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat}; | 150 | enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat}; |
143 | 151 | ||
144 | /** | 152 | /** |
145 | * Constructor. | 153 | * Constructor. |
146 | * This constructor is used by the XML-GUI. If you use it, you need | 154 | * This constructor is used by the XML-GUI. If you use it, you need |
@@ -162,51 +170,51 @@ public: | |||
162 | 170 | ||
163 | /** | 171 | /** |
164 | * Constructor for non-XML-GUI applications. | 172 | * Constructor for non-XML-GUI applications. |
165 | * | 173 | * |
166 | * The toolbar will read in various global config settings for | 174 | * The toolbar will read in various global config settings for |
167 | * things like icon size and text position, etc. However, some of | 175 | * things like icon size and text position, etc. However, some of |
168 | * the settings will be honored only if @ref #_honor_mode is set to | 176 | * the settings will be honored only if @ref #_honor_mode is set to |
169 | * true. All other toolbars will be IconOnly and use Medium icons. | 177 | * true. All other toolbars will be IconOnly and use Medium icons. |
170 | * | 178 | * |
171 | * @param parentWindow The window that should be the parent of this toolbar | 179 | * @param parentWindow The window that should be the parent of this toolbar |
172 | * @param dock The position of the toolbar. Usually QMainWindow::Top. | 180 | * @param dock The position of the toolbar. Usually QMainWindow::Top. |
173 | * @param newLine If true, start a new line in the dock for this toolbar. | 181 | * @param newLine If true, start a new line in the dock for this toolbar. |
174 | * @param name The standard internal name | 182 | * @param name The standard internal name |
175 | * @param honor_style If true, then global settings for IconSize and IconText will be honored | 183 | * @param honor_style If true, then global settings for IconSize and IconText will be honored |
176 | * @param readConfig whether to apply the configuration (global and application-specific) | 184 | * @param readConfig whether to apply the configuration (global and application-specific) |
177 | */ | 185 | */ |
178 | KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false, | 186 | KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false, |
179 | const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); | 187 | const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); |
180 | 188 | ||
181 | /** | 189 | /** |
182 | * Constructor for non-XML-GUI applications. | 190 | * Constructor for non-XML-GUI applications. |
183 | * | 191 | * |
184 | * The toolbar will read in various global config settings for | 192 | * The toolbar will read in various global config settings for |
185 | * things like icon size and text position, etc. However, some of | 193 | * things like icon size and text position, etc. However, some of |
186 | * the settings will be honored only if @ref #_honor_mode is set to | 194 | * the settings will be honored only if @ref #_honor_mode is set to |
187 | * true. All other toolbars will be IconOnly and use Medium icons. | 195 | * true. All other toolbars will be IconOnly and use Medium icons. |
188 | * | 196 | * |
189 | * @param parentWindow The window that should be the parent of this toolbar | 197 | * @param parentWindow The window that should be the parent of this toolbar |
190 | * @param dock Another widget than the mainwindow to dock toolbar to. | 198 | * @param dock Another widget than the mainwindow to dock toolbar to. |
191 | * @param newLine If true, start a new line in the dock for this toolbar. | 199 | * @param newLine If true, start a new line in the dock for this toolbar. |
192 | * @param name The standard internal name | 200 | * @param name The standard internal name |
193 | * @param honor_style If true, then global settings for IconSize and IconText will be honored | 201 | * @param honor_style If true, then global settings for IconSize and IconText will be honored |
194 | * @param readConfig whether to apply the configuration (global and application-specific) | 202 | * @param readConfig whether to apply the configuration (global and application-specific) |
195 | */ | 203 | */ |
196 | KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine = false, | 204 | KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine = false, |
197 | const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); | 205 | const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); |
198 | 206 | ||
199 | virtual ~KToolBar(); | 207 | virtual ~KToolBar(); |
200 | 208 | ||
201 | /** | 209 | /** |
202 | * Insert a button (a @ref KToolBarButton) with a pixmap. The | 210 | * Insert a button (a @ref KToolBarButton) with a pixmap. The |
203 | * pixmap is loaded by the button itself based on the global icon | 211 | * pixmap is loaded by the button itself based on the global icon |
204 | * settings. | 212 | * settings. |
205 | * | 213 | * |
206 | * You should connect to one or more signals in KToolBar: | 214 | * You should connect to one or more signals in KToolBar: |
207 | * @ref clicked() , @ref pressed() , @ref released() , or | 215 | * @ref clicked() , @ref pressed() , @ref released() , or |
208 | * @ref highlighted() and if the button is a toggle button | 216 | * @ref highlighted() and if the button is a toggle button |
209 | * (@ref setToggle() ) @ref toggled() . Those signals have @p id | 217 | * (@ref setToggle() ) @ref toggled() . Those signals have @p id |
210 | * of a button that caused the signal. If you want to bind a popup | 218 | * of a button that caused the signal. If you want to bind a popup |
211 | * to button, see @ref setButton(). | 219 | * to button, see @ref setButton(). |
212 | * | 220 | * |
@@ -290,48 +298,48 @@ public: | |||
290 | const QObject *receiver, const char *slot, | 298 | const QObject *receiver, const char *slot, |
291 | bool enabled = true, const QString& text = QString::null, | 299 | bool enabled = true, const QString& text = QString::null, |
292 | int index=-1 ); | 300 | int index=-1 ); |
293 | 301 | ||
294 | /** | 302 | /** |
295 | * Inserts a button with popupmenu. | 303 | * Inserts a button with popupmenu. |
296 | * | 304 | * |
297 | * Button will have small | 305 | * Button will have small |
298 | * triangle. You have to connect to popup's signals. The | 306 | * triangle. You have to connect to popup's signals. The |
299 | * signals @ref KButton::pressed(), @ref KButton::released(), | 307 | * signals @ref KButton::pressed(), @ref KButton::released(), |
300 | * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not | 308 | * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not |
301 | * emmited by | 309 | * emmited by |
302 | * this button (see @ref setDelayedPopup() for that). | 310 | * this button (see @ref setDelayedPopup() for that). |
303 | * You can add custom popups which inherit @ref QPopupMenu to get popups | 311 | * You can add custom popups which inherit @ref QPopupMenu to get popups |
304 | * with tables, drawings etc. Just don't fiddle with events there. | 312 | * with tables, drawings etc. Just don't fiddle with events there. |
305 | */ | 313 | */ |
306 | int insertButton(const QString& icon, int id, QPopupMenu *popup, | 314 | int insertButton(const QString& icon, int id, Q3PopupMenu *popup, |
307 | bool enabled, const QString&_text, int index=-1); | 315 | bool enabled, const QString&_text, int index=-1); |
308 | 316 | ||
309 | /** | 317 | /** |
310 | * Inserts a button with popupmenu. | 318 | * Inserts a button with popupmenu. |
311 | * | 319 | * |
312 | * Button will have small | 320 | * Button will have small |
313 | * triangle. You have to connect to popup's signals. The | 321 | * triangle. You have to connect to popup's signals. The |
314 | * signals @ref KButton::pressed(), @ref KButton::released(), | 322 | * signals @ref KButton::pressed(), @ref KButton::released(), |
315 | * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not | 323 | * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not |
316 | * emmited by | 324 | * emmited by |
317 | * this button (see @ref setDelayedPopup() for that). | 325 | * this button (see @ref setDelayedPopup() for that). |
318 | * You can add custom popups which inherit @ref QPopupMenu to get popups | 326 | * You can add custom popups which inherit @ref QPopupMenu to get popups |
319 | * with tables, drawings etc. Just don't fiddle with events there. | 327 | * with tables, drawings etc. Just don't fiddle with events there. |
320 | */ | 328 | */ |
321 | int insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, | 329 | int insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup, |
322 | bool enabled, const QString&_text, int index=-1); | 330 | bool enabled, const QString&_text, int index=-1); |
323 | 331 | ||
324 | /** | 332 | /** |
325 | * Inserts a @ref KLineEdit. You have to specify signals and slots to | 333 | * Inserts a @ref KLineEdit. You have to specify signals and slots to |
326 | * which KLineEdit will be connected. KLineEdit has all slots QLineEdit | 334 | * which KLineEdit will be connected. KLineEdit has all slots QLineEdit |
327 | * has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation | 335 | * has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation |
328 | * KLineEdit can be set to autoresize itself to full free width | 336 | * KLineEdit can be set to autoresize itself to full free width |
329 | * in toolbar, that is to last right aligned item. For that, | 337 | * in toolbar, that is to last right aligned item. For that, |
330 | * toolbar must be set to full width (which it is by default). | 338 | * toolbar must be set to full width (which it is by default). |
331 | * @see setFullWidth() | 339 | * @see setFullWidth() |
332 | * @see setItemAutoSized() | 340 | * @see setItemAutoSized() |
333 | * @see KLineEdit | 341 | * @see KLineEdit |
334 | * @return Item index. | 342 | * @return Item index. |
335 | */ | 343 | */ |
336 | int insertLined (const QString& text, int id, | 344 | int insertLined (const QString& text, int id, |
337 | const char *signal, | 345 | const char *signal, |
@@ -346,49 +354,49 @@ public: | |||
346 | * Can be writable, but cannot contain | 354 | * Can be writable, but cannot contain |
347 | * pixmaps. By default inserting policy is AtBottom, i.e. typed items | 355 | * pixmaps. By default inserting policy is AtBottom, i.e. typed items |
348 | * are placed at the bottom of the list. Can be autosized. If the size | 356 | * are placed at the bottom of the list. Can be autosized. If the size |
349 | * argument is specified as -1, the width of the combobox is automatically | 357 | * argument is specified as -1, the width of the combobox is automatically |
350 | * computed. | 358 | * computed. |
351 | * | 359 | * |
352 | * @see setFullWidth() | 360 | * @see setFullWidth() |
353 | * @see setItemAutoSized() | 361 | * @see setItemAutoSized() |
354 | * @see KComboBox | 362 | * @see KComboBox |
355 | * @return Item index. | 363 | * @return Item index. |
356 | */ | 364 | */ |
357 | int insertCombo (const QStringList &list, int id, bool writable, | 365 | int insertCombo (const QStringList &list, int id, bool writable, |
358 | const char *signal, const QObject *receiver, | 366 | const char *signal, const QObject *receiver, |
359 | const char *slot, bool enabled=true, | 367 | const char *slot, bool enabled=true, |
360 | const QString& tooltiptext=QString::null, | 368 | const QString& tooltiptext=QString::null, |
361 | int size=70, int index=-1, | 369 | int size=70, int index=-1, |
362 | QComboBox::Policy policy = QComboBox::AtBottom); | 370 | QComboBox::Policy policy = QComboBox::InsertAtBottom); |
363 | 371 | ||
364 | /** | 372 | /** |
365 | * Insert a @ref KComboBox with text. | 373 | * Insert a @ref KComboBox with text. |
366 | * | 374 | * |
367 | * The rest is the same as above. | 375 | * The rest is the same as above. |
368 | * @see setItemAutoSized() | 376 | * @see setItemAutoSized() |
369 | * | 377 | * |
370 | * @see KComboBox | 378 | * @see KComboBox |
371 | * @return Item index. | 379 | * @return Item index. |
372 | */ | 380 | */ |
373 | int insertCombo (const QString& text, int id, bool writable, | 381 | int insertCombo (const QString& text, int id, bool writable, |
374 | const char *signal, QObject *recevier, | 382 | const char *signal, QObject *recevier, |
375 | const char *slot, bool enabled=true, | 383 | const char *slot, bool enabled=true, |
376 | const QString& tooltiptext=QString::null, | 384 | const QString& tooltiptext=QString::null, |
377 | int size=70, int index=-1, | 385 | int size=70, int index=-1, |
378 | QComboBox::Policy policy = QComboBox::AtBottom); | 386 | QComboBox::Policy policy = QComboBox::InsertAtBottom); |
379 | 387 | ||
380 | /** | 388 | /** |
381 | * Inserts a separator into the toolbar with the given id. | 389 | * Inserts a separator into the toolbar with the given id. |
382 | * Returns the separator's index | 390 | * Returns the separator's index |
383 | */ | 391 | */ |
384 | int insertSeparator( int index = -1, int id = -1 ); | 392 | int insertSeparator( int index = -1, int id = -1 ); |
385 | 393 | ||
386 | /** | 394 | /** |
387 | * Inserts a line separator into the toolbar with the given id. | 395 | * Inserts a line separator into the toolbar with the given id. |
388 | * Returns the separator's index | 396 | * Returns the separator's index |
389 | */ | 397 | */ |
390 | int insertLineSeparator( int index = -1, int id = -1 ); | 398 | int insertLineSeparator( int index = -1, int id = -1 ); |
391 | 399 | ||
392 | /** | 400 | /** |
393 | * Inserts a user-defined widget. The widget @p must have this | 401 | * Inserts a user-defined widget. The widget @p must have this |
394 | * toolbar as its parent. | 402 | * toolbar as its parent. |
@@ -452,59 +460,59 @@ public: | |||
452 | * Can be used while button is visible. | 460 | * Can be used while button is visible. |
453 | */ | 461 | */ |
454 | void setButtonIcon( int id, const QString& _icon ); | 462 | void setButtonIcon( int id, const QString& _icon ); |
455 | 463 | ||
456 | /** | 464 | /** |
457 | * Sets button pixmap. | 465 | * Sets button pixmap. |
458 | * | 466 | * |
459 | * Can be used while button is visible. | 467 | * Can be used while button is visible. |
460 | */ | 468 | */ |
461 | void setButtonPixmap( int id, const QPixmap& _pixmap ); | 469 | void setButtonPixmap( int id, const QPixmap& _pixmap ); |
462 | 470 | ||
463 | /** | 471 | /** |
464 | * Sets a button icon from a QIconSet. | 472 | * Sets a button icon from a QIconSet. |
465 | * | 473 | * |
466 | * Can be used while button is visible. | 474 | * Can be used while button is visible. |
467 | */ | 475 | */ |
468 | void setButtonIconSet( int id, const QIconSet& iconset ); | 476 | void setButtonIconSet( int id, const QIcon& iconset ); |
469 | 477 | ||
470 | /** | 478 | /** |
471 | * Sets a delayed popup for a button. | 479 | * Sets a delayed popup for a button. |
472 | * | 480 | * |
473 | * Delayed popup is what you see in | 481 | * Delayed popup is what you see in |
474 | * Netscape Navigator's Previous and Next buttons: If you click them you | 482 | * Netscape Navigator's Previous and Next buttons: If you click them you |
475 | * go back | 483 | * go back |
476 | * or forth. If you press them long enough, you get a history-menu. | 484 | * or forth. If you press them long enough, you get a history-menu. |
477 | * This is exactly what we do here. | 485 | * This is exactly what we do here. |
478 | * | 486 | * |
479 | * You will insert normal a button with connection (or use signals from | 487 | * You will insert normal a button with connection (or use signals from |
480 | * toolbar): | 488 | * toolbar): |
481 | * <pre> | 489 | * <pre> |
482 | * bar->insertButton(icon, id, SIGNAL(clicked ()), this, | 490 | * bar->insertButton(icon, id, SIGNAL(clicked ()), this, |
483 | * SLOT (slotClick()), true, "click or wait for popup"); | 491 | * SLOT (slotClick()), true, "click or wait for popup"); |
484 | * </pre> And then add a delayed popup: | 492 | * </pre> And then add a delayed popup: |
485 | * <pre> | 493 | * <pre> |
486 | * bar->setDelayedPopup (id, historyPopup); </pre> | 494 | * bar->setDelayedPopup (id, historyPopup); </pre> |
487 | * | 495 | * |
488 | * Don't add delayed popups to buttons which have normal popups. | 496 | * Don't add delayed popups to buttons which have normal popups. |
489 | * | 497 | * |
490 | * You may add popups which are derived from @ref QPopupMenu. You may | 498 | * You may add popups which are derived from @ref QPopupMenu. You may |
491 | * add popups that are already in the menu bar or are submenus of | 499 | * add popups that are already in the menu bar or are submenus of |
492 | * other popups. | 500 | * other popups. |
493 | */ | 501 | */ |
494 | void setDelayedPopup (int id , QPopupMenu *_popup, bool toggle = false); | 502 | void setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle = false); |
495 | 503 | ||
496 | /** | 504 | /** |
497 | * Turns a button into an autorepeat button. | 505 | * Turns a button into an autorepeat button. |
498 | * | 506 | * |
499 | * Toggle buttons, buttons with menus, or | 507 | * Toggle buttons, buttons with menus, or |
500 | * buttons with delayed menus cannot be made into autorepeat buttons. | 508 | * buttons with delayed menus cannot be made into autorepeat buttons. |
501 | * Moreover, you can and will receive | 509 | * Moreover, you can and will receive |
502 | * only the signal clicked(), but not pressed() or released(). | 510 | * only the signal clicked(), but not pressed() or released(). |
503 | * When the user presses this button, you will receive the signal clicked(), | 511 | * When the user presses this button, you will receive the signal clicked(), |
504 | * and if the button is still pressed after some time, | 512 | * and if the button is still pressed after some time, |
505 | * you will receive more clicked() signals separated by regular | 513 | * you will receive more clicked() signals separated by regular |
506 | * intervals. Since this uses @ref QButton::setAutoRepeat() , | 514 | * intervals. Since this uses @ref QButton::setAutoRepeat() , |
507 | * I can't quantify 'some'. | 515 | * I can't quantify 'some'. |
508 | */ | 516 | */ |
509 | void setAutoRepeat (int id, bool flag=true); | 517 | void setAutoRepeat (int id, bool flag=true); |
510 | 518 | ||
@@ -1047,64 +1055,64 @@ public: | |||
1047 | */ | 1055 | */ |
1048 | void repaintMe(); | 1056 | void repaintMe(); |
1049 | static bool highlightSetting(); | 1057 | static bool highlightSetting(); |
1050 | 1058 | ||
1051 | /** | 1059 | /** |
1052 | * @return global setting for "Toolbars transparent when moving" | 1060 | * @return global setting for "Toolbars transparent when moving" |
1053 | */ | 1061 | */ |
1054 | static bool transparentSetting(); | 1062 | static bool transparentSetting(); |
1055 | 1063 | ||
1056 | /** | 1064 | /** |
1057 | * @return global setting for "Icon Text" | 1065 | * @return global setting for "Icon Text" |
1058 | */ | 1066 | */ |
1059 | static IconText iconTextSetting(); | 1067 | static IconText iconTextSetting(); |
1060 | 1068 | ||
1061 | public slots: | 1069 | public slots: |
1062 | virtual void setIconText( const QString &txt ) | 1070 | virtual void setIconText( const QString &txt ) |
1063 | { QToolBar::setIconText( txt ); } | 1071 | { Q3ToolBar::setIconText( txt ); } |
1064 | void slotRepaint(); | 1072 | void slotRepaint(); |
1065 | 1073 | ||
1066 | protected: | 1074 | protected: |
1067 | void mousePressEvent( QMouseEvent * ); | 1075 | void mousePressEvent( QMouseEvent * ); |
1068 | void childEvent( QChildEvent *e ); | 1076 | void childEvent( QChildEvent *e ); |
1069 | void showEvent( QShowEvent *e ); | 1077 | void showEvent( QShowEvent *e ); |
1070 | void resizeEvent( QResizeEvent *e ); | 1078 | void resizeEvent( QResizeEvent *e ); |
1071 | bool event( QEvent *e ); | 1079 | bool event( QEvent *e ); |
1072 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); | 1080 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); |
1073 | QString settingsGroup(); | 1081 | QString settingsGroup(); |
1074 | 1082 | ||
1075 | private slots: | 1083 | private slots: |
1076 | void rebuildLayout(); | 1084 | void rebuildLayout(); |
1077 | void slotReadConfig (); | 1085 | void slotReadConfig (); |
1078 | void slotAppearanceChanged(); | 1086 | void slotAppearanceChanged(); |
1079 | void slotIconChanged(int); | 1087 | void slotIconChanged(int); |
1080 | void toolBarPosChanged( QToolBar *tb ); | 1088 | void toolBarPosChanged( Q3ToolBar *tb ); |
1081 | void slotContextAboutToShow(); | 1089 | void slotContextAboutToShow(); |
1082 | void widgetDestroyed(); | 1090 | void widgetDestroyed(); |
1083 | 1091 | ||
1084 | private: | 1092 | private: |
1085 | int sizeHintW; | 1093 | int sizeHintW; |
1086 | int sizeHintH; | 1094 | int sizeHintH; |
1087 | void init( bool readConfig = true, bool honorStyle = false ); | 1095 | void init( bool readConfig = true, bool honorStyle = false ); |
1088 | void doConnections( KToolBarButton *button ); | 1096 | void doConnections( KToolBarButton *button ); |
1089 | void insertWidgetInternal( QWidget *w, int &index, int id ); | 1097 | void insertWidgetInternal( QWidget *w, int &index, int id ); |
1090 | void removeWidgetInternal( QWidget *w ); | 1098 | void removeWidgetInternal( QWidget *w ); |
1091 | void getAttributes( QString &position, QString &icontext, int &index ); | 1099 | void getAttributes( QString &position, QString &icontext, int &index ); |
1092 | //US KPopupMenu *contextMenu(); | 1100 | //US KPopupMenu *contextMenu(); |
1093 | QPopupMenu *contextMenu(); | 1101 | Q3PopupMenu *contextMenu(); |
1094 | 1102 | ||
1095 | QMap<QWidget*, int > widget2id; | 1103 | QMap<QWidget*, int > widget2id; |
1096 | typedef QMap<int, QWidget* > Id2WidgetMap; | 1104 | typedef QMap<int, QWidget* > Id2WidgetMap; |
1097 | Id2WidgetMap id2widget; | 1105 | Id2WidgetMap id2widget; |
1098 | //US KPopupMenu *context; | 1106 | //US KPopupMenu *context; |
1099 | QPopupMenu *context; | 1107 | Q3PopupMenu *context; |
1100 | QPtrList<QWidget> widgets; | 1108 | Q3PtrList<QWidget> widgets; |
1101 | QTimer *layoutTimer; | 1109 | QTimer *layoutTimer; |
1102 | QGuardedPtr<QWidget> stretchableWidget, rightAligned; | 1110 | QPointer<QWidget> stretchableWidget, rightAligned; |
1103 | protected: | 1111 | protected: |
1104 | virtual void virtual_hook( int id, void* data ); | 1112 | virtual void virtual_hook( int id, void* data ); |
1105 | private: | 1113 | private: |
1106 | KToolBarPrivate *d; | 1114 | KToolBarPrivate *d; |
1107 | bool inshutdownprocess; | 1115 | bool inshutdownprocess; |
1108 | }; | 1116 | }; |
1109 | 1117 | ||
1110 | #endif | 1118 | #endif |
diff --git a/microkde/kdeui/ktoolbarbutton.cpp b/microkde/kdeui/ktoolbarbutton.cpp index 1d5d0e5..7b98b32 100644 --- a/microkde/kdeui/ktoolbarbutton.cpp +++ b/microkde/kdeui/ktoolbarbutton.cpp | |||
@@ -20,48 +20,52 @@ | |||
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | //US #include <config.h> | 24 | //US #include <config.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | 26 | ||
27 | #include "ktoolbarbutton.h" | 27 | #include "ktoolbarbutton.h" |
28 | #include "ktoolbar.h" | 28 | #include "ktoolbar.h" |
29 | 29 | ||
30 | #include <qstyle.h> | 30 | #include <qstyle.h> |
31 | #include <qimage.h> | 31 | #include <qimage.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qdrawutil.h> | 33 | #include <qdrawutil.h> |
34 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
35 | #include <qbitmap.h> | 35 | #include <qbitmap.h> |
36 | #include <qpopupmenu.h> | 36 | #include <q3popupmenu.h> |
37 | #include <qcursor.h> | 37 | #include <qcursor.h> |
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <QPixmap> | ||
42 | #include <QMouseEvent> | ||
43 | #include <QEvent> | ||
40 | 44 | ||
41 | #include <kapplication.h> | 45 | #include <kapplication.h> |
42 | #include <kdebug.h> | 46 | #include <kdebug.h> |
43 | #include <kglobal.h> | 47 | #include <kglobal.h> |
44 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
45 | //US #include <kiconeffect.h> | 49 | //US #include <kiconeffect.h> |
46 | #include <kiconloader.h> | 50 | #include <kiconloader.h> |
47 | 51 | ||
48 | // needed to get our instance | 52 | // needed to get our instance |
49 | #include <kmainwindow.h> | 53 | #include <kmainwindow.h> |
50 | 54 | ||
51 | template class QIntDict<KToolBarButton>; | 55 | template class Q3IntDict<KToolBarButton>; |
52 | 56 | ||
53 | class KToolBarButtonPrivate | 57 | class KToolBarButtonPrivate |
54 | { | 58 | { |
55 | public: | 59 | public: |
56 | KToolBarButtonPrivate() | 60 | KToolBarButtonPrivate() |
57 | { | 61 | { |
58 | m_noStyle = false; | 62 | m_noStyle = false; |
59 | m_isSeparator = false; | 63 | m_isSeparator = false; |
60 | m_isRadio = false; | 64 | m_isRadio = false; |
61 | m_highlight = false; | 65 | m_highlight = false; |
62 | m_isRaised = false; | 66 | m_isRaised = false; |
63 | m_isActive = false; | 67 | m_isActive = false; |
64 | 68 | ||
65 | m_iconName = QString::null; | 69 | m_iconName = QString::null; |
66 | m_iconText = KToolBar::IconOnly; | 70 | m_iconText = KToolBar::IconOnly; |
67 | m_iconSize = 0; | 71 | m_iconSize = 0; |
@@ -102,79 +106,79 @@ KToolBarButton::KToolBarButton( QWidget *_parent, const char *_name ) | |||
102 | hide(); | 106 | hide(); |
103 | d->m_isSeparator = true; | 107 | d->m_isSeparator = true; |
104 | } | 108 | } |
105 | 109 | ||
106 | KToolBarButton::KToolBarButton( const QString& _icon, int _id, | 110 | KToolBarButton::KToolBarButton( const QString& _icon, int _id, |
107 | QWidget *_parent, const char *_name, | 111 | QWidget *_parent, const char *_name, |
108 | const QString &_txt/*US, KInstance *_instance*/ ) | 112 | const QString &_txt/*US, KInstance *_instance*/ ) |
109 | : QToolButton( _parent, _name ), d( 0 ) | 113 | : QToolButton( _parent, _name ), d( 0 ) |
110 | { | 114 | { |
111 | d = new KToolBarButtonPrivate; | 115 | d = new KToolBarButtonPrivate; |
112 | 116 | ||
113 | d->m_id = _id; | 117 | d->m_id = _id; |
114 | d->m_parent = (KToolBar*)_parent; | 118 | d->m_parent = (KToolBar*)_parent; |
115 | QToolButton::setTextLabel(_txt); | 119 | QToolButton::setTextLabel(_txt); |
116 | //US d->m_instance = _instance; | 120 | //US d->m_instance = _instance; |
117 | 121 | ||
118 | setFocusPolicy( NoFocus ); | 122 | setFocusPolicy( Qt::NoFocus ); |
119 | 123 | ||
120 | // connect all of our slots and start trapping events | 124 | // connect all of our slots and start trapping events |
121 | connect(d->m_parent, SIGNAL( modechange() ), | 125 | connect(d->m_parent, SIGNAL( modechange() ), |
122 | this, SLOT( modeChange() )); | 126 | this, SLOT( modeChange() )); |
123 | 127 | ||
124 | connect(this, SIGNAL( clicked() ), | 128 | connect(this, SIGNAL( clicked() ), |
125 | this, SLOT( slotClicked() ) ); | 129 | this, SLOT( slotClicked() ) ); |
126 | connect(this, SIGNAL( pressed() ), | 130 | connect(this, SIGNAL( pressed() ), |
127 | this, SLOT( slotPressed() ) ); | 131 | this, SLOT( slotPressed() ) ); |
128 | connect(this, SIGNAL( released() ), | 132 | connect(this, SIGNAL( released() ), |
129 | this, SLOT( slotReleased() ) ); | 133 | this, SLOT( slotReleased() ) ); |
130 | installEventFilter(this); | 134 | installEventFilter(this); |
131 | 135 | ||
132 | d->m_iconName = _icon; | 136 | d->m_iconName = _icon; |
133 | 137 | ||
134 | // do our initial setup | 138 | // do our initial setup |
135 | modeChange(); | 139 | modeChange(); |
136 | } | 140 | } |
137 | 141 | ||
138 | KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id, | 142 | KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id, |
139 | QWidget *_parent, const char *name, | 143 | QWidget *_parent, const char *name, |
140 | const QString& txt) | 144 | const QString& txt) |
141 | : QToolButton( _parent, name ), d( 0 ) | 145 | : QToolButton( _parent, name ), d( 0 ) |
142 | { | 146 | { |
143 | d = new KToolBarButtonPrivate; | 147 | d = new KToolBarButtonPrivate; |
144 | 148 | ||
145 | d->m_id = _id; | 149 | d->m_id = _id; |
146 | d->m_parent = (KToolBar *) _parent; | 150 | d->m_parent = (KToolBar *) _parent; |
147 | QToolButton::setTextLabel(txt); | 151 | QToolButton::setTextLabel(txt); |
148 | 152 | ||
149 | setFocusPolicy( NoFocus ); | 153 | setFocusPolicy( Qt::NoFocus ); |
150 | 154 | ||
151 | // connect all of our slots and start trapping events | 155 | // connect all of our slots and start trapping events |
152 | connect(d->m_parent, SIGNAL( modechange()), | 156 | connect(d->m_parent, SIGNAL( modechange()), |
153 | this, SLOT(modeChange())); | 157 | this, SLOT(modeChange())); |
154 | 158 | ||
155 | connect(this, SIGNAL( clicked() ), | 159 | connect(this, SIGNAL( clicked() ), |
156 | this, SLOT( slotClicked() )); | 160 | this, SLOT( slotClicked() )); |
157 | connect(this, SIGNAL( pressed() ), | 161 | connect(this, SIGNAL( pressed() ), |
158 | this, SLOT( slotPressed() )); | 162 | this, SLOT( slotPressed() )); |
159 | connect(this, SIGNAL( released() ), | 163 | connect(this, SIGNAL( released() ), |
160 | this, SLOT( slotReleased() )); | 164 | this, SLOT( slotReleased() )); |
161 | installEventFilter(this); | 165 | installEventFilter(this); |
162 | 166 | ||
163 | // set our pixmap and do our initial setup | 167 | // set our pixmap and do our initial setup |
164 | setIconSet( QIconSet( pixmap )); | 168 | setIconSet( QIcon( pixmap )); |
165 | modeChange(); | 169 | modeChange(); |
166 | } | 170 | } |
167 | 171 | ||
168 | KToolBarButton::~KToolBarButton() | 172 | KToolBarButton::~KToolBarButton() |
169 | { | 173 | { |
170 | delete d; d = 0; | 174 | delete d; d = 0; |
171 | } | 175 | } |
172 | 176 | ||
173 | void KToolBarButton::modeChange() | 177 | void KToolBarButton::modeChange() |
174 | { | 178 | { |
175 | QSize mysize; | 179 | QSize mysize; |
176 | 180 | ||
177 | // grab a few global variables for use in this function and others | 181 | // grab a few global variables for use in this function and others |
178 | d->m_highlight = d->m_parent->highlight(); | 182 | d->m_highlight = d->m_parent->highlight(); |
179 | d->m_iconText = d->m_parent->iconText(); | 183 | d->m_iconText = d->m_parent->iconText(); |
180 | 184 | ||
@@ -279,107 +283,107 @@ void KToolBarButton::setIcon( const QString &icon ) | |||
279 | { | 283 | { |
280 | d->m_iconName = icon; | 284 | d->m_iconName = icon; |
281 | d->m_iconSize = d->m_parent->iconSize(); | 285 | d->m_iconSize = d->m_parent->iconSize(); |
282 | // QObject::name() return "const char *" instead of QString. | 286 | // QObject::name() return "const char *" instead of QString. |
283 | if (!strcmp(d->m_parent->name(), "mainToolBar")) | 287 | if (!strcmp(d->m_parent->name(), "mainToolBar")) |
284 | /*US QToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet( | 288 | /*US QToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet( |
285 | d->m_iconName, KIcon::MainToolbar, d->m_iconSize )); | 289 | d->m_iconName, KIcon::MainToolbar, d->m_iconSize )); |
286 | */ | 290 | */ |
287 | QToolButton::setIconSet( KGlobal::iconLoader()->loadIconSet(d->m_iconName )); | 291 | QToolButton::setIconSet( KGlobal::iconLoader()->loadIconSet(d->m_iconName )); |
288 | else | 292 | else |
289 | /*US QToolButton::setIconSet(d->m_instance->iconLoader()->loadIconSet( | 293 | /*US QToolButton::setIconSet(d->m_instance->iconLoader()->loadIconSet( |
290 | d->m_iconName, KIcon::Toolbar, d->m_iconSize )); | 294 | d->m_iconName, KIcon::Toolbar, d->m_iconSize )); |
291 | */ | 295 | */ |
292 | QToolButton::setIconSet(KGlobal::iconLoader()->loadIconSet(d->m_iconName)); | 296 | QToolButton::setIconSet(KGlobal::iconLoader()->loadIconSet(d->m_iconName)); |
293 | } | 297 | } |
294 | 298 | ||
295 | void KToolBarButton::setIconSet( const QIconSet &iconset ) | 299 | void KToolBarButton::setIconSet( const QIcon &iconset ) |
296 | { | 300 | { |
297 | QToolButton::setIconSet( iconset ); | 301 | QToolButton::setIconSet( iconset ); |
298 | } | 302 | } |
299 | 303 | ||
300 | // remove? | 304 | // remove? |
301 | void KToolBarButton::setPixmap( const QPixmap &pixmap ) | 305 | void KToolBarButton::setPixmap( const QPixmap &pixmap ) |
302 | { | 306 | { |
303 | if( pixmap.isNull()) // called by QToolButton | 307 | if( pixmap.isNull()) // called by QToolButton |
304 | { | 308 | { |
305 | QToolButton::setPixmap( pixmap ); | 309 | QToolButton::setPixmap( pixmap ); |
306 | return; | 310 | return; |
307 | } | 311 | } |
308 | QIconSet set = iconSet(); | 312 | QIcon set = iconSet(); |
309 | set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Active ); | 313 | set.setPixmap( pixmap, QIcon::Automatic, QIcon::Active ); |
310 | QToolButton::setIconSet( set ); | 314 | QToolButton::setIconSet( set ); |
311 | } | 315 | } |
312 | 316 | ||
313 | void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap ) | 317 | void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap ) |
314 | { | 318 | { |
315 | QIconSet set = iconSet(); | 319 | QIcon set = iconSet(); |
316 | set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Normal ); | 320 | set.setPixmap( pixmap, QIcon::Automatic, QIcon::Normal ); |
317 | QToolButton::setIconSet( set ); | 321 | QToolButton::setIconSet( set ); |
318 | } | 322 | } |
319 | 323 | ||
320 | void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap ) | 324 | void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap ) |
321 | { | 325 | { |
322 | QIconSet set = iconSet(); | 326 | QIcon set = iconSet(); |
323 | set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Disabled ); | 327 | set.setPixmap( pixmap, QIcon::Automatic, QIcon::Disabled ); |
324 | QToolButton::setIconSet( set ); | 328 | QToolButton::setIconSet( set ); |
325 | } | 329 | } |
326 | 330 | ||
327 | void KToolBarButton::setDefaultIcon( const QString& icon ) | 331 | void KToolBarButton::setDefaultIcon( const QString& icon ) |
328 | { | 332 | { |
329 | QIconSet set = iconSet(); | 333 | QIcon set = iconSet(); |
330 | QPixmap pm; | 334 | QPixmap pm; |
331 | if (!strcmp(d->m_parent->name(), "mainToolBar")) | 335 | if (!strcmp(d->m_parent->name(), "mainToolBar")) |
332 | pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, | 336 | pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, |
333 | d->m_iconSize ); | 337 | d->m_iconSize ); |
334 | else | 338 | else |
335 | pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, | 339 | pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, |
336 | d->m_iconSize ); | 340 | d->m_iconSize ); |
337 | set.setPixmap( pm, QIconSet::Automatic, QIconSet::Normal ); | 341 | set.setPixmap( pm, QIcon::Automatic, QIcon::Normal ); |
338 | QToolButton::setIconSet( set ); | 342 | QToolButton::setIconSet( set ); |
339 | } | 343 | } |
340 | 344 | ||
341 | void KToolBarButton::setDisabledIcon( const QString& icon ) | 345 | void KToolBarButton::setDisabledIcon( const QString& icon ) |
342 | { | 346 | { |
343 | QIconSet set = iconSet(); | 347 | QIcon set = iconSet(); |
344 | QPixmap pm; | 348 | QPixmap pm; |
345 | if (!strcmp(d->m_parent->name(), "mainToolBar")) | 349 | if (!strcmp(d->m_parent->name(), "mainToolBar")) |
346 | pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, | 350 | pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, |
347 | d->m_iconSize ); | 351 | d->m_iconSize ); |
348 | else | 352 | else |
349 | pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, | 353 | pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, |
350 | d->m_iconSize ); | 354 | d->m_iconSize ); |
351 | set.setPixmap( pm, QIconSet::Automatic, QIconSet::Disabled ); | 355 | set.setPixmap( pm, QIcon::Automatic, QIcon::Disabled ); |
352 | QToolButton::setIconSet( set ); | 356 | QToolButton::setIconSet( set ); |
353 | } | 357 | } |
354 | 358 | ||
355 | QPopupMenu *KToolBarButton::popup() | 359 | QMenu *KToolBarButton::popup() |
356 | { | 360 | { |
357 | // obsolete | 361 | // obsolete |
358 | // KDE4: remove me | 362 | // KDE4: remove me |
359 | return QToolButton::popup(); | 363 | return QToolButton::popup(); |
360 | } | 364 | } |
361 | 365 | ||
362 | void KToolBarButton::setPopup(QPopupMenu *p, bool) | 366 | void KToolBarButton::setPopup(Q3PopupMenu *p, bool) |
363 | { | 367 | { |
364 | QToolButton::setPopup(p); | 368 | QToolButton::setPopup(p); |
365 | QToolButton::setPopupDelay(1); | 369 | QToolButton::setPopupDelay(1); |
366 | } | 370 | } |
367 | 371 | ||
368 | 372 | ||
369 | void KToolBarButton::setDelayedPopup (QPopupMenu *p, bool) | 373 | void KToolBarButton::setDelayedPopup (Q3PopupMenu *p, bool) |
370 | { | 374 | { |
371 | QToolButton::setPopup(p); | 375 | QToolButton::setPopup(p); |
372 | //US QToolButton::setPopupDelay(QApplication::startDragTime()); | 376 | //US QToolButton::setPopupDelay(QApplication::startDragTime()); |
373 | } | 377 | } |
374 | 378 | ||
375 | void KToolBarButton::leaveEvent(QEvent *) | 379 | void KToolBarButton::leaveEvent(QEvent *) |
376 | { | 380 | { |
377 | if( d->m_isRaised || d->m_isActive ) | 381 | if( d->m_isRaised || d->m_isActive ) |
378 | { | 382 | { |
379 | d->m_isRaised = false; | 383 | d->m_isRaised = false; |
380 | d->m_isActive = false; | 384 | d->m_isActive = false; |
381 | repaint(false); | 385 | repaint(false); |
382 | } | 386 | } |
383 | 387 | ||
384 | emit highlighted(d->m_id, false); | 388 | emit highlighted(d->m_id, false); |
385 | } | 389 | } |
@@ -438,199 +442,209 @@ bool KToolBarButton::eventFilter(QObject *o, QEvent *ev) | |||
438 | return true; | 442 | return true; |
439 | 443 | ||
440 | // From Kai-Uwe Sattler <kus@iti.CS.Uni-Magdeburg.De> | 444 | // From Kai-Uwe Sattler <kus@iti.CS.Uni-Magdeburg.De> |
441 | if (ev->type() == QEvent::MouseButtonDblClick) | 445 | if (ev->type() == QEvent::MouseButtonDblClick) |
442 | { | 446 | { |
443 | emit doubleClicked(d->m_id); | 447 | emit doubleClicked(d->m_id); |
444 | return true; | 448 | return true; |
445 | } | 449 | } |
446 | } | 450 | } |
447 | 451 | ||
448 | return QToolButton::eventFilter(o, ev); | 452 | return QToolButton::eventFilter(o, ev); |
449 | } | 453 | } |
450 | 454 | ||
451 | void KToolBarButton::drawButton( QPainter *_painter ) | 455 | void KToolBarButton::drawButton( QPainter *_painter ) |
452 | { | 456 | { |
453 | #ifdef DESKTOP_VERSION | 457 | #ifdef DESKTOP_VERSION |
454 | QStyle::SFlags flags = QStyle::Style_Default; | 458 | QStyle::State flags = QStyle::State_None; |
455 | QStyle::SCFlags active = QStyle::SC_None; | 459 | QStyle::SubControls active = QStyle::SC_None; |
456 | 460 | ||
457 | if (isDown()) { | 461 | if (isDown()) { |
458 | flags |= QStyle::Style_Down; | 462 | flags |= QStyle::State_DownArrow; |
459 | active |= QStyle::SC_ToolButton; | 463 | active |= QStyle::SC_ToolButton; |
460 | } | 464 | } |
461 | if (isEnabled()) flags |= QStyle::Style_Enabled; | 465 | if (isEnabled()) flags |= QStyle::State_Enabled; |
462 | if (isOn()) flags |= QStyle::Style_On; | 466 | if (isOn()) flags |= QStyle::State_On; |
463 | if (isEnabled() && d->m_isRaised)flags |= QStyle::Style_Raised; | 467 | if (isEnabled() && d->m_isRaised)flags |= QStyle::State_Raised; |
464 | if (hasFocus())flags |= QStyle::Style_HasFocus; | 468 | if (hasFocus())flags |= QStyle::State_HasFocus; |
469 | |||
470 | QStyleOptionToolButton qsotb; | ||
471 | qsotb.initFrom(this); | ||
472 | qsotb.state = flags; | ||
473 | qsotb.activeSubControls = active; | ||
474 | qsotb.rect = rect(); | ||
475 | qsotb.palette = palette(); | ||
465 | 476 | ||
466 | // Draw a styled toolbutton | 477 | // Draw a styled toolbutton |
467 | style().drawComplexControl(QStyle::CC_ToolButton, _painter, this, rect(), | 478 | style()->drawComplexControl(QStyle::CC_ToolButton, &qsotb, _painter, this); |
468 | colorGroup(), flags, QStyle::SC_ToolButton, active, QStyleOption()); | ||
469 | 479 | ||
470 | #else | 480 | #else |
471 | style().drawToolButton(_painter, rect().x(), rect().y(), rect().width(), rect().height(), colorGroup()); | 481 | style().drawToolButton(_painter, rect().x(), rect().y(), rect().width(), rect().height(), colorGroup()); |
472 | #endif | 482 | #endif |
473 | int dx, dy; | 483 | int dx, dy; |
474 | QFont tmp_font(KGlobalSettings::toolBarFont()); | 484 | QFont tmp_font(KGlobalSettings::toolBarFont()); |
475 | QFontMetrics fm(tmp_font); | 485 | QFontMetrics fm(tmp_font); |
476 | QRect textRect; | 486 | QRect textRect; |
477 | int textFlags = 0; | 487 | int textFlags = 0; |
478 | 488 | ||
479 | if (d->m_iconText == KToolBar::IconOnly) // icon only | 489 | if (d->m_iconText == KToolBar::IconOnly) // icon only |
480 | { | 490 | { |
481 | /*US | 491 | /*US |
482 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 492 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, |
483 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 493 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : |
484 | QIconSet::Disabled, | 494 | QIconSet::Disabled, |
485 | isOn() ? QIconSet::On : QIconSet::Off ); | 495 | isOn() ? QIconSet::On : QIconSet::Off ); |
486 | */ | 496 | */ |
487 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 497 | QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, |
488 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 498 | isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : |
489 | QIconSet::Disabled); | 499 | QIcon::Disabled); |
490 | 500 | ||
491 | if( !pixmap.isNull()) | 501 | if( !pixmap.isNull()) |
492 | { | 502 | { |
493 | dx = ( width() - pixmap.width() ) / 2; | 503 | dx = ( width() - pixmap.width() ) / 2; |
494 | dy = ( height() - pixmap.height() ) / 2; | 504 | dy = ( height() - pixmap.height() ) / 2; |
495 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 505 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
496 | { | 506 | { |
497 | ++dx; | 507 | ++dx; |
498 | ++dy; | 508 | ++dy; |
499 | } | 509 | } |
500 | _painter->drawPixmap( dx, dy, pixmap ); | 510 | _painter->drawPixmap( dx, dy, pixmap ); |
501 | } | 511 | } |
502 | } | 512 | } |
503 | else if (d->m_iconText == KToolBar::IconTextRight) // icon and text (if any) | 513 | else if (d->m_iconText == KToolBar::IconTextRight) // icon and text (if any) |
504 | { | 514 | { |
505 | /*US | 515 | /*US |
506 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 516 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, |
507 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 517 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : |
508 | QIconSet::Disabled, | 518 | QIconSet::Disabled, |
509 | isOn() ? QIconSet::On : QIconSet::Off ); | 519 | isOn() ? QIconSet::On : QIconSet::Off ); |
510 | */ | 520 | */ |
511 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 521 | QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, |
512 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 522 | isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : |
513 | QIconSet::Disabled); | 523 | QIcon::Disabled); |
514 | 524 | ||
515 | if( !pixmap.isNull()) | 525 | if( !pixmap.isNull()) |
516 | { | 526 | { |
517 | dx = 4; | 527 | dx = 4; |
518 | dy = ( height() - pixmap.height() ) / 2; | 528 | dy = ( height() - pixmap.height() ) / 2; |
519 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 529 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
520 | { | 530 | { |
521 | ++dx; | 531 | ++dx; |
522 | ++dy; | 532 | ++dy; |
523 | } | 533 | } |
524 | _painter->drawPixmap( dx, dy, pixmap ); | 534 | _painter->drawPixmap( dx, dy, pixmap ); |
525 | } | 535 | } |
526 | 536 | ||
527 | if (!textLabel().isNull()) | 537 | if (!textLabel().isNull()) |
528 | { | 538 | { |
529 | textFlags = AlignVCenter|AlignLeft; | 539 | textFlags = Qt::AlignVCenter|Qt::AlignLeft; |
530 | if (!pixmap.isNull()) | 540 | if (!pixmap.isNull()) |
531 | dx = 4 + pixmap.width() + 2; | 541 | dx = 4 + pixmap.width() + 2; |
532 | else | 542 | else |
533 | dx = 4; | 543 | dx = 4; |
534 | dy = 0; | 544 | dy = 0; |
535 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 545 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
536 | { | 546 | { |
537 | ++dx; | 547 | ++dx; |
538 | ++dy; | 548 | ++dy; |
539 | } | 549 | } |
540 | textRect = QRect(dx, dy, width()-dx, height()); | 550 | textRect = QRect(dx, dy, width()-dx, height()); |
541 | } | 551 | } |
542 | } | 552 | } |
543 | else if (d->m_iconText == KToolBar::TextOnly) | 553 | else if (d->m_iconText == KToolBar::TextOnly) |
544 | { | 554 | { |
545 | if (!textLabel().isNull()) | 555 | if (!textLabel().isNull()) |
546 | { | 556 | { |
547 | textFlags = AlignVCenter|AlignLeft; | 557 | textFlags = Qt::AlignVCenter|Qt::AlignLeft; |
548 | dx = (width() - fm.width(textLabel())) / 2; | 558 | dx = (width() - fm.width(textLabel())) / 2; |
549 | dy = (height() - fm.lineSpacing()) / 2; | 559 | dy = (height() - fm.lineSpacing()) / 2; |
550 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 560 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
551 | { | 561 | { |
552 | ++dx; | 562 | ++dx; |
553 | ++dy; | 563 | ++dy; |
554 | } | 564 | } |
555 | textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); | 565 | textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); |
556 | } | 566 | } |
557 | } | 567 | } |
558 | else if (d->m_iconText == KToolBar::IconTextBottom) | 568 | else if (d->m_iconText == KToolBar::IconTextBottom) |
559 | { | 569 | { |
560 | /*US | 570 | /*US |
561 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 571 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, |
562 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 572 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : |
563 | QIconSet::Disabled, | 573 | QIconSet::Disabled, |
564 | isOn() ? QIconSet::On : QIconSet::Off ); | 574 | isOn() ? QIconSet::On : QIconSet::Off ); |
565 | */ | 575 | */ |
566 | QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, | 576 | QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, |
567 | isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : | 577 | isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : |
568 | QIconSet::Disabled); | 578 | QIcon::Disabled); |
569 | 579 | ||
570 | if( !pixmap.isNull()) | 580 | if( !pixmap.isNull()) |
571 | { | 581 | { |
572 | dx = (width() - pixmap.width()) / 2; | 582 | dx = (width() - pixmap.width()) / 2; |
573 | dy = (height() - fm.lineSpacing() - pixmap.height()) / 2; | 583 | dy = (height() - fm.lineSpacing() - pixmap.height()) / 2; |
574 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 584 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
575 | { | 585 | { |
576 | ++dx; | 586 | ++dx; |
577 | ++dy; | 587 | ++dy; |
578 | } | 588 | } |
579 | _painter->drawPixmap( dx, dy, pixmap ); | 589 | _painter->drawPixmap( dx, dy, pixmap ); |
580 | } | 590 | } |
581 | 591 | ||
582 | if (!textLabel().isNull()) | 592 | if (!textLabel().isNull()) |
583 | { | 593 | { |
584 | textFlags = AlignBottom|AlignHCenter; | 594 | textFlags = Qt::AlignBottom|Qt::AlignHCenter; |
585 | dx = (width() - fm.width(textLabel())) / 2; | 595 | dx = (width() - fm.width(textLabel())) / 2; |
586 | dy = height() - fm.lineSpacing() - 4; | 596 | dy = height() - fm.lineSpacing() - 4; |
587 | 597 | ||
588 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) | 598 | if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) |
589 | { | 599 | { |
590 | ++dx; | 600 | ++dx; |
591 | ++dy; | 601 | ++dy; |
592 | } | 602 | } |
593 | textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); | 603 | textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); |
594 | } | 604 | } |
595 | } | 605 | } |
596 | 606 | ||
597 | // Draw the text at the position given by textRect, and using textFlags | 607 | // Draw the text at the position given by textRect, and using textFlags |
598 | if (!textLabel().isNull() && !textRect.isNull()) | 608 | if (!textLabel().isNull() && !textRect.isNull()) |
599 | { | 609 | { |
600 | _painter->setFont(KGlobalSettings::toolBarFont()); | 610 | _painter->setFont(KGlobalSettings::toolBarFont()); |
601 | if (!isEnabled()) | 611 | if (!isEnabled()) |
602 | _painter->setPen(palette().disabled().dark()); | 612 | _painter->setPen(palette().disabled().dark()); |
603 | else if(d->m_isRaised) | 613 | else if(d->m_isRaised) |
604 | _painter->setPen(KGlobalSettings::toolBarHighlightColor()); | 614 | _painter->setPen(KGlobalSettings::toolBarHighlightColor()); |
605 | else | 615 | else |
606 | _painter->setPen( colorGroup().buttonText() ); | 616 | _painter->setPen( colorGroup().buttonText() ); |
607 | _painter->drawText(textRect, textFlags, textLabel()); | 617 | _painter->drawText(textRect, textFlags, textLabel()); |
608 | } | 618 | } |
609 | 619 | ||
610 | if (QToolButton::popup()) | 620 | if (QToolButton::popup()) |
611 | { | 621 | { |
612 | #ifdef DESKTOP_VERSION | 622 | #ifdef DESKTOP_VERSION |
613 | QStyle::SFlags arrowFlags = QStyle::Style_Default; | 623 | QStyle::State arrowFlags = QStyle::State_None; |
624 | |||
625 | if (isDown())arrowFlags |= QStyle::State_DownArrow; | ||
626 | if (isEnabled()) arrowFlags |= QStyle::State_Enabled; | ||
614 | 627 | ||
615 | if (isDown())arrowFlags |= QStyle::Style_Down; | 628 | QStyleOption qso; |
616 | if (isEnabled()) arrowFlags |= QStyle::Style_Enabled; | 629 | qso.initFrom(this); |
630 | qso.state = arrowFlags; | ||
631 | qso.rect = QRect(width()-7, height()-7, 7, 7); | ||
632 | qso.palette = palette(); | ||
617 | 633 | ||
618 | style().drawPrimitive(QStyle::PE_ArrowDown, _painter, | 634 | style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &qso, _painter); |
619 | QRect(width()-7, height()-7, 7, 7), colorGroup(), | ||
620 | arrowFlags, QStyleOption() ); | ||
621 | #else | 635 | #else |
622 | style().drawArrow(_painter, Qt::DownArrow, isDown(), | 636 | style().drawArrow(_painter, Qt::DownArrow, isDown(), |
623 | width()-7, height()-7, 7, 7, colorGroup(), isEnabled() ); | 637 | width()-7, height()-7, 7, 7, colorGroup(), isEnabled() ); |
624 | #endif | 638 | #endif |
625 | 639 | ||
626 | } | 640 | } |
627 | } | 641 | } |
628 | 642 | ||
629 | void KToolBarButton::paletteChange(const QPalette &) | 643 | void KToolBarButton::paletteChange(const QPalette &) |
630 | { | 644 | { |
631 | if(!d->m_isSeparator) | 645 | if(!d->m_isSeparator) |
632 | { | 646 | { |
633 | modeChange(); | 647 | modeChange(); |
634 | repaint(false); // no need to delete it first therefore only false | 648 | repaint(false); // no need to delete it first therefore only false |
635 | } | 649 | } |
636 | } | 650 | } |
diff --git a/microkde/kdeui/ktoolbarbutton.h b/microkde/kdeui/ktoolbarbutton.h index 9aaa13c..ad02e4e 100644 --- a/microkde/kdeui/ktoolbarbutton.h +++ b/microkde/kdeui/ktoolbarbutton.h | |||
@@ -13,41 +13,44 @@ | |||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | // $Id$ | 23 | // $Id$ |
24 | #ifndef _KTOOLBARBUTTON_H | 24 | #ifndef _KTOOLBARBUTTON_H |
25 | #define _KTOOLBARBUTTON_H | 25 | #define _KTOOLBARBUTTON_H |
26 | 26 | ||
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qintdict.h> | 29 | #include <q3intdict.h> |
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | //Added by qt3to4: | ||
32 | #include <QEvent> | ||
33 | #include <Q3PopupMenu> | ||
31 | #include <kglobal.h> | 34 | #include <kglobal.h> |
32 | 35 | ||
33 | class KToolBar; | 36 | class KToolBar; |
34 | class KToolBarButtonPrivate; | 37 | class KToolBarButtonPrivate; |
35 | //USclass KInstance; | 38 | //USclass KInstance; |
36 | class QEvent; | 39 | class QEvent; |
37 | class QPopupMenu; | 40 | class Q3PopupMenu; |
38 | class QPainter; | 41 | class QPainter; |
39 | 42 | ||
40 | /** | 43 | /** |
41 | * A toolbar button. This is used internally by @ref KToolBar, use the | 44 | * A toolbar button. This is used internally by @ref KToolBar, use the |
42 | * KToolBar methods instead. | 45 | * KToolBar methods instead. |
43 | * @internal | 46 | * @internal |
44 | */ | 47 | */ |
45 | class KToolBarButton : public QToolButton | 48 | class KToolBarButton : public QToolButton |
46 | { | 49 | { |
47 | Q_OBJECT | 50 | Q_OBJECT |
48 | 51 | ||
49 | public: | 52 | public: |
50 | /** | 53 | /** |
51 | * Construct a button with an icon loaded by the button itself. | 54 | * Construct a button with an icon loaded by the button itself. |
52 | * This will trust the button to load the correct icon with the | 55 | * This will trust the button to load the correct icon with the |
53 | * correct size. | 56 | * correct size. |
@@ -137,33 +140,33 @@ public: | |||
137 | * with the correct size. This function is preferred over @ref setIconSet | 140 | * with the correct size. This function is preferred over @ref setIconSet |
138 | * | 141 | * |
139 | * @param icon The name of the icon | 142 | * @param icon The name of the icon |
140 | */ | 143 | */ |
141 | virtual void setIcon(const QString &icon); | 144 | virtual void setIcon(const QString &icon); |
142 | 145 | ||
143 | /// @since 3.1 | 146 | /// @since 3.1 |
144 | virtual void setIcon( const QPixmap &pixmap ) | 147 | virtual void setIcon( const QPixmap &pixmap ) |
145 | { QToolButton::setIcon( pixmap ); } | 148 | { QToolButton::setIcon( pixmap ); } |
146 | 149 | ||
147 | /** | 150 | /** |
148 | * Set the pixmaps for this toolbar button from a QIconSet. | 151 | * Set the pixmaps for this toolbar button from a QIconSet. |
149 | * If you call this you don't need to call any of the other methods | 152 | * If you call this you don't need to call any of the other methods |
150 | * that set icons or pixmaps. | 153 | * that set icons or pixmaps. |
151 | * @param iconset The iconset to use | 154 | * @param iconset The iconset to use |
152 | */ | 155 | */ |
153 | virtual void setIconSet( const QIconSet &iconset ); | 156 | virtual void setIconSet( const QIcon &iconset ); |
154 | 157 | ||
155 | #ifndef KDE_NO_COMPAT | 158 | #ifndef KDE_NO_COMPAT |
156 | /** | 159 | /** |
157 | * @deprecated | 160 | * @deprecated |
158 | * Set the active icon for this button. The pixmap itself is loaded | 161 | * Set the active icon for this button. The pixmap itself is loaded |
159 | * internally based on the icon size... .. the disabled and default | 162 | * internally based on the icon size... .. the disabled and default |
160 | * pixmaps, however will only be constructed if @ref #generate is | 163 | * pixmaps, however will only be constructed if @ref #generate is |
161 | * true. This function is preferred over @ref setPixmap | 164 | * true. This function is preferred over @ref setPixmap |
162 | * | 165 | * |
163 | * @param icon The name of the active icon | 166 | * @param icon The name of the active icon |
164 | * @param generate If true, then the other icons are automagically | 167 | * @param generate If true, then the other icons are automagically |
165 | * generated from this one | 168 | * generated from this one |
166 | */ | 169 | */ |
167 | void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); } | 170 | void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); } |
168 | 171 | ||
169 | /** | 172 | /** |
@@ -196,59 +199,59 @@ public: | |||
196 | * Toggle this button | 199 | * Toggle this button |
197 | */ | 200 | */ |
198 | void toggle(); | 201 | void toggle(); |
199 | 202 | ||
200 | /** | 203 | /** |
201 | * Turn this button into a toggle button or disable the toggle | 204 | * Turn this button into a toggle button or disable the toggle |
202 | * aspects of it. This does not toggle the button itself. | 205 | * aspects of it. This does not toggle the button itself. |
203 | * Use @ref toggle() for that. | 206 | * Use @ref toggle() for that. |
204 | * | 207 | * |
205 | * @param toggle true or false | 208 | * @param toggle true or false |
206 | */ | 209 | */ |
207 | void setToggle(bool toggle = true); | 210 | void setToggle(bool toggle = true); |
208 | 211 | ||
209 | /** | 212 | /** |
210 | * Return a pointer to this button's popup menu (if it exists) | 213 | * Return a pointer to this button's popup menu (if it exists) |
211 | */ | 214 | */ |
212 | QPopupMenu *popup(); | 215 | QMenu *popup(); |
213 | 216 | ||
214 | /** | 217 | /** |
215 | * Returns the button's id. | 218 | * Returns the button's id. |
216 | * @since 3.2 | 219 | * @since 3.2 |
217 | */ | 220 | */ |
218 | int id() const; | 221 | int id() const; |
219 | 222 | ||
220 | /** | 223 | /** |
221 | * Give this button a popup menu. There will not be a delay when | 224 | * Give this button a popup menu. There will not be a delay when |
222 | * you press the button. Use @ref setDelayedPopup if you want that | 225 | * you press the button. Use @ref setDelayedPopup if you want that |
223 | * behavior. | 226 | * behavior. |
224 | * | 227 | * |
225 | * @param p The new popup menu | 228 | * @param p The new popup menu |
226 | */ | 229 | */ |
227 | void setPopup (QPopupMenu *p, bool unused = false); | 230 | void setPopup (Q3PopupMenu *p, bool unused = false); |
228 | 231 | ||
229 | /** | 232 | /** |
230 | * Gives this button a delayed popup menu. | 233 | * Gives this button a delayed popup menu. |
231 | * | 234 | * |
232 | * This function allows you to add a delayed popup menu to the button. | 235 | * This function allows you to add a delayed popup menu to the button. |
233 | * The popup menu is then only displayed when the button is pressed and | 236 | * The popup menu is then only displayed when the button is pressed and |
234 | * held down for about half a second. | 237 | * held down for about half a second. |
235 | * | 238 | * |
236 | * @param p the new popup menu | 239 | * @param p the new popup menu |
237 | */ | 240 | */ |
238 | void setDelayedPopup(QPopupMenu *p, bool unused = false); | 241 | void setDelayedPopup(Q3PopupMenu *p, bool unused = false); |
239 | 242 | ||
240 | /** | 243 | /** |
241 | * Turn this button into a radio button | 244 | * Turn this button into a radio button |
242 | * | 245 | * |
243 | * @param f true or false | 246 | * @param f true or false |
244 | */ | 247 | */ |
245 | void setRadio(bool f = true); | 248 | void setRadio(bool f = true); |
246 | 249 | ||
247 | /** | 250 | /** |
248 | * Toolbar buttons naturally will assume the global styles | 251 | * Toolbar buttons naturally will assume the global styles |
249 | * concerning icons, icons sizes, etc. You can use this function to | 252 | * concerning icons, icons sizes, etc. You can use this function to |
250 | * explicitely turn this off, if you like. | 253 | * explicitely turn this off, if you like. |
251 | * | 254 | * |
252 | * @param no_style Will disable styles if true | 255 | * @param no_style Will disable styles if true |
253 | */ | 256 | */ |
254 | void setNoStyle(bool no_style = true); | 257 | void setNoStyle(bool no_style = true); |
@@ -290,24 +293,24 @@ protected slots: | |||
290 | void slotPressed(); | 293 | void slotPressed(); |
291 | void slotReleased(); | 294 | void slotReleased(); |
292 | void slotToggled(); | 295 | void slotToggled(); |
293 | void slotDelayTimeout(); | 296 | void slotDelayTimeout(); |
294 | 297 | ||
295 | protected: | 298 | protected: |
296 | virtual void virtual_hook( int id, void* data ); | 299 | virtual void virtual_hook( int id, void* data ); |
297 | private: | 300 | private: |
298 | KToolBarButtonPrivate *d; | 301 | KToolBarButtonPrivate *d; |
299 | }; | 302 | }; |
300 | 303 | ||
301 | /** | 304 | /** |
302 | * List of @ref KToolBarButton objects. | 305 | * List of @ref KToolBarButton objects. |
303 | * @internal | 306 | * @internal |
304 | * @version $Id$ | 307 | * @version $Id$ |
305 | */ | 308 | */ |
306 | class KToolBarButtonList : public QIntDict<KToolBarButton> | 309 | class KToolBarButtonList : public Q3IntDict<KToolBarButton> |
307 | { | 310 | { |
308 | public: | 311 | public: |
309 | KToolBarButtonList(); | 312 | KToolBarButtonList(); |
310 | ~KToolBarButtonList() {} | 313 | ~KToolBarButtonList() {} |
311 | }; | 314 | }; |
312 | 315 | ||
313 | #endif | 316 | #endif |
diff --git a/microkde/kdeui/ktoolbarhandler.cpp b/microkde/kdeui/ktoolbarhandler.cpp index 7b97233..4d3ace7 100644 --- a/microkde/kdeui/ktoolbarhandler.cpp +++ b/microkde/kdeui/ktoolbarhandler.cpp | |||
@@ -5,131 +5,133 @@ | |||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "ktoolbarhandler.h" | 19 | #include "ktoolbarhandler.h" |
20 | 20 | ||
21 | #include <qpopupmenu.h> | 21 | #include <q3popupmenu.h> |
22 | //Added by qt3to4: | ||
23 | #include <Q3PtrList> | ||
22 | #include <kapplication.h> | 24 | #include <kapplication.h> |
23 | #include <ktoolbar.h> | 25 | #include <ktoolbar.h> |
24 | #include <kmainwindow.h> | 26 | #include <kmainwindow.h> |
25 | #include <klocale.h> | 27 | #include <klocale.h> |
26 | #include <kaction.h> | 28 | #include <kaction.h> |
27 | #include <assert.h> | 29 | #include <assert.h> |
28 | 30 | ||
29 | namespace | 31 | namespace |
30 | { | 32 | { |
31 | const char *actionListName = "show_menu_and_toolbar_actionlist"; | 33 | const char *actionListName = "show_menu_and_toolbar_actionlist"; |
32 | 34 | ||
33 | const char *guiDescription = "" | 35 | const char *guiDescription = "" |
34 | "<!DOCTYPE kpartgui><kpartgui name=\"StandardToolBarMenuHandler\">" | 36 | "<!DOCTYPE kpartgui><kpartgui name=\"StandardToolBarMenuHandler\">" |
35 | "<MenuBar>" | 37 | "<MenuBar>" |
36 | " <Menu name=\"settings\">" | 38 | " <Menu name=\"settings\">" |
37 | " <ActionList name=\"%1\" />" | 39 | " <ActionList name=\"%1\" />" |
38 | " </Menu>" | 40 | " </Menu>" |
39 | "</MenuBar>" | 41 | "</MenuBar>" |
40 | "</kpartgui>"; | 42 | "</kpartgui>"; |
41 | 43 | ||
42 | const char *resourceFileName = "barhandler.rc"; | 44 | const char *resourceFileName = "barhandler.rc"; |
43 | 45 | ||
44 | class BarActionBuilder | 46 | class BarActionBuilder |
45 | { | 47 | { |
46 | public: | 48 | public: |
47 | BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, QPtrList<KToolBar> &oldToolBarList ) | 49 | BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, Q3PtrList<KToolBar> &oldToolBarList ) |
48 | : m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false ) | 50 | : m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false ) |
49 | { | 51 | { |
50 | /*US | 52 | /*US |
51 | QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows(); | 53 | QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows(); |
52 | QPtrListIterator<QDockWindow> dockWindowIt( dockWindows ); | 54 | QPtrListIterator<QDockWindow> dockWindowIt( dockWindows ); |
53 | for ( ; dockWindowIt.current(); ++dockWindowIt ) { | 55 | for ( ; dockWindowIt.current(); ++dockWindowIt ) { |
54 | 56 | ||
55 | //US KToolBar *toolBar = dynamic_cast<KToolBar *>( dockWindowIt.current() ); | 57 | //US KToolBar *toolBar = dynamic_cast<KToolBar *>( dockWindowIt.current() ); |
56 | KToolBar *toolBar = (KToolBar *)( dockWindowIt.current() ); | 58 | KToolBar *toolBar = (KToolBar *)( dockWindowIt.current() ); |
57 | if ( !toolBar ) | 59 | if ( !toolBar ) |
58 | continue; | 60 | continue; |
59 | 61 | ||
60 | if ( oldToolBarList.findRef( toolBar ) == -1 ) | 62 | if ( oldToolBarList.findRef( toolBar ) == -1 ) |
61 | m_needsRebuild = true; | 63 | m_needsRebuild = true; |
62 | 64 | ||
63 | m_toolBars.append( toolBar ); | 65 | m_toolBars.append( toolBar ); |
64 | } | 66 | } |
65 | */ | 67 | */ |
66 | if ( !m_needsRebuild ) | 68 | if ( !m_needsRebuild ) |
67 | m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() ); | 69 | m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() ); |
68 | 70 | ||
69 | } | 71 | } |
70 | 72 | ||
71 | bool needsRebuild() const { return m_needsRebuild; } | 73 | bool needsRebuild() const { return m_needsRebuild; } |
72 | 74 | ||
73 | QPtrList<KAction> create() | 75 | Q3PtrList<KAction> create() |
74 | { | 76 | { |
75 | if ( !m_needsRebuild ) | 77 | if ( !m_needsRebuild ) |
76 | return QPtrList<KAction>(); | 78 | return Q3PtrList<KAction>(); |
77 | 79 | ||
78 | QPtrListIterator<KToolBar> toolBarIt( m_toolBars ); | 80 | Q3PtrListIterator<KToolBar> toolBarIt( m_toolBars ); |
79 | for ( ; toolBarIt.current(); ++toolBarIt ) | 81 | for ( ; toolBarIt.current(); ++toolBarIt ) |
80 | handleToolBar( toolBarIt.current() ); | 82 | handleToolBar( toolBarIt.current() ); |
81 | 83 | ||
82 | QPtrList<KAction> actions; | 84 | Q3PtrList<KAction> actions; |
83 | 85 | ||
84 | if ( m_toolBarActions.count() == 0 ) | 86 | if ( m_toolBarActions.count() == 0 ) |
85 | return actions; | 87 | return actions; |
86 | 88 | ||
87 | if ( m_toolBarActions.count() == 1 ) { | 89 | if ( m_toolBarActions.count() == 1 ) { |
88 | m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) ); | 90 | m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) ); |
89 | return m_toolBarActions; | 91 | return m_toolBarActions; |
90 | } | 92 | } |
91 | 93 | ||
92 | KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" ); | 94 | KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" ); |
93 | 95 | ||
94 | QPtrListIterator<KAction> actionIt( m_toolBarActions ); | 96 | Q3PtrListIterator<KAction> actionIt( m_toolBarActions ); |
95 | for ( ; actionIt.current(); ++actionIt ) | 97 | for ( ; actionIt.current(); ++actionIt ) |
96 | menuAction->insert( actionIt.current() ); | 98 | menuAction->insert( actionIt.current() ); |
97 | 99 | ||
98 | actions.append( menuAction ); | 100 | actions.append( menuAction ); |
99 | return actions; | 101 | return actions; |
100 | } | 102 | } |
101 | 103 | ||
102 | const QPtrList<KToolBar> &toolBars() const { return m_toolBars; } | 104 | const Q3PtrList<KToolBar> &toolBars() const { return m_toolBars; } |
103 | 105 | ||
104 | private: | 106 | private: |
105 | void handleToolBar( KToolBar *toolBar ) | 107 | void handleToolBar( KToolBar *toolBar ) |
106 | { | 108 | { |
107 | KAction *action = new KToggleToolBarAction( toolBar, | 109 | KAction *action = new KToggleToolBarAction( toolBar, |
108 | i18n( "Show %1" ).arg( toolBar->label() ), | 110 | i18n( "Show %1" ).arg( toolBar->label() ), |
109 | m_actionCollection, | 111 | m_actionCollection, |
110 | toolBar->name() ); | 112 | toolBar->name() ); |
111 | 113 | ||
112 | m_toolBarActions.append( action ); | 114 | m_toolBarActions.append( action ); |
113 | } | 115 | } |
114 | 116 | ||
115 | KActionCollection *m_actionCollection; | 117 | KActionCollection *m_actionCollection; |
116 | KMainWindow *m_mainWindow; | 118 | KMainWindow *m_mainWindow; |
117 | 119 | ||
118 | QPtrList<KToolBar> m_toolBars; | 120 | Q3PtrList<KToolBar> m_toolBars; |
119 | QPtrList<KAction> m_toolBarActions; | 121 | Q3PtrList<KAction> m_toolBarActions; |
120 | 122 | ||
121 | bool m_needsRebuild : 1; | 123 | bool m_needsRebuild : 1; |
122 | }; | 124 | }; |
123 | } | 125 | } |
124 | 126 | ||
125 | using namespace KDEPrivate; | 127 | using namespace KDEPrivate; |
126 | 128 | ||
127 | ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, const char *name ) | 129 | ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, const char *name ) |
128 | : QObject( mainWindow, name ), KXMLGUIClient( mainWindow ) | 130 | : QObject( mainWindow, name ), KXMLGUIClient( mainWindow ) |
129 | { | 131 | { |
130 | init( mainWindow ); | 132 | init( mainWindow ); |
131 | } | 133 | } |
132 | 134 | ||
133 | ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name ) | 135 | ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name ) |
134 | : QObject( parent, name ), KXMLGUIClient( mainWindow ) | 136 | : QObject( parent, name ), KXMLGUIClient( mainWindow ) |
135 | { | 137 | { |
@@ -211,43 +213,43 @@ void ToolBarHandler::init( KMainWindow *mainWindow ) | |||
211 | /* | 213 | /* |
212 | setXMLFile( resourceFileName ); | 214 | setXMLFile( resourceFileName ); |
213 | */ | 215 | */ |
214 | /*US | 216 | /*US |
215 | if ( domDocument().documentElement().isNull() ) { | 217 | if ( domDocument().documentElement().isNull() ) { |
216 | 218 | ||
217 | QString completeDescription = QString::fromLatin1( guiDescription ) | 219 | QString completeDescription = QString::fromLatin1( guiDescription ) |
218 | .arg( actionListName ); | 220 | .arg( actionListName ); |
219 | 221 | ||
220 | setXML( completeDescription, false*/ /*merge*/ /*); | 222 | setXML( completeDescription, false*/ /*merge*/ /*); |
221 | } | 223 | } |
222 | */ | 224 | */ |
223 | } | 225 | } |
224 | 226 | ||
225 | void ToolBarHandler::connectToActionContainers() | 227 | void ToolBarHandler::connectToActionContainers() |
226 | { | 228 | { |
227 | QPtrListIterator<KAction> actionIt( m_actions ); | 229 | Q3PtrListIterator<KAction> actionIt( m_actions ); |
228 | for ( ; actionIt.current(); ++actionIt ) | 230 | for ( ; actionIt.current(); ++actionIt ) |
229 | connectToActionContainer( actionIt.current() ); | 231 | connectToActionContainer( actionIt.current() ); |
230 | } | 232 | } |
231 | 233 | ||
232 | void ToolBarHandler::connectToActionContainer( KAction *action ) | 234 | void ToolBarHandler::connectToActionContainer( KAction *action ) |
233 | { | 235 | { |
234 | uint containerCount = action->containerCount(); | 236 | uint containerCount = action->containerCount(); |
235 | for ( uint i = 0; i < containerCount; ++i ) | 237 | for ( uint i = 0; i < containerCount; ++i ) |
236 | connectToActionContainer( action->container( i ) ); | 238 | connectToActionContainer( action->container( i ) ); |
237 | } | 239 | } |
238 | 240 | ||
239 | void ToolBarHandler::connectToActionContainer( QWidget *container ) | 241 | void ToolBarHandler::connectToActionContainer( QWidget *container ) |
240 | { | 242 | { |
241 | //US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container ); | 243 | //US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container ); |
242 | QPopupMenu *popupMenu = (QPopupMenu *)( container ); | 244 | Q3PopupMenu *popupMenu = (Q3PopupMenu *)( container ); |
243 | if ( !popupMenu ) | 245 | if ( !popupMenu ) |
244 | return; | 246 | return; |
245 | 247 | ||
246 | connect( popupMenu, SIGNAL( aboutToShow() ), | 248 | connect( popupMenu, SIGNAL( aboutToShow() ), |
247 | this, SLOT( setupActions() ) ); | 249 | this, SLOT( setupActions() ) ); |
248 | } | 250 | } |
249 | 251 | ||
250 | //US #include "ktoolbarhandler.moc" | 252 | //US #include "ktoolbarhandler.moc" |
251 | 253 | ||
252 | /* vim: et sw=4 ts=4 | 254 | /* vim: et sw=4 ts=4 |
253 | */ | 255 | */ |
diff --git a/microkde/kdeui/ktoolbarhandler.h b/microkde/kdeui/ktoolbarhandler.h index a1340ae..35f0d18 100644 --- a/microkde/kdeui/ktoolbarhandler.h +++ b/microkde/kdeui/ktoolbarhandler.h | |||
@@ -7,34 +7,34 @@ | |||
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef KBARHANDLER_H | 19 | #ifndef KBARHANDLER_H |
20 | #define KBARHANDLER_H | 20 | #define KBARHANDLER_H |
21 | 21 | ||
22 | #include <qobject.h> | 22 | #include <qobject.h> |
23 | #include <qguardedptr.h> | 23 | #include <qpointer.h> |
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | #include <kxmlguiclient.h> | 25 | #include <kxmlguiclient.h> |
26 | #include <kaction.h> | 26 | #include <kaction.h> |
27 | 27 | ||
28 | class KMainWindow; | 28 | class KMainWindow; |
29 | class KToolBar; | 29 | class KToolBar; |
30 | 30 | ||
31 | namespace KDEPrivate | 31 | namespace KDEPrivate |
32 | { | 32 | { |
33 | 33 | ||
34 | /// @since 3.1 | 34 | /// @since 3.1 |
35 | class ToolBarHandler : public QObject, public KXMLGUIClient | 35 | class ToolBarHandler : public QObject, public KXMLGUIClient |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | ToolBarHandler( KMainWindow *mainWindow, const char *name = 0 ); | 39 | ToolBarHandler( KMainWindow *mainWindow, const char *name = 0 ); |
40 | ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name = 0 ); | 40 | ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name = 0 ); |
@@ -44,27 +44,27 @@ public: | |||
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | void setupActions(); | 46 | void setupActions(); |
47 | 47 | ||
48 | private slots: | 48 | private slots: |
49 | //US void clientAdded( KXMLGUIClient *client ); | 49 | //US void clientAdded( KXMLGUIClient *client ); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | void init( KMainWindow *mainWindow ); | 52 | void init( KMainWindow *mainWindow ); |
53 | void connectToActionContainers(); | 53 | void connectToActionContainers(); |
54 | void connectToActionContainer( KAction *action ); | 54 | void connectToActionContainer( KAction *action ); |
55 | void connectToActionContainer( QWidget *container ); | 55 | void connectToActionContainer( QWidget *container ); |
56 | 56 | ||
57 | struct Data; | 57 | struct Data; |
58 | Data *d; | 58 | Data *d; |
59 | 59 | ||
60 | QGuardedPtr<KMainWindow> m_mainWindow; | 60 | QPointer<KMainWindow> m_mainWindow; |
61 | QPtrList<KAction> m_actions; | 61 | Q3PtrList<KAction> m_actions; |
62 | QPtrList<KToolBar> m_toolBars; | 62 | Q3PtrList<KToolBar> m_toolBars; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | } // namespace KDEPrivate | 65 | } // namespace KDEPrivate |
66 | 66 | ||
67 | #endif // KBARHANDLER_H | 67 | #endif // KBARHANDLER_H |
68 | 68 | ||
69 | /* vim: et sw=4 ts=4 | 69 | /* vim: et sw=4 ts=4 |
70 | */ | 70 | */ |
diff --git a/microkde/kdeui/kxmlguiclient.cpp b/microkde/kdeui/kxmlguiclient.cpp index 073e30b..8740bde 100644 --- a/microkde/kdeui/kxmlguiclient.cpp +++ b/microkde/kdeui/kxmlguiclient.cpp | |||
@@ -26,93 +26,95 @@ | |||
26 | 26 | ||
27 | /*US | 27 | /*US |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qdom.h> | 30 | #include <qdom.h> |
31 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | */ | 33 | */ |
34 | 34 | ||
35 | //US #include <kinstance.h> | 35 | //US #include <kinstance.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <kaction.h> | 38 | #include <kaction.h> |
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | 40 | ||
41 | #include <assert.h> | 41 | #include <assert.h> |
42 | //Added by qt3to4: | ||
43 | #include <Q3PtrList> | ||
42 | 44 | ||
43 | class KXMLGUIClientPrivate | 45 | class KXMLGUIClientPrivate |
44 | { | 46 | { |
45 | public: | 47 | public: |
46 | KXMLGUIClientPrivate() | 48 | KXMLGUIClientPrivate() |
47 | { | 49 | { |
48 | //US m_instance = KGlobal::instance(); | 50 | //US m_instance = KGlobal::instance(); |
49 | //US m_factory = 0L; | 51 | //US m_factory = 0L; |
50 | m_parent = 0L; | 52 | m_parent = 0L; |
51 | //US m_builder = 0L; | 53 | //US m_builder = 0L; |
52 | m_actionCollection = 0; | 54 | m_actionCollection = 0; |
53 | } | 55 | } |
54 | ~KXMLGUIClientPrivate() | 56 | ~KXMLGUIClientPrivate() |
55 | { | 57 | { |
56 | } | 58 | } |
57 | 59 | ||
58 | //US KInstance *m_instance; | 60 | //US KInstance *m_instance; |
59 | 61 | ||
60 | //US QDomDocument m_doc; | 62 | //US QDomDocument m_doc; |
61 | KActionCollection *m_actionCollection; | 63 | KActionCollection *m_actionCollection; |
62 | //US QDomDocument m_buildDocument; | 64 | //US QDomDocument m_buildDocument; |
63 | //US KXMLGUIFactory *m_factory; | 65 | //US KXMLGUIFactory *m_factory; |
64 | KXMLGUIClient *m_parent; | 66 | KXMLGUIClient *m_parent; |
65 | //QPtrList<KXMLGUIClient> m_supers; | 67 | //QPtrList<KXMLGUIClient> m_supers; |
66 | QPtrList<KXMLGUIClient> m_children; | 68 | Q3PtrList<KXMLGUIClient> m_children; |
67 | //US KXMLGUIBuilder *m_builder; | 69 | //US KXMLGUIBuilder *m_builder; |
68 | //US QString m_xmlFile; | 70 | //US QString m_xmlFile; |
69 | //US QString m_localXMLFile; | 71 | //US QString m_localXMLFile; |
70 | }; | 72 | }; |
71 | 73 | ||
72 | KXMLGUIClient::KXMLGUIClient() | 74 | KXMLGUIClient::KXMLGUIClient() |
73 | { | 75 | { |
74 | d = new KXMLGUIClientPrivate; | 76 | d = new KXMLGUIClientPrivate; |
75 | } | 77 | } |
76 | 78 | ||
77 | KXMLGUIClient::KXMLGUIClient( KXMLGUIClient *parent ) | 79 | KXMLGUIClient::KXMLGUIClient( KXMLGUIClient *parent ) |
78 | { | 80 | { |
79 | d = new KXMLGUIClientPrivate; | 81 | d = new KXMLGUIClientPrivate; |
80 | parent->insertChildClient( this ); | 82 | parent->insertChildClient( this ); |
81 | } | 83 | } |
82 | 84 | ||
83 | KXMLGUIClient::~KXMLGUIClient() | 85 | KXMLGUIClient::~KXMLGUIClient() |
84 | { | 86 | { |
85 | if ( d->m_parent ) | 87 | if ( d->m_parent ) |
86 | d->m_parent->removeChildClient( this ); | 88 | d->m_parent->removeChildClient( this ); |
87 | 89 | ||
88 | QPtrListIterator<KXMLGUIClient> it( d->m_children ); | 90 | Q3PtrListIterator<KXMLGUIClient> it( d->m_children ); |
89 | for ( ; it.current(); ++it ) { | 91 | for ( ; it.current(); ++it ) { |
90 | assert( it.current()->d->m_parent == this ); | 92 | assert( it.current()->d->m_parent == this ); |
91 | it.current()->d->m_parent = 0; | 93 | it.current()->d->m_parent = 0; |
92 | } | 94 | } |
93 | 95 | ||
94 | delete d->m_actionCollection; | 96 | delete d->m_actionCollection; |
95 | delete d; | 97 | delete d; |
96 | } | 98 | } |
97 | 99 | ||
98 | KAction *KXMLGUIClient::action( const char *name ) const | 100 | KAction *KXMLGUIClient::action( const char *name ) const |
99 | { | 101 | { |
100 | KAction* act = actionCollection()->action( name ); | 102 | KAction* act = actionCollection()->action( name ); |
101 | if ( !act ) { | 103 | if ( !act ) { |
102 | QPtrListIterator<KXMLGUIClient> childIt( d->m_children ); | 104 | Q3PtrListIterator<KXMLGUIClient> childIt( d->m_children ); |
103 | for (; childIt.current(); ++childIt ) { | 105 | for (; childIt.current(); ++childIt ) { |
104 | act = childIt.current()->actionCollection()->action( name ); | 106 | act = childIt.current()->actionCollection()->action( name ); |
105 | if ( act ) | 107 | if ( act ) |
106 | break; | 108 | break; |
107 | } | 109 | } |
108 | } | 110 | } |
109 | return act; | 111 | return act; |
110 | } | 112 | } |
111 | 113 | ||
112 | KActionCollection *KXMLGUIClient::actionCollection() const | 114 | KActionCollection *KXMLGUIClient::actionCollection() const |
113 | { | 115 | { |
114 | if ( !d->m_actionCollection ) | 116 | if ( !d->m_actionCollection ) |
115 | d->m_actionCollection = new KActionCollection( 0, 0, | 117 | d->m_actionCollection = new KActionCollection( 0, 0, |
116 | "KXMLGUILClient-KActionCollection" ); | 118 | "KXMLGUILClient-KActionCollection" ); |
117 | return d->m_actionCollection; | 119 | return d->m_actionCollection; |
118 | } | 120 | } |
@@ -575,51 +577,51 @@ void KXMLGUIClient::insertChildClient( KXMLGUIClient *child ) | |||
575 | 577 | ||
576 | void KXMLGUIClient::removeChildClient( KXMLGUIClient *child ) | 578 | void KXMLGUIClient::removeChildClient( KXMLGUIClient *child ) |
577 | { | 579 | { |
578 | assert( d->m_children.containsRef( child ) ); | 580 | assert( d->m_children.containsRef( child ) ); |
579 | d->m_children.removeRef( child ); | 581 | d->m_children.removeRef( child ); |
580 | child->d->m_parent = 0; | 582 | child->d->m_parent = 0; |
581 | } | 583 | } |
582 | 584 | ||
583 | /*bool KXMLGUIClient::addSuperClient( KXMLGUIClient *super ) | 585 | /*bool KXMLGUIClient::addSuperClient( KXMLGUIClient *super ) |
584 | { | 586 | { |
585 | if ( d->m_supers.contains( super ) ) | 587 | if ( d->m_supers.contains( super ) ) |
586 | return false; | 588 | return false; |
587 | d->m_supers.append( super ); | 589 | d->m_supers.append( super ); |
588 | return true; | 590 | return true; |
589 | }*/ | 591 | }*/ |
590 | 592 | ||
591 | const QPtrList<KXMLGUIClient> *KXMLGUIClient::childClients() | 593 | const Q3PtrList<KXMLGUIClient> *KXMLGUIClient::childClients() |
592 | { | 594 | { |
593 | return &d->m_children; | 595 | return &d->m_children; |
594 | } | 596 | } |
595 | /*US | 597 | /*US |
596 | void KXMLGUIClient::setClientBuilder( KXMLGUIBuilder *builder ) | 598 | void KXMLGUIClient::setClientBuilder( KXMLGUIBuilder *builder ) |
597 | { | 599 | { |
598 | d->m_builder = builder; | 600 | d->m_builder = builder; |
599 | if ( builder ) | 601 | if ( builder ) |
600 | builder->setBuilderInstance( instance() ); | 602 | builder->setBuilderInstance( instance() ); |
601 | } | 603 | } |
602 | 604 | ||
603 | KXMLGUIBuilder *KXMLGUIClient::clientBuilder() const | 605 | KXMLGUIBuilder *KXMLGUIClient::clientBuilder() const |
604 | { | 606 | { |
605 | return d->m_builder; | 607 | return d->m_builder; |
606 | } | 608 | } |
607 | */ | 609 | */ |
608 | 610 | ||
609 | void KXMLGUIClient::plugActionList( const QString &name, const QPtrList<KAction> &actionList ) | 611 | void KXMLGUIClient::plugActionList( const QString &name, const Q3PtrList<KAction> &actionList ) |
610 | { | 612 | { |
611 | /*US | 613 | /*US |
612 | if ( !d->m_factory ) | 614 | if ( !d->m_factory ) |
613 | return; | 615 | return; |
614 | 616 | ||
615 | d->m_factory->plugActionList( this, name, actionList ); | 617 | d->m_factory->plugActionList( this, name, actionList ); |
616 | */ | 618 | */ |
617 | } | 619 | } |
618 | 620 | ||
619 | void KXMLGUIClient::unplugActionList( const QString &name ) | 621 | void KXMLGUIClient::unplugActionList( const QString &name ) |
620 | { | 622 | { |
621 | /*US | 623 | /*US |
622 | if ( !d->m_factory ) | 624 | if ( !d->m_factory ) |
623 | return; | 625 | return; |
624 | 626 | ||
625 | d->m_factory->unplugActionList( this, name ); | 627 | d->m_factory->unplugActionList( this, name ); |
diff --git a/microkde/kdeui/kxmlguiclient.h b/microkde/kdeui/kxmlguiclient.h index cd74c8e..b9d7b09 100644 --- a/microkde/kdeui/kxmlguiclient.h +++ b/microkde/kdeui/kxmlguiclient.h | |||
@@ -8,33 +8,33 @@ | |||
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | #ifndef _KXMLGUICLIENT_H | 19 | #ifndef _KXMLGUICLIENT_H |
20 | #define _KXMLGUICLIENT_H | 20 | #define _KXMLGUICLIENT_H |
21 | 21 | ||
22 | 22 | ||
23 | //US #include <qdom.h> | 23 | //US #include <qdom.h> |
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | class QWidget; | 28 | class QWidget; |
29 | class KAction; | 29 | class KAction; |
30 | class KActionCollection; | 30 | class KActionCollection; |
31 | class KInstance; | 31 | class KInstance; |
32 | 32 | ||
33 | class KXMLGUIClientPrivate; | 33 | class KXMLGUIClientPrivate; |
34 | class KXMLGUIFactory; | 34 | class KXMLGUIFactory; |
35 | class KXMLGUIBuilder; | 35 | class KXMLGUIBuilder; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * | 38 | * |
39 | * A KXMLGUIClient can be used with @ref KXMLGUIFactory to create a | 39 | * A KXMLGUIClient can be used with @ref KXMLGUIFactory to create a |
40 | * GUI from actions and an XML document, and can be dynamically merged | 40 | * GUI from actions and an XML document, and can be dynamically merged |
@@ -148,33 +148,33 @@ public: | |||
148 | /** | 148 | /** |
149 | * Use this method to make a client a child client of another client. | 149 | * Use this method to make a client a child client of another client. |
150 | * Usually you don't need to call this method, as it is called | 150 | * Usually you don't need to call this method, as it is called |
151 | * automatically when using the second constructor, which takes a | 151 | * automatically when using the second constructor, which takes a |
152 | * arent argument. | 152 | * arent argument. |
153 | */ | 153 | */ |
154 | void insertChildClient( KXMLGUIClient *child ); | 154 | void insertChildClient( KXMLGUIClient *child ); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Removes the given @p child from the client's children list. | 157 | * Removes the given @p child from the client's children list. |
158 | */ | 158 | */ |
159 | void removeChildClient( KXMLGUIClient *child ); | 159 | void removeChildClient( KXMLGUIClient *child ); |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Retrieves a list of all child clients. | 162 | * Retrieves a list of all child clients. |
163 | */ | 163 | */ |
164 | const QPtrList<KXMLGUIClient> *childClients(); | 164 | const Q3PtrList<KXMLGUIClient> *childClients(); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * A client can have an own @ref KXMLGUIBuilder. | 167 | * A client can have an own @ref KXMLGUIBuilder. |
168 | * Use this method to assign your builder instance to the client (so that the | 168 | * Use this method to assign your builder instance to the client (so that the |
169 | * @ref KXMLGUIFactory can use it when building the client's GUI) | 169 | * @ref KXMLGUIFactory can use it when building the client's GUI) |
170 | * | 170 | * |
171 | * Client specific guibuilders are useful if you want to create | 171 | * Client specific guibuilders are useful if you want to create |
172 | * custom container widgets for your GUI. | 172 | * custom container widgets for your GUI. |
173 | */ | 173 | */ |
174 | //US void setClientBuilder( KXMLGUIBuilder *builder ); | 174 | //US void setClientBuilder( KXMLGUIBuilder *builder ); |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * Retrieves the client's GUI builder or 0L if no client specific | 177 | * Retrieves the client's GUI builder or 0L if no client specific |
178 | * builder has been assigned via @ref #setClientBuilder() | 178 | * builder has been assigned via @ref #setClientBuilder() |
179 | */ | 179 | */ |
180 | //US KXMLGUIBuilder *clientBuilder() const; | 180 | //US KXMLGUIBuilder *clientBuilder() const; |
@@ -215,33 +215,33 @@ public: | |||
215 | * QPtrList<KAction> file_actions; | 215 | * QPtrList<KAction> file_actions; |
216 | * for( ... ) | 216 | * for( ... ) |
217 | * if( ... ) | 217 | * if( ... ) |
218 | * file_actions.append( cool_action ); | 218 | * file_actions.append( cool_action ); |
219 | * unplugActionList( "xxx_file_actionlist" ); | 219 | * unplugActionList( "xxx_file_actionlist" ); |
220 | * plugActionList( "xxx_file_actionlist", file_actions ); | 220 | * plugActionList( "xxx_file_actionlist", file_actions ); |
221 | * \endcode | 221 | * \endcode |
222 | * every time a file is selected, unselected or ... | 222 | * every time a file is selected, unselected or ... |
223 | * | 223 | * |
224 | * \note You should not call createGUI() after calling this | 224 | * \note You should not call createGUI() after calling this |
225 | * function. In fact, that would remove the newly added | 225 | * function. In fact, that would remove the newly added |
226 | * actionlists again... | 226 | * actionlists again... |
227 | * \note Forgetting to call unplugActionList() before | 227 | * \note Forgetting to call unplugActionList() before |
228 | * plugActionList() would leave the previous actions in the | 228 | * plugActionList() would leave the previous actions in the |
229 | * menu too.. | 229 | * menu too.. |
230 | */ | 230 | */ |
231 | void plugActionList( const QString &name, const QPtrList<KAction> &actionList ); | 231 | void plugActionList( const QString &name, const Q3PtrList<KAction> &actionList ); |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * The complement of \ref plugActionList() ... | 234 | * The complement of \ref plugActionList() ... |
235 | */ | 235 | */ |
236 | void unplugActionList( const QString &name ); | 236 | void unplugActionList( const QString &name ); |
237 | 237 | ||
238 | //US static QString findMostRecentXMLFile( const QStringList &files, QString &doc ); | 238 | //US static QString findMostRecentXMLFile( const QStringList &files, QString &doc ); |
239 | 239 | ||
240 | void addStateActionEnabled(const QString& state, const QString& action); | 240 | void addStateActionEnabled(const QString& state, const QString& action); |
241 | 241 | ||
242 | void addStateActionDisabled(const QString& state, const QString& action); | 242 | void addStateActionDisabled(const QString& state, const QString& action); |
243 | 243 | ||
244 | enum ReverseStateChange { StateNoReverse, StateReverse }; | 244 | enum ReverseStateChange { StateNoReverse, StateReverse }; |
245 | struct StateChange | 245 | struct StateChange |
246 | { | 246 | { |
247 | QStringList actionsToEnable; | 247 | QStringList actionsToEnable; |
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp index 8398956..57e7ea6 100644 --- a/microkde/kdialog.cpp +++ b/microkde/kdialog.cpp | |||
@@ -1,51 +1,53 @@ | |||
1 | 1 | ||
2 | #include <kdialog.h> | 2 | #include <kdialog.h> |
3 | #include <qapp.h> | 3 | #include <qapplication.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qprogressbar.h> | 7 | #include <q3progressbar.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3VBoxLayout> | ||
8 | #include <klocale.h> | 10 | #include <klocale.h> |
9 | 11 | ||
10 | KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : | 12 | KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : |
11 | QDialog( parent, name, modal ) | 13 | QDialog( parent, name, modal ) |
12 | { | 14 | { |
13 | ; | 15 | ; |
14 | 16 | ||
15 | } | 17 | } |
16 | #ifdef DESKTOP_VERSION | 18 | #ifdef DESKTOP_VERSION |
17 | int KDialog::spacingHint() { return 7; } | 19 | int KDialog::spacingHint() { return 7; } |
18 | int KDialog::marginHint() { return 7; } | 20 | int KDialog::marginHint() { return 7; } |
19 | 21 | ||
20 | int KDialog::spacingHintSmall() { return 4; } | 22 | int KDialog::spacingHintSmall() { return 4; } |
21 | int KDialog::marginHintSmall() { return 4; } | 23 | int KDialog::marginHintSmall() { return 4; } |
22 | 24 | ||
23 | #else | 25 | #else |
24 | int KDialog::spacingHint() { return 3; } | 26 | int KDialog::spacingHint() { return 3; } |
25 | int KDialog::marginHint() { return 3; } | 27 | int KDialog::marginHint() { return 3; } |
26 | 28 | ||
27 | int KDialog::spacingHintSmall() { return 1; } | 29 | int KDialog::spacingHintSmall() { return 1; } |
28 | int KDialog::marginHintSmall() { return 1; } | 30 | int KDialog::marginHintSmall() { return 1; } |
29 | #endif | 31 | #endif |
30 | KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) : | 32 | KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) : |
31 | QDialog( parent, name, modal ) | 33 | QDialog( parent, name, modal ) |
32 | { | 34 | { |
33 | QVBoxLayout* lay= new QVBoxLayout ( this ); | 35 | Q3VBoxLayout* lay= new Q3VBoxLayout ( this ); |
34 | mLabel = new QLabel ( "abc",this ); | 36 | mLabel = new QLabel ( "abc",this ); |
35 | mBar = new QProgressBar ( this ); | 37 | mBar = new Q3ProgressBar ( this ); |
36 | mButton = new QPushButton ( i18n("Cancel"),this ); | 38 | mButton = new QPushButton ( i18n("Cancel"),this ); |
37 | lay->addWidget ( mLabel ); | 39 | lay->addWidget ( mLabel ); |
38 | lay->addWidget ( mBar ); | 40 | lay->addWidget ( mBar ); |
39 | lay->addWidget ( mButton ); | 41 | lay->addWidget ( mButton ); |
40 | connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () )); | 42 | connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () )); |
41 | resize ( 220, sizeHint().height() +mLabel->sizeHint().height()); | 43 | resize ( 220, sizeHint().height() +mLabel->sizeHint().height()); |
42 | 44 | ||
43 | } | 45 | } |
44 | 46 | ||
45 | void KProgressDialog::setLabelText ( const QString & t) | 47 | void KProgressDialog::setLabelText ( const QString & t) |
46 | { | 48 | { |
47 | mLabel->setText( t ); | 49 | mLabel->setText( t ); |
48 | } | 50 | } |
49 | 51 | ||
50 | void KProgressDialog::setTotalSteps ( int totalSteps ) | 52 | void KProgressDialog::setTotalSteps ( int totalSteps ) |
51 | { | 53 | { |
diff --git a/microkde/kdialog.h b/microkde/kdialog.h index bc80689..5f9bf0e 100644 --- a/microkde/kdialog.h +++ b/microkde/kdialog.h | |||
@@ -1,38 +1,40 @@ | |||
1 | #ifndef MINIKDE_KDIALOG_H | 1 | #ifndef MINIKDE_KDIALOG_H |
2 | #define MINIKDE_KDIALOG_H | 2 | #define MINIKDE_KDIALOG_H |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | //Added by qt3to4: | ||
6 | #include <QLabel> | ||
5 | class QLabel; | 7 | class QLabel; |
6 | class QProgressBar; | 8 | class Q3ProgressBar; |
7 | class QPushButton ; | 9 | class QPushButton ; |
8 | 10 | ||
9 | class KDialog : public QDialog | 11 | class KDialog : public QDialog |
10 | { | 12 | { |
11 | Q_OBJECT | 13 | Q_OBJECT |
12 | public: | 14 | public: |
13 | KDialog( QWidget *parent=0, const char *name=0, bool modal=true ); | 15 | KDialog( QWidget *parent=0, const char *name=0, bool modal=true ); |
14 | 16 | ||
15 | static int spacingHint(); | 17 | static int spacingHint(); |
16 | static int marginHint(); | 18 | static int marginHint(); |
17 | static int spacingHintSmall(); | 19 | static int spacingHintSmall(); |
18 | static int marginHintSmall(); | 20 | static int marginHintSmall(); |
19 | }; | 21 | }; |
20 | class KProgressDialog : public QDialog | 22 | class KProgressDialog : public QDialog |
21 | { | 23 | { |
22 | Q_OBJECT | 24 | Q_OBJECT |
23 | public: | 25 | public: |
24 | KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false ); | 26 | KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false ); |
25 | void setLabelText ( const QString & ); | 27 | void setLabelText ( const QString & ); |
26 | void setTotalSteps ( int totalSteps ); | 28 | void setTotalSteps ( int totalSteps ); |
27 | void setProgress ( int progress ); | 29 | void setProgress ( int progress ); |
28 | void accept(); | 30 | void accept(); |
29 | void reject(); | 31 | void reject(); |
30 | private: | 32 | private: |
31 | QLabel * mLabel; | 33 | QLabel * mLabel; |
32 | QProgressBar *mBar; | 34 | Q3ProgressBar *mBar; |
33 | QPushButton *mButton; | 35 | QPushButton *mButton; |
34 | signals: | 36 | signals: |
35 | void cancelled (); | 37 | void cancelled (); |
36 | }; | 38 | }; |
37 | 39 | ||
38 | #endif | 40 | #endif |
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index d5c7e61..a40bad6 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,20 +1,24 @@ | |||
1 | #include <qtabwidget.h> | 1 | #include <qtabwidget.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qframe.h> | 4 | #include <q3frame.h> |
5 | //Added by qt3to4: | ||
6 | #include <QPixmap> | ||
7 | #include <Q3HBoxLayout> | ||
8 | #include <Q3VBoxLayout> | ||
5 | 9 | ||
6 | 10 | ||
7 | #include "klocale.h" | 11 | #include "klocale.h" |
8 | #include "kdebug.h" | 12 | #include "kdebug.h" |
9 | 13 | ||
10 | #include "kdialogbase.h" | 14 | #include "kdialogbase.h" |
11 | 15 | ||
12 | KDialogBase::KDialogBase() | 16 | KDialogBase::KDialogBase() |
13 | { | 17 | { |
14 | } | 18 | } |
15 | 19 | ||
16 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, | 20 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, |
17 | const QString &caption, | 21 | const QString &caption, |
18 | int buttonMask, ButtonCode defaultButton, | 22 | int buttonMask, ButtonCode defaultButton, |
19 | bool separator, | 23 | bool separator, |
20 | const QString &user1, | 24 | const QString &user1, |
@@ -122,61 +126,61 @@ QTabWidget *KDialogBase::tabWidget() | |||
122 | 126 | ||
123 | void KDialogBase::hideButtons() | 127 | void KDialogBase::hideButtons() |
124 | { | 128 | { |
125 | if ( mUser1Button ) mUser1Button->hide() ; | 129 | if ( mUser1Button ) mUser1Button->hide() ; |
126 | if ( mUser2Button ) mUser2Button->hide() ; | 130 | if ( mUser2Button ) mUser2Button->hide() ; |
127 | if ( mOkButton ) mOkButton->hide() ; | 131 | if ( mOkButton ) mOkButton->hide() ; |
128 | if ( mApplyButton ) mApplyButton->hide() ; | 132 | if ( mApplyButton ) mApplyButton->hide() ; |
129 | if ( mDefaultButton ) mDefaultButton->hide(); | 133 | if ( mDefaultButton ) mDefaultButton->hide(); |
130 | if ( mCancelButton ) mCancelButton->hide() ; | 134 | if ( mCancelButton ) mCancelButton->hide() ; |
131 | if ( mCloseButton ) mCloseButton->hide() ; | 135 | if ( mCloseButton ) mCloseButton->hide() ; |
132 | 136 | ||
133 | } | 137 | } |
134 | void KDialogBase::initLayout() | 138 | void KDialogBase::initLayout() |
135 | { | 139 | { |
136 | 140 | ||
137 | delete mTopLayout; | 141 | delete mTopLayout; |
138 | mTopLayout = new QVBoxLayout( this ); | 142 | mTopLayout = new Q3VBoxLayout( this ); |
139 | mTopLayout->setMargin( marginHintSmall() ); | 143 | mTopLayout->setMargin( marginHintSmall() ); |
140 | mTopLayout->setSpacing( spacingHintSmall() ); | 144 | mTopLayout->setSpacing( spacingHintSmall() ); |
141 | 145 | ||
142 | mTopLayout->addWidget( mMainWidget ); | 146 | mTopLayout->addWidget( mMainWidget ); |
143 | 147 | ||
144 | QBoxLayout *buttonLayout = new QHBoxLayout; | 148 | Q3BoxLayout *buttonLayout = new Q3HBoxLayout; |
145 | mTopLayout->addLayout( buttonLayout ); | 149 | mTopLayout->addLayout( buttonLayout ); |
146 | 150 | ||
147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 151 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 152 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 153 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 154 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 155 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 156 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 157 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
154 | buttonLayout->setMargin( marginHintSmall() ); | 158 | buttonLayout->setMargin( marginHintSmall() ); |
155 | buttonLayout->setSpacing( spacingHintSmall() ); | 159 | buttonLayout->setSpacing( spacingHintSmall() ); |
156 | } | 160 | } |
157 | 161 | ||
158 | QFrame *KDialogBase::addPage( const QString &name ) | 162 | Q3Frame *KDialogBase::addPage( const QString &name ) |
159 | { | 163 | { |
160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 164 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
161 | QFrame *frame = new QFrame( tabWidget() ); | 165 | Q3Frame *frame = new Q3Frame( tabWidget() ); |
162 | tabWidget()->addTab( frame, name ); | 166 | tabWidget()->addTab( frame, name ); |
163 | return frame; | 167 | return frame; |
164 | } | 168 | } |
165 | 169 | ||
166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 170 | Q3Frame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
167 | { | 171 | { |
168 | return addPage( name ); | 172 | return addPage( name ); |
169 | } | 173 | } |
170 | 174 | ||
171 | 175 | ||
172 | void KDialogBase::setMainWidget( QWidget *widget ) | 176 | void KDialogBase::setMainWidget( QWidget *widget ) |
173 | { | 177 | { |
174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 178 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
175 | 179 | ||
176 | mMainWidget = widget; | 180 | mMainWidget = widget; |
177 | initLayout(); | 181 | initLayout(); |
178 | } | 182 | } |
179 | 183 | ||
180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 184 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
181 | { | 185 | { |
182 | QPushButton *button = findButton( id ); | 186 | QPushButton *button = findButton( id ); |
@@ -241,36 +245,36 @@ void KDialogBase::showButton( ButtonCode id, bool show ) | |||
241 | if ( show ) button->show(); | 245 | if ( show ) button->show(); |
242 | else button->hide(); | 246 | else button->hide(); |
243 | } | 247 | } |
244 | } | 248 | } |
245 | 249 | ||
246 | int KDialogBase::pageIndex( QWidget *widget ) const | 250 | int KDialogBase::pageIndex( QWidget *widget ) const |
247 | { | 251 | { |
248 | return 0; | 252 | return 0; |
249 | } | 253 | } |
250 | 254 | ||
251 | 255 | ||
252 | bool KDialogBase::showPage( int index ) | 256 | bool KDialogBase::showPage( int index ) |
253 | { | 257 | { |
254 | tabWidget()->setCurrentPage( index );return false; | 258 | tabWidget()->setCurrentPage( index );return false; |
255 | } | 259 | } |
256 | 260 | ||
257 | QFrame *KDialogBase::plainPage() | 261 | Q3Frame *KDialogBase::plainPage() |
258 | { | 262 | { |
259 | if ( !mPlainPage ) { | 263 | if ( !mPlainPage ) { |
260 | mPlainPage = new QFrame( this ); | 264 | mPlainPage = new Q3Frame( this ); |
261 | setMainWidget( mPlainPage ); | 265 | setMainWidget( mPlainPage ); |
262 | } | 266 | } |
263 | return mPlainPage; | 267 | return mPlainPage; |
264 | } | 268 | } |
265 | 269 | ||
266 | void KDialogBase::slotOk() | 270 | void KDialogBase::slotOk() |
267 | { | 271 | { |
268 | emit okClicked(); | 272 | emit okClicked(); |
269 | accept(); | 273 | accept(); |
270 | } | 274 | } |
271 | 275 | ||
272 | void KDialogBase::slotApply() | 276 | void KDialogBase::slotApply() |
273 | { | 277 | { |
274 | emit applyClicked(); | 278 | emit applyClicked(); |
275 | } | 279 | } |
276 | 280 | ||
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 17c186b..64cbd17 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -1,27 +1,29 @@ | |||
1 | #ifndef MINIKDE_KDIALOGBASE_H | 1 | #ifndef MINIKDE_KDIALOGBASE_H |
2 | #define MINIKDE_KDIALOGBASE_H | 2 | #define MINIKDE_KDIALOGBASE_H |
3 | 3 | ||
4 | #include <qframe.h> | 4 | #include <q3frame.h> |
5 | //Added by qt3to4: | ||
6 | #include <QPixmap> | ||
5 | 7 | ||
6 | #include "kdialog.h" | 8 | #include "kdialog.h" |
7 | 9 | ||
8 | class QPushButton; | 10 | class QPushButton; |
9 | class QLayout; | 11 | class QLayout; |
10 | class QTabWidget; | 12 | class QTabWidget; |
11 | class QBoxLayout; | 13 | class Q3BoxLayout; |
12 | 14 | ||
13 | class KDialogBase : public KDialog | 15 | class KDialogBase : public KDialog |
14 | { | 16 | { |
15 | Q_OBJECT | 17 | Q_OBJECT |
16 | public: | 18 | public: |
17 | enum ButtonCode | 19 | enum ButtonCode |
18 | { | 20 | { |
19 | Help = 0x00000001, | 21 | Help = 0x00000001, |
20 | Default = 0x00000002, | 22 | Default = 0x00000002, |
21 | Ok = 0x00000004, | 23 | Ok = 0x00000004, |
22 | Apply = 0x00000008, | 24 | Apply = 0x00000008, |
23 | Try = 0x00000010, | 25 | Try = 0x00000010, |
24 | Cancel = 0x00000020, | 26 | Cancel = 0x00000020, |
25 | Close = 0x00000040, | 27 | Close = 0x00000040, |
26 | User1 = 0x00000080, | 28 | User1 = 0x00000080, |
27 | User2 = 0x00000100, | 29 | User2 = 0x00000100, |
@@ -46,51 +48,51 @@ class KDialogBase : public KDialog | |||
46 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, | 48 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, |
47 | const QString &caption=QString::null, | 49 | const QString &caption=QString::null, |
48 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, | 50 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, |
49 | bool separator=false, | 51 | bool separator=false, |
50 | const QString &user1=QString::null, | 52 | const QString &user1=QString::null, |
51 | const QString &user2=QString::null, | 53 | const QString &user2=QString::null, |
52 | const QString &user3=QString::null); | 54 | const QString &user3=QString::null); |
53 | KDialogBase( int dialogFace, const QString &caption, | 55 | KDialogBase( int dialogFace, const QString &caption, |
54 | int buttonMask, ButtonCode defaultButton, | 56 | int buttonMask, ButtonCode defaultButton, |
55 | QWidget *parent=0, const char *name=0, bool modal=true, | 57 | QWidget *parent=0, const char *name=0, bool modal=true, |
56 | bool separator=false, | 58 | bool separator=false, |
57 | const QString &user1=QString::null, | 59 | const QString &user1=QString::null, |
58 | const QString &user2=QString::null, | 60 | const QString &user2=QString::null, |
59 | const QString &user3=QString::null); | 61 | const QString &user3=QString::null); |
60 | virtual ~KDialogBase(); | 62 | virtual ~KDialogBase(); |
61 | 63 | ||
62 | QFrame *addPage( const QString & ); | 64 | Q3Frame *addPage( const QString & ); |
63 | QFrame *addPage( const QString &, int, const QPixmap & ); | 65 | Q3Frame *addPage( const QString &, int, const QPixmap & ); |
64 | 66 | ||
65 | void setMainWidget( QWidget *widget ); | 67 | void setMainWidget( QWidget *widget ); |
66 | 68 | ||
67 | void setButtonText( ButtonCode id, const QString &text ); | 69 | void setButtonText( ButtonCode id, const QString &text ); |
68 | 70 | ||
69 | void enableButton( ButtonCode id, bool state ); | 71 | void enableButton( ButtonCode id, bool state ); |
70 | void enableButtonOK( bool state ); | 72 | void enableButtonOK( bool state ); |
71 | void enableButtonApply( bool state ); | 73 | void enableButtonApply( bool state ); |
72 | 74 | ||
73 | void showButton( ButtonCode, bool show ); | 75 | void showButton( ButtonCode, bool show ); |
74 | 76 | ||
75 | int pageIndex( QWidget *widget ) const; | 77 | int pageIndex( QWidget *widget ) const; |
76 | 78 | ||
77 | bool showPage( int index ); | 79 | bool showPage( int index ); |
78 | void hideButtons(); | 80 | void hideButtons(); |
79 | 81 | ||
80 | QFrame *plainPage(); | 82 | Q3Frame *plainPage(); |
81 | 83 | ||
82 | signals: | 84 | signals: |
83 | void user1Clicked(); | 85 | void user1Clicked(); |
84 | void user2Clicked(); | 86 | void user2Clicked(); |
85 | /** | 87 | /** |
86 | * The Apply button was pressed. This signal is only emitted if | 88 | * The Apply button was pressed. This signal is only emitted if |
87 | * @ref slotApply() is not replaced. | 89 | * @ref slotApply() is not replaced. |
88 | */ | 90 | */ |
89 | void applyClicked(); | 91 | void applyClicked(); |
90 | 92 | ||
91 | /** | 93 | /** |
92 | * The OK button was pressed. This signal is only emitted if | 94 | * The OK button was pressed. This signal is only emitted if |
93 | * @ref slotOk() is not replaced. | 95 | * @ref slotOk() is not replaced. |
94 | */ | 96 | */ |
95 | void okClicked(); | 97 | void okClicked(); |
96 | 98 | ||
@@ -115,29 +117,29 @@ class KDialogBase : public KDialog | |||
115 | virtual void slotCancel(); | 117 | virtual void slotCancel(); |
116 | virtual void slotClose(); | 118 | virtual void slotClose(); |
117 | virtual void slotUser1(); | 119 | virtual void slotUser1(); |
118 | virtual void slotUser2(); | 120 | virtual void slotUser2(); |
119 | virtual void accept (); | 121 | virtual void accept (); |
120 | protected: | 122 | protected: |
121 | QPushButton *findButton( ButtonCode ); | 123 | QPushButton *findButton( ButtonCode ); |
122 | QTabWidget *tabWidget(); | 124 | QTabWidget *tabWidget(); |
123 | 125 | ||
124 | private: | 126 | private: |
125 | void init( const QString &caption, int buttonMask, | 127 | void init( const QString &caption, int buttonMask, |
126 | const QString &user1=QString::null, const QString &user2=QString::null ); | 128 | const QString &user1=QString::null, const QString &user2=QString::null ); |
127 | void initLayout(); | 129 | void initLayout(); |
128 | 130 | ||
129 | QWidget *mMainWidget; | 131 | QWidget *mMainWidget; |
130 | QTabWidget *mTabWidget; | 132 | QTabWidget *mTabWidget; |
131 | QFrame *mPlainPage; | 133 | Q3Frame *mPlainPage; |
132 | QBoxLayout *mTopLayout; | 134 | Q3BoxLayout *mTopLayout; |
133 | 135 | ||
134 | QPushButton *mUser1Button; | 136 | QPushButton *mUser1Button; |
135 | QPushButton *mUser2Button; | 137 | QPushButton *mUser2Button; |
136 | QPushButton *mCloseButton; | 138 | QPushButton *mCloseButton; |
137 | QPushButton *mOkButton; | 139 | QPushButton *mOkButton; |
138 | QPushButton *mApplyButton; | 140 | QPushButton *mApplyButton; |
139 | QPushButton *mCancelButton; | 141 | QPushButton *mCancelButton; |
140 | QPushButton *mDefaultButton; | 142 | QPushButton *mDefaultButton; |
141 | }; | 143 | }; |
142 | 144 | ||
143 | #endif | 145 | #endif |
diff --git a/microkde/keditlistbox.cpp b/microkde/keditlistbox.cpp index 55b7784..257a44a 100644 --- a/microkde/keditlistbox.cpp +++ b/microkde/keditlistbox.cpp | |||
@@ -8,121 +8,124 @@ | |||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qstringlist.h> | 21 | #include <qstringlist.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qgroupbox.h> | 24 | #include <q3groupbox.h> |
25 | #include <qlistbox.h> | 25 | #include <q3listbox.h> |
26 | #include <qwhatsthis.h> | 26 | #include <q3whatsthis.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3GridLayout> | ||
30 | #include <Q3StrList> | ||
28 | 31 | ||
29 | #include <kcombobox.h> | 32 | #include <kcombobox.h> |
30 | #include <kdebug.h> | 33 | #include <kdebug.h> |
31 | #include <kdialog.h> | 34 | #include <kdialog.h> |
32 | #include <klineedit.h> | 35 | #include <klineedit.h> |
33 | #include <klocale.h> | 36 | #include <klocale.h> |
34 | #include <kapplication.h> | 37 | #include <kapplication.h> |
35 | #include <knotifyclient.h> | 38 | #include <knotifyclient.h> |
36 | 39 | ||
37 | #include "keditlistbox.h" | 40 | #include "keditlistbox.h" |
38 | 41 | ||
39 | #include <assert.h> | 42 | #include <assert.h> |
40 | 43 | ||
41 | class KEditListBoxPrivate | 44 | class KEditListBoxPrivate |
42 | { | 45 | { |
43 | public: | 46 | public: |
44 | bool m_checkAtEntering; | 47 | bool m_checkAtEntering; |
45 | int buttons; | 48 | int buttons; |
46 | }; | 49 | }; |
47 | 50 | ||
48 | KEditListBox::KEditListBox(QWidget *parent, const char *name, | 51 | KEditListBox::KEditListBox(QWidget *parent, const char *name, |
49 | bool checkAtEntering, int buttons ) | 52 | bool checkAtEntering, int buttons ) |
50 | :QGroupBox(parent, name ) | 53 | :Q3GroupBox(parent, name ) |
51 | { | 54 | { |
52 | init( checkAtEntering, buttons ); | 55 | init( checkAtEntering, buttons ); |
53 | } | 56 | } |
54 | 57 | ||
55 | KEditListBox::KEditListBox(const QString& title, QWidget *parent, | 58 | KEditListBox::KEditListBox(const QString& title, QWidget *parent, |
56 | const char *name, bool checkAtEntering, int buttons) | 59 | const char *name, bool checkAtEntering, int buttons) |
57 | :QGroupBox(title, parent, name ) | 60 | :Q3GroupBox(title, parent, name ) |
58 | { | 61 | { |
59 | init( checkAtEntering, buttons ); | 62 | init( checkAtEntering, buttons ); |
60 | } | 63 | } |
61 | 64 | ||
62 | KEditListBox::KEditListBox(const QString& title, const CustomEditor& custom, | 65 | KEditListBox::KEditListBox(const QString& title, const CustomEditor& custom, |
63 | QWidget *parent, const char *name, | 66 | QWidget *parent, const char *name, |
64 | bool checkAtEntering, int buttons) | 67 | bool checkAtEntering, int buttons) |
65 | :QGroupBox(title, parent, name ) | 68 | :Q3GroupBox(title, parent, name ) |
66 | { | 69 | { |
67 | m_lineEdit = custom.lineEdit(); | 70 | m_lineEdit = custom.lineEdit(); |
68 | init( checkAtEntering, buttons, custom.representationWidget() ); | 71 | init( checkAtEntering, buttons, custom.representationWidget() ); |
69 | } | 72 | } |
70 | 73 | ||
71 | KEditListBox::~KEditListBox() | 74 | KEditListBox::~KEditListBox() |
72 | { | 75 | { |
73 | delete d; | 76 | delete d; |
74 | d=0; | 77 | d=0; |
75 | } | 78 | } |
76 | 79 | ||
77 | void KEditListBox::init( bool checkAtEntering, int buttons, | 80 | void KEditListBox::init( bool checkAtEntering, int buttons, |
78 | QWidget *representationWidget ) | 81 | QWidget *representationWidget ) |
79 | { | 82 | { |
80 | d=new KEditListBoxPrivate; | 83 | d=new KEditListBoxPrivate; |
81 | d->m_checkAtEntering=checkAtEntering; | 84 | d->m_checkAtEntering=checkAtEntering; |
82 | d->buttons = buttons; | 85 | d->buttons = buttons; |
83 | 86 | ||
84 | int lostButtons = 0; | 87 | int lostButtons = 0; |
85 | if ( (buttons & Add) == 0 ) | 88 | if ( (buttons & Add) == 0 ) |
86 | lostButtons++; | 89 | lostButtons++; |
87 | if ( (buttons & Remove) == 0 ) | 90 | if ( (buttons & Remove) == 0 ) |
88 | lostButtons++; | 91 | lostButtons++; |
89 | if ( (buttons & UpDown) == 0 ) | 92 | if ( (buttons & UpDown) == 0 ) |
90 | lostButtons += 2; | 93 | lostButtons += 2; |
91 | 94 | ||
92 | 95 | ||
93 | servNewButton = servRemoveButton = servUpButton = servDownButton = 0L; | 96 | servNewButton = servRemoveButton = servUpButton = servDownButton = 0L; |
94 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, | 97 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, |
95 | QSizePolicy::MinimumExpanding)); | 98 | QSizePolicy::MinimumExpanding)); |
96 | 99 | ||
97 | QWidget * gb = this; | 100 | QWidget * gb = this; |
98 | QGridLayout * grid = new QGridLayout(gb, 7 - lostButtons, 2, | 101 | Q3GridLayout * grid = new Q3GridLayout(gb, 7 - lostButtons, 2, |
99 | KDialog::marginHint(), | 102 | KDialog::marginHint(), |
100 | KDialog::spacingHint()); | 103 | KDialog::spacingHint()); |
101 | grid->addRowSpacing(0, fontMetrics().lineSpacing()); | 104 | grid->addRowSpacing(0, fontMetrics().lineSpacing()); |
102 | for ( int i = 1; i < 7 - lostButtons; i++ ) | 105 | for ( int i = 1; i < 7 - lostButtons; i++ ) |
103 | grid->setRowStretch(i, 1); | 106 | grid->setRowStretch(i, 1); |
104 | 107 | ||
105 | grid->setMargin(15); | 108 | grid->setMargin(15); |
106 | 109 | ||
107 | if ( representationWidget ) | 110 | if ( representationWidget ) |
108 | representationWidget->reparent( gb, QPoint(0,0) ); | 111 | representationWidget->reparent( gb, QPoint(0,0) ); |
109 | else | 112 | else |
110 | m_lineEdit=new KLineEdit(gb); | 113 | m_lineEdit=new KLineEdit(gb); |
111 | 114 | ||
112 | m_listBox = new QListBox(gb); | 115 | m_listBox = new Q3ListBox(gb); |
113 | 116 | ||
114 | QWidget *editingWidget = representationWidget ? | 117 | QWidget *editingWidget = representationWidget ? |
115 | representationWidget : m_lineEdit; | 118 | representationWidget : m_lineEdit; |
116 | grid->addMultiCellWidget(editingWidget,1,1,0,1); | 119 | grid->addMultiCellWidget(editingWidget,1,1,0,1); |
117 | grid->addMultiCellWidget(m_listBox, 2, 6 - lostButtons, 0, 0); | 120 | grid->addMultiCellWidget(m_listBox, 2, 6 - lostButtons, 0, 0); |
118 | int row = 2; | 121 | int row = 2; |
119 | if ( buttons & Add ) { | 122 | if ( buttons & Add ) { |
120 | servNewButton = new QPushButton(i18n("&Add"), gb); | 123 | servNewButton = new QPushButton(i18n("&Add"), gb); |
121 | servNewButton->setEnabled(false); | 124 | servNewButton->setEnabled(false); |
122 | connect(servNewButton, SIGNAL(clicked()), SLOT(addItem())); | 125 | connect(servNewButton, SIGNAL(clicked()), SLOT(addItem())); |
123 | 126 | ||
124 | grid->addWidget(servNewButton, row++, 1); | 127 | grid->addWidget(servNewButton, row++, 1); |
125 | } | 128 | } |
126 | 129 | ||
127 | if ( buttons & Remove ) { | 130 | if ( buttons & Remove ) { |
128 | servRemoveButton = new QPushButton(i18n("&Remove"), gb); | 131 | servRemoveButton = new QPushButton(i18n("&Remove"), gb); |
@@ -191,56 +194,56 @@ void KEditListBox::typedSomething(const QString& text) | |||
191 | 194 | ||
192 | void KEditListBox::moveItemUp() | 195 | void KEditListBox::moveItemUp() |
193 | { | 196 | { |
194 | if (!m_listBox->isEnabled()) | 197 | if (!m_listBox->isEnabled()) |
195 | { | 198 | { |
196 | KNotifyClient::beep(); | 199 | KNotifyClient::beep(); |
197 | return; | 200 | return; |
198 | } | 201 | } |
199 | 202 | ||
200 | unsigned int selIndex = m_listBox->currentItem(); | 203 | unsigned int selIndex = m_listBox->currentItem(); |
201 | if (selIndex == 0) | 204 | if (selIndex == 0) |
202 | { | 205 | { |
203 | KNotifyClient::beep(); | 206 | KNotifyClient::beep(); |
204 | return; | 207 | return; |
205 | } | 208 | } |
206 | 209 | ||
207 | QListBoxItem *selItem = m_listBox->item(selIndex); | 210 | Q3ListBoxItem *selItem = m_listBox->item(selIndex); |
208 | m_listBox->takeItem(selItem); | 211 | m_listBox->takeItem(selItem); |
209 | m_listBox->insertItem(selItem, selIndex-1); | 212 | m_listBox->insertItem(selItem, selIndex-1); |
210 | m_listBox->setCurrentItem(selIndex - 1); | 213 | m_listBox->setCurrentItem(selIndex - 1); |
211 | 214 | ||
212 | emit changed(); | 215 | emit changed(); |
213 | } | 216 | } |
214 | 217 | ||
215 | void KEditListBox::moveItemDown() | 218 | void KEditListBox::moveItemDown() |
216 | { | 219 | { |
217 | if (!m_listBox->isEnabled()) | 220 | if (!m_listBox->isEnabled()) |
218 | { | 221 | { |
219 | KNotifyClient::beep(); | 222 | KNotifyClient::beep(); |
220 | return; | 223 | return; |
221 | } | 224 | } |
222 | 225 | ||
223 | unsigned int selIndex = m_listBox->currentItem(); | 226 | unsigned int selIndex = m_listBox->currentItem(); |
224 | if (selIndex == m_listBox->count() - 1) | 227 | if (selIndex == m_listBox->count() - 1) |
225 | { | 228 | { |
226 | KNotifyClient::beep(); | 229 | KNotifyClient::beep(); |
227 | return; | 230 | return; |
228 | } | 231 | } |
229 | 232 | ||
230 | QListBoxItem *selItem = m_listBox->item(selIndex); | 233 | Q3ListBoxItem *selItem = m_listBox->item(selIndex); |
231 | m_listBox->takeItem(selItem); | 234 | m_listBox->takeItem(selItem); |
232 | m_listBox->insertItem(selItem, selIndex+1); | 235 | m_listBox->insertItem(selItem, selIndex+1); |
233 | m_listBox->setCurrentItem(selIndex + 1); | 236 | m_listBox->setCurrentItem(selIndex + 1); |
234 | 237 | ||
235 | emit changed(); | 238 | emit changed(); |
236 | } | 239 | } |
237 | 240 | ||
238 | void KEditListBox::addItem() | 241 | void KEditListBox::addItem() |
239 | { | 242 | { |
240 | // when m_checkAtEntering is true, the add-button is disabled, but this | 243 | // when m_checkAtEntering is true, the add-button is disabled, but this |
241 | // slot can still be called through Key_Return/Key_Enter. So we guard | 244 | // slot can still be called through Key_Return/Key_Enter. So we guard |
242 | // against this. | 245 | // against this. |
243 | if ( !servNewButton || !servNewButton->isEnabled() ) | 246 | if ( !servNewButton || !servNewButton->isEnabled() ) |
244 | return; | 247 | return; |
245 | 248 | ||
246 | const QString& currentTextLE=m_lineEdit->text(); | 249 | const QString& currentTextLE=m_lineEdit->text(); |
@@ -336,40 +339,42 @@ void KEditListBox::enableMoveButtons(int index) | |||
336 | if ( servRemoveButton ) | 339 | if ( servRemoveButton ) |
337 | servRemoveButton->setEnabled(true); | 340 | servRemoveButton->setEnabled(true); |
338 | } | 341 | } |
339 | 342 | ||
340 | void KEditListBox::clear() | 343 | void KEditListBox::clear() |
341 | { | 344 | { |
342 | m_lineEdit->clear(); | 345 | m_lineEdit->clear(); |
343 | m_listBox->clear(); | 346 | m_listBox->clear(); |
344 | emit changed(); | 347 | emit changed(); |
345 | } | 348 | } |
346 | 349 | ||
347 | void KEditListBox::insertStringList(const QStringList& list, int index) | 350 | void KEditListBox::insertStringList(const QStringList& list, int index) |
348 | { | 351 | { |
349 | m_listBox->insertStringList(list,index); | 352 | m_listBox->insertStringList(list,index); |
350 | } | 353 | } |
351 | 354 | ||
352 | void KEditListBox::insertStrList(const QStrList* list, int index) | 355 | void KEditListBox::insertStrList(const Q3StrList* list, int index) |
353 | { | 356 | { |
354 | m_listBox->insertStrList(list,index); | 357 | for(Q3StrList::const_iterator i=list->begin();i!=list->end();++i) |
358 | m_listBox->insertItem(*i,index++); | ||
355 | } | 359 | } |
356 | 360 | ||
357 | void KEditListBox::insertStrList(const QStrList& list, int index) | 361 | void KEditListBox::insertStrList(const Q3StrList& list, int index) |
358 | { | 362 | { |
359 | m_listBox->insertStrList(list,index); | 363 | for(Q3StrList::const_iterator i=list.begin();i!=list.end();++i) |
364 | m_listBox->insertItem(*i,index++); | ||
360 | } | 365 | } |
361 | 366 | ||
362 | void KEditListBox::insertStrList(const char ** list, int numStrings, int index) | 367 | void KEditListBox::insertStrList(const char ** list, int numStrings, int index) |
363 | { | 368 | { |
364 | m_listBox->insertStrList(list,numStrings,index); | 369 | m_listBox->insertStrList(list,numStrings,index); |
365 | } | 370 | } |
366 | 371 | ||
367 | QStringList KEditListBox::items() const | 372 | QStringList KEditListBox::items() const |
368 | { | 373 | { |
369 | QStringList list; | 374 | QStringList list; |
370 | for ( uint i = 0; i < m_listBox->count(); i++ ) | 375 | for ( uint i = 0; i < m_listBox->count(); i++ ) |
371 | list.append( m_listBox->text( i )); | 376 | list.append( m_listBox->text( i )); |
372 | 377 | ||
373 | return list; | 378 | return list; |
374 | } | 379 | } |
375 | 380 | ||
diff --git a/microkde/keditlistbox.h b/microkde/keditlistbox.h index 130d933..e43d958 100644 --- a/microkde/keditlistbox.h +++ b/microkde/keditlistbox.h | |||
@@ -7,49 +7,51 @@ | |||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef KEDITLISTBOX_H | 20 | #ifndef KEDITLISTBOX_H |
21 | #define KEDITLISTBOX_H | 21 | #define KEDITLISTBOX_H |
22 | 22 | ||
23 | #include <qgroupbox.h> | 23 | #include <q3groupbox.h> |
24 | #include <qlistbox.h> | 24 | #include <q3listbox.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3StrList> | ||
25 | 27 | ||
26 | class KLineEdit; | 28 | class KLineEdit; |
27 | class KComboBox; | 29 | class KComboBox; |
28 | class QPushButton; | 30 | class QPushButton; |
29 | 31 | ||
30 | class KEditListBoxPrivate; | 32 | class KEditListBoxPrivate; |
31 | /** | 33 | /** |
32 | * An editable listbox | 34 | * An editable listbox |
33 | * | 35 | * |
34 | * This class provides a editable listbox ;-), this means | 36 | * This class provides a editable listbox ;-), this means |
35 | * a listbox which is accompanied by a line edit to enter new | 37 | * a listbox which is accompanied by a line edit to enter new |
36 | * items into the listbox and pushbuttons to add and remove | 38 | * items into the listbox and pushbuttons to add and remove |
37 | * items from the listbox and two buttons to move items up and down. | 39 | * items from the listbox and two buttons to move items up and down. |
38 | */ | 40 | */ |
39 | class KEditListBox : public QGroupBox | 41 | class KEditListBox : public Q3GroupBox |
40 | { | 42 | { |
41 | Q_OBJECT | 43 | Q_OBJECT |
42 | 44 | ||
43 | public: | 45 | public: |
44 | /// @since 3.1 | 46 | /// @since 3.1 |
45 | class CustomEditor | 47 | class CustomEditor |
46 | { | 48 | { |
47 | public: | 49 | public: |
48 | CustomEditor() | 50 | CustomEditor() |
49 | : m_representationWidget( 0L ), | 51 | : m_representationWidget( 0L ), |
50 | m_lineEdit( 0L ) {} | 52 | m_lineEdit( 0L ) {} |
51 | CustomEditor( QWidget *repWidget, KLineEdit *edit ) | 53 | CustomEditor( QWidget *repWidget, KLineEdit *edit ) |
52 | : m_representationWidget( repWidget ), | 54 | : m_representationWidget( repWidget ), |
53 | m_lineEdit( edit ) {} | 55 | m_lineEdit( edit ) {} |
54 | CustomEditor( KComboBox *combo ); | 56 | CustomEditor( KComboBox *combo ); |
55 | 57 | ||
@@ -113,70 +115,70 @@ public: | |||
113 | * KLineEdit as child-widget for example, so the KComboBox is used as | 115 | * KLineEdit as child-widget for example, so the KComboBox is used as |
114 | * the representation widget. | 116 | * the representation widget. |
115 | * | 117 | * |
116 | * @see KURLRequester::customEditor() | 118 | * @see KURLRequester::customEditor() |
117 | * @since 3.1 | 119 | * @since 3.1 |
118 | */ | 120 | */ |
119 | KEditListBox( const QString& title, | 121 | KEditListBox( const QString& title, |
120 | const CustomEditor &customEditor, | 122 | const CustomEditor &customEditor, |
121 | QWidget *parent = 0, const char *name = 0, | 123 | QWidget *parent = 0, const char *name = 0, |
122 | bool checkAtEntering = false, int buttons = All ); | 124 | bool checkAtEntering = false, int buttons = All ); |
123 | 125 | ||
124 | virtual ~KEditListBox(); | 126 | virtual ~KEditListBox(); |
125 | 127 | ||
126 | /** | 128 | /** |
127 | * Return a pointer to the embedded QListBox. | 129 | * Return a pointer to the embedded QListBox. |
128 | */ | 130 | */ |
129 | QListBox* listBox() const { return m_listBox; } | 131 | Q3ListBox* listBox() const { return m_listBox; } |
130 | /** | 132 | /** |
131 | * Return a pointer to the embedded QLineEdit. | 133 | * Return a pointer to the embedded QLineEdit. |
132 | */ | 134 | */ |
133 | KLineEdit* lineEdit() const { return m_lineEdit; } | 135 | KLineEdit* lineEdit() const { return m_lineEdit; } |
134 | /** | 136 | /** |
135 | * Return a pointer to the Add button | 137 | * Return a pointer to the Add button |
136 | */ | 138 | */ |
137 | QPushButton* addButton() const { return servNewButton; } | 139 | QPushButton* addButton() const { return servNewButton; } |
138 | /** | 140 | /** |
139 | * Return a pointer to the Remove button | 141 | * Return a pointer to the Remove button |
140 | */ | 142 | */ |
141 | QPushButton* removeButton() const { return servRemoveButton; } | 143 | QPushButton* removeButton() const { return servRemoveButton; } |
142 | /** | 144 | /** |
143 | * Return a pointer to the Up button | 145 | * Return a pointer to the Up button |
144 | */ | 146 | */ |
145 | QPushButton* upButton() const { return servUpButton; } | 147 | QPushButton* upButton() const { return servUpButton; } |
146 | /** | 148 | /** |
147 | * Return a pointer to the Down button | 149 | * Return a pointer to the Down button |
148 | */ | 150 | */ |
149 | QPushButton* downButton() const { return servDownButton; } | 151 | QPushButton* downButton() const { return servDownButton; } |
150 | 152 | ||
151 | /** | 153 | /** |
152 | * See @ref QListBox::count() | 154 | * See @ref QListBox::count() |
153 | */ | 155 | */ |
154 | int count() const { return int(m_listBox->count()); } | 156 | int count() const { return int(m_listBox->count()); } |
155 | /** | 157 | /** |
156 | * See @ref QListBox::insertStringList() | 158 | * See @ref QListBox::insertStringList() |
157 | */ | 159 | */ |
158 | void insertStringList(const QStringList& list, int index=-1); | 160 | void insertStringList(const QStringList& list, int index=-1); |
159 | /** | 161 | /** |
160 | * See @ref QListBox::insertStringList() | 162 | * See @ref QListBox::insertStringList() |
161 | */ | 163 | */ |
162 | void insertStrList(const QStrList* list, int index=-1); | 164 | void insertStrList(const Q3StrList* list, int index=-1); |
163 | /** | 165 | /** |
164 | * See @ref QListBox::insertStrList() | 166 | * See @ref QListBox::insertStrList() |
165 | */ | 167 | */ |
166 | void insertStrList(const QStrList& list, int index=-1); | 168 | void insertStrList(const Q3StrList& list, int index=-1); |
167 | /** | 169 | /** |
168 | * See @ref QListBox::insertStrList() | 170 | * See @ref QListBox::insertStrList() |
169 | */ | 171 | */ |
170 | void insertStrList(const char ** list, int numStrings=-1, int index=-1); | 172 | void insertStrList(const char ** list, int numStrings=-1, int index=-1); |
171 | /** | 173 | /** |
172 | * See @ref QListBox::insertItem() | 174 | * See @ref QListBox::insertItem() |
173 | */ | 175 | */ |
174 | void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);} | 176 | void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);} |
175 | /** | 177 | /** |
176 | * Clears both the listbox and the line edit. | 178 | * Clears both the listbox and the line edit. |
177 | */ | 179 | */ |
178 | void clear(); | 180 | void clear(); |
179 | /** | 181 | /** |
180 | * See @ref QListBox::text() | 182 | * See @ref QListBox::text() |
181 | */ | 183 | */ |
182 | QString text(int index) const { return m_listBox->text(index); } | 184 | QString text(int index) const { return m_listBox->text(index); } |
@@ -194,33 +196,33 @@ public: | |||
194 | */ | 196 | */ |
195 | QStringList items() const; | 197 | QStringList items() const; |
196 | 198 | ||
197 | signals: | 199 | signals: |
198 | void changed(); | 200 | void changed(); |
199 | 201 | ||
200 | protected slots: | 202 | protected slots: |
201 | //the names should be self-explaining | 203 | //the names should be self-explaining |
202 | void moveItemUp(); | 204 | void moveItemUp(); |
203 | void moveItemDown(); | 205 | void moveItemDown(); |
204 | void addItem(); | 206 | void addItem(); |
205 | void removeItem(); | 207 | void removeItem(); |
206 | void enableMoveButtons(int index); | 208 | void enableMoveButtons(int index); |
207 | void typedSomething(const QString& text); | 209 | void typedSomething(const QString& text); |
208 | 210 | ||
209 | private: | 211 | private: |
210 | QListBox *m_listBox; | 212 | Q3ListBox *m_listBox; |
211 | QPushButton *servUpButton, *servDownButton; | 213 | QPushButton *servUpButton, *servDownButton; |
212 | QPushButton *servNewButton, *servRemoveButton; | 214 | QPushButton *servNewButton, *servRemoveButton; |
213 | KLineEdit *m_lineEdit; | 215 | KLineEdit *m_lineEdit; |
214 | 216 | ||
215 | //this is called in both ctors, to avoid code duplication | 217 | //this is called in both ctors, to avoid code duplication |
216 | void init( bool checkAtEntering, int buttons, | 218 | void init( bool checkAtEntering, int buttons, |
217 | QWidget *representationWidget = 0L ); | 219 | QWidget *representationWidget = 0L ); |
218 | 220 | ||
219 | protected: | 221 | protected: |
220 | virtual void virtual_hook( int id, void* data ); | 222 | virtual void virtual_hook( int id, void* data ); |
221 | private: | 223 | private: |
222 | //our lovely private d-pointer | 224 | //our lovely private d-pointer |
223 | KEditListBoxPrivate *d; | 225 | KEditListBoxPrivate *d; |
224 | }; | 226 | }; |
225 | 227 | ||
226 | #endif | 228 | #endif |
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 383e711..c1bfdef 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -1,88 +1,90 @@ | |||
1 | #include <kfiledialog.h> | 1 | #include <kfiledialog.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3VBoxLayout> | ||
7 | 9 | ||
8 | #ifndef DESKTOP_VERSION | 10 | #ifndef DESKTOP_VERSION |
9 | //US orig#include <ofileselector.h> | 11 | //US orig#include <ofileselector.h> |
10 | #include <ofileselector_p.h> | 12 | #include <ofileselector_p.h> |
11 | QString KFileDialog::getSaveFileName( const QString & fn, | 13 | QString KFileDialog::getSaveFileName( const QString & fn, |
12 | const QString & cap , QWidget * par ) | 14 | const QString & cap , QWidget * par ) |
13 | { | 15 | { |
14 | QString retfile = ""; | 16 | QString retfile = ""; |
15 | QDialog dia ( par, "input-dialog", true ); | 17 | QDialog dia ( par, "input-dialog", true ); |
16 | QVBoxLayout lay( &dia ); | 18 | Q3VBoxLayout lay( &dia ); |
17 | lay.setMargin(7); | 19 | lay.setMargin(7); |
18 | lay.setSpacing(7); | 20 | lay.setSpacing(7); |
19 | QString file = fn; | 21 | QString file = fn; |
20 | if ( file.isEmpty() ) | 22 | if ( file.isEmpty() ) |
21 | file = QDir::homeDirPath()+"/*"; | 23 | file = QDir::homeDirPath()+"/*"; |
22 | QFileInfo fi ( file ); | 24 | QFileInfo fi ( file ); |
23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 25 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 26 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
25 | lay.addWidget( &o); | 27 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 28 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 29 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 30 | dia.showMaximized(); |
29 | if ( cap.isEmpty() ) | 31 | if ( cap.isEmpty() ) |
30 | dia.setCaption( file ); | 32 | dia.setCaption( file ); |
31 | else | 33 | else |
32 | dia.setCaption( cap ); | 34 | dia.setCaption( cap ); |
33 | int res = dia.exec(); | 35 | int res = dia.exec(); |
34 | if ( res ) | 36 | if ( res ) |
35 | retfile = o.selectedName(); | 37 | retfile = o.selectedName(); |
36 | return retfile; | 38 | return retfile; |
37 | } | 39 | } |
38 | 40 | ||
39 | QString KFileDialog::getOpenFileName( const QString & fn, | 41 | QString KFileDialog::getOpenFileName( const QString & fn, |
40 | const QString & cap, QWidget * par ) | 42 | const QString & cap, QWidget * par ) |
41 | { | 43 | { |
42 | QString retfile = ""; | 44 | QString retfile = ""; |
43 | QDialog dia ( par, "input-dialog", true ); | 45 | QDialog dia ( par, "input-dialog", true ); |
44 | // QLineEdit lab ( &dia ); | 46 | // QLineEdit lab ( &dia ); |
45 | QVBoxLayout lay( &dia ); | 47 | Q3VBoxLayout lay( &dia ); |
46 | lay.setMargin(7); | 48 | lay.setMargin(7); |
47 | lay.setSpacing(7); | 49 | lay.setSpacing(7); |
48 | QString file = fn; | 50 | QString file = fn; |
49 | if ( file.isEmpty() ) | 51 | if ( file.isEmpty() ) |
50 | file = QDir::homeDirPath()+"/*";; | 52 | file = QDir::homeDirPath()+"/*";; |
51 | QFileInfo fi ( file ); | 53 | QFileInfo fi ( file ); |
52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 54 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 55 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
54 | lay.addWidget( &o); | 56 | lay.addWidget( &o); |
55 | dia.showMaximized(); | 57 | dia.showMaximized(); |
56 | dia.setCaption( cap ); | 58 | dia.setCaption( cap ); |
57 | int res = dia.exec(); | 59 | int res = dia.exec(); |
58 | if ( res ) | 60 | if ( res ) |
59 | retfile = o.selectedName(); | 61 | retfile = o.selectedName(); |
60 | return retfile; | 62 | return retfile; |
61 | } | 63 | } |
62 | QString KFileDialog::getExistingDirectory( const QString & fn, | 64 | QString KFileDialog::getExistingDirectory( const QString & fn, |
63 | const QString & cap, QWidget * par ) | 65 | const QString & cap, QWidget * par ) |
64 | { | 66 | { |
65 | return KFileDialog::getSaveFileName( fn, cap, par ); | 67 | return KFileDialog::getSaveFileName( fn, cap, par ); |
66 | } | 68 | } |
67 | #else | 69 | #else |
68 | 70 | ||
69 | #include <qfiledialog.h> | 71 | #include <q3filedialog.h> |
70 | 72 | ||
71 | QString KFileDialog::getSaveFileName( const QString & fn, | 73 | QString KFileDialog::getSaveFileName( const QString & fn, |
72 | const QString & cap , QWidget * par ) | 74 | const QString & cap , QWidget * par ) |
73 | { | 75 | { |
74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 76 | return Q3FileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
75 | } | 77 | } |
76 | QString KFileDialog::getOpenFileName( const QString & fn, | 78 | QString KFileDialog::getOpenFileName( const QString & fn, |
77 | const QString & cap, QWidget * par ) | 79 | const QString & cap, QWidget * par ) |
78 | { | 80 | { |
79 | 81 | ||
80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 82 | return Q3FileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
81 | } | 83 | } |
82 | QString KFileDialog::getExistingDirectory( const QString & fn, | 84 | QString KFileDialog::getExistingDirectory( const QString & fn, |
83 | const QString & cap, QWidget * par ) | 85 | const QString & cap, QWidget * par ) |
84 | { | 86 | { |
85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); | 87 | return Q3FileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); |
86 | } | 88 | } |
87 | #endif | 89 | #endif |
88 | 90 | ||
diff --git a/microkde/kfontdialog.cpp b/microkde/kfontdialog.cpp index 174123c..f83c2a8 100644 --- a/microkde/kfontdialog.cpp +++ b/microkde/kfontdialog.cpp | |||
@@ -1,31 +1,33 @@ | |||
1 | #include "kfontdialog.h" | 1 | #include "kfontdialog.h" |
2 | #ifndef DESKTOP_VERSION | 2 | #ifndef DESKTOP_VERSION |
3 | #include "ofontselector.h" | 3 | #include "ofontselector.h" |
4 | #else | 4 | #else |
5 | #include <qfontdialog.h> | 5 | #include <qfontdialog.h> |
6 | #endif | 6 | #endif |
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | //Added by qt3to4: | ||
11 | #include <Q3VBoxLayout> | ||
10 | QFont KFontDialog::getFont( const QFont & f, bool & ok ) | 12 | QFont KFontDialog::getFont( const QFont & f, bool & ok ) |
11 | { | 13 | { |
12 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
13 | QDialog d( 0, "fd", true );; | 15 | QDialog d( 0, "fd", true );; |
14 | OFontSelector s ( true, &d, "fontsel"); | 16 | OFontSelector s ( true, &d, "fontsel"); |
15 | QVBoxLayout l ( &d ); | 17 | Q3VBoxLayout l ( &d ); |
16 | l.addWidget( &s ); | 18 | l.addWidget( &s ); |
17 | s.setSelectedFont ( f ); | 19 | s.setSelectedFont ( f ); |
18 | QPushButton b ( "OK", &d ); | 20 | QPushButton b ( "OK", &d ); |
19 | l.addWidget( &b ); | 21 | l.addWidget( &b ); |
20 | qDebug("size %d ", f.bold()); | 22 | qDebug("size %d ", f.bold()); |
21 | QObject::connect( &b, SIGNAL( clicked () ), &d, SLOT ( accept () ) ); | 23 | QObject::connect( &b, SIGNAL( clicked () ), &d, SLOT ( accept () ) ); |
22 | d.show(); | 24 | d.show(); |
23 | ok = false; | 25 | ok = false; |
24 | if ( d.exec () ) { | 26 | if ( d.exec () ) { |
25 | ok = true; | 27 | ok = true; |
26 | return s.selectedFont ( ); | 28 | return s.selectedFont ( ); |
27 | } | 29 | } |
28 | return f; | 30 | return f; |
29 | #else | 31 | #else |
30 | return QFontDialog::getFont ( &ok, f, 0, "fontdialog" ); | 32 | return QFontDialog::getFont ( &ok, f, 0, "fontdialog" ); |
31 | #endif | 33 | #endif |
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp index 53edd08..9cc5835 100644 --- a/microkde/kglobal.cpp +++ b/microkde/kglobal.cpp | |||
@@ -1,32 +1,33 @@ | |||
1 | #include "kglobal.h" | 1 | #include "kglobal.h" |
2 | #include "kstandarddirs.h" | 2 | #include "kstandarddirs.h" |
3 | #include <qkeycode.h> | 3 | #include <qnamespace.h> |
4 | #include <qapplication.h> | 4 | #include <qapplication.h> |
5 | #include <QDesktopWidget> | ||
5 | 6 | ||
6 | KLocale *KGlobal::mLocale = 0; | 7 | KLocale *KGlobal::mLocale = 0; |
7 | KConfig *KGlobal::mConfig = 0; | 8 | KConfig *KGlobal::mConfig = 0; |
8 | KIconLoader *KGlobal::mIconLoader = 0; | 9 | KIconLoader *KGlobal::mIconLoader = 0; |
9 | KStandardDirs *KGlobal::mDirs = 0; | 10 | KStandardDirs *KGlobal::mDirs = 0; |
10 | 11 | ||
11 | QString KGlobal::mAppName = "godot"; | 12 | QString KGlobal::mAppName = "godot"; |
12 | 13 | ||
13 | KLocale *KGlobal::locale() | 14 | KLocale *KGlobal::locale() |
14 | { | 15 | { |
15 | if ( !mLocale ) { | 16 | if ( !mLocale ) { |
16 | ASSERT(mAppName); | 17 | Q_ASSERT(!mAppName.isEmpty()); |
17 | 18 | ||
18 | mLocale = new KLocale();//mAppName); | 19 | mLocale = new KLocale();//mAppName); |
19 | } | 20 | } |
20 | 21 | ||
21 | return mLocale; | 22 | return mLocale; |
22 | } | 23 | } |
23 | 24 | ||
24 | //US | 25 | //US |
25 | void KGlobal::setLocale(KLocale *kg) | 26 | void KGlobal::setLocale(KLocale *kg) |
26 | { | 27 | { |
27 | mLocale = kg; | 28 | mLocale = kg; |
28 | } | 29 | } |
29 | 30 | ||
30 | KConfig *KGlobal::config() | 31 | KConfig *KGlobal::config() |
31 | { | 32 | { |
32 | //mConfig is set inside setAppName. Though it has to be the first function you call. | 33 | //mConfig is set inside setAppName. Though it has to be the first function you call. |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index 2e483e9..1f08255 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -1,22 +1,23 @@ | |||
1 | #include "kglobalsettings.h" | 1 | #include "kglobalsettings.h" |
2 | #include "kconfig.h" | 2 | #include "kconfig.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | #include "kconfigbase.h" | 4 | #include "kconfigbase.h" |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <QDesktopWidget> | ||
7 | 8 | ||
8 | #ifdef DESKTOP_VERSION | 9 | #ifdef DESKTOP_VERSION |
9 | QColor KGlobalSettings::mAlternate = QColor( 235, 235, 235 ); | 10 | QColor KGlobalSettings::mAlternate = QColor( 235, 235, 235 ); |
10 | #else | 11 | #else |
11 | QColor KGlobalSettings::mAlternate = QColor( 210, 210, 210 ); | 12 | QColor KGlobalSettings::mAlternate = QColor( 210, 210, 210 ); |
12 | #endif | 13 | #endif |
13 | 14 | ||
14 | 15 | ||
15 | QFont KGlobalSettings::generalFont() | 16 | QFont KGlobalSettings::generalFont() |
16 | { | 17 | { |
17 | int size = 12; | 18 | int size = 12; |
18 | if (QApplication::desktop()->width() < 480 ) { | 19 | if (QApplication::desktop()->width() < 480 ) { |
19 | size = 10; | 20 | size = 10; |
20 | } | 21 | } |
21 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
22 | else | 23 | else |
diff --git a/microkde/kiconloader.cpp b/microkde/kiconloader.cpp index 4842d71..e7f657d 100644 --- a/microkde/kiconloader.cpp +++ b/microkde/kiconloader.cpp | |||
@@ -1,40 +1,42 @@ | |||
1 | 1 | ||
2 | #include "kiconloader.h" | 2 | #include "kiconloader.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | 4 | ||
5 | #ifndef DESKTOP_VERSION_OEGEL | 5 | #ifndef DESKTOP_VERSION_OEGEL |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | //Added by qt3to4: | ||
8 | #include <QPixmap> | ||
7 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | 9 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, |
8 | int, QString *, bool ) const | 10 | int, QString *, bool ) const |
9 | { | 11 | { |
10 | QPixmap pix; | 12 | QPixmap pix; |
11 | QString file; | 13 | QString file; |
12 | file = iconPath() + name+".png"; | 14 | file = iconPath() + name+".png"; |
13 | pix.load ( file ); | 15 | pix.load ( file ); |
14 | // qDebug("KIconLoader::loadIcon %s -----------", file.latin1()); | 16 | // qDebug("KIconLoader::loadIcon %s -----------", file.latin1()); |
15 | return pix; | 17 | return pix; |
16 | } | 18 | } |
17 | QIconSet KIconLoader::loadIconSet( const QString& name) const | 19 | QIcon KIconLoader::loadIconSet( const QString& name) const |
18 | { | 20 | { |
19 | QPixmap pixmapLoader; | 21 | QPixmap pixmapLoader; |
20 | QString file; | 22 | QString file; |
21 | file = iconPath() + name+".png"; | 23 | file = iconPath() + name+".png"; |
22 | pixmapLoader.load( file ); | 24 | pixmapLoader.load( file ); |
23 | //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() ); | 25 | //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() ); |
24 | QIconSet is ( pixmapLoader ); | 26 | QIcon is ( pixmapLoader ); |
25 | return is; | 27 | return is; |
26 | } | 28 | } |
27 | 29 | ||
28 | QPixmap BarIcon( const QString &name ) | 30 | QPixmap BarIcon( const QString &name ) |
29 | { | 31 | { |
30 | QPixmap pix; | 32 | QPixmap pix; |
31 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | 33 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); |
32 | return pix; | 34 | return pix; |
33 | } | 35 | } |
34 | 36 | ||
35 | QPixmap DesktopIcon( const QString &name, int ) | 37 | QPixmap DesktopIcon( const QString &name, int ) |
36 | { | 38 | { |
37 | QPixmap pix; | 39 | QPixmap pix; |
38 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | 40 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); |
39 | return pix; | 41 | return pix; |
40 | 42 | ||
@@ -64,38 +66,38 @@ QPixmap SmallIconSet( const QString &name ) | |||
64 | 66 | ||
65 | #include <qpe/resource.h> | 67 | #include <qpe/resource.h> |
66 | #include <kglobal.h> | 68 | #include <kglobal.h> |
67 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | 69 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, |
68 | int, QString *, bool ) const | 70 | int, QString *, bool ) const |
69 | { | 71 | { |
70 | QString px = this->iconPath() + "/" + name; | 72 | QString px = this->iconPath() + "/" + name; |
71 | 73 | ||
72 | QPixmap p = Resource::loadPixmap( px ); | 74 | QPixmap p = Resource::loadPixmap( px ); |
73 | QPixmap* pPtr = &p; | 75 | QPixmap* pPtr = &p; |
74 | if (pPtr == 0) | 76 | if (pPtr == 0) |
75 | qDebug("KIconLoader::loadIcon: %s not found", px.latin1()); | 77 | qDebug("KIconLoader::loadIcon: %s not found", px.latin1()); |
76 | 78 | ||
77 | return p; | 79 | return p; |
78 | } | 80 | } |
79 | 81 | ||
80 | QIconSet KIconLoader::loadIconSet( const QString& name) const | 82 | QIcon KIconLoader::loadIconSet( const QString& name) const |
81 | { | 83 | { |
82 | QString px = this->iconPath() + "/" + name; | 84 | QString px = this->iconPath() + "/" + name; |
83 | 85 | ||
84 | QIconSet is ;//= Resource::loadIconSet( px ); | 86 | QIcon is ;//= Resource::loadIconSet( px ); |
85 | QIconSet* isPtr = 0;//LR&is; | 87 | QIcon* isPtr = 0;//LR&is; |
86 | if (isPtr == 0) | 88 | if (isPtr == 0) |
87 | qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1()); | 89 | qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1()); |
88 | 90 | ||
89 | return is; | 91 | return is; |
90 | } | 92 | } |
91 | 93 | ||
92 | QPixmap BarIcon( const QString &name ) | 94 | QPixmap BarIcon( const QString &name ) |
93 | { | 95 | { |
94 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 96 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
95 | return p; | 97 | return p; |
96 | } | 98 | } |
97 | 99 | ||
98 | QPixmap DesktopIcon( const QString &name, int ) | 100 | QPixmap DesktopIcon( const QString &name, int ) |
99 | { | 101 | { |
100 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 102 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
101 | return p; | 103 | return p; |
diff --git a/microkde/kiconloader.h b/microkde/kiconloader.h index 68fec4e..2abb667 100644 --- a/microkde/kiconloader.h +++ b/microkde/kiconloader.h | |||
@@ -1,52 +1,52 @@ | |||
1 | #ifndef MINIKDE_KICONLOADER_H | 1 | #ifndef MINIKDE_KICONLOADER_H |
2 | #define MINIKDE_KICONLOADER_H | 2 | #define MINIKDE_KICONLOADER_H |
3 | 3 | ||
4 | #include <qpixmap.h> | 4 | #include <qpixmap.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | //US | 6 | //US |
7 | #include <qiconset.h> | 7 | #include <qicon.h> |
8 | 8 | ||
9 | class KIcon | 9 | class KIcon |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | enum Group { NoGroup=-1, Desktop=0, Toolbar, MainToolbar, Small, | 12 | enum Group { NoGroup=-1, Desktop=0, Toolbar, MainToolbar, Small, |
13 | Panel, LastGroup, User }; | 13 | Panel, LastGroup, User }; |
14 | enum StdSizes { SizeSmall=16, SizeMedium=32, SizeLarge=48 }; | 14 | enum StdSizes { SizeSmall=16, SizeMedium=32, SizeLarge=48 }; |
15 | enum States { DefaultState, ActiveState, DisabledState, LastState }; | 15 | enum States { DefaultState, ActiveState, DisabledState, LastState }; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | class KIconLoader | 18 | class KIconLoader |
19 | { | 19 | { |
20 | public: | 20 | public: |
21 | KIconLoader() | 21 | KIconLoader() |
22 | : mIconpath(0) {} | 22 | : mIconpath(0) {} |
23 | 23 | ||
24 | KIconLoader( const QString &iconpath ) | 24 | KIconLoader( const QString &iconpath ) |
25 | : mIconpath(iconpath) {} | 25 | : mIconpath(iconpath) {} |
26 | 26 | ||
27 | //US QPixmap loadIcon( const QString &name, int ); | 27 | //US QPixmap loadIcon( const QString &name, int ); |
28 | 28 | ||
29 | QPixmap loadIcon(const QString& name, KIcon::Group group, int size=0, | 29 | QPixmap loadIcon(const QString& name, KIcon::Group group, int size=0, |
30 | int state=KIcon::DefaultState, QString *path_store=0, | 30 | int state=KIcon::DefaultState, QString *path_store=0, |
31 | bool canReturnNull=false) const; | 31 | bool canReturnNull=false) const; |
32 | 32 | ||
33 | //US | 33 | //US |
34 | QString setIconPath( const QString &); | 34 | QString setIconPath( const QString &); |
35 | QString iconPath( /*US const QString &, int */) const; | 35 | QString iconPath( /*US const QString &, int */) const; |
36 | QString iconPath( const QString &, int ) const; | 36 | QString iconPath( const QString &, int ) const; |
37 | QIconSet loadIconSet( const QString &name) const; | 37 | QIcon loadIconSet( const QString &name) const; |
38 | 38 | ||
39 | //US to make this class usable for different applications, we have to add a iconpathvariable | 39 | //US to make this class usable for different applications, we have to add a iconpathvariable |
40 | private: | 40 | private: |
41 | QString mIconpath; | 41 | QString mIconpath; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | QPixmap BarIcon(const QString& name); | 44 | QPixmap BarIcon(const QString& name); |
45 | 45 | ||
46 | QPixmap DesktopIcon(const QString& name, int); | 46 | QPixmap DesktopIcon(const QString& name, int); |
47 | 47 | ||
48 | QPixmap SmallIcon(const QString& name); | 48 | QPixmap SmallIcon(const QString& name); |
49 | 49 | ||
50 | QPixmap SmallIconSet( const QString &name ); | 50 | QPixmap SmallIconSet( const QString &name ); |
51 | 51 | ||
52 | #endif | 52 | #endif |
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp index ca94570..ce62da7 100644 --- a/microkde/kio/kfile/kurlrequester.cpp +++ b/microkde/kio/kfile/kurlrequester.cpp | |||
@@ -14,32 +14,34 @@ | |||
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | 19 | ||
20 | #include <sys/stat.h> | 20 | #include <sys/stat.h> |
21 | #ifdef _WIN32_ | 21 | #ifdef _WIN32_ |
22 | 22 | ||
23 | #else | 23 | #else |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #endif | 25 | #endif |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | //US #include <qtooltip.h> | 27 | //US #include <qtooltip.h> |
28 | 28 | ||
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | //Added by qt3to4: | ||
31 | #include <QPixmap> | ||
30 | 32 | ||
31 | //US #include <kaccel.h> | 33 | //US #include <kaccel.h> |
32 | //US #include <kcombobox.h> | 34 | //US #include <kcombobox.h> |
33 | #include <kdebug.h> | 35 | #include <kdebug.h> |
34 | #include <kdialog.h> | 36 | #include <kdialog.h> |
35 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
36 | #include <kglobal.h> | 38 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
38 | #include <klineedit.h> | 40 | #include <klineedit.h> |
39 | #include <klocale.h> | 41 | #include <klocale.h> |
40 | //US #include <kurlcompletion.h> | 42 | //US #include <kurlcompletion.h> |
41 | //US #include <kurldrag.h> | 43 | //US #include <kurldrag.h> |
42 | //US #include <kprotocolinfo.h> | 44 | //US #include <kprotocolinfo.h> |
43 | 45 | ||
44 | 46 | ||
45 | #include "kurlrequester.h" | 47 | #include "kurlrequester.h" |
@@ -169,68 +171,68 @@ KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent, | |||
169 | const char *name ) | 171 | const char *name ) |
170 | : QHBox( parent, name ) | 172 | : QHBox( parent, name ) |
171 | { | 173 | { |
172 | d = new KURLRequesterPrivate; | 174 | d = new KURLRequesterPrivate; |
173 | 175 | ||
174 | // must have this as parent | 176 | // must have this as parent |
175 | editWidget->reparent( this, 0, QPoint(0,0) ); | 177 | editWidget->reparent( this, 0, QPoint(0,0) ); |
176 | //US d->edit = dynamic_cast<KLineEdit*>( editWidget ); | 178 | //US d->edit = dynamic_cast<KLineEdit*>( editWidget ); |
177 | d->edit = (KLineEdit*)( editWidget ); | 179 | d->edit = (KLineEdit*)( editWidget ); |
178 | //US d->combo = dynamic_cast<KComboBox*>( editWidget ); | 180 | //US d->combo = dynamic_cast<KComboBox*>( editWidget ); |
179 | 181 | ||
180 | init(); | 182 | init(); |
181 | } | 183 | } |
182 | */ | 184 | */ |
183 | 185 | ||
184 | KURLRequester::KURLRequester( QWidget *parent, const char *name ) | 186 | KURLRequester::KURLRequester( QWidget *parent, const char *name ) |
185 | : QHBox( parent, name ) | 187 | : Q3HBox( parent, name ) |
186 | { | 188 | { |
187 | d = new KURLRequesterPrivate; | 189 | d = new KURLRequesterPrivate; |
188 | init(); | 190 | init(); |
189 | } | 191 | } |
190 | 192 | ||
191 | 193 | ||
192 | KURLRequester::KURLRequester( const QString& url, QWidget *parent, | 194 | KURLRequester::KURLRequester( const QString& url, QWidget *parent, |
193 | const char *name ) | 195 | const char *name ) |
194 | : QHBox( parent, name ) | 196 | : Q3HBox( parent, name ) |
195 | { | 197 | { |
196 | d = new KURLRequesterPrivate; | 198 | d = new KURLRequesterPrivate; |
197 | init(); | 199 | init(); |
198 | setURL( url ); | 200 | setURL( url ); |
199 | } | 201 | } |
200 | 202 | ||
201 | 203 | ||
202 | KURLRequester::~KURLRequester() | 204 | KURLRequester::~KURLRequester() |
203 | { | 205 | { |
204 | //US delete myCompletion; | 206 | //US delete myCompletion; |
205 | delete myFileDialog; | 207 | delete myFileDialog; |
206 | delete d; | 208 | delete d; |
207 | } | 209 | } |
208 | 210 | ||
209 | 211 | ||
210 | void KURLRequester::init() | 212 | void KURLRequester::init() |
211 | { | 213 | { |
212 | myFileDialog = 0L; | 214 | myFileDialog = 0L; |
213 | myShowLocalProt = false; | 215 | myShowLocalProt = false; |
214 | mPathIsDir = false; | 216 | mPathIsDir = false; |
215 | if (/*US !d->combo && */ !d->edit ) | 217 | if (/*US !d->combo && */ !d->edit ) |
216 | d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); | 218 | d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); |
217 | 219 | ||
218 | myButton = new KURLDragPushButton( this, "kfile button"); | 220 | myButton = new KURLDragPushButton( this, "kfile button"); |
219 | QIconSet iconSet = SmallIconSet("fileopen"); | 221 | QIcon iconSet = SmallIconSet("fileopen"); |
220 | QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); | 222 | QPixmap pixMap = iconSet.pixmap( QIcon::Small, QIcon::Normal ); |
221 | myButton->setIconSet( iconSet ); | 223 | myButton->setIconSet( iconSet ); |
222 | myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); | 224 | myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); |
223 | //US QToolTip::add(myButton, i18n("Open file dialog")); | 225 | //US QToolTip::add(myButton, i18n("Open file dialog")); |
224 | 226 | ||
225 | connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); | 227 | connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); |
226 | 228 | ||
227 | setSpacing( KDialog::spacingHint() ); | 229 | setSpacing( KDialog::spacingHint() ); |
228 | 230 | ||
229 | QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; | 231 | QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; |
230 | setFocusProxy( widget ); | 232 | setFocusProxy( widget ); |
231 | 233 | ||
232 | d->connectSignals( this ); | 234 | d->connectSignals( this ); |
233 | connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() )); | 235 | connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() )); |
234 | /*US | 236 | /*US |
235 | myCompletion = new KURLCompletion(); | 237 | myCompletion = new KURLCompletion(); |
236 | d->setCompletionObject( myCompletion ); | 238 | d->setCompletionObject( myCompletion ); |
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h index faa3326..5d4fa11 100644 --- a/microkde/kio/kfile/kurlrequester.h +++ b/microkde/kio/kfile/kurlrequester.h | |||
@@ -7,66 +7,66 @@ | |||
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | 19 | ||
20 | #ifndef KURLREQUESTER_H | 20 | #ifndef KURLREQUESTER_H |
21 | #define KURLREQUESTER_H | 21 | #define KURLREQUESTER_H |
22 | 22 | ||
23 | #include <qhbox.h> | 23 | #include <q3hbox.h> |
24 | 24 | ||
25 | #include <keditlistbox.h> | 25 | #include <keditlistbox.h> |
26 | //US #include <kfile.h> | 26 | //US #include <kfile.h> |
27 | //US #include <kpushbutton.h> | 27 | //US #include <kpushbutton.h> |
28 | #include <kurl.h> | 28 | #include <kurl.h> |
29 | 29 | ||
30 | //US class KComboBox; | 30 | //US class KComboBox; |
31 | 31 | ||
32 | class KFileDialog; | 32 | class KFileDialog; |
33 | class KLineEdit; | 33 | class KLineEdit; |
34 | //US class KURLCompletion; | 34 | //US class KURLCompletion; |
35 | class KURLDragPushButton; | 35 | class KURLDragPushButton; |
36 | 36 | ||
37 | class QPushButton; | 37 | class QPushButton; |
38 | class QString; | 38 | class QString; |
39 | class QTimer; | 39 | class QTimer; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * This class is a widget showing a lineedit and a button, which invokes a | 42 | * This class is a widget showing a lineedit and a button, which invokes a |
43 | * filedialog. File name completion is available in the lineedit. | 43 | * filedialog. File name completion is available in the lineedit. |
44 | * | 44 | * |
45 | * The defaults for the filedialog are to ask for one existing local file, i.e. | 45 | * The defaults for the filedialog are to ask for one existing local file, i.e. |
46 | * KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ) | 46 | * KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ) |
47 | * The default filter is "*", i.e. show all files, and the start directory is | 47 | * The default filter is "*", i.e. show all files, and the start directory is |
48 | * the current working directory, or the last directory where a file has been | 48 | * the current working directory, or the last directory where a file has been |
49 | * selected. | 49 | * selected. |
50 | * | 50 | * |
51 | * You can change this behavior by using @ref setMode() or @ref setFilter(). | 51 | * You can change this behavior by using @ref setMode() or @ref setFilter(). |
52 | * | 52 | * |
53 | * @short A widget to request a filename/url from the user | 53 | * @short A widget to request a filename/url from the user |
54 | * @author Carsten Pfeiffer <pfeiffer@kde.org> | 54 | * @author Carsten Pfeiffer <pfeiffer@kde.org> |
55 | */ | 55 | */ |
56 | class KURLRequester : public QHBox | 56 | class KURLRequester : public Q3HBox |
57 | { | 57 | { |
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | Q_PROPERTY( QString url READ url WRITE setURL ) | 59 | Q_PROPERTY( QString url READ url WRITE setURL ) |
60 | 60 | ||
61 | public: | 61 | public: |
62 | /** | 62 | /** |
63 | * Constructs a KURLRequester widget. | 63 | * Constructs a KURLRequester widget. |
64 | */ | 64 | */ |
65 | KURLRequester( QWidget *parent=0, const char *name=0 ); | 65 | KURLRequester( QWidget *parent=0, const char *name=0 ); |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Constructs a KURLRequester widget with the initial URL @p url. | 68 | * Constructs a KURLRequester widget with the initial URL @p url. |
69 | */ | 69 | */ |
70 | KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 ); | 70 | KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 ); |
71 | 71 | ||
72 | /** | 72 | /** |
diff --git a/microkde/kio/kio/kdirwatch.cpp b/microkde/kio/kio/kdirwatch.cpp index 1596d1f..5f07c54 100644 --- a/microkde/kio/kio/kdirwatch.cpp +++ b/microkde/kio/kio/kdirwatch.cpp | |||
@@ -39,37 +39,39 @@ $Id$ | |||
39 | 39 | ||
40 | 40 | ||
41 | //US #include <config.h> | 41 | //US #include <config.h> |
42 | 42 | ||
43 | #ifdef HAVE_DNOTIFY | 43 | #ifdef HAVE_DNOTIFY |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <time.h> | 45 | #include <time.h> |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <signal.h> | 47 | #include <signal.h> |
48 | #include <errno.h> | 48 | #include <errno.h> |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #include <sys/stat.h> | 51 | #include <sys/stat.h> |
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | #include <qdir.h> | 53 | #include <qdir.h> |
54 | #include <qfile.h> | 54 | #include <qfile.h> |
55 | #include <qintdict.h> | 55 | #include <q3intdict.h> |
56 | #include <qptrlist.h> | 56 | #include <q3ptrlist.h> |
57 | #include <qsocketnotifier.h> | 57 | #include <qsocketnotifier.h> |
58 | #include <qstringlist.h> | 58 | #include <qstringlist.h> |
59 | #include <qtimer.h> | 59 | #include <qtimer.h> |
60 | //Added by qt3to4: | ||
61 | #include <Q3CString> | ||
60 | 62 | ||
61 | #include <kapplication.h> | 63 | #include <kapplication.h> |
62 | #include <kdebug.h> | 64 | #include <kdebug.h> |
63 | #include <kconfig.h> | 65 | #include <kconfig.h> |
64 | #include <kconfigbase.h> | 66 | #include <kconfigbase.h> |
65 | #include <kglobal.h> | 67 | #include <kglobal.h> |
66 | #include <kstaticdeleter.h> | 68 | #include <kstaticdeleter.h> |
67 | 69 | ||
68 | #include "kdirwatch.h" | 70 | #include "kdirwatch.h" |
69 | #include "kdirwatch_p.h" | 71 | #include "kdirwatch_p.h" |
70 | //US #include "global.h" // KIO::probably_slow_mounted | 72 | //US #include "global.h" // KIO::probably_slow_mounted |
71 | 73 | ||
72 | #define NO_NOTIFY (time_t) 0 | 74 | #define NO_NOTIFY (time_t) 0 |
73 | 75 | ||
74 | static KDirWatchPrivate* dwp_self = 0; | 76 | static KDirWatchPrivate* dwp_self = 0; |
75 | 77 | ||
@@ -171,33 +173,33 @@ void KDirWatchPrivate::dnotify_sigio_handler(int sig, siginfo_t *si, void *p) | |||
171 | * is changed. | 173 | * is changed. |
172 | */ | 174 | */ |
173 | 175 | ||
174 | KDirWatchPrivate::KDirWatchPrivate() | 176 | KDirWatchPrivate::KDirWatchPrivate() |
175 | { | 177 | { |
176 | timer = new QTimer(this); | 178 | timer = new QTimer(this); |
177 | connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan())); | 179 | connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan())); |
178 | freq = 3600000; // 1 hour as upper bound | 180 | freq = 3600000; // 1 hour as upper bound |
179 | statEntries = 0; | 181 | statEntries = 0; |
180 | delayRemove = false; | 182 | delayRemove = false; |
181 | m_ref = 0; | 183 | m_ref = 0; |
182 | 184 | ||
183 | //US KConfigGroup config(KGlobal::config(), QCString("DirWatch")); | 185 | //US KConfigGroup config(KGlobal::config(), QCString("DirWatch")); |
184 | //US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000); | 186 | //US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000); |
185 | //US m_PollInterval = config.readNumEntry("PollInterval", 500); | 187 | //US m_PollInterval = config.readNumEntry("PollInterval", 500); |
186 | KConfig *config = KGlobal::config(); | 188 | KConfig *config = KGlobal::config(); |
187 | KConfigGroupSaver saver( config, QCString("DirWatch") ); | 189 | KConfigGroupSaver saver( config, Q3CString("DirWatch") ); |
188 | 190 | ||
189 | m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000); | 191 | m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000); |
190 | m_PollInterval = config->readNumEntry("PollInterval", 500); | 192 | m_PollInterval = config->readNumEntry("PollInterval", 500); |
191 | 193 | ||
192 | 194 | ||
193 | QString available("Stat"); | 195 | QString available("Stat"); |
194 | 196 | ||
195 | #ifdef HAVE_FAM | 197 | #ifdef HAVE_FAM |
196 | // It's possible that FAM server can't be started | 198 | // It's possible that FAM server can't be started |
197 | if (FAMOpen(&fc) ==0) { | 199 | if (FAMOpen(&fc) ==0) { |
198 | available += ", FAM"; | 200 | available += ", FAM"; |
199 | use_fam=true; | 201 | use_fam=true; |
200 | sn = new QSocketNotifier( FAMCONNECTION_GETFD(&fc), | 202 | sn = new QSocketNotifier( FAMCONNECTION_GETFD(&fc), |
201 | QSocketNotifier::Read, this); | 203 | QSocketNotifier::Read, this); |
202 | connect( sn, SIGNAL(activated(int)), | 204 | connect( sn, SIGNAL(activated(int)), |
203 | this, SLOT(famEventReceived()) ); | 205 | this, SLOT(famEventReceived()) ); |
@@ -718,33 +720,33 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance, | |||
718 | } | 720 | } |
719 | } | 721 | } |
720 | 722 | ||
721 | kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path | 723 | kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path |
722 | << (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString("")) | 724 | << (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString("")) |
723 | << (instance ? QString(" [%1]").arg(instance->name()) : QString("")) | 725 | << (instance ? QString(" [%1]").arg(instance->name()) : QString("")) |
724 | << endl; | 726 | << endl; |
725 | m_mapEntries.remove( e->path ); // <e> not valid any more | 727 | m_mapEntries.remove( e->path ); // <e> not valid any more |
726 | } | 728 | } |
727 | 729 | ||
728 | 730 | ||
729 | /* Called from KDirWatch destructor: | 731 | /* Called from KDirWatch destructor: |
730 | * remove <instance> as client from all entries | 732 | * remove <instance> as client from all entries |
731 | */ | 733 | */ |
732 | void KDirWatchPrivate::removeEntries( KDirWatch* instance ) | 734 | void KDirWatchPrivate::removeEntries( KDirWatch* instance ) |
733 | { | 735 | { |
734 | QPtrList<Entry> list; | 736 | Q3PtrList<Entry> list; |
735 | int minfreq = 3600000; | 737 | int minfreq = 3600000; |
736 | 738 | ||
737 | // put all entries where instance is a client in list | 739 | // put all entries where instance is a client in list |
738 | EntryMap::Iterator it = m_mapEntries.begin(); | 740 | EntryMap::Iterator it = m_mapEntries.begin(); |
739 | for( ; it != m_mapEntries.end(); ++it ) { | 741 | for( ; it != m_mapEntries.end(); ++it ) { |
740 | Client* c = (*it).m_clients.first(); | 742 | Client* c = (*it).m_clients.first(); |
741 | for(;c;c=(*it).m_clients.next()) | 743 | for(;c;c=(*it).m_clients.next()) |
742 | if (c->instance == instance) break; | 744 | if (c->instance == instance) break; |
743 | if (c) { | 745 | if (c) { |
744 | c->count = 1; // forces deletion of instance as client | 746 | c->count = 1; // forces deletion of instance as client |
745 | list.append(&(*it)); | 747 | list.append(&(*it)); |
746 | } | 748 | } |
747 | else if ( (*it).m_mode == StatMode && (*it).freq < minfreq ) | 749 | else if ( (*it).m_mode == StatMode && (*it).freq < minfreq ) |
748 | minfreq = (*it).freq; | 750 | minfreq = (*it).freq; |
749 | } | 751 | } |
750 | 752 | ||
@@ -994,33 +996,33 @@ void KDirWatchPrivate::slotRemoveDelayed() | |||
994 | void KDirWatchPrivate::slotRescan() | 996 | void KDirWatchPrivate::slotRescan() |
995 | { | 997 | { |
996 | EntryMap::Iterator it; | 998 | EntryMap::Iterator it; |
997 | 999 | ||
998 | // People can do very long things in the slot connected to dirty(), | 1000 | // People can do very long things in the slot connected to dirty(), |
999 | // like showing a message box. We don't want to keep polling during | 1001 | // like showing a message box. We don't want to keep polling during |
1000 | // that time, otherwise the value of 'delayRemove' will be reset. | 1002 | // that time, otherwise the value of 'delayRemove' will be reset. |
1001 | bool timerRunning = timer->isActive(); | 1003 | bool timerRunning = timer->isActive(); |
1002 | if ( timerRunning ) | 1004 | if ( timerRunning ) |
1003 | timer->stop(); | 1005 | timer->stop(); |
1004 | 1006 | ||
1005 | // We delay deletions of entries this way. | 1007 | // We delay deletions of entries this way. |
1006 | // removeDir(), when called in slotDirty(), can cause a crash otherwise | 1008 | // removeDir(), when called in slotDirty(), can cause a crash otherwise |
1007 | delayRemove = true; | 1009 | delayRemove = true; |
1008 | 1010 | ||
1009 | #ifdef HAVE_DNOTIFY | 1011 | #ifdef HAVE_DNOTIFY |
1010 | QPtrList<Entry> dList, cList; | 1012 | Q3PtrList<Entry> dList, cList; |
1011 | 1013 | ||
1012 | // for DNotify method, | 1014 | // for DNotify method, |
1013 | if (rescan_all) | 1015 | if (rescan_all) |
1014 | { | 1016 | { |
1015 | // mark all as dirty | 1017 | // mark all as dirty |
1016 | it = m_mapEntries.begin(); | 1018 | it = m_mapEntries.begin(); |
1017 | for( ; it != m_mapEntries.end(); ++it ) | 1019 | for( ; it != m_mapEntries.end(); ++it ) |
1018 | (*it).dn_dirty = true; | 1020 | (*it).dn_dirty = true; |
1019 | rescan_all = false; | 1021 | rescan_all = false; |
1020 | } | 1022 | } |
1021 | else | 1023 | else |
1022 | { | 1024 | { |
1023 | // progate dirty flag to dependant entries (e.g. file watches) | 1025 | // progate dirty flag to dependant entries (e.g. file watches) |
1024 | it = m_mapEntries.begin(); | 1026 | it = m_mapEntries.begin(); |
1025 | for( ; it != m_mapEntries.end(); ++it ) | 1027 | for( ; it != m_mapEntries.end(); ++it ) |
1026 | if ( ((*it).m_mode == DNotifyMode) && (*it).dn_dirty ) | 1028 | if ( ((*it).m_mode == DNotifyMode) && (*it).dn_dirty ) |
diff --git a/microkde/kio/kio/kdirwatch_p.h b/microkde/kio/kio/kdirwatch_p.h index 0ab482f..be74f2a 100644 --- a/microkde/kio/kio/kdirwatch_p.h +++ b/microkde/kio/kio/kdirwatch_p.h | |||
@@ -5,33 +5,33 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | Enhanced Version of the file for platform independent KDE tools. | 8 | Enhanced Version of the file for platform independent KDE tools. |
9 | Copyright (c) 2004 Ulf Schenk | 9 | Copyright (c) 2004 Ulf Schenk |
10 | 10 | ||
11 | $Id$ | 11 | $Id$ |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifndef _KDIRWATCH_P_H | 14 | #ifndef _KDIRWATCH_P_H |
15 | #define _KDIRWATCH_P_H | 15 | #define _KDIRWATCH_P_H |
16 | 16 | ||
17 | #ifdef HAVE_FAM | 17 | #ifdef HAVE_FAM |
18 | #include <fam.h> | 18 | #include <fam.h> |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #include <qptrlist.h> | 21 | #include <q3ptrlist.h> |
22 | 22 | ||
23 | #include <kdirwatch.h> | 23 | #include <kdirwatch.h> |
24 | 24 | ||
25 | #include <ctime> | 25 | #include <ctime> |
26 | 26 | ||
27 | #define invalid_ctime ((time_t)-1) | 27 | #define invalid_ctime ((time_t)-1) |
28 | 28 | ||
29 | /* KDirWatchPrivate is a singleton and does the watching | 29 | /* KDirWatchPrivate is a singleton and does the watching |
30 | * for every KDirWatch instance in the application. | 30 | * for every KDirWatch instance in the application. |
31 | */ | 31 | */ |
32 | class KDirWatchPrivate : public QObject | 32 | class KDirWatchPrivate : public QObject |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | 36 | ||
37 | enum entryStatus { Normal = 0, NonExistent }; | 37 | enum entryStatus { Normal = 0, NonExistent }; |
@@ -45,35 +45,35 @@ public: | |||
45 | bool watchingStopped; | 45 | bool watchingStopped; |
46 | // events blocked when stopped | 46 | // events blocked when stopped |
47 | int pending; | 47 | int pending; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | class Entry | 50 | class Entry |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | // the last observed modification time | 53 | // the last observed modification time |
54 | time_t m_ctime; | 54 | time_t m_ctime; |
55 | // the last observed link count | 55 | // the last observed link count |
56 | int m_nlink; | 56 | int m_nlink; |
57 | entryStatus m_status; | 57 | entryStatus m_status; |
58 | entryMode m_mode; | 58 | entryMode m_mode; |
59 | bool isDir; | 59 | bool isDir; |
60 | // instances interested in events | 60 | // instances interested in events |
61 | QPtrList<Client> m_clients; | 61 | Q3PtrList<Client> m_clients; |
62 | // nonexistent entries of this directory | 62 | // nonexistent entries of this directory |
63 | QPtrList<Entry> m_entries; | 63 | Q3PtrList<Entry> m_entries; |
64 | QString path; | 64 | QString path; |
65 | 65 | ||
66 | int msecLeft, freq; | 66 | int msecLeft, freq; |
67 | 67 | ||
68 | void addClient(KDirWatch*); | 68 | void addClient(KDirWatch*); |
69 | void removeClient(KDirWatch*); | 69 | void removeClient(KDirWatch*); |
70 | int clients(); | 70 | int clients(); |
71 | bool isValid() { return m_clients.count() || m_entries.count(); } | 71 | bool isValid() { return m_clients.count() || m_entries.count(); } |
72 | 72 | ||
73 | #ifdef HAVE_FAM | 73 | #ifdef HAVE_FAM |
74 | FAMRequest fr; | 74 | FAMRequest fr; |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifdef HAVE_DNOTIFY | 77 | #ifdef HAVE_DNOTIFY |
78 | int dn_fd; | 78 | int dn_fd; |
79 | bool dn_dirty; | 79 | bool dn_dirty; |
@@ -111,43 +111,43 @@ public slots: | |||
111 | void famEventReceived(); // for FAM | 111 | void famEventReceived(); // for FAM |
112 | void slotActivated(); // for DNOTIFY | 112 | void slotActivated(); // for DNOTIFY |
113 | void slotRemoveDelayed(); | 113 | void slotRemoveDelayed(); |
114 | 114 | ||
115 | public: | 115 | public: |
116 | QTimer *timer; | 116 | QTimer *timer; |
117 | EntryMap m_mapEntries; | 117 | EntryMap m_mapEntries; |
118 | 118 | ||
119 | private: | 119 | private: |
120 | int freq; | 120 | int freq; |
121 | int statEntries; | 121 | int statEntries; |
122 | int m_nfsPollInterval, m_PollInterval; | 122 | int m_nfsPollInterval, m_PollInterval; |
123 | int m_ref; | 123 | int m_ref; |
124 | bool useStat(Entry*); | 124 | bool useStat(Entry*); |
125 | 125 | ||
126 | bool delayRemove; | 126 | bool delayRemove; |
127 | QPtrList<Entry> removeList; | 127 | Q3PtrList<Entry> removeList; |
128 | 128 | ||
129 | #ifdef HAVE_FAM | 129 | #ifdef HAVE_FAM |
130 | QSocketNotifier *sn; | 130 | QSocketNotifier *sn; |
131 | FAMConnection fc; | 131 | FAMConnection fc; |
132 | bool use_fam; | 132 | bool use_fam; |
133 | 133 | ||
134 | void checkFAMEvent(FAMEvent*); | 134 | void checkFAMEvent(FAMEvent*); |
135 | bool useFAM(Entry*); | 135 | bool useFAM(Entry*); |
136 | #endif | 136 | #endif |
137 | 137 | ||
138 | #ifdef HAVE_DNOTIFY | 138 | #ifdef HAVE_DNOTIFY |
139 | bool supports_dnotify; | 139 | bool supports_dnotify; |
140 | bool rescan_all; | 140 | bool rescan_all; |
141 | int mPipe[2]; | 141 | int mPipe[2]; |
142 | QTimer mTimer; | 142 | QTimer mTimer; |
143 | QSocketNotifier *mSn; | 143 | QSocketNotifier *mSn; |
144 | QIntDict<Entry> fd_Entry; | 144 | Q3IntDict<Entry> fd_Entry; |
145 | 145 | ||
146 | static void dnotify_handler(int, siginfo_t *si, void *); | 146 | static void dnotify_handler(int, siginfo_t *si, void *); |
147 | static void dnotify_sigio_handler(int, siginfo_t *si, void *); | 147 | static void dnotify_sigio_handler(int, siginfo_t *si, void *); |
148 | bool useDNotify(Entry*); | 148 | bool useDNotify(Entry*); |
149 | #endif | 149 | #endif |
150 | }; | 150 | }; |
151 | 151 | ||
152 | #endif // KDIRWATCH_P_H | 152 | #endif // KDIRWATCH_P_H |
153 | 153 | ||
diff --git a/microkde/klineedit.h b/microkde/klineedit.h index 70c72d1..9eb749d 100644 --- a/microkde/klineedit.h +++ b/microkde/klineedit.h | |||
@@ -1,20 +1,22 @@ | |||
1 | #ifndef MINIKDE_KLINEEDIT_H | 1 | #ifndef MINIKDE_KLINEEDIT_H |
2 | #define MINIKDE_KLINEEDIT_H | 2 | #define MINIKDE_KLINEEDIT_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | //Added by qt3to4: | ||
6 | #include <QKeyEvent> | ||
5 | 7 | ||
6 | #ifndef DESKTOP_VERSION | 8 | #ifndef DESKTOP_VERSION |
7 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
8 | #endif | 10 | #endif |
9 | 11 | ||
10 | 12 | ||
11 | class KLineEdit : public QLineEdit | 13 | class KLineEdit : public QLineEdit |
12 | { | 14 | { |
13 | 15 | ||
14 | Q_OBJECT | 16 | Q_OBJECT |
15 | 17 | ||
16 | public: | 18 | public: |
17 | KLineEdit( QWidget *parent=0, const char *name=0 ) : | 19 | KLineEdit( QWidget *parent=0, const char *name=0 ) : |
18 | QLineEdit( parent, name ) | 20 | QLineEdit( parent, name ) |
19 | { | 21 | { |
20 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
diff --git a/microkde/klineeditdlg.h b/microkde/klineeditdlg.h index 68e9252..d0004cd 100644 --- a/microkde/klineeditdlg.h +++ b/microkde/klineeditdlg.h | |||
@@ -1,34 +1,36 @@ | |||
1 | #ifndef MICROKDE_KLINEEDITDLG_H | 1 | #ifndef MICROKDE_KLINEEDITDLG_H |
2 | #define MICROKDE_KLINEEDITDLG_H | 2 | #define MICROKDE_KLINEEDITDLG_H |
3 | 3 | ||
4 | #include "kdialogbase.h" | 4 | #include "kdialogbase.h" |
5 | #include <klineedit.h> | 5 | #include <klineedit.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qdialog.h> | 8 | #include <qdialog.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | //Added by qt3to4: | ||
11 | #include <Q3VBoxLayout> | ||
10 | 12 | ||
11 | class KLineEditDlg : public QDialog | 13 | class KLineEditDlg : public QDialog |
12 | { | 14 | { |
13 | public: | 15 | public: |
14 | KLineEditDlg( const QString & text, const QString & editText, QWidget *parent ) : | 16 | KLineEditDlg( const QString & text, const QString & editText, QWidget *parent ) : |
15 | QDialog( parent,"lineedit", true ) { | 17 | QDialog( parent,"lineedit", true ) { |
16 | QLabel* lab = new QLabel( text, this ); | 18 | QLabel* lab = new QLabel( text, this ); |
17 | mEdit = new KLineEdit( this ); | 19 | mEdit = new KLineEdit( this ); |
18 | QVBoxLayout* vl = new QVBoxLayout( this ); | 20 | Q3VBoxLayout* vl = new Q3VBoxLayout( this ); |
19 | vl->setSpacing(5); | 21 | vl->setSpacing(5); |
20 | vl->setMargin(7); | 22 | vl->setMargin(7); |
21 | vl->addWidget( lab ); | 23 | vl->addWidget( lab ); |
22 | vl->addWidget( mEdit ); | 24 | vl->addWidget( mEdit ); |
23 | mEdit->setText( editText ); | 25 | mEdit->setText( editText ); |
24 | QPushButton * p = new QPushButton (" OK ", this ); | 26 | QPushButton * p = new QPushButton (" OK ", this ); |
25 | vl->addWidget( p ); | 27 | vl->addWidget( p ); |
26 | connect( p, SIGNAL ( clicked () ), this , SLOT (accept() ) ); | 28 | connect( p, SIGNAL ( clicked () ), this , SLOT (accept() ) ); |
27 | } | 29 | } |
28 | 30 | ||
29 | QString text() { return mEdit->text(); } | 31 | QString text() { return mEdit->text(); } |
30 | private: | 32 | private: |
31 | KLineEdit* mEdit; | 33 | KLineEdit* mEdit; |
32 | }; | 34 | }; |
33 | 35 | ||
34 | #endif | 36 | #endif |
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index 55253c0..4820faf 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -12,90 +12,93 @@ | |||
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | #include <kmessagebox.h> | 26 | #include <kmessagebox.h> |
27 | 27 | ||
28 | #include <qgroupbox.h> | 28 | #include <q3groupbox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvbox.h> | 32 | #include <q3vbox.h> |
33 | 33 | ||
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qscrollview.h> | 35 | #include <q3scrollview.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3VBoxLayout> | ||
38 | #include <Q3Frame> | ||
36 | 39 | ||
37 | #include <kbuttonbox.h> | 40 | #include <kbuttonbox.h> |
38 | #include <kdialog.h> | 41 | #include <kdialog.h> |
39 | #include <klineedit.h> | 42 | #include <klineedit.h> |
40 | 43 | ||
41 | #include "factory.h" | 44 | #include "factory.h" |
42 | #include "configwidget.h" | 45 | #include "configwidget.h" |
43 | #include "configdialog.h" | 46 | #include "configdialog.h" |
44 | 47 | ||
45 | using namespace KRES; | 48 | using namespace KRES; |
46 | 49 | ||
47 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | 50 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, |
48 | Resource* resource, const char *name ) | 51 | Resource* resource, const char *name ) |
49 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), | 52 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), |
50 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) | 53 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) |
51 | { | 54 | { |
52 | 55 | ||
53 | Factory *factory = Factory::self( resourceFamily ); | 56 | Factory *factory = Factory::self( resourceFamily ); |
54 | 57 | ||
55 | //US resize( 250, 240 ); | 58 | //US resize( 250, 240 ); |
56 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); | 59 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); |
57 | 60 | ||
58 | QFrame *main; | 61 | Q3Frame *main; |
59 | 62 | ||
60 | main = plainPage(); | 63 | main = plainPage(); |
61 | 64 | ||
62 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); | 65 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main, 0, spacingHint() ); |
63 | 66 | ||
64 | 67 | ||
65 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 68 | Q3GroupBox *generalGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
66 | generalGroupBox->layout()->setSpacing( spacingHint() ); | 69 | generalGroupBox->layout()->setSpacing( spacingHint() ); |
67 | generalGroupBox->setTitle( i18n( "General Settings" ) ); | 70 | generalGroupBox->setTitle( i18n( "General Settings" ) ); |
68 | 71 | ||
69 | new QLabel( i18n( "Name:" ), generalGroupBox ); | 72 | new QLabel( i18n( "Name:" ), generalGroupBox ); |
70 | 73 | ||
71 | mName = new KLineEdit( generalGroupBox ); | 74 | mName = new KLineEdit( generalGroupBox ); |
72 | 75 | ||
73 | new QLabel("", generalGroupBox ); | 76 | new QLabel("", generalGroupBox ); |
74 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); | 77 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); |
75 | mReadOnly->setChecked( mResource->readOnly() ); | 78 | mReadOnly->setChecked( mResource->readOnly() ); |
76 | 79 | ||
77 | new QLabel("", generalGroupBox ); | 80 | new QLabel("", generalGroupBox ); |
78 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); | 81 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); |
79 | mIncludeInSync->setChecked( mResource->includeInSync() ); | 82 | mIncludeInSync->setChecked( mResource->includeInSync() ); |
80 | 83 | ||
81 | mName->setText( mResource->resourceName() ); | 84 | mName->setText( mResource->resourceName() ); |
82 | 85 | ||
83 | mainLayout->addWidget( generalGroupBox ); | 86 | mainLayout->addWidget( generalGroupBox ); |
84 | 87 | ||
85 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 88 | Q3GroupBox *resourceGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
86 | resourceGroupBox->layout()->setSpacing( spacingHint()); | 89 | resourceGroupBox->layout()->setSpacing( spacingHint()); |
87 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) | 90 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) |
88 | .arg( factory->typeName( resource->type() ) ) ); | 91 | .arg( factory->typeName( resource->type() ) ) ); |
89 | mainLayout->addWidget( resourceGroupBox ); | 92 | mainLayout->addWidget( resourceGroupBox ); |
90 | 93 | ||
91 | mainLayout->addStretch(); | 94 | mainLayout->addStretch(); |
92 | 95 | ||
93 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); | 96 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); |
94 | if ( mConfigWidget ) { | 97 | if ( mConfigWidget ) { |
95 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | 98 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), |
96 | SLOT( setReadOnly( bool ) ) ); | 99 | SLOT( setReadOnly( bool ) ) ); |
97 | connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), | 100 | connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), |
98 | SLOT( setIncludeInSync( bool ) ) ); | 101 | SLOT( setIncludeInSync( bool ) ) ); |
99 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), | 102 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), |
100 | SLOT( setPersistentReadOnly( bool ) ) ); | 103 | SLOT( setPersistentReadOnly( bool ) ) ); |
101 | mConfigWidget->setInEditMode( false ); | 104 | mConfigWidget->setInEditMode( false ); |
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index fc7a42e..1a9d063 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp | |||
@@ -15,108 +15,112 @@ | |||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qgroupbox.h> | 31 | #include <q3groupbox.h> |
32 | 32 | ||
33 | #ifdef DESKTOP_VERSION | 33 | #ifdef DESKTOP_VERSION |
34 | #include <qinputdialog.h> | 34 | #include <qinputdialog.h> |
35 | #else | 35 | #else |
36 | #include <qtcompat/qinputdialog.h> | 36 | #include <qtcompat/qinputdialog.h> |
37 | #endif | 37 | #endif |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3GridLayout> | ||
42 | #include <Q3ValueList> | ||
43 | #include <Q3VBoxLayout> | ||
40 | #include <kapplication.h> | 44 | #include <kapplication.h> |
41 | #include <kcombobox.h> | 45 | #include <kcombobox.h> |
42 | #include <kdebug.h> | 46 | #include <kdebug.h> |
43 | #include <klocale.h> | 47 | #include <klocale.h> |
44 | #include <kmessagebox.h> | 48 | #include <kmessagebox.h> |
45 | #include <ksimpleconfig.h> | 49 | #include <ksimpleconfig.h> |
46 | #include <kstandarddirs.h> | 50 | #include <kstandarddirs.h> |
47 | #include <kurlrequester.h> | 51 | #include <kurlrequester.h> |
48 | #include <klistview.h> | 52 | #include <klistview.h> |
49 | #include <kbuttonbox.h> | 53 | #include <kbuttonbox.h> |
50 | //US #include <ktrader.h> | 54 | //US #include <ktrader.h> |
51 | 55 | ||
52 | #include "resource.h" | 56 | #include "resource.h" |
53 | #include "configdialog.h" | 57 | #include "configdialog.h" |
54 | 58 | ||
55 | #include "configpage.h" | 59 | #include "configpage.h" |
56 | 60 | ||
57 | //US | 61 | //US |
58 | #include <qpushbutton.h> | 62 | #include <qpushbutton.h> |
59 | #include <qfile.h> | 63 | #include <qfile.h> |
60 | #include <kglobal.h> | 64 | #include <kglobal.h> |
61 | 65 | ||
62 | using namespace KRES; | 66 | using namespace KRES; |
63 | 67 | ||
64 | class ConfigViewItem : public QCheckListItem | 68 | class ConfigViewItem : public Q3CheckListItem |
65 | { | 69 | { |
66 | public: | 70 | public: |
67 | ConfigViewItem( QListView *parent, Resource* resource ) : | 71 | ConfigViewItem( Q3ListView *parent, Resource* resource ) : |
68 | QCheckListItem( parent, resource->resourceName(), CheckBox ), | 72 | Q3CheckListItem( parent, resource->resourceName(), CheckBox ), |
69 | mResource( resource ), | 73 | mResource( resource ), |
70 | mIsStandard( false ) | 74 | mIsStandard( false ) |
71 | { | 75 | { |
72 | setText( 1, mResource->type() ); | 76 | setText( 1, mResource->type() ); |
73 | setOn( mResource->isActive() ); | 77 | setOn( mResource->isActive() ); |
74 | } | 78 | } |
75 | 79 | ||
76 | void setStandard( bool value ) | 80 | void setStandard( bool value ) |
77 | { | 81 | { |
78 | setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); | 82 | setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); |
79 | mIsStandard = value; | 83 | mIsStandard = value; |
80 | } | 84 | } |
81 | 85 | ||
82 | bool standard() const { return mIsStandard; } | 86 | bool standard() const { return mIsStandard; } |
83 | bool readOnly() const { return mResource->readOnly(); } | 87 | bool readOnly() const { return mResource->readOnly(); } |
84 | 88 | ||
85 | Resource *resource() { return mResource; } | 89 | Resource *resource() { return mResource; } |
86 | 90 | ||
87 | private: | 91 | private: |
88 | Resource* mResource; | 92 | Resource* mResource; |
89 | 93 | ||
90 | bool mIsStandard; | 94 | bool mIsStandard; |
91 | }; | 95 | }; |
92 | 96 | ||
93 | ConfigPage::ConfigPage( QWidget *parent, const char *name ) | 97 | ConfigPage::ConfigPage( QWidget *parent, const char *name ) |
94 | : QWidget( parent, name ), | 98 | : QWidget( parent, name ), |
95 | mCurrentManager( 0 ), | 99 | mCurrentManager( 0 ), |
96 | mCurrentConfig( 0 ) | 100 | mCurrentConfig( 0 ) |
97 | { | 101 | { |
98 | setCaption( i18n( "Resource Configuration" ) ); | 102 | setCaption( i18n( "Resource Configuration" ) ); |
99 | 103 | ||
100 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 104 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this ); |
101 | 105 | ||
102 | QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this ); | 106 | Q3GroupBox *groupBox = new Q3GroupBox( i18n( "Resources" ), this ); |
103 | groupBox->setColumnLayout(0, Qt::Vertical ); | 107 | groupBox->setColumnLayout(0, Qt::Vertical ); |
104 | groupBox->layout()->setSpacing( 3 ); | 108 | groupBox->layout()->setSpacing( 3 ); |
105 | groupBox->layout()->setMargin( 5 ); | 109 | groupBox->layout()->setMargin( 5 ); |
106 | QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 ); | 110 | Q3GridLayout *groupBoxLayout = new Q3GridLayout( groupBox->layout(), 4, 2 ); |
107 | 111 | ||
108 | //US mFamilyCombo = new KComboBox( false, groupBox ); | 112 | //US mFamilyCombo = new KComboBox( false, groupBox ); |
109 | mFamilyCombo = new KComboBox( groupBox ); | 113 | mFamilyCombo = new KComboBox( groupBox ); |
110 | groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); | 114 | groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); |
111 | 115 | ||
112 | mListView = new KListView( groupBox ); | 116 | mListView = new KListView( groupBox ); |
113 | mListView->setAllColumnsShowFocus( true ); | 117 | mListView->setAllColumnsShowFocus( true ); |
114 | mListView->addColumn( i18n( "Name" ) ); | 118 | mListView->addColumn( i18n( "Name" ) ); |
115 | mListView->addColumn( i18n( "Type" ) ); | 119 | mListView->addColumn( i18n( "Type" ) ); |
116 | mListView->addColumn( i18n( "Standard" ) ); | 120 | mListView->addColumn( i18n( "Standard" ) ); |
117 | 121 | ||
118 | //US groupBoxLayout->addWidget( mListView, 1, 0 ); | 122 | //US groupBoxLayout->addWidget( mListView, 1, 0 ); |
119 | groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); | 123 | groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); |
120 | 124 | ||
121 | 125 | ||
122 | mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); | 126 | mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); |
@@ -132,47 +136,47 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) | |||
132 | mEditButton->setEnabled( false ); | 136 | mEditButton->setEnabled( false ); |
133 | mStandardButton->setEnabled( false ); | 137 | mStandardButton->setEnabled( false ); |
134 | 138 | ||
135 | 139 | ||
136 | connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) ); | 140 | connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) ); |
137 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) ); | 141 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) ); |
138 | connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) ); | 142 | connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) ); |
139 | connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) ); | 143 | connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) ); |
140 | 144 | ||
141 | 145 | ||
142 | mainLayout->addWidget( groupBox ); | 146 | mainLayout->addWidget( groupBox ); |
143 | 147 | ||
144 | connect( mFamilyCombo, SIGNAL( activated( int ) ), | 148 | connect( mFamilyCombo, SIGNAL( activated( int ) ), |
145 | SLOT( slotFamilyChanged( int ) ) ); | 149 | SLOT( slotFamilyChanged( int ) ) ); |
146 | connect( mListView, SIGNAL( selectionChanged() ), | 150 | connect( mListView, SIGNAL( selectionChanged() ), |
147 | SLOT( slotSelectionChanged() ) ); | 151 | SLOT( slotSelectionChanged() ) ); |
148 | connect( mListView, SIGNAL( clicked( QListViewItem * ) ), | 152 | connect( mListView, SIGNAL( clicked( Q3ListViewItem * ) ), |
149 | SLOT( slotItemClicked( QListViewItem * ) ) ); | 153 | SLOT( slotItemClicked( Q3ListViewItem * ) ) ); |
150 | 154 | ||
151 | mLastItem = 0; | 155 | mLastItem = 0; |
152 | 156 | ||
153 | //US mConfig = new KConfig( "kcmkresourcesrc" ); | 157 | //US mConfig = new KConfig( "kcmkresourcesrc" ); |
154 | mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") ); | 158 | mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") ); |
155 | mConfig->setGroup( "General" ); | 159 | mConfig->setGroup( "General" ); |
156 | 160 | ||
157 | load(); | 161 | load(); |
158 | } | 162 | } |
159 | 163 | ||
160 | ConfigPage::~ConfigPage() | 164 | ConfigPage::~ConfigPage() |
161 | { | 165 | { |
162 | QValueList<ResourcePageInfo>::Iterator it; | 166 | Q3ValueList<ResourcePageInfo>::Iterator it; |
163 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) { | 167 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) { |
164 | (*it).mManager->removeListener( this ); | 168 | (*it).mManager->removeListener( this ); |
165 | delete (*it).mManager; | 169 | delete (*it).mManager; |
166 | delete (*it).mConfig; | 170 | delete (*it).mConfig; |
167 | } | 171 | } |
168 | 172 | ||
169 | mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); | 173 | mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); |
170 | delete mConfig; | 174 | delete mConfig; |
171 | mConfig = 0; | 175 | mConfig = 0; |
172 | } | 176 | } |
173 | 177 | ||
174 | void ConfigPage::load() | 178 | void ConfigPage::load() |
175 | { | 179 | { |
176 | kdDebug(5650) << "ConfigPage::load()" << endl; | 180 | kdDebug(5650) << "ConfigPage::load()" << endl; |
177 | 181 | ||
178 | mListView->clear(); | 182 | mListView->clear(); |
@@ -217,33 +221,33 @@ void ConfigPage::load() | |||
217 | } | 221 | } |
218 | } | 222 | } |
219 | } | 223 | } |
220 | mCurrentManager = 0; | 224 | mCurrentManager = 0; |
221 | 225 | ||
222 | mFamilyCombo->insertStringList( mFamilyMap ); | 226 | mFamilyCombo->insertStringList( mFamilyMap ); |
223 | 227 | ||
224 | int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 ); | 228 | int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 ); |
225 | mFamilyCombo->setCurrentItem( currentFamily ); | 229 | mFamilyCombo->setCurrentItem( currentFamily ); |
226 | slotFamilyChanged( currentFamily ); | 230 | slotFamilyChanged( currentFamily ); |
227 | } | 231 | } |
228 | 232 | ||
229 | void ConfigPage::save() | 233 | void ConfigPage::save() |
230 | { | 234 | { |
231 | saveResourceSettings(); | 235 | saveResourceSettings(); |
232 | 236 | ||
233 | QValueList<ResourcePageInfo>::Iterator it; | 237 | Q3ValueList<ResourcePageInfo>::Iterator it; |
234 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) | 238 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) |
235 | (*it).mManager->writeConfig( (*it).mConfig ); | 239 | (*it).mManager->writeConfig( (*it).mConfig ); |
236 | 240 | ||
237 | emit changed( false ); | 241 | emit changed( false ); |
238 | } | 242 | } |
239 | 243 | ||
240 | void ConfigPage::defaults() | 244 | void ConfigPage::defaults() |
241 | { | 245 | { |
242 | } | 246 | } |
243 | 247 | ||
244 | void ConfigPage::slotFamilyChanged( int pos ) | 248 | void ConfigPage::slotFamilyChanged( int pos ) |
245 | { | 249 | { |
246 | if ( pos < 0 || pos >= (int)mFamilyMap.count() ) | 250 | if ( pos < 0 || pos >= (int)mFamilyMap.count() ) |
247 | return; | 251 | return; |
248 | 252 | ||
249 | saveResourceSettings(); | 253 | saveResourceSettings(); |
@@ -328,85 +332,85 @@ void ConfigPage::slotAdd() | |||
328 | 332 | ||
329 | resource->setResourceName( type + "-resource" ); | 333 | resource->setResourceName( type + "-resource" ); |
330 | 334 | ||
331 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 335 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
332 | 336 | ||
333 | if ( dlg.exec() ) { | 337 | if ( dlg.exec() ) { |
334 | mCurrentManager->add( resource ); | 338 | mCurrentManager->add( resource ); |
335 | 339 | ||
336 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); | 340 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); |
337 | 341 | ||
338 | mLastItem = item; | 342 | mLastItem = item; |
339 | 343 | ||
340 | // if there are only read-only resources we'll set this resource | 344 | // if there are only read-only resources we'll set this resource |
341 | // as standard resource | 345 | // as standard resource |
342 | if ( !resource->readOnly() ) { | 346 | if ( !resource->readOnly() ) { |
343 | bool onlyReadOnly = true; | 347 | bool onlyReadOnly = true; |
344 | QListViewItem *it = mListView->firstChild(); | 348 | Q3ListViewItem *it = mListView->firstChild(); |
345 | while ( it != 0 ) { | 349 | while ( it != 0 ) { |
346 | ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it ); | 350 | ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it ); |
347 | if ( !confIt->readOnly() && confIt != item ) | 351 | if ( !confIt->readOnly() && confIt != item ) |
348 | onlyReadOnly = false; | 352 | onlyReadOnly = false; |
349 | 353 | ||
350 | it = it->itemBelow(); | 354 | it = it->itemBelow(); |
351 | } | 355 | } |
352 | 356 | ||
353 | if ( onlyReadOnly ) | 357 | if ( onlyReadOnly ) |
354 | item->setStandard( true ); | 358 | item->setStandard( true ); |
355 | } | 359 | } |
356 | 360 | ||
357 | emit changed( true ); | 361 | emit changed( true ); |
358 | } else { | 362 | } else { |
359 | delete resource; | 363 | delete resource; |
360 | resource = 0; | 364 | resource = 0; |
361 | } | 365 | } |
362 | } | 366 | } |
363 | 367 | ||
364 | void ConfigPage::slotRemove() | 368 | void ConfigPage::slotRemove() |
365 | { | 369 | { |
366 | if ( !mCurrentManager ) | 370 | if ( !mCurrentManager ) |
367 | return; | 371 | return; |
368 | 372 | ||
369 | QListViewItem *item = mListView->currentItem(); | 373 | Q3ListViewItem *item = mListView->currentItem(); |
370 | ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item ); | 374 | ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item ); |
371 | 375 | ||
372 | if ( !confItem ) | 376 | if ( !confItem ) |
373 | return; | 377 | return; |
374 | 378 | ||
375 | if ( confItem->standard() ) { | 379 | if ( confItem->standard() ) { |
376 | KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) ); | 380 | KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) ); |
377 | return; | 381 | return; |
378 | } | 382 | } |
379 | 383 | ||
380 | mCurrentManager->remove( confItem->resource() ); | 384 | mCurrentManager->remove( confItem->resource() ); |
381 | 385 | ||
382 | if ( item == mLastItem ) | 386 | if ( item == mLastItem ) |
383 | mLastItem = 0; | 387 | mLastItem = 0; |
384 | 388 | ||
385 | mListView->takeItem( item ); | 389 | mListView->takeItem( item ); |
386 | delete item; | 390 | delete item; |
387 | 391 | ||
388 | emit changed( true ); | 392 | emit changed( true ); |
389 | } | 393 | } |
390 | 394 | ||
391 | void ConfigPage::slotEdit() | 395 | void ConfigPage::slotEdit() |
392 | { | 396 | { |
393 | if ( !mCurrentManager ) | 397 | if ( !mCurrentManager ) |
394 | return; | 398 | return; |
395 | 399 | ||
396 | QListViewItem *item = mListView->currentItem(); | 400 | Q3ListViewItem *item = mListView->currentItem(); |
397 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); | 401 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); |
398 | if ( !configItem ) | 402 | if ( !configItem ) |
399 | return; | 403 | return; |
400 | 404 | ||
401 | Resource *resource = configItem->resource(); | 405 | Resource *resource = configItem->resource(); |
402 | 406 | ||
403 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 407 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
404 | 408 | ||
405 | if ( dlg.exec() ) { | 409 | if ( dlg.exec() ) { |
406 | configItem->setText( 0, resource->resourceName() ); | 410 | configItem->setText( 0, resource->resourceName() ); |
407 | configItem->setText( 1, resource->type() ); | 411 | configItem->setText( 1, resource->type() ); |
408 | 412 | ||
409 | if ( configItem->standard() && configItem->readOnly() ) { | 413 | if ( configItem->standard() && configItem->readOnly() ) { |
410 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) ); | 414 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) ); |
411 | configItem->setStandard( false ); | 415 | configItem->setStandard( false ); |
412 | } | 416 | } |
@@ -422,33 +426,33 @@ void ConfigPage::slotStandard() | |||
422 | return; | 426 | return; |
423 | 427 | ||
424 | ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); | 428 | ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); |
425 | if ( !item ) | 429 | if ( !item ) |
426 | return; | 430 | return; |
427 | 431 | ||
428 | if ( item->readOnly() ) { | 432 | if ( item->readOnly() ) { |
429 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) ); | 433 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) ); |
430 | return; | 434 | return; |
431 | } | 435 | } |
432 | 436 | ||
433 | if ( !item->isOn() ) { | 437 | if ( !item->isOn() ) { |
434 | KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) ); | 438 | KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) ); |
435 | return; | 439 | return; |
436 | } | 440 | } |
437 | 441 | ||
438 | QListViewItem *it = mListView->firstChild(); | 442 | Q3ListViewItem *it = mListView->firstChild(); |
439 | while ( it != 0 ) { | 443 | while ( it != 0 ) { |
440 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); | 444 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); |
441 | if ( configItem->standard() ) | 445 | if ( configItem->standard() ) |
442 | configItem->setStandard( false ); | 446 | configItem->setStandard( false ); |
443 | it = it->itemBelow(); | 447 | it = it->itemBelow(); |
444 | } | 448 | } |
445 | 449 | ||
446 | item->setStandard( true ); | 450 | item->setStandard( true ); |
447 | mCurrentManager->setStandardResource( item->resource() ); | 451 | mCurrentManager->setStandardResource( item->resource() ); |
448 | emit changed( true ); | 452 | emit changed( true ); |
449 | 453 | ||
450 | } | 454 | } |
451 | 455 | ||
452 | void ConfigPage::slotSelectionChanged() | 456 | void ConfigPage::slotSelectionChanged() |
453 | { | 457 | { |
454 | bool state = ( mListView->currentItem() != 0 ); | 458 | bool state = ( mListView->currentItem() != 0 ); |
@@ -469,55 +473,55 @@ void ConfigPage::resourceAdded( Resource* resource ) | |||
469 | 473 | ||
470 | mLastItem = item; | 474 | mLastItem = item; |
471 | 475 | ||
472 | emit changed( true ); | 476 | emit changed( true ); |
473 | } | 477 | } |
474 | 478 | ||
475 | void ConfigPage::resourceModified( Resource* resource ) | 479 | void ConfigPage::resourceModified( Resource* resource ) |
476 | { | 480 | { |
477 | qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); | 481 | qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); |
478 | } | 482 | } |
479 | 483 | ||
480 | void ConfigPage::resourceDeleted( Resource* resource ) | 484 | void ConfigPage::resourceDeleted( Resource* resource ) |
481 | { | 485 | { |
482 | qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); | 486 | qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); |
483 | } | 487 | } |
484 | 488 | ||
485 | void ConfigPage::slotItemClicked( QListViewItem *item ) | 489 | void ConfigPage::slotItemClicked( Q3ListViewItem *item ) |
486 | { | 490 | { |
487 | ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); | 491 | ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); |
488 | if ( !configItem ) return; | 492 | if ( !configItem ) return; |
489 | 493 | ||
490 | if ( configItem->standard() && !configItem->isOn() ) { | 494 | if ( configItem->standard() && !configItem->isOn() ) { |
491 | KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) ); | 495 | KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) ); |
492 | configItem->setOn( true ); | 496 | configItem->setOn( true ); |
493 | return; | 497 | return; |
494 | } | 498 | } |
495 | 499 | ||
496 | if ( configItem->isOn() != configItem->resource()->isActive() ) { | 500 | if ( configItem->isOn() != configItem->resource()->isActive() ) { |
497 | emit changed( true ); | 501 | emit changed( true ); |
498 | } | 502 | } |
499 | } | 503 | } |
500 | 504 | ||
501 | void ConfigPage::saveResourceSettings() | 505 | void ConfigPage::saveResourceSettings() |
502 | { | 506 | { |
503 | //qDebug("ConfigPage::saveResourceSettings() begin"); | 507 | //qDebug("ConfigPage::saveResourceSettings() begin"); |
504 | 508 | ||
505 | if ( mCurrentManager ) { | 509 | if ( mCurrentManager ) { |
506 | 510 | ||
507 | QListViewItem *item = mListView->firstChild(); | 511 | Q3ListViewItem *item = mListView->firstChild(); |
508 | while ( item ) { | 512 | while ( item ) { |
509 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); | 513 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); |
510 | 514 | ||
511 | // check if standard resource | 515 | // check if standard resource |
512 | if ( configItem->standard() && !configItem->readOnly() && | 516 | if ( configItem->standard() && !configItem->readOnly() && |
513 | configItem->isOn() ) { | 517 | configItem->isOn() ) { |
514 | 518 | ||
515 | mCurrentManager->setStandardResource( configItem->resource() ); | 519 | mCurrentManager->setStandardResource( configItem->resource() ); |
516 | } | 520 | } |
517 | 521 | ||
518 | // check if active or passive resource | 522 | // check if active or passive resource |
519 | configItem->resource()->setActive( configItem->isOn() ); | 523 | configItem->resource()->setActive( configItem->isOn() ); |
520 | 524 | ||
521 | item = item->nextSibling(); | 525 | item = item->nextSibling(); |
522 | } | 526 | } |
523 | mCurrentManager->writeConfig( mCurrentConfig ); | 527 | mCurrentManager->writeConfig( mCurrentConfig ); |
diff --git a/microkde/kresources/configpage.h b/microkde/kresources/configpage.h index be9239e..dc1aa50 100644 --- a/microkde/kresources/configpage.h +++ b/microkde/kresources/configpage.h | |||
@@ -12,39 +12,41 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | #ifndef KRESOURCES_CONFIGPAGE_H | 23 | #ifndef KRESOURCES_CONFIGPAGE_H |
24 | #define KRESOURCES_CONFIGPAGE_H | 24 | #define KRESOURCES_CONFIGPAGE_H |
25 | 25 | ||
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3ValueList> | ||
28 | 30 | ||
29 | #include "manager.h" | 31 | #include "manager.h" |
30 | 32 | ||
31 | class KComboBox; | 33 | class KComboBox; |
32 | class KListView; | 34 | class KListView; |
33 | 35 | ||
34 | class QListViewItem; | 36 | class Q3ListViewItem; |
35 | class QPushButton; | 37 | class QPushButton; |
36 | 38 | ||
37 | 39 | ||
38 | namespace KRES { | 40 | namespace KRES { |
39 | 41 | ||
40 | class ResourcePageInfo | 42 | class ResourcePageInfo |
41 | { | 43 | { |
42 | public: | 44 | public: |
43 | Manager<Resource> *mManager; | 45 | Manager<Resource> *mManager; |
44 | KConfig *mConfig; | 46 | KConfig *mConfig; |
45 | }; | 47 | }; |
46 | 48 | ||
47 | class Resource; | 49 | class Resource; |
48 | 50 | ||
49 | class ConfigPage : public QWidget, public ManagerListener<Resource> | 51 | class ConfigPage : public QWidget, public ManagerListener<Resource> |
50 | { | 52 | { |
@@ -60,45 +62,45 @@ class ConfigPage : public QWidget, public ManagerListener<Resource> | |||
60 | 62 | ||
61 | public slots: | 63 | public slots: |
62 | void slotFamilyChanged( int ); | 64 | void slotFamilyChanged( int ); |
63 | void slotAdd(); | 65 | void slotAdd(); |
64 | void slotRemove(); | 66 | void slotRemove(); |
65 | void slotEdit(); | 67 | void slotEdit(); |
66 | void slotStandard(); | 68 | void slotStandard(); |
67 | void slotSelectionChanged(); | 69 | void slotSelectionChanged(); |
68 | 70 | ||
69 | // From ManagerListener<Resource> | 71 | // From ManagerListener<Resource> |
70 | public: | 72 | public: |
71 | virtual void resourceAdded( Resource* resource ); | 73 | virtual void resourceAdded( Resource* resource ); |
72 | virtual void resourceModified( Resource* resource ); | 74 | virtual void resourceModified( Resource* resource ); |
73 | virtual void resourceDeleted( Resource* resource ); | 75 | virtual void resourceDeleted( Resource* resource ); |
74 | 76 | ||
75 | protected slots: | 77 | protected slots: |
76 | void slotItemClicked( QListViewItem * ); | 78 | void slotItemClicked( Q3ListViewItem * ); |
77 | 79 | ||
78 | signals: | 80 | signals: |
79 | void changed( bool ); | 81 | void changed( bool ); |
80 | 82 | ||
81 | private: | 83 | private: |
82 | void saveResourceSettings(); | 84 | void saveResourceSettings(); |
83 | 85 | ||
84 | Manager<Resource>* mCurrentManager; | 86 | Manager<Resource>* mCurrentManager; |
85 | KConfig* mCurrentConfig; | 87 | KConfig* mCurrentConfig; |
86 | KConfig* mConfig; | 88 | KConfig* mConfig; |
87 | QString mFamily; | 89 | QString mFamily; |
88 | QStringList mFamilyMap; | 90 | QStringList mFamilyMap; |
89 | QValueList<ResourcePageInfo> mInfoMap; | 91 | Q3ValueList<ResourcePageInfo> mInfoMap; |
90 | 92 | ||
91 | KComboBox* mFamilyCombo; | 93 | KComboBox* mFamilyCombo; |
92 | KListView* mListView; | 94 | KListView* mListView; |
93 | QPushButton* mAddButton; | 95 | QPushButton* mAddButton; |
94 | QPushButton* mRemoveButton; | 96 | QPushButton* mRemoveButton; |
95 | QPushButton* mEditButton; | 97 | QPushButton* mEditButton; |
96 | QPushButton* mStandardButton; | 98 | QPushButton* mStandardButton; |
97 | 99 | ||
98 | QListViewItem* mLastItem; | 100 | Q3ListViewItem* mLastItem; |
99 | static const QString syncfamily; | 101 | static const QString syncfamily; |
100 | }; | 102 | }; |
101 | 103 | ||
102 | } | 104 | } |
103 | 105 | ||
104 | #endif | 106 | #endif |
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 86b22b2..4f286d1 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -28,43 +28,43 @@ | |||
28 | #include <kstaticdeleter.h> | 28 | #include <kstaticdeleter.h> |
29 | //#ifndef DESKTOP_VERSION | 29 | //#ifndef DESKTOP_VERSION |
30 | #include <klibloader.h> | 30 | #include <klibloader.h> |
31 | //#endif | 31 | //#endif |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | 33 | ||
34 | #include "resource.h" | 34 | #include "resource.h" |
35 | #include "factory.h" | 35 | #include "factory.h" |
36 | 36 | ||
37 | #ifdef STATIC_RESOURCES | 37 | #ifdef STATIC_RESOURCES |
38 | #include <file/resourcefile.h> | 38 | #include <file/resourcefile.h> |
39 | #include <dir/resourcedir.h> | 39 | #include <dir/resourcedir.h> |
40 | #include <qtopia/resourceqtopia.h> | 40 | #include <qtopia/resourceqtopia.h> |
41 | #endif | 41 | #endif |
42 | using namespace KRES; | 42 | using namespace KRES; |
43 | 43 | ||
44 | QDict<Factory> *Factory::mSelves = 0; | 44 | Q3Dict<Factory> *Factory::mSelves = 0; |
45 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 45 | static KStaticDeleter< Q3Dict<Factory> > staticDeleter; |
46 | 46 | ||
47 | Factory *Factory::self( const QString& resourceFamily) | 47 | Factory *Factory::self( const QString& resourceFamily) |
48 | { | 48 | { |
49 | 49 | ||
50 | 50 | ||
51 | Factory *factory = 0; | 51 | Factory *factory = 0; |
52 | if ( !mSelves ) | 52 | if ( !mSelves ) |
53 | { | 53 | { |
54 | mSelves = staticDeleter.setObject( new QDict<Factory> ); | 54 | mSelves = staticDeleter.setObject( new Q3Dict<Factory> ); |
55 | } | 55 | } |
56 | 56 | ||
57 | factory = mSelves->find( resourceFamily ); | 57 | factory = mSelves->find( resourceFamily ); |
58 | 58 | ||
59 | if ( !factory ) { | 59 | if ( !factory ) { |
60 | factory = new Factory( resourceFamily); | 60 | factory = new Factory( resourceFamily); |
61 | mSelves->insert( resourceFamily, factory ); | 61 | mSelves->insert( resourceFamily, factory ); |
62 | } | 62 | } |
63 | 63 | ||
64 | return factory; | 64 | return factory; |
65 | } | 65 | } |
66 | 66 | ||
67 | Factory::Factory( const QString& resourceFamily) : | 67 | Factory::Factory( const QString& resourceFamily) : |
68 | mResourceFamily( resourceFamily ) | 68 | mResourceFamily( resourceFamily ) |
69 | { | 69 | { |
70 | //US so far we have three types available for resourceFamily "contact" | 70 | //US so far we have three types available for resourceFamily "contact" |
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h index ea01b23..709fde0 100644 --- a/microkde/kresources/factory.h +++ b/microkde/kresources/factory.h | |||
@@ -11,33 +11,33 @@ | |||
11 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KRESOURCES_FACTORY_H | 24 | #ifndef KRESOURCES_FACTORY_H |
25 | #define KRESOURCES_FACTORY_H | 25 | #define KRESOURCES_FACTORY_H |
26 | 26 | ||
27 | #include <qdict.h> | 27 | #include <q3dict.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | 29 | ||
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | 34 | ||
35 | namespace KRES { | 35 | namespace KRES { |
36 | 36 | ||
37 | class ConfigWidget; | 37 | class ConfigWidget; |
38 | 38 | ||
39 | //US | 39 | //US |
40 | struct PluginInfo | 40 | struct PluginInfo |
41 | { | 41 | { |
42 | QString library; | 42 | QString library; |
43 | QString nameLabel; | 43 | QString nameLabel; |
@@ -101,26 +101,26 @@ class Factory | |||
101 | QStringList typeNames() const; | 101 | QStringList typeNames() const; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Returns the name for a special type. | 104 | * Returns the name for a special type. |
105 | */ | 105 | */ |
106 | QString typeName( const QString &type ) const; | 106 | QString typeName( const QString &type ) const; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Returns the description for a special type. | 109 | * Returns the description for a special type. |
110 | */ | 110 | */ |
111 | QString typeDescription( const QString &type ) const; | 111 | QString typeDescription( const QString &type ) const; |
112 | 112 | ||
113 | protected: | 113 | protected: |
114 | Factory( const QString& resourceFamily); | 114 | Factory( const QString& resourceFamily); |
115 | 115 | ||
116 | private: | 116 | private: |
117 | static QDict<Factory> *mSelves; | 117 | static Q3Dict<Factory> *mSelves; |
118 | 118 | ||
119 | QString mResourceFamily; | 119 | QString mResourceFamily; |
120 | //US QMap<QString, KService::Ptr> mTypeMap; | 120 | //US QMap<QString, KService::Ptr> mTypeMap; |
121 | //US lets store the pluginfo struct as value instead of a KService | 121 | //US lets store the pluginfo struct as value instead of a KService |
122 | QMap<QString, PluginInfo*> mTypeMap; | 122 | QMap<QString, PluginInfo*> mTypeMap; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | } | 125 | } |
126 | #endif | 126 | #endif |
diff --git a/microkde/kresources/kcmkresources.cpp b/microkde/kresources/kcmkresources.cpp index d600a31..f5eb826 100644 --- a/microkde/kresources/kcmkresources.cpp +++ b/microkde/kresources/kcmkresources.cpp | |||
@@ -7,55 +7,58 @@ | |||
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | //Added by qt3to4: | ||
24 | #include <Q3VBoxLayout> | ||
25 | #include <Q3Frame> | ||
23 | 26 | ||
24 | //US #include <kaboutdata.h> | 27 | //US #include <kaboutdata.h> |
25 | //US #include <kgenericfactory.h> | 28 | //US #include <kgenericfactory.h> |
26 | #include <klocale.h> | 29 | #include <klocale.h> |
27 | 30 | ||
28 | #include "configpage.h" | 31 | #include "configpage.h" |
29 | 32 | ||
30 | #include "kcmkresources.h" | 33 | #include "kcmkresources.h" |
31 | 34 | ||
32 | using namespace KRES; | 35 | using namespace KRES; |
33 | 36 | ||
34 | //US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory; | 37 | //US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory; |
35 | //US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) ); | 38 | //US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) ); |
36 | 39 | ||
37 | //US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) | 40 | //US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) |
38 | //US : KCModule( ResourcesFactory::instance(), parent, name ) | 41 | //US : KCModule( ResourcesFactory::instance(), parent, name ) |
39 | KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) | 42 | KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) |
40 | : KDialogBase( parent, name, true, i18n( "Configure Resources" ), | 43 | : KDialogBase( parent, name, true, i18n( "Configure Resources" ), |
41 | Ok|Cancel, Ok, true ) | 44 | Ok|Cancel, Ok, true ) |
42 | { | 45 | { |
43 | QFrame *main = plainPage(); | 46 | Q3Frame *main = plainPage(); |
44 | 47 | ||
45 | QVBoxLayout *layout = new QVBoxLayout( main ); | 48 | Q3VBoxLayout *layout = new Q3VBoxLayout( main ); |
46 | mConfigPage = new KRES::ConfigPage( main ); | 49 | mConfigPage = new KRES::ConfigPage( main ); |
47 | layout->addWidget( mConfigPage ); | 50 | layout->addWidget( mConfigPage ); |
48 | 51 | ||
49 | 52 | ||
50 | connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) ); | 53 | connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) ); |
51 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
52 | showMaximized(); | 55 | showMaximized(); |
53 | #endif | 56 | #endif |
54 | } | 57 | } |
55 | 58 | ||
56 | void KCMKResources::changed( bool changed) | 59 | void KCMKResources::changed( bool changed) |
57 | { | 60 | { |
58 | modified = changed; | 61 | modified = changed; |
59 | } | 62 | } |
60 | 63 | ||
61 | void KCMKResources::slotOk() | 64 | void KCMKResources::slotOk() |
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index 69062da..88705d4 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h | |||
@@ -19,34 +19,36 @@ | |||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef KRESOURCES_MANAGER_H | 32 | #ifndef KRESOURCES_MANAGER_H |
33 | #define KRESOURCES_MANAGER_H | 33 | #define KRESOURCES_MANAGER_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <q3dict.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | //Added by qt3to4: | ||
38 | #include <Q3PtrList> | ||
37 | 39 | ||
38 | #include "factory.h" | 40 | #include "factory.h" |
39 | #include "managerimpl.h" | 41 | #include "managerimpl.h" |
40 | 42 | ||
41 | namespace KRES { | 43 | namespace KRES { |
42 | 44 | ||
43 | class Resource; | 45 | class Resource; |
44 | 46 | ||
45 | template<class T> | 47 | template<class T> |
46 | class ManagerListener | 48 | class ManagerListener |
47 | { | 49 | { |
48 | public: | 50 | public: |
49 | virtual void resourceAdded( T *resource ) = 0; | 51 | virtual void resourceAdded( T *resource ) = 0; |
50 | virtual void resourceModified( T *resource ) = 0; | 52 | virtual void resourceModified( T *resource ) = 0; |
51 | virtual void resourceDeleted( T *resource ) = 0; | 53 | virtual void resourceDeleted( T *resource ) = 0; |
52 | }; | 54 | }; |
@@ -162,33 +164,33 @@ class Manager : private ManagerImplListener | |||
162 | ActiveIterator it; | 164 | ActiveIterator it; |
163 | it.mIt = mImpl->resourceList()->end(); | 165 | it.mIt = mImpl->resourceList()->end(); |
164 | it.mList = mImpl->resourceList(); | 166 | it.mList = mImpl->resourceList(); |
165 | return it; | 167 | return it; |
166 | } | 168 | } |
167 | 169 | ||
168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } | 170 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } |
169 | 171 | ||
170 | Manager( const QString &family ) | 172 | Manager( const QString &family ) |
171 | { | 173 | { |
172 | mFactory = Factory::self( family ); | 174 | mFactory = Factory::self( family ); |
173 | // The managerimpl will use the same Factory object as the manager | 175 | // The managerimpl will use the same Factory object as the manager |
174 | // because of the Factory::self() pattern | 176 | // because of the Factory::self() pattern |
175 | mImpl = new ManagerImpl( family ); | 177 | mImpl = new ManagerImpl( family ); |
176 | mImpl->setListener( this ); | 178 | mImpl->setListener( this ); |
177 | 179 | ||
178 | mListeners = new QPtrList<ManagerListener<T> >; | 180 | mListeners = new Q3PtrList<ManagerListener<T> >; |
179 | } | 181 | } |
180 | 182 | ||
181 | virtual ~Manager() | 183 | virtual ~Manager() |
182 | { | 184 | { |
183 | mImpl->setListener( 0 ); | 185 | mImpl->setListener( 0 ); |
184 | delete mListeners; | 186 | delete mListeners; |
185 | delete mImpl; | 187 | delete mImpl; |
186 | } | 188 | } |
187 | 189 | ||
188 | /** | 190 | /** |
189 | Recreate Resource objects from configuration file. If cfg is 0, read standard | 191 | Recreate Resource objects from configuration file. If cfg is 0, read standard |
190 | configuration file. | 192 | configuration file. |
191 | */ | 193 | */ |
192 | void readConfig( KConfig *cfg = 0 ) | 194 | void readConfig( KConfig *cfg = 0 ) |
193 | { | 195 | { |
194 | mImpl->readConfig( cfg ); | 196 | mImpl->readConfig( cfg ); |
@@ -317,22 +319,22 @@ class Manager : private ManagerImplListener | |||
317 | listener->resourceModified( resource ); | 319 | listener->resourceModified( resource ); |
318 | } | 320 | } |
319 | 321 | ||
320 | virtual void resourceDeleted( Resource *res ) | 322 | virtual void resourceDeleted( Resource *res ) |
321 | { | 323 | { |
322 | 324 | ||
323 | T* resource = (T *)( res ); | 325 | T* resource = (T *)( res ); |
324 | ManagerListener<T> *listener; | 326 | ManagerListener<T> *listener; |
325 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { | 327 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { |
326 | listener->resourceDeleted( resource ); | 328 | listener->resourceDeleted( resource ); |
327 | } | 329 | } |
328 | } | 330 | } |
329 | 331 | ||
330 | private: | 332 | private: |
331 | ManagerImpl *mImpl; | 333 | ManagerImpl *mImpl; |
332 | Factory *mFactory; | 334 | Factory *mFactory; |
333 | QPtrList<ManagerListener<T> > *mListeners; | 335 | Q3PtrList<ManagerListener<T> > *mListeners; |
334 | }; | 336 | }; |
335 | 337 | ||
336 | } | 338 | } |
337 | 339 | ||
338 | #endif | 340 | #endif |
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index a6d2007..4c0751c 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -22,32 +22,34 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | 32 | ||
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | //Added by qt3to4: | ||
39 | #include <Q3PtrList> | ||
38 | 40 | ||
39 | #include "resource.h" | 41 | #include "resource.h" |
40 | #include "factory.h" | 42 | #include "factory.h" |
41 | #include "managerimpl.h" | 43 | #include "managerimpl.h" |
42 | 44 | ||
43 | 45 | ||
44 | 46 | ||
45 | using namespace KRES; | 47 | using namespace KRES; |
46 | 48 | ||
47 | ManagerImpl::ManagerImpl( const QString &family ) | 49 | ManagerImpl::ManagerImpl( const QString &family ) |
48 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), | 50 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), |
49 | mFactory( 0 ) | 51 | mFactory( 0 ) |
50 | 52 | ||
51 | { | 53 | { |
52 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; | 54 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; |
53 | 55 | ||
@@ -219,46 +221,46 @@ void ManagerImpl::resourceChanged( Resource *resource ) | |||
219 | QStringList ManagerImpl::resourceNames() | 221 | QStringList ManagerImpl::resourceNames() |
220 | { | 222 | { |
221 | QStringList result; | 223 | QStringList result; |
222 | 224 | ||
223 | Resource::List::ConstIterator it; | 225 | Resource::List::ConstIterator it; |
224 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 226 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
225 | result.append( (*it)->resourceName() ); | 227 | result.append( (*it)->resourceName() ); |
226 | } | 228 | } |
227 | return result; | 229 | return result; |
228 | } | 230 | } |
229 | 231 | ||
230 | Resource::List *ManagerImpl::resourceList() | 232 | Resource::List *ManagerImpl::resourceList() |
231 | { | 233 | { |
232 | return &mResources; | 234 | return &mResources; |
233 | } | 235 | } |
234 | 236 | ||
235 | QPtrList<Resource> ManagerImpl::resources() | 237 | Q3PtrList<Resource> ManagerImpl::resources() |
236 | { | 238 | { |
237 | QPtrList<Resource> result; | 239 | Q3PtrList<Resource> result; |
238 | 240 | ||
239 | Resource::List::ConstIterator it; | 241 | Resource::List::ConstIterator it; |
240 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 242 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
241 | result.append( *it ); | 243 | result.append( *it ); |
242 | } | 244 | } |
243 | return result; | 245 | return result; |
244 | } | 246 | } |
245 | 247 | ||
246 | QPtrList<Resource> ManagerImpl::resources( bool active ) | 248 | Q3PtrList<Resource> ManagerImpl::resources( bool active ) |
247 | { | 249 | { |
248 | QPtrList<Resource> result; | 250 | Q3PtrList<Resource> result; |
249 | 251 | ||
250 | Resource::List::ConstIterator it; | 252 | Resource::List::ConstIterator it; |
251 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 253 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
252 | if ( (*it)->isActive() == active ) { | 254 | if ( (*it)->isActive() == active ) { |
253 | result.append( *it ); | 255 | result.append( *it ); |
254 | } | 256 | } |
255 | } | 257 | } |
256 | return result; | 258 | return result; |
257 | } | 259 | } |
258 | 260 | ||
259 | void ManagerImpl::setListener( ManagerImplListener *listener ) | 261 | void ManagerImpl::setListener( ManagerImplListener *listener ) |
260 | { | 262 | { |
261 | mListener = listener; | 263 | mListener = listener; |
262 | } | 264 | } |
263 | 265 | ||
264 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, | 266 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, |
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h index 56a2db6..1f728e5 100644 --- a/microkde/kresources/managerimpl.h +++ b/microkde/kresources/managerimpl.h | |||
@@ -19,34 +19,34 @@ | |||
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef KRESOURCES_MANAGERIMPL_H | 31 | #ifndef KRESOURCES_MANAGERIMPL_H |
32 | #define KRESOURCES_MANAGERIMPL_H | 32 | #define KRESOURCES_MANAGERIMPL_H |
33 | 33 | ||
34 | #include <qstring.h> | 34 | #include <qstring.h> |
35 | #include <qptrlist.h> | 35 | #include <q3ptrlist.h> |
36 | #include <qdict.h> | 36 | #include <q3dict.h> |
37 | //US | 37 | //US |
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | #include "resource.h" | 40 | #include "resource.h" |
41 | 41 | ||
42 | 42 | ||
43 | class KConfig; | 43 | class KConfig; |
44 | 44 | ||
45 | namespace KRES { | 45 | namespace KRES { |
46 | 46 | ||
47 | class Resource; | 47 | class Resource; |
48 | class Factory; | 48 | class Factory; |
49 | 49 | ||
50 | class ManagerImplListener | 50 | class ManagerImplListener |
51 | { | 51 | { |
52 | public: | 52 | public: |
@@ -68,36 +68,36 @@ class ManagerImpl : public QObject | |||
68 | ManagerImpl( const QString &family); | 68 | ManagerImpl( const QString &family); |
69 | ~ManagerImpl(); | 69 | ~ManagerImpl(); |
70 | 70 | ||
71 | void readConfig( KConfig * ); | 71 | void readConfig( KConfig * ); |
72 | void writeConfig( KConfig * ); | 72 | void writeConfig( KConfig * ); |
73 | 73 | ||
74 | void add( Resource *resource, bool useDCOP = true ); | 74 | void add( Resource *resource, bool useDCOP = true ); |
75 | void remove( Resource *resource, bool useDCOP = true ); | 75 | void remove( Resource *resource, bool useDCOP = true ); |
76 | 76 | ||
77 | Resource *standardResource(); | 77 | Resource *standardResource(); |
78 | void setStandardResource( Resource *resource ); | 78 | void setStandardResource( Resource *resource ); |
79 | 79 | ||
80 | void setActive( Resource *resource, bool active ); | 80 | void setActive( Resource *resource, bool active ); |
81 | 81 | ||
82 | Resource::List *resourceList(); | 82 | Resource::List *resourceList(); |
83 | 83 | ||
84 | QPtrList<Resource> resources(); | 84 | Q3PtrList<Resource> resources(); |
85 | 85 | ||
86 | // Get only active or passive resources | 86 | // Get only active or passive resources |
87 | QPtrList<Resource> resources( bool active ); | 87 | Q3PtrList<Resource> resources( bool active ); |
88 | 88 | ||
89 | QStringList resourceNames(); | 89 | QStringList resourceNames(); |
90 | 90 | ||
91 | void setListener( ManagerImplListener *listener ); | 91 | void setListener( ManagerImplListener *listener ); |
92 | 92 | ||
93 | public slots: | 93 | public slots: |
94 | void resourceChanged( Resource *resource ); | 94 | void resourceChanged( Resource *resource ); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | // dcop calls | 97 | // dcop calls |
98 | 98 | ||
99 | private: | 99 | private: |
100 | void createStandardConfig(); | 100 | void createStandardConfig(); |
101 | 101 | ||
102 | Resource *readResourceConfig( const QString& identifier, bool checkActive ); | 102 | Resource *readResourceConfig( const QString& identifier, bool checkActive ); |
103 | void writeResourceConfig( Resource *resource, bool checkActive ); | 103 | void writeResourceConfig( Resource *resource, bool checkActive ); |
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index ed5af96..1f9527c 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -15,33 +15,33 @@ | |||
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef KRESOURCES_RESOURCE_H | 23 | #ifndef KRESOURCES_RESOURCE_H |
24 | #define KRESOURCES_RESOURCE_H | 24 | #define KRESOURCES_RESOURCE_H |
25 | 25 | ||
26 | //US | 26 | //US |
27 | #ifdef QT_THREAD_SUPPORT | 27 | #ifdef QT_THREAD_SUPPORT |
28 | #include <qmutex.h> | 28 | #include <qmutex.h> |
29 | #endif //QT_THREAD_SUPPORT | 29 | #endif //QT_THREAD_SUPPORT |
30 | 30 | ||
31 | #include <qvaluelist.h> | 31 | #include <q3valuelist.h> |
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | 35 | ||
36 | #include <klibloader.h> | 36 | #include <klibloader.h> |
37 | 37 | ||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KRES { | 40 | namespace KRES { |
41 | 41 | ||
42 | class ConfigWidget; | 42 | class ConfigWidget; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @internal | 45 | * @internal |
46 | * @libdoc The KDE Resource library | 46 | * @libdoc The KDE Resource library |
47 | * | 47 | * |
@@ -226,33 +226,33 @@ link_DATA= resourceexample.desktop | |||
226 | * | 226 | * |
227 | * | 227 | * |
228 | */ | 228 | */ |
229 | 229 | ||
230 | /** | 230 | /** |
231 | * A @ref Resource is a ... | 231 | * A @ref Resource is a ... |
232 | * | 232 | * |
233 | * A subclass should reimplement at least the constructor and the | 233 | * A subclass should reimplement at least the constructor and the |
234 | k * @ref writeConfig method. | 234 | k * @ref writeConfig method. |
235 | * | 235 | * |
236 | */ | 236 | */ |
237 | class Resource : public QObject | 237 | class Resource : public QObject |
238 | { | 238 | { |
239 | Q_OBJECT | 239 | Q_OBJECT |
240 | 240 | ||
241 | public: | 241 | public: |
242 | typedef QValueList<Resource *> List; | 242 | typedef Q3ValueList<Resource *> List; |
243 | 243 | ||
244 | /** | 244 | /** |
245 | * Constructor. Construct resource from config. | 245 | * Constructor. Construct resource from config. |
246 | * @param config Configuration to read persistence information from. | 246 | * @param config Configuration to read persistence information from. |
247 | * If config==0, create object using default settings. | 247 | * If config==0, create object using default settings. |
248 | */ | 248 | */ |
249 | Resource( const KConfig* config ); | 249 | Resource( const KConfig* config ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Destructor. | 252 | * Destructor. |
253 | */ | 253 | */ |
254 | virtual ~Resource(); | 254 | virtual ~Resource(); |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * Write configuration information for this resource to a configuration | 257 | * Write configuration information for this resource to a configuration |
258 | * file. If you override this method, remember to call Resource::writeConfig | 258 | * file. If you override this method, remember to call Resource::writeConfig |
diff --git a/microkde/kresources/selectdialog.cpp b/microkde/kresources/selectdialog.cpp index fba8648..d5b83e9 100644 --- a/microkde/kresources/selectdialog.cpp +++ b/microkde/kresources/selectdialog.cpp | |||
@@ -21,112 +21,116 @@ | |||
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*US | 24 | /*US |
25 | #include <kbuttonbox.h> | 25 | #include <kbuttonbox.h> |
26 | #include <klistbox.h> | 26 | #include <klistbox.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kmessagebox.h> | 28 | #include <kmessagebox.h> |
29 | 29 | ||
30 | */ | 30 | */ |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | //US | 34 | //US |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | 36 | ||
37 | #include <qlistbox.h> | 37 | #include <q3listbox.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qgroupbox.h> | 39 | #include <q3groupbox.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3VBoxLayout> | ||
42 | #include <Q3Frame> | ||
43 | #include <Q3PtrList> | ||
40 | 44 | ||
41 | #include "resource.h" | 45 | #include "resource.h" |
42 | 46 | ||
43 | #include "selectdialog.h" | 47 | #include "selectdialog.h" |
44 | 48 | ||
45 | using namespace KRES; | 49 | using namespace KRES; |
46 | 50 | ||
47 | //US I am using KBaseDialog instead of KDialog | 51 | //US I am using KBaseDialog instead of KDialog |
48 | //US : KDialog( parent, name, true ) | 52 | //US : KDialog( parent, name, true ) |
49 | SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, | 53 | SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent, |
50 | const char *name ) | 54 | const char *name ) |
51 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, | 55 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, |
52 | Ok, true) | 56 | Ok, true) |
53 | 57 | ||
54 | { | 58 | { |
55 | //US setCaption( i18n( "Resource Selection" ) ); | 59 | //US setCaption( i18n( "Resource Selection" ) ); |
56 | //US resize( 300, 200 ); | 60 | //US resize( 300, 200 ); |
57 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); | 61 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); |
58 | 62 | ||
59 | //US | 63 | //US |
60 | QFrame *main = plainPage(); | 64 | Q3Frame *main = plainPage(); |
61 | /*US | 65 | /*US |
62 | QVBoxLayout *layout = new QVBoxLayout( main ); | 66 | QVBoxLayout *layout = new QVBoxLayout( main ); |
63 | mConfigPage = new KRES::ConfigPage( main ); | 67 | mConfigPage = new KRES::ConfigPage( main ); |
64 | layout->addWidget( mConfigPage ); | 68 | layout->addWidget( mConfigPage ); |
65 | */ | 69 | */ |
66 | 70 | ||
67 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 71 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
68 | QVBoxLayout *mainLayout = new QVBoxLayout( main ); | 72 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main ); |
69 | mainLayout->setMargin( marginHint() ); | 73 | mainLayout->setMargin( marginHint() ); |
70 | 74 | ||
71 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); | 75 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); |
72 | QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 76 | Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
73 | groupBox->setTitle( i18n( "Resources" ) ); | 77 | groupBox->setTitle( i18n( "Resources" ) ); |
74 | 78 | ||
75 | //US mResourceId = new KListBox( groupBox ); | 79 | //US mResourceId = new KListBox( groupBox ); |
76 | mResourceId = new QListBox( groupBox ); | 80 | mResourceId = new Q3ListBox( groupBox ); |
77 | 81 | ||
78 | mainLayout->addWidget( groupBox ); | 82 | mainLayout->addWidget( groupBox ); |
79 | 83 | ||
80 | mainLayout->addSpacing( 40 ); | 84 | mainLayout->addSpacing( 40 ); |
81 | 85 | ||
82 | /*US | 86 | /*US |
83 | KButtonBox *buttonBox = new KButtonBox( this ); | 87 | KButtonBox *buttonBox = new KButtonBox( this ); |
84 | 88 | ||
85 | buttonBox->addStretch(); | 89 | buttonBox->addStretch(); |
86 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); | 90 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); |
87 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); | 91 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); |
88 | buttonBox->layout(); | 92 | buttonBox->layout(); |
89 | 93 | ||
90 | mainLayout->addWidget( buttonBox ); | 94 | mainLayout->addWidget( buttonBox ); |
91 | */ | 95 | */ |
92 | // setup listbox | 96 | // setup listbox |
93 | uint counter = 0; | 97 | uint counter = 0; |
94 | for ( uint i = 0; i < list.count(); ++i ) { | 98 | for ( uint i = 0; i < list.count(); ++i ) { |
95 | Resource *resource = list.at( i ); | 99 | Resource *resource = list.at( i ); |
96 | if ( resource && !resource->readOnly() ) { | 100 | if ( resource && !resource->readOnly() ) { |
97 | mResourceMap.insert( counter, resource ); | 101 | mResourceMap.insert( counter, resource ); |
98 | mResourceId->insertItem( resource->resourceName() ); | 102 | mResourceId->insertItem( resource->resourceName() ); |
99 | counter++; | 103 | counter++; |
100 | } | 104 | } |
101 | } | 105 | } |
102 | 106 | ||
103 | mResourceId->setCurrentItem( 0 ); | 107 | mResourceId->setCurrentItem( 0 ); |
104 | connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)), | 108 | connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)), |
105 | SLOT(accept()) ); | 109 | SLOT(accept()) ); |
106 | } | 110 | } |
107 | 111 | ||
108 | Resource *SelectDialog::resource() | 112 | Resource *SelectDialog::resource() |
109 | { | 113 | { |
110 | if ( mResourceId->currentItem() != -1 ) | 114 | if ( mResourceId->currentItem() != -1 ) |
111 | return mResourceMap[ mResourceId->currentItem() ]; | 115 | return mResourceMap[ mResourceId->currentItem() ]; |
112 | else | 116 | else |
113 | return 0; | 117 | return 0; |
114 | } | 118 | } |
115 | 119 | ||
116 | Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent ) | 120 | Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent ) |
117 | { | 121 | { |
118 | if ( list.count() == 0 ) { | 122 | if ( list.count() == 0 ) { |
119 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); | 123 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); |
120 | return 0; | 124 | return 0; |
121 | } | 125 | } |
122 | 126 | ||
123 | if ( list.count() == 1 ) return list.first(); | 127 | if ( list.count() == 1 ) return list.first(); |
124 | 128 | ||
125 | // the following lines will return a writeable resource if only _one_ writeable | 129 | // the following lines will return a writeable resource if only _one_ writeable |
126 | // resource exists | 130 | // resource exists |
127 | Resource *found = 0; | 131 | Resource *found = 0; |
128 | Resource *it = list.first(); | 132 | Resource *it = list.first(); |
129 | while ( it ) { | 133 | while ( it ) { |
130 | if ( !it->readOnly() ) { | 134 | if ( !it->readOnly() ) { |
131 | if ( found ) { | 135 | if ( found ) { |
132 | found = 0; | 136 | found = 0; |
diff --git a/microkde/kresources/selectdialog.h b/microkde/kresources/selectdialog.h index 7026212..be5152b 100644 --- a/microkde/kresources/selectdialog.h +++ b/microkde/kresources/selectdialog.h | |||
@@ -12,81 +12,81 @@ | |||
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KRESOURCES_SELECTDIALOG_H | 24 | #ifndef KRESOURCES_SELECTDIALOG_H |
25 | #define KRESOURCES_SELECTDIALOG_H | 25 | #define KRESOURCES_SELECTDIALOG_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | #include <qmap.h> | 29 | #include <qmap.h> |
30 | 30 | ||
31 | #include <kdialogbase.h> | 31 | #include <kdialogbase.h> |
32 | 32 | ||
33 | //US class KListBox; | 33 | //US class KListBox; |
34 | class QListBox; | 34 | class Q3ListBox; |
35 | 35 | ||
36 | namespace KRES { | 36 | namespace KRES { |
37 | 37 | ||
38 | class Resource; | 38 | class Resource; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Dialog for selecting a resource. | 41 | * Dialog for selecting a resource. |
42 | * | 42 | * |
43 | * Example: | 43 | * Example: |
44 | * | 44 | * |
45 | * <pre> | 45 | * <pre> |
46 | * KABC::Resource *res = KABC::SelectDialog::getResource(); | 46 | * KABC::Resource *res = KABC::SelectDialog::getResource(); |
47 | * if ( !( res ) ) { | 47 | * if ( !( res ) ) { |
48 | * // no resource selected | 48 | * // no resource selected |
49 | * } else { | 49 | * } else { |
50 | * // do something with resource | 50 | * // do something with resource |
51 | * } | 51 | * } |
52 | * </pre> | 52 | * </pre> |
53 | */ | 53 | */ |
54 | //US class SelectDialog : KDialog | 54 | //US class SelectDialog : KDialog |
55 | class SelectDialog : KDialogBase | 55 | class SelectDialog : KDialogBase |
56 | { | 56 | { |
57 | // Q_OBJECT | 57 | // Q_OBJECT |
58 | public: | 58 | public: |
59 | /** | 59 | /** |
60 | * Constructor. | 60 | * Constructor. |
61 | * @param ab The address book you want to select the resource from | 61 | * @param ab The address book you want to select the resource from |
62 | * @param parent The parent widget | 62 | * @param parent The parent widget |
63 | * @param name The name of the dialog | 63 | * @param name The name of the dialog |
64 | */ | 64 | */ |
65 | SelectDialog( QPtrList<Resource> list, QWidget *parent = 0, | 65 | SelectDialog( Q3PtrList<Resource> list, QWidget *parent = 0, |
66 | const char *name = 0); | 66 | const char *name = 0); |
67 | 67 | ||
68 | // ~SelectDialog(); | 68 | // ~SelectDialog(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Return selected resource. | 71 | * Return selected resource. |
72 | */ | 72 | */ |
73 | Resource *resource(); | 73 | Resource *resource(); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Open a dialog showing the available resources and return the resource the | 76 | * Open a dialog showing the available resources and return the resource the |
77 | * user has selected. Returns 0, if the dialog was canceled. | 77 | * user has selected. Returns 0, if the dialog was canceled. |
78 | */ | 78 | */ |
79 | static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 ); | 79 | static Resource *getResource( Q3PtrList<Resource> list, QWidget *parent = 0 ); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | //US KListBox *mResourceId; | 82 | //US KListBox *mResourceId; |
83 | QListBox *mResourceId; | 83 | Q3ListBox *mResourceId; |
84 | 84 | ||
85 | QMap<int, Resource*> mResourceMap; | 85 | QMap<int, Resource*> mResourceMap; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | } | 90 | } |
91 | 91 | ||
92 | #endif | 92 | #endif |
diff --git a/microkde/ksystemtray.cpp b/microkde/ksystemtray.cpp index 4f81d02..0d0045f 100644 --- a/microkde/ksystemtray.cpp +++ b/microkde/ksystemtray.cpp | |||
@@ -1,11 +1,14 @@ | |||
1 | #include "ksystemtray.h" | 1 | #include "ksystemtray.h" |
2 | //Added by qt3to4: | ||
3 | #include <QMouseEvent> | ||
4 | #include <QLabel> | ||
2 | 5 | ||
3 | void KSystemTray::mousePressEvent( QMouseEvent *) | 6 | void KSystemTray::mousePressEvent( QMouseEvent *) |
4 | { | 7 | { |
5 | ; //qDebug("hallo"); | 8 | ; //qDebug("hallo"); |
6 | } | 9 | } |
7 | 10 | ||
8 | KSystemTray::KSystemTray( QWidget *parent ) : QLabel( parent ) | 11 | KSystemTray::KSystemTray( QWidget *parent ) : QLabel( parent ) |
9 | { | 12 | { |
10 | 13 | ||
11 | } | 14 | } |
diff --git a/microkde/ksystemtray.h b/microkde/ksystemtray.h index f3e4f6a..6708c86 100644 --- a/microkde/ksystemtray.h +++ b/microkde/ksystemtray.h | |||
@@ -1,14 +1,16 @@ | |||
1 | #ifndef MICROKDE_KSYSTEMTRAY_H | 1 | #ifndef MICROKDE_KSYSTEMTRAY_H |
2 | #define MICROKDE_KSYSTEMTRAY_H | 2 | #define MICROKDE_KSYSTEMTRAY_H |
3 | 3 | ||
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | //Added by qt3to4: | ||
6 | #include <QMouseEvent> | ||
5 | 7 | ||
6 | class KSystemTray : public QLabel | 8 | class KSystemTray : public QLabel |
7 | { | 9 | { |
8 | Q_OBJECT | 10 | Q_OBJECT |
9 | public: | 11 | public: |
10 | KSystemTray( QWidget *parent = 0 ); | 12 | KSystemTray( QWidget *parent = 0 ); |
11 | void mousePressEvent( QMouseEvent *); | 13 | void mousePressEvent( QMouseEvent *); |
12 | }; | 14 | }; |
13 | 15 | ||
14 | #endif | 16 | #endif |
diff --git a/microkde/ktempfile.cpp b/microkde/ktempfile.cpp index b9166bd..d61d22e 100644 --- a/microkde/ktempfile.cpp +++ b/microkde/ktempfile.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include <qtextstream.h> | 1 | #include <q3textstream.h> |
2 | 2 | ||
3 | #include "ktempfile.h" | 3 | #include "ktempfile.h" |
4 | 4 | ||
5 | KTempFile::KTempFile() | 5 | KTempFile::KTempFile() |
6 | { | 6 | { |
7 | } | 7 | } |
8 | 8 | ||
9 | KTempFile::KTempFile( const QString &filename, const QString &extension ) | 9 | KTempFile::KTempFile( const QString &filename, const QString &extension ) |
10 | { | 10 | { |
11 | } | 11 | } |
12 | 12 | ||
13 | void KTempFile::setAutoDelete( bool ) | 13 | void KTempFile::setAutoDelete( bool ) |
14 | { | 14 | { |
15 | } | 15 | } |
16 | 16 | ||
17 | QString KTempFile::name() | 17 | QString KTempFile::name() |
18 | { | 18 | { |
19 | return QString::null; | 19 | return QString::null; |
20 | } | 20 | } |
21 | 21 | ||
22 | QTextStream *KTempFile::textStream() | 22 | Q3TextStream *KTempFile::textStream() |
23 | { | 23 | { |
24 | return 0; | 24 | return 0; |
25 | } | 25 | } |
diff --git a/microkde/ktempfile.h b/microkde/ktempfile.h index 20dfa82..1ac7258 100644 --- a/microkde/ktempfile.h +++ b/microkde/ktempfile.h | |||
@@ -1,20 +1,20 @@ | |||
1 | #ifndef MINIKDE_KTEMPFILE_H | 1 | #ifndef MINIKDE_KTEMPFILE_H |
2 | #define MINIKDE_KTEMPFILE_H | 2 | #define MINIKDE_KTEMPFILE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | class QTextStream; | 6 | class Q3TextStream; |
7 | 7 | ||
8 | class KTempFile | 8 | class KTempFile |
9 | { | 9 | { |
10 | public: | 10 | public: |
11 | KTempFile(); | 11 | KTempFile(); |
12 | KTempFile( const QString &filename, const QString &extension ); | 12 | KTempFile( const QString &filename, const QString &extension ); |
13 | 13 | ||
14 | void setAutoDelete( bool ); | 14 | void setAutoDelete( bool ); |
15 | QString name(); | 15 | QString name(); |
16 | 16 | ||
17 | QTextStream *textStream(); | 17 | Q3TextStream *textStream(); |
18 | }; | 18 | }; |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/microkde/ktextedit.cpp b/microkde/ktextedit.cpp index 4dd6875..d74706b 100644 --- a/microkde/ktextedit.cpp +++ b/microkde/ktextedit.cpp | |||
@@ -1,53 +1,55 @@ | |||
1 | 1 | ||
2 | #include <ktextedit.h> | 2 | #include <ktextedit.h> |
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | //Added by qt3to4: | ||
6 | #include <QMouseEvent> | ||
5 | #endif | 7 | #endif |
6 | 8 | ||
7 | 9 | ||
8 | KTextEdit::KTextEdit ( QWidget *parent ) : QMultiLineEdit( parent ) | 10 | KTextEdit::KTextEdit ( QWidget *parent ) : Q3MultiLineEdit( parent ) |
9 | { | 11 | { |
10 | mAllowPopupMenu = false; | 12 | mAllowPopupMenu = false; |
11 | mMouseDown = false; | 13 | mMouseDown = false; |
12 | mIgnoreMark = false; | 14 | mIgnoreMark = false; |
13 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
14 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 16 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
15 | #endif | 17 | #endif |
16 | } | 18 | } |
17 | 19 | ||
18 | void KTextEdit::mousePressEvent(QMouseEvent *e) | 20 | void KTextEdit::mousePressEvent(QMouseEvent *e) |
19 | { | 21 | { |
20 | if ( e->button() == LeftButton ) { | 22 | if ( e->button() == Qt::LeftButton ) { |
21 | mAllowPopupMenu = true; | 23 | mAllowPopupMenu = true; |
22 | mYMousePos = mapToGlobal( (e->pos())).y(); | 24 | mYMousePos = mapToGlobal( (e->pos())).y(); |
23 | mXMousePos = mapToGlobal( (e->pos())).x(); | 25 | mXMousePos = mapToGlobal( (e->pos())).x(); |
24 | } | 26 | } |
25 | if ( e->button() == RightButton && !mAllowPopupMenu ) | 27 | if ( e->button() == Qt::RightButton && !mAllowPopupMenu ) |
26 | return; | 28 | return; |
27 | if ( e->button() == LeftButton ) { | 29 | if ( e->button() == Qt::LeftButton ) { |
28 | if ( hasMarkedText () ) | 30 | if ( hasMarkedText () ) |
29 | mIgnoreMark = !mIgnoreMark; | 31 | mIgnoreMark = !mIgnoreMark; |
30 | if ( mIgnoreMark && hasMarkedText () ) { | 32 | if ( mIgnoreMark && hasMarkedText () ) { |
31 | mMouseDown = false; | 33 | mMouseDown = false; |
32 | return ; | 34 | return ; |
33 | } | 35 | } |
34 | } | 36 | } |
35 | QMultiLineEdit::mousePressEvent( e ); | 37 | Q3MultiLineEdit::mousePressEvent( e ); |
36 | } | 38 | } |
37 | 39 | ||
38 | void KTextEdit::mouseReleaseEvent(QMouseEvent *e) | 40 | void KTextEdit::mouseReleaseEvent(QMouseEvent *e) |
39 | { | 41 | { |
40 | QMultiLineEdit::mouseReleaseEvent(e); | 42 | Q3MultiLineEdit::mouseReleaseEvent(e); |
41 | } | 43 | } |
42 | 44 | ||
43 | void KTextEdit::mouseMoveEvent(QMouseEvent *e) | 45 | void KTextEdit::mouseMoveEvent(QMouseEvent *e) |
44 | { | 46 | { |
45 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 47 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
46 | if ( diff < 0 ) diff = -diff; | 48 | if ( diff < 0 ) diff = -diff; |
47 | int diff2 = mXMousePos - mapToGlobal( (e->pos())).x(); | 49 | int diff2 = mXMousePos - mapToGlobal( (e->pos())).x(); |
48 | if ( diff2 < 0 ) diff2 = -diff2; | 50 | if ( diff2 < 0 ) diff2 = -diff2; |
49 | if ( diff+ diff2 > 20 ) | 51 | if ( diff+ diff2 > 20 ) |
50 | mAllowPopupMenu = false; | 52 | mAllowPopupMenu = false; |
51 | QMultiLineEdit::mouseMoveEvent(e); | 53 | Q3MultiLineEdit::mouseMoveEvent(e); |
52 | } | 54 | } |
53 | 55 | ||
diff --git a/microkde/ktextedit.h b/microkde/ktextedit.h index 87c0602..b7c8924 100644 --- a/microkde/ktextedit.h +++ b/microkde/ktextedit.h | |||
@@ -1,22 +1,24 @@ | |||
1 | #ifndef MICROKDE_KTEXTEDIT_H | 1 | #ifndef MICROKDE_KTEXTEDIT_H |
2 | #define MICROKDE_KTEXTEDIT_H | 2 | #define MICROKDE_KTEXTEDIT_H |
3 | 3 | ||
4 | #include <qmultilineedit.h> | 4 | #include <q3multilineedit.h> |
5 | //Added by qt3to4: | ||
6 | #include <QMouseEvent> | ||
5 | 7 | ||
6 | class KTextEdit : public QMultiLineEdit | 8 | class KTextEdit : public Q3MultiLineEdit |
7 | { | 9 | { |
8 | public: | 10 | public: |
9 | KTextEdit( QWidget *parent ) ; | 11 | KTextEdit( QWidget *parent ) ; |
10 | void setIgnoreMark( bool b ) { mIgnoreMark = b; } | 12 | void setIgnoreMark( bool b ) { mIgnoreMark = b; } |
11 | 13 | ||
12 | private: | 14 | private: |
13 | bool mAllowPopupMenu; | 15 | bool mAllowPopupMenu; |
14 | bool mMouseDown; | 16 | bool mMouseDown; |
15 | bool mIgnoreMark; | 17 | bool mIgnoreMark; |
16 | int mYMousePos; | 18 | int mYMousePos; |
17 | int mXMousePos; | 19 | int mXMousePos; |
18 | void mousePressEvent(QMouseEvent *e); | 20 | void mousePressEvent(QMouseEvent *e); |
19 | void mouseReleaseEvent(QMouseEvent *e); | 21 | void mouseReleaseEvent(QMouseEvent *e); |
20 | void mouseMoveEvent(QMouseEvent *e); | 22 | void mouseMoveEvent(QMouseEvent *e); |
21 | }; | 23 | }; |
22 | 24 | ||
diff --git a/microkde/kurl.cpp b/microkde/kurl.cpp index 2574e25..122ad71 100644 --- a/microkde/kurl.cpp +++ b/microkde/kurl.cpp | |||
@@ -21,56 +21,58 @@ | |||
21 | 21 | ||
22 | #ifndef KDE_QT_ONLY | 22 | #ifndef KDE_QT_ONLY |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | #include <kglobal.h> | 24 | #include <kglobal.h> |
25 | //US#include <kidna.h> | 25 | //US#include <kidna.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | #include <assert.h> | 29 | #include <assert.h> |
30 | #include <ctype.h> | 30 | #include <ctype.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #ifdef _WIN32_ | 32 | #ifdef _WIN32_ |
33 | 33 | ||
34 | #else | 34 | #else |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | #endif | 36 | #endif |
37 | #include <qurl.h> | 37 | #include <q3url.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qstringlist.h> | 39 | #include <qstringlist.h> |
40 | #include <qregexp.h> | 40 | #include <qregexp.h> |
41 | //US#include <qstylesheet.h> | 41 | //US#include <qstylesheet.h> |
42 | #include <qmap.h> | 42 | #include <qmap.h> |
43 | #include <qtextcodec.h> | 43 | #include <qtextcodec.h> |
44 | //Added by qt3to4: | ||
45 | #include <Q3CString> | ||
44 | 46 | ||
45 | static const QString fileProt = "file"; | 47 | static const QString fileProt = "file"; |
46 | 48 | ||
47 | static QTextCodec * codecForHint( int encoding_hint /* not 0 ! */ ) | 49 | static QTextCodec * codecForHint( int encoding_hint /* not 0 ! */ ) |
48 | { | 50 | { |
49 | return QTextCodec::codecForMib( encoding_hint ); | 51 | return QTextCodec::codecForMib( encoding_hint ); |
50 | } | 52 | } |
51 | 53 | ||
52 | static QString encode( const QString& segment, bool encode_slash, int encoding_hint ) | 54 | static QString encode( const QString& segment, bool encode_slash, int encoding_hint ) |
53 | { | 55 | { |
54 | const char *encode_string; | 56 | const char *encode_string; |
55 | if (encode_slash) | 57 | if (encode_slash) |
56 | encode_string = "<>#@\"&%?={}|^~[]\'`\\:+/"; | 58 | encode_string = "<>#@\"&%?={}|^~[]\'`\\:+/"; |
57 | else | 59 | else |
58 | encode_string = "<>#@\"&%?={}|^~[]\'`\\:+"; | 60 | encode_string = "<>#@\"&%?={}|^~[]\'`\\:+"; |
59 | 61 | ||
60 | QCString local; | 62 | Q3CString local; |
61 | if (encoding_hint==0) | 63 | if (encoding_hint==0) |
62 | local = segment.local8Bit(); | 64 | local = segment.local8Bit(); |
63 | else | 65 | else |
64 | { | 66 | { |
65 | QTextCodec * textCodec = codecForHint( encoding_hint ); | 67 | QTextCodec * textCodec = codecForHint( encoding_hint ); |
66 | if (!textCodec) | 68 | if (!textCodec) |
67 | local = segment.local8Bit(); | 69 | local = segment.local8Bit(); |
68 | else | 70 | else |
69 | local = textCodec->fromUnicode( segment ); | 71 | local = textCodec->fromUnicode( segment ); |
70 | } | 72 | } |
71 | 73 | ||
72 | int old_length = local.length(); | 74 | int old_length = local.length(); |
73 | 75 | ||
74 | if ( !old_length ) | 76 | if ( !old_length ) |
75 | return segment.isNull() ? QString::null : QString(""); // differenciate null and empty | 77 | return segment.isNull() ? QString::null : QString(""); // differenciate null and empty |
76 | 78 | ||
@@ -87,33 +89,33 @@ static QString encode( const QString& segment, bool encode_slash, int encoding_h | |||
87 | unsigned char character = local[i]; | 89 | unsigned char character = local[i]; |
88 | if ( (character <= 32) || (character >= 127) || | 90 | if ( (character <= 32) || (character >= 127) || |
89 | strchr(encode_string, character) ) | 91 | strchr(encode_string, character) ) |
90 | { | 92 | { |
91 | new_segment[ new_length++ ] = '%'; | 93 | new_segment[ new_length++ ] = '%'; |
92 | 94 | ||
93 | unsigned int c = character / 16; | 95 | unsigned int c = character / 16; |
94 | c += (c > 9) ? ('A' - 10) : '0'; | 96 | c += (c > 9) ? ('A' - 10) : '0'; |
95 | new_segment[ new_length++ ] = c; | 97 | new_segment[ new_length++ ] = c; |
96 | 98 | ||
97 | c = character % 16; | 99 | c = character % 16; |
98 | c += (c > 9) ? ('A' - 10) : '0'; | 100 | c += (c > 9) ? ('A' - 10) : '0'; |
99 | new_segment[ new_length++ ] = c; | 101 | new_segment[ new_length++ ] = c; |
100 | 102 | ||
101 | } | 103 | } |
102 | else | 104 | else |
103 | new_segment[ new_length++ ] = local[i]; | 105 | new_segment[ new_length++ ] = character; |
104 | } | 106 | } |
105 | 107 | ||
106 | QString result = QString(new_segment, new_length); | 108 | QString result = QString(new_segment, new_length); |
107 | delete [] new_segment; | 109 | delete [] new_segment; |
108 | return result; | 110 | return result; |
109 | } | 111 | } |
110 | 112 | ||
111 | static QString encodeHost( const QString& segment, bool encode_slash, int encoding_hint ) | 113 | static QString encodeHost( const QString& segment, bool encode_slash, int encoding_hint ) |
112 | { | 114 | { |
113 | // Hostnames are encoded differently | 115 | // Hostnames are encoded differently |
114 | // we use the IDNA transformation instead | 116 | // we use the IDNA transformation instead |
115 | 117 | ||
116 | // Note: when merging qt-addon, use QResolver::domainToAscii here | 118 | // Note: when merging qt-addon, use QResolver::domainToAscii here |
117 | #ifndef KDE_QT_ONLY | 119 | #ifndef KDE_QT_ONLY |
118 | Q_UNUSED( encode_slash ); | 120 | Q_UNUSED( encode_slash ); |
119 | Q_UNUSED( encoding_hint ); | 121 | Q_UNUSED( encoding_hint ); |
@@ -192,33 +194,33 @@ static QString lazy_encode( const QString& segment ) | |||
192 | static void decode( const QString& segment, QString &decoded, QString &encoded, int encoding_hint=0, bool updateDecoded = true ) | 194 | static void decode( const QString& segment, QString &decoded, QString &encoded, int encoding_hint=0, bool updateDecoded = true ) |
193 | { | 195 | { |
194 | decoded = QString::null; | 196 | decoded = QString::null; |
195 | encoded = segment; | 197 | encoded = segment; |
196 | 198 | ||
197 | int old_length = segment.length(); | 199 | int old_length = segment.length(); |
198 | if ( !old_length ) | 200 | if ( !old_length ) |
199 | return; | 201 | return; |
200 | 202 | ||
201 | QTextCodec *textCodec = 0; | 203 | QTextCodec *textCodec = 0; |
202 | if (encoding_hint) | 204 | if (encoding_hint) |
203 | textCodec = codecForHint( encoding_hint ); | 205 | textCodec = codecForHint( encoding_hint ); |
204 | 206 | ||
205 | if (!textCodec) | 207 | if (!textCodec) |
206 | textCodec = QTextCodec::codecForLocale(); | 208 | textCodec = QTextCodec::codecForLocale(); |
207 | 209 | ||
208 | QCString csegment = textCodec->fromUnicode(segment); | 210 | Q3CString csegment = textCodec->fromUnicode(segment); |
209 | // Check if everything went ok | 211 | // Check if everything went ok |
210 | if (textCodec->toUnicode(csegment) != segment) | 212 | if (textCodec->toUnicode(csegment) != segment) |
211 | { | 213 | { |
212 | // Uh oh | 214 | // Uh oh |
213 | textCodec = codecForHint( 106 ); // Fall back to utf-8 | 215 | textCodec = codecForHint( 106 ); // Fall back to utf-8 |
214 | csegment = textCodec->fromUnicode(segment); | 216 | csegment = textCodec->fromUnicode(segment); |
215 | } | 217 | } |
216 | old_length = csegment.length(); | 218 | old_length = csegment.length(); |
217 | 219 | ||
218 | int new_length = 0; | 220 | int new_length = 0; |
219 | int new_length2 = 0; | 221 | int new_length2 = 0; |
220 | 222 | ||
221 | // make a copy of the old one | 223 | // make a copy of the old one |
222 | char *new_segment = new char[ old_length + 1 ]; | 224 | char *new_segment = new char[ old_length + 1 ]; |
223 | QChar *new_usegment = new QChar[ old_length * 3 + 1 ]; | 225 | QChar *new_usegment = new QChar[ old_length * 3 + 1 ]; |
224 | 226 | ||
@@ -265,33 +267,33 @@ static void decode( const QString& segment, QString &decoded, QString &encoded, | |||
265 | new_usegment[ new_length2++ ] = c; | 267 | new_usegment[ new_length2++ ] = c; |
266 | } | 268 | } |
267 | 269 | ||
268 | new_segment [ new_length++ ] = character; | 270 | new_segment [ new_length++ ] = character; |
269 | } | 271 | } |
270 | new_segment [ new_length ] = 0; | 272 | new_segment [ new_length ] = 0; |
271 | 273 | ||
272 | encoded = QString( new_usegment, new_length2); | 274 | encoded = QString( new_usegment, new_length2); |
273 | 275 | ||
274 | // Encoding specified | 276 | // Encoding specified |
275 | if (updateDecoded) | 277 | if (updateDecoded) |
276 | { | 278 | { |
277 | QByteArray array; | 279 | QByteArray array; |
278 | array.setRawData(new_segment, new_length); | 280 | array.setRawData(new_segment, new_length); |
279 | decoded = textCodec->toUnicode( array, new_length ); | 281 | decoded = textCodec->toUnicode( array, new_length ); |
280 | array.resetRawData(new_segment, new_length); | 282 | array.resetRawData(new_segment, new_length); |
281 | QCString validate = textCodec->fromUnicode(decoded); | 283 | Q3CString validate = textCodec->fromUnicode(decoded); |
282 | 284 | ||
283 | if (strcmp(validate.data(), new_segment) != 0) | 285 | if (strcmp(validate.data(), new_segment) != 0) |
284 | { | 286 | { |
285 | decoded = QString::fromLocal8Bit(new_segment, new_length); | 287 | decoded = QString::fromLocal8Bit(new_segment, new_length); |
286 | } | 288 | } |
287 | } | 289 | } |
288 | 290 | ||
289 | delete [] new_segment; | 291 | delete [] new_segment; |
290 | delete [] new_usegment; | 292 | delete [] new_usegment; |
291 | } | 293 | } |
292 | 294 | ||
293 | static QString decode(const QString &segment, int encoding_hint = 0) | 295 | static QString decode(const QString &segment, int encoding_hint = 0) |
294 | { | 296 | { |
295 | QString result; | 297 | QString result; |
296 | QString tmp; | 298 | QString tmp; |
297 | decode(segment, result, tmp, encoding_hint); | 299 | decode(segment, result, tmp, encoding_hint); |
@@ -406,33 +408,33 @@ KURL::~KURL() | |||
406 | { | 408 | { |
407 | } | 409 | } |
408 | 410 | ||
409 | 411 | ||
410 | KURL::KURL( const QString &url, int encoding_hint ) | 412 | KURL::KURL( const QString &url, int encoding_hint ) |
411 | { | 413 | { |
412 | reset(); | 414 | reset(); |
413 | parse( url, encoding_hint ); | 415 | parse( url, encoding_hint ); |
414 | } | 416 | } |
415 | 417 | ||
416 | KURL::KURL( const char * url, int encoding_hint ) | 418 | KURL::KURL( const char * url, int encoding_hint ) |
417 | { | 419 | { |
418 | reset(); | 420 | reset(); |
419 | parse( QString::fromLatin1(url), encoding_hint ); | 421 | parse( QString::fromLatin1(url), encoding_hint ); |
420 | } | 422 | } |
421 | 423 | ||
422 | KURL::KURL( const QCString& url, int encoding_hint ) | 424 | KURL::KURL( const Q3CString& url, int encoding_hint ) |
423 | { | 425 | { |
424 | reset(); | 426 | reset(); |
425 | parse( QString::fromLatin1(url), encoding_hint ); | 427 | parse( QString::fromLatin1(url), encoding_hint ); |
426 | } | 428 | } |
427 | 429 | ||
428 | KURL::KURL( const KURL& _u ) | 430 | KURL::KURL( const KURL& _u ) |
429 | { | 431 | { |
430 | *this = _u; | 432 | *this = _u; |
431 | } | 433 | } |
432 | 434 | ||
433 | QDataStream & operator<< (QDataStream & s, const KURL & a) | 435 | QDataStream & operator<< (QDataStream & s, const KURL & a) |
434 | { | 436 | { |
435 | QString QueryForWire=a.m_strQuery_encoded; | 437 | QString QueryForWire=a.m_strQuery_encoded; |
436 | if (!a.m_strQuery_encoded.isNull()) | 438 | if (!a.m_strQuery_encoded.isNull()) |
437 | QueryForWire.prepend("?"); | 439 | QueryForWire.prepend("?"); |
438 | 440 | ||
@@ -447,33 +449,33 @@ QDataStream & operator>> (QDataStream & s, KURL & a) | |||
447 | Q_INT8 malf; | 449 | Q_INT8 malf; |
448 | QString QueryFromWire; | 450 | QString QueryFromWire; |
449 | s >> a.m_strProtocol >> a.m_strUser >> a.m_strPass >> a.m_strHost | 451 | s >> a.m_strProtocol >> a.m_strUser >> a.m_strPass >> a.m_strHost |
450 | >> a.m_strPath >> a.m_strPath_encoded >> QueryFromWire >> a.m_strRef_encoded | 452 | >> a.m_strPath >> a.m_strPath_encoded >> QueryFromWire >> a.m_strRef_encoded |
451 | >> malf >> a.m_iPort; | 453 | >> malf >> a.m_iPort; |
452 | a.m_bIsMalformed = (malf != 0); | 454 | a.m_bIsMalformed = (malf != 0); |
453 | 455 | ||
454 | if ( QueryFromWire.isEmpty() ) | 456 | if ( QueryFromWire.isEmpty() ) |
455 | a.m_strQuery_encoded = QString::null; | 457 | a.m_strQuery_encoded = QString::null; |
456 | else | 458 | else |
457 | a.m_strQuery_encoded = QueryFromWire.mid(1); | 459 | a.m_strQuery_encoded = QueryFromWire.mid(1); |
458 | 460 | ||
459 | return s; | 461 | return s; |
460 | } | 462 | } |
461 | 463 | ||
462 | #ifndef QT_NO_NETWORKPROTOCOL | 464 | #ifndef QT_NO_NETWORKPROTOCOL |
463 | KURL::KURL( const QUrl &u ) | 465 | KURL::KURL( const Q3Url &u ) |
464 | { | 466 | { |
465 | *this = u; | 467 | *this = u; |
466 | } | 468 | } |
467 | #endif | 469 | #endif |
468 | 470 | ||
469 | KURL::KURL( const KURL& _u, const QString& _rel_url, int encoding_hint ) | 471 | KURL::KURL( const KURL& _u, const QString& _rel_url, int encoding_hint ) |
470 | { | 472 | { |
471 | // WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS | 473 | // WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS |
472 | // http:/index.html AS A VALID SYNTAX FOR RELATIVE | 474 | // http:/index.html AS A VALID SYNTAX FOR RELATIVE |
473 | // URLS. ( RFC 2396 section 5.2 item # 3 ) | 475 | // URLS. ( RFC 2396 section 5.2 item # 3 ) |
474 | QString rUrl = _rel_url; | 476 | QString rUrl = _rel_url; |
475 | int len = _u.m_strProtocol.length(); | 477 | int len = _u.m_strProtocol.length(); |
476 | if ( !_u.m_strHost.isEmpty() && !rUrl.isEmpty() && | 478 | if ( !_u.m_strHost.isEmpty() && !rUrl.isEmpty() && |
477 | rUrl.find( _u.m_strProtocol, 0, false ) == 0 && | 479 | rUrl.find( _u.m_strProtocol, 0, false ) == 0 && |
478 | rUrl[len] == ':' && (rUrl[len+1] != '/' || | 480 | rUrl[len] == ':' && (rUrl[len+1] != '/' || |
479 | (rUrl[len+1] == '/' && rUrl[len+2] != '/')) ) | 481 | (rUrl[len+1] == '/' && rUrl[len+2] != '/')) ) |
@@ -576,39 +578,39 @@ void KURL::parse( const QString& _url, int encoding_hint ) | |||
576 | QString port; | 578 | QString port; |
577 | bool badHostName = false; | 579 | bool badHostName = false; |
578 | int start = 0; | 580 | int start = 0; |
579 | uint len = _url.length(); | 581 | uint len = _url.length(); |
580 | const QChar* buf = _url.unicode(); | 582 | const QChar* buf = _url.unicode(); |
581 | const QChar* orig = buf; | 583 | const QChar* orig = buf; |
582 | 584 | ||
583 | QChar delim; | 585 | QChar delim; |
584 | QString tmp; | 586 | QString tmp; |
585 | 587 | ||
586 | uint pos = 0; | 588 | uint pos = 0; |
587 | 589 | ||
588 | // Node 1: Accept alpha or slash | 590 | // Node 1: Accept alpha or slash |
589 | QChar x = buf[pos++]; | 591 | QChar x = buf[pos++]; |
590 | if ( x == '/' ) | 592 | if ( x == '/' ) |
591 | goto Node9; | 593 | goto Node9; |
592 | if ( !isalpha( (int)x ) ) | 594 | if ( !x.isLetter() ) |
593 | goto NodeErr; | 595 | goto NodeErr; |
594 | 596 | ||
595 | // Node 2: Accept any amount of (alpha|digit|'+'|'-') | 597 | // Node 2: Accept any amount of (alpha|digit|'+'|'-') |
596 | // '.' is not currently accepted, because current KURL may be confused. | 598 | // '.' is not currently accepted, because current KURL may be confused. |
597 | // Proceed with :// :/ or : | 599 | // Proceed with :// :/ or : |
598 | while( pos < len && (isalpha((int)buf[pos]) || isdigit((int)buf[pos]) || | 600 | while( pos < len && ( buf[pos].isLetter() || buf[pos].isDigit() || |
599 | buf[pos] == '+' || buf[pos] == '-')) pos++; | 601 | buf[pos] == '+' || buf[pos] == '-')) pos++; |
600 | 602 | ||
601 | if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' ) | 603 | if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' ) |
602 | { | 604 | { |
603 | m_strProtocol = QString( orig, pos ).lower(); | 605 | m_strProtocol = QString( orig, pos ).lower(); |
604 | pos += 3; | 606 | pos += 3; |
605 | } | 607 | } |
606 | else if (pos+1 < len && buf[pos] == ':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!! | 608 | else if (pos+1 < len && buf[pos] == ':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!! |
607 | { | 609 | { |
608 | m_strProtocol = QString( orig, pos ).lower(); | 610 | m_strProtocol = QString( orig, pos ).lower(); |
609 | //kdDebug(126)<<"setting protocol to "<<m_strProtocol<<endl; | 611 | //kdDebug(126)<<"setting protocol to "<<m_strProtocol<<endl; |
610 | pos++; | 612 | pos++; |
611 | start = pos; | 613 | start = pos; |
612 | goto Node9; | 614 | goto Node9; |
613 | } | 615 | } |
614 | else | 616 | else |
@@ -756,37 +758,37 @@ void KURL::parse( const QString& _url, int encoding_hint ) | |||
756 | setHost(decode(QString( buf + start, pos - start ), encoding_hint)); | 758 | setHost(decode(QString( buf + start, pos - start ), encoding_hint)); |
757 | } | 759 | } |
758 | x = buf[pos]; | 760 | x = buf[pos]; |
759 | if ( x == '/' ) | 761 | if ( x == '/' ) |
760 | { | 762 | { |
761 | start = pos++; | 763 | start = pos++; |
762 | goto Node9; | 764 | goto Node9; |
763 | } | 765 | } |
764 | else if ( x != ':' ) | 766 | else if ( x != ':' ) |
765 | goto NodeErr; | 767 | goto NodeErr; |
766 | pos++; | 768 | pos++; |
767 | 769 | ||
768 | // Node 8a: Accept at least one digit | 770 | // Node 8a: Accept at least one digit |
769 | if ( pos == len ) | 771 | if ( pos == len ) |
770 | goto NodeErr; | 772 | goto NodeErr; |
771 | start = pos; | 773 | start = pos; |
772 | if ( !isdigit( buf[pos++] ) ) | 774 | if ( !buf[pos++].isDigit() ) |
773 | goto NodeErr; | 775 | goto NodeErr; |
774 | 776 | ||
775 | // Node 8b: Accept any amount of digits | 777 | // Node 8b: Accept any amount of digits |
776 | while( pos < len && isdigit( buf[pos] ) ) pos++; | 778 | while( pos < len && buf[pos].isDigit() ) pos++; |
777 | port = QString( buf + start, pos - start ); | 779 | port = QString( buf + start, pos - start ); |
778 | m_iPort = port.toUShort(); | 780 | m_iPort = port.toUShort(); |
779 | if ( pos == len ) | 781 | if ( pos == len ) |
780 | goto NodeOk; | 782 | goto NodeOk; |
781 | start = pos++; | 783 | start = pos++; |
782 | 784 | ||
783 | Node9: // parse path until query or reference reached | 785 | Node9: // parse path until query or reference reached |
784 | 786 | ||
785 | while( pos < len && buf[pos] != '#' && buf[pos]!='?' ) pos++; | 787 | while( pos < len && buf[pos] != '#' && buf[pos]!='?' ) pos++; |
786 | 788 | ||
787 | tmp = QString( buf + start, pos - start ); | 789 | tmp = QString( buf + start, pos - start ); |
788 | //kdDebug(126)<<" setting encoded path&query to:"<<tmp<<endl; | 790 | //kdDebug(126)<<" setting encoded path&query to:"<<tmp<<endl; |
789 | setEncodedPath( tmp, encoding_hint ); | 791 | setEncodedPath( tmp, encoding_hint ); |
790 | 792 | ||
791 | if ( pos == len ) | 793 | if ( pos == len ) |
792 | goto NodeOk; | 794 | goto NodeOk; |
@@ -835,33 +837,33 @@ KURL& KURL::operator=( const QString& _url ) | |||
835 | { | 837 | { |
836 | reset(); | 838 | reset(); |
837 | parse( _url ); | 839 | parse( _url ); |
838 | 840 | ||
839 | return *this; | 841 | return *this; |
840 | } | 842 | } |
841 | 843 | ||
842 | KURL& KURL::operator=( const char * _url ) | 844 | KURL& KURL::operator=( const char * _url ) |
843 | { | 845 | { |
844 | reset(); | 846 | reset(); |
845 | parse( QString::fromLatin1(_url) ); | 847 | parse( QString::fromLatin1(_url) ); |
846 | 848 | ||
847 | return *this; | 849 | return *this; |
848 | } | 850 | } |
849 | 851 | ||
850 | #ifndef QT_NO_NETWORKPROTOCOL | 852 | #ifndef QT_NO_NETWORKPROTOCOL |
851 | KURL& KURL::operator=( const QUrl & u ) | 853 | KURL& KURL::operator=( const Q3Url & u ) |
852 | { | 854 | { |
853 | m_strProtocol = u.protocol(); | 855 | m_strProtocol = u.protocol(); |
854 | m_strUser = u.user(); | 856 | m_strUser = u.user(); |
855 | m_strPass = u.password(); | 857 | m_strPass = u.password(); |
856 | m_strHost = u.host(); | 858 | m_strHost = u.host(); |
857 | m_strPath = u.path( FALSE ); | 859 | m_strPath = u.path( FALSE ); |
858 | m_strPath_encoded = QString::null; | 860 | m_strPath_encoded = QString::null; |
859 | m_strQuery_encoded = u.query(); | 861 | m_strQuery_encoded = u.query(); |
860 | m_strRef_encoded = u.ref(); | 862 | m_strRef_encoded = u.ref(); |
861 | m_bIsMalformed = !u.isValid(); | 863 | m_bIsMalformed = !u.isValid(); |
862 | m_iPort = u.port(); | 864 | m_iPort = u.port(); |
863 | 865 | ||
864 | return *this; | 866 | return *this; |
865 | } | 867 | } |
866 | #endif | 868 | #endif |
867 | 869 | ||
@@ -1361,33 +1363,33 @@ KURL::List KURL::split( const KURL& _url ) | |||
1361 | KURL::List KURL::split( const QString& _url ) | 1363 | KURL::List KURL::split( const QString& _url ) |
1362 | { | 1364 | { |
1363 | return split(KURL(_url)); | 1365 | return split(KURL(_url)); |
1364 | } | 1366 | } |
1365 | 1367 | ||
1366 | KURL KURL::join( const KURL::List & lst ) | 1368 | KURL KURL::join( const KURL::List & lst ) |
1367 | { | 1369 | { |
1368 | if (lst.isEmpty()) return KURL(); | 1370 | if (lst.isEmpty()) return KURL(); |
1369 | KURL tmp; | 1371 | KURL tmp; |
1370 | 1372 | ||
1371 | KURL::List::ConstIterator first = lst.fromLast(); | 1373 | KURL::List::ConstIterator first = lst.fromLast(); |
1372 | for( KURL::List::ConstIterator it = first; it != lst.end(); --it ) | 1374 | for( KURL::List::ConstIterator it = first; it != lst.end(); --it ) |
1373 | { | 1375 | { |
1374 | KURL u(*it); | 1376 | KURL u(*it); |
1375 | if (it != first) | 1377 | if (it != first) |
1376 | { | 1378 | { |
1377 | if (!u.m_strRef_encoded) u.m_strRef_encoded = tmp.url(); | 1379 | if (u.m_strRef_encoded.isEmpty()) u.m_strRef_encoded = tmp.url(); |
1378 | else u.m_strRef_encoded += "#" + tmp.url(); // Support more than one suburl thingy | 1380 | else u.m_strRef_encoded += "#" + tmp.url(); // Support more than one suburl thingy |
1379 | } | 1381 | } |
1380 | tmp = u; | 1382 | tmp = u; |
1381 | } | 1383 | } |
1382 | 1384 | ||
1383 | return tmp; | 1385 | return tmp; |
1384 | } | 1386 | } |
1385 | 1387 | ||
1386 | QString KURL::fileName( bool _strip_trailing_slash ) const | 1388 | QString KURL::fileName( bool _strip_trailing_slash ) const |
1387 | { | 1389 | { |
1388 | QString fname; | 1390 | QString fname; |
1389 | if (hasSubURL()) { // If we have a suburl, then return the filename from there | 1391 | if (hasSubURL()) { // If we have a suburl, then return the filename from there |
1390 | KURL::List list = KURL::split(*this); | 1392 | KURL::List list = KURL::split(*this); |
1391 | KURL::List::Iterator it = list.fromLast(); | 1393 | KURL::List::Iterator it = list.fromLast(); |
1392 | return (*it).fileName(_strip_trailing_slash); | 1394 | return (*it).fileName(_strip_trailing_slash); |
1393 | } | 1395 | } |
@@ -1405,33 +1407,33 @@ QString KURL::fileName( bool _strip_trailing_slash ) const | |||
1405 | else if ( path[ len - 1 ] == '/' ) | 1407 | else if ( path[ len - 1 ] == '/' ) |
1406 | return fname; | 1408 | return fname; |
1407 | 1409 | ||
1408 | // Does the path only consist of '/' characters ? | 1410 | // Does the path only consist of '/' characters ? |
1409 | if ( len == 1 && path[ 0 ] == '/' ) | 1411 | if ( len == 1 && path[ 0 ] == '/' ) |
1410 | return fname; | 1412 | return fname; |
1411 | 1413 | ||
1412 | // Skip last n slashes | 1414 | // Skip last n slashes |
1413 | int n = 1; | 1415 | int n = 1; |
1414 | if (!m_strPath_encoded.isEmpty()) | 1416 | if (!m_strPath_encoded.isEmpty()) |
1415 | { | 1417 | { |
1416 | // This is hairy, we need the last unencoded slash. | 1418 | // This is hairy, we need the last unencoded slash. |
1417 | // Count in the encoded string how many encoded slashes follow the last | 1419 | // Count in the encoded string how many encoded slashes follow the last |
1418 | // unencoded one. | 1420 | // unencoded one. |
1419 | int i = m_strPath_encoded.findRev( '/', len - 1 ); | 1421 | int i = m_strPath_encoded.findRev( '/', len - 1 ); |
1420 | QString fileName_encoded = m_strPath_encoded.mid(i+1); | 1422 | QString fileName_encoded = m_strPath_encoded.mid(i+1); |
1421 | n += fileName_encoded.contains("%2f", false); | 1423 | n += fileName_encoded.count("%2f", Qt::CaseInsensitive); |
1422 | } | 1424 | } |
1423 | int i = len; | 1425 | int i = len; |
1424 | do { | 1426 | do { |
1425 | i = path.findRev( '/', i - 1 ); | 1427 | i = path.findRev( '/', i - 1 ); |
1426 | } | 1428 | } |
1427 | while (--n && (i > 0)); | 1429 | while (--n && (i > 0)); |
1428 | 1430 | ||
1429 | // If ( i == -1 ) => the first character is not a '/' | 1431 | // If ( i == -1 ) => the first character is not a '/' |
1430 | // So it's some URL like file:blah.tgz, return the whole path | 1432 | // So it's some URL like file:blah.tgz, return the whole path |
1431 | if ( i == -1 ) { | 1433 | if ( i == -1 ) { |
1432 | if ( len == (int)path.length() ) | 1434 | if ( len == (int)path.length() ) |
1433 | fname = path; | 1435 | fname = path; |
1434 | else | 1436 | else |
1435 | // Might get here if _strip_trailing_slash is true | 1437 | // Might get here if _strip_trailing_slash is true |
1436 | fname = path.left( len ); | 1438 | fname = path.left( len ); |
1437 | } | 1439 | } |
diff --git a/microkde/kurl.h b/microkde/kurl.h index cd65a1c..016eb24 100644 --- a/microkde/kurl.h +++ b/microkde/kurl.h | |||
@@ -8,35 +8,37 @@ | |||
8 | * | 8 | * |
9 | * This library is distributed in the hope that it will be useful, | 9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. | 12 | * Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to | 15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. | 17 | * Boston, MA 02111-1307, USA. |
18 | **/ | 18 | **/ |
19 | 19 | ||
20 | #ifndef __kurl_h__ | 20 | #ifndef __kurl_h__ |
21 | #define __kurl_h__ "$Id$" | 21 | #define __kurl_h__ "$Id$" |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qvaluelist.h> | 24 | #include <q3valuelist.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | class QUrl; | 28 | class Q3Url; |
27 | class QStringList; | 29 | class QStringList; |
28 | template <typename K, typename V> class QMap; | 30 | template <typename K, typename V> class QMap; |
29 | 31 | ||
30 | class KURLPrivate; | 32 | class KURLPrivate; |
31 | /** | 33 | /** |
32 | * Represents and parses a URL. | 34 | * Represents and parses a URL. |
33 | * | 35 | * |
34 | * A prototypical URL looks like: | 36 | * A prototypical URL looks like: |
35 | * <pre> | 37 | * <pre> |
36 | * protocol:/user:password\@hostname:port/path/to/file.ext#reference | 38 | * protocol:/user:password\@hostname:port/path/to/file.ext#reference |
37 | * </pre> | 39 | * </pre> |
38 | * | 40 | * |
39 | * KURL has some restrictions regarding the path | 41 | * KURL has some restrictions regarding the path |
40 | * encoding. KURL works internally with the decoded path and | 42 | * encoding. KURL works internally with the decoded path and |
41 | * and encoded query. For example, | 43 | * and encoded query. For example, |
42 | * <pre> | 44 | * <pre> |
@@ -51,33 +53,33 @@ class KURLPrivate; | |||
51 | */ | 53 | */ |
52 | class KURL | 54 | class KURL |
53 | { | 55 | { |
54 | public: | 56 | public: |
55 | enum AdjustementFlags | 57 | enum AdjustementFlags |
56 | { | 58 | { |
57 | NoAdjustements = 0, | 59 | NoAdjustements = 0, |
58 | StripFileProtocol = 1 | 60 | StripFileProtocol = 1 |
59 | }; | 61 | }; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * KURL::List is a QValueList that contains KURLs with a few | 64 | * KURL::List is a QValueList that contains KURLs with a few |
63 | * convenience methods. | 65 | * convenience methods. |
64 | * @see KURL | 66 | * @see KURL |
65 | * @see QValueList | 67 | * @see QValueList |
66 | */ | 68 | */ |
67 | class List : public QValueList<KURL> | 69 | class List : public Q3ValueList<KURL> |
68 | { | 70 | { |
69 | public: | 71 | public: |
70 | /** | 72 | /** |
71 | * Creates an empty List. | 73 | * Creates an empty List. |
72 | */ | 74 | */ |
73 | List() { } | 75 | List() { } |
74 | /** | 76 | /** |
75 | * Creates a list that contains the given URL as only | 77 | * Creates a list that contains the given URL as only |
76 | * item. | 78 | * item. |
77 | * @param url the url to add. | 79 | * @param url the url to add. |
78 | */ | 80 | */ |
79 | List(const KURL &url); | 81 | List(const KURL &url); |
80 | /** | 82 | /** |
81 | * Creates a list that contains the URLs from the given | 83 | * Creates a list that contains the URLs from the given |
82 | * list. | 84 | * list. |
83 | * @param list the list containing the URLs as strings | 85 | * @param list the list containing the URLs as strings |
@@ -122,43 +124,43 @@ public: | |||
122 | * then URL, in its encoded form, is strictly ascii. | 124 | * then URL, in its encoded form, is strictly ascii. |
123 | * @param url A encoded URL. If the URL does not have a protocol part, | 125 | * @param url A encoded URL. If the URL does not have a protocol part, |
124 | * "file:" is assumed. | 126 | * "file:" is assumed. |
125 | * @param encoding_hint MIB of original encoding of URL. | 127 | * @param encoding_hint MIB of original encoding of URL. |
126 | * @see QTextCodec::mibEnum() | 128 | * @see QTextCodec::mibEnum() |
127 | */ | 129 | */ |
128 | KURL( const char * url, int encoding_hint = 0 ); | 130 | KURL( const char * url, int encoding_hint = 0 ); |
129 | /** | 131 | /** |
130 | * Constructor taking a QCString @p url, which is an _encoded_ representation | 132 | * Constructor taking a QCString @p url, which is an _encoded_ representation |
131 | * of the URL, exactly like the usual constructor. This is useful when | 133 | * of the URL, exactly like the usual constructor. This is useful when |
132 | * then URL, in its encoded form, is strictly ascii. | 134 | * then URL, in its encoded form, is strictly ascii. |
133 | * @param url A encoded URL. If the URL does not have a protocol part, | 135 | * @param url A encoded URL. If the URL does not have a protocol part, |
134 | * "file:" is assumed. | 136 | * "file:" is assumed. |
135 | * @param encoding_hint MIB of original encoding of URL. | 137 | * @param encoding_hint MIB of original encoding of URL. |
136 | * @see QTextCodec::mibEnum() | 138 | * @see QTextCodec::mibEnum() |
137 | */ | 139 | */ |
138 | KURL( const QCString& url, int encoding_hint = 0 ); | 140 | KURL( const Q3CString& url, int encoding_hint = 0 ); |
139 | /** | 141 | /** |
140 | * Copy constructor. | 142 | * Copy constructor. |
141 | * @param u the KURL to copy | 143 | * @param u the KURL to copy |
142 | */ | 144 | */ |
143 | KURL( const KURL& u ); | 145 | KURL( const KURL& u ); |
144 | /** | 146 | /** |
145 | * Converts from a @ref QUrl. | 147 | * Converts from a @ref QUrl. |
146 | * @param u the QUrl | 148 | * @param u the QUrl |
147 | */ | 149 | */ |
148 | KURL( const QUrl &u ); | 150 | KURL( const Q3Url &u ); |
149 | /** | 151 | /** |
150 | * Constructor allowing relative URLs. | 152 | * Constructor allowing relative URLs. |
151 | * | 153 | * |
152 | * @param _baseurl The base url. | 154 | * @param _baseurl The base url. |
153 | * @param _rel_url A relative or absolute URL. | 155 | * @param _rel_url A relative or absolute URL. |
154 | * If this is an absolute URL then @p _baseurl will be ignored. | 156 | * If this is an absolute URL then @p _baseurl will be ignored. |
155 | * If this is a relative URL it will be combined with @p _baseurl. | 157 | * If this is a relative URL it will be combined with @p _baseurl. |
156 | * Note that _rel_url should be encoded too, in any case. | 158 | * Note that _rel_url should be encoded too, in any case. |
157 | * So do NOT pass a path here (use setPath or addPath instead). | 159 | * So do NOT pass a path here (use setPath or addPath instead). |
158 | * @param encoding_hint MIB of original encoding of URL. | 160 | * @param encoding_hint MIB of original encoding of URL. |
159 | * @see QTextCodec::mibEnum() | 161 | * @see QTextCodec::mibEnum() |
160 | */ | 162 | */ |
161 | KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 ); | 163 | KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 ); |
162 | 164 | ||
163 | /** | 165 | /** |
164 | * Returns the protocol for the URL (i.e., file, http, etc.). | 166 | * Returns the protocol for the URL (i.e., file, http, etc.). |
@@ -645,33 +647,33 @@ public: | |||
645 | **/ | 647 | **/ |
646 | bool isEmpty() const; | 648 | bool isEmpty() const; |
647 | 649 | ||
648 | /** | 650 | /** |
649 | * This function is useful to implement the "Up" button in a file manager for example. | 651 | * This function is useful to implement the "Up" button in a file manager for example. |
650 | * @ref cd() never strips a sub-protocol. That means that if you are in | 652 | * @ref cd() never strips a sub-protocol. That means that if you are in |
651 | * file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see | 653 | * file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see |
652 | * file:/home. The algorithm tries to go up on the right-most URL. If that is not | 654 | * file:/home. The algorithm tries to go up on the right-most URL. If that is not |
653 | * possible it strips the right most URL. It continues stripping URLs. | 655 | * possible it strips the right most URL. It continues stripping URLs. |
654 | * @return a URL that is a level higher | 656 | * @return a URL that is a level higher |
655 | */ | 657 | */ |
656 | KURL upURL( ) const; | 658 | KURL upURL( ) const; |
657 | 659 | ||
658 | KURL& operator=( const KURL& _u ); | 660 | KURL& operator=( const KURL& _u ); |
659 | KURL& operator=( const QString& _url ); | 661 | KURL& operator=( const QString& _url ); |
660 | KURL& operator=( const char * _url ); | 662 | KURL& operator=( const char * _url ); |
661 | KURL& operator=( const QUrl & u ); | 663 | KURL& operator=( const Q3Url & u ); |
662 | 664 | ||
663 | bool operator==( const KURL& _u ) const; | 665 | bool operator==( const KURL& _u ) const; |
664 | bool operator==( const QString& _u ) const; | 666 | bool operator==( const QString& _u ) const; |
665 | bool operator!=( const KURL& _u ) const { return !( *this == _u ); } | 667 | bool operator!=( const KURL& _u ) const { return !( *this == _u ); } |
666 | bool operator!=( const QString& _u ) const { return !( *this == _u ); } | 668 | bool operator!=( const QString& _u ) const { return !( *this == _u ); } |
667 | 669 | ||
668 | /** | 670 | /** |
669 | * The same as equals(), just with a less obvious name. | 671 | * The same as equals(), just with a less obvious name. |
670 | * Compares this url with @p u. | 672 | * Compares this url with @p u. |
671 | * @param ignore_trailing set to true to ignore trailing '/' characters. | 673 | * @param ignore_trailing set to true to ignore trailing '/' characters. |
672 | * @return true if both urls are the same | 674 | * @return true if both urls are the same |
673 | * @see operator==. This function should be used if you want to | 675 | * @see operator==. This function should be used if you want to |
674 | * ignore trailing '/' characters. | 676 | * ignore trailing '/' characters. |
675 | * @deprecated | 677 | * @deprecated |
676 | */ | 678 | */ |
677 | bool cmp( const KURL &u, bool ignore_trailing = false ) const; | 679 | bool cmp( const KURL &u, bool ignore_trailing = false ) const; |
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp index 9c87682..88f17e5 100644 --- a/microkde/kutils/kcmultidialog.cpp +++ b/microkde/kutils/kcmultidialog.cpp | |||
@@ -6,36 +6,38 @@ | |||
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qhbox.h> | 22 | #include <q3hbox.h> |
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | //Added by qt3to4: | ||
27 | #include <QPixmap> | ||
26 | 28 | ||
27 | #include <klocale.h> | 29 | #include <klocale.h> |
28 | #include <kglobal.h> | 30 | #include <kglobal.h> |
29 | #include <kdebug.h> | 31 | #include <kdebug.h> |
30 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
31 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
32 | //US #include <klibloader.h> | 34 | //US #include <klibloader.h> |
33 | #include <krun.h> | 35 | #include <krun.h> |
34 | #include <kprocess.h> | 36 | #include <kprocess.h> |
35 | #include <kglobalsettings.h> | 37 | #include <kglobalsettings.h> |
36 | 38 | ||
37 | #include "kcmultidialog.h" | 39 | #include "kcmultidialog.h" |
38 | //US #include "kcmultidialog.moc" | 40 | //US #include "kcmultidialog.moc" |
39 | //US #include "kcmoduleloader.h" | 41 | //US #include "kcmoduleloader.h" |
40 | 42 | ||
41 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) | 43 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) |
@@ -60,65 +62,65 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch | |||
60 | setMaximumSize( 800, 800 ); | 62 | setMaximumSize( 800, 800 ); |
61 | //showMaximized(); | 63 | //showMaximized(); |
62 | #endif | 64 | #endif |
63 | 65 | ||
64 | } | 66 | } |
65 | 67 | ||
66 | KCMultiDialog::~KCMultiDialog() | 68 | KCMultiDialog::~KCMultiDialog() |
67 | { | 69 | { |
68 | //US moduleDict.setAutoDelete(true); | 70 | //US moduleDict.setAutoDelete(true); |
69 | } | 71 | } |
70 | 72 | ||
71 | void KCMultiDialog::slotDefault() | 73 | void KCMultiDialog::slotDefault() |
72 | { | 74 | { |
73 | 75 | ||
74 | int curPageIndex = activePageIndex(); | 76 | int curPageIndex = activePageIndex(); |
75 | 77 | ||
76 | QPtrListIterator<KCModule> it(modules); | 78 | Q3PtrListIterator<KCModule> it(modules); |
77 | for (; it.current(); ++it) | 79 | for (; it.current(); ++it) |
78 | { | 80 | { |
79 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) | 81 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) |
80 | { | 82 | { |
81 | (*it)->defaults(); | 83 | (*it)->defaults(); |
82 | clientChanged(true); | 84 | clientChanged(true); |
83 | return; | 85 | return; |
84 | } | 86 | } |
85 | } | 87 | } |
86 | 88 | ||
87 | } | 89 | } |
88 | void KCMultiDialog::accept() | 90 | void KCMultiDialog::accept() |
89 | { | 91 | { |
90 | slotOk(); | 92 | slotOk(); |
91 | } | 93 | } |
92 | void KCMultiDialog::slotApply() | 94 | void KCMultiDialog::slotApply() |
93 | { | 95 | { |
94 | QPtrListIterator<KCModule> it(modules); | 96 | Q3PtrListIterator<KCModule> it(modules); |
95 | for (; it.current(); ++it) | 97 | for (; it.current(); ++it) |
96 | (*it)->save(); | 98 | (*it)->save(); |
97 | clientChanged(false); | 99 | clientChanged(false); |
98 | 100 | ||
99 | emit applyClicked(); | 101 | emit applyClicked(); |
100 | 102 | ||
101 | } | 103 | } |
102 | 104 | ||
103 | 105 | ||
104 | void KCMultiDialog::slotOk() | 106 | void KCMultiDialog::slotOk() |
105 | { | 107 | { |
106 | qDebug("KCMultiDialog::slotOk clicked"); | 108 | qDebug("KCMultiDialog::slotOk clicked"); |
107 | 109 | ||
108 | QPtrListIterator<KCModule> it(modules); | 110 | Q3PtrListIterator<KCModule> it(modules); |
109 | for (; it.current(); ++it) | 111 | for (; it.current(); ++it) |
110 | (*it)->save(); | 112 | (*it)->save(); |
111 | QDialog::accept(); | 113 | QDialog::accept(); |
112 | 114 | ||
113 | emit okClicked(); | 115 | emit okClicked(); |
114 | } | 116 | } |
115 | 117 | ||
116 | void KCMultiDialog::slotHelp() | 118 | void KCMultiDialog::slotHelp() |
117 | { | 119 | { |
118 | /*US | 120 | /*US |
119 | KURL url( KURL("help:/"), _docPath ); | 121 | KURL url( KURL("help:/"), _docPath ); |
120 | 122 | ||
121 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { | 123 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { |
122 | KProcess process; | 124 | KProcess process; |
123 | process << "khelpcenter" | 125 | process << "khelpcenter" |
124 | << url.url(); | 126 | << url.url(); |
@@ -140,35 +142,35 @@ void KCMultiDialog::addModule(const QString& path, bool withfallback) | |||
140 | { | 142 | { |
141 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; | 143 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; |
142 | 144 | ||
143 | KCModuleInfo info(path, _baseGroup); | 145 | KCModuleInfo info(path, _baseGroup); |
144 | 146 | ||
145 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), | 147 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), |
146 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); | 148 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); |
147 | if(!page) { | 149 | if(!page) { |
148 | KCModuleLoader::unloadModule(info); | 150 | KCModuleLoader::unloadModule(info); |
149 | return; | 151 | return; |
150 | } | 152 | } |
151 | moduleDict.insert(page, new LoadInfo(path, withfallback)); | 153 | moduleDict.insert(page, new LoadInfo(path, withfallback)); |
152 | if (modules.isEmpty()) | 154 | if (modules.isEmpty()) |
153 | slotAboutToShow(page); | 155 | slotAboutToShow(page); |
154 | } | 156 | } |
155 | */ | 157 | */ |
156 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) | 158 | Q3VBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) |
157 | { | 159 | { |
158 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); | 160 | Q3VBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); |
159 | return page; | 161 | return page; |
160 | 162 | ||
161 | } | 163 | } |
162 | //US special method for microkde. We dop noty want to load everything dynamically. | 164 | //US special method for microkde. We dop noty want to load everything dynamically. |
163 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) | 165 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) |
164 | { | 166 | { |
165 | 167 | ||
166 | modules.append(module); | 168 | modules.append(module); |
167 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 169 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
168 | //US | 170 | //US |
169 | module->load(); | 171 | module->load(); |
170 | 172 | ||
171 | 173 | ||
172 | } | 174 | } |
173 | 175 | ||
174 | void KCMultiDialog::slotAboutToShow(QWidget *page) | 176 | void KCMultiDialog::slotAboutToShow(QWidget *page) |
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h index 66412ac..78f8a00 100644 --- a/microkde/kutils/kcmultidialog.h +++ b/microkde/kutils/kcmultidialog.h | |||
@@ -9,34 +9,34 @@ | |||
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef KCMULTIDIALOG_H | 22 | #ifndef KCMULTIDIALOG_H |
23 | #define KCMULTIDIALOG_H | 23 | #define KCMULTIDIALOG_H |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | #include <qptrdict.h> | 26 | #include <q3ptrdict.h> |
27 | 27 | ||
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
29 | #include <kjanuswidget.h> | 29 | #include <kjanuswidget.h> |
30 | #include <kcmodule.h> | 30 | #include <kcmodule.h> |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules | 33 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules |
34 | * | 34 | * |
35 | * @short A method that offers a @ref KDialogBase containing arbitrary | 35 | * @short A method that offers a @ref KDialogBase containing arbitrary |
36 | * KControl Modules. | 36 | * KControl Modules. |
37 | * | 37 | * |
38 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> | 38 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> |
39 | * @since 3.2 | 39 | * @since 3.2 |
40 | */ | 40 | */ |
41 | class KCMultiDialog : public KDialogBase | 41 | class KCMultiDialog : public KDialogBase |
42 | { | 42 | { |
@@ -62,33 +62,33 @@ public: | |||
62 | virtual ~KCMultiDialog(); | 62 | virtual ~KCMultiDialog(); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Add a module. | 65 | * Add a module. |
66 | * | 66 | * |
67 | * @param module Specify the name of the module that is to be added | 67 | * @param module Specify the name of the module that is to be added |
68 | * to the list of modules the dialog will show. | 68 | * to the list of modules the dialog will show. |
69 | * | 69 | * |
70 | * @param withfallback Try harder to load the module. Might result | 70 | * @param withfallback Try harder to load the module. Might result |
71 | * in the module appearing outside the dialog. | 71 | * in the module appearing outside the dialog. |
72 | **/ | 72 | **/ |
73 | //US void addModule(const QString& module, bool withfallback=true); | 73 | //US void addModule(const QString& module, bool withfallback=true); |
74 | 74 | ||
75 | 75 | ||
76 | //US special method for microkde. We do not want to load everything dynamically. | 76 | //US special method for microkde. We do not want to load everything dynamically. |
77 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); | 77 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); |
78 | QVBox* getNewVBoxPage(const QString & modulename) ; | 78 | Q3VBox* getNewVBoxPage(const QString & modulename) ; |
79 | 79 | ||
80 | 80 | ||
81 | bool showPage( int index ); | 81 | bool showPage( int index ); |
82 | int activePageIndex() const; | 82 | int activePageIndex() const; |
83 | int pageIndex( QWidget *widget ) const; | 83 | int pageIndex( QWidget *widget ) const; |
84 | 84 | ||
85 | protected slots: | 85 | protected slots: |
86 | /** | 86 | /** |
87 | * This slot is called when the user presses the "Default" Button | 87 | * This slot is called when the user presses the "Default" Button |
88 | * You can reimplement it if needed. | 88 | * You can reimplement it if needed. |
89 | * | 89 | * |
90 | * @note Make sure you call the original implementation! | 90 | * @note Make sure you call the original implementation! |
91 | **/ | 91 | **/ |
92 | virtual void slotDefault(); | 92 | virtual void slotDefault(); |
93 | 93 | ||
94 | /** | 94 | /** |
@@ -120,32 +120,32 @@ protected slots: | |||
120 | private slots: | 120 | private slots: |
121 | 121 | ||
122 | void slotAboutToShow(QWidget *); | 122 | void slotAboutToShow(QWidget *); |
123 | 123 | ||
124 | void clientChanged(bool state); | 124 | void clientChanged(bool state); |
125 | 125 | ||
126 | private: | 126 | private: |
127 | /*US | 127 | /*US |
128 | struct LoadInfo { | 128 | struct LoadInfo { |
129 | LoadInfo(const QString &_path, bool _withfallback) | 129 | LoadInfo(const QString &_path, bool _withfallback) |
130 | : path(_path), withfallback(_withfallback) | 130 | : path(_path), withfallback(_withfallback) |
131 | { } | 131 | { } |
132 | QString path; | 132 | QString path; |
133 | bool withfallback; | 133 | bool withfallback; |
134 | }; | 134 | }; |
135 | */ | 135 | */ |
136 | QPtrList<KCModule> modules; | 136 | Q3PtrList<KCModule> modules; |
137 | /* | 137 | /* |
138 | QPtrDict<LoadInfo> moduleDict; | 138 | QPtrDict<LoadInfo> moduleDict; |
139 | QString _docPath; | 139 | QString _docPath; |
140 | */ | 140 | */ |
141 | QString _baseGroup; | 141 | QString _baseGroup; |
142 | 142 | ||
143 | //US | 143 | //US |
144 | KJanusWidget* mMainWidget; | 144 | KJanusWidget* mMainWidget; |
145 | 145 | ||
146 | // For future use | 146 | // For future use |
147 | class KCMultiDialogPrivate; | 147 | class KCMultiDialogPrivate; |
148 | KCMultiDialogPrivate *d; | 148 | KCMultiDialogPrivate *d; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | #endif //KCMULTIDIALOG_H | 151 | #endif //KCMULTIDIALOG_H |
diff --git a/microkde/microkde.pro b/microkde/microkde.pro index 7120bdd..4ff06a3 100644 --- a/microkde/microkde.pro +++ b/microkde/microkde.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | include( ../variables.pri ) | 3 | include( ../variables.pri ) |
4 | #INCLUDEPATH += $(QTDIR)/include . | 4 | #INCLUDEPATH += $(QTDIR)/include . |
5 | #DEPENDPATH += $(QTDIR)/include | 5 | #DEPENDPATH += $(QTDIR)/include |
6 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio | 6 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio |
7 | #LIBS += -lqtcompat | 7 | #LIBS += -lqtcompat |
8 | 8 | ||
9 | TARGET = microkde | 9 | TARGET = xmicrokde |
10 | DESTDIR= ../bin | 10 | DESTDIR= ../bin |
11 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY | 11 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY |
12 | unix : { | 12 | unix : { |
13 | staticlib: { | 13 | staticlib: { |
14 | INCLUDEPATH += ../kabc/plugins | 14 | INCLUDEPATH += ../kabc/plugins |
15 | DEFINES += STATIC_RESOURCES | 15 | DEFINES += STATIC_RESOURCES |
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | OBJECTS_DIR = obj/unix | 19 | OBJECTS_DIR = obj/unix |
20 | MOC_DIR = moc/unix | 20 | MOC_DIR = moc/unix |
21 | } | 21 | } |
22 | win32: { | 22 | win32: { |
23 | DEFINES += _WIN32_ | 23 | DEFINES += _WIN32_ |
24 | OBJECTS_DIR = obj/win | 24 | OBJECTS_DIR = obj/win |
25 | MOC_DIR = moc/win | 25 | MOC_DIR = moc/win |
@@ -165,16 +165,18 @@ KDGanttMinimizeSplitter.cpp \ | |||
165 | kresources/resource.cpp \ | 165 | kresources/resource.cpp \ |
166 | kresources/selectdialog.cpp \ | 166 | kresources/selectdialog.cpp \ |
167 | kutils/kcmultidialog.cpp \ | 167 | kutils/kcmultidialog.cpp \ |
168 | kdeui/kaction.cpp \ | 168 | kdeui/kaction.cpp \ |
169 | kdeui/kpopupmenu.cpp \ | 169 | kdeui/kpopupmenu.cpp \ |
170 | kdeui/kactionclasses.cpp \ | 170 | kdeui/kactionclasses.cpp \ |
171 | kdeui/kactioncollection.cpp \ | 171 | kdeui/kactioncollection.cpp \ |
172 | kdeui/kmainwindow.cpp \ | 172 | kdeui/kmainwindow.cpp \ |
173 | kdeui/ktoolbar.cpp \ | 173 | kdeui/ktoolbar.cpp \ |
174 | kdeui/ktoolbarbutton.cpp \ | 174 | kdeui/ktoolbarbutton.cpp \ |
175 | kdeui/ktoolbarhandler.cpp \ | 175 | kdeui/ktoolbarhandler.cpp \ |
176 | kdeui/kstdaction.cpp \ | 176 | kdeui/kstdaction.cpp \ |
177 | kdeui/kxmlguiclient.cpp \ | 177 | kdeui/kxmlguiclient.cpp \ |
178 | kdecore/kprefs.cpp \ | 178 | kdecore/kprefs.cpp \ |
179 | kdecore/klibloader.cpp \ | 179 | kdecore/klibloader.cpp \ |
180 | kidmanager.cpp | 180 | kidmanager.cpp |
181 | #The following line was inserted by qt3to4 | ||
182 | QT += xml qt3support | ||
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index 8fe2bd5..514e7b3 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro | |||
@@ -1,26 +1,26 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include | 3 | INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include |
4 | 4 | ||
5 | DEPENDPATH += $(QPEDIR)/include | 5 | DEPENDPATH += $(QPEDIR)/include |
6 | LIBS += -lmicroqtcompat -L$(QPEDIR)/lib | 6 | LIBS += -lmicroqtcompat -L$(QPEDIR)/lib |
7 | 7 | ||
8 | DEFINES += KDE_QT_ONLY | 8 | DEFINES += KDE_QT_ONLY |
9 | 9 | ||
10 | TARGET = microkde | 10 | TARGET = xmicrokde |
11 | OBJECTS_DIR = obj/$(PLATFORM) | 11 | OBJECTS_DIR = obj/$(PLATFORM) |
12 | MOC_DIR = moc/$(PLATFORM) | 12 | MOC_DIR = moc/$(PLATFORM) |
13 | DESTDIR=$(QPEDIR)/lib | 13 | DESTDIR=$(QPEDIR)/lib |
14 | 14 | ||
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | qlayoutengine_p.h fncolordialog.h\ | 19 | qlayoutengine_p.h fncolordialog.h\ |
20 | KDGanttMinimizeSplitter.h \ | 20 | KDGanttMinimizeSplitter.h \ |
21 | kapplication.h \ | 21 | kapplication.h \ |
22 | kaudioplayer.h \ | 22 | kaudioplayer.h \ |
23 | kcalendarsystem.h \ | 23 | kcalendarsystem.h \ |
24 | kcalendarsystemgregorian.h \ | 24 | kcalendarsystemgregorian.h \ |
25 | kcolorbutton.h \ | 25 | kcolorbutton.h \ |
26 | kcolordialog.h \ | 26 | kcolordialog.h \ |
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp index f4f112e..0f95c84 100644 --- a/microkde/ofileselector_p.cpp +++ b/microkde/ofileselector_p.cpp | |||
@@ -252,33 +252,33 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st | |||
252 | 252 | ||
253 | m_btnNew = new QToolButton( box ); | 253 | m_btnNew = new QToolButton( box ); |
254 | m_btnNew->setIconSet( Resource::loadPixmap("new") ); | 254 | m_btnNew->setIconSet( Resource::loadPixmap("new") ); |
255 | connect(m_btnNew, SIGNAL(clicked() ), | 255 | connect(m_btnNew, SIGNAL(clicked() ), |
256 | this, SLOT(slotNew() ) ); | 256 | this, SLOT(slotNew() ) ); |
257 | 257 | ||
258 | 258 | ||
259 | m_btnClose = new QToolButton( box ); | 259 | m_btnClose = new QToolButton( box ); |
260 | m_btnClose->setIconSet( Resource::loadPixmap("close") ); | 260 | m_btnClose->setIconSet( Resource::loadPixmap("close") ); |
261 | connect(m_btnClose, SIGNAL(clicked() ), | 261 | connect(m_btnClose, SIGNAL(clicked() ), |
262 | selector(), SIGNAL(closeMe() ) ); | 262 | selector(), SIGNAL(closeMe() ) ); |
263 | 263 | ||
264 | btn = new QToolButton( box ); | 264 | btn = new QToolButton( box ); |
265 | btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); | 265 | btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); |
266 | 266 | ||
267 | /* let's fill device parts */ | 267 | /* let's fill device parts */ |
268 | QPopupMenu* pop = new QPopupMenu(this); | 268 | Q3PopupMenu* pop = new Q3PopupMenu(this); |
269 | connect(pop, SIGNAL( activated(int) ), | 269 | connect(pop, SIGNAL( activated(int) ), |
270 | this, SLOT(slotFSActivated(int) ) ); | 270 | this, SLOT(slotFSActivated(int) ) ); |
271 | 271 | ||
272 | StorageInfo storage; | 272 | StorageInfo storage; |
273 | const QList<FileSystem> &fs = storage.fileSystems(); | 273 | const QList<FileSystem> &fs = storage.fileSystems(); |
274 | QListIterator<FileSystem> it(fs); | 274 | QListIterator<FileSystem> it(fs); |
275 | for ( ; it.current(); ++it ) { | 275 | for ( ; it.current(); ++it ) { |
276 | const QString disk = (*it)->name(); | 276 | const QString disk = (*it)->name(); |
277 | const QString path = (*it)->path(); | 277 | const QString path = (*it)->path(); |
278 | m_dev.insert( disk, path ); | 278 | m_dev.insert( disk, path ); |
279 | pop->insertItem( disk ); | 279 | pop->insertItem( disk ); |
280 | } | 280 | } |
281 | m_fsPop = pop; | 281 | m_fsPop = pop; |
282 | 282 | ||
283 | 283 | ||
284 | btn->setPopup( pop ); | 284 | btn->setPopup( pop ); |
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h index 834fd70..a7d97fe 100644 --- a/microkde/ofileselector_p.h +++ b/microkde/ofileselector_p.h | |||
@@ -124,33 +124,33 @@ private slots: | |||
124 | void cdHome(); | 124 | void cdHome(); |
125 | void cdDoc(); | 125 | void cdDoc(); |
126 | void changeDir( const QString& ); | 126 | void changeDir( const QString& ); |
127 | void slotCurrentChanged( QListViewItem* ); | 127 | void slotCurrentChanged( QListViewItem* ); |
128 | void slotClicked(int, QListViewItem*, const QPoint&, int ); | 128 | void slotClicked(int, QListViewItem*, const QPoint&, int ); |
129 | void slotDoubleClicked(QListViewItem*); | 129 | void slotDoubleClicked(QListViewItem*); |
130 | void slotFSActivated(int); | 130 | void slotFSActivated(int); |
131 | 131 | ||
132 | protected: | 132 | protected: |
133 | 133 | ||
134 | OFileSelector* selector(); | 134 | OFileSelector* selector(); |
135 | 135 | ||
136 | private: | 136 | private: |
137 | QMap<QString, QString> m_dev; | 137 | QMap<QString, QString> m_dev; |
138 | bool m_all : 1; | 138 | bool m_all : 1; |
139 | OFileSelector* m_sel; | 139 | OFileSelector* m_sel; |
140 | QPopupMenu* m_fsPop; | 140 | Q3PopupMenu* m_fsPop; |
141 | bool compliesMime( const QString& ); | 141 | bool compliesMime( const QString& ); |
142 | QStringList m_mimes; // used in compy mime | 142 | QStringList m_mimes; // used in compy mime |
143 | QString m_currentDir; | 143 | QString m_currentDir; |
144 | QToolButton *m_btnNew, *m_btnClose; | 144 | QToolButton *m_btnNew, *m_btnClose; |
145 | void connectSlots(); | 145 | void connectSlots(); |
146 | void addFile( QFileInfo* info, bool symlink = FALSE ); | 146 | void addFile( QFileInfo* info, bool symlink = FALSE ); |
147 | void addDir ( QFileInfo* info, bool symlink = FALSE ); | 147 | void addDir ( QFileInfo* info, bool symlink = FALSE ); |
148 | void addSymlink( QFileInfo* info, bool = FALSE ); | 148 | void addSymlink( QFileInfo* info, bool = FALSE ); |
149 | 149 | ||
150 | 150 | ||
151 | private: | 151 | private: |
152 | QListView* m_view; | 152 | QListView* m_view; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | typedef QMap<QString, QStringList> MimeTypes; | 155 | typedef QMap<QString, QStringList> MimeTypes; |
156 | 156 | ||
diff --git a/microkde/qlayoutengine_p.h b/microkde/qlayoutengine_p.h index 2d6a556..e782703 100644 --- a/microkde/qlayoutengine_p.h +++ b/microkde/qlayoutengine_p.h | |||
@@ -1,16 +1,18 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3MemArray> | ||
1 | // THIS IS A COPY OF THE FILE FOUND IN $QTDIR/src/kernel. Needed to modify qsplitter | 3 | // THIS IS A COPY OF THE FILE FOUND IN $QTDIR/src/kernel. Needed to modify qsplitter |
2 | 4 | ||
3 | /**************************************************************************** | 5 | /**************************************************************************** |
4 | ** $Id$ | 6 | ** $Id$ |
5 | ** | 7 | ** |
6 | ** Internal header file. | 8 | ** Internal header file. |
7 | ** | 9 | ** |
8 | ** Created : 981027 | 10 | ** Created : 981027 |
9 | ** | 11 | ** |
10 | ** Copyright (C) 1998-99 by Trolltech AS. All rights reserved. | 12 | ** Copyright (C) 1998-99 by Trolltech AS. All rights reserved. |
11 | ** | 13 | ** |
12 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 14 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
13 | ** | 15 | ** |
14 | ** This file may be distributed under the terms of the Q Public License | 16 | ** This file may be distributed under the terms of the Q Public License |
15 | ** as defined by Trolltech AS of Norway and appearing in the file | 17 | ** as defined by Trolltech AS of Norway and appearing in the file |
16 | ** LICENSE.QPL included in the packaging of this file. | 18 | ** LICENSE.QPL included in the packaging of this file. |
@@ -42,59 +44,55 @@ | |||
42 | 44 | ||
43 | 45 | ||
44 | // | 46 | // |
45 | // W A R N I N G | 47 | // W A R N I N G |
46 | // ------------- | 48 | // ------------- |
47 | // | 49 | // |
48 | // This file is not part of the Qt API. It exists for the convenience | 50 | // This file is not part of the Qt API. It exists for the convenience |
49 | // of qlayout.cpp, qlayoutengine.cpp, qmainwindow.cpp and qsplitter.cpp. | 51 | // of qlayout.cpp, qlayoutengine.cpp, qmainwindow.cpp and qsplitter.cpp. |
50 | // This header file may change from version to version without notice, | 52 | // This header file may change from version to version without notice, |
51 | // or even be removed. | 53 | // or even be removed. |
52 | // | 54 | // |
53 | // We mean it. | 55 | // We mean it. |
54 | // | 56 | // |
55 | // | 57 | // |
56 | 58 | ||
57 | 59 | ||
58 | #ifndef QT_H | ||
59 | #include "qabstractlayout.h" | ||
60 | #endif // QT_H | ||
61 | |||
62 | #ifndef QT_NO_LAYOUT | 60 | #ifndef QT_NO_LAYOUT |
63 | struct QLayoutStruct | 61 | struct QLayoutStruct |
64 | { | 62 | { |
65 | void initParameters() { minimumSize = sizeHint = 0; | 63 | void initParameters() { minimumSize = sizeHint = 0; |
66 | maximumSize = QWIDGETSIZE_MAX; expansive = FALSE; empty = TRUE; } | 64 | maximumSize = QWIDGETSIZE_MAX; expansive = FALSE; empty = TRUE; } |
67 | void init() { stretch = 0; initParameters(); } | 65 | void init() { stretch = 0; initParameters(); } |
68 | //permanent storage: | 66 | //permanent storage: |
69 | int stretch; | 67 | int stretch; |
70 | //parameters: | 68 | //parameters: |
71 | QCOORD sizeHint; | 69 | QCOORD sizeHint; |
72 | QCOORD maximumSize; | 70 | QCOORD maximumSize; |
73 | QCOORD minimumSize; | 71 | QCOORD minimumSize; |
74 | bool expansive; | 72 | bool expansive; |
75 | bool empty; | 73 | bool empty; |
76 | //temporary storage: | 74 | //temporary storage: |
77 | bool done; | 75 | bool done; |
78 | //result: | 76 | //result: |
79 | int pos; | 77 | int pos; |
80 | int size; | 78 | int size; |
81 | }; | 79 | }; |
82 | 80 | ||
83 | 81 | ||
84 | void qGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, | 82 | void qGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos, |
85 | int space, int spacer ); | 83 | int space, int spacer ); |
86 | 84 | ||
87 | 85 | ||
88 | 86 | ||
89 | /* | 87 | /* |
90 | Modify total maximum (max) and total expansion (exp) | 88 | Modify total maximum (max) and total expansion (exp) |
91 | when adding boxmax/boxexp. | 89 | when adding boxmax/boxexp. |
92 | 90 | ||
93 | Expansive boxes win over non-expansive boxes. | 91 | Expansive boxes win over non-expansive boxes. |
94 | */ | 92 | */ |
95 | static inline void qMaxExpCalc( QCOORD & max, bool &exp, | 93 | static inline void qMaxExpCalc( QCOORD & max, bool &exp, |
96 | QCOORD boxmax, bool boxexp ) | 94 | QCOORD boxmax, bool boxexp ) |
97 | { | 95 | { |
98 | if ( exp ) { | 96 | if ( exp ) { |
99 | if ( boxexp ) | 97 | if ( boxexp ) |
100 | max = QMAX( max, boxmax ); | 98 | max = QMAX( max, boxmax ); |