Commit 94fa064e authored by Michael Zanetti's avatar Michael Zanetti Committed by Michael Zanetti
Browse files

Correctly disable buttons in case a remote control is not available.

Make it more obvious when a remote is not available.

Fixes some crash reports when people tried to edit a non existent remote:

BUG: 287568
BUG: 284640
BUG: 287568
BUG: 301046
parent 29101b9f
......@@ -317,10 +317,12 @@ void KCMRemoteControl::updateActions(Mode *mode) {
void KCMRemoteControl::modeSelectionChanged(const QModelIndex &index) {
if(index.isValid()){
ui.pbAddMode->setEnabled(true);
ui.pbEditMode->setEnabled(true);
ui.pbAddAction->setEnabled(true);
ui.pbAutoPopulate->setEnabled(true);
// Enable Add and Edit buttons only if remote is available
bool selectedRemoteAvailable = m_remoteModel->remote(index)->isAvailable();
ui.pbAddMode->setEnabled(selectedRemoteAvailable);
ui.pbEditMode->setEnabled(selectedRemoteAvailable);
ui.pbAddAction->setEnabled(selectedRemoteAvailable);
ui.pbAutoPopulate->setEnabled(selectedRemoteAvailable);
// Only enable the remove mode button if a non-Master mode is selected,
// or if the Remote is not available in in the system
......
......@@ -763,7 +763,16 @@ QVariant RemoteItem::data(int role) const {
return remote->name();
}
if(role == Qt::DecorationRole){
return KIcon(remote->masterMode()->iconName());
if(remote->isAvailable()) {
return KIcon(remote->masterMode()->iconName());
} else {
return KIcon(remote->masterMode()->iconName(), 0, QStringList() << QLatin1String("emblem-important"));
}
}
if(role == Qt::ToolTipRole) {
if(!remote->isAvailable()) {
return i18n("This remote control is currently not available.");
}
}
return QStandardItem::data(role);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment