summaryrefslogtreecommitdiffstats
path: root/src/MainWidget.cpp
diff options
context:
space:
mode:
authorRay-V <[email protected]>2021-02-11 11:37:04 +0900
committerMichele Calgaro <[email protected]>2021-02-11 12:36:02 +0900
commit16e7cd436a26f2c3c401034082e739543ec7860e (patch)
tree2a5545dac1cb23c36e46f133a182f9ab38f0131d /src/MainWidget.cpp
parent2c38847e01161b7e4720271b1b17e79007334855 (diff)
downloadkvkbd-16e7cd436a26f2c3c401034082e739543ec7860e.tar.gz
kvkbd-16e7cd436a26f2c3c401034082e739543ec7860e.zip
Added 'lock on screen' functionality.
Signed-off-by: Ray-V <[email protected]> Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit 0da79dd6ef5eae251828d32568aedb01240590b3)
Diffstat (limited to 'src/MainWidget.cpp')
-rw-r--r--src/MainWidget.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp
index 0ca175b..80a2b31 100644
--- a/src/MainWidget.cpp
+++ b/src/MainWidget.cpp
@@ -516,12 +516,14 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
bool fnt_autores = cfg->readBoolEntry("autoresfont",true);
m->setItemChecked(mnu_autores, fnt_autores);
-
mnu_dock = m->insertItem ( "Dock widget", this, TQT_SLOT ( showDock() ) );
bool show_dock = cfg->readBoolEntry("showdock",false);
-
m->setItemChecked(mnu_dock, show_dock);
+ mnu_lock = m->insertItem(i18n("Lock on screen"), this, TQT_SLOT(toggleLock()));
+ bool is_locked = cfg->readBoolEntry("locked", false);
+ m->setItemChecked(mnu_lock, is_locked);
+
//m->insertItem("Configure", this, TQT_SLOT(config()));
m->insertSeparator();
m->insertItem ( "Help", h->menu() );
@@ -728,6 +730,7 @@ void MainWidget::chooseFont()
if (c)show();
updateFont();
}
+
void MainWidget::quitClicked()
{
if (stand_alone)
@@ -735,6 +738,19 @@ void MainWidget::quitClicked()
else
hide();
}
+
+void MainWidget::toggleLock()
+{
+ bool c = isLocked();
+
+ tray->contextMenu()->setItemChecked(mnu_lock, !c);
+ setLocked(!c);
+
+ TDEConfig *cfg = TDEApplication::kApplication()->config();
+ cfg->writeEntry("locked", !c);
+ cfg->sync();
+}
+
void MainWidget::showDock()
{
bool c = dock->isShown();