butMoreInfo = new QPushButton( QIcon( ":/menu/info" ),
qtr( "More information..." ),
this );
- CONNECT( butMoreInfo, clicked(),
- this, moreInformation() );
+ CONNECT( butMoreInfo, clicked(), this, moreInformation() );
hbox->addWidget( butMoreInfo );
// Reload button
QPushButton *reload = new QPushButton( QIcon( ":/update" ),
qtr( "Reload extensions" ),
this );
- CONNECT( reload, clicked(),
- EM, reloadExtensions() );
+ CONNECT( reload, clicked(), EM, reloadExtensions() );
+ CONNECT( reload, clicked(), this, updateButtons() );
+ CONNECT( extList->selectionModel(),
+ selectionChanged( const QItemSelection &, const QItemSelection & ),
+ this,
+ updateButtons() );
hbox->addWidget( reload );
// Add buttons hbox
layout->addItem( hbox );
+ updateButtons();
}
ExtensionTab::~ExtensionTab()
{
}
+void ExtensionTab::updateButtons()
+{
+ butMoreInfo->setEnabled( extList->selectionModel()->hasSelection() );
+}
+
// Do not close on ESC or ENTER
void ExtensionTab::keyPressEvent( QKeyEvent *keyEvent )
{
// Show more information
void ExtensionTab::moreInformation()
{
- if( !extList->selectionModel() ||
- extList->selectionModel()->selectedIndexes().isEmpty() )
-
- {
- return;
- }
-
QModelIndex index = extList->selectionModel()->selectedIndexes().first();
ExtensionCopy *ext = (ExtensionCopy*) index.internalPointer();
if( !ext )