author | umopapisdn <umopapisdn> | 2003-05-05 21:44:39 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-05-05 21:44:39 (UTC) |
commit | 3b193b852133a82b5c1708b68a7e460c63629768 (patch) (unidiff) | |
tree | 8cd0ff3adc14f0b937d24ab99fca327fb3f16875 /core/pim/datebook/datebook.cpp | |
parent | 12a700f8903eedeba03d3aba7990b9d660410045 (diff) | |
download | opie-3b193b852133a82b5c1708b68a7e460c63629768.zip opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.gz opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.bz2 |
UI and code cleanup. Both UI and code is now more consistent. Also removed menus in favor of toolbuttons. (why were they even available as menus in the first place?)
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 276 |
1 files changed, 126 insertions, 150 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index cf1eeca..b7e89b0 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -72,131 +72,134 @@ | |||
72 | 72 | ||
73 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 73 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
74 | : QMainWindow( parent, "datebook", f ), | 74 | : QMainWindow( parent, "datebook", f ), |
75 | aPreset( FALSE ), | 75 | aPreset( FALSE ), |
76 | presetTime( -1 ), | 76 | presetTime( -1 ), |
77 | startTime( 8 ), // an acceptable default | 77 | startTime( 8 ), // an acceptable default |
78 | rowStyle( 0 ), | 78 | rowStyle( 0 ), |
79 | bJumpToCurTime(FALSE), | 79 | bJumpToCurTime(FALSE), |
80 | syncing(FALSE), | 80 | syncing(FALSE), |
81 | inSearch(FALSE), | 81 | inSearch(FALSE), |
82 | alarmCounter(0) | 82 | alarmCounter(0) |
83 | { | 83 | { |
84 | bool needEvilHack= false; // if we need an Evil Hack | 84 | bool needEvilHack= false; // if we need an Evil Hack |
85 | QTime t; | 85 | QTime t; |
86 | t.start(); | 86 | t.start(); |
87 | db = new DateBookDBHack; | 87 | db = new DateBookDBHack; |
88 | qDebug("loading db t=%d", t.elapsed() ); | 88 | qDebug("loading db t=%d", t.elapsed() ); |
89 | loadSettings(); | 89 | loadSettings(); |
90 | setCaption( tr("Calendar") ); | 90 | setCaption( tr("Calendar") ); |
91 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 91 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
92 | 92 | ||
93 | setToolBarsMovable( FALSE ); | 93 | setToolBarsMovable( FALSE ); |
94 | 94 | ||
95 | views = new QWidgetStack( this ); | 95 | views = new QWidgetStack( this ); |
96 | setCentralWidget( views ); | 96 | setCentralWidget( views ); |
97 | 97 | ||
98 | dayView = 0; | 98 | dayView = 0; |
99 | weekView = 0; | 99 | weekView = 0; |
100 | weekLstView = 0; | 100 | weekLstView = 0; |
101 | monthView = 0; | 101 | monthView = 0; |
102 | 102 | ||
103 | QPEToolBar *bar = new QPEToolBar( this ); | 103 | // QPEToolBar *bar = new QPEToolBar( this ); |
104 | bar->setHorizontalStretchable( TRUE ); | 104 | // bar->setHorizontalStretchable( TRUE ); |
105 | 105 | ||
106 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 106 | // QPEMenuBar *mb = new QPEMenuBar( bar ); |
107 | mb->setMargin( 0 ); | 107 | // mb->setMargin( 0 ); |
108 | 108 | ||
109 | QPEToolBar *sub_bar = new QPEToolBar(this); | 109 | // QPopupMenu *view = new QPopupMenu( this ); |
110 | 110 | // mb->insertItem( tr( "View" ), view ); | |
111 | QPopupMenu *view = new QPopupMenu( this ); | 111 | |
112 | QPopupMenu *settings = new QPopupMenu( this ); | 112 | QPEToolBar *sub_bar = new QPEToolBar(this); |
113 | 113 | sub_bar->setHorizontalStretchable(TRUE); | |
114 | mb->insertItem( tr( "View" ), view ); | 114 | |
115 | mb->insertItem( tr( "Settings" ), settings ); | 115 | QActionGroup *g = new QActionGroup( this ); |
116 | 116 | g->setExclusive( TRUE ); | |
117 | QActionGroup *g = new QActionGroup( this ); | 117 | |
118 | g->setExclusive( TRUE ); | 118 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
119 | 119 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | |
120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 120 | a->addTo( sub_bar ); |
121 | QString::null, 0, this, 0 ); | 121 | |
122 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 122 | sub_bar->addSeparator(); |
123 | a->addTo( sub_bar ); | 123 | |
124 | 124 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); | |
125 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); | 125 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); |
126 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | 126 | a->addTo( sub_bar ); |
127 | a->addTo( sub_bar ); | 127 | //a->addTo( view ); |
128 | a->addTo( view ); | 128 | |
129 | 129 | sub_bar->addSeparator(); | |
130 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 130 | |
131 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 131 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); |
132 | a->addTo( sub_bar ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
133 | a->addTo( view ); | 133 | a->addTo( sub_bar ); |
134 | a->setToggleAction( TRUE ); | 134 | // a->addTo( view ); |
135 | a->setOn( TRUE ); | 135 | a->setToggleAction( TRUE ); |
136 | dayAction = a; | 136 | a->setOn( TRUE ); |
137 | 137 | dayAction = a; | |
138 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 138 | |
139 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 139 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
140 | a->addTo( sub_bar ); | 140 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
141 | a->addTo( view ); | 141 | a->addTo( sub_bar ); |
142 | a->setToggleAction( TRUE ); | 142 | // a->addTo( view ); |
143 | weekAction = a; | 143 | a->setToggleAction( TRUE ); |
144 | 144 | weekAction = a; | |
145 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); | 145 | |
146 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | 146 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); |
147 | a->addTo( sub_bar ); | 147 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); |
148 | a->addTo( view ); | 148 | a->addTo( sub_bar ); |
149 | a->setToggleAction( TRUE ); | 149 | // a->addTo( view ); |
150 | weekLstAction = a; | 150 | a->setToggleAction( TRUE ); |
151 | 151 | weekLstAction = a; | |
152 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 152 | |
153 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 153 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
154 | a->addTo( sub_bar ); | 154 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
155 | a->addTo( view ); | 155 | a->addTo( sub_bar ); |
156 | a->setToggleAction( TRUE ); | 156 | // a->addTo( view ); |
157 | monthAction = a; | 157 | a->setToggleAction( TRUE ); |
158 | 158 | monthAction = a; | |
159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); | 159 | |
160 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 160 | sub_bar->addSeparator(); |
161 | a->addTo( sub_bar ); | 161 | |
162 | 162 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); | |
163 | a = new QAction( tr( "Edit..." ), QString::null, 0, 0 ); | 163 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
164 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 164 | a->addTo( sub_bar ); |
165 | a->addTo( settings ); | 165 | |
166 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); | ||
167 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | ||
168 | a->addTo( sub_bar ); | ||
166 | 169 | ||
167 | if(defaultView==DAY) viewDay(); | 170 | if(defaultView==DAY) viewDay(); |
168 | if(defaultView==WEEK) needEvilHack=true;// viewWeek(); | 171 | if(defaultView==WEEK) needEvilHack=true;// viewWeek(); |
169 | if(defaultView==WEEKLST) viewWeekLst(); | 172 | if(defaultView==WEEKLST) viewWeekLst(); |
170 | if(defaultView==MONTH) viewMonth(); | 173 | if(defaultView==MONTH) viewMonth(); |
171 | 174 | ||
172 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | 175 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
173 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); | 176 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); |
174 | 177 | ||
175 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 178 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
176 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 179 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
177 | #endif | 180 | #endif |
178 | 181 | ||
179 | // listen on QPE/System | 182 | // listen on QPE/System |
180 | #if defined(Q_WS_QWS) | 183 | #if defined(Q_WS_QWS) |
181 | #if !defined(QT_NO_COP) | 184 | #if !defined(QT_NO_COP) |
182 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 185 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
183 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); | 186 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); |
184 | channel = new QCopChannel( "QPE/Datebook", this ); | 187 | channel = new QCopChannel( "QPE/Datebook", this ); |
185 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); | 188 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); |
186 | qDebug("olle\n"); | 189 | qDebug("olle\n"); |
187 | #endif | 190 | #endif |
188 | #endif | 191 | #endif |
189 | 192 | ||
190 | qDebug("done t=%d", t.elapsed() ); | 193 | qDebug("done t=%d", t.elapsed() ); |
191 | 194 | ||
192 | /* | 195 | /* |
193 | * Here is a problem description: | 196 | * Here is a problem description: |
194 | * When Weekview is the default view | 197 | * When Weekview is the default view |
195 | * a DateBookWeekView get's created | 198 | * a DateBookWeekView get's created |
196 | * redraw() get's called. So what? | 199 | * redraw() get's called. So what? |
197 | * Remember that we're still in the c'tor | 200 | * Remember that we're still in the c'tor |
198 | * and no final layout has happened? Ok | 201 | * and no final layout has happened? Ok |
199 | * now all Events get arranged. Their x | 202 | * now all Events get arranged. Their x |
200 | * position get's determined by a QHeader | 203 | * position get's determined by a QHeader |
201 | * position. But the QHeader isn't layouted or | 204 | * position. But the QHeader isn't layouted or |
202 | * at the right position. redraw() is a slot | 205 | * at the right position. redraw() is a slot |
@@ -364,48 +367,41 @@ void DateBook::view(int v, const QDate &d) { | |||
364 | views->raiseWidget( weekLstView ); | 367 | views->raiseWidget( weekLstView ); |
365 | weekLstView->redraw(); | 368 | weekLstView->redraw(); |
366 | } else if (v==MONTH) { | 369 | } else if (v==MONTH) { |
367 | initMonth(); | 370 | initMonth(); |
368 | monthAction->setOn( TRUE ); | 371 | monthAction->setOn( TRUE ); |
369 | monthView->setDate( d.year(), d.month(), d.day() ); | 372 | monthView->setDate( d.year(), d.month(), d.day() ); |
370 | views->raiseWidget( monthView ); | 373 | views->raiseWidget( monthView ); |
371 | monthView->redraw(); | 374 | monthView->redraw(); |
372 | } | 375 | } |
373 | } | 376 | } |
374 | 377 | ||
375 | void DateBook::viewDefault(const QDate &d) { | 378 | void DateBook::viewDefault(const QDate &d) { |
376 | /* | ||
377 | Config config("DateBook"); | ||
378 | config.setGroup("Main"); | ||
379 | int current=config.readNumEntry("defaultview", DAY); | ||
380 | |||
381 | view(current,d); | ||
382 | */ | ||
383 | view(defaultView,d); | 379 | view(defaultView,d); |
384 | } | 380 | } |
385 | 381 | ||
386 | void DateBook::viewDay() { | 382 | void DateBook::viewDay() { |
387 | view(DAY,currentDate()); | 383 | view(DAY,currentDate()); |
388 | } | 384 | } |
389 | 385 | ||
390 | void DateBook::viewWeek() { | 386 | void DateBook::viewWeek() { |
391 | view(WEEK,currentDate()); | 387 | view(WEEK,currentDate()); |
392 | } | 388 | } |
393 | 389 | ||
394 | void DateBook::viewWeekLst() { | 390 | void DateBook::viewWeekLst() { |
395 | view(WEEKLST,currentDate()); | 391 | view(WEEKLST,currentDate()); |
396 | } | 392 | } |
397 | 393 | ||
398 | void DateBook::viewMonth() { | 394 | void DateBook::viewMonth() { |
399 | view(MONTH,currentDate()); | 395 | view(MONTH,currentDate()); |
400 | } | 396 | } |
401 | 397 | ||
402 | void DateBook::insertEvent( const Event &e ) | 398 | void DateBook::insertEvent( const Event &e ) |
403 | { | 399 | { |
404 | Event dupEvent=e; | 400 | Event dupEvent=e; |
405 | dupEvent.setLocation(defaultLocation); | 401 | dupEvent.setLocation(defaultLocation); |
406 | dupEvent.setCategories(defaultCategories); | 402 | dupEvent.setCategories(defaultCategories); |
407 | db->addEvent(dupEvent); | 403 | db->addEvent(dupEvent); |
408 | emit newEvent(); | 404 | emit newEvent(); |
409 | } | 405 | } |
410 | 406 | ||
411 | void DateBook::duplicateEvent( const Event &e ) | 407 | void DateBook::duplicateEvent( const Event &e ) |
@@ -517,127 +513,107 @@ void DateBook::showDay( int year, int month, int day ) | |||
517 | QDate d(year, month, day); | 513 | QDate d(year, month, day); |
518 | view(DAY,d); | 514 | view(DAY,d); |
519 | } | 515 | } |
520 | 516 | ||
521 | void DateBook::initDay() | 517 | void DateBook::initDay() |
522 | { | 518 | { |
523 | if ( !dayView ) { | 519 | if ( !dayView ) { |
524 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); | 520 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); |
525 | views->addWidget( dayView, DAY ); | 521 | views->addWidget( dayView, DAY ); |
526 | dayView->setStartViewTime( startTime ); | 522 | dayView->setStartViewTime( startTime ); |
527 | dayView->setJumpToCurTime( bJumpToCurTime ); | 523 | dayView->setJumpToCurTime( bJumpToCurTime ); |
528 | dayView->setRowStyle( rowStyle ); | 524 | dayView->setRowStyle( rowStyle ); |
529 | connect( this, SIGNAL( newEvent() ), | 525 | connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); |
530 | dayView, SLOT( redraw() ) ); | 526 | connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); |
531 | connect( dayView, SIGNAL( newEvent() ), | 527 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); |
532 | this, SLOT( fileNew() ) ); | 528 | connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); |
533 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), | 529 | connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); |
534 | this, SLOT( removeEvent( const Event & ) ) ); | 530 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), this, SLOT( beamEvent( const Event & ) ) ); |
535 | connect( dayView, SIGNAL( editEvent( const Event & ) ), | 531 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), this, SLOT(slotNewEventFromKey(const QString &)) ); |
536 | this, SLOT( editEvent( const Event & ) ) ); | 532 | } |
537 | connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), | ||
538 | this, SLOT( duplicateEvent( const Event & ) ) ); | ||
539 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), | ||
540 | this, SLOT( beamEvent( const Event & ) ) ); | ||
541 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), | ||
542 | this, SLOT(slotNewEventFromKey(const QString &)) ); | ||
543 | } | ||
544 | } | 533 | } |
545 | 534 | ||
546 | void DateBook::initWeek() | 535 | void DateBook::initWeek() |
547 | { | 536 | { |
548 | if ( !weekView ) { | 537 | if ( !weekView ) { |
549 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); | 538 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); |
550 | weekView->setStartViewTime( startTime ); | 539 | weekView->setStartViewTime( startTime ); |
551 | views->addWidget( weekView, WEEK ); | 540 | views->addWidget( weekView, WEEK ); |
552 | connect( weekView, SIGNAL( showDate( int, int, int ) ), | 541 | connect( weekView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); |
553 | this, SLOT( showDay( int, int, int ) ) ); | 542 | connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) ); |
554 | connect( this, SIGNAL( newEvent() ), | ||
555 | weekView, SLOT( redraw() ) ); | ||
556 | } | 543 | } |
557 | 544 | ||
558 | //But also get it right: the year that we display can be different | 545 | //But also get it right: the year that we display can be different |
559 | //from the year of the current date. So, first find the year | 546 | //from the year of the current date. So, first find the year |
560 | //number of the current week. | 547 | //number of the current week. |
561 | int yearNumber, totWeeks; | 548 | int yearNumber, totWeeks; |
562 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); | 549 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); |
563 | 550 | ||
564 | QDate d = QDate( yearNumber, 12, 31 ); | 551 | QDate d = QDate( yearNumber, 12, 31 ); |
565 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 552 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
566 | 553 | ||
567 | while ( totWeeks == 1 ) { | 554 | while ( totWeeks == 1 ) { |
568 | d = d.addDays( -1 ); | 555 | d = d.addDays( -1 ); |
569 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 556 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
570 | } | 557 | } |
571 | if ( totWeeks != weekView->totalWeeks() ) | ||
572 | weekView->setTotalWeeks( totWeeks ); | ||
573 | } | 558 | } |
574 | 559 | ||
575 | void DateBook::initWeekLst() { | 560 | void DateBook::initWeekLst() { |
576 | if ( !weekLstView ) { | 561 | if ( !weekLstView ) { |
577 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, | 562 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" ); |
578 | views, "weeklst view" ); | 563 | views->addWidget( weekLstView, WEEKLST ); |
579 | views->addWidget( weekLstView, WEEKLST ); | 564 | |
580 | 565 | //weekLstView->setStartViewTime( startTime ); | |
581 | //weekLstView->setStartViewTime( startTime ); | 566 | connect( weekLstView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); |
582 | connect( weekLstView, SIGNAL( showDate( int, int, int ) ), | 567 | connect( weekLstView, SIGNAL( addEvent( const QDateTime &, const QDateTime &, const QString & , const QString &) ), |
583 | this, SLOT( showDay( int, int, int ) ) ); | 568 | this, SLOT( slotNewEntry( const QDateTime &, const QDateTime &, const QString & , const QString &) ) ); |
584 | connect( weekLstView, SIGNAL( addEvent( const QDateTime &, | 569 | connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); |
585 | const QDateTime &, | 570 | connect( weekLstView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); |
586 | const QString & , const QString &) ), | 571 | } |
587 | this, SLOT( slotNewEntry( const QDateTime &, | ||
588 | const QDateTime &, | ||
589 | const QString & , const QString &) ) ); | ||
590 | connect( this, SIGNAL( newEvent() ), | ||
591 | weekLstView, SLOT( redraw() ) ); | ||
592 | connect( weekLstView, SIGNAL( editEvent( const Event & ) ), | ||
593 | this, SLOT( editEvent( const Event & ) ) ); | ||
594 | } | ||
595 | } | 572 | } |
596 | 573 | ||
597 | 574 | ||
598 | void DateBook::initMonth() | 575 | void DateBook::initMonth() |
599 | { | 576 | { |
600 | if ( !monthView ) { | 577 | if ( !monthView ) { |
601 | monthView = new DateBookMonth( views, "month view", FALSE, db ); | 578 | monthView = new DateBookMonth( views, "month view", FALSE, db ); |
602 | views->addWidget( monthView, MONTH ); | 579 | views->addWidget( monthView, MONTH ); |
603 | connect( monthView, SIGNAL( dateClicked( int, int, int ) ), | 580 | connect( monthView, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) ); |
604 | this, SLOT( showDay( int, int, int ) ) ); | 581 | connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) ); |
605 | connect( this, SIGNAL( newEvent() ), | 582 | qApp->processEvents(); |
606 | monthView, SLOT( redraw() ) ); | 583 | } |
607 | qApp->processEvents(); | ||
608 | } | ||
609 | } | 584 | } |
610 | 585 | ||
611 | void DateBook::loadSettings() | 586 | void DateBook::loadSettings() |
612 | { | 587 | { |
613 | Config qpeconfig( "qpe" ); | 588 | Config qpeconfig( "qpe" ); |
614 | qpeconfig.setGroup("Time"); | 589 | qpeconfig.setGroup("Time"); |
615 | ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); | 590 | ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); |
616 | onMonday = qpeconfig.readBoolEntry( "MONDAY" ); | 591 | onMonday = qpeconfig.readBoolEntry( "MONDAY" ); |
617 | 592 | ||
618 | Config config("DateBook"); | 593 | Config config("DateBook"); |
619 | config.setGroup("Main"); | 594 | config.setGroup("Main"); |
620 | startTime = config.readNumEntry("startviewtime", 8); | 595 | startTime = config.readNumEntry("startviewtime", 8); |
621 | aPreset = config.readBoolEntry("alarmpreset"); | 596 | aPreset = config.readBoolEntry("alarmpreset"); |
622 | presetTime = config.readNumEntry("presettime"); | 597 | presetTime = config.readNumEntry("presettime"); |
623 | bJumpToCurTime = config.readBoolEntry("jumptocurtime"); | 598 | bJumpToCurTime = config.readBoolEntry("jumptocurtime"); |
624 | rowStyle = config.readNumEntry("rowstyle"); | 599 | rowStyle = config.readNumEntry("rowstyle"); |
625 | defaultView = config.readNumEntry("defaultview",DAY); | 600 | defaultView = config.readNumEntry("defaultview",DAY); |
626 | weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); | 601 | weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); |
627 | 602 | ||
628 | defaultLocation=config.readEntry("defaultLocation"); | 603 | defaultLocation=config.readEntry("defaultLocation"); |
629 | QString tmpString=config.readEntry("defaultCategories"); | 604 | QString tmpString=config.readEntry("defaultCategories"); |
630 | QStringList tmpStringList=QStringList::split(",",tmpString); | 605 | QStringList tmpStringList=QStringList::split(",",tmpString); |
631 | defaultCategories.truncate(0); | 606 | defaultCategories.truncate(0); |
607 | |||
632 | for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { | 608 | for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { |
633 | defaultCategories.resize(defaultCategories.count()+1); | 609 | defaultCategories.resize(defaultCategories.count()+1); |
634 | defaultCategories[defaultCategories.count()-1]=(*i).toInt(); | 610 | defaultCategories[defaultCategories.count()-1]=(*i).toInt(); |
635 | } | 611 | } |
636 | } | 612 | } |
637 | 613 | ||
638 | void DateBook::saveSettings() | 614 | void DateBook::saveSettings() |
639 | { | 615 | { |
640 | Config config( "qpe" ); | 616 | Config config( "qpe" ); |
641 | Config configDB( "DateBook" ); | 617 | Config configDB( "DateBook" ); |
642 | configDB.setGroup( "Main" ); | 618 | configDB.setGroup( "Main" ); |
643 | configDB.writeEntry("startviewtime",startTime); | 619 | configDB.writeEntry("startviewtime",startTime); |