-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 | |||
@@ -1,626 +1,626 @@ | |||
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 <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
55 | { | 55 | { |
56 | mGlobalUpdateDisabled = false; | 56 | mGlobalUpdateDisabled = false; |
57 | mCategoryColors.setAutoDelete(true); | 57 | mCategoryColors.setAutoDelete(true); |
58 | fillMailDefaults(); | 58 | fillMailDefaults(); |
59 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 59 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
60 | QColor defaultHolidayColor = QColor(255,0,0); | 60 | QColor defaultHolidayColor = QColor(255,0,0); |
61 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 61 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
62 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 62 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
63 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 63 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
64 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 64 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
65 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 65 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
66 | QColor defaultTodoRunColor = QColor(99,194,30); | 66 | QColor defaultTodoRunColor = QColor(99,194,30); |
67 | KPrefs::setCurrentGroup("General"); | 67 | KPrefs::setCurrentGroup("General"); |
68 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 68 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
69 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 69 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
70 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 70 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
71 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 71 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
72 | addItemBool("ShowIconList",&mShowIconList,true); | 72 | addItemBool("ShowIconList",&mShowIconList,true); |
73 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 73 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
74 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 74 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
75 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | 75 | addItemBool("ShowIconDay6",&mShowIconDay6,true); |
76 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 76 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
77 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 77 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
78 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 78 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
79 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 79 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
80 | addItemBool("ShowIconBack",&mShowIconBack,true); | 80 | addItemBool("ShowIconBack",&mShowIconBack,true); |
81 | addItemBool("ShowIconToday",&mShowIconToday,true); | 81 | addItemBool("ShowIconToday",&mShowIconToday,true); |
82 | addItemBool("ShowIconForward",&mShowIconForward,true); | 82 | addItemBool("ShowIconForward",&mShowIconForward,true); |
83 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 83 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
84 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 84 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
85 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); | 85 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); |
86 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 86 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
87 | addItemBool("ShowIconNext",&mShowIconNext,true); | 87 | addItemBool("ShowIconNext",&mShowIconNext,true); |
88 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 88 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
89 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 89 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
90 | addItemBool("ShowIconFilter",&mShowIconFilter,false); | 90 | addItemBool("ShowIconFilter",&mShowIconFilter,false); |
91 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); | 91 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); |
92 | 92 | ||
93 | bool addIcons = false; | 93 | bool addIcons = false; |
94 | #ifdef DESKTOP_VERSION | 94 | #ifdef DESKTOP_VERSION |
95 | addIcons = true; | 95 | addIcons = true; |
96 | #endif | 96 | #endif |
97 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); | 97 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); |
98 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); | 98 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); |
99 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); | 99 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); |
100 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); | 100 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); |
101 | 101 | ||
102 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 102 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
103 | 103 | ||
104 | addItemBool("AskForQuit",&mAskForQuit,false); | 104 | addItemBool("AskForQuit",&mAskForQuit,false); |
105 | 105 | ||
106 | #ifndef DESKTOP_VERSION | 106 | #ifndef DESKTOP_VERSION |
107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
108 | #else | 108 | #else |
109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
110 | #endif | 110 | #endif |
111 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 111 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
112 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 112 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
113 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); | 113 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); |
114 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); | 114 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); |
115 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); | 115 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); |
116 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); | 116 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); |
117 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); | 117 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); |
118 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); | 118 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); |
119 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 119 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
120 | addItemBool("WhatsNextTime2Lines",&mWhatsNextTime2Lines, false ); | 120 | addItemBool("WhatsNextTime2Lines",&mWhatsNextTime2Lines, false ); |
121 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 121 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
122 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 122 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
123 | 123 | ||
124 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 124 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
125 | addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); | 125 | addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); |
126 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 126 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
127 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 127 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
128 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 128 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
129 | addItemInt("AllDay Size",&mAllDaySize,28); | 129 | addItemInt("AllDay Size",&mAllDaySize,28); |
130 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 130 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
131 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 131 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
132 | 132 | ||
133 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 133 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
134 | addItemStringList("EventSummary User",&mEventSummaryUser); | 134 | addItemStringList("EventSummary User",&mEventSummaryUser); |
135 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 135 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
136 | addItemStringList("JournalSummary User",&mJournalSummaryUser); | 136 | addItemStringList("JournalSummary User",&mJournalSummaryUser); |
137 | 137 | ||
138 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 138 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
139 | addItemBool("Enable Project View",&mEnableProjectView,false); | 139 | addItemBool("Enable Project View",&mEnableProjectView,false); |
140 | addItemBool("Auto Save",&mAutoSave,false); | 140 | addItemBool("Auto Save",&mAutoSave,false); |
141 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 141 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
142 | addItemBool("Confirm Deletes",&mConfirm,true); | 142 | addItemBool("Confirm Deletes",&mConfirm,true); |
143 | addItemString("Archive File",&mArchiveFile); | 143 | addItemString("Archive File",&mArchiveFile); |
144 | addItemString("Html Export File",&mHtmlExportFile, | 144 | addItemString("Html Export File",&mHtmlExportFile, |
145 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 145 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
146 | addItemBool("Html With Save",&mHtmlWithSave,false); | 146 | addItemBool("Html With Save",&mHtmlWithSave,false); |
147 | 147 | ||
148 | KPrefs::setCurrentGroup("Personal Settings"); | 148 | KPrefs::setCurrentGroup("Personal Settings"); |
149 | 149 | ||
150 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 150 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
151 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 151 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
152 | addItemBool("Bcc",&mBcc,false); | 152 | addItemBool("Bcc",&mBcc,false); |
153 | 153 | ||
154 | KPrefs::setCurrentGroup("Time & Date"); | 154 | KPrefs::setCurrentGroup("Time & Date"); |
155 | 155 | ||
156 | 156 | ||
157 | addItemInt("Default Start Time",&mStartTime,10); | 157 | addItemInt("Default Start Time",&mStartTime,10); |
158 | addItemInt("Default Duration",&mDefaultDuration,2); | 158 | addItemInt("Default Duration",&mDefaultDuration,2); |
159 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 159 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
160 | KPrefs::setCurrentGroup("AlarmSettings"); | 160 | KPrefs::setCurrentGroup("AlarmSettings"); |
161 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 161 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
162 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 162 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
163 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 163 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
164 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 164 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
165 | 165 | ||
166 | 166 | ||
167 | KPrefs::setCurrentGroup("Calendar"); | 167 | KPrefs::setCurrentGroup("Calendar"); |
168 | 168 | ||
169 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 169 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
170 | 170 | ||
171 | KPrefs::setCurrentGroup("Fonts"); | 171 | KPrefs::setCurrentGroup("Fonts"); |
172 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 172 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
173 | QFont fon = KGlobalSettings::generalFont(); | 173 | QFont fon = KGlobalSettings::generalFont(); |
174 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); | 174 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); |
175 | addItemFont("MonthView Font",&mMonthViewFont,fon); | 175 | addItemFont("MonthView Font",&mMonthViewFont,fon); |
176 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); | 176 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); |
177 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); | 177 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); |
178 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); | 178 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); |
179 | addItemFont("TodoView Font",&mTodoViewFont,fon); | 179 | addItemFont("TodoView Font",&mTodoViewFont,fon); |
180 | addItemFont("ListView Font",&mListViewFont,fon); | 180 | addItemFont("ListView Font",&mListViewFont,fon); |
181 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); | 181 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); |
182 | addItemFont("EditBox Font",&mEditBoxFont,fon); | 182 | addItemFont("EditBox Font",&mEditBoxFont,fon); |
183 | addItemFont("JournalView Font",&mJornalViewFont,fon); | 183 | addItemFont("JournalView Font",&mJornalViewFont,fon); |
184 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); | 184 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); |
185 | addItemFont("EventView Font",&mEventViewFont,fon); | 185 | addItemFont("EventView Font",&mEventViewFont,fon); |
186 | 186 | ||
187 | KPrefs::setCurrentGroup("RemoteSyncing"); | 187 | KPrefs::setCurrentGroup("RemoteSyncing"); |
188 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 188 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
189 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 189 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
191 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 191 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
192 | 192 | ||
193 | #ifdef _WIN32_ | 193 | #ifdef _WIN32_ |
194 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 194 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
195 | #else | 195 | #else |
196 | QString hdp= locateLocal("data","korganizer")+"/"; | 196 | QString hdp= locateLocal("data","korganizer")+"/"; |
197 | #endif | 197 | #endif |
198 | 198 | ||
199 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 199 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
200 | 200 | ||
201 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 201 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
202 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 202 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
203 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 203 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
204 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 204 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
205 | 205 | ||
206 | 206 | ||
207 | KPrefs::setCurrentGroup("Locale"); | 207 | KPrefs::setCurrentGroup("Locale"); |
208 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 208 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
209 | 209 | ||
210 | 210 | ||
211 | KPrefs::setCurrentGroup("Colors"); | 211 | KPrefs::setCurrentGroup("Colors"); |
212 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 212 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
213 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 213 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
214 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 214 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
215 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 215 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
216 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 216 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
217 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 217 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
218 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 218 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
219 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 219 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
220 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); | 220 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); |
221 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 221 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
222 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 222 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
223 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 223 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
224 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 224 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
225 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 225 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
226 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 226 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
227 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 227 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
228 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 228 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
229 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 229 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
230 | addItemBool("UseAppColors",&mUseAppColors,false); | 230 | addItemBool("UseAppColors",&mUseAppColors,false); |
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | KPrefs::setCurrentGroup("Views"); | 234 | KPrefs::setCurrentGroup("Views"); |
235 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); | 235 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); |
236 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 236 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
237 | addItemInt("Hour Size",&mHourSize,8); | 237 | addItemInt("Hour Size",&mHourSize,8); |
238 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 238 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
239 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 239 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
240 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 240 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
241 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 241 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
242 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 242 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
243 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 243 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
244 | addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); | 244 | addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); |
245 | #ifdef DESKTOP_VERION | 245 | #ifdef DESKTOP_VERION |
246 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 246 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
247 | #else | 247 | #else |
248 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 248 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
249 | #endif | 249 | #endif |
250 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 250 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
251 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 251 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
252 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 252 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
253 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 253 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
254 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 254 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
255 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 255 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
256 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 256 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
257 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 257 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
258 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 258 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
259 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 259 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
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 | |||
@@ -159,2530 +159,2530 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
159 | if ( iii ) | 159 | if ( iii ) |
160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
161 | } | 161 | } |
162 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
163 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
164 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
165 | { | 165 | { |
166 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
167 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
168 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | mClosed = false; | 173 | mClosed = false; |
174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 175 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 176 | QFileInfo finf ( confFile ); |
177 | bool showWarning = !finf.exists(); | 177 | bool showWarning = !finf.exists(); |
178 | setIcon(SmallIcon( "ko24" ) ); | 178 | setIcon(SmallIcon( "ko24" ) ); |
179 | mBlockAtStartup = true; | 179 | mBlockAtStartup = true; |
180 | mFlagKeyPressed = false; | 180 | mFlagKeyPressed = false; |
181 | setCaption("KO/Pi"); | 181 | setCaption("KO/Pi"); |
182 | KOPrefs *p = KOPrefs::instance(); | 182 | KOPrefs *p = KOPrefs::instance(); |
183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
184 | p->mCurrentDisplayedView = 0; | 184 | p->mCurrentDisplayedView = 0; |
185 | if ( p->mHourSize > 22 ) | 185 | if ( p->mHourSize > 22 ) |
186 | p->mHourSize = 22; | 186 | p->mHourSize = 22; |
187 | QMainWindow::ToolBarDock tbd; | 187 | QMainWindow::ToolBarDock tbd; |
188 | if ( p->mToolBarHor ) { | 188 | if ( p->mToolBarHor ) { |
189 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
190 | tbd = Bottom; | 190 | tbd = Bottom; |
191 | else | 191 | else |
192 | tbd = Top; | 192 | tbd = Top; |
193 | } | 193 | } |
194 | else { | 194 | else { |
195 | if ( p->mToolBarUp ) | 195 | if ( p->mToolBarUp ) |
196 | tbd = Right; | 196 | tbd = Right; |
197 | else | 197 | else |
198 | tbd = Left; | 198 | tbd = Left; |
199 | } | 199 | } |
200 | if ( KOPrefs::instance()->mUseAppColors ) | 200 | if ( KOPrefs::instance()->mUseAppColors ) |
201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
202 | globalFlagBlockStartup = 1; | 202 | globalFlagBlockStartup = 1; |
203 | iconToolBar = new QPEToolBar( this ); | 203 | iconToolBar = new QPEToolBar( this ); |
204 | addToolBar (iconToolBar , tbd ); | 204 | addToolBar (iconToolBar , tbd ); |
205 | 205 | ||
206 | #ifdef DESKTOP_VERSION | 206 | #ifdef DESKTOP_VERSION |
207 | if ( KOPrefs::instance()->mShowIconFilter ) | 207 | if ( KOPrefs::instance()->mShowIconFilter ) |
208 | #else | 208 | #else |
209 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) | 209 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | { | 212 | { |
213 | if ( p->mToolBarHorF ) { | 213 | if ( p->mToolBarHorF ) { |
214 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
215 | tbd = Bottom; | 215 | tbd = Bottom; |
216 | else | 216 | else |
217 | tbd = Top; | 217 | tbd = Top; |
218 | } | 218 | } |
219 | else { | 219 | else { |
220 | if ( p->mToolBarUpF ) | 220 | if ( p->mToolBarUpF ) |
221 | tbd = Right; | 221 | tbd = Right; |
222 | else | 222 | else |
223 | tbd = Left; | 223 | tbd = Left; |
224 | } | 224 | } |
225 | filterToolBar = new QPEToolBar ( this ); | 225 | filterToolBar = new QPEToolBar ( this ); |
226 | filterMenubar = new KMenuBar( 0 ); | 226 | filterMenubar = new KMenuBar( 0 ); |
227 | QFontMetrics fm ( filterMenubar->font() ); | 227 | QFontMetrics fm ( filterMenubar->font() ); |
228 | #ifndef DESKTOP_VERSION | 228 | #ifndef DESKTOP_VERSION |
229 | filterToolBar->setFocusPolicy( NoFocus ); | 229 | filterToolBar->setFocusPolicy( NoFocus ); |
230 | filterMenubar->setFocusPolicy( NoFocus ); | 230 | filterMenubar->setFocusPolicy( NoFocus ); |
231 | #endif | 231 | #endif |
232 | filterPopupMenu = new QPopupMenu( this ); | 232 | filterPopupMenu = new QPopupMenu( this ); |
233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
234 | QString addTest = "A"; | 234 | QString addTest = "A"; |
235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
236 | #ifdef DESKTOP_VERSION | 236 | #ifdef DESKTOP_VERSION |
237 | addTest = "AAAAAABBBCCCx"; | 237 | addTest = "AAAAAABBBCCCx"; |
238 | #else | 238 | #else |
239 | addTest = "AAAAAx"; | 239 | addTest = "AAAAAx"; |
240 | #endif | 240 | #endif |
241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
242 | addToolBar (filterToolBar , tbd ); | 242 | addToolBar (filterToolBar , tbd ); |
243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
246 | filterToolBar->hide(); | 246 | filterToolBar->hide(); |
247 | } else { | 247 | } else { |
248 | filterToolBar = 0; | 248 | filterToolBar = 0; |
249 | filterMenubar = 0; | 249 | filterMenubar = 0; |
250 | filterPopupMenu = 0; | 250 | filterPopupMenu = 0; |
251 | } | 251 | } |
252 | if ( p->mShowIconOnetoolbar ) { | 252 | if ( p->mShowIconOnetoolbar ) { |
253 | viewToolBar = iconToolBar ; | 253 | viewToolBar = iconToolBar ; |
254 | navigatorToolBar = iconToolBar ; | 254 | navigatorToolBar = iconToolBar ; |
255 | } else { | 255 | } else { |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | setToolBarsMovable( false ); | 257 | setToolBarsMovable( false ); |
258 | #endif | 258 | #endif |
259 | if ( p->mToolBarHorV ) { | 259 | if ( p->mToolBarHorV ) { |
260 | if ( p->mToolBarUpV ) | 260 | if ( p->mToolBarUpV ) |
261 | tbd = Bottom; | 261 | tbd = Bottom; |
262 | else | 262 | else |
263 | tbd = Top; | 263 | tbd = Top; |
264 | } | 264 | } |
265 | else { | 265 | else { |
266 | if ( p->mToolBarUpV ) | 266 | if ( p->mToolBarUpV ) |
267 | tbd = Right; | 267 | tbd = Right; |
268 | else | 268 | else |
269 | tbd = Left; | 269 | tbd = Left; |
270 | } | 270 | } |
271 | viewToolBar = new QPEToolBar( this ); | 271 | viewToolBar = new QPEToolBar( this ); |
272 | addToolBar (viewToolBar , tbd ); | 272 | addToolBar (viewToolBar , tbd ); |
273 | if ( p->mToolBarHorN ) { | 273 | if ( p->mToolBarHorN ) { |
274 | if ( p->mToolBarUpN ) | 274 | if ( p->mToolBarUpN ) |
275 | tbd = Bottom; | 275 | tbd = Bottom; |
276 | else | 276 | else |
277 | tbd = Top; | 277 | tbd = Top; |
278 | } | 278 | } |
279 | else { | 279 | else { |
280 | if ( p->mToolBarUpN ) | 280 | if ( p->mToolBarUpN ) |
281 | tbd = Right; | 281 | tbd = Right; |
282 | else | 282 | else |
283 | tbd = Left; | 283 | tbd = Left; |
284 | } | 284 | } |
285 | navigatorToolBar = new QPEToolBar( this ); | 285 | navigatorToolBar = new QPEToolBar( this ); |
286 | addToolBar (navigatorToolBar , tbd ); | 286 | addToolBar (navigatorToolBar , tbd ); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | mCalendarModifiedFlag = false; | 291 | mCalendarModifiedFlag = false; |
292 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 292 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
293 | splash->setAlignment ( AlignCenter ); | 293 | splash->setAlignment ( AlignCenter ); |
294 | setCentralWidget( splash ); | 294 | setCentralWidget( splash ); |
295 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
296 | showMaximized(); | 296 | showMaximized(); |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
300 | setDefaultPreferences(); | 300 | setDefaultPreferences(); |
301 | mCalendar = new CalendarLocal(); | 301 | mCalendar = new CalendarLocal(); |
302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
303 | mView->hide(); | 303 | mView->hide(); |
304 | //mView->resize(splash->size() ); | 304 | //mView->resize(splash->size() ); |
305 | initActions(); | 305 | initActions(); |
306 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 306 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
307 | mSyncManager->setBlockSave(false); | 307 | mSyncManager->setBlockSave(false); |
308 | mView->setSyncManager(mSyncManager); | 308 | mView->setSyncManager(mSyncManager); |
309 | #ifndef DESKTOP_VERSION | 309 | #ifndef DESKTOP_VERSION |
310 | iconToolBar->show(); | 310 | iconToolBar->show(); |
311 | qApp->processEvents(); | 311 | qApp->processEvents(); |
312 | #endif | 312 | #endif |
313 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 313 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
314 | int vh = height() ; | 314 | int vh = height() ; |
315 | int vw = width(); | 315 | int vw = width(); |
316 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 316 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
317 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 317 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
318 | vh -= iconToolBar->height(); | 318 | vh -= iconToolBar->height(); |
319 | } else { | 319 | } else { |
320 | vw -= iconToolBar->height(); | 320 | vw -= iconToolBar->height(); |
321 | } | 321 | } |
322 | //mView->setMaximumSize( splash->size() ); | 322 | //mView->setMaximumSize( splash->size() ); |
323 | //mView->resize( splash->size() ); | 323 | //mView->resize( splash->size() ); |
324 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 324 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
325 | mView->readSettings(); | 325 | mView->readSettings(); |
326 | bool newFile = false; | 326 | bool newFile = false; |
327 | if( !QFile::exists( defaultFileName() ) ) { | 327 | if( !QFile::exists( defaultFileName() ) ) { |
328 | QFileInfo finfo ( defaultFileName() ); | 328 | QFileInfo finfo ( defaultFileName() ); |
329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
331 | finfo.setFile( oldFile ); | 331 | finfo.setFile( oldFile ); |
332 | if (finfo.exists() ) { | 332 | if (finfo.exists() ) { |
333 | KMessageBox::information( this, message); | 333 | KMessageBox::information( this, message); |
334 | mView->openCalendar( oldFile ); | 334 | mView->openCalendar( oldFile ); |
335 | qApp->processEvents(); | 335 | qApp->processEvents(); |
336 | } else { | 336 | } else { |
337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
338 | finfo.setFile( oldFile ); | 338 | finfo.setFile( oldFile ); |
339 | if (finfo.exists() ) { | 339 | if (finfo.exists() ) { |
340 | KMessageBox::information( this, message); | 340 | KMessageBox::information( this, message); |
341 | mView->openCalendar( oldFile ); | 341 | mView->openCalendar( oldFile ); |
342 | qApp->processEvents(); | 342 | qApp->processEvents(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | mView->saveCalendar( defaultFileName() ); | 345 | mView->saveCalendar( defaultFileName() ); |
346 | newFile = true; | 346 | newFile = true; |
347 | } | 347 | } |
348 | 348 | ||
349 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 349 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
350 | mView->loadCalendars(); | 350 | mView->loadCalendars(); |
351 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 351 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
352 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 352 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
353 | 353 | ||
354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
355 | KOPrefs::instance()->setAllDefaults(); | 355 | KOPrefs::instance()->setAllDefaults(); |
356 | } | 356 | } |
357 | processIncidenceSelection( 0 ); | 357 | processIncidenceSelection( 0 ); |
358 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 358 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
359 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 359 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
360 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 360 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
361 | SLOT( slotModifiedChanged( bool ) ) ); | 361 | SLOT( slotModifiedChanged( bool ) ) ); |
362 | 362 | ||
363 | 363 | ||
364 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 364 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
365 | SLOT( disableBR(bool) ) ); | 365 | SLOT( disableBR(bool) ) ); |
366 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 366 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
367 | mView->setModified( false ); | 367 | mView->setModified( false ); |
368 | mBlockAtStartup = false; | 368 | mBlockAtStartup = false; |
369 | mView->setModified( false ); | 369 | mView->setModified( false ); |
370 | setCentralWidget( mView ); | 370 | setCentralWidget( mView ); |
371 | globalFlagBlockStartup = 0; | 371 | globalFlagBlockStartup = 0; |
372 | mView->show(); | 372 | mView->show(); |
373 | delete splash; | 373 | delete splash; |
374 | if ( newFile ) | 374 | if ( newFile ) |
375 | mView->updateConfig(); | 375 | mView->updateConfig(); |
376 | // qApp->processEvents(); | 376 | // qApp->processEvents(); |
377 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 377 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
378 | //fillSyncMenu(); | 378 | //fillSyncMenu(); |
379 | 379 | ||
380 | 380 | ||
381 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 381 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
382 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 382 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
383 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 383 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
384 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 384 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
385 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 385 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
386 | mSyncManager->setDefaultFileName( sentSyncFile()); | 386 | mSyncManager->setDefaultFileName( sentSyncFile()); |
387 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 387 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
388 | mSyncManager->fillSyncMenu(); | 388 | mSyncManager->fillSyncMenu(); |
389 | 389 | ||
390 | 390 | ||
391 | 391 | ||
392 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 392 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
393 | if ( showWarning ) { | 393 | if ( showWarning ) { |
394 | KMessageBox::information( this, | 394 | KMessageBox::information( this, |
395 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 395 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
396 | qApp->processEvents(); | 396 | qApp->processEvents(); |
397 | mView->dialogManager()->showSyncOptions(); | 397 | mView->dialogManager()->showSyncOptions(); |
398 | } | 398 | } |
399 | 399 | ||
400 | //US listen for result adressed from Ka/Pi | 400 | //US listen for result adressed from Ka/Pi |
401 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
402 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 402 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
403 | #endif | 403 | #endif |
404 | #ifndef DESKTOP_VERSION | 404 | #ifndef DESKTOP_VERSION |
405 | infrared = 0; | 405 | infrared = 0; |
406 | #endif | 406 | #endif |
407 | updateFilterToolbar(); | 407 | updateFilterToolbar(); |
408 | updateWeek( mView->startDate() ); | 408 | updateWeek( mView->startDate() ); |
409 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 409 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
410 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 410 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
411 | mBRdisabled = false; | 411 | mBRdisabled = false; |
412 | //toggleBeamReceive(); | 412 | //toggleBeamReceive(); |
413 | 413 | ||
414 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 414 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
415 | } | 415 | } |
416 | MainWindow::~MainWindow() | 416 | MainWindow::~MainWindow() |
417 | { | 417 | { |
418 | //qDebug("MainWindow::~MainWindow() "); | 418 | //qDebug("MainWindow::~MainWindow() "); |
419 | //save toolbar location | 419 | //save toolbar location |
420 | delete mCalendar; | 420 | delete mCalendar; |
421 | delete mSyncManager; | 421 | delete mSyncManager; |
422 | #ifndef DESKTOP_VERSION | 422 | #ifndef DESKTOP_VERSION |
423 | if ( infrared ) | 423 | if ( infrared ) |
424 | delete infrared; | 424 | delete infrared; |
425 | #endif | 425 | #endif |
426 | 426 | ||
427 | 427 | ||
428 | } | 428 | } |
429 | void MainWindow::slotResetFocus() | 429 | void MainWindow::slotResetFocus() |
430 | { | 430 | { |
431 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 431 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
432 | mFocusLoop = 3; | 432 | mFocusLoop = 3; |
433 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 433 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
434 | } | 434 | } |
435 | void MainWindow::slotResetFocusLoop() | 435 | void MainWindow::slotResetFocusLoop() |
436 | { | 436 | { |
437 | --mFocusLoop; | 437 | --mFocusLoop; |
438 | QWidget* fw = mView->viewManager()->currentView(); | 438 | QWidget* fw = mView->viewManager()->currentView(); |
439 | if ( fw ) { | 439 | if ( fw ) { |
440 | //qDebug("loop "); | 440 | //qDebug("loop "); |
441 | fw->setFocus(); | 441 | fw->setFocus(); |
442 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 442 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
443 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 443 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
444 | } | 444 | } |
445 | 445 | ||
446 | } | 446 | } |
447 | void MainWindow::disableBR(bool b) | 447 | void MainWindow::disableBR(bool b) |
448 | { | 448 | { |
449 | #ifndef DESKTOP_VERSION | 449 | #ifndef DESKTOP_VERSION |
450 | if ( b ) { | 450 | if ( b ) { |
451 | if ( infrared ) { | 451 | if ( infrared ) { |
452 | toggleBeamReceive(); | 452 | toggleBeamReceive(); |
453 | mBRdisabled = true; | 453 | mBRdisabled = true; |
454 | } | 454 | } |
455 | mBRdisabled = true; | 455 | mBRdisabled = true; |
456 | } else { | 456 | } else { |
457 | if ( mBRdisabled ) { | 457 | if ( mBRdisabled ) { |
458 | mBRdisabled = false; | 458 | mBRdisabled = false; |
459 | //makes no sense,because other cal ap is probably running | 459 | //makes no sense,because other cal ap is probably running |
460 | // toggleBeamReceive(); | 460 | // toggleBeamReceive(); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | #endif | 463 | #endif |
464 | 464 | ||
465 | } | 465 | } |
466 | bool MainWindow::beamReceiveEnabled() | 466 | bool MainWindow::beamReceiveEnabled() |
467 | { | 467 | { |
468 | #ifndef DESKTOP_VERSION | 468 | #ifndef DESKTOP_VERSION |
469 | return ( infrared != 0 ); | 469 | return ( infrared != 0 ); |
470 | #endif | 470 | #endif |
471 | return false; | 471 | return false; |
472 | } | 472 | } |
473 | 473 | ||
474 | void MainWindow::toggleBeamReceive() | 474 | void MainWindow::toggleBeamReceive() |
475 | { | 475 | { |
476 | if ( mBRdisabled ) | 476 | if ( mBRdisabled ) |
477 | return; | 477 | return; |
478 | #ifndef DESKTOP_VERSION | 478 | #ifndef DESKTOP_VERSION |
479 | if ( infrared ) { | 479 | if ( infrared ) { |
480 | qDebug("KO: Disable BeamReceive "); | 480 | qDebug("KO: Disable BeamReceive "); |
481 | delete infrared; | 481 | delete infrared; |
482 | infrared = 0; | 482 | infrared = 0; |
483 | brAction->setOn(false); | 483 | brAction->setOn(false); |
484 | return; | 484 | return; |
485 | } | 485 | } |
486 | qDebug("KO: Enable BeamReceive "); | 486 | qDebug("KO: Enable BeamReceive "); |
487 | brAction->setOn(true); | 487 | brAction->setOn(true); |
488 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 488 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
489 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 489 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
490 | #endif | 490 | #endif |
491 | } | 491 | } |
492 | void MainWindow::showMaximized () | 492 | void MainWindow::showMaximized () |
493 | { | 493 | { |
494 | #ifndef DESKTOP_VERSION | 494 | #ifndef DESKTOP_VERSION |
495 | if ( ! globalFlagBlockStartup ) | 495 | if ( ! globalFlagBlockStartup ) |
496 | if ( mClosed ) | 496 | if ( mClosed ) |
497 | mView->goToday(); | 497 | mView->goToday(); |
498 | #endif | 498 | #endif |
499 | QWidget::showMaximized () ; | 499 | QWidget::showMaximized () ; |
500 | mClosed = false; | 500 | mClosed = false; |
501 | } | 501 | } |
502 | void MainWindow::closeEvent( QCloseEvent* ce ) | 502 | void MainWindow::closeEvent( QCloseEvent* ce ) |
503 | { | 503 | { |
504 | 504 | ||
505 | 505 | ||
506 | 506 | ||
507 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 507 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
508 | saveOnClose(); | 508 | saveOnClose(); |
509 | if ( mCalendarModifiedFlag ) { | 509 | if ( mCalendarModifiedFlag ) { |
510 | ce->ignore(); | 510 | ce->ignore(); |
511 | return; | 511 | return; |
512 | } | 512 | } |
513 | mClosed = true; | 513 | mClosed = true; |
514 | ce->accept(); | 514 | ce->accept(); |
515 | return; | 515 | return; |
516 | 516 | ||
517 | } | 517 | } |
518 | 518 | ||
519 | switch( QMessageBox::information( this, "KO/Pi", | 519 | switch( QMessageBox::information( this, "KO/Pi", |
520 | i18n("Do you really want\nto close KO/Pi?"), | 520 | i18n("Do you really want\nto close KO/Pi?"), |
521 | i18n("Close"), i18n("No"), | 521 | i18n("Close"), i18n("No"), |
522 | 0, 0 ) ) { | 522 | 0, 0 ) ) { |
523 | case 0: | 523 | case 0: |
524 | saveOnClose(); | 524 | saveOnClose(); |
525 | if ( mCalendarModifiedFlag ) { | 525 | if ( mCalendarModifiedFlag ) { |
526 | ce->ignore(); | 526 | ce->ignore(); |
527 | return; | 527 | return; |
528 | } | 528 | } |
529 | mClosed = true; | 529 | mClosed = true; |
530 | ce->accept(); | 530 | ce->accept(); |
531 | break; | 531 | break; |
532 | case 1: | 532 | case 1: |
533 | ce->ignore(); | 533 | ce->ignore(); |
534 | break; | 534 | break; |
535 | case 2: | 535 | case 2: |
536 | 536 | ||
537 | default: | 537 | default: |
538 | break; | 538 | break; |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | } | 542 | } |
543 | 543 | ||
544 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 544 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
545 | { | 545 | { |
546 | QDataStream stream( data, IO_ReadOnly ); | 546 | QDataStream stream( data, IO_ReadOnly ); |
547 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 547 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
548 | //QString datamess; | 548 | //QString datamess; |
549 | //qDebug("message "); | 549 | //qDebug("message "); |
550 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 550 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
551 | 551 | ||
552 | if ( cmsg == "setDocument(QString)" ) { | 552 | if ( cmsg == "setDocument(QString)" ) { |
553 | QDataStream stream( data, IO_ReadOnly ); | 553 | QDataStream stream( data, IO_ReadOnly ); |
554 | QString fileName; | 554 | QString fileName; |
555 | stream >> fileName; | 555 | stream >> fileName; |
556 | //qDebug("filename %s ", fileName.latin1()); | 556 | //qDebug("filename %s ", fileName.latin1()); |
557 | showMaximized(); | 557 | showMaximized(); |
558 | raise(); | 558 | raise(); |
559 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 559 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
560 | mSyncManager->slotSyncMenu( 1002 ); | 560 | mSyncManager->slotSyncMenu( 1002 ); |
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | 563 | ||
564 | if ( cmsg == "-writeFile" ) { | 564 | if ( cmsg == "-writeFile" ) { |
565 | // I made from the "-writeFile" an "-writeAlarm" | 565 | // I made from the "-writeFile" an "-writeAlarm" |
566 | mView->viewManager()->showWhatsNextView(); | 566 | mView->viewManager()->showWhatsNextView(); |
567 | mCalendar->checkAlarmForIncidence( 0, true); | 567 | mCalendar->checkAlarmForIncidence( 0, true); |
568 | showMaximized(); | 568 | showMaximized(); |
569 | raise(); | 569 | raise(); |
570 | return; | 570 | return; |
571 | 571 | ||
572 | } | 572 | } |
573 | if ( cmsg == "-writeFileSilent" ) { | 573 | if ( cmsg == "-writeFileSilent" ) { |
574 | // I made from the "-writeFile" an "-writeAlarm" | 574 | // I made from the "-writeFile" an "-writeAlarm" |
575 | // mView->viewManager()->showWhatsNextView(); | 575 | // mView->viewManager()->showWhatsNextView(); |
576 | mCalendar->checkAlarmForIncidence( 0, true); | 576 | mCalendar->checkAlarmForIncidence( 0, true); |
577 | //showMaximized(); | 577 | //showMaximized(); |
578 | //raise(); | 578 | //raise(); |
579 | hide(); | 579 | hide(); |
580 | return; | 580 | return; |
581 | } | 581 | } |
582 | if ( cmsg == "-newCountdown" ) { | 582 | if ( cmsg == "-newCountdown" ) { |
583 | qDebug("newCountdown "); | 583 | qDebug("newCountdown "); |
584 | 584 | ||
585 | } | 585 | } |
586 | QString msg ; | 586 | QString msg ; |
587 | QString allmsg = cmsg; | 587 | QString allmsg = cmsg; |
588 | while ( allmsg.length() > 0 ) { | 588 | while ( allmsg.length() > 0 ) { |
589 | int nextC = allmsg.find( "-", 1 ); | 589 | int nextC = allmsg.find( "-", 1 ); |
590 | if ( nextC == -1 ) { | 590 | if ( nextC == -1 ) { |
591 | msg = allmsg; | 591 | msg = allmsg; |
592 | allmsg = ""; | 592 | allmsg = ""; |
593 | } else{ | 593 | } else{ |
594 | msg = allmsg.left( nextC ); | 594 | msg = allmsg.left( nextC ); |
595 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 595 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
596 | } | 596 | } |
597 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 597 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
598 | if ( msg == "-newEvent" ) { | 598 | if ( msg == "-newEvent" ) { |
599 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 599 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
600 | } | 600 | } |
601 | if ( msg == "-newTodo" ) { | 601 | if ( msg == "-newTodo" ) { |
602 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 602 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
603 | } | 603 | } |
604 | if ( msg == "-showWN" ) { | 604 | if ( msg == "-showWN" ) { |
605 | mView->viewManager()->showWhatsNextView(); | 605 | mView->viewManager()->showWhatsNextView(); |
606 | } | 606 | } |
607 | if ( msg == "-showTodo" ) { | 607 | if ( msg == "-showTodo" ) { |
608 | mView->viewManager()->showTodoView(); | 608 | mView->viewManager()->showTodoView(); |
609 | } | 609 | } |
610 | if ( msg == "-showList" ) { | 610 | if ( msg == "-showList" ) { |
611 | mView->viewManager()->showListView(); | 611 | mView->viewManager()->showListView(); |
612 | } | 612 | } |
613 | else if ( msg == "-showDay" ) { | 613 | else if ( msg == "-showDay" ) { |
614 | mView->viewManager()->showDayView(); | 614 | mView->viewManager()->showDayView(); |
615 | } | 615 | } |
616 | else if ( msg == "-showWWeek" ) { | 616 | else if ( msg == "-showWWeek" ) { |
617 | mView->viewManager()->showWorkWeekView(); | 617 | mView->viewManager()->showWorkWeekView(); |
618 | } | 618 | } |
619 | else if ( msg == "-ringSync" ) { | 619 | else if ( msg == "-ringSync" ) { |
620 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 620 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
621 | } | 621 | } |
622 | else if ( msg == "-showWeek" ) { | 622 | else if ( msg == "-showWeek" ) { |
623 | mView->viewManager()->showWeekView(); | 623 | mView->viewManager()->showWeekView(); |
624 | } | 624 | } |
625 | else if ( msg == "-showTodo" ) { | 625 | else if ( msg == "-showTodo" ) { |
626 | mView->viewManager()->showTodoView(); | 626 | mView->viewManager()->showTodoView(); |
627 | } | 627 | } |
628 | else if ( msg == "-showJournal" ) { | 628 | else if ( msg == "-showJournal" ) { |
629 | mView->dateNavigator()->selectDates( 1 ); | 629 | mView->dateNavigator()->selectDates( 1 ); |
630 | mView->dateNavigator()->selectToday(); | 630 | mView->dateNavigator()->selectToday(); |
631 | mView->viewManager()->showJournalView(); | 631 | mView->viewManager()->showJournalView(); |
632 | } | 632 | } |
633 | else if ( msg == "-showKO" ) { | 633 | else if ( msg == "-showKO" ) { |
634 | mView->viewManager()->showNextXView(); | 634 | mView->viewManager()->showNextXView(); |
635 | } | 635 | } |
636 | else if ( msg == "-showWNext" ) { | 636 | else if ( msg == "-showWNext" ) { |
637 | mView->viewManager()->showWhatsNextView(); | 637 | mView->viewManager()->showWhatsNextView(); |
638 | } | 638 | } |
639 | else if ( msg == "nextView()" ) { | 639 | else if ( msg == "nextView()" ) { |
640 | mView->viewManager()->showNextView(); | 640 | mView->viewManager()->showNextView(); |
641 | } | 641 | } |
642 | else if ( msg == "-showNextXView" ) { | 642 | else if ( msg == "-showNextXView" ) { |
643 | mView->viewManager()->showNextXView(); | 643 | mView->viewManager()->showNextXView(); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | } | 647 | } |
648 | 648 | ||
649 | showMaximized(); | 649 | showMaximized(); |
650 | raise(); | 650 | raise(); |
651 | } | 651 | } |
652 | void MainWindow::startMultiSync() | 652 | void MainWindow::startMultiSync() |
653 | { | 653 | { |
654 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 654 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
655 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 655 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
656 | question, | 656 | question, |
657 | i18n("Yes"), i18n("No"), | 657 | i18n("Yes"), i18n("No"), |
658 | 0, 0 ) != 0 ) { | 658 | 0, 0 ) != 0 ) { |
659 | setCaption(i18n("Aborted! Nothing synced!")); | 659 | setCaption(i18n("Aborted! Nothing synced!")); |
660 | return; | 660 | return; |
661 | } | 661 | } |
662 | mSyncManager->multiSync( false ); | 662 | mSyncManager->multiSync( false ); |
663 | #ifndef DESKTOP_VERSION | 663 | #ifndef DESKTOP_VERSION |
664 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 664 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
665 | #endif | 665 | #endif |
666 | } | 666 | } |
667 | QPixmap MainWindow::loadPixmap( QString name ) | 667 | QPixmap MainWindow::loadPixmap( QString name ) |
668 | { | 668 | { |
669 | return SmallIcon( name ); | 669 | return SmallIcon( name ); |
670 | 670 | ||
671 | } | 671 | } |
672 | void MainWindow::setUsesBigPixmaps ( bool b ) | 672 | void MainWindow::setUsesBigPixmaps ( bool b ) |
673 | { | 673 | { |
674 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 674 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
675 | if ( b ) | 675 | if ( b ) |
676 | qDebug("KO: BigPixmaps are not supported "); | 676 | qDebug("KO: BigPixmaps are not supported "); |
677 | } | 677 | } |
678 | void MainWindow::initActions() | 678 | void MainWindow::initActions() |
679 | { | 679 | { |
680 | //KOPrefs::instance()->mShowFullMenu | 680 | //KOPrefs::instance()->mShowFullMenu |
681 | iconToolBar->clear(); | 681 | iconToolBar->clear(); |
682 | KOPrefs *p = KOPrefs::instance(); | 682 | KOPrefs *p = KOPrefs::instance(); |
683 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 683 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
684 | 684 | ||
685 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 685 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
686 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 686 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
687 | mCurrentItemMenu = new QPopupMenu ( this ); | 687 | mCurrentItemMenu = new QPopupMenu ( this ); |
688 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 688 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
689 | QPopupMenu *importMenu = new QPopupMenu( this ); | 689 | QPopupMenu *importMenu = new QPopupMenu( this ); |
690 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 690 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
691 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 691 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
692 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 692 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
693 | selectFilterMenu = new QPopupMenu( this ); | 693 | selectFilterMenu = new QPopupMenu( this ); |
694 | selectFilterMenu->setCheckable( true ); | 694 | selectFilterMenu->setCheckable( true ); |
695 | syncMenu = new QPopupMenu( this ); | 695 | syncMenu = new QPopupMenu( this ); |
696 | configureAgendaMenu = new QPopupMenu( this ); | 696 | configureAgendaMenu = new QPopupMenu( this ); |
697 | configureToolBarMenu = new QPopupMenu( this ); | 697 | configureToolBarMenu = new QPopupMenu( this ); |
698 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 698 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
699 | QIconSet icon; | 699 | QIconSet icon; |
700 | int pixWid = 22, pixHei = 22; | 700 | int pixWid = 22, pixHei = 22; |
701 | QString pathString = ""; | 701 | QString pathString = ""; |
702 | if ( !p->mToolBarMiniIcons ) { | 702 | if ( !p->mToolBarMiniIcons ) { |
703 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 703 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
704 | pathString += "icons16/"; | 704 | pathString += "icons16/"; |
705 | pixWid = 18; pixHei = 16; | 705 | pixWid = 18; pixHei = 16; |
706 | } | 706 | } |
707 | } else { | 707 | } else { |
708 | pathString += "iconsmini/"; | 708 | pathString += "iconsmini/"; |
709 | pixWid = 18; pixHei = 16; | 709 | pixWid = 18; pixHei = 16; |
710 | } | 710 | } |
711 | 711 | ||
712 | if ( KOPrefs::instance()->mShowFullMenu ) { | 712 | if ( KOPrefs::instance()->mShowFullMenu ) { |
713 | menuBar1 = new KMenuBar( this );//menuBar(); | 713 | menuBar1 = new KMenuBar( this );//menuBar(); |
714 | //setMenuBar( menuBar1 ); | 714 | //setMenuBar( menuBar1 ); |
715 | menuBar1->show(); | 715 | menuBar1->show(); |
716 | menuBar1->insertItem( i18n("File"), importMenu ); | 716 | menuBar1->insertItem( i18n("File"), importMenu ); |
717 | menuBar1->insertItem( i18n("View"), viewMenu ); | 717 | menuBar1->insertItem( i18n("View"), viewMenu ); |
718 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 718 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
719 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 719 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
720 | #ifdef DESKTOP_VERSION | 720 | #ifdef DESKTOP_VERSION |
721 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 721 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
722 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 722 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
723 | #else | 723 | #else |
724 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 724 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
725 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 725 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
726 | #endif | 726 | #endif |
727 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 727 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
728 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 728 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
729 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 729 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
730 | } else { | 730 | } else { |
731 | menuBar1 = new KMenuBar( iconToolBar ); | 731 | menuBar1 = new KMenuBar( iconToolBar ); |
732 | QPopupMenu *menuBar = new QPopupMenu( this ); | 732 | QPopupMenu *menuBar = new QPopupMenu( this ); |
733 | icon = loadPixmap( pathString + "z_menu" ); | 733 | icon = loadPixmap( pathString + "z_menu" ); |
734 | menuBar1->insertItem( icon.pixmap(), menuBar); | 734 | menuBar1->insertItem( icon.pixmap(), menuBar); |
735 | //menuBar1->insertItem( i18n("ME"), menuBar); | 735 | //menuBar1->insertItem( i18n("ME"), menuBar); |
736 | menuBar->insertItem( i18n("File"), importMenu ); | 736 | menuBar->insertItem( i18n("File"), importMenu ); |
737 | menuBar->insertItem( i18n("View"), viewMenu ); | 737 | menuBar->insertItem( i18n("View"), viewMenu ); |
738 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 738 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
739 | menuBar->insertItem( i18n("Action"), actionMenu ); | 739 | menuBar->insertItem( i18n("Action"), actionMenu ); |
740 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 740 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
741 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 741 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
742 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 742 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
743 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 743 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
744 | menuBar->insertItem( i18n("Help"), helpMenu ); | 744 | menuBar->insertItem( i18n("Help"), helpMenu ); |
745 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 745 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
746 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 746 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
747 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | 747 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); |
748 | } | 748 | } |
749 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 749 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
750 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 750 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
751 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 751 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
752 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 752 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
753 | 753 | ||
754 | 754 | ||
755 | mWeekBgColor = iconToolBar->backgroundColor(); | 755 | mWeekBgColor = iconToolBar->backgroundColor(); |
756 | mWeekPixmap.resize( pixWid , pixHei ); | 756 | mWeekPixmap.resize( pixWid , pixHei ); |
757 | mWeekPixmap.fill( mWeekBgColor ); | 757 | mWeekPixmap.fill( mWeekBgColor ); |
758 | icon = mWeekPixmap; | 758 | icon = mWeekPixmap; |
759 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 759 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
760 | if ( p-> mShowIconWeekNum ) | 760 | if ( p-> mShowIconWeekNum ) |
761 | mWeekAction->addTo( iconToolBar ); | 761 | mWeekAction->addTo( iconToolBar ); |
762 | mWeekFont = font(); | 762 | mWeekFont = font(); |
763 | 763 | ||
764 | int fontPoint = mWeekFont.pointSize(); | 764 | int fontPoint = mWeekFont.pointSize(); |
765 | QFontMetrics f( mWeekFont ); | 765 | QFontMetrics f( mWeekFont ); |
766 | int fontWid = f.width( "30" ); | 766 | int fontWid = f.width( "30" ); |
767 | while ( fontWid > pixWid ) { | 767 | while ( fontWid > pixWid ) { |
768 | --fontPoint; | 768 | --fontPoint; |
769 | mWeekFont.setPointSize( fontPoint ); | 769 | mWeekFont.setPointSize( fontPoint ); |
770 | QFontMetrics f( mWeekFont ); | 770 | QFontMetrics f( mWeekFont ); |
771 | fontWid = f.width( "30" ); | 771 | fontWid = f.width( "30" ); |
772 | //qDebug("dec-- "); | 772 | //qDebug("dec-- "); |
773 | } | 773 | } |
774 | 774 | ||
775 | connect( mWeekAction, SIGNAL( activated() ), | 775 | connect( mWeekAction, SIGNAL( activated() ), |
776 | this, SLOT( weekAction() ) ); | 776 | this, SLOT( weekAction() ) ); |
777 | 777 | ||
778 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 778 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
779 | if ( p->mShowIconFilterview ) { | 779 | if ( p->mShowIconFilterview ) { |
780 | icon = loadPixmap( pathString + "filter" ); | 780 | icon = loadPixmap( pathString + "filter" ); |
781 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 781 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
782 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 782 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
783 | this, SLOT( fillFilterMenuTB() ) ); | 783 | this, SLOT( fillFilterMenuTB() ) ); |
784 | actionFilterMenuTB->addTo( iconToolBar ); | 784 | actionFilterMenuTB->addTo( iconToolBar ); |
785 | selectFilterMenuTB = new QPopupMenu( this ); | 785 | selectFilterMenuTB = new QPopupMenu( this ); |
786 | selectFilterMenuTB->setCheckable( true ); | 786 | selectFilterMenuTB->setCheckable( true ); |
787 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 787 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
788 | } | 788 | } |
789 | 789 | ||
790 | //#endif | 790 | //#endif |
791 | // ****************** | 791 | // ****************** |
792 | QAction *action; | 792 | QAction *action; |
793 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 793 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
794 | configureToolBarMenu->setCheckable( true ); | 794 | configureToolBarMenu->setCheckable( true ); |
795 | 795 | ||
796 | 796 | ||
797 | configureAgendaMenu->setCheckable( true ); | 797 | configureAgendaMenu->setCheckable( true ); |
798 | int iii ; | 798 | int iii ; |
799 | for ( iii = 1;iii<= 10 ;++iii ){ | 799 | for ( iii = 1;iii<= 10 ;++iii ){ |
800 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 800 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
801 | } | 801 | } |
802 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 802 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
803 | 803 | ||
804 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 804 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
805 | this, SLOT( showConfigureAgenda( ) ) ); | 805 | this, SLOT( showConfigureAgenda( ) ) ); |
806 | icon = loadPixmap( pathString + "today" ); | 806 | icon = loadPixmap( pathString + "today" ); |
807 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 807 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
808 | today_action->addTo( actionMenu ); | 808 | today_action->addTo( actionMenu ); |
809 | connect( today_action, SIGNAL( activated() ), | 809 | connect( today_action, SIGNAL( activated() ), |
810 | mView, SLOT( goToday() ) ); | 810 | mView, SLOT( goToday() ) ); |
811 | 811 | ||
812 | icon = loadPixmap( pathString + "picker" ); | 812 | icon = loadPixmap( pathString + "picker" ); |
813 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); | 813 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); |
814 | dPickerAction->addTo( actionMenu ); | 814 | dPickerAction->addTo( actionMenu ); |
815 | connect( dPickerAction, SIGNAL( activated() ), | 815 | connect( dPickerAction, SIGNAL( activated() ), |
816 | mView, SLOT( showDatePicker() ) ); | 816 | mView, SLOT( showDatePicker() ) ); |
817 | 817 | ||
818 | icon = loadPixmap( pathString + "search" ); | 818 | icon = loadPixmap( pathString + "search" ); |
819 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 819 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
820 | search_action->addTo( actionMenu ); | 820 | search_action->addTo( actionMenu ); |
821 | connect( search_action, SIGNAL( activated() ), | 821 | connect( search_action, SIGNAL( activated() ), |
822 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 822 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
823 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); | 823 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); |
824 | 824 | ||
825 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); | 825 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); |
826 | action->addTo( nextConflictMenu ); | 826 | action->addTo( nextConflictMenu ); |
827 | connect( action, SIGNAL( activated() ), | 827 | connect( action, SIGNAL( activated() ), |
828 | mView, SLOT( conflictAll() ) ); | 828 | mView, SLOT( conflictAll() ) ); |
829 | 829 | ||
830 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); | 830 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); |
831 | action->addTo( nextConflictMenu ); | 831 | action->addTo( nextConflictMenu ); |
832 | connect( action, SIGNAL( activated() ), | 832 | connect( action, SIGNAL( activated() ), |
833 | mView, SLOT( conflictAllday() ) ); | 833 | mView, SLOT( conflictAllday() ) ); |
834 | 834 | ||
835 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); | 835 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); |
836 | action->addTo( nextConflictMenu ); | 836 | action->addTo( nextConflictMenu ); |
837 | connect( action, SIGNAL( activated() ), | 837 | connect( action, SIGNAL( activated() ), |
838 | mView, SLOT( conflictNotAll() ) ); | 838 | mView, SLOT( conflictNotAll() ) ); |
839 | 839 | ||
840 | actionMenu->insertSeparator(); | 840 | actionMenu->insertSeparator(); |
841 | 841 | ||
842 | icon = loadPixmap( pathString + "newevent" ); | 842 | icon = loadPixmap( pathString + "newevent" ); |
843 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 843 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
844 | ne_action->addTo( mCurrentItemMenu ); | 844 | ne_action->addTo( mCurrentItemMenu ); |
845 | connect( ne_action, SIGNAL( activated() ), | 845 | connect( ne_action, SIGNAL( activated() ), |
846 | mView, SLOT( newEvent() ) ); | 846 | mView, SLOT( newEvent() ) ); |
847 | icon = loadPixmap( pathString + "newtodo" ); | 847 | icon = loadPixmap( pathString + "newtodo" ); |
848 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 848 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
849 | nt_action->addTo( mCurrentItemMenu ); | 849 | nt_action->addTo( mCurrentItemMenu ); |
850 | connect( nt_action, SIGNAL( activated() ), | 850 | connect( nt_action, SIGNAL( activated() ), |
851 | mView, SLOT( newTodo() ) ); | 851 | mView, SLOT( newTodo() ) ); |
852 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 852 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
853 | this ); | 853 | this ); |
854 | mNewSubTodoAction->addTo( mCurrentItemMenu ); | 854 | mNewSubTodoAction->addTo( mCurrentItemMenu ); |
855 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 855 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
856 | mView, SLOT( newSubTodo() ) ); | 856 | mView, SLOT( newSubTodo() ) ); |
857 | 857 | ||
858 | mCurrentItemMenu->insertSeparator(); | 858 | mCurrentItemMenu->insertSeparator(); |
859 | icon = loadPixmap( pathString + "newevent" ); | 859 | icon = loadPixmap( pathString + "newevent" ); |
860 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 860 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
861 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 861 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
862 | configureToolBarMenu->insertSeparator(); | 862 | configureToolBarMenu->insertSeparator(); |
863 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 863 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
864 | configureToolBarMenu->insertSeparator(); | 864 | configureToolBarMenu->insertSeparator(); |
865 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 865 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
866 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 866 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
867 | icon = loadPixmap( pathString + "newtodo" ); | 867 | icon = loadPixmap( pathString + "newtodo" ); |
868 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 868 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
869 | 869 | ||
870 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 870 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
871 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); | 871 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
872 | mShowAction->addTo( mCurrentItemMenu ); | 872 | mShowAction->addTo( mCurrentItemMenu ); |
873 | connect( mShowAction, SIGNAL( activated() ), | 873 | connect( mShowAction, SIGNAL( activated() ), |
874 | mView, SLOT( showIncidence() ) ); | 874 | mView, SLOT( showIncidence() ) ); |
875 | 875 | ||
876 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 876 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
877 | mEditAction->addTo( mCurrentItemMenu ); | 877 | mEditAction->addTo( mCurrentItemMenu ); |
878 | connect( mEditAction, SIGNAL( activated() ), | 878 | connect( mEditAction, SIGNAL( activated() ), |
879 | mView, SLOT( editIncidence() ) ); | 879 | mView, SLOT( editIncidence() ) ); |
880 | 880 | ||
881 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 881 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
882 | mDeleteAction->addTo( mCurrentItemMenu ); | 882 | mDeleteAction->addTo( mCurrentItemMenu ); |
883 | connect( mDeleteAction, SIGNAL( activated() ), | 883 | connect( mDeleteAction, SIGNAL( activated() ), |
884 | mView, SLOT( deleteIncidence() ) ); | 884 | mView, SLOT( deleteIncidence() ) ); |
885 | 885 | ||
886 | 886 | ||
887 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 887 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
888 | mCloneAction->addTo( mCurrentItemMenu ); | 888 | mCloneAction->addTo( mCurrentItemMenu ); |
889 | connect( mCloneAction, SIGNAL( activated() ), | 889 | connect( mCloneAction, SIGNAL( activated() ), |
890 | mView, SLOT( cloneIncidence() ) ); | 890 | mView, SLOT( cloneIncidence() ) ); |
891 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 891 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
892 | mMoveAction->addTo( mCurrentItemMenu ); | 892 | mMoveAction->addTo( mCurrentItemMenu ); |
893 | connect( mMoveAction, SIGNAL( activated() ), | 893 | connect( mMoveAction, SIGNAL( activated() ), |
894 | mView, SLOT( moveIncidence() ) ); | 894 | mView, SLOT( moveIncidence() ) ); |
895 | #ifndef DESKTOP_VERSION | 895 | #ifndef DESKTOP_VERSION |
896 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 896 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
897 | mBeamAction->addTo(mCurrentItemMenu ); | 897 | mBeamAction->addTo(mCurrentItemMenu ); |
898 | connect( mBeamAction, SIGNAL( activated() ), | 898 | connect( mBeamAction, SIGNAL( activated() ), |
899 | mView, SLOT( beamIncidence() ) ); | 899 | mView, SLOT( beamIncidence() ) ); |
900 | #endif | 900 | #endif |
901 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 901 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
902 | mCancelAction->addTo( mCurrentItemMenu ); | 902 | mCancelAction->addTo( mCurrentItemMenu ); |
903 | connect( mCancelAction, SIGNAL( activated() ), | 903 | connect( mCancelAction, SIGNAL( activated() ), |
904 | mView, SLOT( toggleCancelIncidence() ) ); | 904 | mView, SLOT( toggleCancelIncidence() ) ); |
905 | 905 | ||
906 | 906 | ||
907 | mCurrentItemMenu->insertSeparator(); | 907 | mCurrentItemMenu->insertSeparator(); |
908 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 908 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
909 | action->addTo( mCurrentItemMenu ); | 909 | action->addTo( mCurrentItemMenu ); |
910 | connect( action, SIGNAL( activated() ), | 910 | connect( action, SIGNAL( activated() ), |
911 | mView, SLOT( undo_delete() ) ); | 911 | mView, SLOT( undo_delete() ) ); |
912 | 912 | ||
913 | // *********************** | 913 | // *********************** |
914 | if ( KOPrefs::instance()->mVerticalScreen ) { | 914 | if ( KOPrefs::instance()->mVerticalScreen ) { |
915 | icon = SmallIcon( "1updownarrow" ); | 915 | icon = SmallIcon( "1updownarrow" ); |
916 | } else { | 916 | } else { |
917 | icon = SmallIcon("1leftrightarrow" ); | 917 | icon = SmallIcon("1leftrightarrow" ); |
918 | } | 918 | } |
919 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 919 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
920 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 920 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
921 | FSaction->addTo( viewMenu ); | 921 | FSaction->addTo( viewMenu ); |
922 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 922 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
923 | 923 | ||
924 | 924 | ||
925 | icon = loadPixmap( pathString + "filter" ); | 925 | icon = loadPixmap( pathString + "filter" ); |
926 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 926 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
927 | icon = loadPixmap( pathString + "configure" ); | 927 | icon = loadPixmap( pathString + "configure" ); |
928 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 928 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
929 | action->addTo( viewMenu ); | 929 | action->addTo( viewMenu ); |
930 | connect( action, SIGNAL( activated() ), | 930 | connect( action, SIGNAL( activated() ), |
931 | mView, SLOT( toggleFilter() ) ); | 931 | mView, SLOT( toggleFilter() ) ); |
932 | mToggleFilter = action; | 932 | mToggleFilter = action; |
933 | icon = loadPixmap( pathString + "navi" ); | 933 | icon = loadPixmap( pathString + "navi" ); |
934 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 934 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
935 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 935 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
936 | action->addTo( viewMenu ); | 936 | action->addTo( viewMenu ); |
937 | connect( action, SIGNAL( activated() ), | 937 | connect( action, SIGNAL( activated() ), |
938 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 938 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
939 | mToggleNav = action ; | 939 | mToggleNav = action ; |
940 | icon = loadPixmap( pathString + "allday" ); | 940 | icon = loadPixmap( pathString + "allday" ); |
941 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 941 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
942 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 942 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
943 | action->addTo( viewMenu ); | 943 | action->addTo( viewMenu ); |
944 | connect( action, SIGNAL( activated() ), | 944 | connect( action, SIGNAL( activated() ), |
945 | mView, SLOT( toggleAllDaySize() ) ); | 945 | mView, SLOT( toggleAllDaySize() ) ); |
946 | mToggleAllday = action; | 946 | mToggleAllday = action; |
947 | 947 | ||
948 | 948 | ||
949 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 949 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
950 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 950 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
951 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 951 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
952 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 952 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
953 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 953 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
954 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 954 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
955 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 955 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
956 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 956 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
957 | 957 | ||
958 | 958 | ||
959 | dPickerAction->addTo( iconToolBar ); | 959 | dPickerAction->addTo( iconToolBar ); |
960 | viewMenu->insertSeparator(); | 960 | viewMenu->insertSeparator(); |
961 | 961 | ||
962 | if ( p-> mShowIconToggleFull ) | 962 | if ( p-> mShowIconToggleFull ) |
963 | FSaction->addTo( iconToolBar ); | 963 | FSaction->addTo( iconToolBar ); |
964 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 964 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
965 | 965 | ||
966 | //******************** | 966 | //******************** |
967 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 967 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
968 | 968 | ||
969 | 969 | ||
970 | icon = loadPixmap( pathString + "whatsnext" ); | 970 | icon = loadPixmap( pathString + "whatsnext" ); |
971 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 971 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
972 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 972 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
973 | whatsnext_action->addTo( viewMenu ); | 973 | whatsnext_action->addTo( viewMenu ); |
974 | connect( whatsnext_action, SIGNAL( activated() ), | 974 | connect( whatsnext_action, SIGNAL( activated() ), |
975 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 975 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
976 | 976 | ||
977 | icon = loadPixmap( pathString + "xdays" ); | 977 | icon = loadPixmap( pathString + "xdays" ); |
978 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 978 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
979 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 979 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
980 | xdays_action->addTo( viewMenu ); | 980 | xdays_action->addTo( viewMenu ); |
981 | connect( xdays_action, SIGNAL( activated() ), | 981 | connect( xdays_action, SIGNAL( activated() ), |
982 | mView->viewManager(), SLOT( showNextXView() ) ); | 982 | mView->viewManager(), SLOT( showNextXView() ) ); |
983 | 983 | ||
984 | 984 | ||
985 | icon = loadPixmap( pathString + "journal" ); | 985 | icon = loadPixmap( pathString + "journal" ); |
986 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 986 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
987 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 987 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
988 | viewjournal_action->addTo( viewMenu ); | 988 | viewjournal_action->addTo( viewMenu ); |
989 | connect( viewjournal_action, SIGNAL( activated() ), | 989 | connect( viewjournal_action, SIGNAL( activated() ), |
990 | mView->viewManager(), SLOT( showJournalView() ) ); | 990 | mView->viewManager(), SLOT( showJournalView() ) ); |
991 | 991 | ||
992 | 992 | ||
993 | icon = loadPixmap( pathString + "day" ); | 993 | icon = loadPixmap( pathString + "day" ); |
994 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 994 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
995 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 995 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
996 | day1_action->addTo( viewMenu ); | 996 | day1_action->addTo( viewMenu ); |
997 | // action->addTo( toolBar ); | 997 | // action->addTo( toolBar ); |
998 | connect( day1_action, SIGNAL( activated() ), | 998 | connect( day1_action, SIGNAL( activated() ), |
999 | mView->viewManager(), SLOT( showDayView() ) ); | 999 | mView->viewManager(), SLOT( showDayView() ) ); |
1000 | 1000 | ||
1001 | icon = loadPixmap( pathString + "workweek" ); | 1001 | icon = loadPixmap( pathString + "workweek" ); |
1002 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 1002 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
1003 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 1003 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
1004 | day5_action->addTo( viewMenu ); | 1004 | day5_action->addTo( viewMenu ); |
1005 | connect( day5_action, SIGNAL( activated() ), | 1005 | connect( day5_action, SIGNAL( activated() ), |
1006 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 1006 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
1007 | 1007 | ||
1008 | icon = loadPixmap( pathString + "week" ); | 1008 | icon = loadPixmap( pathString + "week" ); |
1009 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 1009 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
1010 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 1010 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
1011 | day7_action->addTo( viewMenu ); | 1011 | day7_action->addTo( viewMenu ); |
1012 | connect( day7_action, SIGNAL( activated() ), | 1012 | connect( day7_action, SIGNAL( activated() ), |
1013 | mView->viewManager(), SLOT( showWeekView() ) ); | 1013 | mView->viewManager(), SLOT( showWeekView() ) ); |
1014 | 1014 | ||
1015 | icon = loadPixmap( pathString + "workweek2" ); | 1015 | icon = loadPixmap( pathString + "workweek2" ); |
1016 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 1016 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
1017 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 1017 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
1018 | day6_action->addTo( viewMenu ); | 1018 | day6_action->addTo( viewMenu ); |
1019 | connect( day6_action, SIGNAL( activated() ), | 1019 | connect( day6_action, SIGNAL( activated() ), |
1020 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 1020 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
1021 | 1021 | ||
1022 | icon = loadPixmap( pathString + "month" ); | 1022 | icon = loadPixmap( pathString + "month" ); |
1023 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 1023 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
1024 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 1024 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
1025 | month_action->addTo( viewMenu ); | 1025 | month_action->addTo( viewMenu ); |
1026 | connect( month_action, SIGNAL( activated() ), | 1026 | connect( month_action, SIGNAL( activated() ), |
1027 | mView->viewManager(), SLOT( showMonthView() ) ); | 1027 | mView->viewManager(), SLOT( showMonthView() ) ); |
1028 | 1028 | ||
1029 | icon = loadPixmap( pathString + "list" ); | 1029 | icon = loadPixmap( pathString + "list" ); |
1030 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 1030 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
1031 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 1031 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
1032 | showlist_action->addTo( viewMenu ); | 1032 | showlist_action->addTo( viewMenu ); |
1033 | connect( showlist_action, SIGNAL( activated() ), | 1033 | connect( showlist_action, SIGNAL( activated() ), |
1034 | mView->viewManager(), SLOT( showListView() ) ); | 1034 | mView->viewManager(), SLOT( showListView() ) ); |
1035 | 1035 | ||
1036 | icon = loadPixmap( pathString + "todo" ); | 1036 | icon = loadPixmap( pathString + "todo" ); |
1037 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1037 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1038 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1038 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1039 | todoview_action->addTo( viewMenu ); | 1039 | todoview_action->addTo( viewMenu ); |
1040 | connect( todoview_action, SIGNAL( activated() ), | 1040 | connect( todoview_action, SIGNAL( activated() ), |
1041 | mView->viewManager(), SLOT( showTodoView() ) ); | 1041 | mView->viewManager(), SLOT( showTodoView() ) ); |
1042 | 1042 | ||
1043 | 1043 | ||
1044 | 1044 | ||
1045 | #if 0 | 1045 | #if 0 |
1046 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1046 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1047 | action->addTo( viewMenu ); | 1047 | action->addTo( viewMenu ); |
1048 | connect( action, SIGNAL( activated() ), | 1048 | connect( action, SIGNAL( activated() ), |
1049 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1049 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1050 | #endif | 1050 | #endif |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | 1053 | ||
1054 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1054 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1055 | this ); | 1055 | this ); |
1056 | action->addTo( actionMenu ); | 1056 | action->addTo( actionMenu ); |
1057 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1057 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1058 | 1058 | ||
1059 | 1059 | ||
1060 | icon = loadPixmap( pathString + "search" ); | 1060 | icon = loadPixmap( pathString + "search" ); |
1061 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1061 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1062 | 1062 | ||
1063 | 1063 | ||
1064 | 1064 | ||
1065 | actionMenu->insertSeparator(); | 1065 | actionMenu->insertSeparator(); |
1066 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1066 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1067 | this ); | 1067 | this ); |
1068 | action->addTo( actionMenu ); | 1068 | action->addTo( actionMenu ); |
1069 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1069 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1070 | 1070 | ||
1071 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1071 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1072 | this ); | 1072 | this ); |
1073 | action->addTo( actionMenu ); | 1073 | action->addTo( actionMenu ); |
1074 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1074 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1075 | 1075 | ||
1076 | 1076 | ||
1077 | actionMenu->insertSeparator(); | 1077 | actionMenu->insertSeparator(); |
1078 | icon = loadPixmap( pathString + "configure" ); | 1078 | icon = loadPixmap( pathString + "configure" ); |
1079 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1079 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1080 | action->addTo( actionMenu ); | 1080 | action->addTo( actionMenu ); |
1081 | connect( action, SIGNAL( activated() ), | 1081 | connect( action, SIGNAL( activated() ), |
1082 | mView, SLOT( edit_options() ) ); | 1082 | mView, SLOT( edit_options() ) ); |
1083 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1083 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1084 | action->addTo( actionMenu ); | 1084 | action->addTo( actionMenu ); |
1085 | connect( action, SIGNAL( activated() ), | 1085 | connect( action, SIGNAL( activated() ), |
1086 | this, SLOT( calHint() ) ); | 1086 | this, SLOT( calHint() ) ); |
1087 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1087 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1088 | action->addTo( actionMenu ); | 1088 | action->addTo( actionMenu ); |
1089 | connect( action, SIGNAL( activated() ), | 1089 | connect( action, SIGNAL( activated() ), |
1090 | mView, SLOT( edit_global_options() ) ); | 1090 | mView, SLOT( edit_global_options() ) ); |
1091 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1091 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1092 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1092 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1093 | 1093 | ||
1094 | } | 1094 | } |
1095 | // actionMenu->insertSeparator(); | 1095 | // actionMenu->insertSeparator(); |
1096 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1096 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1097 | this ); | 1097 | this ); |
1098 | action->addTo( importMenu_X ); | 1098 | action->addTo( importMenu_X ); |
1099 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1099 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1100 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1100 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1101 | this ); | 1101 | this ); |
1102 | action->addTo( importMenu_X ); | 1102 | action->addTo( importMenu_X ); |
1103 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1103 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1104 | importMenu_X->insertSeparator(); | 1104 | importMenu_X->insertSeparator(); |
1105 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1105 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1106 | this ); | 1106 | this ); |
1107 | action->addTo( importMenu_X ); | 1107 | action->addTo( importMenu_X ); |
1108 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1108 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1109 | //#ifndef DESKTOP_VERSION | 1109 | //#ifndef DESKTOP_VERSION |
1110 | importMenu_X->insertSeparator(); | 1110 | importMenu_X->insertSeparator(); |
1111 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1111 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1112 | this ); | 1112 | this ); |
1113 | action->addTo( importMenu_X ); | 1113 | action->addTo( importMenu_X ); |
1114 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1114 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1115 | //#else | 1115 | //#else |
1116 | #ifdef _OL_IMPORT_ | 1116 | #ifdef _OL_IMPORT_ |
1117 | importMenu_X->insertSeparator(); | 1117 | importMenu_X->insertSeparator(); |
1118 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1118 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1119 | this ); | 1119 | this ); |
1120 | action->addTo( importMenu_X ); | 1120 | action->addTo( importMenu_X ); |
1121 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1121 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1122 | #endif | 1122 | #endif |
1123 | //#endif | 1123 | //#endif |
1124 | 1124 | ||
1125 | //importMenu->insertSeparator(); | 1125 | //importMenu->insertSeparator(); |
1126 | #if 0 | 1126 | #if 0 |
1127 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1127 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1128 | this ); | 1128 | this ); |
1129 | action->addTo( importMenu ); | 1129 | action->addTo( importMenu ); |
1130 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1130 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1131 | #endif | 1131 | #endif |
1132 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1132 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1133 | this ); | 1133 | this ); |
1134 | action->addTo( importMenu ); | 1134 | action->addTo( importMenu ); |
1135 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1135 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1136 | importMenu->insertSeparator(); | 1136 | importMenu->insertSeparator(); |
1137 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1137 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1138 | //importMenu->insertSeparator(); | 1138 | //importMenu->insertSeparator(); |
1139 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1139 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1140 | this ); | 1140 | this ); |
1141 | action->addTo( exportMenu_X ); | 1141 | action->addTo( exportMenu_X ); |
1142 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1142 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | //LR | 1145 | //LR |
1146 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1146 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1147 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1147 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1148 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1148 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1149 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1149 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1150 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1150 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1151 | 1151 | ||
1152 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1152 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1153 | mPrintSelAction = 0; | 1153 | mPrintSelAction = 0; |
1154 | #ifndef DESKTOP_VERSION | 1154 | #ifndef DESKTOP_VERSION |
1155 | //importMenu->insertSeparator(); | 1155 | //importMenu->insertSeparator(); |
1156 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1156 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1157 | this ); | 1157 | this ); |
1158 | brAction->addTo( beamMenu_X ); | 1158 | brAction->addTo( beamMenu_X ); |
1159 | brAction->setToggleAction (true ) ; | 1159 | brAction->setToggleAction (true ) ; |
1160 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1160 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1161 | 1161 | ||
1162 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1162 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1163 | this ); | 1163 | this ); |
1164 | action->addTo( beamMenu_X ); | 1164 | action->addTo( beamMenu_X ); |
1165 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1165 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1166 | 1166 | ||
1167 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1167 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1168 | this ); | 1168 | this ); |
1169 | action->addTo( beamMenu_X ); | 1169 | action->addTo( beamMenu_X ); |
1170 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1170 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1171 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1171 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1172 | #else | 1172 | #else |
1173 | //importMenu->insertSeparator(); | 1173 | //importMenu->insertSeparator(); |
1174 | icon = loadPixmap( pathString + "print" ); | 1174 | icon = loadPixmap( pathString + "print" ); |
1175 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1175 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1176 | action->addTo( beamMenu_X ); | 1176 | action->addTo( beamMenu_X ); |
1177 | connect( action, SIGNAL( activated() ), | 1177 | connect( action, SIGNAL( activated() ), |
1178 | this, SLOT( printCal() ) ); | 1178 | this, SLOT( printCal() ) ); |
1179 | 1179 | ||
1180 | icon = loadPixmap( pathString + "week" ); | 1180 | icon = loadPixmap( pathString + "week" ); |
1181 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1181 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1182 | action->addTo( beamMenu_X ); | 1182 | action->addTo( beamMenu_X ); |
1183 | connect( action, SIGNAL( activated() ), | 1183 | connect( action, SIGNAL( activated() ), |
1184 | this, SLOT( printSel() ) ); | 1184 | this, SLOT( printSel() ) ); |
1185 | icon = loadPixmap( pathString + "whatsnext" ); | 1185 | icon = loadPixmap( pathString + "whatsnext" ); |
1186 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1186 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1187 | action->addTo( beamMenu_X ); | 1187 | action->addTo( beamMenu_X ); |
1188 | connect( action, SIGNAL( activated() ), | 1188 | connect( action, SIGNAL( activated() ), |
1189 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1189 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1190 | 1190 | ||
1191 | 1191 | ||
1192 | icon = loadPixmap( pathString + "list" ); | 1192 | icon = loadPixmap( pathString + "list" ); |
1193 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1193 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1194 | action->addTo( beamMenu_X ); | 1194 | action->addTo( beamMenu_X ); |
1195 | connect( action, SIGNAL( activated() ), | 1195 | connect( action, SIGNAL( activated() ), |
1196 | this, SLOT( printListView() ) ); | 1196 | this, SLOT( printListView() ) ); |
1197 | 1197 | ||
1198 | icon = loadPixmap( pathString + "newevent" ); | 1198 | icon = loadPixmap( pathString + "newevent" ); |
1199 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1199 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1200 | action->addTo( beamMenu_X ); | 1200 | action->addTo( beamMenu_X ); |
1201 | connect( action, SIGNAL( activated() ), | 1201 | connect( action, SIGNAL( activated() ), |
1202 | mView, SLOT( slotprintSelInc() ) ); | 1202 | mView, SLOT( slotprintSelInc() ) ); |
1203 | mPrintSelAction = action; | 1203 | mPrintSelAction = action; |
1204 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1204 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1205 | #endif | 1205 | #endif |
1206 | 1206 | ||
1207 | importMenu->insertSeparator(); | 1207 | importMenu->insertSeparator(); |
1208 | action = new QAction( "beam all", i18n("Save"), 0, | 1208 | action = new QAction( "beam all", i18n("Save"), 0, |
1209 | this ); | 1209 | this ); |
1210 | action->addTo( importMenu ); | 1210 | action->addTo( importMenu ); |
1211 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1211 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1212 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1212 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1213 | this ); | 1213 | this ); |
1214 | action->addTo( importMenu ); | 1214 | action->addTo( importMenu ); |
1215 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1215 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1216 | 1216 | ||
1217 | //menuBar->insertItem( "Configure",configureMenu ); | 1217 | //menuBar->insertItem( "Configure",configureMenu ); |
1218 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1218 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1219 | icon = loadPixmap( "korganizer/korganizer" ); | 1219 | icon = loadPixmap( "korganizer/korganizer" ); |
1220 | 1220 | ||
1221 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1221 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1222 | action->addTo( helpMenu ); | 1222 | action->addTo( helpMenu ); |
1223 | connect( action, SIGNAL( activated() ), | 1223 | connect( action, SIGNAL( activated() ), |
1224 | SLOT( whatsNew() ) ); | 1224 | SLOT( whatsNew() ) ); |
1225 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1225 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1226 | action->addTo( helpMenu ); | 1226 | action->addTo( helpMenu ); |
1227 | connect( action, SIGNAL( activated() ), | 1227 | connect( action, SIGNAL( activated() ), |
1228 | SLOT( features() ) ); | 1228 | SLOT( features() ) ); |
1229 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1229 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1230 | action->addTo( helpMenu ); | 1230 | action->addTo( helpMenu ); |
1231 | connect( action, SIGNAL( activated() ), | 1231 | connect( action, SIGNAL( activated() ), |
1232 | SLOT( keyBindings() ) ); | 1232 | SLOT( keyBindings() ) ); |
1233 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1233 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1234 | action->addTo( helpMenu ); | 1234 | action->addTo( helpMenu ); |
1235 | connect( action, SIGNAL( activated() ), | 1235 | connect( action, SIGNAL( activated() ), |
1236 | SLOT( storagehowto() ) ); | 1236 | SLOT( storagehowto() ) ); |
1237 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1237 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1238 | action->addTo( helpMenu ); | 1238 | action->addTo( helpMenu ); |
1239 | connect( action, SIGNAL( activated() ), | 1239 | connect( action, SIGNAL( activated() ), |
1240 | SLOT( timetrackinghowto() ) ); | 1240 | SLOT( timetrackinghowto() ) ); |
1241 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1241 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1242 | action->addTo( helpMenu ); | 1242 | action->addTo( helpMenu ); |
1243 | connect( action, SIGNAL( activated() ), | 1243 | connect( action, SIGNAL( activated() ), |
1244 | SLOT( synchowto() ) ); | 1244 | SLOT( synchowto() ) ); |
1245 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1245 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1246 | action->addTo( helpMenu ); | 1246 | action->addTo( helpMenu ); |
1247 | connect( action, SIGNAL( activated() ), | 1247 | connect( action, SIGNAL( activated() ), |
1248 | SLOT( kdesynchowto() ) ); | 1248 | SLOT( kdesynchowto() ) ); |
1249 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1249 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1250 | action->addTo( helpMenu ); | 1250 | action->addTo( helpMenu ); |
1251 | connect( action, SIGNAL( activated() ), | 1251 | connect( action, SIGNAL( activated() ), |
1252 | SLOT( multisynchowto() ) ); | 1252 | SLOT( multisynchowto() ) ); |
1253 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1253 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1254 | action->addTo( helpMenu ); | 1254 | action->addTo( helpMenu ); |
1255 | connect( action, SIGNAL( activated() ), | 1255 | connect( action, SIGNAL( activated() ), |
1256 | SLOT( aboutAutoSaving() ) ); | 1256 | SLOT( aboutAutoSaving() ) ); |
1257 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1257 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1258 | action->addTo( helpMenu ); | 1258 | action->addTo( helpMenu ); |
1259 | connect( action, SIGNAL( activated() ), | 1259 | connect( action, SIGNAL( activated() ), |
1260 | SLOT( aboutKnownBugs() ) ); | 1260 | SLOT( aboutKnownBugs() ) ); |
1261 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1261 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1262 | action->addTo( helpMenu ); | 1262 | action->addTo( helpMenu ); |
1263 | connect( action, SIGNAL( activated() ), | 1263 | connect( action, SIGNAL( activated() ), |
1264 | SLOT( usertrans() ) ); | 1264 | SLOT( usertrans() ) ); |
1265 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1265 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1266 | action->addTo( helpMenu ); | 1266 | action->addTo( helpMenu ); |
1267 | connect( action, SIGNAL( activated() ), | 1267 | connect( action, SIGNAL( activated() ), |
1268 | SLOT( faq() ) ); | 1268 | SLOT( faq() ) ); |
1269 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1269 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1270 | action->addTo( helpMenu ); | 1270 | action->addTo( helpMenu ); |
1271 | connect( action, SIGNAL( activated() ), | 1271 | connect( action, SIGNAL( activated() ), |
1272 | SLOT( licence() ) ); | 1272 | SLOT( licence() ) ); |
1273 | action = new QAction( "about", i18n("About..."), 0, this ); | 1273 | action = new QAction( "about", i18n("About..."), 0, this ); |
1274 | action->addTo( helpMenu ); | 1274 | action->addTo( helpMenu ); |
1275 | connect( action, SIGNAL( activated() ), | 1275 | connect( action, SIGNAL( activated() ), |
1276 | SLOT( about() ) ); | 1276 | SLOT( about() ) ); |
1277 | //menuBar->insertSeparator(); | 1277 | //menuBar->insertSeparator(); |
1278 | 1278 | ||
1279 | // ****************************************************** | 1279 | // ****************************************************** |
1280 | // menubar icons | 1280 | // menubar icons |
1281 | 1281 | ||
1282 | 1282 | ||
1283 | 1283 | ||
1284 | //menuBar->insertItem( iconToolBar ); | 1284 | //menuBar->insertItem( iconToolBar ); |
1285 | //xdays_action | 1285 | //xdays_action |
1286 | if (p-> mShowIconNewEvent) | 1286 | if (p-> mShowIconNewEvent) |
1287 | ne_action->addTo( iconToolBar ); | 1287 | ne_action->addTo( iconToolBar ); |
1288 | if (p->mShowIconNewTodo ) | 1288 | if (p->mShowIconNewTodo ) |
1289 | nt_action->addTo( iconToolBar ); | 1289 | nt_action->addTo( iconToolBar ); |
1290 | if (p-> mShowIconSearch) | 1290 | if (p-> mShowIconSearch) |
1291 | search_action->addTo( iconToolBar ); | 1291 | search_action->addTo( iconToolBar ); |
1292 | if (p-> mShowIconWhatsThis) | 1292 | if (p-> mShowIconWhatsThis) |
1293 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1293 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1294 | if (p-> mShowIconNext) | 1294 | if (p-> mShowIconNext) |
1295 | whatsnext_action->addTo( viewToolBar ); | 1295 | whatsnext_action->addTo( viewToolBar ); |
1296 | if (p-> mShowIconNextDays) | 1296 | if (p-> mShowIconNextDays) |
1297 | xdays_action->addTo( viewToolBar ); | 1297 | xdays_action->addTo( viewToolBar ); |
1298 | if (p-> mShowIconJournal) | 1298 | if (p-> mShowIconJournal) |
1299 | viewjournal_action->addTo( viewToolBar ); | 1299 | viewjournal_action->addTo( viewToolBar ); |
1300 | if (p-> mShowIconDay1) | 1300 | if (p-> mShowIconDay1) |
1301 | day1_action->addTo( viewToolBar ); | 1301 | day1_action->addTo( viewToolBar ); |
1302 | if (p-> mShowIconDay5) | 1302 | if (p-> mShowIconDay5) |
1303 | day5_action->addTo( viewToolBar ); | 1303 | day5_action->addTo( viewToolBar ); |
1304 | if (p-> mShowIconDay7) | 1304 | if (p-> mShowIconDay7) |
1305 | day7_action->addTo( viewToolBar ); | 1305 | day7_action->addTo( viewToolBar ); |
1306 | if (p-> mShowIconDay6) | 1306 | if (p-> mShowIconDay6) |
1307 | day6_action->addTo( viewToolBar ); | 1307 | day6_action->addTo( viewToolBar ); |
1308 | if (p-> mShowIconMonth) | 1308 | if (p-> mShowIconMonth) |
1309 | month_action->addTo( viewToolBar ); | 1309 | month_action->addTo( viewToolBar ); |
1310 | if (p-> mShowIconList) | 1310 | if (p-> mShowIconList) |
1311 | showlist_action->addTo( viewToolBar ); | 1311 | showlist_action->addTo( viewToolBar ); |
1312 | if (p-> mShowIconTodoview) | 1312 | if (p-> mShowIconTodoview) |
1313 | todoview_action->addTo( viewToolBar ); | 1313 | todoview_action->addTo( viewToolBar ); |
1314 | 1314 | ||
1315 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1315 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1316 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1316 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1317 | if (p-> mShowIconBackFast) { | 1317 | if (p-> mShowIconBackFast) { |
1318 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1318 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1319 | connect( action, SIGNAL( activated() ), | 1319 | connect( action, SIGNAL( activated() ), |
1320 | mView, SLOT( goPreviousMonth() ) ); | 1320 | mView, SLOT( goPreviousMonth() ) ); |
1321 | action->addTo( navigatorToolBar ); | 1321 | action->addTo( navigatorToolBar ); |
1322 | } | 1322 | } |
1323 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1323 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1324 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1324 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1325 | if (p-> mShowIconBack) { | 1325 | if (p-> mShowIconBack) { |
1326 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1326 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1327 | connect( action, SIGNAL( activated() ), | 1327 | connect( action, SIGNAL( activated() ), |
1328 | mView, SLOT( goPrevious() ) ); | 1328 | mView, SLOT( goPrevious() ) ); |
1329 | action->addTo( navigatorToolBar ); | 1329 | action->addTo( navigatorToolBar ); |
1330 | } | 1330 | } |
1331 | icon = loadPixmap( pathString + "today" ); | 1331 | icon = loadPixmap( pathString + "today" ); |
1332 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1332 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1333 | if (p-> mShowIconToday) | 1333 | if (p-> mShowIconToday) |
1334 | today_action->addTo( navigatorToolBar ); | 1334 | today_action->addTo( navigatorToolBar ); |
1335 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1335 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1336 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1336 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1337 | if (p-> mShowIconForward) { | 1337 | if (p-> mShowIconForward) { |
1338 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1338 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1339 | connect( action, SIGNAL( activated() ), | 1339 | connect( action, SIGNAL( activated() ), |
1340 | mView, SLOT( goNext() ) ); | 1340 | mView, SLOT( goNext() ) ); |
1341 | action->addTo( navigatorToolBar ); | 1341 | action->addTo( navigatorToolBar ); |
1342 | } | 1342 | } |
1343 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1343 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1344 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1344 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1345 | if (p-> mShowIconForwardFast) { | 1345 | if (p-> mShowIconForwardFast) { |
1346 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1346 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1347 | connect( action, SIGNAL( activated() ), | 1347 | connect( action, SIGNAL( activated() ), |
1348 | mView, SLOT( goNextMonth() ) ); | 1348 | mView, SLOT( goNextMonth() ) ); |
1349 | action->addTo( navigatorToolBar ); | 1349 | action->addTo( navigatorToolBar ); |
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | 1352 | ||
1353 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1353 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1354 | 1354 | ||
1355 | 1355 | ||
1356 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1356 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1357 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1357 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1358 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1358 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1359 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1359 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1360 | 1360 | ||
1361 | if (p-> mShowIconNewEvent) | 1361 | if (p-> mShowIconNewEvent) |
1362 | configureToolBarMenu->setItemChecked( 10, true ); | 1362 | configureToolBarMenu->setItemChecked( 10, true ); |
1363 | if (p->mShowIconNewTodo ) | 1363 | if (p->mShowIconNewTodo ) |
1364 | configureToolBarMenu->setItemChecked( 20, true ); | 1364 | configureToolBarMenu->setItemChecked( 20, true ); |
1365 | if (p-> mShowIconSearch) | 1365 | if (p-> mShowIconSearch) |
1366 | configureToolBarMenu->setItemChecked( 120, true ); | 1366 | configureToolBarMenu->setItemChecked( 120, true ); |
1367 | if (p-> mShowIconList) | 1367 | if (p-> mShowIconList) |
1368 | configureToolBarMenu->setItemChecked( 30, true ); | 1368 | configureToolBarMenu->setItemChecked( 30, true ); |
1369 | if (p-> mShowIconDay1) | 1369 | if (p-> mShowIconDay1) |
1370 | configureToolBarMenu->setItemChecked( 40, true ); | 1370 | configureToolBarMenu->setItemChecked( 40, true ); |
1371 | if (p-> mShowIconDay5) | 1371 | if (p-> mShowIconDay5) |
1372 | configureToolBarMenu->setItemChecked( 50, true ); | 1372 | configureToolBarMenu->setItemChecked( 50, true ); |
1373 | if (p-> mShowIconDay6) | 1373 | if (p-> mShowIconDay6) |
1374 | configureToolBarMenu->setItemChecked( 75, true ); | 1374 | configureToolBarMenu->setItemChecked( 75, true ); |
1375 | if (p-> mShowIconDay7) | 1375 | if (p-> mShowIconDay7) |
1376 | configureToolBarMenu->setItemChecked( 60, true ); | 1376 | configureToolBarMenu->setItemChecked( 60, true ); |
1377 | if (p-> mShowIconMonth) | 1377 | if (p-> mShowIconMonth) |
1378 | configureToolBarMenu->setItemChecked( 70, true ); | 1378 | configureToolBarMenu->setItemChecked( 70, true ); |
1379 | if (p-> mShowIconTodoview) | 1379 | if (p-> mShowIconTodoview) |
1380 | configureToolBarMenu->setItemChecked( 80, true ); | 1380 | configureToolBarMenu->setItemChecked( 80, true ); |
1381 | if (p-> mShowIconBackFast) | 1381 | if (p-> mShowIconBackFast) |
1382 | configureToolBarMenu->setItemChecked( 200, true ); | 1382 | configureToolBarMenu->setItemChecked( 200, true ); |
1383 | if (p-> mShowIconBack) | 1383 | if (p-> mShowIconBack) |
1384 | configureToolBarMenu->setItemChecked( 210, true ); | 1384 | configureToolBarMenu->setItemChecked( 210, true ); |
1385 | if (p-> mShowIconToday) | 1385 | if (p-> mShowIconToday) |
1386 | configureToolBarMenu->setItemChecked( 130, true ); | 1386 | configureToolBarMenu->setItemChecked( 130, true ); |
1387 | if (p-> mShowIconForward) | 1387 | if (p-> mShowIconForward) |
1388 | configureToolBarMenu->setItemChecked( 220, true ); | 1388 | configureToolBarMenu->setItemChecked( 220, true ); |
1389 | if (p-> mShowIconForwardFast) | 1389 | if (p-> mShowIconForwardFast) |
1390 | configureToolBarMenu->setItemChecked( 230, true ); | 1390 | configureToolBarMenu->setItemChecked( 230, true ); |
1391 | if (p-> mShowIconNextDays) | 1391 | if (p-> mShowIconNextDays) |
1392 | configureToolBarMenu->setItemChecked( 100, true ); | 1392 | configureToolBarMenu->setItemChecked( 100, true ); |
1393 | if (p-> mShowIconNext) | 1393 | if (p-> mShowIconNext) |
1394 | configureToolBarMenu->setItemChecked( 110, true ); | 1394 | configureToolBarMenu->setItemChecked( 110, true ); |
1395 | if (p-> mShowIconJournal) | 1395 | if (p-> mShowIconJournal) |
1396 | configureToolBarMenu->setItemChecked( 90, true ); | 1396 | configureToolBarMenu->setItemChecked( 90, true ); |
1397 | if (p-> mShowIconWhatsThis) | 1397 | if (p-> mShowIconWhatsThis) |
1398 | configureToolBarMenu->setItemChecked( 300, true ); | 1398 | configureToolBarMenu->setItemChecked( 300, true ); |
1399 | if (p-> mShowIconWeekNum) | 1399 | if (p-> mShowIconWeekNum) |
1400 | configureToolBarMenu->setItemChecked( 400, true ); | 1400 | configureToolBarMenu->setItemChecked( 400, true ); |
1401 | if (!p-> mShowIconStretch) { | 1401 | if (!p-> mShowIconStretch) { |
1402 | QLabel* dummy = new QLabel( iconToolBar ); | 1402 | QLabel* dummy = new QLabel( iconToolBar ); |
1403 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1403 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1404 | dummy->setMinimumWidth( 0 ); | 1404 | dummy->setMinimumWidth( 0 ); |
1405 | iconToolBar->setStretchableWidget ( dummy ) ; | 1405 | iconToolBar->setStretchableWidget ( dummy ) ; |
1406 | } | 1406 | } |
1407 | else { | 1407 | else { |
1408 | iconToolBar->setHorizontalStretchable (true ); | 1408 | iconToolBar->setHorizontalStretchable (true ); |
1409 | viewToolBar->setHorizontalStretchable (true ); | 1409 | viewToolBar->setHorizontalStretchable (true ); |
1410 | navigatorToolBar->setHorizontalStretchable (true ); | 1410 | navigatorToolBar->setHorizontalStretchable (true ); |
1411 | iconToolBar->setVerticalStretchable (true ); | 1411 | iconToolBar->setVerticalStretchable (true ); |
1412 | viewToolBar->setVerticalStretchable (true ); | 1412 | viewToolBar->setVerticalStretchable (true ); |
1413 | navigatorToolBar->setVerticalStretchable (true ); | 1413 | navigatorToolBar->setVerticalStretchable (true ); |
1414 | configureToolBarMenu->setItemChecked( 5, true ); | 1414 | configureToolBarMenu->setItemChecked( 5, true ); |
1415 | } | 1415 | } |
1416 | if (p-> mShowIconFilter) | 1416 | if (p-> mShowIconFilter) |
1417 | configureToolBarMenu->setItemChecked( 7, true ); | 1417 | configureToolBarMenu->setItemChecked( 7, true ); |
1418 | if (p-> mShowIconOnetoolbar) | 1418 | if (p-> mShowIconOnetoolbar) |
1419 | configureToolBarMenu->setItemChecked( 6, true ); | 1419 | configureToolBarMenu->setItemChecked( 6, true ); |
1420 | 1420 | ||
1421 | 1421 | ||
1422 | if ( filterMenubar ) { | 1422 | if ( filterMenubar ) { |
1423 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1423 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1424 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1424 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1425 | } | 1425 | } |
1426 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1426 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1427 | configureAgenda( p->mHourSize ); | 1427 | configureAgenda( p->mHourSize ); |
1428 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1428 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1429 | } | 1429 | } |
1430 | void MainWindow::calHint() | 1430 | void MainWindow::calHint() |
1431 | { | 1431 | { |
1432 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1432 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1433 | 1433 | ||
1434 | KMessageBox::information( this, message); | 1434 | KMessageBox::information( this, message); |
1435 | } | 1435 | } |
1436 | void MainWindow::exportToPhone( int mode ) | 1436 | void MainWindow::exportToPhone( int mode ) |
1437 | { | 1437 | { |
1438 | 1438 | ||
1439 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1439 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1440 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1440 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1441 | KOex2phonePrefs ex2phone; | 1441 | KOex2phonePrefs ex2phone; |
1442 | 1442 | ||
1443 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1443 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1444 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1444 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1445 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1445 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1446 | if ( mode == 1 ) | 1446 | if ( mode == 1 ) |
1447 | ex2phone.setCaption(i18n("Export complete calendar")); | 1447 | ex2phone.setCaption(i18n("Export complete calendar")); |
1448 | if ( mode == 2 ) | 1448 | if ( mode == 2 ) |
1449 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1449 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1450 | 1450 | ||
1451 | if ( !ex2phone.exec() ) { | 1451 | if ( !ex2phone.exec() ) { |
1452 | return; | 1452 | return; |
1453 | } | 1453 | } |
1454 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1454 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1455 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1455 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1456 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1456 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1457 | 1457 | ||
1458 | int inFuture = 0; | 1458 | int inFuture = 0; |
1459 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1459 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1460 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1460 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1461 | QPtrList<Incidence> delSel; | 1461 | QPtrList<Incidence> delSel; |
1462 | if ( mode == 1 ) | 1462 | if ( mode == 1 ) |
1463 | delSel = mCalendar->rawIncidences(); | 1463 | delSel = mCalendar->rawIncidences(); |
1464 | if ( mode == 2 ) | 1464 | if ( mode == 2 ) |
1465 | delSel = mCalendar->incidences(); | 1465 | delSel = mCalendar->incidences(); |
1466 | CalendarLocal* cal = new CalendarLocal(); | 1466 | CalendarLocal* cal = new CalendarLocal(); |
1467 | cal->setLocalTime(); | 1467 | cal->setLocalTime(); |
1468 | Incidence *incidence = delSel.first(); | 1468 | Incidence *incidence = delSel.first(); |
1469 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1469 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1470 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1470 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1471 | while ( incidence ) { | 1471 | while ( incidence ) { |
1472 | if ( incidence->typeID() != journalID ) { | 1472 | if ( incidence->typeID() != journalID ) { |
1473 | bool add = true; | 1473 | bool add = true; |
1474 | if ( inFuture ) { | 1474 | if ( inFuture ) { |
1475 | QDateTime dt; | 1475 | QDateTime dt; |
1476 | if ( incidence->typeID() == todoID ) { | 1476 | if ( incidence->typeID() == todoID ) { |
1477 | Todo * t = (Todo*)incidence; | 1477 | Todo * t = (Todo*)incidence; |
1478 | if ( t->hasDueDate() ) | 1478 | if ( t->hasDueDate() ) |
1479 | dt = t->dtDue(); | 1479 | dt = t->dtDue(); |
1480 | else | 1480 | else |
1481 | dt = cur.addSecs( 62 ); | 1481 | dt = cur.addSecs( 62 ); |
1482 | } | 1482 | } |
1483 | else { | 1483 | else { |
1484 | bool ok; | 1484 | bool ok; |
1485 | dt = incidence->getNextOccurence( cur, &ok ); | 1485 | dt = incidence->getNextOccurence( cur, &ok ); |
1486 | if ( !ok ) | 1486 | if ( !ok ) |
1487 | dt = cur.addSecs( -62 ); | 1487 | dt = cur.addSecs( -62 ); |
1488 | } | 1488 | } |
1489 | if ( dt < cur || dt > end ) { | 1489 | if ( dt < cur || dt > end ) { |
1490 | add = false; | 1490 | add = false; |
1491 | } | 1491 | } |
1492 | } | 1492 | } |
1493 | if ( add ) { | 1493 | if ( add ) { |
1494 | Incidence *in = incidence->clone(); | 1494 | Incidence *in = incidence->clone(); |
1495 | cal->addIncidence( in ); | 1495 | cal->addIncidence( in ); |
1496 | } | 1496 | } |
1497 | } | 1497 | } |
1498 | incidence = delSel.next(); | 1498 | incidence = delSel.next(); |
1499 | } | 1499 | } |
1500 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1500 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1501 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1501 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1502 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1502 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
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 ) { |
1893 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1893 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1894 | if ( p->mToolBarHorF ) | 1894 | if ( p->mToolBarHorF ) |
1895 | p->mToolBarUpF = myP.y() > height()/2; | 1895 | p->mToolBarUpF = myP.y() > height()/2; |
1896 | else | 1896 | else |
1897 | p->mToolBarUpF = myP.x() > width()/2 ; | 1897 | p->mToolBarUpF = myP.x() > width()/2 ; |
1898 | } | 1898 | } |
1899 | #else | 1899 | #else |
1900 | if ( p->mToolBarHor ) | 1900 | if ( p->mToolBarHor ) |
1901 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1901 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1902 | else | 1902 | else |
1903 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1903 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1904 | if ( p->mToolBarHorV ) | 1904 | if ( p->mToolBarHorV ) |
1905 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1905 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1906 | else | 1906 | else |
1907 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1907 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1908 | 1908 | ||
1909 | if ( p->mToolBarHorN ) | 1909 | if ( p->mToolBarHorN ) |
1910 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1910 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1911 | else | 1911 | else |
1912 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1912 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1913 | if ( filterToolBar ) { | 1913 | if ( filterToolBar ) { |
1914 | if ( p->mToolBarHorF ) | 1914 | if ( p->mToolBarHorF ) |
1915 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1915 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1916 | else | 1916 | else |
1917 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1917 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1918 | } | 1918 | } |
1919 | #endif | 1919 | #endif |
1920 | save(); | 1920 | save(); |
1921 | mView->writeSettings(); | 1921 | mView->writeSettings(); |
1922 | mView->checkSuspendAlarm(); | 1922 | mView->checkSuspendAlarm(); |
1923 | } | 1923 | } |
1924 | void MainWindow::slotModifiedChanged( bool ) | 1924 | void MainWindow::slotModifiedChanged( bool ) |
1925 | { | 1925 | { |
1926 | if ( mBlockAtStartup ) | 1926 | if ( mBlockAtStartup ) |
1927 | return; | 1927 | return; |
1928 | 1928 | ||
1929 | int msec; | 1929 | int msec; |
1930 | if ( mCalendarModifiedFlag ) { | 1930 | if ( mCalendarModifiedFlag ) { |
1931 | //qDebug(" MainWindow timer is running "); | 1931 | //qDebug(" MainWindow timer is running "); |
1932 | return; | 1932 | return; |
1933 | } | 1933 | } |
1934 | // we store the changes after 1 minute, | 1934 | // we store the changes after 1 minute, |
1935 | // and for safety reasons after 10 minutes again | 1935 | // and for safety reasons after 10 minutes again |
1936 | if ( !mSyncManager->blockSave() ) | 1936 | if ( !mSyncManager->blockSave() ) |
1937 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1937 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1938 | else | 1938 | else |
1939 | msec = 1000 * 600; | 1939 | msec = 1000 * 600; |
1940 | mSaveTimer.start( msec, true ); // 1 minute | 1940 | mSaveTimer.start( msec, true ); // 1 minute |
1941 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1941 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1942 | mCalendarModifiedFlag = true; | 1942 | mCalendarModifiedFlag = true; |
1943 | } | 1943 | } |
1944 | void MainWindow::saveStopTimer() | 1944 | void MainWindow::saveStopTimer() |
1945 | { | 1945 | { |
1946 | mSaveTimer.stop(); | 1946 | mSaveTimer.stop(); |
1947 | } | 1947 | } |
1948 | void MainWindow::backupAllFiles() | 1948 | void MainWindow::backupAllFiles() |
1949 | { | 1949 | { |
1950 | QDate reference ( 2000,1,1); | 1950 | QDate reference ( 2000,1,1); |
1951 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1951 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1952 | setCaption(i18n("Creating backup ... please wait ..." )); | 1952 | setCaption(i18n("Creating backup ... please wait ..." )); |
1953 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1953 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1954 | // we need the file path, the backup dir and the number of bups as param | 1954 | // we need the file path, the backup dir and the number of bups as param |
1955 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1955 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1956 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1956 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1957 | bupDir = KGlobalSettings::backupDataDir(); | 1957 | bupDir = KGlobalSettings::backupDataDir(); |
1958 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1958 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1959 | if ( retval == 0 ) { | 1959 | if ( retval == 0 ) { |
1960 | setCaption(i18n("Backup cancelled" )); | 1960 | setCaption(i18n("Backup cancelled" )); |
1961 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1961 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1962 | // retval == 0 : backup skipped for today, try again tomorrow | 1962 | // retval == 0 : backup skipped for today, try again tomorrow |
1963 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1963 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1964 | } else if ( retval == 1 ){ | 1964 | } else if ( retval == 1 ){ |
1965 | qDebug("KO: Backup created."); | 1965 | qDebug("KO: Backup created."); |
1966 | // backup ok | 1966 | // backup ok |
1967 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1967 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1968 | KopiCalendarFile * cal = calendars.first(); | 1968 | KopiCalendarFile * cal = calendars.first(); |
1969 | cal = calendars.next(); | 1969 | cal = calendars.next(); |
1970 | while ( cal ) { | 1970 | while ( cal ) { |
1971 | if ( !cal->mErrorOnLoad ) { | 1971 | if ( !cal->mErrorOnLoad ) { |
1972 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1972 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1973 | } | 1973 | } |
1974 | cal = calendars.next(); | 1974 | cal = calendars.next(); |
1975 | } | 1975 | } |
1976 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1976 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1977 | setCaption(i18n("Backup succesfully finished" )); | 1977 | setCaption(i18n("Backup succesfully finished" )); |
1978 | } else if ( retval == 2 ){ | 1978 | } else if ( retval == 2 ){ |
1979 | setCaption(i18n("Backup globally disabled" )); | 1979 | setCaption(i18n("Backup globally disabled" )); |
1980 | qDebug("KO: Backup globally cancelled."); | 1980 | qDebug("KO: Backup globally cancelled."); |
1981 | // backup globally cancelled | 1981 | // backup globally cancelled |
1982 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1982 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1983 | } | 1983 | } |
1984 | // retval == 3: do nothing, try again later | 1984 | // retval == 3: do nothing, try again later |
1985 | } | 1985 | } |
1986 | void MainWindow::save() | 1986 | void MainWindow::save() |
1987 | { | 1987 | { |
1988 | 1988 | ||
1989 | if ( mView->viewManager()->journalView() ) | 1989 | if ( mView->viewManager()->journalView() ) |
1990 | mView->viewManager()->journalView()->checkModified(); | 1990 | mView->viewManager()->journalView()->checkModified(); |
1991 | if ( !mCalendarModifiedFlag ) { | 1991 | if ( !mCalendarModifiedFlag ) { |
1992 | qDebug("KO: Calendar not modified. Nothing saved."); | 1992 | qDebug("KO: Calendar not modified. Nothing saved."); |
1993 | return; | 1993 | return; |
1994 | } | 1994 | } |
1995 | if ( mSyncManager->blockSave() ) { | 1995 | if ( mSyncManager->blockSave() ) { |
1996 | slotModifiedChanged( true ); | 1996 | slotModifiedChanged( true ); |
1997 | return; | 1997 | return; |
1998 | } | 1998 | } |
1999 | mSyncManager->setBlockSave(true); | 1999 | mSyncManager->setBlockSave(true); |
2000 | if ( mView->checkAllFileVersions() ) { | 2000 | if ( mView->checkAllFileVersions() ) { |
2001 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 2001 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
2002 | QDate reference ( 2000,1,1); | 2002 | QDate reference ( 2000,1,1); |
2003 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2003 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
2004 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 2004 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
2005 | backupAllFiles(); | 2005 | backupAllFiles(); |
2006 | } | 2006 | } |
2007 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 2007 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
2008 | } | 2008 | } |
2009 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 2009 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
2010 | if ( !isMinimized () ) | 2010 | if ( !isMinimized () ) |
2011 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2011 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2012 | qDebug("KO: Start saving data to file!"); | 2012 | qDebug("KO: Start saving data to file!"); |
2013 | if ( mView->saveCalendars() ) | 2013 | if ( mView->saveCalendars() ) |
2014 | mCalendarModifiedFlag = false; | 2014 | mCalendarModifiedFlag = false; |
2015 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 2015 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
2016 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2016 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
2017 | QString savemes; | 2017 | QString savemes; |
2018 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2018 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2019 | if ( !isMinimized () ) | 2019 | if ( !isMinimized () ) |
2020 | setCaption(savemes); | 2020 | setCaption(savemes); |
2021 | else | 2021 | else |
2022 | qDebug(savemes); | 2022 | qDebug(savemes); |
2023 | } else { | 2023 | } else { |
2024 | setCaption(i18n("Saving cancelled!")); | 2024 | setCaption(i18n("Saving cancelled!")); |
2025 | mCalendarModifiedFlag = false; | 2025 | mCalendarModifiedFlag = false; |
2026 | slotModifiedChanged( true ); | 2026 | slotModifiedChanged( true ); |
2027 | } | 2027 | } |
2028 | mSyncManager->setBlockSave( false ); | 2028 | mSyncManager->setBlockSave( false ); |
2029 | } | 2029 | } |
2030 | 2030 | ||
2031 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2031 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2032 | { | 2032 | { |
2033 | if ( !e->isAutoRepeat() ) { | 2033 | if ( !e->isAutoRepeat() ) { |
2034 | mFlagKeyPressed = false; | 2034 | mFlagKeyPressed = false; |
2035 | } | 2035 | } |
2036 | } | 2036 | } |
2037 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2037 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2038 | { | 2038 | { |
2039 | qApp->processEvents(); | 2039 | qApp->processEvents(); |
2040 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2040 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2041 | e->ignore(); | 2041 | e->ignore(); |
2042 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2042 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2043 | return; | 2043 | return; |
2044 | } | 2044 | } |
2045 | if (! e->isAutoRepeat() ) | 2045 | if (! e->isAutoRepeat() ) |
2046 | mFlagKeyPressed = true; | 2046 | mFlagKeyPressed = true; |
2047 | KOPrefs *p = KOPrefs::instance(); | 2047 | KOPrefs *p = KOPrefs::instance(); |
2048 | bool showSelectedDates = false; | 2048 | bool showSelectedDates = false; |
2049 | int size; | 2049 | int size; |
2050 | int pro = 0; | 2050 | int pro = 0; |
2051 | //qDebug("MainWindow::keyPressEvent "); | 2051 | //qDebug("MainWindow::keyPressEvent "); |
2052 | switch ( e->key() ) { | 2052 | switch ( e->key() ) { |
2053 | case Qt::Key_Right: | 2053 | case Qt::Key_Right: |
2054 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2054 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2055 | mView->goNextMonth(); | 2055 | mView->goNextMonth(); |
2056 | else | 2056 | else |
2057 | mView->goNext(); | 2057 | mView->goNext(); |
2058 | showSelectedDates = true; | 2058 | showSelectedDates = true; |
2059 | break; | 2059 | break; |
2060 | case Qt::Key_Left: | 2060 | case Qt::Key_Left: |
2061 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2061 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2062 | mView->goPreviousMonth(); | 2062 | mView->goPreviousMonth(); |
2063 | else | 2063 | else |
2064 | mView->goPrevious(); | 2064 | mView->goPrevious(); |
2065 | showSelectedDates = true; | 2065 | showSelectedDates = true; |
2066 | break; | 2066 | break; |
2067 | case Qt::Key_Down: | 2067 | case Qt::Key_Down: |
2068 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2068 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2069 | break; | 2069 | break; |
2070 | case Qt::Key_Up: | 2070 | case Qt::Key_Up: |
2071 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2071 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2072 | break; | 2072 | break; |
2073 | case Qt::Key_K: | 2073 | case Qt::Key_K: |
2074 | mView->viewManager()->showMonthViewWeek(); | 2074 | mView->viewManager()->showMonthViewWeek(); |
2075 | break; | 2075 | break; |
2076 | case Qt::Key_I: | 2076 | case Qt::Key_I: |
2077 | mView->showIncidence(); | 2077 | mView->showIncidence(); |
2078 | break; | 2078 | break; |
2079 | case Qt::Key_Delete: | 2079 | case Qt::Key_Delete: |
2080 | case Qt::Key_Backspace: | 2080 | case Qt::Key_Backspace: |
2081 | mView->deleteIncidence(); | 2081 | mView->deleteIncidence(); |
2082 | break; | 2082 | break; |
2083 | case Qt::Key_D: | 2083 | case Qt::Key_D: |
2084 | mView->viewManager()->showDayView(); | 2084 | mView->viewManager()->showDayView(); |
2085 | showSelectedDates = true; | 2085 | showSelectedDates = true; |
2086 | break; | 2086 | break; |
2087 | case Qt::Key_O: | 2087 | case Qt::Key_O: |
2088 | mView->toggleFilerEnabled( ); | 2088 | mView->toggleFilerEnabled( ); |
2089 | break; | 2089 | break; |
2090 | case Qt::Key_0: | 2090 | case Qt::Key_0: |
2091 | case Qt::Key_1: | 2091 | case Qt::Key_1: |
2092 | case Qt::Key_2: | 2092 | case Qt::Key_2: |
2093 | case Qt::Key_3: | 2093 | case Qt::Key_3: |
2094 | case Qt::Key_4: | 2094 | case Qt::Key_4: |
2095 | case Qt::Key_5: | 2095 | case Qt::Key_5: |
2096 | case Qt::Key_6: | 2096 | case Qt::Key_6: |
2097 | case Qt::Key_7: | 2097 | case Qt::Key_7: |
2098 | case Qt::Key_8: | 2098 | case Qt::Key_8: |
2099 | case Qt::Key_9: | 2099 | case Qt::Key_9: |
2100 | pro = e->key()-48; | 2100 | pro = e->key()-48; |
2101 | if ( pro == 0 ) | 2101 | if ( pro == 0 ) |
2102 | pro = 10; | 2102 | pro = 10; |
2103 | if ( e->state() == Qt::ControlButton) | 2103 | if ( e->state() == Qt::ControlButton) |
2104 | pro += 10; | 2104 | pro += 10; |
2105 | break; | 2105 | break; |
2106 | case Qt::Key_M: | 2106 | case Qt::Key_M: |
2107 | mView->viewManager()->showMonthView(); | 2107 | mView->viewManager()->showMonthView(); |
2108 | showSelectedDates = true; | 2108 | showSelectedDates = true; |
2109 | break; | 2109 | break; |
2110 | case Qt::Key_Insert: | 2110 | case Qt::Key_Insert: |
2111 | mView->newEvent(); | 2111 | mView->newEvent(); |
2112 | break; | 2112 | break; |
2113 | case Qt::Key_S : | 2113 | case Qt::Key_S : |
2114 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2114 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2115 | mView->newSubTodo(); | 2115 | mView->newSubTodo(); |
2116 | else | 2116 | else |
2117 | mView->dialogManager()->showSearchDialog(); | 2117 | mView->dialogManager()->showSearchDialog(); |
2118 | break; | 2118 | break; |
2119 | case Qt::Key_Y : | 2119 | case Qt::Key_Y : |
2120 | case Qt::Key_Z : | 2120 | case Qt::Key_Z : |
2121 | mView->viewManager()->showWorkWeekView(); | 2121 | mView->viewManager()->showWorkWeekView(); |
2122 | showSelectedDates = true; | 2122 | showSelectedDates = true; |
2123 | break; | 2123 | break; |
2124 | case Qt::Key_U : | 2124 | case Qt::Key_U : |
2125 | mView->viewManager()->showWeekView(); | 2125 | mView->viewManager()->showWeekView(); |
2126 | showSelectedDates = true; | 2126 | showSelectedDates = true; |
2127 | break; | 2127 | break; |
2128 | case Qt::Key_H : | 2128 | case Qt::Key_H : |
2129 | keyBindings(); | 2129 | keyBindings(); |
2130 | break; | 2130 | break; |
2131 | case Qt::Key_W: | 2131 | case Qt::Key_W: |
2132 | mView->viewManager()->showWhatsNextView(); | 2132 | mView->viewManager()->showWhatsNextView(); |
2133 | break; | 2133 | break; |
2134 | case Qt::Key_L: | 2134 | case Qt::Key_L: |
2135 | mView->viewManager()->showListView(); | 2135 | mView->viewManager()->showListView(); |
2136 | break; | 2136 | break; |
2137 | case Qt::Key_N: | 2137 | case Qt::Key_N: |
2138 | mView->viewManager()->showNextView(); | 2138 | mView->viewManager()->showNextView(); |
2139 | break; | 2139 | break; |
2140 | case Qt::Key_V: | 2140 | case Qt::Key_V: |
2141 | mView->viewManager()->showTodoView(); | 2141 | mView->viewManager()->showTodoView(); |
2142 | break; | 2142 | break; |
2143 | case Qt::Key_C: | 2143 | case Qt::Key_C: |
2144 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2144 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2145 | break; | 2145 | break; |
2146 | case Qt::Key_P: | 2146 | case Qt::Key_P: |
2147 | mView->showDatePicker( ); | 2147 | mView->showDatePicker( ); |
2148 | break; | 2148 | break; |
2149 | case Qt::Key_F: | 2149 | case Qt::Key_F: |
2150 | mView->editFilters(); | 2150 | mView->editFilters(); |
2151 | break; | 2151 | break; |
2152 | case Qt::Key_R: | 2152 | case Qt::Key_R: |
2153 | mView->toggleFilter(); | 2153 | mView->toggleFilter(); |
2154 | break; | 2154 | break; |
2155 | case Qt::Key_X: | 2155 | case Qt::Key_X: |
2156 | if ( e->state() == Qt::ControlButton ) | 2156 | if ( e->state() == Qt::ControlButton ) |
2157 | mView->toggleDateNavigatorWidget(); | 2157 | mView->toggleDateNavigatorWidget(); |
2158 | else { | 2158 | else { |
2159 | mView->viewManager()->showNextXView(); | 2159 | mView->viewManager()->showNextXView(); |
2160 | showSelectedDates = true; | 2160 | showSelectedDates = true; |
2161 | } | 2161 | } |
2162 | break; | 2162 | break; |
2163 | case Qt::Key_Space: | 2163 | case Qt::Key_Space: |
2164 | mView->toggleExpand(); | 2164 | mView->toggleExpand(); |
2165 | break; | 2165 | break; |
2166 | case Qt::Key_A: | 2166 | case Qt::Key_A: |
2167 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2167 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2168 | mView->showNextAlarms(); | 2168 | mView->showNextAlarms(); |
2169 | else | 2169 | else |
2170 | mView->toggleAllDaySize(); | 2170 | mView->toggleAllDaySize(); |
2171 | break; | 2171 | break; |
2172 | case Qt::Key_T: | 2172 | case Qt::Key_T: |
2173 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2173 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2174 | mView->newTodo(); | 2174 | mView->newTodo(); |
2175 | else { | 2175 | else { |
2176 | mView->goToday(); | 2176 | mView->goToday(); |
2177 | showSelectedDates = true; | 2177 | showSelectedDates = true; |
2178 | } | 2178 | } |
2179 | break; | 2179 | break; |
2180 | case Qt::Key_Q: | 2180 | case Qt::Key_Q: |
2181 | if ( e->state() == Qt::ControlButton ) | 2181 | if ( e->state() == Qt::ControlButton ) |
2182 | mView->conflictNotAll(); | 2182 | mView->conflictNotAll(); |
2183 | else if ( e->state() == Qt::ShiftButton ) | 2183 | else if ( e->state() == Qt::ShiftButton ) |
2184 | mView->conflictAllday(); | 2184 | mView->conflictAllday(); |
2185 | else | 2185 | else |
2186 | mView->conflictAll(); | 2186 | mView->conflictAll(); |
2187 | break; | 2187 | break; |
2188 | case Qt::Key_J: | 2188 | case Qt::Key_J: |
2189 | mView->viewManager()->showJournalView(); | 2189 | mView->viewManager()->showJournalView(); |
2190 | break; | 2190 | break; |
2191 | case Qt::Key_B: | 2191 | case Qt::Key_B: |
2192 | mView->editIncidenceDescription();; | 2192 | mView->editIncidenceDescription();; |
2193 | break; | 2193 | break; |
2194 | // case Qt::Key_Return: | 2194 | // case Qt::Key_Return: |
2195 | case Qt::Key_E: | 2195 | case Qt::Key_E: |
2196 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2196 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2197 | mView->newEvent(); | 2197 | mView->newEvent(); |
2198 | else | 2198 | else |
2199 | mView->editIncidence(); | 2199 | mView->editIncidence(); |
2200 | break; | 2200 | break; |
2201 | case Qt::Key_Plus: | 2201 | case Qt::Key_Plus: |
2202 | size = p->mHourSize +2; | 2202 | size = p->mHourSize +2; |
2203 | if ( size <= 22 ) | 2203 | if ( size <= 22 ) |
2204 | configureAgenda( size ); | 2204 | configureAgenda( size ); |
2205 | break; | 2205 | break; |
2206 | case Qt::Key_Minus: | 2206 | case Qt::Key_Minus: |
2207 | size = p->mHourSize - 2; | 2207 | size = p->mHourSize - 2; |
2208 | if ( size >= 4 ) | 2208 | if ( size >= 4 ) |
2209 | configureAgenda( size ); | 2209 | configureAgenda( size ); |
2210 | break; | 2210 | break; |
2211 | 2211 | ||
2212 | 2212 | ||
2213 | default: | 2213 | default: |
2214 | e->ignore(); | 2214 | e->ignore(); |
2215 | } | 2215 | } |
2216 | if ( pro > 0 ) { | 2216 | if ( pro > 0 ) { |
2217 | selectFilter( pro+1 ); | 2217 | selectFilter( pro+1 ); |
2218 | } | 2218 | } |
2219 | if ( showSelectedDates ) { | 2219 | if ( showSelectedDates ) { |
2220 | ;// setCaptionToDates(); | 2220 | ;// setCaptionToDates(); |
2221 | } | 2221 | } |
2222 | 2222 | ||
2223 | } | 2223 | } |
2224 | void MainWindow::fillFilterMenuTB() | 2224 | void MainWindow::fillFilterMenuTB() |
2225 | { | 2225 | { |
2226 | selectFilterMenuTB->clear(); | 2226 | selectFilterMenuTB->clear(); |
2227 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2227 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2228 | selectFilterMenuTB->insertSeparator(); | 2228 | selectFilterMenuTB->insertSeparator(); |
2229 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2229 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2230 | 2230 | ||
2231 | selectFilterMenuTB->insertSeparator(); | 2231 | selectFilterMenuTB->insertSeparator(); |
2232 | QPtrList<CalFilter> fili = mView->filters(); | 2232 | QPtrList<CalFilter> fili = mView->filters(); |
2233 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2233 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2234 | CalFilter *filter = fili.first(); | 2234 | CalFilter *filter = fili.first(); |
2235 | int iii = 2; | 2235 | int iii = 2; |
2236 | bool checkitem = mView->filterView()->filtersEnabled(); | 2236 | bool checkitem = mView->filterView()->filtersEnabled(); |
2237 | while(filter) { | 2237 | while(filter) { |
2238 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2238 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2239 | if ( filter == curfilter) | 2239 | if ( filter == curfilter) |
2240 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2240 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2241 | filter = fili.next(); | 2241 | filter = fili.next(); |
2242 | ++iii; | 2242 | ++iii; |
2243 | } | 2243 | } |
2244 | if ( !checkitem ) | 2244 | if ( !checkitem ) |
2245 | selectFilterMenuTB->setItemChecked( 1, true ); | 2245 | selectFilterMenuTB->setItemChecked( 1, true ); |
2246 | 2246 | ||
2247 | int x = 0; | 2247 | int x = 0; |
2248 | int y = iconToolBar->height(); | 2248 | int y = iconToolBar->height(); |
2249 | int dX = 0; | 2249 | int dX = 0; |
2250 | int dY = 0; | 2250 | int dY = 0; |
2251 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2251 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2252 | if ( iconToolBar->y() > height()/2 ) { | 2252 | if ( iconToolBar->y() > height()/2 ) { |
2253 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2253 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2254 | y = 0; | 2254 | y = 0; |
2255 | } | 2255 | } |
2256 | } else { | 2256 | } else { |
2257 | if ( iconToolBar->x() > width()/2 ) { // right side | 2257 | if ( iconToolBar->x() > width()/2 ) { // right side |
2258 | x=0; | 2258 | x=0; |
2259 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2259 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2260 | y = 0; | 2260 | y = 0; |
2261 | } else { | 2261 | } else { |
2262 | x= iconToolBar->width(); | 2262 | x= iconToolBar->width(); |
2263 | y = 0; | 2263 | y = 0; |
2264 | } | 2264 | } |
2265 | } | 2265 | } |
2266 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2266 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2267 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2267 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2268 | } | 2268 | } |
2269 | void MainWindow::fillFilterMenu() | 2269 | void MainWindow::fillFilterMenu() |
2270 | { | 2270 | { |
2271 | selectFilterMenu->clear(); | 2271 | selectFilterMenu->clear(); |
2272 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2272 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2273 | selectFilterMenu->insertSeparator(); | 2273 | selectFilterMenu->insertSeparator(); |
2274 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2274 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2275 | 2275 | ||
2276 | selectFilterMenu->insertSeparator(); | 2276 | selectFilterMenu->insertSeparator(); |
2277 | QPtrList<CalFilter> fili = mView->filters(); | 2277 | QPtrList<CalFilter> fili = mView->filters(); |
2278 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2278 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2279 | CalFilter *filter = fili.first(); | 2279 | CalFilter *filter = fili.first(); |
2280 | int iii = 2; | 2280 | int iii = 2; |
2281 | bool checkitem = mView->filterView()->filtersEnabled(); | 2281 | bool checkitem = mView->filterView()->filtersEnabled(); |
2282 | while(filter) { | 2282 | while(filter) { |
2283 | selectFilterMenu->insertItem( filter->name(), iii ); | 2283 | selectFilterMenu->insertItem( filter->name(), iii ); |
2284 | if ( filter == curfilter) | 2284 | if ( filter == curfilter) |
2285 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2285 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2286 | filter = fili.next(); | 2286 | filter = fili.next(); |
2287 | ++iii; | 2287 | ++iii; |
2288 | } | 2288 | } |
2289 | if ( !checkitem ) | 2289 | if ( !checkitem ) |
2290 | selectFilterMenu->setItemChecked( 1, true ); | 2290 | selectFilterMenu->setItemChecked( 1, true ); |
2291 | } | 2291 | } |
2292 | void MainWindow::fillFilterMenuPopup() | 2292 | void MainWindow::fillFilterMenuPopup() |
2293 | { | 2293 | { |
2294 | filterPopupMenu->clear(); | 2294 | filterPopupMenu->clear(); |
2295 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2295 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2296 | 2296 | ||
2297 | filterPopupMenu->insertSeparator(); | 2297 | filterPopupMenu->insertSeparator(); |
2298 | QPtrList<CalFilter> fili = mView->filters(); | 2298 | QPtrList<CalFilter> fili = mView->filters(); |
2299 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2299 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2300 | CalFilter *filter = fili.first(); | 2300 | CalFilter *filter = fili.first(); |
2301 | int iii = 1; | 2301 | int iii = 1; |
2302 | bool checkitem = mView->filterView()->filtersEnabled(); | 2302 | bool checkitem = mView->filterView()->filtersEnabled(); |
2303 | while(filter) { | 2303 | while(filter) { |
2304 | filterPopupMenu->insertItem( filter->name(), iii ); | 2304 | filterPopupMenu->insertItem( filter->name(), iii ); |
2305 | if ( filter == curfilter) | 2305 | if ( filter == curfilter) |
2306 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2306 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2307 | filter = fili.next(); | 2307 | filter = fili.next(); |
2308 | ++iii; | 2308 | ++iii; |
2309 | } | 2309 | } |
2310 | if ( !checkitem ) | 2310 | if ( !checkitem ) |
2311 | filterPopupMenu->setItemChecked( 0, true ); | 2311 | filterPopupMenu->setItemChecked( 0, true ); |
2312 | } | 2312 | } |
2313 | void MainWindow::selectFilter( int fil ) | 2313 | void MainWindow::selectFilter( int fil ) |
2314 | { | 2314 | { |
2315 | 2315 | ||
2316 | if ( fil == 0 ) { | 2316 | if ( fil == 0 ) { |
2317 | mView->editFilters( ); | 2317 | mView->editFilters( ); |
2318 | } else if ( fil == 1 ){ | 2318 | } else if ( fil == 1 ){ |
2319 | if ( mView->filterView()->filtersEnabled() ) | 2319 | if ( mView->filterView()->filtersEnabled() ) |
2320 | mView->toggleFilerEnabled( ); | 2320 | mView->toggleFilerEnabled( ); |
2321 | } else { | 2321 | } else { |
2322 | if ( !mView->filterView()->filtersEnabled() ) { | 2322 | if ( !mView->filterView()->filtersEnabled() ) { |
2323 | mView->filterView()->blockSignals( true ); | 2323 | mView->filterView()->blockSignals( true ); |
2324 | mView->toggleFilerEnabled( ); | 2324 | mView->toggleFilerEnabled( ); |
2325 | mView->filterView()->blockSignals( false ); | 2325 | mView->filterView()->blockSignals( false ); |
2326 | } | 2326 | } |
2327 | mView->selectFilter( fil-2 ); | 2327 | mView->selectFilter( fil-2 ); |
2328 | } | 2328 | } |
2329 | } | 2329 | } |
2330 | void MainWindow::updateFilterToolbar() | 2330 | void MainWindow::updateFilterToolbar() |
2331 | { | 2331 | { |
2332 | if ( filterMenubar ) { | 2332 | if ( filterMenubar ) { |
2333 | if ( !mView->filterView()->filtersEnabled() ) { | 2333 | if ( !mView->filterView()->filtersEnabled() ) { |
2334 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2334 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2335 | } else { | 2335 | } else { |
2336 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2336 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2337 | if ( curfilter ) { | 2337 | if ( curfilter ) { |
2338 | QString name = curfilter->name(); | 2338 | QString name = curfilter->name(); |
2339 | if ( name.length() > 12 ) | 2339 | if ( name.length() > 12 ) |
2340 | name = name.left(10)+"..."; | 2340 | name = name.left(10)+"..."; |
2341 | filterMenubar->changeItem( 0, name ); | 2341 | filterMenubar->changeItem( 0, name ); |
2342 | } | 2342 | } |
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | } | 2345 | } |
2346 | void MainWindow::selectFilterPopup( int fil ) | 2346 | void MainWindow::selectFilterPopup( int fil ) |
2347 | { | 2347 | { |
2348 | selectFilter( fil + 1 ); | 2348 | selectFilter( fil + 1 ); |
2349 | 2349 | ||
2350 | } | 2350 | } |
2351 | void MainWindow::configureToolBar( int item ) | 2351 | void MainWindow::configureToolBar( int item ) |
2352 | { | 2352 | { |
2353 | 2353 | ||
2354 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2354 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2355 | KOPrefs *p = KOPrefs::instance(); | 2355 | KOPrefs *p = KOPrefs::instance(); |
2356 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2356 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2357 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2357 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2358 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2358 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2359 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2359 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2360 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2360 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2361 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2361 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2362 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2362 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2363 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2363 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2364 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2364 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2365 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2365 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2366 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2366 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2367 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2367 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2368 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2368 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2369 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2369 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2370 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2370 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2371 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2371 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2372 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2372 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2373 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2373 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2374 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2374 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2375 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2375 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
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 | } |