summaryrefslogtreecommitdiff
path: root/core/pim/datebook
authorzecke <zecke>2002-06-27 12:42:37 (UTC)
committer zecke <zecke>2002-06-27 12:42:37 (UTC)
commit475c11d442a03d8e53b220923626c4bb7350831f (patch) (side-by-side diff)
tree10e7fdfc22b337dfd8f6947f09e7bd163e609f0f /core/pim/datebook
parente69c1daabcd8149f2ad61b2cbbf205128072b415 (diff)
downloadopie-475c11d442a03d8e53b220923626c4bb7350831f.zip
opie-475c11d442a03d8e53b220923626c4bb7350831f.tar.gz
opie-475c11d442a03d8e53b220923626c4bb7350831f.tar.bz2
Fix for bug 81. It's now like in todolist
If neither description nor note is inserted it'll be discarded
Diffstat (limited to 'core/pim/datebook') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp2
-rw-r--r--core/pim/datebook/dateentryimpl.cpp11
2 files changed, 8 insertions, 5 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index e10842a..76260e2 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -420,24 +420,26 @@ void DateBook::editEvent( const Event &e )
// KLUDGE!!!
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
entry->timezone->setEnabled( FALSE );
sv->addChild( entry );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
editDlg.showMaximized();
#endif
while (editDlg.exec() ) {
Event newEv = entry->event();
+ if(newEv.description().isEmpty() && newEv.notes().isEmpty() )
+ break;
newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
QString error = checkEvent(newEv);
if (!error.isNull()) {
if (QMessageBox::warning(this, "error box",
error, "Fix it", "Continue",
0, 0, 1) == 0)
continue;
}
db->editEvent(e, newEv);
emit newEvent();
break;
}
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index dab3375..2cdda9d 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -84,25 +84,25 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
} 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;
}
}
@@ -177,50 +177,50 @@ void DateEntry::updateTimeEdit(bool s, bool e) {
if ( ehour > 12 )
ehour -= 12;
strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
} else {
if ( ehour == 0 )
ehour = 12;
strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
}
} else {
strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
}
-
+
if (s) comboStart->setText(strStart);
if (e) comboEnd->setText(strEnd);
}
void DateEntry::init()
{
comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
initCombos();
QPopupMenu *m1 = new QPopupMenu( this );
startPicker = new DateBookMonth( m1, 0, TRUE );
m1->insertItem( startPicker );
buttonStart->setPopup( m1 );
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 &) ));
@@ -237,25 +237,25 @@ 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.sprintf("<B>%d/%d</B> ", startDate.day(), startDate.month());
NoteEntry noteDlg(s+comboDescription->currentText(), noteStr,
- this,0,TRUE);
+ this,0,TRUE);
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
noteDlg.showMaximized();
#endif
if (noteDlg.exec() ) {
noteStr=noteDlg.note->text();
}
}
void DateEntry::endDateChanged( int y, int m, int d )
{
@@ -412,25 +412,25 @@ 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 );
@@ -561,12 +561,13 @@ void DateEntry::initCombos()
}
}
}
*/
}
void DateEntry::slotChangeClock( bool whichClock )
{
ampm = whichClock;
initCombos();
setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) );
}
+