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
@@ -63,12 +63,26 @@ DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
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
@@ -82,20 +96,41 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
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 */
@@ -148,17 +183,19 @@ void 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: