author | zautrix <zautrix> | 2005-04-01 18:10:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 18:10:09 (UTC) |
commit | edc032c21ae3788d02a632ea8066e4ac5a4feedb (patch) (unidiff) | |
tree | 8e59c8dcf1cc3021694025627d36e152f7adc389 /microkde | |
parent | 5d88f92b76a760f100384ea5fa6ed143088d19bb (diff) | |
download | kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.zip kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.gz kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.bz2 |
fixes
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 14 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index ea3a329..d675517 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -617,146 +617,154 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
617 | addWidget( (QWidget*)c->child() ); | 617 | addWidget( (QWidget*)c->child() ); |
618 | recalc( isVisible() ); | 618 | recalc( isVisible() ); |
619 | 619 | ||
620 | } else if ( c->type() == QEvent::ChildRemoved ) { | 620 | } else if ( c->type() == QEvent::ChildRemoved ) { |
621 | QSplitterLayoutStruct *p = 0; | 621 | QSplitterLayoutStruct *p = 0; |
622 | if ( data->list.count() > 1 ) | 622 | if ( data->list.count() > 1 ) |
623 | p = data->list.at(1); //remove handle _after_ first widget. | 623 | p = data->list.at(1); //remove handle _after_ first widget. |
624 | QSplitterLayoutStruct *s = data->list.first(); | 624 | QSplitterLayoutStruct *s = data->list.first(); |
625 | while ( s ) { | 625 | while ( s ) { |
626 | if ( s->wid == c->child() ) { | 626 | if ( s->wid == c->child() ) { |
627 | data->list.removeRef( s ); | 627 | data->list.removeRef( s ); |
628 | delete s; | 628 | delete s; |
629 | if ( p && p->isSplitter ) { | 629 | if ( p && p->isSplitter ) { |
630 | data->list.removeRef( p ); | 630 | data->list.removeRef( p ); |
631 | delete p->wid; //will call childEvent | 631 | delete p->wid; //will call childEvent |
632 | delete p; | 632 | delete p; |
633 | } | 633 | } |
634 | recalcId(); | 634 | recalcId(); |
635 | doResize(); | 635 | doResize(); |
636 | return; | 636 | return; |
637 | } | 637 | } |
638 | p = s; | 638 | p = s; |
639 | s = data->list.next(); | 639 | s = data->list.next(); |
640 | } | 640 | } |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | /*! | 645 | /*! |
646 | Shows a rubber band at position \a p. If \a p is negative, the | 646 | Shows a rubber band at position \a p. If \a p is negative, the |
647 | rubber band is removed. | 647 | rubber band is removed. |
648 | */ | 648 | */ |
649 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 649 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
650 | { | 650 | { |
651 | #ifdef DESKTOP_VERSION | 651 | #ifdef DESKTOP_VERSION |
652 | QPainter paint( this ); | 652 | QPainter paint( this ); |
653 | paint.setPen( gray ); | 653 | paint.setPen( gray ); |
654 | paint.setBrush( gray ); | 654 | paint.setBrush( gray ); |
655 | paint.setRasterOp( XorROP ); | 655 | paint.setRasterOp( XorROP ); |
656 | QRect r = contentsRect(); | 656 | QRect r = contentsRect(); |
657 | const int rBord = 3; //Themable???? | 657 | const int rBord = 3; //Themable???? |
658 | #if QT_VERSION >= 0x030000 | 658 | #if QT_VERSION >= 0x030000 |
659 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 659 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
660 | #else | 660 | #else |
661 | int sw = style().splitterWidth(); | 661 | int sw = style().splitterWidth(); |
662 | #endif | 662 | #endif |
663 | if ( orient == Horizontal ) { | 663 | if ( orient == Horizontal ) { |
664 | if ( opaqueOldPos >= 0 ) | 664 | if ( opaqueOldPos >= 0 ) |
665 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 665 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
666 | 2*rBord, r.height() ); | 666 | 2*rBord, r.height() ); |
667 | if ( p >= 0 ) | 667 | if ( p >= 0 ) |
668 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 668 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
669 | } else { | 669 | } else { |
670 | if ( opaqueOldPos >= 0 ) | 670 | if ( opaqueOldPos >= 0 ) |
671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
672 | r.width(), 2*rBord ); | 672 | r.width(), 2*rBord ); |
673 | if ( p >= 0 ) | 673 | if ( p >= 0 ) |
674 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 674 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
675 | } | 675 | } |
676 | opaqueOldPos = p; | 676 | opaqueOldPos = p; |
677 | #else | 677 | #else |
678 | if ( !mRubberBand ) { | 678 | if ( !mRubberBand ) { |
679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | 679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); |
680 | mRubberBand->setFrameStyle( Box | Raised ); | 680 | mRubberBand->setFrameStyle( Box | Raised ); |
681 | mRubberBand->setPalette( QPalette ( Qt::green.light(),Qt::green.dark() ) ); | 681 | mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); |
682 | } | 682 | } |
683 | QRect r = contentsRect(); | 683 | QRect r = contentsRect(); |
684 | const int rBord = 5; //Themable???? | 684 | static int rBord = 0; //Themable???? |
685 | if ( !rBord ) { | ||
686 | if (QApplication::desktop()->width() <= 320 ) | ||
687 | rBord = 4; | ||
688 | else | ||
689 | rBord = 5; | ||
690 | } | ||
685 | int sw = style().splitterWidth(); | 691 | int sw = style().splitterWidth(); |
686 | if ( orient == Horizontal ) { | 692 | if ( orient == Horizontal ) { |
687 | if ( p >= 0 ) { | 693 | if ( p >= 0 ) { |
688 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | 694 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); |
689 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | 695 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); |
690 | } | 696 | } |
691 | } else { | 697 | } else { |
692 | if ( p >= 0 ) { | 698 | if ( p >= 0 ) { |
693 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | 699 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); |
694 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | 700 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); |
695 | } | 701 | } |
696 | } | 702 | } |
697 | opaqueOldPos = p; | 703 | opaqueOldPos = p; |
698 | mRubberBand->show(); | 704 | if ( ! mRubberBand->isVisible() ) { |
705 | mRubberBand->show(); | ||
706 | } | ||
699 | #endif | 707 | #endif |
700 | } | 708 | } |
701 | 709 | ||
702 | 710 | ||
703 | /*! \reimp */ | 711 | /*! \reimp */ |
704 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 712 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
705 | { | 713 | { |
706 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 714 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { |
707 | recalc( isVisible() ); | 715 | recalc( isVisible() ); |
708 | if ( e->type() == QEvent::Show ) | 716 | if ( e->type() == QEvent::Show ) |
709 | data->firstShow = FALSE; | 717 | data->firstShow = FALSE; |
710 | } | 718 | } |
711 | return QWidget::event( e ); | 719 | return QWidget::event( e ); |
712 | } | 720 | } |
713 | 721 | ||
714 | 722 | ||
715 | /*! | 723 | /*! |
716 | \obsolete | 724 | \obsolete |
717 | 725 | ||
718 | Draws the splitter handle in the rectangle described by \a x, \a y, | 726 | Draws the splitter handle in the rectangle described by \a x, \a y, |
719 | \a w, \a h using painter \a p. | 727 | \a w, \a h using painter \a p. |
720 | \sa QStyle::drawPrimitive() | 728 | \sa QStyle::drawPrimitive() |
721 | */ | 729 | */ |
722 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 730 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
723 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 731 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
724 | { | 732 | { |
725 | #if 0 | 733 | #if 0 |
726 | // LR | 734 | // LR |
727 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 735 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
728 | (orientation() == Qt::Horizontal ? | 736 | (orientation() == Qt::Horizontal ? |
729 | QStyle::Style_Horizontal : 0)); | 737 | QStyle::Style_Horizontal : 0)); |
730 | #endif | 738 | #endif |
731 | } | 739 | } |
732 | 740 | ||
733 | 741 | ||
734 | /*! | 742 | /*! |
735 | Returns the id of the splitter to the right of or below the widget \a w, | 743 | Returns the id of the splitter to the right of or below the widget \a w, |
736 | or 0 if there is no such splitter | 744 | or 0 if there is no such splitter |
737 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). | 745 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). |
738 | */ | 746 | */ |
739 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const | 747 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const |
740 | { | 748 | { |
741 | QSplitterLayoutStruct *s = data->list.first(); | 749 | QSplitterLayoutStruct *s = data->list.first(); |
742 | bool seen_w = FALSE; | 750 | bool seen_w = FALSE; |
743 | while ( s ) { | 751 | while ( s ) { |
744 | if ( s->isSplitter && seen_w ) | 752 | if ( s->isSplitter && seen_w ) |
745 | return data->list.at(); | 753 | return data->list.at(); |
746 | if ( !s->isSplitter && s->wid == w ) | 754 | if ( !s->isSplitter && s->wid == w ) |
747 | seen_w = TRUE; | 755 | seen_w = TRUE; |
748 | s = data->list.next(); | 756 | s = data->list.next(); |
749 | } | 757 | } |
750 | return 0; | 758 | return 0; |
751 | } | 759 | } |
752 | 760 | ||
753 | 761 | ||
754 | /*! | 762 | /*! |
755 | Moves the left/top edge of the splitter handle with id \a id as | 763 | Moves the left/top edge of the splitter handle with id \a id as |
756 | close as possible to position \a p, which is the distance from the | 764 | close as possible to position \a p, which is the distance from the |
757 | left (or top) edge of the widget. | 765 | left (or top) edge of the widget. |
758 | 766 | ||
759 | For Arabic and Hebrew the layout is reversed, and using this | 767 | For Arabic and Hebrew the layout is reversed, and using this |
760 | function to set the position of the splitter might lead to | 768 | function to set the position of the splitter might lead to |
761 | unexpected results, since in Arabic and Hebrew the position of | 769 | unexpected results, since in Arabic and Hebrew the position of |
762 | splitter one is to the left of the position of splitter zero. | 770 | splitter one is to the left of the position of splitter zero. |
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index f453331..e6144de 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -90,128 +90,130 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
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 | ||
114 | QTabWidget *KDialogBase::tabWidget() | 114 | QTabWidget *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 | ||
123 | void KDialogBase::hideButtons() | 123 | void 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 | } |
134 | void KDialogBase::initLayout() | 134 | void 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( marginHint() ); |
140 | mTopLayout->setSpacing( spacingHint() ); | 140 | mTopLayout->setSpacing( spacingHint() ); |
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 ); | ||
155 | buttonLayout->setSpacing( spacingHint() ); | ||
154 | } | 156 | } |
155 | 157 | ||
156 | QFrame *KDialogBase::addPage( const QString &name ) | 158 | QFrame *KDialogBase::addPage( const QString &name ) |
157 | { | 159 | { |
158 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
159 | QFrame *frame = new QFrame( tabWidget() ); | 161 | QFrame *frame = new QFrame( tabWidget() ); |
160 | tabWidget()->addTab( frame, name ); | 162 | tabWidget()->addTab( frame, name ); |
161 | return frame; | 163 | return frame; |
162 | } | 164 | } |
163 | 165 | ||
164 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
165 | { | 167 | { |
166 | return addPage( name ); | 168 | return addPage( name ); |
167 | } | 169 | } |
168 | 170 | ||
169 | 171 | ||
170 | void KDialogBase::setMainWidget( QWidget *widget ) | 172 | void KDialogBase::setMainWidget( QWidget *widget ) |
171 | { | 173 | { |
172 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
173 | 175 | ||
174 | mMainWidget = widget; | 176 | mMainWidget = widget; |
175 | initLayout(); | 177 | initLayout(); |
176 | } | 178 | } |
177 | 179 | ||
178 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
179 | { | 181 | { |
180 | QPushButton *button = findButton( id ); | 182 | QPushButton *button = findButton( id ); |
181 | if ( button ) { | 183 | if ( button ) { |
182 | button->setText( text ); | 184 | button->setText( text ); |
183 | } | 185 | } |
184 | } | 186 | } |
185 | 187 | ||
186 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 188 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
187 | { | 189 | { |
188 | QPushButton *button = findButton( id ); | 190 | QPushButton *button = findButton( id ); |
189 | if ( button ) { | 191 | if ( button ) { |
190 | button->setEnabled( state ); | 192 | button->setEnabled( state ); |
191 | } | 193 | } |
192 | } | 194 | } |
193 | 195 | ||
194 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 196 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
195 | { | 197 | { |
196 | QPushButton *button = 0; | 198 | QPushButton *button = 0; |
197 | switch ( id ) { | 199 | switch ( id ) { |
198 | case Ok: | 200 | case Ok: |
199 | button = mOkButton; | 201 | button = mOkButton; |
200 | break; | 202 | break; |
201 | case Apply: | 203 | case Apply: |
202 | button = mApplyButton; | 204 | button = mApplyButton; |
203 | break; | 205 | break; |
204 | case User1: | 206 | case User1: |
205 | button = mUser1Button; | 207 | button = mUser1Button; |
206 | break; | 208 | break; |
207 | case User2: | 209 | case User2: |
208 | button = mUser2Button; | 210 | button = mUser2Button; |
209 | break; | 211 | break; |
210 | case Cancel: | 212 | case Cancel: |
211 | button = mCancelButton; | 213 | button = mCancelButton; |
212 | break; | 214 | break; |
213 | case Default: | 215 | case Default: |
214 | button = mDefaultButton; | 216 | button = mDefaultButton; |
215 | break; | 217 | break; |
216 | case Close: | 218 | case Close: |
217 | button = mCloseButton; | 219 | button = mCloseButton; |