author | hakan <hakan> | 2002-03-29 16:33:34 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-03-29 16:33:34 (UTC) |
commit | 3a1684894efb2106f957469b94350abf754a404e (patch) (side-by-side diff) | |
tree | 22e475a3dd11da80fa4f3735b479102715ba7eb3 | |
parent | d31e0363e905aae78034626896b0d6620ffbc8fc (diff) | |
download | opie-3a1684894efb2106f957469b94350abf754a404e.zip opie-3a1684894efb2106f957469b94350abf754a404e.tar.gz opie-3a1684894efb2106f957469b94350abf754a404e.tar.bz2 |
Editing an event will no longer clears it's uid
-rw-r--r-- | core/pim/datebook/datebook.cpp | 4 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.cpp | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 2deb96f..97c305c 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -189,74 +189,73 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) ag->addTo(default_view); connect(ag, SIGNAL( selected ( QAction * ) ), this, SLOT( newDefaultView(QAction *) ) ); connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); #endif // listen on QPE/System #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); channel = new QCopChannel( "QPE/Datebook", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); + qDebug("olle\n"); #endif #endif qDebug("done t=%d", t.elapsed() ); } void DateBook::receive( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "timeChange(QString)" ) { // update active view! if ( dayAction->isOn() ) viewDay(); else if ( weekAction->isOn() ) viewWeek(); else if ( monthAction->isOn() ) viewMonth(); } else if (msg == "editEvent(int)") { - /* Not yet working... int uid; stream >> uid; Event e=db->getEvent(uid); editEvent(e); - */ } } DateBook::~DateBook() { } void DateBook::slotSettings() { DateBookSettings frmSettings( ampm, this ); frmSettings.setStartTime( startTime ); frmSettings.setAlarmPreset( aPreset, presetTime ); #if defined (Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); #endif if ( frmSettings.exec() ) { aPreset = frmSettings.alarmPreset(); presetTime = frmSettings.presetTime(); startTime = frmSettings.startTime(); if ( dayView ) dayView->setStartViewTime( startTime ); if ( weekView ) weekView->setStartViewTime( startTime ); @@ -380,48 +379,49 @@ void DateBook::editEvent( const Event &e ) QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); return; } // workaround added for text input. QDialog editDlg( this, 0, TRUE ); DateEntry *entry; editDlg.setCaption( tr("Edit Event") ); QVBoxLayout *vb = new QVBoxLayout( &editDlg ); QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); sv->setResizePolicy( QScrollView::AutoOneFit ); // 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(); + 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; } } void DateBook::removeEvent( const Event &e ) { if (syncing) { QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); return; } QString strName = e.description(); if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 1c43363..e563db0 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -92,50 +92,52 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, if(!event.description().isEmpty()) addOrPick( comboDescription, event.description() ); if(!event.location().isEmpty()) addOrPick( comboLocation, event.location() ); checkAlarm->setChecked( event.hasAlarm() ); checkAllDay->setChecked( event.type() == Event::AllDay ); if(!event.notes().isEmpty()) editNote->setText(event.notes()); spinAlarm->setValue(event.alarmTime()); if ( event.alarmSound() != Event::Silent ) comboSound->setCurrentItem( 1 ); if ( event.hasRepeat() ) { rp = event.repeatPattern(); cmdRepeat->setText( tr("Repeat...") ); } setRepeatLabel(); } void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) { startDate = s.date(); endDate = e.date(); startTime = s.time(); endTime = e.time(); + startDateChanged( s.date().year(), s.date().month(), s.date().day() ); endDateChanged( e.date().year(), e.date().month(), e.date().day() ); + updateTimeEdit(true,true); } void DateEntry::updateTimeEdit(bool s, bool e) { // Comboboxes QString strStart, strEnd; int shour, ehour; if ( ampm ) { shour = startTime.hour(); ehour = endTime.hour(); if ( shour >= 12 ) { if ( shour > 12 ) shour -= 12; strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); } else { if ( shour == 0 ) shour = 12; strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); } if ( ehour == 24 && endTime.minute() == 0 ) { strEnd = "11:59 PM"; // or "midnight" } else if ( ehour >= 12 ) { if ( ehour > 12 ) diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp index 5f08a05..9097e1b 100644 --- a/core/pim/datebook/timepicker.cpp +++ b/core/pim/datebook/timepicker.cpp @@ -1,31 +1,32 @@ #include "timepicker.h" #include <qbuttongroup.h> #include <qtoolbutton.h> #include <qlayout.h> #include "clickablelabel.h" #include <qstring.h> +#include <stdio.h> TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0) : QWidget(parent,name,fl) { QVBoxLayout *vbox=new QVBoxLayout(this); ClickableLabel *r; QString s; // Hour Row QWidget *row=new QWidget(this); QHBoxLayout *l=new QHBoxLayout(row); vbox->addWidget(row); for (int i=0; i<24; i++) { r=new ClickableLabel(row); hourLst.append(r); s.sprintf("%.2d",i); r->setText(s); r->setToggleButton(true); r->setAlignment(AlignHCenter | AlignVCenter); l->addWidget(r); |