author | umopapisdn <umopapisdn> | 2003-03-24 09:06:06 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-24 09:06:06 (UTC) |
commit | fea2436fef9e7096b31840e7170a23280f3d6e39 (patch) (unidiff) | |
tree | 83bcaeafa071242e4b1d5df76409ff41d9900eac /core/pim/datebook | |
parent | 4a0041efd5cc7e08063c09b02858fcd9c2b59880 (diff) | |
download | opie-fea2436fef9e7096b31840e7170a23280f3d6e39.zip opie-fea2436fef9e7096b31840e7170a23280f3d6e39.tar.gz opie-fea2436fef9e7096b31840e7170a23280f3d6e39.tar.bz2 |
New feature: In dayview it's now possible to duplicate an event (and immediatly change some parameters for the duplicate).
-rw-r--r-- | core/pim/datebook/datebook.cpp | 65 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 3 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 2 |
4 files changed, 73 insertions, 2 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index fa509d9..47be523 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -404,2 +404,59 @@ void DateBook::viewMonth() { | |||
404 | 404 | ||
405 | void DateBook::duplicateEvent( const Event &e ) | ||
406 | { | ||
407 | qWarning("Hmmm..."); | ||
408 | // Alot of code duplication, as this is almost like editEvent(); | ||
409 | if (syncing) { | ||
410 | QMessageBox::warning( this, tr("Calendar"), | ||
411 | tr( "Can not edit data, currently syncing") ); | ||
412 | return; | ||
413 | } | ||
414 | |||
415 | Event dupevent; | ||
416 | dupevent.setStart(e.start()); | ||
417 | dupevent.setEnd(e.end()); | ||
418 | dupevent.setDescription(e.description()); | ||
419 | dupevent.setLocation(e.location()); | ||
420 | // dupevent.setCategory(e.category());// how is this done?? | ||
421 | dupevent.setNotes(e.notes()); | ||
422 | dupevent.setAllDay(e.isAllDay()); | ||
423 | dupevent.setTimeZone(e.timeZone()); | ||
424 | if(e.hasAlarm()) dupevent.setAlarm(e.alarmDelay(),e.alarmSound()); | ||
425 | if(e.hasRepeat()) dupevent.setRepeat(e.repeatPattern()); | ||
426 | |||
427 | // workaround added for text input. | ||
428 | QDialog editDlg( this, 0, TRUE ); | ||
429 | DateEntry *entry; | ||
430 | editDlg.setCaption( tr("Duplicate Event") ); | ||
431 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); | ||
432 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); | ||
433 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
434 | // KLUDGE!!! | ||
435 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
436 | vb->addWidget( sv ); | ||
437 | entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" ); | ||
438 | entry->timezone->setEnabled( FALSE ); | ||
439 | sv->addChild( entry ); | ||
440 | |||
441 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | ||
442 | editDlg.showMaximized(); | ||
443 | #endif | ||
444 | while (editDlg.exec() ) { | ||
445 | Event newEv = entry->event(); | ||
446 | if(newEv.description().isEmpty() && newEv.notes().isEmpty() ) | ||
447 | break; | ||
448 | newEv.setUid(e.uid()); // FIXME: Hack not to clear uid | ||
449 | QString error = checkEvent(newEv); | ||
450 | if (!error.isNull()) { | ||
451 | if (QMessageBox::warning(this, "error box", | ||
452 | error, "Fix it", "Continue", | ||
453 | 0, 0, 1) == 0) | ||
454 | continue; | ||
455 | } | ||
456 | db->addEvent(newEv); | ||
457 | emit newEvent(); | ||
458 | break; | ||
459 | } | ||
460 | } | ||
461 | |||
405 | void DateBook::editEvent( const Event &e ) | 462 | void DateBook::editEvent( const Event &e ) |
@@ -494,2 +551,4 @@ void DateBook::initDay() | |||
494 | this, SLOT( editEvent( const Event & ) ) ); | 551 | this, SLOT( editEvent( const Event & ) ) ); |
552 | connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), | ||
553 | this, SLOT( duplicateEvent( const Event & ) ) ); | ||
495 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), | 554 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), |
@@ -818,3 +877,3 @@ void DateBook::slotNewEventFromKey( const QString &str ) | |||
818 | } | 877 | } |
819 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) { | 878 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) { |
820 | // argh! This really needs to be encapsulated in a class | 879 | // argh! This really needs to be encapsulated in a class |
@@ -834,3 +893,7 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const | |||
834 | // When the new gui comes in, change this... | 893 | // When the new gui comes in, change this... |
894 | if(location==0) { | ||
835 | ev.setLocation( tr("(Unknown)") ); | 895 | ev.setLocation( tr("(Unknown)") ); |
896 | } else { | ||
897 | ev.setLocation(location); | ||
898 | } | ||
836 | ev.setStart( start ); | 899 | ev.setStart( start ); |
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index ba8f97e..623862b 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -67,3 +67,3 @@ private slots: | |||
67 | void fileNew(); | 67 | void fileNew(); |
68 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str); | 68 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0); |
69 | void slotSettings(); | 69 | void slotSettings(); |
@@ -89,2 +89,3 @@ private slots: | |||
89 | void editEvent( const Event &e ); | 89 | void editEvent( const Event &e ); |
90 | void duplicateEvent( const Event &e ); | ||
90 | void removeEvent( const Event &e ); | 91 | void removeEvent( const Event &e ); |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 42f026a..5d472a6 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -315,2 +315,4 @@ void DateBookDay::getEvents() | |||
315 | this, SIGNAL( removeEvent( const Event & ) ) ); | 315 | this, SIGNAL( removeEvent( const Event & ) ) ); |
316 | connect( w, SIGNAL( duplicateMe( const Event & ) ), | ||
317 | this, SIGNAL( duplicateEvent( const Event & ) ) ); | ||
316 | connect( w, SIGNAL( editMe( const Event & ) ), | 318 | connect( w, SIGNAL( editMe( const Event & ) ), |
@@ -724,2 +726,3 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | |||
724 | m.insertItem( tr( "Edit" ), 1 ); | 726 | m.insertItem( tr( "Edit" ), 1 ); |
727 | m.insertItem( tr( "Duplicate" ), 4 ); | ||
725 | m.insertItem( tr( "Delete" ), 2 ); | 728 | m.insertItem( tr( "Delete" ), 2 ); |
@@ -733,2 +736,4 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | |||
733 | emit beamMe( ev.event() ); | 736 | emit beamMe( ev.event() ); |
737 | } else if ( r == 4 ) { | ||
738 | emit duplicateMe( ev.event() ); | ||
734 | } | 739 | } |
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index db1cd04..2faf24e 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -81,2 +81,3 @@ signals: | |||
81 | void deleteMe( const Event &e ); | 81 | void deleteMe( const Event &e ); |
82 | void duplicateMe( const Event &e ); | ||
82 | void editMe( const Event &e ); | 83 | void editMe( const Event &e ); |
@@ -177,2 +178,3 @@ signals: | |||
177 | void editEvent( const Event& ); | 178 | void editEvent( const Event& ); |
179 | void duplicateEvent( const Event& ); | ||
178 | void beamEvent( const Event& ); | 180 | void beamEvent( const Event& ); |