summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-02-11 12:15:48 +0900
committerMichele Calgaro <[email protected]>2021-02-11 12:36:09 +0900
commit9ef732aa0682eeb945d8a16839487f30c0e76db5 (patch)
tree74c8ce9c025016446be6f795ca4be50bdddc1bb9 /src
parent16e7cd436a26f2c3c401034082e739543ec7860e (diff)
downloadkvkbd-9ef732aa0682eeb945d8a16839487f30c0e76db5.tar.gz
kvkbd-9ef732aa0682eeb945d8a16839487f30c0e76db5.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]> (cherry picked from commit b53e33352c2b7de5521b0944b30a0b12afa2f97e)
Diffstat (limited to 'src')
-rw-r--r--src/DragWidget.cpp10
-rw-r--r--src/DragWidget.h5
-rw-r--r--src/MainWidget.cpp46
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();
}