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

Method trayActivated

nixnote.cpp:2844–2905  ·  view source on GitHub ↗

The tray icon was activated. If it was double clicked we restore the gui.

Source from the content-addressed store, hash-verified

2842// The tray icon was activated. If it was double clicked we restore the
2843// gui.
2844void NixNote::trayActivated(QSystemTrayIcon::ActivationReason reason) {
2845 int doNothing = 0;
2846 int showHide = 1;
2847 int newNote = 2;
2848 int newQuickNote = 3;
2849 int screenCapture = 4;
2850
2851 if (reason == QSystemTrayIcon::DoubleClick) {
2852 global.settings->beginGroup("Appearance");
2853 int value = global.settings->value("trayDoubleClickAction", -1).toInt();
2854 global.settings->endGroup();
2855 if (value == doNothing)
2856 return;
2857 if (value == showHide)
2858 toggleVisible();
2859 if (value == newNote) {
2860 if (!isVisible())
2861 toggleVisible();
2862 this->newNote();
2863 }
2864 if (value == newQuickNote)
2865 this->newExternalNote();
2866 if (value == screenCapture)
2867 this->screenCapture();
2868 }
2869 if (reason == QSystemTrayIcon::MiddleClick) {
2870 global.settings->beginGroup("Appearance");
2871 int value = global.settings->value("trayMiddleClickAction", -1).toInt();
2872 global.settings->endGroup();
2873 if (value == doNothing)
2874 return;
2875 if (value == showHide)
2876 toggleVisible();
2877 if (value == newNote) {
2878 if (!isVisible())
2879 toggleVisible();
2880 this->newNote();
2881 }
2882 if (value == newQuickNote)
2883 this->newExternalNote();
2884 if (value == screenCapture)
2885 this->screenCapture();
2886 }
2887 if (reason == QSystemTrayIcon::Trigger) {
2888 global.settings->beginGroup("Appearance");
2889 int value = global.settings->value("traySingleClickAction", -1).toInt();
2890 global.settings->endGroup();
2891 if (value == doNothing)
2892 return;
2893 if (value == showHide)
2894 toggleVisible();
2895 if (value == newNote) {
2896 if (!isVisible())
2897 toggleVisible();
2898 this->newNote();
2899 }
2900 if (value == newQuickNote)
2901 this->newExternalNote();

Callers

nothing calls this directly

Calls 4

newNoteMethod · 0.95
newExternalNoteMethod · 0.95
screenCaptureMethod · 0.95
valueMethod · 0.80

Tested by

no test coverage detected