From 0da79dd6ef5eae251828d32568aedb01240590b3 Mon Sep 17 00:00:00 2001 From: Ray-V Date: Thu, 11 Feb 2021 11:37:04 +0900 Subject: Added 'lock on screen' functionality. Signed-off-by: Ray-V Signed-off-by: Michele Calgaro --- src/MainWidget.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/MainWidget.cpp') 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(); -- cgit v1.2.1