author | zautrix <zautrix> | 2005-08-17 20:40:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 20:40:41 (UTC) |
commit | 671857b232224314ad7720ad4bc037758a90fa4b (patch) (unidiff) | |
tree | 0dc33183b05febc146a0138e98a076b0cc2d0642 | |
parent | c49a7d17b98d59010e88305d8a66f8318b3d4aed (diff) | |
download | kdepimpi-671857b232224314ad7720ad4bc037758a90fa4b.zip kdepimpi-671857b232224314ad7720ad4bc037758a90fa4b.tar.gz kdepimpi-671857b232224314ad7720ad4bc037758a90fa4b.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 1 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 7 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 8 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
4 files changed, 12 insertions, 10 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 944ee1e..0160dbe 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,32 +1,33 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.2.1 ************ | 3 | ********** VERSION 2.2.1 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed a problem displaying very long allday events in agenda view in single day mode. | 6 | Fixed a problem displaying very long allday events in agenda view in single day mode. |
7 | Fixed a problem with the default settings for new todos. | 7 | Fixed a problem with the default settings for new todos. |
8 | Added an error message dialog if saving of calendar files is not possible. | 8 | Added an error message dialog if saving of calendar files is not possible. |
9 | Made it impossible to close KO/Pi if saving fails. | 9 | Made it impossible to close KO/Pi if saving fails. |
10 | Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. | ||
10 | 11 | ||
11 | KA/Pi: | 12 | KA/Pi: |
12 | Added a config option to turn on asking before a contact is deleted. | 13 | Added a config option to turn on asking before a contact is deleted. |
13 | Fixed a problem with the default view and view selection at startup. | 14 | Fixed a problem with the default view and view selection at startup. |
14 | Formatted name is now set on import, if formatted name is empty. | 15 | Formatted name is now set on import, if formatted name is empty. |
15 | 16 | ||
16 | ********** VERSION 2.2.0 ************ | 17 | ********** VERSION 2.2.0 ************ |
17 | 18 | ||
18 | New stable release! | 19 | New stable release! |
19 | Fixed some minor usability problems. | 20 | Fixed some minor usability problems. |
20 | Added writing of next alarm to a file for usage on pdaXrom. | 21 | Added writing of next alarm to a file for usage on pdaXrom. |
21 | 22 | ||
22 | 23 | ||
23 | ************************************* | 24 | ************************************* |
24 | 25 | ||
25 | You can find the complete changelog | 26 | You can find the complete changelog |
26 | from version 1.7.7 to 2.2.0 | 27 | from version 1.7.7 to 2.2.0 |
27 | in the source package or on | 28 | in the source package or on |
28 | 29 | ||
29 | http://www.pi-sync.net/html/changelog.html | 30 | http://www.pi-sync.net/html/changelog.html |
30 | 31 | ||
31 | 32 | ||
32 | 33 | ||
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index e86ec95..ef25fd0 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,496 +1,497 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qwhatsthis.h> | 32 | #include <qwhatsthis.h> |
33 | #include <qdir.h> | ||
33 | 34 | ||
34 | 35 | ||
35 | #include <libkcal/calfilter.h> | 36 | #include <libkcal/calfilter.h> |
36 | 37 | ||
37 | #include "kofilterview.h" | 38 | #include "kofilterview.h" |
38 | #include "koprefs.h" | 39 | #include "koprefs.h" |
39 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
40 | #include <kglobal.h> | 41 | #include <kglobal.h> |
41 | #include <kglobalsettings.h> | 42 | #include <kglobalsettings.h> |
42 | #include <kcolorbutton.h> | 43 | #include <kcolorbutton.h> |
43 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
44 | 45 | ||
45 | 46 | ||
46 | 47 | ||
47 | 48 | ||
48 | 49 | ||
49 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 50 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
50 | const char* name,WFlags fl ) | 51 | const char* name,WFlags fl ) |
51 | : KOFilterView_base(parent,name,fl) | 52 | : KOFilterView_base(parent,name,fl) |
52 | { | 53 | { |
53 | mFilters = filterList; | 54 | mFilters = filterList; |
54 | 55 | ||
55 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 56 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
56 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 57 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
57 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 58 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
58 | } | 59 | } |
59 | 60 | ||
60 | KOFilterView::~KOFilterView() | 61 | KOFilterView::~KOFilterView() |
61 | { | 62 | { |
62 | // no need to delete child widgets, Qt does it all for us | 63 | // no need to delete child widgets, Qt does it all for us |
63 | } | 64 | } |
64 | 65 | ||
65 | bool KOFilterView::filtersEnabled() | 66 | bool KOFilterView::filtersEnabled() |
66 | { | 67 | { |
67 | return mEnabledCheck->isChecked(); | 68 | return mEnabledCheck->isChecked(); |
68 | } | 69 | } |
69 | 70 | ||
70 | void KOFilterView::setFiltersEnabled(bool set) | 71 | void KOFilterView::setFiltersEnabled(bool set) |
71 | { | 72 | { |
72 | mEnabledCheck->setChecked(set); | 73 | mEnabledCheck->setChecked(set); |
73 | emit filterChanged(); | 74 | emit filterChanged(); |
74 | } | 75 | } |
75 | 76 | ||
76 | 77 | ||
77 | void KOFilterView::updateFilters() | 78 | void KOFilterView::updateFilters() |
78 | { | 79 | { |
79 | mSelectionCombo->clear(); | 80 | mSelectionCombo->clear(); |
80 | 81 | ||
81 | CalFilter *filter = mFilters->first(); | 82 | CalFilter *filter = mFilters->first(); |
82 | while(filter) { | 83 | while(filter) { |
83 | mSelectionCombo->insertItem(filter->name()); | 84 | mSelectionCombo->insertItem(filter->name()); |
84 | filter = mFilters->next(); | 85 | filter = mFilters->next(); |
85 | } | 86 | } |
86 | } | 87 | } |
87 | 88 | ||
88 | CalFilter *KOFilterView::selectedFilter() | 89 | CalFilter *KOFilterView::selectedFilter() |
89 | { | 90 | { |
90 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 91 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
91 | return f; | 92 | return f; |
92 | } | 93 | } |
93 | 94 | ||
94 | void KOFilterView::setSelectedFilter(QString filterName) | 95 | void KOFilterView::setSelectedFilter(QString filterName) |
95 | { | 96 | { |
96 | int filter_num = mSelectionCombo->count(); | 97 | int filter_num = mSelectionCombo->count(); |
97 | int i; | 98 | int i; |
98 | for (i=0;i<filter_num;i++) { | 99 | for (i=0;i<filter_num;i++) { |
99 | if (mSelectionCombo->text(i)==filterName) | 100 | if (mSelectionCombo->text(i)==filterName) |
100 | mSelectionCombo->setCurrentItem(i); | 101 | mSelectionCombo->setCurrentItem(i); |
101 | } | 102 | } |
102 | emit filterChanged(); | 103 | emit filterChanged(); |
103 | } | 104 | } |
104 | void KOFilterView::setSelectedFilter( int fil ) | 105 | void KOFilterView::setSelectedFilter( int fil ) |
105 | { | 106 | { |
106 | if ( fil >= mSelectionCombo->count() ) | 107 | if ( fil >= mSelectionCombo->count() ) |
107 | return; | 108 | return; |
108 | mSelectionCombo->setCurrentItem( fil ); | 109 | mSelectionCombo->setCurrentItem( fil ); |
109 | emit filterChanged(); | 110 | emit filterChanged(); |
110 | } | 111 | } |
111 | 112 | ||
112 | 113 | ||
113 | 114 | ||
114 | KOCalEditView::KOCalEditView(QWidget* parent, | 115 | KOCalEditView::KOCalEditView(QWidget* parent, |
115 | const char* name ) | 116 | const char* name ) |
116 | : QScrollView(parent,name) | 117 | : QScrollView(parent,name) |
117 | { | 118 | { |
118 | mw = 0; | 119 | mw = 0; |
119 | setResizePolicy( AutoOneFit ); | 120 | setResizePolicy( AutoOneFit ); |
120 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 121 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); |
121 | setLineWidth ( 1 ); | 122 | setLineWidth ( 1 ); |
122 | setMidLineWidth ( 1 ); | 123 | setMidLineWidth ( 1 ); |
123 | setFocusPolicy(NoFocus); | 124 | setFocusPolicy(NoFocus); |
124 | } | 125 | } |
125 | 126 | ||
126 | KOCalEditView::~KOCalEditView() | 127 | KOCalEditView::~KOCalEditView() |
127 | { | 128 | { |
128 | // no need to delete child widgets, Qt does it all for us | 129 | // no need to delete child widgets, Qt does it all for us |
129 | } | 130 | } |
130 | void KOCalEditView::selectCal(int id ,bool b) | 131 | void KOCalEditView::selectCal(int id ,bool b) |
131 | { | 132 | { |
132 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 133 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
133 | emit calendarEnabled ( id, b ); | 134 | emit calendarEnabled ( id, b ); |
134 | emit needsUpdate(); | 135 | emit needsUpdate(); |
135 | 136 | ||
136 | } | 137 | } |
137 | void KOCalEditView::selectStdCal( int id ) | 138 | void KOCalEditView::selectStdCal( int id ) |
138 | { | 139 | { |
139 | KOCalRadioButton* it = mStdandardB.first(); | 140 | KOCalRadioButton* it = mStdandardB.first(); |
140 | while ( it ) { | 141 | while ( it ) { |
141 | it->blockSignals( true ); | 142 | it->blockSignals( true ); |
142 | it->setChecked( it->num() == id ); | 143 | it->setChecked( it->num() == id ); |
143 | it->blockSignals( false ); | 144 | it->blockSignals( false ); |
144 | it = mStdandardB.next(); | 145 | it = mStdandardB.next(); |
145 | } | 146 | } |
146 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 147 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
147 | while ( kkf ) { | 148 | while ( kkf ) { |
148 | kkf->isStandard = (kkf->mCalNumber == id ); | 149 | kkf->isStandard = (kkf->mCalNumber == id ); |
149 | kkf = KOPrefs::instance()->mCalendars.next(); | 150 | kkf = KOPrefs::instance()->mCalendars.next(); |
150 | } | 151 | } |
151 | emit setCalendarDefault ( id ); | 152 | emit setCalendarDefault ( id ); |
152 | } | 153 | } |
153 | 154 | ||
154 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 155 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
155 | { | 156 | { |
156 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 157 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
157 | emit alarmEnabled ( id , b ); | 158 | emit alarmEnabled ( id , b ); |
158 | emit needsUpdate(); | 159 | emit needsUpdate(); |
159 | } | 160 | } |
160 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 161 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
161 | { | 162 | { |
162 | 163 | ||
163 | emit calendarReadonly ( id , b ); | 164 | emit calendarReadonly ( id , b ); |
164 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 165 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
165 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) { | 166 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) { |
166 | findNewStandard(); | 167 | findNewStandard(); |
167 | } | 168 | } |
168 | if ( !b ){ | 169 | if ( !b ){ |
169 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 170 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
170 | while ( kkf ) { | 171 | while ( kkf ) { |
171 | if (kkf->isReadOnly && kkf->isStandard ) { | 172 | if (kkf->isReadOnly && kkf->isStandard ) { |
172 | selectStdCal( id ); | 173 | selectStdCal( id ); |
173 | break; | 174 | break; |
174 | } | 175 | } |
175 | kkf = KOPrefs::instance()->mCalendars.next(); | 176 | kkf = KOPrefs::instance()->mCalendars.next(); |
176 | } | 177 | } |
177 | } | 178 | } |
178 | 179 | ||
179 | mStdandardB.at(id-1)->setEnabled( !b ); | 180 | mStdandardB.at(id-1)->setEnabled( !b ); |
180 | emit needsUpdate(); | 181 | emit needsUpdate(); |
181 | 182 | ||
182 | } | 183 | } |
183 | void KOCalEditView::findNewStandard() | 184 | void KOCalEditView::findNewStandard() |
184 | { | 185 | { |
185 | bool found = false; | 186 | bool found = false; |
186 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 187 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
187 | while ( kkf ) { | 188 | while ( kkf ) { |
188 | if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) { | 189 | if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) { |
189 | found = true; | 190 | found = true; |
190 | selectStdCal( kkf->mCalNumber ); | 191 | selectStdCal( kkf->mCalNumber ); |
191 | break; | 192 | break; |
192 | } | 193 | } |
193 | kkf = KOPrefs::instance()->mCalendars.next(); | 194 | kkf = KOPrefs::instance()->mCalendars.next(); |
194 | } | 195 | } |
195 | if ( !found ) { | 196 | if ( !found ) { |
196 | KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"), | 197 | KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"), |
197 | i18n("Houston, we have a problem!") ); | 198 | i18n("Houston, we have a problem!") ); |
198 | 199 | ||
199 | } | 200 | } |
200 | } | 201 | } |
201 | 202 | ||
202 | void KOCalEditView::setColor( const QColor& c, int id ) | 203 | void KOCalEditView::setColor( const QColor& c, int id ) |
203 | { | 204 | { |
204 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 205 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
205 | emit needsUpdate(); | 206 | emit needsUpdate(); |
206 | } | 207 | } |
207 | void KOCalEditView::deleteCal( int id ) | 208 | void KOCalEditView::deleteCal( int id ) |
208 | { | 209 | { |
209 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 210 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
210 | QString name = kkf->mName; | 211 | QString name = kkf->mName; |
211 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); | 212 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); |
212 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 213 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
213 | bool findnewstd = kkf->isStandard; | 214 | bool findnewstd = kkf->isStandard; |
214 | emit removeCalendar ( id ); | 215 | emit removeCalendar ( id ); |
215 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 216 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
216 | if ( findnewstd ) findNewStandard(); | 217 | if ( findnewstd ) findNewStandard(); |
217 | emit needsUpdate(); | 218 | emit needsUpdate(); |
218 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 219 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
219 | } | 220 | } |
220 | void KOCalEditView::infoCal( int id ) | 221 | void KOCalEditView::infoCal( int id ) |
221 | { | 222 | { |
222 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 223 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
223 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); | 224 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); |
224 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { | 225 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
225 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { | 226 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { |
226 | emit calendarAdded( id ); | 227 | emit calendarAdded( id ); |
227 | emit needsUpdate(); | 228 | emit needsUpdate(); |
228 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 229 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
229 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); | 230 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); |
230 | } | 231 | } |
231 | } | 232 | } |
232 | else | 233 | else |
233 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 234 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
234 | } | 235 | } |
235 | void KOCalEditView::readConfig() | 236 | void KOCalEditView::readConfig() |
236 | { | 237 | { |
237 | 238 | ||
238 | mStdandardB.clear(); | 239 | mStdandardB.clear(); |
239 | mEnabledB.clear(); | 240 | mEnabledB.clear(); |
240 | mAlarmB.clear(); | 241 | mAlarmB.clear(); |
241 | mROB.clear(); | 242 | mROB.clear(); |
242 | 243 | ||
243 | if ( mw ) delete mw; | 244 | if ( mw ) delete mw; |
244 | mw = new QWidget ( viewport() ); | 245 | mw = new QWidget ( viewport() ); |
245 | addChild(mw); | 246 | addChild(mw); |
246 | int ii = 0; | 247 | int ii = 0; |
247 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 248 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
248 | mainLayout->setMargin( 2 ); | 249 | mainLayout->setMargin( 2 ); |
249 | mainLayout->setSpacing( 2 ); | 250 | mainLayout->setSpacing( 2 ); |
250 | QPushButton * addButT = new QPushButton ( mw ); | 251 | QPushButton * addButT = new QPushButton ( mw ); |
251 | addButT->setFocusPolicy(NoFocus); | 252 | addButT->setFocusPolicy(NoFocus); |
252 | mainLayout->addWidget( addButT,0,0 ); | 253 | mainLayout->addWidget( addButT,0,0 ); |
253 | addButT->setText( "D"); | 254 | addButT->setText( "D"); |
254 | connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo())); | 255 | connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo())); |
255 | QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); | 256 | QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); |
256 | //addBut->setPixmap ( SmallIcon("greenhook16")); | 257 | //addBut->setPixmap ( SmallIcon("greenhook16")); |
257 | QPushButton *addBut = new QPushButton ( mw ); | 258 | QPushButton *addBut = new QPushButton ( mw ); |
258 | addBut->setFocusPolicy(NoFocus); | 259 | addBut->setFocusPolicy(NoFocus); |
259 | mainLayout->addWidget( addBut,0,++ii ); | 260 | mainLayout->addWidget( addBut,0,++ii ); |
260 | addBut->setPixmap ( SmallIcon("eye")); | 261 | addBut->setPixmap ( SmallIcon("eye")); |
261 | QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") ); | 262 | QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") ); |
262 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 263 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
263 | int max = addBut->sizeHint().height(); | 264 | int max = addBut->sizeHint().height(); |
264 | addBut->setMaximumWidth( max ); | 265 | addBut->setMaximumWidth( max ); |
265 | addButT->setFixedSize( QSize( max, max ) ); | 266 | addButT->setFixedSize( QSize( max, max ) ); |
266 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); | 267 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); |
267 | mainLayout->addWidget( lab,0,++ii ); | 268 | mainLayout->addWidget( lab,0,++ii ); |
268 | QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") ); | 269 | QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") ); |
269 | //lab = new QLabel ( i18n(" "), mw ); | 270 | //lab = new QLabel ( i18n(" "), mw ); |
270 | //mainLayout->addWidget( lab,0,++ii ); | 271 | //mainLayout->addWidget( lab,0,++ii ); |
271 | //lab->setFixedWidth( 1 ); | 272 | //lab->setFixedWidth( 1 ); |
272 | addBut = new QPushButton ( mw ); | 273 | addBut = new QPushButton ( mw ); |
273 | addBut->setFocusPolicy(NoFocus); | 274 | addBut->setFocusPolicy(NoFocus); |
274 | mainLayout->addWidget( addBut,0,++ii ); | 275 | mainLayout->addWidget( addBut,0,++ii ); |
275 | addBut->setPixmap ( SmallIcon("bell")); | 276 | addBut->setPixmap ( SmallIcon("bell")); |
276 | QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") ); | 277 | QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") ); |
277 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 278 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
278 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 279 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
279 | 280 | ||
280 | addBut = new QPushButton ( mw ); | 281 | addBut = new QPushButton ( mw ); |
281 | addBut->setFocusPolicy(NoFocus); | 282 | addBut->setFocusPolicy(NoFocus); |
282 | mainLayout->addWidget( addBut,0,++ii ); | 283 | mainLayout->addWidget( addBut,0,++ii ); |
283 | addBut->setPixmap ( SmallIcon("pencil")); | 284 | addBut->setPixmap ( SmallIcon("pencil")); |
284 | QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") ); | 285 | QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") ); |
285 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 286 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
286 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 287 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
287 | lab = new QLabel ( "", mw ); | 288 | lab = new QLabel ( "", mw ); |
288 | mainLayout->addWidget( lab,0,++ii ); | 289 | mainLayout->addWidget( lab,0,++ii ); |
289 | 290 | ||
290 | addBut = new QPushButton ( mw ); | 291 | addBut = new QPushButton ( mw ); |
291 | addBut->setFocusPolicy(NoFocus); | 292 | addBut->setFocusPolicy(NoFocus); |
292 | mainLayout->addWidget( addBut,0,++ii ); | 293 | mainLayout->addWidget( addBut,0,++ii ); |
293 | addBut->setPixmap ( SmallIcon("plus")); | 294 | addBut->setPixmap ( SmallIcon("plus")); |
294 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 295 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
295 | QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") ); | 296 | QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") ); |
296 | lab = new QLabel ( " ", mw ); | 297 | lab = new QLabel ( " ", mw ); |
297 | mainLayout->addWidget( lab,0,++ii ); | 298 | mainLayout->addWidget( lab,0,++ii ); |
298 | 299 | ||
299 | 300 | ||
300 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 301 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
301 | int row = 1; | 302 | int row = 1; |
302 | bool errorLoadStandard = false; | 303 | bool errorLoadStandard = false; |
303 | while ( kkf ) { | 304 | while ( kkf ) { |
304 | int iii = 0; | 305 | int iii = 0; |
305 | KOCalRadioButton* rb = new KOCalRadioButton( mw ); | 306 | KOCalRadioButton* rb = new KOCalRadioButton( mw ); |
306 | mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); | 307 | mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); |
307 | rb->setChecked( kkf->isStandard ); | 308 | rb->setChecked( kkf->isStandard ); |
308 | if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) | 309 | if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) |
309 | errorLoadStandard = true; | 310 | errorLoadStandard = true; |
310 | rb->setNum( kkf->mCalNumber ); | 311 | rb->setNum( kkf->mCalNumber ); |
311 | connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); | 312 | connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); |
312 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 313 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
313 | rb->setEnabled( false ); | 314 | rb->setEnabled( false ); |
314 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 315 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
315 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); | 316 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); |
316 | cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); | 317 | cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); |
317 | cb->setNum( kkf->mCalNumber ); | 318 | cb->setNum( kkf->mCalNumber ); |
318 | if ( kkf->mErrorOnLoad ) | 319 | if ( kkf->mErrorOnLoad ) |
319 | cb->setEnabled( false ); | 320 | cb->setEnabled( false ); |
320 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 321 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
321 | KOCalButton* name = new KOCalButton( mw ); | 322 | KOCalButton* name = new KOCalButton( mw ); |
322 | name->setNum( kkf->mCalNumber ); | 323 | name->setNum( kkf->mCalNumber ); |
323 | name->setText( kkf->mName ); | 324 | name->setText( kkf->mName ); |
324 | mainLayout->addWidget( name,row,++iii ); | 325 | mainLayout->addWidget( name,row,++iii ); |
325 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 326 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
326 | //lab = new QLabel (" ", mw ); | 327 | //lab = new QLabel (" ", mw ); |
327 | //mainLayout->addWidget( lab,row,++iii ); | 328 | //mainLayout->addWidget( lab,row,++iii ); |
328 | cb = new KOCalCheckButton( mw ); | 329 | cb = new KOCalCheckButton( mw ); |
329 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); | 330 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); |
330 | cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); | 331 | cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); |
331 | cb->setNum( kkf->mCalNumber ); | 332 | cb->setNum( kkf->mCalNumber ); |
332 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 333 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
333 | if ( kkf->mErrorOnLoad ) | 334 | if ( kkf->mErrorOnLoad ) |
334 | cb->setEnabled( false ); | 335 | cb->setEnabled( false ); |
335 | cb = new KOCalCheckButton( mw ); | 336 | cb = new KOCalCheckButton( mw ); |
336 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); | 337 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); |
337 | cb->setChecked( kkf->isReadOnly ); | 338 | cb->setChecked( kkf->isReadOnly ); |
338 | cb->setNum( kkf->mCalNumber ); | 339 | cb->setNum( kkf->mCalNumber ); |
339 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 340 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
340 | if ( kkf->mErrorOnLoad ) | 341 | if ( kkf->mErrorOnLoad ) |
341 | cb->setEnabled( false ); | 342 | cb->setEnabled( false ); |
342 | if ( row > 1) { | 343 | if ( row > 1) { |
343 | KColorButton *colb = new KColorButton( mw ); | 344 | KColorButton *colb = new KColorButton( mw ); |
344 | mainLayout->addWidget( colb,row,++iii ); | 345 | mainLayout->addWidget( colb,row,++iii ); |
345 | colb->setID( kkf->mCalNumber ); | 346 | colb->setID( kkf->mCalNumber ); |
346 | colb->setColor( kkf->mDefaultColor ); | 347 | colb->setColor( kkf->mDefaultColor ); |
347 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 348 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
348 | KOCalButton* calb = new KOCalButton( mw ); | 349 | KOCalButton* calb = new KOCalButton( mw ); |
349 | mainLayout->addWidget( calb,row,++iii ); | 350 | mainLayout->addWidget( calb,row,++iii ); |
350 | calb->setNum( kkf->mCalNumber ); | 351 | calb->setNum( kkf->mCalNumber ); |
351 | calb->setPixmap ( SmallIcon("minus")); | 352 | calb->setPixmap ( SmallIcon("minus")); |
352 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 353 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
353 | int hei = calb->sizeHint().height(); | 354 | int hei = calb->sizeHint().height(); |
354 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 355 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
355 | } | 356 | } |
356 | ++row; | 357 | ++row; |
357 | kkf = KOPrefs::instance()->mCalendars.next(); | 358 | kkf = KOPrefs::instance()->mCalendars.next(); |
358 | } | 359 | } |
359 | if ( errorLoadStandard ) | 360 | if ( errorLoadStandard ) |
360 | findNewStandard(); | 361 | findNewStandard(); |
361 | lab = new QLabel ( "", mw ); | 362 | lab = new QLabel ( "", mw ); |
362 | mainLayout->addWidget( lab,row,0 ); | 363 | mainLayout->addWidget( lab,row,0 ); |
363 | mw->show(); | 364 | mw->show(); |
364 | 365 | ||
365 | } | 366 | } |
366 | 367 | ||
367 | void KOCalEditView::defaultInfo() | 368 | void KOCalEditView::defaultInfo() |
368 | { | 369 | { |
369 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); | 370 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); |
370 | } | 371 | } |
371 | void KOCalEditView::addCal() | 372 | void KOCalEditView::addCal() |
372 | { | 373 | { |
373 | bool tryagain = true; | 374 | bool tryagain = true; |
374 | QString name, file = KGlobalSettings::calendarDir()+"newCal.ics"; | 375 | QString name, file = KGlobalSettings::calendarDir()+"newCal.ics"; |
375 | while ( tryagain ) { | 376 | while ( tryagain ) { |
376 | KONewCalPrefs prefs ( this ); | 377 | KONewCalPrefs prefs ( this ); |
377 | prefs.nameE->setText( name ); | 378 | prefs.nameE->setText( name ); |
378 | prefs.url->setURL( file ); | 379 | prefs.url->setURL( file ); |
379 | if ( ! prefs.exec() ) | 380 | if ( ! prefs.exec() ) |
380 | return; | 381 | return; |
381 | name = prefs.calName(); | 382 | name = prefs.calName(); |
382 | file = prefs.calFileName(); | 383 | file = prefs.calFileName(); |
383 | tryagain = false; | 384 | tryagain = false; |
384 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 385 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
385 | while ( kkf ) { | 386 | while ( kkf ) { |
386 | if ( kkf->mName == name ) { | 387 | if ( kkf->mName == name ) { |
387 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 388 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
388 | name = ""; | 389 | name = ""; |
389 | tryagain = true; | 390 | tryagain = true; |
390 | break; | 391 | break; |
391 | } | 392 | } |
392 | if ( kkf->mFileName == file ) { | 393 | if ( kkf->mFileName == file ) { |
393 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); | 394 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
394 | tryagain = true; | 395 | tryagain = true; |
395 | file = KGlobalSettings::calendarDir()+"newCal.ics"; | 396 | file = KGlobalSettings::calendarDir()+"newCal.ics"; |
396 | break; | 397 | break; |
397 | } | 398 | } |
398 | kkf = KOPrefs::instance()->mCalendars.next(); | 399 | kkf = KOPrefs::instance()->mCalendars.next(); |
399 | } | 400 | } |
400 | QFileInfo fi ( file ); | 401 | QFileInfo fi ( file ); |
401 | if ( fi.isDir() ) { | 402 | if ( fi.isDir() ) { |
402 | tryagain = true; | 403 | tryagain = true; |
403 | } | 404 | } |
404 | } | 405 | } |
405 | addCalendar ( name, file ); | 406 | addCalendar ( name, file ); |
406 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); | 407 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); |
407 | } | 408 | } |
408 | int KOCalEditView::addCalendar( QString name, QString file, bool ask ) | 409 | int KOCalEditView::addCalendar( QString name, QString file, bool ask ) |
409 | { | 410 | { |
410 | 411 | file = QDir::convertSeparators( file ); | |
411 | QFileInfo fi ( file ); | 412 | QFileInfo fi ( file ); |
412 | QString absFile = file; | 413 | QString absFile = file; |
413 | bool isRelative = false; | 414 | bool isRelative = false; |
414 | if ( fi.isRelative() ) { | 415 | if ( fi.isRelative() ) { |
415 | isRelative = true; | 416 | isRelative = true; |
416 | absFile = KGlobalSettings::calendarDir()+file; | 417 | absFile = QDir::convertSeparators( KGlobalSettings::calendarDir()+file ); |
417 | fi.setFile( absFile ); | 418 | fi.setFile( absFile ); |
418 | } else { | 419 | } else { |
419 | QString cd = KGlobalSettings::calendarDir(); | 420 | QString cd = QDir::convertSeparators( KGlobalSettings::calendarDir() ); |
420 | if ( file.left( cd.length() ) == cd ) { | 421 | if ( file.left( cd.length() ) == cd ) { |
421 | isRelative = true; | 422 | isRelative = true; |
422 | file = fi.fileName (); | 423 | file = fi.fileName (); |
423 | fi.setFile( absFile ); | 424 | fi.setFile( absFile ); |
424 | } | 425 | } |
425 | } | 426 | } |
426 | if (!fi.exists() ) { | 427 | if (!fi.exists() ) { |
427 | if ( ask ) | 428 | if ( ask ) |
428 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) | 429 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) |
429 | return 0; | 430 | return 0; |
430 | QFile fileIn( absFile ); | 431 | QFile fileIn( absFile ); |
431 | if (!fileIn.open( IO_WriteOnly ) ) { | 432 | if (!fileIn.open( IO_WriteOnly ) ) { |
432 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); | 433 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); |
433 | return 0; | 434 | return 0; |
434 | } | 435 | } |
435 | QTextStream tsIn( &fileIn ); | 436 | QTextStream tsIn( &fileIn ); |
436 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 437 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
437 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; | 438 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; |
438 | fileIn.close(); | 439 | fileIn.close(); |
439 | } | 440 | } |
440 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 441 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
441 | kkf->mName = name; | 442 | kkf->mName = name; |
442 | kkf->mFileName = absFile; | 443 | kkf->mFileName = absFile; |
443 | kkf->mSavedFileName = file; | 444 | kkf->mSavedFileName = file; |
444 | kkf->isRelative = isRelative; | 445 | kkf->isRelative = isRelative; |
445 | emit calendarAdded( kkf->mCalNumber ); | 446 | emit calendarAdded( kkf->mCalNumber ); |
446 | if ( ask ) | 447 | if ( ask ) |
447 | emit needsUpdate(); | 448 | emit needsUpdate(); |
448 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 449 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
449 | return kkf->mCalNumber; | 450 | return kkf->mCalNumber; |
450 | } | 451 | } |
451 | int KOCalEditView::getBirtdayID() | 452 | int KOCalEditView::getBirtdayID() |
452 | { | 453 | { |
453 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 454 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
454 | while ( kkf ) { | 455 | while ( kkf ) { |
455 | if ( kkf->mName == i18n("Birthdays") ) | 456 | if ( kkf->mName == i18n("Birthdays") ) |
456 | return kkf->mCalNumber; | 457 | return kkf->mCalNumber; |
457 | kkf = KOPrefs::instance()->mCalendars.next(); | 458 | kkf = KOPrefs::instance()->mCalendars.next(); |
458 | } | 459 | } |
459 | QString file = locateLocal( "data", "korganizer/birthdays.ics" ); | 460 | QString file = locateLocal( "data", "korganizer/birthdays.ics" ); |
460 | return addCalendar( i18n("Birthdays"), file, false ); | 461 | return addCalendar( i18n("Birthdays"), file, false ); |
461 | } | 462 | } |
462 | 463 | ||
463 | void KOCalEditView::enableAll() | 464 | void KOCalEditView::enableAll() |
464 | { | 465 | { |
465 | toggleList( mEnabledB ); | 466 | toggleList( mEnabledB ); |
466 | } | 467 | } |
467 | void KOCalEditView::enableAlarm() | 468 | void KOCalEditView::enableAlarm() |
468 | { | 469 | { |
469 | toggleList( mAlarmB ); | 470 | toggleList( mAlarmB ); |
470 | } | 471 | } |
471 | void KOCalEditView::disableRO() | 472 | void KOCalEditView::disableRO() |
472 | { | 473 | { |
473 | toggleList( mROB, false ); | 474 | toggleList( mROB, false ); |
474 | } | 475 | } |
475 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable ) | 476 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable ) |
476 | { | 477 | { |
477 | bool dis = !enable; | 478 | bool dis = !enable; |
478 | KOCalCheckButton* it = list.first(); | 479 | KOCalCheckButton* it = list.first(); |
479 | while ( it ) { | 480 | while ( it ) { |
480 | if ( !it->isChecked() == enable && it->isEnabled() ) { | 481 | if ( !it->isChecked() == enable && it->isEnabled() ) { |
481 | dis = !dis; | 482 | dis = !dis; |
482 | break; | 483 | break; |
483 | } | 484 | } |
484 | it = list.next(); | 485 | it = list.next(); |
485 | } | 486 | } |
486 | it = list.first(); | 487 | it = list.first(); |
487 | while ( it ) { | 488 | while ( it ) { |
488 | if ( it->isEnabled() ) | 489 | if ( it->isEnabled() ) |
489 | it->setChecked(dis); | 490 | it->setChecked(dis); |
490 | it = list.next(); | 491 | it = list.next(); |
491 | } | 492 | } |
492 | } | 493 | } |
493 | void KOCalEditView::deleteAll() | 494 | void KOCalEditView::deleteAll() |
494 | { | 495 | { |
495 | qDebug("delteAll"); | 496 | qDebug("delteAll"); |
496 | } | 497 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index eb997f5..77f572c 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -260,367 +260,367 @@ KOPrefs::KOPrefs() : | |||
260 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 260 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
261 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 261 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
262 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 262 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
263 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 263 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
264 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 264 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
265 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 265 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
266 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 266 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
267 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 267 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
268 | addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,false); | 268 | addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,false); |
269 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 269 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
270 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 270 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
271 | #ifdef DESKTOP_VERSION | 271 | #ifdef DESKTOP_VERSION |
272 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 272 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
273 | #else | 273 | #else |
274 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 274 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
275 | #endif | 275 | #endif |
276 | addItemInt("Day Begins",&mDayBegins,7); | 276 | addItemInt("Day Begins",&mDayBegins,7); |
277 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 277 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
278 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 278 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
279 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 279 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
280 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 280 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
281 | 281 | ||
282 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 282 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
283 | addItemBool("Full View Month",&mFullViewMonth,true); | 283 | addItemBool("Full View Month",&mFullViewMonth,true); |
284 | addItemBool("Full View Todo",&mFullViewTodo,true); | 284 | addItemBool("Full View Todo",&mFullViewTodo,true); |
285 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 285 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
286 | 286 | ||
287 | addItemInt("Next X Days",&mNextXDays,3); | 287 | addItemInt("Next X Days",&mNextXDays,3); |
288 | 288 | ||
289 | KPrefs::setCurrentGroup("Printer"); | 289 | KPrefs::setCurrentGroup("Printer"); |
290 | 290 | ||
291 | KPrefs::setCurrentGroup("Layout"); | 291 | KPrefs::setCurrentGroup("Layout"); |
292 | 292 | ||
293 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 293 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
294 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 294 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
295 | 295 | ||
296 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 296 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
297 | 297 | ||
298 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 298 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
299 | 299 | ||
300 | KPrefs::setCurrentGroup("Group Scheduling"); | 300 | KPrefs::setCurrentGroup("Group Scheduling"); |
301 | 301 | ||
302 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 302 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
303 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 303 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
304 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 304 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
305 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 305 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
306 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 306 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
307 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 307 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
308 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 308 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
309 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 309 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
310 | 310 | ||
311 | KPrefs::setCurrentGroup( "Editors" ); | 311 | KPrefs::setCurrentGroup( "Editors" ); |
312 | 312 | ||
313 | addItemStringList( "EventTemplates", &mEventTemplates ); | 313 | addItemStringList( "EventTemplates", &mEventTemplates ); |
314 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 314 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
315 | 315 | ||
316 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 316 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
317 | 317 | ||
318 | KPrefs::setCurrentGroup( "ViewOptions" ); | 318 | KPrefs::setCurrentGroup( "ViewOptions" ); |
319 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 319 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
320 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 320 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
321 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 321 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
322 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 322 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
323 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 323 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
324 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 324 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
325 | mCalendars.setAutoDelete( true ); | 325 | mCalendars.setAutoDelete( true ); |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | KOPrefs::~KOPrefs() | 329 | KOPrefs::~KOPrefs() |
330 | { | 330 | { |
331 | if (mInstance == this) | 331 | if (mInstance == this) |
332 | mInstance = insd.setObject(0); | 332 | mInstance = insd.setObject(0); |
333 | mCalendars.setAutoDelete( true ); | 333 | mCalendars.setAutoDelete( true ); |
334 | mCalendars.clear(); | 334 | mCalendars.clear(); |
335 | //qDebug("KOPrefs::~KOPrefs() "); | 335 | //qDebug("KOPrefs::~KOPrefs() "); |
336 | } | 336 | } |
337 | 337 | ||
338 | 338 | ||
339 | KOPrefs *KOPrefs::instance() | 339 | KOPrefs *KOPrefs::instance() |
340 | { | 340 | { |
341 | if (!mInstance) { | 341 | if (!mInstance) { |
342 | mInstance = insd.setObject(new KOPrefs()); | 342 | mInstance = insd.setObject(new KOPrefs()); |
343 | mInstance->readConfig(); | 343 | mInstance->readConfig(); |
344 | } | 344 | } |
345 | 345 | ||
346 | return mInstance; | 346 | return mInstance; |
347 | } | 347 | } |
348 | 348 | ||
349 | void KOPrefs::usrSetDefaults() | 349 | void KOPrefs::usrSetDefaults() |
350 | { | 350 | { |
351 | 351 | ||
352 | } | 352 | } |
353 | 353 | ||
354 | void KOPrefs::fillMailDefaults() | 354 | void KOPrefs::fillMailDefaults() |
355 | { | 355 | { |
356 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 356 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
357 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 357 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
358 | } | 358 | } |
359 | 359 | ||
360 | void KOPrefs::setTimeZoneIdDefault() | 360 | void KOPrefs::setTimeZoneIdDefault() |
361 | { | 361 | { |
362 | ; | 362 | ; |
363 | } | 363 | } |
364 | 364 | ||
365 | void KOPrefs::setAllDefaults() | 365 | void KOPrefs::setAllDefaults() |
366 | { | 366 | { |
367 | setCategoryDefaults(); | 367 | setCategoryDefaults(); |
368 | mEventSummaryUser = getDefaultList() ; | 368 | mEventSummaryUser = getDefaultList() ; |
369 | mTodoSummaryUser = getDefaultList() ; | 369 | mTodoSummaryUser = getDefaultList() ; |
370 | mJournalSummaryUser = getDefaultList() ; | 370 | mJournalSummaryUser = getDefaultList() ; |
371 | mLocationDefaults = getLocationDefaultList(); | 371 | mLocationDefaults = getLocationDefaultList(); |
372 | } | 372 | } |
373 | 373 | ||
374 | void KOPrefs::setCategoryDefaults() | 374 | void KOPrefs::setCategoryDefaults() |
375 | { | 375 | { |
376 | mCustomCategories.clear(); | 376 | mCustomCategories.clear(); |
377 | mCustomCategories = getDefaultList(); | 377 | mCustomCategories = getDefaultList(); |
378 | 378 | ||
379 | QStringList::Iterator it; | 379 | QStringList::Iterator it; |
380 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 380 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
381 | setCategoryColor(*it,mDefaultCategoryColor); | 381 | setCategoryColor(*it,mDefaultCategoryColor); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | QStringList KOPrefs::getLocationDefaultList() | 384 | QStringList KOPrefs::getLocationDefaultList() |
385 | { | 385 | { |
386 | QStringList retval ; | 386 | QStringList retval ; |
387 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 387 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
388 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 388 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
389 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 389 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
390 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 390 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
391 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 391 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
392 | 392 | ||
393 | retval.sort(); | 393 | retval.sort(); |
394 | return retval; | 394 | return retval; |
395 | } | 395 | } |
396 | QStringList KOPrefs::getDefaultList() | 396 | QStringList KOPrefs::getDefaultList() |
397 | { | 397 | { |
398 | QStringList retval ; | 398 | QStringList retval ; |
399 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") | 399 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") |
400 | << i18n("Break") | 400 | << i18n("Break") |
401 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") | 401 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") |
402 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") | 402 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") |
403 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") | 403 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") |
404 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") | 404 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") |
405 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") | 405 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") |
406 | << i18n("Vacation") ; | 406 | << i18n("Vacation") ; |
407 | retval.sort(); | 407 | retval.sort(); |
408 | //qDebug("cat %s ", retval.join("-").latin1()); | 408 | //qDebug("cat %s ", retval.join("-").latin1()); |
409 | return retval; | 409 | return retval; |
410 | } | 410 | } |
411 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") | 411 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") |
412 | void KOPrefs::usrReadConfig() | 412 | void KOPrefs::usrReadConfig() |
413 | { | 413 | { |
414 | config()->setGroup("General"); | 414 | config()->setGroup("General"); |
415 | 415 | ||
416 | //qDebug("KOPrefs::usrReadConfig() "); | 416 | //qDebug("KOPrefs::usrReadConfig() "); |
417 | mCustomCategories = config()->readListEntry("Custom Categories"); | 417 | mCustomCategories = config()->readListEntry("Custom Categories"); |
418 | mOldLoadedLanguage = mOldLanguage ; | 418 | mOldLoadedLanguage = mOldLanguage ; |
419 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 419 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
420 | if (mLocationDefaults.isEmpty()) { | 420 | if (mLocationDefaults.isEmpty()) { |
421 | mLocationDefaults = getLocationDefaultList(); | 421 | mLocationDefaults = getLocationDefaultList(); |
422 | } | 422 | } |
423 | 423 | ||
424 | if (mEventSummaryUser.isEmpty()) { | 424 | if (mEventSummaryUser.isEmpty()) { |
425 | mEventSummaryUser = getDefaultList() ; | 425 | mEventSummaryUser = getDefaultList() ; |
426 | } | 426 | } |
427 | if (mTodoSummaryUser.isEmpty()) { | 427 | if (mTodoSummaryUser.isEmpty()) { |
428 | mTodoSummaryUser = getDefaultList() ; | 428 | mTodoSummaryUser = getDefaultList() ; |
429 | } | 429 | } |
430 | 430 | ||
431 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 431 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
432 | 432 | ||
433 | config()->setGroup("Personal Settings"); | 433 | config()->setGroup("Personal Settings"); |
434 | mName = config()->readEntry("user_name",""); | 434 | mName = config()->readEntry("user_name",""); |
435 | mEmail = config()->readEntry("user_email",""); | 435 | mEmail = config()->readEntry("user_email",""); |
436 | fillMailDefaults(); | 436 | fillMailDefaults(); |
437 | 437 | ||
438 | config()->setGroup("Category Colors"); | 438 | config()->setGroup("Category Colors"); |
439 | QStringList::Iterator it; | 439 | QStringList::Iterator it; |
440 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 440 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
441 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 441 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
442 | 442 | ||
443 | } | 443 | } |
444 | KConfig fc (locateLocal("config","kopicalendarrc")); | 444 | KConfig fc (locateLocal("config","kopicalendarrc")); |
445 | fc.setGroup("CC"); | 445 | fc.setGroup("CC"); |
446 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 446 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
447 | mNextAvailableCalendar = 1; | 447 | mNextAvailableCalendar = 1; |
448 | if ( numCals == 0 ) { | 448 | if ( numCals == 0 ) { |
449 | KopiCalendarFile *kkf = getNewCalendar(); | 449 | KopiCalendarFile *kkf = getNewCalendar(); |
450 | kkf->isStandard = true; | 450 | kkf->isStandard = true; |
451 | kkf->mName = i18n("Standard"); | 451 | kkf->mName = i18n("Standard"); |
452 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 452 | kkf->mFileName = QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); |
453 | } | 453 | } |
454 | while ( mNextAvailableCalendar <= numCals ) { | 454 | while ( mNextAvailableCalendar <= numCals ) { |
455 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); | 455 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); |
456 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); | 456 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); |
457 | KopiCalendarFile *kkf = getNewCalendar(); | 457 | KopiCalendarFile *kkf = getNewCalendar(); |
458 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 458 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
459 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 459 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
460 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); | 460 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); |
461 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); | 461 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); |
462 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); | 462 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); |
463 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); | 463 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); |
464 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); | 464 | kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) ); |
465 | kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName); | 465 | kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) ); |
466 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); | 466 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); |
467 | if ( kkf->mCalNumber == 1 ) { | 467 | if ( kkf->mCalNumber == 1 ) { |
468 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 468 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
469 | } | 469 | } |
470 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); | 470 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); |
471 | if ( kkf->mName == i18n("Birthdays") ) { | 471 | if ( kkf->mName == i18n("Birthdays") ) { |
472 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); | 472 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); |
473 | } | 473 | } |
474 | if ( kkf->isRelative ) | 474 | if ( kkf->isRelative ) |
475 | kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName; | 475 | kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); |
476 | } | 476 | } |
477 | 477 | ||
478 | KPimPrefs::usrReadConfig(); | 478 | KPimPrefs::usrReadConfig(); |
479 | } | 479 | } |
480 | 480 | ||
481 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 481 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
482 | { | 482 | { |
483 | return mDefCalColors[num-1]; | 483 | return mDefCalColors[num-1]; |
484 | } | 484 | } |
485 | 485 | ||
486 | KopiCalendarFile * KOPrefs::getNewCalendar() | 486 | KopiCalendarFile * KOPrefs::getNewCalendar() |
487 | { | 487 | { |
488 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 488 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
489 | kkf->mCalNumber = mNextAvailableCalendar; | 489 | kkf->mCalNumber = mNextAvailableCalendar; |
490 | mDefCalColors.resize( mNextAvailableCalendar ); | 490 | mDefCalColors.resize( mNextAvailableCalendar ); |
491 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 491 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
492 | ++mNextAvailableCalendar; | 492 | ++mNextAvailableCalendar; |
493 | kkf->mDefaultColor = mEventColor; | 493 | kkf->mDefaultColor = mEventColor; |
494 | kkf->mName = i18n("New Calendar"); | 494 | kkf->mName = i18n("New Calendar"); |
495 | mCalendars.append( kkf ); | 495 | mCalendars.append( kkf ); |
496 | return kkf; | 496 | return kkf; |
497 | } | 497 | } |
498 | void KOPrefs::deleteCalendar( int num ) | 498 | void KOPrefs::deleteCalendar( int num ) |
499 | { | 499 | { |
500 | KopiCalendarFile * kkf = mCalendars.first(); | 500 | KopiCalendarFile * kkf = mCalendars.first(); |
501 | while ( kkf ) { | 501 | while ( kkf ) { |
502 | if ( kkf->mCalNumber == num ) { | 502 | if ( kkf->mCalNumber == num ) { |
503 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 503 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
504 | mCalendars.remove( kkf ); | 504 | mCalendars.remove( kkf ); |
505 | delete kkf; | 505 | delete kkf; |
506 | return; | 506 | return; |
507 | } | 507 | } |
508 | kkf = mCalendars.next(); | 508 | kkf = mCalendars.next(); |
509 | } | 509 | } |
510 | } | 510 | } |
511 | int KOPrefs::getCalendarID( const QString & name ) | 511 | int KOPrefs::getCalendarID( const QString & name ) |
512 | { | 512 | { |
513 | KopiCalendarFile * kkf = mCalendars.first(); | 513 | KopiCalendarFile * kkf = mCalendars.first(); |
514 | while ( kkf ) { | 514 | while ( kkf ) { |
515 | if ( name == kkf->mName) | 515 | if ( name == kkf->mName) |
516 | return kkf->mCalNumber; | 516 | return kkf->mCalNumber; |
517 | kkf = mCalendars.next(); | 517 | kkf = mCalendars.next(); |
518 | } | 518 | } |
519 | return 1; | 519 | return 1; |
520 | } | 520 | } |
521 | QString KOPrefs::calName( int calNum) const | 521 | QString KOPrefs::calName( int calNum) const |
522 | { | 522 | { |
523 | return (mDefCalColors[calNum-1])->mName; | 523 | return (mDefCalColors[calNum-1])->mName; |
524 | } | 524 | } |
525 | QColor KOPrefs::defaultColor( int calNum ) const | 525 | QColor KOPrefs::defaultColor( int calNum ) const |
526 | { | 526 | { |
527 | if ( calNum == 1 ) return mEventColor; | 527 | if ( calNum == 1 ) return mEventColor; |
528 | return (mDefCalColors[calNum-1])->mDefaultColor; | 528 | return (mDefCalColors[calNum-1])->mDefaultColor; |
529 | } | 529 | } |
530 | void KOPrefs::usrWriteConfig() | 530 | void KOPrefs::usrWriteConfig() |
531 | { | 531 | { |
532 | config()->setGroup("General"); | 532 | config()->setGroup("General"); |
533 | config()->writeEntry("Custom Categories",mCustomCategories); | 533 | config()->writeEntry("Custom Categories",mCustomCategories); |
534 | 534 | ||
535 | config()->setGroup("Personal Settings"); | 535 | config()->setGroup("Personal Settings"); |
536 | config()->writeEntry("user_name",mName); | 536 | config()->writeEntry("user_name",mName); |
537 | config()->writeEntry("user_email",mEmail); | 537 | config()->writeEntry("user_email",mEmail); |
538 | 538 | ||
539 | config()->setGroup("Category Colors"); | 539 | config()->setGroup("Category Colors"); |
540 | QDictIterator<QColor> it(mCategoryColors); | 540 | QDictIterator<QColor> it(mCategoryColors); |
541 | while (it.current()) { | 541 | while (it.current()) { |
542 | config()->writeEntry(it.currentKey(),*(it.current())); | 542 | config()->writeEntry(it.currentKey(),*(it.current())); |
543 | ++it; | 543 | ++it; |
544 | } | 544 | } |
545 | KConfig fc (locateLocal("config","kopicalendarrc")); | 545 | KConfig fc (locateLocal("config","kopicalendarrc")); |
546 | fc.setGroup("CC"); | 546 | fc.setGroup("CC"); |
547 | fc.deleteGroup( "CC"); | 547 | fc.deleteGroup( "CC"); |
548 | fc.setGroup("CC"); | 548 | fc.setGroup("CC"); |
549 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 549 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
550 | int numCal = 1; | 550 | int numCal = 1; |
551 | int writeCal = 0; | 551 | int writeCal = 0; |
552 | while ( numCal < mNextAvailableCalendar ) { | 552 | while ( numCal < mNextAvailableCalendar ) { |
553 | KopiCalendarFile * kkf = mCalendars.first(); | 553 | KopiCalendarFile * kkf = mCalendars.first(); |
554 | while ( kkf ) { | 554 | while ( kkf ) { |
555 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 555 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |
556 | if ( kkf->mCalNumber == numCal ) { | 556 | if ( kkf->mCalNumber == numCal ) { |
557 | ++writeCal; | 557 | ++writeCal; |
558 | //qDebug("Write calendar %d %d ", numCal , writeCal); | 558 | //qDebug("Write calendar %d %d ", numCal , writeCal); |
559 | QString prefix = "Cal_" + QString::number( writeCal ); | 559 | QString prefix = "Cal_" + QString::number( writeCal ); |
560 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); | 560 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); |
561 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); | 561 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); |
562 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); | 562 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); |
563 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); | 563 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); |
564 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); | 564 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); |
565 | fc.writeEntry( prefix+"_Name", kkf->mName); | 565 | fc.writeEntry( prefix+"_Name", kkf->mName); |
566 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); | 566 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); |
567 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); | 567 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); |
568 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); | 568 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); |
569 | } | 569 | } |
570 | kkf = mCalendars.next(); | 570 | kkf = mCalendars.next(); |
571 | } | 571 | } |
572 | ++numCal; | 572 | ++numCal; |
573 | } | 573 | } |
574 | fc.sync(); | 574 | fc.sync(); |
575 | KPimPrefs::usrWriteConfig(); | 575 | KPimPrefs::usrWriteConfig(); |
576 | } | 576 | } |
577 | 577 | ||
578 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 578 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
579 | { | 579 | { |
580 | mCategoryColors.replace(cat,new QColor(color)); | 580 | mCategoryColors.replace(cat,new QColor(color)); |
581 | } | 581 | } |
582 | 582 | ||
583 | QColor *KOPrefs::categoryColor(QString cat) | 583 | QColor *KOPrefs::categoryColor(QString cat) |
584 | { | 584 | { |
585 | QColor *color = 0; | 585 | QColor *color = 0; |
586 | 586 | ||
587 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 587 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
588 | 588 | ||
589 | if (color) return color; | 589 | if (color) return color; |
590 | else return &mDefaultCategoryColor; | 590 | else return &mDefaultCategoryColor; |
591 | } | 591 | } |
592 | 592 | ||
593 | void KOPrefs::setFullName(const QString &name) | 593 | void KOPrefs::setFullName(const QString &name) |
594 | { | 594 | { |
595 | mName = name; | 595 | mName = name; |
596 | } | 596 | } |
597 | 597 | ||
598 | void KOPrefs::setEmail(const QString &email) | 598 | void KOPrefs::setEmail(const QString &email) |
599 | { | 599 | { |
600 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 600 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
601 | mEmail = email; | 601 | mEmail = email; |
602 | } | 602 | } |
603 | 603 | ||
604 | QString KOPrefs::fullName() | 604 | QString KOPrefs::fullName() |
605 | { | 605 | { |
606 | if (mEmailControlCenter) { | 606 | if (mEmailControlCenter) { |
607 | KEMailSettings settings; | 607 | KEMailSettings settings; |
608 | return settings.getSetting(KEMailSettings::RealName); | 608 | return settings.getSetting(KEMailSettings::RealName); |
609 | } else { | 609 | } else { |
610 | return mName; | 610 | return mName; |
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
614 | QString KOPrefs::email() | 614 | QString KOPrefs::email() |
615 | { | 615 | { |
616 | if (mEmailControlCenter) { | 616 | if (mEmailControlCenter) { |
617 | KEMailSettings settings; | 617 | KEMailSettings settings; |
618 | return settings.getSetting(KEMailSettings::EmailAddress); | 618 | return settings.getSetting(KEMailSettings::EmailAddress); |
619 | } else { | 619 | } else { |
620 | return mEmail; | 620 | return mEmail; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | KConfig* KOPrefs::getConfig() | 623 | KConfig* KOPrefs::getConfig() |
624 | { | 624 | { |
625 | return config(); | 625 | return config(); |
626 | } | 626 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9c55e9f..9ae393d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1503,390 +1503,390 @@ void MainWindow::exportToPhone( int mode ) | |||
1503 | 1503 | ||
1504 | setCaption( i18n("Writing to phone...")); | 1504 | setCaption( i18n("Writing to phone...")); |
1505 | if ( PhoneFormat::writeToPhone( cal ) ) | 1505 | if ( PhoneFormat::writeToPhone( cal ) ) |
1506 | setCaption( i18n("Export to phone successful!")); | 1506 | setCaption( i18n("Export to phone successful!")); |
1507 | else | 1507 | else |
1508 | setCaption( i18n("Error exporting to phone!")); | 1508 | setCaption( i18n("Error exporting to phone!")); |
1509 | delete cal; | 1509 | delete cal; |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | 1512 | ||
1513 | void MainWindow::setDefaultPreferences() | 1513 | void MainWindow::setDefaultPreferences() |
1514 | { | 1514 | { |
1515 | KOPrefs *p = KOPrefs::instance(); | 1515 | KOPrefs *p = KOPrefs::instance(); |
1516 | 1516 | ||
1517 | p->mCompactDialogs = true; | 1517 | p->mCompactDialogs = true; |
1518 | p->mConfirm = true; | 1518 | p->mConfirm = true; |
1519 | // p->mEnableQuickTodo = false; | 1519 | // p->mEnableQuickTodo = false; |
1520 | 1520 | ||
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | QString MainWindow::resourcePath() | 1523 | QString MainWindow::resourcePath() |
1524 | { | 1524 | { |
1525 | return KGlobal::iconLoader()->iconPath(); | 1525 | return KGlobal::iconLoader()->iconPath(); |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | void MainWindow::displayText( QString text ,QString cap ) | 1528 | void MainWindow::displayText( QString text ,QString cap ) |
1529 | { | 1529 | { |
1530 | QDialog dia( this, "name", true ); ; | 1530 | QDialog dia( this, "name", true ); ; |
1531 | dia.setCaption( cap ); | 1531 | dia.setCaption( cap ); |
1532 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1532 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1533 | lay->setSpacing( 3 ); | 1533 | lay->setSpacing( 3 ); |
1534 | lay->setMargin( 3 ); | 1534 | lay->setMargin( 3 ); |
1535 | QTextBrowser tb ( &dia ); | 1535 | QTextBrowser tb ( &dia ); |
1536 | lay->addWidget( &tb ); | 1536 | lay->addWidget( &tb ); |
1537 | tb.setText( text ); | 1537 | tb.setText( text ); |
1538 | #ifdef DESKTOP_VERSION | 1538 | #ifdef DESKTOP_VERSION |
1539 | dia.resize( 640, 480); | 1539 | dia.resize( 640, 480); |
1540 | #else | 1540 | #else |
1541 | dia.showMaximized(); | 1541 | dia.showMaximized(); |
1542 | #endif | 1542 | #endif |
1543 | dia.exec(); | 1543 | dia.exec(); |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | void MainWindow::features() | 1546 | void MainWindow::features() |
1547 | { | 1547 | { |
1548 | 1548 | ||
1549 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1549 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | void MainWindow::usertrans() | 1552 | void MainWindow::usertrans() |
1553 | { | 1553 | { |
1554 | 1554 | ||
1555 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1555 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | void MainWindow::storagehowto() | 1558 | void MainWindow::storagehowto() |
1559 | { | 1559 | { |
1560 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1560 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1561 | } | 1561 | } |
1562 | void MainWindow::timetrackinghowto() | 1562 | void MainWindow::timetrackinghowto() |
1563 | { | 1563 | { |
1564 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1564 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1565 | } | 1565 | } |
1566 | void MainWindow::kdesynchowto() | 1566 | void MainWindow::kdesynchowto() |
1567 | { | 1567 | { |
1568 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1568 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1569 | } | 1569 | } |
1570 | void MainWindow::multisynchowto() | 1570 | void MainWindow::multisynchowto() |
1571 | { | 1571 | { |
1572 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1572 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1573 | } | 1573 | } |
1574 | void MainWindow::synchowto() | 1574 | void MainWindow::synchowto() |
1575 | { | 1575 | { |
1576 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1576 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1577 | } | 1577 | } |
1578 | void MainWindow::faq() | 1578 | void MainWindow::faq() |
1579 | { | 1579 | { |
1580 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1580 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1581 | 1581 | ||
1582 | } | 1582 | } |
1583 | void MainWindow::whatsNew() | 1583 | void MainWindow::whatsNew() |
1584 | { | 1584 | { |
1585 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1585 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1586 | 1586 | ||
1587 | } | 1587 | } |
1588 | void MainWindow::licence() | 1588 | void MainWindow::licence() |
1589 | { | 1589 | { |
1590 | KApplication::showLicence(); | 1590 | KApplication::showLicence(); |
1591 | 1591 | ||
1592 | } | 1592 | } |
1593 | void MainWindow::about() | 1593 | void MainWindow::about() |
1594 | { | 1594 | { |
1595 | QString version; | 1595 | QString version; |
1596 | #include <../version> | 1596 | #include <../version> |
1597 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1597 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1598 | i18n("KOrganizer/Platform-independent\n") + | 1598 | i18n("KOrganizer/Platform-independent\n") + |
1599 | "(KO/Pi) " + version + " - " + | 1599 | "(KO/Pi) " + version + " - " + |
1600 | 1600 | ||
1601 | #ifdef DESKTOP_VERSION | 1601 | #ifdef DESKTOP_VERSION |
1602 | i18n("Desktop Edition\n") + | 1602 | i18n("Desktop Edition\n") + |
1603 | #else | 1603 | #else |
1604 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1604 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1605 | #endif | 1605 | #endif |
1606 | 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!") ); | 1606 | 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!") ); |
1607 | } | 1607 | } |
1608 | void MainWindow::keyBindings() | 1608 | void MainWindow::keyBindings() |
1609 | { | 1609 | { |
1610 | QString cap = i18n("KO/Pi Keys + Colors"); | 1610 | QString cap = i18n("KO/Pi Keys + Colors"); |
1611 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1611 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1612 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1612 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1613 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1613 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1614 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1614 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1615 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1615 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1616 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1616 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1617 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1617 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1618 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1618 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1619 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1619 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1620 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1620 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1621 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1621 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1622 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1622 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1623 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1623 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1624 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1624 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1625 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1625 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1626 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1626 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1627 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1627 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1628 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1628 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1629 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1629 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1630 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1630 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1631 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1631 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1632 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1632 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1633 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1633 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1634 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1634 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1635 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1635 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1636 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1636 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1637 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1637 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1638 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1638 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1639 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1639 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1640 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1640 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1641 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1641 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1642 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1642 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1643 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1643 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1644 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1644 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1645 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1645 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1646 | i18n("<p><h3>In list view:</h3></p>\n") + | 1646 | i18n("<p><h3>In list view:</h3></p>\n") + |
1647 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1647 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1648 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1648 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1649 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1649 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1650 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1650 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1651 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1651 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1652 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1652 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1653 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1653 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1654 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1654 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1655 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1655 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1656 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1656 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1657 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1657 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1658 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1658 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1659 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1659 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1660 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1660 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1661 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1661 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1662 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1662 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1663 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1663 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1664 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1664 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1665 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1665 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1666 | displayText( text, cap); | 1666 | displayText( text, cap); |
1667 | } | 1667 | } |
1668 | void MainWindow::aboutAutoSaving() | 1668 | void MainWindow::aboutAutoSaving() |
1669 | { | 1669 | { |
1670 | 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"); | 1670 | 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"); |
1671 | 1671 | ||
1672 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1672 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1673 | 1673 | ||
1674 | } | 1674 | } |
1675 | void MainWindow::aboutKnownBugs() | 1675 | void MainWindow::aboutKnownBugs() |
1676 | { | 1676 | { |
1677 | QMessageBox* msg; | 1677 | QMessageBox* msg; |
1678 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1678 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1679 | 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")+ | 1679 | 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")+ |
1680 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1680 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1681 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1681 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1682 | i18n("\nor report them in the bugtracker on\n") + | 1682 | i18n("\nor report them in the bugtracker on\n") + |
1683 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1683 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1684 | QMessageBox::NoIcon, | 1684 | QMessageBox::NoIcon, |
1685 | QMessageBox::Ok, | 1685 | QMessageBox::Ok, |
1686 | QMessageBox::NoButton, | 1686 | QMessageBox::NoButton, |
1687 | QMessageBox::NoButton); | 1687 | QMessageBox::NoButton); |
1688 | msg->exec(); | 1688 | msg->exec(); |
1689 | delete msg; | 1689 | delete msg; |
1690 | 1690 | ||
1691 | } | 1691 | } |
1692 | 1692 | ||
1693 | QString MainWindow::defaultFileName() | 1693 | QString MainWindow::defaultFileName() |
1694 | { | 1694 | { |
1695 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1695 | return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); |
1696 | } | 1696 | } |
1697 | QString MainWindow::syncFileName() | 1697 | QString MainWindow::syncFileName() |
1698 | { | 1698 | { |
1699 | #ifdef DESKTOP_VERSION | 1699 | #ifdef DESKTOP_VERSION |
1700 | return locateLocal( "tmp", "synccalendar.ics" ); | 1700 | return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); |
1701 | #else | 1701 | #else |
1702 | return QString( "/tmp/synccalendar.ics" ); | 1702 | return QString( "/tmp/synccalendar.ics" ); |
1703 | #endif | 1703 | #endif |
1704 | } | 1704 | } |
1705 | #include "koglobals.h" | 1705 | #include "koglobals.h" |
1706 | #include <kcalendarsystem.h> | 1706 | #include <kcalendarsystem.h> |
1707 | void MainWindow::updateWeek(QDate seda) | 1707 | void MainWindow::updateWeek(QDate seda) |
1708 | { | 1708 | { |
1709 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1709 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1710 | mWeekPixmap.fill( mWeekBgColor ); | 1710 | mWeekPixmap.fill( mWeekBgColor ); |
1711 | QPainter p ( &mWeekPixmap ); | 1711 | QPainter p ( &mWeekPixmap ); |
1712 | p.setFont( mWeekFont ); | 1712 | p.setFont( mWeekFont ); |
1713 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1713 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1714 | p.end(); | 1714 | p.end(); |
1715 | QIconSet icon3 ( mWeekPixmap ); | 1715 | QIconSet icon3 ( mWeekPixmap ); |
1716 | mWeekAction->setIconSet ( icon3 ); | 1716 | mWeekAction->setIconSet ( icon3 ); |
1717 | 1717 | ||
1718 | } | 1718 | } |
1719 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1719 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1720 | { | 1720 | { |
1721 | updateWeek( selectedDates.first() ); | 1721 | updateWeek( selectedDates.first() ); |
1722 | } | 1722 | } |
1723 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1723 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1724 | { | 1724 | { |
1725 | if ( !incidence ) { | 1725 | if ( !incidence ) { |
1726 | mShowAction->setMenuText( i18n("Show") ); | 1726 | mShowAction->setMenuText( i18n("Show") ); |
1727 | enableIncidenceActions( false ); | 1727 | enableIncidenceActions( false ); |
1728 | mNewSubTodoAction->setEnabled( false ); | 1728 | mNewSubTodoAction->setEnabled( false ); |
1729 | setCaptionToDates(); | 1729 | setCaptionToDates(); |
1730 | return; | 1730 | return; |
1731 | } | 1731 | } |
1732 | QString startString = ""; | 1732 | QString startString = ""; |
1733 | if ( incidence->typeID() != todoID ) { | 1733 | if ( incidence->typeID() != todoID ) { |
1734 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1734 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1735 | if ( incidence->doesFloat() ) { | 1735 | if ( incidence->doesFloat() ) { |
1736 | startString += ": "+incidence->dtStartDateStr( true ); | 1736 | startString += ": "+incidence->dtStartDateStr( true ); |
1737 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1737 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1738 | } else { | 1738 | } else { |
1739 | startString = ": "+incidence->dtStartStr(true); | 1739 | startString = ": "+incidence->dtStartStr(true); |
1740 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1740 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1741 | } | 1741 | } |
1742 | } else { | 1742 | } else { |
1743 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1743 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1744 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1744 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1745 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1745 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1746 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1746 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1747 | bool ok; | 1747 | bool ok; |
1748 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1748 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1749 | if ( ok ) { | 1749 | if ( ok ) { |
1750 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1750 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1751 | startString += i18n(" (%1 y.)"). arg( years ); | 1751 | startString += i18n(" (%1 y.)"). arg( years ); |
1752 | } | 1752 | } |
1753 | } | 1753 | } |
1754 | else | 1754 | else |
1755 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1755 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1756 | } | 1756 | } |
1757 | } | 1757 | } |
1758 | else { | 1758 | else { |
1759 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1759 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1760 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1760 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1761 | else | 1761 | else |
1762 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1762 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1763 | } | 1763 | } |
1764 | if ( !incidence->location().isEmpty() ) | 1764 | if ( !incidence->location().isEmpty() ) |
1765 | startString += " (" +incidence->location()+")"; | 1765 | startString += " (" +incidence->location()+")"; |
1766 | setCaption( incidence->summary()+startString); | 1766 | setCaption( incidence->summary()+startString); |
1767 | enableIncidenceActions( true ); | 1767 | enableIncidenceActions( true ); |
1768 | if ( incidence->typeID() == eventID ) { | 1768 | if ( incidence->typeID() == eventID ) { |
1769 | mShowAction->setMenuText( i18n("Show Event") ); | 1769 | mShowAction->setMenuText( i18n("Show Event") ); |
1770 | mNewSubTodoAction->setEnabled( false ); | 1770 | mNewSubTodoAction->setEnabled( false ); |
1771 | } else if ( incidence->typeID() == todoID ) { | 1771 | } else if ( incidence->typeID() == todoID ) { |
1772 | mShowAction->setMenuText( i18n("Show Todo") ); | 1772 | mShowAction->setMenuText( i18n("Show Todo") ); |
1773 | mNewSubTodoAction->setEnabled( true ); | 1773 | mNewSubTodoAction->setEnabled( true ); |
1774 | } else { | 1774 | } else { |
1775 | mShowAction->setMenuText( i18n("Show") ); | 1775 | mShowAction->setMenuText( i18n("Show") ); |
1776 | mNewSubTodoAction->setEnabled( false ); | 1776 | mNewSubTodoAction->setEnabled( false ); |
1777 | } | 1777 | } |
1778 | #ifdef DESKTOP_VERSION | 1778 | #ifdef DESKTOP_VERSION |
1779 | static QPixmap jP = SmallIcon( "journal" ); | 1779 | static QPixmap jP = SmallIcon( "journal" ); |
1780 | static QPixmap eP = SmallIcon( "newevent" ); | 1780 | static QPixmap eP = SmallIcon( "newevent" ); |
1781 | static QPixmap tP = SmallIcon( "newtodo" ); | 1781 | static QPixmap tP = SmallIcon( "newtodo" ); |
1782 | QIconSet icon; | 1782 | QIconSet icon; |
1783 | if ( incidence->typeID() == todoID ) | 1783 | if ( incidence->typeID() == todoID ) |
1784 | icon = QIconSet ( tP ); | 1784 | icon = QIconSet ( tP ); |
1785 | else if ( incidence->typeID() == eventID ) | 1785 | else if ( incidence->typeID() == eventID ) |
1786 | icon = QIconSet ( eP ); | 1786 | icon = QIconSet ( eP ); |
1787 | else if ( incidence->typeID() == journalID ) | 1787 | else if ( incidence->typeID() == journalID ) |
1788 | icon = QIconSet ( jP ); | 1788 | icon = QIconSet ( jP ); |
1789 | mPrintSelAction->setIconSet ( icon ); | 1789 | mPrintSelAction->setIconSet ( icon ); |
1790 | #endif | 1790 | #endif |
1791 | } | 1791 | } |
1792 | 1792 | ||
1793 | void MainWindow::enableIncidenceActions( bool enabled ) | 1793 | void MainWindow::enableIncidenceActions( bool enabled ) |
1794 | { | 1794 | { |
1795 | mShowAction->setEnabled( enabled ); | 1795 | mShowAction->setEnabled( enabled ); |
1796 | mEditAction->setEnabled( enabled ); | 1796 | mEditAction->setEnabled( enabled ); |
1797 | mDeleteAction->setEnabled( enabled ); | 1797 | mDeleteAction->setEnabled( enabled ); |
1798 | 1798 | ||
1799 | mCloneAction->setEnabled( enabled ); | 1799 | mCloneAction->setEnabled( enabled ); |
1800 | mMoveAction->setEnabled( enabled ); | 1800 | mMoveAction->setEnabled( enabled ); |
1801 | #ifndef DESKTOP_VERSION | 1801 | #ifndef DESKTOP_VERSION |
1802 | mBeamAction->setEnabled( enabled ); | 1802 | mBeamAction->setEnabled( enabled ); |
1803 | #else | 1803 | #else |
1804 | mPrintSelAction->setEnabled( enabled ); | 1804 | mPrintSelAction->setEnabled( enabled ); |
1805 | #endif | 1805 | #endif |
1806 | mCancelAction->setEnabled( enabled ); | 1806 | mCancelAction->setEnabled( enabled ); |
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | void MainWindow::importOL() | 1809 | void MainWindow::importOL() |
1810 | { | 1810 | { |
1811 | #ifdef _OL_IMPORT_ | 1811 | #ifdef _OL_IMPORT_ |
1812 | mView->clearAllViews(); | 1812 | mView->clearAllViews(); |
1813 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1813 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1814 | id->exec(); | 1814 | id->exec(); |
1815 | delete id; | 1815 | delete id; |
1816 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1816 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1817 | mView->updateView(); | 1817 | mView->updateView(); |
1818 | #endif | 1818 | #endif |
1819 | } | 1819 | } |
1820 | void MainWindow::importBday() | 1820 | void MainWindow::importBday() |
1821 | { | 1821 | { |
1822 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1822 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1823 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1823 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1824 | i18n("Import!"), i18n("Cancel"), 0, | 1824 | i18n("Import!"), i18n("Cancel"), 0, |
1825 | 0, 1 ); | 1825 | 0, 1 ); |
1826 | if ( result == 0 ) { | 1826 | if ( result == 0 ) { |
1827 | mView->importBday(); | 1827 | mView->importBday(); |
1828 | 1828 | ||
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | 1831 | ||
1832 | } | 1832 | } |
1833 | void MainWindow::importQtopia() | 1833 | void MainWindow::importQtopia() |
1834 | { | 1834 | { |
1835 | //#ifndef DESKTOP_VERSION | 1835 | //#ifndef DESKTOP_VERSION |
1836 | 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"); | 1836 | 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"); |
1837 | #ifdef DESKTOP_VERSION | 1837 | #ifdef DESKTOP_VERSION |
1838 | 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"); | 1838 | 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"); |
1839 | #endif | 1839 | #endif |
1840 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1840 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1841 | i18n("Import!"), i18n("Cancel"), 0, | 1841 | i18n("Import!"), i18n("Cancel"), 0, |
1842 | 0, 1 ); | 1842 | 0, 1 ); |
1843 | if ( result == 0 ) { | 1843 | if ( result == 0 ) { |
1844 | #ifndef DESKTOP_VERSION | 1844 | #ifndef DESKTOP_VERSION |
1845 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1845 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1846 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1846 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1847 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1847 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1848 | #else | 1848 | #else |
1849 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1849 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1850 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1850 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1851 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1851 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1852 | #endif | 1852 | #endif |
1853 | mView->importQtopia( categories, datebook, todolist ); | 1853 | mView->importQtopia( categories, datebook, todolist ); |
1854 | } | 1854 | } |
1855 | mView->calendar()->reInitAlarmSettings(); | 1855 | mView->calendar()->reInitAlarmSettings(); |
1856 | #if 0 | 1856 | #if 0 |
1857 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1857 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1858 | i18n("Not supported \non desktop!\n"), | 1858 | i18n("Not supported \non desktop!\n"), |
1859 | i18n("Ok"), i18n("Cancel"), 0, | 1859 | i18n("Ok"), i18n("Cancel"), 0, |
1860 | 0, 1 ); | 1860 | 0, 1 ); |
1861 | 1861 | ||
1862 | #endif | 1862 | #endif |
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | void MainWindow::saveOnClose() | 1865 | void MainWindow::saveOnClose() |
1866 | { | 1866 | { |
1867 | KOPrefs *p = KOPrefs::instance(); | 1867 | KOPrefs *p = KOPrefs::instance(); |
1868 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1868 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1869 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1869 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1870 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1870 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1871 | if ( filterToolBar ) { | 1871 | if ( filterToolBar ) { |
1872 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1872 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1873 | } | 1873 | } |
1874 | #ifdef DESKTOP_VERSION | 1874 | #ifdef DESKTOP_VERSION |
1875 | 1875 | ||
1876 | QPoint myP; | 1876 | QPoint myP; |
1877 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1877 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1878 | if ( p->mToolBarHor ) | 1878 | if ( p->mToolBarHor ) |
1879 | p->mToolBarUp = myP.y() > height()/2; | 1879 | p->mToolBarUp = myP.y() > height()/2; |
1880 | else | 1880 | else |
1881 | p->mToolBarUp = myP.x() > width()/2; | 1881 | p->mToolBarUp = myP.x() > width()/2; |
1882 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1882 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1883 | if ( p->mToolBarHorV ) | 1883 | if ( p->mToolBarHorV ) |
1884 | p->mToolBarUpV = myP.y() > height()/2; | 1884 | p->mToolBarUpV = myP.y() > height()/2; |
1885 | else | 1885 | else |
1886 | p->mToolBarUpV = myP.x() > width()/2 ; | 1886 | p->mToolBarUpV = myP.x() > width()/2 ; |
1887 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1887 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1888 | if ( p->mToolBarHorN ) | 1888 | if ( p->mToolBarHorN ) |
1889 | p->mToolBarUpN = myP.y() > height()/2; | 1889 | p->mToolBarUpN = myP.y() > height()/2; |
1890 | else | 1890 | else |
1891 | p->mToolBarUpN = myP.x() > width()/2 ; | 1891 | p->mToolBarUpN = myP.x() > width()/2 ; |
1892 | if ( filterToolBar ) { | 1892 | if ( filterToolBar ) { |
@@ -2376,313 +2376,313 @@ void MainWindow::configureToolBar( int item ) | |||
2376 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2376 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2377 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2377 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2378 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2378 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2379 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2379 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2380 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2380 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2381 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2381 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2382 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2382 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2383 | // initActions(); | 2383 | // initActions(); |
2384 | setCaption ( i18n("Toolbar changes needs a restart!") ); | 2384 | setCaption ( i18n("Toolbar changes needs a restart!") ); |
2385 | } | 2385 | } |
2386 | void MainWindow::setCaption ( const QString & c ) | 2386 | void MainWindow::setCaption ( const QString & c ) |
2387 | { | 2387 | { |
2388 | QString cap = c; | 2388 | QString cap = c; |
2389 | cap.replace( QRegExp("\n"), " " ); | 2389 | cap.replace( QRegExp("\n"), " " ); |
2390 | cap = cap.stripWhiteSpace(); | 2390 | cap = cap.stripWhiteSpace(); |
2391 | if ( cap.isEmpty() ) | 2391 | if ( cap.isEmpty() ) |
2392 | cap = "KO/Pi"; | 2392 | cap = "KO/Pi"; |
2393 | QWidget::setCaption( cap ); | 2393 | QWidget::setCaption( cap ); |
2394 | } | 2394 | } |
2395 | void MainWindow::setCaptionToDates() | 2395 | void MainWindow::setCaptionToDates() |
2396 | { | 2396 | { |
2397 | QString selDates; | 2397 | QString selDates; |
2398 | QDate date = mView->startDate(); | 2398 | QDate date = mView->startDate(); |
2399 | if ( ! date.isValid() ) { | 2399 | if ( ! date.isValid() ) { |
2400 | setCaption(""); | 2400 | setCaption(""); |
2401 | return; | 2401 | return; |
2402 | } | 2402 | } |
2403 | selDates = KGlobal::locale()->formatDate( date, true); | 2403 | selDates = KGlobal::locale()->formatDate( date, true); |
2404 | if (mView->startDate() < mView->endDate() ) | 2404 | if (mView->startDate() < mView->endDate() ) |
2405 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2405 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2406 | else { | 2406 | else { |
2407 | QString addString; | 2407 | QString addString; |
2408 | if ( date == QDateTime::currentDateTime().date() ) | 2408 | if ( date == QDateTime::currentDateTime().date() ) |
2409 | addString = i18n("Today"); | 2409 | addString = i18n("Today"); |
2410 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2410 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2411 | addString = i18n("Tomorrow"); | 2411 | addString = i18n("Tomorrow"); |
2412 | if ( !addString.isEmpty() ) | 2412 | if ( !addString.isEmpty() ) |
2413 | selDates = addString+", "+selDates ; | 2413 | selDates = addString+", "+selDates ; |
2414 | } | 2414 | } |
2415 | setCaption( i18n("Dates: ") + selDates ); | 2415 | setCaption( i18n("Dates: ") + selDates ); |
2416 | 2416 | ||
2417 | } | 2417 | } |
2418 | void MainWindow::showConfigureAgenda( ) | 2418 | void MainWindow::showConfigureAgenda( ) |
2419 | { | 2419 | { |
2420 | int iii; | 2420 | int iii; |
2421 | for ( iii = 1;iii<= 10 ;++iii ){ | 2421 | for ( iii = 1;iii<= 10 ;++iii ){ |
2422 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2422 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2423 | } | 2423 | } |
2424 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2424 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2425 | } | 2425 | } |
2426 | void MainWindow::configureAgenda( int item ) | 2426 | void MainWindow::configureAgenda( int item ) |
2427 | { | 2427 | { |
2428 | if ( KOPrefs::instance()->mHourSize == item ) | 2428 | if ( KOPrefs::instance()->mHourSize == item ) |
2429 | return; | 2429 | return; |
2430 | KOPrefs::instance()->mHourSize=item; | 2430 | KOPrefs::instance()->mHourSize=item; |
2431 | mView->viewManager()->agendaView()->updateConfig(); | 2431 | mView->viewManager()->agendaView()->updateConfig(); |
2432 | } | 2432 | } |
2433 | 2433 | ||
2434 | void MainWindow::saveCalendar() | 2434 | void MainWindow::saveCalendar() |
2435 | { | 2435 | { |
2436 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2436 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2437 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2437 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2438 | bupDir = KGlobalSettings::backupDataDir(); | 2438 | bupDir = KGlobalSettings::backupDataDir(); |
2439 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); | 2439 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2440 | QString bupHint; | 2440 | QString bupHint; |
2441 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) | 2441 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2442 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); | 2442 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); |
2443 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; | 2443 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; |
2444 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; | 2444 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; |
2445 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2445 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2446 | save(); | 2446 | save(); |
2447 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; | 2447 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; |
2448 | backupAllFiles(); | 2448 | backupAllFiles(); |
2449 | } | 2449 | } |
2450 | void MainWindow::loadCalendar() | 2450 | void MainWindow::loadCalendar() |
2451 | { | 2451 | { |
2452 | 2452 | ||
2453 | 2453 | ||
2454 | #if 0 | 2454 | #if 0 |
2455 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2455 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2456 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2456 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2457 | 2457 | ||
2458 | if ( fn == "" ) | 2458 | if ( fn == "" ) |
2459 | return; | 2459 | return; |
2460 | QFileInfo info; | 2460 | QFileInfo info; |
2461 | info.setFile( fn ); | 2461 | info.setFile( fn ); |
2462 | QString mess; | 2462 | QString mess; |
2463 | bool loadbup = true; | 2463 | bool loadbup = true; |
2464 | if ( info. exists() ) { | 2464 | if ( info. exists() ) { |
2465 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2465 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2466 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2466 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2467 | mess, | 2467 | mess, |
2468 | i18n("Load!"), i18n("Cancel"), 0, | 2468 | i18n("Load!"), i18n("Cancel"), 0, |
2469 | 0, 1 ); | 2469 | 0, 1 ); |
2470 | if ( result != 0 ) { | 2470 | if ( result != 0 ) { |
2471 | loadbup = false; | 2471 | loadbup = false; |
2472 | } | 2472 | } |
2473 | } else { | 2473 | } else { |
2474 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2474 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2475 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2475 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2476 | 0, 1 ); | 2476 | 0, 1 ); |
2477 | 2477 | ||
2478 | return; | 2478 | return; |
2479 | } | 2479 | } |
2480 | if ( loadbup ) { | 2480 | if ( loadbup ) { |
2481 | mView->openCalendar( fn ); | 2481 | mView->openCalendar( fn ); |
2482 | KOPrefs::instance()->mLastLoadFile = fn; | 2482 | KOPrefs::instance()->mLastLoadFile = fn; |
2483 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2483 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2484 | setCaption(mess); | 2484 | setCaption(mess); |
2485 | } | 2485 | } |
2486 | #endif | 2486 | #endif |
2487 | 2487 | ||
2488 | } | 2488 | } |
2489 | void MainWindow::quickImportIcal() | 2489 | void MainWindow::quickImportIcal() |
2490 | { | 2490 | { |
2491 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2491 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2492 | } | 2492 | } |
2493 | void MainWindow::importFile( QString fn, bool quick ) | 2493 | void MainWindow::importFile( QString fn, bool quick ) |
2494 | { | 2494 | { |
2495 | QFileInfo info; | 2495 | QFileInfo info; |
2496 | info.setFile( fn ); | 2496 | info.setFile( fn ); |
2497 | QString mess; | 2497 | QString mess; |
2498 | if ( !info. exists() ) { | 2498 | if ( !info. exists() ) { |
2499 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2499 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2500 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2500 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2501 | mess ); | 2501 | mess ); |
2502 | return; | 2502 | return; |
2503 | } | 2503 | } |
2504 | int result = 0; | 2504 | int result = 0; |
2505 | if ( !quick ) { | 2505 | if ( !quick ) { |
2506 | 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 )); | 2506 | 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 )); |
2507 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2507 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2508 | mess, | 2508 | mess, |
2509 | "Import", "Cancel", 0, | 2509 | "Import", "Cancel", 0, |
2510 | 0, 1 ); | 2510 | 0, 1 ); |
2511 | } | 2511 | } |
2512 | if ( result == 0 ) { | 2512 | if ( result == 0 ) { |
2513 | if ( mView->openCalendar( fn, true )) { | 2513 | if ( mView->openCalendar( fn, true )) { |
2514 | KOPrefs::instance()->mLastImportFile = fn; | 2514 | KOPrefs::instance()->mLastImportFile = fn; |
2515 | setCaption(i18n("Imported file successfully")); | 2515 | setCaption(i18n("Imported file successfully")); |
2516 | } else { | 2516 | } else { |
2517 | setCaption(i18n("Error importing file")); | 2517 | setCaption(i18n("Error importing file")); |
2518 | } | 2518 | } |
2519 | } | 2519 | } |
2520 | } | 2520 | } |
2521 | 2521 | ||
2522 | void MainWindow::importIcal() | 2522 | void MainWindow::importIcal() |
2523 | { | 2523 | { |
2524 | 2524 | ||
2525 | QString fn =KOPrefs::instance()->mLastImportFile; | 2525 | QString fn =KOPrefs::instance()->mLastImportFile; |
2526 | 2526 | ||
2527 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2527 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2528 | if ( fn == "" ) | 2528 | if ( fn == "" ) |
2529 | return; | 2529 | return; |
2530 | importFile( fn, true ); | 2530 | importFile( fn, true ); |
2531 | 2531 | ||
2532 | } | 2532 | } |
2533 | 2533 | ||
2534 | void MainWindow::exportVCalendar() | 2534 | void MainWindow::exportVCalendar() |
2535 | { | 2535 | { |
2536 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2536 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2537 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2537 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2538 | if ( fn == "" ) | 2538 | if ( fn == "" ) |
2539 | return; | 2539 | return; |
2540 | QFileInfo info; | 2540 | QFileInfo info; |
2541 | info.setFile( fn ); | 2541 | info.setFile( fn ); |
2542 | QString mes; | 2542 | QString mes; |
2543 | bool createbup = true; | 2543 | bool createbup = true; |
2544 | if ( info. exists() ) { | 2544 | if ( info. exists() ) { |
2545 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2545 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2546 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2546 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2547 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2547 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2548 | 0, 1 ); | 2548 | 0, 1 ); |
2549 | if ( result != 0 ) { | 2549 | if ( result != 0 ) { |
2550 | createbup = false; | 2550 | createbup = false; |
2551 | } | 2551 | } |
2552 | } | 2552 | } |
2553 | if ( createbup ) { | 2553 | if ( createbup ) { |
2554 | if ( mView->exportVCalendar( fn ) ) { | 2554 | if ( mView->exportVCalendar( fn ) ) { |
2555 | KOPrefs::instance()->mLastVcalFile = fn; | 2555 | KOPrefs::instance()->mLastVcalFile = fn; |
2556 | if ( fn.length() > 20 ) | 2556 | if ( fn.length() > 20 ) |
2557 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2557 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2558 | else | 2558 | else |
2559 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2559 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2560 | setCaption(mes); | 2560 | setCaption(mes); |
2561 | } | 2561 | } |
2562 | } | 2562 | } |
2563 | 2563 | ||
2564 | } | 2564 | } |
2565 | QString MainWindow::sentSyncFile() | 2565 | QString MainWindow::sentSyncFile() |
2566 | { | 2566 | { |
2567 | #ifdef DESKTOP_VERSION | 2567 | #ifdef DESKTOP_VERSION |
2568 | return locateLocal( "tmp", "copysynccal.ics" ); | 2568 | return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); |
2569 | #else | 2569 | #else |
2570 | return QString( "/tmp/copysynccal.ics" ); | 2570 | return QString( "/tmp/copysynccal.ics" ); |
2571 | #endif | 2571 | #endif |
2572 | } | 2572 | } |
2573 | 2573 | ||
2574 | void MainWindow::syncFileRequest() | 2574 | void MainWindow::syncFileRequest() |
2575 | { | 2575 | { |
2576 | while ( mSyncManager->blockSave() ) { | 2576 | while ( mSyncManager->blockSave() ) { |
2577 | qApp->processEvents(); | 2577 | qApp->processEvents(); |
2578 | } | 2578 | } |
2579 | mSyncManager->setBlockSave(true); | 2579 | mSyncManager->setBlockSave(true); |
2580 | 2580 | ||
2581 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2581 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2582 | mSyncManager->slotSyncMenu( 999 ); | 2582 | mSyncManager->slotSyncMenu( 999 ); |
2583 | } | 2583 | } |
2584 | 2584 | ||
2585 | setCaption(i18n("Saving Data to temp file ..." )); | 2585 | setCaption(i18n("Saving Data to temp file ..." )); |
2586 | mView->saveCalendar( sentSyncFile() ); | 2586 | mView->saveCalendar( sentSyncFile() ); |
2587 | setCaption(i18n("Data saved to temp file!" )); | 2587 | setCaption(i18n("Data saved to temp file!" )); |
2588 | mSyncManager->setBlockSave( false ); | 2588 | mSyncManager->setBlockSave( false ); |
2589 | 2589 | ||
2590 | } | 2590 | } |
2591 | void MainWindow::getFile( bool success ) | 2591 | void MainWindow::getFile( bool success ) |
2592 | { | 2592 | { |
2593 | if ( ! success ) { | 2593 | if ( ! success ) { |
2594 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2594 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2595 | return; | 2595 | return; |
2596 | } | 2596 | } |
2597 | mView->mergeFile( sentSyncFile() ); | 2597 | mView->mergeFile( sentSyncFile() ); |
2598 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2598 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2599 | mSyncManager->slotSyncMenu( 999 ); | 2599 | mSyncManager->slotSyncMenu( 999 ); |
2600 | } | 2600 | } |
2601 | setCaption( i18n("Pi-Sync successful!") ); | 2601 | setCaption( i18n("Pi-Sync successful!") ); |
2602 | } | 2602 | } |
2603 | void MainWindow::printListView() | 2603 | void MainWindow::printListView() |
2604 | { | 2604 | { |
2605 | 2605 | ||
2606 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2606 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2607 | 2607 | ||
2608 | KMessageBox::information( this, message); | 2608 | KMessageBox::information( this, message); |
2609 | } | 2609 | } |
2610 | void MainWindow::printSel( ) | 2610 | void MainWindow::printSel( ) |
2611 | { | 2611 | { |
2612 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2612 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2613 | } | 2613 | } |
2614 | 2614 | ||
2615 | void MainWindow::printCal() | 2615 | void MainWindow::printCal() |
2616 | { | 2616 | { |
2617 | mView->print();//mCp->showDialog(); | 2617 | mView->print();//mCp->showDialog(); |
2618 | } | 2618 | } |
2619 | 2619 | ||
2620 | 2620 | ||
2621 | #include "libkdepim/kdatepicker.h" | 2621 | #include "libkdepim/kdatepicker.h" |
2622 | #include <kdatetbl.h> | 2622 | #include <kdatetbl.h> |
2623 | 2623 | ||
2624 | void MainWindow::weekAction() | 2624 | void MainWindow::weekAction() |
2625 | { | 2625 | { |
2626 | int month; | 2626 | int month; |
2627 | KPopupFrame* popup = new KPopupFrame(this); | 2627 | KPopupFrame* popup = new KPopupFrame(this); |
2628 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2628 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2629 | // ----- | 2629 | // ----- |
2630 | picker->resize(picker->sizeHint()); | 2630 | picker->resize(picker->sizeHint()); |
2631 | popup->setMainWidget(picker); | 2631 | popup->setMainWidget(picker); |
2632 | picker->setFocus(); | 2632 | picker->setFocus(); |
2633 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2633 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2634 | int x = 0; | 2634 | int x = 0; |
2635 | int y = iconToolBar->height(); | 2635 | int y = iconToolBar->height(); |
2636 | int dX = 0; | 2636 | int dX = 0; |
2637 | int dY = 0; | 2637 | int dY = 0; |
2638 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2638 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2639 | if ( iconToolBar->y() > height()/2 ) { | 2639 | if ( iconToolBar->y() > height()/2 ) { |
2640 | dY = picker->sizeHint().height()+8; | 2640 | dY = picker->sizeHint().height()+8; |
2641 | y = 0; | 2641 | y = 0; |
2642 | } | 2642 | } |
2643 | } else { | 2643 | } else { |
2644 | if ( iconToolBar->x() > width()/2 ) { // right side | 2644 | if ( iconToolBar->x() > width()/2 ) { // right side |
2645 | x=0; | 2645 | x=0; |
2646 | dX= picker->sizeHint().width()+8; | 2646 | dX= picker->sizeHint().width()+8; |
2647 | y = 0; | 2647 | y = 0; |
2648 | } else { | 2648 | } else { |
2649 | x= iconToolBar->width(); | 2649 | x= iconToolBar->width(); |
2650 | y = 0; | 2650 | y = 0; |
2651 | } | 2651 | } |
2652 | } | 2652 | } |
2653 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2653 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2654 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2654 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2655 | { | 2655 | { |
2656 | month = picker->getResult(); | 2656 | month = picker->getResult(); |
2657 | emit selectWeek ( month ); | 2657 | emit selectWeek ( month ); |
2658 | //qDebug("weekSelected %d ", month); | 2658 | //qDebug("weekSelected %d ", month); |
2659 | } | 2659 | } |
2660 | delete popup; | 2660 | delete popup; |
2661 | } | 2661 | } |
2662 | 2662 | ||
2663 | void MainWindow::hideEvent ( QHideEvent * ) | 2663 | void MainWindow::hideEvent ( QHideEvent * ) |
2664 | { | 2664 | { |
2665 | QString message; | 2665 | QString message; |
2666 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2666 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2667 | if ( nextA.isValid() ) { | 2667 | if ( nextA.isValid() ) { |
2668 | QString sum = mCalendar->nextSummary(); | 2668 | QString sum = mCalendar->nextSummary(); |
2669 | 2669 | ||
2670 | 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)); | 2670 | 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)); |
2671 | setCaption( message ); | 2671 | setCaption( message ); |
2672 | } | 2672 | } |
2673 | } | 2673 | } |
2674 | 2674 | ||
2675 | void MainWindow::resizeEvent( QResizeEvent* e) | 2675 | void MainWindow::resizeEvent( QResizeEvent* e) |
2676 | { | 2676 | { |
2677 | #ifndef DESKTOP_VERSION | 2677 | #ifndef DESKTOP_VERSION |
2678 | if ( filterToolBar ) { | 2678 | if ( filterToolBar ) { |
2679 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2679 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2680 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2680 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2681 | filterToolBar->hide(); | 2681 | filterToolBar->hide(); |
2682 | else | 2682 | else |
2683 | filterToolBar->show(); | 2683 | filterToolBar->show(); |
2684 | } | 2684 | } |
2685 | } | 2685 | } |
2686 | #endif | 2686 | #endif |
2687 | QMainWindow::resizeEvent( e); | 2687 | QMainWindow::resizeEvent( e); |
2688 | } | 2688 | } |