~ubuntu-branches/ubuntu/utopic/kde4libs/utopic

« back to all changes in this revision

Viewing changes to plasma/dialog.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac, Philip Muškovac, Felix Geyer
  • Date: 2011-12-23 20:22:04 UTC
  • mfrom: (1.14.12)
  • Revision ID: package-import@ubuntu.com-20111223202204-pa369jt38tng7j3k
Tags: 4:4.7.95-0ubuntu1
[ Philip Muškovac ]
* New upstream release candidate
  - update kdelibs5-data.install

[ Felix Geyer ]
* Update symbols files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
490
490
                break;
491
491
        }
492
492
 
493
 
        if ((newWidth >= minimumSize().width()) && (newHeight >= minimumSize().height())) {
494
 
            setGeometry(QRect(position, QSize(newWidth, newHeight)));
 
493
        QRect newGeom(position, QSize(newWidth, newHeight));
 
494
 
 
495
        // now sanity check the resize results again min constraints, if any
 
496
        if (d->leftResizeMin > -1 && newGeom.left() > d->leftResizeMin) {
 
497
            newGeom.setLeft(d->leftResizeMin);
 
498
        }
 
499
 
 
500
        if (d->topResizeMin > -1 && newGeom.top() > d->topResizeMin) {
 
501
            newGeom.setTop(d->topResizeMin);
 
502
        }
 
503
 
 
504
        if (d->rightResizeMin > -1 && newGeom.right() < d->rightResizeMin) {
 
505
            newGeom.setRight(d->rightResizeMin);
 
506
        }
 
507
 
 
508
        if (d->bottomResizeMin > -1 && newGeom.bottom() < d->bottomResizeMin) {
 
509
            newGeom.setBottom(d->bottomResizeMin);
 
510
        }
 
511
 
 
512
        if ((newGeom.width() >= minimumSize().width()) && (newGeom.height() >= minimumSize().height())) {
 
513
            setGeometry(newGeom);
495
514
        }
496
515
    }
497
516
 
518
537
void Dialog::mouseReleaseEvent(QMouseEvent *event)
519
538
{
520
539
    if (d->resizeStartCorner != Dialog::NoCorner) {
521
 
        d->resizeStartCorner = Dialog::NoCorner;
522
 
        unsetCursor();
523
540
        emit dialogResized();
 
541
        d->resizeStartCorner = Dialog::NoCorner;
 
542
        unsetCursor();
524
543
    }
525
544
 
526
545
    QWidget::mouseReleaseEvent(event);
535
554
 
536
555
bool Dialog::event(QEvent *event)
537
556
{
538
 
    if (event->type() == QEvent::Paint) {
539
 
        QPainter p(this);
540
 
        p.setCompositionMode(QPainter::CompositionMode_Source);
541
 
        p.fillRect(rect(), Qt::transparent);
542
 
    }
543
 
 
544
557
    return QWidget::event(event);
545
558
}
546
559
 
751
764
    return d->resizeCorners;
752
765
}
753
766
 
 
767
bool Dialog::isUserResizing() const
 
768
{
 
769
    return d->resizeStartCorner > NoCorner;
 
770
}
 
771
 
 
772
void Dialog::setMinimumResizeLimits(int left, int top, int right, int bottom)
 
773
{
 
774
    d->leftResizeMin = left;
 
775
    d->topResizeMin = top;
 
776
    d->rightResizeMin = right;
 
777
    d->bottomResizeMin = bottom;
 
778
}
 
779
 
 
780
void Dialog::getMinimumResizeLimits(int *left, int *top, int *right, int *bottom)
 
781
{
 
782
    if (left) {
 
783
        *left = d->leftResizeMin;
 
784
    }
 
785
 
 
786
    if (top) {
 
787
        *top = d->topResizeMin;
 
788
    }
 
789
 
 
790
    if (right) {
 
791
        *right = d->rightResizeMin;
 
792
    }
 
793
 
 
794
    if (bottom) {
 
795
        *bottom = d->bottomResizeMin;
 
796
    }
 
797
}
 
798
 
754
799
void Dialog::animatedHide(Plasma::Direction direction)
755
800
{
756
801
    if (!isVisible()) {
757
802
        return;
758
803
    }
759
804
 
760
 
    if (!KWindowSystem::compositingActive()) {
 
805
    if (!Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
761
806
        hide();
762
807
        return;
763
808
    }
786
831
 
787
832
void Dialog::animatedShow(Plasma::Direction direction)
788
833
{
789
 
    if (!KWindowSystem::compositingActive()) {
 
834
    if (!Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
790
835
        show();
791
836
        return;
792
837
    }
810
855
        break;
811
856
    }
812
857
 
813
 
    if (KWindowSystem::compositingActive()) {
 
858
    if (Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
814
859
        Plasma::WindowEffects::slideWindow(this, location);
815
860
    }
816
861