summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.cpp8
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.h10
2 files changed, 9 insertions, 9 deletions
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.cpp b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
index 90c1a5f..ee7f3a3 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.cpp
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
@@ -1,172 +1,174 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qpopupmenu.h> 3#include <qpopupmenu.h>
4#include <qspinbox.h> 4#include <qspinbox.h>
5 5
6#include <qpe/timestring.h> 6#include <qpe/timestring.h>
7 7
8#include "opimrecurrencewidget.h" 8#include "opimrecurrencewidget.h"
9 9
10
11using namespace Opie;
10// Global Templates for use in setting up the repeat label... 12// Global Templates for use in setting up the repeat label...
11// the problem is these strings get initialized before QPEApplication can install the translator -zecke 13// the problem is these strings get initialized before QPEApplication can install the translator -zecke
12namespace { 14namespace {
13QString strDayTemplate; 15QString strDayTemplate;
14QString strYearTemplate; 16QString strYearTemplate;
15QString strMonthDateTemplate; 17QString strMonthDateTemplate;
16QString strMonthDayTemplate; 18QString strMonthDayTemplate;
17QString strWeekTemplate; 19QString strWeekTemplate;
18QString dayLabel[7]; 20QString dayLabel[7];
19} 21}
20 22
21/* 23/*
22 * static linkage to not polute the symbol table... 24 * static linkage to not polute the symbol table...
23 * The problem is that const and static linkage are resolved prior to installing a translator 25 * The problem is that const and static linkage are resolved prior to installing a translator
24 * leading to that the above strings are translted but to the original we delay the init of these strings... 26 * leading to that the above strings are translted but to the original we delay the init of these strings...
25 * -zecke 27 * -zecke
26 */ 28 */
27static void fillStrings() { 29static void fillStrings() {
28 strDayTemplate = QObject::tr("Every"); 30 strDayTemplate = QObject::tr("Every");
29 strYearTemplate = QObject::tr("%1 %2 every "); 31 strYearTemplate = QObject::tr("%1 %2 every ");
30 strMonthDateTemplate = QObject::tr("The %1 every "); 32 strMonthDateTemplate = QObject::tr("The %1 every ");
31 strMonthDayTemplate = QObject::tr("The %1 %2 of every"); 33 strMonthDayTemplate = QObject::tr("The %1 %2 of every");
32 strWeekTemplate = QObject::tr("Every "); 34 strWeekTemplate = QObject::tr("Every ");
33 dayLabel[0] = QObject::tr("Monday"); 35 dayLabel[0] = QObject::tr("Monday");
34 dayLabel[1] = QObject::tr("Tuesday"); 36 dayLabel[1] = QObject::tr("Tuesday");
35 dayLabel[2] = QObject::tr("Wednesday"); 37 dayLabel[2] = QObject::tr("Wednesday");
36 dayLabel[3] = QObject::tr("Thursday"); 38 dayLabel[3] = QObject::tr("Thursday");
37 dayLabel[4] = QObject::tr("Friday"); 39 dayLabel[4] = QObject::tr("Friday");
38 dayLabel[5] = QObject::tr("Saturday"); 40 dayLabel[5] = QObject::tr("Saturday");
39 dayLabel[6] = QObject::tr("Sunday"); 41 dayLabel[6] = QObject::tr("Sunday");
40} 42}
41 43
42 static QString numberPlacing( int x );// return the proper word format for 44 static QString numberPlacing( int x );// return the proper word format for
43 // x (1st, 2nd, etc) 45 // x (1st, 2nd, etc)
44static int week( const QDate &dt ); // what week in the month is dt? 46static int week( const QDate &dt ); // what week in the month is dt?
45 47
46/** 48/**
47 * Constructs the Widget 49 * Constructs the Widget
48 * @param startOnMonday Does the week start on monday 50 * @param startOnMonday Does the week start on monday
49 * @param newStart The start date of the recurrence 51 * @param newStart The start date of the recurrence
50 * @param parent The parent widget 52 * @param parent The parent widget
51 * @param name the name of object 53 * @param name the name of object
52 * @param modal if the dialog should be modal 54 * @param modal if the dialog should be modal
53 * @param fl Additional window flags 55 * @param fl Additional window flags
54 */ 56 */
55OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday, 57OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday,
56 const QDate& newStart, 58 const QDate& newStart,
57 QWidget* parent, 59 QWidget* parent,
58 const char* name, 60 const char* name,
59 bool modal, 61 bool modal,
60 WFlags fl ) 62 WFlags fl )
61 : OPimRecurrenceBase( parent, name, modal, fl ), 63 : OPimRecurrenceBase( parent, name, modal, fl ),
62 start( newStart ), 64 start( newStart ),
63 currInterval( None ), 65 currInterval( None ),
64 startWeekOnMonday( startOnMonday ) 66 startWeekOnMonday( startOnMonday )
65{ 67{
66 if (strDayTemplate.isEmpty() ) 68 if (strDayTemplate.isEmpty() )
67 fillStrings(); 69 fillStrings();
68 70
69 init(); 71 init();
70 fraType->setButton( currInterval ); 72 fraType->setButton( currInterval );
71 chkNoEnd->setChecked( TRUE ); 73 chkNoEnd->setChecked( TRUE );
72 setupNone(); 74 setupNone();
73} 75}
74 76
75/** 77/**
76 * Different constructor 78 * Different constructor
77 * @param startOnMonday Does the week start on monday? 79 * @param startOnMonday Does the week start on monday?
78 * @param rp Already set OPimRecurrence object 80 * @param rp Already set OPimRecurrence object
79 * @param startDate The start date 81 * @param startDate The start date
80 * @param parent The parent widget 82 * @param parent The parent widget
81 * @param name The name of the object 83 * @param name The name of the object
82 * @param modal 84 * @param modal
83 * @param fl The flags for window 85 * @param fl The flags for window
84 */ 86 */
85OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday, 87OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday,
86 const OPimRecurrence& rp, const QDate& startDate, 88 const Opie::OPimRecurrence& rp, const QDate& startDate,
87 QWidget* parent, const char* name, 89 QWidget* parent, const char* name,
88 bool modal, WFlags fl) 90 bool modal, WFlags fl)
89 : OPimRecurrenceBase( parent, name, modal, fl ), 91 : OPimRecurrenceBase( parent, name, modal, fl ),
90 start( startDate ), 92 start( startDate ),
91 end( rp.endDate() ), 93 end( rp.endDate() ),
92 startWeekOnMonday( startOnMonday ) 94 startWeekOnMonday( startOnMonday )
93{ 95{
94 if (strDayTemplate.isEmpty() ) 96 if (strDayTemplate.isEmpty() )
95 fillStrings(); 97 fillStrings();
96 // do some stuff with the repeat pattern 98 // do some stuff with the repeat pattern
97 init(); 99 init();
98 setRecurrence( rp ); 100 setRecurrence( rp );
99} 101}
100 102
101OPimRecurrenceWidget::~OPimRecurrenceWidget() { 103OPimRecurrenceWidget::~OPimRecurrenceWidget() {
102} 104}
103 105
104/** 106/**
105 * set the start date 107 * set the start date
106 * @param date the new start date 108 * @param date the new start date
107 */ 109 */
108void OPimRecurrenceWidget::setStartDate( const QDate& date ) { 110void OPimRecurrenceWidget::setStartDate( const QDate& date ) {
109 setRecurrence( recurrence(), date ); 111 setRecurrence( recurrence(), date );
110} 112}
111/** 113/**
112 * set the recurrence 114 * set the recurrence
113 * @param rp The OPimRecurrence object with the new recurrence rules 115 * @param rp The OPimRecurrence object with the new recurrence rules
114 */ 116 */
115void OPimRecurrenceWidget::setRecurrence( const OPimRecurrence& rp ) { 117void OPimRecurrenceWidget::setRecurrence( const Opie::OPimRecurrence& rp ) {
116 setRecurrence( rp, start ); 118 setRecurrence( rp, start );
117} 119}
118 120
119/** 121/**
120 * overloaded method taking OPimRecurrence and a new start date 122 * overloaded method taking OPimRecurrence and a new start date
121 * @param rp Recurrence rule 123 * @param rp Recurrence rule
122 * @param date The new start date 124 * @param date The new start date
123 */ 125 */
124void OPimRecurrenceWidget::setRecurrence( const OPimRecurrence& rp, const QDate& date ) { 126void OPimRecurrenceWidget::setRecurrence( const Opie::OPimRecurrence& rp, const QDate& date ) {
125 start = date; 127 start = date;
126 end = rp.endDate(); 128 end = rp.endDate();
127 switch ( rp.type() ) { 129 switch ( rp.type() ) {
128 default: 130 default:
129 case OPimRecurrence::NoRepeat: 131 case OPimRecurrence::NoRepeat:
130 currInterval = None; 132 currInterval = None;
131 setupNone(); 133 setupNone();
132 break; 134 break;
133 case OPimRecurrence::Daily: 135 case OPimRecurrence::Daily:
134 currInterval = Day; 136 currInterval = Day;
135 setupDaily(); 137 setupDaily();
136 break; 138 break;
137 case OPimRecurrence::Weekly: 139 case OPimRecurrence::Weekly:
138 currInterval = Week; 140 currInterval = Week;
139 setupWeekly(); 141 setupWeekly();
140 int day, buttons; 142 int day, buttons;
141 for ( day = 0x01, buttons = 0; buttons < 7; 143 for ( day = 0x01, buttons = 0; buttons < 7;
142 day = day << 1, buttons++ ) { 144 day = day << 1, buttons++ ) {
143 if ( rp.days() & day ) { 145 if ( rp.days() & day ) {
144 if ( startWeekOnMonday ) 146 if ( startWeekOnMonday )
145 fraExtra->setButton( buttons ); 147 fraExtra->setButton( buttons );
146 else { 148 else {
147 if ( buttons == 7 ) 149 if ( buttons == 7 )
148 fraExtra->setButton( 0 ); 150 fraExtra->setButton( 0 );
149 else 151 else
150 fraExtra->setButton( buttons + 1 ); 152 fraExtra->setButton( buttons + 1 );
151 } 153 }
152 } 154 }
153 } 155 }
154 slotWeekLabel(); 156 slotWeekLabel();
155 break; 157 break;
156 case OPimRecurrence::MonthlyDay: 158 case OPimRecurrence::MonthlyDay:
157 currInterval = Month; 159 currInterval = Month;
158 setupMonthly(); 160 setupMonthly();
159 fraExtra->setButton( 0 ); 161 fraExtra->setButton( 0 );
160 slotMonthLabel( 0 ); 162 slotMonthLabel( 0 );
161 break; 163 break;
162 case OPimRecurrence::MonthlyDate: 164 case OPimRecurrence::MonthlyDate:
163 currInterval = Month; 165 currInterval = Month;
164 setupMonthly(); 166 setupMonthly();
165 fraExtra->setButton( 1 ); 167 fraExtra->setButton( 1 );
166 slotMonthLabel( 1 ); 168 slotMonthLabel( 1 );
167 break; 169 break;
168 case OPimRecurrence::Yearly: 170 case OPimRecurrence::Yearly:
169 currInterval = Year; 171 currInterval = Year;
170 setupYearly(); 172 setupYearly();
171 break; 173 break;
172 } 174 }
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.h b/libopie2/opiepim/ui/opimrecurrencewidget.h
index 3f28565..2c315b3 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.h
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.h
@@ -1,93 +1,91 @@
1/* 1/*
2 * GPL and based on the widget from TT 2 * GPL and based on the widget from TT
3 */ 3 */
4 4
5#ifndef OPIE_PIM_RECURRENCE_WIDGET_H 5#ifndef OPIE_PIM_RECURRENCE_WIDGET_H
6#define OPIE_PIM_RECURRENCE_WIDGET_H 6#define OPIE_PIM_RECURRENCE_WIDGET_H
7 7
8#include <opie2/opimrecurrence.h> 8#include <opie2/opimrecurrence.h>
9 9
10#include <qpe/datebookmonth.h> 10#include <qpe/datebookmonth.h>
11 11
12#include <qlist.h> 12#include <qlist.h>
13#include <qtoolbutton.h> 13#include <qtoolbutton.h>
14#include <qcheckbox.h> 14#include <qcheckbox.h>
15#include <qdatetime.h> 15#include <qdatetime.h>
16#include <qbuttongroup.h> 16#include <qbuttongroup.h>
17 17
18#include "opimrecurrencebase.h" 18#include "opimrecurrencebase.h"
19 19
20using namespace Opie;
21
22/** 20/**
23 * A widget to let the user select rules for recurrences. 21 * A widget to let the user select rules for recurrences.
24 * This widget can take care of weekly, monthly, daily and yearly recurrence 22 * This widget can take care of weekly, monthly, daily and yearly recurrence
25 * It is used inside todolist and datebook. 23 * It is used inside todolist and datebook.
26 * 24 *
27 * 25 *
28 * @short Widget of selecting Recurrance 26 * @short Widget of selecting Recurrance
29 * @author Trolltech, Holger Freyther 27 * @author Trolltech, Holger Freyther
30 * @version 0.9 28 * @version 0.9
31 */ 29 */
32class OPimRecurrenceWidget : public OPimRecurrenceBase { 30class OPimRecurrenceWidget : public OPimRecurrenceBase {
33 Q_OBJECT 31 Q_OBJECT
34public: 32public:
35 OPimRecurrenceWidget( bool startOnMonday, 33 OPimRecurrenceWidget( bool startOnMonday,
36 const QDate& start, QWidget* parent = 0, 34 const QDate& start, QWidget* parent = 0,
37 const char* name = 0, bool modal = TRUE, 35 const char* name = 0, bool modal = TRUE,
38 WFlags fl = 0 ); 36 WFlags fl = 0 );
39 OPimRecurrenceWidget( bool startOnMonday, 37 OPimRecurrenceWidget( bool startOnMonday,
40 const OPimRecurrence& rp, const QDate& start, 38 const Opie::OPimRecurrence& rp, const QDate& start,
41 QWidget* parent = 0, const char* name =0, 39 QWidget* parent = 0, const char* name =0,
42 bool modal = TRUE, WFlags = 0 ); 40 bool modal = TRUE, WFlags = 0 );
43 ~OPimRecurrenceWidget(); 41 ~OPimRecurrenceWidget();
44 OPimRecurrence recurrence()const; 42 Opie::OPimRecurrence recurrence()const;
45 QDate endDate()const; 43 QDate endDate()const;
46 44
47public slots: 45public slots:
48 void slotSetRType( int ); 46 void slotSetRType( int );
49 /** 47 /**
50 * set the new end date 48 * set the new end date
51 */ 49 */
52 void endDateChanged( int, int, int ); 50 void endDateChanged( int, int, int );
53 /** 51 /**
54 * enable/disable end date 52 * enable/disable end date
55 */ 53 */
56 void slotNoEnd( bool unused ); 54 void slotNoEnd( bool unused );
57 void setStartDate( const QDate& ); 55 void setStartDate( const QDate& );
58 void setRecurrence( const OPimRecurrence& recur, const QDate& start ); 56 void setRecurrence( const Opie::OPimRecurrence& recur, const QDate& start );
59 void setRecurrence( const OPimRecurrence& recur ); 57 void setRecurrence( const Opie::OPimRecurrence& recur );
60 58
61private slots: 59private slots:
62 void setupRepeatLabel( const QString& ); 60 void setupRepeatLabel( const QString& );
63 void setupRepeatLabel( int ); 61 void setupRepeatLabel( int );
64 void slotWeekLabel(); 62 void slotWeekLabel();
65 void slotMonthLabel( int ); 63 void slotMonthLabel( int );
66 void slotChangeStartOfWeek( bool onMonday ); 64 void slotChangeStartOfWeek( bool onMonday );
67 65
68private: 66private:
69 void setupNone(); 67 void setupNone();
70 void setupDaily(); 68 void setupDaily();
71 void setupWeekly(); 69 void setupWeekly();
72 void setupMonthly(); 70 void setupMonthly();
73 void setupYearly(); 71 void setupYearly();
74 72
75 enum repeatButtons { None, Day, Week, Month, Year }; 73 enum repeatButtons { None, Day, Week, Month, Year };
76 void init(); 74 void init();
77 void hideExtras(); 75 void hideExtras();
78 void showRepeatStuff(); 76 void showRepeatStuff();
79 77
80 QList<QToolButton> listRTypeButtons; 78 QList<QToolButton> listRTypeButtons;
81 QList<QToolButton> listExtra; 79 QList<QToolButton> listExtra;
82 QDate start; // only used in one spot... 80 QDate start; // only used in one spot...
83 QDate end; 81 QDate end;
84 repeatButtons currInterval; 82 repeatButtons currInterval;
85 bool startWeekOnMonday : 1; 83 bool startWeekOnMonday : 1;
86 DateBookMonth *repeatPicker; 84 DateBookMonth *repeatPicker;
87 85
88 class Private; 86 class Private;
89 Private *d; 87 Private *d;
90 88
91}; 89};
92 90
93#endif 91#endif