summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-04-02 08:36:37 (UTC)
committer zautrix <zautrix>2005-04-02 08:36:37 (UTC)
commite7cb4c20af8b07bf923c864026481ce316c40e1d (patch) (unidiff)
treec88b2d0c01ce683e73ea9f4657f4d5c6fbe6f922 /microkde
parent7aefe488d1fe0c34cf29460f48a9a97d632f615e (diff)
downloadkdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.zip
kdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.tar.gz
kdepimpi-e7cb4c20af8b07bf923c864026481ce316c40e1d.tar.bz2
more fixes
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp10
-rw-r--r--microkde/kdialogbase.cpp8
2 files changed, 7 insertions, 11 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 253175e..2a30346 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -180,212 +180,208 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
180 } 180 }
181 _activeButton = 0; 181 _activeButton = 0;
182 updateCursor( e->pos() ); 182 updateCursor( e->pos() );
183 } 183 }
184 else { 184 else {
185 if ( !opaque() && e->button() == LeftButton ) { 185 if ( !opaque() && e->button() == LeftButton ) {
186 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 186 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
187 - mouseOffset; 187 - mouseOffset;
188 s->setRubberband( -1 ); 188 s->setRubberband( -1 );
189 s->moveSplitter( pos, id() ); 189 s->moveSplitter( pos, id() );
190 } 190 }
191 } 191 }
192 if ( s->rubberBand() ) 192 if ( s->rubberBand() )
193 s->rubberBand()->hide(); 193 s->rubberBand()->hide();
194 repaint(); 194 repaint();
195} 195}
196 196
197int KDGanttSplitterHandle::onButton( const QPoint& p ) 197int KDGanttSplitterHandle::onButton( const QPoint& p )
198{ 198{
199 QValueList<QPointArray> list = buttonRegions(); 199 QValueList<QPointArray> list = buttonRegions();
200 int index = 1; 200 int index = 1;
201 int add = 12; 201 int add = 12;
202 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 202 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
203 QRect rect = (*it).boundingRect(); 203 QRect rect = (*it).boundingRect();
204 rect.setLeft( rect.left()- add ); 204 rect.setLeft( rect.left()- add );
205 rect.setRight( rect.right() + add); 205 rect.setRight( rect.right() + add);
206 rect.setTop( rect.top()- add ); 206 rect.setTop( rect.top()- add );
207 rect.setBottom( rect.bottom() + add); 207 rect.setBottom( rect.bottom() + add);
208 if ( rect.contains( p ) ) { 208 if ( rect.contains( p ) ) {
209 return index; 209 return index;
210 } 210 }
211 index++; 211 index++;
212 } 212 }
213 return 0; 213 return 0;
214} 214}
215 215
216 216
217QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() 217QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions()
218{ 218{
219 QValueList<QPointArray> list; 219 QValueList<QPointArray> list;
220 220
221 int sw = 8; 221 int sw = 8;
222 int yyy = 1; 222 int yyy = 1;
223 int xxx = 1; 223 int xxx = 1;
224 int voffset[] = { (int) -sw*3, (int) sw*3 }; 224 int voffset[] = { (int) -sw*3, (int) sw*3 };
225 for ( int i = 0; i < 2; i++ ) { 225 for ( int i = 0; i < 2; i++ ) {
226 QPointArray arr; 226 QPointArray arr;
227 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || 227 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
228 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { 228 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
229 int mid = height()/2 + voffset[i]; 229 int mid = height()/2 + voffset[i];
230 arr.setPoints( 3, 230 arr.setPoints( 3,
231 1-xxx, mid - sw + 4, 231 1-xxx, mid - sw + 4,
232 sw-3-xxx, mid, 232 sw-3-xxx, mid,
233 1-xxx, mid + sw -4); 233 1-xxx, mid + sw -4);
234 } 234 }
235 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || 235 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
236 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { 236 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
237 int mid = height()/2 + voffset[i]; 237 int mid = height()/2 + voffset[i];
238 arr.setPoints( 3, 238 arr.setPoints( 3,
239 sw-4, mid - sw + 4, 239 sw-4, mid - sw + 4,
240 0, mid, 240 0, mid,
241 sw-4, mid + sw - 4); 241 sw-4, mid + sw - 4);
242 } 242 }
243 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up || 243 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
244 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) { 244 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) {
245 int mid = width()/2 + voffset[i]; 245 int mid = width()/2 + voffset[i];
246 arr.setPoints( 3, 246 arr.setPoints( 3,
247 mid - sw + 4, sw-4, 247 mid - sw + 4, sw-4,
248 mid, 0, 248 mid, 0,
249 mid + sw - 4, sw-4 ); 249 mid + sw - 4, sw-4 );
250 } 250 }
251 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down || 251 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down ||
252 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { 252 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
253 int mid = width()/2 + voffset[i]; 253 int mid = width()/2 + voffset[i];
254 arr.setPoints( 3, 254 arr.setPoints( 3,
255 mid - sw + 4, 1-yyy, 255 mid - sw + 4, 1-yyy,
256 mid, sw-3-yyy, 256 mid, sw-3-yyy,
257 mid + sw -4, 1-yyy); 257 mid + sw -4, 1-yyy);
258 } 258 }
259 list.append( arr ); 259 list.append( arr );
260 } 260 }
261 return list; 261 return list;
262} 262}
263 263
264void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) 264void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
265{ 265{
266 QPixmap buffer( size() ); 266 QPixmap buffer( size() );
267 QPainter p( &buffer ); 267 QPainter p( &buffer );
268 268
269 //LR 269 //LR
270 // Draw the splitter rectangle 270 // Draw the splitter rectangle
271 p.setBrush( colorGroup().background() ); 271 p.setBrush( colorGroup().background() );
272 p.setPen( colorGroup().foreground() ); 272 p.setPen( colorGroup().foreground() );
273 //p.drawRect( rect() ); 273 //p.drawRect( rect() );
274#ifndef DESKTOP_VERSION 274#ifndef DESKTOP_VERSION
275 if ( mMouseDown ) 275 if ( mMouseDown )
276 buffer.fill( QColor( 242,27,255 ) ); 276 buffer.fill( colorGroup().background().dark() );
277 else 277 else
278#endif 278#endif
279 buffer.fill( colorGroup().background() ); 279 buffer.fill( colorGroup().background() );
280 //buffer.fill( backgroundColor() ); 280 //buffer.fill( backgroundColor() );
281 // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup()); 281 // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup());
282 282
283 int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size 283 int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size
284 284
285 // arrow color 285 // arrow color
286 QColor col; 286 QColor col;
287 if ( _activeButton ) 287 if ( _activeButton )
288 col = colorGroup().background().dark( 250 ); 288 col = colorGroup().background().dark( 250 );
289 else { 289 else {
290 if ( mMouseDown ) 290 if ( mMouseDown )
291#ifndef DESKTOP_VERSION 291 col = Qt::white;
292 col = QColor( 178,18,188);//QColor( 242,27,255 );//Qt::white;
293#else
294 col = Qt::white;
295#endif
296 else 292 else
297 col = colorGroup().background().dark( 150 ); 293 col = colorGroup().background().dark( 150 );
298 } 294 }
299 //QColor col = backgroundColor().dark( 130 ); 295 //QColor col = backgroundColor().dark( 130 );
300 p.setBrush( col ); 296 p.setBrush( col );
301 p.setPen( col ); 297 p.setPen( col );
302 298
303 QValueList<QPointArray> list = buttonRegions(); 299 QValueList<QPointArray> list = buttonRegions();
304 int index = 1; 300 int index = 1;
305 if ( mUseOffset ) 301 if ( mUseOffset )
306 p.translate( 0, 1 ); 302 p.translate( 0, 1 );
307 for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 303 for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
308 if ( index == _activeButton ) { 304 if ( index == _activeButton ) {
309 305
310 /* 306 /*
311 if ( ! _collapsed ) { 307 if ( ! _collapsed ) {
312 p.save(); 308 p.save();
313 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), 309 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
314 // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); 310 // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) );
315 p.translate( -1, 0 ); 311 p.translate( -1, 0 );
316 p.drawPolygon( *it, true ); 312 p.drawPolygon( *it, true );
317 p.restore(); } else 313 p.restore(); } else
318 */ 314 */
319 p.drawPolygon( *it, true ); 315 p.drawPolygon( *it, true );
320 316
321 } 317 }
322 else { 318 else {
323 /* 319 /*
324 if ( ! _collapsed ) { 320 if ( ! _collapsed ) {
325 p.save(); 321 p.save();
326 p.translate( -1, 0 ); 322 p.translate( -1, 0 );
327 p.drawPolygon( *it, true ); 323 p.drawPolygon( *it, true );
328 p.restore(); 324 p.restore();
329 } else 325 } else
330 */ 326 */
331 p.drawPolygon( *it, true ); 327 p.drawPolygon( *it, true );
332 328
333 } 329 }
334 index++; 330 index++;
335 } 331 }
336 332
337 // Draw the lines between the arrows 333 // Draw the lines between the arrows
338 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left || 334 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
339 s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { 335 s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
340 int mid = height()/2; 336 int mid = height()/2;
341 p.drawLine ( 1, mid - sw, 1, mid + sw ); 337 p.drawLine ( 1, mid - sw, 1, mid + sw );
342 p.drawLine ( 3, mid - sw, 3, mid + sw ); 338 p.drawLine ( 3, mid - sw, 3, mid + sw );
343 } 339 }
344 else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up || 340 else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
345 s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) { 341 s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) {
346 int mid = width()/2; 342 int mid = width()/2;
347 p.drawLine( mid -sw, 1, mid +sw, 1 ); 343 p.drawLine( mid -sw, 1, mid +sw, 1 );
348 p.drawLine( mid -sw, 3, mid +sw, 3 ); 344 p.drawLine( mid -sw, 3, mid +sw, 3 );
349 } 345 }
350 bitBlt( this, 0, 0, &buffer ); 346 bitBlt( this, 0, 0, &buffer );
351 347
352} 348}
353#endif 349#endif
354 350
355class QSplitterLayoutStruct 351class QSplitterLayoutStruct
356{ 352{
357public: 353public:
358 KDGanttMinimizeSplitter::ResizeMode mode; 354 KDGanttMinimizeSplitter::ResizeMode mode;
359 QCOORD sizer; 355 QCOORD sizer;
360 bool isSplitter; 356 bool isSplitter;
361 QWidget *wid; 357 QWidget *wid;
362}; 358};
363 359
364class QSplitterData 360class QSplitterData
365{ 361{
366public: 362public:
367 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {} 363 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
368 364
369 QPtrList<QSplitterLayoutStruct> list; 365 QPtrList<QSplitterLayoutStruct> list;
370 bool opaque; 366 bool opaque;
371 bool firstShow; 367 bool firstShow;
372}; 368};
373 369
374void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos, 370void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
375 int space, int spacer ); 371 int space, int spacer );
376#endif // DOXYGEN_SKIP_INTERNAL 372#endif // DOXYGEN_SKIP_INTERNAL
377 373
378 374
379/*! 375/*!
380 \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h 376 \class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h
381 \brief The KDGanttMinimizeSplitter class implements a splitter 377 \brief The KDGanttMinimizeSplitter class implements a splitter
382 widget with minimize buttons. 378 widget with minimize buttons.
383 379
384 This class (and its documentation) is largely a copy of Qt's 380 This class (and its documentation) is largely a copy of Qt's
385 QSplitter; the copying was necessary because QSplitter is not 381 QSplitter; the copying was necessary because QSplitter is not
386 extensible at all. QSplitter and its documentation are licensed 382 extensible at all. QSplitter and its documentation are licensed
387 according to the GPL and the Qt Professional License (if you hold 383 according to the GPL and the Qt Professional License (if you hold
388 such a license) and are (C) Trolltech AS. 384 such a license) and are (C) Trolltech AS.
389 385
390 A splitter lets the user control the size of child widgets by 386 A splitter lets the user control the size of child widgets by
391 dragging the boundary between the children. Any number of widgets 387 dragging the boundary between the children. Any number of widgets
@@ -595,193 +591,193 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool firs
595 s->sizer = pick( w->size() ); 591 s->sizer = pick( w->size() );
596 s->isSplitter = FALSE; 592 s->isSplitter = FALSE;
597 if ( first ) 593 if ( first )
598 data->list.insert( 0, s ); 594 data->list.insert( 0, s );
599 else 595 else
600 data->list.append( s ); 596 data->list.append( s );
601 if ( newHandle && isVisible() ) 597 if ( newHandle && isVisible() )
602 newHandle->show(); //will trigger sending of post events 598 newHandle->show(); //will trigger sending of post events
603 return s; 599 return s;
604} 600}
605 601
606 602
607/*! 603/*!
608 Tells the splitter that a child widget has been inserted or removed. 604 Tells the splitter that a child widget has been inserted or removed.
609 The event is passed in \a c. 605 The event is passed in \a c.
610*/ 606*/
611void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) 607void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
612{ 608{
613 if ( c->type() == QEvent::ChildInserted ) { 609 if ( c->type() == QEvent::ChildInserted ) {
614 if ( !c->child()->isWidgetType() ) 610 if ( !c->child()->isWidgetType() )
615 return; 611 return;
616 612
617 if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) ) 613 if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
618 return; 614 return;
619 615
620 QSplitterLayoutStruct *s = data->list.first(); 616 QSplitterLayoutStruct *s = data->list.first();
621 while ( s ) { 617 while ( s ) {
622 if ( s->wid == c->child() ) 618 if ( s->wid == c->child() )
623 return; 619 return;
624 s = data->list.next(); 620 s = data->list.next();
625 } 621 }
626 addWidget( (QWidget*)c->child() ); 622 addWidget( (QWidget*)c->child() );
627 recalc( isVisible() ); 623 recalc( isVisible() );
628 624
629 } else if ( c->type() == QEvent::ChildRemoved ) { 625 } else if ( c->type() == QEvent::ChildRemoved ) {
630 QSplitterLayoutStruct *p = 0; 626 QSplitterLayoutStruct *p = 0;
631 if ( data->list.count() > 1 ) 627 if ( data->list.count() > 1 )
632 p = data->list.at(1); //remove handle _after_ first widget. 628 p = data->list.at(1); //remove handle _after_ first widget.
633 QSplitterLayoutStruct *s = data->list.first(); 629 QSplitterLayoutStruct *s = data->list.first();
634 while ( s ) { 630 while ( s ) {
635 if ( s->wid == c->child() ) { 631 if ( s->wid == c->child() ) {
636 data->list.removeRef( s ); 632 data->list.removeRef( s );
637 delete s; 633 delete s;
638 if ( p && p->isSplitter ) { 634 if ( p && p->isSplitter ) {
639 data->list.removeRef( p ); 635 data->list.removeRef( p );
640 delete p->wid; //will call childEvent 636 delete p->wid; //will call childEvent
641 delete p; 637 delete p;
642 } 638 }
643 recalcId(); 639 recalcId();
644 doResize(); 640 doResize();
645 return; 641 return;
646 } 642 }
647 p = s; 643 p = s;
648 s = data->list.next(); 644 s = data->list.next();
649 } 645 }
650 } 646 }
651} 647}
652 648
653 649
654/*! 650/*!
655 Shows a rubber band at position \a p. If \a p is negative, the 651 Shows a rubber band at position \a p. If \a p is negative, the
656 rubber band is removed. 652 rubber band is removed.
657*/ 653*/
658void KDGanttMinimizeSplitter::setRubberband( int p ) 654void KDGanttMinimizeSplitter::setRubberband( int p )
659{ 655{
660#ifdef DESKTOP_VERSION 656#ifdef DESKTOP_VERSION
661 QPainter paint( this ); 657 QPainter paint( this );
662 paint.setPen( gray ); 658 paint.setPen( gray );
663 paint.setBrush( gray ); 659 paint.setBrush( gray );
664 paint.setRasterOp( XorROP ); 660 paint.setRasterOp( XorROP );
665 QRect r = contentsRect(); 661 QRect r = contentsRect();
666 const int rBord = 3; //Themable???? 662 const int rBord = 3; //Themable????
667#if QT_VERSION >= 0x030000 663#if QT_VERSION >= 0x030000
668 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); 664 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
669#else 665#else
670 int sw = style().splitterWidth(); 666 int sw = style().splitterWidth();
671#endif 667#endif
672 if ( orient == Horizontal ) { 668 if ( orient == Horizontal ) {
673 if ( opaqueOldPos >= 0 ) 669 if ( opaqueOldPos >= 0 )
674 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), 670 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
675 2*rBord, r.height() ); 671 2*rBord, r.height() );
676 if ( p >= 0 ) 672 if ( p >= 0 )
677 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); 673 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
678 } else { 674 } else {
679 if ( opaqueOldPos >= 0 ) 675 if ( opaqueOldPos >= 0 )
680 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, 676 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
681 r.width(), 2*rBord ); 677 r.width(), 2*rBord );
682 if ( p >= 0 ) 678 if ( p >= 0 )
683 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); 679 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
684 } 680 }
685 opaqueOldPos = p; 681 opaqueOldPos = p;
686#else 682#else
687 if ( !mRubberBand ) { 683 if ( !mRubberBand ) {
688 mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); 684 mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
689 mRubberBand->setFrameStyle( Box | Raised ); 685 mRubberBand->setFrameStyle( Box | Raised );
690 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); 686 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
691 mRubberBand->setPalette( QPalette ( QColor( 178,18,188), QColor( 242,27,255 ) )); 687 mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
692 } 688 }
693 QRect r = contentsRect(); 689 QRect r = contentsRect();
694 static int rBord = 0; //Themable???? 690 static int rBord = 0; //Themable????
695 if ( !rBord ) { 691 if ( !rBord ) {
696 if (QApplication::desktop()->width() <= 320 ) 692 if (QApplication::desktop()->width() <= 320 )
697 rBord = 3; 693 rBord = 3;
698 else 694 else
699 rBord = 4; 695 rBord = 4;
700 } 696 }
701 int sw = style().splitterWidth(); 697 int sw = style().splitterWidth();
702 if ( orient == Horizontal ) { 698 if ( orient == Horizontal ) {
703 if ( p >= 0 ) { 699 if ( p >= 0 ) {
704 QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); 700 QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y()));
705 mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); 701 mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() );
706 } 702 }
707 } else { 703 } else {
708 if ( p >= 0 ) { 704 if ( p >= 0 ) {
709 QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); 705 QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord));
710 mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); 706 mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord);
711 } 707 }
712 } 708 }
713 opaqueOldPos = p; 709 opaqueOldPos = p;
714 if ( ! mRubberBand->isVisible() ) { 710 if ( ! mRubberBand->isVisible() ) {
715 mRubberBand->show(); 711 mRubberBand->show();
716 } 712 }
717#endif 713#endif
718} 714}
719 715
720 716
721/*! \reimp */ 717/*! \reimp */
722bool KDGanttMinimizeSplitter::event( QEvent *e ) 718bool KDGanttMinimizeSplitter::event( QEvent *e )
723{ 719{
724 if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { 720 if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) {
725 recalc( isVisible() ); 721 recalc( isVisible() );
726 if ( e->type() == QEvent::Show ) 722 if ( e->type() == QEvent::Show )
727 data->firstShow = FALSE; 723 data->firstShow = FALSE;
728 } 724 }
729 return QWidget::event( e ); 725 return QWidget::event( e );
730} 726}
731 727
732 728
733/*! 729/*!
734 \obsolete 730 \obsolete
735 731
736 Draws the splitter handle in the rectangle described by \a x, \a y, 732 Draws the splitter handle in the rectangle described by \a x, \a y,
737 \a w, \a h using painter \a p. 733 \a w, \a h using painter \a p.
738 \sa QStyle::drawPrimitive() 734 \sa QStyle::drawPrimitive()
739*/ 735*/
740void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, 736void KDGanttMinimizeSplitter::drawSplitter( QPainter *p,
741 QCOORD x, QCOORD y, QCOORD w, QCOORD h ) 737 QCOORD x, QCOORD y, QCOORD w, QCOORD h )
742{ 738{
743#if 0 739#if 0
744 // LR 740 // LR
745 style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), 741 style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
746 (orientation() == Qt::Horizontal ? 742 (orientation() == Qt::Horizontal ?
747 QStyle::Style_Horizontal : 0)); 743 QStyle::Style_Horizontal : 0));
748#endif 744#endif
749} 745}
750 746
751 747
752/*! 748/*!
753 Returns the id of the splitter to the right of or below the widget \a w, 749 Returns the id of the splitter to the right of or below the widget \a w,
754 or 0 if there is no such splitter 750 or 0 if there is no such splitter
755 (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). 751 (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end).
756*/ 752*/
757int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const 753int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const
758{ 754{
759 QSplitterLayoutStruct *s = data->list.first(); 755 QSplitterLayoutStruct *s = data->list.first();
760 bool seen_w = FALSE; 756 bool seen_w = FALSE;
761 while ( s ) { 757 while ( s ) {
762 if ( s->isSplitter && seen_w ) 758 if ( s->isSplitter && seen_w )
763 return data->list.at(); 759 return data->list.at();
764 if ( !s->isSplitter && s->wid == w ) 760 if ( !s->isSplitter && s->wid == w )
765 seen_w = TRUE; 761 seen_w = TRUE;
766 s = data->list.next(); 762 s = data->list.next();
767 } 763 }
768 return 0; 764 return 0;
769} 765}
770 766
771 767
772/*! 768/*!
773 Moves the left/top edge of the splitter handle with id \a id as 769 Moves the left/top edge of the splitter handle with id \a id as
774 close as possible to position \a p, which is the distance from the 770 close as possible to position \a p, which is the distance from the
775 left (or top) edge of the widget. 771 left (or top) edge of the widget.
776 772
777 For Arabic and Hebrew the layout is reversed, and using this 773 For Arabic and Hebrew the layout is reversed, and using this
778 function to set the position of the splitter might lead to 774 function to set the position of the splitter might lead to
779 unexpected results, since in Arabic and Hebrew the position of 775 unexpected results, since in Arabic and Hebrew the position of
780 splitter one is to the left of the position of splitter zero. 776 splitter one is to the left of the position of splitter zero.
781 777
782 \sa idAfter() 778 \sa idAfter()
783*/ 779*/
784void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id ) 780void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
785{ 781{
786 p = adjustPos( p, id ); 782 p = adjustPos( p, id );
787 QSplitterLayoutStruct *s = data->list.at(id); 783 QSplitterLayoutStruct *s = data->list.at(id);
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index e6144de..11635e1 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -43,209 +43,209 @@ KDialogBase::KDialogBase( int dialogFace, const QString &caption,
43 if (findButton( defaultButton ) ) { 43 if (findButton( defaultButton ) ) {
44 (findButton( defaultButton ) )->setFocus(); 44 (findButton( defaultButton ) )->setFocus();
45 (findButton( defaultButton ) )->setDefault( true ); 45 (findButton( defaultButton ) )->setDefault( true );
46 } 46 }
47 47
48} 48}
49 49
50KDialogBase::~KDialogBase() 50KDialogBase::~KDialogBase()
51{ 51{
52} 52}
53 53
54void KDialogBase::init( const QString &caption, int buttonMask, 54void KDialogBase::init( const QString &caption, int buttonMask,
55 const QString &user1 ,const QString &user2 ) 55 const QString &user1 ,const QString &user2 )
56{ 56{
57 mMainWidget = 0; 57 mMainWidget = 0;
58 mTabWidget = 0; 58 mTabWidget = 0;
59 mPlainPage = 0; 59 mPlainPage = 0;
60 mTopLayout = 0; 60 mTopLayout = 0;
61 if ( !caption.isEmpty() ) { 61 if ( !caption.isEmpty() ) {
62 setCaption( caption ); 62 setCaption( caption );
63 } 63 }
64 64
65 if ( buttonMask & User1 ) { 65 if ( buttonMask & User1 ) {
66 mUser1Button = new QPushButton( user1, this ); 66 mUser1Button = new QPushButton( user1, this );
67 connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); 67 connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) );
68 } else { 68 } else {
69 mUser1Button = 0; 69 mUser1Button = 0;
70 } 70 }
71 if ( buttonMask & User2 ) { 71 if ( buttonMask & User2 ) {
72 mUser2Button = new QPushButton( user2, this ); 72 mUser2Button = new QPushButton( user2, this );
73 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); 73 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) );
74 } else { 74 } else {
75 mUser2Button = 0; 75 mUser2Button = 0;
76 } 76 }
77 77
78 if ( buttonMask & Ok ) { 78 if ( buttonMask & Ok ) {
79 mOkButton = new QPushButton( i18n("Ok"), this ); 79 mOkButton = new QPushButton( i18n("Ok"), this );
80 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); 80 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) );
81 //mOkButton->setDefault( true ); 81 //mOkButton->setDefault( true );
82 } else { 82 } else {
83 mOkButton = 0; 83 mOkButton = 0;
84 } 84 }
85 if ( buttonMask & Default ) { 85 if ( buttonMask & Default ) {
86 mDefaultButton = new QPushButton( i18n("Default"), this ); 86 mDefaultButton = new QPushButton( i18n("Default"), this );
87 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); 87 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
88 } else { 88 } else {
89 mDefaultButton = 0; 89 mDefaultButton = 0;
90 } 90 }
91 91
92 if ( buttonMask & Apply ) { 92 if ( buttonMask & Apply ) {
93 mApplyButton = new QPushButton( i18n("Apply"), this ); 93 mApplyButton = new QPushButton( i18n("Apply"), this );
94 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); 94 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
95 } else { 95 } else {
96 mApplyButton = 0; 96 mApplyButton = 0;
97 } 97 }
98 98
99 if ( buttonMask & Cancel ) { 99 if ( buttonMask & Cancel ) {
100 mCancelButton = new QPushButton( i18n("Cancel"), this ); 100 mCancelButton = new QPushButton( i18n("Cancel"), this );
101 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); 101 connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) );
102 } else { 102 } else {
103 mCancelButton = 0; 103 mCancelButton = 0;
104 } 104 }
105 105
106 if ( buttonMask & Close ) { 106 if ( buttonMask & Close ) {
107 mCloseButton = new QPushButton( i18n("Close"), this ); 107 mCloseButton = new QPushButton( i18n("Close"), this );
108 connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); 108 connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) );
109 } else { 109 } else {
110 mCloseButton = 0; 110 mCloseButton = 0;
111 } 111 }
112} 112}
113 113
114QTabWidget *KDialogBase::tabWidget() 114QTabWidget *KDialogBase::tabWidget()
115{ 115{
116 if ( !mTabWidget ) { 116 if ( !mTabWidget ) {
117 mTabWidget = new QTabWidget( this ); 117 mTabWidget = new QTabWidget( this );
118 setMainWidget( mTabWidget ); 118 setMainWidget( mTabWidget );
119 } 119 }
120 return mTabWidget; 120 return mTabWidget;
121} 121}
122 122
123void KDialogBase::hideButtons() 123void KDialogBase::hideButtons()
124{ 124{
125 if ( mUser1Button ) mUser1Button->hide() ; 125 if ( mUser1Button ) mUser1Button->hide() ;
126 if ( mUser2Button ) mUser2Button->hide() ; 126 if ( mUser2Button ) mUser2Button->hide() ;
127 if ( mOkButton ) mOkButton->hide() ; 127 if ( mOkButton ) mOkButton->hide() ;
128 if ( mApplyButton ) mApplyButton->hide() ; 128 if ( mApplyButton ) mApplyButton->hide() ;
129 if ( mDefaultButton ) mDefaultButton->hide(); 129 if ( mDefaultButton ) mDefaultButton->hide();
130 if ( mCancelButton ) mCancelButton->hide() ; 130 if ( mCancelButton ) mCancelButton->hide() ;
131 if ( mCloseButton ) mCloseButton->hide() ; 131 if ( mCloseButton ) mCloseButton->hide() ;
132 132
133} 133}
134void KDialogBase::initLayout() 134void KDialogBase::initLayout()
135{ 135{
136 136
137 delete mTopLayout; 137 delete mTopLayout;
138 mTopLayout = new QVBoxLayout( this ); 138 mTopLayout = new QVBoxLayout( this );
139 mTopLayout->setMargin( marginHint() ); 139 mTopLayout->setMargin( marginHintSmall() );
140 mTopLayout->setSpacing( spacingHint() ); 140 mTopLayout->setSpacing( spacingHintSmall() );
141 141
142 mTopLayout->addWidget( mMainWidget ); 142 mTopLayout->addWidget( mMainWidget );
143 143
144 QBoxLayout *buttonLayout = new QHBoxLayout; 144 QBoxLayout *buttonLayout = new QHBoxLayout;
145 mTopLayout->addLayout( buttonLayout ); 145 mTopLayout->addLayout( buttonLayout );
146 146
147 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); 147 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
148 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); 148 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
149 if ( mOkButton ) buttonLayout->addWidget( mOkButton ); 149 if ( mOkButton ) buttonLayout->addWidget( mOkButton );
150 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); 150 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
151 if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); 151 if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
152 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); 152 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
153 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); 153 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
154 buttonLayout->setMargin( 0 ); 154 buttonLayout->setMargin( marginHintSmall() );
155 buttonLayout->setSpacing( spacingHint() ); 155 buttonLayout->setSpacing( spacingHintSmall() );
156} 156}
157 157
158QFrame *KDialogBase::addPage( const QString &name ) 158QFrame *KDialogBase::addPage( const QString &name )
159{ 159{
160// kdDebug() << "KDialogBase::addPage(): " << name << endl; 160// kdDebug() << "KDialogBase::addPage(): " << name << endl;
161 QFrame *frame = new QFrame( tabWidget() ); 161 QFrame *frame = new QFrame( tabWidget() );
162 tabWidget()->addTab( frame, name ); 162 tabWidget()->addTab( frame, name );
163 return frame; 163 return frame;
164} 164}
165 165
166QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) 166QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
167{ 167{
168 return addPage( name ); 168 return addPage( name );
169} 169}
170 170
171 171
172void KDialogBase::setMainWidget( QWidget *widget ) 172void KDialogBase::setMainWidget( QWidget *widget )
173{ 173{
174 kdDebug() << "KDialogBase::setMainWidget()" << endl; 174 kdDebug() << "KDialogBase::setMainWidget()" << endl;
175 175
176 mMainWidget = widget; 176 mMainWidget = widget;
177 initLayout(); 177 initLayout();
178} 178}
179 179
180void KDialogBase::setButtonText( ButtonCode id, const QString &text ) 180void KDialogBase::setButtonText( ButtonCode id, const QString &text )
181{ 181{
182 QPushButton *button = findButton( id ); 182 QPushButton *button = findButton( id );
183 if ( button ) { 183 if ( button ) {
184 button->setText( text ); 184 button->setText( text );
185 } 185 }
186} 186}
187 187
188void KDialogBase::enableButton( ButtonCode id, bool state ) 188void KDialogBase::enableButton( ButtonCode id, bool state )
189{ 189{
190 QPushButton *button = findButton( id ); 190 QPushButton *button = findButton( id );
191 if ( button ) { 191 if ( button ) {
192 button->setEnabled( state ); 192 button->setEnabled( state );
193 } 193 }
194} 194}
195 195
196QPushButton *KDialogBase::findButton( ButtonCode id ) 196QPushButton *KDialogBase::findButton( ButtonCode id )
197{ 197{
198 QPushButton *button = 0; 198 QPushButton *button = 0;
199 switch ( id ) { 199 switch ( id ) {
200 case Ok: 200 case Ok:
201 button = mOkButton; 201 button = mOkButton;
202 break; 202 break;
203 case Apply: 203 case Apply:
204 button = mApplyButton; 204 button = mApplyButton;
205 break; 205 break;
206 case User1: 206 case User1:
207 button = mUser1Button; 207 button = mUser1Button;
208 break; 208 break;
209 case User2: 209 case User2:
210 button = mUser2Button; 210 button = mUser2Button;
211 break; 211 break;
212 case Cancel: 212 case Cancel:
213 button = mCancelButton; 213 button = mCancelButton;
214 break; 214 break;
215 case Default: 215 case Default:
216 button = mDefaultButton; 216 button = mDefaultButton;
217 break; 217 break;
218 case Close: 218 case Close:
219 button = mCloseButton; 219 button = mCloseButton;
220 break; 220 break;
221 default: 221 default:
222 break; 222 break;
223 } 223 }
224 return button; 224 return button;
225} 225}
226 226
227void KDialogBase::enableButtonOK( bool state ) 227void KDialogBase::enableButtonOK( bool state )
228{ 228{
229 enableButton( Ok, state ); 229 enableButton( Ok, state );
230} 230}
231 231
232void KDialogBase::enableButtonApply( bool state ) 232void KDialogBase::enableButtonApply( bool state )
233{ 233{
234 enableButton( Apply, state ); 234 enableButton( Apply, state );
235} 235}
236 236
237void KDialogBase::showButton( ButtonCode id, bool show ) 237void KDialogBase::showButton( ButtonCode id, bool show )
238{ 238{
239 QPushButton *button = findButton( id ); 239 QPushButton *button = findButton( id );
240 if ( button ) { 240 if ( button ) {
241 if ( show ) button->show(); 241 if ( show ) button->show();
242 else button->hide(); 242 else button->hide();
243 } 243 }
244} 244}
245 245
246int KDialogBase::pageIndex( QWidget *widget ) const 246int KDialogBase::pageIndex( QWidget *widget ) const
247{ 247{
248 return 0; 248 return 0;
249} 249}
250 250
251 251