Commit b0577392 authored by Lasse Holmstedt's avatar Lasse Holmstedt

Fixed missing text/design mode sync warnings

Task-number: BAUHAUS-565
Reviewed-by:erikv
parent b2470265
......@@ -72,19 +72,13 @@ public:
enum Type {
NoError = 0,
InternalError = 1,
ParseError = 2,
EngineError = 3
ParseError = 2
};
public:
Error();
Error(const QDeclarativeError &qmlError);
Error(Exception *exception);
Error(const QUrl &url,
const QString &description,
int line = -1,
int column = -1,
Type type = EngineError);
Type type() const
{ return m_type; }
......
......@@ -65,6 +65,9 @@ public:
*/
void applyChanges();
bool hasNoPendingChanges() const
{ return m_rewriteActions.isEmpty(); }
void nodeCreated(const ModelNode &createdNode);
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
......
......@@ -71,15 +71,6 @@ RewriterView::Error::Error(const QDeclarativeError &qmlError):
{
}
RewriterView::Error::Error(const QUrl &url, const QString &description, int line,
int column, Type type):
m_type(type),
m_line(line),
m_column(column),
m_description(description),
m_url(url)
{}
QString RewriterView::Error::toString() const
{
QString str;
......@@ -342,6 +333,9 @@ void RewriterView::rootNodeTypeChanged(const QString &type, int majorVersion, in
void RewriterView::customNotification(const AbstractView * /*view*/, const QString &identifier, const QList<ModelNode> & /* nodeList */, const QList<QVariant> & /*data */)
{
if (identifier == StartRewriterAmend || identifier == EndRewriterAmend)
return; // we emitted this ourselves, so just ignore these notifications.
if (identifier == ("__start rewriter transaction__")) {
transactionLevel++;
setModificationGroupActive(true);
......@@ -396,6 +390,9 @@ void RewriterView::applyModificationGroupChanges()
void RewriterView::applyChanges()
{
if (modelToTextMerger()->hasNoPendingChanges())
return; // quick exit: nothing to be done.
clearErrors();
if (inErrorState()) {
......
......@@ -103,7 +103,12 @@ DocumentWarningWidget::DocumentWarningWidget(DesignModeWidget *parent) :
void DocumentWarningWidget::setError(const RewriterView::Error &error)
{
m_error = error;
QString str = tr("%3 (%1:%2)").arg(QString::number(error.line()), QString::number(error.column()), error.description());
QString str;
if (error.type() == RewriterView::Error::ParseError) {
str = tr("%3 (%1:%2)").arg(QString::number(error.line()), QString::number(error.column()), error.description());
} else if (error.type() == RewriterView::Error::InternalError) {
str = tr("Internal error (%1)") .arg(error.description());
}
m_errorMessage->setText(str);
resize(layout()->totalSizeHint());
......
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