author | zecke <zecke> | 2002-11-30 11:31:24 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-30 11:31:24 (UTC) |
commit | cfb09f9ae7b710b3079320f3b268c45c3fae8979 (patch) (side-by-side diff) | |
tree | 7dda9c82a59f8ca6a2cf55271b2749b71e29b26e | |
parent | 9b8b30fa6cbdf1424b29cde21fae112e8bf96e6d (diff) | |
download | opie-cfb09f9ae7b710b3079320f3b268c45c3fae8979.zip opie-cfb09f9ae7b710b3079320f3b268c45c3fae8979.tar.gz opie-cfb09f9ae7b710b3079320f3b268c45c3fae8979.tar.bz2 |
pelling updates
libopie.pro additions
-rw-r--r-- | libopie/libopie.pro | 6 | ||||
-rw-r--r-- | libopie/orecurrancewidget.cpp | 20 | ||||
-rw-r--r-- | libopie/orecurrancewidget.h | 6 |
3 files changed, 27 insertions, 5 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index b7537cc..2e76cb1 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro @@ -1,93 +1,99 @@ TEMPLATE = lib CONFIG += qte warn_on release HEADERS = ofontmenu.h \ ocolorbutton.h \ ofiledialog.h ofileselector.h tododb.h \ ocheckitem.h todoevent.h todoresource.h \ todovcalresource.h xmltree.h \ colordialog.h colorpopupmenu.h \ oclickablelabel.h oprocctrl.h \ oprocess.h odevice.h \ otimepicker.h otabwidget.h \ otabbar.h otabinfo.h \ ofontselector.h \ pim/opimrecord.h \ pim/otodo.h \ pim/orecordlist.h \ pim/opimaccesstemplate.h \ pim/opimaccessbackend.h \ pim/otodoaccess.h \ pim/otodoaccessbackend.h \ pim/ocontact.h \ pim/ocontactaccess.h \ pim/ocontactaccessbackend.h \ pim/ocontactaccessbackend_xml.h \ pim/ocontactaccessbackend_vcard.h \ pim/obackendfactory.h \ pim/opimcache.h \ pim/otodoaccessvcal.h \ pim/orecur.h \ pim/opimstate.h \ pim/opimxrefpartner.h \ pim/opimxref.h \ pim/opimxrefmanager.h \ pim/opimmaintainer.h \ + pim/opimnotify.h \ + pim/opimnotifymanager.h \ + pim/opimmainwindow.h \ orecurrancewidget.h \ oticker.h # pim/otodoaccesssql.h \ SOURCES = ofontmenu.cc \ ocolorbutton.cpp \ sharp_compat.cpp \ xmltree.cc \ ofiledialog.cc ofileselector.cc \ ocheckitem.cpp tododb.cpp todoevent.cpp \ todovcalresource.cpp colordialog.cpp \ colorpopupmenu.cpp oclickablelabel.cpp \ oprocctrl.cpp oprocess.cpp \ odevice.cpp otimepicker.cpp \ otabwidget.cpp otabbar.cpp \ ofontselector.cpp \ pim/otodo.cpp \ pim/opimrecord.cpp \ pim/otodoaccess.cpp \ pim/otodoaccessbackend.cpp \ pim/otodoaccessxml.cpp \ pim/ocontact.cpp \ pim/ocontactaccess.cpp \ pim/ocontactaccessbackend_vcard.cpp \ pim/otodoaccessvcal.cpp \ pim/orecur.cpp \ pim/opimstate.cpp \ pim/opimxrefpartner.cpp \ pim/opimxref.cpp \ pim/opimxrefmanager.cpp \ pim/opimmaintainer.cpp \ + pim/opimnotify.cpp \ + pim/opimnotifymanager.cpp \ + pim/opimmainwindow.cpp \ orecurrancewidget.cpp \ oticker.cpp # pim/otodoaccesssql.cpp \ TARGET = opie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(QTDIR)/lib$(PROJMAK) #VERSION = 1.0.0 # LIBS += -lopiesql INTERFACES = otimepickerbase.ui orecurrancebase.ui TRANSLATIONS = ../i18n/de/libopie.ts \ ../i18n/en/libopie.ts \ ../i18n/es/libopie.ts \ ../i18n/fr/libopie.ts \ ../i18n/hu/libopie.ts \ ../i18n/ja/libopie.ts \ ../i18n/ko/libopie.ts \ ../i18n/no/libopie.ts \ ../i18n/pl/libopie.ts \ ../i18n/pt/libopie.ts \ ../i18n/pt_BR/libopie.ts \ ../i18n/sl/libopie.ts \ ../i18n/zh_CN/libopie.ts \ ../i18n/zh_TW/libopie.ts \ ../i18n/da/libopie.ts diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp index 53cee65..0484ab9 100644 --- a/libopie/orecurrancewidget.cpp +++ b/libopie/orecurrancewidget.cpp @@ -1,242 +1,254 @@ #include <qapplication.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qspinbox.h> #include <qpe/timestring.h> #include "orecurrancewidget.h" // Global Templates for use in setting up the repeat label... const QString strDayTemplate = QObject::tr("Every"); const QString strYearTemplate = QObject::tr("%1 %2 every "); const QString strMonthDateTemplate = QObject::tr("The %1 every "); const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every"); const QString strWeekTemplate = QObject::tr("Every "); const QString dayLabel[] = { QObject::tr("Monday"), QObject::tr("Tuesday"), QObject::tr("Wednesday"), QObject::tr("Thursday"), QObject::tr("Friday"), QObject::tr("Saturday"), QObject::tr("Sunday") }; static QString numberPlacing( int x ); // return the proper word format for // x (1st, 2nd, etc) static int week( const QDate &dt ); // what week in the month is dt? ORecurranceWidget::ORecurranceWidget( bool startOnMonday, const QDate& newStart, QWidget* parent, const char* name, bool modal, WFlags fl ) : ORecurranceBase( parent, name, modal, fl ), start( newStart ), currInterval( None ), startWeekOnMonday( startOnMonday ) { init(); fraType->setButton( currInterval ); chkNoEnd->setChecked( TRUE ); setupNone(); } ORecurranceWidget::ORecurranceWidget( bool startOnMonday, const ORecur& rp, const QDate& startDate, QWidget* parent, const char* name, bool modal, WFlags fl) : ORecurranceBase( parent, name, modal, fl ), start( startDate ), end( rp.endDate() ), startWeekOnMonday( startOnMonday ) { // do some stuff with the repeat pattern init(); + setRecurrence( rp ); +} + +ORecurranceWidget::~ORecurranceWidget() { +} +void ORecurranceWidget::setStartDate( const QDate& date ) { + qWarning("ORecurranceWidget::setStartDate"); + setRecurrence( recurrence(), date ); +} +void ORecurranceWidget::setRecurrence( const ORecur& rp ) { + setRecurrence( rp, start ); +} +void ORecurranceWidget::setRecurrence( const ORecur& rp, const QDate& date ) { + start = date; + end = rp.endDate(); switch ( rp.type() ) { default: case ORecur::NoRepeat: currInterval = None; setupNone(); break; case ORecur::Daily: currInterval = Day; setupDaily(); break; case ORecur::Weekly: currInterval = Week; setupWeekly(); int day, buttons; for ( day = 0x01, buttons = 0; buttons < 7; day = day << 1, buttons++ ) { if ( rp.days() & day ) { if ( startWeekOnMonday ) fraExtra->setButton( buttons ); else { if ( buttons == 7 ) fraExtra->setButton( 0 ); else fraExtra->setButton( buttons + 1 ); } } } slotWeekLabel(); break; case ORecur::MonthlyDay: currInterval = Month; setupMonthly(); fraExtra->setButton( 0 ); slotMonthLabel( 0 ); break; case ORecur::MonthlyDate: currInterval = Month; setupMonthly(); fraExtra->setButton( 1 ); slotMonthLabel( 1 ); break; case ORecur::Yearly: currInterval = Year; setupYearly(); break; } fraType->setButton( currInterval ); spinFreq->setValue( rp.frequency() ); if ( !rp.hasEndDate() ) { cmdEnd->setText( tr("No End Date") ); chkNoEnd->setChecked( TRUE ); } else cmdEnd->setText( TimeString::shortDate( end ) ); } -ORecurranceWidget::~ORecurranceWidget() { - -} -ORecur ORecurranceWidget::recurrance()const { +ORecur ORecurranceWidget::recurrence()const { QListIterator<QToolButton> it( listRTypeButtons ); QListIterator<QToolButton> itExtra( listExtra ); ORecur rpTmp; int i; for ( i = 0; *it; ++it, i++ ) { if ( (*it)->isOn() ) { switch ( i ) { case None: rpTmp.setType( ORecur::NoRepeat ); break; case Day: rpTmp.setType( ORecur::Daily ); break; case Week:{ rpTmp.setType( ORecur::Weekly ); int day; int day2 = 0; for ( day = 1; *itExtra; ++itExtra, day = day << 1 ) { if ( (*itExtra)->isOn() ) { if ( startWeekOnMonday ) day2 |= day; else { if ( day == 1 ) day2 |= Event::SUN; else day2 |= day >> 1; } } } rpTmp.setDays( day2 ); } break; case Month: if ( cmdExtra1->isOn() ) rpTmp.setType( ORecur::MonthlyDay ); else if ( cmdExtra2->isOn() ) rpTmp.setType( ORecur::MonthlyDate ); // figure out the montly day... rpTmp.setPosition( week( start ) ); break; case Year: rpTmp.setType( ORecur::Yearly ); break; } break; // no need to keep looking! } } rpTmp.setFrequency(spinFreq->value() ); rpTmp.setHasEndDate( !chkNoEnd->isChecked() ); if ( rpTmp.hasEndDate() ) { rpTmp.setEndDate( end ); } // timestamp it... rpTmp.setCreateTime( time( NULL ) ); return rpTmp; } QDate ORecurranceWidget::endDate()const { return end; } void ORecurranceWidget::slotSetRType(int rtype) { // now call the right function based on the type... currInterval = static_cast<repeatButtons>(rtype); switch ( currInterval ) { case None: setupNone(); break; case Day: setupDaily(); break; case Week: setupWeekly(); slotWeekLabel(); break; case Month: setupMonthly(); cmdExtra2->setOn( TRUE ); slotMonthLabel( 1 ); break; case Year: setupYearly(); break; } } void ORecurranceWidget::endDateChanged(int y, int m, int d) { end.setYMD( y, m, d ); if ( end < start ) end = start; cmdEnd->setText( TimeString::shortDate( end ) ); repeatPicker->setDate( end.year(), end.month(), end.day() ); } void ORecurranceWidget::slotNoEnd( bool unused) { // if the item was toggled, then go ahead and set it to the maximum date if ( unused ) { end.setYMD( 3000, 12, 31 ); cmdEnd->setText( tr("No End Date") ); } else { end = start; cmdEnd->setText( TimeString::shortDate(end) ); } } void ORecurranceWidget::setupRepeatLabel( const QString& s) { lblVar1->setText( s ); } void ORecurranceWidget::setupRepeatLabel( int x) { // change the spelling based on the value of x QString strVar2; if ( x > 1 ) lblVar1->show(); else lblVar1->hide(); switch ( currInterval ) { case None: break; case Day: if ( x > 1 ) strVar2 = tr( "days" ); else strVar2 = tr( "day" ); break; case Week: if ( x > 1 ) strVar2 = tr( "weeks" ); else strVar2 = tr( "week" ); break; case Month: diff --git a/libopie/orecurrancewidget.h b/libopie/orecurrancewidget.h index f2d7f87..4a8dd08 100644 --- a/libopie/orecurrancewidget.h +++ b/libopie/orecurrancewidget.h @@ -1,68 +1,72 @@ /* * GPL and based on the widget from TT */ #ifndef OPIE_RECURRANCE_WIDGET_H #define OPIE_RECURRANCE_WIDGET_H #include <qlist.h> #include <qtoolbutton.h> #include <qcheckbox.h> #include <qdatetime.h> #include <qbuttongroup.h> #include <qpe/datebookmonth.h> #include "orecurrancebase.h" #include <opie/orecur.h> +// FIXME spelling!!!! -zecke class ORecurranceWidget : public ORecurranceBase { Q_OBJECT public: ORecurranceWidget( bool startOnMonday, const QDate& start, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 ); ORecurranceWidget( bool startOnMonday, const ORecur& rp, const QDate& start, QWidget* parent = 0, const char* name =0, bool modal = TRUE, WFlags = 0 ); ~ORecurranceWidget(); - ORecur recurrance()const; + ORecur recurrence()const; QDate endDate()const; public slots: void slotSetRType( int ); void endDateChanged( int, int, int ); void slotNoEnd( bool unused ); + void setStartDate( const QDate& ); + void setRecurrence( const ORecur& recur, const QDate& start ); + void setRecurrence( const ORecur& recur ); private slots: void setupRepeatLabel( const QString& ); void setupRepeatLabel( int ); void slotWeekLabel(); void slotMonthLabel( int ); void slotChangeStartOfWeek( bool onMonday ); private: void setupNone(); void setupDaily(); void setupWeekly(); void setupMonthly(); void setupYearly(); enum repeatButtons { None, Day, Week, Month, Year }; void init(); void hideExtras(); void showRepeatStuff(); QList<QToolButton> listRTypeButtons; QList<QToolButton> listExtra; QDate start; // only used in one spot... QDate end; repeatButtons currInterval; bool startWeekOnMonday : 1; DateBookMonth *repeatPicker; }; #endif |