summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp67
-rw-r--r--core/pim/datebook/datebook.h3
-rw-r--r--core/pim/datebook/datebookday.cpp29
-rw-r--r--core/pim/datebook/datebookday.h2
4 files changed, 86 insertions, 15 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() {
+void DateBook::duplicateEvent( const Event &e )
+{
+ qWarning("Hmmm...");
+ // Alot of code duplication, as this is almost like editEvent();
+ if (syncing) {
+ QMessageBox::warning( this, tr("Calendar"),
+ tr( "Can not edit data, currently syncing") );
+ return;
+ }
+
+ Event dupevent;
+ dupevent.setStart(e.start());
+ dupevent.setEnd(e.end());
+ dupevent.setDescription(e.description());
+ dupevent.setLocation(e.location());
+// dupevent.setCategory(e.category()); // how is this done??
+ dupevent.setNotes(e.notes());
+ dupevent.setAllDay(e.isAllDay());
+ dupevent.setTimeZone(e.timeZone());
+ if(e.hasAlarm()) dupevent.setAlarm(e.alarmDelay(),e.alarmSound());
+ if(e.hasRepeat()) dupevent.setRepeat(e.repeatPattern());
+
+ // workaround added for text input.
+ QDialog editDlg( this, 0, TRUE );
+ DateEntry *entry;
+ editDlg.setCaption( tr("Duplicate 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, dupevent, 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->addEvent(newEv);
+ emit newEvent();
+ break;
+ }
+}
+
void DateBook::editEvent( const Event &e )
@@ -494,2 +551,4 @@ void DateBook::initDay()
this, SLOT( editEvent( const Event & ) ) );
+ connect( dayView, SIGNAL( duplicateEvent( const Event & ) ),
+ this, SLOT( duplicateEvent( const Event & ) ) );
connect( dayView, SIGNAL( beamEvent( const Event & ) ),
@@ -818,3 +877,3 @@ void DateBook::slotNewEventFromKey( const QString &str )
}
-void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) {
+void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) {
// argh! This really needs to be encapsulated in a class
@@ -834,3 +893,7 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
// When the new gui comes in, change this...
- ev.setLocation( tr("(Unknown)") );
+ if(location==0) {
+ ev.setLocation( tr("(Unknown)") );
+ } else {
+ ev.setLocation(location);
+ }
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:
void fileNew();
- void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str);
+ void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0);
void slotSettings();
@@ -89,2 +89,3 @@ private slots:
void editEvent( const Event &e );
+ void duplicateEvent( const Event &e );
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()
this, SIGNAL( removeEvent( const Event & ) ) );
+ connect( w, SIGNAL( duplicateMe( const Event & ) ),
+ this, SIGNAL( duplicateEvent( const Event & ) ) );
connect( w, SIGNAL( editMe( const Event & ) ),
@@ -722,14 +724,17 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e )
- QPopupMenu m;
- m.insertItem( tr( "Edit" ), 1 );
- m.insertItem( tr( "Delete" ), 2 );
- if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 );
- int r = m.exec( e->globalPos() );
- if ( r == 1 ) {
- emit editMe( ev.event() );
- } else if ( r == 2 ) {
- emit deleteMe( ev.event() );
- } else if ( r == 3 ) {
- emit beamMe( ev.event() );
- }
+ QPopupMenu m;
+ m.insertItem( tr( "Edit" ), 1 );
+ m.insertItem( tr( "Duplicate" ), 4 );
+ m.insertItem( tr( "Delete" ), 2 );
+ if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 );
+ int r = m.exec( e->globalPos() );
+ if ( r == 1 ) {
+ emit editMe( ev.event() );
+ } else if ( r == 2 ) {
+ emit deleteMe( ev.event() );
+ } else if ( r == 3 ) {
+ emit beamMe( ev.event() );
+ } else if ( r == 4 ) {
+ emit duplicateMe( ev.event() );
+ }
}
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:
void deleteMe( const Event &e );
+ void duplicateMe( const Event &e );
void editMe( const Event &e );
@@ -177,2 +178,3 @@ signals:
void editEvent( const Event& );
+ void duplicateEvent( const Event& );
void beamEvent( const Event& );