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>
(cherry picked from commit b53e33352c)
r14.0.x
Michele Calgaro 4 years ago
parent 16e7cd436a
commit 9ef732aa06
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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"

@ -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

@ -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();
}

Loading…
Cancel
Save