diff options
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp b/SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp index 9dc85f7..c3fd257 100644 --- a/SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/sqleditor.cpp @@ -1,4 +1,5 @@ #include "sqleditor.h" +#include "log.h" #include "uiconfig.h" #include "uiutils.h" #include "services/config.h" @@ -93,7 +94,7 @@ void SqlEditor::init() connect(this, &QWidget::customContextMenuRequested, this, &SqlEditor::customContextMenuRequested); connect(CFG_UI.Fonts.SqlEditor, SIGNAL(changed(QVariant)), this, SLOT(changeFont(QVariant))); - connect(CFG, SIGNAL(massSaveCommited()), this, SLOT(configModified())); + connect(CFG, SIGNAL(massSaveCommitted()), this, SLOT(configModified())); } void SqlEditor::removeErrorMarkers() @@ -135,10 +136,10 @@ void SqlEditor::createActions() createAction(MOVE_BLOCK_UP, tr("Move block up", "sql editor"), this, SLOT(moveBlockUp()), this); createAction(COPY_BLOCK_DOWN, tr("Copy block down", "sql editor"), this, SLOT(copyBlockDown()), this); createAction(COPY_BLOCK_UP, tr("Copy up down", "sql editor"), this, SLOT(copyBlockUp()), this); - createAction(FIND, ICONS.ACT_SEARCH, tr("Find", "sql editor"), this, SLOT(find()), this); + createAction(FIND, ICONS.SEARCH, tr("Find", "sql editor"), this, SLOT(find()), this); createAction(FIND_NEXT, tr("Find next", "sql editor"), this, SLOT(findNext()), this); createAction(FIND_PREV, tr("Find previous", "sql editor"), this, SLOT(findPrevious()), this); - createAction(REPLACE, tr("Replace", "sql editor"), this, SLOT(replace()), this); + createAction(REPLACE, ICONS.SEARCH_AND_REPLACE, tr("Replace", "sql editor"), this, SLOT(replace()), this); createAction(TOGGLE_COMMENT, tr("Toggle comment", "sql editor"), this, SLOT(toggleComment()), this); actionMap[CUT]->setEnabled(false); @@ -213,7 +214,8 @@ bool SqlEditor::handleValidObjectContextMenu(const QPoint& pos) if (!obj) return false; - QString objName = toPlainText().mid(obj->from, (obj->to - obj->from + 1)); + Dialect dialect = getDialect(); + QString objName = stripObjName(toPlainText().mid(obj->from, (obj->to - obj->from + 1)), dialect); validObjContextMenu->clear(); @@ -832,7 +834,7 @@ void SqlEditor::completerRightPressed() void SqlEditor::parseContents() { - if (document()->characterCount() > 100000) + if (document()->characterCount() > SqliteSyntaxHighlighter::MAX_QUERY_LENGTH) { if (richFeaturesEnabled) notifyWarn(tr("Contents of the SQL editor are huge, so errors detecting and existing objects highlighting are temporarily disabled.")); @@ -860,11 +862,14 @@ void SqlEditor::parseContents() } queryParser->setDialect(dialect); - queryParser->parse(sql); + if (richFeaturesEnabled) + { + queryParser->parse(sql); + checkForValidObjects(); + checkForSyntaxErrors(); + highlighter->rehighlight(); + } - checkForValidObjects(); - checkForSyntaxErrors(); - highlighter->rehighlight(); } void SqlEditor::checkForSyntaxErrors() @@ -1494,7 +1499,7 @@ void SqlEditor::mousePressEvent(QMouseEvent* e) if (obj && e->button() == Qt::LeftButton) { QString objName = toPlainText().mid(obj->from, (obj->to - obj->from + 1)); - openObject(obj->dbName, objName); + openObject(obj->dbName, stripObjName(objName, getDialect())); } } |
