summaryrefslogtreecommitdiff
authorhakan <hakan>2002-05-06 21:09:38 (UTC)
committer hakan <hakan>2002-05-06 21:09:38 (UTC)
commitf046179d3b49c44896298aa86380046a21394bbc (patch) (side-by-side diff)
treeb0df64a4170cd9d2631244213b33c7ef0e55b4f8
parent8622bcb85245937853f3e657498957deb7eb2073 (diff)
downloadopie-f046179d3b49c44896298aa86380046a21394bbc.zip
opie-f046179d3b49c44896298aa86380046a21394bbc.tar.gz
opie-f046179d3b49c44896298aa86380046a21394bbc.tar.bz2
In the date entry dialog:
- Show end time (not only chnage label) when end textbox is selected. - Update timepicker when endtime is edited. - Update time textboxes when they looses focus. - Got rid of vertical empty borders. - "All day" dissables timepicker aswell. - Picking bad end time will set and show end time to starttime
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/dateentry.ui36
-rw-r--r--core/pim/datebook/dateentryimpl.cpp38
2 files changed, 59 insertions, 15 deletions
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index dc5195f..1a712ec 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -14,65 +14,65 @@
** 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>0</number>
+ <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>
@@ -236,129 +236,151 @@
<height>32767</height>
</size>
</property>
</widget>
<widget row="4" column="1" rowspan="1" colspan="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>comboStart</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>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" colspan="3">
<class>TimePicker</class>
<property stdset="1">
<name>name</name>
<cstring>timePickerStart</cstring>
</property>
</widget>
- <widget row="3" column="2" colspan="2">
+ <widget row="3" column="3" colspan="1">
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>buttonEnd</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Jan 02 00</string>
</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>
</widget>
- <widget row="4" column="2" colspan="2">
+ <widget row="4" column="3" colspan="1">
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>comboEnd</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>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>TextLabel3_2</cstring>
+ <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>
@@ -534,55 +556,61 @@
<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&amp;)</signal>
<receiver>DateEntryBase</receiver>
<slot>endTimeChanged( const QString &amp; )</slot>
</connection>
<connection>
<sender>cmdRepeat</sender>
<signal>clicked()</signal>
<receiver>DateEntryBase</receiver>
<slot>slotRepeat()</slot>
</connection>
<connection>
<sender>comboStart</sender>
<signal>textChanged(const QString &amp;)</signal>
<receiver>DateEntryBase</receiver>
<slot>startTimeEdited( const QString &amp; )</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 &amp; )</slot>
<slot access="public">endDateChanged( int, int, int )</slot>
<slot access="public">endTimeChanged( const QString &amp; )</slot>
<slot access="public">slotRepeat()</slot>
<slot access="public">slotWait( int )</slot>
<slot access="public">startDateChanged( const QString &amp; )</slot>
<slot access="public">startDateChanged(int, int, int)</slot>
<slot access="public">startTimeEdited( const QString &amp; )</slot>
<slot access="public">typeChanged( const QString &amp; )</slot>
<slot access="public">tzexecute(void)</slot>
</connections>
</UI>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index f2f17c6..e14e2f5 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -39,71 +39,87 @@
#include <qscrollview.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include "timepicker.h"
#include <stdlib.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 )
{
init();
setDates(start,end);
setFocusProxy(comboDescription);
}
bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
{
if( ev->type() == QEvent::FocusIn ){
if( obj == comboStart ){
- TextLabel3_2->setText( tr("Start Time" ) );
+ timePickerStart->setHour(startTime.hour());
+ timePickerStart->setMinute(startTime.minute());
+ TimePickerLabel->setText( tr("Start Time" ) );
m_showStart= true;
}else if( obj == comboEnd ){
- TextLabel3_2->setText( tr("End Time") );
+ 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 )
{
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() );
@@ -239,125 +255,125 @@ static QTime parseTime( const QString& s, bool 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 )
{
- QTime tmpTime = parseTime(s,ampm);
- if ( endDate > startDate || tmpTime >= startTime ) {
- endTime = tmpTime;
+ endTimeChanged( parseTime(s,ampm) );
+}
+
+void DateEntry::endTimeChanged( const QTime &t ) {
+ if ( endDate > startDate || t >= startTime ) {
+ endTime = t;
} else {
endTime = startTime;
//comboEnd->setCurrentItem( comboStart->currentItem() );
}
-
-}
-
-void DateEntry::endTimeChanged( const QTime &t ) {
+ 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{
- endTime = t;
+ 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() ) {
rp = e->repeatPattern();
setRepeatLabel();