-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 163 | ||||
-rw-r--r-- | korganizer/komonthview.h | 4 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 16 |
7 files changed, 174 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index cca73f2..be78057 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3729,188 +3729,193 @@ void CalendarView::showIncidence() | |||
3729 | ShowIncidenceVisitor v; | 3729 | ShowIncidenceVisitor v; |
3730 | v.act( incidence, this ); | 3730 | v.act( incidence, this ); |
3731 | } | 3731 | } |
3732 | } | 3732 | } |
3733 | void CalendarView::editIncidenceDescription() | 3733 | void CalendarView::editIncidenceDescription() |
3734 | { | 3734 | { |
3735 | mFlagEditDescription = true; | 3735 | mFlagEditDescription = true; |
3736 | editIncidence(); | 3736 | editIncidence(); |
3737 | mFlagEditDescription = false; | 3737 | mFlagEditDescription = false; |
3738 | } | 3738 | } |
3739 | void CalendarView::editIncidence() | 3739 | void CalendarView::editIncidence() |
3740 | { | 3740 | { |
3741 | // qDebug("editIncidence() "); | 3741 | // qDebug("editIncidence() "); |
3742 | Incidence *incidence = currentSelection(); | 3742 | Incidence *incidence = currentSelection(); |
3743 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3743 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3744 | if ( incidence ) { | 3744 | if ( incidence ) { |
3745 | EditIncidenceVisitor v; | 3745 | EditIncidenceVisitor v; |
3746 | v.act( incidence, this ); | 3746 | v.act( incidence, this ); |
3747 | } | 3747 | } |
3748 | } | 3748 | } |
3749 | 3749 | ||
3750 | void CalendarView::deleteIncidence() | 3750 | void CalendarView::deleteIncidence() |
3751 | { | 3751 | { |
3752 | Incidence *incidence = currentSelection(); | 3752 | Incidence *incidence = currentSelection(); |
3753 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3753 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3754 | if ( incidence ) { | 3754 | if ( incidence ) { |
3755 | deleteIncidence(incidence); | 3755 | deleteIncidence(incidence); |
3756 | } | 3756 | } |
3757 | } | 3757 | } |
3758 | 3758 | ||
3759 | void CalendarView::showIncidence(Incidence *incidence) | 3759 | void CalendarView::showIncidence(Incidence *incidence) |
3760 | { | 3760 | { |
3761 | if ( incidence ) { | 3761 | if ( incidence ) { |
3762 | ShowIncidenceVisitor v; | 3762 | ShowIncidenceVisitor v; |
3763 | v.act( incidence, this ); | 3763 | v.act( incidence, this ); |
3764 | } | 3764 | } |
3765 | } | 3765 | } |
3766 | 3766 | ||
3767 | void CalendarView::editIncidence(Incidence *incidence) | 3767 | void CalendarView::editIncidence(Incidence *incidence) |
3768 | { | 3768 | { |
3769 | if ( incidence ) { | 3769 | if ( incidence ) { |
3770 | 3770 | ||
3771 | EditIncidenceVisitor v; | 3771 | EditIncidenceVisitor v; |
3772 | v.act( incidence, this ); | 3772 | v.act( incidence, this ); |
3773 | 3773 | ||
3774 | } | 3774 | } |
3775 | } | 3775 | } |
3776 | 3776 | ||
3777 | void CalendarView::deleteIncidence(Incidence *incidence) | 3777 | void CalendarView::deleteIncidence(Incidence *incidence) |
3778 | { | 3778 | { |
3779 | //qDebug(" CalendarView::deleteIncidence "); | 3779 | //qDebug(" CalendarView::deleteIncidence "); |
3780 | if ( incidence ) { | 3780 | if ( incidence ) { |
3781 | DeleteIncidenceVisitor v; | 3781 | DeleteIncidenceVisitor v; |
3782 | v.act( incidence, this ); | 3782 | v.act( incidence, this ); |
3783 | } | 3783 | } |
3784 | } | 3784 | } |
3785 | 3785 | ||
3786 | 3786 | ||
3787 | void CalendarView::lookForOutgoingMessages() | 3787 | void CalendarView::lookForOutgoingMessages() |
3788 | { | 3788 | { |
3789 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3789 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3790 | ogd->loadMessages(); | 3790 | ogd->loadMessages(); |
3791 | } | 3791 | } |
3792 | 3792 | ||
3793 | void CalendarView::lookForIncomingMessages() | 3793 | void CalendarView::lookForIncomingMessages() |
3794 | { | 3794 | { |
3795 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3795 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3796 | icd->retrieve(); | 3796 | icd->retrieve(); |
3797 | } | 3797 | } |
3798 | 3798 | ||
3799 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3799 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3800 | { | 3800 | { |
3801 | bool deleteTodo = true; | 3801 | bool deleteTodo = true; |
3802 | QPtrList<Incidence> subTodos; | 3802 | QPtrList<Incidence> subTodos; |
3803 | Incidence *aTodo; | 3803 | Incidence *aTodo; |
3804 | subTodos = t->relations(); | 3804 | subTodos = t->relations(); |
3805 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3805 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3806 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3806 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3807 | deleteTodo = false; | 3807 | deleteTodo = false; |
3808 | } | 3808 | } |
3809 | if ( deleteTodo ) { | 3809 | if ( deleteTodo ) { |
3810 | if ( t->isCompleted() ) { | 3810 | if ( t->isCompleted() ) { |
3811 | checkExternalId( t ); | 3811 | checkExternalId( t ); |
3812 | mCalendar->deleteTodo( t ); | 3812 | mCalendar->deleteTodo( t ); |
3813 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3813 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3814 | } | 3814 | } |
3815 | else | 3815 | else |
3816 | deleteTodo = false; | 3816 | deleteTodo = false; |
3817 | } | 3817 | } |
3818 | return deleteTodo; | 3818 | return deleteTodo; |
3819 | 3819 | ||
3820 | } | 3820 | } |
3821 | void CalendarView::purgeCompleted() | 3821 | void CalendarView::purgeCompleted() |
3822 | { | 3822 | { |
3823 | int result = KMessageBox::warningContinueCancel(this, | 3823 | int result = KMessageBox::warningContinueCancel(this, |
3824 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3824 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3825 | 3825 | ||
3826 | if (result == KMessageBox::Continue) { | 3826 | if (result == KMessageBox::Continue) { |
3827 | 3827 | ||
3828 | QPtrList<Todo> todoCal; | 3828 | QPtrList<Todo> todoCal; |
3829 | QPtrList<Todo> rootTodos; | 3829 | QPtrList<Todo> rootTodos; |
3830 | //QPtrList<Incidence> rel; | 3830 | //QPtrList<Incidence> rel; |
3831 | Todo *aTodo;//, *rTodo; | 3831 | Todo *aTodo;//, *rTodo; |
3832 | Incidence *rIncidence; | 3832 | Incidence *rIncidence; |
3833 | bool childDelete = false; | 3833 | bool childDelete = false; |
3834 | bool deletedOne = true; | 3834 | bool deletedOne = true; |
3835 | todoCal = calendar()->todos(); | 3835 | todoCal = calendar()->todos(); |
3836 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3836 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3837 | if ( !aTodo->relatedTo() ) | 3837 | if ( !aTodo->relatedTo() ) |
3838 | rootTodos.append( aTodo ); | 3838 | rootTodos.append( aTodo ); |
3839 | } | 3839 | } |
3840 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3840 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3841 | removeCompletedSubTodos( aTodo ); | 3841 | removeCompletedSubTodos( aTodo ); |
3842 | } | 3842 | } |
3843 | 3843 | ||
3844 | updateView(); | 3844 | updateView(); |
3845 | } | 3845 | } |
3846 | } | 3846 | } |
3847 | 3847 | ||
3848 | void CalendarView::slotCalendarChanged() | 3848 | void CalendarView::slotCalendarChanged() |
3849 | { | 3849 | { |
3850 | ; | 3850 | ; |
3851 | } | 3851 | } |
3852 | 3852 | ||
3853 | NavigatorBar *CalendarView::navigatorBar() | 3853 | NavigatorBar *CalendarView::navigatorBar() |
3854 | { | 3854 | { |
3855 | return mNavigatorBar; | 3855 | return mNavigatorBar; |
3856 | } | 3856 | } |
3857 | void CalendarView::showNavigatorBar( bool b) | ||
3858 | { | ||
3859 | if ( b ) mNavigatorBar->show(); | ||
3860 | else mNavigatorBar->hide(); | ||
3861 | } | ||
3857 | 3862 | ||
3858 | 3863 | ||
3859 | 3864 | ||
3860 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3865 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3861 | { | 3866 | { |
3862 | //qDebug(" alendarView::keyPressEvent "); | 3867 | //qDebug(" alendarView::keyPressEvent "); |
3863 | e->ignore(); | 3868 | e->ignore(); |
3864 | } | 3869 | } |
3865 | 3870 | ||
3866 | 3871 | ||
3867 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3872 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3868 | { | 3873 | { |
3869 | // mSyncManager = manager; | 3874 | // mSyncManager = manager; |
3870 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3875 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3871 | qDebug("KO: SyncKDE request detected!"); | 3876 | qDebug("KO: SyncKDE request detected!"); |
3872 | } | 3877 | } |
3873 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3878 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3874 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3879 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3875 | return syncCalendar( filename, mode ); | 3880 | return syncCalendar( filename, mode ); |
3876 | } | 3881 | } |
3877 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3882 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3878 | { | 3883 | { |
3879 | //mSyncManager = manager; | 3884 | //mSyncManager = manager; |
3880 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3885 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3881 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3886 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3882 | if ( resource == "sharp" ) | 3887 | if ( resource == "sharp" ) |
3883 | syncExternal( 0 ); | 3888 | syncExternal( 0 ); |
3884 | if ( resource == "phone" ) | 3889 | if ( resource == "phone" ) |
3885 | syncExternal( 1 ); | 3890 | syncExternal( 1 ); |
3886 | // pending setmodified | 3891 | // pending setmodified |
3887 | return true; | 3892 | return true; |
3888 | } | 3893 | } |
3889 | void CalendarView::setSyncManager(KSyncManager* manager) | 3894 | void CalendarView::setSyncManager(KSyncManager* manager) |
3890 | { | 3895 | { |
3891 | mSyncManager = manager; | 3896 | mSyncManager = manager; |
3892 | } | 3897 | } |
3893 | 3898 | ||
3894 | void CalendarView::removeSyncInfo( QString syncProfile) | 3899 | void CalendarView::removeSyncInfo( QString syncProfile) |
3895 | { | 3900 | { |
3896 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 3901 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
3897 | mCalendar->removeSyncInfo( syncProfile ); | 3902 | mCalendar->removeSyncInfo( syncProfile ); |
3898 | 3903 | ||
3899 | } | 3904 | } |
3900 | 3905 | ||
3901 | void CalendarView::undo_delete() | 3906 | void CalendarView::undo_delete() |
3902 | { | 3907 | { |
3903 | //qDebug("undo_delete() "); | 3908 | //qDebug("undo_delete() "); |
3904 | Incidence* undo = mCalendar->undoIncidence(); | 3909 | Incidence* undo = mCalendar->undoIncidence(); |
3905 | if ( !undo ) { | 3910 | if ( !undo ) { |
3906 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 3911 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
3907 | i18n("KO/Pi")); | 3912 | i18n("KO/Pi")); |
3908 | return; | 3913 | return; |
3909 | } | 3914 | } |
3910 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 3915 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
3911 | i18n("\nAre you sure you want\nto restore this?"), | 3916 | i18n("\nAre you sure you want\nto restore this?"), |
3912 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 3917 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
3913 | mCalendar->undoDeleteIncidence(); | 3918 | mCalendar->undoDeleteIncidence(); |
3914 | updateView(); | 3919 | updateView(); |
3915 | } | 3920 | } |
3916 | } | 3921 | } |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 7c59a8d..6ea8287 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -49,256 +49,257 @@ class QSplitter; | |||
49 | 49 | ||
50 | class CalPrinter; | 50 | class CalPrinter; |
51 | class KOFilterView; | 51 | class KOFilterView; |
52 | class KOViewManager; | 52 | class KOViewManager; |
53 | class KODialogManager; | 53 | class KODialogManager; |
54 | class KOTodoView; | 54 | class KOTodoView; |
55 | class KDateNavigator; | 55 | class KDateNavigator; |
56 | class DateNavigator; | 56 | class DateNavigator; |
57 | class KOIncidenceEditor; | 57 | class KOIncidenceEditor; |
58 | class KDatePicker; | 58 | class KDatePicker; |
59 | class ResourceView; | 59 | class ResourceView; |
60 | class NavigatorBar; | 60 | class NavigatorBar; |
61 | class KOEventEditor; | 61 | class KOEventEditor; |
62 | class KOTodoEditor ; | 62 | class KOTodoEditor ; |
63 | class KOEventViewerDialog; | 63 | class KOEventViewerDialog; |
64 | class KOBeamPrefs; | 64 | class KOBeamPrefs; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | class AlarmDialog; | 66 | class AlarmDialog; |
67 | class KCal::Attendee; | 67 | class KCal::Attendee; |
68 | 68 | ||
69 | namespace KCal { class FileStorage; } | 69 | namespace KCal { class FileStorage; } |
70 | 70 | ||
71 | using namespace KCal; | 71 | using namespace KCal; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | This is the main calendar widget. It provides the different vies on t he | 74 | This is the main calendar widget. It provides the different vies on t he |
75 | calendar data as well as the date navigator. It also handles synchronisation | 75 | calendar data as well as the date navigator. It also handles synchronisation |
76 | of the different views and controls the different dialogs like preferences, | 76 | of the different views and controls the different dialogs like preferences, |
77 | event editor, search dialog etc. | 77 | event editor, search dialog etc. |
78 | 78 | ||
79 | @short main calendar view widget | 79 | @short main calendar view widget |
80 | @author Cornelius Schumacher | 80 | @author Cornelius Schumacher |
81 | */ | 81 | */ |
82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | /** | 86 | /** |
87 | Constructs a new calendar view widget. | 87 | Constructs a new calendar view widget. |
88 | 88 | ||
89 | @param calendar calendar document | 89 | @param calendar calendar document |
90 | @param parent parent window | 90 | @param parent parent window |
91 | @param name Qt internal widget object name | 91 | @param name Qt internal widget object name |
92 | */ | 92 | */ |
93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 95 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
96 | const char *name = 0 ); | 96 | const char *name = 0 ); |
97 | virtual ~CalendarView(); | 97 | virtual ~CalendarView(); |
98 | 98 | ||
99 | Calendar *calendar() { return mCalendar; } | 99 | Calendar *calendar() { return mCalendar; } |
100 | 100 | ||
101 | KOViewManager *viewManager(); | 101 | KOViewManager *viewManager(); |
102 | KODialogManager *dialogManager(); | 102 | KODialogManager *dialogManager(); |
103 | 103 | ||
104 | QDate startDate(); | 104 | QDate startDate(); |
105 | QDate endDate(); | 105 | QDate endDate(); |
106 | 106 | ||
107 | QWidgetStack *viewStack(); | 107 | QWidgetStack *viewStack(); |
108 | QWidget *leftFrame(); | 108 | QWidget *leftFrame(); |
109 | NavigatorBar *navigatorBar(); | 109 | NavigatorBar *navigatorBar(); |
110 | 110 | ||
111 | DateNavigator *dateNavigator(); | 111 | DateNavigator *dateNavigator(); |
112 | KDateNavigator *dateNavigatorWidget(); | 112 | KDateNavigator *dateNavigatorWidget(); |
113 | 113 | ||
114 | void addView(KOrg::BaseView *); | 114 | void addView(KOrg::BaseView *); |
115 | void showView(KOrg::BaseView *); | 115 | void showView(KOrg::BaseView *); |
116 | KOEventViewerDialog* getEventViewerDialog(); | 116 | KOEventViewerDialog* getEventViewerDialog(); |
117 | Incidence *currentSelection(); | 117 | Incidence *currentSelection(); |
118 | 118 | ||
119 | signals: | 119 | signals: |
120 | void tempDisableBR(bool); | 120 | void tempDisableBR(bool); |
121 | /** This todo has been modified */ | 121 | /** This todo has been modified */ |
122 | void todoModified(Todo *, int); | 122 | void todoModified(Todo *, int); |
123 | 123 | ||
124 | /** when change is made to options dialog, the topwidget will catch this | 124 | /** when change is made to options dialog, the topwidget will catch this |
125 | * and emit this signal which notifies all widgets which have registered | 125 | * and emit this signal which notifies all widgets which have registered |
126 | * for notification to update their settings. */ | 126 | * for notification to update their settings. */ |
127 | void configChanged(); | 127 | void configChanged(); |
128 | /** emitted when the topwidget is closing down, so that any attached | 128 | /** emitted when the topwidget is closing down, so that any attached |
129 | child windows can also close. */ | 129 | child windows can also close. */ |
130 | void closingDown(); | 130 | void closingDown(); |
131 | /** emitted right before we die */ | 131 | /** emitted right before we die */ |
132 | void closed(QWidget *); | 132 | void closed(QWidget *); |
133 | 133 | ||
134 | /** Emitted when state of modified flag changes */ | 134 | /** Emitted when state of modified flag changes */ |
135 | void modifiedChanged(bool); | 135 | void modifiedChanged(bool); |
136 | void signalmodified(); | 136 | void signalmodified(); |
137 | 137 | ||
138 | /** Emitted when state of read-only flag changes */ | 138 | /** Emitted when state of read-only flag changes */ |
139 | void readOnlyChanged(bool); | 139 | void readOnlyChanged(bool); |
140 | 140 | ||
141 | /** Emitted when the unit of navigation changes */ | 141 | /** Emitted when the unit of navigation changes */ |
142 | void changeNavStringPrev(const QString &); | 142 | void changeNavStringPrev(const QString &); |
143 | void changeNavStringNext(const QString &); | 143 | void changeNavStringNext(const QString &); |
144 | 144 | ||
145 | /** Emitted when state of events selection has changed and user is organizer*/ | 145 | /** Emitted when state of events selection has changed and user is organizer*/ |
146 | void organizerEventsSelected(bool); | 146 | void organizerEventsSelected(bool); |
147 | /** Emitted when state of events selection has changed and user is attendee*/ | 147 | /** Emitted when state of events selection has changed and user is attendee*/ |
148 | void groupEventsSelected(bool); | 148 | void groupEventsSelected(bool); |
149 | /** | 149 | /** |
150 | Emitted when an incidence gets selected. If the selection is cleared the | 150 | Emitted when an incidence gets selected. If the selection is cleared the |
151 | signal is emitted with 0 as argument. | 151 | signal is emitted with 0 as argument. |
152 | */ | 152 | */ |
153 | void incidenceSelected( Incidence * ); | 153 | void incidenceSelected( Incidence * ); |
154 | /** Emitted, when a todoitem is selected or deselected. */ | 154 | /** Emitted, when a todoitem is selected or deselected. */ |
155 | void todoSelected( bool ); | 155 | void todoSelected( bool ); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | Emitted, when clipboard content changes. Parameter indicates if paste | 158 | Emitted, when clipboard content changes. Parameter indicates if paste |
159 | is possible or not. | 159 | is possible or not. |
160 | */ | 160 | */ |
161 | void pasteEnabled(bool); | 161 | void pasteEnabled(bool); |
162 | 162 | ||
163 | /** Emitted, when the number of incoming messages has changed. */ | 163 | /** Emitted, when the number of incoming messages has changed. */ |
164 | void numIncomingChanged(int); | 164 | void numIncomingChanged(int); |
165 | 165 | ||
166 | /** Emitted, when the number of outgoing messages has changed. */ | 166 | /** Emitted, when the number of outgoing messages has changed. */ |
167 | void numOutgoingChanged(int); | 167 | void numOutgoingChanged(int); |
168 | 168 | ||
169 | /** Send status message, which can e.g. be displayed in the status bar. */ | 169 | /** Send status message, which can e.g. be displayed in the status bar. */ |
170 | void statusMessage(const QString &); | 170 | void statusMessage(const QString &); |
171 | 171 | ||
172 | void calendarViewExpanded( bool ); | 172 | void calendarViewExpanded( bool ); |
173 | void updateSearchDialog(); | 173 | void updateSearchDialog(); |
174 | 174 | ||
175 | 175 | ||
176 | public slots: | 176 | public slots: |
177 | void showNavigatorBar(bool); | ||
177 | void showOpenError(); | 178 | void showOpenError(); |
178 | void watchSavedFile(); | 179 | void watchSavedFile(); |
179 | void recheckTimerAlarm(); | 180 | void recheckTimerAlarm(); |
180 | void checkNextTimerAlarm(); | 181 | void checkNextTimerAlarm(); |
181 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 182 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
182 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 183 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
183 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 184 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
184 | 185 | ||
185 | /** options dialog made a changed to the configuration. we catch this | 186 | /** options dialog made a changed to the configuration. we catch this |
186 | * and notify all widgets which need to update their configuration. */ | 187 | * and notify all widgets which need to update their configuration. */ |
187 | void updateConfig(); | 188 | void updateConfig(); |
188 | 189 | ||
189 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 190 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
190 | const QStringList& anniversaryList, const QStringList& realNameList, | 191 | const QStringList& anniversaryList, const QStringList& realNameList, |
191 | const QStringList& emailList, const QStringList& assembledNameList, | 192 | const QStringList& emailList, const QStringList& assembledNameList, |
192 | const QStringList& uidList); | 193 | const QStringList& uidList); |
193 | 194 | ||
194 | /** | 195 | /** |
195 | Load calendar from file \a filename. If \a merge is true, load | 196 | Load calendar from file \a filename. If \a merge is true, load |
196 | calendar into existing one, if it is false, clear calendar, before | 197 | calendar into existing one, if it is false, clear calendar, before |
197 | loading. Return true, if calendar could be successfully loaded. | 198 | loading. Return true, if calendar could be successfully loaded. |
198 | */ | 199 | */ |
199 | bool openCalendar(QString filename, bool merge=false); | 200 | bool openCalendar(QString filename, bool merge=false); |
200 | bool syncCalendar(QString filename,int mode = 0 ); | 201 | bool syncCalendar(QString filename,int mode = 0 ); |
201 | 202 | ||
202 | /** | 203 | /** |
203 | Save calendar data to file. Return true if calendar could be | 204 | Save calendar data to file. Return true if calendar could be |
204 | successfully saved. | 205 | successfully saved. |
205 | */ | 206 | */ |
206 | bool saveCalendar(QString filename); | 207 | bool saveCalendar(QString filename); |
207 | 208 | ||
208 | /** | 209 | /** |
209 | Close calendar. Clear calendar data and reset views to display an empty | 210 | Close calendar. Clear calendar data and reset views to display an empty |
210 | calendar. | 211 | calendar. |
211 | */ | 212 | */ |
212 | void closeCalendar(); | 213 | void closeCalendar(); |
213 | 214 | ||
214 | /** Archive old events of calendar */ | 215 | /** Archive old events of calendar */ |
215 | void archiveCalendar(); | 216 | void archiveCalendar(); |
216 | 217 | ||
217 | void showIncidence(); | 218 | void showIncidence(); |
218 | void editIncidence(); | 219 | void editIncidence(); |
219 | void editIncidenceDescription(); | 220 | void editIncidenceDescription(); |
220 | void deleteIncidence(); | 221 | void deleteIncidence(); |
221 | void cloneIncidence(); | 222 | void cloneIncidence(); |
222 | void moveIncidence(); | 223 | void moveIncidence(); |
223 | void beamIncidence(); | 224 | void beamIncidence(); |
224 | void toggleCancelIncidence(); | 225 | void toggleCancelIncidence(); |
225 | 226 | ||
226 | /** create an editeventwin with supplied date/time, and if bool is true, | 227 | /** create an editeventwin with supplied date/time, and if bool is true, |
227 | * make the event take all day. */ | 228 | * make the event take all day. */ |
228 | void newEvent(QDateTime, QDateTime, bool allDay ); | 229 | void newEvent(QDateTime, QDateTime, bool allDay ); |
229 | void newEvent(QDateTime, QDateTime); | 230 | void newEvent(QDateTime, QDateTime); |
230 | void newEvent(QDateTime fh); | 231 | void newEvent(QDateTime fh); |
231 | void newEvent(QDate dt); | 232 | void newEvent(QDate dt); |
232 | /** create new event without having a date hint. Takes current date as | 233 | /** create new event without having a date hint. Takes current date as |
233 | default hint. */ | 234 | default hint. */ |
234 | void newEvent(); | 235 | void newEvent(); |
235 | void newFloatingEvent(); | 236 | void newFloatingEvent(); |
236 | 237 | ||
237 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 238 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
238 | void showIncidence(Incidence *); | 239 | void showIncidence(Incidence *); |
239 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 240 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
240 | void editIncidence(Incidence *); | 241 | void editIncidence(Incidence *); |
241 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 242 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
242 | void deleteIncidence(Incidence *); | 243 | void deleteIncidence(Incidence *); |
243 | void cloneIncidence(Incidence *); | 244 | void cloneIncidence(Incidence *); |
244 | void cancelIncidence(Incidence *); | 245 | void cancelIncidence(Incidence *); |
245 | /** Create an editor for the supplied event. */ | 246 | /** Create an editor for the supplied event. */ |
246 | void editEvent(Event *); | 247 | void editEvent(Event *); |
247 | /** Delete the supplied event. */ | 248 | /** Delete the supplied event. */ |
248 | void deleteEvent(Event *); | 249 | void deleteEvent(Event *); |
249 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 250 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
250 | found. */ | 251 | found. */ |
251 | bool deleteEvent(const QString &uid); | 252 | bool deleteEvent(const QString &uid); |
252 | /** Create a read-only viewer dialog for the supplied event. */ | 253 | /** Create a read-only viewer dialog for the supplied event. */ |
253 | void showEvent(Event *); | 254 | void showEvent(Event *); |
254 | 255 | ||
255 | void editJournal(Journal *); | 256 | void editJournal(Journal *); |
256 | void showJournal(Journal *); | 257 | void showJournal(Journal *); |
257 | void deleteJournal(Journal *); | 258 | void deleteJournal(Journal *); |
258 | /** Create an editor dialog for a todo */ | 259 | /** Create an editor dialog for a todo */ |
259 | void editTodo(Todo *); | 260 | void editTodo(Todo *); |
260 | /** Create a read-only viewer dialog for the supplied todo */ | 261 | /** Create a read-only viewer dialog for the supplied todo */ |
261 | void showTodo(Todo *); | 262 | void showTodo(Todo *); |
262 | /** create new todo */ | 263 | /** create new todo */ |
263 | void newTodo(); | 264 | void newTodo(); |
264 | void newTodoDateTime(QDateTime, bool allday); | 265 | void newTodoDateTime(QDateTime, bool allday); |
265 | /** create new todo with a parent todo */ | 266 | /** create new todo with a parent todo */ |
266 | void newSubTodo(); | 267 | void newSubTodo(); |
267 | /** create new todo with a parent todo */ | 268 | /** create new todo with a parent todo */ |
268 | void newSubTodo(Todo *); | 269 | void newSubTodo(Todo *); |
269 | /** Delete todo */ | 270 | /** Delete todo */ |
270 | void deleteTodo(Todo *); | 271 | void deleteTodo(Todo *); |
271 | 272 | ||
272 | 273 | ||
273 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 274 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
274 | * emitted as result. */ | 275 | * emitted as result. */ |
275 | void checkClipboard(); | 276 | void checkClipboard(); |
276 | 277 | ||
277 | /** using the KConfig associated with the kapp variable, read in the | 278 | /** using the KConfig associated with the kapp variable, read in the |
278 | * settings from the config file. | 279 | * settings from the config file. |
279 | */ | 280 | */ |
280 | void readSettings(); | 281 | void readSettings(); |
281 | 282 | ||
282 | /** write current state to config file. */ | 283 | /** write current state to config file. */ |
283 | void writeSettings(); | 284 | void writeSettings(); |
284 | 285 | ||
285 | /** read settings for calendar filters */ | 286 | /** read settings for calendar filters */ |
286 | void readFilterSettings(KConfig *config); | 287 | void readFilterSettings(KConfig *config); |
287 | 288 | ||
288 | /** write settings for calendar filters */ | 289 | /** write settings for calendar filters */ |
289 | void writeFilterSettings(KConfig *config); | 290 | void writeFilterSettings(KConfig *config); |
290 | 291 | ||
291 | /** passes on the message that an event has changed to the currently | 292 | /** passes on the message that an event has changed to the currently |
292 | * activated view so that it can make appropriate display changes. */ | 293 | * activated view so that it can make appropriate display changes. */ |
293 | void changeEventDisplay(Event *, int); | 294 | void changeEventDisplay(Event *, int); |
294 | void changeIncidenceDisplay(Incidence *, int); | 295 | void changeIncidenceDisplay(Incidence *, int); |
295 | void changeTodoDisplay(Todo *, int); | 296 | void changeTodoDisplay(Todo *, int); |
296 | 297 | ||
297 | void eventAdded(Event *); | 298 | void eventAdded(Event *); |
298 | void eventChanged(Event *); | 299 | void eventChanged(Event *); |
299 | void eventToBeDeleted(Event *); | 300 | void eventToBeDeleted(Event *); |
300 | void eventDeleted(); | 301 | void eventDeleted(); |
301 | 302 | ||
302 | void todoAdded(Todo *); | 303 | void todoAdded(Todo *); |
303 | void todoChanged(Todo *); | 304 | void todoChanged(Todo *); |
304 | void todoToBeDeleted(Todo *); | 305 | void todoToBeDeleted(Todo *); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 6411156..9888566 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -340,930 +340,1069 @@ void MonthViewCell::setMyPalette() | |||
340 | 340 | ||
341 | if ( mHoliday) { | 341 | if ( mHoliday) { |
342 | setPalette( mHolidayPalette ); | 342 | setPalette( mHolidayPalette ); |
343 | } else { | 343 | } else { |
344 | if ( mPrimary ) { | 344 | if ( mPrimary ) { |
345 | setPalette( mPrimaryPalette ); | 345 | setPalette( mPrimaryPalette ); |
346 | } else { | 346 | } else { |
347 | setPalette( mNonPrimaryPalette ); | 347 | setPalette( mNonPrimaryPalette ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | QPalette pal = palette(); | 350 | QPalette pal = palette(); |
351 | 351 | ||
352 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 352 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
353 | } | 353 | } |
354 | QPalette MonthViewCell::getPalette () | 354 | QPalette MonthViewCell::getPalette () |
355 | { | 355 | { |
356 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 356 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
357 | return mStandardPalette; | 357 | return mStandardPalette; |
358 | if ( mHoliday) { | 358 | if ( mHoliday) { |
359 | return mHolidayPalette ; | 359 | return mHolidayPalette ; |
360 | } else { | 360 | } else { |
361 | if ( mPrimary ) { | 361 | if ( mPrimary ) { |
362 | return mPrimaryPalette ; | 362 | return mPrimaryPalette ; |
363 | } | 363 | } |
364 | } | 364 | } |
365 | return mNonPrimaryPalette; | 365 | return mNonPrimaryPalette; |
366 | } | 366 | } |
367 | bool MonthViewCell::isPrimary() const | 367 | bool MonthViewCell::isPrimary() const |
368 | { | 368 | { |
369 | return mPrimary; | 369 | return mPrimary; |
370 | } | 370 | } |
371 | 371 | ||
372 | void MonthViewCell::setHoliday( bool holiday ) | 372 | void MonthViewCell::setHoliday( bool holiday ) |
373 | { | 373 | { |
374 | mHoliday = holiday; | 374 | mHoliday = holiday; |
375 | //setMyPalette(); | 375 | //setMyPalette(); |
376 | } | 376 | } |
377 | 377 | ||
378 | void MonthViewCell::setHoliday( const QString &holiday ) | 378 | void MonthViewCell::setHoliday( const QString &holiday ) |
379 | { | 379 | { |
380 | mHolidayString = holiday; | 380 | mHolidayString = holiday; |
381 | 381 | ||
382 | if ( !holiday.isEmpty() ) { | 382 | if ( !holiday.isEmpty() ) { |
383 | setHoliday( true ); | 383 | setHoliday( true ); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 386 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
387 | { | 387 | { |
388 | 388 | ||
389 | e->ignore(); | 389 | e->ignore(); |
390 | 390 | ||
391 | } | 391 | } |
392 | void MonthViewCell::clear() | 392 | void MonthViewCell::clear() |
393 | { | 393 | { |
394 | mItemList->clear(); | 394 | mItemList->clear(); |
395 | QApplication::removePostedEvents ( mItemList ); | 395 | QApplication::removePostedEvents ( mItemList ); |
396 | QApplication::removePostedEvents ( mLabel ); | 396 | QApplication::removePostedEvents ( mLabel ); |
397 | QApplication::removePostedEvents ( this ); | 397 | QApplication::removePostedEvents ( this ); |
398 | } | 398 | } |
399 | 399 | ||
400 | void MonthViewCell::startUpdateCell() | 400 | void MonthViewCell::startUpdateCell() |
401 | { | 401 | { |
402 | 402 | ||
403 | if ( !mMonthView->isUpdatePossible() ) | 403 | if ( !mMonthView->isUpdatePossible() ) |
404 | return; | 404 | return; |
405 | /* | 405 | /* |
406 | if ( !isVisible() ){ | 406 | if ( !isVisible() ){ |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | */ | 409 | */ |
410 | // qDebug("MonthViewCell::updateCell() "); | 410 | // qDebug("MonthViewCell::updateCell() "); |
411 | setPrimary( mDate.month()%2 ); | 411 | setPrimary( mDate.month()%2 ); |
412 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 412 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
413 | if ( mDate == QDate::currentDate() ) { | 413 | if ( mDate == QDate::currentDate() ) { |
414 | mItemList->setLineWidth( 3 ); | 414 | mItemList->setLineWidth( 3 ); |
415 | } else { | 415 | } else { |
416 | mItemList->setLineWidth( 1 ); | 416 | mItemList->setLineWidth( 1 ); |
417 | } | 417 | } |
418 | mItemList->clear(); | 418 | mItemList->clear(); |
419 | 419 | ||
420 | #ifdef DESKTOP_VERSION | 420 | #ifdef DESKTOP_VERSION |
421 | QToolTip::remove(this); | 421 | QToolTip::remove(this); |
422 | #endif | 422 | #endif |
423 | mToolTip = ""; | 423 | mToolTip = ""; |
424 | //qApp->processEvents(); | 424 | //qApp->processEvents(); |
425 | if ( !mHolidayString.isEmpty() ) { | 425 | if ( !mHolidayString.isEmpty() ) { |
426 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 426 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
427 | item->setPalette( mHolidayPalette ); | 427 | item->setPalette( mHolidayPalette ); |
428 | mItemList->insertItem( item ); | 428 | mItemList->insertItem( item ); |
429 | mToolTip += mHolidayString+"\n"; | 429 | mToolTip += mHolidayString+"\n"; |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | void MonthViewCell::insertEvent(Event *event) | 433 | void MonthViewCell::insertEvent(Event *event) |
434 | { | 434 | { |
435 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 435 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
436 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 436 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
437 | return; | 437 | return; |
438 | else | 438 | else |
439 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 439 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | if ( event->categories().contains("Holiday") || | 443 | if ( event->categories().contains("Holiday") || |
444 | event->categories().contains(i18n("Holiday"))) { | 444 | event->categories().contains(i18n("Holiday"))) { |
445 | setHoliday( true ); | 445 | setHoliday( true ); |
446 | if ( mDate.dayOfWeek() == 7 ) | 446 | if ( mDate.dayOfWeek() == 7 ) |
447 | mItemList->setLineWidth( 3 ); | 447 | mItemList->setLineWidth( 3 ); |
448 | } | 448 | } |
449 | QString text; | 449 | QString text; |
450 | if (event->isMultiDay()) { | 450 | if (event->isMultiDay()) { |
451 | QString prefix = "<->"; | 451 | QString prefix = "<->"; |
452 | if ( event->doesRecur() ) { | 452 | if ( event->doesRecur() ) { |
453 | if ( event->recursOn( mDate) ) | 453 | if ( event->recursOn( mDate) ) |
454 | prefix ="->" ; | 454 | prefix ="->" ; |
455 | else { | 455 | else { |
456 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 456 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
457 | if ( event->recursOn( mDate.addDays( -days)) ) | 457 | if ( event->recursOn( mDate.addDays( -days)) ) |
458 | prefix ="<-" ; | 458 | prefix ="<-" ; |
459 | } | 459 | } |
460 | 460 | ||
461 | } else { | 461 | } else { |
462 | if (mDate == event->dtStart().date()) { | 462 | if (mDate == event->dtStart().date()) { |
463 | prefix ="->" ; | 463 | prefix ="->" ; |
464 | } else if (mDate == event->dtEnd().date()) { | 464 | } else if (mDate == event->dtEnd().date()) { |
465 | prefix ="<-" ; | 465 | prefix ="<-" ; |
466 | } | 466 | } |
467 | } | 467 | } |
468 | if ( !event->doesFloat() ) { | ||
469 | if ( mDate == event->dtStart().date () ) | ||
470 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | ||
471 | else if ( mDate == event->dtEnd().date () ) | ||
472 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | ||
473 | |||
474 | } | ||
468 | text = prefix + event->summary(); | 475 | text = prefix + event->summary(); |
469 | mToolTip += text; | 476 | mToolTip += text; |
470 | } else { | 477 | } else { |
471 | if (event->doesFloat()) { | 478 | if (event->doesFloat()) { |
472 | text = event->summary(); | 479 | text = event->summary(); |
473 | mToolTip += text; | 480 | mToolTip += text; |
474 | } | 481 | } |
475 | else { | 482 | else { |
476 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 483 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
477 | text += " " + event->summary(); | 484 | text += " " + event->summary(); |
478 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 485 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
479 | } | 486 | } |
480 | } | 487 | } |
481 | 488 | ||
482 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 489 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
483 | QPalette pal; | 490 | QPalette pal; |
484 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 491 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
485 | QStringList categories = event->categories(); | 492 | QStringList categories = event->categories(); |
486 | QString cat = categories.first(); | 493 | QString cat = categories.first(); |
487 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 494 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
488 | pal = getPalette(); | 495 | pal = getPalette(); |
489 | if (cat.isEmpty()) { | 496 | if (cat.isEmpty()) { |
490 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 497 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
491 | } else { | 498 | } else { |
492 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 499 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
493 | } | 500 | } |
494 | 501 | ||
495 | } else { | 502 | } else { |
496 | if (cat.isEmpty()) { | 503 | if (cat.isEmpty()) { |
497 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 504 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
498 | } else { | 505 | } else { |
499 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 506 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
500 | } | 507 | } |
501 | } | 508 | } |
502 | 509 | ||
503 | } else { | 510 | } else { |
504 | pal = mStandardPalette ; | 511 | pal = mStandardPalette ; |
505 | } | 512 | } |
506 | item->setPalette( pal ); | 513 | item->setPalette( pal ); |
507 | item->setRecur( event->recurrence()->doesRecur() ); | 514 | item->setRecur( event->recurrence()->doesRecur() ); |
508 | item->setAlarm( event->isAlarmEnabled() ); | 515 | item->setAlarm( event->isAlarmEnabled() ); |
509 | item->setMoreInfo( event->description().length() > 0 ); | 516 | item->setMoreInfo( event->description().length() > 0 ); |
510 | #ifdef DESKTOP_VERSION | 517 | #ifdef DESKTOP_VERSION |
511 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 518 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
512 | KOPrefs::instance()->email()); | 519 | KOPrefs::instance()->email()); |
513 | if ( me != 0 ) { | 520 | if ( me != 0 ) { |
514 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 521 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
515 | item->setReply(true); | 522 | item->setReply(true); |
516 | else | 523 | else |
517 | item->setReply(false); | 524 | item->setReply(false); |
518 | } else | 525 | } else |
519 | item->setReply(false); | 526 | item->setReply(false); |
520 | #endif | 527 | #endif |
521 | mItemList->insertItem( item ); | 528 | mItemList->insertItem( item ); |
522 | mToolTip += "\n"; | 529 | mToolTip += "\n"; |
523 | } | 530 | } |
524 | void MonthViewCell::insertTodo(Todo *todo) | 531 | void MonthViewCell::insertTodo(Todo *todo) |
525 | { | 532 | { |
526 | QString text; | 533 | QString text; |
527 | if (todo->hasDueDate()) { | 534 | if (todo->hasDueDate()) { |
528 | if (!todo->doesFloat()) { | 535 | if (!todo->doesFloat()) { |
529 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 536 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
530 | text += " "; | 537 | text += " "; |
531 | } | 538 | } |
532 | } | 539 | } |
533 | text += i18n("To-Do: %1").arg(todo->summary()); | 540 | text += i18n("To-Do: %1").arg(todo->summary()); |
534 | 541 | ||
535 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 542 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
536 | //item->setPalette( mStandardPalette ); | 543 | //item->setPalette( mStandardPalette ); |
537 | QPalette pal; | 544 | QPalette pal; |
538 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 545 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
539 | QStringList categories = todo->categories(); | 546 | QStringList categories = todo->categories(); |
540 | QString cat = categories.first(); | 547 | QString cat = categories.first(); |
541 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 548 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
542 | pal = getPalette(); | 549 | pal = getPalette(); |
543 | if (cat.isEmpty()) { | 550 | if (cat.isEmpty()) { |
544 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 551 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
545 | } else { | 552 | } else { |
546 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 553 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
547 | } | 554 | } |
548 | 555 | ||
549 | } else { | 556 | } else { |
550 | if (cat.isEmpty()) { | 557 | if (cat.isEmpty()) { |
551 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 558 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
552 | } else { | 559 | } else { |
553 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 560 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
554 | } | 561 | } |
555 | } | 562 | } |
556 | 563 | ||
557 | } else { | 564 | } else { |
558 | pal = mStandardPalette ; | 565 | pal = mStandardPalette ; |
559 | } | 566 | } |
560 | item->setPalette( pal ); | 567 | item->setPalette( pal ); |
561 | mItemList->insertItem( item ); | 568 | mItemList->insertItem( item ); |
562 | mToolTip += text+"\n"; | 569 | mToolTip += text+"\n"; |
563 | } | 570 | } |
564 | void MonthViewCell::finishUpdateCell() | 571 | void MonthViewCell::finishUpdateCell() |
565 | { | 572 | { |
566 | #ifdef DESKTOP_VERSION | 573 | #ifdef DESKTOP_VERSION |
567 | if (mToolTip != "") | 574 | if (mToolTip != "") |
568 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 575 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
569 | #endif | 576 | #endif |
570 | 577 | mItemList->sort(); | |
571 | //setMyPalette(); | 578 | //setMyPalette(); |
572 | setMyPalette(); | 579 | setMyPalette(); |
573 | QString text; | 580 | QString text; |
574 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 581 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
575 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 582 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
576 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 583 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
577 | mLabel->resize( mLabelBigSize ); | 584 | mLabel->resize( mLabelBigSize ); |
578 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 585 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
579 | } else { | 586 | } else { |
580 | mLabel->resize( mLabelSize ); | 587 | mLabel->resize( mLabelSize ); |
581 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 588 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
582 | } | 589 | } |
583 | 590 | ||
584 | mLabel->setText( text ); | 591 | mLabel->setText( text ); |
585 | resizeEvent( 0 ); | 592 | resizeEvent( 0 ); |
586 | } | 593 | } |
587 | void MonthViewCell::updateCell() | 594 | void MonthViewCell::updateCell() |
588 | { | 595 | { |
589 | if ( !mMonthView->isUpdatePossible() ) | 596 | if ( !mMonthView->isUpdatePossible() ) |
590 | return; | 597 | return; |
591 | startUpdateCell(); | 598 | startUpdateCell(); |
592 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 599 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
593 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 600 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
594 | Event *event; | 601 | Event *event; |
595 | for( event = events.first(); event; event = events.next() ) { // for event | 602 | for( event = events.first(); event; event = events.next() ) { // for event |
596 | insertEvent(event); | 603 | insertEvent(event); |
597 | } | 604 | } |
598 | // insert due todos | 605 | // insert due todos |
599 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 606 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
600 | Todo *todo; | 607 | Todo *todo; |
601 | for(todo = todos.first(); todo; todo = todos.next()) { | 608 | for(todo = todos.first(); todo; todo = todos.next()) { |
602 | insertTodo( todo ); | 609 | insertTodo( todo ); |
603 | } | 610 | } |
604 | finishUpdateCell(); | 611 | finishUpdateCell(); |
605 | // if ( isVisible()) | 612 | // if ( isVisible()) |
606 | //qApp->processEvents(); | 613 | //qApp->processEvents(); |
607 | } | 614 | } |
608 | 615 | ||
609 | void MonthViewCell::updateConfig() | 616 | void MonthViewCell::updateConfig() |
610 | { | 617 | { |
611 | setFont( KOPrefs::instance()->mMonthViewFont ); | 618 | setFont( KOPrefs::instance()->mMonthViewFont ); |
612 | 619 | ||
613 | QFontMetrics fm( font() ); | 620 | QFontMetrics fm( font() ); |
614 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 621 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
615 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 622 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
616 | mHolidayPalette = mStandardPalette; | 623 | mHolidayPalette = mStandardPalette; |
617 | mPrimaryPalette = mStandardPalette; | 624 | mPrimaryPalette = mStandardPalette; |
618 | mNonPrimaryPalette = mStandardPalette; | 625 | mNonPrimaryPalette = mStandardPalette; |
619 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 626 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
620 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 627 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
621 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 628 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
622 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 629 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
623 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 630 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
624 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 631 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
625 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 632 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
626 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 633 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
627 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 634 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
628 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 635 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
629 | } | 636 | } |
630 | //updateCell(); | 637 | //updateCell(); |
631 | } | 638 | } |
632 | 639 | ||
633 | void MonthViewCell::enableScrollBars( bool enabled ) | 640 | void MonthViewCell::enableScrollBars( bool enabled ) |
634 | { | 641 | { |
635 | if ( enabled ) { | 642 | if ( enabled ) { |
636 | mItemList->setVScrollBarMode(QScrollView::Auto); | 643 | mItemList->setVScrollBarMode(QScrollView::Auto); |
637 | mItemList->setHScrollBarMode(QScrollView::Auto); | 644 | mItemList->setHScrollBarMode(QScrollView::Auto); |
638 | } else { | 645 | } else { |
639 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 646 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
640 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 647 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
641 | } | 648 | } |
642 | } | 649 | } |
643 | 650 | ||
644 | Incidence *MonthViewCell::selectedIncidence() | 651 | Incidence *MonthViewCell::selectedIncidence() |
645 | { | 652 | { |
646 | int index = mItemList->currentItem(); | 653 | int index = mItemList->currentItem(); |
647 | if ( index < 0 ) return 0; | 654 | if ( index < 0 ) return 0; |
648 | 655 | ||
649 | MonthViewItem *item = | 656 | MonthViewItem *item = |
650 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 657 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
651 | 658 | ||
652 | if ( !item ) return 0; | 659 | if ( !item ) return 0; |
653 | 660 | ||
654 | return item->incidence(); | 661 | return item->incidence(); |
655 | } | 662 | } |
656 | 663 | ||
657 | QDate MonthViewCell::selectedIncidenceDate() | 664 | QDate MonthViewCell::selectedIncidenceDate() |
658 | { | 665 | { |
659 | QDate qd; | 666 | QDate qd; |
660 | int index = mItemList->currentItem(); | 667 | int index = mItemList->currentItem(); |
661 | if ( index < 0 ) return qd; | 668 | if ( index < 0 ) return qd; |
662 | 669 | ||
663 | MonthViewItem *item = | 670 | MonthViewItem *item = |
664 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 671 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
665 | 672 | ||
666 | if ( !item ) return qd; | 673 | if ( !item ) return qd; |
667 | 674 | ||
668 | return item->incidenceDate(); | 675 | return item->incidenceDate(); |
669 | } | 676 | } |
670 | 677 | ||
671 | void MonthViewCell::deselect() | 678 | void MonthViewCell::deselect() |
672 | { | 679 | { |
673 | mItemList->clearSelection(); | 680 | mItemList->clearSelection(); |
674 | enableScrollBars( false ); | 681 | enableScrollBars( false ); |
675 | // updateCell(); | 682 | // updateCell(); |
676 | } | 683 | } |
677 | void MonthViewCell::select() | 684 | void MonthViewCell::select() |
678 | { | 685 | { |
679 | ;// updateCell(); | 686 | ;// updateCell(); |
680 | } | 687 | } |
681 | 688 | ||
682 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 689 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
683 | { | 690 | { |
684 | if ( !mMonthView->isUpdatePossible() ) | 691 | if ( !mMonthView->isUpdatePossible() ) |
685 | return; | 692 | return; |
686 | #ifndef DESKTOP_VERSION | 693 | #ifndef DESKTOP_VERSION |
687 | if ( !isVisible() ){ | 694 | if ( !isVisible() ){ |
688 | return; | 695 | return; |
689 | } | 696 | } |
690 | #endif | 697 | #endif |
691 | int size = height() - mLabel->height(); | 698 | int size = height() - mLabel->height() - 2; |
692 | if ( size > 0 ) | 699 | if ( size > 0 ) |
693 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 700 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
694 | size = width() - mLabel->width(); | 701 | size = width() - mLabel->width() -2; |
695 | if ( size > 0 ) | 702 | if ( size > 0 ) |
696 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 703 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
697 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 704 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
698 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 705 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
699 | } | 706 | } |
700 | 707 | ||
701 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 708 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
702 | { | 709 | { |
703 | if ( !item ) return; | 710 | if ( !item ) return; |
704 | 711 | ||
705 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 712 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
706 | Incidence *incidence = eventItem->incidence(); | 713 | Incidence *incidence = eventItem->incidence(); |
707 | if ( incidence ) mMonthView->defaultAction( incidence ); | 714 | if ( incidence ) mMonthView->defaultAction( incidence ); |
708 | } | 715 | } |
709 | void MonthViewCell::showDay() | 716 | void MonthViewCell::showDay() |
710 | { | 717 | { |
711 | emit showDaySignal( date() ); | 718 | emit showDaySignal( date() ); |
712 | } | 719 | } |
713 | void MonthViewCell::newEvent() | 720 | void MonthViewCell::newEvent() |
714 | { | 721 | { |
715 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 722 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
716 | emit newEventSignal( dt ); | 723 | emit newEventSignal( dt ); |
717 | } | 724 | } |
718 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 725 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
719 | { | 726 | { |
720 | static QListBoxItem * lastClicked = 0; | 727 | static QListBoxItem * lastClicked = 0; |
721 | if ( item == 0 ) { | 728 | if ( item == 0 ) { |
722 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 729 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
723 | emit newEventSignal( dt ); | 730 | emit newEventSignal( dt ); |
724 | return; | 731 | return; |
725 | } | 732 | } |
726 | /* | 733 | /* |
727 | if ( lastClicked ) | 734 | if ( lastClicked ) |
728 | if ( ! item ) { | 735 | if ( ! item ) { |
729 | if ( lastClicked->listBox() != item->listBox() ) | 736 | if ( lastClicked->listBox() != item->listBox() ) |
730 | lastClicked->listBox()->clearSelection(); | 737 | lastClicked->listBox()->clearSelection(); |
731 | } | 738 | } |
732 | */ | 739 | */ |
733 | 740 | ||
734 | mMonthView->setSelectedCell( this ); | 741 | mMonthView->setSelectedCell( this ); |
735 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); | 742 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
736 | select(); | 743 | select(); |
737 | } | 744 | } |
738 | 745 | ||
739 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 746 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
740 | { | 747 | { |
741 | if ( !item ) return; | 748 | if ( !item ) return; |
742 | 749 | ||
743 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 750 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
744 | Incidence *incidence = eventItem->incidence(); | 751 | Incidence *incidence = eventItem->incidence(); |
745 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 752 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
746 | } | 753 | } |
747 | 754 | ||
748 | void MonthViewCell::selection( QListBoxItem *item ) | 755 | void MonthViewCell::selection( QListBoxItem *item ) |
749 | { | 756 | { |
750 | if ( !item ) return; | 757 | if ( !item ) return; |
751 | 758 | ||
752 | mMonthView->setSelectedCell( this ); | 759 | mMonthView->setSelectedCell( this ); |
753 | } | 760 | } |
754 | 761 | ||
755 | 762 | ||
756 | // ******************************************************************************* | 763 | // ******************************************************************************* |
757 | // ******************************************************************************* | 764 | // ******************************************************************************* |
758 | // ******************************************************************************* | 765 | // ******************************************************************************* |
759 | 766 | ||
760 | 767 | ||
761 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 768 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
762 | : KOEventView( calendar, parent, name ), | 769 | : KOEventView( calendar, parent, name ), |
763 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 770 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
764 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 771 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
765 | { | 772 | { |
766 | 773 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | |
774 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | ||
775 | if ( mShowWeekView ) | ||
776 | mWeekStartsMonday = true; | ||
767 | updatePossible = false; | 777 | updatePossible = false; |
768 | mCells.setAutoDelete( true ); | 778 | mCells.setAutoDelete( true ); |
769 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 779 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
770 | // mDayLayout = new QGridLayout( this ); | 780 | // mDayLayout = new QGridLayout( this ); |
771 | // create the day of the week labels (Sun, Mon, etc) and add them to | 781 | // create the day of the week labels (Sun, Mon, etc) and add them to |
772 | // the layout. | 782 | // the layout. |
773 | mDayLabels.resize( mDaysPerWeek ); | 783 | mDayLabels.resize( mDaysPerWeek ); |
774 | QFont bfont = font(); | 784 | QFont bfont = font(); |
775 | if ( QApplication::desktop()->width() < 650 ) { | 785 | if ( QApplication::desktop()->width() < 650 ) { |
776 | bfont.setPointSize( bfont.pointSize() - 2 ); | 786 | bfont.setPointSize( bfont.pointSize() - 2 ); |
777 | } | 787 | } |
778 | bfont.setBold( true ); | 788 | bfont.setBold( true ); |
779 | int i; | 789 | int i; |
780 | 790 | ||
781 | for( i = 0; i < mDaysPerWeek; i++ ) { | 791 | for( i = 0; i < mDaysPerWeek; i++ ) { |
782 | QLabel *label = new QLabel( this ); | 792 | QLabel *label = new QLabel( this ); |
783 | label->setFont(bfont); | 793 | label->setFont(bfont); |
784 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 794 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
785 | label->setLineWidth(1); | 795 | label->setLineWidth(1); |
786 | label->setAlignment(AlignCenter); | 796 | label->setAlignment(AlignCenter); |
787 | mDayLabels.insert( i, label ); | 797 | mDayLabels.insert( i, label ); |
788 | } | 798 | } |
789 | 799 | ||
790 | bfont.setBold( false ); | 800 | bfont.setBold( false ); |
791 | mWeekLabels.resize( mNumWeeks+1 ); | 801 | mWeekLabels.resize( mNumWeeks+1 ); |
792 | for( i = 0; i < mNumWeeks+1; i++ ) { | 802 | for( i = 0; i < mNumWeeks+1; i++ ) { |
793 | KOWeekButton *label = new KOWeekButton( this ); | 803 | KOWeekButton *label = new KOWeekButton( this ); |
794 | label->setFont(bfont); | 804 | label->setFont(bfont); |
795 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 805 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
796 | label->setFlat(true); | 806 | label->setFlat(true); |
797 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 807 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
798 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 808 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
799 | //label->setLineWidth(1); | 809 | //label->setLineWidth(1); |
800 | //label->setAlignment(AlignCenter); | 810 | //label->setAlignment(AlignCenter); |
801 | mWeekLabels.insert( i, label ); | 811 | mWeekLabels.insert( i, label ); |
802 | } | 812 | } |
803 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 813 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
804 | int row, col; | 814 | int row, col; |
805 | mCells.resize( mNumCells ); | 815 | mCells.resize( mNumCells ); |
806 | for( row = 0; row < mNumWeeks; ++row ) { | 816 | for( row = 0; row < mNumWeeks; ++row ) { |
807 | for( col = 0; col < mDaysPerWeek; ++col ) { | 817 | for( col = 0; col < mDaysPerWeek; ++col ) { |
808 | MonthViewCell *cell = new MonthViewCell( this ); | 818 | MonthViewCell *cell = new MonthViewCell( this ); |
809 | mCells.insert( row * mDaysPerWeek + col, cell ); | 819 | mCells.insert( row * mDaysPerWeek + col, cell ); |
810 | 820 | ||
811 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 821 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
812 | SLOT( defaultAction( Incidence * ) ) ); | 822 | SLOT( defaultAction( Incidence * ) ) ); |
813 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 823 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
814 | SIGNAL( newEventSignal( QDateTime ) ) ); | 824 | SIGNAL( newEventSignal( QDateTime ) ) ); |
815 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 825 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
816 | SIGNAL( showDaySignal( QDate ) ) ); | 826 | SIGNAL( showDaySignal( QDate ) ) ); |
817 | } | 827 | } |
818 | } | 828 | } |
819 | 829 | ||
830 | connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), | ||
831 | SLOT( switchView() ) ); | ||
820 | mContextMenu = eventPopup(); | 832 | mContextMenu = eventPopup(); |
821 | // updateConfig(); //useless here | 833 | // updateConfig(); //useless here |
822 | 834 | ||
823 | emit incidenceSelected( 0 ); | 835 | emit incidenceSelected( 0 ); |
824 | } | 836 | } |
825 | 837 | ||
826 | KOMonthView::~KOMonthView() | 838 | KOMonthView::~KOMonthView() |
827 | { | 839 | { |
828 | delete mContextMenu; | 840 | delete mContextMenu; |
829 | } | 841 | } |
842 | void KOMonthView::switchView() | ||
843 | { | ||
844 | mShowWeekView = !mShowWeekView; | ||
845 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | ||
846 | emit showNavigator( !mShowWeekView ); | ||
847 | computeLayout(); | ||
848 | updateConfig(); | ||
849 | } | ||
830 | 850 | ||
831 | int KOMonthView::maxDatesHint() | 851 | int KOMonthView::maxDatesHint() |
832 | { | 852 | { |
833 | return mNumCells; | 853 | return mNumCells; |
834 | } | 854 | } |
835 | 855 | ||
836 | int KOMonthView::currentDateCount() | 856 | int KOMonthView::currentDateCount() |
837 | { | 857 | { |
838 | return mNumCells; | 858 | return mNumCells; |
839 | } | 859 | } |
840 | 860 | ||
841 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 861 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
842 | { | 862 | { |
843 | QPtrList<Incidence> selected; | 863 | QPtrList<Incidence> selected; |
844 | 864 | ||
845 | if ( mSelectedCell ) { | 865 | if ( mSelectedCell ) { |
846 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 866 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
847 | if ( incidence ) selected.append( incidence ); | 867 | if ( incidence ) selected.append( incidence ); |
848 | } | 868 | } |
849 | 869 | ||
850 | return selected; | 870 | return selected; |
851 | } | 871 | } |
852 | 872 | ||
853 | DateList KOMonthView::selectedDates() | 873 | DateList KOMonthView::selectedDates() |
854 | { | 874 | { |
855 | DateList selected; | 875 | DateList selected; |
856 | 876 | ||
857 | if ( mSelectedCell ) { | 877 | if ( mSelectedCell ) { |
858 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 878 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
859 | if ( qd.isValid() ) selected.append( qd ); | 879 | if ( qd.isValid() ) selected.append( qd ); |
860 | } | 880 | } |
861 | 881 | ||
862 | return selected; | 882 | return selected; |
863 | } | 883 | } |
864 | 884 | ||
865 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 885 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
866 | const QDate &td) | 886 | const QDate &td) |
867 | { | 887 | { |
868 | #ifndef KORG_NOPRINTER | 888 | #ifndef KORG_NOPRINTER |
869 | calPrinter->preview(CalPrinter::Month, fd, td); | 889 | calPrinter->preview(CalPrinter::Month, fd, td); |
870 | #endif | 890 | #endif |
871 | } | 891 | } |
872 | 892 | ||
873 | void KOMonthView::updateConfig() | 893 | void KOMonthView::updateConfig() |
874 | { | 894 | { |
875 | 895 | ||
876 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 896 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
877 | 897 | ||
898 | if ( mShowWeekView ) | ||
899 | mWeekStartsMonday = true; | ||
878 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 900 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
879 | mWidthLongDayLabel = 0; | 901 | mWidthLongDayLabel = 0; |
880 | 902 | ||
881 | for (int i = 0; i < 7; i++) { | 903 | for (int i = 0; i < 7; i++) { |
882 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 904 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
883 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 905 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
884 | } | 906 | } |
885 | bool temp = mShowSatSunComp ; | 907 | bool temp = mShowSatSunComp ; |
886 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 908 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
887 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 909 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
888 | computeLayout(); | 910 | computeLayout(); |
889 | updateDayLabels(); | 911 | updateDayLabels(); |
890 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 912 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
891 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 913 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
892 | //resizeEvent( 0 ); | 914 | //resizeEvent( 0 ); |
893 | for (uint i = 0; i < mCells.count(); ++i) { | 915 | for (uint i = 0; i < mCells.count(); ++i) { |
894 | mCells[i]->updateConfig(); | 916 | mCells[i]->updateConfig(); |
895 | } | 917 | } |
896 | #ifdef DESKTOP_VERSION | 918 | #ifdef DESKTOP_VERSION |
897 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 919 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
898 | #endif | 920 | #endif |
899 | updateView(); | 921 | updateView(); |
900 | } | 922 | } |
901 | 923 | ||
902 | void KOMonthView::updateDayLabels() | 924 | void KOMonthView::updateDayLabels() |
903 | { | 925 | { |
904 | 926 | ||
905 | for (int i = 0; i < 7; i++) { | 927 | for (int i = 0; i < 7; i++) { |
906 | if (mWeekStartsMonday) { | 928 | if (mWeekStartsMonday) { |
907 | bool show = mShortDayLabels; | 929 | bool show = mShortDayLabels; |
908 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 930 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
909 | show = true; | 931 | show = true; |
910 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 932 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
911 | } else { | 933 | } else { |
912 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 934 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
913 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 935 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
914 | 936 | ||
915 | } | 937 | } |
916 | } | 938 | } |
917 | } | 939 | } |
918 | 940 | ||
919 | void KOMonthView::showDates(const QDate &start, const QDate &) | 941 | void KOMonthView::showDates(const QDate &start, const QDate &) |
920 | { | 942 | { |
921 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 943 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
922 | 944 | ||
923 | 945 | ||
924 | mStartDate = start; | 946 | mStartDate = start; |
925 | 947 | ||
926 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 948 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
927 | 949 | ||
928 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 950 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
929 | mStartDate = mStartDate.addDays( -1 ); | 951 | mStartDate = mStartDate.addDays( -1 ); |
930 | } | 952 | } |
931 | 953 | ||
932 | bool primary = false; | 954 | bool primary = false; |
933 | uint i; | 955 | uint i; |
934 | for( i = 0; i < mCells.size(); ++i ) { | 956 | for( i = 0; i < mCells.size(); ++i ) { |
935 | QDate date = mStartDate.addDays( i ); | 957 | QDate date = mStartDate.addDays( i ); |
936 | mCells[i]->setDate( date ); | 958 | mCells[i]->setDate( date ); |
937 | 959 | ||
938 | #ifndef KORG_NOPLUGINS | 960 | #ifndef KORG_NOPLUGINS |
939 | // add holiday, if present | 961 | // add holiday, if present |
940 | QString hstring(KOCore::self()->holiday(date)); | 962 | QString hstring(KOCore::self()->holiday(date)); |
941 | mCells[i]->setHoliday( hstring ); | 963 | mCells[i]->setHoliday( hstring ); |
942 | #endif | 964 | #endif |
943 | 965 | ||
944 | } | 966 | } |
945 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 967 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
946 | for( i = 0; i < 6; ++i ) { | 968 | for( i = 0; i < 6; ++i ) { |
947 | int wno; | 969 | int wno; |
948 | // remember, according to ISO 8601, the first week of the year is the | 970 | // remember, according to ISO 8601, the first week of the year is the |
949 | // first week that contains a thursday. Thus we must subtract off 4, | 971 | // first week that contains a thursday. Thus we must subtract off 4, |
950 | // not just 1. | 972 | // not just 1. |
951 | int dayOfYear = date.dayOfYear(); | 973 | int dayOfYear = date.dayOfYear(); |
952 | if (dayOfYear % 7 != 0) | 974 | if (dayOfYear % 7 != 0) |
953 | wno = dayOfYear / 7 + 1; | 975 | wno = dayOfYear / 7 + 1; |
954 | else | 976 | else |
955 | wno =dayOfYear / 7; | 977 | wno =dayOfYear / 7; |
956 | mWeekLabels[i]->setWeekNum( wno ); | 978 | mWeekLabels[i]->setWeekNum( wno ); |
957 | date = date.addDays( 7 ); | 979 | date = date.addDays( 7 ); |
958 | } | 980 | } |
959 | updateView(); | 981 | updateView(); |
960 | } | 982 | } |
961 | 983 | ||
962 | void KOMonthView::showEvents(QPtrList<Event>) | 984 | void KOMonthView::showEvents(QPtrList<Event>) |
963 | { | 985 | { |
964 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 986 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
965 | } | 987 | } |
966 | 988 | ||
967 | void KOMonthView::changeEventDisplay(Event *, int) | 989 | void KOMonthView::changeEventDisplay(Event *, int) |
968 | { | 990 | { |
969 | // this should be re-written to be much more efficient, but this | 991 | // this should be re-written to be much more efficient, but this |
970 | // quick-and-dirty-hack gets the job done for right now. | 992 | // quick-and-dirty-hack gets the job done for right now. |
971 | updateView(); | 993 | updateView(); |
972 | } | 994 | } |
973 | 995 | ||
974 | void KOMonthView::updateView() | 996 | void KOMonthView::updateView() |
975 | { | 997 | { |
976 | 998 | ||
977 | if ( !updatePossible ) | 999 | if ( !updatePossible ) |
978 | return; | 1000 | return; |
979 | //QTime ti; | 1001 | //QTime ti; |
980 | //ti.start(); | 1002 | //ti.start(); |
981 | #if 1 | 1003 | #if 1 |
982 | int i; | 1004 | int i; |
983 | for( i = 0; i < mCells.count(); ++i ) { | 1005 | int timeSpan = mCells.size()-1; |
1006 | if ( KOPrefs::instance()->mMonthViewWeek ) | ||
1007 | timeSpan = 6; | ||
1008 | for( i = 0; i < timeSpan + 1; ++i ) { | ||
984 | mCells[i]->startUpdateCell(); | 1009 | mCells[i]->startUpdateCell(); |
985 | } | 1010 | } |
986 | 1011 | ||
987 | QPtrList<Event> events = calendar()->events(); | 1012 | QPtrList<Event> events = calendar()->events(); |
988 | Event *event; | 1013 | Event *event; |
989 | QDateTime dt; | 1014 | QDateTime dt; |
990 | bool ok; | 1015 | bool ok; |
991 | int timeSpan = mCells.size()-1; | ||
992 | QDate endDate = mStartDate.addDays( timeSpan ); | 1016 | QDate endDate = mStartDate.addDays( timeSpan ); |
993 | for( event = events.first(); event; event = events.next() ) { // for event | 1017 | for( event = events.first(); event; event = events.next() ) { // for event |
994 | if ( event->doesRecur() ) { | 1018 | if ( event->doesRecur() ) { |
995 | bool last; | 1019 | bool last; |
996 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1020 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
997 | QDateTime incidenceEnd; | 1021 | QDateTime incidenceEnd; |
998 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1022 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
999 | bool invalid = false; | 1023 | bool invalid = false; |
1000 | while( true ) { | 1024 | while( true ) { |
1001 | if ( incidenceStart.isValid() ) { | 1025 | if ( incidenceStart.isValid() ) { |
1002 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1026 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1003 | int st = incidenceStart.date().daysTo( endDate ); | 1027 | int st = incidenceStart.date().daysTo( endDate ); |
1004 | if ( st >= 0 ) { // start before timeend | 1028 | if ( st >= 0 ) { // start before timeend |
1005 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1029 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1006 | if ( end >= 0 ) { // end after timestart --- got one! | 1030 | if ( end >= 0 ) { // end after timestart --- got one! |
1007 | //normalize | 1031 | //normalize |
1008 | st = timeSpan - st; | 1032 | st = timeSpan - st; |
1009 | if ( st < 0 ) st = 0; | 1033 | if ( st < 0 ) st = 0; |
1010 | if ( end > timeSpan ) end = timeSpan; | 1034 | if ( end > timeSpan ) end = timeSpan; |
1011 | int iii; | 1035 | int iii; |
1012 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1036 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1013 | for ( iii = st;iii<= end;++iii) | 1037 | for ( iii = st;iii<= end;++iii) |
1014 | mCells[iii]->insertEvent( event ); | 1038 | mCells[iii]->insertEvent( event ); |
1015 | } | 1039 | } |
1016 | } | 1040 | } |
1017 | } else { | 1041 | } else { |
1018 | if ( invalid ) | 1042 | if ( invalid ) |
1019 | break; | 1043 | break; |
1020 | invalid = true; | 1044 | invalid = true; |
1021 | //qDebug("invalid %s", event->summary().latin1()); | 1045 | //qDebug("invalid %s", event->summary().latin1()); |
1022 | incidenceStart = QDateTime( mStartDate ); | 1046 | incidenceStart = QDateTime( mStartDate ); |
1023 | } | 1047 | } |
1024 | if ( last ) | 1048 | if ( last ) |
1025 | break; | 1049 | break; |
1026 | bool ok; | 1050 | bool ok; |
1027 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1051 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1028 | if ( ! ok ) | 1052 | if ( ! ok ) |
1029 | break; | 1053 | break; |
1030 | if ( incidenceStart.date() > endDate ) | 1054 | if ( incidenceStart.date() > endDate ) |
1031 | break; | 1055 | break; |
1032 | } | 1056 | } |
1033 | } else { // no recur | 1057 | } else { // no recur |
1034 | int st = event->dtStart().date().daysTo( endDate ); | 1058 | int st = event->dtStart().date().daysTo( endDate ); |
1035 | if ( st >= 0 ) { // start before timeend | 1059 | if ( st >= 0 ) { // start before timeend |
1036 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1060 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1037 | if ( end >= 0 ) { // end after timestart --- got one! | 1061 | if ( end >= 0 ) { // end after timestart --- got one! |
1038 | //normalize | 1062 | //normalize |
1039 | st = timeSpan - st; | 1063 | st = timeSpan - st; |
1040 | if ( st < 0 ) st = 0; | 1064 | if ( st < 0 ) st = 0; |
1041 | if ( end > timeSpan ) end = timeSpan; | 1065 | if ( end > timeSpan ) end = timeSpan; |
1042 | int iii; | 1066 | int iii; |
1043 | for ( iii = st;iii<= end;++iii) | 1067 | for ( iii = st;iii<= end;++iii) |
1044 | mCells[iii]->insertEvent( event ); | 1068 | mCells[iii]->insertEvent( event ); |
1045 | } | 1069 | } |
1046 | } | 1070 | } |
1047 | } | 1071 | } |
1048 | } | 1072 | } |
1049 | // insert due todos | 1073 | // insert due todos |
1050 | QPtrList<Todo> todos = calendar()->todos( ); | 1074 | QPtrList<Todo> todos = calendar()->todos( ); |
1051 | Todo *todo; | 1075 | Todo *todo; |
1052 | for(todo = todos.first(); todo; todo = todos.next()) { | 1076 | for(todo = todos.first(); todo; todo = todos.next()) { |
1053 | //insertTodo( todo ); | 1077 | //insertTodo( todo ); |
1054 | if ( todo->hasDueDate() ) { | 1078 | if ( todo->hasDueDate() ) { |
1055 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1079 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1056 | if ( day >= 0 && day < mCells.size() ) { | 1080 | if ( day >= 0 && day < timeSpan + 1) { |
1057 | mCells[day]->insertTodo( todo ); | 1081 | mCells[day]->insertTodo( todo ); |
1058 | } | 1082 | } |
1059 | } | 1083 | } |
1060 | } | 1084 | } |
1061 | 1085 | ||
1062 | for( i = 0; i < mCells.count(); ++i ) { | 1086 | for( i = 0; i < timeSpan+1; ++i ) { |
1063 | mCells[i]->finishUpdateCell(); | 1087 | mCells[i]->finishUpdateCell(); |
1064 | } | 1088 | } |
1065 | processSelectionChange(); | 1089 | processSelectionChange(); |
1066 | mCells[0]->setFocus(); | 1090 | mCells[0]->setFocus(); |
1067 | 1091 | ||
1068 | 1092 | ||
1069 | #else | 1093 | #else |
1070 | // old code | 1094 | // old code |
1071 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1095 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1072 | int i; | 1096 | int i; |
1073 | for( i = 0; i < mCells.count(); ++i ) { | 1097 | for( i = 0; i < mCells.count(); ++i ) { |
1074 | mCells[i]->updateCell(); | 1098 | mCells[i]->updateCell(); |
1075 | } | 1099 | } |
1076 | 1100 | ||
1077 | //qDebug("KOMonthView::updateView() "); | 1101 | //qDebug("KOMonthView::updateView() "); |
1078 | processSelectionChange(); | 1102 | processSelectionChange(); |
1079 | // qDebug("---------------------------------------------------------------------+ "); | 1103 | // qDebug("---------------------------------------------------------------------+ "); |
1080 | mCells[0]->setFocus(); | 1104 | mCells[0]->setFocus(); |
1081 | #endif | 1105 | #endif |
1082 | 1106 | ||
1083 | //qDebug("update time %d ", ti.elapsed()); | 1107 | //qDebug("update time %d ", ti.elapsed()); |
1084 | } | 1108 | } |
1085 | 1109 | ||
1086 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1110 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1087 | { | 1111 | { |
1088 | computeLayout(); | 1112 | computeLayout(); |
1089 | mCells[0]->setFocus(); | 1113 | mCells[0]->setFocus(); |
1090 | } | 1114 | } |
1115 | void KOMonthView::computeLayoutWeek() | ||
1116 | { | ||
1117 | |||
1118 | int daysToShow; | ||
1119 | bool combinedSatSun = false; | ||
1120 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | ||
1121 | daysToShow = 6; | ||
1122 | combinedSatSun = true; | ||
1123 | } | ||
1124 | int tWid = topLevelWidget()->size().width(); | ||
1125 | int tHei = topLevelWidget()->size().height(); | ||
1126 | |||
1127 | int wid = size().width();//e | ||
1128 | int hei = size().height()-1; | ||
1129 | |||
1130 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1131 | return; | ||
1132 | |||
1133 | if ( wid < hei ) | ||
1134 | daysToShow = 2; | ||
1135 | else | ||
1136 | daysToShow = 3; | ||
1137 | mShowSatSunComp = true; | ||
1138 | combinedSatSun = true; | ||
1139 | |||
1140 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1141 | QFontMetrics fm ( mWeekLabels[0]->font() ); | ||
1142 | int weeklabelwid = fm.width( "888" ); | ||
1143 | wid -= weeklabelwid; | ||
1144 | |||
1145 | int colWid = wid / daysToShow; | ||
1146 | int lastCol = wid - ( colWid*6 ); | ||
1147 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | ||
1148 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | ||
1149 | int colModulo = wid % daysToShow; | ||
1150 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | ||
1151 | //qDebug("rowmod %d ", rowModulo); | ||
1152 | int i; | ||
1153 | int x,y,w,h; | ||
1154 | x= 0; | ||
1155 | y= 0; | ||
1156 | w = colWid; | ||
1157 | h = dayLabelHei ; | ||
1158 | for ( i = 0; i < 7; i++) { | ||
1159 | if ( i && !( i % daysToShow) && i < 6) { | ||
1160 | y += hei/(5-daysToShow); | ||
1161 | x = 0; | ||
1162 | } | ||
1163 | if ( i == daysToShow-colModulo ) | ||
1164 | ++w; | ||
1165 | if ( i >= 5 ) { | ||
1166 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | ||
1167 | x -= w/2 ; | ||
1168 | } | ||
1169 | else | ||
1170 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | ||
1171 | x += w; | ||
1172 | } | ||
1173 | x= 0; | ||
1174 | y= dayLabelHei; | ||
1175 | w = colWid; | ||
1176 | h = cellHei; | ||
1177 | for ( i = 0; i < mCells.count(); ++i) { | ||
1178 | if ( i > 6 ) { | ||
1179 | mCells[i]->hide(); | ||
1180 | continue; | ||
1181 | } | ||
1182 | |||
1183 | w = colWid; | ||
1184 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | ||
1185 | ++w; | ||
1186 | } | ||
1187 | if ( i == (daysToShow-1-rowModulo)*7) | ||
1188 | ++h; | ||
1189 | |||
1190 | if ( i >= 5 ) { | ||
1191 | if ( i ==5 ) { | ||
1192 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | ||
1193 | x -= w ;y += h/2; | ||
1194 | } else { | ||
1195 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | ||
1196 | y -= h/2; | ||
1197 | } | ||
1198 | } else | ||
1199 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | ||
1200 | |||
1201 | |||
1202 | x += w; | ||
1203 | if ( x + w/2 > wid ) { | ||
1204 | x = 0; | ||
1205 | y += h+dayLabelHei ; | ||
1206 | } | ||
1207 | } | ||
1208 | y= dayLabelHei; | ||
1209 | h = cellHei ; | ||
1210 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | ||
1211 | for ( i = 1; i < 6; i++) { | ||
1212 | mWeekLabels[i]->hide(); | ||
1213 | } | ||
1214 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | ||
1215 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | ||
1216 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1217 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | ||
1218 | updateDayLabels(); | ||
1219 | bool forceUpdate = !updatePossible; | ||
1220 | updatePossible = true; | ||
1221 | mWeekLabels[mNumWeeks]->setText( i18n("M")); | ||
1222 | if ( forceUpdate ) | ||
1223 | updateView(); | ||
1224 | } | ||
1091 | void KOMonthView::computeLayout() | 1225 | void KOMonthView::computeLayout() |
1092 | { | 1226 | { |
1093 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1227 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1094 | // note this only changes the text if the requested size crosses the | 1228 | // note this only changes the text if the requested size crosses the |
1095 | // threshold between big enough to support the full name and not big | 1229 | // threshold between big enough to support the full name and not big |
1096 | // enough. | 1230 | // enough. |
1097 | 1231 | if ( mShowWeekView ){ | |
1232 | computeLayoutWeek(); | ||
1233 | return; | ||
1234 | } | ||
1098 | int daysToShow = 7; | 1235 | int daysToShow = 7; |
1099 | bool combinedSatSun = false; | 1236 | bool combinedSatSun = false; |
1100 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1237 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1101 | daysToShow = 6; | 1238 | daysToShow = 6; |
1102 | combinedSatSun = true; | 1239 | combinedSatSun = true; |
1103 | } | 1240 | } |
1104 | int tWid = topLevelWidget()->size().width(); | 1241 | int tWid = topLevelWidget()->size().width(); |
1105 | int tHei = topLevelWidget()->size().height(); | 1242 | int tHei = topLevelWidget()->size().height(); |
1106 | 1243 | ||
1107 | int wid = size().width();//e | 1244 | int wid = size().width();//e |
1108 | int hei = size().height()-1; | 1245 | int hei = size().height()-1; |
1109 | 1246 | ||
1110 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1247 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1111 | return; | 1248 | return; |
1112 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1249 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1113 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1250 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1114 | int weeklabelwid = fm.width( "888" ); | 1251 | int weeklabelwid = fm.width( "888" ); |
1115 | wid -= weeklabelwid; | 1252 | wid -= weeklabelwid; |
1116 | 1253 | ||
1117 | int colWid = wid / daysToShow; | 1254 | int colWid = wid / daysToShow; |
1118 | int lastCol = wid - ( colWid*6 ); | 1255 | int lastCol = wid - ( colWid*6 ); |
1119 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1256 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1120 | int cellHei = (hei - dayLabelHei) /6; | 1257 | int cellHei = (hei - dayLabelHei) /6; |
1121 | int colModulo = wid % daysToShow; | 1258 | int colModulo = wid % daysToShow; |
1122 | int rowModulo = (hei- dayLabelHei) % 6; | 1259 | int rowModulo = (hei- dayLabelHei) % 6; |
1123 | //qDebug("rowmod %d ", rowModulo); | 1260 | //qDebug("rowmod %d ", rowModulo); |
1124 | int i; | 1261 | int i; |
1125 | int x,y,w,h; | 1262 | int x,y,w,h; |
1126 | x= 0; | 1263 | x= 0; |
1127 | y= 0; | 1264 | y= 0; |
1128 | w = colWid; | 1265 | w = colWid; |
1129 | h = dayLabelHei ; | 1266 | h = dayLabelHei ; |
1130 | for ( i = 0; i < 7; i++) { | 1267 | for ( i = 0; i < 7; i++) { |
1131 | if ( i == daysToShow-colModulo ) | 1268 | if ( i == daysToShow-colModulo ) |
1132 | ++w; | 1269 | ++w; |
1133 | if ( combinedSatSun ) { | 1270 | if ( combinedSatSun ) { |
1134 | if ( i >= daysToShow-1 ) { | 1271 | if ( i >= daysToShow-1 ) { |
1135 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1272 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1136 | x -= w/2 ; | 1273 | x -= w/2 ; |
1137 | } | 1274 | } |
1138 | else | 1275 | else |
1139 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1276 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1140 | } else | 1277 | } else |
1141 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1278 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1142 | x += w; | 1279 | x += w; |
1143 | } | 1280 | } |
1144 | x= 0; | 1281 | x= 0; |
1145 | y= dayLabelHei; | 1282 | y= dayLabelHei; |
1146 | w = colWid; | 1283 | w = colWid; |
1147 | h = cellHei ; | 1284 | h = cellHei ; |
1148 | for ( i = 0; i < mCells.count(); ++i) { | 1285 | for ( i = 0; i < mCells.count(); ++i) { |
1149 | 1286 | mCells[i]->show(); | |
1150 | w = colWid; | 1287 | w = colWid; |
1151 | if ( ((i) % 7) >= 7-colModulo ) { | 1288 | if ( ((i) % 7) >= 7-colModulo ) { |
1152 | ++w; | 1289 | ++w; |
1153 | } | 1290 | } |
1154 | if ( i == (6-rowModulo)*7) | 1291 | if ( i == (6-rowModulo)*7) |
1155 | ++h; | 1292 | ++h; |
1156 | if ( combinedSatSun ) { | 1293 | if ( combinedSatSun ) { |
1157 | if ( (i)%7 >= daysToShow-1 ) { | 1294 | if ( (i)%7 >= daysToShow-1 ) { |
1158 | if ( (i)%7 == daysToShow-1 ) { | 1295 | if ( (i)%7 == daysToShow-1 ) { |
1159 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1296 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1160 | x -= w ;y += h/2; | 1297 | x -= w ;y += h/2; |
1161 | } else { | 1298 | } else { |
1162 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1299 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1163 | y -= h/2; | 1300 | y -= h/2; |
1164 | } | 1301 | } |
1165 | } else | 1302 | } else |
1166 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1303 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1167 | 1304 | ||
1168 | } | 1305 | } |
1169 | else | 1306 | else |
1170 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1307 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1171 | x += w; | 1308 | x += w; |
1172 | if ( x + w/2 > wid ) { | 1309 | if ( x + w/2 > wid ) { |
1173 | x = 0; | 1310 | x = 0; |
1174 | y += h; | 1311 | y += h; |
1175 | } | 1312 | } |
1176 | } | 1313 | } |
1177 | y= dayLabelHei; | 1314 | y= dayLabelHei; |
1178 | h = cellHei ; | 1315 | h = cellHei ; |
1179 | for ( i = 0; i < 6; i++) { | 1316 | for ( i = 0; i < 6; i++) { |
1317 | mWeekLabels[i]->show(); | ||
1180 | if ( i == (6-rowModulo)) | 1318 | if ( i == (6-rowModulo)) |
1181 | ++h; | 1319 | ++h; |
1182 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1320 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1183 | y += h; | 1321 | y += h; |
1184 | } | 1322 | } |
1185 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1323 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1186 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1324 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1187 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1325 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1188 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1326 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1189 | updateDayLabels(); | 1327 | updateDayLabels(); |
1190 | bool forceUpdate = !updatePossible; | 1328 | bool forceUpdate = !updatePossible; |
1191 | updatePossible = true; | 1329 | updatePossible = true; |
1330 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
1192 | if ( forceUpdate ) | 1331 | if ( forceUpdate ) |
1193 | updateView(); | 1332 | updateView(); |
1194 | } | 1333 | } |
1195 | 1334 | ||
1196 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1335 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1197 | { | 1336 | { |
1198 | mContextMenu->showIncidencePopup(incidence); | 1337 | mContextMenu->showIncidencePopup(incidence); |
1199 | /* | 1338 | /* |
1200 | if( incidence && incidence->type() == "Event" ) { | 1339 | if( incidence && incidence->type() == "Event" ) { |
1201 | Event *event = static_cast<Event *>(incidence); | 1340 | Event *event = static_cast<Event *>(incidence); |
1202 | mContextMenu->showEventPopup(event); | 1341 | mContextMenu->showEventPopup(event); |
1203 | } else { | 1342 | } else { |
1204 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1343 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1205 | } | 1344 | } |
1206 | */ | 1345 | */ |
1207 | } | 1346 | } |
1208 | MonthViewCell * KOMonthView::selectedCell( ) | 1347 | MonthViewCell * KOMonthView::selectedCell( ) |
1209 | { | 1348 | { |
1210 | return mSelectedCell; | 1349 | return mSelectedCell; |
1211 | } | 1350 | } |
1212 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1351 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1213 | { | 1352 | { |
1214 | // qDebug("KOMonthView::setSelectedCell "); | 1353 | // qDebug("KOMonthView::setSelectedCell "); |
1215 | if ( mSelectedCell && mSelectedCell != cell ) { | 1354 | if ( mSelectedCell && mSelectedCell != cell ) { |
1216 | MonthViewCell * mvc = mSelectedCell; | 1355 | MonthViewCell * mvc = mSelectedCell; |
1217 | mSelectedCell = cell; | 1356 | mSelectedCell = cell; |
1218 | mvc->deselect(); | 1357 | mvc->deselect(); |
1219 | } else | 1358 | } else |
1220 | mSelectedCell = cell; | 1359 | mSelectedCell = cell; |
1221 | // if ( mSelectedCell ) | 1360 | // if ( mSelectedCell ) |
1222 | // mSelectedCell->select(); | 1361 | // mSelectedCell->select(); |
1223 | if ( !mSelectedCell ) | 1362 | if ( !mSelectedCell ) |
1224 | emit incidenceSelected( 0 ); | 1363 | emit incidenceSelected( 0 ); |
1225 | else | 1364 | else |
1226 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1365 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1227 | } | 1366 | } |
1228 | 1367 | ||
1229 | void KOMonthView::processSelectionChange() | 1368 | void KOMonthView::processSelectionChange() |
1230 | { | 1369 | { |
1231 | QPtrList<Incidence> incidences = selectedIncidences(); | 1370 | QPtrList<Incidence> incidences = selectedIncidences(); |
1232 | if (incidences.count() > 0) { | 1371 | if (incidences.count() > 0) { |
1233 | emit incidenceSelected( incidences.first() ); | 1372 | emit incidenceSelected( incidences.first() ); |
1234 | } else { | 1373 | } else { |
1235 | emit incidenceSelected( 0 ); | 1374 | emit incidenceSelected( 0 ); |
1236 | } | 1375 | } |
1237 | } | 1376 | } |
1238 | 1377 | ||
1239 | void KOMonthView::clearSelection() | 1378 | void KOMonthView::clearSelection() |
1240 | { | 1379 | { |
1241 | if ( mSelectedCell ) { | 1380 | if ( mSelectedCell ) { |
1242 | mSelectedCell->deselect(); | 1381 | mSelectedCell->deselect(); |
1243 | mSelectedCell = 0; | 1382 | mSelectedCell = 0; |
1244 | } | 1383 | } |
1245 | } | 1384 | } |
1246 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1385 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1247 | { | 1386 | { |
1248 | //qDebug("KOMonthView::keyPressEvent "); | 1387 | //qDebug("KOMonthView::keyPressEvent "); |
1249 | switch(e->key()) { | 1388 | switch(e->key()) { |
1250 | case Key_Up: | 1389 | case Key_Up: |
1251 | { | 1390 | { |
1252 | emit prevMonth(); | 1391 | emit prevMonth(); |
1253 | mCells[0]->setFocus(); | 1392 | mCells[0]->setFocus(); |
1254 | } | 1393 | } |
1255 | e->accept(); | 1394 | e->accept(); |
1256 | break; | 1395 | break; |
1257 | case Key_Down: | 1396 | case Key_Down: |
1258 | { | 1397 | { |
1259 | emit nextMonth(); | 1398 | emit nextMonth(); |
1260 | mCells[0]->setFocus(); | 1399 | mCells[0]->setFocus(); |
1261 | 1400 | ||
1262 | } | 1401 | } |
1263 | e->accept(); | 1402 | e->accept(); |
1264 | break; | 1403 | break; |
1265 | default: | 1404 | default: |
1266 | e->ignore(); | 1405 | e->ignore(); |
1267 | break; | 1406 | break; |
1268 | } | 1407 | } |
1269 | } | 1408 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index b84065e..0bc3743 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -115,165 +115,169 @@ class MonthViewItem: public QListBoxItem | |||
115 | QPalette mPalette; | 115 | QPalette mPalette; |
116 | QDate mDate; | 116 | QDate mDate; |
117 | 117 | ||
118 | Incidence *mIncidence; | 118 | Incidence *mIncidence; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | class KOMonthView; | 122 | class KOMonthView; |
123 | 123 | ||
124 | class MonthViewCell : public QWidget | 124 | class MonthViewCell : public QWidget |
125 | { | 125 | { |
126 | Q_OBJECT | 126 | Q_OBJECT |
127 | public: | 127 | public: |
128 | MonthViewCell( KOMonthView * ); | 128 | MonthViewCell( KOMonthView * ); |
129 | 129 | ||
130 | void setDate( const QDate & ); | 130 | void setDate( const QDate & ); |
131 | QDate date() const; | 131 | QDate date() const; |
132 | 132 | ||
133 | void setPrimary( bool ); | 133 | void setPrimary( bool ); |
134 | bool isPrimary() const; | 134 | bool isPrimary() const; |
135 | 135 | ||
136 | void setHoliday( bool ); | 136 | void setHoliday( bool ); |
137 | void setHoliday( const QString & ); | 137 | void setHoliday( const QString & ); |
138 | 138 | ||
139 | void updateCell(); | 139 | void updateCell(); |
140 | void startUpdateCell(); | 140 | void startUpdateCell(); |
141 | void finishUpdateCell(); | 141 | void finishUpdateCell(); |
142 | void insertEvent(Event *); | 142 | void insertEvent(Event *); |
143 | void insertTodo(Todo *); | 143 | void insertTodo(Todo *); |
144 | 144 | ||
145 | void updateConfig(); | 145 | void updateConfig(); |
146 | 146 | ||
147 | void enableScrollBars( bool ); | 147 | void enableScrollBars( bool ); |
148 | 148 | ||
149 | Incidence *selectedIncidence(); | 149 | Incidence *selectedIncidence(); |
150 | QDate selectedIncidenceDate(); | 150 | QDate selectedIncidenceDate(); |
151 | 151 | ||
152 | void deselect(); | 152 | void deselect(); |
153 | void select(); | 153 | void select(); |
154 | void clear(); | 154 | void clear(); |
155 | 155 | ||
156 | #ifdef DESKTOP_VERSION | 156 | #ifdef DESKTOP_VERSION |
157 | static QToolTipGroup *toolTipGroup(); | 157 | static QToolTipGroup *toolTipGroup(); |
158 | #endif | 158 | #endif |
159 | signals: | 159 | signals: |
160 | void defaultAction( Incidence * ); | 160 | void defaultAction( Incidence * ); |
161 | void newEventSignal( QDateTime ); | 161 | void newEventSignal( QDateTime ); |
162 | void showDaySignal( QDate ); | 162 | void showDaySignal( QDate ); |
163 | 163 | ||
164 | protected: | 164 | protected: |
165 | QString mToolTip; | 165 | QString mToolTip; |
166 | void resizeEvent( QResizeEvent * ); | 166 | void resizeEvent( QResizeEvent * ); |
167 | 167 | ||
168 | protected slots: | 168 | protected slots: |
169 | void defaultAction( QListBoxItem * ); | 169 | void defaultAction( QListBoxItem * ); |
170 | void contextMenu( QListBoxItem * ); | 170 | void contextMenu( QListBoxItem * ); |
171 | void selection( QListBoxItem * ); | 171 | void selection( QListBoxItem * ); |
172 | void cellClicked( QListBoxItem * ); | 172 | void cellClicked( QListBoxItem * ); |
173 | void newEvent(); | 173 | void newEvent(); |
174 | void showDay(); | 174 | void showDay(); |
175 | 175 | ||
176 | private: | 176 | private: |
177 | KOMonthView *mMonthView; | 177 | KOMonthView *mMonthView; |
178 | 178 | ||
179 | QDate mDate; | 179 | QDate mDate; |
180 | bool mPrimary; | 180 | bool mPrimary; |
181 | bool mHoliday; | 181 | bool mHoliday; |
182 | QString mHolidayString; | 182 | QString mHolidayString; |
183 | 183 | ||
184 | //QLabel *mLabel; | 184 | //QLabel *mLabel; |
185 | QPushButton *mLabel; | 185 | QPushButton *mLabel; |
186 | QListBox *mItemList; | 186 | QListBox *mItemList; |
187 | #ifdef DESKTOP_VERSION | 187 | #ifdef DESKTOP_VERSION |
188 | static QToolTipGroup *mToolTipGroup; | 188 | static QToolTipGroup *mToolTipGroup; |
189 | #endif | 189 | #endif |
190 | QSize mLabelSize; | 190 | QSize mLabelSize; |
191 | QSize mLabelBigSize; | 191 | QSize mLabelBigSize; |
192 | QPalette mHolidayPalette; | 192 | QPalette mHolidayPalette; |
193 | QPalette mStandardPalette; | 193 | QPalette mStandardPalette; |
194 | QPalette mPrimaryPalette; | 194 | QPalette mPrimaryPalette; |
195 | QPalette mNonPrimaryPalette; | 195 | QPalette mNonPrimaryPalette; |
196 | void setMyPalette(); | 196 | void setMyPalette(); |
197 | QPalette getPalette (); | 197 | QPalette getPalette (); |
198 | void keyPressEvent ( QKeyEvent * ) ; | 198 | void keyPressEvent ( QKeyEvent * ) ; |
199 | 199 | ||
200 | }; | 200 | }; |
201 | 201 | ||
202 | 202 | ||
203 | class KOMonthView: public KOEventView | 203 | class KOMonthView: public KOEventView |
204 | { | 204 | { |
205 | Q_OBJECT | 205 | Q_OBJECT |
206 | public: | 206 | public: |
207 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 207 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
208 | ~KOMonthView(); | 208 | ~KOMonthView(); |
209 | 209 | ||
210 | /** Returns maximum number of days supported by the komonthview */ | 210 | /** Returns maximum number of days supported by the komonthview */ |
211 | virtual int maxDatesHint(); | 211 | virtual int maxDatesHint(); |
212 | 212 | ||
213 | /** Returns number of currently shown dates. */ | 213 | /** Returns number of currently shown dates. */ |
214 | virtual int currentDateCount(); | 214 | virtual int currentDateCount(); |
215 | 215 | ||
216 | /** returns the currently selected events */ | 216 | /** returns the currently selected events */ |
217 | virtual QPtrList<Incidence> selectedIncidences(); | 217 | virtual QPtrList<Incidence> selectedIncidences(); |
218 | 218 | ||
219 | /** returns dates of the currently selected events */ | 219 | /** returns dates of the currently selected events */ |
220 | virtual DateList selectedDates(); | 220 | virtual DateList selectedDates(); |
221 | 221 | ||
222 | virtual void printPreview(CalPrinter *calPrinter, | 222 | virtual void printPreview(CalPrinter *calPrinter, |
223 | const QDate &, const QDate &); | 223 | const QDate &, const QDate &); |
224 | bool isMonthView() { return true; } | 224 | bool isMonthView() { return true; } |
225 | bool isUpdatePossible() { return updatePossible; } | 225 | bool isUpdatePossible() { return updatePossible; } |
226 | 226 | ||
227 | MonthViewCell * selectedCell(); | 227 | MonthViewCell * selectedCell(); |
228 | public slots: | 228 | public slots: |
229 | virtual void updateView(); | 229 | virtual void updateView(); |
230 | virtual void updateConfig(); | 230 | virtual void updateConfig(); |
231 | virtual void showDates(const QDate &start, const QDate &end); | 231 | virtual void showDates(const QDate &start, const QDate &end); |
232 | virtual void showEvents(QPtrList<Event> eventList); | 232 | virtual void showEvents(QPtrList<Event> eventList); |
233 | 233 | ||
234 | void changeEventDisplay(Event *, int); | 234 | void changeEventDisplay(Event *, int); |
235 | 235 | ||
236 | void clearSelection(); | 236 | void clearSelection(); |
237 | 237 | ||
238 | void showContextMenu( Incidence * ); | 238 | void showContextMenu( Incidence * ); |
239 | 239 | ||
240 | void setSelectedCell( MonthViewCell * ); | 240 | void setSelectedCell( MonthViewCell * ); |
241 | 241 | ||
242 | protected slots: | 242 | protected slots: |
243 | void switchView(); | ||
243 | void processSelectionChange(); | 244 | void processSelectionChange(); |
244 | signals: | 245 | signals: |
245 | void nextMonth(); | 246 | void nextMonth(); |
246 | void prevMonth(); | 247 | void prevMonth(); |
248 | void showNavigator( bool ); | ||
247 | void selectWeekNum ( int ); | 249 | void selectWeekNum ( int ); |
248 | void showDaySignal( QDate ); | 250 | void showDaySignal( QDate ); |
249 | protected: | 251 | protected: |
250 | void resizeEvent(QResizeEvent *); | 252 | void resizeEvent(QResizeEvent *); |
251 | void viewChanged(); | 253 | void viewChanged(); |
252 | void updateDayLabels(); | 254 | void updateDayLabels(); |
253 | 255 | ||
254 | private: | 256 | private: |
257 | bool mShowWeekView; | ||
255 | bool updatePossible; | 258 | bool updatePossible; |
256 | int mDaysPerWeek; | 259 | int mDaysPerWeek; |
257 | int mNumWeeks; | 260 | int mNumWeeks; |
258 | int mNumCells; | 261 | int mNumCells; |
259 | bool mWeekStartsMonday; | 262 | bool mWeekStartsMonday; |
260 | bool mShowSatSunComp; | 263 | bool mShowSatSunComp; |
261 | void computeLayout(); | 264 | void computeLayout(); |
265 | void computeLayoutWeek(); | ||
262 | 266 | ||
263 | QPtrVector<MonthViewCell> mCells; | 267 | QPtrVector<MonthViewCell> mCells; |
264 | QPtrVector<QLabel> mDayLabels; | 268 | QPtrVector<QLabel> mDayLabels; |
265 | QPtrVector<KOWeekButton> mWeekLabels; | 269 | QPtrVector<KOWeekButton> mWeekLabels; |
266 | 270 | ||
267 | bool mShortDayLabels; | 271 | bool mShortDayLabels; |
268 | int mWidthLongDayLabel; | 272 | int mWidthLongDayLabel; |
269 | 273 | ||
270 | QDate mStartDate; | 274 | QDate mStartDate; |
271 | 275 | ||
272 | MonthViewCell *mSelectedCell; | 276 | MonthViewCell *mSelectedCell; |
273 | 277 | ||
274 | KOEventPopupMenu *mContextMenu; | 278 | KOEventPopupMenu *mContextMenu; |
275 | void keyPressEvent ( QKeyEvent * ) ; | 279 | void keyPressEvent ( QKeyEvent * ) ; |
276 | 280 | ||
277 | }; | 281 | }; |
278 | 282 | ||
279 | #endif | 283 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0548f14..2fb7c36 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -82,256 +82,257 @@ KOPrefs::KOPrefs() : | |||
82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
88 | addItemBool("ShowIconBack",&mShowIconBack,true); | 88 | addItemBool("ShowIconBack",&mShowIconBack,true); |
89 | addItemBool("ShowIconToday",&mShowIconToday,true); | 89 | addItemBool("ShowIconToday",&mShowIconToday,true); |
90 | addItemBool("ShowIconForward",&mShowIconForward,true); | 90 | addItemBool("ShowIconForward",&mShowIconForward,true); |
91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
94 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
98 | 98 | ||
99 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
100 | 100 | ||
101 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
103 | #else | 103 | #else |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
105 | #endif | 105 | #endif |
106 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 106 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
107 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 107 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
111 | 111 | ||
112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
116 | addItemInt("AllDay Size",&mAllDaySize,28); | 116 | addItemInt("AllDay Size",&mAllDaySize,28); |
117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
119 | 119 | ||
120 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 120 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
121 | addItemStringList("EventSummary User",&mEventSummaryUser); | 121 | addItemStringList("EventSummary User",&mEventSummaryUser); |
122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
123 | 123 | ||
124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
125 | addItemBool("Enable Project View",&mEnableProjectView,false); | 125 | addItemBool("Enable Project View",&mEnableProjectView,false); |
126 | addItemBool("Auto Save",&mAutoSave,false); | 126 | addItemBool("Auto Save",&mAutoSave,false); |
127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
128 | addItemBool("Confirm Deletes",&mConfirm,true); | 128 | addItemBool("Confirm Deletes",&mConfirm,true); |
129 | addItemString("Archive File",&mArchiveFile); | 129 | addItemString("Archive File",&mArchiveFile); |
130 | addItemString("Html Export File",&mHtmlExportFile, | 130 | addItemString("Html Export File",&mHtmlExportFile, |
131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
132 | addItemBool("Html With Save",&mHtmlWithSave,false); | 132 | addItemBool("Html With Save",&mHtmlWithSave,false); |
133 | 133 | ||
134 | KPrefs::setCurrentGroup("Personal Settings"); | 134 | KPrefs::setCurrentGroup("Personal Settings"); |
135 | 135 | ||
136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
138 | addItemBool("Bcc",&mBcc,false); | 138 | addItemBool("Bcc",&mBcc,false); |
139 | 139 | ||
140 | KPrefs::setCurrentGroup("Time & Date"); | 140 | KPrefs::setCurrentGroup("Time & Date"); |
141 | 141 | ||
142 | 142 | ||
143 | addItemInt("Default Start Time",&mStartTime,10); | 143 | addItemInt("Default Start Time",&mStartTime,10); |
144 | addItemInt("Default Duration",&mDefaultDuration,2); | 144 | addItemInt("Default Duration",&mDefaultDuration,2); |
145 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 145 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
146 | KPrefs::setCurrentGroup("AlarmSettings"); | 146 | KPrefs::setCurrentGroup("AlarmSettings"); |
147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
151 | 151 | ||
152 | 152 | ||
153 | KPrefs::setCurrentGroup("Calendar"); | 153 | KPrefs::setCurrentGroup("Calendar"); |
154 | 154 | ||
155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
156 | 156 | ||
157 | KPrefs::setCurrentGroup("Fonts"); | 157 | KPrefs::setCurrentGroup("Fonts"); |
158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
159 | addItemFont("TimeBar Font",&mTimeBarFont); | 159 | addItemFont("TimeBar Font",&mTimeBarFont); |
160 | addItemFont("MonthView Font",&mMonthViewFont); | 160 | addItemFont("MonthView Font",&mMonthViewFont); |
161 | addItemFont("AgendaView Font",&mAgendaViewFont); | 161 | addItemFont("AgendaView Font",&mAgendaViewFont); |
162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
164 | addItemFont("TodoView Font",&mTodoViewFont); | 164 | addItemFont("TodoView Font",&mTodoViewFont); |
165 | addItemFont("ListView Font",&mListViewFont); | 165 | addItemFont("ListView Font",&mListViewFont); |
166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
167 | addItemFont("EditBox Font",&mEditBoxFont); | 167 | addItemFont("EditBox Font",&mEditBoxFont); |
168 | addItemFont("JournalView Font",&mJornalViewFont); | 168 | addItemFont("JournalView Font",&mJornalViewFont); |
169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
170 | addItemFont("EventView Font",&mEventViewFont); | 170 | addItemFont("EventView Font",&mEventViewFont); |
171 | 171 | ||
172 | KPrefs::setCurrentGroup("RemoteSyncing"); | 172 | KPrefs::setCurrentGroup("RemoteSyncing"); |
173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
176 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 176 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
177 | 177 | ||
178 | #ifdef _WIN32_ | 178 | #ifdef _WIN32_ |
179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
180 | #else | 180 | #else |
181 | QString hdp= locateLocal("data","korganizer")+"/"; | 181 | QString hdp= locateLocal("data","korganizer")+"/"; |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
185 | 185 | ||
186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
190 | 190 | ||
191 | 191 | ||
192 | KPrefs::setCurrentGroup("Locale"); | 192 | KPrefs::setCurrentGroup("Locale"); |
193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
194 | 194 | ||
195 | 195 | ||
196 | KPrefs::setCurrentGroup("Colors"); | 196 | KPrefs::setCurrentGroup("Colors"); |
197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | ||
210 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
211 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
212 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
213 | addItemBool("UseAppColors",&mUseAppColors,false); | 214 | addItemBool("UseAppColors",&mUseAppColors,false); |
214 | 215 | ||
215 | 216 | ||
216 | 217 | ||
217 | KPrefs::setCurrentGroup("Views"); | 218 | KPrefs::setCurrentGroup("Views"); |
218 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
219 | addItemInt("Hour Size",&mHourSize,8); | 220 | addItemInt("Hour Size",&mHourSize,8); |
220 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
221 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
222 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
223 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
224 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
225 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
226 | #ifdef DESKTOP_VERION | 227 | #ifdef DESKTOP_VERION |
227 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
228 | #else | 229 | #else |
229 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
230 | #endif | 231 | #endif |
231 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
232 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
233 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
234 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
235 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
236 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
237 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
238 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
239 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
240 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
241 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
242 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
243 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
244 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
245 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
246 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
247 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); |
248 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 249 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
249 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 250 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
250 | #ifdef DESKTOP_VERSION | 251 | #ifdef DESKTOP_VERSION |
251 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 252 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
252 | #else | 253 | #else |
253 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 254 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
254 | #endif | 255 | #endif |
255 | addItemInt("Day Begins",&mDayBegins,7); | 256 | addItemInt("Day Begins",&mDayBegins,7); |
256 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 257 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
257 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 258 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
258 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 259 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
259 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 260 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
260 | 261 | ||
261 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 262 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
262 | addItemBool("Full View Month",&mFullViewMonth,true); | 263 | addItemBool("Full View Month",&mFullViewMonth,true); |
263 | addItemBool("Full View Todo",&mFullViewTodo,true); | 264 | addItemBool("Full View Todo",&mFullViewTodo,true); |
264 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 265 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
265 | 266 | ||
266 | addItemInt("Next X Days",&mNextXDays,3); | 267 | addItemInt("Next X Days",&mNextXDays,3); |
267 | 268 | ||
268 | KPrefs::setCurrentGroup("Printer"); | 269 | KPrefs::setCurrentGroup("Printer"); |
269 | 270 | ||
270 | KPrefs::setCurrentGroup("Layout"); | 271 | KPrefs::setCurrentGroup("Layout"); |
271 | 272 | ||
272 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 273 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
273 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 274 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
274 | 275 | ||
275 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 276 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
276 | 277 | ||
277 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 278 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
278 | 279 | ||
279 | KPrefs::setCurrentGroup("Group Scheduling"); | 280 | KPrefs::setCurrentGroup("Group Scheduling"); |
280 | 281 | ||
281 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 282 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
282 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 283 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
283 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 284 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
284 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 285 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
285 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 286 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
286 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 287 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
287 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 288 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
288 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 289 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
289 | 290 | ||
290 | KPrefs::setCurrentGroup( "Editors" ); | 291 | KPrefs::setCurrentGroup( "Editors" ); |
291 | 292 | ||
292 | addItemStringList( "EventTemplates", &mEventTemplates ); | 293 | addItemStringList( "EventTemplates", &mEventTemplates ); |
293 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 294 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
294 | 295 | ||
295 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 296 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
296 | 297 | ||
297 | 298 | ||
298 | 299 | ||
299 | } | 300 | } |
300 | 301 | ||
301 | 302 | ||
302 | KOPrefs::~KOPrefs() | 303 | KOPrefs::~KOPrefs() |
303 | { | 304 | { |
304 | if (mInstance == this) | 305 | if (mInstance == this) |
305 | mInstance = insd.setObject(0); | 306 | mInstance = insd.setObject(0); |
306 | 307 | ||
307 | //qDebug("KOPrefs::~KOPrefs() "); | 308 | //qDebug("KOPrefs::~KOPrefs() "); |
308 | } | 309 | } |
309 | 310 | ||
310 | 311 | ||
311 | KOPrefs *KOPrefs::instance() | 312 | KOPrefs *KOPrefs::instance() |
312 | { | 313 | { |
313 | if (!mInstance) { | 314 | if (!mInstance) { |
314 | mInstance = insd.setObject(new KOPrefs()); | 315 | mInstance = insd.setObject(new KOPrefs()); |
315 | mInstance->readConfig(); | 316 | mInstance->readConfig(); |
316 | } | 317 | } |
317 | 318 | ||
318 | return mInstance; | 319 | return mInstance; |
319 | } | 320 | } |
320 | 321 | ||
321 | void KOPrefs::usrSetDefaults() | 322 | void KOPrefs::usrSetDefaults() |
322 | { | 323 | { |
323 | 324 | ||
324 | } | 325 | } |
325 | 326 | ||
326 | void KOPrefs::fillMailDefaults() | 327 | void KOPrefs::fillMailDefaults() |
327 | { | 328 | { |
328 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 329 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
329 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 330 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
330 | } | 331 | } |
331 | 332 | ||
332 | void KOPrefs::setTimeZoneIdDefault() | 333 | void KOPrefs::setTimeZoneIdDefault() |
333 | { | 334 | { |
334 | ; | 335 | ; |
335 | } | 336 | } |
336 | 337 | ||
337 | void KOPrefs::setCategoryDefaults() | 338 | void KOPrefs::setCategoryDefaults() |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 8b849fa..6541af2 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -8,256 +8,257 @@ | |||
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | 60 | ||
61 | protected: | 61 | protected: |
62 | void setTimeZoneIdDefault(); | 62 | void setTimeZoneIdDefault(); |
63 | 63 | ||
64 | /** Fill empty mail fields with default values. */ | 64 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 65 | void fillMailDefaults(); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 68 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 69 | object. */ |
70 | KOPrefs(); | 70 | KOPrefs(); |
71 | 71 | ||
72 | static KOPrefs *mInstance; | 72 | static KOPrefs *mInstance; |
73 | QStringList getDefaultList(); | 73 | QStringList getDefaultList(); |
74 | public: | 74 | public: |
75 | // preferences data | 75 | // preferences data |
76 | KConfig* getConfig(); | 76 | KConfig* getConfig(); |
77 | void setFullName(const QString &); | 77 | void setFullName(const QString &); |
78 | QString fullName(); | 78 | QString fullName(); |
79 | void setEmail(const QString &); | 79 | void setEmail(const QString &); |
80 | QString email(); | 80 | QString email(); |
81 | 81 | ||
82 | QString mAdditional; | 82 | QString mAdditional; |
83 | 83 | ||
84 | bool mEmailControlCenter; | 84 | bool mEmailControlCenter; |
85 | 85 | ||
86 | bool mBcc; | 86 | bool mBcc; |
87 | bool mAutoSave; | 87 | bool mAutoSave; |
88 | int mAutoSaveInterval; | 88 | int mAutoSaveInterval; |
89 | bool mConfirm; | 89 | bool mConfirm; |
90 | 90 | ||
91 | bool mEnableGroupScheduling; | 91 | bool mEnableGroupScheduling; |
92 | bool mEnableProjectView; | 92 | bool mEnableProjectView; |
93 | 93 | ||
94 | int mDefaultFormat; | 94 | int mDefaultFormat; |
95 | int mMailClient; | 95 | int mMailClient; |
96 | 96 | ||
97 | int mStartTime; | 97 | int mStartTime; |
98 | int mDefaultDuration; | 98 | int mDefaultDuration; |
99 | int mAlarmTime; | 99 | int mAlarmTime; |
100 | 100 | ||
101 | int mWorkingHoursStart; | 101 | int mWorkingHoursStart; |
102 | int mWorkingHoursEnd; | 102 | int mWorkingHoursEnd; |
103 | bool mExcludeHolidays; | 103 | bool mExcludeHolidays; |
104 | bool mExcludeSaturdays; | 104 | bool mExcludeSaturdays; |
105 | bool mMarcusBainsShowSeconds; | 105 | bool mMarcusBainsShowSeconds; |
106 | 106 | ||
107 | QFont mTimeBarFont; | 107 | QFont mTimeBarFont; |
108 | QFont mMonthViewFont; | 108 | QFont mMonthViewFont; |
109 | QFont mAgendaViewFont; | 109 | QFont mAgendaViewFont; |
110 | QFont mMarcusBainsFont; | 110 | QFont mMarcusBainsFont; |
111 | QFont mTimeLabelsFont; | 111 | QFont mTimeLabelsFont; |
112 | QFont mTodoViewFont; | 112 | QFont mTodoViewFont; |
113 | QFont mListViewFont; | 113 | QFont mListViewFont; |
114 | QFont mDateNavigatorFont; | 114 | QFont mDateNavigatorFont; |
115 | QFont mEditBoxFont; | 115 | QFont mEditBoxFont; |
116 | QFont mJornalViewFont; | 116 | QFont mJornalViewFont; |
117 | QFont mWhatsNextFont; | 117 | QFont mWhatsNextFont; |
118 | QFont mEventViewFont; | 118 | QFont mEventViewFont; |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | QColor mHolidayColor; | 123 | QColor mHolidayColor; |
124 | QColor mHighlightColor; | 124 | QColor mHighlightColor; |
125 | QColor mEventColor; | 125 | QColor mEventColor; |
126 | QColor mTodoDoneColor; | 126 | QColor mTodoDoneColor; |
127 | QColor mAgendaBgColor; | 127 | QColor mAgendaBgColor; |
128 | QColor mWorkingHoursColor; | 128 | QColor mWorkingHoursColor; |
129 | QColor mTodoDueTodayColor; | 129 | QColor mTodoDueTodayColor; |
130 | QColor mTodoOverdueColor; | 130 | QColor mTodoOverdueColor; |
131 | QColor mMonthViewEvenColor; | 131 | QColor mMonthViewEvenColor; |
132 | QColor mMonthViewOddColor; | 132 | QColor mMonthViewOddColor; |
133 | QColor mMonthViewHolidayColor; | 133 | QColor mMonthViewHolidayColor; |
134 | bool mMonthViewUsesDayColors; | 134 | bool mMonthViewUsesDayColors; |
135 | bool mMonthViewSatSunTog; | 135 | bool mMonthViewSatSunTog; |
136 | bool mMonthViewWeek; | ||
136 | QColor mAppColor1; | 137 | QColor mAppColor1; |
137 | QColor mAppColor2; | 138 | QColor mAppColor2; |
138 | bool mUseAppColors; | 139 | bool mUseAppColors; |
139 | 140 | ||
140 | int mDayBegins; | 141 | int mDayBegins; |
141 | int mHourSize; | 142 | int mHourSize; |
142 | int mAllDaySize; | 143 | int mAllDaySize; |
143 | bool mShowFullMenu; | 144 | bool mShowFullMenu; |
144 | bool mDailyRecur; | 145 | bool mDailyRecur; |
145 | bool mWeeklyRecur; | 146 | bool mWeeklyRecur; |
146 | bool mMonthDailyRecur; | 147 | bool mMonthDailyRecur; |
147 | bool mMonthWeeklyRecur; | 148 | bool mMonthWeeklyRecur; |
148 | bool mMonthShowIcons; | 149 | bool mMonthShowIcons; |
149 | bool mMonthShowShort; | 150 | bool mMonthShowShort; |
150 | bool mEnableToolTips; | 151 | bool mEnableToolTips; |
151 | bool mEnableMonthScroll; | 152 | bool mEnableMonthScroll; |
152 | bool mFullViewMonth; | 153 | bool mFullViewMonth; |
153 | bool mMonthViewUsesCategoryColor; | 154 | bool mMonthViewUsesCategoryColor; |
154 | bool mFullViewTodo; | 155 | bool mFullViewTodo; |
155 | bool mShowCompletedTodo; | 156 | bool mShowCompletedTodo; |
156 | bool mMarcusBainsEnabled; | 157 | bool mMarcusBainsEnabled; |
157 | int mNextXDays; | 158 | int mNextXDays; |
158 | int mWhatsNextDays; | 159 | int mWhatsNextDays; |
159 | int mWhatsNextPrios; | 160 | int mWhatsNextPrios; |
160 | bool mEnableQuickTodo; | 161 | bool mEnableQuickTodo; |
161 | 162 | ||
162 | bool mCompactDialogs; | 163 | bool mCompactDialogs; |
163 | bool mVerticalScreen; | 164 | bool mVerticalScreen; |
164 | 165 | ||
165 | bool mShowIconNewTodo; | 166 | bool mShowIconNewTodo; |
166 | bool mShowIconNewEvent; | 167 | bool mShowIconNewEvent; |
167 | bool mShowIconSearch; | 168 | bool mShowIconSearch; |
168 | bool mShowIconList; | 169 | bool mShowIconList; |
169 | bool mShowIconDay1; | 170 | bool mShowIconDay1; |
170 | bool mShowIconDay5; | 171 | bool mShowIconDay5; |
171 | bool mShowIconDay7; | 172 | bool mShowIconDay7; |
172 | bool mShowIconMonth; | 173 | bool mShowIconMonth; |
173 | bool mShowIconTodoview; | 174 | bool mShowIconTodoview; |
174 | bool mShowIconBackFast; | 175 | bool mShowIconBackFast; |
175 | bool mShowIconBack; | 176 | bool mShowIconBack; |
176 | bool mShowIconToday; | 177 | bool mShowIconToday; |
177 | bool mShowIconForward; | 178 | bool mShowIconForward; |
178 | bool mShowIconForwardFast; | 179 | bool mShowIconForwardFast; |
179 | bool mShowIconWhatsThis; | 180 | bool mShowIconWhatsThis; |
180 | bool mShowIconNextDays; | 181 | bool mShowIconNextDays; |
181 | bool mShowIconNext; | 182 | bool mShowIconNext; |
182 | bool mShowIconJournal; | 183 | bool mShowIconJournal; |
183 | 184 | ||
184 | bool mShowIconStretch; | 185 | bool mShowIconStretch; |
185 | 186 | ||
186 | bool mToolBarHor; | 187 | bool mToolBarHor; |
187 | bool mToolBarUp; | 188 | bool mToolBarUp; |
188 | bool mToolBarMiniIcons; | 189 | bool mToolBarMiniIcons; |
189 | 190 | ||
190 | bool mAskForQuit; | 191 | bool mAskForQuit; |
191 | bool mUsePassWd; | 192 | bool mUsePassWd; |
192 | bool mShowSyncEvents; | 193 | bool mShowSyncEvents; |
193 | bool mShowTodoInAgenda; | 194 | bool mShowTodoInAgenda; |
194 | bool mShowTimeInAgenda; | 195 | bool mShowTimeInAgenda; |
195 | bool mHideNonStartedTodos; | 196 | bool mHideNonStartedTodos; |
196 | 197 | ||
197 | int mLastSyncTime; | 198 | int mLastSyncTime; |
198 | void setCategoryColor(QString cat,const QColor & color); | 199 | void setCategoryColor(QString cat,const QColor & color); |
199 | QColor *categoryColor(QString cat); | 200 | QColor *categoryColor(QString cat); |
200 | 201 | ||
201 | QString mArchiveFile; | 202 | QString mArchiveFile; |
202 | QString mHtmlExportFile; | 203 | QString mHtmlExportFile; |
203 | bool mHtmlWithSave; | 204 | bool mHtmlWithSave; |
204 | 205 | ||
205 | QStringList mSelectedPlugins; | 206 | QStringList mSelectedPlugins; |
206 | 207 | ||
207 | QString mLastImportFile; | 208 | QString mLastImportFile; |
208 | QString mLastVcalFile; | 209 | QString mLastVcalFile; |
209 | QString mLastSaveFile; | 210 | QString mLastSaveFile; |
210 | QString mLastLoadFile; | 211 | QString mLastLoadFile; |
211 | 212 | ||
212 | 213 | ||
213 | QString mDefaultAlarmFile; | 214 | QString mDefaultAlarmFile; |
214 | int mIMIPScheduler; | 215 | int mIMIPScheduler; |
215 | int mIMIPSend; | 216 | int mIMIPSend; |
216 | QStringList mAdditionalMails; | 217 | QStringList mAdditionalMails; |
217 | int mIMIPAutoRefresh; | 218 | int mIMIPAutoRefresh; |
218 | int mIMIPAutoInsertReply; | 219 | int mIMIPAutoInsertReply; |
219 | int mIMIPAutoInsertRequest; | 220 | int mIMIPAutoInsertRequest; |
220 | int mIMIPAutoFreeBusy; | 221 | int mIMIPAutoFreeBusy; |
221 | int mIMIPAutoFreeBusyReply; | 222 | int mIMIPAutoFreeBusyReply; |
222 | 223 | ||
223 | QStringList mTodoTemplates; | 224 | QStringList mTodoTemplates; |
224 | QStringList mEventTemplates; | 225 | QStringList mEventTemplates; |
225 | 226 | ||
226 | int mDestination; | 227 | int mDestination; |
227 | 228 | ||
228 | 229 | ||
229 | bool mEditOnDoubleClick; | 230 | bool mEditOnDoubleClick; |
230 | bool mViewChangeHoldFullscreen; | 231 | bool mViewChangeHoldFullscreen; |
231 | bool mViewChangeHoldNonFullscreen; | 232 | bool mViewChangeHoldNonFullscreen; |
232 | bool mCenterOnCurrentTime; | 233 | bool mCenterOnCurrentTime; |
233 | bool mSetTimeToDayStartAt; | 234 | bool mSetTimeToDayStartAt; |
234 | bool mHighlightCurrentDay; | 235 | bool mHighlightCurrentDay; |
235 | bool mUseHighlightLightColor; | 236 | bool mUseHighlightLightColor; |
236 | bool mListViewMonthTimespan; | 237 | bool mListViewMonthTimespan; |
237 | bool mWNViewShowsParents; | 238 | bool mWNViewShowsParents; |
238 | bool mWNViewShowsPast; | 239 | bool mWNViewShowsPast; |
239 | bool mWNViewShowLocation; | 240 | bool mWNViewShowLocation; |
240 | bool mTodoViewShowsPercentage; | 241 | bool mTodoViewShowsPercentage; |
241 | bool mTodoViewUsesCatColors; | 242 | bool mTodoViewUsesCatColors; |
242 | bool mTodoViewUsesSmallFont; | 243 | bool mTodoViewUsesSmallFont; |
243 | bool mTodoViewUsesForegroundColor; | 244 | bool mTodoViewUsesForegroundColor; |
244 | bool mMonthViewUsesForegroundColor; | 245 | bool mMonthViewUsesForegroundColor; |
245 | 246 | ||
246 | bool mHightlightDateTimeEdit; | 247 | bool mHightlightDateTimeEdit; |
247 | bool mShortDateInViewer; | 248 | bool mShortDateInViewer; |
248 | 249 | ||
249 | bool mShowDateNavigator; | 250 | bool mShowDateNavigator; |
250 | 251 | ||
251 | QStringList mLocationDefaults; | 252 | QStringList mLocationDefaults; |
252 | QStringList mEventSummaryUser; | 253 | QStringList mEventSummaryUser; |
253 | QStringList mTodoSummaryUser; | 254 | QStringList mTodoSummaryUser; |
254 | 255 | ||
255 | bool mUseInternalAlarmNotification; | 256 | bool mUseInternalAlarmNotification; |
256 | int mAlarmPlayBeeps; | 257 | int mAlarmPlayBeeps; |
257 | int mAlarmSuspendTime; | 258 | int mAlarmSuspendTime; |
258 | int mAlarmSuspendCount; | 259 | int mAlarmSuspendCount; |
259 | int mAlarmBeepInterval; | 260 | int mAlarmBeepInterval; |
260 | int mOldLanguage; | 261 | int mOldLanguage; |
261 | int mOldLoadedLanguage; | 262 | int mOldLoadedLanguage; |
262 | 263 | ||
263 | 264 | ||
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 7e126d9..6afd203 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -99,259 +99,261 @@ void KOViewManager::readSettings(KConfig *config) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | void KOViewManager::showDateView( int view, QDate date) | 101 | void KOViewManager::showDateView( int view, QDate date) |
102 | { | 102 | { |
103 | static int lastMode = 0; | 103 | static int lastMode = 0; |
104 | static int lastCount = 0; | 104 | static int lastCount = 0; |
105 | static bool lastNDMode = false; | 105 | static bool lastNDMode = false; |
106 | static QDate lastDate; | 106 | static QDate lastDate; |
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 108 | ||
109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
111 | mFlagShowNextxDays = false; | 111 | mFlagShowNextxDays = false; |
112 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
113 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
116 | lastNDMode = savemFlagShowNextxDays; | 116 | lastNDMode = savemFlagShowNextxDays; |
117 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
118 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
119 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
120 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
121 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
122 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
123 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
124 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
125 | mMainView->dateNavigator()->blockSignals( true ); | 125 | mMainView->dateNavigator()->blockSignals( true ); |
126 | showMonthView(); | 126 | showMonthView(); |
127 | mMainView->dateNavigator()->selectMonthByDate( date ); | 127 | mMainView->dateNavigator()->selectMonthByDate( date ); |
128 | mMainView->dateNavigator()->blockSignals( false ); | 128 | mMainView->dateNavigator()->blockSignals( false ); |
129 | mMainView->dateNavigator()->selectDate( date ); | 129 | mMainView->dateNavigator()->selectDate( date ); |
130 | } else if (view == 7 ) { | 130 | } else if (view == 7 ) { |
131 | mMainView->dateNavigator()->selectDate( date ); | 131 | mMainView->dateNavigator()->selectDate( date ); |
132 | showJournalView(); | 132 | showJournalView(); |
133 | } else if (view == 8 ) { | 133 | } else if (view == 8 ) { |
134 | globalFlagBlockAgenda = 1; | 134 | globalFlagBlockAgenda = 1; |
135 | if ( mCurrentAgendaView != 3 ) | 135 | if ( mCurrentAgendaView != 3 ) |
136 | mCurrentAgendaView = -1; | 136 | mCurrentAgendaView = -1; |
137 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 137 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
138 | globalFlagBlockAgenda = 2; | 138 | globalFlagBlockAgenda = 2; |
139 | mMainView->dateNavigator()->selectDates( date , | 139 | mMainView->dateNavigator()->selectDates( date , |
140 | KOPrefs::instance()->mNextXDays ); | 140 | KOPrefs::instance()->mNextXDays ); |
141 | mFlagShowNextxDays = true; | 141 | mFlagShowNextxDays = true; |
142 | mCurrentAgendaView = 3 ; | 142 | mCurrentAgendaView = 3 ; |
143 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 143 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
144 | if ( lastMode ) { | 144 | if ( lastMode ) { |
145 | mCurrentAgendaView = lastCount ; | 145 | mCurrentAgendaView = lastCount ; |
146 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 146 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
147 | mFlagShowNextxDays = lastNDMode; | 147 | mFlagShowNextxDays = lastNDMode; |
148 | if ( mFlagShowNextxDays ) { | 148 | if ( mFlagShowNextxDays ) { |
149 | mCurrentAgendaView = 3 ; | 149 | mCurrentAgendaView = 3 ; |
150 | } | 150 | } |
151 | } else | 151 | } else |
152 | showWeekView(); | 152 | showWeekView(); |
153 | } else if (view == 10) { | 153 | } else if (view == 10) { |
154 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 154 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
155 | } | 155 | } |
156 | lastMode = view; | 156 | lastMode = view; |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | 160 | ||
161 | void KOViewManager::writeSettings(KConfig *config) | 161 | void KOViewManager::writeSettings(KConfig *config) |
162 | { | 162 | { |
163 | config->setGroup("General"); | 163 | config->setGroup("General"); |
164 | 164 | ||
165 | QString view; | 165 | QString view; |
166 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 166 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
167 | else if (mCurrentView == mMonthView) view = "Month"; | 167 | else if (mCurrentView == mMonthView) view = "Month"; |
168 | else if (mCurrentView == mListView) view = "List"; | 168 | else if (mCurrentView == mListView) view = "List"; |
169 | else if (mCurrentView == mJournalView) view = "Journal"; | 169 | else if (mCurrentView == mJournalView) view = "Journal"; |
170 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 170 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
171 | else if (mCurrentView == mTodoView) view = "Todo"; | 171 | else if (mCurrentView == mTodoView) view = "Todo"; |
172 | else view = "Agenda"; | 172 | else view = "Agenda"; |
173 | 173 | ||
174 | config->writeEntry("Current View",view); | 174 | config->writeEntry("Current View",view); |
175 | 175 | ||
176 | if (mAgendaView) { | 176 | if (mAgendaView) { |
177 | mAgendaView->writeSettings(config); | 177 | mAgendaView->writeSettings(config); |
178 | } | 178 | } |
179 | if (mTimeSpanView) { | 179 | if (mTimeSpanView) { |
180 | mTimeSpanView->writeSettings(config); | 180 | mTimeSpanView->writeSettings(config); |
181 | } | 181 | } |
182 | if (mListView) { | 182 | if (mListView) { |
183 | mListView->writeSettings(config); | 183 | mListView->writeSettings(config); |
184 | } | 184 | } |
185 | if (mTodoView) { | 185 | if (mTodoView) { |
186 | mTodoView->saveLayout(config,"Todo View"); | 186 | mTodoView->saveLayout(config,"Todo View"); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 190 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
191 | { | 191 | { |
192 | 192 | ||
193 | //mFlagShowNextxDays = false; | 193 | //mFlagShowNextxDays = false; |
194 | //if(view == mCurrentView) return; | 194 | //if(view == mCurrentView) return; |
195 | if ( view == 0 ) { | 195 | if ( view == 0 ) { |
196 | view = mCurrentView; | 196 | view = mCurrentView; |
197 | if ( view == 0 ) | 197 | if ( view == 0 ) |
198 | return; | 198 | return; |
199 | } | 199 | } |
200 | bool full = fullScreen; | 200 | bool full = fullScreen; |
201 | if(view == mCurrentView && view != mWhatsNextView ) { | 201 | if(view == mCurrentView && view != mWhatsNextView ) { |
202 | if ( mCurrentAgendaView < 0 ) | 202 | if ( mCurrentAgendaView < 0 ) |
203 | return; | 203 | return; |
204 | full = mMainView->leftFrame()->isVisible(); | 204 | full = mMainView->leftFrame()->isVisible(); |
205 | } else { | 205 | } else { |
206 | mCurrentView = view; | 206 | mCurrentView = view; |
207 | // bool full = fullScreen; | 207 | // bool full = fullScreen; |
208 | bool isFull = !mMainView->leftFrame()->isVisible(); | 208 | bool isFull = !mMainView->leftFrame()->isVisible(); |
209 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 209 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
210 | full = true; | 210 | full = true; |
211 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 211 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
212 | full = false; | 212 | full = false; |
213 | } | 213 | } |
214 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 214 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
215 | //raiseCurrentView( full ); | 215 | //raiseCurrentView( full ); |
216 | mMainView->processIncidenceSelection( 0 ); | 216 | mMainView->processIncidenceSelection( 0 ); |
217 | //mMainView->updateView(); | 217 | //mMainView->updateView(); |
218 | raiseCurrentView( full, true ); | 218 | raiseCurrentView( full, true ); |
219 | mMainView->adaptNavigationUnits(); | 219 | mMainView->adaptNavigationUnits(); |
220 | } | 220 | } |
221 | 221 | ||
222 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 222 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
223 | { | 223 | { |
224 | mCurrentAgendaView = 0; | 224 | mCurrentAgendaView = 0; |
225 | int wid = mMainView->width() ; | 225 | int wid = mMainView->width() ; |
226 | int hei = mMainView->height(); | 226 | int hei = mMainView->height(); |
227 | if ( mCurrentView == mMonthView ) { | 227 | if ( mCurrentView == mMonthView ) { |
228 | mMainView->navigatorBar()->show(); | 228 | if ( !KOPrefs::instance()->mMonthViewWeek ) { |
229 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 229 | mMainView->navigatorBar()->show(); |
230 | hei -= mMainView->navigatorBar()->sizeHint().height(); | ||
231 | } | ||
230 | //mMainView->navigatorBar()->hide(); | 232 | //mMainView->navigatorBar()->hide(); |
231 | } else { | 233 | } else { |
232 | mMainView->navigatorBar()->hide(); | 234 | mMainView->navigatorBar()->hide(); |
233 | } | 235 | } |
234 | if ( fullScreen ) { | 236 | if ( fullScreen ) { |
235 | mMainView->leftFrame()->hide(); | 237 | mMainView->leftFrame()->hide(); |
236 | } else { | 238 | } else { |
237 | mMainView->leftFrame()->show(); | 239 | mMainView->leftFrame()->show(); |
238 | if ( KOPrefs::instance()->mVerticalScreen ) | 240 | if ( KOPrefs::instance()->mVerticalScreen ) |
239 | hei -= mMainView->leftFrame()->height(); | 241 | hei -= mMainView->leftFrame()->height(); |
240 | else | 242 | else |
241 | wid -= mMainView->leftFrame()->width(); | 243 | wid -= mMainView->leftFrame()->width(); |
242 | } | 244 | } |
243 | emit signalFullScreen( !fullScreen ); | 245 | emit signalFullScreen( !fullScreen ); |
244 | if ( callUpdateView ) | 246 | if ( callUpdateView ) |
245 | mMainView->updateView(); | 247 | mMainView->updateView(); |
246 | 248 | ||
247 | if ( globalFlagBlockAgenda == 5 ) { | 249 | if ( globalFlagBlockAgenda == 5 ) { |
248 | globalFlagBlockAgenda = 4; | 250 | globalFlagBlockAgenda = 4; |
249 | globalFlagBlockAgendaItemPaint = 1; | 251 | globalFlagBlockAgendaItemPaint = 1; |
250 | } | 252 | } |
251 | mMainView->viewStack()->raiseWidget(mCurrentView); | 253 | mMainView->viewStack()->raiseWidget(mCurrentView); |
252 | if ( globalFlagBlockAgenda == 4 ) { | 254 | if ( globalFlagBlockAgenda == 4 ) { |
253 | if ( mCurrentView == mAgendaView ) { | 255 | if ( mCurrentView == mAgendaView ) { |
254 | //globalFlagBlockAgenda =1 ; | 256 | //globalFlagBlockAgenda =1 ; |
255 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 257 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
256 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 258 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
257 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 259 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
258 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 260 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
259 | qApp->processEvents(); | 261 | qApp->processEvents(); |
260 | //qDebug("qApp->processEvents() "); | 262 | //qDebug("qApp->processEvents() "); |
261 | globalFlagBlockAgenda = 0; | 263 | globalFlagBlockAgenda = 0; |
262 | mAgendaView->repaintAgenda(); | 264 | mAgendaView->repaintAgenda(); |
263 | 265 | ||
264 | } | 266 | } |
265 | globalFlagBlockAgenda = 0; | 267 | globalFlagBlockAgenda = 0; |
266 | } | 268 | } |
267 | emit signalAgendaView( mCurrentView == mAgendaView ); | 269 | emit signalAgendaView( mCurrentView == mAgendaView ); |
268 | //qDebug("raiseCurrentView ende "); | 270 | //qDebug("raiseCurrentView ende "); |
269 | 271 | ||
270 | } | 272 | } |
271 | 273 | ||
272 | void KOViewManager::updateView() | 274 | void KOViewManager::updateView() |
273 | { | 275 | { |
274 | // qDebug("KOViewManager::updateView() "); | 276 | // qDebug("KOViewManager::updateView() "); |
275 | // if we are updating mTodoView, we get endless recursion | 277 | // if we are updating mTodoView, we get endless recursion |
276 | if ( mTodoView == mCurrentView ) | 278 | if ( mTodoView == mCurrentView ) |
277 | return; | 279 | return; |
278 | if ( mCurrentView ) mCurrentView->updateView(); | 280 | if ( mCurrentView ) mCurrentView->updateView(); |
279 | 281 | ||
280 | } | 282 | } |
281 | 283 | ||
282 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 284 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
283 | { | 285 | { |
284 | // kdDebug() << "KOViewManager::updateView()" << endl; | 286 | // kdDebug() << "KOViewManager::updateView()" << endl; |
285 | 287 | ||
286 | if (mCurrentView) mCurrentView->showDates(start, end); | 288 | if (mCurrentView) mCurrentView->showDates(start, end); |
287 | 289 | ||
288 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 290 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
289 | } | 291 | } |
290 | 292 | ||
291 | 293 | ||
292 | void KOViewManager::updateWNview() | 294 | void KOViewManager::updateWNview() |
293 | { | 295 | { |
294 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 296 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
295 | mWhatsNextView->updateView(); | 297 | mWhatsNextView->updateView(); |
296 | 298 | ||
297 | } | 299 | } |
298 | void KOViewManager::showWhatsNextView() | 300 | void KOViewManager::showWhatsNextView() |
299 | { | 301 | { |
300 | if (!mWhatsNextView) { | 302 | if (!mWhatsNextView) { |
301 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 303 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
302 | "KOViewManager::WhatsNextView"); | 304 | "KOViewManager::WhatsNextView"); |
303 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 305 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
304 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 306 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
305 | addView(mWhatsNextView); | 307 | addView(mWhatsNextView); |
306 | connect(this, SIGNAL( printWNV() ), | 308 | connect(this, SIGNAL( printWNV() ), |
307 | mWhatsNextView, SLOT( printMe() ) ); | 309 | mWhatsNextView, SLOT( printMe() ) ); |
308 | } | 310 | } |
309 | globalFlagBlockAgenda = 1; | 311 | globalFlagBlockAgenda = 1; |
310 | showView(mWhatsNextView, true ); | 312 | showView(mWhatsNextView, true ); |
311 | //mWhatsNextView->updateView(); | 313 | //mWhatsNextView->updateView(); |
312 | 314 | ||
313 | } | 315 | } |
314 | 316 | ||
315 | void KOViewManager::showListView() | 317 | void KOViewManager::showListView() |
316 | { | 318 | { |
317 | if (!mListView) { | 319 | if (!mListView) { |
318 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 320 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
319 | addView(mListView); | 321 | addView(mListView); |
320 | 322 | ||
321 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 323 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
322 | mMainView, SLOT(showIncidence(Incidence *))); | 324 | mMainView, SLOT(showIncidence(Incidence *))); |
323 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 325 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
324 | mMainView, SLOT(editIncidence(Incidence *))); | 326 | mMainView, SLOT(editIncidence(Incidence *))); |
325 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 327 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
326 | mMainView, SLOT(deleteIncidence(Incidence *))); | 328 | mMainView, SLOT(deleteIncidence(Incidence *))); |
327 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 329 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
328 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 330 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
329 | connect( mListView, SIGNAL( signalNewEvent() ), | 331 | connect( mListView, SIGNAL( signalNewEvent() ), |
330 | mMainView, SLOT( newEvent() ) ); | 332 | mMainView, SLOT( newEvent() ) ); |
331 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 333 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
332 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 334 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
333 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 335 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
334 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 336 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
335 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 337 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
336 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 338 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
337 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 339 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
338 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 340 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
339 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 341 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
340 | } | 342 | } |
341 | // bool temp = mFlagShowNextxDays; | 343 | // bool temp = mFlagShowNextxDays; |
342 | //globalFlagBlockPainting = true; | 344 | //globalFlagBlockPainting = true; |
343 | globalFlagBlockAgenda = 1; | 345 | globalFlagBlockAgenda = 1; |
344 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 346 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
345 | mMainView->setBlockShowDates( true ); | 347 | mMainView->setBlockShowDates( true ); |
346 | mMainView->dateNavigator()->selectMonth(); | 348 | mMainView->dateNavigator()->selectMonth(); |
347 | mMainView->setBlockShowDates( false ); | 349 | mMainView->setBlockShowDates( false ); |
348 | } | 350 | } |
349 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 351 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
350 | //mFlagShowNextxDays = temp; | 352 | //mFlagShowNextxDays = temp; |
351 | } | 353 | } |
352 | 354 | ||
353 | void KOViewManager::showAgendaView( bool fullScreen ) | 355 | void KOViewManager::showAgendaView( bool fullScreen ) |
354 | { | 356 | { |
355 | 357 | ||
356 | mMainView->dialogManager()->hideSearchDialog(); | 358 | mMainView->dialogManager()->hideSearchDialog(); |
357 | // qDebug("KOViewManager::showAgendaView "); | 359 | // qDebug("KOViewManager::showAgendaView "); |
@@ -402,258 +404,262 @@ void KOViewManager::showAgendaView( bool fullScreen ) | |||
402 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 404 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
403 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 405 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
404 | SLOT( updateTodo( Todo *, int ) ) ); | 406 | SLOT( updateTodo( Todo *, int ) ) ); |
405 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 407 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
406 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 408 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
407 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 409 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
408 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 410 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
409 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 411 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
410 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 412 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
411 | mAgendaView->readSettings(); | 413 | mAgendaView->readSettings(); |
412 | mAgendaView->updateConfig(); | 414 | mAgendaView->updateConfig(); |
413 | } | 415 | } |
414 | 416 | ||
415 | showView( mAgendaView, full); | 417 | showView( mAgendaView, full); |
416 | 418 | ||
417 | } | 419 | } |
418 | 420 | ||
419 | void KOViewManager::showDayView() | 421 | void KOViewManager::showDayView() |
420 | { | 422 | { |
421 | mFlagShowNextxDays = false; | 423 | mFlagShowNextxDays = false; |
422 | globalFlagBlockLabel = 1; | 424 | globalFlagBlockLabel = 1; |
423 | globalFlagBlockAgenda = 1; | 425 | globalFlagBlockAgenda = 1; |
424 | if ( mCurrentAgendaView != 1 ) | 426 | if ( mCurrentAgendaView != 1 ) |
425 | mCurrentAgendaView = -1; | 427 | mCurrentAgendaView = -1; |
426 | showAgendaView(); | 428 | showAgendaView(); |
427 | qApp->processEvents(); | 429 | qApp->processEvents(); |
428 | globalFlagBlockAgenda = 2; | 430 | globalFlagBlockAgenda = 2; |
429 | globalFlagBlockLabel = 0; | 431 | globalFlagBlockLabel = 0; |
430 | mMainView->dateNavigator()->selectDates( 1 ); | 432 | mMainView->dateNavigator()->selectDates( 1 ); |
431 | mCurrentAgendaView = 1 ; | 433 | mCurrentAgendaView = 1 ; |
432 | 434 | ||
433 | } | 435 | } |
434 | 436 | ||
435 | void KOViewManager::showWorkWeekView() | 437 | void KOViewManager::showWorkWeekView() |
436 | { | 438 | { |
437 | mFlagShowNextxDays = false; | 439 | mFlagShowNextxDays = false; |
438 | globalFlagBlockAgenda = 1; | 440 | globalFlagBlockAgenda = 1; |
439 | globalFlagBlockLabel = 1; | 441 | globalFlagBlockLabel = 1; |
440 | if ( mCurrentAgendaView != 5 ) | 442 | if ( mCurrentAgendaView != 5 ) |
441 | mCurrentAgendaView = -1; | 443 | mCurrentAgendaView = -1; |
442 | showAgendaView(); | 444 | showAgendaView(); |
443 | qApp->processEvents(); | 445 | qApp->processEvents(); |
444 | globalFlagBlockAgenda = 2; | 446 | globalFlagBlockAgenda = 2; |
445 | globalFlagBlockLabel = 0; | 447 | globalFlagBlockLabel = 0; |
446 | mMainView->dateNavigator()->selectWorkWeek(); | 448 | mMainView->dateNavigator()->selectWorkWeek(); |
447 | mCurrentAgendaView = 5 ; | 449 | mCurrentAgendaView = 5 ; |
448 | 450 | ||
449 | } | 451 | } |
450 | 452 | ||
451 | void KOViewManager::showWeekView() | 453 | void KOViewManager::showWeekView() |
452 | { | 454 | { |
453 | /* | 455 | /* |
454 | globalFlagBlockAgenda = 2; | 456 | globalFlagBlockAgenda = 2; |
455 | qDebug("4globalFlagBlockAgenda = 2; "); | 457 | qDebug("4globalFlagBlockAgenda = 2; "); |
456 | //globalFlagBlockPainting = true; | 458 | //globalFlagBlockPainting = true; |
457 | mMainView->dateNavigator()->selectWeek(); | 459 | mMainView->dateNavigator()->selectWeek(); |
458 | showAgendaView(); | 460 | showAgendaView(); |
459 | */ | 461 | */ |
460 | 462 | ||
461 | 463 | ||
462 | mFlagShowNextxDays = false; | 464 | mFlagShowNextxDays = false; |
463 | globalFlagBlockAgenda = 1; | 465 | globalFlagBlockAgenda = 1; |
464 | globalFlagBlockLabel = 1; | 466 | globalFlagBlockLabel = 1; |
465 | if ( mCurrentAgendaView != 7 ) | 467 | if ( mCurrentAgendaView != 7 ) |
466 | mCurrentAgendaView = -1; | 468 | mCurrentAgendaView = -1; |
467 | showAgendaView(); | 469 | showAgendaView(); |
468 | qApp->processEvents(); | 470 | qApp->processEvents(); |
469 | globalFlagBlockAgenda = 2; | 471 | globalFlagBlockAgenda = 2; |
470 | globalFlagBlockLabel = 0; | 472 | globalFlagBlockLabel = 0; |
471 | mMainView->dateNavigator()->selectWeek(); | 473 | mMainView->dateNavigator()->selectWeek(); |
472 | mCurrentAgendaView = 7 ; | 474 | mCurrentAgendaView = 7 ; |
473 | } | 475 | } |
474 | 476 | ||
475 | void KOViewManager::showNextXView() | 477 | void KOViewManager::showNextXView() |
476 | { | 478 | { |
477 | 479 | ||
478 | globalFlagBlockAgenda = 1; | 480 | globalFlagBlockAgenda = 1; |
479 | if ( mCurrentAgendaView != 3 ) | 481 | if ( mCurrentAgendaView != 3 ) |
480 | mCurrentAgendaView = -1; | 482 | mCurrentAgendaView = -1; |
481 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 483 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
482 | globalFlagBlockAgenda = 2; | 484 | globalFlagBlockAgenda = 2; |
483 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 485 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
484 | KOPrefs::instance()->mNextXDays ); | 486 | KOPrefs::instance()->mNextXDays ); |
485 | mFlagShowNextxDays = true; | 487 | mFlagShowNextxDays = true; |
486 | mCurrentAgendaView = 3 ; | 488 | mCurrentAgendaView = 3 ; |
487 | } | 489 | } |
488 | bool KOViewManager::showsNextDays() | 490 | bool KOViewManager::showsNextDays() |
489 | { | 491 | { |
490 | return mFlagShowNextxDays; | 492 | return mFlagShowNextxDays; |
491 | } | 493 | } |
492 | void KOViewManager::showMonthView() | 494 | void KOViewManager::showMonthView() |
493 | { | 495 | { |
494 | if (!mMonthView) { | 496 | if (!mMonthView) { |
495 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 497 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
496 | 498 | ||
497 | addView(mMonthView); | 499 | addView(mMonthView); |
498 | // mMonthView->show(); | 500 | // mMonthView->show(); |
499 | // SIGNALS/SLOTS FOR MONTH VIEW | 501 | // SIGNALS/SLOTS FOR MONTH VIEW |
500 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 502 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
501 | mMainView, SLOT(newEvent(QDateTime))); | 503 | mMainView, SLOT(newEvent(QDateTime))); |
502 | 504 | ||
503 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 505 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
504 | mMainView, SLOT(showIncidence(Incidence *))); | 506 | mMainView, SLOT(showIncidence(Incidence *))); |
505 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 507 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
506 | mMainView, SLOT(editIncidence(Incidence *))); | 508 | mMainView, SLOT(editIncidence(Incidence *))); |
507 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 509 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
508 | mMainView, SLOT(deleteIncidence(Incidence *))); | 510 | mMainView, SLOT(deleteIncidence(Incidence *))); |
509 | 511 | ||
510 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 512 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
511 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 513 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
512 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 514 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
513 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 515 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
514 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 516 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
515 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 517 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
516 | 518 | ||
517 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 519 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
518 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 520 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
519 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 521 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
520 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 522 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
521 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 523 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
522 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 524 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
523 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 525 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
524 | mMainView, SLOT ( showDay( QDate ) ) ); | 526 | mMainView, SLOT ( showDay( QDate ) ) ); |
525 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 527 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
526 | connect( mMonthView, SIGNAL(nextMonth() ), | 528 | connect( mMonthView, SIGNAL(nextMonth() ), |
527 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 529 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
528 | connect( mMonthView, SIGNAL(prevMonth() ), | 530 | connect( mMonthView, SIGNAL(prevMonth() ), |
529 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 531 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
530 | mMonthView->updateConfig(); | 532 | connect( mMonthView, SIGNAL( showNavigator(bool) ), |
533 | mMainView, SLOT ( showNavigatorBar(bool) ) ); | ||
531 | } | 534 | } |
532 | 535 | ||
533 | globalFlagBlockAgenda = 1; | 536 | globalFlagBlockAgenda = 1; |
534 | //mFlagShowNextxDays = false; | 537 | //mFlagShowNextxDays = false; |
535 | // if(mMonthView == mCurrentView) return; | 538 | // if(mMonthView == mCurrentView) return; |
536 | mMainView->dateNavigator()->selectMonth(); | 539 | if ( KOPrefs::instance()->mMonthViewWeek ) |
540 | mMainView->dateNavigator()->selectWeek(); | ||
541 | else | ||
542 | mMainView->dateNavigator()->selectMonth(); | ||
537 | 543 | ||
538 | showView(mMonthView, true ); | 544 | showView(mMonthView, true ); |
539 | 545 | ||
540 | } | 546 | } |
541 | 547 | ||
542 | void KOViewManager::showTodoView() | 548 | void KOViewManager::showTodoView() |
543 | { | 549 | { |
544 | //mFlagShowNextxDays = false; | 550 | //mFlagShowNextxDays = false; |
545 | if ( !mTodoView ) { | 551 | if ( !mTodoView ) { |
546 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 552 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
547 | "KOViewManager::TodoView" ); | 553 | "KOViewManager::TodoView" ); |
548 | 554 | ||
549 | addView( mTodoView ); | 555 | addView( mTodoView ); |
550 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 556 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
551 | 557 | ||
552 | // SIGNALS/SLOTS FOR TODO VIEW | 558 | // SIGNALS/SLOTS FOR TODO VIEW |
553 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 559 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
554 | mMainView, SLOT( newTodo() ) ); | 560 | mMainView, SLOT( newTodo() ) ); |
555 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 561 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
556 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 562 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
557 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 563 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
558 | mMainView, SLOT( showTodo( Todo * ) ) ); | 564 | mMainView, SLOT( showTodo( Todo * ) ) ); |
559 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 565 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
560 | mMainView, SLOT( editTodo( Todo * ) ) ); | 566 | mMainView, SLOT( editTodo( Todo * ) ) ); |
561 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 567 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
562 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 568 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
563 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 569 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
564 | mMainView, SLOT( purgeCompleted() ) ); | 570 | mMainView, SLOT( purgeCompleted() ) ); |
565 | 571 | ||
566 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 572 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
567 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 573 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
568 | 574 | ||
569 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 575 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
570 | SLOT( updateConfig() ) ); | 576 | SLOT( updateConfig() ) ); |
571 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 577 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
572 | SLOT( updateTodo( Todo *, int ) ) ); | 578 | SLOT( updateTodo( Todo *, int ) ) ); |
573 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 579 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
574 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 580 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
575 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 581 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
576 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 582 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
577 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 583 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
578 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 584 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
579 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 585 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
580 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 586 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
581 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 587 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
582 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 588 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
583 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 589 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
584 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 590 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
585 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 591 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
586 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 592 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
587 | KConfig *config = KOGlobals::config(); | 593 | KConfig *config = KOGlobals::config(); |
588 | mTodoView->restoreLayout(config,"Todo View"); | 594 | mTodoView->restoreLayout(config,"Todo View"); |
589 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 595 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
590 | } | 596 | } |
591 | 597 | ||
592 | globalFlagBlockAgenda = 1; | 598 | globalFlagBlockAgenda = 1; |
593 | showView( mTodoView, true ); | 599 | showView( mTodoView, true ); |
594 | 600 | ||
595 | } | 601 | } |
596 | 602 | ||
597 | void KOViewManager::showJournalView() | 603 | void KOViewManager::showJournalView() |
598 | { | 604 | { |
599 | //mFlagShowNextxDays = false; | 605 | //mFlagShowNextxDays = false; |
600 | if (!mJournalView) { | 606 | if (!mJournalView) { |
601 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 607 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
602 | "KOViewManager::JournalView"); | 608 | "KOViewManager::JournalView"); |
603 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 609 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
604 | SLOT( updateConfig() ) ); | 610 | SLOT( updateConfig() ) ); |
605 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 611 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
606 | addView(mJournalView); | 612 | addView(mJournalView); |
607 | } | 613 | } |
608 | 614 | ||
609 | showView(mJournalView); | 615 | showView(mJournalView); |
610 | mMainView->dateNavigator()->selectDates( 1 ); | 616 | mMainView->dateNavigator()->selectDates( 1 ); |
611 | } | 617 | } |
612 | 618 | ||
613 | void KOViewManager::showTimeSpanView() | 619 | void KOViewManager::showTimeSpanView() |
614 | { | 620 | { |
615 | //mFlagShowNextxDays = false; | 621 | //mFlagShowNextxDays = false; |
616 | if (!mTimeSpanView) { | 622 | if (!mTimeSpanView) { |
617 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 623 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
618 | "KOViewManager::TimeSpanView"); | 624 | "KOViewManager::TimeSpanView"); |
619 | addView(mTimeSpanView); | 625 | addView(mTimeSpanView); |
620 | 626 | ||
621 | mTimeSpanView->readSettings(); | 627 | mTimeSpanView->readSettings(); |
622 | } | 628 | } |
623 | 629 | ||
624 | showView(mTimeSpanView); | 630 | showView(mTimeSpanView); |
625 | } | 631 | } |
626 | 632 | ||
627 | Incidence *KOViewManager::currentSelection() | 633 | Incidence *KOViewManager::currentSelection() |
628 | { | 634 | { |
629 | if (!mCurrentView) return 0; | 635 | if (!mCurrentView) return 0; |
630 | if ( mCurrentView == mListView ) { | 636 | if ( mCurrentView == mListView ) { |
631 | if ( mListView->currentItem() ) | 637 | if ( mListView->currentItem() ) |
632 | return mListView->currentItem(); | 638 | return mListView->currentItem(); |
633 | } | 639 | } |
634 | return mCurrentView->selectedIncidences().first(); | 640 | return mCurrentView->selectedIncidences().first(); |
635 | } | 641 | } |
636 | 642 | ||
637 | QDate KOViewManager::currentSelectionDate() | 643 | QDate KOViewManager::currentSelectionDate() |
638 | { | 644 | { |
639 | QDate qd; | 645 | QDate qd; |
640 | if (mCurrentView) { | 646 | if (mCurrentView) { |
641 | DateList qvl = mCurrentView->selectedDates(); | 647 | DateList qvl = mCurrentView->selectedDates(); |
642 | if (!qvl.isEmpty()) qd = qvl.first(); | 648 | if (!qvl.isEmpty()) qd = qvl.first(); |
643 | } | 649 | } |
644 | return qd; | 650 | return qd; |
645 | } | 651 | } |
646 | 652 | ||
647 | void KOViewManager::addView(KOrg::BaseView *view) | 653 | void KOViewManager::addView(KOrg::BaseView *view) |
648 | { | 654 | { |
649 | #if QT_VERSION >= 0x030000 | 655 | #if QT_VERSION >= 0x030000 |
650 | mMainView->viewStack()->addWidget( view ); | 656 | mMainView->viewStack()->addWidget( view ); |
651 | #else | 657 | #else |
652 | mMainView->viewStack()->addWidget( view, 1 ); | 658 | mMainView->viewStack()->addWidget( view, 1 ); |
653 | #endif | 659 | #endif |
654 | } | 660 | } |
655 | 661 | ||
656 | void KOViewManager::setDocumentId( const QString &id ) | 662 | void KOViewManager::setDocumentId( const QString &id ) |
657 | { | 663 | { |
658 | if (mTodoView) mTodoView->setDocumentId( id ); | 664 | if (mTodoView) mTodoView->setDocumentId( id ); |
659 | } | 665 | } |