summaryrefslogtreecommitdiff
path: root/core/pim/datebook/dateentryimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/dateentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentryimpl.cpp8
1 files changed, 6 insertions, 2 deletions
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
@@ -22,63 +22,65 @@
22#include "repeatentry.h" 22#include "repeatentry.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/categoryselect.h> 25#include <qpe/categoryselect.h>
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qevent.h> 32#include <qevent.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmultilineedit.h> 37#include <qmultilineedit.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43#include "timepicker.h" 43#include "timepicker.h"
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46#include <stdio.h>
46 47
47/* 48/*
48 * Constructs a DateEntry which is a child of 'parent', with the 49 * Constructs a DateEntry which is a child of 'parent', with the
49 * name 'name' and widget flags set to 'f' 50 * name 'name' and widget flags set to 'f'
50 * 51 *
51 * The dialog will by default be modeless, unless you set 'modal' to 52 * The dialog will by default be modeless, unless you set 'modal' to
52 * TRUE to construct a modal dialog. 53 * TRUE to construct a modal dialog.
53 */ 54 */
54 55
55DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 56DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
56 const QDateTime &end, bool whichClock, QWidget* parent, 57 const QDateTime &end, bool whichClock, QWidget* parent,
57 const char* name ) 58 const char* name )
58 : DateEntryBase( parent, name ), 59 : DateEntryBase( parent, name ),
59 ampm( whichClock ), 60 ampm( whichClock ),
60 startWeekOnMonday( startOnMonday ) 61 startWeekOnMonday( startOnMonday ),
62 m_showStart(true)
61{ 63{
62 init(); 64 init();
63 setDates(start,end); 65 setDates(start,end);
64 setFocusProxy(comboDescription); 66 setFocusProxy(comboDescription);
65} 67}
66 68
67bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) 69bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
68{ 70{
69 if( ev->type() == QEvent::FocusIn ){ 71 if( ev->type() == QEvent::FocusIn ){
70 if( obj == comboStart ){ 72 if( obj == comboStart ){
71 timePickerStart->setHour(startTime.hour()); 73 timePickerStart->setHour(startTime.hour());
72 timePickerStart->setMinute(startTime.minute()); 74 timePickerStart->setMinute(startTime.minute());
73 TimePickerLabel->setText( tr("Start Time" ) ); 75 TimePickerLabel->setText( tr("Start Time" ) );
74 m_showStart= true; 76 m_showStart= true;
75 }else if( obj == comboEnd ){ 77 }else if( obj == comboEnd ){
76 timePickerStart->setHour(endTime.hour()); 78 timePickerStart->setHour(endTime.hour());
77 timePickerStart->setMinute(endTime.minute()); 79 timePickerStart->setMinute(endTime.minute());
78 TimePickerLabel->setText( tr("End Time") ); 80 TimePickerLabel->setText( tr("End Time") );
79 m_showStart = false; 81 m_showStart = false;
80 } 82 }
81 } else if( ev->type() == QEvent::FocusOut ){ 83 } else if( ev->type() == QEvent::FocusOut ){
82 if( obj == comboEnd ){ 84 if( obj == comboEnd ){
83 QString s; 85 QString s;
84 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); 86 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
@@ -92,49 +94,51 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
92 } 94 }
93 95
94 return false; 96 return false;
95} 97}
96 98
97static void addOrPick( QComboBox* combo, const QString& t ) 99static void addOrPick( QComboBox* combo, const QString& t )
98{ 100{
99 // Pick an item if one excists 101 // Pick an item if one excists
100 for (int i=0; i<combo->count(); i++) { 102 for (int i=0; i<combo->count(); i++) {
101 if ( combo->text(i) == t ) { 103 if ( combo->text(i) == t ) {
102 combo->setCurrentItem(i); 104 combo->setCurrentItem(i);
103 return; 105 return;
104 } 106 }
105 } 107 }
106 108
107 // Else add one 109 // Else add one
108 combo->insertItem(t); 110 combo->insertItem(t);
109 combo->setCurrentItem(combo->count()-1); 111 combo->setCurrentItem(combo->count()-1);
110} 112}
111 113
112DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 114DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
113 QWidget* parent, const char* name ) 115 QWidget* parent, const char* name )
114 : DateEntryBase( parent, name ), 116 : DateEntryBase( parent, name ),
115 ampm( whichClock ), 117 ampm( whichClock ),
116 startWeekOnMonday( startOnMonday ) 118 startWeekOnMonday( startOnMonday ),
119 m_showStart(true)
120
117{ 121{
118 init(); 122 init();
119 setDates(event.start(),event.end()); 123 setDates(event.start(),event.end());
120 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 124 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
121 if(!event.description().isEmpty()) 125 if(!event.description().isEmpty())
122 addOrPick( comboDescription, event.description() ); 126 addOrPick( comboDescription, event.description() );
123 if(!event.location().isEmpty()) 127 if(!event.location().isEmpty())
124 addOrPick( comboLocation, event.location() ); 128 addOrPick( comboLocation, event.location() );
125 checkAlarm->setChecked( event.hasAlarm() ); 129 checkAlarm->setChecked( event.hasAlarm() );
126 checkAllDay->setChecked( event.type() == Event::AllDay ); 130 checkAllDay->setChecked( event.type() == Event::AllDay );
127 if(!event.notes().isEmpty()) 131 if(!event.notes().isEmpty())
128 editNote->setText(event.notes()); 132 editNote->setText(event.notes());
129 spinAlarm->setValue(event.alarmTime()); 133 spinAlarm->setValue(event.alarmTime());
130 if ( event.alarmSound() != Event::Silent ) 134 if ( event.alarmSound() != Event::Silent )
131 comboSound->setCurrentItem( 1 ); 135 comboSound->setCurrentItem( 1 );
132 if ( event.hasRepeat() ) { 136 if ( event.hasRepeat() ) {
133 rp = event.repeatPattern(); 137 rp = event.repeatPattern();
134 cmdRepeat->setText( tr("Repeat...") ); 138 cmdRepeat->setText( tr("Repeat...") );
135 } 139 }
136 setRepeatLabel(); 140 setRepeatLabel();
137} 141}
138 142
139void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 143void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
140{ 144{