summaryrefslogtreecommitdiff
path: root/core/pim/datebook
Side-by-side diff
Diffstat (limited to 'core/pim/datebook') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/clickablelabel.cpp88
-rw-r--r--core/pim/datebook/clickablelabel.h30
-rw-r--r--core/pim/datebook/datebook.pro4
-rw-r--r--core/pim/datebook/datebookweeklst.cpp2
-rw-r--r--core/pim/datebook/datebookweeklst.h4
-rw-r--r--core/pim/datebook/datebookweeklstdayhdr.ui8
-rw-r--r--core/pim/datebook/dateentryimpl.cpp8
-rw-r--r--core/pim/datebook/opie-datebook.control2
-rw-r--r--core/pim/datebook/timepicker.cpp19
-rw-r--r--core/pim/datebook/timepicker.h6
10 files changed, 27 insertions, 144 deletions
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 <stdio.h>
-
-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 <qlabel.h>
-
-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
@@ -2,51 +2,49 @@ TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = datebookday.h \
datebook.h \
dateentryimpl.h \
datebookdayheaderimpl.h \
datebooksettings.h \
datebookweek.h \
datebookweeklst.h \
datebookweekheaderimpl.h \
repeatentry.h \
- clickablelabel.h \
timepicker.h
SOURCES = main.cpp \
datebookday.cpp \
datebook.cpp \
dateentryimpl.cpp \
datebookdayheaderimpl.cpp \
datebooksettings.cpp \
datebookweek.cpp \
datebookweeklst.cpp \
datebookweekheaderimpl.cpp \
repeatentry.cpp \
- clickablelabel.cpp \
timepicker.cpp
INTERFACES = dateentry.ui \
datebookdayheader.ui \
datebooksettingsbase.ui \
datebookweekheader.ui \
datebookweeklstheader.ui \
datebookweeklstdayhdr.ui \
repeatentrybase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe
+LIBS += -lqpe -lopie
TARGET = datebook
TRANSLATIONS = ../i18n/pt_BR/datebook.ts
TRANSLATIONS += ../i18n/de/datebook.ts
TRANSLATIONS += ../i18n/en/datebook.ts
TRANSLATIONS += ../i18n/hu/datebook.ts
TRANSLATIONS += ../i18n/pl/datebook.ts
TRANSLATIONS += ../i18n/sl/datebook.ts
TRANSLATIONS += ../i18n/ja/datebook.ts
TRANSLATIONS += ../i18n/ko/datebook.ts
TRANSLATIONS += ../i18n/no/datebook.ts
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
@@ -134,25 +134,25 @@ void DateBookWeekLstDayHdr::showDay() {
void DateBookWeekLstDayHdr::newEvent() {
QDateTime start, stop;
start=stop=date;
start.setTime(QTime(10,0));
stop.setTime(QTime(12,0));
emit addEvent(start,stop,"");
}
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];
if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
if ( ev.endDate() == ev.date() ) { // last day
strcpy(s, "__|__");
} else {
strcpy(s, " |---");
}
} else {
sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
}
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
@@ -1,25 +1,25 @@
#ifndef DATEBOOKWEEKLST
#define DATEBOOKWEEKLST
#include <qwidget.h>
#include <qdatetime.h>
#include <qpe/event.h>
#include <qlabel.h>
#include <qscrollview.h>
#include "datebookweeklstheader.h"
#include "datebookweeklstdayhdr.h"
-#include "clickablelabel.h"
+#include <opie/oclickablelabel.h>
class QDateTime;
class DateBookDB;
class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase
{
Q_OBJECT
public:
DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0,
WFlags fl = 0 );
~DateBookWeekLstHeader();
void setDate(const QDate &d);
@@ -46,25 +46,25 @@ public:
WFlags fl = 0 );
public slots:
void showDay();
void newEvent();
signals:
void showDate(int y, int m, int d);
void addEvent(const QDateTime &start, const QDateTime &stop,
const QString &str);
private:
QDate date;
};
-class DateBookWeekLstEvent: public ClickableLabel
+class DateBookWeekLstEvent: public OClickableLabel
{
Q_OBJECT
public:
DateBookWeekLstEvent(const EffectiveEvent &ev,
QWidget* parent = 0, const char* name = 0,
WFlags fl = 0);
signals:
void editEvent(const Event &e);
private slots:
void editMe();
private:
const EffectiveEvent event;
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
@@ -51,25 +51,25 @@
<name>maximumSize</name>
<size>
<width>32767</width>
<height>32767</height>
</size>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget>
- <class>ClickableLabel</class>
+ <class>OClickableLabel</class>
<property stdset="1">
<name>name</name>
<cstring>label</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
@@ -96,43 +96,43 @@
<name>maximumSize</name>
<size>
<width>32767</width>
<height>32767</height>
</size>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget>
- <class>ClickableLabel</class>
+ <class>OClickableLabel</class>
<property stdset="1">
<name>name</name>
<cstring>add</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
</widget>
</hbox>
</widget>
<customwidgets>
<customwidget>
- <class>ClickableLabel</class>
- <header location="local">clickablelabel.h</header>
+ <class>OClickableLabel</class>
+ <header location="global">opie/oclickablelabel.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>5</hordata>
<verdata>5</verdata>
</sizepolicy>
<pixmap>image0</pixmap>
</customwidget>
</customwidgets>
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
@@ -34,39 +34,41 @@
#include <qcombobox.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpopupmenu.h>
#include <qscrollview.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include "timepicker.h"
#include <stdlib.h>
+#include <stdio.h>
/*
* Constructs a DateEntry which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
const QDateTime &end, bool whichClock, QWidget* parent,
const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
- startWeekOnMonday( startOnMonday )
+ startWeekOnMonday( startOnMonday ),
+ m_showStart(true)
{
init();
setDates(start,end);
setFocusProxy(comboDescription);
}
bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
{
if( ev->type() == QEvent::FocusIn ){
if( obj == comboStart ){
timePickerStart->setHour(startTime.hour());
timePickerStart->setMinute(startTime.minute());
@@ -104,25 +106,27 @@ static void addOrPick( QComboBox* combo, const QString& t )
}
}
// Else add one
combo->insertItem(t);
combo->setCurrentItem(combo->count()-1);
}
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());
comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
if(!event.description().isEmpty())
addOrPick( comboDescription, event.description() );
if(!event.location().isEmpty())
addOrPick( comboLocation, event.location() );
checkAlarm->setChecked( event.hasAlarm() );
checkAllDay->setChecked( event.type() == Event::AllDay );
if(!event.notes().isEmpty())
editNote->setText(event.notes());
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
@@ -1,9 +1,9 @@
Files: bin/datebook apps/Applications/datebook.desktop
Priority: optional
Section: opie/applications
Maintainer: Warwick Allison <warwick@trolltech.com>
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
@@ -1,120 +1,119 @@
#include "timepicker.h"
#include <qbuttongroup.h>
#include <qtoolbutton.h>
#include <qlayout.h>
-#include "clickablelabel.h"
#include <qstring.h>
#include <stdio.h>
TimePicker::TimePicker(QWidget* parent, const char* name,
WFlags fl) :
QWidget(parent,name,fl)
{
QVBoxLayout *vbox=new QVBoxLayout(this);
- ClickableLabel *r;
+ OClickableLabel *r;
QString s;
// Hour Row
QWidget *row=new QWidget(this);
QHBoxLayout *l=new QHBoxLayout(row);
vbox->addWidget(row);
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);
r->setToggleButton(true);
r->setAlignment(AlignHCenter | AlignVCenter);
l->addWidget(r);
connect(r, SIGNAL(toggled(bool)),
this, SLOT(slotHour(bool)));
if (i==11) { // Second row
row=new QWidget(this);
l=new QHBoxLayout(row);
vbox->addWidget(row);
}
}
// Minute Row
row=new QWidget(this);
l=new QHBoxLayout(row);
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);
r->setToggleButton(true);
r->setAlignment(AlignHCenter | AlignVCenter);
l->addWidget(r);
connect(r, SIGNAL(toggled(bool)),
this, SLOT(slotMinute(bool)));
}
}
void TimePicker::slotHour(bool b) {
- ClickableLabel *r = (ClickableLabel *) sender();
+ OClickableLabel *r = (OClickableLabel *) sender();
if (b) {
- QValueListIterator<ClickableLabel *> it;
+ QValueListIterator<OClickableLabel *> it;
for (it=hourLst.begin(); it!=hourLst.end(); it++) {
if (*it != r) (*it)->setOn(false);
else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
}
emit timeChanged(tm);
} else {
r->setOn(true);
}
}
void TimePicker::slotMinute(bool b) {
- ClickableLabel *r = (ClickableLabel *) sender();
+ OClickableLabel *r = (OClickableLabel *) sender();
if (b) {
- QValueListIterator<ClickableLabel *> it;
+ QValueListIterator<OClickableLabel *> it;
for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
if (*it != r) (*it)->setOn(false);
else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
}
emit timeChanged(tm);
} else {
r->setOn(true);
}
}
void TimePicker::setMinute(int m) {
QString minute;
minute.sprintf("%.2d",m);
- QValueListIterator<ClickableLabel *> it;
+ QValueListIterator<OClickableLabel *> it;
for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
if ((*it)->text() == minute) (*it)->setOn(true);
else (*it)->setOn(false);
}
tm.setHMS(tm.hour(),m,0);
}
void TimePicker::setHour(int h) {
QString hour;
hour.sprintf("%.2d",h);
- QValueListIterator<ClickableLabel *> it;
+ QValueListIterator<OClickableLabel *> it;
for (it=hourLst.begin(); it!=hourLst.end(); it++) {
if ((*it)->text() == hour) (*it)->setOn(true);
else (*it)->setOn(false);
}
tm.setHMS(h,tm.minute(),0);
}
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
@@ -1,32 +1,32 @@
#ifndef TIMEPICKER_H
#define TIMEPICKER_H
#include <qwidget.h>
#include <qvaluelist.h>
-#include "clickablelabel.h"
+#include <opie/oclickablelabel.h>
#include <qdatetime.h>
class TimePicker: public QWidget {
Q_OBJECT
public:
TimePicker(QWidget* parent = 0, const char* name = 0,
WFlags fl = 0);
void setHour(int h);
void setMinute(int m);
private:
- QValueList<ClickableLabel *> hourLst;
- QValueList<ClickableLabel *> minuteLst;
+ QValueList<OClickableLabel *> hourLst;
+ QValueList<OClickableLabel *> minuteLst;
QTime tm;
private slots:
void slotHour(bool b);
void slotMinute(bool b);
signals:
void timeChanged(const QTime &);
};
#endif