diff options
author | Michele Calgaro <[email protected]> | 2021-02-11 12:15:48 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-02-11 12:15:48 +0900 |
commit | b53e33352c2b7de5521b0944b30a0b12afa2f97e (patch) | |
tree | 8a96ad0907b4d5f4f7eb29cf4af8128c68f4d091 | |
parent | 0da79dd6ef5eae251828d32568aedb01240590b3 (diff) | |
download | kvkbd-b53e33352c2b7de5521b0944b30a0b12afa2f97e.tar.gz kvkbd-b53e33352c2b7de5521b0944b30a0b12afa2f97e.zip |
Simplified code from previous commit and fixed 'lock on screen' functionality after restoring the keyboard from a previous run.
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r-- | src/DragWidget.cpp | 10 | ||||
-rw-r--r-- | src/DragWidget.h | 5 | ||||
-rw-r--r-- | src/MainWidget.cpp | 46 |
3 files changed, 20 insertions, 41 deletions
diff --git a/src/DragWidget.cpp b/src/DragWidget.cpp index d6e495c..395a56b 100644 --- a/src/DragWidget.cpp +++ b/src/DragWidget.cpp @@ -37,14 +37,4 @@ void DragWidget::mouseMoveEvent(TQMouseEvent *e) TQWidget::move(curr); } -void DragWidget::setLocked(bool mode) -{ - locked=mode; -} - -const bool DragWidget::isLocked() const -{ - return locked; -} - #include "DragWidget.moc" diff --git a/src/DragWidget.h b/src/DragWidget.h index ed311d3..0b2e988 100644 --- a/src/DragWidget.h +++ b/src/DragWidget.h @@ -12,11 +12,7 @@ public: DragWidget(TQWidget *parent=0, const char *name="", WFlags f=0); virtual ~DragWidget(); - void setLocked(bool mode); - const bool isLocked() const; - private: - bool drag; protected: @@ -26,7 +22,6 @@ protected: TQPoint dragP; TQPoint gpress; bool locked; - }; #endif diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp index 80a2b31..d320cea 100644 --- a/src/MainWidget.cpp +++ b/src/MainWidget.cpp @@ -49,12 +49,8 @@ bool shutting=false; MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const char * name, WFlags f ) : ResizableDragWidget ( parent,name,f ), stand_alone(tren) { - - tray=0; - nresize=false; - display=tqt_xdisplay(); //TQString k1= "`1234567890-="; @@ -500,7 +496,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const min->res(); connect ( min, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); - if (!stand_alone){ + if (!stand_alone) + { tray = new KbdTray ( this ); tray->setPixmap ( UserIcon ( "tray" ) ); @@ -521,8 +518,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const 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); + locked = cfg->readBoolEntry("locked", false); + m->setItemChecked(mnu_lock, locked); //m->insertItem("Configure", this, TQT_SLOT(config())); m->insertSeparator(); @@ -530,20 +527,21 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const tray->show(); - dock = new KbdDock ( this ); - if (show_dock){ + TQFont fnt = cfg->readFontEntry("KvkbdFont"); + m->setItemChecked(mnu_autores, fnt_autores); + setFont(fnt); + + dock = new KbdDock(this); + if (show_dock) + { dock->show(); - } - else{ + else + { dock->hide(); - } - - TQFont fnt = cfg->readFontEntry("KvkbdFont"); - m->setItemChecked(mnu_autores, fnt_autores); - setFont(fnt); + tray->contextMenu()->setItemChecked(mnu_lock, locked); popup_menu = new VButton ( this,"popupmenu" ); popup_menu->resize ( 15,30 ); @@ -555,16 +553,13 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const other_keys.append(popup_menu); connect ( popup_menu,TQT_SIGNAL ( clicked() ),this, TQT_SLOT ( showConfigMenu() ) ); - } - else{ + else + { setCaption("kvkbdalone"); - } - } - void MainWidget::finishInit() { TDEConfig *cfg = TDEApplication::kApplication()->config(); @@ -576,6 +571,7 @@ void MainWidget::finishInit() hide(); } } + bool MainWidget::close(bool alsoDelete) { shutting=true; @@ -741,13 +737,11 @@ void MainWidget::quitClicked() void MainWidget::toggleLock() { - bool c = isLocked(); - - tray->contextMenu()->setItemChecked(mnu_lock, !c); - setLocked(!c); + locked = !locked; + tray->contextMenu()->setItemChecked(mnu_lock, locked); TDEConfig *cfg = TDEApplication::kApplication()->config(); - cfg->writeEntry("locked", !c); + cfg->writeEntry("locked", locked); cfg->sync(); } |