diff options
Diffstat (limited to 'source/kde/patch/calligra/0066-Backport-Plan-Do-not-crash-if-scheduler-plugins-not-.patch')
-rw-r--r-- | source/kde/patch/calligra/0066-Backport-Plan-Do-not-crash-if-scheduler-plugins-not-.patch | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/source/kde/patch/calligra/0066-Backport-Plan-Do-not-crash-if-scheduler-plugins-not-.patch b/source/kde/patch/calligra/0066-Backport-Plan-Do-not-crash-if-scheduler-plugins-not-.patch new file mode 100644 index 00000000..efbd9ac8 --- /dev/null +++ b/source/kde/patch/calligra/0066-Backport-Plan-Do-not-crash-if-scheduler-plugins-not-.patch @@ -0,0 +1,138 @@ +From 4d9762cd151b7d6a208aece8cebcdbe09bd41703 Mon Sep 17 00:00:00 2001 +From: Dag Andersen <danders@get2net.dk> +Date: Mon, 22 Aug 2016 09:15:32 +0200 +Subject: [PATCH 66/80] Backport: Plan: Do not crash if scheduler plugins not + found + +Shouldn't happen atm, but... +--- + plan/libs/models/kptschedulemodel.cpp | 69 ++++++++++++++++++++++------------- + 1 file changed, 43 insertions(+), 26 deletions(-) + +diff --git a/plan/libs/models/kptschedulemodel.cpp b/plan/libs/models/kptschedulemodel.cpp +index 35b74bc..e3ce298 100644 +--- a/plan/libs/models/kptschedulemodel.cpp ++++ b/plan/libs/models/kptschedulemodel.cpp +@@ -252,9 +252,16 @@ Qt::ItemFlags ScheduleItemModel::flags( const QModelIndex &index ) const + if ( !m_readWrite ) { + return flags &= ~Qt::ItemIsEditable; + } +- flags &= ~Qt::ItemIsEditable; + ScheduleManager *sm = manager( index ); +- int capabilities = sm->schedulerPlugin()->capabilities(); ++ if ( sm == 0 ) { ++ return flags; ++ } ++ SchedulerPlugin *pl = sm->schedulerPlugin(); ++ if ( pl == 0 ) { ++ return flags; ++ } ++ int capabilities = pl->capabilities(); ++ flags &= ~Qt::ItemIsEditable; + if ( sm && ! sm->isBaselined() ) { + switch ( index.column() ) { + case ScheduleModel::ScheduleState: break; +@@ -452,7 +459,11 @@ QVariant ScheduleItemModel::allowOverbooking( const QModelIndex &index, int role + if ( sm == 0 ) { + return QVariant(); + } +- int capabilities = sm->schedulerPlugin()->capabilities(); ++ SchedulerPlugin *pl = sm->schedulerPlugin(); ++ if ( pl == 0 ) { ++ return QVariant(); ++ } ++ int capabilities = pl->capabilities(); + switch ( role ) { + case Qt::EditRole: + return sm->allowOverbooking(); +@@ -480,11 +491,11 @@ QVariant ScheduleItemModel::allowOverbooking( const QModelIndex &index, int role + if ( capabilities & SchedulerPlugin::AllowOverbooking ) { + return sm->allowOverbooking() + ? i18nc( "@info:tooltip", "Allow overbooking of resources" ) +- : i18nc( "@info:tooltip 1=scheduler name", "%1 always allows overbooking of resources", sm->schedulerPlugin()->name() ); ++ : i18nc( "@info:tooltip 1=scheduler name", "%1 always allows overbooking of resources", pl->name() ); + } + if ( capabilities & SchedulerPlugin::AvoidOverbooking ) { + return sm->allowOverbooking() +- ? i18nc( "@info:tooltip 1=scheduler name", "%1 always avoids overbooking of resources", sm->schedulerPlugin()->name() ) ++ ? i18nc( "@info:tooltip 1=scheduler name", "%1 always avoids overbooking of resources", pl->name() ) + : i18nc( "@info:tooltip", "Avoid overbooking resources" ); + } + break; +@@ -637,7 +648,11 @@ QVariant ScheduleItemModel::schedulingDirection( const QModelIndex &index, int r + if ( sm == 0 ) { + return QVariant(); + } +- int capabilities = sm->schedulerPlugin()->capabilities(); ++ SchedulerPlugin *pl = sm->schedulerPlugin(); ++ if ( pl == 0 ) { ++ return QVariant(); ++ } ++ int capabilities = pl->capabilities(); + switch ( role ) { + case Qt::EditRole: + return sm->schedulingDirection(); +@@ -664,13 +679,13 @@ QVariant ScheduleItemModel::schedulingDirection( const QModelIndex &index, int r + } + if ( capabilities & SchedulerPlugin::ScheduleForward ) { + return sm->schedulingDirection() +- ? i18nc( "@info:tooltip 1=scheduler name", "%1 always schedules from target start time", sm->schedulerPlugin()->name() ) ++ ? i18nc( "@info:tooltip 1=scheduler name", "%1 always schedules from target start time", pl->name() ) + : i18nc( "@info:tooltip", "Schedule project from target start time" ); + } + if ( capabilities & SchedulerPlugin::ScheduleBackward ) { + return sm->schedulingDirection() + ? i18nc( "@info:tooltip", "Schedule project from target end time" ) +- : i18nc( "@info:tooltip 1=scheduler name", "%1 always schedules from target end time", sm->schedulerPlugin()->name() ); ++ : i18nc( "@info:tooltip 1=scheduler name", "%1 always schedules from target end time", pl->name() ); + } + break; + case Role::EnumList: +@@ -708,24 +723,26 @@ QVariant ScheduleItemModel::scheduler( const QModelIndex &index, int role ) cons + return QVariant(); + } + SchedulerPlugin *pl = sm->schedulerPlugin(); +- switch ( role ) { +- case Qt::EditRole: +- return sm->schedulerPluginId(); +- case Qt::DisplayRole: +- return pl ? pl->name() : i18n( "Unknown" ); +- case Qt::ToolTipRole: +- return pl ? pl->comment() : QString(); +- case Role::EnumList: +- return sm->schedulerPluginNames(); +- case Role::EnumListValue: +- return sm->schedulerPluginIndex(); +- case Qt::TextAlignmentRole: +- return Qt::AlignCenter; +- case Qt::StatusTipRole: +- return QVariant(); +- case Qt::WhatsThisRole: { +- QString s = pl->description(); +- return s.isEmpty() ? QVariant() : QVariant( s ); ++ if ( pl ) { ++ switch ( role ) { ++ case Qt::EditRole: ++ return sm->schedulerPluginId(); ++ case Qt::DisplayRole: ++ return pl ? pl->name() : i18n( "Unknown" ); ++ case Qt::ToolTipRole: ++ return pl ? pl->comment() : QString(); ++ case Role::EnumList: ++ return sm->schedulerPluginNames(); ++ case Role::EnumListValue: ++ return sm->schedulerPluginIndex(); ++ case Qt::TextAlignmentRole: ++ return Qt::AlignCenter; ++ case Qt::StatusTipRole: ++ return QVariant(); ++ case Qt::WhatsThisRole: { ++ QString s = pl->description(); ++ return s.isEmpty() ? QVariant() : QVariant( s ); ++ } + } + } + return QVariant(); +-- +2.7.4 + |