summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 92dbdc8..2deb96f 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -162,115 +162,126 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
162 162
163 a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); 163 a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 );
164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
165 a->addTo( settings ); 165 a->addTo( settings );
166 166
167 QPopupMenu *default_view = new QPopupMenu(this); 167 QPopupMenu *default_view = new QPopupMenu(this);
168 settings->insertItem( tr( "Default View" ),default_view ); 168 settings->insertItem( tr( "Default View" ),default_view );
169 default_view->setCheckable(TRUE); 169 default_view->setCheckable(TRUE);
170 170
171 Config config("DateBook"); 171 Config config("DateBook");
172 config.setGroup("Main"); 172 config.setGroup("Main");
173 int current=config.readNumEntry("defaultview", DAY); 173 int current=config.readNumEntry("defaultview", DAY);
174 174
175 QActionGroup *ag = new QActionGroup(this); 175 QActionGroup *ag = new QActionGroup(this);
176 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); 176 a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true );
177 if (current==DAY) a->setOn(true), viewDay(); 177 if (current==DAY) a->setOn(true), viewDay();
178 ag->insert(a); 178 ag->insert(a);
179 a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); 179 a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true );
180 if (current==WEEK) a->setOn(true), viewWeek(); 180 if (current==WEEK) a->setOn(true), viewWeek();
181 ag->insert(a); 181 ag->insert(a);
182 a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); 182 a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true );
183 if (current==WEEKLST) a->setOn(true), viewWeekLst(); 183 if (current==WEEKLST) a->setOn(true), viewWeekLst();
184 ag->insert(a); 184 ag->insert(a);
185 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); 185 a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true );
186 if (current==MONTH) a->setOn(true), viewMonth(); 186 if (current==MONTH) a->setOn(true), viewMonth();
187 ag->insert(a); 187 ag->insert(a);
188 188
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 );
211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
212 this, SLOT(receive(const QCString&, const QByteArray&)) );
210#endif 213#endif
211#endif 214#endif
212 215
213 qDebug("done t=%d", t.elapsed() ); 216 qDebug("done t=%d", t.elapsed() );
214 217
215} 218}
216 219
217void DateBook::receive( const QCString &msg, const QByteArray &data ) 220void DateBook::receive( const QCString &msg, const QByteArray &data )
218{ 221{
219 QDataStream stream( data, IO_ReadOnly ); 222 QDataStream stream( data, IO_ReadOnly );
220 if ( msg == "timeChange(QString)" ) { 223 if ( msg == "timeChange(QString)" ) {
221 // update active view! 224 // update active view!
222 if ( dayAction->isOn() ) 225 if ( dayAction->isOn() )
223 viewDay(); 226 viewDay();
224 else if ( weekAction->isOn() ) 227 else if ( weekAction->isOn() )
225 viewWeek(); 228 viewWeek();
226 else if ( monthAction->isOn() ) 229 else if ( monthAction->isOn() )
227 viewMonth(); 230 viewMonth();
228 } 231 }
232 else if (msg == "editEvent(int)") {
233 /* Not yet working...
234 int uid;
235 stream >> uid;
236 Event e=db->getEvent(uid);
237 editEvent(e);
238 */
239 }
229} 240}
230 241
231DateBook::~DateBook() 242DateBook::~DateBook()
232{ 243{
233} 244}
234 245
235void DateBook::slotSettings() 246void DateBook::slotSettings()
236{ 247{
237 DateBookSettings frmSettings( ampm, this ); 248 DateBookSettings frmSettings( ampm, this );
238 frmSettings.setStartTime( startTime ); 249 frmSettings.setStartTime( startTime );
239 frmSettings.setAlarmPreset( aPreset, presetTime ); 250 frmSettings.setAlarmPreset( aPreset, presetTime );
240#if defined (Q_WS_QWS) || defined(_WS_QWS_) 251#if defined (Q_WS_QWS) || defined(_WS_QWS_)
241 frmSettings.showMaximized(); 252 frmSettings.showMaximized();
242#endif 253#endif
243 254
244 if ( frmSettings.exec() ) { 255 if ( frmSettings.exec() ) {
245 aPreset = frmSettings.alarmPreset(); 256 aPreset = frmSettings.alarmPreset();
246 presetTime = frmSettings.presetTime(); 257 presetTime = frmSettings.presetTime();
247 startTime = frmSettings.startTime(); 258 startTime = frmSettings.startTime();
248 if ( dayView ) 259 if ( dayView )
249 dayView->setStartViewTime( startTime ); 260 dayView->setStartViewTime( startTime );
250 if ( weekView ) 261 if ( weekView )
251 weekView->setStartViewTime( startTime ); 262 weekView->setStartViewTime( startTime );
252 saveSettings(); 263 saveSettings();
253 264
254 // make the change obvious 265 // make the change obvious
255 if ( views->visibleWidget() ) { 266 if ( views->visibleWidget() ) {
256 if ( views->visibleWidget() == dayView ) 267 if ( views->visibleWidget() == dayView )
257 dayView->redraw(); 268 dayView->redraw();
258 else if ( views->visibleWidget() == weekView ) 269 else if ( views->visibleWidget() == weekView )
259 weekView->redraw(); 270 weekView->redraw();
260 } 271 }
261 } 272 }
262} 273}
263 274
264void DateBook::fileNew() 275void DateBook::fileNew()
265{ 276{
266 slotNewEventFromKey(""); 277 slotNewEventFromKey("");
267} 278}
268 279
269QString DateBook::checkEvent(const Event &e) 280QString DateBook::checkEvent(const Event &e)
270{ 281{
271 /* check if overlaps with itself */ 282 /* check if overlaps with itself */
272 bool checkFailed = FALSE; 283 bool checkFailed = FALSE;
273 284
274 /* check the next 12 repeats. should catch most problems */ 285 /* check the next 12 repeats. should catch most problems */
275 QDate current_date = e.start().date(); 286 QDate current_date = e.start().date();
276 Event previous = e; 287 Event previous = e;