author | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
commit | f0e656b51a2dcee1dec594636cbc1ba8d4b11eef (patch) (unidiff) | |
tree | 1eb83b120f8ce404324575799d75c32d4056d1f6 /core/pim/datebook/datebook.cpp | |
parent | 6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (diff) | |
download | opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.zip opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.tar.gz opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.tar.bz2 |
Patch by <tboc@gmx.de> to configure the size
of the row of the dayview
Adds an option to jump to the current time in the dayview
and some small fixes ( zecke )
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index c0d45c9..7dd93a6 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -71,24 +71,26 @@ | |||
71 | 71 | ||
72 | #define DAY 1 | 72 | #define DAY 1 |
73 | #define WEEK 2 | 73 | #define WEEK 2 |
74 | #define WEEKLST 4 | 74 | #define WEEKLST 4 |
75 | #define MONTH 3 | 75 | #define MONTH 3 |
76 | 76 | ||
77 | 77 | ||
78 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 78 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
79 | : QMainWindow( parent, "datebook", f ), | 79 | : QMainWindow( parent, "datebook", f ), |
80 | aPreset( FALSE ), | 80 | aPreset( FALSE ), |
81 | presetTime( -1 ), | 81 | presetTime( -1 ), |
82 | startTime( 8 ), // an acceptable default | 82 | startTime( 8 ), // an acceptable default |
83 | rowStyle( 0 ), | ||
84 | bJumpToCurTime(FALSE), | ||
83 | syncing(FALSE), | 85 | syncing(FALSE), |
84 | inSearch(FALSE), | 86 | inSearch(FALSE), |
85 | alarmCounter(0) | 87 | alarmCounter(0) |
86 | { | 88 | { |
87 | QTime t; | 89 | QTime t; |
88 | t.start(); | 90 | t.start(); |
89 | db = new DateBookDBHack; | 91 | db = new DateBookDBHack; |
90 | qDebug("loading db t=%d", t.elapsed() ); | 92 | qDebug("loading db t=%d", t.elapsed() ); |
91 | loadSettings(); | 93 | loadSettings(); |
92 | setCaption( tr("Calendar") ); | 94 | setCaption( tr("Calendar") ); |
93 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 95 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
94 | 96 | ||
@@ -240,34 +242,40 @@ void DateBook::receive( const QCString &msg, const QByteArray &data ) | |||
240 | } | 242 | } |
241 | } | 243 | } |
242 | 244 | ||
243 | DateBook::~DateBook() | 245 | DateBook::~DateBook() |
244 | { | 246 | { |
245 | } | 247 | } |
246 | 248 | ||
247 | void DateBook::slotSettings() | 249 | void DateBook::slotSettings() |
248 | { | 250 | { |
249 | DateBookSettings frmSettings( ampm, this ); | 251 | DateBookSettings frmSettings( ampm, this ); |
250 | frmSettings.setStartTime( startTime ); | 252 | frmSettings.setStartTime( startTime ); |
251 | frmSettings.setAlarmPreset( aPreset, presetTime ); | 253 | frmSettings.setAlarmPreset( aPreset, presetTime ); |
254 | frmSettings.setJumpToCurTime( bJumpToCurTime ); | ||
255 | frmSettings.setRowStyle( rowStyle ); | ||
252 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) | 256 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) |
253 | frmSettings.showMaximized(); | 257 | frmSettings.showMaximized(); |
254 | #endif | 258 | #endif |
255 | 259 | ||
256 | if ( frmSettings.exec() ) { | 260 | if ( frmSettings.exec() ) { |
257 | aPreset = frmSettings.alarmPreset(); | 261 | aPreset = frmSettings.alarmPreset(); |
258 | presetTime = frmSettings.presetTime(); | 262 | presetTime = frmSettings.presetTime(); |
259 | startTime = frmSettings.startTime(); | 263 | startTime = frmSettings.startTime(); |
264 | bJumpToCurTime = frmSettings.jumpToCurTime(); | ||
265 | rowStyle = frmSettings.rowStyle(); | ||
260 | if ( dayView ) | 266 | if ( dayView ) |
261 | dayView->setStartViewTime( startTime ); | 267 | dayView->setStartViewTime( startTime ); |
268 | dayView->setJumpToCurTime( bJumpToCurTime ); | ||
269 | dayView->setRowStyle( rowStyle ); | ||
262 | if ( weekView ) | 270 | if ( weekView ) |
263 | weekView->setStartViewTime( startTime ); | 271 | weekView->setStartViewTime( startTime ); |
264 | saveSettings(); | 272 | saveSettings(); |
265 | 273 | ||
266 | // make the change obvious | 274 | // make the change obvious |
267 | if ( views->visibleWidget() ) { | 275 | if ( views->visibleWidget() ) { |
268 | if ( views->visibleWidget() == dayView ) | 276 | if ( views->visibleWidget() == dayView ) |
269 | dayView->redraw(); | 277 | dayView->redraw(); |
270 | else if ( views->visibleWidget() == weekView ) | 278 | else if ( views->visibleWidget() == weekView ) |
271 | weekView->redraw(); | 279 | weekView->redraw(); |
272 | } | 280 | } |
273 | } | 281 | } |
@@ -444,24 +452,26 @@ void DateBook::addEvent( const Event &e ) | |||
444 | void DateBook::showDay( int year, int month, int day ) | 452 | void DateBook::showDay( int year, int month, int day ) |
445 | { | 453 | { |
446 | QDate d(year, month, day); | 454 | QDate d(year, month, day); |
447 | view(DAY,d); | 455 | view(DAY,d); |
448 | } | 456 | } |
449 | 457 | ||
450 | void DateBook::initDay() | 458 | void DateBook::initDay() |
451 | { | 459 | { |
452 | if ( !dayView ) { | 460 | if ( !dayView ) { |
453 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); | 461 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); |
454 | views->addWidget( dayView, DAY ); | 462 | views->addWidget( dayView, DAY ); |
455 | dayView->setStartViewTime( startTime ); | 463 | dayView->setStartViewTime( startTime ); |
464 | dayView->setJumpToCurTime( bJumpToCurTime ); | ||
465 | dayView->setRowStyle( rowStyle ); | ||
456 | connect( this, SIGNAL( newEvent() ), | 466 | connect( this, SIGNAL( newEvent() ), |
457 | dayView, SLOT( redraw() ) ); | 467 | dayView, SLOT( redraw() ) ); |
458 | connect( dayView, SIGNAL( newEvent() ), | 468 | connect( dayView, SIGNAL( newEvent() ), |
459 | this, SLOT( fileNew() ) ); | 469 | this, SLOT( fileNew() ) ); |
460 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), | 470 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), |
461 | this, SLOT( removeEvent( const Event & ) ) ); | 471 | this, SLOT( removeEvent( const Event & ) ) ); |
462 | connect( dayView, SIGNAL( editEvent( const Event & ) ), | 472 | connect( dayView, SIGNAL( editEvent( const Event & ) ), |
463 | this, SLOT( editEvent( const Event & ) ) ); | 473 | this, SLOT( editEvent( const Event & ) ) ); |
464 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), | 474 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), |
465 | this, SLOT( beamEvent( const Event & ) ) ); | 475 | this, SLOT( beamEvent( const Event & ) ) ); |
466 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), | 476 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), |
467 | this, SLOT(slotNewEventFromKey(const QString &)) ); | 477 | this, SLOT(slotNewEventFromKey(const QString &)) ); |
@@ -538,35 +548,39 @@ void DateBook::loadSettings() | |||
538 | Config config( "qpe" ); | 548 | Config config( "qpe" ); |
539 | config.setGroup("Time"); | 549 | config.setGroup("Time"); |
540 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 550 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
541 | onMonday = config.readBoolEntry( "MONDAY" ); | 551 | onMonday = config.readBoolEntry( "MONDAY" ); |
542 | } | 552 | } |
543 | 553 | ||
544 | { | 554 | { |
545 | Config config("DateBook"); | 555 | Config config("DateBook"); |
546 | config.setGroup("Main"); | 556 | config.setGroup("Main"); |
547 | startTime = config.readNumEntry("startviewtime", 8); | 557 | startTime = config.readNumEntry("startviewtime", 8); |
548 | aPreset = config.readBoolEntry("alarmpreset"); | 558 | aPreset = config.readBoolEntry("alarmpreset"); |
549 | presetTime = config.readNumEntry("presettime"); | 559 | presetTime = config.readNumEntry("presettime"); |
560 | bJumpToCurTime = config.readBoolEntry("jumptocurtime"); | ||
561 | rowStyle = config.readNumEntry("rowstyle"); | ||
550 | } | 562 | } |
551 | } | 563 | } |
552 | 564 | ||
553 | void DateBook::saveSettings() | 565 | void DateBook::saveSettings() |
554 | { | 566 | { |
555 | Config config( "qpe" ); | 567 | Config config( "qpe" ); |
556 | Config configDB( "DateBook" ); | 568 | Config configDB( "DateBook" ); |
557 | configDB.setGroup( "Main" ); | 569 | configDB.setGroup( "Main" ); |
558 | configDB.writeEntry("startviewtime",startTime); | 570 | configDB.writeEntry("startviewtime",startTime); |
559 | configDB.writeEntry("alarmpreset",aPreset); | 571 | configDB.writeEntry("alarmpreset",aPreset); |
560 | configDB.writeEntry("presettime",presetTime); | 572 | configDB.writeEntry("presettime",presetTime); |
573 | configDB.writeEntry("jumptocurtime", bJumpToCurTime); | ||
574 | configDB.writeEntry("rowstyle", rowStyle); | ||
561 | } | 575 | } |
562 | 576 | ||
563 | void DateBook::newDefaultView(QAction *a) { | 577 | void DateBook::newDefaultView(QAction *a) { |
564 | int val=DAY; | 578 | int val=DAY; |
565 | if (a->text() == "Day") val=DAY; | 579 | if (a->text() == "Day") val=DAY; |
566 | if (a->text() == "Week") val=WEEK; | 580 | if (a->text() == "Week") val=WEEK; |
567 | if (a->text() == "WeekLst") val=WEEKLST; | 581 | if (a->text() == "WeekLst") val=WEEKLST; |
568 | if (a->text() == "Month") val=MONTH; | 582 | if (a->text() == "Month") val=MONTH; |
569 | 583 | ||
570 | Config configDB( "DateBook" ); | 584 | Config configDB( "DateBook" ); |
571 | configDB.setGroup( "Main" ); | 585 | configDB.setGroup( "Main" ); |
572 | configDB.writeEntry("defaultview",val); | 586 | configDB.writeEntry("defaultview",val); |