Simplified code from previous commit and fixed 'lock on screen' functionality after restoring the keyboard from a previous run.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/10/head
Michele Calgaro 4 years ago
parent 0da79dd6ef
commit b53e33352c
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -37,14 +37,4 @@ void DragWidget::mouseMoveEvent(TQMouseEvent *e)
TQWidget::move(curr); TQWidget::move(curr);
} }
void DragWidget::setLocked(bool mode)
{
locked=mode;
}
const bool DragWidget::isLocked() const
{
return locked;
}
#include "DragWidget.moc" #include "DragWidget.moc"

@ -12,11 +12,7 @@ public:
DragWidget(TQWidget *parent=0, const char *name="", WFlags f=0); DragWidget(TQWidget *parent=0, const char *name="", WFlags f=0);
virtual ~DragWidget(); virtual ~DragWidget();
void setLocked(bool mode);
const bool isLocked() const;
private: private:
bool drag; bool drag;
protected: protected:
@ -26,7 +22,6 @@ protected:
TQPoint dragP; TQPoint dragP;
TQPoint gpress; TQPoint gpress;
bool locked; bool locked;
}; };
#endif #endif

@ -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) MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const char * name, WFlags f ) : ResizableDragWidget ( parent,name,f ), stand_alone(tren)
{ {
tray=0; tray=0;
nresize=false; nresize=false;
display=tqt_xdisplay(); display=tqt_xdisplay();
//TQString k1= "`1234567890-="; //TQString k1= "`1234567890-=";
@ -500,7 +496,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
min->res(); min->res();
connect ( min, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); connect ( min, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
if (!stand_alone){ if (!stand_alone)
{
tray = new KbdTray ( this ); tray = new KbdTray ( this );
tray->setPixmap ( UserIcon ( "tray" ) ); tray->setPixmap ( UserIcon ( "tray" ) );
@ -521,8 +518,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
m->setItemChecked(mnu_dock, show_dock); m->setItemChecked(mnu_dock, show_dock);
mnu_lock = m->insertItem(i18n("Lock on screen"), this, TQT_SLOT(toggleLock())); mnu_lock = m->insertItem(i18n("Lock on screen"), this, TQT_SLOT(toggleLock()));
bool is_locked = cfg->readBoolEntry("locked", false); locked = cfg->readBoolEntry("locked", false);
m->setItemChecked(mnu_lock, is_locked); m->setItemChecked(mnu_lock, locked);
//m->insertItem("Configure", this, TQT_SLOT(config())); //m->insertItem("Configure", this, TQT_SLOT(config()));
m->insertSeparator(); m->insertSeparator();
@ -530,20 +527,21 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
tray->show(); tray->show();
dock = new KbdDock ( this ); TQFont fnt = cfg->readFontEntry("KvkbdFont");
if (show_dock){ m->setItemChecked(mnu_autores, fnt_autores);
setFont(fnt);
dock = new KbdDock(this);
if (show_dock)
{
dock->show(); dock->show();
} }
else{ else
{
dock->hide(); 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 = new VButton ( this,"popupmenu" );
popup_menu->resize ( 15,30 ); popup_menu->resize ( 15,30 );
@ -555,16 +553,13 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
other_keys.append(popup_menu); other_keys.append(popup_menu);
connect ( popup_menu,TQT_SIGNAL ( clicked() ),this, TQT_SLOT ( showConfigMenu() ) ); connect ( popup_menu,TQT_SIGNAL ( clicked() ),this, TQT_SLOT ( showConfigMenu() ) );
} }
else{ else
{
setCaption("kvkbdalone"); setCaption("kvkbdalone");
} }
} }
void MainWidget::finishInit() void MainWidget::finishInit()
{ {
TDEConfig *cfg = TDEApplication::kApplication()->config(); TDEConfig *cfg = TDEApplication::kApplication()->config();
@ -576,6 +571,7 @@ void MainWidget::finishInit()
hide(); hide();
} }
} }
bool MainWidget::close(bool alsoDelete) bool MainWidget::close(bool alsoDelete)
{ {
shutting=true; shutting=true;
@ -741,13 +737,11 @@ void MainWidget::quitClicked()
void MainWidget::toggleLock() void MainWidget::toggleLock()
{ {
bool c = isLocked(); locked = !locked;
tray->contextMenu()->setItemChecked(mnu_lock, locked);
tray->contextMenu()->setItemChecked(mnu_lock, !c);
setLocked(!c);
TDEConfig *cfg = TDEApplication::kApplication()->config(); TDEConfig *cfg = TDEApplication::kApplication()->config();
cfg->writeEntry("locked", !c); cfg->writeEntry("locked", locked);
cfg->sync(); cfg->sync();
} }

Loading…
Cancel
Save