Fix crash when we don't select an item
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=818001
This commit is contained in:
parent
d222baf2f2
commit
210f9032ff
@ -47,6 +47,7 @@ OpenWidgetAssistant::OpenWidgetAssistant(QWidget *parent)
|
|||||||
m_widgetTypeList->setSelectionMode(QAbstractItemView::SingleSelection);
|
m_widgetTypeList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
//m_widgetTypeList->setSelectionBehavior(QAbstractItemView::SelectItems);
|
//m_widgetTypeList->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||||
connect(m_widgetTypeList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(next()));
|
connect(m_widgetTypeList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(next()));
|
||||||
|
connect(m_widgetTypeList, SIGNAL(itemSelectionChanged ()), this, SLOT(slotItemChanged()));
|
||||||
|
|
||||||
QString constraint("'Applet' in [X-Plasma-ComponentTypes] and exist [X-Plasma-PackageFormat]");
|
QString constraint("'Applet' in [X-Plasma-ComponentTypes] and exist [X-Plasma-PackageFormat]");
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint);
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint);
|
||||||
@ -88,9 +89,16 @@ OpenWidgetAssistant::OpenWidgetAssistant(QWidget *parent)
|
|||||||
resize(QSize(560, 400).expandedTo(minimumSizeHint()));
|
resize(QSize(560, 400).expandedTo(minimumSizeHint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenWidgetAssistant::slotItemChanged()
|
||||||
|
{
|
||||||
|
enableButton( KDialog::User2, !m_widgetTypeList->selectedItems().isEmpty() );
|
||||||
|
}
|
||||||
|
|
||||||
void OpenWidgetAssistant::prepPage(KPageWidgetItem *current, KPageWidgetItem *before)
|
void OpenWidgetAssistant::prepPage(KPageWidgetItem *current, KPageWidgetItem *before)
|
||||||
{
|
{
|
||||||
Q_UNUSED(before)
|
Q_UNUSED(before)
|
||||||
|
if ( m_widgetTypeList->selectedItems().isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
if (current != m_filePage) {
|
if (current != m_filePage) {
|
||||||
return;
|
return;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
class KFileWidget;
|
class KFileWidget;
|
||||||
class KListWidget;
|
class KListWidget;
|
||||||
|
class QListWidgetItem;
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -42,7 +43,7 @@ protected Q_SLOTS:
|
|||||||
void prepPage(KPageWidgetItem *current, KPageWidgetItem *before);
|
void prepPage(KPageWidgetItem *current, KPageWidgetItem *before);
|
||||||
void finished();
|
void finished();
|
||||||
void slotHelpClicked();
|
void slotHelpClicked();
|
||||||
|
void slotItemChanged();
|
||||||
private:
|
private:
|
||||||
KPageWidgetItem *m_typePage;
|
KPageWidgetItem *m_typePage;
|
||||||
KPageWidgetItem *m_filePage;
|
KPageWidgetItem *m_filePage;
|
||||||
|
Loading…
Reference in New Issue
Block a user