Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 120 |
1 files changed, 39 insertions, 81 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 829f8f8..4fbcb10 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -72,8 +72,2 @@ | |||
72 | 72 | ||
73 | #define DAY 1 | ||
74 | #define WEEK 2 | ||
75 | #define WEEKLST 4 | ||
76 | #define MONTH 3 | ||
77 | |||
78 | |||
79 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 73 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
@@ -168,3 +162,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
168 | 162 | ||
169 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); | 163 | a = new QAction( tr( "Edit..." ), QString::null, 0, 0 ); |
170 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 164 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
@@ -172,37 +166,12 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
172 | 166 | ||
173 | QPopupMenu *default_view = new QPopupMenu(this); | 167 | if(defaultView==DAY) viewDay(); |
174 | settings->insertItem( tr( "Default View" ),default_view ); | 168 | if(defaultView==WEEK) needEvilHack=true;// viewWeek(); |
175 | default_view->setCheckable(TRUE); | 169 | if(defaultView==WEEKLST) viewWeekLst(); |
170 | if(defaultView==MONTH) viewMonth(); | ||
176 | 171 | ||
177 | Config config("DateBook"); | 172 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
178 | config.setGroup("Main"); | 173 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); |
179 | int current=config.readNumEntry("defaultview", DAY); | ||
180 | |||
181 | QActionGroup *ag = new QActionGroup(this); | ||
182 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); | ||
183 | if (current==DAY) a->setOn(true), viewDay(); | ||
184 | ag->insert(a); | ||
185 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); | ||
186 | if (current==WEEK) a->setOn(true), /*viewWeek(),*/ needEvilHack = true; | ||
187 | ag->insert(a); | ||
188 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); | ||
189 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); | ||
190 | ag->insert(a); | ||
191 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); | ||
192 | if (current==MONTH) a->setOn(true), viewMonth(); | ||
193 | ag->insert(a); | ||
194 | |||
195 | ag->addTo(default_view); | ||
196 | connect(ag, SIGNAL( selected ( QAction * ) ), | ||
197 | this, SLOT( newDefaultView(QAction *) ) | ||
198 | ); | ||
199 | |||
200 | connect( qApp, SIGNAL(clockChanged(bool)), | ||
201 | this, SLOT(changeClock(bool)) ); | ||
202 | connect( qApp, SIGNAL(weekChanged(bool)), | ||
203 | this, SLOT(changeWeek(bool)) ); | ||
204 | 174 | ||
205 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 175 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
206 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 176 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
207 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | ||
208 | #endif | 177 | #endif |
@@ -213,7 +182,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
213 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 182 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
214 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 183 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); |
215 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
216 | channel = new QCopChannel( "QPE/Datebook", this ); | 184 | channel = new QCopChannel( "QPE/Datebook", this ); |
217 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 185 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); |
218 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
219 | qDebug("olle\n"); | 186 | qDebug("olle\n"); |
@@ -274,2 +241,5 @@ void DateBook::slotSettings() | |||
274 | frmSettings.setRowStyle( rowStyle ); | 241 | frmSettings.setRowStyle( rowStyle ); |
242 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); | ||
243 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); | ||
244 | |||
275 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) | 245 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) |
@@ -285,2 +255,4 @@ void DateBook::slotSettings() | |||
285 | rowStyle = frmSettings.rowStyle(); | 255 | rowStyle = frmSettings.rowStyle(); |
256 | defaultView=frmSettings.comboDefaultView->currentItem()+1; | ||
257 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); | ||
286 | 258 | ||
@@ -302,2 +274,4 @@ void DateBook::slotSettings() | |||
302 | weekView->redraw(); | 274 | weekView->redraw(); |
275 | else if ( views->visibleWidget() == weekLstView ) | ||
276 | weekLstView->redraw(); | ||
303 | } | 277 | } |
@@ -385,2 +359,3 @@ void DateBook::view(int v, const QDate &d) { | |||
385 | void DateBook::viewDefault(const QDate &d) { | 359 | void DateBook::viewDefault(const QDate &d) { |
360 | /* | ||
386 | Config config("DateBook"); | 361 | Config config("DateBook"); |
@@ -390,2 +365,4 @@ void DateBook::viewDefault(const QDate &d) { | |||
390 | view(current,d); | 365 | view(current,d); |
366 | */ | ||
367 | view(defaultView,d); | ||
391 | } | 368 | } |
@@ -610,10 +587,7 @@ void DateBook::loadSettings() | |||
610 | { | 587 | { |
611 | { | 588 | Config qpeconfig( "qpe" ); |
612 | Config config( "qpe" ); | 589 | qpeconfig.setGroup("Time"); |
613 | config.setGroup("Time"); | 590 | ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); |
614 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 591 | onMonday = qpeconfig.readBoolEntry( "MONDAY" ); |
615 | onMonday = config.readBoolEntry( "MONDAY" ); | ||
616 | } | ||
617 | 592 | ||
618 | { | ||
619 | Config config("DateBook"); | 593 | Config config("DateBook"); |
@@ -625,3 +599,4 @@ void DateBook::loadSettings() | |||
625 | rowStyle = config.readNumEntry("rowstyle"); | 599 | rowStyle = config.readNumEntry("rowstyle"); |
626 | } | 600 | defaultView = config.readNumEntry("defaultview",DAY); |
601 | weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); | ||
627 | } | 602 | } |
@@ -638,14 +613,4 @@ void DateBook::saveSettings() | |||
638 | configDB.writeEntry("rowstyle", rowStyle); | 613 | configDB.writeEntry("rowstyle", rowStyle); |
639 | } | 614 | configDB.writeEntry("defaultview",defaultView); |
640 | 615 | configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); | |
641 | void DateBook::newDefaultView(QAction *a) { | ||
642 | int val=DAY; | ||
643 | if (a->text() == "Day") val=DAY; | ||
644 | if (a->text() == "Week") val=WEEK; | ||
645 | if (a->text() == "WeekLst") val=WEEKLST; | ||
646 | if (a->text() == "Month") val=MONTH; | ||
647 | |||
648 | Config configDB( "DateBook" ); | ||
649 | configDB.setGroup( "Main" ); | ||
650 | configDB.writeEntry("defaultview",val); | ||
651 | } | 616 | } |
@@ -664,4 +629,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
664 | QDateTime current = QDateTime::currentDateTime(); | 629 | QDateTime current = QDateTime::currentDateTime(); |
665 | if ( current.time().hour() != when.time().hour() | 630 | if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() ) |
666 | && current.time().minute() != when.time().minute() ) | ||
667 | return; | 631 | return; |
@@ -674,4 +638,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
674 | bool found = FALSE; | 638 | bool found = FALSE; |
675 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 639 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { |
676 | it!=list.end(); ++it ) { | ||
677 | if ( (*it).event().hasAlarm() ) { | 640 | if ( (*it).event().hasAlarm() ) { |
@@ -698,3 +661,2 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
698 | } | 661 | } |
699 | |||
700 | QDialog dlg( this, 0, TRUE ); | 662 | QDialog dlg( this, 0, TRUE ); |
@@ -722,4 +684,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
722 | needShow = TRUE; | 684 | needShow = TRUE; |
723 | } | 685 | } else { |
724 | else { | ||
725 | QWidget* cur = views->visibleWidget(); | 686 | QWidget* cur = views->visibleWidget(); |
@@ -753,8 +714,5 @@ void DateBook::reload() | |||
753 | db->reload(); | 714 | db->reload(); |
754 | if ( dayAction->isOn() ) | 715 | if ( dayAction->isOn() ) viewDay(); |
755 | viewDay(); | 716 | else if ( weekAction->isOn() ) viewWeek(); |
756 | else if ( weekAction->isOn() ) | 717 | else if ( monthAction->isOn() ) viewMonth(); |
757 | viewWeek(); | ||
758 | else if ( monthAction->isOn() ) | ||
759 | viewMonth(); | ||
760 | syncing = FALSE; | 718 | syncing = FALSE; |
@@ -773,6 +731,6 @@ void DateBook::timerEvent( QTimerEvent *e ) | |||
773 | Sound::soundAlarm(); | 731 | Sound::soundAlarm(); |
774 | } | 732 | } else { |
775 | else | ||
776 | killTimer( e->timerId() ); | 733 | killTimer( e->timerId() ); |
777 | } | 734 | } |
735 | } | ||
778 | 736 | ||
@@ -797,3 +755,3 @@ void DateBook::slotToday() | |||
797 | // we need to view today using default view | 755 | // we need to view today using default view |
798 | viewDefault(QDate::currentDate()); | 756 | view(defaultView,QDate::currentDate()); |
799 | } | 757 | } |
@@ -811,5 +769,5 @@ void DateBook::closeEvent( QCloseEvent *e ) | |||
811 | saveSettings(); | 769 | saveSettings(); |
812 | if ( db->save() ) | 770 | if ( db->save() ) { |
813 | e->accept(); | 771 | e->accept(); |
814 | else { | 772 | } else { |
815 | if ( QMessageBox::critical( this, tr( "Out of space" ), | 773 | if ( QMessageBox::critical( this, tr( "Out of space" ), |