diff options
| author | Tannin <devnull@localhost> | 2015-01-11 11:17:04 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-01-11 11:17:04 +0100 |
| commit | 1321564a926c88b6c09311ccd5902c9bbd522bfe (patch) | |
| tree | b60c660bdba04c8d3d3ceca230c214b82c61d7da /src | |
| parent | 4d9795527d1b9fa77ceb0106f308a13f24e1fca4 (diff) | |
bugfix: priority couldn't be changed directly in plugin list (this change was apparently not copied to the branch)
Diffstat (limited to 'src')
| -rw-r--r-- | src/pluginlist.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 9e8e242e..a97ad7af 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -773,7 +773,8 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const { int index = modelIndex.row(); - if (role == Qt::DisplayRole) { + if ((role == Qt::DisplayRole) + || (role == Qt::EditRole)) { switch (modelIndex.column()) { case COL_NAME: { return m_ESPs[index].m_Name; @@ -886,6 +887,8 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const bool PluginList::setData(const QModelIndex &modIndex, const QVariant &value, int role) { + bool result = true; + if (role == Qt::CheckStateRole) { m_ESPs[modIndex.row()].m_Enabled = value.toInt() == Qt::Checked; emit dataChanged(modIndex, modIndex); @@ -893,10 +896,19 @@ bool PluginList::setData(const QModelIndex &modIndex, const QVariant &value, int refreshLoadOrder(); startSaveTime(); - return true; - } else { - return false; + result = true; + } else if (role == Qt::EditRole) { + if (modIndex.column() == COL_PRIORITY) { + bool ok = false; + int newPriority = value.toInt(&ok); + if (ok) { + setPluginPriority(modIndex.row(), newPriority); + result = true; + } + refreshLoadOrder(); + } } + return result; } @@ -928,6 +940,9 @@ Qt::ItemFlags PluginList::flags(const QModelIndex &modelIndex) const if (!m_ESPs[index].m_ForceEnabled) { result |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; } + if (modelIndex.column() == COL_PRIORITY) { + result |= Qt::ItemIsEditable; + } } else { result |= Qt::ItemIsDropEnabled; } |
