summaryrefslogtreecommitdiff
authorhakan <hakan>2002-03-29 16:33:34 (UTC)
committer hakan <hakan>2002-03-29 16:33:34 (UTC)
commit3a1684894efb2106f957469b94350abf754a404e (patch) (unidiff)
tree22e475a3dd11da80fa4f3735b479102715ba7eb3
parentd31e0363e905aae78034626896b0d6620ffbc8fc (diff)
downloadopie-3a1684894efb2106f957469b94350abf754a404e.zip
opie-3a1684894efb2106f957469b94350abf754a404e.tar.gz
opie-3a1684894efb2106f957469b94350abf754a404e.tar.bz2
Editing an event will no longer clears it's uid
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp12
-rw-r--r--core/pim/datebook/dateentryimpl.cpp2
-rw-r--r--core/pim/datebook/timepicker.cpp1
3 files changed, 9 insertions, 6 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 )
189 ag->addTo(default_view); 189 ag->addTo(default_view);
190 connect(ag, SIGNAL( selected ( QAction * ) ), 190 connect(ag, SIGNAL( selected ( QAction * ) ),
191 this, SLOT( newDefaultView(QAction *) ) 191 this, SLOT( newDefaultView(QAction *) )
192 ); 192 );
193 193
194 connect( qApp, SIGNAL(clockChanged(bool)), 194 connect( qApp, SIGNAL(clockChanged(bool)),
195 this, SLOT(changeClock(bool)) ); 195 this, SLOT(changeClock(bool)) );
196 connect( qApp, SIGNAL(weekChanged(bool)), 196 connect( qApp, SIGNAL(weekChanged(bool)),
197 this, SLOT(changeWeek(bool)) ); 197 this, SLOT(changeWeek(bool)) );
198 198
199#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 199#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
201 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 201 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
202#endif 202#endif
203 203
204 // listen on QPE/System 204 // listen on QPE/System
205#if defined(Q_WS_QWS) 205#if defined(Q_WS_QWS)
206#if !defined(QT_NO_COP) 206#if !defined(QT_NO_COP)
207 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 207 QCopChannel *channel = new QCopChannel( "QPE/System", this );
208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
209 this, SLOT(receive(const QCString&, const QByteArray&)) ); 209 this, SLOT(receive(const QCString&, const QByteArray&)) );
210 channel = new QCopChannel( "QPE/Datebook", this ); 210 channel = new QCopChannel( "QPE/Datebook", this );
211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
212 this, SLOT(receive(const QCString&, const QByteArray&)) ); 212 this, SLOT(receive(const QCString&, const QByteArray&)) );
213 qDebug("olle\n");
213#endif 214#endif
214#endif 215#endif
215 216
216 qDebug("done t=%d", t.elapsed() ); 217 qDebug("done t=%d", t.elapsed() );
217 218
218} 219}
219 220
220void DateBook::receive( const QCString &msg, const QByteArray &data ) 221void DateBook::receive( const QCString &msg, const QByteArray &data )
221{ 222{
222 QDataStream stream( data, IO_ReadOnly ); 223 QDataStream stream( data, IO_ReadOnly );
223 if ( msg == "timeChange(QString)" ) { 224 if ( msg == "timeChange(QString)" ) {
224 // update active view! 225 // update active view!
225 if ( dayAction->isOn() ) 226 if ( dayAction->isOn() )
226 viewDay(); 227 viewDay();
227 else if ( weekAction->isOn() ) 228 else if ( weekAction->isOn() )
228 viewWeek(); 229 viewWeek();
229 else if ( monthAction->isOn() ) 230 else if ( monthAction->isOn() )
230 viewMonth(); 231 viewMonth();
231 } 232 }
232 else if (msg == "editEvent(int)") { 233 else if (msg == "editEvent(int)") {
233 /* Not yet working... 234 int uid;
234 int uid; 235 stream >> uid;
235 stream >> uid; 236 Event e=db->getEvent(uid);
236 Event e=db->getEvent(uid); 237 editEvent(e);
237 editEvent(e);
238 */
239 } 238 }
240} 239}
241 240
242DateBook::~DateBook() 241DateBook::~DateBook()
243{ 242{
244} 243}
245 244
246void DateBook::slotSettings() 245void DateBook::slotSettings()
247{ 246{
248 DateBookSettings frmSettings( ampm, this ); 247 DateBookSettings frmSettings( ampm, this );
249 frmSettings.setStartTime( startTime ); 248 frmSettings.setStartTime( startTime );
250 frmSettings.setAlarmPreset( aPreset, presetTime ); 249 frmSettings.setAlarmPreset( aPreset, presetTime );
251#if defined (Q_WS_QWS) || defined(_WS_QWS_) 250#if defined (Q_WS_QWS) || defined(_WS_QWS_)
252 frmSettings.showMaximized(); 251 frmSettings.showMaximized();
253#endif 252#endif
254 253
255 if ( frmSettings.exec() ) { 254 if ( frmSettings.exec() ) {
256 aPreset = frmSettings.alarmPreset(); 255 aPreset = frmSettings.alarmPreset();
257 presetTime = frmSettings.presetTime(); 256 presetTime = frmSettings.presetTime();
258 startTime = frmSettings.startTime(); 257 startTime = frmSettings.startTime();
259 if ( dayView ) 258 if ( dayView )
260 dayView->setStartViewTime( startTime ); 259 dayView->setStartViewTime( startTime );
261 if ( weekView ) 260 if ( weekView )
262 weekView->setStartViewTime( startTime ); 261 weekView->setStartViewTime( startTime );
@@ -380,48 +379,49 @@ void DateBook::editEvent( const Event &e )
380 QMessageBox::warning( this, tr("Calendar"), 379 QMessageBox::warning( this, tr("Calendar"),
381 tr( "Can not edit data, currently syncing") ); 380 tr( "Can not edit data, currently syncing") );
382 return; 381 return;
383 } 382 }
384 383
385 // workaround added for text input. 384 // workaround added for text input.
386 QDialog editDlg( this, 0, TRUE ); 385 QDialog editDlg( this, 0, TRUE );
387 DateEntry *entry; 386 DateEntry *entry;
388 editDlg.setCaption( tr("Edit Event") ); 387 editDlg.setCaption( tr("Edit Event") );
389 QVBoxLayout *vb = new QVBoxLayout( &editDlg ); 388 QVBoxLayout *vb = new QVBoxLayout( &editDlg );
390 QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); 389 QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
391 sv->setResizePolicy( QScrollView::AutoOneFit ); 390 sv->setResizePolicy( QScrollView::AutoOneFit );
392 // KLUDGE!!! 391 // KLUDGE!!!
393 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 392 sv->setHScrollBarMode( QScrollView::AlwaysOff );
394 vb->addWidget( sv ); 393 vb->addWidget( sv );
395 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); 394 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
396 entry->timezone->setEnabled( FALSE ); 395 entry->timezone->setEnabled( FALSE );
397 sv->addChild( entry ); 396 sv->addChild( entry );
398 397
399#if defined(Q_WS_QWS) || defined(_WS_QWS_) 398#if defined(Q_WS_QWS) || defined(_WS_QWS_)
400 editDlg.showMaximized(); 399 editDlg.showMaximized();
401#endif 400#endif
402 while (editDlg.exec() ) { 401 while (editDlg.exec() ) {
403 Event newEv = entry->event(); 402 Event newEv = entry->event();
403 newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
404 QString error = checkEvent(newEv); 404 QString error = checkEvent(newEv);
405 if (!error.isNull()) { 405 if (!error.isNull()) {
406 if (QMessageBox::warning(this, "error box", 406 if (QMessageBox::warning(this, "error box",
407 error, "Fix it", "Continue", 407 error, "Fix it", "Continue",
408 0, 0, 1) == 0) 408 0, 0, 1) == 0)
409 continue; 409 continue;
410 } 410 }
411 db->editEvent(e, newEv); 411 db->editEvent(e, newEv);
412 emit newEvent(); 412 emit newEvent();
413 break; 413 break;
414 } 414 }
415} 415}
416 416
417void DateBook::removeEvent( const Event &e ) 417void DateBook::removeEvent( const Event &e )
418{ 418{
419 if (syncing) { 419 if (syncing) {
420 QMessageBox::warning( this, tr("Calendar"), 420 QMessageBox::warning( this, tr("Calendar"),
421 tr( "Can not edit data, currently syncing") ); 421 tr( "Can not edit data, currently syncing") );
422 return; 422 return;
423 } 423 }
424 424
425 QString strName = e.description(); 425 QString strName = e.description();
426 426
427 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) 427 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,
92 if(!event.description().isEmpty()) 92 if(!event.description().isEmpty())
93 addOrPick( comboDescription, event.description() ); 93 addOrPick( comboDescription, event.description() );
94 if(!event.location().isEmpty()) 94 if(!event.location().isEmpty())
95 addOrPick( comboLocation, event.location() ); 95 addOrPick( comboLocation, event.location() );
96 checkAlarm->setChecked( event.hasAlarm() ); 96 checkAlarm->setChecked( event.hasAlarm() );
97 checkAllDay->setChecked( event.type() == Event::AllDay ); 97 checkAllDay->setChecked( event.type() == Event::AllDay );
98 if(!event.notes().isEmpty()) 98 if(!event.notes().isEmpty())
99 editNote->setText(event.notes()); 99 editNote->setText(event.notes());
100 spinAlarm->setValue(event.alarmTime()); 100 spinAlarm->setValue(event.alarmTime());
101 if ( event.alarmSound() != Event::Silent ) 101 if ( event.alarmSound() != Event::Silent )
102 comboSound->setCurrentItem( 1 ); 102 comboSound->setCurrentItem( 1 );
103 if ( event.hasRepeat() ) { 103 if ( event.hasRepeat() ) {
104 rp = event.repeatPattern(); 104 rp = event.repeatPattern();
105 cmdRepeat->setText( tr("Repeat...") ); 105 cmdRepeat->setText( tr("Repeat...") );
106 } 106 }
107 setRepeatLabel(); 107 setRepeatLabel();
108} 108}
109 109
110void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 110void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
111{ 111{
112 startDate = s.date(); 112 startDate = s.date();
113 endDate = e.date(); 113 endDate = e.date();
114 startTime = s.time(); 114 startTime = s.time();
115 endTime = e.time(); 115 endTime = e.time();
116
116 startDateChanged( s.date().year(), s.date().month(), s.date().day() ); 117 startDateChanged( s.date().year(), s.date().month(), s.date().day() );
117 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 118 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
119
118 updateTimeEdit(true,true); 120 updateTimeEdit(true,true);
119} 121}
120 122
121void DateEntry::updateTimeEdit(bool s, bool e) { 123void DateEntry::updateTimeEdit(bool s, bool e) {
122 124
123 // Comboboxes 125 // Comboboxes
124 QString strStart, strEnd; 126 QString strStart, strEnd;
125 int shour, ehour; 127 int shour, ehour;
126 if ( ampm ) { 128 if ( ampm ) {
127 shour = startTime.hour(); 129 shour = startTime.hour();
128 ehour = endTime.hour(); 130 ehour = endTime.hour();
129 if ( shour >= 12 ) { 131 if ( shour >= 12 ) {
130 if ( shour > 12 ) 132 if ( shour > 12 )
131 shour -= 12; 133 shour -= 12;
132 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); 134 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
133 } else { 135 } else {
134 if ( shour == 0 ) 136 if ( shour == 0 )
135 shour = 12; 137 shour = 12;
136 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); 138 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
137 } 139 }
138 if ( ehour == 24 && endTime.minute() == 0 ) { 140 if ( ehour == 24 && endTime.minute() == 0 ) {
139 strEnd = "11:59 PM"; // or "midnight" 141 strEnd = "11:59 PM"; // or "midnight"
140 } else if ( ehour >= 12 ) { 142 } else if ( ehour >= 12 ) {
141 if ( ehour > 12 ) 143 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 @@
1#include "timepicker.h" 1#include "timepicker.h"
2 2
3#include <qbuttongroup.h> 3#include <qbuttongroup.h>
4#include <qtoolbutton.h> 4#include <qtoolbutton.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include "clickablelabel.h" 6#include "clickablelabel.h"
7#include <qstring.h> 7#include <qstring.h>
8#include <stdio.h>
8 9
9TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0, 10TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0,
10 WFlags fl = 0) : 11 WFlags fl = 0) :
11 QWidget(parent,name,fl) 12 QWidget(parent,name,fl)
12{ 13{
13 QVBoxLayout *vbox=new QVBoxLayout(this); 14 QVBoxLayout *vbox=new QVBoxLayout(this);
14 15
15 ClickableLabel *r; 16 ClickableLabel *r;
16 QString s; 17 QString s;
17 18
18 // Hour Row 19 // Hour Row
19 QWidget *row=new QWidget(this); 20 QWidget *row=new QWidget(this);
20 QHBoxLayout *l=new QHBoxLayout(row); 21 QHBoxLayout *l=new QHBoxLayout(row);
21 vbox->addWidget(row); 22 vbox->addWidget(row);
22 23
23 24
24 for (int i=0; i<24; i++) { 25 for (int i=0; i<24; i++) {
25 r=new ClickableLabel(row); 26 r=new ClickableLabel(row);
26 hourLst.append(r); 27 hourLst.append(r);
27 s.sprintf("%.2d",i); 28 s.sprintf("%.2d",i);
28 r->setText(s); 29 r->setText(s);
29 r->setToggleButton(true); 30 r->setToggleButton(true);
30 r->setAlignment(AlignHCenter | AlignVCenter); 31 r->setAlignment(AlignHCenter | AlignVCenter);
31 l->addWidget(r); 32 l->addWidget(r);