MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / NWebView

Method NWebView

gui/nwebview.cpp:46–253  ·  view source on GitHub ↗

Override the constructor so we always use a NWebPage rather than a QWebPage

Source from the content-addressed store, hash-verified

44// Override the constructor so we always use a NWebPage
45// rather than a QWebPage
46NWebView::NWebView(NBrowserWindow *parent) :
47 QWebView(parent)
48{
49 this->parent = parent;
50 editorPage = new NWebPage(this);
51 setPage(editorPage);
52 isDirty = false;
53 this->setFont(global.getGuiFont(font()));
54
55 contextMenu = new QMenu(this);
56 openAction = new QAction(tr("Open"), this);
57 contextMenu->addAction(openAction);
58 contextMenu->addSeparator();
59 contextMenu->setFont(global.getGuiFont(font()));
60
61 cutAction = new QAction(tr("Cut"), this);
62 this->setupShortcut(cutAction, "Edit_Cut");
63 contextMenu->addAction(cutAction);
64 connect(cutAction, SIGNAL(triggered()), parent, SLOT(cutButtonPressed()));
65
66 copyAction = new QAction(tr("Copy"), this);
67 this->setupShortcut(copyAction, "Edit_Copy");
68 contextMenu->addAction(copyAction);
69 connect(copyAction, SIGNAL(triggered()), parent, SLOT(copyButtonPressed()));
70
71 pasteAction = new QAction(tr("Paste"), this);
72 setupShortcut(pasteAction, "Edit_Paste");
73 contextMenu->addAction(pasteAction);
74 connect(pasteAction, SIGNAL(triggered()), parent, SLOT(pasteButtonPressed()));
75
76 pasteWithoutFormatAction = new QAction(tr("Paste as Unformatted Text"), this);
77 this->setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting");
78 contextMenu->addAction(pasteWithoutFormatAction);
79 connect(pasteWithoutFormatAction, SIGNAL(triggered()), parent, SLOT(pasteWithoutFormatButtonPressed()));
80
81 removeFormattingAction = new QAction(tr("Remove Formatting"), this);
82 this->setupShortcut(removeFormattingAction, "Edit_Remove_Formatting");
83 contextMenu->addAction(removeFormattingAction);
84 connect(removeFormattingAction, SIGNAL(triggered()), parent, SLOT(removeFormatButtonPressed()));
85
86 copyNoteUrlAction = new QAction(tr("Copy Note URL"), this);
87 this->setupShortcut(copyNoteUrlAction, "Edit_Copy_Note_Url");
88 contextMenu->addAction(copyNoteUrlAction);
89 connect(copyNoteUrlAction, SIGNAL(triggered()), parent, SLOT(copyNoteUrl()));
90
91 contextMenu->addSeparator();
92
93 QMenu *colorMenu = new QMenu(tr("Background Color"), this);
94 colorMenu->setFont(global.getGuiFont(font()));
95
96 // Build the background color menu
97 backgroundColorMapper = new QSignalMapper(this);
98 QAction *action;
99 ColorSettings colorSettings;
100 QList< QPair<QString,QString> > colorList = colorSettings.colorList();
101 for (int i=0; i<colorList.size(); i++) {
102 action = colorMenu->addAction(colorList[i].first);
103 backgroundColorMapper->setMapping(action, colorList[i].second);

Callers

nothing calls this directly

Calls 9

setupShortcutMethod · 0.95
getGuiFontMethod · 0.80
addSeparatorMethod · 0.80
colorListMethod · 0.80
setEnabledMethod · 0.80
getQssDirPathUserMethod · 0.80
getQssDirPathMethod · 0.80
setTextMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected