CppEditor: Fix sorting of quick fixes "Add {public, private, ...} declaration"

Change-Id: I43f09042a525a798d95b3365873be24eafd423e9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-06-03 14:57:13 +02:00
parent 5e5c5bb02b
commit b8a2983fd5
3 changed files with 11 additions and 25 deletions

View File

@@ -2334,8 +2334,8 @@ class InsertDeclOperation: public CppQuickFixOperation
public:
InsertDeclOperation(const QSharedPointer<const CppQuickFixAssistInterface> &interface,
const QString &targetFileName, const Class *targetSymbol,
InsertionPointLocator::AccessSpec xsSpec, const QString &decl)
: CppQuickFixOperation(interface, 0)
InsertionPointLocator::AccessSpec xsSpec, const QString &decl, int priority)
: CppQuickFixOperation(interface, priority)
, m_targetFileName(targetFileName)
, m_targetSymbol(targetSymbol)
, m_xsSpec(xsSpec)
@@ -2397,10 +2397,11 @@ public:
, m_decl(decl)
{}
TextEditor::QuickFixOperation::Ptr
operator()(InsertionPointLocator::AccessSpec xsSpec)
operator()(InsertionPointLocator::AccessSpec xsSpec, int priority)
{
return TextEditor::QuickFixOperation::Ptr(
new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl));
new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl,
priority));
}
private:
@@ -2462,12 +2463,12 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
// Add several possible insertion locations for declaration
DeclOperationFactory operation(interface, fileName, matchingClass, decl);
result.append(operation(InsertionPointLocator::Public));
result.append(operation(InsertionPointLocator::PublicSlot));
result.append(operation(InsertionPointLocator::Protected));
result.append(operation(InsertionPointLocator::ProtectedSlot));
result.append(operation(InsertionPointLocator::Private));
result.append(operation(InsertionPointLocator::PrivateSlot));
result.append(operation(InsertionPointLocator::Public, 5));
result.append(operation(InsertionPointLocator::PublicSlot, 4));
result.append(operation(InsertionPointLocator::Protected, 3));
result.append(operation(InsertionPointLocator::ProtectedSlot, 2));
result.append(operation(InsertionPointLocator::Private, 1));
result.append(operation(InsertionPointLocator::PrivateSlot, 0));
}
}