author | zautrix <zautrix> | 2005-03-27 09:46:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-27 09:46:04 (UTC) |
commit | b170a7414ff72016285ea207caa7ccf786530e77 (patch) (unidiff) | |
tree | cb635d155fed20ecb33f877659a00d88bedb309e /korganizer | |
parent | ee6f7d5329658c567882e8e496c65eef8874496e (diff) | |
download | kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.zip kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.gz kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.bz2 |
many fixes
-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 37 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3a16fe6..73aa733 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,1156 +1,1157 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preston.brown@yale.edu) | 8 | Preston Brown (preston.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "datenavigatorcontainer.h" | 110 | #include "datenavigatorcontainer.h" |
111 | #include "statusdialog.h" | 111 | #include "statusdialog.h" |
112 | #include "kdatenavigator.h" | 112 | #include "kdatenavigator.h" |
113 | #include "kotodoview.h" | 113 | #include "kotodoview.h" |
114 | #include "datenavigator.h" | 114 | #include "datenavigator.h" |
115 | #include "resourceview.h" | 115 | #include "resourceview.h" |
116 | #include "navigatorbar.h" | 116 | #include "navigatorbar.h" |
117 | #include "searchdialog.h" | 117 | #include "searchdialog.h" |
118 | #include "mainwindow.h" | 118 | #include "mainwindow.h" |
119 | 119 | ||
120 | #include "calendarview.h" | 120 | #include "calendarview.h" |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | #include <qtopia/alarmserver.h> | 122 | #include <qtopia/alarmserver.h> |
123 | #endif | 123 | #endif |
124 | #ifndef _WIN32_ | 124 | #ifndef _WIN32_ |
125 | #include <stdlib.h> | 125 | #include <stdlib.h> |
126 | #include <stdio.h> | 126 | #include <stdio.h> |
127 | #include <unistd.h> | 127 | #include <unistd.h> |
128 | #else | 128 | #else |
129 | #include <qprocess.h> | 129 | #include <qprocess.h> |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef DESKTOP_VERSION | 132 | #ifdef DESKTOP_VERSION |
133 | #include <kabc/stdaddressbook.h> | 133 | #include <kabc/stdaddressbook.h> |
134 | #endif | 134 | #endif |
135 | using namespace KOrg; | 135 | using namespace KOrg; |
136 | using namespace KCal; | 136 | using namespace KCal; |
137 | extern int globalFlagBlockAgenda; | 137 | extern int globalFlagBlockAgenda; |
138 | extern int globalFlagBlockStartup; | 138 | extern int globalFlagBlockStartup; |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | class KOBeamPrefs : public QDialog | 142 | class KOBeamPrefs : public QDialog |
143 | { | 143 | { |
144 | public: | 144 | public: |
145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 145 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
146 | QDialog( parent, name, true ) | 146 | QDialog( parent, name, true ) |
147 | { | 147 | { |
148 | setCaption( i18n("Beam Options") ); | 148 | setCaption( i18n("Beam Options") ); |
149 | QVBoxLayout* lay = new QVBoxLayout( this ); | 149 | QVBoxLayout* lay = new QVBoxLayout( this ); |
150 | lay->setSpacing( 3 ); | 150 | lay->setSpacing( 3 ); |
151 | lay->setMargin( 3 ); | 151 | lay->setMargin( 3 ); |
152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 152 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
153 | lay->addWidget( format ); | 153 | lay->addWidget( format ); |
154 | format->setExclusive ( true ) ; | 154 | format->setExclusive ( true ) ; |
155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 155 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
156 | lay->addWidget( time ); time->setExclusive ( true ) ; | 156 | lay->addWidget( time ); time->setExclusive ( true ) ; |
157 | vcal = new QRadioButton(" vCalendar ", format ); | 157 | vcal = new QRadioButton(" vCalendar ", format ); |
158 | ical = new QRadioButton(" iCalendar ", format ); | 158 | ical = new QRadioButton(" iCalendar ", format ); |
159 | vcal->setChecked( true ); | 159 | vcal->setChecked( true ); |
160 | tz = new QRadioButton(i18n(" With timezone "), time ); | 160 | tz = new QRadioButton(i18n(" With timezone "), time ); |
161 | local = new QRadioButton(i18n(" Local time "), time ); | 161 | local = new QRadioButton(i18n(" Local time "), time ); |
162 | tz->setChecked( true ); | 162 | tz->setChecked( true ); |
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 164 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 166 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 169 | resize( 200, 200 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 172 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 173 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 174 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 176 | }; |
177 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
178 | { | 178 | { |
179 | public: | 179 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
182 | { | 182 | { |
183 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
202 | } | 202 | } |
203 | 203 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 205 | private: |
206 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 211 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 212 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 213 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 214 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 215 | mResourceManager( calendar->resourceManager() ) |
216 | { | 216 | { |
217 | 217 | ||
218 | mEventEditor = 0; | 218 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 219 | mTodoEditor = 0; |
220 | 220 | ||
221 | init(); | 221 | init(); |
222 | } | 222 | } |
223 | 223 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 224 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 225 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 226 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 227 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 228 | mResourceManager( 0 ) |
229 | { | 229 | { |
230 | 230 | ||
231 | mEventEditor = 0; | 231 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 232 | mTodoEditor = 0; |
233 | init(); | 233 | init(); |
234 | } | 234 | } |
235 | 235 | ||
236 | void CalendarView::init() | 236 | void CalendarView::init() |
237 | { | 237 | { |
238 | 238 | mNextAlarmDateTime = QDateTime::currentDateTime(); | |
239 | setFocusPolicy ( WheelFocus ); | 239 | setFocusPolicy ( WheelFocus ); |
240 | mViewerCallerIsSearchDialog = false; | 240 | mViewerCallerIsSearchDialog = false; |
241 | mBlockShowDates = false; | 241 | mBlockShowDates = false; |
242 | beamDialog = new KOBeamPrefs(); | 242 | beamDialog = new KOBeamPrefs(); |
243 | mDatePickerMode = 0; | 243 | mDatePickerMode = 0; |
244 | mCurrentSyncDevice = ""; | 244 | mCurrentSyncDevice = ""; |
245 | writeLocale(); | 245 | writeLocale(); |
246 | mViewManager = new KOViewManager( this ); | 246 | mViewManager = new KOViewManager( this ); |
247 | mDialogManager = new KODialogManager( this ); | 247 | mDialogManager = new KODialogManager( this ); |
248 | mEventViewerDialog = 0; | 248 | mEventViewerDialog = 0; |
249 | mModified = false; | 249 | mModified = false; |
250 | mReadOnly = false; | 250 | mReadOnly = false; |
251 | mSelectedIncidence = 0; | 251 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 252 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 253 | mFilters.setAutoDelete(true); |
254 | 254 | ||
255 | mCalendar->registerObserver( this ); | 255 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 256 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 257 | ||
258 | mStorage = new FileStorage( mCalendar ); | 258 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 260 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 262 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 263 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 265 | topLayout->addWidget(mPanner); |
266 | 266 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 268 | "CalendarView::LeftFrame"); |
269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
270 | 270 | ||
271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
272 | "CalendarView::DateNavigator" ); | 272 | "CalendarView::DateNavigator" ); |
273 | 273 | ||
274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
276 | mTodoList->setNavigator( mNavigator ); | 276 | mTodoList->setNavigator( mNavigator ); |
277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
278 | 278 | ||
279 | #ifdef KORG_NORESOURCEVIEW | 279 | #ifdef KORG_NORESOURCEVIEW |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | #else | 281 | #else |
282 | if ( mResourceManager ) { | 282 | if ( mResourceManager ) { |
283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
284 | mResourceView->updateView(); | 284 | mResourceView->updateView(); |
285 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 285 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
286 | SLOT( updateView() ) ); | 286 | SLOT( updateView() ) ); |
287 | } else { | 287 | } else { |
288 | mResourceView = 0; | 288 | mResourceView = 0; |
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | QWidget *rightBox = new QWidget( mPanner ); | 291 | QWidget *rightBox = new QWidget( mPanner ); |
292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
293 | 293 | ||
294 | mRightFrame = new QWidgetStack( rightBox ); | 294 | mRightFrame = new QWidgetStack( rightBox ); |
295 | rightLayout->addWidget( mRightFrame, 1 ); | 295 | rightLayout->addWidget( mRightFrame, 1 ); |
296 | 296 | ||
297 | mLeftFrame = mLeftSplitter; | 297 | mLeftFrame = mLeftSplitter; |
298 | #else | 298 | #else |
299 | //QWidget *mainBox = new QWidget( this ); | 299 | //QWidget *mainBox = new QWidget( this ); |
300 | //QWidget *leftFrame = new QWidget( mainBox ); | 300 | //QWidget *leftFrame = new QWidget( mainBox ); |
301 | //QBoxLayout * mainBoxLayout; | 301 | //QBoxLayout * mainBoxLayout; |
302 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
303 | //mainBoxLayout = new QVBoxLayout(mainBox); | 303 | //mainBoxLayout = new QVBoxLayout(mainBox); |
304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 304 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 305 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 306 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 307 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 308 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
309 | } else { | 309 | } else { |
310 | //mainBoxLayout = new QHBoxLayout(mainBox); | 310 | //mainBoxLayout = new QHBoxLayout(mainBox); |
311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 311 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 312 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 313 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 314 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 315 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
316 | } | 316 | } |
317 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 317 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
318 | //QBoxLayout * leftFrameLayout; | 318 | //QBoxLayout * leftFrameLayout; |
319 | topLayout->addWidget( mMainFrame ); | 319 | topLayout->addWidget( mMainFrame ); |
320 | //mainBoxLayout->addWidget (mLeftFrame); | 320 | //mainBoxLayout->addWidget (mLeftFrame); |
321 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 321 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
322 | "CalendarView::DateNavigator" ); | 322 | "CalendarView::DateNavigator" ); |
323 | #if 0 | 323 | #if 0 |
324 | // FIXME | 324 | // FIXME |
325 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 325 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
326 | "CalendarView::DateNavigator", QDate::currentDate()); | 326 | "CalendarView::DateNavigator", QDate::currentDate()); |
327 | #endif | 327 | #endif |
328 | // mDateNavigator->blockSignals( true ); | 328 | // mDateNavigator->blockSignals( true ); |
329 | //leftFrameLayout->addWidget( mDateNavigator ); | 329 | //leftFrameLayout->addWidget( mDateNavigator ); |
330 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 330 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
331 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 331 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
332 | mTodoList->setNavigator( mNavigator ); | 332 | mTodoList->setNavigator( mNavigator ); |
333 | #if 0 | 333 | #if 0 |
334 | if ( QApplication::desktop()->width() < 480 ) { | 334 | if ( QApplication::desktop()->width() < 480 ) { |
335 | leftFrameLayout->addWidget(mFilterView); | 335 | leftFrameLayout->addWidget(mFilterView); |
336 | leftFrameLayout->addWidget(mTodoList, 2 ); | 336 | leftFrameLayout->addWidget(mTodoList, 2 ); |
337 | 337 | ||
338 | } else { | 338 | } else { |
339 | leftFrameLayout->addWidget(mTodoList,2 ); | 339 | leftFrameLayout->addWidget(mTodoList,2 ); |
340 | leftFrameLayout->addWidget(mFilterView ); | 340 | leftFrameLayout->addWidget(mFilterView ); |
341 | } | 341 | } |
342 | #endif | 342 | #endif |
343 | mFilterView->hide(); | 343 | mFilterView->hide(); |
344 | QWidget *rightBox = new QWidget( mMainFrame ); | 344 | QWidget *rightBox = new QWidget( mMainFrame ); |
345 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 345 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
346 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 346 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
347 | mRightFrame = new QWidgetStack( rightBox ); | 347 | mRightFrame = new QWidgetStack( rightBox ); |
348 | rightLayout->addWidget( mRightFrame, 10 ); | 348 | rightLayout->addWidget( mRightFrame, 10 ); |
349 | 349 | ||
350 | //mLeftFrame = (QWidget *)leftFrame; | 350 | //mLeftFrame = (QWidget *)leftFrame; |
351 | if ( KOPrefs::instance()->mVerticalScreen ) { | 351 | if ( KOPrefs::instance()->mVerticalScreen ) { |
352 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 352 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
353 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 353 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
354 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 354 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
355 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 355 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
356 | } else { | 356 | } else { |
357 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 357 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
358 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 358 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
359 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 359 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
360 | } | 360 | } |
361 | if ( !KOPrefs::instance()->mShowDateNavigator) | 361 | if ( !KOPrefs::instance()->mShowDateNavigator) |
362 | mDateNavigator->hide(); | 362 | mDateNavigator->hide(); |
363 | //qDebug("Calendarview Size %d %d ", width(), height()); | 363 | //qDebug("Calendarview Size %d %d ", width(), height()); |
364 | #endif | 364 | #endif |
365 | 365 | ||
366 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 366 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
367 | SLOT( showDates( const KCal::DateList & ) ) ); | 367 | SLOT( showDates( const KCal::DateList & ) ) ); |
368 | 368 | ||
369 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 369 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
370 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 370 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 374 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
375 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 375 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
376 | 376 | ||
377 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 377 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
378 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 378 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
379 | 379 | ||
380 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 380 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
381 | mNavigator, SLOT( selectPreviousYear() ) ); | 381 | mNavigator, SLOT( selectPreviousYear() ) ); |
382 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 382 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
383 | mNavigator, SLOT( selectNextYear() ) ); | 383 | mNavigator, SLOT( selectNextYear() ) ); |
384 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 384 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
385 | mNavigator, SLOT( selectPreviousMonth() ) ); | 385 | mNavigator, SLOT( selectPreviousMonth() ) ); |
386 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 386 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
387 | mNavigator, SLOT( selectNextMonth() ) ); | 387 | mNavigator, SLOT( selectNextMonth() ) ); |
388 | 388 | ||
389 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 389 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
390 | mNavigator, SLOT( selectPrevious() ) ); | 390 | mNavigator, SLOT( selectPrevious() ) ); |
391 | connect( mDateNavigator, SIGNAL( goNext() ), | 391 | connect( mDateNavigator, SIGNAL( goNext() ), |
392 | mNavigator, SLOT( selectNext() ) ); | 392 | mNavigator, SLOT( selectNext() ) ); |
393 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 393 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
394 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 394 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
395 | 395 | ||
396 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 396 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
397 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 397 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
398 | #if 0 | 398 | #if 0 |
399 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 399 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
400 | SLOT( incidenceAdded( Incidence *) ) ); | 400 | SLOT( incidenceAdded( Incidence *) ) ); |
401 | #endif | 401 | #endif |
402 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 402 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
403 | 403 | ||
404 | connect( this, SIGNAL( configChanged() ), | 404 | connect( this, SIGNAL( configChanged() ), |
405 | mDateNavigator, SLOT( updateConfig() ) ); | 405 | mDateNavigator, SLOT( updateConfig() ) ); |
406 | 406 | ||
407 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 407 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
408 | SLOT( newTodo() ) ); | 408 | SLOT( newTodo() ) ); |
409 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 409 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
410 | SLOT( newSubTodo( Todo * ) ) ); | 410 | SLOT( newSubTodo( Todo * ) ) ); |
411 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 411 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
412 | SLOT( editTodo( Todo * ) ) ); | 412 | SLOT( editTodo( Todo * ) ) ); |
413 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 413 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
414 | SLOT( showTodo( Todo *) ) ); | 414 | SLOT( showTodo( Todo *) ) ); |
415 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 415 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
416 | SLOT( deleteTodo( Todo *) ) ); | 416 | SLOT( deleteTodo( Todo *) ) ); |
417 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 417 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
418 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 418 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
419 | SLOT( purgeCompleted() ) ); | 419 | SLOT( purgeCompleted() ) ); |
420 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 420 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
421 | SIGNAL( todoModified( Todo *, int ) ) ); | 421 | SIGNAL( todoModified( Todo *, int ) ) ); |
422 | 422 | ||
423 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 423 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
424 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 424 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
425 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 425 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
426 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 426 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
427 | 427 | ||
428 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 428 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
429 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 429 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
430 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 430 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
431 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 431 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
432 | 432 | ||
433 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 433 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
434 | this, SLOT ( todo_unsub( Todo * ) ) ); | 434 | this, SLOT ( todo_unsub( Todo * ) ) ); |
435 | 435 | ||
436 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 436 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
437 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 437 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
438 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 438 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
439 | SLOT( updateTodo( Todo *, int ) ) ); | 439 | SLOT( updateTodo( Todo *, int ) ) ); |
440 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 440 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
441 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 441 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
442 | 442 | ||
443 | 443 | ||
444 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 444 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
445 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 445 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
446 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 446 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
447 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 447 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | 451 | ||
452 | 452 | ||
453 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 453 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
454 | SLOT(checkClipboard())); | 454 | SLOT(checkClipboard())); |
455 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 455 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
456 | SLOT( processTodoListSelection( Incidence * ) ) ); | 456 | SLOT( processTodoListSelection( Incidence * ) ) ); |
457 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 457 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
458 | 458 | ||
459 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 459 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
460 | 460 | ||
461 | mDateFrame = new QVBox(0,0,WType_Popup); | 461 | mDateFrame = new QVBox(0,0,WType_Popup); |
462 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 462 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
463 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 463 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
464 | mDateFrame->setLineWidth(3); | 464 | mDateFrame->setLineWidth(3); |
465 | mDateFrame->hide(); | 465 | mDateFrame->hide(); |
466 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 466 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
467 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 467 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
468 | 468 | ||
469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
470 | 470 | ||
471 | mEventEditor = mDialogManager->getEventEditor(); | 471 | mEventEditor = mDialogManager->getEventEditor(); |
472 | mTodoEditor = mDialogManager->getTodoEditor(); | 472 | mTodoEditor = mDialogManager->getTodoEditor(); |
473 | 473 | ||
474 | mFlagEditDescription = false; | 474 | mFlagEditDescription = false; |
475 | 475 | ||
476 | mSuspendTimer = new QTimer( this ); | 476 | mSuspendTimer = new QTimer( this ); |
477 | mAlarmTimer = new QTimer( this ); | 477 | mAlarmTimer = new QTimer( this ); |
478 | mRecheckAlarmTimer = new QTimer( this ); | 478 | mRecheckAlarmTimer = new QTimer( this ); |
479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
482 | mAlarmDialog = new AlarmDialog( this ); | 482 | mAlarmDialog = new AlarmDialog( this ); |
483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
484 | mAlarmDialog->setServerNotification( false ); | 484 | mAlarmDialog->setServerNotification( false ); |
485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
486 | 486 | ||
487 | 487 | ||
488 | #ifndef DESKTOP_VERSION | 488 | #ifndef DESKTOP_VERSION |
489 | //US listen for arriving address resultsets | 489 | //US listen for arriving address resultsets |
490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
492 | #endif | 492 | #endif |
493 | mDateNavigator->setCalendar( mCalendar ); | 493 | mDateNavigator->setCalendar( mCalendar ); |
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | CalendarView::~CalendarView() | 497 | CalendarView::~CalendarView() |
498 | { | 498 | { |
499 | // kdDebug() << "~CalendarView()" << endl; | 499 | // kdDebug() << "~CalendarView()" << endl; |
500 | //qDebug("CalendarView::~CalendarView() "); | 500 | //qDebug("CalendarView::~CalendarView() "); |
501 | delete mDialogManager; | 501 | delete mDialogManager; |
502 | delete mViewManager; | 502 | delete mViewManager; |
503 | delete mStorage; | 503 | delete mStorage; |
504 | delete mDateFrame ; | 504 | delete mDateFrame ; |
505 | delete beamDialog; | 505 | delete beamDialog; |
506 | delete mEventViewerDialog; | 506 | delete mEventViewerDialog; |
507 | //kdDebug() << "~CalendarView() done" << endl; | 507 | //kdDebug() << "~CalendarView() done" << endl; |
508 | } | 508 | } |
509 | 509 | ||
510 | void CalendarView::showDay( QDate d ) | 510 | void CalendarView::showDay( QDate d ) |
511 | { | 511 | { |
512 | dateNavigator()->blockSignals( true ); | 512 | dateNavigator()->blockSignals( true ); |
513 | dateNavigator()->selectDate( d ); | 513 | dateNavigator()->selectDate( d ); |
514 | dateNavigator()->blockSignals( false ); | 514 | dateNavigator()->blockSignals( false ); |
515 | mViewManager->showDayView(); | 515 | mViewManager->showDayView(); |
516 | //dateNavigator()->selectDate( d ); | 516 | //dateNavigator()->selectDate( d ); |
517 | } | 517 | } |
518 | void CalendarView::timerAlarm() | 518 | void CalendarView::timerAlarm() |
519 | { | 519 | { |
520 | //qDebug("CalendarView::timerAlarm() "); | 520 | //qDebug("CalendarView::timerAlarm() "); |
521 | computeAlarm(mAlarmNotification ); | 521 | computeAlarm(mAlarmNotification ); |
522 | } | 522 | } |
523 | 523 | ||
524 | void CalendarView::suspendAlarm() | 524 | void CalendarView::suspendAlarm() |
525 | { | 525 | { |
526 | //qDebug(" CalendarView::suspendAlarm() "); | 526 | //qDebug(" CalendarView::suspendAlarm() "); |
527 | computeAlarm(mSuspendAlarmNotification ); | 527 | computeAlarm(mSuspendAlarmNotification ); |
528 | 528 | ||
529 | } | 529 | } |
530 | 530 | ||
531 | void CalendarView::startAlarm( QString mess , QString filename) | 531 | void CalendarView::startAlarm( QString mess , QString filename) |
532 | { | 532 | { |
533 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 533 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
534 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 534 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
535 | 535 | ||
536 | } | 536 | } |
537 | 537 | ||
538 | void CalendarView::checkNextTimerAlarm() | 538 | void CalendarView::checkNextTimerAlarm() |
539 | { | 539 | { |
540 | mCalendar->checkAlarmForIncidence( 0, true ); | 540 | mCalendar->checkAlarmForIncidence( 0, true ); |
541 | } | 541 | } |
542 | 542 | ||
543 | void CalendarView::computeAlarm( QString msg ) | 543 | void CalendarView::computeAlarm( QString msg ) |
544 | { | 544 | { |
545 | 545 | ||
546 | QString mess = msg; | 546 | QString mess = msg; |
547 | QString mAlarmMessage = mess.mid( 9 ); | 547 | QString mAlarmMessage = mess.mid( 9 ); |
548 | QString filename = MainWindow::resourcePath(); | 548 | QString filename = MainWindow::resourcePath(); |
549 | filename += "koalarm.wav"; | 549 | filename += "koalarm.wav"; |
550 | QString tempfilename; | 550 | QString tempfilename; |
551 | if ( mess.left( 13 ) == "suspend_alarm") { | 551 | if ( mess.left( 13 ) == "suspend_alarm") { |
552 | bool error = false; | 552 | bool error = false; |
553 | int len = mess.mid( 13 ).find("+++"); | 553 | int len = mess.mid( 13 ).find("+++"); |
554 | if ( len < 2 ) | 554 | if ( len < 2 ) |
555 | error = true; | 555 | error = true; |
556 | else { | 556 | else { |
557 | tempfilename = mess.mid( 13, len ); | 557 | tempfilename = mess.mid( 13, len ); |
558 | if ( !QFile::exists( tempfilename ) ) | 558 | if ( !QFile::exists( tempfilename ) ) |
559 | error = true; | 559 | error = true; |
560 | } | 560 | } |
561 | if ( ! error ) { | 561 | if ( ! error ) { |
562 | filename = tempfilename; | 562 | filename = tempfilename; |
563 | } | 563 | } |
564 | mAlarmMessage = mess.mid( 13+len+3 ); | 564 | mAlarmMessage = mess.mid( 13+len+3 ); |
565 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 565 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
566 | startAlarm( mAlarmMessage, filename); | 566 | startAlarm( mAlarmMessage, filename); |
567 | return; | 567 | return; |
568 | } | 568 | } |
569 | if ( mess.left( 11 ) == "timer_alarm") { | 569 | if ( mess.left( 11 ) == "timer_alarm") { |
570 | //mTimerTime = 0; | 570 | //mTimerTime = 0; |
571 | startAlarm( mess.mid( 11 ), filename ); | 571 | startAlarm( mess.mid( 11 ), filename ); |
572 | return; | 572 | return; |
573 | } | 573 | } |
574 | if ( mess.left( 10 ) == "proc_alarm") { | 574 | if ( mess.left( 10 ) == "proc_alarm") { |
575 | bool error = false; | 575 | bool error = false; |
576 | int len = mess.mid( 10 ).find("+++"); | 576 | int len = mess.mid( 10 ).find("+++"); |
577 | if ( len < 2 ) | 577 | if ( len < 2 ) |
578 | error = true; | 578 | error = true; |
579 | else { | 579 | else { |
580 | tempfilename = mess.mid( 10, len ); | 580 | tempfilename = mess.mid( 10, len ); |
581 | if ( !QFile::exists( tempfilename ) ) | 581 | if ( !QFile::exists( tempfilename ) ) |
582 | error = true; | 582 | error = true; |
583 | } | 583 | } |
584 | if ( error ) { | 584 | if ( error ) { |
585 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 585 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
586 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 586 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
587 | } else { | 587 | } else { |
588 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 588 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
589 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 589 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
590 | #ifndef _WIN32_ | 590 | #ifndef _WIN32_ |
591 | if ( vfork () == 0 ) { | 591 | if ( vfork () == 0 ) { |
592 | execl ( tempfilename.latin1(), 0 ); | 592 | execl ( tempfilename.latin1(), 0 ); |
593 | return; | 593 | return; |
594 | } | 594 | } |
595 | #else | 595 | #else |
596 | QProcess* p = new QProcess(); | 596 | QProcess* p = new QProcess(); |
597 | p->addArgument( tempfilename.latin1() ); | 597 | p->addArgument( tempfilename.latin1() ); |
598 | p->start(); | 598 | p->start(); |
599 | return; | 599 | return; |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | 604 | ||
605 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 605 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
606 | } | 606 | } |
607 | if ( mess.left( 11 ) == "audio_alarm") { | 607 | if ( mess.left( 11 ) == "audio_alarm") { |
608 | bool error = false; | 608 | bool error = false; |
609 | int len = mess.mid( 11 ).find("+++"); | 609 | int len = mess.mid( 11 ).find("+++"); |
610 | if ( len < 2 ) | 610 | if ( len < 2 ) |
611 | error = true; | 611 | error = true; |
612 | else { | 612 | else { |
613 | tempfilename = mess.mid( 11, len ); | 613 | tempfilename = mess.mid( 11, len ); |
614 | if ( !QFile::exists( tempfilename ) ) | 614 | if ( !QFile::exists( tempfilename ) ) |
615 | error = true; | 615 | error = true; |
616 | } | 616 | } |
617 | if ( ! error ) { | 617 | if ( ! error ) { |
618 | filename = tempfilename; | 618 | filename = tempfilename; |
619 | } | 619 | } |
620 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 620 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
621 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 621 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
622 | } | 622 | } |
623 | if ( mess.left( 9 ) == "cal_alarm") { | 623 | if ( mess.left( 9 ) == "cal_alarm") { |
624 | mAlarmMessage = mess.mid( 9 ) ; | 624 | mAlarmMessage = mess.mid( 9 ) ; |
625 | } | 625 | } |
626 | 626 | ||
627 | startAlarm( mAlarmMessage, filename ); | 627 | startAlarm( mAlarmMessage, filename ); |
628 | 628 | ||
629 | 629 | ||
630 | } | 630 | } |
631 | 631 | ||
632 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 632 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
633 | { | 633 | { |
634 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 634 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
635 | 635 | ||
636 | mSuspendAlarmNotification = noti; | 636 | mSuspendAlarmNotification = noti; |
637 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 637 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
638 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 638 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
639 | mSuspendTimer->start( ms , true ); | 639 | mSuspendTimer->start( ms , true ); |
640 | 640 | ||
641 | } | 641 | } |
642 | 642 | ||
643 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 643 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
644 | { | 644 | { |
645 | mNextAlarmDateTime = qdt; | ||
645 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 646 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
646 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 647 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
647 | #ifndef DESKTOP_VERSION | 648 | #ifndef DESKTOP_VERSION |
648 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 649 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
649 | #endif | 650 | #endif |
650 | return; | 651 | return; |
651 | } | 652 | } |
652 | int maxSec; | 653 | int maxSec; |
653 | //maxSec = 5; //testing only | 654 | //maxSec = 5; //testing only |
654 | maxSec = 86400+3600; // one day+1hour | 655 | maxSec = 86400+3600; // one day+1hour |
655 | mAlarmNotification = noti; | 656 | mAlarmNotification = noti; |
656 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 657 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
657 | if ( sec > maxSec ) { | 658 | if ( sec > maxSec ) { |
658 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 659 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
659 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 660 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
660 | return; | 661 | return; |
661 | } else { | 662 | } else { |
662 | mRecheckAlarmTimer->stop(); | 663 | mRecheckAlarmTimer->stop(); |
663 | } | 664 | } |
664 | //qDebug("Alarm timer started with secs: %d ", sec); | 665 | //qDebug("Alarm timer started with secs: %d ", sec); |
665 | mAlarmTimer->start( sec *1000 , true ); | 666 | mAlarmTimer->start( sec *1000 , true ); |
666 | 667 | ||
667 | } | 668 | } |
668 | // called by mRecheckAlarmTimer to get next alarm | 669 | // called by mRecheckAlarmTimer to get next alarm |
669 | // we need this, because a QTimer has only a max range of 25 days | 670 | // we need this, because a QTimer has only a max range of 25 days |
670 | void CalendarView::recheckTimerAlarm() | 671 | void CalendarView::recheckTimerAlarm() |
671 | { | 672 | { |
672 | mAlarmTimer->stop(); | 673 | mAlarmTimer->stop(); |
673 | mRecheckAlarmTimer->stop(); | 674 | mRecheckAlarmTimer->stop(); |
674 | mCalendar->checkAlarmForIncidence( 0, true ); | 675 | mCalendar->checkAlarmForIncidence( 0, true ); |
675 | } | 676 | } |
676 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 677 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
677 | { | 678 | { |
678 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 679 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
679 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 680 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
680 | #ifndef DESKTOP_VERSION | 681 | #ifndef DESKTOP_VERSION |
681 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 682 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
682 | #endif | 683 | #endif |
683 | return; | 684 | return; |
684 | } | 685 | } |
685 | mAlarmTimer->stop(); | 686 | mAlarmTimer->stop(); |
686 | } | 687 | } |
687 | void CalendarView::selectWeekNum ( int num ) | 688 | void CalendarView::selectWeekNum ( int num ) |
688 | { | 689 | { |
689 | dateNavigator()->blockSignals( true ); | 690 | dateNavigator()->blockSignals( true ); |
690 | dateNavigator()->selectWeek( num ); | 691 | dateNavigator()->selectWeek( num ); |
691 | dateNavigator()->blockSignals( false ); | 692 | dateNavigator()->blockSignals( false ); |
692 | mViewManager->showWeekView(); | 693 | mViewManager->showWeekView(); |
693 | } | 694 | } |
694 | KOViewManager *CalendarView::viewManager() | 695 | KOViewManager *CalendarView::viewManager() |
695 | { | 696 | { |
696 | return mViewManager; | 697 | return mViewManager; |
697 | } | 698 | } |
698 | 699 | ||
699 | KODialogManager *CalendarView::dialogManager() | 700 | KODialogManager *CalendarView::dialogManager() |
700 | { | 701 | { |
701 | return mDialogManager; | 702 | return mDialogManager; |
702 | } | 703 | } |
703 | 704 | ||
704 | QDate CalendarView::startDate() | 705 | QDate CalendarView::startDate() |
705 | { | 706 | { |
706 | DateList dates = mNavigator->selectedDates(); | 707 | DateList dates = mNavigator->selectedDates(); |
707 | 708 | ||
708 | return dates.first(); | 709 | return dates.first(); |
709 | } | 710 | } |
710 | 711 | ||
711 | QDate CalendarView::endDate() | 712 | QDate CalendarView::endDate() |
712 | { | 713 | { |
713 | DateList dates = mNavigator->selectedDates(); | 714 | DateList dates = mNavigator->selectedDates(); |
714 | 715 | ||
715 | return dates.last(); | 716 | return dates.last(); |
716 | } | 717 | } |
717 | 718 | ||
718 | 719 | ||
719 | void CalendarView::createPrinter() | 720 | void CalendarView::createPrinter() |
720 | { | 721 | { |
721 | #ifndef KORG_NOPRINTER | 722 | #ifndef KORG_NOPRINTER |
722 | if (!mCalPrinter) { | 723 | if (!mCalPrinter) { |
723 | mCalPrinter = new CalPrinter(this, mCalendar); | 724 | mCalPrinter = new CalPrinter(this, mCalendar); |
724 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 725 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
725 | } | 726 | } |
726 | #endif | 727 | #endif |
727 | } | 728 | } |
728 | 729 | ||
729 | 730 | ||
730 | //KOPrefs::instance()->mWriteBackFile | 731 | //KOPrefs::instance()->mWriteBackFile |
731 | //KOPrefs::instance()->mWriteBackExistingOnly | 732 | //KOPrefs::instance()->mWriteBackExistingOnly |
732 | 733 | ||
733 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 734 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
734 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 735 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
735 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 736 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
736 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 737 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
737 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 738 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
738 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 739 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
739 | 740 | ||
740 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 741 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
741 | { | 742 | { |
742 | 743 | ||
743 | // 0 equal | 744 | // 0 equal |
744 | // 1 take local | 745 | // 1 take local |
745 | // 2 take remote | 746 | // 2 take remote |
746 | // 3 cancel | 747 | // 3 cancel |
747 | QDateTime lastSync = mLastCalendarSync; | 748 | QDateTime lastSync = mLastCalendarSync; |
748 | QDateTime localMod = local->lastModified(); | 749 | QDateTime localMod = local->lastModified(); |
749 | QDateTime remoteMod = remote->lastModified(); | 750 | QDateTime remoteMod = remote->lastModified(); |
750 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 751 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
751 | bool remCh, locCh; | 752 | bool remCh, locCh; |
752 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 753 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
753 | //if ( remCh ) | 754 | //if ( remCh ) |
754 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 755 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
755 | locCh = ( localMod > mLastCalendarSync ); | 756 | locCh = ( localMod > mLastCalendarSync ); |
756 | if ( !remCh && ! locCh ) { | 757 | if ( !remCh && ! locCh ) { |
757 | //qDebug("both not changed "); | 758 | //qDebug("both not changed "); |
758 | lastSync = localMod.addDays(1); | 759 | lastSync = localMod.addDays(1); |
759 | if ( mode <= SYNC_PREF_ASK ) | 760 | if ( mode <= SYNC_PREF_ASK ) |
760 | return 0; | 761 | return 0; |
761 | } else { | 762 | } else { |
762 | if ( locCh ) { | 763 | if ( locCh ) { |
763 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 764 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
764 | lastSync = localMod.addDays( -1 ); | 765 | lastSync = localMod.addDays( -1 ); |
765 | if ( !remCh ) | 766 | if ( !remCh ) |
766 | remoteMod = ( lastSync.addDays( -1 ) ); | 767 | remoteMod = ( lastSync.addDays( -1 ) ); |
767 | } else { | 768 | } else { |
768 | //qDebug(" not loc changed "); | 769 | //qDebug(" not loc changed "); |
769 | lastSync = localMod.addDays( 1 ); | 770 | lastSync = localMod.addDays( 1 ); |
770 | if ( remCh ) | 771 | if ( remCh ) |
771 | remoteMod =( lastSync.addDays( 1 ) ); | 772 | remoteMod =( lastSync.addDays( 1 ) ); |
772 | 773 | ||
773 | } | 774 | } |
774 | } | 775 | } |
775 | full = true; | 776 | full = true; |
776 | if ( mode < SYNC_PREF_ASK ) | 777 | if ( mode < SYNC_PREF_ASK ) |
777 | mode = SYNC_PREF_ASK; | 778 | mode = SYNC_PREF_ASK; |
778 | } else { | 779 | } else { |
779 | if ( localMod == remoteMod ) | 780 | if ( localMod == remoteMod ) |
780 | // if ( local->revision() == remote->revision() ) | 781 | // if ( local->revision() == remote->revision() ) |
781 | return 0; | 782 | return 0; |
782 | 783 | ||
783 | } | 784 | } |
784 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 785 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
785 | 786 | ||
786 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 787 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
787 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 788 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
788 | //full = true; //debug only | 789 | //full = true; //debug only |
789 | if ( full ) { | 790 | if ( full ) { |
790 | bool equ = false; | 791 | bool equ = false; |
791 | if ( local->type() == "Event" ) { | 792 | if ( local->type() == "Event" ) { |
792 | equ = (*((Event*) local) == *((Event*) remote)); | 793 | equ = (*((Event*) local) == *((Event*) remote)); |
793 | } | 794 | } |
794 | else if ( local->type() =="Todo" ) | 795 | else if ( local->type() =="Todo" ) |
795 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 796 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
796 | else if ( local->type() =="Journal" ) | 797 | else if ( local->type() =="Journal" ) |
797 | equ = (*((Journal*) local) == *((Journal*) remote)); | 798 | equ = (*((Journal*) local) == *((Journal*) remote)); |
798 | if ( equ ) { | 799 | if ( equ ) { |
799 | //qDebug("equal "); | 800 | //qDebug("equal "); |
800 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 801 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
801 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 802 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
802 | } | 803 | } |
803 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 804 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
804 | return 0; | 805 | return 0; |
805 | 806 | ||
806 | }//else //debug only | 807 | }//else //debug only |
807 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 808 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
808 | } | 809 | } |
809 | int result; | 810 | int result; |
810 | bool localIsNew; | 811 | bool localIsNew; |
811 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 812 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
812 | 813 | ||
813 | if ( full && mode < SYNC_PREF_NEWEST ) | 814 | if ( full && mode < SYNC_PREF_NEWEST ) |
814 | mode = SYNC_PREF_ASK; | 815 | mode = SYNC_PREF_ASK; |
815 | 816 | ||
816 | switch( mode ) { | 817 | switch( mode ) { |
817 | case SYNC_PREF_LOCAL: | 818 | case SYNC_PREF_LOCAL: |
818 | if ( lastSync > remoteMod ) | 819 | if ( lastSync > remoteMod ) |
819 | return 1; | 820 | return 1; |
820 | if ( lastSync > localMod ) | 821 | if ( lastSync > localMod ) |
821 | return 2; | 822 | return 2; |
822 | return 1; | 823 | return 1; |
823 | break; | 824 | break; |
824 | case SYNC_PREF_REMOTE: | 825 | case SYNC_PREF_REMOTE: |
825 | if ( lastSync > remoteMod ) | 826 | if ( lastSync > remoteMod ) |
826 | return 1; | 827 | return 1; |
827 | if ( lastSync > localMod ) | 828 | if ( lastSync > localMod ) |
828 | return 2; | 829 | return 2; |
829 | return 2; | 830 | return 2; |
830 | break; | 831 | break; |
831 | case SYNC_PREF_NEWEST: | 832 | case SYNC_PREF_NEWEST: |
832 | if ( localMod > remoteMod ) | 833 | if ( localMod > remoteMod ) |
833 | return 1; | 834 | return 1; |
834 | else | 835 | else |
835 | return 2; | 836 | return 2; |
836 | break; | 837 | break; |
837 | case SYNC_PREF_ASK: | 838 | case SYNC_PREF_ASK: |
838 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 839 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
839 | if ( lastSync > remoteMod ) | 840 | if ( lastSync > remoteMod ) |
840 | return 1; | 841 | return 1; |
841 | if ( lastSync > localMod ) | 842 | if ( lastSync > localMod ) |
842 | return 2; | 843 | return 2; |
843 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 844 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
844 | localIsNew = localMod >= remoteMod; | 845 | localIsNew = localMod >= remoteMod; |
845 | if ( localIsNew ) | 846 | if ( localIsNew ) |
846 | getEventViewerDialog()->setColorMode( 1 ); | 847 | getEventViewerDialog()->setColorMode( 1 ); |
847 | else | 848 | else |
848 | getEventViewerDialog()->setColorMode( 2 ); | 849 | getEventViewerDialog()->setColorMode( 2 ); |
849 | getEventViewerDialog()->setIncidence(local); | 850 | getEventViewerDialog()->setIncidence(local); |
850 | if ( localIsNew ) | 851 | if ( localIsNew ) |
851 | getEventViewerDialog()->setColorMode( 2 ); | 852 | getEventViewerDialog()->setColorMode( 2 ); |
852 | else | 853 | else |
853 | getEventViewerDialog()->setColorMode( 1 ); | 854 | getEventViewerDialog()->setColorMode( 1 ); |
854 | getEventViewerDialog()->addIncidence(remote); | 855 | getEventViewerDialog()->addIncidence(remote); |
855 | getEventViewerDialog()->setColorMode( 0 ); | 856 | getEventViewerDialog()->setColorMode( 0 ); |
856 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 857 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
857 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 858 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
858 | getEventViewerDialog()->showMe(); | 859 | getEventViewerDialog()->showMe(); |
859 | result = getEventViewerDialog()->executeS( localIsNew ); | 860 | result = getEventViewerDialog()->executeS( localIsNew ); |
860 | return result; | 861 | return result; |
861 | 862 | ||
862 | break; | 863 | break; |
863 | case SYNC_PREF_FORCE_LOCAL: | 864 | case SYNC_PREF_FORCE_LOCAL: |
864 | return 1; | 865 | return 1; |
865 | break; | 866 | break; |
866 | case SYNC_PREF_FORCE_REMOTE: | 867 | case SYNC_PREF_FORCE_REMOTE: |
867 | return 2; | 868 | return 2; |
868 | break; | 869 | break; |
869 | 870 | ||
870 | default: | 871 | default: |
871 | // SYNC_PREF_TAKE_BOTH not implemented | 872 | // SYNC_PREF_TAKE_BOTH not implemented |
872 | break; | 873 | break; |
873 | } | 874 | } |
874 | return 0; | 875 | return 0; |
875 | } | 876 | } |
876 | Event* CalendarView::getLastSyncEvent() | 877 | Event* CalendarView::getLastSyncEvent() |
877 | { | 878 | { |
878 | Event* lse; | 879 | Event* lse; |
879 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 880 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
880 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 881 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
881 | if (!lse) { | 882 | if (!lse) { |
882 | lse = new Event(); | 883 | lse = new Event(); |
883 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 884 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
884 | QString sum = ""; | 885 | QString sum = ""; |
885 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 886 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
886 | sum = "E: "; | 887 | sum = "E: "; |
887 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 888 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
888 | lse->setDtStart( mLastCalendarSync ); | 889 | lse->setDtStart( mLastCalendarSync ); |
889 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 890 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
890 | lse->setCategories( i18n("SyncEvent") ); | 891 | lse->setCategories( i18n("SyncEvent") ); |
891 | lse->setReadOnly( true ); | 892 | lse->setReadOnly( true ); |
892 | mCalendar->addEvent( lse ); | 893 | mCalendar->addEvent( lse ); |
893 | } | 894 | } |
894 | 895 | ||
895 | return lse; | 896 | return lse; |
896 | 897 | ||
897 | } | 898 | } |
898 | 899 | ||
899 | // we check, if the to delete event has a id for a profile | 900 | // we check, if the to delete event has a id for a profile |
900 | // if yes, we set this id in the profile to delete | 901 | // if yes, we set this id in the profile to delete |
901 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 902 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
902 | { | 903 | { |
903 | if ( lastSync.count() == 0 ) { | 904 | if ( lastSync.count() == 0 ) { |
904 | //qDebug(" lastSync.count() == 0"); | 905 | //qDebug(" lastSync.count() == 0"); |
905 | return; | 906 | return; |
906 | } | 907 | } |
907 | if ( toDelete->type() == "Journal" ) | 908 | if ( toDelete->type() == "Journal" ) |
908 | return; | 909 | return; |
909 | 910 | ||
910 | Event* eve = lastSync.first(); | 911 | Event* eve = lastSync.first(); |
911 | 912 | ||
912 | while ( eve ) { | 913 | while ( eve ) { |
913 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 914 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
914 | if ( !id.isEmpty() ) { | 915 | if ( !id.isEmpty() ) { |
915 | QString des = eve->description(); | 916 | QString des = eve->description(); |
916 | QString pref = "e"; | 917 | QString pref = "e"; |
917 | if ( toDelete->type() == "Todo" ) | 918 | if ( toDelete->type() == "Todo" ) |
918 | pref = "t"; | 919 | pref = "t"; |
919 | des += pref+ id + ","; | 920 | des += pref+ id + ","; |
920 | eve->setReadOnly( false ); | 921 | eve->setReadOnly( false ); |
921 | eve->setDescription( des ); | 922 | eve->setDescription( des ); |
922 | //qDebug("setdes %s ", des.latin1()); | 923 | //qDebug("setdes %s ", des.latin1()); |
923 | eve->setReadOnly( true ); | 924 | eve->setReadOnly( true ); |
924 | } | 925 | } |
925 | eve = lastSync.next(); | 926 | eve = lastSync.next(); |
926 | } | 927 | } |
927 | 928 | ||
928 | } | 929 | } |
929 | void CalendarView::checkExternalId( Incidence * inc ) | 930 | void CalendarView::checkExternalId( Incidence * inc ) |
930 | { | 931 | { |
931 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 932 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
932 | checkExternSyncEvent( lastSync, inc ); | 933 | checkExternSyncEvent( lastSync, inc ); |
933 | 934 | ||
934 | } | 935 | } |
935 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 936 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
936 | { | 937 | { |
937 | bool syncOK = true; | 938 | bool syncOK = true; |
938 | int addedEvent = 0; | 939 | int addedEvent = 0; |
939 | int addedEventR = 0; | 940 | int addedEventR = 0; |
940 | int deletedEventR = 0; | 941 | int deletedEventR = 0; |
941 | int deletedEventL = 0; | 942 | int deletedEventL = 0; |
942 | int changedLocal = 0; | 943 | int changedLocal = 0; |
943 | int changedRemote = 0; | 944 | int changedRemote = 0; |
944 | int filteredIN = 0; | 945 | int filteredIN = 0; |
945 | int filteredOUT = 0; | 946 | int filteredOUT = 0; |
946 | //QPtrList<Event> el = local->rawEvents(); | 947 | //QPtrList<Event> el = local->rawEvents(); |
947 | Event* eventR; | 948 | Event* eventR; |
948 | QString uid; | 949 | QString uid; |
949 | int take; | 950 | int take; |
950 | Event* eventL; | 951 | Event* eventL; |
951 | Event* eventRSync; | 952 | Event* eventRSync; |
952 | Event* eventLSync; | 953 | Event* eventLSync; |
953 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 954 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
954 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 955 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
955 | bool fullDateRange = false; | 956 | bool fullDateRange = false; |
956 | local->resetTempSyncStat(); | 957 | local->resetTempSyncStat(); |
957 | mLastCalendarSync = QDateTime::currentDateTime(); | 958 | mLastCalendarSync = QDateTime::currentDateTime(); |
958 | if ( mSyncManager->syncWithDesktop() ) { | 959 | if ( mSyncManager->syncWithDesktop() ) { |
959 | remote->resetPilotStat(1); | 960 | remote->resetPilotStat(1); |
960 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 961 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
961 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 962 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
962 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 963 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
963 | } else { | 964 | } else { |
964 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 965 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
965 | } | 966 | } |
966 | } | 967 | } |
967 | QDateTime modifiedCalendar = mLastCalendarSync; | 968 | QDateTime modifiedCalendar = mLastCalendarSync; |
968 | eventLSync = getLastSyncEvent(); | 969 | eventLSync = getLastSyncEvent(); |
969 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 970 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
970 | if ( eventR ) { | 971 | if ( eventR ) { |
971 | eventRSync = (Event*) eventR->clone(); | 972 | eventRSync = (Event*) eventR->clone(); |
972 | remote->deleteEvent(eventR ); | 973 | remote->deleteEvent(eventR ); |
973 | 974 | ||
974 | } else { | 975 | } else { |
975 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 976 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
976 | eventRSync = (Event*)eventLSync->clone(); | 977 | eventRSync = (Event*)eventLSync->clone(); |
977 | } else { | 978 | } else { |
978 | fullDateRange = true; | 979 | fullDateRange = true; |
979 | eventRSync = new Event(); | 980 | eventRSync = new Event(); |
980 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 981 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
981 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 982 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
982 | eventRSync->setDtStart( mLastCalendarSync ); | 983 | eventRSync->setDtStart( mLastCalendarSync ); |
983 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 984 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
984 | eventRSync->setCategories( i18n("SyncEvent") ); | 985 | eventRSync->setCategories( i18n("SyncEvent") ); |
985 | } | 986 | } |
986 | } | 987 | } |
987 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 988 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
988 | fullDateRange = true; | 989 | fullDateRange = true; |
989 | 990 | ||
990 | if ( ! fullDateRange ) { | 991 | if ( ! fullDateRange ) { |
991 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 992 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
992 | 993 | ||
993 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 994 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
994 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 995 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
995 | fullDateRange = true; | 996 | fullDateRange = true; |
996 | } | 997 | } |
997 | } | 998 | } |
998 | if ( mSyncManager->syncWithDesktop() ) { | 999 | if ( mSyncManager->syncWithDesktop() ) { |
999 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1000 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1000 | } | 1001 | } |
1001 | if ( fullDateRange ) | 1002 | if ( fullDateRange ) |
1002 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1003 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1003 | else | 1004 | else |
1004 | mLastCalendarSync = eventLSync->dtStart(); | 1005 | mLastCalendarSync = eventLSync->dtStart(); |
1005 | // for resyncing if own file has changed | 1006 | // for resyncing if own file has changed |
1006 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1007 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1007 | mLastCalendarSync = loadedFileVersion; | 1008 | mLastCalendarSync = loadedFileVersion; |
1008 | //qDebug("setting mLastCalendarSync "); | 1009 | //qDebug("setting mLastCalendarSync "); |
1009 | } | 1010 | } |
1010 | //qDebug("*************************** "); | 1011 | //qDebug("*************************** "); |
1011 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1012 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1012 | QPtrList<Incidence> er = remote->rawIncidences(); | 1013 | QPtrList<Incidence> er = remote->rawIncidences(); |
1013 | Incidence* inR = er.first(); | 1014 | Incidence* inR = er.first(); |
1014 | Incidence* inL; | 1015 | Incidence* inL; |
1015 | QProgressBar bar( er.count(),0 ); | 1016 | QProgressBar bar( er.count(),0 ); |
1016 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1017 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1017 | 1018 | ||
1018 | // ************** setting up filter ************* | 1019 | // ************** setting up filter ************* |
1019 | CalFilter *filterIN = 0; | 1020 | CalFilter *filterIN = 0; |
1020 | CalFilter *filterOUT = 0; | 1021 | CalFilter *filterOUT = 0; |
1021 | CalFilter *filter = mFilters.first(); | 1022 | CalFilter *filter = mFilters.first(); |
1022 | while(filter) { | 1023 | while(filter) { |
1023 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1024 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1024 | filterIN = filter; | 1025 | filterIN = filter; |
1025 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1026 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1026 | filterOUT = filter; | 1027 | filterOUT = filter; |
1027 | filter = mFilters.next(); | 1028 | filter = mFilters.next(); |
1028 | } | 1029 | } |
1029 | int w = 300; | 1030 | int w = 300; |
1030 | if ( QApplication::desktop()->width() < 320 ) | 1031 | if ( QApplication::desktop()->width() < 320 ) |
1031 | w = 220; | 1032 | w = 220; |
1032 | int h = bar.sizeHint().height() ; | 1033 | int h = bar.sizeHint().height() ; |
1033 | int dw = QApplication::desktop()->width(); | 1034 | int dw = QApplication::desktop()->width(); |
1034 | int dh = QApplication::desktop()->height(); | 1035 | int dh = QApplication::desktop()->height(); |
1035 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1036 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1036 | bar.show(); | 1037 | bar.show(); |
1037 | int modulo = (er.count()/10)+1; | 1038 | int modulo = (er.count()/10)+1; |
1038 | int incCounter = 0; | 1039 | int incCounter = 0; |
1039 | while ( inR ) { | 1040 | while ( inR ) { |
1040 | if ( ! bar.isVisible() ) | 1041 | if ( ! bar.isVisible() ) |
1041 | return false; | 1042 | return false; |
1042 | if ( incCounter % modulo == 0 ) | 1043 | if ( incCounter % modulo == 0 ) |
1043 | bar.setProgress( incCounter ); | 1044 | bar.setProgress( incCounter ); |
1044 | ++incCounter; | 1045 | ++incCounter; |
1045 | uid = inR->uid(); | 1046 | uid = inR->uid(); |
1046 | bool skipIncidence = false; | 1047 | bool skipIncidence = false; |
1047 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1048 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1048 | skipIncidence = true; | 1049 | skipIncidence = true; |
1049 | QString idS; | 1050 | QString idS; |
1050 | qApp->processEvents(); | 1051 | qApp->processEvents(); |
1051 | if ( !skipIncidence ) { | 1052 | if ( !skipIncidence ) { |
1052 | inL = local->incidence( uid ); | 1053 | inL = local->incidence( uid ); |
1053 | if ( inL ) { // maybe conflict - same uid in both calendars | 1054 | if ( inL ) { // maybe conflict - same uid in both calendars |
1054 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1055 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1055 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1056 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1056 | if ( take == 3 ) | 1057 | if ( take == 3 ) |
1057 | return false; | 1058 | return false; |
1058 | if ( take == 1 ) {// take local ********************** | 1059 | if ( take == 1 ) {// take local ********************** |
1059 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1060 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1060 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1061 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1061 | else | 1062 | else |
1062 | idS = inR->IDStr(); | 1063 | idS = inR->IDStr(); |
1063 | remote->deleteIncidence( inR ); | 1064 | remote->deleteIncidence( inR ); |
1064 | inR = inL->clone(); | 1065 | inR = inL->clone(); |
1065 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1066 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1066 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1067 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1067 | inR->setIDStr( idS ); | 1068 | inR->setIDStr( idS ); |
1068 | remote->addIncidence( inR ); | 1069 | remote->addIncidence( inR ); |
1069 | if ( mSyncManager->syncWithDesktop() ) | 1070 | if ( mSyncManager->syncWithDesktop() ) |
1070 | inR->setPilotId( 2 ); | 1071 | inR->setPilotId( 2 ); |
1071 | ++changedRemote; | 1072 | ++changedRemote; |
1072 | } else {// take remote ********************** | 1073 | } else {// take remote ********************** |
1073 | idS = inL->IDStr(); | 1074 | idS = inL->IDStr(); |
1074 | int pid = inL->pilotId(); | 1075 | int pid = inL->pilotId(); |
1075 | local->deleteIncidence( inL ); | 1076 | local->deleteIncidence( inL ); |
1076 | inL = inR->clone(); | 1077 | inL = inR->clone(); |
1077 | if ( mSyncManager->syncWithDesktop() ) | 1078 | if ( mSyncManager->syncWithDesktop() ) |
1078 | inL->setPilotId( pid ); | 1079 | inL->setPilotId( pid ); |
1079 | inL->setIDStr( idS ); | 1080 | inL->setIDStr( idS ); |
1080 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1081 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1081 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1082 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1082 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1083 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1083 | } | 1084 | } |
1084 | local->addIncidence( inL ); | 1085 | local->addIncidence( inL ); |
1085 | ++changedLocal; | 1086 | ++changedLocal; |
1086 | } | 1087 | } |
1087 | } | 1088 | } |
1088 | } else { // no conflict ********** add or delete remote | 1089 | } else { // no conflict ********** add or delete remote |
1089 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1090 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1090 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1091 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1091 | QString des = eventLSync->description(); | 1092 | QString des = eventLSync->description(); |
1092 | QString pref = "e"; | 1093 | QString pref = "e"; |
1093 | if ( inR->type() == "Todo" ) | 1094 | if ( inR->type() == "Todo" ) |
1094 | pref = "t"; | 1095 | pref = "t"; |
1095 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1096 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1096 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1097 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1097 | //remote->deleteIncidence( inR ); | 1098 | //remote->deleteIncidence( inR ); |
1098 | ++deletedEventR; | 1099 | ++deletedEventR; |
1099 | } else { | 1100 | } else { |
1100 | inR->setLastModified( modifiedCalendar ); | 1101 | inR->setLastModified( modifiedCalendar ); |
1101 | inL = inR->clone(); | 1102 | inL = inR->clone(); |
1102 | inL->setIDStr( ":" ); | 1103 | inL->setIDStr( ":" ); |
1103 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1104 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1104 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1105 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1105 | local->addIncidence( inL ); | 1106 | local->addIncidence( inL ); |
1106 | ++addedEvent; | 1107 | ++addedEvent; |
1107 | 1108 | ||
1108 | } | 1109 | } |
1109 | } else { | 1110 | } else { |
1110 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1111 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1111 | inR->setLastModified( modifiedCalendar ); | 1112 | inR->setLastModified( modifiedCalendar ); |
1112 | inL = inR->clone(); | 1113 | inL = inR->clone(); |
1113 | inL->setIDStr( ":" ); | 1114 | inL->setIDStr( ":" ); |
1114 | local->addIncidence( inL ); | 1115 | local->addIncidence( inL ); |
1115 | ++addedEvent; | 1116 | ++addedEvent; |
1116 | 1117 | ||
1117 | } else { | 1118 | } else { |
1118 | checkExternSyncEvent(eventRSyncSharp, inR); | 1119 | checkExternSyncEvent(eventRSyncSharp, inR); |
1119 | remote->deleteIncidence( inR ); | 1120 | remote->deleteIncidence( inR ); |
1120 | ++deletedEventR; | 1121 | ++deletedEventR; |
1121 | } | 1122 | } |
1122 | } | 1123 | } |
1123 | } else { | 1124 | } else { |
1124 | ++filteredIN; | 1125 | ++filteredIN; |
1125 | } | 1126 | } |
1126 | } | 1127 | } |
1127 | } | 1128 | } |
1128 | inR = er.next(); | 1129 | inR = er.next(); |
1129 | } | 1130 | } |
1130 | QPtrList<Incidence> el = local->rawIncidences(); | 1131 | QPtrList<Incidence> el = local->rawIncidences(); |
1131 | inL = el.first(); | 1132 | inL = el.first(); |
1132 | modulo = (el.count()/10)+1; | 1133 | modulo = (el.count()/10)+1; |
1133 | bar.setCaption (i18n("Add / remove events") ); | 1134 | bar.setCaption (i18n("Add / remove events") ); |
1134 | bar.setTotalSteps ( el.count() ) ; | 1135 | bar.setTotalSteps ( el.count() ) ; |
1135 | bar.show(); | 1136 | bar.show(); |
1136 | incCounter = 0; | 1137 | incCounter = 0; |
1137 | 1138 | ||
1138 | while ( inL ) { | 1139 | while ( inL ) { |
1139 | 1140 | ||
1140 | qApp->processEvents(); | 1141 | qApp->processEvents(); |
1141 | if ( ! bar.isVisible() ) | 1142 | if ( ! bar.isVisible() ) |
1142 | return false; | 1143 | return false; |
1143 | if ( incCounter % modulo == 0 ) | 1144 | if ( incCounter % modulo == 0 ) |
1144 | bar.setProgress( incCounter ); | 1145 | bar.setProgress( incCounter ); |
1145 | ++incCounter; | 1146 | ++incCounter; |
1146 | uid = inL->uid(); | 1147 | uid = inL->uid(); |
1147 | bool skipIncidence = false; | 1148 | bool skipIncidence = false; |
1148 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1149 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1149 | skipIncidence = true; | 1150 | skipIncidence = true; |
1150 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1151 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1151 | skipIncidence = true; | 1152 | skipIncidence = true; |
1152 | if ( !skipIncidence ) { | 1153 | if ( !skipIncidence ) { |
1153 | inR = remote->incidence( uid ); | 1154 | inR = remote->incidence( uid ); |
1154 | if ( ! inR ) { | 1155 | if ( ! inR ) { |
1155 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1156 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1156 | // no conflict ********** add or delete local | 1157 | // no conflict ********** add or delete local |
@@ -3555,512 +3556,527 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3555 | emit todoSelected( true ); | 3556 | emit todoSelected( true ); |
3556 | Todo *event = static_cast<Todo *>( incidence ); | 3557 | Todo *event = static_cast<Todo *>( incidence ); |
3557 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3558 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3558 | emit organizerEventsSelected( true ); | 3559 | emit organizerEventsSelected( true ); |
3559 | } else { | 3560 | } else { |
3560 | emit organizerEventsSelected(false); | 3561 | emit organizerEventsSelected(false); |
3561 | } | 3562 | } |
3562 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3563 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3563 | KOPrefs::instance()->email() ) ) { | 3564 | KOPrefs::instance()->email() ) ) { |
3564 | emit groupEventsSelected( true ); | 3565 | emit groupEventsSelected( true ); |
3565 | } else { | 3566 | } else { |
3566 | emit groupEventsSelected(false); | 3567 | emit groupEventsSelected(false); |
3567 | } | 3568 | } |
3568 | return; | 3569 | return; |
3569 | } else { | 3570 | } else { |
3570 | emit todoSelected( false ); | 3571 | emit todoSelected( false ); |
3571 | emit organizerEventsSelected(false); | 3572 | emit organizerEventsSelected(false); |
3572 | emit groupEventsSelected(false); | 3573 | emit groupEventsSelected(false); |
3573 | } | 3574 | } |
3574 | return; | 3575 | return; |
3575 | } | 3576 | } |
3576 | 3577 | ||
3577 | /* if ( incidence && incidence->type() == "Todo" ) { | 3578 | /* if ( incidence && incidence->type() == "Todo" ) { |
3578 | emit todoSelected( true ); | 3579 | emit todoSelected( true ); |
3579 | } else { | 3580 | } else { |
3580 | emit todoSelected( false ); | 3581 | emit todoSelected( false ); |
3581 | }*/ | 3582 | }*/ |
3582 | } | 3583 | } |
3583 | 3584 | ||
3584 | 3585 | ||
3585 | void CalendarView::checkClipboard() | 3586 | void CalendarView::checkClipboard() |
3586 | { | 3587 | { |
3587 | #ifndef KORG_NODND | 3588 | #ifndef KORG_NODND |
3588 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3589 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3589 | emit pasteEnabled(true); | 3590 | emit pasteEnabled(true); |
3590 | } else { | 3591 | } else { |
3591 | emit pasteEnabled(false); | 3592 | emit pasteEnabled(false); |
3592 | } | 3593 | } |
3593 | #endif | 3594 | #endif |
3594 | } | 3595 | } |
3595 | 3596 | ||
3596 | void CalendarView::showDates(const DateList &selectedDates) | 3597 | void CalendarView::showDates(const DateList &selectedDates) |
3597 | { | 3598 | { |
3598 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3599 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3599 | 3600 | ||
3600 | 3601 | ||
3601 | if ( !mBlockShowDates ) { | 3602 | if ( !mBlockShowDates ) { |
3602 | if ( mViewManager->currentView() ) { | 3603 | if ( mViewManager->currentView() ) { |
3603 | updateView( selectedDates.first(), selectedDates.last() ); | 3604 | updateView( selectedDates.first(), selectedDates.last() ); |
3604 | } else { | 3605 | } else { |
3605 | mViewManager->showAgendaView(); | 3606 | mViewManager->showAgendaView(); |
3606 | } | 3607 | } |
3607 | } | 3608 | } |
3608 | 3609 | ||
3609 | QDate date = selectedDates.first(); | 3610 | QDate date = selectedDates.first(); |
3610 | if ( ! date.isValid() ) { | 3611 | if ( ! date.isValid() ) { |
3611 | topLevelWidget()->setCaption(""); | 3612 | topLevelWidget()->setCaption(""); |
3612 | return; | 3613 | return; |
3613 | } | 3614 | } |
3614 | 3615 | ||
3615 | QString selDates; | 3616 | QString selDates; |
3616 | selDates = KGlobal::locale()->formatDate( date, true); | 3617 | selDates = KGlobal::locale()->formatDate( date, true); |
3617 | if (selectedDates.first() < selectedDates.last() ) | 3618 | if (selectedDates.first() < selectedDates.last() ) |
3618 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3619 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3619 | else { | 3620 | else { |
3620 | QString addString; | 3621 | QString addString; |
3621 | if ( date == QDateTime::currentDateTime().date() ) | 3622 | if ( date == QDateTime::currentDateTime().date() ) |
3622 | addString = i18n("Today"); | 3623 | addString = i18n("Today"); |
3623 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 3624 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3624 | addString = i18n("Tomorrow"); | 3625 | addString = i18n("Tomorrow"); |
3625 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 3626 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3626 | addString = i18n("Yesterday"); | 3627 | addString = i18n("Yesterday"); |
3627 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 3628 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3628 | addString = i18n("Day before yesterday"); | 3629 | addString = i18n("Day before yesterday"); |
3629 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 3630 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3630 | addString = i18n("Day after tomorrow"); | 3631 | addString = i18n("Day after tomorrow"); |
3631 | if ( !addString.isEmpty() ) { | 3632 | if ( !addString.isEmpty() ) { |
3632 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3633 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3633 | return; | 3634 | return; |
3634 | } | 3635 | } |
3635 | } | 3636 | } |
3636 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3637 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3637 | 3638 | ||
3638 | } | 3639 | } |
3639 | 3640 | ||
3640 | QPtrList<CalFilter> CalendarView::filters() | 3641 | QPtrList<CalFilter> CalendarView::filters() |
3641 | { | 3642 | { |
3642 | return mFilters; | 3643 | return mFilters; |
3643 | 3644 | ||
3644 | } | 3645 | } |
3645 | void CalendarView::editFilters() | 3646 | void CalendarView::editFilters() |
3646 | { | 3647 | { |
3647 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3648 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3648 | 3649 | ||
3649 | CalFilter *filter = mFilters.first(); | 3650 | CalFilter *filter = mFilters.first(); |
3650 | while(filter) { | 3651 | while(filter) { |
3651 | kdDebug() << " Filter: " << filter->name() << endl; | 3652 | kdDebug() << " Filter: " << filter->name() << endl; |
3652 | filter = mFilters.next(); | 3653 | filter = mFilters.next(); |
3653 | } | 3654 | } |
3654 | 3655 | ||
3655 | mDialogManager->showFilterEditDialog(&mFilters); | 3656 | mDialogManager->showFilterEditDialog(&mFilters); |
3656 | } | 3657 | } |
3657 | void CalendarView::toggleFilter() | 3658 | void CalendarView::toggleFilter() |
3658 | { | 3659 | { |
3659 | showFilter(! mFilterView->isVisible()); | 3660 | showFilter(! mFilterView->isVisible()); |
3660 | } | 3661 | } |
3661 | 3662 | ||
3662 | KOFilterView *CalendarView::filterView() | 3663 | KOFilterView *CalendarView::filterView() |
3663 | { | 3664 | { |
3664 | return mFilterView; | 3665 | return mFilterView; |
3665 | } | 3666 | } |
3666 | void CalendarView::selectFilter( int fil ) | 3667 | void CalendarView::selectFilter( int fil ) |
3667 | { | 3668 | { |
3668 | mFilterView->setSelectedFilter( fil ); | 3669 | mFilterView->setSelectedFilter( fil ); |
3669 | } | 3670 | } |
3670 | void CalendarView::showFilter(bool visible) | 3671 | void CalendarView::showFilter(bool visible) |
3671 | { | 3672 | { |
3672 | if (visible) mFilterView->show(); | 3673 | if (visible) mFilterView->show(); |
3673 | else mFilterView->hide(); | 3674 | else mFilterView->hide(); |
3674 | } | 3675 | } |
3675 | void CalendarView::toggleFilerEnabled( ) | 3676 | void CalendarView::toggleFilerEnabled( ) |
3676 | { | 3677 | { |
3677 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3678 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3678 | if ( !mFilterView->filtersEnabled() ) | 3679 | if ( !mFilterView->filtersEnabled() ) |
3679 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3680 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3680 | 3681 | ||
3681 | } | 3682 | } |
3682 | void CalendarView::updateFilter() | 3683 | void CalendarView::updateFilter() |
3683 | { | 3684 | { |
3684 | CalFilter *filter = mFilterView->selectedFilter(); | 3685 | CalFilter *filter = mFilterView->selectedFilter(); |
3685 | if (filter) { | 3686 | if (filter) { |
3686 | QString mess; | 3687 | QString mess; |
3687 | if (mFilterView->filtersEnabled()) { | 3688 | if (mFilterView->filtersEnabled()) { |
3688 | mess = i18n("Filter selected: ")+filter->name(); | 3689 | mess = i18n("Filter selected: ")+filter->name(); |
3689 | filter->setEnabled(true); | 3690 | filter->setEnabled(true); |
3690 | } | 3691 | } |
3691 | else filter->setEnabled(false); | 3692 | else filter->setEnabled(false); |
3692 | mCalendar->setFilter(filter); | 3693 | mCalendar->setFilter(filter); |
3693 | updateView(); | 3694 | updateView(); |
3694 | if ( !mess.isEmpty() ) | 3695 | if ( !mess.isEmpty() ) |
3695 | topLevelWidget()->setCaption( mess ); | 3696 | topLevelWidget()->setCaption( mess ); |
3696 | 3697 | ||
3697 | } | 3698 | } |
3698 | } | 3699 | } |
3699 | 3700 | ||
3700 | void CalendarView::filterEdited() | 3701 | void CalendarView::filterEdited() |
3701 | { | 3702 | { |
3702 | mFilterView->updateFilters(); | 3703 | mFilterView->updateFilters(); |
3703 | updateFilter(); | 3704 | updateFilter(); |
3704 | writeSettings(); | 3705 | writeSettings(); |
3705 | } | 3706 | } |
3706 | 3707 | ||
3707 | 3708 | ||
3708 | void CalendarView::takeOverEvent() | 3709 | void CalendarView::takeOverEvent() |
3709 | { | 3710 | { |
3710 | Incidence *incidence = currentSelection(); | 3711 | Incidence *incidence = currentSelection(); |
3711 | 3712 | ||
3712 | if (!incidence) return; | 3713 | if (!incidence) return; |
3713 | 3714 | ||
3714 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3715 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3715 | incidence->recreate(); | 3716 | incidence->recreate(); |
3716 | incidence->setReadOnly(false); | 3717 | incidence->setReadOnly(false); |
3717 | 3718 | ||
3718 | updateView(); | 3719 | updateView(); |
3719 | } | 3720 | } |
3720 | 3721 | ||
3721 | void CalendarView::takeOverCalendar() | 3722 | void CalendarView::takeOverCalendar() |
3722 | { | 3723 | { |
3723 | // TODO: Create Calendar::allIncidences() function and use it here | 3724 | // TODO: Create Calendar::allIncidences() function and use it here |
3724 | 3725 | ||
3725 | QPtrList<Event> events = mCalendar->events(); | 3726 | QPtrList<Event> events = mCalendar->events(); |
3726 | for(uint i=0; i<events.count(); ++i) { | 3727 | for(uint i=0; i<events.count(); ++i) { |
3727 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3728 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3728 | events.at(i)->recreate(); | 3729 | events.at(i)->recreate(); |
3729 | events.at(i)->setReadOnly(false); | 3730 | events.at(i)->setReadOnly(false); |
3730 | } | 3731 | } |
3731 | 3732 | ||
3732 | QPtrList<Todo> todos = mCalendar->todos(); | 3733 | QPtrList<Todo> todos = mCalendar->todos(); |
3733 | for(uint i=0; i<todos.count(); ++i) { | 3734 | for(uint i=0; i<todos.count(); ++i) { |
3734 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3735 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3735 | todos.at(i)->recreate(); | 3736 | todos.at(i)->recreate(); |
3736 | todos.at(i)->setReadOnly(false); | 3737 | todos.at(i)->setReadOnly(false); |
3737 | } | 3738 | } |
3738 | 3739 | ||
3739 | QPtrList<Journal> journals = mCalendar->journals(); | 3740 | QPtrList<Journal> journals = mCalendar->journals(); |
3740 | for(uint i=0; i<journals.count(); ++i) { | 3741 | for(uint i=0; i<journals.count(); ++i) { |
3741 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3742 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3742 | journals.at(i)->recreate(); | 3743 | journals.at(i)->recreate(); |
3743 | journals.at(i)->setReadOnly(false); | 3744 | journals.at(i)->setReadOnly(false); |
3744 | } | 3745 | } |
3745 | 3746 | ||
3746 | updateView(); | 3747 | updateView(); |
3747 | } | 3748 | } |
3748 | 3749 | ||
3749 | void CalendarView::showIntro() | 3750 | void CalendarView::showIntro() |
3750 | { | 3751 | { |
3751 | kdDebug() << "To be implemented." << endl; | 3752 | kdDebug() << "To be implemented." << endl; |
3752 | } | 3753 | } |
3753 | 3754 | ||
3754 | QWidgetStack *CalendarView::viewStack() | 3755 | QWidgetStack *CalendarView::viewStack() |
3755 | { | 3756 | { |
3756 | return mRightFrame; | 3757 | return mRightFrame; |
3757 | } | 3758 | } |
3758 | 3759 | ||
3759 | QWidget *CalendarView::leftFrame() | 3760 | QWidget *CalendarView::leftFrame() |
3760 | { | 3761 | { |
3761 | return ( QWidget *)mLeftFrame; | 3762 | return ( QWidget *)mLeftFrame; |
3762 | } | 3763 | } |
3763 | 3764 | ||
3764 | DateNavigator *CalendarView::dateNavigator() | 3765 | DateNavigator *CalendarView::dateNavigator() |
3765 | { | 3766 | { |
3766 | return mNavigator; | 3767 | return mNavigator; |
3767 | } | 3768 | } |
3768 | 3769 | ||
3769 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3770 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3770 | { | 3771 | { |
3771 | return mDateNavigator->navigatorView(); | 3772 | return mDateNavigator->navigatorView(); |
3772 | } | 3773 | } |
3773 | void CalendarView::toggleDateNavigatorWidget() | 3774 | void CalendarView::toggleDateNavigatorWidget() |
3774 | { | 3775 | { |
3775 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3776 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3776 | 3777 | ||
3777 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3778 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3778 | mDateNavigator->hide(); | 3779 | mDateNavigator->hide(); |
3779 | else | 3780 | else |
3780 | mDateNavigator->show(); | 3781 | mDateNavigator->show(); |
3781 | } | 3782 | } |
3782 | void CalendarView::addView(KOrg::BaseView *view) | 3783 | void CalendarView::addView(KOrg::BaseView *view) |
3783 | { | 3784 | { |
3784 | mViewManager->addView(view); | 3785 | mViewManager->addView(view); |
3785 | } | 3786 | } |
3786 | 3787 | ||
3787 | void CalendarView::showView(KOrg::BaseView *view) | 3788 | void CalendarView::showView(KOrg::BaseView *view) |
3788 | { | 3789 | { |
3789 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3790 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3790 | } | 3791 | } |
3791 | 3792 | ||
3792 | Incidence *CalendarView::currentSelection() | 3793 | Incidence *CalendarView::currentSelection() |
3793 | { | 3794 | { |
3794 | return mViewManager->currentSelection(); | 3795 | return mViewManager->currentSelection(); |
3795 | } | 3796 | } |
3796 | void CalendarView::toggleAllDaySize() | 3797 | void CalendarView::toggleAllDaySize() |
3797 | { | 3798 | { |
3798 | /* | 3799 | /* |
3799 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3800 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3800 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3801 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3801 | else | 3802 | else |
3802 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3803 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3803 | */ | 3804 | */ |
3804 | viewManager()->agendaView()->toggleAllDay(); | 3805 | viewManager()->agendaView()->toggleAllDay(); |
3805 | } | 3806 | } |
3806 | void CalendarView::toggleExpand() | 3807 | void CalendarView::toggleExpand() |
3807 | { | 3808 | { |
3808 | // if ( mLeftFrame->isHidden() ) { | 3809 | // if ( mLeftFrame->isHidden() ) { |
3809 | // mLeftFrame->show(); | 3810 | // mLeftFrame->show(); |
3810 | // emit calendarViewExpanded( false ); | 3811 | // emit calendarViewExpanded( false ); |
3811 | // } else { | 3812 | // } else { |
3812 | // mLeftFrame->hide(); | 3813 | // mLeftFrame->hide(); |
3813 | // emit calendarViewExpanded( true ); | 3814 | // emit calendarViewExpanded( true ); |
3814 | // } | 3815 | // } |
3815 | //qDebug(" CalendarView::toggleExpand()"); | 3816 | //qDebug(" CalendarView::toggleExpand()"); |
3816 | globalFlagBlockAgenda = 1; | 3817 | globalFlagBlockAgenda = 1; |
3817 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3818 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3818 | globalFlagBlockAgenda = 5; | 3819 | globalFlagBlockAgenda = 5; |
3819 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3820 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3820 | //mViewManager->showView( 0, true ); | 3821 | //mViewManager->showView( 0, true ); |
3821 | } | 3822 | } |
3822 | 3823 | ||
3823 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3824 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3824 | { | 3825 | { |
3825 | setModified( modified ); | 3826 | setModified( modified ); |
3826 | } | 3827 | } |
3827 | 3828 | ||
3828 | Todo *CalendarView::selectedTodo() | 3829 | Todo *CalendarView::selectedTodo() |
3829 | { | 3830 | { |
3830 | Incidence *incidence = currentSelection(); | 3831 | Incidence *incidence = currentSelection(); |
3831 | if ( incidence && incidence->type() == "Todo" ) { | 3832 | if ( incidence && incidence->type() == "Todo" ) { |
3832 | return static_cast<Todo *>( incidence ); | 3833 | return static_cast<Todo *>( incidence ); |
3833 | } | 3834 | } |
3834 | 3835 | ||
3835 | incidence = mTodoList->selectedIncidences().first(); | 3836 | incidence = mTodoList->selectedIncidences().first(); |
3836 | if ( incidence && incidence->type() == "Todo" ) { | 3837 | if ( incidence && incidence->type() == "Todo" ) { |
3837 | return static_cast<Todo *>( incidence ); | 3838 | return static_cast<Todo *>( incidence ); |
3838 | } | 3839 | } |
3839 | 3840 | ||
3840 | return 0; | 3841 | return 0; |
3841 | } | 3842 | } |
3842 | 3843 | ||
3843 | void CalendarView::dialogClosing(Incidence *in) | 3844 | void CalendarView::dialogClosing(Incidence *in) |
3844 | { | 3845 | { |
3845 | // mDialogList.remove(in); | 3846 | // mDialogList.remove(in); |
3846 | } | 3847 | } |
3847 | 3848 | ||
3848 | void CalendarView::showIncidence() | 3849 | void CalendarView::showIncidence() |
3849 | { | 3850 | { |
3850 | mViewerCallerIsSearchDialog = false; | 3851 | mViewerCallerIsSearchDialog = false; |
3851 | Incidence *incidence = currentSelection(); | 3852 | Incidence *incidence = currentSelection(); |
3852 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3853 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3853 | if ( incidence ) { | 3854 | if ( incidence ) { |
3854 | ShowIncidenceVisitor v; | 3855 | ShowIncidenceVisitor v; |
3855 | v.act( incidence, this ); | 3856 | v.act( incidence, this ); |
3856 | } | 3857 | } |
3857 | } | 3858 | } |
3858 | void CalendarView::editIncidenceDescription() | 3859 | void CalendarView::editIncidenceDescription() |
3859 | { | 3860 | { |
3860 | mFlagEditDescription = true; | 3861 | mFlagEditDescription = true; |
3861 | editIncidence(); | 3862 | editIncidence(); |
3862 | mFlagEditDescription = false; | 3863 | mFlagEditDescription = false; |
3863 | } | 3864 | } |
3864 | void CalendarView::editIncidence() | 3865 | void CalendarView::editIncidence() |
3865 | { | 3866 | { |
3866 | // qDebug("editIncidence() "); | 3867 | // qDebug("editIncidence() "); |
3867 | Incidence *incidence = currentSelection(); | 3868 | Incidence *incidence = currentSelection(); |
3868 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3869 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3869 | if ( incidence ) { | 3870 | if ( incidence ) { |
3870 | EditIncidenceVisitor v; | 3871 | EditIncidenceVisitor v; |
3871 | v.act( incidence, this ); | 3872 | v.act( incidence, this ); |
3872 | } | 3873 | } |
3873 | } | 3874 | } |
3874 | 3875 | ||
3875 | void CalendarView::deleteIncidence() | 3876 | void CalendarView::deleteIncidence() |
3876 | { | 3877 | { |
3877 | Incidence *incidence = currentSelection(); | 3878 | Incidence *incidence = currentSelection(); |
3878 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3879 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3879 | if ( incidence ) { | 3880 | if ( incidence ) { |
3880 | deleteIncidence(incidence); | 3881 | deleteIncidence(incidence); |
3881 | } | 3882 | } |
3882 | } | 3883 | } |
3883 | 3884 | ||
3884 | void CalendarView::showIncidence(Incidence *incidence) | 3885 | void CalendarView::showIncidence(Incidence *incidence) |
3885 | { | 3886 | { |
3886 | mViewerCallerIsSearchDialog = false; | 3887 | mViewerCallerIsSearchDialog = false; |
3887 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 3888 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
3888 | if ( sender() && mDialogManager->getSearchDialog() ) { | 3889 | if ( sender() && mDialogManager->getSearchDialog() ) { |
3889 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 3890 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
3890 | mViewerCallerIsSearchDialog = true; | 3891 | mViewerCallerIsSearchDialog = true; |
3891 | } | 3892 | } |
3892 | } | 3893 | } |
3893 | if ( incidence ) { | 3894 | if ( incidence ) { |
3894 | ShowIncidenceVisitor v; | 3895 | ShowIncidenceVisitor v; |
3895 | v.act( incidence, this ); | 3896 | v.act( incidence, this ); |
3896 | } | 3897 | } |
3897 | } | 3898 | } |
3898 | 3899 | ||
3899 | void CalendarView::editIncidence(Incidence *incidence) | 3900 | void CalendarView::editIncidence(Incidence *incidence) |
3900 | { | 3901 | { |
3901 | if ( incidence ) { | 3902 | if ( incidence ) { |
3902 | 3903 | ||
3903 | EditIncidenceVisitor v; | 3904 | EditIncidenceVisitor v; |
3904 | v.act( incidence, this ); | 3905 | v.act( incidence, this ); |
3905 | 3906 | ||
3906 | } | 3907 | } |
3907 | } | 3908 | } |
3908 | 3909 | ||
3909 | void CalendarView::deleteIncidence(Incidence *incidence) | 3910 | void CalendarView::deleteIncidence(Incidence *incidence) |
3910 | { | 3911 | { |
3911 | //qDebug(" CalendarView::deleteIncidence "); | 3912 | //qDebug(" CalendarView::deleteIncidence "); |
3912 | if ( incidence ) { | 3913 | if ( incidence ) { |
3913 | DeleteIncidenceVisitor v; | 3914 | DeleteIncidenceVisitor v; |
3914 | v.act( incidence, this ); | 3915 | v.act( incidence, this ); |
3915 | } | 3916 | } |
3916 | } | 3917 | } |
3917 | 3918 | ||
3918 | 3919 | ||
3919 | void CalendarView::lookForOutgoingMessages() | 3920 | void CalendarView::lookForOutgoingMessages() |
3920 | { | 3921 | { |
3921 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3922 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3922 | ogd->loadMessages(); | 3923 | ogd->loadMessages(); |
3923 | } | 3924 | } |
3924 | 3925 | ||
3925 | void CalendarView::lookForIncomingMessages() | 3926 | void CalendarView::lookForIncomingMessages() |
3926 | { | 3927 | { |
3927 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3928 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3928 | icd->retrieve(); | 3929 | icd->retrieve(); |
3929 | } | 3930 | } |
3930 | 3931 | ||
3931 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3932 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3932 | { | 3933 | { |
3933 | bool deleteTodo = true; | 3934 | bool deleteTodo = true; |
3934 | QPtrList<Incidence> subTodos; | 3935 | QPtrList<Incidence> subTodos; |
3935 | Incidence *aTodo; | 3936 | Incidence *aTodo; |
3936 | subTodos = t->relations(); | 3937 | subTodos = t->relations(); |
3937 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3938 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3938 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3939 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3939 | deleteTodo = false; | 3940 | deleteTodo = false; |
3940 | } | 3941 | } |
3941 | if ( deleteTodo ) { | 3942 | if ( deleteTodo ) { |
3942 | if ( t->isCompleted() && !t->doesRecur()) { | 3943 | if ( t->isCompleted() && !t->doesRecur()) { |
3943 | checkExternalId( t ); | 3944 | checkExternalId( t ); |
3944 | mCalendar->deleteTodo( t ); | 3945 | mCalendar->deleteTodo( t ); |
3945 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3946 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3946 | } | 3947 | } |
3947 | else | 3948 | else |
3948 | deleteTodo = false; | 3949 | deleteTodo = false; |
3949 | } | 3950 | } |
3950 | return deleteTodo; | 3951 | return deleteTodo; |
3951 | 3952 | ||
3952 | } | 3953 | } |
3953 | void CalendarView::purgeCompleted() | 3954 | void CalendarView::purgeCompleted() |
3954 | { | 3955 | { |
3955 | int result = KMessageBox::warningContinueCancel(this, | 3956 | int result = KMessageBox::warningContinueCancel(this, |
3956 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3957 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3957 | 3958 | ||
3958 | if (result == KMessageBox::Continue) { | 3959 | if (result == KMessageBox::Continue) { |
3959 | 3960 | ||
3960 | QPtrList<Todo> todoCal; | 3961 | QPtrList<Todo> todoCal; |
3961 | QPtrList<Todo> rootTodos; | 3962 | QPtrList<Todo> rootTodos; |
3962 | //QPtrList<Incidence> rel; | 3963 | //QPtrList<Incidence> rel; |
3963 | Todo *aTodo;//, *rTodo; | 3964 | Todo *aTodo;//, *rTodo; |
3964 | Incidence *rIncidence; | 3965 | Incidence *rIncidence; |
3965 | bool childDelete = false; | 3966 | bool childDelete = false; |
3966 | bool deletedOne = true; | 3967 | bool deletedOne = true; |
3967 | todoCal = calendar()->todos(); | 3968 | todoCal = calendar()->todos(); |
3968 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3969 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3969 | if ( !aTodo->relatedTo() ) | 3970 | if ( !aTodo->relatedTo() ) |
3970 | rootTodos.append( aTodo ); | 3971 | rootTodos.append( aTodo ); |
3971 | } | 3972 | } |
3972 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3973 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3973 | removeCompletedSubTodos( aTodo ); | 3974 | removeCompletedSubTodos( aTodo ); |
3974 | } | 3975 | } |
3975 | 3976 | ||
3976 | updateView(); | 3977 | updateView(); |
3977 | } | 3978 | } |
3978 | } | 3979 | } |
3979 | 3980 | ||
3980 | void CalendarView::slotCalendarChanged() | 3981 | void CalendarView::slotCalendarChanged() |
3981 | { | 3982 | { |
3982 | ; | 3983 | ; |
3983 | } | 3984 | } |
3984 | 3985 | ||
3985 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3986 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3986 | { | 3987 | { |
3987 | //qDebug(" alendarView::keyPressEvent "); | 3988 | //qDebug(" alendarView::keyPressEvent "); |
3988 | e->ignore(); | 3989 | e->ignore(); |
3989 | } | 3990 | } |
3990 | 3991 | ||
3991 | 3992 | ||
3992 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3993 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3993 | { | 3994 | { |
3994 | // mSyncManager = manager; | 3995 | // mSyncManager = manager; |
3995 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3996 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3996 | qDebug("KO: SyncKDE request detected!"); | 3997 | qDebug("KO: SyncKDE request detected!"); |
3997 | } | 3998 | } |
3998 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3999 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3999 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4000 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4000 | return syncCalendar( filename, mode ); | 4001 | return syncCalendar( filename, mode ); |
4001 | } | 4002 | } |
4002 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4003 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4003 | { | 4004 | { |
4004 | //mSyncManager = manager; | 4005 | //mSyncManager = manager; |
4005 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4006 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4006 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4007 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4007 | if ( resource == "sharp" ) | 4008 | if ( resource == "sharp" ) |
4008 | syncExternal( 0 ); | 4009 | syncExternal( 0 ); |
4009 | if ( resource == "phone" ) | 4010 | if ( resource == "phone" ) |
4010 | syncExternal( 1 ); | 4011 | syncExternal( 1 ); |
4011 | // pending setmodified | 4012 | // pending setmodified |
4012 | return true; | 4013 | return true; |
4013 | } | 4014 | } |
4014 | void CalendarView::setSyncManager(KSyncManager* manager) | 4015 | void CalendarView::setSyncManager(KSyncManager* manager) |
4015 | { | 4016 | { |
4016 | mSyncManager = manager; | 4017 | mSyncManager = manager; |
4017 | } | 4018 | } |
4018 | 4019 | ||
4019 | void CalendarView::removeSyncInfo( QString syncProfile) | 4020 | void CalendarView::removeSyncInfo( QString syncProfile) |
4020 | { | 4021 | { |
4021 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4022 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4022 | mCalendar->removeSyncInfo( syncProfile ); | 4023 | mCalendar->removeSyncInfo( syncProfile ); |
4023 | 4024 | ||
4024 | } | 4025 | } |
4025 | 4026 | ||
4026 | void CalendarView::undo_delete() | 4027 | void CalendarView::undo_delete() |
4027 | { | 4028 | { |
4028 | //qDebug("undo_delete() "); | 4029 | //qDebug("undo_delete() "); |
4029 | Incidence* undo = mCalendar->undoIncidence(); | 4030 | Incidence* undo = mCalendar->undoIncidence(); |
4030 | if ( !undo ) { | 4031 | if ( !undo ) { |
4031 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4032 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4032 | i18n("KO/Pi")); | 4033 | i18n("KO/Pi")); |
4033 | return; | 4034 | return; |
4034 | } | 4035 | } |
4035 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4036 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4036 | i18n("\nAre you sure you want\nto restore this?"), | 4037 | i18n("\nAre you sure you want\nto restore this?"), |
4037 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4038 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4038 | mCalendar->undoDeleteIncidence(); | 4039 | mCalendar->undoDeleteIncidence(); |
4039 | updateView(); | 4040 | updateView(); |
4040 | } | 4041 | } |
4041 | } | 4042 | } |
4042 | 4043 | ||
4043 | void CalendarView::slotViewerClosed() | 4044 | void CalendarView::slotViewerClosed() |
4044 | { | 4045 | { |
4045 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4046 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4046 | } | 4047 | } |
4047 | 4048 | ||
4048 | void CalendarView::resetFocus() | 4049 | void CalendarView::resetFocus() |
4049 | { | 4050 | { |
4050 | if ( mViewerCallerIsSearchDialog ) { | 4051 | if ( mViewerCallerIsSearchDialog ) { |
4051 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4052 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4052 | mDialogManager->getSearchDialog()->raise(); | 4053 | mDialogManager->getSearchDialog()->raise(); |
4053 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4054 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4054 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4055 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
4055 | } else | 4056 | } else |
4056 | mViewerCallerIsSearchDialog = false; | 4057 | mViewerCallerIsSearchDialog = false; |
4057 | } | 4058 | } |
4058 | if ( !mViewerCallerIsSearchDialog ) { | 4059 | if ( !mViewerCallerIsSearchDialog ) { |
4059 | //mViewManager->currentView()->setFocus(); | 4060 | //mViewManager->currentView()->setFocus(); |
4060 | //qDebug("sssssssssssssssset focus "); | 4061 | //qDebug("sssssssssssssssset focus "); |
4061 | topLevelWidget()->raise(); | 4062 | topLevelWidget()->raise(); |
4062 | setActiveWindow(); | 4063 | setActiveWindow(); |
4063 | //setFocus(); | 4064 | //setFocus(); |
4064 | } | 4065 | } |
4065 | mViewerCallerIsSearchDialog = false; | 4066 | mViewerCallerIsSearchDialog = false; |
4066 | } | 4067 | } |
4068 | |||
4069 | void CalendarView::showNextAlarms() | ||
4070 | { | ||
4071 | QString message; | ||
4072 | if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { | ||
4073 | QString sum = mCalendar->nextSummary(); | ||
4074 | QDateTime nextA = mNextAlarmDateTime; | ||
4075 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | ||
4076 | message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | ||
4077 | } else { | ||
4078 | message = i18n("There is no next alarm."); | ||
4079 | |||
4080 | } | ||
4081 | KMessageBox::information( this, message); | ||
4082 | } | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 16e671f..9782ffe 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,617 +1,619 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <KDGanttMinimizeSplitter.h> | 42 | #include <KDGanttMinimizeSplitter.h> |
43 | 43 | ||
44 | #include <korganizer/calendarviewbase.h> | 44 | #include <korganizer/calendarviewbase.h> |
45 | 45 | ||
46 | #include <ksyncmanager.h> | 46 | #include <ksyncmanager.h> |
47 | 47 | ||
48 | class QWidgetStack; | 48 | class QWidgetStack; |
49 | class QSplitter; | 49 | class QSplitter; |
50 | 50 | ||
51 | class CalPrinter; | 51 | class CalPrinter; |
52 | class KOFilterView; | 52 | class KOFilterView; |
53 | class KOViewManager; | 53 | class KOViewManager; |
54 | class KODialogManager; | 54 | class KODialogManager; |
55 | class KOTodoView; | 55 | class KOTodoView; |
56 | class KDateNavigator; | 56 | class KDateNavigator; |
57 | class DateNavigatorContainer; | 57 | class DateNavigatorContainer; |
58 | class DateNavigator; | 58 | class DateNavigator; |
59 | class KOIncidenceEditor; | 59 | class KOIncidenceEditor; |
60 | class KDatePicker; | 60 | class KDatePicker; |
61 | class ResourceView; | 61 | class ResourceView; |
62 | class KOEventEditor; | 62 | class KOEventEditor; |
63 | class KOTodoEditor ; | 63 | class KOTodoEditor ; |
64 | class KOEventViewerDialog; | 64 | class KOEventViewerDialog; |
65 | class KOBeamPrefs; | 65 | class KOBeamPrefs; |
66 | class KSyncProfile; | 66 | class KSyncProfile; |
67 | class AlarmDialog; | 67 | class AlarmDialog; |
68 | class KCal::Attendee; | 68 | class KCal::Attendee; |
69 | 69 | ||
70 | namespace KCal { class FileStorage; } | 70 | namespace KCal { class FileStorage; } |
71 | 71 | ||
72 | using namespace KCal; | 72 | using namespace KCal; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | This is the main calendar widget. It provides the different vies on t he | 75 | This is the main calendar widget. It provides the different vies on t he |
76 | calendar data as well as the date navigator. It also handles synchronisation | 76 | calendar data as well as the date navigator. It also handles synchronisation |
77 | of the different views and controls the different dialogs like preferences, | 77 | of the different views and controls the different dialogs like preferences, |
78 | event editor, search dialog etc. | 78 | event editor, search dialog etc. |
79 | 79 | ||
80 | @short main calendar view widget | 80 | @short main calendar view widget |
81 | @author Cornelius Schumacher | 81 | @author Cornelius Schumacher |
82 | */ | 82 | */ |
83 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 83 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
84 | { | 84 | { |
85 | Q_OBJECT | 85 | Q_OBJECT |
86 | public: | 86 | public: |
87 | /** | 87 | /** |
88 | Constructs a new calendar view widget. | 88 | Constructs a new calendar view widget. |
89 | 89 | ||
90 | @param calendar calendar document | 90 | @param calendar calendar document |
91 | @param parent parent window | 91 | @param parent parent window |
92 | @param name Qt internal widget object name | 92 | @param name Qt internal widget object name |
93 | */ | 93 | */ |
94 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 94 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
95 | const char *name = 0 ); | 95 | const char *name = 0 ); |
96 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 96 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
97 | const char *name = 0 ); | 97 | const char *name = 0 ); |
98 | virtual ~CalendarView(); | 98 | virtual ~CalendarView(); |
99 | 99 | ||
100 | Calendar *calendar() { return mCalendar; } | 100 | Calendar *calendar() { return mCalendar; } |
101 | 101 | ||
102 | KOViewManager *viewManager(); | 102 | KOViewManager *viewManager(); |
103 | KODialogManager *dialogManager(); | 103 | KODialogManager *dialogManager(); |
104 | 104 | ||
105 | QDate startDate(); | 105 | QDate startDate(); |
106 | QDate endDate(); | 106 | QDate endDate(); |
107 | 107 | ||
108 | QWidgetStack *viewStack(); | 108 | QWidgetStack *viewStack(); |
109 | QWidget *leftFrame(); | 109 | QWidget *leftFrame(); |
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 save (); | 120 | void save (); |
121 | void saveStopTimer (); | 121 | void saveStopTimer (); |
122 | void tempDisableBR(bool); | 122 | void tempDisableBR(bool); |
123 | /** This todo has been modified */ | 123 | /** This todo has been modified */ |
124 | void todoModified(Todo *, int); | 124 | void todoModified(Todo *, int); |
125 | 125 | ||
126 | /** when change is made to options dialog, the topwidget will catch this | 126 | /** when change is made to options dialog, the topwidget will catch this |
127 | * and emit this signal which notifies all widgets which have registered | 127 | * and emit this signal which notifies all widgets which have registered |
128 | * for notification to update their settings. */ | 128 | * for notification to update their settings. */ |
129 | void configChanged(); | 129 | void configChanged(); |
130 | /** emitted when the topwidget is closing down, so that any attached | 130 | /** emitted when the topwidget is closing down, so that any attached |
131 | child windows can also close. */ | 131 | child windows can also close. */ |
132 | void closingDown(); | 132 | void closingDown(); |
133 | /** emitted right before we die */ | 133 | /** emitted right before we die */ |
134 | void closed(QWidget *); | 134 | void closed(QWidget *); |
135 | 135 | ||
136 | /** Emitted when state of modified flag changes */ | 136 | /** Emitted when state of modified flag changes */ |
137 | void modifiedChanged(bool); | 137 | void modifiedChanged(bool); |
138 | void signalmodified(); | 138 | void signalmodified(); |
139 | 139 | ||
140 | /** Emitted when state of read-only flag changes */ | 140 | /** Emitted when state of read-only flag changes */ |
141 | void readOnlyChanged(bool); | 141 | void readOnlyChanged(bool); |
142 | 142 | ||
143 | /** Emitted when the unit of navigation changes */ | 143 | /** Emitted when the unit of navigation changes */ |
144 | void changeNavStringPrev(const QString &); | 144 | void changeNavStringPrev(const QString &); |
145 | void changeNavStringNext(const QString &); | 145 | void changeNavStringNext(const QString &); |
146 | 146 | ||
147 | /** Emitted when state of events selection has changed and user is organizer*/ | 147 | /** Emitted when state of events selection has changed and user is organizer*/ |
148 | void organizerEventsSelected(bool); | 148 | void organizerEventsSelected(bool); |
149 | /** Emitted when state of events selection has changed and user is attendee*/ | 149 | /** Emitted when state of events selection has changed and user is attendee*/ |
150 | void groupEventsSelected(bool); | 150 | void groupEventsSelected(bool); |
151 | /** | 151 | /** |
152 | Emitted when an incidence gets selected. If the selection is cleared the | 152 | Emitted when an incidence gets selected. If the selection is cleared the |
153 | signal is emitted with 0 as argument. | 153 | signal is emitted with 0 as argument. |
154 | */ | 154 | */ |
155 | void incidenceSelected( Incidence * ); | 155 | void incidenceSelected( Incidence * ); |
156 | /** Emitted, when a todoitem is selected or deselected. */ | 156 | /** Emitted, when a todoitem is selected or deselected. */ |
157 | void todoSelected( bool ); | 157 | void todoSelected( bool ); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Emitted, when clipboard content changes. Parameter indicates if paste | 160 | Emitted, when clipboard content changes. Parameter indicates if paste |
161 | is possible or not. | 161 | is possible or not. |
162 | */ | 162 | */ |
163 | void pasteEnabled(bool); | 163 | void pasteEnabled(bool); |
164 | 164 | ||
165 | /** Emitted, when the number of incoming messages has changed. */ | 165 | /** Emitted, when the number of incoming messages has changed. */ |
166 | void numIncomingChanged(int); | 166 | void numIncomingChanged(int); |
167 | 167 | ||
168 | /** Emitted, when the number of outgoing messages has changed. */ | 168 | /** Emitted, when the number of outgoing messages has changed. */ |
169 | void numOutgoingChanged(int); | 169 | void numOutgoingChanged(int); |
170 | 170 | ||
171 | /** Send status message, which can e.g. be displayed in the status bar. */ | 171 | /** Send status message, which can e.g. be displayed in the status bar. */ |
172 | void statusMessage(const QString &); | 172 | void statusMessage(const QString &); |
173 | 173 | ||
174 | void calendarViewExpanded( bool ); | 174 | void calendarViewExpanded( bool ); |
175 | void updateSearchDialog(); | 175 | void updateSearchDialog(); |
176 | 176 | ||
177 | 177 | ||
178 | public slots: | 178 | public slots: |
179 | void showNextAlarms(); | ||
179 | void showOpenError(); | 180 | void showOpenError(); |
180 | void watchSavedFile(); | 181 | void watchSavedFile(); |
181 | void recheckTimerAlarm(); | 182 | void recheckTimerAlarm(); |
182 | void checkNextTimerAlarm(); | 183 | void checkNextTimerAlarm(); |
183 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 184 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
184 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 185 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
185 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 186 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
186 | 187 | ||
187 | /** options dialog made a changed to the configuration. we catch this | 188 | /** options dialog made a changed to the configuration. we catch this |
188 | * and notify all widgets which need to update their configuration. */ | 189 | * and notify all widgets which need to update their configuration. */ |
189 | void updateConfig(); | 190 | void updateConfig(); |
190 | 191 | ||
191 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 192 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
192 | const QStringList& anniversaryList, const QStringList& realNameList, | 193 | const QStringList& anniversaryList, const QStringList& realNameList, |
193 | const QStringList& emailList, const QStringList& assembledNameList, | 194 | const QStringList& emailList, const QStringList& assembledNameList, |
194 | const QStringList& uidList); | 195 | const QStringList& uidList); |
195 | 196 | ||
196 | /** | 197 | /** |
197 | Load calendar from file \a filename. If \a merge is true, load | 198 | Load calendar from file \a filename. If \a merge is true, load |
198 | calendar into existing one, if it is false, clear calendar, before | 199 | calendar into existing one, if it is false, clear calendar, before |
199 | loading. Return true, if calendar could be successfully loaded. | 200 | loading. Return true, if calendar could be successfully loaded. |
200 | */ | 201 | */ |
201 | bool openCalendar(QString filename, bool merge=false); | 202 | bool openCalendar(QString filename, bool merge=false); |
202 | bool syncCalendar(QString filename,int mode = 0 ); | 203 | bool syncCalendar(QString filename,int mode = 0 ); |
203 | 204 | ||
204 | /** | 205 | /** |
205 | Save calendar data to file. Return true if calendar could be | 206 | Save calendar data to file. Return true if calendar could be |
206 | successfully saved. | 207 | successfully saved. |
207 | */ | 208 | */ |
208 | bool saveCalendar(QString filename); | 209 | bool saveCalendar(QString filename); |
209 | 210 | ||
210 | /** | 211 | /** |
211 | Close calendar. Clear calendar data and reset views to display an empty | 212 | Close calendar. Clear calendar data and reset views to display an empty |
212 | calendar. | 213 | calendar. |
213 | */ | 214 | */ |
214 | void closeCalendar(); | 215 | void closeCalendar(); |
215 | 216 | ||
216 | /** Archive old events of calendar */ | 217 | /** Archive old events of calendar */ |
217 | void archiveCalendar(); | 218 | void archiveCalendar(); |
218 | 219 | ||
219 | void showIncidence(); | 220 | void showIncidence(); |
220 | void editIncidence(); | 221 | void editIncidence(); |
221 | void editIncidenceDescription(); | 222 | void editIncidenceDescription(); |
222 | void deleteIncidence(); | 223 | void deleteIncidence(); |
223 | void cloneIncidence(); | 224 | void cloneIncidence(); |
224 | void moveIncidence(); | 225 | void moveIncidence(); |
225 | void beamIncidence(); | 226 | void beamIncidence(); |
226 | void toggleCancelIncidence(); | 227 | void toggleCancelIncidence(); |
227 | 228 | ||
228 | /** create an editeventwin with supplied date/time, and if bool is true, | 229 | /** create an editeventwin with supplied date/time, and if bool is true, |
229 | * make the event take all day. */ | 230 | * make the event take all day. */ |
230 | void newEvent(QDateTime, QDateTime, bool allDay ); | 231 | void newEvent(QDateTime, QDateTime, bool allDay ); |
231 | void newEvent(QDateTime, QDateTime); | 232 | void newEvent(QDateTime, QDateTime); |
232 | void newEvent(QDateTime fh); | 233 | void newEvent(QDateTime fh); |
233 | void newEvent(QDate dt); | 234 | void newEvent(QDate dt); |
234 | /** create new event without having a date hint. Takes current date as | 235 | /** create new event without having a date hint. Takes current date as |
235 | default hint. */ | 236 | default hint. */ |
236 | void newEvent(); | 237 | void newEvent(); |
237 | void newFloatingEvent(); | 238 | void newFloatingEvent(); |
238 | 239 | ||
239 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 240 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
240 | void showIncidence(Incidence *); | 241 | void showIncidence(Incidence *); |
241 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 242 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
242 | void editIncidence(Incidence *); | 243 | void editIncidence(Incidence *); |
243 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 244 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
244 | void deleteIncidence(Incidence *); | 245 | void deleteIncidence(Incidence *); |
245 | void cloneIncidence(Incidence *); | 246 | void cloneIncidence(Incidence *); |
246 | void cancelIncidence(Incidence *); | 247 | void cancelIncidence(Incidence *); |
247 | /** Create an editor for the supplied event. */ | 248 | /** Create an editor for the supplied event. */ |
248 | void editEvent(Event *); | 249 | void editEvent(Event *); |
249 | /** Delete the supplied event. */ | 250 | /** Delete the supplied event. */ |
250 | void deleteEvent(Event *); | 251 | void deleteEvent(Event *); |
251 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 252 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
252 | found. */ | 253 | found. */ |
253 | bool deleteEvent(const QString &uid); | 254 | bool deleteEvent(const QString &uid); |
254 | /** Create a read-only viewer dialog for the supplied event. */ | 255 | /** Create a read-only viewer dialog for the supplied event. */ |
255 | void showEvent(Event *); | 256 | void showEvent(Event *); |
256 | 257 | ||
257 | void editJournal(Journal *); | 258 | void editJournal(Journal *); |
258 | void showJournal(Journal *); | 259 | void showJournal(Journal *); |
259 | void deleteJournal(Journal *); | 260 | void deleteJournal(Journal *); |
260 | /** Create an editor dialog for a todo */ | 261 | /** Create an editor dialog for a todo */ |
261 | void editTodo(Todo *); | 262 | void editTodo(Todo *); |
262 | /** Create a read-only viewer dialog for the supplied todo */ | 263 | /** Create a read-only viewer dialog for the supplied todo */ |
263 | void showTodo(Todo *); | 264 | void showTodo(Todo *); |
264 | /** create new todo */ | 265 | /** create new todo */ |
265 | void newTodo(); | 266 | void newTodo(); |
266 | void newTodoDateTime(QDateTime, bool allday); | 267 | void newTodoDateTime(QDateTime, bool allday); |
267 | /** create new todo with a parent todo */ | 268 | /** create new todo with a parent todo */ |
268 | void newSubTodo(); | 269 | void newSubTodo(); |
269 | /** create new todo with a parent todo */ | 270 | /** create new todo with a parent todo */ |
270 | void newSubTodo(Todo *); | 271 | void newSubTodo(Todo *); |
271 | /** Delete todo */ | 272 | /** Delete todo */ |
272 | void deleteTodo(Todo *); | 273 | void deleteTodo(Todo *); |
273 | 274 | ||
274 | 275 | ||
275 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 276 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
276 | * emitted as result. */ | 277 | * emitted as result. */ |
277 | void checkClipboard(); | 278 | void checkClipboard(); |
278 | 279 | ||
279 | /** using the KConfig associated with the kapp variable, read in the | 280 | /** using the KConfig associated with the kapp variable, read in the |
280 | * settings from the config file. | 281 | * settings from the config file. |
281 | */ | 282 | */ |
282 | void readSettings(); | 283 | void readSettings(); |
283 | 284 | ||
284 | /** write current state to config file. */ | 285 | /** write current state to config file. */ |
285 | void writeSettings(); | 286 | void writeSettings(); |
286 | 287 | ||
287 | /** read settings for calendar filters */ | 288 | /** read settings for calendar filters */ |
288 | void readFilterSettings(KConfig *config); | 289 | void readFilterSettings(KConfig *config); |
289 | 290 | ||
290 | /** write settings for calendar filters */ | 291 | /** write settings for calendar filters */ |
291 | void writeFilterSettings(KConfig *config); | 292 | void writeFilterSettings(KConfig *config); |
292 | 293 | ||
293 | /** passes on the message that an event has changed to the currently | 294 | /** passes on the message that an event has changed to the currently |
294 | * activated view so that it can make appropriate display changes. */ | 295 | * activated view so that it can make appropriate display changes. */ |
295 | void changeEventDisplay(Event *, int); | 296 | void changeEventDisplay(Event *, int); |
296 | void changeIncidenceDisplay(Incidence *, int); | 297 | void changeIncidenceDisplay(Incidence *, int); |
297 | void changeTodoDisplay(Todo *, int); | 298 | void changeTodoDisplay(Todo *, int); |
298 | 299 | ||
299 | void eventAdded(Event *); | 300 | void eventAdded(Event *); |
300 | void eventChanged(Event *); | 301 | void eventChanged(Event *); |
301 | void eventToBeDeleted(Event *); | 302 | void eventToBeDeleted(Event *); |
302 | void eventDeleted(); | 303 | void eventDeleted(); |
303 | 304 | ||
304 | void todoAdded(Todo *); | 305 | void todoAdded(Todo *); |
305 | void todoChanged(Todo *); | 306 | void todoChanged(Todo *); |
306 | void todoToBeDeleted(Todo *); | 307 | void todoToBeDeleted(Todo *); |
307 | void todoDeleted(); | 308 | void todoDeleted(); |
308 | 309 | ||
309 | void updateView(const QDate &start, const QDate &end); | 310 | void updateView(const QDate &start, const QDate &end); |
310 | void updateView(); | 311 | void updateView(); |
311 | 312 | ||
312 | /** Full update of visible todo views */ | 313 | /** Full update of visible todo views */ |
313 | void updateTodoViews(); | 314 | void updateTodoViews(); |
314 | 315 | ||
315 | void updateUnmanagedViews(); | 316 | void updateUnmanagedViews(); |
316 | 317 | ||
317 | /** cut the current appointment to the clipboard */ | 318 | /** cut the current appointment to the clipboard */ |
318 | void edit_cut(); | 319 | void edit_cut(); |
319 | 320 | ||
320 | /** copy the current appointment(s) to the clipboard */ | 321 | /** copy the current appointment(s) to the clipboard */ |
321 | void edit_copy(); | 322 | void edit_copy(); |
322 | 323 | ||
323 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 324 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
324 | void edit_paste(); | 325 | void edit_paste(); |
325 | 326 | ||
326 | /** edit viewing and configuration options. */ | 327 | /** edit viewing and configuration options. */ |
327 | void edit_options(); | 328 | void edit_options(); |
328 | /** | 329 | /** |
329 | Functions for printing, previewing a print, and setting up printing | 330 | Functions for printing, previewing a print, and setting up printing |
330 | parameters. | 331 | parameters. |
331 | */ | 332 | */ |
332 | void print(); | 333 | void print(); |
333 | void printSetup(); | 334 | void printSetup(); |
334 | void printPreview(); | 335 | void printPreview(); |
335 | 336 | ||
336 | /** Export as iCalendar file */ | 337 | /** Export as iCalendar file */ |
337 | void exportICalendar(); | 338 | void exportICalendar(); |
338 | 339 | ||
339 | /** Export as vCalendar file */ | 340 | /** Export as vCalendar file */ |
340 | bool exportVCalendar( QString fn); | 341 | bool exportVCalendar( QString fn); |
341 | 342 | ||
342 | /** pop up a dialog to show an existing appointment. */ | 343 | /** pop up a dialog to show an existing appointment. */ |
343 | void appointment_show(); | 344 | void appointment_show(); |
344 | /** | 345 | /** |
345 | * pop up an Appointment Dialog to edit an existing appointment.Get | 346 | * pop up an Appointment Dialog to edit an existing appointment.Get |
346 | * information on the appointment from the list of unique IDs that is | 347 | * information on the appointment from the list of unique IDs that is |
347 | * currently in the View, called currIds. | 348 | * currently in the View, called currIds. |
348 | */ | 349 | */ |
349 | void appointment_edit(); | 350 | void appointment_edit(); |
350 | /** | 351 | /** |
351 | * pop up dialog confirming deletion of currently selected event in the | 352 | * pop up dialog confirming deletion of currently selected event in the |
352 | * View. | 353 | * View. |
353 | */ | 354 | */ |
354 | void appointment_delete(); | 355 | void appointment_delete(); |
355 | 356 | ||
356 | /** mails the currently selected event to a particular user as a vCalendar | 357 | /** mails the currently selected event to a particular user as a vCalendar |
357 | attachment. */ | 358 | attachment. */ |
358 | void action_mail(); | 359 | void action_mail(); |
359 | 360 | ||
360 | /* frees a subtodo from it's relation */ | 361 | /* frees a subtodo from it's relation */ |
361 | void todo_unsub( Todo * ); | 362 | void todo_unsub( Todo * ); |
362 | void todo_resub( Todo * parent, Todo * sub ); | 363 | void todo_resub( Todo * parent, Todo * sub ); |
363 | 364 | ||
364 | /** Take ownership of selected event. */ | 365 | /** Take ownership of selected event. */ |
365 | void takeOverEvent(); | 366 | void takeOverEvent(); |
366 | 367 | ||
367 | /** Take ownership of all events in calendar. */ | 368 | /** Take ownership of all events in calendar. */ |
368 | void takeOverCalendar(); | 369 | void takeOverCalendar(); |
369 | 370 | ||
370 | /** query whether or not the calendar is "dirty". */ | 371 | /** query whether or not the calendar is "dirty". */ |
371 | bool isModified(); | 372 | bool isModified(); |
372 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 373 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
373 | void setModified(bool modified=true); | 374 | void setModified(bool modified=true); |
374 | 375 | ||
375 | /** query if the calendar is read-only. */ | 376 | /** query if the calendar is read-only. */ |
376 | bool isReadOnly(); | 377 | bool isReadOnly(); |
377 | /** set state of calendar to read-only */ | 378 | /** set state of calendar to read-only */ |
378 | void setReadOnly(bool readOnly=true); | 379 | void setReadOnly(bool readOnly=true); |
379 | 380 | ||
380 | void eventUpdated(Incidence *); | 381 | void eventUpdated(Incidence *); |
381 | 382 | ||
382 | /* iTIP scheduling actions */ | 383 | /* iTIP scheduling actions */ |
383 | void schedule_publish(Incidence *incidence = 0); | 384 | void schedule_publish(Incidence *incidence = 0); |
384 | void schedule_request(Incidence *incidence = 0); | 385 | void schedule_request(Incidence *incidence = 0); |
385 | void schedule_refresh(Incidence *incidence = 0); | 386 | void schedule_refresh(Incidence *incidence = 0); |
386 | void schedule_cancel(Incidence *incidence = 0); | 387 | void schedule_cancel(Incidence *incidence = 0); |
387 | void schedule_add(Incidence *incidence = 0); | 388 | void schedule_add(Incidence *incidence = 0); |
388 | void schedule_reply(Incidence *incidence = 0); | 389 | void schedule_reply(Incidence *incidence = 0); |
389 | void schedule_counter(Incidence *incidence = 0); | 390 | void schedule_counter(Incidence *incidence = 0); |
390 | void schedule_declinecounter(Incidence *incidence = 0); | 391 | void schedule_declinecounter(Incidence *incidence = 0); |
391 | void schedule_publish_freebusy(int daysToPublish = 30); | 392 | void schedule_publish_freebusy(int daysToPublish = 30); |
392 | 393 | ||
393 | void openAddressbook(); | 394 | void openAddressbook(); |
394 | 395 | ||
395 | void editFilters(); | 396 | void editFilters(); |
396 | void toggleFilerEnabled(); | 397 | void toggleFilerEnabled(); |
397 | QPtrList<CalFilter> filters(); | 398 | QPtrList<CalFilter> filters(); |
398 | void toggleFilter(); | 399 | void toggleFilter(); |
399 | void showFilter(bool visible); | 400 | void showFilter(bool visible); |
400 | void updateFilter(); | 401 | void updateFilter(); |
401 | void filterEdited(); | 402 | void filterEdited(); |
402 | void selectFilter( int ); | 403 | void selectFilter( int ); |
403 | KOFilterView *filterView(); | 404 | KOFilterView *filterView(); |
404 | 405 | ||
405 | void showIntro(); | 406 | void showIntro(); |
406 | 407 | ||
407 | /** Move the curdatepient view date to today */ | 408 | /** Move the curdatepient view date to today */ |
408 | void goToday(); | 409 | void goToday(); |
409 | 410 | ||
410 | /** Move to the next date(s) in the current view */ | 411 | /** Move to the next date(s) in the current view */ |
411 | void goNext(); | 412 | void goNext(); |
412 | 413 | ||
413 | /** Move to the previous date(s) in the current view */ | 414 | /** Move to the previous date(s) in the current view */ |
414 | void goPrevious(); | 415 | void goPrevious(); |
415 | /** Move to the next date(s) in the current view */ | 416 | /** Move to the next date(s) in the current view */ |
416 | void goNextMonth(); | 417 | void goNextMonth(); |
417 | 418 | ||
418 | /** Move to the previous date(s) in the current view */ | 419 | /** Move to the previous date(s) in the current view */ |
419 | void goPreviousMonth(); | 420 | void goPreviousMonth(); |
420 | 421 | ||
421 | void toggleExpand(); | 422 | void toggleExpand(); |
422 | void toggleDateNavigatorWidget(); | 423 | void toggleDateNavigatorWidget(); |
423 | void toggleAllDaySize(); | 424 | void toggleAllDaySize(); |
424 | void dialogClosing(Incidence *); | 425 | void dialogClosing(Incidence *); |
425 | 426 | ||
426 | /** Look for new messages in the inbox */ | 427 | /** Look for new messages in the inbox */ |
427 | void lookForIncomingMessages(); | 428 | void lookForIncomingMessages(); |
428 | /** Look for new messages in the outbox */ | 429 | /** Look for new messages in the outbox */ |
429 | void lookForOutgoingMessages(); | 430 | void lookForOutgoingMessages(); |
430 | 431 | ||
431 | void processMainViewSelection( Incidence * ); | 432 | void processMainViewSelection( Incidence * ); |
432 | void processTodoListSelection( Incidence * ); | 433 | void processTodoListSelection( Incidence * ); |
433 | 434 | ||
434 | void processIncidenceSelection( Incidence * ); | 435 | void processIncidenceSelection( Incidence * ); |
435 | 436 | ||
436 | void purgeCompleted(); | 437 | void purgeCompleted(); |
437 | bool removeCompletedSubTodos( Todo* ); | 438 | bool removeCompletedSubTodos( Todo* ); |
438 | void slotCalendarChanged(); | 439 | void slotCalendarChanged(); |
439 | bool importBday(); | 440 | bool importBday(); |
440 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 441 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
441 | bool importQtopia( const QString &categoriesFile, | 442 | bool importQtopia( const QString &categoriesFile, |
442 | const QString &datebookFile, | 443 | const QString &datebookFile, |
443 | const QString &tasklistFile ); | 444 | const QString &tasklistFile ); |
444 | void syncExternal( int mode ); | 445 | void syncExternal( int mode ); |
445 | void slotSelectPickerDate( QDate ) ; | 446 | void slotSelectPickerDate( QDate ) ; |
446 | void showDatePicker() ; | 447 | void showDatePicker() ; |
447 | void showDatePickerPopup() ; | 448 | void showDatePickerPopup() ; |
448 | void moveIncidence(Incidence *) ; | 449 | void moveIncidence(Incidence *) ; |
449 | void beamIncidence(Incidence *) ; | 450 | void beamIncidence(Incidence *) ; |
450 | void beamCalendar() ; | 451 | void beamCalendar() ; |
451 | void beamFilteredCalendar() ; | 452 | void beamFilteredCalendar() ; |
452 | void beamIncidenceList(QPtrList<Incidence>) ; | 453 | void beamIncidenceList(QPtrList<Incidence>) ; |
453 | void manageCategories(); | 454 | void manageCategories(); |
454 | int addCategories(); | 455 | int addCategories(); |
455 | void removeCategories(); | 456 | void removeCategories(); |
456 | void setSyncDevice( QString ); | 457 | void setSyncDevice( QString ); |
457 | void setSyncName( QString ); | 458 | void setSyncName( QString ); |
458 | void showDay( QDate ); | 459 | void showDay( QDate ); |
459 | void undo_delete(); | 460 | void undo_delete(); |
460 | protected slots: | 461 | protected slots: |
461 | void resetFocus(); | 462 | void resetFocus(); |
462 | void slotViewerClosed(); | 463 | void slotViewerClosed(); |
463 | void timerAlarm(); | 464 | void timerAlarm(); |
464 | void suspendAlarm(); | 465 | void suspendAlarm(); |
465 | void beamDone( Ir *ir ); | 466 | void beamDone( Ir *ir ); |
466 | /** Select a view or adapt the current view to display the specified dates. */ | 467 | /** Select a view or adapt the current view to display the specified dates. */ |
467 | void showDates( const KCal::DateList & ); | 468 | void showDates( const KCal::DateList & ); |
468 | void selectWeekNum ( int ); | 469 | void selectWeekNum ( int ); |
469 | 470 | ||
470 | public: | 471 | public: |
471 | // show a standard warning | 472 | // show a standard warning |
472 | // returns KMsgBox::yesNoCancel() | 473 | // returns KMsgBox::yesNoCancel() |
473 | int msgCalModified(); | 474 | int msgCalModified(); |
474 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 475 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
475 | 476 | ||
476 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 477 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
477 | virtual void removeSyncInfo( QString syncProfile); | 478 | virtual void removeSyncInfo( QString syncProfile); |
478 | void setSyncManager(KSyncManager* manager); | 479 | void setSyncManager(KSyncManager* manager); |
479 | void setLoadedFileVersion(QDateTime); | 480 | void setLoadedFileVersion(QDateTime); |
480 | bool checkFileVersion(QString fn); | 481 | bool checkFileVersion(QString fn); |
481 | bool checkFileChanged(QString fn); | 482 | bool checkFileChanged(QString fn); |
482 | Event* getLastSyncEvent(); | 483 | Event* getLastSyncEvent(); |
483 | /** Adapt navigation units correpsonding to step size of navigation of the | 484 | /** Adapt navigation units correpsonding to step size of navigation of the |
484 | * current view. | 485 | * current view. |
485 | */ | 486 | */ |
486 | void adaptNavigationUnits(); | 487 | void adaptNavigationUnits(); |
487 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 488 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
488 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 489 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
489 | //Attendee* getYourAttendee(Event *event); | 490 | //Attendee* getYourAttendee(Event *event); |
490 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 491 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
491 | protected: | 492 | protected: |
492 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 493 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
493 | 494 | ||
494 | // returns KMsgBox::OKCandel() | 495 | // returns KMsgBox::OKCandel() |
495 | int msgItemDelete(const QString name); | 496 | int msgItemDelete(const QString name); |
496 | void showEventEditor(); | 497 | void showEventEditor(); |
497 | void showTodoEditor(); | 498 | void showTodoEditor(); |
498 | void writeLocale(); | 499 | void writeLocale(); |
499 | Todo *selectedTodo(); | 500 | Todo *selectedTodo(); |
500 | 501 | ||
501 | private: | 502 | private: |
503 | QDateTime mNextAlarmDateTime; | ||
502 | bool mViewerCallerIsSearchDialog; | 504 | bool mViewerCallerIsSearchDialog; |
503 | bool mBlockShowDates; | 505 | bool mBlockShowDates; |
504 | KSyncManager* mSyncManager; | 506 | KSyncManager* mSyncManager; |
505 | AlarmDialog * mAlarmDialog; | 507 | AlarmDialog * mAlarmDialog; |
506 | QString mAlarmNotification; | 508 | QString mAlarmNotification; |
507 | QString mSuspendAlarmNotification; | 509 | QString mSuspendAlarmNotification; |
508 | QTimer* mSuspendTimer; | 510 | QTimer* mSuspendTimer; |
509 | QTimer* mAlarmTimer; | 511 | QTimer* mAlarmTimer; |
510 | QTimer* mRecheckAlarmTimer; | 512 | QTimer* mRecheckAlarmTimer; |
511 | void computeAlarm( QString ); | 513 | void computeAlarm( QString ); |
512 | void startAlarm( QString, QString ); | 514 | void startAlarm( QString, QString ); |
513 | void setSyncEventsReadOnly(); | 515 | void setSyncEventsReadOnly(); |
514 | 516 | ||
515 | QDateTime loadedFileVersion; | 517 | QDateTime loadedFileVersion; |
516 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 518 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
517 | void checkExternalId( Incidence * inc ); | 519 | void checkExternalId( Incidence * inc ); |
518 | int mGlobalSyncMode; | 520 | int mGlobalSyncMode; |
519 | QString mCurrentSyncDevice; | 521 | QString mCurrentSyncDevice; |
520 | QString mCurrentSyncName; | 522 | QString mCurrentSyncName; |
521 | KOBeamPrefs* beamDialog; | 523 | KOBeamPrefs* beamDialog; |
522 | void init(); | 524 | void init(); |
523 | int mDatePickerMode; | 525 | int mDatePickerMode; |
524 | bool mFlagEditDescription; | 526 | bool mFlagEditDescription; |
525 | QDateTime mLastCalendarSync; | 527 | QDateTime mLastCalendarSync; |
526 | void createPrinter(); | 528 | void createPrinter(); |
527 | 529 | ||
528 | void calendarModified( bool, Calendar * ); | 530 | void calendarModified( bool, Calendar * ); |
529 | 531 | ||
530 | CalPrinter *mCalPrinter; | 532 | CalPrinter *mCalPrinter; |
531 | 533 | ||
532 | QSplitter *mPanner; | 534 | QSplitter *mPanner; |
533 | QSplitter *mLeftSplitter; | 535 | QSplitter *mLeftSplitter; |
534 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 536 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
535 | QWidgetStack *mRightFrame; | 537 | QWidgetStack *mRightFrame; |
536 | 538 | ||
537 | KDatePicker* mDatePicker; | 539 | KDatePicker* mDatePicker; |
538 | QVBox* mDateFrame; | 540 | QVBox* mDateFrame; |
539 | 541 | ||
540 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 542 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
541 | 543 | ||
542 | KOFilterView *mFilterView; | 544 | KOFilterView *mFilterView; |
543 | 545 | ||
544 | ResourceView *mResourceView; | 546 | ResourceView *mResourceView; |
545 | 547 | ||
546 | // calendar object for this viewing instance | 548 | // calendar object for this viewing instance |
547 | Calendar *mCalendar; | 549 | Calendar *mCalendar; |
548 | 550 | ||
549 | CalendarResourceManager *mResourceManager; | 551 | CalendarResourceManager *mResourceManager; |
550 | 552 | ||
551 | FileStorage *mStorage; | 553 | FileStorage *mStorage; |
552 | 554 | ||
553 | DateNavigator *mNavigator; | 555 | DateNavigator *mNavigator; |
554 | 556 | ||
555 | KOViewManager *mViewManager; | 557 | KOViewManager *mViewManager; |
556 | KODialogManager *mDialogManager; | 558 | KODialogManager *mDialogManager; |
557 | 559 | ||
558 | // Calendar filters | 560 | // Calendar filters |
559 | QPtrList<CalFilter> mFilters; | 561 | QPtrList<CalFilter> mFilters; |
560 | 562 | ||
561 | // various housekeeping variables. | 563 | // various housekeeping variables. |
562 | bool mModified; // flag indicating if calendar is modified | 564 | bool mModified; // flag indicating if calendar is modified |
563 | bool mReadOnly; // flag indicating if calendar is read-only | 565 | bool mReadOnly; // flag indicating if calendar is read-only |
564 | QDate mSaveSingleDate; | 566 | QDate mSaveSingleDate; |
565 | 567 | ||
566 | Incidence *mSelectedIncidence; | 568 | Incidence *mSelectedIncidence; |
567 | Incidence *mMoveIncidence; | 569 | Incidence *mMoveIncidence; |
568 | QDate mMoveIncidenceOldDate; | 570 | QDate mMoveIncidenceOldDate; |
569 | KOTodoView *mTodoList; | 571 | KOTodoView *mTodoList; |
570 | KOEventEditor * mEventEditor; | 572 | KOEventEditor * mEventEditor; |
571 | KOTodoEditor * mTodoEditor; | 573 | KOTodoEditor * mTodoEditor; |
572 | KOEventViewerDialog * mEventViewerDialog; | 574 | KOEventViewerDialog * mEventViewerDialog; |
573 | void keyPressEvent ( QKeyEvent *e) ; | 575 | void keyPressEvent ( QKeyEvent *e) ; |
574 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 576 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
575 | }; | 577 | }; |
576 | 578 | ||
577 | 579 | ||
578 | class CalendarViewVisitor : public Incidence::Visitor | 580 | class CalendarViewVisitor : public Incidence::Visitor |
579 | { | 581 | { |
580 | public: | 582 | public: |
581 | CalendarViewVisitor() : mView( 0 ) {} | 583 | CalendarViewVisitor() : mView( 0 ) {} |
582 | 584 | ||
583 | bool act( Incidence *incidence, CalendarView *view ) | 585 | bool act( Incidence *incidence, CalendarView *view ) |
584 | { | 586 | { |
585 | mView = view; | 587 | mView = view; |
586 | return incidence->accept( *this ); | 588 | return incidence->accept( *this ); |
587 | } | 589 | } |
588 | 590 | ||
589 | protected: | 591 | protected: |
590 | CalendarView *mView; | 592 | CalendarView *mView; |
591 | }; | 593 | }; |
592 | 594 | ||
593 | class ShowIncidenceVisitor : public CalendarViewVisitor | 595 | class ShowIncidenceVisitor : public CalendarViewVisitor |
594 | { | 596 | { |
595 | protected: | 597 | protected: |
596 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 598 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
597 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 599 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
598 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 600 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
599 | }; | 601 | }; |
600 | 602 | ||
601 | class EditIncidenceVisitor : public CalendarViewVisitor | 603 | class EditIncidenceVisitor : public CalendarViewVisitor |
602 | { | 604 | { |
603 | protected: | 605 | protected: |
604 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 606 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
605 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 607 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
606 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 608 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
607 | }; | 609 | }; |
608 | 610 | ||
609 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 611 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
610 | { | 612 | { |
611 | protected: | 613 | protected: |
612 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 614 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
613 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 615 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
614 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 616 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
615 | }; | 617 | }; |
616 | 618 | ||
617 | #endif | 619 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95b836c..7a4275b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -81,1025 +81,1025 @@ class KOex2phonePrefs : public QDialog | |||
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
136 | mClosed = false; | 136 | mClosed = false; |
137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
138 | QString confFile = locateLocal("config","korganizerrc"); | 138 | QString confFile = locateLocal("config","korganizerrc"); |
139 | QFileInfo finf ( confFile ); | 139 | QFileInfo finf ( confFile ); |
140 | bool showWarning = !finf.exists(); | 140 | bool showWarning = !finf.exists(); |
141 | setIcon(SmallIcon( "ko24" ) ); | 141 | setIcon(SmallIcon( "ko24" ) ); |
142 | mBlockAtStartup = true; | 142 | mBlockAtStartup = true; |
143 | mFlagKeyPressed = false; | 143 | mFlagKeyPressed = false; |
144 | setCaption("KO/Pi"); | 144 | setCaption("KO/Pi"); |
145 | KOPrefs *p = KOPrefs::instance(); | 145 | KOPrefs *p = KOPrefs::instance(); |
146 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 146 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
147 | if ( p->mHourSize > 22 ) | 147 | if ( p->mHourSize > 22 ) |
148 | p->mHourSize = 22; | 148 | p->mHourSize = 22; |
149 | QMainWindow::ToolBarDock tbd; | 149 | QMainWindow::ToolBarDock tbd; |
150 | if ( p->mToolBarHor ) { | 150 | if ( p->mToolBarHor ) { |
151 | if ( p->mToolBarUp ) | 151 | if ( p->mToolBarUp ) |
152 | tbd = Bottom; | 152 | tbd = Bottom; |
153 | else | 153 | else |
154 | tbd = Top; | 154 | tbd = Top; |
155 | } | 155 | } |
156 | else { | 156 | else { |
157 | if ( p->mToolBarUp ) | 157 | if ( p->mToolBarUp ) |
158 | tbd = Right; | 158 | tbd = Right; |
159 | else | 159 | else |
160 | tbd = Left; | 160 | tbd = Left; |
161 | } | 161 | } |
162 | if ( KOPrefs::instance()->mUseAppColors ) | 162 | if ( KOPrefs::instance()->mUseAppColors ) |
163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
164 | globalFlagBlockStartup = 1; | 164 | globalFlagBlockStartup = 1; |
165 | iconToolBar = new QPEToolBar( this ); | 165 | iconToolBar = new QPEToolBar( this ); |
166 | addToolBar (iconToolBar , tbd ); | 166 | addToolBar (iconToolBar , tbd ); |
167 | mCalendarModifiedFlag = false; | 167 | mCalendarModifiedFlag = false; |
168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
169 | splash->setAlignment ( AlignCenter ); | 169 | splash->setAlignment ( AlignCenter ); |
170 | setCentralWidget( splash ); | 170 | setCentralWidget( splash ); |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | showMaximized(); | 172 | showMaximized(); |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
176 | setDefaultPreferences(); | 176 | setDefaultPreferences(); |
177 | mCalendar = new CalendarLocal(); | 177 | mCalendar = new CalendarLocal(); |
178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
179 | mView->hide(); | 179 | mView->hide(); |
180 | //mView->resize(splash->size() ); | 180 | //mView->resize(splash->size() ); |
181 | initActions(); | 181 | initActions(); |
182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
183 | mSyncManager->setBlockSave(false); | 183 | mSyncManager->setBlockSave(false); |
184 | mView->setSyncManager(mSyncManager); | 184 | mView->setSyncManager(mSyncManager); |
185 | #ifndef DESKTOP_VERSION | 185 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 186 | iconToolBar->show(); |
187 | qApp->processEvents(); | 187 | qApp->processEvents(); |
188 | #endif | 188 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 190 | int vh = height() ; |
191 | int vw = width(); | 191 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 194 | vh -= iconToolBar->height(); |
195 | } else { | 195 | } else { |
196 | vw -= iconToolBar->height(); | 196 | vw -= iconToolBar->height(); |
197 | } | 197 | } |
198 | //mView->setMaximumSize( splash->size() ); | 198 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 199 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 201 | mView->readSettings(); |
202 | bool newFile = false; | 202 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 203 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 204 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 206 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
208 | finfo.setFile( oldFile ); | 208 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 209 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 210 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 211 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 212 | qApp->processEvents(); |
213 | } else { | 213 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 215 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 216 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 217 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 218 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 219 | qApp->processEvents(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | mView->saveCalendar( defaultFileName() ); | 222 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 223 | newFile = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 227 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 230 | ||
231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
232 | KOPrefs::instance()->setAllDefaults(); | 232 | KOPrefs::instance()->setAllDefaults(); |
233 | int count = mView->addCategories(); | 233 | int count = mView->addCategories(); |
234 | } | 234 | } |
235 | processIncidenceSelection( 0 ); | 235 | processIncidenceSelection( 0 ); |
236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
237 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 237 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
239 | SLOT( slotModifiedChanged( bool ) ) ); | 239 | SLOT( slotModifiedChanged( bool ) ) ); |
240 | 240 | ||
241 | 241 | ||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | updateWeek( mView->startDate() ); | 285 | updateWeek( mView->startDate() ); |
286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | } | 290 | } |
291 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
292 | { | 292 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 294 | //save toolbar location |
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" ) { | 487 | else if ( msg == "-showWNext" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "nextView()" ) { | 490 | else if ( msg == "nextView()" ) { |
491 | mView->viewManager()->showNextView(); | 491 | mView->viewManager()->showNextView(); |
492 | } | 492 | } |
493 | else if ( msg == "-showNextXView" ) { | 493 | else if ( msg == "-showNextXView" ) { |
494 | mView->viewManager()->showNextXView(); | 494 | mView->viewManager()->showNextXView(); |
495 | } | 495 | } |
496 | 496 | ||
497 | 497 | ||
498 | } | 498 | } |
499 | 499 | ||
500 | showMaximized(); | 500 | showMaximized(); |
501 | raise(); | 501 | raise(); |
502 | } | 502 | } |
503 | 503 | ||
504 | QPixmap MainWindow::loadPixmap( QString name ) | 504 | QPixmap MainWindow::loadPixmap( QString name ) |
505 | { | 505 | { |
506 | return SmallIcon( name ); | 506 | return SmallIcon( name ); |
507 | 507 | ||
508 | } | 508 | } |
509 | void MainWindow::initActions() | 509 | void MainWindow::initActions() |
510 | { | 510 | { |
511 | //KOPrefs::instance()->mShowFullMenu | 511 | //KOPrefs::instance()->mShowFullMenu |
512 | iconToolBar->clear(); | 512 | iconToolBar->clear(); |
513 | KOPrefs *p = KOPrefs::instance(); | 513 | KOPrefs *p = KOPrefs::instance(); |
514 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 514 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
515 | 515 | ||
516 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 516 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
517 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 517 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
518 | QPopupMenu *importMenu = new QPopupMenu( this ); | 518 | QPopupMenu *importMenu = new QPopupMenu( this ); |
519 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 519 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
520 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 520 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
521 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 521 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
522 | selectFilterMenu = new QPopupMenu( this ); | 522 | selectFilterMenu = new QPopupMenu( this ); |
523 | selectFilterMenu->setCheckable( true ); | 523 | selectFilterMenu->setCheckable( true ); |
524 | syncMenu = new QPopupMenu( this ); | 524 | syncMenu = new QPopupMenu( this ); |
525 | configureAgendaMenu = new QPopupMenu( this ); | 525 | configureAgendaMenu = new QPopupMenu( this ); |
526 | configureToolBarMenu = new QPopupMenu( this ); | 526 | configureToolBarMenu = new QPopupMenu( this ); |
527 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 527 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
528 | QIconSet icon; | 528 | QIconSet icon; |
529 | int pixWid = 22, pixHei = 22; | 529 | int pixWid = 22, pixHei = 22; |
530 | QString pathString = ""; | 530 | QString pathString = ""; |
531 | if ( !p->mToolBarMiniIcons ) { | 531 | if ( !p->mToolBarMiniIcons ) { |
532 | if ( QApplication::desktop()->width() < 480 ) { | 532 | if ( QApplication::desktop()->width() < 480 ) { |
533 | pathString += "icons16/"; | 533 | pathString += "icons16/"; |
534 | pixWid = 18; pixHei = 16; | 534 | pixWid = 18; pixHei = 16; |
535 | } | 535 | } |
536 | } else { | 536 | } else { |
537 | pathString += "iconsmini/"; | 537 | pathString += "iconsmini/"; |
538 | pixWid = 18; pixHei = 16; | 538 | pixWid = 18; pixHei = 16; |
539 | } | 539 | } |
540 | if ( KOPrefs::instance()->mShowFullMenu ) { | 540 | if ( KOPrefs::instance()->mShowFullMenu ) { |
541 | QMenuBar *menuBar1; | 541 | QMenuBar *menuBar1; |
542 | menuBar1 = menuBar(); | 542 | menuBar1 = menuBar(); |
543 | menuBar1->insertItem( i18n("File"), importMenu ); | 543 | menuBar1->insertItem( i18n("File"), importMenu ); |
544 | menuBar1->insertItem( i18n("View"), viewMenu ); | 544 | menuBar1->insertItem( i18n("View"), viewMenu ); |
545 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 545 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
546 | #ifdef DESKTOP_VERSION | 546 | #ifdef DESKTOP_VERSION |
547 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 547 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
548 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 548 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
549 | #else | 549 | #else |
550 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 550 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
551 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 551 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
552 | #endif | 552 | #endif |
553 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 553 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
554 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 554 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
555 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 555 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
556 | } else { | 556 | } else { |
557 | QPEMenuBar *menuBar1; | 557 | QPEMenuBar *menuBar1; |
558 | menuBar1 = new QPEMenuBar( iconToolBar ); | 558 | menuBar1 = new QPEMenuBar( iconToolBar ); |
559 | QPopupMenu *menuBar = new QPopupMenu( this ); | 559 | QPopupMenu *menuBar = new QPopupMenu( this ); |
560 | icon = loadPixmap( pathString + "z_menu" ); | 560 | icon = loadPixmap( pathString + "z_menu" ); |
561 | menuBar1->insertItem( icon.pixmap(), menuBar); | 561 | menuBar1->insertItem( icon.pixmap(), menuBar); |
562 | //menuBar1->insertItem( i18n("ME"), menuBar); | 562 | //menuBar1->insertItem( i18n("ME"), menuBar); |
563 | menuBar->insertItem( i18n("File"), importMenu ); | 563 | menuBar->insertItem( i18n("File"), importMenu ); |
564 | menuBar->insertItem( i18n("View"), viewMenu ); | 564 | menuBar->insertItem( i18n("View"), viewMenu ); |
565 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 565 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
566 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 566 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
567 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 567 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
568 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 568 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
569 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 569 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
570 | menuBar->insertItem( i18n("Help"), helpMenu ); | 570 | menuBar->insertItem( i18n("Help"), helpMenu ); |
571 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 571 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
572 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 572 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
573 | } | 573 | } |
574 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 574 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
575 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 575 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
576 | mWeekBgColor = iconToolBar->backgroundColor(); | 576 | mWeekBgColor = iconToolBar->backgroundColor(); |
577 | mWeekPixmap.resize( pixWid , pixHei ); | 577 | mWeekPixmap.resize( pixWid , pixHei ); |
578 | mWeekPixmap.fill( mWeekBgColor ); | 578 | mWeekPixmap.fill( mWeekBgColor ); |
579 | icon = mWeekPixmap; | 579 | icon = mWeekPixmap; |
580 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 580 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
581 | if ( p-> mShowIconWeekNum ) | 581 | if ( p-> mShowIconWeekNum ) |
582 | mWeekAction->addTo( iconToolBar ); | 582 | mWeekAction->addTo( iconToolBar ); |
583 | mWeekFont = font(); | 583 | mWeekFont = font(); |
584 | 584 | ||
585 | int fontPoint = mWeekFont.pointSize(); | 585 | int fontPoint = mWeekFont.pointSize(); |
586 | QFontMetrics f( mWeekFont ); | 586 | QFontMetrics f( mWeekFont ); |
587 | int fontWid = f.width( "30" ); | 587 | int fontWid = f.width( "30" ); |
588 | while ( fontWid > pixWid ) { | 588 | while ( fontWid > pixWid ) { |
589 | --fontPoint; | 589 | --fontPoint; |
590 | mWeekFont.setPointSize( fontPoint ); | 590 | mWeekFont.setPointSize( fontPoint ); |
591 | QFontMetrics f( mWeekFont ); | 591 | QFontMetrics f( mWeekFont ); |
592 | fontWid = f.width( "30" ); | 592 | fontWid = f.width( "30" ); |
593 | qDebug("dec-- "); | 593 | //qDebug("dec-- "); |
594 | } | 594 | } |
595 | 595 | ||
596 | connect( mWeekAction, SIGNAL( activated() ), | 596 | connect( mWeekAction, SIGNAL( activated() ), |
597 | this, SLOT( weekAction() ) ); | 597 | this, SLOT( weekAction() ) ); |
598 | 598 | ||
599 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 599 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
600 | 600 | ||
601 | //#endif | 601 | //#endif |
602 | // ****************** | 602 | // ****************** |
603 | QAction *action; | 603 | QAction *action; |
604 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 604 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
605 | configureToolBarMenu->setCheckable( true ); | 605 | configureToolBarMenu->setCheckable( true ); |
606 | 606 | ||
607 | 607 | ||
608 | configureAgendaMenu->setCheckable( true ); | 608 | configureAgendaMenu->setCheckable( true ); |
609 | int iii ; | 609 | int iii ; |
610 | for ( iii = 1;iii<= 10 ;++iii ){ | 610 | for ( iii = 1;iii<= 10 ;++iii ){ |
611 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 611 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
612 | } | 612 | } |
613 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 613 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
614 | 614 | ||
615 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 615 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
616 | this, SLOT( showConfigureAgenda( ) ) ); | 616 | this, SLOT( showConfigureAgenda( ) ) ); |
617 | 617 | ||
618 | icon = loadPixmap( pathString + "configure" ); | 618 | icon = loadPixmap( pathString + "configure" ); |
619 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 619 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
620 | action->addTo( actionMenu ); | 620 | action->addTo( actionMenu ); |
621 | connect( action, SIGNAL( activated() ), | 621 | connect( action, SIGNAL( activated() ), |
622 | mView, SLOT( edit_options() ) ); | 622 | mView, SLOT( edit_options() ) ); |
623 | actionMenu->insertSeparator(); | 623 | actionMenu->insertSeparator(); |
624 | 624 | ||
625 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 625 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
626 | action->addTo( actionMenu ); | 626 | action->addTo( actionMenu ); |
627 | connect( action, SIGNAL( activated() ), | 627 | connect( action, SIGNAL( activated() ), |
628 | mView, SLOT( undo_delete() ) ); | 628 | mView, SLOT( undo_delete() ) ); |
629 | actionMenu->insertSeparator(); | 629 | actionMenu->insertSeparator(); |
630 | 630 | ||
631 | icon = loadPixmap( pathString + "newevent" ); | 631 | icon = loadPixmap( pathString + "newevent" ); |
632 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 632 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
633 | configureToolBarMenu->insertSeparator(); | 633 | configureToolBarMenu->insertSeparator(); |
634 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 634 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
635 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
636 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 636 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
637 | ne_action->addTo( actionMenu ); | 637 | ne_action->addTo( actionMenu ); |
638 | connect( ne_action, SIGNAL( activated() ), | 638 | connect( ne_action, SIGNAL( activated() ), |
639 | mView, SLOT( newEvent() ) ); | 639 | mView, SLOT( newEvent() ) ); |
640 | icon = loadPixmap( pathString + "newtodo" ); | 640 | icon = loadPixmap( pathString + "newtodo" ); |
641 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 641 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
642 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 642 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
643 | nt_action->addTo( actionMenu ); | 643 | nt_action->addTo( actionMenu ); |
644 | connect( nt_action, SIGNAL( activated() ), | 644 | connect( nt_action, SIGNAL( activated() ), |
645 | mView, SLOT( newTodo() ) ); | 645 | mView, SLOT( newTodo() ) ); |
646 | 646 | ||
647 | icon = loadPixmap( pathString + "today" ); | 647 | icon = loadPixmap( pathString + "today" ); |
648 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 648 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
649 | today_action->addTo( viewMenu ); | 649 | today_action->addTo( viewMenu ); |
650 | connect( today_action, SIGNAL( activated() ), | 650 | connect( today_action, SIGNAL( activated() ), |
651 | mView, SLOT( goToday() ) ); | 651 | mView, SLOT( goToday() ) ); |
652 | viewMenu->insertSeparator(); | 652 | viewMenu->insertSeparator(); |
653 | 653 | ||
654 | icon = loadPixmap( pathString + "navi" ); | 654 | icon = loadPixmap( pathString + "navi" ); |
655 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 655 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
656 | action->addTo( viewMenu ); | 656 | action->addTo( viewMenu ); |
657 | connect( action, SIGNAL( activated() ), | 657 | connect( action, SIGNAL( activated() ), |
658 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 658 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
659 | mToggleNav = action ; | 659 | mToggleNav = action ; |
660 | icon = loadPixmap( pathString + "filter" ); | 660 | icon = loadPixmap( pathString + "filter" ); |
661 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 661 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
662 | action->addTo( viewMenu ); | 662 | action->addTo( viewMenu ); |
663 | connect( action, SIGNAL( activated() ), | 663 | connect( action, SIGNAL( activated() ), |
664 | mView, SLOT( toggleFilter() ) ); | 664 | mView, SLOT( toggleFilter() ) ); |
665 | mToggleFilter = action; | 665 | mToggleFilter = action; |
666 | icon = loadPixmap( pathString + "allday" ); | 666 | icon = loadPixmap( pathString + "allday" ); |
667 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 667 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
668 | action->addTo( viewMenu ); | 668 | action->addTo( viewMenu ); |
669 | connect( action, SIGNAL( activated() ), | 669 | connect( action, SIGNAL( activated() ), |
670 | mView, SLOT( toggleAllDaySize() ) ); | 670 | mView, SLOT( toggleAllDaySize() ) ); |
671 | mToggleAllday = action; | 671 | mToggleAllday = action; |
672 | 672 | ||
673 | 673 | ||
674 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 674 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
675 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 675 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
676 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 676 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
677 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 677 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
678 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 678 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
679 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 679 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
680 | 680 | ||
681 | viewMenu->insertSeparator(); | 681 | viewMenu->insertSeparator(); |
682 | icon = loadPixmap( pathString + "picker" ); | 682 | icon = loadPixmap( pathString + "picker" ); |
683 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 683 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
684 | action->addTo( viewMenu ); | 684 | action->addTo( viewMenu ); |
685 | connect( action, SIGNAL( activated() ), | 685 | connect( action, SIGNAL( activated() ), |
686 | mView, SLOT( showDatePicker() ) ); | 686 | mView, SLOT( showDatePicker() ) ); |
687 | action->addTo( iconToolBar ); | 687 | action->addTo( iconToolBar ); |
688 | viewMenu->insertSeparator(); | 688 | viewMenu->insertSeparator(); |
689 | 689 | ||
690 | 690 | ||
691 | icon = loadPixmap( pathString + "whatsnext" ); | 691 | icon = loadPixmap( pathString + "whatsnext" ); |
692 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 692 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
693 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 693 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
694 | whatsnext_action->addTo( viewMenu ); | 694 | whatsnext_action->addTo( viewMenu ); |
695 | connect( whatsnext_action, SIGNAL( activated() ), | 695 | connect( whatsnext_action, SIGNAL( activated() ), |
696 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 696 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
697 | 697 | ||
698 | icon = loadPixmap( pathString + "xdays" ); | 698 | icon = loadPixmap( pathString + "xdays" ); |
699 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 699 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
700 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 700 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
701 | xdays_action->addTo( viewMenu ); | 701 | xdays_action->addTo( viewMenu ); |
702 | connect( xdays_action, SIGNAL( activated() ), | 702 | connect( xdays_action, SIGNAL( activated() ), |
703 | mView->viewManager(), SLOT( showNextXView() ) ); | 703 | mView->viewManager(), SLOT( showNextXView() ) ); |
704 | 704 | ||
705 | 705 | ||
706 | icon = loadPixmap( pathString + "journal" ); | 706 | icon = loadPixmap( pathString + "journal" ); |
707 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 707 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
708 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 708 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
709 | viewjournal_action->addTo( viewMenu ); | 709 | viewjournal_action->addTo( viewMenu ); |
710 | connect( viewjournal_action, SIGNAL( activated() ), | 710 | connect( viewjournal_action, SIGNAL( activated() ), |
711 | mView->viewManager(), SLOT( showJournalView() ) ); | 711 | mView->viewManager(), SLOT( showJournalView() ) ); |
712 | 712 | ||
713 | 713 | ||
714 | icon = loadPixmap( pathString + "day" ); | 714 | icon = loadPixmap( pathString + "day" ); |
715 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 715 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
716 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 716 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
717 | day1_action->addTo( viewMenu ); | 717 | day1_action->addTo( viewMenu ); |
718 | // action->addTo( toolBar ); | 718 | // action->addTo( toolBar ); |
719 | connect( day1_action, SIGNAL( activated() ), | 719 | connect( day1_action, SIGNAL( activated() ), |
720 | mView->viewManager(), SLOT( showDayView() ) ); | 720 | mView->viewManager(), SLOT( showDayView() ) ); |
721 | 721 | ||
722 | icon = loadPixmap( pathString + "workweek" ); | 722 | icon = loadPixmap( pathString + "workweek" ); |
723 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 723 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
724 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 724 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
725 | day5_action->addTo( viewMenu ); | 725 | day5_action->addTo( viewMenu ); |
726 | connect( day5_action, SIGNAL( activated() ), | 726 | connect( day5_action, SIGNAL( activated() ), |
727 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 727 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
728 | 728 | ||
729 | icon = loadPixmap( pathString + "week" ); | 729 | icon = loadPixmap( pathString + "week" ); |
730 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 730 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
731 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 731 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
732 | day7_action->addTo( viewMenu ); | 732 | day7_action->addTo( viewMenu ); |
733 | connect( day7_action, SIGNAL( activated() ), | 733 | connect( day7_action, SIGNAL( activated() ), |
734 | mView->viewManager(), SLOT( showWeekView() ) ); | 734 | mView->viewManager(), SLOT( showWeekView() ) ); |
735 | 735 | ||
736 | icon = loadPixmap( pathString + "workweek2" ); | 736 | icon = loadPixmap( pathString + "workweek2" ); |
737 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 737 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
738 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 738 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
739 | day6_action->addTo( viewMenu ); | 739 | day6_action->addTo( viewMenu ); |
740 | connect( day6_action, SIGNAL( activated() ), | 740 | connect( day6_action, SIGNAL( activated() ), |
741 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 741 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
742 | 742 | ||
743 | icon = loadPixmap( pathString + "month" ); | 743 | icon = loadPixmap( pathString + "month" ); |
744 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 744 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
745 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 745 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
746 | month_action->addTo( viewMenu ); | 746 | month_action->addTo( viewMenu ); |
747 | connect( month_action, SIGNAL( activated() ), | 747 | connect( month_action, SIGNAL( activated() ), |
748 | mView->viewManager(), SLOT( showMonthView() ) ); | 748 | mView->viewManager(), SLOT( showMonthView() ) ); |
749 | 749 | ||
750 | icon = loadPixmap( pathString + "list" ); | 750 | icon = loadPixmap( pathString + "list" ); |
751 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 751 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
752 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 752 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
753 | showlist_action->addTo( viewMenu ); | 753 | showlist_action->addTo( viewMenu ); |
754 | connect( showlist_action, SIGNAL( activated() ), | 754 | connect( showlist_action, SIGNAL( activated() ), |
755 | mView->viewManager(), SLOT( showListView() ) ); | 755 | mView->viewManager(), SLOT( showListView() ) ); |
756 | 756 | ||
757 | icon = loadPixmap( pathString + "todo" ); | 757 | icon = loadPixmap( pathString + "todo" ); |
758 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 758 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
759 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 759 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
760 | todoview_action->addTo( viewMenu ); | 760 | todoview_action->addTo( viewMenu ); |
761 | connect( todoview_action, SIGNAL( activated() ), | 761 | connect( todoview_action, SIGNAL( activated() ), |
762 | mView->viewManager(), SLOT( showTodoView() ) ); | 762 | mView->viewManager(), SLOT( showTodoView() ) ); |
763 | 763 | ||
764 | 764 | ||
765 | 765 | ||
766 | #if 0 | 766 | #if 0 |
767 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 767 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
768 | action->addTo( viewMenu ); | 768 | action->addTo( viewMenu ); |
769 | connect( action, SIGNAL( activated() ), | 769 | connect( action, SIGNAL( activated() ), |
770 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 770 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
771 | #endif | 771 | #endif |
772 | 772 | ||
773 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 773 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
774 | this ); | 774 | this ); |
775 | mNewSubTodoAction->addTo( actionMenu ); | 775 | mNewSubTodoAction->addTo( actionMenu ); |
776 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 776 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
777 | mView, SLOT( newSubTodo() ) ); | 777 | mView, SLOT( newSubTodo() ) ); |
778 | 778 | ||
779 | actionMenu->insertSeparator(); | 779 | actionMenu->insertSeparator(); |
780 | 780 | ||
781 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 781 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
782 | mShowAction->addTo( actionMenu ); | 782 | mShowAction->addTo( actionMenu ); |
783 | connect( mShowAction, SIGNAL( activated() ), | 783 | connect( mShowAction, SIGNAL( activated() ), |
784 | mView, SLOT( showIncidence() ) ); | 784 | mView, SLOT( showIncidence() ) ); |
785 | 785 | ||
786 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 786 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
787 | mEditAction->addTo( actionMenu ); | 787 | mEditAction->addTo( actionMenu ); |
788 | connect( mEditAction, SIGNAL( activated() ), | 788 | connect( mEditAction, SIGNAL( activated() ), |
789 | mView, SLOT( editIncidence() ) ); | 789 | mView, SLOT( editIncidence() ) ); |
790 | 790 | ||
791 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 791 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
792 | mDeleteAction->addTo( actionMenu ); | 792 | mDeleteAction->addTo( actionMenu ); |
793 | connect( mDeleteAction, SIGNAL( activated() ), | 793 | connect( mDeleteAction, SIGNAL( activated() ), |
794 | mView, SLOT( deleteIncidence() ) ); | 794 | mView, SLOT( deleteIncidence() ) ); |
795 | 795 | ||
796 | 796 | ||
797 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 797 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
798 | mCloneAction->addTo( actionMenu ); | 798 | mCloneAction->addTo( actionMenu ); |
799 | connect( mCloneAction, SIGNAL( activated() ), | 799 | connect( mCloneAction, SIGNAL( activated() ), |
800 | mView, SLOT( cloneIncidence() ) ); | 800 | mView, SLOT( cloneIncidence() ) ); |
801 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 801 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
802 | mMoveAction->addTo( actionMenu ); | 802 | mMoveAction->addTo( actionMenu ); |
803 | connect( mMoveAction, SIGNAL( activated() ), | 803 | connect( mMoveAction, SIGNAL( activated() ), |
804 | mView, SLOT( moveIncidence() ) ); | 804 | mView, SLOT( moveIncidence() ) ); |
805 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 805 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
806 | mBeamAction->addTo( actionMenu ); | 806 | mBeamAction->addTo( actionMenu ); |
807 | connect( mBeamAction, SIGNAL( activated() ), | 807 | connect( mBeamAction, SIGNAL( activated() ), |
808 | mView, SLOT( beamIncidence() ) ); | 808 | mView, SLOT( beamIncidence() ) ); |
809 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 809 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
810 | mCancelAction->addTo( actionMenu ); | 810 | mCancelAction->addTo( actionMenu ); |
811 | connect( mCancelAction, SIGNAL( activated() ), | 811 | connect( mCancelAction, SIGNAL( activated() ), |
812 | mView, SLOT( toggleCancelIncidence() ) ); | 812 | mView, SLOT( toggleCancelIncidence() ) ); |
813 | 813 | ||
814 | actionMenu->insertSeparator(); | 814 | actionMenu->insertSeparator(); |
815 | 815 | ||
816 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 816 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
817 | this ); | 817 | this ); |
818 | action->addTo( actionMenu ); | 818 | action->addTo( actionMenu ); |
819 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 819 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
820 | 820 | ||
821 | icon = loadPixmap( pathString + "search" ); | 821 | icon = loadPixmap( pathString + "search" ); |
822 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 822 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
823 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 823 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
824 | search_action->addTo( actionMenu ); | 824 | search_action->addTo( actionMenu ); |
825 | connect( search_action, SIGNAL( activated() ), | 825 | connect( search_action, SIGNAL( activated() ), |
826 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 826 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
827 | 827 | ||
828 | 828 | ||
829 | 829 | ||
830 | if ( KOPrefs::instance()->mShowFullMenu ) { | 830 | if ( KOPrefs::instance()->mShowFullMenu ) { |
831 | actionMenu->insertSeparator(); | 831 | actionMenu->insertSeparator(); |
832 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 832 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
833 | 833 | ||
834 | } | 834 | } |
835 | // actionMenu->insertSeparator(); | 835 | // actionMenu->insertSeparator(); |
836 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 836 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
837 | this ); | 837 | this ); |
838 | action->addTo( importMenu_X ); | 838 | action->addTo( importMenu_X ); |
839 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 839 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
840 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 840 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
841 | this ); | 841 | this ); |
842 | action->addTo( importMenu_X ); | 842 | action->addTo( importMenu_X ); |
843 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 843 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
844 | importMenu_X->insertSeparator(); | 844 | importMenu_X->insertSeparator(); |
845 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 845 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
846 | this ); | 846 | this ); |
847 | action->addTo( importMenu_X ); | 847 | action->addTo( importMenu_X ); |
848 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 848 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
849 | //#ifndef DESKTOP_VERSION | 849 | //#ifndef DESKTOP_VERSION |
850 | importMenu_X->insertSeparator(); | 850 | importMenu_X->insertSeparator(); |
851 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 851 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
852 | this ); | 852 | this ); |
853 | action->addTo( importMenu_X ); | 853 | action->addTo( importMenu_X ); |
854 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 854 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
855 | //#else | 855 | //#else |
856 | #ifdef _OL_IMPORT_ | 856 | #ifdef _OL_IMPORT_ |
857 | importMenu_X->insertSeparator(); | 857 | importMenu_X->insertSeparator(); |
858 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 858 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
859 | this ); | 859 | this ); |
860 | action->addTo( importMenu_X ); | 860 | action->addTo( importMenu_X ); |
861 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 861 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
862 | #endif | 862 | #endif |
863 | //#endif | 863 | //#endif |
864 | 864 | ||
865 | //importMenu->insertSeparator(); | 865 | //importMenu->insertSeparator(); |
866 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 866 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
867 | this ); | 867 | this ); |
868 | action->addTo( importMenu ); | 868 | action->addTo( importMenu ); |
869 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 869 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
870 | 870 | ||
871 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 871 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
872 | this ); | 872 | this ); |
873 | action->addTo( importMenu ); | 873 | action->addTo( importMenu ); |
874 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 874 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
875 | importMenu->insertSeparator(); | 875 | importMenu->insertSeparator(); |
876 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 876 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
877 | //importMenu->insertSeparator(); | 877 | //importMenu->insertSeparator(); |
878 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 878 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
879 | this ); | 879 | this ); |
880 | action->addTo( exportMenu_X ); | 880 | action->addTo( exportMenu_X ); |
881 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 881 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
882 | 882 | ||
883 | 883 | ||
884 | //LR | 884 | //LR |
885 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 885 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
886 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 886 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
887 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 887 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
888 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 888 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
889 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 889 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
890 | 890 | ||
891 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 891 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
892 | #ifndef DESKTOP_VERSION | 892 | #ifndef DESKTOP_VERSION |
893 | //importMenu->insertSeparator(); | 893 | //importMenu->insertSeparator(); |
894 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 894 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
895 | this ); | 895 | this ); |
896 | brAction->addTo( beamMenu_X ); | 896 | brAction->addTo( beamMenu_X ); |
897 | brAction->setToggleAction (true ) ; | 897 | brAction->setToggleAction (true ) ; |
898 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 898 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
899 | 899 | ||
900 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 900 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
901 | this ); | 901 | this ); |
902 | action->addTo( beamMenu_X ); | 902 | action->addTo( beamMenu_X ); |
903 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 903 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
904 | 904 | ||
905 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 905 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
906 | this ); | 906 | this ); |
907 | action->addTo( beamMenu_X ); | 907 | action->addTo( beamMenu_X ); |
908 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 908 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
909 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 909 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
910 | #else | 910 | #else |
911 | //importMenu->insertSeparator(); | 911 | //importMenu->insertSeparator(); |
912 | icon = loadPixmap( pathString + "print" ); | 912 | icon = loadPixmap( pathString + "print" ); |
913 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 913 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
914 | action->addTo( beamMenu_X ); | 914 | action->addTo( beamMenu_X ); |
915 | connect( action, SIGNAL( activated() ), | 915 | connect( action, SIGNAL( activated() ), |
916 | this, SLOT( printCal() ) ); | 916 | this, SLOT( printCal() ) ); |
917 | 917 | ||
918 | icon = loadPixmap( pathString + "print" ); | 918 | icon = loadPixmap( pathString + "print" ); |
919 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 919 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
920 | action->addTo( beamMenu_X ); | 920 | action->addTo( beamMenu_X ); |
921 | connect( action, SIGNAL( activated() ), | 921 | connect( action, SIGNAL( activated() ), |
922 | this, SLOT( printSel() ) ); | 922 | this, SLOT( printSel() ) ); |
923 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 923 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
924 | action->addTo( beamMenu_X ); | 924 | action->addTo( beamMenu_X ); |
925 | connect( action, SIGNAL( activated() ), | 925 | connect( action, SIGNAL( activated() ), |
926 | mView->viewManager(), SIGNAL( printWNV() ) ); | 926 | mView->viewManager(), SIGNAL( printWNV() ) ); |
927 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 927 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
928 | #endif | 928 | #endif |
929 | importMenu->insertSeparator(); | 929 | importMenu->insertSeparator(); |
930 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 930 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
931 | this ); | 931 | this ); |
932 | action->addTo( importMenu ); | 932 | action->addTo( importMenu ); |
933 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 933 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
934 | importMenu->insertSeparator(); | 934 | importMenu->insertSeparator(); |
935 | action = new QAction( "beam all", i18n("Save"), 0, | 935 | action = new QAction( "beam all", i18n("Save"), 0, |
936 | this ); | 936 | this ); |
937 | action->addTo( importMenu ); | 937 | action->addTo( importMenu ); |
938 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 938 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
939 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 939 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
940 | this ); | 940 | this ); |
941 | action->addTo( importMenu ); | 941 | action->addTo( importMenu ); |
942 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 942 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
943 | 943 | ||
944 | //menuBar->insertItem( "Configure",configureMenu ); | 944 | //menuBar->insertItem( "Configure",configureMenu ); |
945 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 945 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
946 | icon = loadPixmap( "korganizer/korganizer" ); | 946 | icon = loadPixmap( "korganizer/korganizer" ); |
947 | 947 | ||
948 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 948 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
949 | action->addTo( helpMenu ); | 949 | action->addTo( helpMenu ); |
950 | connect( action, SIGNAL( activated() ), | 950 | connect( action, SIGNAL( activated() ), |
951 | SLOT( whatsNew() ) ); | 951 | SLOT( whatsNew() ) ); |
952 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 952 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
953 | action->addTo( helpMenu ); | 953 | action->addTo( helpMenu ); |
954 | connect( action, SIGNAL( activated() ), | 954 | connect( action, SIGNAL( activated() ), |
955 | SLOT( features() ) ); | 955 | SLOT( features() ) ); |
956 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 956 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
957 | action->addTo( helpMenu ); | 957 | action->addTo( helpMenu ); |
958 | connect( action, SIGNAL( activated() ), | 958 | connect( action, SIGNAL( activated() ), |
959 | SLOT( keyBindings() ) ); | 959 | SLOT( keyBindings() ) ); |
960 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 960 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
961 | action->addTo( helpMenu ); | 961 | action->addTo( helpMenu ); |
962 | connect( action, SIGNAL( activated() ), | 962 | connect( action, SIGNAL( activated() ), |
963 | SLOT( synchowto() ) ); | 963 | SLOT( synchowto() ) ); |
964 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 964 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
965 | action->addTo( helpMenu ); | 965 | action->addTo( helpMenu ); |
966 | connect( action, SIGNAL( activated() ), | 966 | connect( action, SIGNAL( activated() ), |
967 | SLOT( kdesynchowto() ) ); | 967 | SLOT( kdesynchowto() ) ); |
968 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 968 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
969 | action->addTo( helpMenu ); | 969 | action->addTo( helpMenu ); |
970 | connect( action, SIGNAL( activated() ), | 970 | connect( action, SIGNAL( activated() ), |
971 | SLOT( multisynchowto() ) ); | 971 | SLOT( multisynchowto() ) ); |
972 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 972 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
973 | action->addTo( helpMenu ); | 973 | action->addTo( helpMenu ); |
974 | connect( action, SIGNAL( activated() ), | 974 | connect( action, SIGNAL( activated() ), |
975 | SLOT( aboutAutoSaving() ) ); | 975 | SLOT( aboutAutoSaving() ) ); |
976 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 976 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
977 | action->addTo( helpMenu ); | 977 | action->addTo( helpMenu ); |
978 | connect( action, SIGNAL( activated() ), | 978 | connect( action, SIGNAL( activated() ), |
979 | SLOT( aboutKnownBugs() ) ); | 979 | SLOT( aboutKnownBugs() ) ); |
980 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 980 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
981 | action->addTo( helpMenu ); | 981 | action->addTo( helpMenu ); |
982 | connect( action, SIGNAL( activated() ), | 982 | connect( action, SIGNAL( activated() ), |
983 | SLOT( usertrans() ) ); | 983 | SLOT( usertrans() ) ); |
984 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 984 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
985 | action->addTo( helpMenu ); | 985 | action->addTo( helpMenu ); |
986 | connect( action, SIGNAL( activated() ), | 986 | connect( action, SIGNAL( activated() ), |
987 | SLOT( faq() ) ); | 987 | SLOT( faq() ) ); |
988 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 988 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
989 | action->addTo( helpMenu ); | 989 | action->addTo( helpMenu ); |
990 | connect( action, SIGNAL( activated() ), | 990 | connect( action, SIGNAL( activated() ), |
991 | SLOT( licence() ) ); | 991 | SLOT( licence() ) ); |
992 | action = new QAction( "about", i18n("About..."), 0, this ); | 992 | action = new QAction( "about", i18n("About..."), 0, this ); |
993 | action->addTo( helpMenu ); | 993 | action->addTo( helpMenu ); |
994 | connect( action, SIGNAL( activated() ), | 994 | connect( action, SIGNAL( activated() ), |
995 | SLOT( about() ) ); | 995 | SLOT( about() ) ); |
996 | //menuBar->insertSeparator(); | 996 | //menuBar->insertSeparator(); |
997 | 997 | ||
998 | // ****************************************************** | 998 | // ****************************************************** |
999 | // menubar icons | 999 | // menubar icons |
1000 | 1000 | ||
1001 | 1001 | ||
1002 | iconToolBar->setHorizontalStretchable (true ); | 1002 | iconToolBar->setHorizontalStretchable (true ); |
1003 | //menuBar->insertItem( iconToolBar ); | 1003 | //menuBar->insertItem( iconToolBar ); |
1004 | //xdays_action | 1004 | //xdays_action |
1005 | if (p-> mShowIconNewEvent) | 1005 | if (p-> mShowIconNewEvent) |
1006 | ne_action->addTo( iconToolBar ); | 1006 | ne_action->addTo( iconToolBar ); |
1007 | if (p->mShowIconNewTodo ) | 1007 | if (p->mShowIconNewTodo ) |
1008 | nt_action->addTo( iconToolBar ); | 1008 | nt_action->addTo( iconToolBar ); |
1009 | if (p-> mShowIconSearch) | 1009 | if (p-> mShowIconSearch) |
1010 | search_action->addTo( iconToolBar ); | 1010 | search_action->addTo( iconToolBar ); |
1011 | if (p-> mShowIconWhatsThis) | 1011 | if (p-> mShowIconWhatsThis) |
1012 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1012 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1013 | if (p-> mShowIconNext) | 1013 | if (p-> mShowIconNext) |
1014 | whatsnext_action->addTo( iconToolBar ); | 1014 | whatsnext_action->addTo( iconToolBar ); |
1015 | if (p-> mShowIconNextDays) | 1015 | if (p-> mShowIconNextDays) |
1016 | xdays_action->addTo( iconToolBar ); | 1016 | xdays_action->addTo( iconToolBar ); |
1017 | if (p-> mShowIconJournal) | 1017 | if (p-> mShowIconJournal) |
1018 | viewjournal_action->addTo( iconToolBar ); | 1018 | viewjournal_action->addTo( iconToolBar ); |
1019 | if (p-> mShowIconDay1) | 1019 | if (p-> mShowIconDay1) |
1020 | day1_action->addTo( iconToolBar ); | 1020 | day1_action->addTo( iconToolBar ); |
1021 | if (p-> mShowIconDay5) | 1021 | if (p-> mShowIconDay5) |
1022 | day5_action->addTo( iconToolBar ); | 1022 | day5_action->addTo( iconToolBar ); |
1023 | if (p-> mShowIconDay7) | 1023 | if (p-> mShowIconDay7) |
1024 | day7_action->addTo( iconToolBar ); | 1024 | day7_action->addTo( iconToolBar ); |
1025 | if (p-> mShowIconDay6) | 1025 | if (p-> mShowIconDay6) |
1026 | day6_action->addTo( iconToolBar ); | 1026 | day6_action->addTo( iconToolBar ); |
1027 | if (p-> mShowIconMonth) | 1027 | if (p-> mShowIconMonth) |
1028 | month_action->addTo( iconToolBar ); | 1028 | month_action->addTo( iconToolBar ); |
1029 | if (p-> mShowIconList) | 1029 | if (p-> mShowIconList) |
1030 | showlist_action->addTo( iconToolBar ); | 1030 | showlist_action->addTo( iconToolBar ); |
1031 | if (p-> mShowIconTodoview) | 1031 | if (p-> mShowIconTodoview) |
1032 | todoview_action->addTo( iconToolBar ); | 1032 | todoview_action->addTo( iconToolBar ); |
1033 | 1033 | ||
1034 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1034 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1035 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1035 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1036 | if (p-> mShowIconBackFast) { | 1036 | if (p-> mShowIconBackFast) { |
1037 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1037 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1038 | connect( action, SIGNAL( activated() ), | 1038 | connect( action, SIGNAL( activated() ), |
1039 | mView, SLOT( goPreviousMonth() ) ); | 1039 | mView, SLOT( goPreviousMonth() ) ); |
1040 | action->addTo( iconToolBar ); | 1040 | action->addTo( iconToolBar ); |
1041 | } | 1041 | } |
1042 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1042 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1043 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1043 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1044 | if (p-> mShowIconBack) { | 1044 | if (p-> mShowIconBack) { |
1045 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1045 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1046 | connect( action, SIGNAL( activated() ), | 1046 | connect( action, SIGNAL( activated() ), |
1047 | mView, SLOT( goPrevious() ) ); | 1047 | mView, SLOT( goPrevious() ) ); |
1048 | action->addTo( iconToolBar ); | 1048 | action->addTo( iconToolBar ); |
1049 | } | 1049 | } |
1050 | icon = loadPixmap( pathString + "today" ); | 1050 | icon = loadPixmap( pathString + "today" ); |
1051 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1051 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1052 | if (p-> mShowIconToday) | 1052 | if (p-> mShowIconToday) |
1053 | today_action->addTo( iconToolBar ); | 1053 | today_action->addTo( iconToolBar ); |
1054 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1054 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1055 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1055 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1056 | if (p-> mShowIconForward) { | 1056 | if (p-> mShowIconForward) { |
1057 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1057 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1058 | connect( action, SIGNAL( activated() ), | 1058 | connect( action, SIGNAL( activated() ), |
1059 | mView, SLOT( goNext() ) ); | 1059 | mView, SLOT( goNext() ) ); |
1060 | action->addTo( iconToolBar ); | 1060 | action->addTo( iconToolBar ); |
1061 | } | 1061 | } |
1062 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1062 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1063 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1063 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1064 | if (p-> mShowIconForwardFast) { | 1064 | if (p-> mShowIconForwardFast) { |
1065 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1065 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1066 | connect( action, SIGNAL( activated() ), | 1066 | connect( action, SIGNAL( activated() ), |
1067 | mView, SLOT( goNextMonth() ) ); | 1067 | mView, SLOT( goNextMonth() ) ); |
1068 | action->addTo( iconToolBar ); | 1068 | action->addTo( iconToolBar ); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | 1071 | ||
1072 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1072 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1073 | 1073 | ||
1074 | if (p-> mShowIconNewEvent) | 1074 | if (p-> mShowIconNewEvent) |
1075 | configureToolBarMenu->setItemChecked( 10, true ); | 1075 | configureToolBarMenu->setItemChecked( 10, true ); |
1076 | if (p->mShowIconNewTodo ) | 1076 | if (p->mShowIconNewTodo ) |
1077 | configureToolBarMenu->setItemChecked( 20, true ); | 1077 | configureToolBarMenu->setItemChecked( 20, true ); |
1078 | if (p-> mShowIconSearch) | 1078 | if (p-> mShowIconSearch) |
1079 | configureToolBarMenu->setItemChecked( 120, true ); | 1079 | configureToolBarMenu->setItemChecked( 120, true ); |
1080 | if (p-> mShowIconList) | 1080 | if (p-> mShowIconList) |
1081 | configureToolBarMenu->setItemChecked( 30, true ); | 1081 | configureToolBarMenu->setItemChecked( 30, true ); |
1082 | if (p-> mShowIconDay1) | 1082 | if (p-> mShowIconDay1) |
1083 | configureToolBarMenu->setItemChecked( 40, true ); | 1083 | configureToolBarMenu->setItemChecked( 40, true ); |
1084 | if (p-> mShowIconDay5) | 1084 | if (p-> mShowIconDay5) |
1085 | configureToolBarMenu->setItemChecked( 50, true ); | 1085 | configureToolBarMenu->setItemChecked( 50, true ); |
1086 | if (p-> mShowIconDay6) | 1086 | if (p-> mShowIconDay6) |
1087 | configureToolBarMenu->setItemChecked( 75, true ); | 1087 | configureToolBarMenu->setItemChecked( 75, true ); |
1088 | if (p-> mShowIconDay7) | 1088 | if (p-> mShowIconDay7) |
1089 | configureToolBarMenu->setItemChecked( 60, true ); | 1089 | configureToolBarMenu->setItemChecked( 60, true ); |
1090 | if (p-> mShowIconMonth) | 1090 | if (p-> mShowIconMonth) |
1091 | configureToolBarMenu->setItemChecked( 70, true ); | 1091 | configureToolBarMenu->setItemChecked( 70, true ); |
1092 | if (p-> mShowIconTodoview) | 1092 | if (p-> mShowIconTodoview) |
1093 | configureToolBarMenu->setItemChecked( 80, true ); | 1093 | configureToolBarMenu->setItemChecked( 80, true ); |
1094 | if (p-> mShowIconBackFast) | 1094 | if (p-> mShowIconBackFast) |
1095 | configureToolBarMenu->setItemChecked( 200, true ); | 1095 | configureToolBarMenu->setItemChecked( 200, true ); |
1096 | if (p-> mShowIconBack) | 1096 | if (p-> mShowIconBack) |
1097 | configureToolBarMenu->setItemChecked( 210, true ); | 1097 | configureToolBarMenu->setItemChecked( 210, true ); |
1098 | if (p-> mShowIconToday) | 1098 | if (p-> mShowIconToday) |
1099 | configureToolBarMenu->setItemChecked( 130, true ); | 1099 | configureToolBarMenu->setItemChecked( 130, true ); |
1100 | if (p-> mShowIconForward) | 1100 | if (p-> mShowIconForward) |
1101 | configureToolBarMenu->setItemChecked( 220, true ); | 1101 | configureToolBarMenu->setItemChecked( 220, true ); |
1102 | if (p-> mShowIconForwardFast) | 1102 | if (p-> mShowIconForwardFast) |
1103 | configureToolBarMenu->setItemChecked( 230, true ); | 1103 | configureToolBarMenu->setItemChecked( 230, true ); |
1104 | if (p-> mShowIconNextDays) | 1104 | if (p-> mShowIconNextDays) |
1105 | configureToolBarMenu->setItemChecked( 100, true ); | 1105 | configureToolBarMenu->setItemChecked( 100, true ); |
@@ -1239,897 +1239,912 @@ void MainWindow::features() | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | void MainWindow::usertrans() | 1241 | void MainWindow::usertrans() |
1242 | { | 1242 | { |
1243 | 1243 | ||
1244 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1244 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | void MainWindow::kdesynchowto() | 1247 | void MainWindow::kdesynchowto() |
1248 | { | 1248 | { |
1249 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1249 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1250 | } | 1250 | } |
1251 | void MainWindow::multisynchowto() | 1251 | void MainWindow::multisynchowto() |
1252 | { | 1252 | { |
1253 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1253 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1254 | } | 1254 | } |
1255 | void MainWindow::synchowto() | 1255 | void MainWindow::synchowto() |
1256 | { | 1256 | { |
1257 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1257 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1258 | } | 1258 | } |
1259 | void MainWindow::faq() | 1259 | void MainWindow::faq() |
1260 | { | 1260 | { |
1261 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1261 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1262 | 1262 | ||
1263 | } | 1263 | } |
1264 | void MainWindow::whatsNew() | 1264 | void MainWindow::whatsNew() |
1265 | { | 1265 | { |
1266 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1266 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1267 | 1267 | ||
1268 | } | 1268 | } |
1269 | void MainWindow::licence() | 1269 | void MainWindow::licence() |
1270 | { | 1270 | { |
1271 | KApplication::showLicence(); | 1271 | KApplication::showLicence(); |
1272 | 1272 | ||
1273 | } | 1273 | } |
1274 | void MainWindow::about() | 1274 | void MainWindow::about() |
1275 | { | 1275 | { |
1276 | QString version; | 1276 | QString version; |
1277 | #include <../version> | 1277 | #include <../version> |
1278 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1278 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1279 | i18n("KOrganizer/Platform-independent\n") + | 1279 | i18n("KOrganizer/Platform-independent\n") + |
1280 | "(KO/Pi) " + version + " - " + | 1280 | "(KO/Pi) " + version + " - " + |
1281 | 1281 | ||
1282 | #ifdef DESKTOP_VERSION | 1282 | #ifdef DESKTOP_VERSION |
1283 | i18n("Desktop Edition\n") + | 1283 | i18n("Desktop Edition\n") + |
1284 | #else | 1284 | #else |
1285 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1285 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1286 | #endif | 1286 | #endif |
1287 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1287 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1288 | } | 1288 | } |
1289 | void MainWindow::keyBindings() | 1289 | void MainWindow::keyBindings() |
1290 | { | 1290 | { |
1291 | QString cap = i18n("KO/Pi Keys + Colors"); | 1291 | QString cap = i18n("KO/Pi Keys + Colors"); |
1292 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1292 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1293 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1293 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1294 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1294 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1295 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1295 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1296 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1296 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1297 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1297 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1298 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1298 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1299 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1299 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1300 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1300 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1301 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1301 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1302 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1302 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1303 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1303 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1304 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1304 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1305 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1305 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1306 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1306 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1307 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1307 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1308 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1308 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1309 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1309 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1310 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1310 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1311 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1311 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1312 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1312 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1313 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1313 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1314 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1314 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1315 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1315 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1316 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1316 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1317 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1317 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1318 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1318 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1319 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1319 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1320 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1320 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1321 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1321 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1322 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1322 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1323 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1323 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1324 | i18n("<p><h3>In list view:</h3></p>\n") + | 1324 | i18n("<p><h3>In list view:</h3></p>\n") + |
1325 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1325 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1326 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1326 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1327 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1327 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1328 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1328 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1329 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1329 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1330 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1330 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1331 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1331 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1332 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1332 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1333 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1333 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1334 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1334 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1335 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1335 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1336 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1336 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1337 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1337 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1338 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1338 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1339 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1339 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1340 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1340 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1341 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1341 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1342 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1342 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1343 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1343 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1344 | displayText( text, cap); | 1344 | displayText( text, cap); |
1345 | } | 1345 | } |
1346 | void MainWindow::aboutAutoSaving() | 1346 | void MainWindow::aboutAutoSaving() |
1347 | { | 1347 | { |
1348 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1348 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1349 | 1349 | ||
1350 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1350 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1351 | 1351 | ||
1352 | } | 1352 | } |
1353 | void MainWindow::aboutKnownBugs() | 1353 | void MainWindow::aboutKnownBugs() |
1354 | { | 1354 | { |
1355 | QMessageBox* msg; | 1355 | QMessageBox* msg; |
1356 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1356 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1357 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1357 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1358 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1358 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1359 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1359 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1360 | i18n("\nor report them in the bugtracker on\n") + | 1360 | i18n("\nor report them in the bugtracker on\n") + |
1361 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1361 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1362 | QMessageBox::NoIcon, | 1362 | QMessageBox::NoIcon, |
1363 | QMessageBox::Ok, | 1363 | QMessageBox::Ok, |
1364 | QMessageBox::NoButton, | 1364 | QMessageBox::NoButton, |
1365 | QMessageBox::NoButton); | 1365 | QMessageBox::NoButton); |
1366 | msg->exec(); | 1366 | msg->exec(); |
1367 | delete msg; | 1367 | delete msg; |
1368 | 1368 | ||
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | QString MainWindow::defaultFileName() | 1371 | QString MainWindow::defaultFileName() |
1372 | { | 1372 | { |
1373 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1373 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1374 | } | 1374 | } |
1375 | QString MainWindow::syncFileName() | 1375 | QString MainWindow::syncFileName() |
1376 | { | 1376 | { |
1377 | #ifdef DESKTOP_VERSION | 1377 | #ifdef DESKTOP_VERSION |
1378 | return locateLocal( "tmp", "synccalendar.ics" ); | 1378 | return locateLocal( "tmp", "synccalendar.ics" ); |
1379 | #else | 1379 | #else |
1380 | return QString( "/tmp/synccalendar.ics" ); | 1380 | return QString( "/tmp/synccalendar.ics" ); |
1381 | #endif | 1381 | #endif |
1382 | } | 1382 | } |
1383 | void MainWindow::updateWeek(QDate seda) | 1383 | void MainWindow::updateWeek(QDate seda) |
1384 | { | 1384 | { |
1385 | int weekNum = 0; | 1385 | int weekNum = 0; |
1386 | QDate d = QDate ( seda.year(), 1,1); | 1386 | QDate d = QDate ( seda.year(), 1,1); |
1387 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1387 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1388 | if ( seda.addDays(6).year() != seda.year() ) { | 1388 | if ( seda.addDays(6).year() != seda.year() ) { |
1389 | if ( seda.year() != d.year() ) { | 1389 | if ( seda.year() != d.year() ) { |
1390 | if ( d.dayOfWeek() > 4 ) | 1390 | if ( d.dayOfWeek() > 4 ) |
1391 | d = QDate ( seda.year(), 1,1); | 1391 | d = QDate ( seda.year(), 1,1); |
1392 | else | 1392 | else |
1393 | weekNum = 1; | 1393 | weekNum = 1; |
1394 | } else { | 1394 | } else { |
1395 | QDate dd( seda.year()+1, 1,1); | 1395 | QDate dd( seda.year()+1, 1,1); |
1396 | if ( dd.dayOfWeek() <= 4 ) | 1396 | if ( dd.dayOfWeek() <= 4 ) |
1397 | weekNum = 1; | 1397 | weekNum = 1; |
1398 | } | 1398 | } |
1399 | } | 1399 | } |
1400 | if ( weekNum == 0 ){ | 1400 | if ( weekNum == 0 ){ |
1401 | int dow = d.dayOfWeek(); | 1401 | int dow = d.dayOfWeek(); |
1402 | if ( dow <= 4 ) | 1402 | if ( dow <= 4 ) |
1403 | d = d.addDays( 1-dow ); | 1403 | d = d.addDays( 1-dow ); |
1404 | else // 5,6,7 | 1404 | else // 5,6,7 |
1405 | d = d.addDays( 8-dow ); | 1405 | d = d.addDays( 8-dow ); |
1406 | // we have the first week of the year.we are on monday | 1406 | // we have the first week of the year.we are on monday |
1407 | weekNum = d.daysTo( seda ) / 7 +1; | 1407 | weekNum = d.daysTo( seda ) / 7 +1; |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | mWeekPixmap.fill( mWeekBgColor ); | 1410 | mWeekPixmap.fill( mWeekBgColor ); |
1411 | QPainter p ( &mWeekPixmap ); | 1411 | QPainter p ( &mWeekPixmap ); |
1412 | p.setFont( mWeekFont ); | 1412 | p.setFont( mWeekFont ); |
1413 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1413 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1414 | p.end(); | 1414 | p.end(); |
1415 | QIconSet icon3 ( mWeekPixmap ); | 1415 | QIconSet icon3 ( mWeekPixmap ); |
1416 | mWeekAction->setIconSet ( icon3 ); | 1416 | mWeekAction->setIconSet ( icon3 ); |
1417 | 1417 | ||
1418 | } | 1418 | } |
1419 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1419 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1420 | { | 1420 | { |
1421 | updateWeek( selectedDates.first() ); | 1421 | updateWeek( selectedDates.first() ); |
1422 | } | 1422 | } |
1423 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1423 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1424 | { | 1424 | { |
1425 | 1425 | ||
1426 | if ( !incidence ) { | 1426 | if ( !incidence ) { |
1427 | enableIncidenceActions( false ); | 1427 | enableIncidenceActions( false ); |
1428 | 1428 | ||
1429 | mNewSubTodoAction->setEnabled( false ); | 1429 | mNewSubTodoAction->setEnabled( false ); |
1430 | setCaptionToDates(); | 1430 | setCaptionToDates(); |
1431 | return; | 1431 | return; |
1432 | 1432 | ||
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | //KGlobal::locale()->formatDateTime(nextA, true); | 1435 | //KGlobal::locale()->formatDateTime(nextA, true); |
1436 | QString startString = ""; | 1436 | QString startString = ""; |
1437 | if ( incidence->type() != "Todo" ) { | 1437 | if ( incidence->type() != "Todo" ) { |
1438 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1438 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1439 | if ( incidence->doesFloat() ) { | 1439 | if ( incidence->doesFloat() ) { |
1440 | startString += ": "+incidence->dtStartDateStr( true ); | 1440 | startString += ": "+incidence->dtStartDateStr( true ); |
1441 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1441 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1442 | 1442 | ||
1443 | } else { | 1443 | } else { |
1444 | startString = ": "+incidence->dtStartStr(true); | 1444 | startString = ": "+incidence->dtStartStr(true); |
1445 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1445 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1446 | 1446 | ||
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | } else { | 1449 | } else { |
1450 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1450 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1451 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1451 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1452 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1452 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1453 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1453 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1454 | bool ok; | 1454 | bool ok; |
1455 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1455 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1456 | if ( ok ) { | 1456 | if ( ok ) { |
1457 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1457 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1458 | startString += i18n(" (%1 y.)"). arg( years ); | 1458 | startString += i18n(" (%1 y.)"). arg( years ); |
1459 | } | 1459 | } |
1460 | } | 1460 | } |
1461 | else | 1461 | else |
1462 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1462 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | } | 1465 | } |
1466 | else | 1466 | else |
1467 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1467 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1468 | if ( !incidence->location().isEmpty() ) | 1468 | if ( !incidence->location().isEmpty() ) |
1469 | startString += " (" +incidence->location()+")"; | 1469 | startString += " (" +incidence->location()+")"; |
1470 | setCaption( incidence->summary()+startString); | 1470 | setCaption( incidence->summary()+startString); |
1471 | 1471 | ||
1472 | enableIncidenceActions( true ); | 1472 | enableIncidenceActions( true ); |
1473 | 1473 | ||
1474 | if ( incidence->type() == "Event" ) { | 1474 | if ( incidence->type() == "Event" ) { |
1475 | mShowAction->setText( i18n("Show Event...") ); | 1475 | mShowAction->setText( i18n("Show Event...") ); |
1476 | mEditAction->setText( i18n("Edit Event...") ); | 1476 | mEditAction->setText( i18n("Edit Event...") ); |
1477 | mDeleteAction->setText( i18n("Delete Event...") ); | 1477 | mDeleteAction->setText( i18n("Delete Event...") ); |
1478 | 1478 | ||
1479 | mNewSubTodoAction->setEnabled( false ); | 1479 | mNewSubTodoAction->setEnabled( false ); |
1480 | } else if ( incidence->type() == "Todo" ) { | 1480 | } else if ( incidence->type() == "Todo" ) { |
1481 | mShowAction->setText( i18n("Show Todo...") ); | 1481 | mShowAction->setText( i18n("Show Todo...") ); |
1482 | mEditAction->setText( i18n("Edit Todo...") ); | 1482 | mEditAction->setText( i18n("Edit Todo...") ); |
1483 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1483 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1484 | 1484 | ||
1485 | mNewSubTodoAction->setEnabled( true ); | 1485 | mNewSubTodoAction->setEnabled( true ); |
1486 | } else { | 1486 | } else { |
1487 | mShowAction->setText( i18n("Show...") ); | 1487 | mShowAction->setText( i18n("Show...") ); |
1488 | mShowAction->setText( i18n("Edit...") ); | 1488 | mShowAction->setText( i18n("Edit...") ); |
1489 | mShowAction->setText( i18n("Delete...") ); | 1489 | mShowAction->setText( i18n("Delete...") ); |
1490 | 1490 | ||
1491 | mNewSubTodoAction->setEnabled( false ); | 1491 | mNewSubTodoAction->setEnabled( false ); |
1492 | } | 1492 | } |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | void MainWindow::enableIncidenceActions( bool enabled ) | 1495 | void MainWindow::enableIncidenceActions( bool enabled ) |
1496 | { | 1496 | { |
1497 | mShowAction->setEnabled( enabled ); | 1497 | mShowAction->setEnabled( enabled ); |
1498 | mEditAction->setEnabled( enabled ); | 1498 | mEditAction->setEnabled( enabled ); |
1499 | mDeleteAction->setEnabled( enabled ); | 1499 | mDeleteAction->setEnabled( enabled ); |
1500 | 1500 | ||
1501 | mCloneAction->setEnabled( enabled ); | 1501 | mCloneAction->setEnabled( enabled ); |
1502 | mMoveAction->setEnabled( enabled ); | 1502 | mMoveAction->setEnabled( enabled ); |
1503 | mBeamAction->setEnabled( enabled ); | 1503 | mBeamAction->setEnabled( enabled ); |
1504 | mCancelAction->setEnabled( enabled ); | 1504 | mCancelAction->setEnabled( enabled ); |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | void MainWindow::importOL() | 1507 | void MainWindow::importOL() |
1508 | { | 1508 | { |
1509 | #ifdef _OL_IMPORT_ | 1509 | #ifdef _OL_IMPORT_ |
1510 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1510 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1511 | id->exec(); | 1511 | id->exec(); |
1512 | delete id; | 1512 | delete id; |
1513 | mView->updateView(); | 1513 | mView->updateView(); |
1514 | #endif | 1514 | #endif |
1515 | } | 1515 | } |
1516 | void MainWindow::importBday() | 1516 | void MainWindow::importBday() |
1517 | { | 1517 | { |
1518 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1518 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1519 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1519 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1520 | i18n("Import!"), i18n("Cancel"), 0, | 1520 | i18n("Import!"), i18n("Cancel"), 0, |
1521 | 0, 1 ); | 1521 | 0, 1 ); |
1522 | if ( result == 0 ) { | 1522 | if ( result == 0 ) { |
1523 | mView->importBday(); | 1523 | mView->importBday(); |
1524 | 1524 | ||
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | 1527 | ||
1528 | } | 1528 | } |
1529 | void MainWindow::importQtopia() | 1529 | void MainWindow::importQtopia() |
1530 | { | 1530 | { |
1531 | //#ifndef DESKTOP_VERSION | 1531 | //#ifndef DESKTOP_VERSION |
1532 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1532 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1533 | #ifdef DESKTOP_VERSION | 1533 | #ifdef DESKTOP_VERSION |
1534 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1534 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1535 | #endif | 1535 | #endif |
1536 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1536 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1537 | i18n("Import!"), i18n("Cancel"), 0, | 1537 | i18n("Import!"), i18n("Cancel"), 0, |
1538 | 0, 1 ); | 1538 | 0, 1 ); |
1539 | if ( result == 0 ) { | 1539 | if ( result == 0 ) { |
1540 | #ifndef DESKTOP_VERSION | 1540 | #ifndef DESKTOP_VERSION |
1541 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1541 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1542 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1542 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1543 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1543 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1544 | #else | 1544 | #else |
1545 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1545 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1546 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1546 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1547 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1547 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1548 | #endif | 1548 | #endif |
1549 | mView->importQtopia( categories, datebook, todolist ); | 1549 | mView->importQtopia( categories, datebook, todolist ); |
1550 | } | 1550 | } |
1551 | #if 0 | 1551 | #if 0 |
1552 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1552 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1553 | i18n("Not supported \non desktop!\n"), | 1553 | i18n("Not supported \non desktop!\n"), |
1554 | i18n("Ok"), i18n("Cancel"), 0, | 1554 | i18n("Ok"), i18n("Cancel"), 0, |
1555 | 0, 1 ); | 1555 | 0, 1 ); |
1556 | 1556 | ||
1557 | #endif | 1557 | #endif |
1558 | } | 1558 | } |
1559 | 1559 | ||
1560 | void MainWindow::saveOnClose() | 1560 | void MainWindow::saveOnClose() |
1561 | { | 1561 | { |
1562 | KOPrefs *p = KOPrefs::instance(); | 1562 | KOPrefs *p = KOPrefs::instance(); |
1563 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1563 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1564 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1564 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1565 | iconToolBar->y() > height()/2; | 1565 | iconToolBar->y() > height()/2; |
1566 | mView->writeSettings(); | 1566 | mView->writeSettings(); |
1567 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1567 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1568 | save(); | 1568 | save(); |
1569 | } | 1569 | } |
1570 | void MainWindow::slotModifiedChanged( bool changed ) | 1570 | void MainWindow::slotModifiedChanged( bool changed ) |
1571 | { | 1571 | { |
1572 | if ( mBlockAtStartup ) | 1572 | if ( mBlockAtStartup ) |
1573 | return; | 1573 | return; |
1574 | 1574 | ||
1575 | int msec; | 1575 | int msec; |
1576 | // we store the changes after 1 minute, | 1576 | // we store the changes after 1 minute, |
1577 | // and for safety reasons after 10 minutes again | 1577 | // and for safety reasons after 10 minutes again |
1578 | if ( !mSyncManager->blockSave() ) | 1578 | if ( !mSyncManager->blockSave() ) |
1579 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1579 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1580 | else | 1580 | else |
1581 | msec = 1000 * 600; | 1581 | msec = 1000 * 600; |
1582 | mSaveTimer.start( msec, true ); // 1 minute | 1582 | mSaveTimer.start( msec, true ); // 1 minute |
1583 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1583 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1584 | mCalendarModifiedFlag = true; | 1584 | mCalendarModifiedFlag = true; |
1585 | } | 1585 | } |
1586 | void MainWindow::saveStopTimer() | 1586 | void MainWindow::saveStopTimer() |
1587 | { | 1587 | { |
1588 | mSaveTimer.stop(); | 1588 | mSaveTimer.stop(); |
1589 | if (mSaveTimer.isActive() ) | 1589 | if (mSaveTimer.isActive() ) |
1590 | qDebug("ti active "); | 1590 | qDebug("ti active "); |
1591 | else | 1591 | else |
1592 | qDebug("KO: Save timer stopped"); | 1592 | qDebug("KO: Save timer stopped"); |
1593 | } | 1593 | } |
1594 | void MainWindow::save() | 1594 | void MainWindow::save() |
1595 | { | 1595 | { |
1596 | if ( !mCalendarModifiedFlag ) { | 1596 | if ( !mCalendarModifiedFlag ) { |
1597 | qDebug("KO: Calendar not modified. Nothing saved."); | 1597 | qDebug("KO: Calendar not modified. Nothing saved."); |
1598 | return; | 1598 | return; |
1599 | } | 1599 | } |
1600 | if ( mSyncManager->blockSave() ) | 1600 | if ( mSyncManager->blockSave() ) |
1601 | return; | 1601 | return; |
1602 | mSyncManager->setBlockSave(true); | 1602 | mSyncManager->setBlockSave(true); |
1603 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1603 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1604 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1604 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1605 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1605 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1606 | qDebug("KO: Start saving data to file!"); | 1606 | qDebug("KO: Start saving data to file!"); |
1607 | mView->saveCalendar( defaultFileName() ); | 1607 | mView->saveCalendar( defaultFileName() ); |
1608 | mCalendarModifiedFlag = false; | 1608 | mCalendarModifiedFlag = false; |
1609 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1609 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1610 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1610 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1611 | QString savemes; | 1611 | QString savemes; |
1612 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1612 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1613 | setCaption(savemes); | 1613 | setCaption(savemes); |
1614 | } else | 1614 | } else |
1615 | setCaption(i18n("Saving cancelled!")); | 1615 | setCaption(i18n("Saving cancelled!")); |
1616 | mSyncManager->setBlockSave( false ); | 1616 | mSyncManager->setBlockSave( false ); |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1619 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1620 | { | 1620 | { |
1621 | if ( !e->isAutoRepeat() ) { | 1621 | if ( !e->isAutoRepeat() ) { |
1622 | mFlagKeyPressed = false; | 1622 | mFlagKeyPressed = false; |
1623 | } | 1623 | } |
1624 | } | 1624 | } |
1625 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1625 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1626 | { | 1626 | { |
1627 | qApp->processEvents(); | 1627 | qApp->processEvents(); |
1628 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1628 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1629 | e->ignore(); | 1629 | e->ignore(); |
1630 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1630 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1631 | return; | 1631 | return; |
1632 | } | 1632 | } |
1633 | if (! e->isAutoRepeat() ) | 1633 | if (! e->isAutoRepeat() ) |
1634 | mFlagKeyPressed = true; | 1634 | mFlagKeyPressed = true; |
1635 | KOPrefs *p = KOPrefs::instance(); | 1635 | KOPrefs *p = KOPrefs::instance(); |
1636 | bool showSelectedDates = false; | 1636 | bool showSelectedDates = false; |
1637 | int size; | 1637 | int size; |
1638 | int pro = 0; | 1638 | int pro = 0; |
1639 | //qDebug("MainWindow::keyPressEvent "); | 1639 | //qDebug("MainWindow::keyPressEvent "); |
1640 | switch ( e->key() ) { | 1640 | switch ( e->key() ) { |
1641 | case Qt::Key_Right: | 1641 | case Qt::Key_Right: |
1642 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1642 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1643 | mView->goNextMonth(); | 1643 | mView->goNextMonth(); |
1644 | else | 1644 | else |
1645 | mView->goNext(); | 1645 | mView->goNext(); |
1646 | showSelectedDates = true; | 1646 | showSelectedDates = true; |
1647 | break; | 1647 | break; |
1648 | case Qt::Key_Left: | 1648 | case Qt::Key_Left: |
1649 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1649 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1650 | mView->goPreviousMonth(); | 1650 | mView->goPreviousMonth(); |
1651 | else | 1651 | else |
1652 | mView->goPrevious(); | 1652 | mView->goPrevious(); |
1653 | showSelectedDates = true; | 1653 | showSelectedDates = true; |
1654 | break; | 1654 | break; |
1655 | case Qt::Key_Down: | 1655 | case Qt::Key_Down: |
1656 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1656 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1657 | break; | 1657 | break; |
1658 | case Qt::Key_Up: | 1658 | case Qt::Key_Up: |
1659 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1659 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1660 | break; | 1660 | break; |
1661 | case Qt::Key_K: | 1661 | case Qt::Key_K: |
1662 | mView->viewManager()->showMonthViewWeek(); | 1662 | mView->viewManager()->showMonthViewWeek(); |
1663 | break; | 1663 | break; |
1664 | case Qt::Key_I: | 1664 | case Qt::Key_I: |
1665 | mView->showIncidence(); | 1665 | mView->showIncidence(); |
1666 | break; | 1666 | break; |
1667 | case Qt::Key_Delete: | 1667 | case Qt::Key_Delete: |
1668 | case Qt::Key_Backspace: | 1668 | case Qt::Key_Backspace: |
1669 | mView->deleteIncidence(); | 1669 | mView->deleteIncidence(); |
1670 | break; | 1670 | break; |
1671 | case Qt::Key_D: | 1671 | case Qt::Key_D: |
1672 | mView->viewManager()->showDayView(); | 1672 | mView->viewManager()->showDayView(); |
1673 | showSelectedDates = true; | 1673 | showSelectedDates = true; |
1674 | break; | 1674 | break; |
1675 | case Qt::Key_O: | 1675 | case Qt::Key_O: |
1676 | mView->toggleFilerEnabled( ); | 1676 | mView->toggleFilerEnabled( ); |
1677 | break; | 1677 | break; |
1678 | case Qt::Key_0: | 1678 | case Qt::Key_0: |
1679 | case Qt::Key_1: | 1679 | case Qt::Key_1: |
1680 | case Qt::Key_2: | 1680 | case Qt::Key_2: |
1681 | case Qt::Key_3: | 1681 | case Qt::Key_3: |
1682 | case Qt::Key_4: | 1682 | case Qt::Key_4: |
1683 | case Qt::Key_5: | 1683 | case Qt::Key_5: |
1684 | case Qt::Key_6: | 1684 | case Qt::Key_6: |
1685 | case Qt::Key_7: | 1685 | case Qt::Key_7: |
1686 | case Qt::Key_8: | 1686 | case Qt::Key_8: |
1687 | case Qt::Key_9: | 1687 | case Qt::Key_9: |
1688 | pro = e->key()-48; | 1688 | pro = e->key()-48; |
1689 | if ( pro == 0 ) | 1689 | if ( pro == 0 ) |
1690 | pro = 10; | 1690 | pro = 10; |
1691 | if ( e->state() == Qt::ControlButton) | 1691 | if ( e->state() == Qt::ControlButton) |
1692 | pro += 10; | 1692 | pro += 10; |
1693 | break; | 1693 | break; |
1694 | case Qt::Key_M: | 1694 | case Qt::Key_M: |
1695 | mView->viewManager()->showMonthView(); | 1695 | mView->viewManager()->showMonthView(); |
1696 | showSelectedDates = true; | 1696 | showSelectedDates = true; |
1697 | break; | 1697 | break; |
1698 | case Qt::Key_Insert: | 1698 | case Qt::Key_Insert: |
1699 | mView->newEvent(); | 1699 | mView->newEvent(); |
1700 | break; | 1700 | break; |
1701 | case Qt::Key_S : | 1701 | case Qt::Key_S : |
1702 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1702 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1703 | mView->newSubTodo(); | 1703 | mView->newSubTodo(); |
1704 | else | 1704 | else |
1705 | mView->dialogManager()->showSearchDialog(); | 1705 | mView->dialogManager()->showSearchDialog(); |
1706 | break; | 1706 | break; |
1707 | case Qt::Key_Y : | 1707 | case Qt::Key_Y : |
1708 | case Qt::Key_Z : | 1708 | case Qt::Key_Z : |
1709 | mView->viewManager()->showWorkWeekView(); | 1709 | mView->viewManager()->showWorkWeekView(); |
1710 | showSelectedDates = true; | 1710 | showSelectedDates = true; |
1711 | break; | 1711 | break; |
1712 | case Qt::Key_U : | 1712 | case Qt::Key_U : |
1713 | mView->viewManager()->showWeekView(); | 1713 | mView->viewManager()->showWeekView(); |
1714 | showSelectedDates = true; | 1714 | showSelectedDates = true; |
1715 | break; | 1715 | break; |
1716 | case Qt::Key_H : | 1716 | case Qt::Key_H : |
1717 | keyBindings(); | 1717 | keyBindings(); |
1718 | break; | 1718 | break; |
1719 | case Qt::Key_W: | 1719 | case Qt::Key_W: |
1720 | mView->viewManager()->showWhatsNextView(); | 1720 | mView->viewManager()->showWhatsNextView(); |
1721 | break; | 1721 | break; |
1722 | case Qt::Key_L: | 1722 | case Qt::Key_L: |
1723 | mView->viewManager()->showListView(); | 1723 | mView->viewManager()->showListView(); |
1724 | break; | 1724 | break; |
1725 | case Qt::Key_N: | 1725 | case Qt::Key_N: |
1726 | mView->viewManager()->showNextXView(); | 1726 | mView->viewManager()->showNextXView(); |
1727 | showSelectedDates = true; | 1727 | showSelectedDates = true; |
1728 | break; | 1728 | break; |
1729 | case Qt::Key_V: | 1729 | case Qt::Key_V: |
1730 | mView->viewManager()->showTodoView(); | 1730 | mView->viewManager()->showTodoView(); |
1731 | break; | 1731 | break; |
1732 | case Qt::Key_C: | 1732 | case Qt::Key_C: |
1733 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1733 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1734 | break; | 1734 | break; |
1735 | case Qt::Key_P: | 1735 | case Qt::Key_P: |
1736 | mView->showDatePicker( ); | 1736 | mView->showDatePicker( ); |
1737 | break; | 1737 | break; |
1738 | case Qt::Key_F: | 1738 | case Qt::Key_F: |
1739 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1739 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1740 | mView->editFilters(); | 1740 | mView->editFilters(); |
1741 | else | 1741 | else |
1742 | mView->toggleFilter(); | 1742 | mView->toggleFilter(); |
1743 | break; | 1743 | break; |
1744 | case Qt::Key_X: | 1744 | case Qt::Key_X: |
1745 | mView->toggleDateNavigatorWidget(); | 1745 | mView->toggleDateNavigatorWidget(); |
1746 | break; | 1746 | break; |
1747 | case Qt::Key_Space: | 1747 | case Qt::Key_Space: |
1748 | mView->toggleExpand(); | 1748 | mView->toggleExpand(); |
1749 | break; | 1749 | break; |
1750 | case Qt::Key_A: | 1750 | case Qt::Key_A: |
1751 | mView->toggleAllDaySize(); | 1751 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
1752 | mView->showNextAlarms(); | ||
1753 | else | ||
1754 | mView->toggleAllDaySize(); | ||
1752 | break; | 1755 | break; |
1753 | case Qt::Key_T: | 1756 | case Qt::Key_T: |
1754 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1757 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1755 | mView->newTodo(); | 1758 | mView->newTodo(); |
1756 | else { | 1759 | else { |
1757 | mView->goToday(); | 1760 | mView->goToday(); |
1758 | showSelectedDates = true; | 1761 | showSelectedDates = true; |
1759 | } | 1762 | } |
1760 | break; | 1763 | break; |
1761 | case Qt::Key_J: | 1764 | case Qt::Key_J: |
1762 | mView->viewManager()->showJournalView(); | 1765 | mView->viewManager()->showJournalView(); |
1763 | break; | 1766 | break; |
1764 | case Qt::Key_B: | 1767 | case Qt::Key_B: |
1765 | mView->editIncidenceDescription();; | 1768 | mView->editIncidenceDescription();; |
1766 | break; | 1769 | break; |
1767 | // case Qt::Key_Return: | 1770 | // case Qt::Key_Return: |
1768 | case Qt::Key_E: | 1771 | case Qt::Key_E: |
1769 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1772 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1770 | mView->newEvent(); | 1773 | mView->newEvent(); |
1771 | else | 1774 | else |
1772 | mView->editIncidence(); | 1775 | mView->editIncidence(); |
1773 | break; | 1776 | break; |
1774 | case Qt::Key_Plus: | 1777 | case Qt::Key_Plus: |
1775 | size = p->mHourSize +2; | 1778 | size = p->mHourSize +2; |
1776 | if ( size <= 22 ) | 1779 | if ( size <= 22 ) |
1777 | configureAgenda( size ); | 1780 | configureAgenda( size ); |
1778 | break; | 1781 | break; |
1779 | case Qt::Key_Minus: | 1782 | case Qt::Key_Minus: |
1780 | size = p->mHourSize - 2; | 1783 | size = p->mHourSize - 2; |
1781 | if ( size >= 4 ) | 1784 | if ( size >= 4 ) |
1782 | configureAgenda( size ); | 1785 | configureAgenda( size ); |
1783 | break; | 1786 | break; |
1784 | 1787 | ||
1785 | 1788 | ||
1786 | default: | 1789 | default: |
1787 | e->ignore(); | 1790 | e->ignore(); |
1788 | } | 1791 | } |
1789 | if ( pro > 0 ) { | 1792 | if ( pro > 0 ) { |
1790 | mView->selectFilter( pro-1 ); | 1793 | mView->selectFilter( pro-1 ); |
1791 | } | 1794 | } |
1792 | if ( showSelectedDates ) { | 1795 | if ( showSelectedDates ) { |
1793 | ;// setCaptionToDates(); | 1796 | ;// setCaptionToDates(); |
1794 | } | 1797 | } |
1795 | 1798 | ||
1796 | } | 1799 | } |
1797 | 1800 | ||
1798 | void MainWindow::fillFilterMenu() | 1801 | void MainWindow::fillFilterMenu() |
1799 | { | 1802 | { |
1800 | selectFilterMenu->clear(); | 1803 | selectFilterMenu->clear(); |
1801 | bool disable = false; | 1804 | bool disable = false; |
1802 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1805 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1803 | selectFilterMenu->insertSeparator(); | 1806 | selectFilterMenu->insertSeparator(); |
1804 | if ( mView->filterView()->filtersEnabled() ) { | 1807 | if ( mView->filterView()->filtersEnabled() ) { |
1805 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1808 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1806 | } | 1809 | } |
1807 | else { | 1810 | else { |
1808 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1811 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1809 | disable = true; | 1812 | disable = true; |
1810 | } | 1813 | } |
1811 | selectFilterMenu->insertSeparator(); | 1814 | selectFilterMenu->insertSeparator(); |
1812 | QPtrList<CalFilter> fili = mView->filters(); | 1815 | QPtrList<CalFilter> fili = mView->filters(); |
1813 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1816 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1814 | CalFilter *filter = fili.first(); | 1817 | CalFilter *filter = fili.first(); |
1815 | int iii = 2; | 1818 | int iii = 2; |
1816 | while(filter) { | 1819 | while(filter) { |
1817 | selectFilterMenu->insertItem( filter->name(), iii ); | 1820 | selectFilterMenu->insertItem( filter->name(), iii ); |
1818 | if ( filter == curfilter) | 1821 | if ( filter == curfilter) |
1819 | selectFilterMenu->setItemChecked( iii, true ); | 1822 | selectFilterMenu->setItemChecked( iii, true ); |
1820 | if ( disable ) | 1823 | if ( disable ) |
1821 | selectFilterMenu->setItemEnabled( iii, false ); | 1824 | selectFilterMenu->setItemEnabled( iii, false ); |
1822 | filter = fili.next(); | 1825 | filter = fili.next(); |
1823 | ++iii; | 1826 | ++iii; |
1824 | } | 1827 | } |
1825 | } | 1828 | } |
1826 | void MainWindow::selectFilter( int fil ) | 1829 | void MainWindow::selectFilter( int fil ) |
1827 | { | 1830 | { |
1828 | if ( fil == 0 ) { | 1831 | if ( fil == 0 ) { |
1829 | mView->editFilters( ); | 1832 | mView->editFilters( ); |
1830 | } else if ( fil == 1 ){ | 1833 | } else if ( fil == 1 ){ |
1831 | mView->toggleFilerEnabled( ); | 1834 | mView->toggleFilerEnabled( ); |
1832 | } else { | 1835 | } else { |
1833 | mView->selectFilter( fil-2 ); | 1836 | mView->selectFilter( fil-2 ); |
1834 | } | 1837 | } |
1835 | } | 1838 | } |
1836 | void MainWindow::configureToolBar( int item ) | 1839 | void MainWindow::configureToolBar( int item ) |
1837 | { | 1840 | { |
1838 | 1841 | ||
1839 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1842 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1840 | KOPrefs *p = KOPrefs::instance(); | 1843 | KOPrefs *p = KOPrefs::instance(); |
1841 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1844 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1842 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1845 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1843 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1846 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1844 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1847 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1845 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1848 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1846 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1849 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1847 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1850 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1848 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 1851 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
1849 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1852 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1850 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1853 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1851 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1854 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1852 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1855 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1853 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1856 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1854 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1857 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1855 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1858 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1856 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1859 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1857 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1860 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1858 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1861 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1859 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1862 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1860 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1863 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1861 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 1864 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
1862 | // initActions(); | 1865 | // initActions(); |
1863 | } | 1866 | } |
1864 | void MainWindow::setCaption ( const QString & c ) | 1867 | void MainWindow::setCaption ( const QString & c ) |
1865 | { | 1868 | { |
1866 | QString cap = c; | 1869 | QString cap = c; |
1867 | cap.replace( QRegExp("\n"), " " ); | 1870 | cap.replace( QRegExp("\n"), " " ); |
1868 | cap = cap.stripWhiteSpace(); | 1871 | cap = cap.stripWhiteSpace(); |
1869 | if ( cap.isEmpty() ) | 1872 | if ( cap.isEmpty() ) |
1870 | cap = "KO/Pi"; | 1873 | cap = "KO/Pi"; |
1871 | QWidget::setCaption( cap ); | 1874 | QWidget::setCaption( cap ); |
1872 | } | 1875 | } |
1873 | void MainWindow::setCaptionToDates() | 1876 | void MainWindow::setCaptionToDates() |
1874 | { | 1877 | { |
1875 | QString selDates; | 1878 | QString selDates; |
1876 | QDate date = mView->startDate(); | 1879 | QDate date = mView->startDate(); |
1877 | if ( ! date.isValid() ) { | 1880 | if ( ! date.isValid() ) { |
1878 | setCaption(""); | 1881 | setCaption(""); |
1879 | return; | 1882 | return; |
1880 | } | 1883 | } |
1881 | selDates = KGlobal::locale()->formatDate( date, true); | 1884 | selDates = KGlobal::locale()->formatDate( date, true); |
1882 | if (mView->startDate() < mView->endDate() ) | 1885 | if (mView->startDate() < mView->endDate() ) |
1883 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1886 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1884 | else { | 1887 | else { |
1885 | QString addString; | 1888 | QString addString; |
1886 | if ( date == QDateTime::currentDateTime().date() ) | 1889 | if ( date == QDateTime::currentDateTime().date() ) |
1887 | addString = i18n("Today"); | 1890 | addString = i18n("Today"); |
1888 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 1891 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
1889 | addString = i18n("Tomorrow"); | 1892 | addString = i18n("Tomorrow"); |
1890 | if ( !addString.isEmpty() ) | 1893 | if ( !addString.isEmpty() ) |
1891 | selDates = addString+", "+selDates ; | 1894 | selDates = addString+", "+selDates ; |
1892 | } | 1895 | } |
1893 | setCaption( i18n("Dates: ") + selDates ); | 1896 | setCaption( i18n("Dates: ") + selDates ); |
1894 | 1897 | ||
1895 | } | 1898 | } |
1896 | void MainWindow::showConfigureAgenda( ) | 1899 | void MainWindow::showConfigureAgenda( ) |
1897 | { | 1900 | { |
1898 | int iii; | 1901 | int iii; |
1899 | for ( iii = 1;iii<= 10 ;++iii ){ | 1902 | for ( iii = 1;iii<= 10 ;++iii ){ |
1900 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1903 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1901 | } | 1904 | } |
1902 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1905 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1903 | } | 1906 | } |
1904 | void MainWindow::configureAgenda( int item ) | 1907 | void MainWindow::configureAgenda( int item ) |
1905 | { | 1908 | { |
1906 | if ( KOPrefs::instance()->mHourSize == item ) | 1909 | if ( KOPrefs::instance()->mHourSize == item ) |
1907 | return; | 1910 | return; |
1908 | KOPrefs::instance()->mHourSize=item; | 1911 | KOPrefs::instance()->mHourSize=item; |
1909 | mView->viewManager()->agendaView()->updateConfig(); | 1912 | mView->viewManager()->agendaView()->updateConfig(); |
1910 | } | 1913 | } |
1911 | 1914 | ||
1912 | void MainWindow::saveCalendar() | 1915 | void MainWindow::saveCalendar() |
1913 | { | 1916 | { |
1914 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1917 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1915 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1918 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1916 | 1919 | ||
1917 | if ( fn == "" ) | 1920 | if ( fn == "" ) |
1918 | return; | 1921 | return; |
1919 | QFileInfo info; | 1922 | QFileInfo info; |
1920 | info.setFile( fn ); | 1923 | info.setFile( fn ); |
1921 | QString mes; | 1924 | QString mes; |
1922 | bool createbup = true; | 1925 | bool createbup = true; |
1923 | if ( info. exists() ) { | 1926 | if ( info. exists() ) { |
1924 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1927 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1925 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1928 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1926 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1929 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1927 | 0, 1 ); | 1930 | 0, 1 ); |
1928 | if ( result != 0 ) { | 1931 | if ( result != 0 ) { |
1929 | createbup = false; | 1932 | createbup = false; |
1930 | } | 1933 | } |
1931 | } | 1934 | } |
1932 | if ( createbup ) { | 1935 | if ( createbup ) { |
1933 | mView->saveCalendar( fn ); | 1936 | mView->saveCalendar( fn ); |
1934 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1937 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1935 | KOPrefs::instance()->mLastSaveFile = fn; | 1938 | KOPrefs::instance()->mLastSaveFile = fn; |
1936 | setCaption(mes); | 1939 | setCaption(mes); |
1937 | } | 1940 | } |
1938 | } | 1941 | } |
1939 | void MainWindow::loadCalendar() | 1942 | void MainWindow::loadCalendar() |
1940 | { | 1943 | { |
1941 | 1944 | ||
1942 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1945 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1943 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1946 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1944 | 1947 | ||
1945 | if ( fn == "" ) | 1948 | if ( fn == "" ) |
1946 | return; | 1949 | return; |
1947 | QFileInfo info; | 1950 | QFileInfo info; |
1948 | info.setFile( fn ); | 1951 | info.setFile( fn ); |
1949 | QString mess; | 1952 | QString mess; |
1950 | bool loadbup = true; | 1953 | bool loadbup = true; |
1951 | if ( info. exists() ) { | 1954 | if ( info. exists() ) { |
1952 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1955 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1953 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1956 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1954 | mess, | 1957 | mess, |
1955 | i18n("Load!"), i18n("Cancel"), 0, | 1958 | i18n("Load!"), i18n("Cancel"), 0, |
1956 | 0, 1 ); | 1959 | 0, 1 ); |
1957 | if ( result != 0 ) { | 1960 | if ( result != 0 ) { |
1958 | loadbup = false; | 1961 | loadbup = false; |
1959 | } | 1962 | } |
1960 | } else { | 1963 | } else { |
1961 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1964 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1962 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1965 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1963 | 0, 1 ); | 1966 | 0, 1 ); |
1964 | 1967 | ||
1965 | return; | 1968 | return; |
1966 | } | 1969 | } |
1967 | if ( loadbup ) { | 1970 | if ( loadbup ) { |
1968 | mView->openCalendar( fn ); | 1971 | mView->openCalendar( fn ); |
1969 | KOPrefs::instance()->mLastLoadFile = fn; | 1972 | KOPrefs::instance()->mLastLoadFile = fn; |
1970 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1973 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1971 | setCaption(mess); | 1974 | setCaption(mess); |
1972 | } | 1975 | } |
1973 | 1976 | ||
1974 | } | 1977 | } |
1975 | void MainWindow::quickImportIcal() | 1978 | void MainWindow::quickImportIcal() |
1976 | { | 1979 | { |
1977 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1980 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1978 | } | 1981 | } |
1979 | void MainWindow::importFile( QString fn, bool quick ) | 1982 | void MainWindow::importFile( QString fn, bool quick ) |
1980 | { | 1983 | { |
1981 | QFileInfo info; | 1984 | QFileInfo info; |
1982 | info.setFile( fn ); | 1985 | info.setFile( fn ); |
1983 | QString mess; | 1986 | QString mess; |
1984 | bool loadbup = true; | 1987 | bool loadbup = true; |
1985 | if ( !info. exists() ) { | 1988 | if ( !info. exists() ) { |
1986 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1989 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1987 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1990 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1988 | mess ); | 1991 | mess ); |
1989 | return; | 1992 | return; |
1990 | } | 1993 | } |
1991 | int result = 0; | 1994 | int result = 0; |
1992 | if ( !quick ) { | 1995 | if ( !quick ) { |
1993 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1996 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1994 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1997 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1995 | mess, | 1998 | mess, |
1996 | "Import", "Cancel", 0, | 1999 | "Import", "Cancel", 0, |
1997 | 0, 1 ); | 2000 | 0, 1 ); |
1998 | } | 2001 | } |
1999 | if ( result == 0 ) { | 2002 | if ( result == 0 ) { |
2000 | if ( mView->openCalendar( fn, true )) { | 2003 | if ( mView->openCalendar( fn, true )) { |
2001 | KOPrefs::instance()->mLastImportFile = fn; | 2004 | KOPrefs::instance()->mLastImportFile = fn; |
2002 | setCaption(i18n("Imported file successfully")); | 2005 | setCaption(i18n("Imported file successfully")); |
2003 | } else { | 2006 | } else { |
2004 | setCaption(i18n("Error importing file")); | 2007 | setCaption(i18n("Error importing file")); |
2005 | } | 2008 | } |
2006 | } | 2009 | } |
2007 | } | 2010 | } |
2008 | 2011 | ||
2009 | void MainWindow::importIcal() | 2012 | void MainWindow::importIcal() |
2010 | { | 2013 | { |
2011 | 2014 | ||
2012 | QString fn =KOPrefs::instance()->mLastImportFile; | 2015 | QString fn =KOPrefs::instance()->mLastImportFile; |
2013 | 2016 | ||
2014 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2017 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2015 | if ( fn == "" ) | 2018 | if ( fn == "" ) |
2016 | return; | 2019 | return; |
2017 | importFile( fn, true ); | 2020 | importFile( fn, true ); |
2018 | 2021 | ||
2019 | } | 2022 | } |
2020 | 2023 | ||
2021 | void MainWindow::exportVCalendar() | 2024 | void MainWindow::exportVCalendar() |
2022 | { | 2025 | { |
2023 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2026 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2024 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2027 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2025 | if ( fn == "" ) | 2028 | if ( fn == "" ) |
2026 | return; | 2029 | return; |
2027 | QFileInfo info; | 2030 | QFileInfo info; |
2028 | info.setFile( fn ); | 2031 | info.setFile( fn ); |
2029 | QString mes; | 2032 | QString mes; |
2030 | bool createbup = true; | 2033 | bool createbup = true; |
2031 | if ( info. exists() ) { | 2034 | if ( info. exists() ) { |
2032 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2035 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2033 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2036 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2034 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2037 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2035 | 0, 1 ); | 2038 | 0, 1 ); |
2036 | if ( result != 0 ) { | 2039 | if ( result != 0 ) { |
2037 | createbup = false; | 2040 | createbup = false; |
2038 | } | 2041 | } |
2039 | } | 2042 | } |
2040 | if ( createbup ) { | 2043 | if ( createbup ) { |
2041 | if ( mView->exportVCalendar( fn ) ) { | 2044 | if ( mView->exportVCalendar( fn ) ) { |
2042 | KOPrefs::instance()->mLastVcalFile = fn; | 2045 | KOPrefs::instance()->mLastVcalFile = fn; |
2043 | if ( fn.length() > 20 ) | 2046 | if ( fn.length() > 20 ) |
2044 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2047 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2045 | else | 2048 | else |
2046 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2049 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2047 | setCaption(mes); | 2050 | setCaption(mes); |
2048 | } | 2051 | } |
2049 | } | 2052 | } |
2050 | 2053 | ||
2051 | } | 2054 | } |
2052 | QString MainWindow::sentSyncFile() | 2055 | QString MainWindow::sentSyncFile() |
2053 | { | 2056 | { |
2054 | #ifdef DESKTOP_VERSION | 2057 | #ifdef DESKTOP_VERSION |
2055 | return locateLocal( "tmp", "copysynccal.ics" ); | 2058 | return locateLocal( "tmp", "copysynccal.ics" ); |
2056 | #else | 2059 | #else |
2057 | return QString( "/tmp/copysynccal.ics" ); | 2060 | return QString( "/tmp/copysynccal.ics" ); |
2058 | #endif | 2061 | #endif |
2059 | } | 2062 | } |
2060 | 2063 | ||
2061 | void MainWindow::syncFileRequest() | 2064 | void MainWindow::syncFileRequest() |
2062 | { | 2065 | { |
2063 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2066 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2064 | mSyncManager->slotSyncMenu( 999 ); | 2067 | mSyncManager->slotSyncMenu( 999 ); |
2065 | } | 2068 | } |
2066 | 2069 | ||
2067 | setCaption(i18n("Saving Data to temp file ..." )); | 2070 | setCaption(i18n("Saving Data to temp file ..." )); |
2068 | mView->saveCalendar( sentSyncFile() ); | 2071 | mView->saveCalendar( sentSyncFile() ); |
2069 | setCaption(i18n("Data saved to temp file!" )); | 2072 | setCaption(i18n("Data saved to temp file!" )); |
2070 | 2073 | ||
2071 | } | 2074 | } |
2072 | void MainWindow::getFile( bool success ) | 2075 | void MainWindow::getFile( bool success ) |
2073 | { | 2076 | { |
2074 | if ( ! success ) { | 2077 | if ( ! success ) { |
2075 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2078 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2076 | return; | 2079 | return; |
2077 | } | 2080 | } |
2078 | mView->openCalendar( sentSyncFile() ); | 2081 | mView->openCalendar( sentSyncFile() ); |
2079 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2082 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2080 | mSyncManager->slotSyncMenu( 999 ); | 2083 | mSyncManager->slotSyncMenu( 999 ); |
2081 | } | 2084 | } |
2082 | setCaption( i18n("Pi-Sync successful!") ); | 2085 | setCaption( i18n("Pi-Sync successful!") ); |
2083 | } | 2086 | } |
2084 | 2087 | ||
2085 | void MainWindow::printSel( ) | 2088 | void MainWindow::printSel( ) |
2086 | { | 2089 | { |
2087 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2090 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2088 | } | 2091 | } |
2089 | 2092 | ||
2090 | void MainWindow::printCal() | 2093 | void MainWindow::printCal() |
2091 | { | 2094 | { |
2092 | mView->print();//mCp->showDialog(); | 2095 | mView->print();//mCp->showDialog(); |
2093 | } | 2096 | } |
2094 | 2097 | ||
2095 | 2098 | ||
2096 | #include "libkdepim/kdatepicker.h" | 2099 | #include "libkdepim/kdatepicker.h" |
2097 | #include <kdatetbl.h> | 2100 | #include <kdatetbl.h> |
2098 | void MainWindow::weekAction() | 2101 | void MainWindow::weekAction() |
2099 | { | 2102 | { |
2100 | int month; | 2103 | int month; |
2101 | KPopupFrame* popup = new KPopupFrame(this); | 2104 | KPopupFrame* popup = new KPopupFrame(this); |
2102 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2105 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2103 | // ----- | 2106 | // ----- |
2104 | picker->resize(picker->sizeHint()); | 2107 | picker->resize(picker->sizeHint()); |
2105 | popup->setMainWidget(picker); | 2108 | popup->setMainWidget(picker); |
2106 | picker->setFocus(); | 2109 | picker->setFocus(); |
2107 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2110 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2108 | int x = 0; | 2111 | int x = 0; |
2109 | int y = iconToolBar->height(); | 2112 | int y = iconToolBar->height(); |
2110 | int dX = 0; | 2113 | int dX = 0; |
2111 | int dY = 0; | 2114 | int dY = 0; |
2112 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2115 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2113 | if ( iconToolBar->y() > height()/2 ) { | 2116 | if ( iconToolBar->y() > height()/2 ) { |
2114 | dY = picker->sizeHint().height()+8; | 2117 | dY = picker->sizeHint().height()+8; |
2115 | y = 0; | 2118 | y = 0; |
2116 | } | 2119 | } |
2117 | } else { | 2120 | } else { |
2118 | if ( iconToolBar->x() > width()/2 ) { // right side | 2121 | if ( iconToolBar->x() > width()/2 ) { // right side |
2119 | x=0; | 2122 | x=0; |
2120 | dX= picker->sizeHint().width()+8; | 2123 | dX= picker->sizeHint().width()+8; |
2121 | y = 0; | 2124 | y = 0; |
2122 | } else { | 2125 | } else { |
2123 | x= iconToolBar->width(); | 2126 | x= iconToolBar->width(); |
2124 | y = 0; | 2127 | y = 0; |
2125 | } | 2128 | } |
2126 | } | 2129 | } |
2127 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2130 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2128 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2131 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2129 | { | 2132 | { |
2130 | month = picker->getResult(); | 2133 | month = picker->getResult(); |
2131 | emit selectWeek ( month ); | 2134 | emit selectWeek ( month ); |
2132 | //qDebug("weekSelected %d ", month); | 2135 | //qDebug("weekSelected %d ", month); |
2133 | } | 2136 | } |
2134 | delete popup; | 2137 | delete popup; |
2135 | } | 2138 | } |
2139 | |||
2140 | void MainWindow::hideEvent ( QHideEvent * ) | ||
2141 | { | ||
2142 | QString message; | ||
2143 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | ||
2144 | if ( nextA.isValid() ) { | ||
2145 | QString sum = mCalendar->nextSummary(); | ||
2146 | |||
2147 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | ||
2148 | setCaption( message ); | ||
2149 | } | ||
2150 | } | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7604529..b3041dc 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,160 +1,161 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
27 | 27 | ||
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | class CalendarLocal; | 30 | class CalendarLocal; |
31 | } | 31 | } |
32 | 32 | ||
33 | class KOMenuBar : public QMenuBar | 33 | class KOMenuBar : public QMenuBar |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
38 | }; | 38 | }; |
39 | 39 | ||
40 | using namespace KCal; | 40 | using namespace KCal; |
41 | 41 | ||
42 | class MainWindow : public QMainWindow | 42 | class MainWindow : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
47 | ~MainWindow(); | 47 | ~MainWindow(); |
48 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
49 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
50 | static QString syncFileName(); | 50 | static QString syncFileName(); |
51 | static QString resourcePath(); | 51 | static QString resourcePath(); |
52 | public slots: | 52 | public slots: |
53 | void setCaption ( const QString & ); | 53 | void setCaption ( const QString & ); |
54 | void updateWeekNum(const KCal::DateList &); | 54 | void updateWeekNum(const KCal::DateList &); |
55 | void updateWeek(QDate); | 55 | void updateWeek(QDate); |
56 | virtual void showMaximized (); | 56 | virtual void showMaximized (); |
57 | void configureAgenda( int ); | 57 | void configureAgenda( int ); |
58 | void recieve( const QCString& msg, const QByteArray& data ); | 58 | void recieve( const QCString& msg, const QByteArray& data ); |
59 | protected slots: | 59 | protected slots: |
60 | void setCaptionToDates(); | 60 | void setCaptionToDates(); |
61 | void weekAction(); | 61 | void weekAction(); |
62 | void about(); | 62 | void about(); |
63 | void licence(); | 63 | void licence(); |
64 | void faq(); | 64 | void faq(); |
65 | void usertrans(); | 65 | void usertrans(); |
66 | void features(); | 66 | void features(); |
67 | void synchowto(); | 67 | void synchowto(); |
68 | void kdesynchowto(); | 68 | void kdesynchowto(); |
69 | void multisynchowto(); | 69 | void multisynchowto(); |
70 | void whatsNew(); | 70 | void whatsNew(); |
71 | void keyBindings(); | 71 | void keyBindings(); |
72 | void aboutAutoSaving();; | 72 | void aboutAutoSaving();; |
73 | void aboutKnownBugs(); | 73 | void aboutKnownBugs(); |
74 | 74 | ||
75 | void processIncidenceSelection( Incidence * ); | 75 | void processIncidenceSelection( Incidence * ); |
76 | 76 | ||
77 | void importQtopia(); | 77 | void importQtopia(); |
78 | void importBday(); | 78 | void importBday(); |
79 | void importOL(); | 79 | void importOL(); |
80 | void importIcal(); | 80 | void importIcal(); |
81 | void importFile( QString, bool ); | 81 | void importFile( QString, bool ); |
82 | void quickImportIcal(); | 82 | void quickImportIcal(); |
83 | 83 | ||
84 | void slotModifiedChanged( bool ); | 84 | void slotModifiedChanged( bool ); |
85 | 85 | ||
86 | void save(); | 86 | void save(); |
87 | void saveStopTimer(); | 87 | void saveStopTimer(); |
88 | void configureToolBar( int ); | 88 | void configureToolBar( int ); |
89 | void printSel(); | 89 | void printSel(); |
90 | void printCal(); | 90 | void printCal(); |
91 | void saveCalendar(); | 91 | void saveCalendar(); |
92 | void loadCalendar(); | 92 | void loadCalendar(); |
93 | void exportVCalendar(); | 93 | void exportVCalendar(); |
94 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
95 | void selectFilter( int ); | 95 | void selectFilter( int ); |
96 | void exportToPhone( int ); | 96 | void exportToPhone( int ); |
97 | void toggleBeamReceive(); | 97 | void toggleBeamReceive(); |
98 | void disableBR(bool); | 98 | void disableBR(bool); |
99 | signals: | 99 | signals: |
100 | void selectWeek ( int ); | 100 | void selectWeek ( int ); |
101 | private slots: | 101 | private slots: |
102 | void showConfigureAgenda(); | 102 | void showConfigureAgenda(); |
103 | void getFile( bool ); | 103 | void getFile( bool ); |
104 | void syncFileRequest(); | 104 | void syncFileRequest(); |
105 | 105 | ||
106 | protected: | 106 | protected: |
107 | void hideEvent ( QHideEvent * ); | ||
107 | QString sentSyncFile(); | 108 | QString sentSyncFile(); |
108 | void displayText( QString, QString); | 109 | void displayText( QString, QString); |
109 | void enableIncidenceActions( bool ); | 110 | void enableIncidenceActions( bool ); |
110 | 111 | ||
111 | private: | 112 | private: |
112 | bool mBRdisabled; | 113 | bool mBRdisabled; |
113 | #ifndef DESKTOP_VERSION | 114 | #ifndef DESKTOP_VERSION |
114 | QCopChannel* infrared; | 115 | QCopChannel* infrared; |
115 | #endif | 116 | #endif |
116 | QAction* brAction; | 117 | QAction* brAction; |
117 | KSyncManager* mSyncManager; | 118 | KSyncManager* mSyncManager; |
118 | bool mClosed; | 119 | bool mClosed; |
119 | void saveOnClose(); | 120 | void saveOnClose(); |
120 | bool mFlagKeyPressed; | 121 | bool mFlagKeyPressed; |
121 | bool mBlockAtStartup; | 122 | bool mBlockAtStartup; |
122 | QPEToolBar *iconToolBar; | 123 | QPEToolBar *iconToolBar; |
123 | void initActions(); | 124 | void initActions(); |
124 | void setDefaultPreferences(); | 125 | void setDefaultPreferences(); |
125 | void keyPressEvent ( QKeyEvent * ) ; | 126 | void keyPressEvent ( QKeyEvent * ) ; |
126 | void keyReleaseEvent ( QKeyEvent * ) ; | 127 | void keyReleaseEvent ( QKeyEvent * ) ; |
127 | QPopupMenu *configureToolBarMenu; | 128 | QPopupMenu *configureToolBarMenu; |
128 | QPopupMenu *selectFilterMenu; | 129 | QPopupMenu *selectFilterMenu; |
129 | QPopupMenu *configureAgendaMenu, *syncMenu; | 130 | QPopupMenu *configureAgendaMenu, *syncMenu; |
130 | CalendarLocal *mCalendar; | 131 | CalendarLocal *mCalendar; |
131 | CalendarView *mView; | 132 | CalendarView *mView; |
132 | QAction *mNewSubTodoAction; | 133 | QAction *mNewSubTodoAction; |
133 | QAction *mWeekAction; | 134 | QAction *mWeekAction; |
134 | QFont mWeekFont; | 135 | QFont mWeekFont; |
135 | QPixmap mWeekPixmap; | 136 | QPixmap mWeekPixmap; |
136 | QColor mWeekBgColor; | 137 | QColor mWeekBgColor; |
137 | 138 | ||
138 | QAction *mShowAction; | 139 | QAction *mShowAction; |
139 | QAction *mEditAction; | 140 | QAction *mEditAction; |
140 | QAction *mDeleteAction; | 141 | QAction *mDeleteAction; |
141 | QAction *mCloneAction; | 142 | QAction *mCloneAction; |
142 | QAction *mMoveAction; | 143 | QAction *mMoveAction; |
143 | QAction *mBeamAction; | 144 | QAction *mBeamAction; |
144 | QAction *mCancelAction; | 145 | QAction *mCancelAction; |
145 | 146 | ||
146 | QAction *mToggleNav; | 147 | QAction *mToggleNav; |
147 | QAction *mToggleFilter; | 148 | QAction *mToggleFilter; |
148 | QAction *mToggleAllday; | 149 | QAction *mToggleAllday; |
149 | 150 | ||
150 | 151 | ||
151 | void closeEvent( QCloseEvent* ce ); | 152 | void closeEvent( QCloseEvent* ce ); |
152 | SimpleAlarmClient mAlarmClient; | 153 | SimpleAlarmClient mAlarmClient; |
153 | QTimer mSaveTimer; | 154 | QTimer mSaveTimer; |
154 | //bool mBlockSaveFlag; | 155 | //bool mBlockSaveFlag; |
155 | bool mCalendarModifiedFlag; | 156 | bool mCalendarModifiedFlag; |
156 | QPixmap loadPixmap( QString ); | 157 | QPixmap loadPixmap( QString ); |
157 | }; | 158 | }; |
158 | 159 | ||
159 | 160 | ||
160 | #endif | 161 | #endif |