Skip to content

Commit

Permalink
Fixing link completion in O header/N editor on macOS which resolves #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Dvořák authored and Martin Dvořák committed Mar 8, 2020
1 parent 1ccdede commit 29de855
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/qt/note_editor_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class NoteEditorView : public QPlainTextEdit
private slots:
void insertTab();
void insertCompletion(const QString& completion, bool singleWord=false);
void slotStartLinkCompletion();
public slots:
void slotStartLinkCompletion();
void slotPerformLinkCompletion(const QString& completionPrefix, std::vector<std::string>* links);

// line & line number
Expand Down
15 changes: 15 additions & 0 deletions app/src/qt/orloj_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ OrlojPresenter::OrlojPresenter(MainWindowPresenter* mainPresenter,
QObject::connect(
navigatorPresenter, SIGNAL(signalThingSelected()),
this, SLOT(slotShowNavigator()));
// N editor
#ifdef __APPLE__
QObject::connect(
mainPresenter->getMainMenu()->getView()->actionEditComplete, SIGNAL(triggered()),
this, SLOT(slotEditStartLinkCompletion()));
#endif
// editor getting data from the backend
QObject::connect(
view->getNoteEdit()->getNoteEditor(), SIGNAL(signalGetLinksForPattern(const QString&)),
Expand Down Expand Up @@ -794,6 +800,15 @@ void OrlojPresenter::refreshLiveNotePreview()
}
}

void OrlojPresenter::slotEditStartLinkCompletion()
{
if(isFacetActive(OrlojPresenterFacets::FACET_EDIT_NOTE)) {
view->getNoteEdit()->getNoteEditor()->slotStartLinkCompletion();
} else if(isFacetActive(OrlojPresenterFacets::FACET_EDIT_OUTLINE_HEADER)) {
view->getOutlineHeaderEdit()->getHeaderEditor()->slotStartLinkCompletion();
}
}

void OrlojPresenter::slotRefreshCurrentNotePreview()
{
MF_DEBUG("Slot to refresh live preview: " << getFacet() << " hoist: " << config.isUiHoistedMode() << endl);
Expand Down
1 change: 1 addition & 0 deletions app/src/qt/orloj_presenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public slots:
void slotRefreshCurrentNotePreview();
void slotOutlinesTableSorted(int column);
void slotToggleFullOutlinePreview();
void slotEditStartLinkCompletion();

signals:
void signalLinksForPattern(const QString& completionPrefix, std::vector<std::string>* links);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define MF_DEBUG(x) do { std::cerr << x; } while (0)

// enable/disable verbose debug of particular components
#define MF_DEBUG_HTML
//#define MF_DEBUG_HTML
//#define MF_DEBUG_ASYNC_TASKS
//#define MF_DEBUG_QRC
//#define MF_DEBUG_L10N
Expand Down

0 comments on commit 29de855

Please sign in to comment.