summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookdayallday.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookdayallday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookdayallday.cpp47
1 files changed, 42 insertions, 5 deletions
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index a0aefd3..3c3f482 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -57,51 +57,86 @@ DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
57 DatebookAlldayDisp * lb; 57 DatebookAlldayDisp * lb;
58 lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); 58 lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL);
59 lb->show(); 59 lb->show();
60 datebookdayalldayLayout->addWidget(lb); 60 datebookdayalldayLayout->addWidget(lb);
61 subWidgets.append(lb); 61 subWidgets.append(lb);
62 62
63 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); 63 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&)));
64 ++item_count; 64 ++item_count;
65 65
66 return lb; 66 return lb;
67} 67}
68 68
69DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e)
70{
71 DatebookAlldayDisp * lb;
72 lb = new DatebookAlldayDisp(e,m_MainFrame,NULL);
73 lb->show();
74 datebookdayalldayLayout->addWidget(lb);
75 subWidgets.append(lb);
76
77 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&)));
78 ++item_count;
79
80 return lb;
81}
82
69void DatebookdayAllday::removeAllEvents() 83void DatebookdayAllday::removeAllEvents()
70{ 84{
71 subWidgets.clear(); 85 subWidgets.clear();
72 item_count = 0; 86 item_count = 0;
73} 87}
74 88
75DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, 89DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
76 QWidget* parent,const char* name,WFlags f) 90 QWidget* parent,const char* name,WFlags f)
77 : QLabel(parent,name,f),m_Ev(ev),dateBook(db) 91 : QLabel(parent,name,f),m_Ev(ev),dateBook(db)
78{ 92{
79 QString strDesc = m_Ev.description(); 93 QString strDesc = m_Ev.description();
80 strDesc = strDesc.replace(QRegExp("<"),"&#60;"); 94 strDesc = strDesc.replace(QRegExp("<"),"&#60;");
81 setBackgroundColor(yellow); 95 setBackgroundColor(yellow);
82 setText(strDesc); 96 setText(strDesc);
83 setFrameStyle(QFrame::Raised|QFrame::Panel); 97 setFrameStyle(QFrame::Raised|QFrame::Panel);
84 98
85 int s = QFontMetrics(font()).height()+4; 99 int s = QFontMetrics(font()).height()+4;
86 setMaximumHeight( s ); 100 setMaximumHeight( s );
87 setMinimumSize( QSize( 0, s ) ); 101 setMinimumSize( QSize( 0, s ) );
102 m_holiday = false;
103}
104
105DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,const char* name, WFlags fl)
106 : QLabel(parent,name,fl),m_Ev(),dateBook(0)
107{
108 QString strDesc = aholiday;
109 strDesc = strDesc.replace(QRegExp("<"),"&#60;");
110 Event ev;
111 ev.setDescription(strDesc);
112 ev.setAllDay(true);
113 m_Ev.setEvent(ev);
114 setBackgroundColor(yellow);
115 setText(strDesc);
116 setFrameStyle(QFrame::Raised|QFrame::Panel);
117
118 int s = QFontMetrics(font()).height()+4;
119 setMaximumHeight( s );
120 setMinimumSize( QSize( 0, s ) );
121 m_holiday = true;
88} 122}
89 123
90DatebookAlldayDisp::~DatebookAlldayDisp() 124DatebookAlldayDisp::~DatebookAlldayDisp()
91{ 125{
92} 126}
93 127
94void DatebookAlldayDisp::beam_single_event() 128void DatebookAlldayDisp::beam_single_event()
95{ 129{
130 if (m_holiday) return;
96 // create an Event and beam it... 131 // create an Event and beam it...
97 /* 132 /*
98 * Start with the easy stuff. If start and end date is the same we can just use 133 * Start with the easy stuff. If start and end date is the same we can just use
99 * the values of effective m_Events 134 * the values of effective m_Events
100 * If it is a multi day m_Event we need to find the real start and end date... 135 * If it is a multi day m_Event we need to find the real start and end date...
101 */ 136 */
102 if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { 137 if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) {
103 Event m_Event( m_Ev.event() ); 138 Event m_Event( m_Ev.event() );
104 139
105 QDateTime dt( m_Ev.date(), m_Ev.start() ); 140 QDateTime dt( m_Ev.date(), m_Ev.start() );
106 m_Event.setStart( dt ); 141 m_Event.setStart( dt );
107 142
@@ -142,29 +177,31 @@ void DatebookAlldayDisp::beam_single_event()
142 m_Event.setEnd ( end ); 177 m_Event.setEnd ( end );
143 emit beamMe( m_Event ); 178 emit beamMe( m_Event );
144 } 179 }
145} 180}
146 181
147void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) 182void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
148{ 183{
149 Event ev = m_Ev.event(); 184 Event ev = m_Ev.event();
150 QColor b = backgroundColor(); 185 QColor b = backgroundColor();
151 setBackgroundColor(green); 186 setBackgroundColor(green);
152 update(); 187 update();
153 QPopupMenu m; 188 QPopupMenu m;
154 m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); 189 if (!m_holiday) {
155 m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); 190 m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 );
156 m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); 191 m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 );
157 if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); 192 m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 );
158 if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); 193 if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 );
194 if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 );
195 }
159 m.insertItem( tr( "Info"),6); 196 m.insertItem( tr( "Info"),6);
160 int r = m.exec( e->globalPos() ); 197 int r = m.exec( e->globalPos() );
161 setBackgroundColor(b); 198 setBackgroundColor(b);
162 update(); 199 update();
163 switch (r) { 200 switch (r) {
164 case 1: 201 case 1:
165 emit editMe( ev ); 202 emit editMe( ev );
166 break; 203 break;
167 case 2: 204 case 2:
168 emit deleteMe( ev ); 205 emit deleteMe( ev );
169 break; 206 break;
170 case 3: 207 case 3: