From cfe30703da090180b66bc571e85654c71a7ee8e0 Mon Sep 17 00:00:00 2001 From: hakan Date: Tue, 07 May 2002 10:43:49 +0000 Subject: Moved ClickableLabel to libopie/OClickableLabel --- (limited to 'core/pim/datebook') diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp deleted file mode 100644 index 128bebb..0000000 --- a/core/pim/datebook/clickablelabel.cpp +++ b/dev/null @@ -1,88 +0,0 @@ -#include "clickablelabel.h" -#include - -ClickableLabel::ClickableLabel(QWidget* parent, - const char* name, - WFlags fl) : - QLabel(parent,name,fl) -{ - textInverted=false; - isToggle=false; - isDown=false; - showState(false); - setFrameShadow(Sunken); -} - -void ClickableLabel::setToggleButton(bool t) { - isToggle=t; -} - -void ClickableLabel::mousePressEvent( QMouseEvent *e ) { - if (isToggle && isDown) { - showState(false); - } else { - showState(true); - } -} - -void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { - if (rect().contains(e->pos()) && isToggle) isDown=!isDown; - - if (isToggle && isDown) { - showState(true); - } else { - showState(false); - } - - if (rect().contains(e->pos())) { - if (isToggle) { - emit toggled(isDown); - } - emit clicked(); - } -} - -void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { - if (rect().contains(e->pos())) { - if (isToggle && isDown) { - showState(false); - } else { - showState(true); - } - } else { - if (isToggle && isDown) { - showState(true); - } else { - showState(false); - } - } -} - -void ClickableLabel::showState(bool on) { - if (on) { - //setFrameShape(Panel); - setInverted(true); - setBackgroundMode(PaletteHighlight); - } else { - //setFrameShape(NoFrame); - setInverted(false); - setBackgroundMode(PaletteBackground); - } - repaint(); -} - -void ClickableLabel::setInverted(bool on) { - if ( (!textInverted && on) || (textInverted && !on) ) { - QPalette pal=palette(); - QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground); - col.setRgb(255-col.red(),255-col.green(),255-col.blue()); - pal.setColor(QPalette::Normal, QColorGroup::Foreground, col); - setPalette(pal); - textInverted=!textInverted; - } -} - -void ClickableLabel::setOn(bool on) { - isDown=on; - showState(isDown); -} diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h deleted file mode 100644 index d00fee6..0000000 --- a/core/pim/datebook/clickablelabel.h +++ b/dev/null @@ -1,30 +0,0 @@ -#ifndef CLICKABLELABEL -#define CLICKABLELABEL - -#include - -class ClickableLabel: public QLabel -{ - Q_OBJECT -public: - ClickableLabel(QWidget* parent = 0, const char* name = 0, - WFlags fl = 0); - void setToggleButton(bool t); - protected: - void mousePressEvent( QMouseEvent *e ); - void mouseReleaseEvent( QMouseEvent *e ); - void mouseMoveEvent( QMouseEvent *e ); - public slots: - void setOn(bool on); - signals: - void clicked(); - void toggled(bool on); - private: - bool isToggle; - bool isDown; - void showState(bool on); - bool textInverted; - void setInverted(bool on); -}; - -#endif diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index a8a9285..9383053 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro @@ -11,7 +11,6 @@ HEADERS = datebookday.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ - clickablelabel.h \ timepicker.h SOURCES = main.cpp \ @@ -24,7 +23,6 @@ SOURCES = main.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ - clickablelabel.cpp \ timepicker.cpp INTERFACES = dateentry.ui \ @@ -37,7 +35,7 @@ INTERFACES = dateentry.ui \ INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopie TARGET = datebook diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 85c745a..8e88377 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -143,7 +143,7 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, QWidget* parent, const char* name, WFlags fl) : - ClickableLabel(parent,name,fl), + OClickableLabel(parent,name,fl), event(ev) { char s[10]; diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index b0b0417..24f6c83 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h @@ -10,7 +10,7 @@ #include "datebookweeklstheader.h" #include "datebookweeklstdayhdr.h" -#include "clickablelabel.h" +#include class QDateTime; class DateBookDB; @@ -55,7 +55,7 @@ private: QDate date; }; -class DateBookWeekLstEvent: public ClickableLabel +class DateBookWeekLstEvent: public OClickableLabel { Q_OBJECT public: diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui index 2b68754..9499726 100644 --- a/core/pim/datebook/datebookweeklstdayhdr.ui +++ b/core/pim/datebook/datebookweeklstdayhdr.ui @@ -60,7 +60,7 @@ - ClickableLabel + OClickableLabel name label @@ -105,7 +105,7 @@ - ClickableLabel + OClickableLabel name add @@ -122,8 +122,8 @@ - ClickableLabel -
clickablelabel.h
+ OClickableLabel +
opie/oclickablelabel.h
-1 -1 diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index e14e2f5..c4f6c68 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -43,6 +43,7 @@ #include "timepicker.h" #include +#include /* * Constructs a DateEntry which is a child of 'parent', with the @@ -57,7 +58,8 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, const char* name ) : DateEntryBase( parent, name ), ampm( whichClock ), - startWeekOnMonday( startOnMonday ) + startWeekOnMonday( startOnMonday ), + m_showStart(true) { init(); setDates(start,end); @@ -113,7 +115,9 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, QWidget* parent, const char* name ) : DateEntryBase( parent, name ), ampm( whichClock ), - startWeekOnMonday( startOnMonday ) + startWeekOnMonday( startOnMonday ), + m_showStart(true) + { init(); setDates(event.start(),event.end()); diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control index 6566d50..9bef119 100644 --- a/core/pim/datebook/opie-datebook.control +++ b/core/pim/datebook/opie-datebook.control @@ -4,6 +4,6 @@ Section: opie/applications Maintainer: Warwick Allison Architecture: arm Version: $QPE_VERSION-$SUB_VERSION -Depends: opie-base ($QPE_VERSION) +Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) Description: A datebook/appointment manager A datebook/appointment manager for the Opie environment. diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp index 43e05ad..f2cb71d 100644 --- a/core/pim/datebook/timepicker.cpp +++ b/core/pim/datebook/timepicker.cpp @@ -3,7 +3,6 @@ #include #include #include -#include "clickablelabel.h" #include #include @@ -13,7 +12,7 @@ TimePicker::TimePicker(QWidget* parent, const char* name, { QVBoxLayout *vbox=new QVBoxLayout(this); - ClickableLabel *r; + OClickableLabel *r; QString s; // Hour Row @@ -23,7 +22,7 @@ TimePicker::TimePicker(QWidget* parent, const char* name, for (int i=0; i<24; i++) { - r=new ClickableLabel(row); + r=new OClickableLabel(row); hourLst.append(r); s.sprintf("%.2d",i); r->setText(s); @@ -46,7 +45,7 @@ TimePicker::TimePicker(QWidget* parent, const char* name, vbox->addWidget(row); for (int i=0; i<60; i+=5) { - r=new ClickableLabel(row); + r=new OClickableLabel(row); minuteLst.append(r); s.sprintf("%.2d",i); r->setText(s); @@ -60,10 +59,10 @@ TimePicker::TimePicker(QWidget* parent, const char* name, void TimePicker::slotHour(bool b) { - ClickableLabel *r = (ClickableLabel *) sender(); + OClickableLabel *r = (OClickableLabel *) sender(); if (b) { - QValueListIterator it; + QValueListIterator it; for (it=hourLst.begin(); it!=hourLst.end(); it++) { if (*it != r) (*it)->setOn(false); else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); @@ -77,10 +76,10 @@ void TimePicker::slotHour(bool b) { void TimePicker::slotMinute(bool b) { - ClickableLabel *r = (ClickableLabel *) sender(); + OClickableLabel *r = (OClickableLabel *) sender(); if (b) { - QValueListIterator it; + QValueListIterator it; for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { if (*it != r) (*it)->setOn(false); else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); @@ -97,7 +96,7 @@ void TimePicker::setMinute(int m) { QString minute; minute.sprintf("%.2d",m); - QValueListIterator it; + QValueListIterator it; for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { if ((*it)->text() == minute) (*it)->setOn(true); else (*it)->setOn(false); @@ -111,7 +110,7 @@ void TimePicker::setHour(int h) { QString hour; hour.sprintf("%.2d",h); - QValueListIterator it; + QValueListIterator it; for (it=hourLst.begin(); it!=hourLst.end(); it++) { if ((*it)->text() == hour) (*it)->setOn(true); else (*it)->setOn(false); diff --git a/core/pim/datebook/timepicker.h b/core/pim/datebook/timepicker.h index 0acadcb..1c35600 100644 --- a/core/pim/datebook/timepicker.h +++ b/core/pim/datebook/timepicker.h @@ -3,7 +3,7 @@ #include #include -#include "clickablelabel.h" +#include #include class TimePicker: public QWidget { @@ -16,8 +16,8 @@ class TimePicker: public QWidget { void setMinute(int m); private: - QValueList hourLst; - QValueList minuteLst; + QValueList hourLst; + QValueList minuteLst; QTime tm; private slots: -- cgit v0.9.0.2