-rw-r--r-- | core/pim/datebook/datebook.pro | 4 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstdayhdr.ui | 8 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 6 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/namespace_hack.h | 20 |
6 files changed, 31 insertions, 9 deletions
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index 2b2efaa..dbdd31b 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro @@ -1,40 +1,40 @@ CONFIG += qt warn_on release quick-app HEADERS = datebookday.h \ datebook.h \ dateentryimpl.h \ datebookdayheaderimpl.h \ datebooksettings.h \ datebookweek.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ noteentryimpl.h \ onoteedit.h \ - datebookdayallday.h + datebookdayallday.h SOURCES = main.cpp \ datebookday.cpp \ datebook.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ datebooksettings.cpp \ datebookweek.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ noteentryimpl.cpp \ onoteedit.cpp \ - datebookdayallday.cpp + datebookdayallday.cpp INTERFACES = dateentry.ui \ datebookdayheader.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.ui \ repeatentrybase.ui \ datebooksettingsbase.ui \ noteentry.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopieui2 TARGET = datebook include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 30c925d..abaf3ea 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -1,395 +1,396 @@ +#include "namespace_hack.h" #include "datebookweeklst.h" #include "datebook.h" #include <qpe/datebookmonth.h> #include <qpe/config.h> #include <qpe/resource.h> #include <qlayout.h> #include <qtoolbutton.h> #include <qtl.h> bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); using namespace Opie::Ui; DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) : DateBookWeekLstHeaderBase(parent, name, fl) { setBackgroundMode( PaletteButton ); labelDate->setBackgroundMode( PaletteButton ); forwardweek->setBackgroundMode( PaletteButton ); forwardweek->setPixmap( Resource::loadPixmap("forward") ); forwardmonth->setBackgroundMode( PaletteButton ); forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); backweek->setBackgroundMode( PaletteButton ); backweek->setPixmap( Resource::loadPixmap("back") ); backmonth->setBackgroundMode( PaletteButton ); backmonth->setPixmap( Resource::loadPixmap("fastback") ); DateBookWeekLstHeaderBaseLayout->setSpacing(0); DateBookWeekLstHeaderBaseLayout->setMargin(0); //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); bStartOnMonday=onM; } DateBookWeekLstHeader::~DateBookWeekLstHeader(){} void DateBookWeekLstHeader::setDate(const QDate &d) { int year,week,dayofweek; date=d; dayofweek=d.dayOfWeek(); if(bStartOnMonday) dayofweek--; else if( dayofweek == 7 ) /* we already have the right day -7 would lead to the same week */ dayofweek = 0; date=date.addDays(-dayofweek); calcWeek(date,week,year,bStartOnMonday); QDate start=date; QDate stop=start.addDays(6); labelDate->setText( QString::number(start.day()) + "." + Calendar::nameOfMonth( start.month() ) + "-" + QString::number(stop.day()) + "." + Calendar::nameOfMonth( stop.month()) +" ("+ tr("w")+":"+QString::number( week ) +")"); date = d; // bugfix: 0001126 - date has to be the selected date, not monday! emit dateChanged(date); } void DateBookWeekLstHeader::pickDate() { static QPopupMenu *m1 = 0; static DateBookMonth *picker = 0; if ( !m1 ) { m1 = new QPopupMenu( this ); picker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( picker ); connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); //connect( m1, SIGNAL( aboutToHide() ), //this, SLOT( gotHide() ) ); } picker->setDate( date.year(), date.month(), date.day() ); m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); picker->setFocus(); } void DateBookWeekLstHeader::setDate(int y, int m, int d) { setDate(QDate(y,m,d)); } void DateBookWeekLstHeader::nextWeek() { setDate(date.addDays(7)); } void DateBookWeekLstHeader::prevWeek() { setDate(date.addDays(-7)); } void DateBookWeekLstHeader::nextMonth() { setDate(date.addDays(28)); } void DateBookWeekLstHeader::prevMonth() { setDate(date.addDays(-28)); } DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, QWidget* parent, const char* name, WFlags fl ) : DateBookWeekLstDayHdrBase(parent, name, fl) { date=d; static const QString wdays=tr("MTWTFSSM", "Week days"); char day=wdays[d.dayOfWeek()-1]; //dont use dayOfWeek() to save space ! label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); add->setText("+"); if (d == QDate::currentDate()) { QPalette pal=label->palette(); pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); label->setPalette(pal); /* QFont f=label->font(); f.setItalic(true); label->setFont(f); label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); */ } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday QPalette pal=label->palette(); pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); label->setPalette(pal); } connect (label, SIGNAL(clicked()), this, SLOT(showDay())); connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); } void DateBookWeekLstDayHdr::showDay() { emit showDate(date.year(), date.month(), date.day()); } void DateBookWeekLstDayHdr::newEvent() { QDateTime start, stop; start=stop=date; start.setTime(QTime(10,0)); stop.setTime(QTime(12,0)); emit addEvent(start,stop,"",0); } DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig, QWidget* parent, const char* name, WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) { // old values... lastday = "__|__", middle=" |---", Firstday="00:00", QString s,start,middle,end,day; qDebug("weeklistviewconfig=%d",weeklistviewconfig); if(weeklistviewconfig==NONE) { // No times displayed. // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); // middle.sprintf("<--->"); // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); middle.sprintf(" |---"); end.sprintf("__|__"); day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); middle.sprintf("<--->"); end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); } if(ev.event().type() == Event::Normal) { if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. s=day; } else if(ev.startDate()==ev.date()) { // start event. s=start; } else if(ev.endDate()==ev.date()) { // end event. s=end; } else { // middle day. s=middle; } } else { s=""; } setText(QString(s) + " " + ev.description()); connect(this, SIGNAL(clicked()), this, SLOT(editMe())); setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } void DateBookWeekLstEvent::editMe() { emit editEvent(event.event()); } DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, QWidget* parent, const char* name, WFlags fl) : QWidget( parent, name, fl ) { Config config("DateBook"); config.setGroup("Main"); int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); bStartOnMonday=onM; setPalette(white); setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); QVBoxLayout *layout = new QVBoxLayout( this ); qBubbleSort(ev); QValueListIterator<EffectiveEvent> it; it=ev.begin(); int dayOrder[7]; if (bStartOnMonday) { for (int d=0; d<7; d++) dayOrder[d]=d+1; } else { for (int d=0; d<7; d++) dayOrder[d]=d; dayOrder[0]=7; } // Calculate offset to first day of week. int dayoffset=d.dayOfWeek(); if(bStartOnMonday) dayoffset--; else if( dayoffset == 7 ) dayoffset = 0; for (int i=0; i<7; i++) { // Header DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); layout->addWidget(hdr); // Events while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); layout->addWidget(l); connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); } it++; } layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); } } DateBookWeekLstView::~DateBookWeekLstView(){} void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, QValueList<EffectiveEvent> &ev2, QDate &d, bool onM, QWidget* parent, const char* name, WFlags fl) : QWidget( parent, name, fl ) { QHBoxLayout *layout = new QHBoxLayout( this ); DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); layout->addWidget(w); connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); layout->addWidget(w); connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); } DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, QWidget *parent, const char *name ) : QWidget( parent, name ), db( newDB ), startTime( 0 ), ampm( ap ), bStartOnMonday(onM) { setFocusPolicy(StrongFocus); layout = new QVBoxLayout( this ); layout->setMargin(0); header=new DateBookWeekLstHeader(onM, this); layout->addWidget( header ); connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); scroll=new QScrollView(this); scroll->setResizePolicy(QScrollView::AutoOneFit); layout->addWidget(scroll); view=NULL; Config config("DateBook"); config.setGroup("Main"); dbl=config.readBoolEntry("weeklst_dbl", false); header->dbl->setOn(dbl); } DateBookWeekLst::~DateBookWeekLst(){ Config config("DateBook"); config.setGroup("Main"); config.writeEntry("weeklst_dbl", dbl); } void DateBookWeekLst::setDate(const QDate &d) { bdate=d; header->setDate(d); } void DateBookWeekLst::setDbl(bool on) { dbl=on; redraw(); } void DateBookWeekLst::redraw() {getEvents();} QDate DateBookWeekLst::date() { return bdate; } // return the date at the beginning of the week... // copied from DateBookWeek QDate DateBookWeekLst::weekDate() const { QDate d=bdate; // Calculate offset to first day of week. int dayoffset=d.dayOfWeek(); if(bStartOnMonday) dayoffset--; else if( dayoffset == 7 ) dayoffset = 0; return d.addDays(-dayoffset); } void DateBookWeekLst::getEvents() { QDate start = weekDate(); //date(); QDate stop = start.addDays(6); QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); if (view) delete view; if (dbl) { QDate start2=start.addDays(7); stop=start2.addDays(6); QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); } else { view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); } connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); scroll->addChild(view); view->show(); scroll->updateScrollBars(); } void DateBookWeekLst::dateChanged(QDate &newdate) { bdate=newdate; getEvents(); } void DateBookWeekLst::keyPressEvent(QKeyEvent *e) { switch(e->key()) { case Key_Up: scroll->scrollBy(0, -20); break; case Key_Down: scroll->scrollBy(0, 20); break; case Key_Left: header->prevWeek(); break; case Key_Right: header->nextWeek(); break; default: e->ignore(); } } diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui index 9499726..74ea584 100644 --- a/core/pim/datebook/datebookweeklstdayhdr.ui +++ b/core/pim/datebook/datebookweeklstdayhdr.ui @@ -1,145 +1,145 @@ <!DOCTYPE UI><UI> <class>DateBookWeekLstDayHdrBase</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>DateBookWeekLstDayHdrBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>106</y> <width>621</width> <height>5</height> </rect> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property> <name>layoutMargin</name> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line1</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>0</width> <height>0</height> </size> </property> <property stdset="1"> <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>OClickableLabel</class> + <class>ClickableLabel</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"> <name>font</name> <font> <bold>1</bold> </font> </property> </widget> <widget> <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line1_2</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>0</width> <height>0</height> </size> </property> <property stdset="1"> <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>OClickableLabel</class> + <class>ClickableLabel</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>OClickableLabel</class> - <header location="global">opie/oclickablelabel.h</header> + <class>ClickableLabel</class> + <header location="local">namespace_hack.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> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> </image> </images> </UI> diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui index acc607c..f776911 100644 --- a/core/pim/datebook/dateentry.ui +++ b/core/pim/datebook/dateentry.ui @@ -1,661 +1,661 @@ <!DOCTYPE UI><UI> <class>DateEntryBase</class> <comment>********************************************************************* ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** $Id$ ** *********************************************************************</comment> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>DateEntryBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>242</width> <height>339</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>New Event</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2</cstring> </property> <property stdset="1"> <name>frameShape</name> <enum>MShape</enum> </property> <property stdset="1"> <name>frameShadow</name> <enum>MShadow</enum> </property> <property stdset="1"> <name>text</name> <string>Location</string> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel2_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Category</string> </property> <property> <name>buddy</name> <cstring>comboPriority</cstring> </property> </widget> <widget row="0" column="1" rowspan="1" colspan="3" > <class>QComboBox</class> <item> <property> <name>text</name> <string></string> </property> </item> <item> <property> <name>text</name> <string>Meeting</string> </property> </item> <item> <property> <name>text</name> <string>Lunch</string> </property> </item> <item> <property> <name>text</name> <string>Dinner</string> </property> </item> <item> <property> <name>text</name> <string>Travel</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>comboDescription</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>editable</name> <bool>true</bool> </property> <property stdset="1"> <name>currentItem</name> <number>0</number> </property> <property stdset="1"> <name>duplicatesEnabled</name> <bool>false</bool> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> <string>Description </string> </property> </widget> <widget row="1" column="1" rowspan="1" colspan="3" > <class>QComboBox</class> <item> <property> <name>text</name> <string></string> </property> </item> <item> <property> <name>text</name> <string>Office</string> </property> </item> <item> <property> <name>text</name> <string>Home</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>comboLocation</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>editable</name> <bool>true</bool> </property> <property stdset="1"> <name>currentItem</name> <number>0</number> </property> <property stdset="1"> <name>duplicatesEnabled</name> <bool>false</bool> </property> </widget> <widget row="2" column="1" rowspan="1" colspan="3" > <class>CategorySelect</class> <property stdset="1"> <name>name</name> <cstring>comboCategory</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> </widget> <widget row="3" column="0" rowspan="2" colspan="1" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>Start - End </string> </property> </widget> <widget row="3" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>buttonStart</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>text</name> <string>Jan 02 00</string> </property> </widget> <widget row="4" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>comboStart</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>alignment</name> <set>AlignHCenter</set> </property> <property> <name>hAlign</name> </property> </widget> <spacer row="3" column="2" rowspan="2" colspan="1" > <property> <name>name</name> <cstring>Spacer1_2</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="5" column="1" rowspan="1" colspan="3" > - <class>OTimePicker</class> + <class>TimePicker</class> <property stdset="1"> <name>name</name> <cstring>timePickerStart</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> </widget> <widget row="3" column="3" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>buttonEnd</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>text</name> <string>Jan 02 00</string> </property> </widget> <widget row="4" column="3" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>comboEnd</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>alignment</name> <set>AlignHCenter</set> </property> <property> <name>hAlign</name> </property> </widget> <widget row="5" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TimePickerLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Start time</string> </property> </widget> <widget row="6" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>checkAllDay</cstring> </property> <property stdset="1"> <name>text</name> <string>All day</string> </property> </widget> <widget row="7" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3_2_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Time zone</string> </property> </widget> <widget row="7" column="1" rowspan="1" colspan="3" > <class>TimeZoneSelector</class> <property stdset="1"> <name>name</name> <cstring>timezone</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> </widget> <widget row="8" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>checkAlarm</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>true</bool> </property> <property stdset="1"> <name>autoMask</name> <bool>false</bool> </property> <property stdset="1"> <name>text</name> <string>&Alarm</string> </property> <property stdset="1"> <name>checked</name> <bool>false</bool> </property> </widget> <widget row="8" column="1" rowspan="1" colspan="2" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>spinAlarm</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>suffix</name> <string> minutes</string> </property> <property stdset="1"> <name>maxValue</name> <number>180</number> </property> <property stdset="1"> <name>minValue</name> <number>0</number> </property> <property stdset="1"> <name>lineStep</name> <number>5</number> </property> <property stdset="1"> <name>value</name> <number>5</number> </property> </widget> <widget row="8" column="3" > <class>QComboBox</class> <item> <property> <name>text</name> <string>Silent</string> </property> </item> <item> <property> <name>text</name> <string>Loud</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>comboSound</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> </widget> <widget row="9" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>lblRepeat</cstring> </property> <property stdset="1"> <name>text</name> <string>Repeat</string> </property> </widget> <widget row="9" column="1" rowspan="1" colspan="3" > <class>QToolButton</class> <property stdset="1"> <name>name</name> <cstring>cmdRepeat</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>focusPolicy</name> <enum>TabFocus</enum> </property> <property stdset="1"> <name>text</name> <string>No Repeat...</string> </property> </widget> <widget row="10" column="0" rowspan="1" colspan="4" > <class>QToolButton</class> <property stdset="1"> <name>name</name> <cstring>editNote</cstring> </property> <property stdset="1"> <name>text</name> <string>Note...</string> </property> </widget> </grid> </widget> <customwidgets> <customwidget> <class>TimeZoneSelector</class> <header location="global">qpe/tzselect.h</header> <sizehint> <width>21</width> <height>10</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> <customwidget> <class>CategorySelect</class> <header location="global">qpe/categoryselect.h</header> <sizehint> <width>-1</width> <height>-1</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> </sizepolicy> <pixmap>image1</pixmap> </customwidget> <customwidget> - <class>OTimePicker</class> - <header location="local">opie/otimepicker.h</header> + <class>TimePicker</class> + <header location="local">namespace_hack.h</header> <sizehint> <width>-1</width> <height>-1</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> </sizepolicy> <pixmap>image1</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data> </image> <image> <name>image1</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> <connections> <connection> <sender>checkAlarm</sender> <signal>toggled(bool)</signal> <receiver>spinAlarm</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>comboEnd</sender> <signal>textChanged(const QString&)</signal> <receiver>DateEntryBase</receiver> <slot>endTimeChanged( const QString & )</slot> </connection> <connection> <sender>cmdRepeat</sender> <signal>clicked()</signal> <receiver>DateEntryBase</receiver> <slot>slotRepeat()</slot> </connection> <connection> <sender>comboStart</sender> <signal>textChanged(const QString &)</signal> <receiver>DateEntryBase</receiver> <slot>startTimeEdited( const QString & )</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>comboEnd</receiver> <slot>setDisabled(bool)</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>timePickerStart</receiver> <slot>setDisabled(bool)</slot> </connection> <connection> <sender>checkAlarm</sender> <signal>toggled(bool)</signal> <receiver>comboSound</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>comboStart</receiver> <slot>setDisabled(bool)</slot> </connection> <slot access="public">endDateChanged( const QString & )</slot> <slot access="public">endDateChanged( int, int, int )</slot> <slot access="public">endTimeChanged( const QString & )</slot> <slot access="public">slotRepeat()</slot> <slot access="public">slotWait( int )</slot> <slot access="public">startDateChanged( const QString & )</slot> <slot access="public">startDateChanged(int, int, int)</slot> <slot access="public">startTimeEdited( const QString & )</slot> <slot access="public">typeChanged( const QString & )</slot> <slot access="public">tzexecute(void)</slot> </connections> </UI> diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index dbff18f..7b4716f 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -1,559 +1,560 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +#include "namespace_hack.h" #include "dateentryimpl.h" #include "repeatentry.h" #include <qpe/qpeapplication.h> #include <qpe/categoryselect.h> #include <qpe/datebookmonth.h> #include <qpe/tzselect.h> #include <qlineedit.h> #include <qspinbox.h> #include <opie2/otimepicker.h> #include "onoteedit.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 ), 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()); TimePickerLabel->setText( tr("Start Time" ) ); m_showStart= true; }else if( obj == comboEnd ){ timePickerStart->setHour(endTime.hour()); timePickerStart->setMinute(endTime.minute()); TimePickerLabel->setText( tr("End Time") ); m_showStart = false; } } else if( ev->type() == QEvent::FocusOut ){ // if( obj == comboEnd ){ // QString s; // s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); // comboEnd->setText(s); // } // else if( obj == comboStart ){ // QString s; // s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); // comboStart->setText(s); // } } return false; } static void addOrPick( QComboBox* combo, const QString& t ) { // Pick an item if one excists for (int i=0; i<combo->count(); i++) { if ( combo->text(i) == t ) { combo->setCurrentItem(i); return; } } // 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 ), 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()) noteStr=event.notes(); else noteStr=""; spinAlarm->setValue(event.alarmTime()); if ( event.alarmSound() != Event::Silent ) comboSound->setCurrentItem( 1 ); if ( event.hasRepeat() ) { rp = event.repeatPattern(); cmdRepeat->setText( tr("Repeat...") ); } setRepeatLabel(); } void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) { startDate = s.date(); endDate = e.date(); startTime = s.time(); endTime = e.time(); startDateChanged( s.date().year(), s.date().month(), s.date().day() ); endDateChanged( e.date().year(), e.date().month(), e.date().day() ); updateTimeEdit(true,true); } void DateEntry::updateTimeEdit(bool s, bool e) { // Comboboxes QString strStart, strEnd; int shour, ehour; if ( ampm ) { shour = startTime.hour(); ehour = endTime.hour(); if ( shour >= 12 ) { if ( shour > 12 ) shour -= 12; strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); } else { if ( shour == 0 ) shour = 12; strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); } if ( ehour == 24 && endTime.minute() == 0 ) { strEnd = "11:59 PM"; // or "midnight" } else if ( ehour >= 12 ) { if ( ehour > 12 ) ehour -= 12; strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); } else { if ( ehour == 0 ) ehour = 12; strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); } } else { strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); } if (s) comboStart->setText(strStart); if (e) comboEnd->setText(strEnd); } void DateEntry::init() { comboDescription->setInsertionPolicy(QComboBox::AtCurrent); comboLocation->setInsertionPolicy(QComboBox::AtCurrent); initCombos(); QPopupMenu *m1 = new QPopupMenu( this ); startPicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( startPicker ); buttonStart->setPopup( m1 ); connect( startPicker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( startDateChanged(int,int,int) ) ); //Let start button change both start and end dates connect( startPicker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( endDateChanged(int,int,int) ) ); connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotChangeStartOfWeek(bool)) ); connect( editNote, SIGNAL(clicked()), this, SLOT(slotEditNote()) ); QPopupMenu *m2 = new QPopupMenu( this ); endPicker = new DateBookMonth( m2, 0, TRUE ); m2->insertItem( endPicker ); buttonEnd->setPopup( m2 ); connect( endPicker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( endDateChanged(int,int,int) ) ); connect(timePickerStart, SIGNAL( timeChanged(const QTime&) ), this, SLOT( startTimePicked(const QTime&) )); // install eventFilters comboEnd->installEventFilter( this ); comboStart->installEventFilter( this ); } /* * Destroys the object and frees any allocated resources */ DateEntry::~DateEntry() { // no need to delete child widgets, Qt does it all for us //cout << "Del: " << comboStart->currentText() << endl; } /* * public slot */ void DateEntry::slotEditNote() { QString s; s = "<B>"+ TimeString::longDateString( startDate ) + "</B>"; // s.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month()); NoteEntry noteDlg(s+comboDescription->currentText(), noteStr, this,0,TRUE); if ( QPEApplication::execDialog( ¬eDlg ) ) { noteStr=noteDlg.note->text(); } } void DateEntry::endDateChanged( int y, int m, int d ) { endDate.setYMD( y, m, d ); if ( endDate < startDate ) { endDate = startDate; } buttonEnd->setText( TimeString::shortDate( endDate ) ); endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); } static QTime parseTime( const QString& s, bool ampm ) { QTime tmpTime; QStringList l = QStringList::split( ':', s ); int hour = l[0].toInt(); if ( ampm ) { int i=0; while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') i++; QString digits = l[1].left(i); if ( l[1].contains( "PM", FALSE ) ) { if ( hour != 12 ) hour += 12; } else { if ( hour == 12 ) hour = 0; } l[1] = digits; } int minute = l[1].toInt(); if ( minute > 59 ) minute = 59; else if ( minute < 0 ) minute = 0; if ( hour > 23 ) { hour = 23; minute = 59; } else if ( hour < 0 ) hour = 0; tmpTime.setHMS( hour, minute, 0 ); return tmpTime; } /* * public slot */ void DateEntry::endTimeChanged( const QString &s ) { endTimeChanged( parseTime(s,ampm) ); } void DateEntry::endTimeChanged( const QTime &t ) { if ( endDate > startDate || t >= startTime ) { endTime = t; } else { endTime = startTime; //comboEnd->setCurrentItem( comboStart->currentItem() ); } timePickerStart->setHour(endTime.hour()); timePickerStart->setMinute(endTime.minute()); } /* * public slot */ void DateEntry::startDateChanged( int y, int m, int d ) { QDate prev = startDate; startDate.setYMD( y, m, d ); if ( rp.type == Event::Weekly && startDate.dayOfWeek() != prev.dayOfWeek() ) { // if we change the start of a weekly repeating event // set the repeating day appropriately char mask = 1 << (prev.dayOfWeek()-1); rp.days &= (~mask); rp.days |= 1 << (startDate.dayOfWeek()-1); } buttonStart->setText( TimeString::shortDate( startDate ) ); // our pickers must be reset... startPicker->setDate( y, m, d ); endPicker->setDate( y, m, d ); } /* * public slot */ void DateEntry::startTimeEdited( const QString &s ) { startTimeChanged(parseTime(s,ampm)); updateTimeEdit(false,true); timePickerStart->setHour(startTime.hour()); timePickerStart->setMinute(startTime.minute()); } void DateEntry::startTimeChanged( const QTime &t ) { int duration=startTime.secsTo(endTime); startTime = t; endTime=t.addSecs(duration); } void DateEntry::startTimePicked( const QTime &t ) { if(m_showStart ){ startTimeChanged(t); updateTimeEdit(true,true); }else{ endTimeChanged(t); updateTimeEdit(false, true ); } } /* * public slot */ void DateEntry::typeChanged( const QString &s ) { bool b = s != "All Day"; buttonStart->setEnabled( b ); comboStart->setEnabled( b ); comboEnd->setEnabled( b ); } void DateEntry::slotRepeat() { // Work around for compiler Bug.. RepeatEntry *e; // it is better in my opinion to just grab this from the mother, // since, this dialog doesn't need to keep track of it... if ( rp.type != Event::NoRepeat ) e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); else e = new RepeatEntry( startWeekOnMonday, startDate, this ); if ( QPEApplication::execDialog( e ) ) { rp = e->repeatPattern(); setRepeatLabel(); } // deleting sounds like a nice idea... delete e; } void DateEntry::slotChangeStartOfWeek( bool onMonday ) { startWeekOnMonday = onMonday; } Event DateEntry::event() { Event ev; Event::SoundTypeChoice st; ev.setDescription( comboDescription->currentText() ); ev.setLocation( comboLocation->currentText() ); ev.setCategories( comboCategory->currentCategories() ); ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); if ( startDate > endDate ) { QDate tmp = endDate; endDate = startDate; startDate = tmp; } // This is now done in the changed slots // startTime = parseTime( comboStart->text(), ampm ); //endTime = parseTime( comboEnd->text(), ampm ); if ( startTime > endTime && endDate == startDate ) { QTime tmp = endTime; endTime = startTime; startTime = tmp; } // don't set the time if theres no need too if ( ev.type() == Event::AllDay ) { startTime.setHMS( 0, 0, 0 ); endTime.setHMS( 23, 59, 59 ); } // adjust start and end times based on timezone QDateTime start( startDate, startTime ); QDateTime end( endDate, endTime ); time_t start_utc, end_utc; // qDebug( "tz: %s", timezone->currentZone().latin1() ); // get real timezone QString realTZ; realTZ = QString::fromLocal8Bit( getenv("TZ") ); // set timezone if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) qWarning( "There was a problem setting the timezone." ); // convert to UTC based on selected TZ (calling tzset internally) start_utc = TimeConversion::toUTC( start ); end_utc = TimeConversion::toUTC( end ); // done playing around... put it all back unsetenv( "TZ" ); if ( !realTZ.isNull() ) if ( setenv( "TZ", realTZ, true ) != 0 ) qWarning( "There was a problem setting the timezone." ); // convert UTC to local time (calling tzset internally) ev.setStart( TimeConversion::fromUTC( start_utc ) ); ev.setEnd( TimeConversion::fromUTC( end_utc ) ); // we only have one type of sound at the moment... LOUD!!! if ( comboSound->currentItem() != 0 ) st = Event::Loud; else st = Event::Silent; ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); if ( rp.type != Event::NoRepeat ) ev.setRepeat( TRUE, rp ); ev.setNotes( noteStr ); //cout << "Start: " << comboStart->currentText() << endl; return ev; } void DateEntry::setRepeatLabel() { switch( rp.type ) { case Event::Daily: cmdRepeat->setText( tr("Daily...") ); break; case Event::Weekly: cmdRepeat->setText( tr("Weekly...") ); break; case Event::MonthlyDay: case Event::MonthlyDate: cmdRepeat->setText( tr("Monthly...") ); break; case Event::Yearly: cmdRepeat->setText( tr("Yearly...") ); break; default: cmdRepeat->setText( tr("No Repeat...") ); } } void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) { checkAlarm->setChecked( alarmPreset ); spinAlarm->setValue( presetTime ); if ( sound != Event::Silent ) comboSound->setCurrentItem( 1 ); else comboSound->setCurrentItem( 0 ); } void DateEntry::initCombos() { /* comboStart->clear(); comboEnd->clear(); if ( ampm ) { for ( int i = 0; i < 24; i++ ) { if ( i == 0 ) { comboStart->insertItem( "12:00 AM" ); comboStart->insertItem( "12:30 AM" ); comboEnd->insertItem( "12:00 AM" ); comboEnd->insertItem( "12:30 AM" ); } else if ( i == 12 ) { comboStart->insertItem( "12:00 PM" ); comboStart->insertItem( "12:30 PM" ); comboEnd->insertItem( "12:00 PM" ); comboEnd->insertItem( "12:30 PM" ); } else if ( i > 12 ) { comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" ); comboStart->insertItem( QString::number( i - 12 ) + ":30 PM" ); comboEnd->insertItem( QString::number( i - 12 ) + ":00 PM" ); comboEnd->insertItem( QString::number( i - 12 ) + ":30 PM" ); } else { comboStart->insertItem( QString::number( i) + ":00 AM" ); comboStart->insertItem( QString::number( i ) + ":30 AM" ); comboEnd->insertItem( QString::number( i ) + ":00 AM" ); comboEnd->insertItem( QString::number( i ) + ":30 AM" ); } } } else { for ( int i = 0; i < 24; i++ ) { if ( i < 10 ) { comboStart->insertItem( QString("0") + QString::number(i) + ":00" ); comboStart->insertItem( QString("0") + QString::number(i) + ":30" ); comboEnd->insertItem( QString("0") + QString::number(i) + ":00" ); comboEnd->insertItem( QString("0") + QString::number(i) + ":30" ); } else { comboStart->insertItem( QString::number(i) + ":00" ); comboStart->insertItem( QString::number(i) + ":30" ); comboEnd->insertItem( QString::number(i) + ":00" ); comboEnd->insertItem( QString::number(i) + ":30" ); } } } */ } void DateEntry::slotChangeClock( bool whichClock ) { ampm = whichClock; initCombos(); setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) ); } diff --git a/core/pim/datebook/namespace_hack.h b/core/pim/datebook/namespace_hack.h new file mode 100644 index 0000000..c15b5ed --- a/dev/null +++ b/core/pim/datebook/namespace_hack.h @@ -0,0 +1,20 @@ +#ifndef NAME_SPACE_HACK_H +#define NAME_SPACE_HACK_H + +#include <opie2/otimepicker.h> +#include <opie2/oclickablelabel.h> + +class TimePicker : public Opie::Ui::OTimePicker { +public: + TimePicker( QWidget* p = 0, const char* name = 0, WFlags fl = 0 ) + : Opie::Ui::OTimePicker(p,name,fl){} + +}; +class ClickableLabel : public Opie::Ui::OClickableLabel { +public: + ClickableLabel(QWidget *p=0,const char* name=0, WFlags fl = 0 ) + : Opie::Ui::OClickableLabel(p,name,fl){} +}; + + +#endif |