diff options
-rw-r--r-- | src/DragWidget.cpp | 26 | ||||
-rw-r--r-- | src/DragWidget.h | 4 | ||||
-rw-r--r-- | src/MainWidget.cpp | 20 | ||||
-rw-r--r-- | src/MainWidget.h | 3 | ||||
-rw-r--r-- | src/resizabledragwidget.cpp | 4 |
5 files changed, 48 insertions, 9 deletions
diff --git a/src/DragWidget.cpp b/src/DragWidget.cpp index 8517b99..d6e495c 100644 --- a/src/DragWidget.cpp +++ b/src/DragWidget.cpp @@ -4,33 +4,47 @@ DragWidget::DragWidget(TQWidget *parent, const char *name, WFlags f) : TQWidget( { dragP=TQPoint(0,0); drag=false; - + locked=false; } + DragWidget::~DragWidget() { - } void DragWidget::mousePressEvent(TQMouseEvent *e) { dragP=e->pos(); gpress=e->globalPos(); + if (locked) + { + return; + } drag=true; - } + void DragWidget::mouseReleaseEvent(TQMouseEvent *) { - drag=false; } + void DragWidget::mouseMoveEvent(TQMouseEvent *e) { - if (!drag) { + if (!drag) + { return; } TQPoint curr(e->globalPos().x()-dragP.x(),e->globalPos().y()-dragP.y()); 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 8519e16..ed311d3 100644 --- a/src/DragWidget.h +++ b/src/DragWidget.h @@ -12,6 +12,9 @@ public: DragWidget(TQWidget *parent=0, const char *name="", WFlags f=0); virtual ~DragWidget(); + void setLocked(bool mode); + const bool isLocked() const; + private: bool drag; @@ -22,6 +25,7 @@ protected: void mouseReleaseEvent ( TQMouseEvent * e ); TQPoint dragP; TQPoint gpress; + bool locked; }; 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(); diff --git a/src/MainWidget.h b/src/MainWidget.h index c9f85a8..d0fb301 100644 --- a/src/MainWidget.h +++ b/src/MainWidget.h @@ -63,6 +63,7 @@ public slots: void chooseFont(); void toggleNumericPad(); void toggleFontAutoRes(); + void toggleLock(); void restorePosition(); void showConfigMenu(); // void shutDown(); @@ -128,7 +129,7 @@ private: double sdxb; int mnu_dock; int mnu_autores; - + int mnu_lock; }; diff --git a/src/resizabledragwidget.cpp b/src/resizabledragwidget.cpp index ec48d6e..9cb3ade 100644 --- a/src/resizabledragwidget.cpp +++ b/src/resizabledragwidget.cpp @@ -36,6 +36,10 @@ ResizableDragWidget::~ResizableDragWidget() void ResizableDragWidget::mousePressEvent(TQMouseEvent * e) { + if (locked) + { + return; + } TQPoint pos = e->pos(); if (pos.x()>width()-20 && pos.x()<width() && pos.y()>height()-20 && pos.y()<height() ) { |