summaryrefslogtreecommitdiff
path: root/core/pim/datebook/dateentryimpl.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/dateentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentryimpl.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index d9e5225..856837c 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -204,100 +204,97 @@ void DateEntry::init()
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 defined(Q_WS_QWS) || defined(_WS_QWS_)
- noteDlg.showMaximized();
-#endif
- if (noteDlg.exec() ) {
+ if ( QPEApplication::execDialog( &noteDlg ) ) {
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;
@@ -350,100 +347,97 @@ void DateEntry::startDateChanged( int y, int m, int d )
*/
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 defined(Q_WS_QWS) || defined(_WS_QWS_)
- e->showMaximized();
-#endif
- if ( e->exec() ) {
+ 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() );