[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/krunner
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2007-11-02 23:55:37
Message-ID: 1194047737.016849.28055.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 732164 by aseigo:
* prevent crash on show/hide of options
* get button text right
probably have to disable the animation until Qt4.4 comes out due to horriffic, horriffic flicker.
BUG:151640
M +9 -13 collapsiblewidget.cpp
M +26 -15 interface.cpp
--- trunk/KDE/kdebase/workspace/krunner/collapsiblewidget.cpp #732163:732164
@@ -101,7 +101,6 @@
d->gridLayout = new QGridLayout( this );
d->gridLayout->setMargin(0);
- setExpanded(false);
setEnabled(false);
}
@@ -117,17 +116,17 @@
void CollapsibleWidget::setInnerWidget(QWidget *w)
{
+ d->innerWidget = w;
+
if (!w) {
return;
}
- d->innerWidget = w;
-
- if ( !isExpanded() ) {
+ if (!isExpanded()) {
d->innerWidget->hide();
}
- d->gridLayout->addWidget( d->innerWidget, 2, 2 );
- d->gridLayout->setRowStretch( 2, 1 );
+ d->gridLayout->addWidget(d->innerWidget, 2, 2);
+ d->gridLayout->setRowStretch(2, 1);
setEnabled( true );
@@ -138,13 +137,9 @@
void CollapsibleWidget::setExpanded(bool expanded)
{
- if ( !d->innerWidget ) {
- return;
- }
-
d->expanded = expanded;
- if ( !expanded ) {
+ if (d->innerWidget && !expanded) {
d->innerWidget->setVisible( false );
}
@@ -155,11 +150,12 @@
void CollapsibleWidget::animateCollapse( qreal showAmount )
{
- int pixels = d->innerWidget->sizeHint().height() * showAmount;
+ int pixels = d->innerWidget ? d->innerWidget->sizeHint().height() * showAmount :
+ height() * showAmount;
d->gridLayout->setRowMinimumHeight( 2, pixels );
- if ( showAmount == 1 ) {
+ if (showAmount == 1 && d->innerWidget) {
d->innerWidget->setVisible( true );
}
}
--- trunk/KDE/kdebase/workspace/krunner/interface.cpp #732163:732164
@@ -432,6 +432,7 @@
if (!m_expander) {
//kDebug() << "creating m_expander";
m_expander = new CollapsibleWidget( this );
+ m_expander->show();
connect( m_expander, SIGNAL( collapseCompleted() ),
m_expander, SLOT( hide() ) );
m_layout->insertWidget( 3, m_expander );
@@ -441,8 +442,6 @@
delete m_optionsWidget;
m_optionsWidget = new QWidget(this);
m_defaultMatch->action()->runner()->createMatchOptions(m_optionsWidget);
- m_expander->setInnerWidget(m_optionsWidget);
- m_expander->show();
m_optionsButton->setText( i18n( "Hide Options" ) );
} else {
delete m_optionsWidget;
@@ -457,28 +456,40 @@
// other items in the dialog from moving around and look
// more "natural"; it should appear as if a "drawer" is
// being pulled open, e.g. an expander.
- m_expander->setExpanded( show );
+ m_expander->setInnerWidget(m_optionsWidget);
+ m_expander->setExpanded(show);
}
- m_optionsButton->setChecked( show );
+
+ m_optionsButton->setChecked(show);
}
void Interface::setDefaultItem( QListWidgetItem* item )
{
- if ( !item ) {
- return;
- }
+ bool hasOptions = false;
- if ( m_defaultMatch ) {
- m_defaultMatch->setDefault( false );
+ if (item) {
+ if (m_defaultMatch) {
+ m_defaultMatch->setDefault(false);
+ }
+
+ m_defaultMatch = dynamic_cast<SearchMatch*>(item);
+ hasOptions = m_defaultMatch && m_defaultMatch->action()->runner()->hasMatchOptions();
}
- m_defaultMatch = dynamic_cast<SearchMatch*>( item );
+ m_optionsButton->setEnabled(hasOptions);
- bool hasOptions = m_defaultMatch && m_defaultMatch->action()->runner()->hasMatchOptions();
- m_optionsButton->setEnabled( hasOptions );
-
- if ( m_expander && !hasOptions ) {
- m_expander->hide();
+ if (hasOptions) {
+ if (m_expander && m_expander->isExpanded()) {
+ m_optionsButton->setText(i18n("Hide Options"));
+ } else {
+ m_optionsButton->setText(i18n("Show Options"));
+ }
+ } else {
+ m_optionsButton->setText(i18n("Show Options"));
+ m_optionsButton->setChecked(false);
+ if (m_expander) {
+ m_expander->hide();
+ }
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic