summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-23 11:40:59 (UTC)
committer zautrix <zautrix>2004-10-23 11:40:59 (UTC)
commit25b0233d54a6d4bea457fd843073e57183d8bea0 (patch) (unidiff)
tree4d85c3cec59e8b085738be7111c7e2bb0ee7219e /korganizer
parentba2583db0431059cd7368be23c9653e81af16d29 (diff)
downloadkdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.zip
kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.gz
kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.bz2
global settings bugfixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodialogmanager.cpp5
-rw-r--r--korganizer/koprefs.cpp88
-rw-r--r--korganizer/koprefs.h16
-rw-r--r--korganizer/ktimeedit.cpp5
-rw-r--r--korganizer/mainwindow.cpp3
5 files changed, 14 insertions, 103 deletions
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 58198a2..db7c3f2 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,342 +1,341 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <libkdepim/categoryeditdialog.h> 22#include <libkdepim/categoryeditdialog.h>
23 23
24#include "calendarview.h" 24#include "calendarview.h"
25#include "incomingdialog.h" 25#include "incomingdialog.h"
26#include "outgoingdialog.h" 26#include "outgoingdialog.h"
27#include "koprefsdialog.h" 27#include "koprefsdialog.h"
28#include "koeventeditor.h" 28#include "koeventeditor.h"
29#include "koprefs.h" 29#include "koprefs.h"
30#include "datenavigator.h" 30#include "datenavigator.h"
31#include "kotodoeditor.h" 31#include "kotodoeditor.h"
32#include "searchdialog.h" 32#include "searchdialog.h"
33#include "filtereditdialog.h" 33#include "filtereditdialog.h"
34#ifndef KORG_NOPLUGINS 34#ifndef KORG_NOPLUGINS
35#include "plugindialog.h" 35#include "plugindialog.h"
36#endif 36#endif
37#ifndef KORG_NOARCHIVE 37#ifndef KORG_NOARCHIVE
38#include "archivedialog.h" 38#include "archivedialog.h"
39#endif 39#endif
40 40
41#include "kconfig.h" 41#include "kconfig.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43 43
44KODialogManager::KODialogManager( CalendarView *mainView ) : 44KODialogManager::KODialogManager( CalendarView *mainView ) :
45 QObject(), mMainView( mainView ) 45 QObject(), mMainView( mainView )
46{ 46{
47 mOutgoingDialog = 0; 47 mOutgoingDialog = 0;
48 mIncomingDialog = 0; 48 mIncomingDialog = 0;
49 mOptionsDialog = 0; 49 mOptionsDialog = 0;
50 mSearchDialog = 0; 50 mSearchDialog = 0;
51 mArchiveDialog = 0; 51 mArchiveDialog = 0;
52 mFilterEditDialog = 0; 52 mFilterEditDialog = 0;
53 mPluginDialog = 0; 53 mPluginDialog = 0;
54 54
55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
57} 57}
58 58
59KODialogManager::~KODialogManager() 59KODialogManager::~KODialogManager()
60{ 60{
61 delete mOutgoingDialog; 61 delete mOutgoingDialog;
62 delete mIncomingDialog; 62 delete mIncomingDialog;
63 delete mOptionsDialog; 63 delete mOptionsDialog;
64 delete mSearchDialog; 64 delete mSearchDialog;
65#ifndef KORG_NOARCHIVE 65#ifndef KORG_NOARCHIVE
66 delete mArchiveDialog; 66 delete mArchiveDialog;
67#endif 67#endif
68 delete mFilterEditDialog; 68 delete mFilterEditDialog;
69#ifndef KORG_NOPLUGINS 69#ifndef KORG_NOPLUGINS
70 delete mPluginDialog; 70 delete mPluginDialog;
71#endif 71#endif
72} 72}
73 73
74OutgoingDialog *KODialogManager::outgoingDialog() 74OutgoingDialog *KODialogManager::outgoingDialog()
75{ 75{
76 createOutgoingDialog(); 76 createOutgoingDialog();
77 return mOutgoingDialog; 77 return mOutgoingDialog;
78} 78}
79 79
80void KODialogManager::createOutgoingDialog() 80void KODialogManager::createOutgoingDialog()
81{ 81{
82 if (!mOutgoingDialog) { 82 if (!mOutgoingDialog) {
83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
86 mMainView,SIGNAL(numOutgoingChanged(int))); 86 mMainView,SIGNAL(numOutgoingChanged(int)));
87 } 87 }
88} 88}
89 89
90void KODialogManager::showOptionsDialog( bool showSync ) 90void KODialogManager::showOptionsDialog( bool showSync )
91{ 91{
92 int curLanguage = KOPrefs::instance()->mPreferredLanguage; 92
93 if (!mOptionsDialog) { 93 if (!mOptionsDialog) {
94 mOptionsDialog = new KOPrefsDialog(mMainView); 94 mOptionsDialog = new KOPrefsDialog(mMainView);
95 //mOptionsDialog->readConfig(); 95 //mOptionsDialog->readConfig();
96 connect(mOptionsDialog,SIGNAL(configChanged()), 96 connect(mOptionsDialog,SIGNAL(configChanged()),
97 mMainView,SLOT(updateConfig())); 97 mMainView,SLOT(updateConfig()));
98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
99 // mOptionsDialog,SLOT(updateCategories())); 99 // mOptionsDialog,SLOT(updateCategories()));
100 100
101 } 101 }
102 mOptionsDialog->readConfig(); 102 mOptionsDialog->readConfig();
103#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
104 mOptionsDialog->showMaximized(); 104 mOptionsDialog->showMaximized();
105#else 105#else
106 mOptionsDialog->show(); 106 mOptionsDialog->show();
107#endif 107#endif
108 if ( showSync ) 108 if ( showSync )
109 mOptionsDialog->showSyncPage(); 109 mOptionsDialog->showSyncPage();
110 mOptionsDialog->exec(); 110 mOptionsDialog->exec();
111 if ( curLanguage != KOPrefs::instance()->mPreferredLanguage ) 111
112 KOPrefs::instance()->mLanguageChanged = true;
113} 112}
114void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
115{ 114{
116 showOptionsDialog( true ); 115 showOptionsDialog( true );
117 116
118} 117}
119void KODialogManager::showOutgoingDialog() 118void KODialogManager::showOutgoingDialog()
120{ 119{
121 createOutgoingDialog(); 120 createOutgoingDialog();
122 mOutgoingDialog->show(); 121 mOutgoingDialog->show();
123 mOutgoingDialog->raise(); 122 mOutgoingDialog->raise();
124} 123}
125 124
126IncomingDialog *KODialogManager::incomingDialog() 125IncomingDialog *KODialogManager::incomingDialog()
127{ 126{
128 createOutgoingDialog(); 127 createOutgoingDialog();
129 if (!mIncomingDialog) { 128 if (!mIncomingDialog) {
130 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 129 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
131 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 130 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
132 mMainView,SIGNAL(numIncomingChanged(int))); 131 mMainView,SIGNAL(numIncomingChanged(int)));
133 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 132 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
134 mMainView,SLOT(updateView())); 133 mMainView,SLOT(updateView()));
135 } 134 }
136 return mIncomingDialog; 135 return mIncomingDialog;
137} 136}
138 137
139void KODialogManager::createIncomingDialog() 138void KODialogManager::createIncomingDialog()
140{ 139{
141 createOutgoingDialog(); 140 createOutgoingDialog();
142 if (!mIncomingDialog) { 141 if (!mIncomingDialog) {
143 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 142 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
144 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 143 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
145 mMainView,SIGNAL(numIncomingChanged(int))); 144 mMainView,SIGNAL(numIncomingChanged(int)));
146 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 145 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
147 mMainView,SLOT(updateView())); 146 mMainView,SLOT(updateView()));
148 } 147 }
149} 148}
150 149
151void KODialogManager::showIncomingDialog() 150void KODialogManager::showIncomingDialog()
152{ 151{
153 createIncomingDialog(); 152 createIncomingDialog();
154 mIncomingDialog->show(); 153 mIncomingDialog->show();
155 mIncomingDialog->raise(); 154 mIncomingDialog->raise();
156} 155}
157/* 156/*
158void KODialogManager::showCategoryEditDialog() 157void KODialogManager::showCategoryEditDialog()
159{ 158{
160 mCategoryEditDialog->show(); 159 mCategoryEditDialog->show();
161} 160}
162*/ 161*/
163void KODialogManager::hideSearchDialog() 162void KODialogManager::hideSearchDialog()
164{ 163{
165 if (mSearchDialog) 164 if (mSearchDialog)
166 mSearchDialog->hide(); 165 mSearchDialog->hide();
167} 166}
168 167
169void KODialogManager::showSearchDialog() 168void KODialogManager::showSearchDialog()
170{ 169{
171 if (!mSearchDialog) { 170 if (!mSearchDialog) {
172 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 171 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
173 KOListView * lview = mSearchDialog->listview(); 172 KOListView * lview = mSearchDialog->listview();
174 173
175 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 174 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
176 mMainView, SLOT(showIncidence(Incidence *))); 175 mMainView, SLOT(showIncidence(Incidence *)));
177 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 176 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
178 mMainView, SLOT(editIncidence(Incidence *))); 177 mMainView, SLOT(editIncidence(Incidence *)));
179 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 178 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
180 mMainView, SLOT(deleteIncidence(Incidence *))); 179 mMainView, SLOT(deleteIncidence(Incidence *)));
181 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 180 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
182 mMainView, SLOT(cloneIncidence(Incidence *))); 181 mMainView, SLOT(cloneIncidence(Incidence *)));
183 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 182 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
184 mMainView, SLOT(beamIncidence(Incidence *))); 183 mMainView, SLOT(beamIncidence(Incidence *)));
185 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 184 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
186 mMainView, SLOT(moveIncidence(Incidence *))); 185 mMainView, SLOT(moveIncidence(Incidence *)));
187 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 186 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
188 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 187 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
189 188
190 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 189 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
191 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 190 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
192 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 191 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
193 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 192 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
194#ifndef DESKTOP_VERSION 193#ifndef DESKTOP_VERSION
195 mSearchDialog->setMaximumSize( 640, 480 ); 194 mSearchDialog->setMaximumSize( 640, 480 );
196 //mSearchDialog->setGeometry( 40,40, 400, 300); 195 //mSearchDialog->setGeometry( 40,40, 400, 300);
197 mSearchDialog->showMaximized(); 196 mSearchDialog->showMaximized();
198#else 197#else
199 KConfig *config = KOGlobals::config(); 198 KConfig *config = KOGlobals::config();
200 config->setGroup("WidgetLayout"); 199 config->setGroup("WidgetLayout");
201 QStringList list; 200 QStringList list;
202 list = config->readListEntry("SearchLayout"); 201 list = config->readListEntry("SearchLayout");
203 int x,y,w,h; 202 int x,y,w,h;
204 if ( ! list.isEmpty() ) { 203 if ( ! list.isEmpty() ) {
205 x = list[0].toInt(); 204 x = list[0].toInt();
206 y = list[1].toInt(); 205 y = list[1].toInt();
207 w = list[2].toInt(); 206 w = list[2].toInt();
208 h = list[3].toInt(); 207 h = list[3].toInt();
209 mSearchDialog->setGeometry(x,y,w,h); 208 mSearchDialog->setGeometry(x,y,w,h);
210 209
211 } 210 }
212 211
213#endif 212#endif
214 } 213 }
215 // make sure the widget is on top again 214 // make sure the widget is on top again
216 mSearchDialog->show(); 215 mSearchDialog->show();
217 mSearchDialog->raise(); 216 mSearchDialog->raise();
218} 217}
219 218
220SearchDialog * KODialogManager::getSearchDialog() 219SearchDialog * KODialogManager::getSearchDialog()
221{ 220{
222 return mSearchDialog; 221 return mSearchDialog;
223} 222}
224void KODialogManager::showArchiveDialog() 223void KODialogManager::showArchiveDialog()
225{ 224{
226#ifndef KORG_NOARCHIVE 225#ifndef KORG_NOARCHIVE
227 if (!mArchiveDialog) { 226 if (!mArchiveDialog) {
228 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 227 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
229 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 228 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
230 mMainView,SLOT(updateView())); 229 mMainView,SLOT(updateView()));
231 } 230 }
232 mArchiveDialog->show(); 231 mArchiveDialog->show();
233 mArchiveDialog->raise(); 232 mArchiveDialog->raise();
234 233
235 // Workaround. 234 // Workaround.
236 QApplication::restoreOverrideCursor(); 235 QApplication::restoreOverrideCursor();
237#endif 236#endif
238} 237}
239 238
240void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 239void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
241{ 240{
242 if (!mFilterEditDialog) { 241 if (!mFilterEditDialog) {
243 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 242 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
244 connect(mFilterEditDialog,SIGNAL(filterChanged()), 243 connect(mFilterEditDialog,SIGNAL(filterChanged()),
245 mMainView,SLOT(filterEdited())); 244 mMainView,SLOT(filterEdited()));
246 245
247 } 246 }
248 247
249#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
250 mFilterEditDialog->showMaximized(); 249 mFilterEditDialog->showMaximized();
251#else 250#else
252 mFilterEditDialog->show(); 251 mFilterEditDialog->show();
253#endif 252#endif
254 mFilterEditDialog->raise(); 253 mFilterEditDialog->raise();
255} 254}
256 255
257void KODialogManager::showPluginDialog() 256void KODialogManager::showPluginDialog()
258{ 257{
259#ifndef KORG_NOPLUGINS 258#ifndef KORG_NOPLUGINS
260 if (!mPluginDialog) { 259 if (!mPluginDialog) {
261 mPluginDialog = new PluginDialog(mMainView); 260 mPluginDialog = new PluginDialog(mMainView);
262 connect(mPluginDialog,SIGNAL(configChanged()), 261 connect(mPluginDialog,SIGNAL(configChanged()),
263 mMainView,SLOT(updateConfig())); 262 mMainView,SLOT(updateConfig()));
264 } 263 }
265 mPluginDialog->show(); 264 mPluginDialog->show();
266 mPluginDialog->raise(); 265 mPluginDialog->raise();
267#endif 266#endif
268} 267}
269 268
270KOEventEditor *KODialogManager::getEventEditor() 269KOEventEditor *KODialogManager::getEventEditor()
271{ 270{
272 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), 271 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
273 mMainView ); 272 mMainView );
274 273
275 connect(eventEditor,SIGNAL(eventAdded(Event *)), 274 connect(eventEditor,SIGNAL(eventAdded(Event *)),
276 mMainView,SLOT(eventAdded(Event *))); 275 mMainView,SLOT(eventAdded(Event *)));
277 connect(eventEditor,SIGNAL(eventChanged(Event *)), 276 connect(eventEditor,SIGNAL(eventChanged(Event *)),
278 mMainView,SLOT(eventChanged(Event *))); 277 mMainView,SLOT(eventChanged(Event *)));
279 connect(eventEditor,SIGNAL(eventDeleted()), 278 connect(eventEditor,SIGNAL(eventDeleted()),
280 mMainView,SLOT(eventDeleted())); 279 mMainView,SLOT(eventDeleted()));
281 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), 280 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)),
282 mMainView,SLOT(schedule_cancel(Incidence *))); 281 mMainView,SLOT(schedule_cancel(Incidence *)));
283 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), 282 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)),
284 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 283 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
285 connect( eventEditor, SIGNAL( showAgendaView( bool)), 284 connect( eventEditor, SIGNAL( showAgendaView( bool)),
286 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 285 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
287 286
288 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 287 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
289 // eventEditor,SLOT(updateCategoryConfig())); 288 // eventEditor,SLOT(updateCategoryConfig()));
290 // connect(eventEditor,SIGNAL(editCategories()), 289 // connect(eventEditor,SIGNAL(editCategories()),
291 // mCategoryEditDialog,SLOT(show())); 290 // mCategoryEditDialog,SLOT(show()));
292 connect(eventEditor,SIGNAL(dialogClose(Incidence*)), 291 connect(eventEditor,SIGNAL(dialogClose(Incidence*)),
293 mMainView,SLOT(dialogClosing(Incidence*))); 292 mMainView,SLOT(dialogClosing(Incidence*)));
294 293
295 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); 294 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject()));
296 295
297 return eventEditor; 296 return eventEditor;
298} 297}
299 298
300KOTodoEditor *KODialogManager::getTodoEditor() 299KOTodoEditor *KODialogManager::getTodoEditor()
301{ 300{
302 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), 301 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(),
303 mMainView ); 302 mMainView );
304 303
305 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 304 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
306 // todoEditor,SLOT(updateCategoryConfig())); 305 // todoEditor,SLOT(updateCategoryConfig()));
307 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); 306 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show()));
308 307
309 connect(todoEditor,SIGNAL(todoAdded(Todo *)), 308 connect(todoEditor,SIGNAL(todoAdded(Todo *)),
310 mMainView,SLOT(todoAdded(Todo *))); 309 mMainView,SLOT(todoAdded(Todo *)));
311 connect(todoEditor,SIGNAL(todoChanged(Todo *)), 310 connect(todoEditor,SIGNAL(todoChanged(Todo *)),
312 mMainView,SLOT(todoChanged(Todo *))); 311 mMainView,SLOT(todoChanged(Todo *)));
313 connect(todoEditor,SIGNAL(todoDeleted()), 312 connect(todoEditor,SIGNAL(todoDeleted()),
314 mMainView,SLOT(todoDeleted())); 313 mMainView,SLOT(todoDeleted()));
315 connect(todoEditor,SIGNAL(dialogClose(Incidence*)), 314 connect(todoEditor,SIGNAL(dialogClose(Incidence*)),
316 mMainView,SLOT(dialogClosing(Incidence*))); 315 mMainView,SLOT(dialogClosing(Incidence*)));
317 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), 316 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)),
318 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 317 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
319 connect( todoEditor, SIGNAL( showAgendaView( bool)), 318 connect( todoEditor, SIGNAL( showAgendaView( bool)),
320 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 319 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
321 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), 320 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)),
322 // mMainView,SLOT(schedule_cancel(Incidence *))); 321 // mMainView,SLOT(schedule_cancel(Incidence *)));
323 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); 322 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject()));
324 323
325 return todoEditor; 324 return todoEditor;
326} 325}
327 326
328void KODialogManager::updateSearchDialog() 327void KODialogManager::updateSearchDialog()
329{ 328{
330 if (mSearchDialog) mSearchDialog->updateView(); 329 if (mSearchDialog) mSearchDialog->updateView();
331} 330}
332 331
333void KODialogManager::setDocumentId( const QString &id ) 332void KODialogManager::setDocumentId( const QString &id )
334{ 333{
335 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); 334 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id );
336} 335}
337 336
338void KODialogManager::writeSettings( KConfig *config ) 337void KODialogManager::writeSettings( KConfig *config )
339{ 338{
340 if (mSearchDialog) 339 if (mSearchDialog)
341 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); 340 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout");
342} 341}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,555 +1,477 @@
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 <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49const char *germanwords[][2] = {
50#include "wordsgerman.h"
51 "", ""
52};
53
54KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
55static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
56 51
57KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
58 KPimPrefs("korganizerrc") 53 KPimPrefs("korganizerrc")
59{ 54{
60 mCategoryColors.setAutoDelete(true); 55 mCategoryColors.setAutoDelete(true);
61 mLocaleDict = 0;
62 fillMailDefaults(); 56 fillMailDefaults();
63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 57 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
64 QColor defaultHolidayColor = QColor(255,0,0); 58 QColor defaultHolidayColor = QColor(255,0,0);
65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 59 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
68 QColor defaultTodoDueTodayColor = QColor(255,220,100); 62 QColor defaultTodoDueTodayColor = QColor(255,220,100);
69 QColor defaultTodoOverdueColor = QColor(255,153,125); 63 QColor defaultTodoOverdueColor = QColor(255,153,125);
70 64
71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
72 mDefaultViewFont = QFont("helvetica",10); 66 mDefaultViewFont = QFont("helvetica",10);
73 mDefaultMonthViewFont = QFont("helvetica",8); 67 mDefaultMonthViewFont = QFont("helvetica",8);
74 mMarcusBainsFont= QFont("helvetica",10); 68 mMarcusBainsFont= QFont("helvetica",10);
75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 69 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
76 mEditBoxFont = QFont("helvetica",12); 70 mEditBoxFont = QFont("helvetica",12);
77 mJornalViewFont = QFont("helvetica",12); 71 mJornalViewFont = QFont("helvetica",12);
78 72
79 KPrefs::setCurrentGroup("General"); 73 KPrefs::setCurrentGroup("General");
80 74
81 75
82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 76 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
83 77
84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 78 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 79 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
86 addItemBool("ShowIconSearch",&mShowIconSearch,true); 80 addItemBool("ShowIconSearch",&mShowIconSearch,true);
87 addItemBool("ShowIconList",&mShowIconList,true); 81 addItemBool("ShowIconList",&mShowIconList,true);
88 addItemBool("ShowIconDay1",&mShowIconDay1,true); 82 addItemBool("ShowIconDay1",&mShowIconDay1,true);
89 addItemBool("ShowIconDay5",&mShowIconDay5,true); 83 addItemBool("ShowIconDay5",&mShowIconDay5,true);
90 addItemBool("ShowIconDay7",&mShowIconDay7,true); 84 addItemBool("ShowIconDay7",&mShowIconDay7,true);
91 addItemBool("ShowIconMonth",&mShowIconMonth,true); 85 addItemBool("ShowIconMonth",&mShowIconMonth,true);
92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
94 addItemBool("ShowIconBack",&mShowIconBack,true); 88 addItemBool("ShowIconBack",&mShowIconBack,true);
95 addItemBool("ShowIconToday",&mShowIconToday,true); 89 addItemBool("ShowIconToday",&mShowIconToday,true);
96 addItemBool("ShowIconForward",&mShowIconForward,true); 90 addItemBool("ShowIconForward",&mShowIconForward,true);
97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 93 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
100 addItemBool("ShowIconNext",&mShowIconNext,true); 94 addItemBool("ShowIconNext",&mShowIconNext,true);
101 addItemBool("ShowIconJournal",&mShowIconJournal,true); 95 addItemBool("ShowIconJournal",&mShowIconJournal,true);
102 addItemBool("ShowIconStretch",&mShowIconStretch,true); 96 addItemBool("ShowIconStretch",&mShowIconStretch,true);
103 addItemBool("LanguageChanged",&mLanguageChanged,false); 97 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
104 98
105 addItemBool("AskForQuit",&mAskForQuit,false); 99 addItemBool("AskForQuit",&mAskForQuit,false);
106 100
107#ifndef DESKTOP_VERSION 101#ifndef DESKTOP_VERSION
108 addItemBool("ShowFullMenu",&mShowFullMenu,false); 102 addItemBool("ShowFullMenu",&mShowFullMenu,false);
109#else 103#else
110 addItemBool("ShowFullMenu",&mShowFullMenu,true); 104 addItemBool("ShowFullMenu",&mShowFullMenu,true);
111#endif 105#endif
112 addItemBool("ToolBarHor",&mToolBarHor, true ); 106 addItemBool("ToolBarHor",&mToolBarHor, true );
113 addItemBool("ToolBarUp",&mToolBarUp, false ); 107 addItemBool("ToolBarUp",&mToolBarUp, false );
114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
115 addItemInt("Whats Next Days",&mWhatsNextDays,3); 109 addItemInt("Whats Next Days",&mWhatsNextDays,3);
116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 110 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
117 111
118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 112 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 113 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
120 addItemInt("AllDay Size",&mAllDaySize,28); 114 addItemInt("AllDay Size",&mAllDaySize,28);
121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 115 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 116 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
123 117
124 addItemStringList("LocationDefaults",&mLocationDefaults ); 118 addItemStringList("LocationDefaults",&mLocationDefaults );
125 addItemStringList("EventSummary User",&mEventSummaryUser); 119 addItemStringList("EventSummary User",&mEventSummaryUser);
126 addItemStringList("TodoSummary User",&mTodoSummaryUser); 120 addItemStringList("TodoSummary User",&mTodoSummaryUser);
127 121
128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 122 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
129 addItemBool("Enable Project View",&mEnableProjectView,false); 123 addItemBool("Enable Project View",&mEnableProjectView,false);
130 addItemBool("Auto Save",&mAutoSave,false); 124 addItemBool("Auto Save",&mAutoSave,false);
131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 125 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
132 addItemBool("Confirm Deletes",&mConfirm,true); 126 addItemBool("Confirm Deletes",&mConfirm,true);
133 addItemString("Archive File",&mArchiveFile); 127 addItemString("Archive File",&mArchiveFile);
134 addItemString("Html Export File",&mHtmlExportFile, 128 addItemString("Html Export File",&mHtmlExportFile,
135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 129 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
136 addItemBool("Html With Save",&mHtmlWithSave,false); 130 addItemBool("Html With Save",&mHtmlWithSave,false);
137 131
138 KPrefs::setCurrentGroup("Personal Settings"); 132 KPrefs::setCurrentGroup("Personal Settings");
139 133
140 addItemInt("Mail Client",&mMailClient,MailClientKMail); 134 addItemInt("Mail Client",&mMailClient,MailClientKMail);
141 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 135 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
142 addItemBool("Bcc",&mBcc,false); 136 addItemBool("Bcc",&mBcc,false);
143 137
144 KPrefs::setCurrentGroup("Time & Date"); 138 KPrefs::setCurrentGroup("Time & Date");
145 139
146 140
147 addItemInt("Default Start Time",&mStartTime,10); 141 addItemInt("Default Start Time",&mStartTime,10);
148 addItemInt("Default Duration",&mDefaultDuration,2); 142 addItemInt("Default Duration",&mDefaultDuration,2);
149 addItemInt("Default Alarm Time",&mAlarmTime,3); 143 addItemInt("Default Alarm Time",&mAlarmTime,3);
150 KPrefs::setCurrentGroup("AlarmSettings"); 144 KPrefs::setCurrentGroup("AlarmSettings");
151 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 145 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
152 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 146 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
153 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 147 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
154 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 148 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
155 149
156 150
157 KPrefs::setCurrentGroup("Calendar"); 151 KPrefs::setCurrentGroup("Calendar");
158 152
159 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 153 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
160 154
161 KPrefs::setCurrentGroup("Fonts"); 155 KPrefs::setCurrentGroup("Fonts");
162 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 156 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
163 addItemFont("TimeBar Font",&mTimeBarFont); 157 addItemFont("TimeBar Font",&mTimeBarFont);
164 addItemFont("MonthView Font",&mMonthViewFont); 158 addItemFont("MonthView Font",&mMonthViewFont);
165 addItemFont("AgendaView Font",&mAgendaViewFont); 159 addItemFont("AgendaView Font",&mAgendaViewFont);
166 addItemFont("MarcusBains Font",&mMarcusBainsFont); 160 addItemFont("MarcusBains Font",&mMarcusBainsFont);
167 addItemFont("TimeLabels Font",&mTimeLabelsFont); 161 addItemFont("TimeLabels Font",&mTimeLabelsFont);
168 addItemFont("TodoView Font",&mTodoViewFont); 162 addItemFont("TodoView Font",&mTodoViewFont);
169 addItemFont("ListView Font",&mListViewFont); 163 addItemFont("ListView Font",&mListViewFont);
170 addItemFont("DateNavigator Font",&mDateNavigatorFont); 164 addItemFont("DateNavigator Font",&mDateNavigatorFont);
171 addItemFont("EditBox Font",&mEditBoxFont); 165 addItemFont("EditBox Font",&mEditBoxFont);
172 addItemFont("JournalView Font",&mJornalViewFont); 166 addItemFont("JournalView Font",&mJornalViewFont);
173 addItemFont("WhatsNextView Font",&mWhatsNextFont); 167 addItemFont("WhatsNextView Font",&mWhatsNextFont);
174 addItemFont("EventView Font",&mEventViewFont); 168 addItemFont("EventView Font",&mEventViewFont);
175 169
176// KPrefs::setCurrentGroup("SyncProfiles"); 170// KPrefs::setCurrentGroup("SyncProfiles");
177// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 171// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
178// addItemStringList("SyncProfileNames",&mSyncProfileNames); 172// addItemStringList("SyncProfileNames",&mSyncProfileNames);
179// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 173// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
180 174
181 KPrefs::setCurrentGroup("RemoteSyncing"); 175 KPrefs::setCurrentGroup("RemoteSyncing");
182// addItemBool("UsePasswd",&mUsePassWd,false); 176// addItemBool("UsePasswd",&mUsePassWd,false);
183// addItemBool("WriteBackFile",&mWriteBackFile,true); 177// addItemBool("WriteBackFile",&mWriteBackFile,true);
184// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 178// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
185// addItemBool("AskForPreferences",&mAskForPreferences,true); 179// addItemBool("AskForPreferences",&mAskForPreferences,true);
186// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 180// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
187 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 181 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
188 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 182 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
189 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 183 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
190 addItemInt("LastSyncTime",&mLastSyncTime,0); 184 addItemInt("LastSyncTime",&mLastSyncTime,0);
191 185
192#ifdef _WIN32_ 186#ifdef _WIN32_
193 QString hdp= locateLocal("data","korganizer")+"\\\\"; 187 QString hdp= locateLocal("data","korganizer")+"\\\\";
194#else 188#else
195 QString hdp= locateLocal("data","korganizer")+"/"; 189 QString hdp= locateLocal("data","korganizer")+"/";
196#endif 190#endif
197 191
198 KPrefs::setCurrentGroup("LoadSaveFileNames"); 192 KPrefs::setCurrentGroup("LoadSaveFileNames");
199 193
200 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 194 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
201 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 195 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
202 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 196 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
203 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 197 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
204 198
205 199
206 KPrefs::setCurrentGroup("Locale"); 200 KPrefs::setCurrentGroup("Locale");
207 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
208 addItemInt("PreferredTime",&mPreferredTime,0);
209 addItemInt("PreferredDate",&mPreferredDate,0);
210 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
211 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 201 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
212 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
213 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
214 202
215 203
216 KPrefs::setCurrentGroup("Colors"); 204 KPrefs::setCurrentGroup("Colors");
217 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 205 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
218 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 206 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
219 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 207 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
220 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 208 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
221 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 209 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
222 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 210 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
223 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 211 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
224 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 212 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
225 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 213 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
226 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 214 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
227 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 215 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
228 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 216 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
229 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 217 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
230 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 218 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
231 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 219 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
232 addItemBool("UseAppColors",&mUseAppColors,false); 220 addItemBool("UseAppColors",&mUseAppColors,false);
233 221
234 222
235 223
236 KPrefs::setCurrentGroup("Views"); 224 KPrefs::setCurrentGroup("Views");
237 addItemInt("Hour Size",&mHourSize,8); 225 addItemInt("Hour Size",&mHourSize,8);
238 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 226 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
239 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 227 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
240 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 228 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
241 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 229 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
242 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 230 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
243 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 231 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
244 addItemBool("Enable ToolTips",&mEnableToolTips,false); 232 addItemBool("Enable ToolTips",&mEnableToolTips,false);
245 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 233 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
246 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 234 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
247 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 235 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
248 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 236 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
249 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 237 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
250 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 238 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
251 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 239 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
252 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 240 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
253 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 241 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
254 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 242 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
255 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 243 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
256 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 244 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
257 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 245 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
258 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 246 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
259 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 247 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
260 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 248 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
261 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 249 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
262 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 250 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
263#ifdef DESKTOP_VERSION 251#ifdef DESKTOP_VERSION
264 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 252 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
265#else 253#else
266 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 254 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
267#endif 255#endif
268 addItemInt("Day Begins",&mDayBegins,7); 256 addItemInt("Day Begins",&mDayBegins,7);
269 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 257 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
270 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 258 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
271 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 259 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
272 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 260 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
273 261
274 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 262 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
275 addItemBool("Full View Month",&mFullViewMonth,true); 263 addItemBool("Full View Month",&mFullViewMonth,true);
276 addItemBool("Full View Todo",&mFullViewTodo,true); 264 addItemBool("Full View Todo",&mFullViewTodo,true);
277 addItemBool("Quick Todo",&mEnableQuickTodo,false); 265 addItemBool("Quick Todo",&mEnableQuickTodo,false);
278 266
279 addItemInt("Next X Days",&mNextXDays,3); 267 addItemInt("Next X Days",&mNextXDays,3);
280 268
281 KPrefs::setCurrentGroup("Printer"); 269 KPrefs::setCurrentGroup("Printer");
282 270
283 KPrefs::setCurrentGroup("Layout"); 271 KPrefs::setCurrentGroup("Layout");
284 272
285 addItemBool("CompactDialogs",&mCompactDialogs,false); 273 addItemBool("CompactDialogs",&mCompactDialogs,false);
286 addItemBool("VerticalScreen",&mVerticalScreen,true); 274 addItemBool("VerticalScreen",&mVerticalScreen,true);
287 275
288 KPrefs::setCurrentGroup("KOrganizer Plugins"); 276 KPrefs::setCurrentGroup("KOrganizer Plugins");
289 277
290 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 278 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
291 279
292 KPrefs::setCurrentGroup("Group Scheduling"); 280 KPrefs::setCurrentGroup("Group Scheduling");
293 281
294 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 282 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
295 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 283 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
296 addItemStringList("AdditionalMails",&mAdditionalMails,""); 284 addItemStringList("AdditionalMails",&mAdditionalMails,"");
297 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 285 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
298 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 286 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
299 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 287 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
300 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 288 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
301 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 289 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
302 290
303 KPrefs::setCurrentGroup( "Editors" ); 291 KPrefs::setCurrentGroup( "Editors" );
304 292
305 addItemStringList( "EventTemplates", &mEventTemplates ); 293 addItemStringList( "EventTemplates", &mEventTemplates );
306 addItemStringList( "TodoTemplates", &mTodoTemplates ); 294 addItemStringList( "TodoTemplates", &mTodoTemplates );
307 295
308 addItemInt("DestinationPolicy",&mDestination,standardDestination); 296 addItemInt("DestinationPolicy",&mDestination,standardDestination);
309 297
310 298
311 299
312} 300}
313 301
314 302
315KOPrefs::~KOPrefs() 303KOPrefs::~KOPrefs()
316{ 304{
317 if (mInstance == this) 305 if (mInstance == this)
318 mInstance = insd.setObject(0); 306 mInstance = insd.setObject(0);
319 setLocaleDict( 0 ); 307
320 if ( mLocaleDict )
321 delete mLocaleDict;
322 //qDebug("KOPrefs::~KOPrefs() "); 308 //qDebug("KOPrefs::~KOPrefs() ");
323} 309}
324 310
325 311
326KOPrefs *KOPrefs::instance() 312KOPrefs *KOPrefs::instance()
327{ 313{
328 if (!mInstance) { 314 if (!mInstance) {
329 mInstance = insd.setObject(new KOPrefs()); 315 mInstance = insd.setObject(new KOPrefs());
330 mInstance->readConfig(); 316 mInstance->readConfig();
331 } 317 }
332 318
333 return mInstance; 319 return mInstance;
334} 320}
335 321
336void KOPrefs::usrSetDefaults() 322void KOPrefs::usrSetDefaults()
337{ 323{
338 324
339} 325}
340 326
341void KOPrefs::fillMailDefaults() 327void KOPrefs::fillMailDefaults()
342{ 328{
343 if (mName.isEmpty()) mName = i18n("Anonymous"); 329 if (mName.isEmpty()) mName = i18n("Anonymous");
344 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 330 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
345} 331}
346 332
347void KOPrefs::setTimeZoneIdDefault() 333void KOPrefs::setTimeZoneIdDefault()
348{ 334{
349 ; 335 ;
350} 336}
351 337
352void KOPrefs::setCategoryDefaults() 338void KOPrefs::setCategoryDefaults()
353{ 339{
354 mCustomCategories.clear(); 340 mCustomCategories.clear();
355 mCustomCategories = getDefaultList(); 341 mCustomCategories = getDefaultList();
356 342
357 QStringList::Iterator it; 343 QStringList::Iterator it;
358 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 344 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
359 setCategoryColor(*it,mDefaultCategoryColor); 345 setCategoryColor(*it,mDefaultCategoryColor);
360 } 346 }
361} 347}
362 348
363QStringList KOPrefs::getDefaultList() 349QStringList KOPrefs::getDefaultList()
364{ 350{
365 QStringList retval ; 351 QStringList retval ;
366 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 352 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
367 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 353 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
368 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 354 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
369 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 355 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
370 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 356 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
371 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 357 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
372 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 358 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
373 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 359 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
374 retval.sort(); 360 retval.sort();
375 return retval; 361 return retval;
376} 362}
377 363
378void KOPrefs::usrReadConfig() 364void KOPrefs::usrReadConfig()
379{ 365{
380 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
381 mLocaleDict = 0;
382 // pending LR fix translation
383 // qDebug("KOPrefs::usrReadConfig() fix translation ");
384 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
385 if ( mPreferredLanguage == 1 ) {
386 mLocaleDict = new QDict<QString>;
387 int i = 0;
388 QString fw ( germanwords[i] [0]);
389 while ( !fw.isEmpty() ) {
390 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
391 ++i;
392 fw = germanwords[i] [0];
393 }
394
395 setLocaleDict( mLocaleDict );
396 } else {
397 QString fileName ;
398 if ( mPreferredLanguage == 4 )
399 fileName = MainWindow::resourcePath()+"usertranslation.txt";
400 else if ( mPreferredLanguage == 2 )
401 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
402 else if ( mPreferredLanguage == 3 )
403 fileName = MainWindow::resourcePath()+"italiantranslation.txt";
404 QFile file( fileName );
405 if (file.open( IO_ReadOnly ) ) {
406 QTextStream ts( &file );
407 ts.setEncoding( QTextStream::Latin1 );
408 //ts.setCodec( QTextCodec::latin1 );
409 QString text = ts.read();
410 file.close();
411 text.replace( QRegExp("\\\\n"), "\n" );
412 QString line;
413 QString we;
414 QString wt;
415 int br = 0;
416 int nbr;
417 nbr = text.find ( "},", br );
418 line = text.mid( br, nbr - br );
419 br = nbr+1;
420 int se, ee, st, et;
421 mLocaleDict = new QDict<QString>;
422 QString end = "{ \"\",\"\" }";
423 while ( (line != end) && (br > 1) ) {
424 //qDebug("%d *%s* ", br, line.latin1());
425 se = line.find("\"")+1;
426 et = line.findRev("\"",-1);
427 ee = line.find("\",\"");
428 st = ee+3;
429 we = line.mid( se, ee-se );
430 wt = line.mid( st, et-st );
431 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
432 mLocaleDict->insert( we, new QString (wt) );
433 nbr = text.find ( "}", br );
434 line = text.mid( br, nbr - br );
435 br = nbr+1;
436 }
437 //qDebug("end *%s* ", end.latin1());
438
439 setLocaleDict( mLocaleDict );
440 } else {
441 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
442 }
443
444 }
445 }
446 config()->setGroup("General"); 366 config()->setGroup("General");
447 367
448 mCustomCategories = config()->readListEntry("Custom Categories"); 368 mCustomCategories = config()->readListEntry("Custom Categories");
449 if ( KOPrefs::instance()->mLanguageChanged ) { 369 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) {
450 mLocationDefaults.clear(); 370 mLocationDefaults.clear();
451 mEventSummaryUser.clear(); 371 mEventSummaryUser.clear();
452 mTodoSummaryUser.clear(); 372 mTodoSummaryUser.clear();
453 } 373 }
374 mOldLoadedLanguage = mOldLanguage ;
375 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
454 if (mLocationDefaults.isEmpty()) { 376 if (mLocationDefaults.isEmpty()) {
455 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 377 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
456 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 378 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
457 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 379 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
458 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 380 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
459 mLocationDefaults.sort(); 381 mLocationDefaults.sort();
460 } 382 }
461 383
462 if (mEventSummaryUser.isEmpty()) { 384 if (mEventSummaryUser.isEmpty()) {
463 mEventSummaryUser = getDefaultList() ; 385 mEventSummaryUser = getDefaultList() ;
464 } 386 }
465 if (mTodoSummaryUser.isEmpty()) { 387 if (mTodoSummaryUser.isEmpty()) {
466 mTodoSummaryUser = getDefaultList() ; 388 mTodoSummaryUser = getDefaultList() ;
467 } 389 }
468 390
469 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 391 if (mCustomCategories.isEmpty()) setCategoryDefaults();
470 392
471 config()->setGroup("Personal Settings"); 393 config()->setGroup("Personal Settings");
472 mName = config()->readEntry("user_name",""); 394 mName = config()->readEntry("user_name","");
473 mEmail = config()->readEntry("user_email",""); 395 mEmail = config()->readEntry("user_email","");
474 fillMailDefaults(); 396 fillMailDefaults();
475 397
476 config()->setGroup("Category Colors"); 398 config()->setGroup("Category Colors");
477 QStringList::Iterator it; 399 QStringList::Iterator it;
478 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 400 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
479 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 401 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
480 402
481 } 403 }
482 404
483 KPimPrefs::usrReadConfig(); 405 KPimPrefs::usrReadConfig();
484} 406}
485 407
486 408
487void KOPrefs::usrWriteConfig() 409void KOPrefs::usrWriteConfig()
488{ 410{
489 config()->setGroup("General"); 411 config()->setGroup("General");
490 config()->writeEntry("Custom Categories",mCustomCategories); 412 config()->writeEntry("Custom Categories",mCustomCategories);
491 413
492 config()->setGroup("Personal Settings"); 414 config()->setGroup("Personal Settings");
493 config()->writeEntry("user_name",mName); 415 config()->writeEntry("user_name",mName);
494 config()->writeEntry("user_email",mEmail); 416 config()->writeEntry("user_email",mEmail);
495 417
496 config()->setGroup("Category Colors"); 418 config()->setGroup("Category Colors");
497 QDictIterator<QColor> it(mCategoryColors); 419 QDictIterator<QColor> it(mCategoryColors);
498 while (it.current()) { 420 while (it.current()) {
499 config()->writeEntry(it.currentKey(),*(it.current())); 421 config()->writeEntry(it.currentKey(),*(it.current()));
500 ++it; 422 ++it;
501 } 423 }
502 424
503 425
504 KPimPrefs::usrWriteConfig(); 426 KPimPrefs::usrWriteConfig();
505} 427}
506 428
507void KOPrefs::setCategoryColor(QString cat,const QColor & color) 429void KOPrefs::setCategoryColor(QString cat,const QColor & color)
508{ 430{
509 mCategoryColors.replace(cat,new QColor(color)); 431 mCategoryColors.replace(cat,new QColor(color));
510} 432}
511 433
512QColor *KOPrefs::categoryColor(QString cat) 434QColor *KOPrefs::categoryColor(QString cat)
513{ 435{
514 QColor *color = 0; 436 QColor *color = 0;
515 437
516 if (!cat.isEmpty()) color = mCategoryColors[cat]; 438 if (!cat.isEmpty()) color = mCategoryColors[cat];
517 439
518 if (color) return color; 440 if (color) return color;
519 else return &mDefaultCategoryColor; 441 else return &mDefaultCategoryColor;
520} 442}
521 443
522void KOPrefs::setFullName(const QString &name) 444void KOPrefs::setFullName(const QString &name)
523{ 445{
524 mName = name; 446 mName = name;
525} 447}
526 448
527void KOPrefs::setEmail(const QString &email) 449void KOPrefs::setEmail(const QString &email)
528{ 450{
529 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 451 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
530 mEmail = email; 452 mEmail = email;
531} 453}
532 454
533QString KOPrefs::fullName() 455QString KOPrefs::fullName()
534{ 456{
535 if (mEmailControlCenter) { 457 if (mEmailControlCenter) {
536 KEMailSettings settings; 458 KEMailSettings settings;
537 return settings.getSetting(KEMailSettings::RealName); 459 return settings.getSetting(KEMailSettings::RealName);
538 } else { 460 } else {
539 return mName; 461 return mName;
540 } 462 }
541} 463}
542 464
543QString KOPrefs::email() 465QString KOPrefs::email()
544{ 466{
545 if (mEmailControlCenter) { 467 if (mEmailControlCenter) {
546 KEMailSettings settings; 468 KEMailSettings settings;
547 return settings.getSetting(KEMailSettings::EmailAddress); 469 return settings.getSetting(KEMailSettings::EmailAddress);
548 } else { 470 } else {
549 return mEmail; 471 return mEmail;
550 } 472 }
551} 473}
552KConfig* KOPrefs::getConfig() 474KConfig* KOPrefs::getConfig()
553{ 475{
554 return config(); 476 return config();
555} 477}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,283 +1,273 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,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#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26#include <qdict.h>
27 26
28#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class KOPrefs : public KPimPrefs
36{ 36{
37 public: 37 public:
38 enum { FormatVCalendar, FormatICalendar }; 38 enum { FormatVCalendar, FormatICalendar };
39 enum { MailClientKMail, MailClientSendmail }; 39 enum { MailClientKMail, MailClientSendmail };
40 enum { IMIPDummy, IMIPKMail }; 40 enum { IMIPDummy, IMIPKMail };
41 enum { IMIPOutbox, IMIPdirectsend }; 41 enum { IMIPOutbox, IMIPdirectsend };
42 enum { neverAuto, addressbookAuto, selectedAuto }; 42 enum { neverAuto, addressbookAuto, selectedAuto };
43 enum { standardDestination, askDestination }; 43 enum { standardDestination, askDestination };
44 44
45 virtual ~KOPrefs(); 45 virtual ~KOPrefs();
46 46
47 /** Get instance of KOPrefs. It is made sure that there is only one 47 /** Get instance of KOPrefs. It is made sure that there is only one
48 instance. */ 48 instance. */
49 static KOPrefs *instance(); 49 static KOPrefs *instance();
50 50
51 /** Set preferences to default values */ 51 /** Set preferences to default values */
52 void usrSetDefaults(); 52 void usrSetDefaults();
53 53
54 /** Read preferences from config file */ 54 /** Read preferences from config file */
55 void usrReadConfig(); 55 void usrReadConfig();
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 60
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
69 object. */ 69 object. */
70 KOPrefs(); 70 KOPrefs();
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QDict<QString> *mLocaleDict;
74 QStringList getDefaultList(); 73 QStringList getDefaultList();
75 public: 74 public:
76 // preferences data 75 // preferences data
77 KConfig* getConfig(); 76 KConfig* getConfig();
78 void setFullName(const QString &); 77 void setFullName(const QString &);
79 QString fullName(); 78 QString fullName();
80 void setEmail(const QString &); 79 void setEmail(const QString &);
81 QString email(); 80 QString email();
82 81
83 QString mAdditional; 82 QString mAdditional;
84 83
85 bool mEmailControlCenter; 84 bool mEmailControlCenter;
86 85
87 bool mBcc; 86 bool mBcc;
88 bool mAutoSave; 87 bool mAutoSave;
89 int mAutoSaveInterval; 88 int mAutoSaveInterval;
90 bool mConfirm; 89 bool mConfirm;
91 90
92 bool mEnableGroupScheduling; 91 bool mEnableGroupScheduling;
93 bool mEnableProjectView; 92 bool mEnableProjectView;
94 93
95 int mDefaultFormat; 94 int mDefaultFormat;
96 int mMailClient; 95 int mMailClient;
97 96
98 int mStartTime; 97 int mStartTime;
99 int mDefaultDuration; 98 int mDefaultDuration;
100 int mAlarmTime; 99 int mAlarmTime;
101 100
102 int mWorkingHoursStart; 101 int mWorkingHoursStart;
103 int mWorkingHoursEnd; 102 int mWorkingHoursEnd;
104 bool mExcludeHolidays; 103 bool mExcludeHolidays;
105 bool mExcludeSaturdays; 104 bool mExcludeSaturdays;
106 bool mMarcusBainsShowSeconds; 105 bool mMarcusBainsShowSeconds;
107 106
108 QFont mTimeBarFont; 107 QFont mTimeBarFont;
109 QFont mMonthViewFont; 108 QFont mMonthViewFont;
110 QFont mAgendaViewFont; 109 QFont mAgendaViewFont;
111 QFont mMarcusBainsFont; 110 QFont mMarcusBainsFont;
112 QFont mTimeLabelsFont; 111 QFont mTimeLabelsFont;
113 QFont mTodoViewFont; 112 QFont mTodoViewFont;
114 QFont mListViewFont; 113 QFont mListViewFont;
115 QFont mDateNavigatorFont; 114 QFont mDateNavigatorFont;
116 QFont mEditBoxFont; 115 QFont mEditBoxFont;
117 QFont mJornalViewFont; 116 QFont mJornalViewFont;
118 QFont mWhatsNextFont; 117 QFont mWhatsNextFont;
119 QFont mEventViewFont; 118 QFont mEventViewFont;
120 119
121 120
122 121
123 122
124 QColor mHolidayColor; 123 QColor mHolidayColor;
125 QColor mHighlightColor; 124 QColor mHighlightColor;
126 QColor mEventColor; 125 QColor mEventColor;
127 QColor mAgendaBgColor; 126 QColor mAgendaBgColor;
128 QColor mWorkingHoursColor; 127 QColor mWorkingHoursColor;
129 QColor mTodoDueTodayColor; 128 QColor mTodoDueTodayColor;
130 QColor mTodoOverdueColor; 129 QColor mTodoOverdueColor;
131 QColor mMonthViewEvenColor; 130 QColor mMonthViewEvenColor;
132 QColor mMonthViewOddColor; 131 QColor mMonthViewOddColor;
133 QColor mMonthViewHolidayColor; 132 QColor mMonthViewHolidayColor;
134 bool mMonthViewUsesDayColors; 133 bool mMonthViewUsesDayColors;
135 bool mMonthViewSatSunTog; 134 bool mMonthViewSatSunTog;
136 QColor mAppColor1; 135 QColor mAppColor1;
137 QColor mAppColor2; 136 QColor mAppColor2;
138 bool mUseAppColors; 137 bool mUseAppColors;
139 138
140 int mDayBegins; 139 int mDayBegins;
141 int mHourSize; 140 int mHourSize;
142 int mAllDaySize; 141 int mAllDaySize;
143 bool mShowFullMenu; 142 bool mShowFullMenu;
144 bool mDailyRecur; 143 bool mDailyRecur;
145 bool mWeeklyRecur; 144 bool mWeeklyRecur;
146 bool mMonthDailyRecur; 145 bool mMonthDailyRecur;
147 bool mMonthWeeklyRecur; 146 bool mMonthWeeklyRecur;
148 bool mMonthShowIcons; 147 bool mMonthShowIcons;
149 bool mMonthShowShort; 148 bool mMonthShowShort;
150 bool mEnableToolTips; 149 bool mEnableToolTips;
151 bool mEnableMonthScroll; 150 bool mEnableMonthScroll;
152 bool mFullViewMonth; 151 bool mFullViewMonth;
153 bool mMonthViewUsesCategoryColor; 152 bool mMonthViewUsesCategoryColor;
154 bool mFullViewTodo; 153 bool mFullViewTodo;
155 bool mShowCompletedTodo; 154 bool mShowCompletedTodo;
156 bool mMarcusBainsEnabled; 155 bool mMarcusBainsEnabled;
157 int mNextXDays; 156 int mNextXDays;
158 int mWhatsNextDays; 157 int mWhatsNextDays;
159 int mWhatsNextPrios; 158 int mWhatsNextPrios;
160 bool mEnableQuickTodo; 159 bool mEnableQuickTodo;
161 bool mLanguageChanged;
162 160
163 bool mCompactDialogs; 161 bool mCompactDialogs;
164 bool mVerticalScreen; 162 bool mVerticalScreen;
165 163
166 bool mShowIconNewTodo; 164 bool mShowIconNewTodo;
167 bool mShowIconNewEvent; 165 bool mShowIconNewEvent;
168 bool mShowIconSearch; 166 bool mShowIconSearch;
169 bool mShowIconList; 167 bool mShowIconList;
170 bool mShowIconDay1; 168 bool mShowIconDay1;
171 bool mShowIconDay5; 169 bool mShowIconDay5;
172 bool mShowIconDay7; 170 bool mShowIconDay7;
173 bool mShowIconMonth; 171 bool mShowIconMonth;
174 bool mShowIconTodoview; 172 bool mShowIconTodoview;
175 bool mShowIconBackFast; 173 bool mShowIconBackFast;
176 bool mShowIconBack; 174 bool mShowIconBack;
177 bool mShowIconToday; 175 bool mShowIconToday;
178 bool mShowIconForward; 176 bool mShowIconForward;
179 bool mShowIconForwardFast; 177 bool mShowIconForwardFast;
180 bool mShowIconWhatsThis; 178 bool mShowIconWhatsThis;
181 bool mShowIconNextDays; 179 bool mShowIconNextDays;
182 bool mShowIconNext; 180 bool mShowIconNext;
183 bool mShowIconJournal; 181 bool mShowIconJournal;
184 182
185 bool mShowIconStretch; 183 bool mShowIconStretch;
186 184
187 bool mToolBarHor; 185 bool mToolBarHor;
188 bool mToolBarUp; 186 bool mToolBarUp;
189 bool mToolBarMiniIcons; 187 bool mToolBarMiniIcons;
190 188
191 bool mAskForQuit; 189 bool mAskForQuit;
192 bool mUsePassWd; 190 bool mUsePassWd;
193 bool mShowSyncEvents; 191 bool mShowSyncEvents;
194 bool mShowTodoInAgenda; 192 bool mShowTodoInAgenda;
195 193
196 int mLastSyncTime; 194 int mLastSyncTime;
197 void setCategoryColor(QString cat,const QColor & color); 195 void setCategoryColor(QString cat,const QColor & color);
198 QColor *categoryColor(QString cat); 196 QColor *categoryColor(QString cat);
199 197
200 QString mArchiveFile; 198 QString mArchiveFile;
201 QString mHtmlExportFile; 199 QString mHtmlExportFile;
202 bool mHtmlWithSave; 200 bool mHtmlWithSave;
203 201
204 QStringList mSelectedPlugins; 202 QStringList mSelectedPlugins;
205 203
206 QString mLastImportFile; 204 QString mLastImportFile;
207 QString mLastVcalFile; 205 QString mLastVcalFile;
208 QString mLastSaveFile; 206 QString mLastSaveFile;
209 QString mLastLoadFile; 207 QString mLastLoadFile;
210 208
211 209
212 QString mDefaultAlarmFile; 210 QString mDefaultAlarmFile;
213 int mIMIPScheduler; 211 int mIMIPScheduler;
214 int mIMIPSend; 212 int mIMIPSend;
215 QStringList mAdditionalMails; 213 QStringList mAdditionalMails;
216 int mIMIPAutoRefresh; 214 int mIMIPAutoRefresh;
217 int mIMIPAutoInsertReply; 215 int mIMIPAutoInsertReply;
218 int mIMIPAutoInsertRequest; 216 int mIMIPAutoInsertRequest;
219 int mIMIPAutoFreeBusy; 217 int mIMIPAutoFreeBusy;
220 int mIMIPAutoFreeBusyReply; 218 int mIMIPAutoFreeBusyReply;
221 219
222 QStringList mTodoTemplates; 220 QStringList mTodoTemplates;
223 QStringList mEventTemplates; 221 QStringList mEventTemplates;
224 222
225 int mDestination; 223 int mDestination;
226 224
227 225
228 bool mEditOnDoubleClick; 226 bool mEditOnDoubleClick;
229 bool mViewChangeHoldFullscreen; 227 bool mViewChangeHoldFullscreen;
230 bool mViewChangeHoldNonFullscreen; 228 bool mViewChangeHoldNonFullscreen;
231 bool mCenterOnCurrentTime; 229 bool mCenterOnCurrentTime;
232 bool mSetTimeToDayStartAt; 230 bool mSetTimeToDayStartAt;
233 bool mHighlightCurrentDay; 231 bool mHighlightCurrentDay;
234 bool mUseHighlightLightColor; 232 bool mUseHighlightLightColor;
235 bool mListViewMonthTimespan; 233 bool mListViewMonthTimespan;
236 bool mWNViewShowsParents; 234 bool mWNViewShowsParents;
237 bool mWNViewShowLocation; 235 bool mWNViewShowLocation;
238 bool mTodoViewShowsPercentage; 236 bool mTodoViewShowsPercentage;
239 bool mTodoViewUsesCatColors; 237 bool mTodoViewUsesCatColors;
240 bool mTodoViewUsesSmallFont; 238 bool mTodoViewUsesSmallFont;
241 bool mTodoViewUsesForegroundColor; 239 bool mTodoViewUsesForegroundColor;
242 bool mMonthViewUsesForegroundColor; 240 bool mMonthViewUsesForegroundColor;
243 241
244 bool mHightlightDateTimeEdit; 242 bool mHightlightDateTimeEdit;
245 bool mShortDateInViewer; 243 bool mShortDateInViewer;
246 244
247 QStringList mLocationDefaults; 245 QStringList mLocationDefaults;
248 QStringList mEventSummaryUser; 246 QStringList mEventSummaryUser;
249 QStringList mTodoSummaryUser; 247 QStringList mTodoSummaryUser;
250 248
251 bool mUseInternalAlarmNotification; 249 bool mUseInternalAlarmNotification;
252 int mAlarmPlayBeeps; 250 int mAlarmPlayBeeps;
253 int mAlarmSuspendTime; 251 int mAlarmSuspendTime;
254 int mAlarmSuspendCount; 252 int mAlarmSuspendCount;
255 int mAlarmBeepInterval; 253 int mAlarmBeepInterval;
254 int mOldLanguage;
255 int mOldLoadedLanguage;
256 256
257 257
258 QString mActiveSyncPort; 258 QString mActiveSyncPort;
259 QString mActiveSyncIP; 259 QString mActiveSyncIP;
260 260
261
262 //US I copied the following settings into KPimGlobalPrefs
263 // that allows us later to easily remove the settings from here.
264 int mPreferredDate;
265 QString mUserDateFormatLong;
266 QString mUserDateFormatShort;
267 int mPreferredLanguage;
268 int mPreferredTime;
269 bool mWeekStartsOnSunday;
270
271 private: 261 private:
272 QDict<QColor> mCategoryColors; 262 QDict<QColor> mCategoryColors;
273 QColor mDefaultCategoryColor; 263 QColor mDefaultCategoryColor;
274 264
275 QFont mDefaultTimeBarFont; 265 QFont mDefaultTimeBarFont;
276 QFont mDefaultViewFont; 266 QFont mDefaultViewFont;
277 QFont mDefaultMonthViewFont; 267 QFont mDefaultMonthViewFont;
278 268
279 QString mName; 269 QString mName;
280 QString mEmail; 270 QString mEmail;
281}; 271};
282 272
283#endif 273#endif
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -1,527 +1,528 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown, Ian Dawes 3 Copyright (c) 1999 Preston Brown, Ian Dawes
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 <qkeycode.h> 24#include <qkeycode.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qapplication.h> 28#include <qapplication.h>
29 29
30#include <kmessagebox.h> 30#include <kmessagebox.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kpimglobalprefs.h>
34 35
35#include "ktimeedit.h" 36#include "ktimeedit.h"
36#include "koprefs.h" 37#include "koprefs.h"
37#include <qvalidator.h> 38#include <qvalidator.h>
38 39
39// Validator for a time value with only hours and minutes (no seconds) 40// Validator for a time value with only hours and minutes (no seconds)
40// Mostly locale aware. Author: David Faure <faure@kde.org> 41// Mostly locale aware. Author: David Faure <faure@kde.org>
41class KOTimeValidator : public QValidator 42class KOTimeValidator : public QValidator
42{ 43{
43public: 44public:
44 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} 45 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {}
45 46
46 virtual State validate(QString& str, int& /*cursorPos*/) const 47 virtual State validate(QString& str, int& /*cursorPos*/) const
47 { 48 {
48 return Acceptable; 49 return Acceptable;
49 bool ok = false; 50 bool ok = false;
50 // TODO use KLocale::WithoutSeconds in HEAD 51 // TODO use KLocale::WithoutSeconds in HEAD
51 /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); 52 /*QTime time =*/ KGlobal::locale()->readTime(str, &ok);
52 if ( ok ) 53 if ( ok )
53 return Acceptable; 54 return Acceptable;
54 // readTime doesn't help knowing when the string is "Intermediate". 55 // readTime doesn't help knowing when the string is "Intermediate".
55 int length = str.length(); 56 int length = str.length();
56 if ( !str ) // empty string? 57 if ( !str ) // empty string?
57 return Invalid; // there should always be a ':' in it, right? 58 return Invalid; // there should always be a ':' in it, right?
58 // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...) 59 // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...)
59 QChar sep = ':'; 60 QChar sep = ':';
60 // I want to allow "HH:", ":MM" and ":" to make editing easier 61 // I want to allow "HH:", ":MM" and ":" to make editing easier
61 if ( str[0] == sep ) 62 if ( str[0] == sep )
62 { 63 {
63 if ( length == 1 ) // just ":" 64 if ( length == 1 ) // just ":"
64 return Intermediate; 65 return Intermediate;
65 QString minutes = str.mid(1); 66 QString minutes = str.mid(1);
66 int m = minutes.toInt(&ok); 67 int m = minutes.toInt(&ok);
67 if ( ok && m >= 0 && m < 60 ) 68 if ( ok && m >= 0 && m < 60 )
68 return Intermediate; 69 return Intermediate;
69 } else if ( str.at(str.length()-1) == sep ) 70 } else if ( str.at(str.length()-1) == sep )
70 { 71 {
71 QString hours = str.left(length-1); 72 QString hours = str.left(length-1);
72 int h = hours.toInt(&ok); 73 int h = hours.toInt(&ok);
73 if ( ok && h >= 0 && h < 24 ) 74 if ( ok && h >= 0 && h < 24 )
74 return Intermediate; 75 return Intermediate;
75 } 76 }
76 return Invalid; 77 return Invalid;
77 } 78 }
78}; 79};
79 80
80// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. 81// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
81// Difficult to get all in one... 82// Difficult to get all in one...
82// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. 83// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
83KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) 84KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
84 : QComboBox(TRUE, parent, name) 85 : QComboBox(TRUE, parent, name)
85{ 86{
86 setInsertionPolicy(NoInsertion); 87 setInsertionPolicy(NoInsertion);
87 setValidator( new KOTimeValidator( this ) ); 88 setValidator( new KOTimeValidator( this ) );
88 mFlagKeyPressed = false; 89 mFlagKeyPressed = false;
89 90
90 if ( QApplication::desktop()->width() < 650 ) 91 if ( QApplication::desktop()->width() < 650 )
91 setSizeLimit ( 6 ); 92 setSizeLimit ( 6 );
92 mTime = qt; 93 mTime = qt;
93 94
94// mNoTimeString = i18n("No Time"); 95// mNoTimeString = i18n("No Time");
95// insertItem( mNoTimeString ); 96// insertItem( mNoTimeString );
96 97
97 // Fill combo box with selection of times in localized format. 98 // Fill combo box with selection of times in localized format.
98 QTime timeEntry(0,0,0); 99 QTime timeEntry(0,0,0);
99 do { 100 do {
100 insertItem(KGlobal::locale()->formatTime(timeEntry)); 101 insertItem(KGlobal::locale()->formatTime(timeEntry));
101 timeEntry = timeEntry.addSecs(60*15); 102 timeEntry = timeEntry.addSecs(60*15);
102 } while (!timeEntry.isNull()); 103 } while (!timeEntry.isNull());
103 // Add end of day. 104 // Add end of day.
104 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); 105 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
105 106
106 updateText(); 107 updateText();
107 setFocusPolicy(QWidget::StrongFocus); 108 setFocusPolicy(QWidget::StrongFocus);
108 109
109 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); 110 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
110 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); 111 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
111 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); 112 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
112 QFontMetrics fm ( font() ); 113 QFontMetrics fm ( font() );
113 QString timeString = "24:00"; 114 QString timeString = "24:00";
114 if ( KOPrefs::instance()->mPreferredTime == 1 ) 115 if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
115 timeString = "02:00pm"; 116 timeString = "02:00pm";
116 int addSpace = 32; 117 int addSpace = 32;
117 if ( QApplication::desktop()->width() > 320 ) 118 if ( QApplication::desktop()->width() > 320 )
118 timeString += ":00"; 119 timeString += ":00";
119 setFixedWidth(fm.width( timeString ) + 32 ); 120 setFixedWidth(fm.width( timeString ) + 32 );
120 121
121 // Highlight Background and Textcolor change from default 122 // Highlight Background and Textcolor change from default
122 QPalette palette = QWidget::palette(); 123 QPalette palette = QWidget::palette();
123 unsigned char red, green, blue; 124 unsigned char red, green, blue;
124 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 125 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
125 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 126 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
126 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 127 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
127 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); 128 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
128 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); 129 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
129 setPalette( palette ); 130 setPalette( palette );
130} 131}
131 132
132KOTimeEdit::~KOTimeEdit() 133KOTimeEdit::~KOTimeEdit()
133{ 134{
134} 135}
135 136
136bool KOTimeEdit::hasTime() const 137bool KOTimeEdit::hasTime() const
137{ 138{
138 // Can't happen 139 // Can't happen
139 if ( currentText().isEmpty() ) return false; 140 if ( currentText().isEmpty() ) return false;
140 //if ( currentText() == mNoTimeString ) return false; 141 //if ( currentText() == mNoTimeString ) return false;
141 142
142 return true; // always 143 return true; // always
143} 144}
144 145
145QTime KOTimeEdit::getTime() const 146QTime KOTimeEdit::getTime() const
146{ 147{
147 //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl; 148 //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl;
148 // TODO use KLocale::WithoutSeconds in HEAD 149 // TODO use KLocale::WithoutSeconds in HEAD
149 QTime time = KGlobal::locale()->readTime(currentText()); 150 QTime time = KGlobal::locale()->readTime(currentText());
150 // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl; 151 // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl;
151 return time; 152 return time;
152} 153}
153/* 154/*
154QSizePolicy KOTimeEdit::sizePolicy() const 155QSizePolicy KOTimeEdit::sizePolicy() const
155{ 156{
156 // Set size policy to Fixed, because edit cannot contain more text than the 157 // Set size policy to Fixed, because edit cannot contain more text than the
157 // string representing the time. It doesn't make sense to provide more space. 158 // string representing the time. It doesn't make sense to provide more space.
158 QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); 159 QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
159 160
160 return sizePolicy; 161 return sizePolicy;
161} 162}
162*/ 163*/
163void KOTimeEdit::setTime(QTime newTime) 164void KOTimeEdit::setTime(QTime newTime)
164{ 165{
165 if ( mTime != newTime ) 166 if ( mTime != newTime )
166 { 167 {
167 kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl; 168 kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl;
168 169
169 mTime = newTime; 170 mTime = newTime;
170 updateText(); 171 updateText();
171 } 172 }
172 173
173} 174}
174 175
175void KOTimeEdit::activ(int i) 176void KOTimeEdit::activ(int i)
176{ 177{
177 // The last entry, 23:59, is a special case 178 // The last entry, 23:59, is a special case
178 if( i == count() - 1 ) 179 if( i == count() - 1 )
179 mTime = QTime( 23, 59, 0 ); 180 mTime = QTime( 23, 59, 0 );
180 else 181 else
181 mTime = QTime(0,0,0).addSecs(i*15*60); 182 mTime = QTime(0,0,0).addSecs(i*15*60);
182 emit timeChanged(mTime); 183 emit timeChanged(mTime);
183} 184}
184 185
185void KOTimeEdit::hilit(int ) 186void KOTimeEdit::hilit(int )
186{ 187{
187 // we don't currently need to do anything here. 188 // we don't currently need to do anything here.
188} 189}
189 190
190void KOTimeEdit::addTime(QTime qt, bool update) 191void KOTimeEdit::addTime(QTime qt, bool update)
191{ 192{
192 // Calculate the new time. 193 // Calculate the new time.
193 //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); 194 //qDebug("add h %d min %d ", qt.hour(),qt.minute() );
194 mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); 195 mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600);
195 // if ( update ) 196 // if ( update )
196 updateText(); 197 updateText();
197 emit timeChanged(mTime); 198 emit timeChanged(mTime);
198} 199}
199 200
200void KOTimeEdit::subTime(QTime qt, bool update) 201void KOTimeEdit::subTime(QTime qt, bool update)
201{ 202{
202 int h, m; 203 int h, m;
203 //qDebug("sub h %d min %d ", qt.hour(),qt.minute() ); 204 //qDebug("sub h %d min %d ", qt.hour(),qt.minute() );
204 205
205 mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600)); 206 mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600));
206 // store the newly calculated time. 207 // store the newly calculated time.
207 // mTime.setHMS(h, m, 0); 208 // mTime.setHMS(h, m, 0);
208 //if ( update ) 209 //if ( update )
209 updateText(); 210 updateText();
210 emit timeChanged(mTime); 211 emit timeChanged(mTime);
211} 212}
212 213
213// void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * ) 214// void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * )
214// { 215// {
215// qDebug("mouseReleaseEvent ( QMouseEvent * ) "); 216// qDebug("mouseReleaseEvent ( QMouseEvent * ) ");
216// } 217// }
217 218
218// void KOTimeEdit::focusInEvent ( QFocusEvent * ) 219// void KOTimeEdit::focusInEvent ( QFocusEvent * )
219// { 220// {
220// qDebug("focusInEvent ( QFocusEvent * ) "); 221// qDebug("focusInEvent ( QFocusEvent * ) ");
221// } 222// }
222 223
223void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) 224void KOTimeEdit::keyReleaseEvent(QKeyEvent *e)
224{ 225{
225 if ( !e->isAutoRepeat() ) { 226 if ( !e->isAutoRepeat() ) {
226 mFlagKeyPressed = false; 227 mFlagKeyPressed = false;
227 } 228 }
228 229
229} 230}
230void KOTimeEdit::setSelect( int from, int to ) 231void KOTimeEdit::setSelect( int from, int to )
231{ 232{
232 if ( KOPrefs::instance()->mHightlightDateTimeEdit) 233 if ( KOPrefs::instance()->mHightlightDateTimeEdit)
233 lineEdit()->setSelection( from , to ); 234 lineEdit()->setSelection( from , to );
234} 235}
235 236
236 237
237void KOTimeEdit::keyPressEvent(QKeyEvent *e) 238void KOTimeEdit::keyPressEvent(QKeyEvent *e)
238{ 239{
239 240
240 qApp->processEvents(); 241 qApp->processEvents();
241 bool hour12Format = ( KOPrefs::instance()->mPreferredTime == 1 ); 242 bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 );
242 int maxpos = hour12Format?7:5; 243 int maxpos = hour12Format?7:5;
243 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 244 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
244 e->ignore(); 245 e->ignore();
245 // qDebug(" ignore %d",e->isAutoRepeat() ); 246 // qDebug(" ignore %d",e->isAutoRepeat() );
246 return; 247 return;
247 } 248 }
248 if (! e->isAutoRepeat() ) { 249 if (! e->isAutoRepeat() ) {
249 mFlagKeyPressed = true; 250 mFlagKeyPressed = true;
250 } 251 }
251 // Tap -> Focus Next Widget 252 // Tap -> Focus Next Widget
252 if ( e->key() == Key_Tab ) { 253 if ( e->key() == Key_Tab ) {
253 QComboBox::keyPressEvent(e); 254 QComboBox::keyPressEvent(e);
254 return; 255 return;
255 } 256 }
256 257
257 // save Text from QLineEdit and CursorPosition 258 // save Text from QLineEdit and CursorPosition
258 QString text = lineEdit()->text(); 259 QString text = lineEdit()->text();
259 int cpos = lineEdit()->cursorPosition(); 260 int cpos = lineEdit()->cursorPosition();
260 // qDebug("cpos %d ", cpos); 261 // qDebug("cpos %d ", cpos);
261 262
262 // Switch for arrows, backspace and escape 263 // Switch for arrows, backspace and escape
263 switch(e->key()) { 264 switch(e->key()) {
264 case Key_Escape: 265 case Key_Escape:
265 lineEdit()->deselect(); 266 lineEdit()->deselect();
266 case Key_Tab: 267 case Key_Tab:
267 QComboBox::keyPressEvent(e); 268 QComboBox::keyPressEvent(e);
268 break; 269 break;
269 case Key_Up: 270 case Key_Up:
270 if ( e->state () == Qt::ControlButton ) { 271 if ( e->state () == Qt::ControlButton ) {
271 addTime(QTime(0,15,0), false ); 272 addTime(QTime(0,15,0), false );
272 lineEdit()->setCursorPosition(3); 273 lineEdit()->setCursorPosition(3);
273 setSelect( 3 , 2 ); 274 setSelect( 3 , 2 );
274 } 275 }
275 else 276 else
276 if ( e->state () == Qt::ShiftButton ) { 277 if ( e->state () == Qt::ShiftButton ) {
277 addTime(QTime(1,0,0), false ); 278 addTime(QTime(1,0,0), false );
278 lineEdit()->setCursorPosition(0); 279 lineEdit()->setCursorPosition(0);
279 setSelect( 0 , 2 ); 280 setSelect( 0 , 2 );
280 } 281 }
281 else 282 else
282 // switch time up, cursor location depend 283 // switch time up, cursor location depend
283 switch (cpos) { 284 switch (cpos) {
284 case 7: 285 case 7:
285 case 6: 286 case 6:
286 case 5: 287 case 5:
287 if(!hour12Format) { 288 if(!hour12Format) {
288 lineEdit()->setCursorPosition(cpos = 4); 289 lineEdit()->setCursorPosition(cpos = 4);
289 } else { 290 } else {
290 addTime(QTime(12,0,0), false ); 291 addTime(QTime(12,0,0), false );
291 setSelect ( 5 , 2 ); 292 setSelect ( 5 , 2 );
292 break; 293 break;
293 } 294 }
294 case 4: 295 case 4:
295 addTime(QTime(0,1,0), false ); 296 addTime(QTime(0,1,0), false );
296 setSelect ( cpos , 1 ); 297 setSelect ( cpos , 1 );
297 break; 298 break;
298 case 3: 299 case 3:
299 addTime(QTime(0,10,0), false ); 300 addTime(QTime(0,10,0), false );
300 setSelect ( cpos , 1 ); 301 setSelect ( cpos , 1 );
301 break; 302 break;
302 case 2: 303 case 2:
303 lineEdit()->setCursorPosition(--cpos); 304 lineEdit()->setCursorPosition(--cpos);
304 case 1: 305 case 1:
305 case 0: 306 case 0:
306 addTime(QTime(1,0,0), false ); 307 addTime(QTime(1,0,0), false );
307 setSelect ( 0, 2 ); 308 setSelect ( 0, 2 );
308 break; 309 break;
309 } 310 }
310 break; 311 break;
311 case Key_Down: 312 case Key_Down:
312 if ( e->state () == Qt::ControlButton ) { 313 if ( e->state () == Qt::ControlButton ) {
313 subTime(QTime(0,15,0), false ); 314 subTime(QTime(0,15,0), false );
314 lineEdit()->setCursorPosition(3); 315 lineEdit()->setCursorPosition(3);
315 setSelect( 3 , 2 ); 316 setSelect( 3 , 2 );
316 } 317 }
317 else 318 else
318 if ( e->state () == Qt::ShiftButton ) { 319 if ( e->state () == Qt::ShiftButton ) {
319 subTime(QTime(1,0,0), false ); 320 subTime(QTime(1,0,0), false );
320 lineEdit()->setCursorPosition(0); 321 lineEdit()->setCursorPosition(0);
321 setSelect( 0 , 2 ); 322 setSelect( 0 , 2 );
322 } 323 }
323 else 324 else
324 // switch time down, cursor location depend 325 // switch time down, cursor location depend
325 switch (cpos) { 326 switch (cpos) {
326 case 7: 327 case 7:
327 case 6: 328 case 6:
328 case 5: 329 case 5:
329 if(!hour12Format) { 330 if(!hour12Format) {
330 lineEdit()->setCursorPosition(cpos = 4); 331 lineEdit()->setCursorPosition(cpos = 4);
331 } else { 332 } else {
332 subTime(QTime(12,0,0), false ); 333 subTime(QTime(12,0,0), false );
333 setSelect ( 5 , 2 ); 334 setSelect ( 5 , 2 );
334 break; 335 break;
335 } 336 }
336 case 4: 337 case 4:
337 subTime(QTime(0,1,0), false ); 338 subTime(QTime(0,1,0), false );
338 setSelect ( cpos , 1 ); 339 setSelect ( cpos , 1 );
339 break; 340 break;
340 case 3: 341 case 3:
341 subTime(QTime(0,10,0), false ); 342 subTime(QTime(0,10,0), false );
342 setSelect ( cpos , 1 ); 343 setSelect ( cpos , 1 );
343 break; 344 break;
344 case 2: 345 case 2:
345 lineEdit()->setCursorPosition(--cpos); 346 lineEdit()->setCursorPosition(--cpos);
346 case 1: 347 case 1:
347 case 0: 348 case 0:
348 subTime(QTime(1,0,0), false ); 349 subTime(QTime(1,0,0), false );
349 setSelect ( 0 , 2 ); 350 setSelect ( 0 , 2 );
350 break; 351 break;
351 } 352 }
352 break; 353 break;
353 // set cursor to correct place 354 // set cursor to correct place
354 case Key_Left: 355 case Key_Left:
355 if ( cpos == 3 ) 356 if ( cpos == 3 )
356 --cpos; 357 --cpos;
357 if ( cpos > 0) { 358 if ( cpos > 0) {
358 lineEdit()->setCursorPosition(--cpos); 359 lineEdit()->setCursorPosition(--cpos);
359 setSelect ( cpos , 1 ); 360 setSelect ( cpos , 1 );
360 } 361 }
361 else 362 else
362 setSelect ( 0 , 1 ); 363 setSelect ( 0 , 1 );
363 break; 364 break;
364 // set cursor to correct place 365 // set cursor to correct place
365 case Key_Right: 366 case Key_Right:
366 if ( cpos == 1 ) 367 if ( cpos == 1 )
367 ++cpos; 368 ++cpos;
368 if ( cpos < maxpos ) { 369 if ( cpos < maxpos ) {
369 lineEdit()->setCursorPosition(++cpos); 370 lineEdit()->setCursorPosition(++cpos);
370 setSelect ( cpos , 1 ); 371 setSelect ( cpos , 1 );
371 } 372 }
372 break; 373 break;
373 // rest 374 // rest
374 case Key_Prior: 375 case Key_Prior:
375 subTime(QTime(1,0,0)); 376 subTime(QTime(1,0,0));
376 break; 377 break;
377 case Key_Next: 378 case Key_Next:
378 addTime(QTime(1,0,0)); 379 addTime(QTime(1,0,0));
379 break; 380 break;
380 case Key_Backspace: 381 case Key_Backspace:
381 if ( cpos > 0) { 382 if ( cpos > 0) {
382 if ( cpos == 3 ) 383 if ( cpos == 3 )
383 --cpos; 384 --cpos;
384 if ( cpos > 5) 385 if ( cpos > 5)
385 cpos = 5; 386 cpos = 5;
386 text.at( cpos-1 ) = '0'; 387 text.at( cpos-1 ) = '0';
387 lineEdit()->setText( text ); 388 lineEdit()->setText( text );
388 lineEdit()->setCursorPosition(--cpos); 389 lineEdit()->setCursorPosition(--cpos);
389 setSelect ( cpos , 1 ); 390 setSelect ( cpos , 1 );
390 changedText(); 391 changedText();
391 } 392 }
392 break; 393 break;
393 } // switch arrows 394 } // switch arrows
394 395
395 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos 396 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
396 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { 397 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) {
397 lineEdit()->deselect(); 398 lineEdit()->deselect();
398 cpos = 0; 399 cpos = 0;
399 lineEdit()->setCursorPosition(cpos); 400 lineEdit()->setCursorPosition(cpos);
400 setSelect(cpos , 1); 401 setSelect(cpos , 1);
401 } 402 }
402 403
403 if ( cpos == 2 ) { 404 if ( cpos == 2 ) {
404 lineEdit()->setCursorPosition(++cpos); 405 lineEdit()->setCursorPosition(++cpos);
405 } 406 }
406 407
407 // num keys when cursorPos preEnd 408 // num keys when cursorPos preEnd
408 if ( cpos < 5 ) { 409 if ( cpos < 5 ) {
409 // switch another keys 410 // switch another keys
410 switch(e->key()) { 411 switch(e->key()) {
411 case Key_Delete: 412 case Key_Delete:
412 text.at( cpos ) = '0'; 413 text.at( cpos ) = '0';
413 lineEdit()->setText( text ); 414 lineEdit()->setText( text );
414 lineEdit()->setCursorPosition(cpos); 415 lineEdit()->setCursorPosition(cpos);
415 setSelect ( cpos , 1 ); 416 setSelect ( cpos , 1 );
416 changedText(); 417 changedText();
417 break; 418 break;
418 case Key_9: 419 case Key_9:
419 case Key_8: 420 case Key_8:
420 case Key_7: 421 case Key_7:
421 case Key_6: 422 case Key_6:
422 if ( !(cpos == 1 || cpos == 4) ) 423 if ( !(cpos == 1 || cpos == 4) )
423 return; 424 return;
424 if ( cpos == 1 && text.at( 0 ) > '1') 425 if ( cpos == 1 && text.at( 0 ) > '1')
425 text.at( 0 ) = '1'; 426 text.at( 0 ) = '1';
426 case Key_5: 427 case Key_5:
427 case Key_4: 428 case Key_4:
428 case Key_3: 429 case Key_3:
429 if ( cpos < 1 ) 430 if ( cpos < 1 )
430 return; 431 return;
431 if ( hour12Format && cpos == 1 ) 432 if ( hour12Format && cpos == 1 )
432 return; 433 return;
433 case Key_2: 434 case Key_2:
434 if ( hour12Format && cpos == 0 ) 435 if ( hour12Format && cpos == 0 )
435 return; 436 return;
436 if ( cpos == 0 && text.at( 1 ) > '3') 437 if ( cpos == 0 && text.at( 1 ) > '3')
437 text.at( 1 ) = '3'; 438 text.at( 1 ) = '3';
438 case Key_1: 439 case Key_1:
439 case Key_0: 440 case Key_0:
440 if ( hour12Format ) { 441 if ( hour12Format ) {
441 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) 442 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' )
442 return; 443 return;
443 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) 444 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' )
444 text.at( 1 ) = '1'; 445 text.at( 1 ) = '1';
445 } 446 }
446 text.at( cpos ) = QChar ( e->key() ); 447 text.at( cpos ) = QChar ( e->key() );
447 lineEdit()->setText( text ); 448 lineEdit()->setText( text );
448 if ( cpos == 1 ) 449 if ( cpos == 1 )
449 ++cpos; 450 ++cpos;
450 if ( cpos < 5) 451 if ( cpos < 5)
451 lineEdit()->setCursorPosition(++cpos); 452 lineEdit()->setCursorPosition(++cpos);
452 setSelect( cpos , 1 ); 453 setSelect( cpos , 1 );
453 changedText(); 454 changedText();
454 break; 455 break;
455 case Key_Home: 456 case Key_Home:
456 lineEdit()->setCursorPosition(0); 457 lineEdit()->setCursorPosition(0);
457 setSelect( cpos , 1 ); 458 setSelect( cpos , 1 );
458 break; 459 break;
459 case Key_End: 460 case Key_End:
460 lineEdit()->setCursorPosition(5); 461 lineEdit()->setCursorPosition(5);
461 lineEdit()->deselect(); 462 lineEdit()->deselect();
462 break; 463 break;
463 default: 464 default:
464// QComboBox::keyPressEvent(e); 465// QComboBox::keyPressEvent(e);
465 break; 466 break;
466 } // switch num keys 467 } // switch num keys
467 } else if ( cpos == 5 ) {// if cpos < 5 468 } else if ( cpos == 5 ) {// if cpos < 5
468 if ( hour12Format ) { 469 if ( hour12Format ) {
469 if ( e->key() == Key_A ) { 470 if ( e->key() == Key_A ) {
470 text.at( 5 ) = 'a'; 471 text.at( 5 ) = 'a';
471 lineEdit()->setText( text ); 472 lineEdit()->setText( text );
472 lineEdit()->setCursorPosition(5); 473 lineEdit()->setCursorPosition(5);
473 474
474 } else if ( e->key() == Key_P ) { 475 } else if ( e->key() == Key_P ) {
475 text.at( 5 ) = 'p'; 476 text.at( 5 ) = 'p';
476 lineEdit()->setText( text ); 477 lineEdit()->setText( text );
477 lineEdit()->setCursorPosition(5); 478 lineEdit()->setCursorPosition(5);
478 479
479 } 480 }
480 } 481 }
481 } 482 }
482 483
483 484
484} 485}
485 486
486void KOTimeEdit::updateText() 487void KOTimeEdit::updateText()
487{ 488{
488// kdDebug(5850) << "KOTimeEdit::updateText() " << endl 489// kdDebug(5850) << "KOTimeEdit::updateText() " << endl
489 QString s = KGlobal::locale()->formatTime(mTime); 490 QString s = KGlobal::locale()->formatTime(mTime);
490 // Set the text but without emitting signals, nor losing the cursor position 491 // Set the text but without emitting signals, nor losing the cursor position
491 QLineEdit *line = lineEdit(); 492 QLineEdit *line = lineEdit();
492 line->blockSignals(true); 493 line->blockSignals(true);
493 int pos = line->cursorPosition(); 494 int pos = line->cursorPosition();
494 // qDebug(" settext *%s* ", s.latin1()); 495 // qDebug(" settext *%s* ", s.latin1());
495 line->setText(s); 496 line->setText(s);
496 // line->setCursorPosition(pos); 497 // line->setCursorPosition(pos);
497// line->blockSignals(false); 498// line->blockSignals(false);
498 499
499// kdDebug(5850) << "KOTimeEdit::updateText(): " << s << endl; 500// kdDebug(5850) << "KOTimeEdit::updateText(): " << s << endl;
500 501
501 if (!mTime.minute() % 15) { 502 if (!mTime.minute() % 15) {
502 setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); 503 setCurrentItem((mTime.hour()*4)+(mTime.minute()/15));
503 } 504 }
504 line->setCursorPosition(pos); 505 line->setCursorPosition(pos);
505 line->blockSignals(false); 506 line->blockSignals(false);
506 507
507} 508}
508 509
509bool KOTimeEdit::inputIsValid() const 510bool KOTimeEdit::inputIsValid() const
510{ 511{
511 int cursorPos = lineEdit()->cursorPosition(); 512 int cursorPos = lineEdit()->cursorPosition();
512 QString str = currentText(); 513 QString str = currentText();
513 return validator()->validate( str, cursorPos ) == QValidator::Acceptable; 514 return validator()->validate( str, cursorPos ) == QValidator::Acceptable;
514} 515}
515 516
516void KOTimeEdit::changedText() 517void KOTimeEdit::changedText()
517{ 518{
518 //kdDebug(5850) << "KOTimeEdit::changedText()" << endl; 519 //kdDebug(5850) << "KOTimeEdit::changedText()" << endl;
519 if ( inputIsValid() ) 520 if ( inputIsValid() )
520 { 521 {
521 int pos = lineEdit()->cursorPosition(); 522 int pos = lineEdit()->cursorPosition();
522 mTime = getTime(); 523 mTime = getTime();
523 // updateText(); 524 // updateText();
524 emit timeChanged(mTime); 525 emit timeChanged(mTime);
525 lineEdit()->setCursorPosition(pos); 526 lineEdit()->setCursorPosition(pos);
526 } 527 }
527} 528}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1894 +1,1893 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#include "koimportoldialog.h" 69#include "koimportoldialog.h"
70#endif 70#endif
71#include "mainwindow.h" 71#include "mainwindow.h"
72 72
73class KOex2phonePrefs : public QDialog 73class KOex2phonePrefs : public QDialog
74{ 74{
75 public: 75 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 77 QDialog( parent, name, true )
78 { 78 {
79 setCaption( i18n("Export to phone options") ); 79 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 80 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 81 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 82 lay->setMargin( 3 );
83 QLabel *lab; 83 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 85 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 86 QHBox* temphb;
87 temphb = new QHBox( this ); 87 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 88 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 89 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 90 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 92 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 93 mPhoneConnection = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Model(opt.): "), temphb ); 96 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 97 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mClosed = false; 133 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 139 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 145 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
149 tbd = Bottom; 149 tbd = Bottom;
150 else 150 else
151 tbd = Top; 151 tbd = Top;
152 } 152 }
153 else { 153 else {
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 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"; 204 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";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false;
232 } 231 }
233 processIncidenceSelection( 0 ); 232 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 233 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 234 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 235 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 236 SLOT( slotModifiedChanged( bool ) ) );
238 237
239 238
240 connect( mView, SIGNAL( tempDisableBR(bool) ), 239 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) ); 240 SLOT( disableBR(bool) ) );
242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 241 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
243 mView->setModified( false ); 242 mView->setModified( false );
244 mBlockAtStartup = false; 243 mBlockAtStartup = false;
245 mView->setModified( false ); 244 mView->setModified( false );
246 setCentralWidget( mView ); 245 setCentralWidget( mView );
247 globalFlagBlockStartup = 0; 246 globalFlagBlockStartup = 0;
248 mView->show(); 247 mView->show();
249 delete splash; 248 delete splash;
250 if ( newFile ) 249 if ( newFile )
251 mView->updateConfig(); 250 mView->updateConfig();
252 // qApp->processEvents(); 251 // qApp->processEvents();
253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 252 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
254 //fillSyncMenu(); 253 //fillSyncMenu();
255 254
256 255
257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 256 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 257 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 258 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
260 mSyncManager->setDefaultFileName( defaultFileName()); 259 mSyncManager->setDefaultFileName( defaultFileName());
261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 260 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
262 mSyncManager->fillSyncMenu(); 261 mSyncManager->fillSyncMenu();
263 262
264 263
265 264
266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 265 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
267 if ( showWarning ) { 266 if ( showWarning ) {
268 KMessageBox::information( this, 267 KMessageBox::information( this,
269 "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"); 268 "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");
270 qApp->processEvents(); 269 qApp->processEvents();
271 mView->dialogManager()->showSyncOptions(); 270 mView->dialogManager()->showSyncOptions();
272 } 271 }
273 272
274 //US listen for result adressed from Ka/Pi 273 //US listen for result adressed from Ka/Pi
275#ifndef DESKTOP_VERSION 274#ifndef DESKTOP_VERSION
276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 275 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
277#endif 276#endif
278#ifndef DESKTOP_VERSION 277#ifndef DESKTOP_VERSION
279 infrared = 0; 278 infrared = 0;
280#endif 279#endif
281 280
282 mBRdisabled = false; 281 mBRdisabled = false;
283 toggleBeamReceive(); 282 toggleBeamReceive();
284} 283}
285MainWindow::~MainWindow() 284MainWindow::~MainWindow()
286{ 285{
287 //qDebug("MainWindow::~MainWindow() "); 286 //qDebug("MainWindow::~MainWindow() ");
288 //save toolbar location 287 //save toolbar location
289 delete mCalendar; 288 delete mCalendar;
290 delete mSyncManager; 289 delete mSyncManager;
291#ifndef DESKTOP_VERSION 290#ifndef DESKTOP_VERSION
292 if ( infrared ) 291 if ( infrared )
293 delete infrared; 292 delete infrared;
294#endif 293#endif
295 294
296 295
297} 296}
298 297
299void MainWindow::disableBR(bool b) 298void MainWindow::disableBR(bool b)
300{ 299{
301#ifndef DESKTOP_VERSION 300#ifndef DESKTOP_VERSION
302 if ( b ) { 301 if ( b ) {
303 if ( infrared ) { 302 if ( infrared ) {
304 toggleBeamReceive(); 303 toggleBeamReceive();
305 mBRdisabled = true; 304 mBRdisabled = true;
306 } 305 }
307 mBRdisabled = true; 306 mBRdisabled = true;
308 } else { 307 } else {
309 if ( mBRdisabled ) { 308 if ( mBRdisabled ) {
310 mBRdisabled = false; 309 mBRdisabled = false;
311 //makes no sense,because other cal ap is probably running 310 //makes no sense,because other cal ap is probably running
312 // toggleBeamReceive(); 311 // toggleBeamReceive();
313 } 312 }
314 } 313 }
315#endif 314#endif
316 315
317} 316}
318bool MainWindow::beamReceiveEnabled() 317bool MainWindow::beamReceiveEnabled()
319{ 318{
320#ifndef DESKTOP_VERSION 319#ifndef DESKTOP_VERSION
321 return ( infrared != 0 ); 320 return ( infrared != 0 );
322#endif 321#endif
323 return false; 322 return false;
324} 323}
325 324
326void MainWindow::toggleBeamReceive() 325void MainWindow::toggleBeamReceive()
327{ 326{
328 if ( mBRdisabled ) 327 if ( mBRdisabled )
329 return; 328 return;
330#ifndef DESKTOP_VERSION 329#ifndef DESKTOP_VERSION
331 if ( infrared ) { 330 if ( infrared ) {
332 qDebug("disable BeamReceive "); 331 qDebug("disable BeamReceive ");
333 delete infrared; 332 delete infrared;
334 infrared = 0; 333 infrared = 0;
335 brAction->setOn(false); 334 brAction->setOn(false);
336 return; 335 return;
337 } 336 }
338 qDebug("enable BeamReceive "); 337 qDebug("enable BeamReceive ");
339 brAction->setOn(true); 338 brAction->setOn(true);
340 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 339 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
341 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
342#endif 341#endif
343} 342}
344void MainWindow::showMaximized () 343void MainWindow::showMaximized ()
345{ 344{
346#ifndef DESKTOP_VERSION 345#ifndef DESKTOP_VERSION
347 if ( ! globalFlagBlockStartup ) 346 if ( ! globalFlagBlockStartup )
348 if ( mClosed ) 347 if ( mClosed )
349 mView->goToday(); 348 mView->goToday();
350#endif 349#endif
351 QWidget::showMaximized () ; 350 QWidget::showMaximized () ;
352 mClosed = false; 351 mClosed = false;
353} 352}
354void MainWindow::closeEvent( QCloseEvent* ce ) 353void MainWindow::closeEvent( QCloseEvent* ce )
355{ 354{
356 355
357 356
358 357
359 if ( ! KOPrefs::instance()->mAskForQuit ) { 358 if ( ! KOPrefs::instance()->mAskForQuit ) {
360 saveOnClose(); 359 saveOnClose();
361 mClosed = true; 360 mClosed = true;
362 ce->accept(); 361 ce->accept();
363 return; 362 return;
364 363
365 } 364 }
366 365
367 switch( QMessageBox::information( this, "KO/Pi", 366 switch( QMessageBox::information( this, "KO/Pi",
368 i18n("Do you really want\nto close KO/Pi?"), 367 i18n("Do you really want\nto close KO/Pi?"),
369 i18n("Close"), i18n("No"), 368 i18n("Close"), i18n("No"),
370 0, 0 ) ) { 369 0, 0 ) ) {
371 case 0: 370 case 0:
372 saveOnClose(); 371 saveOnClose();
373 mClosed = true; 372 mClosed = true;
374 ce->accept(); 373 ce->accept();
375 break; 374 break;
376 case 1: 375 case 1:
377 ce->ignore(); 376 ce->ignore();
378 break; 377 break;
379 case 2: 378 case 2:
380 379
381 default: 380 default:
382 break; 381 break;
383 } 382 }
384 383
385 384
386} 385}
387 386
388void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
389{ 388{
390 QDataStream stream( data, IO_ReadOnly ); 389 QDataStream stream( data, IO_ReadOnly );
391 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
392 //QString datamess; 391 //QString datamess;
393 //qDebug("message "); 392 //qDebug("message ");
394 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 393 qDebug("KO: QCOP message received: %s ", cmsg.data() );
395 394
396 if ( cmsg == "setDocument(QString)" ) { 395 if ( cmsg == "setDocument(QString)" ) {
397 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
398 QString fileName; 397 QString fileName;
399 stream >> fileName; 398 stream >> fileName;
400 //qDebug("filename %s ", fileName.latin1()); 399 //qDebug("filename %s ", fileName.latin1());
401 showMaximized(); 400 showMaximized();
402 raise(); 401 raise();
403 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
404 mSyncManager->slotSyncMenu( 1002 ); 403 mSyncManager->slotSyncMenu( 1002 );
405 return; 404 return;
406 } 405 }
407 406
408 if ( cmsg == "-writeFile" ) { 407 if ( cmsg == "-writeFile" ) {
409 // I made from the "-writeFile" an "-writeAlarm" 408 // I made from the "-writeFile" an "-writeAlarm"
410 mView->viewManager()->showWhatsNextView(); 409 mView->viewManager()->showWhatsNextView();
411 mCalendar->checkAlarmForIncidence( 0, true); 410 mCalendar->checkAlarmForIncidence( 0, true);
412 showMaximized(); 411 showMaximized();
413 raise(); 412 raise();
414 return; 413 return;
415 414
416 } 415 }
417 if ( cmsg == "-writeFileSilent" ) { 416 if ( cmsg == "-writeFileSilent" ) {
418 // I made from the "-writeFile" an "-writeAlarm" 417 // I made from the "-writeFile" an "-writeAlarm"
419 // mView->viewManager()->showWhatsNextView(); 418 // mView->viewManager()->showWhatsNextView();
420 mCalendar->checkAlarmForIncidence( 0, true); 419 mCalendar->checkAlarmForIncidence( 0, true);
421 //showMaximized(); 420 //showMaximized();
422 //raise(); 421 //raise();
423 hide(); 422 hide();
424 return; 423 return;
425 } 424 }
426 if ( cmsg == "-newCountdown" ) { 425 if ( cmsg == "-newCountdown" ) {
427 qDebug("newCountdown "); 426 qDebug("newCountdown ");
428 427
429 } 428 }
430 QString msg ; 429 QString msg ;
431 QString allmsg = cmsg; 430 QString allmsg = cmsg;
432 while ( allmsg.length() > 0 ) { 431 while ( allmsg.length() > 0 ) {
433 int nextC = allmsg.find( "-", 1 ); 432 int nextC = allmsg.find( "-", 1 );
434 if ( nextC == -1 ) { 433 if ( nextC == -1 ) {
435 msg = allmsg; 434 msg = allmsg;
436 allmsg = ""; 435 allmsg = "";
437 } else{ 436 } else{
438 msg = allmsg.left( nextC ); 437 msg = allmsg.left( nextC );
439 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 438 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
440 } 439 }
441 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 440 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
442 if ( msg == "-newEvent" ) { 441 if ( msg == "-newEvent" ) {
443 mView->newEvent(); 442 mView->newEvent();
444 } 443 }
445 if ( msg == "-newTodo" ) { 444 if ( msg == "-newTodo" ) {
446 mView->newTodo(); 445 mView->newTodo();
447 446
448 } 447 }
449 if ( msg == "-showWN" ) { 448 if ( msg == "-showWN" ) {
450 mView->viewManager()->showWhatsNextView(); 449 mView->viewManager()->showWhatsNextView();
451 } 450 }
452 if ( msg == "-showTodo" ) { 451 if ( msg == "-showTodo" ) {
453 mView->viewManager()->showTodoView(); 452 mView->viewManager()->showTodoView();
454 } 453 }
455 if ( msg == "-showList" ) { 454 if ( msg == "-showList" ) {
456 mView->viewManager()->showListView(); 455 mView->viewManager()->showListView();
457 } 456 }
458 else if ( msg == "-showDay" ) { 457 else if ( msg == "-showDay" ) {
459 mView->viewManager()->showDayView(); 458 mView->viewManager()->showDayView();
460 } 459 }
461 else if ( msg == "-showWWeek" ) { 460 else if ( msg == "-showWWeek" ) {
462 mView->viewManager()->showWorkWeekView(); 461 mView->viewManager()->showWorkWeekView();
463 } 462 }
464 else if ( msg == "-ringSync" ) { 463 else if ( msg == "-ringSync" ) {
465 mSyncManager->multiSync( false ); 464 mSyncManager->multiSync( false );
466 } 465 }
467 else if ( msg == "-showWeek" ) { 466 else if ( msg == "-showWeek" ) {
468 mView->viewManager()->showWeekView(); 467 mView->viewManager()->showWeekView();
469 } 468 }
470 else if ( msg == "-showTodo" ) { 469 else if ( msg == "-showTodo" ) {
471 mView->viewManager()->showTodoView(); 470 mView->viewManager()->showTodoView();
472 } 471 }
473 else if ( msg == "-showJournal" ) { 472 else if ( msg == "-showJournal" ) {
474 mView->dateNavigator()->selectDates( 1 ); 473 mView->dateNavigator()->selectDates( 1 );
475 mView->dateNavigator()->selectToday(); 474 mView->dateNavigator()->selectToday();
476 mView->viewManager()->showJournalView(); 475 mView->viewManager()->showJournalView();
477 } 476 }
478 else if ( msg == "-showKO" ) { 477 else if ( msg == "-showKO" ) {
479 mView->viewManager()->showNextXView(); 478 mView->viewManager()->showNextXView();
480 } 479 }
481 else if ( msg == "-showWNext" || msg == "nextView()" ) { 480 else if ( msg == "-showWNext" || msg == "nextView()" ) {
482 mView->viewManager()->showWhatsNextView(); 481 mView->viewManager()->showWhatsNextView();
483 } 482 }
484 else if ( msg == "-showNextXView" ) { 483 else if ( msg == "-showNextXView" ) {
485 mView->viewManager()->showNextXView(); 484 mView->viewManager()->showNextXView();
486 } 485 }
487 486
488 487
489 } 488 }
490 489
491 showMaximized(); 490 showMaximized();
492 raise(); 491 raise();
493} 492}
494 493
495QPixmap MainWindow::loadPixmap( QString name ) 494QPixmap MainWindow::loadPixmap( QString name )
496{ 495{
497 return SmallIcon( name ); 496 return SmallIcon( name );
498 497
499} 498}
500void MainWindow::initActions() 499void MainWindow::initActions()
501{ 500{
502 //KOPrefs::instance()->mShowFullMenu 501 //KOPrefs::instance()->mShowFullMenu
503 iconToolBar->clear(); 502 iconToolBar->clear();
504 KOPrefs *p = KOPrefs::instance(); 503 KOPrefs *p = KOPrefs::instance();
505 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 504 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
506 505
507 QPopupMenu *viewMenu = new QPopupMenu( this ); 506 QPopupMenu *viewMenu = new QPopupMenu( this );
508 QPopupMenu *actionMenu = new QPopupMenu( this ); 507 QPopupMenu *actionMenu = new QPopupMenu( this );
509 QPopupMenu *importMenu = new QPopupMenu( this ); 508 QPopupMenu *importMenu = new QPopupMenu( this );
510 selectFilterMenu = new QPopupMenu( this ); 509 selectFilterMenu = new QPopupMenu( this );
511 selectFilterMenu->setCheckable( true ); 510 selectFilterMenu->setCheckable( true );
512 syncMenu = new QPopupMenu( this ); 511 syncMenu = new QPopupMenu( this );
513 configureAgendaMenu = new QPopupMenu( this ); 512 configureAgendaMenu = new QPopupMenu( this );
514 configureToolBarMenu = new QPopupMenu( this ); 513 configureToolBarMenu = new QPopupMenu( this );
515 QPopupMenu *helpMenu = new QPopupMenu( this ); 514 QPopupMenu *helpMenu = new QPopupMenu( this );
516 if ( KOPrefs::instance()->mShowFullMenu ) { 515 if ( KOPrefs::instance()->mShowFullMenu ) {
517 QMenuBar *menuBar1; 516 QMenuBar *menuBar1;
518 menuBar1 = menuBar(); 517 menuBar1 = menuBar();
519 menuBar1->insertItem( i18n("File"), importMenu ); 518 menuBar1->insertItem( i18n("File"), importMenu );
520 menuBar1->insertItem( i18n("View"), viewMenu ); 519 menuBar1->insertItem( i18n("View"), viewMenu );
521 menuBar1->insertItem( i18n("Actions"), actionMenu ); 520 menuBar1->insertItem( i18n("Actions"), actionMenu );
522 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 521 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
523 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 522 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
524 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 523 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
525 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 524 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
526 menuBar1->insertItem( i18n("Help"), helpMenu ); 525 menuBar1->insertItem( i18n("Help"), helpMenu );
527 } else { 526 } else {
528 QPEMenuBar *menuBar1; 527 QPEMenuBar *menuBar1;
529 menuBar1 = new QPEMenuBar( iconToolBar ); 528 menuBar1 = new QPEMenuBar( iconToolBar );
530 QPopupMenu *menuBar = new QPopupMenu( this ); 529 QPopupMenu *menuBar = new QPopupMenu( this );
531 menuBar1->insertItem( i18n("ME"), menuBar); 530 menuBar1->insertItem( i18n("ME"), menuBar);
532 menuBar->insertItem( i18n("File"), importMenu ); 531 menuBar->insertItem( i18n("File"), importMenu );
533 menuBar->insertItem( i18n("View"), viewMenu ); 532 menuBar->insertItem( i18n("View"), viewMenu );
534 menuBar->insertItem( i18n("Actions"), actionMenu ); 533 menuBar->insertItem( i18n("Actions"), actionMenu );
535 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 534 menuBar->insertItem( i18n("Synchronize"), syncMenu );
536 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 535 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
537 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 536 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
538 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 537 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
539 menuBar->insertItem( i18n("Help"), helpMenu ); 538 menuBar->insertItem( i18n("Help"), helpMenu );
540 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 539 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
541 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 540 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
542 } 541 }
543 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 542 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
544 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 543 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
545 544
546 // ****************** 545 // ******************
547 QAction *action; 546 QAction *action;
548 QIconSet icon; 547 QIconSet icon;
549 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 548 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
550 configureToolBarMenu->setCheckable( true ); 549 configureToolBarMenu->setCheckable( true );
551 550
552 QString pathString = ""; 551 QString pathString = "";
553 if ( !p->mToolBarMiniIcons ) { 552 if ( !p->mToolBarMiniIcons ) {
554 if ( QApplication::desktop()->width() < 480 ) 553 if ( QApplication::desktop()->width() < 480 )
555 pathString += "icons16/"; 554 pathString += "icons16/";
556 } else 555 } else
557 pathString += "iconsmini/"; 556 pathString += "iconsmini/";
558 configureAgendaMenu->setCheckable( true ); 557 configureAgendaMenu->setCheckable( true );
559 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 558 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
560 configureAgendaMenu->insertSeparator(); 559 configureAgendaMenu->insertSeparator();
561 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 560 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
562 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 561 configureAgendaMenu->insertItem(i18n("Small"), 6 );
563 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 562 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
564 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 563 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
565 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 564 configureAgendaMenu->insertItem(i18n("Large"), 12 );
566 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 565 configureAgendaMenu->insertItem(i18n("Big"), 14 );
567 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 566 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
568 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 567 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
569 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 568 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
570 569
571 icon = loadPixmap( pathString + "configure" ); 570 icon = loadPixmap( pathString + "configure" );
572 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 571 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
573 action->addTo( actionMenu ); 572 action->addTo( actionMenu );
574 connect( action, SIGNAL( activated() ), 573 connect( action, SIGNAL( activated() ),
575 mView, SLOT( edit_options() ) ); 574 mView, SLOT( edit_options() ) );
576 actionMenu->insertSeparator(); 575 actionMenu->insertSeparator();
577 icon = loadPixmap( pathString + "newevent" ); 576 icon = loadPixmap( pathString + "newevent" );
578 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 577 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
579 configureToolBarMenu->insertSeparator(); 578 configureToolBarMenu->insertSeparator();
580 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 579 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
581 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 580 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
582 ne_action->addTo( actionMenu ); 581 ne_action->addTo( actionMenu );
583 connect( ne_action, SIGNAL( activated() ), 582 connect( ne_action, SIGNAL( activated() ),
584 mView, SLOT( newEvent() ) ); 583 mView, SLOT( newEvent() ) );
585 icon = loadPixmap( pathString + "newtodo" ); 584 icon = loadPixmap( pathString + "newtodo" );
586 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 585 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
587 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 586 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
588 nt_action->addTo( actionMenu ); 587 nt_action->addTo( actionMenu );
589 connect( nt_action, SIGNAL( activated() ), 588 connect( nt_action, SIGNAL( activated() ),
590 mView, SLOT( newTodo() ) ); 589 mView, SLOT( newTodo() ) );
591 icon = loadPixmap( pathString + "navi" ); 590 icon = loadPixmap( pathString + "navi" );
592 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 591 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
593 action->addTo( viewMenu ); 592 action->addTo( viewMenu );
594 connect( action, SIGNAL( activated() ), 593 connect( action, SIGNAL( activated() ),
595 mView, SLOT( toggleDateNavigatorWidget() ) ); 594 mView, SLOT( toggleDateNavigatorWidget() ) );
596 icon = loadPixmap( pathString + "filter" ); 595 icon = loadPixmap( pathString + "filter" );
597 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 596 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
598 action->addTo( viewMenu ); 597 action->addTo( viewMenu );
599 connect( action, SIGNAL( activated() ), 598 connect( action, SIGNAL( activated() ),
600 mView, SLOT( toggleFilter() ) ); 599 mView, SLOT( toggleFilter() ) );
601 600
602 601
603 viewMenu->insertSeparator(); 602 viewMenu->insertSeparator();
604 icon = loadPixmap( pathString + "picker" ); 603 icon = loadPixmap( pathString + "picker" );
605 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 604 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
606 action->addTo( viewMenu ); 605 action->addTo( viewMenu );
607 connect( action, SIGNAL( activated() ), 606 connect( action, SIGNAL( activated() ),
608 mView, SLOT( showDatePicker() ) ); 607 mView, SLOT( showDatePicker() ) );
609 action->addTo( iconToolBar ); 608 action->addTo( iconToolBar );
610 viewMenu->insertSeparator(); 609 viewMenu->insertSeparator();
611 icon = loadPixmap( pathString + "list" ); 610 icon = loadPixmap( pathString + "list" );
612 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 611 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
613 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 612 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
614 showlist_action->addTo( viewMenu ); 613 showlist_action->addTo( viewMenu );
615 connect( showlist_action, SIGNAL( activated() ), 614 connect( showlist_action, SIGNAL( activated() ),
616 mView->viewManager(), SLOT( showListView() ) ); 615 mView->viewManager(), SLOT( showListView() ) );
617 616
618 617
619 icon = loadPixmap( pathString + "day" ); 618 icon = loadPixmap( pathString + "day" );
620 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 619 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
621 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 620 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
622 day1_action->addTo( viewMenu ); 621 day1_action->addTo( viewMenu );
623 // action->addTo( toolBar ); 622 // action->addTo( toolBar );
624 connect( day1_action, SIGNAL( activated() ), 623 connect( day1_action, SIGNAL( activated() ),
625 mView->viewManager(), SLOT( showDayView() ) ); 624 mView->viewManager(), SLOT( showDayView() ) );
626 625
627 icon = loadPixmap( pathString + "workweek" ); 626 icon = loadPixmap( pathString + "workweek" );
628 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 627 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
629 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 628 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
630 day5_action->addTo( viewMenu ); 629 day5_action->addTo( viewMenu );
631 connect( day5_action, SIGNAL( activated() ), 630 connect( day5_action, SIGNAL( activated() ),
632 mView->viewManager(), SLOT( showWorkWeekView() ) ); 631 mView->viewManager(), SLOT( showWorkWeekView() ) );
633 632
634 icon = loadPixmap( pathString + "week" ); 633 icon = loadPixmap( pathString + "week" );
635 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 634 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
636 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 635 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
637 day7_action->addTo( viewMenu ); 636 day7_action->addTo( viewMenu );
638 connect( day7_action, SIGNAL( activated() ), 637 connect( day7_action, SIGNAL( activated() ),
639 mView->viewManager(), SLOT( showWeekView() ) ); 638 mView->viewManager(), SLOT( showWeekView() ) );
640 639
641 icon = loadPixmap( pathString + "month" ); 640 icon = loadPixmap( pathString + "month" );
642 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 641 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
643 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 642 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
644 month_action->addTo( viewMenu ); 643 month_action->addTo( viewMenu );
645 connect( month_action, SIGNAL( activated() ), 644 connect( month_action, SIGNAL( activated() ),
646 mView->viewManager(), SLOT( showMonthView() ) ); 645 mView->viewManager(), SLOT( showMonthView() ) );
647 646
648 icon = loadPixmap( pathString + "todo" ); 647 icon = loadPixmap( pathString + "todo" );
649 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 648 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
650 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 649 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
651 todoview_action->addTo( viewMenu ); 650 todoview_action->addTo( viewMenu );
652 connect( todoview_action, SIGNAL( activated() ), 651 connect( todoview_action, SIGNAL( activated() ),
653 mView->viewManager(), SLOT( showTodoView() ) ); 652 mView->viewManager(), SLOT( showTodoView() ) );
654 653
655 icon = loadPixmap( pathString + "journal" ); 654 icon = loadPixmap( pathString + "journal" );
656 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 655 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
657 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 656 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
658 viewjournal_action->addTo( viewMenu ); 657 viewjournal_action->addTo( viewMenu );
659 connect( viewjournal_action, SIGNAL( activated() ), 658 connect( viewjournal_action, SIGNAL( activated() ),
660 mView->viewManager(), SLOT( showJournalView() ) ); 659 mView->viewManager(), SLOT( showJournalView() ) );
661 660
662 icon = loadPixmap( pathString + "xdays" ); 661 icon = loadPixmap( pathString + "xdays" );
663 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 662 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
664 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 663 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
665 xdays_action->addTo( viewMenu ); 664 xdays_action->addTo( viewMenu );
666 connect( xdays_action, SIGNAL( activated() ), 665 connect( xdays_action, SIGNAL( activated() ),
667 mView->viewManager(), SLOT( showNextXView() ) ); 666 mView->viewManager(), SLOT( showNextXView() ) );
668 667
669 icon = loadPixmap( pathString + "whatsnext" ); 668 icon = loadPixmap( pathString + "whatsnext" );
670 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 669 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
671 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 670 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
672 whatsnext_action->addTo( viewMenu ); 671 whatsnext_action->addTo( viewMenu );
673 connect( whatsnext_action, SIGNAL( activated() ), 672 connect( whatsnext_action, SIGNAL( activated() ),
674 mView->viewManager(), SLOT( showWhatsNextView() ) ); 673 mView->viewManager(), SLOT( showWhatsNextView() ) );
675 674
676#if 0 675#if 0
677 action = new QAction( "view_timespan", "Time Span", 0, this ); 676 action = new QAction( "view_timespan", "Time Span", 0, this );
678 action->addTo( viewMenu ); 677 action->addTo( viewMenu );
679 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
680 mView->viewManager(), SLOT( showTimeSpanView() ) ); 679 mView->viewManager(), SLOT( showTimeSpanView() ) );
681#endif 680#endif
682 681
683 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 682 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
684 this ); 683 this );
685 mNewSubTodoAction->addTo( actionMenu ); 684 mNewSubTodoAction->addTo( actionMenu );
686 connect( mNewSubTodoAction, SIGNAL( activated() ), 685 connect( mNewSubTodoAction, SIGNAL( activated() ),
687 mView, SLOT( newSubTodo() ) ); 686 mView, SLOT( newSubTodo() ) );
688 687
689 actionMenu->insertSeparator(); 688 actionMenu->insertSeparator();
690 689
691 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 690 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
692 mShowAction->addTo( actionMenu ); 691 mShowAction->addTo( actionMenu );
693 connect( mShowAction, SIGNAL( activated() ), 692 connect( mShowAction, SIGNAL( activated() ),
694 mView, SLOT( showIncidence() ) ); 693 mView, SLOT( showIncidence() ) );
695 694
696 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 695 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
697 mEditAction->addTo( actionMenu ); 696 mEditAction->addTo( actionMenu );
698 connect( mEditAction, SIGNAL( activated() ), 697 connect( mEditAction, SIGNAL( activated() ),
699 mView, SLOT( editIncidence() ) ); 698 mView, SLOT( editIncidence() ) );
700 699
701 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 700 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
702 mDeleteAction->addTo( actionMenu ); 701 mDeleteAction->addTo( actionMenu );
703 connect( mDeleteAction, SIGNAL( activated() ), 702 connect( mDeleteAction, SIGNAL( activated() ),
704 mView, SLOT( deleteIncidence() ) ); 703 mView, SLOT( deleteIncidence() ) );
705 704
706 705
707 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 706 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
708 mCloneAction->addTo( actionMenu ); 707 mCloneAction->addTo( actionMenu );
709 connect( mCloneAction, SIGNAL( activated() ), 708 connect( mCloneAction, SIGNAL( activated() ),
710 mView, SLOT( cloneIncidence() ) ); 709 mView, SLOT( cloneIncidence() ) );
711 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 710 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
712 mMoveAction->addTo( actionMenu ); 711 mMoveAction->addTo( actionMenu );
713 connect( mMoveAction, SIGNAL( activated() ), 712 connect( mMoveAction, SIGNAL( activated() ),
714 mView, SLOT( moveIncidence() ) ); 713 mView, SLOT( moveIncidence() ) );
715 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 714 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
716 mBeamAction->addTo( actionMenu ); 715 mBeamAction->addTo( actionMenu );
717 connect( mBeamAction, SIGNAL( activated() ), 716 connect( mBeamAction, SIGNAL( activated() ),
718 mView, SLOT( beamIncidence() ) ); 717 mView, SLOT( beamIncidence() ) );
719 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 718 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
720 mCancelAction->addTo( actionMenu ); 719 mCancelAction->addTo( actionMenu );
721 connect( mCancelAction, SIGNAL( activated() ), 720 connect( mCancelAction, SIGNAL( activated() ),
722 mView, SLOT( toggleCancelIncidence() ) ); 721 mView, SLOT( toggleCancelIncidence() ) );
723 722
724 actionMenu->insertSeparator(); 723 actionMenu->insertSeparator();
725 724
726 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 725 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
727 this ); 726 this );
728 action->addTo( actionMenu ); 727 action->addTo( actionMenu );
729 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 728 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
730 729
731 icon = loadPixmap( pathString + "search" ); 730 icon = loadPixmap( pathString + "search" );
732 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 731 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
733 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 732 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
734 search_action->addTo( actionMenu ); 733 search_action->addTo( actionMenu );
735 connect( search_action, SIGNAL( activated() ), 734 connect( search_action, SIGNAL( activated() ),
736 mView->dialogManager(), SLOT( showSearchDialog() ) ); 735 mView->dialogManager(), SLOT( showSearchDialog() ) );
737 736
738 icon = loadPixmap( pathString + "today" ); 737 icon = loadPixmap( pathString + "today" );
739 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 738 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
740 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 739 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
741 today_action->addTo( actionMenu ); 740 today_action->addTo( actionMenu );
742 connect( today_action, SIGNAL( activated() ), 741 connect( today_action, SIGNAL( activated() ),
743 mView, SLOT( goToday() ) ); 742 mView, SLOT( goToday() ) );
744 743
745 if ( KOPrefs::instance()->mShowFullMenu ) { 744 if ( KOPrefs::instance()->mShowFullMenu ) {
746 actionMenu->insertSeparator(); 745 actionMenu->insertSeparator();
747 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 746 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
748 747
749 } 748 }
750 // actionMenu->insertSeparator(); 749 // actionMenu->insertSeparator();
751 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 750 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
752 this ); 751 this );
753 action->addTo( importMenu ); 752 action->addTo( importMenu );
754 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 753 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
755 action = new QAction( "import_quick", i18n("Import last file"), 0, 754 action = new QAction( "import_quick", i18n("Import last file"), 0,
756 this ); 755 this );
757 action->addTo( importMenu ); 756 action->addTo( importMenu );
758 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 757 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
759 importMenu->insertSeparator(); 758 importMenu->insertSeparator();
760 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 759 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
761 this ); 760 this );
762 action->addTo( importMenu ); 761 action->addTo( importMenu );
763 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 762 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
764#ifndef DESKTOP_VERSION 763#ifndef DESKTOP_VERSION
765 importMenu->insertSeparator(); 764 importMenu->insertSeparator();
766 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 765 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
767 this ); 766 this );
768 action->addTo( importMenu ); 767 action->addTo( importMenu );
769 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 768 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
770#else 769#else
771#ifdef _WIN32_ 770#ifdef _WIN32_
772 importMenu->insertSeparator(); 771 importMenu->insertSeparator();
773 action = new QAction( "import_ol", i18n("Import from OL"), 0, 772 action = new QAction( "import_ol", i18n("Import from OL"), 0,
774 this ); 773 this );
775 action->addTo( importMenu ); 774 action->addTo( importMenu );
776 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 775 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
777#endif 776#endif
778#endif 777#endif
779 778
780 importMenu->insertSeparator(); 779 importMenu->insertSeparator();
781 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 780 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
782 this ); 781 this );
783 action->addTo( importMenu ); 782 action->addTo( importMenu );
784 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 783 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
785 784
786 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 785 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
787 this ); 786 this );
788 action->addTo( importMenu ); 787 action->addTo( importMenu );
789 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 788 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
790 789
791 importMenu->insertSeparator(); 790 importMenu->insertSeparator();
792 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 791 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
793 this ); 792 this );
794 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 793 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
795 794
796 795
797 //LR 796 //LR
798 QPopupMenu *ex2phone = new QPopupMenu( this ); 797 QPopupMenu *ex2phone = new QPopupMenu( this );
799 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 798 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
800 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 799 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
801 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 800 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
802 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 801 importMenu->insertItem( i18n("Export to phone"), ex2phone );
803 802
804 importMenu->insertSeparator(); 803 importMenu->insertSeparator();
805 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 804 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
806 this ); 805 this );
807 action->addTo( importMenu ); 806 action->addTo( importMenu );
808 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 807 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
809#ifndef DESKTOP_VERSION 808#ifndef DESKTOP_VERSION
810 importMenu->insertSeparator(); 809 importMenu->insertSeparator();
811 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 810 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
812 this ); 811 this );
813 brAction->addTo( importMenu ); 812 brAction->addTo( importMenu );
814 brAction->setToggleAction (true ) ; 813 brAction->setToggleAction (true ) ;
815 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 814 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
816 815
817 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 816 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
818 this ); 817 this );
819 action->addTo( importMenu ); 818 action->addTo( importMenu );
820 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 819 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
821 820
822 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 821 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
823 this ); 822 this );
824 action->addTo( importMenu ); 823 action->addTo( importMenu );
825 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 824 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
826#else 825#else
827 importMenu->insertSeparator(); 826 importMenu->insertSeparator();
828 icon = loadPixmap( pathString + "print" ); 827 icon = loadPixmap( pathString + "print" );
829 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 828 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
830 action->addTo( importMenu ); 829 action->addTo( importMenu );
831 connect( action, SIGNAL( activated() ), 830 connect( action, SIGNAL( activated() ),
832 this, SLOT( printCal() ) ); 831 this, SLOT( printCal() ) );
833 832
834 icon = loadPixmap( pathString + "print" ); 833 icon = loadPixmap( pathString + "print" );
835 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 834 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
836 action->addTo( importMenu ); 835 action->addTo( importMenu );
837 connect( action, SIGNAL( activated() ), 836 connect( action, SIGNAL( activated() ),
838 this, SLOT( printSel() ) ); 837 this, SLOT( printSel() ) );
839#endif 838#endif
840 importMenu->insertSeparator(); 839 importMenu->insertSeparator();
841 action = new QAction( "beam all", i18n("Save"), 0, 840 action = new QAction( "beam all", i18n("Save"), 0,
842 this ); 841 this );
843 action->addTo( importMenu ); 842 action->addTo( importMenu );
844 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 843 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
845 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 844 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
846 this ); 845 this );
847 action->addTo( importMenu ); 846 action->addTo( importMenu );
848 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 847 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
849 848
850 //menuBar->insertItem( "Configure",configureMenu ); 849 //menuBar->insertItem( "Configure",configureMenu );
851 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 850 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
852 icon = loadPixmap( "korganizer/korganizer" ); 851 icon = loadPixmap( "korganizer/korganizer" );
853 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 852 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
854 action->addTo( helpMenu ); 853 action->addTo( helpMenu );
855 connect( action, SIGNAL( activated() ), 854 connect( action, SIGNAL( activated() ),
856 SLOT( keyBindings() ) ); 855 SLOT( keyBindings() ) );
857 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 856 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
858 action->addTo( helpMenu ); 857 action->addTo( helpMenu );
859 connect( action, SIGNAL( activated() ), 858 connect( action, SIGNAL( activated() ),
860 SLOT( features() ) ); 859 SLOT( features() ) );
861 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 860 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
862 action->addTo( helpMenu ); 861 action->addTo( helpMenu );
863 connect( action, SIGNAL( activated() ), 862 connect( action, SIGNAL( activated() ),
864 SLOT( aboutAutoSaving() ) ); 863 SLOT( aboutAutoSaving() ) );
865 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 864 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
866 action->addTo( helpMenu ); 865 action->addTo( helpMenu );
867 connect( action, SIGNAL( activated() ), 866 connect( action, SIGNAL( activated() ),
868 SLOT( aboutKnownBugs() ) ); 867 SLOT( aboutKnownBugs() ) );
869 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 868 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
870 action->addTo( helpMenu ); 869 action->addTo( helpMenu );
871 connect( action, SIGNAL( activated() ), 870 connect( action, SIGNAL( activated() ),
872 SLOT( usertrans() ) ); 871 SLOT( usertrans() ) );
873 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 872 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
874 action->addTo( helpMenu ); 873 action->addTo( helpMenu );
875 connect( action, SIGNAL( activated() ), 874 connect( action, SIGNAL( activated() ),
876 SLOT( synchowto() ) ); 875 SLOT( synchowto() ) );
877 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 876 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
878 action->addTo( helpMenu ); 877 action->addTo( helpMenu );
879 connect( action, SIGNAL( activated() ), 878 connect( action, SIGNAL( activated() ),
880 SLOT( whatsNew() ) ); 879 SLOT( whatsNew() ) );
881 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 880 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
882 action->addTo( helpMenu ); 881 action->addTo( helpMenu );
883 connect( action, SIGNAL( activated() ), 882 connect( action, SIGNAL( activated() ),
884 SLOT( faq() ) ); 883 SLOT( faq() ) );
885 884
886 885
887 action = new QAction( "about", i18n("About..."), 0, this ); 886 action = new QAction( "about", i18n("About..."), 0, this );
888 action->addTo( helpMenu ); 887 action->addTo( helpMenu );
889 connect( action, SIGNAL( activated() ), 888 connect( action, SIGNAL( activated() ),
890 SLOT( about() ) ); 889 SLOT( about() ) );
891 action = new QAction( "licence", i18n("Licence..."), 0, this ); 890 action = new QAction( "licence", i18n("Licence..."), 0, this );
892 action->addTo( helpMenu ); 891 action->addTo( helpMenu );
893 connect( action, SIGNAL( activated() ), 892 connect( action, SIGNAL( activated() ),
894 SLOT( licence() ) ); 893 SLOT( licence() ) );
895 //menuBar->insertSeparator(); 894 //menuBar->insertSeparator();
896 895
897 // ****************************************************** 896 // ******************************************************
898 // menubar icons 897 // menubar icons
899 898
900 899
901 iconToolBar->setHorizontalStretchable (true ); 900 iconToolBar->setHorizontalStretchable (true );
902 //menuBar->insertItem( iconToolBar ); 901 //menuBar->insertItem( iconToolBar );
903 //xdays_action 902 //xdays_action
904 if (p-> mShowIconNewEvent) 903 if (p-> mShowIconNewEvent)
905 ne_action->addTo( iconToolBar ); 904 ne_action->addTo( iconToolBar );
906 if (p->mShowIconNewTodo ) 905 if (p->mShowIconNewTodo )
907 nt_action->addTo( iconToolBar ); 906 nt_action->addTo( iconToolBar );
908 if (p-> mShowIconSearch) 907 if (p-> mShowIconSearch)
909 search_action->addTo( iconToolBar ); 908 search_action->addTo( iconToolBar );
910 if (p-> mShowIconNext) 909 if (p-> mShowIconNext)
911 whatsnext_action->addTo( iconToolBar ); 910 whatsnext_action->addTo( iconToolBar );
912 if (p-> mShowIconNextDays) 911 if (p-> mShowIconNextDays)
913 xdays_action->addTo( iconToolBar ); 912 xdays_action->addTo( iconToolBar );
914 if (p-> mShowIconList) 913 if (p-> mShowIconList)
915 showlist_action->addTo( iconToolBar ); 914 showlist_action->addTo( iconToolBar );
916 if (p-> mShowIconDay1) 915 if (p-> mShowIconDay1)
917 day1_action->addTo( iconToolBar ); 916 day1_action->addTo( iconToolBar );
918 if (p-> mShowIconDay5) 917 if (p-> mShowIconDay5)
919 day5_action->addTo( iconToolBar ); 918 day5_action->addTo( iconToolBar );
920 if (p-> mShowIconDay7) 919 if (p-> mShowIconDay7)
921 day7_action->addTo( iconToolBar ); 920 day7_action->addTo( iconToolBar );
922 if (p-> mShowIconMonth) 921 if (p-> mShowIconMonth)
923 month_action->addTo( iconToolBar ); 922 month_action->addTo( iconToolBar );
924 if (p-> mShowIconTodoview) 923 if (p-> mShowIconTodoview)
925 todoview_action->addTo( iconToolBar ); 924 todoview_action->addTo( iconToolBar );
926 if (p-> mShowIconJournal) 925 if (p-> mShowIconJournal)
927 viewjournal_action->addTo( iconToolBar ); 926 viewjournal_action->addTo( iconToolBar );
928 icon = loadPixmap( pathString + "2leftarrowB" ); 927 icon = loadPixmap( pathString + "2leftarrowB" );
929 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 928 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
930 if (p-> mShowIconBackFast) { 929 if (p-> mShowIconBackFast) {
931 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 930 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
932 connect( action, SIGNAL( activated() ), 931 connect( action, SIGNAL( activated() ),
933 mView, SLOT( goPreviousMonth() ) ); 932 mView, SLOT( goPreviousMonth() ) );
934 action->addTo( iconToolBar ); 933 action->addTo( iconToolBar );
935 } 934 }
936 icon = loadPixmap( pathString + "1leftarrowB" ); 935 icon = loadPixmap( pathString + "1leftarrowB" );
937 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 936 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
938 if (p-> mShowIconBack) { 937 if (p-> mShowIconBack) {
939 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 938 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
940 connect( action, SIGNAL( activated() ), 939 connect( action, SIGNAL( activated() ),
941 mView, SLOT( goPrevious() ) ); 940 mView, SLOT( goPrevious() ) );
942 action->addTo( iconToolBar ); 941 action->addTo( iconToolBar );
943 } 942 }
944 if (p-> mShowIconToday) 943 if (p-> mShowIconToday)
945 today_action->addTo( iconToolBar ); 944 today_action->addTo( iconToolBar );
946 icon = loadPixmap( pathString + "1rightarrowB" ); 945 icon = loadPixmap( pathString + "1rightarrowB" );
947 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 946 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
948 if (p-> mShowIconForward) { 947 if (p-> mShowIconForward) {
949 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 948 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
950 connect( action, SIGNAL( activated() ), 949 connect( action, SIGNAL( activated() ),
951 mView, SLOT( goNext() ) ); 950 mView, SLOT( goNext() ) );
952 action->addTo( iconToolBar ); 951 action->addTo( iconToolBar );
953 } 952 }
954 icon = loadPixmap( pathString + "2rightarrowB" ); 953 icon = loadPixmap( pathString + "2rightarrowB" );
955 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 954 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
956 if (p-> mShowIconForwardFast) { 955 if (p-> mShowIconForwardFast) {
957 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 956 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
958 connect( action, SIGNAL( activated() ), 957 connect( action, SIGNAL( activated() ),
959 mView, SLOT( goNextMonth() ) ); 958 mView, SLOT( goNextMonth() ) );
960 action->addTo( iconToolBar ); 959 action->addTo( iconToolBar );
961 } 960 }
962 961
963 962
964 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 963 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
965 964
966 if (p-> mShowIconNewEvent) 965 if (p-> mShowIconNewEvent)
967 configureToolBarMenu->setItemChecked( 10, true ); 966 configureToolBarMenu->setItemChecked( 10, true );
968 if (p->mShowIconNewTodo ) 967 if (p->mShowIconNewTodo )
969 configureToolBarMenu->setItemChecked( 20, true ); 968 configureToolBarMenu->setItemChecked( 20, true );
970 if (p-> mShowIconSearch) 969 if (p-> mShowIconSearch)
971 configureToolBarMenu->setItemChecked( 120, true ); 970 configureToolBarMenu->setItemChecked( 120, true );
972 if (p-> mShowIconList) 971 if (p-> mShowIconList)
973 configureToolBarMenu->setItemChecked( 30, true ); 972 configureToolBarMenu->setItemChecked( 30, true );
974 if (p-> mShowIconDay1) 973 if (p-> mShowIconDay1)
975 configureToolBarMenu->setItemChecked( 40, true ); 974 configureToolBarMenu->setItemChecked( 40, true );
976 if (p-> mShowIconDay5) 975 if (p-> mShowIconDay5)
977 configureToolBarMenu->setItemChecked( 50, true ); 976 configureToolBarMenu->setItemChecked( 50, true );
978 if (p-> mShowIconDay7) 977 if (p-> mShowIconDay7)
979 configureToolBarMenu->setItemChecked( 60, true ); 978 configureToolBarMenu->setItemChecked( 60, true );
980 if (p-> mShowIconMonth) 979 if (p-> mShowIconMonth)
981 configureToolBarMenu->setItemChecked( 70, true ); 980 configureToolBarMenu->setItemChecked( 70, true );
982 if (p-> mShowIconTodoview) 981 if (p-> mShowIconTodoview)
983 configureToolBarMenu->setItemChecked( 80, true ); 982 configureToolBarMenu->setItemChecked( 80, true );
984 if (p-> mShowIconBackFast) 983 if (p-> mShowIconBackFast)
985 configureToolBarMenu->setItemChecked( 200, true ); 984 configureToolBarMenu->setItemChecked( 200, true );
986 if (p-> mShowIconBack) 985 if (p-> mShowIconBack)
987 configureToolBarMenu->setItemChecked( 210, true ); 986 configureToolBarMenu->setItemChecked( 210, true );
988 if (p-> mShowIconToday) 987 if (p-> mShowIconToday)
989 configureToolBarMenu->setItemChecked( 130, true ); 988 configureToolBarMenu->setItemChecked( 130, true );
990 if (p-> mShowIconForward) 989 if (p-> mShowIconForward)
991 configureToolBarMenu->setItemChecked( 220, true ); 990 configureToolBarMenu->setItemChecked( 220, true );
992 if (p-> mShowIconForwardFast) 991 if (p-> mShowIconForwardFast)
993 configureToolBarMenu->setItemChecked( 230, true ); 992 configureToolBarMenu->setItemChecked( 230, true );
994 if (p-> mShowIconNextDays) 993 if (p-> mShowIconNextDays)
995 configureToolBarMenu->setItemChecked( 100, true ); 994 configureToolBarMenu->setItemChecked( 100, true );
996 if (p-> mShowIconNext) 995 if (p-> mShowIconNext)
997 configureToolBarMenu->setItemChecked( 110, true ); 996 configureToolBarMenu->setItemChecked( 110, true );
998 if (p-> mShowIconJournal) 997 if (p-> mShowIconJournal)
999 configureToolBarMenu->setItemChecked( 90, true ); 998 configureToolBarMenu->setItemChecked( 90, true );
1000 if (p-> mShowIconWhatsThis) 999 if (p-> mShowIconWhatsThis)
1001 configureToolBarMenu->setItemChecked( 300, true ); 1000 configureToolBarMenu->setItemChecked( 300, true );
1002 1001
1003 QLabel* dummy = new QLabel( iconToolBar ); 1002 QLabel* dummy = new QLabel( iconToolBar );
1004 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1003 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1005 if (!p-> mShowIconStretch) 1004 if (!p-> mShowIconStretch)
1006 iconToolBar->setStretchableWidget ( dummy ) ; 1005 iconToolBar->setStretchableWidget ( dummy ) ;
1007 else 1006 else
1008 configureToolBarMenu->setItemChecked( 5, true ); 1007 configureToolBarMenu->setItemChecked( 5, true );
1009 if (p-> mShowIconWhatsThis) 1008 if (p-> mShowIconWhatsThis)
1010 QWhatsThis::whatsThisButton ( iconToolBar ); 1009 QWhatsThis::whatsThisButton ( iconToolBar );
1011 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1010 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1012 configureAgenda( p->mHourSize ); 1011 configureAgenda( p->mHourSize );
1013 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1012 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1014} 1013}
1015 1014
1016void MainWindow::exportToPhone( int mode ) 1015void MainWindow::exportToPhone( int mode )
1017{ 1016{
1018 1017
1019 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1018 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1020 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1019 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1021 KOex2phonePrefs ex2phone; 1020 KOex2phonePrefs ex2phone;
1022 1021
1023 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1022 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1024 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1023 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1025 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1024 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1026 if ( mode == 1 ) 1025 if ( mode == 1 )
1027 ex2phone.setCaption(i18n("Export complete calendar")); 1026 ex2phone.setCaption(i18n("Export complete calendar"));
1028 if ( mode == 2 ) 1027 if ( mode == 2 )
1029 ex2phone.setCaption(i18n("Export filtered calendar")); 1028 ex2phone.setCaption(i18n("Export filtered calendar"));
1030 1029
1031 if ( !ex2phone.exec() ) { 1030 if ( !ex2phone.exec() ) {
1032 return; 1031 return;
1033 } 1032 }
1034 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1033 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1035 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1034 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1036 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1035 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1037 1036
1038 int inFuture = 0; 1037 int inFuture = 0;
1039 if ( ex2phone.mWriteBackFuture->isChecked() ) 1038 if ( ex2phone.mWriteBackFuture->isChecked() )
1040 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1039 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1041 QPtrList<Incidence> delSel; 1040 QPtrList<Incidence> delSel;
1042 if ( mode == 1 ) 1041 if ( mode == 1 )
1043 delSel = mCalendar->rawIncidences(); 1042 delSel = mCalendar->rawIncidences();
1044 if ( mode == 2 ) 1043 if ( mode == 2 )
1045 delSel = mCalendar->incidences(); 1044 delSel = mCalendar->incidences();
1046 CalendarLocal* cal = new CalendarLocal(); 1045 CalendarLocal* cal = new CalendarLocal();
1047 cal->setLocalTime(); 1046 cal->setLocalTime();
1048 Incidence *incidence = delSel.first(); 1047 Incidence *incidence = delSel.first();
1049 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1048 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1050 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1049 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1051 while ( incidence ) { 1050 while ( incidence ) {
1052 if ( incidence->type() != "Journal" ) { 1051 if ( incidence->type() != "Journal" ) {
1053 bool add = true; 1052 bool add = true;
1054 if ( inFuture ) { 1053 if ( inFuture ) {
1055 QDateTime dt; 1054 QDateTime dt;
1056 if ( incidence->type() == "Todo" ) { 1055 if ( incidence->type() == "Todo" ) {
1057 Todo * t = (Todo*)incidence; 1056 Todo * t = (Todo*)incidence;
1058 if ( t->hasDueDate() ) 1057 if ( t->hasDueDate() )
1059 dt = t->dtDue(); 1058 dt = t->dtDue();
1060 else 1059 else
1061 dt = cur.addSecs( 62 ); 1060 dt = cur.addSecs( 62 );
1062 } 1061 }
1063 else { 1062 else {
1064 bool ok; 1063 bool ok;
1065 dt = incidence->getNextOccurence( cur, &ok ); 1064 dt = incidence->getNextOccurence( cur, &ok );
1066 if ( !ok ) 1065 if ( !ok )
1067 dt = cur.addSecs( -62 ); 1066 dt = cur.addSecs( -62 );
1068 } 1067 }
1069 if ( dt < cur || dt > end ) { 1068 if ( dt < cur || dt > end ) {
1070 add = false; 1069 add = false;
1071 } 1070 }
1072 } 1071 }
1073 if ( add ) { 1072 if ( add ) {
1074 Incidence *in = incidence->clone(); 1073 Incidence *in = incidence->clone();
1075 cal->addIncidence( in ); 1074 cal->addIncidence( in );
1076 } 1075 }
1077 } 1076 }
1078 incidence = delSel.next(); 1077 incidence = delSel.next();
1079 } 1078 }
1080 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1079 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1081 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1080 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1082 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1081 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1083 1082
1084 setCaption( i18n("Writing to phone...")); 1083 setCaption( i18n("Writing to phone..."));
1085 if ( PhoneFormat::writeToPhone( cal ) ) 1084 if ( PhoneFormat::writeToPhone( cal ) )
1086 setCaption( i18n("Export to phone successful!")); 1085 setCaption( i18n("Export to phone successful!"));
1087 else 1086 else
1088 setCaption( i18n("Error exporting to phone!")); 1087 setCaption( i18n("Error exporting to phone!"));
1089 delete cal; 1088 delete cal;
1090} 1089}
1091 1090
1092 1091
1093void MainWindow::setDefaultPreferences() 1092void MainWindow::setDefaultPreferences()
1094{ 1093{
1095 KOPrefs *p = KOPrefs::instance(); 1094 KOPrefs *p = KOPrefs::instance();
1096 1095
1097 p->mCompactDialogs = true; 1096 p->mCompactDialogs = true;
1098 p->mConfirm = true; 1097 p->mConfirm = true;
1099 // p->mEnableQuickTodo = false; 1098 // p->mEnableQuickTodo = false;
1100 1099
1101} 1100}
1102 1101
1103QString MainWindow::resourcePath() 1102QString MainWindow::resourcePath()
1104{ 1103{
1105 return KGlobal::iconLoader()->iconPath(); 1104 return KGlobal::iconLoader()->iconPath();
1106} 1105}
1107 1106
1108void MainWindow::displayText( QString text ,QString cap ) 1107void MainWindow::displayText( QString text ,QString cap )
1109{ 1108{
1110 QDialog dia( this, "name", true ); ; 1109 QDialog dia( this, "name", true ); ;
1111 dia.setCaption( cap ); 1110 dia.setCaption( cap );
1112 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1111 QVBoxLayout* lay = new QVBoxLayout( &dia );
1113 lay->setSpacing( 3 ); 1112 lay->setSpacing( 3 );
1114 lay->setMargin( 3 ); 1113 lay->setMargin( 3 );
1115 QTextBrowser tb ( &dia ); 1114 QTextBrowser tb ( &dia );
1116 lay->addWidget( &tb ); 1115 lay->addWidget( &tb );
1117 tb.setText( text ); 1116 tb.setText( text );
1118#ifdef DESKTOP_VERSION 1117#ifdef DESKTOP_VERSION
1119 dia.resize( 640, 480); 1118 dia.resize( 640, 480);
1120#else 1119#else
1121 dia.showMaximized(); 1120 dia.showMaximized();
1122#endif 1121#endif
1123 dia.exec(); 1122 dia.exec();
1124} 1123}
1125void MainWindow::displayFile( QString fn, QString cap ) 1124void MainWindow::displayFile( QString fn, QString cap )
1126{ 1125{
1127 QString fileName = resourcePath() + fn; 1126 QString fileName = resourcePath() + fn;
1128 QString text; 1127 QString text;
1129 QFile file( fileName ); 1128 QFile file( fileName );
1130 if (!file.open( IO_ReadOnly ) ) { 1129 if (!file.open( IO_ReadOnly ) ) {
1131 return ; 1130 return ;
1132 1131
1133 } 1132 }
1134 QTextStream ts( &file ); 1133 QTextStream ts( &file );
1135 text = ts.read(); 1134 text = ts.read();
1136 file.close(); 1135 file.close();
1137 displayText( text, cap); 1136 displayText( text, cap);
1138} 1137}
1139void MainWindow::features() 1138void MainWindow::features()
1140{ 1139{
1141 1140
1142 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1141 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1143} 1142}
1144 1143
1145void MainWindow::usertrans() 1144void MainWindow::usertrans()
1146{ 1145{
1147 1146
1148 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1147 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1149} 1148}
1150 1149
1151void MainWindow::synchowto() 1150void MainWindow::synchowto()
1152{ 1151{
1153 1152
1154 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1153 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1155} 1154}
1156void MainWindow::faq() 1155void MainWindow::faq()
1157{ 1156{
1158 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1157 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1159 1158
1160} 1159}
1161void MainWindow::whatsNew() 1160void MainWindow::whatsNew()
1162{ 1161{
1163 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1162 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1164 1163
1165} 1164}
1166void MainWindow::licence() 1165void MainWindow::licence()
1167{ 1166{
1168 KApplication::showLicence(); 1167 KApplication::showLicence();
1169 1168
1170} 1169}
1171void MainWindow::about() 1170void MainWindow::about()
1172{ 1171{
1173 QString version; 1172 QString version;
1174#include <../version> 1173#include <../version>
1175 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1174 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1176 i18n("KOrganizer/Platform-independent\n") + 1175 i18n("KOrganizer/Platform-independent\n") +
1177 "(KO/Pi) " + version + " - " + 1176 "(KO/Pi) " + version + " - " +
1178 1177
1179#ifdef DESKTOP_VERSION 1178#ifdef DESKTOP_VERSION
1180 i18n("Desktop Edition\n") + 1179 i18n("Desktop Edition\n") +
1181#else 1180#else
1182 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1181 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1183#endif 1182#endif
1184 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1183 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1185} 1184}
1186void MainWindow::keyBindings() 1185void MainWindow::keyBindings()
1187{ 1186{
1188 QString cap = i18n("Key bindings KOrganizer/Pi"); 1187 QString cap = i18n("Key bindings KOrganizer/Pi");
1189 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1188 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1190 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1189 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1191 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1190 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1192 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1191 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1193 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1192 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1194 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1193 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1195 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1194 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1196 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1195 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1197 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1196 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1198 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1197 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1199 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1198 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1200 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1199 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1201 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1200 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1202 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1201 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1203 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1202 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1204 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1203 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1205 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1204 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1206 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1205 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1207 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1206 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1208 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1207 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1209 i18n("<p><h3>In agenda view:</h3></p>\n") + 1208 i18n("<p><h3>In agenda view:</h3></p>\n") +
1210 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1209 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1211 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1210 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1212 i18n("<p><h3>In todo view:</h3></p>\n") + 1211 i18n("<p><h3>In todo view:</h3></p>\n") +
1213 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1212 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1214 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1213 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1215 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1214 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1216 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1215 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1217 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1216 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1218 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1217 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1219 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1218 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1220 i18n("<p><h3>In list view:</h3></p>\n") + 1219 i18n("<p><h3>In list view:</h3></p>\n") +
1221 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1220 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1222 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1221 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1223 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1222 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1224 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1223 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1225 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1224 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1226 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1225 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1227 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1226 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1228 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1227 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1229 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1228 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1230 i18n("<p><b>E</b>: Edit item</p>\n") + 1229 i18n("<p><b>E</b>: Edit item</p>\n") +
1231 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1230 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1232 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1231 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1233 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1232 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1234 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1233 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1235 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1234 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1236 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1235 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1237 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1236 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1238 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1237 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1239 i18n("<p><b>White</b>: Item readonly</p>\n"); 1238 i18n("<p><b>White</b>: Item readonly</p>\n");
1240 displayText( text, cap); 1239 displayText( text, cap);
1241 1240
1242} 1241}
1243void MainWindow::aboutAutoSaving() 1242void MainWindow::aboutAutoSaving()
1244{ 1243{
1245 QMessageBox* msg; 1244 QMessageBox* msg;
1246 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1245 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1247 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, 1246 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon,
1248 QMessageBox::Ok, 1247 QMessageBox::Ok,
1249 QMessageBox::NoButton, 1248 QMessageBox::NoButton,
1250 QMessageBox::NoButton); 1249 QMessageBox::NoButton);
1251 msg->exec(); 1250 msg->exec();
1252 delete msg; 1251 delete msg;
1253 1252
1254 1253
1255} 1254}
1256void MainWindow::aboutKnownBugs() 1255void MainWindow::aboutKnownBugs()
1257{ 1256{
1258 QMessageBox* msg; 1257 QMessageBox* msg;
1259 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1258 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1260 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")+ 1259 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")+
1261 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1260 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1262 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1261 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1263 i18n("\nor report them in the bugtracker on\n") + 1262 i18n("\nor report them in the bugtracker on\n") +
1264 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1263 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1265 QMessageBox::NoIcon, 1264 QMessageBox::NoIcon,
1266 QMessageBox::Ok, 1265 QMessageBox::Ok,
1267 QMessageBox::NoButton, 1266 QMessageBox::NoButton,
1268 QMessageBox::NoButton); 1267 QMessageBox::NoButton);
1269 msg->exec(); 1268 msg->exec();
1270 delete msg; 1269 delete msg;
1271 1270
1272} 1271}
1273 1272
1274QString MainWindow::defaultFileName() 1273QString MainWindow::defaultFileName()
1275{ 1274{
1276 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1275 return locateLocal( "data", "korganizer/mycalendar.ics" );
1277} 1276}
1278QString MainWindow::syncFileName() 1277QString MainWindow::syncFileName()
1279{ 1278{
1280#ifdef DESKTOP_VERSION 1279#ifdef DESKTOP_VERSION
1281 return locateLocal( "tmp", "synccalendar.ics" ); 1280 return locateLocal( "tmp", "synccalendar.ics" );
1282#else 1281#else
1283 return QString( "/tmp/synccalendar.ics" ); 1282 return QString( "/tmp/synccalendar.ics" );
1284#endif 1283#endif
1285} 1284}
1286 1285
1287void MainWindow::processIncidenceSelection( Incidence *incidence ) 1286void MainWindow::processIncidenceSelection( Incidence *incidence )
1288{ 1287{
1289 if ( !incidence ) { 1288 if ( !incidence ) {
1290 enableIncidenceActions( false ); 1289 enableIncidenceActions( false );
1291 1290
1292 mNewSubTodoAction->setEnabled( false ); 1291 mNewSubTodoAction->setEnabled( false );
1293 setCaptionToDates(); 1292 setCaptionToDates();
1294 return; 1293 return;
1295 1294
1296 } 1295 }
1297 1296
1298 //KGlobal::locale()->formatDateTime(nextA, true); 1297 //KGlobal::locale()->formatDateTime(nextA, true);
1299 QString startString = ""; 1298 QString startString = "";
1300 if ( incidence->type() != "Todo" ) { 1299 if ( incidence->type() != "Todo" ) {
1301 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1300 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1302 if ( incidence->doesFloat() ) { 1301 if ( incidence->doesFloat() ) {
1303 startString += ": "+incidence->dtStartDateStr( true ); 1302 startString += ": "+incidence->dtStartDateStr( true );
1304 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1303 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1305 1304
1306 } else { 1305 } else {
1307 startString = ": "+incidence->dtStartStr(true); 1306 startString = ": "+incidence->dtStartStr(true);
1308 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1307 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1309 1308
1310 } 1309 }
1311 1310
1312 } else { 1311 } else {
1313 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1312 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1314 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1313 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1315 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1314 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1316 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1315 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1317 } 1316 }
1318 1317
1319 } 1318 }
1320 else 1319 else
1321 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1320 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1322 if ( !incidence->location().isEmpty() ) 1321 if ( !incidence->location().isEmpty() )
1323 startString += " (" +incidence->location()+")"; 1322 startString += " (" +incidence->location()+")";
1324 setCaption( incidence->summary()+startString); 1323 setCaption( incidence->summary()+startString);
1325 1324
1326 enableIncidenceActions( true ); 1325 enableIncidenceActions( true );
1327 1326
1328 if ( incidence->type() == "Event" ) { 1327 if ( incidence->type() == "Event" ) {
1329 mShowAction->setText( i18n("Show Event...") ); 1328 mShowAction->setText( i18n("Show Event...") );
1330 mEditAction->setText( i18n("Edit Event...") ); 1329 mEditAction->setText( i18n("Edit Event...") );
1331 mDeleteAction->setText( i18n("Delete Event...") ); 1330 mDeleteAction->setText( i18n("Delete Event...") );
1332 1331
1333 mNewSubTodoAction->setEnabled( false ); 1332 mNewSubTodoAction->setEnabled( false );
1334 } else if ( incidence->type() == "Todo" ) { 1333 } else if ( incidence->type() == "Todo" ) {
1335 mShowAction->setText( i18n("Show Todo...") ); 1334 mShowAction->setText( i18n("Show Todo...") );
1336 mEditAction->setText( i18n("Edit Todo...") ); 1335 mEditAction->setText( i18n("Edit Todo...") );
1337 mDeleteAction->setText( i18n("Delete Todo...") ); 1336 mDeleteAction->setText( i18n("Delete Todo...") );
1338 1337
1339 mNewSubTodoAction->setEnabled( true ); 1338 mNewSubTodoAction->setEnabled( true );
1340 } else { 1339 } else {
1341 mShowAction->setText( i18n("Show...") ); 1340 mShowAction->setText( i18n("Show...") );
1342 mShowAction->setText( i18n("Edit...") ); 1341 mShowAction->setText( i18n("Edit...") );
1343 mShowAction->setText( i18n("Delete...") ); 1342 mShowAction->setText( i18n("Delete...") );
1344 1343
1345 mNewSubTodoAction->setEnabled( false ); 1344 mNewSubTodoAction->setEnabled( false );
1346 } 1345 }
1347} 1346}
1348 1347
1349void MainWindow::enableIncidenceActions( bool enabled ) 1348void MainWindow::enableIncidenceActions( bool enabled )
1350{ 1349{
1351 mShowAction->setEnabled( enabled ); 1350 mShowAction->setEnabled( enabled );
1352 mEditAction->setEnabled( enabled ); 1351 mEditAction->setEnabled( enabled );
1353 mDeleteAction->setEnabled( enabled ); 1352 mDeleteAction->setEnabled( enabled );
1354 1353
1355 mCloneAction->setEnabled( enabled ); 1354 mCloneAction->setEnabled( enabled );
1356 mMoveAction->setEnabled( enabled ); 1355 mMoveAction->setEnabled( enabled );
1357 mBeamAction->setEnabled( enabled ); 1356 mBeamAction->setEnabled( enabled );
1358 mCancelAction->setEnabled( enabled ); 1357 mCancelAction->setEnabled( enabled );
1359} 1358}
1360 1359
1361void MainWindow::importOL() 1360void MainWindow::importOL()
1362{ 1361{
1363#ifdef _WIN32_ 1362#ifdef _WIN32_
1364 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1363 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1365 id->exec(); 1364 id->exec();
1366 delete id; 1365 delete id;
1367 mView->updateView(); 1366 mView->updateView();
1368#endif 1367#endif
1369} 1368}
1370void MainWindow::importBday() 1369void MainWindow::importBday()
1371{ 1370{
1372 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1371 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1373 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1372 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1374 i18n("Import!"), i18n("Cancel"), 0, 1373 i18n("Import!"), i18n("Cancel"), 0,
1375 0, 1 ); 1374 0, 1 );
1376 if ( result == 0 ) { 1375 if ( result == 0 ) {
1377 mView->importBday(); 1376 mView->importBday();
1378 1377
1379 } 1378 }
1380 1379
1381 1380
1382} 1381}
1383void MainWindow::importQtopia() 1382void MainWindow::importQtopia()
1384{ 1383{
1385#ifndef DESKTOP_VERSION 1384#ifndef DESKTOP_VERSION
1386 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1385 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1387 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"), 1386 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"),
1388 i18n("Import!"), i18n("Cancel"), 0, 1387 i18n("Import!"), i18n("Cancel"), 0,
1389 0, 1 ); 1388 0, 1 );
1390 if ( result == 0 ) { 1389 if ( result == 0 ) {
1391 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1390 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1392 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1391 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1393 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1392 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1394 mView->importQtopia( categories, datebook, todolist ); 1393 mView->importQtopia( categories, datebook, todolist );
1395 } 1394 }
1396#else 1395#else
1397 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1396 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1398 i18n("Not supported \non desktop!\n"), 1397 i18n("Not supported \non desktop!\n"),
1399 i18n("Ok"), i18n("Cancel"), 0, 1398 i18n("Ok"), i18n("Cancel"), 0,
1400 0, 1 ); 1399 0, 1 );
1401 1400
1402#endif 1401#endif
1403} 1402}
1404 1403
1405void MainWindow::saveOnClose() 1404void MainWindow::saveOnClose()
1406{ 1405{
1407 KOPrefs *p = KOPrefs::instance(); 1406 KOPrefs *p = KOPrefs::instance();
1408 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1407 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1409 p->mToolBarUp = iconToolBar->x() > width()/2 || 1408 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1410 iconToolBar->y() > height()/2; 1409 iconToolBar->y() > height()/2;
1411 mView->writeSettings(); 1410 mView->writeSettings();
1412 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1411 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1413 save(); 1412 save();
1414} 1413}
1415void MainWindow::slotModifiedChanged( bool changed ) 1414void MainWindow::slotModifiedChanged( bool changed )
1416{ 1415{
1417 if ( mBlockAtStartup ) 1416 if ( mBlockAtStartup )
1418 return; 1417 return;
1419 int msec; 1418 int msec;
1420 // we store the changes after 1 minute, 1419 // we store the changes after 1 minute,
1421 // and for safety reasons after 10 minutes again 1420 // and for safety reasons after 10 minutes again
1422 if ( !mSyncManager->blockSave() ) 1421 if ( !mSyncManager->blockSave() )
1423 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1422 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1424 else 1423 else
1425 msec = 1000 * 600; 1424 msec = 1000 * 600;
1426 mSaveTimer.start( msec, true ); // 1 minute 1425 mSaveTimer.start( msec, true ); // 1 minute
1427 qDebug("KO: Saving File in %d secs!", msec/1000); 1426 qDebug("KO: Saving File in %d secs!", msec/1000);
1428 mCalendarModifiedFlag = true; 1427 mCalendarModifiedFlag = true;
1429} 1428}
1430void MainWindow::save() 1429void MainWindow::save()
1431{ 1430{
1432 if ( mSyncManager->blockSave() ) 1431 if ( mSyncManager->blockSave() )
1433 return; 1432 return;
1434 mSyncManager->setBlockSave(true); 1433 mSyncManager->setBlockSave(true);
1435 if ( mView->checkFileVersion( defaultFileName()) ) { 1434 if ( mView->checkFileVersion( defaultFileName()) ) {
1436 1435
1437 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1436 QTime neededSaveTime = QDateTime::currentDateTime().time();
1438 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1437 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1439 qDebug("KO: Start saving data to file!"); 1438 qDebug("KO: Start saving data to file!");
1440 mView->saveCalendar( defaultFileName() ); 1439 mView->saveCalendar( defaultFileName() );
1441 1440
1442 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1441 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1443 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1442 qDebug("KO: Needed %d ms for saving.",msNeeded );
1444 QString savemes; 1443 QString savemes;
1445 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1444 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1446 setCaption(savemes); 1445 setCaption(savemes);
1447 } else 1446 } else
1448 setCaption(i18n("Saving cancelled!")); 1447 setCaption(i18n("Saving cancelled!"));
1449 mCalendarModifiedFlag = false; 1448 mCalendarModifiedFlag = false;
1450 mSyncManager->setBlockSave( false ); 1449 mSyncManager->setBlockSave( false );
1451} 1450}
1452 1451
1453void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1452void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1454{ 1453{
1455 if ( !e->isAutoRepeat() ) { 1454 if ( !e->isAutoRepeat() ) {
1456 mFlagKeyPressed = false; 1455 mFlagKeyPressed = false;
1457 } 1456 }
1458} 1457}
1459void MainWindow::keyPressEvent ( QKeyEvent * e ) 1458void MainWindow::keyPressEvent ( QKeyEvent * e )
1460{ 1459{
1461 qApp->processEvents(); 1460 qApp->processEvents();
1462 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1461 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1463 e->ignore(); 1462 e->ignore();
1464 // qDebug(" ignore %d",e->isAutoRepeat() ); 1463 // qDebug(" ignore %d",e->isAutoRepeat() );
1465 return; 1464 return;
1466 } 1465 }
1467 if (! e->isAutoRepeat() ) 1466 if (! e->isAutoRepeat() )
1468 mFlagKeyPressed = true; 1467 mFlagKeyPressed = true;
1469 KOPrefs *p = KOPrefs::instance(); 1468 KOPrefs *p = KOPrefs::instance();
1470 bool showSelectedDates = false; 1469 bool showSelectedDates = false;
1471 int size; 1470 int size;
1472 int pro = 0; 1471 int pro = 0;
1473 //qDebug("MainWindow::keyPressEvent "); 1472 //qDebug("MainWindow::keyPressEvent ");
1474 switch ( e->key() ) { 1473 switch ( e->key() ) {
1475 case Qt::Key_Right: 1474 case Qt::Key_Right:
1476 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1475 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1477 mView->goNextMonth(); 1476 mView->goNextMonth();
1478 else 1477 else
1479 mView->goNext(); 1478 mView->goNext();
1480 showSelectedDates = true; 1479 showSelectedDates = true;
1481 break; 1480 break;
1482 case Qt::Key_Left: 1481 case Qt::Key_Left:
1483 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1482 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1484 mView->goPreviousMonth(); 1483 mView->goPreviousMonth();
1485 else 1484 else
1486 mView->goPrevious(); 1485 mView->goPrevious();
1487 showSelectedDates = true; 1486 showSelectedDates = true;
1488 break; 1487 break;
1489 case Qt::Key_Down: 1488 case Qt::Key_Down:
1490 mView->viewManager()->agendaView()->scrollOneHourDown(); 1489 mView->viewManager()->agendaView()->scrollOneHourDown();
1491 break; 1490 break;
1492 case Qt::Key_Up: 1491 case Qt::Key_Up:
1493 mView->viewManager()->agendaView()->scrollOneHourUp(); 1492 mView->viewManager()->agendaView()->scrollOneHourUp();
1494 break; 1493 break;
1495 case Qt::Key_I: 1494 case Qt::Key_I:
1496 mView->showIncidence(); 1495 mView->showIncidence();
1497 break; 1496 break;
1498 case Qt::Key_Delete: 1497 case Qt::Key_Delete:
1499 case Qt::Key_Backspace: 1498 case Qt::Key_Backspace:
1500 mView->deleteIncidence(); 1499 mView->deleteIncidence();
1501 break; 1500 break;
1502 case Qt::Key_D: 1501 case Qt::Key_D:
1503 mView->viewManager()->showDayView(); 1502 mView->viewManager()->showDayView();
1504 showSelectedDates = true; 1503 showSelectedDates = true;
1505 break; 1504 break;
1506 case Qt::Key_O: 1505 case Qt::Key_O:
1507 mView->toggleFilerEnabled( ); 1506 mView->toggleFilerEnabled( );
1508 break; 1507 break;
1509 case Qt::Key_0: 1508 case Qt::Key_0:
1510 case Qt::Key_1: 1509 case Qt::Key_1:
1511 case Qt::Key_2: 1510 case Qt::Key_2:
1512 case Qt::Key_3: 1511 case Qt::Key_3:
1513 case Qt::Key_4: 1512 case Qt::Key_4:
1514 case Qt::Key_5: 1513 case Qt::Key_5:
1515 case Qt::Key_6: 1514 case Qt::Key_6:
1516 case Qt::Key_7: 1515 case Qt::Key_7:
1517 case Qt::Key_8: 1516 case Qt::Key_8:
1518 case Qt::Key_9: 1517 case Qt::Key_9:
1519 pro = e->key()-48; 1518 pro = e->key()-48;
1520 if ( pro == 0 ) 1519 if ( pro == 0 )
1521 pro = 10; 1520 pro = 10;
1522 if ( e->state() == Qt::ControlButton) 1521 if ( e->state() == Qt::ControlButton)
1523 pro += 10; 1522 pro += 10;
1524 break; 1523 break;
1525 case Qt::Key_M: 1524 case Qt::Key_M:
1526 mView->viewManager()->showMonthView(); 1525 mView->viewManager()->showMonthView();
1527 showSelectedDates = true; 1526 showSelectedDates = true;
1528 break; 1527 break;
1529 case Qt::Key_Insert: 1528 case Qt::Key_Insert:
1530 mView->newEvent(); 1529 mView->newEvent();
1531 break; 1530 break;
1532 case Qt::Key_S : 1531 case Qt::Key_S :
1533 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1532 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1534 mView->newSubTodo(); 1533 mView->newSubTodo();
1535 else 1534 else
1536 mView->dialogManager()->showSearchDialog(); 1535 mView->dialogManager()->showSearchDialog();
1537 break; 1536 break;
1538 case Qt::Key_Y : 1537 case Qt::Key_Y :
1539 case Qt::Key_Z : 1538 case Qt::Key_Z :
1540 mView->viewManager()->showWorkWeekView(); 1539 mView->viewManager()->showWorkWeekView();
1541 showSelectedDates = true; 1540 showSelectedDates = true;
1542 break; 1541 break;
1543 case Qt::Key_U : 1542 case Qt::Key_U :
1544 mView->viewManager()->showWeekView(); 1543 mView->viewManager()->showWeekView();
1545 showSelectedDates = true; 1544 showSelectedDates = true;
1546 break; 1545 break;
1547 case Qt::Key_H : 1546 case Qt::Key_H :
1548 keyBindings(); 1547 keyBindings();
1549 break; 1548 break;
1550 case Qt::Key_W: 1549 case Qt::Key_W:
1551 mView->viewManager()->showWhatsNextView(); 1550 mView->viewManager()->showWhatsNextView();
1552 break; 1551 break;
1553 case Qt::Key_L: 1552 case Qt::Key_L:
1554 mView->viewManager()->showListView(); 1553 mView->viewManager()->showListView();
1555 break; 1554 break;
1556 case Qt::Key_N: 1555 case Qt::Key_N:
1557 mView->viewManager()->showNextXView(); 1556 mView->viewManager()->showNextXView();
1558 showSelectedDates = true; 1557 showSelectedDates = true;
1559 break; 1558 break;
1560 case Qt::Key_V: 1559 case Qt::Key_V:
1561 mView->viewManager()->showTodoView(); 1560 mView->viewManager()->showTodoView();
1562 break; 1561 break;
1563 case Qt::Key_C: 1562 case Qt::Key_C:
1564 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1563 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1565 break; 1564 break;
1566 case Qt::Key_P: 1565 case Qt::Key_P:
1567 mView->showDatePicker( ); 1566 mView->showDatePicker( );
1568 break; 1567 break;
1569 case Qt::Key_F: 1568 case Qt::Key_F:
1570 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1569 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1571 mView->editFilters(); 1570 mView->editFilters();
1572 else 1571 else
1573 mView->toggleFilter(); 1572 mView->toggleFilter();
1574 break; 1573 break;
1575 case Qt::Key_X: 1574 case Qt::Key_X:
1576 mView->toggleDateNavigatorWidget(); 1575 mView->toggleDateNavigatorWidget();
1577 break; 1576 break;
1578 case Qt::Key_Space: 1577 case Qt::Key_Space:
1579 mView->toggleExpand(); 1578 mView->toggleExpand();
1580 break; 1579 break;
1581 case Qt::Key_A: 1580 case Qt::Key_A:
1582 mView->toggleAllDaySize(); 1581 mView->toggleAllDaySize();
1583 break; 1582 break;
1584 case Qt::Key_T: 1583 case Qt::Key_T:
1585 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1584 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1586 mView->newTodo(); 1585 mView->newTodo();
1587 else { 1586 else {
1588 mView->goToday(); 1587 mView->goToday();
1589 showSelectedDates = true; 1588 showSelectedDates = true;
1590 } 1589 }
1591 break; 1590 break;
1592 case Qt::Key_J: 1591 case Qt::Key_J:
1593 mView->viewManager()->showJournalView(); 1592 mView->viewManager()->showJournalView();
1594 break; 1593 break;
1595 case Qt::Key_B: 1594 case Qt::Key_B:
1596 mView->editIncidenceDescription();; 1595 mView->editIncidenceDescription();;
1597 break; 1596 break;
1598 // case Qt::Key_Return: 1597 // case Qt::Key_Return:
1599 case Qt::Key_E: 1598 case Qt::Key_E:
1600 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1599 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1601 mView->newEvent(); 1600 mView->newEvent();
1602 else 1601 else
1603 mView->editIncidence(); 1602 mView->editIncidence();
1604 break; 1603 break;
1605 case Qt::Key_Plus: 1604 case Qt::Key_Plus:
1606 size = p->mHourSize +2; 1605 size = p->mHourSize +2;
1607 if ( size <= 18 ) 1606 if ( size <= 18 )
1608 configureAgenda( size ); 1607 configureAgenda( size );
1609 break; 1608 break;
1610 case Qt::Key_Minus: 1609 case Qt::Key_Minus:
1611 size = p->mHourSize - 2; 1610 size = p->mHourSize - 2;
1612 if ( size >= 4 ) 1611 if ( size >= 4 )
1613 configureAgenda( size ); 1612 configureAgenda( size );
1614 break; 1613 break;
1615 1614
1616 1615
1617 default: 1616 default:
1618 e->ignore(); 1617 e->ignore();
1619 } 1618 }
1620 if ( pro > 0 ) { 1619 if ( pro > 0 ) {
1621 mView->selectFilter( pro-1 ); 1620 mView->selectFilter( pro-1 );
1622 } 1621 }
1623 if ( showSelectedDates ) { 1622 if ( showSelectedDates ) {
1624 ;// setCaptionToDates(); 1623 ;// setCaptionToDates();
1625 } 1624 }
1626 1625
1627} 1626}
1628 1627
1629void MainWindow::fillFilterMenu() 1628void MainWindow::fillFilterMenu()
1630{ 1629{
1631 selectFilterMenu->clear(); 1630 selectFilterMenu->clear();
1632 bool disable = false; 1631 bool disable = false;
1633 if ( mView->filterView()->filtersEnabled() ) { 1632 if ( mView->filterView()->filtersEnabled() ) {
1634 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1633 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1635 } 1634 }
1636 else { 1635 else {
1637 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1636 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1638 disable = true; 1637 disable = true;
1639 } 1638 }
1640 selectFilterMenu->insertSeparator(); 1639 selectFilterMenu->insertSeparator();
1641 QPtrList<CalFilter> fili = mView->filters(); 1640 QPtrList<CalFilter> fili = mView->filters();
1642 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1641 CalFilter *curfilter = mView->filterView()->selectedFilter();
1643 CalFilter *filter = fili.first(); 1642 CalFilter *filter = fili.first();
1644 int iii = 1; 1643 int iii = 1;
1645 while(filter) { 1644 while(filter) {
1646 selectFilterMenu->insertItem( filter->name(), iii ); 1645 selectFilterMenu->insertItem( filter->name(), iii );
1647 if ( filter == curfilter) 1646 if ( filter == curfilter)
1648 selectFilterMenu->setItemChecked( iii, true ); 1647 selectFilterMenu->setItemChecked( iii, true );
1649 if ( disable ) 1648 if ( disable )
1650 selectFilterMenu->setItemEnabled( iii, false ); 1649 selectFilterMenu->setItemEnabled( iii, false );
1651 filter = fili.next(); 1650 filter = fili.next();
1652 ++iii; 1651 ++iii;
1653 } 1652 }
1654} 1653}
1655void MainWindow::selectFilter( int fil ) 1654void MainWindow::selectFilter( int fil )
1656{ 1655{
1657 if ( fil == 0 ) { 1656 if ( fil == 0 ) {
1658 mView->toggleFilerEnabled( ); 1657 mView->toggleFilerEnabled( );
1659 } else { 1658 } else {
1660 mView->selectFilter( fil-1 ); 1659 mView->selectFilter( fil-1 );
1661 } 1660 }
1662} 1661}
1663void MainWindow::configureToolBar( int item ) 1662void MainWindow::configureToolBar( int item )
1664{ 1663{
1665 1664
1666 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1665 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1667 KOPrefs *p = KOPrefs::instance(); 1666 KOPrefs *p = KOPrefs::instance();
1668 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1667 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1669 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1668 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1670 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1669 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1671 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1670 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1672 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1671 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1673 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1672 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1674 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1673 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1675 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1674 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1676 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1675 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1677 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1676 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1678 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1677 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1679 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1678 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1680 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1679 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1681 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1680 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1682 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1681 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1683 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1682 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1684 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1683 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1685 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1684 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1686 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1685 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1687 // initActions(); 1686 // initActions();
1688} 1687}
1689 1688
1690void MainWindow::setCaptionToDates() 1689void MainWindow::setCaptionToDates()
1691{ 1690{
1692 QString selDates; 1691 QString selDates;
1693 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1692 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1694 if (mView->startDate() < mView->endDate() ) 1693 if (mView->startDate() < mView->endDate() )
1695 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1694 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1696 setCaption( i18n("Dates: ") + selDates ); 1695 setCaption( i18n("Dates: ") + selDates );
1697 1696
1698} 1697}
1699// parameter item == 0: reinit 1698// parameter item == 0: reinit
1700void MainWindow::configureAgenda( int item ) 1699void MainWindow::configureAgenda( int item )
1701{ 1700{
1702 1701
1703 KOPrefs *p = KOPrefs::instance(); 1702 KOPrefs *p = KOPrefs::instance();
1704 1703
1705 int i; 1704 int i;
1706 if ( item == 1 ) { 1705 if ( item == 1 ) {
1707 mView->toggleAllDaySize(); 1706 mView->toggleAllDaySize();
1708 return; 1707 return;
1709 } 1708 }
1710 // do not allow 4 for widgets higher than 480 1709 // do not allow 4 for widgets higher than 480
1711 // if ( QApplication::desktop()->height() > 480 ) { 1710 // if ( QApplication::desktop()->height() > 480 ) {
1712// if ( item == 4 ) 1711// if ( item == 4 )
1713// item = 6; 1712// item = 6;
1714// } 1713// }
1715 for ( i = 4; i <= 18; i= i+2 ) 1714 for ( i = 4; i <= 18; i= i+2 )
1716 configureAgendaMenu->setItemChecked( i, false ); 1715 configureAgendaMenu->setItemChecked( i, false );
1717 configureAgendaMenu->setItemChecked( item, true ); 1716 configureAgendaMenu->setItemChecked( item, true );
1718 if ( p->mHourSize == item ) 1717 if ( p->mHourSize == item )
1719 return; 1718 return;
1720 p->mHourSize=item; 1719 p->mHourSize=item;
1721 mView->viewManager()->agendaView()->updateConfig(); 1720 mView->viewManager()->agendaView()->updateConfig();
1722} 1721}
1723 1722
1724void MainWindow::saveCalendar() 1723void MainWindow::saveCalendar()
1725{ 1724{
1726 QString fn = KOPrefs::instance()->mLastSaveFile; 1725 QString fn = KOPrefs::instance()->mLastSaveFile;
1727 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1726 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1728 1727
1729 if ( fn == "" ) 1728 if ( fn == "" )
1730 return; 1729 return;
1731 QFileInfo info; 1730 QFileInfo info;
1732 info.setFile( fn ); 1731 info.setFile( fn );
1733 QString mes; 1732 QString mes;
1734 bool createbup = true; 1733 bool createbup = true;
1735 if ( info. exists() ) { 1734 if ( info. exists() ) {
1736 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1735 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1737 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1736 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1738 i18n("Overwrite!"), i18n("Cancel"), 0, 1737 i18n("Overwrite!"), i18n("Cancel"), 0,
1739 0, 1 ); 1738 0, 1 );
1740 if ( result != 0 ) { 1739 if ( result != 0 ) {
1741 createbup = false; 1740 createbup = false;
1742 } 1741 }
1743 } 1742 }
1744 if ( createbup ) { 1743 if ( createbup ) {
1745 mView->saveCalendar( fn ); 1744 mView->saveCalendar( fn );
1746 mes = i18n("KO/Pi:Saved %1").arg(fn); 1745 mes = i18n("KO/Pi:Saved %1").arg(fn);
1747 KOPrefs::instance()->mLastSaveFile = fn; 1746 KOPrefs::instance()->mLastSaveFile = fn;
1748 setCaption(mes); 1747 setCaption(mes);
1749 } 1748 }
1750} 1749}
1751void MainWindow::loadCalendar() 1750void MainWindow::loadCalendar()
1752{ 1751{
1753 1752
1754 QString fn = KOPrefs::instance()->mLastLoadFile; 1753 QString fn = KOPrefs::instance()->mLastLoadFile;
1755 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1754 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1756 1755
1757 if ( fn == "" ) 1756 if ( fn == "" )
1758 return; 1757 return;
1759 QFileInfo info; 1758 QFileInfo info;
1760 info.setFile( fn ); 1759 info.setFile( fn );
1761 QString mess; 1760 QString mess;
1762 bool loadbup = true; 1761 bool loadbup = true;
1763 if ( info. exists() ) { 1762 if ( info. exists() ) {
1764 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1763 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1765 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1764 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1766 mess, 1765 mess,
1767 i18n("Load!"), i18n("Cancel"), 0, 1766 i18n("Load!"), i18n("Cancel"), 0,
1768 0, 1 ); 1767 0, 1 );
1769 if ( result != 0 ) { 1768 if ( result != 0 ) {
1770 loadbup = false; 1769 loadbup = false;
1771 } 1770 }
1772 } else { 1771 } else {
1773 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1772 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1774 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1773 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1775 0, 1 ); 1774 0, 1 );
1776 1775
1777 return; 1776 return;
1778 } 1777 }
1779 if ( loadbup ) { 1778 if ( loadbup ) {
1780 mView->openCalendar( fn ); 1779 mView->openCalendar( fn );
1781 KOPrefs::instance()->mLastLoadFile = fn; 1780 KOPrefs::instance()->mLastLoadFile = fn;
1782 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1781 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1783 setCaption(mess); 1782 setCaption(mess);
1784 } 1783 }
1785 1784
1786} 1785}
1787void MainWindow::quickImportIcal() 1786void MainWindow::quickImportIcal()
1788{ 1787{
1789 importFile( KOPrefs::instance()->mLastImportFile, false ); 1788 importFile( KOPrefs::instance()->mLastImportFile, false );
1790} 1789}
1791void MainWindow::importFile( QString fn, bool quick ) 1790void MainWindow::importFile( QString fn, bool quick )
1792{ 1791{
1793 QFileInfo info; 1792 QFileInfo info;
1794 info.setFile( fn ); 1793 info.setFile( fn );
1795 QString mess; 1794 QString mess;
1796 bool loadbup = true; 1795 bool loadbup = true;
1797 if ( !info. exists() ) { 1796 if ( !info. exists() ) {
1798 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1797 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1799 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1798 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1800 mess ); 1799 mess );
1801 return; 1800 return;
1802 } 1801 }
1803 int result = 0; 1802 int result = 0;
1804 if ( !quick ) { 1803 if ( !quick ) {
1805 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 )); 1804 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 ));
1806 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1805 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1807 mess, 1806 mess,
1808 "Import", "Cancel", 0, 1807 "Import", "Cancel", 0,
1809 0, 1 ); 1808 0, 1 );
1810 } 1809 }
1811 if ( result == 0 ) { 1810 if ( result == 0 ) {
1812 if ( mView->openCalendar( fn, true )) { 1811 if ( mView->openCalendar( fn, true )) {
1813 KOPrefs::instance()->mLastImportFile = fn; 1812 KOPrefs::instance()->mLastImportFile = fn;
1814 setCaption(i18n("Imported file successfully")); 1813 setCaption(i18n("Imported file successfully"));
1815 } else { 1814 } else {
1816 setCaption(i18n("Error importing file")); 1815 setCaption(i18n("Error importing file"));
1817 } 1816 }
1818 } 1817 }
1819} 1818}
1820 1819
1821void MainWindow::importIcal() 1820void MainWindow::importIcal()
1822{ 1821{
1823 1822
1824 QString fn =KOPrefs::instance()->mLastImportFile; 1823 QString fn =KOPrefs::instance()->mLastImportFile;
1825 1824
1826 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1825 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1827 if ( fn == "" ) 1826 if ( fn == "" )
1828 return; 1827 return;
1829 importFile( fn, true ); 1828 importFile( fn, true );
1830 1829
1831} 1830}
1832 1831
1833void MainWindow::exportVCalendar() 1832void MainWindow::exportVCalendar()
1834{ 1833{
1835 QString fn = KOPrefs::instance()->mLastVcalFile; 1834 QString fn = KOPrefs::instance()->mLastVcalFile;
1836 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1835 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1837 if ( fn == "" ) 1836 if ( fn == "" )
1838 return; 1837 return;
1839 QFileInfo info; 1838 QFileInfo info;
1840 info.setFile( fn ); 1839 info.setFile( fn );
1841 QString mes; 1840 QString mes;
1842 bool createbup = true; 1841 bool createbup = true;
1843 if ( info. exists() ) { 1842 if ( info. exists() ) {
1844 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1843 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1845 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1844 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1846 i18n("Overwrite!"), i18n("Cancel"), 0, 1845 i18n("Overwrite!"), i18n("Cancel"), 0,
1847 0, 1 ); 1846 0, 1 );
1848 if ( result != 0 ) { 1847 if ( result != 0 ) {
1849 createbup = false; 1848 createbup = false;
1850 } 1849 }
1851 } 1850 }
1852 if ( createbup ) { 1851 if ( createbup ) {
1853 if ( mView->exportVCalendar( fn ) ) { 1852 if ( mView->exportVCalendar( fn ) ) {
1854 KOPrefs::instance()->mLastVcalFile = fn; 1853 KOPrefs::instance()->mLastVcalFile = fn;
1855 if ( fn.length() > 20 ) 1854 if ( fn.length() > 20 )
1856 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1855 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1857 else 1856 else
1858 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1857 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1859 setCaption(mes); 1858 setCaption(mes);
1860 } 1859 }
1861 } 1860 }
1862 1861
1863} 1862}
1864 1863
1865void MainWindow::syncFileRequest() 1864void MainWindow::syncFileRequest()
1866{ 1865{
1867 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1866 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1868 mSyncManager->slotSyncMenu( 999 ); 1867 mSyncManager->slotSyncMenu( 999 );
1869 } 1868 }
1870 save(); 1869 save();
1871} 1870}
1872void MainWindow::getFile( bool success ) 1871void MainWindow::getFile( bool success )
1873{ 1872{
1874 if ( ! success ) { 1873 if ( ! success ) {
1875 setCaption( i18n("Error receiving file. Nothing changed!") ); 1874 setCaption( i18n("Error receiving file. Nothing changed!") );
1876 return; 1875 return;
1877 } 1876 }
1878 mView->openCalendar( defaultFileName() ); 1877 mView->openCalendar( defaultFileName() );
1879 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1878 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1880 mSyncManager->slotSyncMenu( 999 ); 1879 mSyncManager->slotSyncMenu( 999 );
1881 } 1880 }
1882 setCaption( i18n("Pi-Sync successful!") ); 1881 setCaption( i18n("Pi-Sync successful!") );
1883} 1882}
1884 1883
1885void MainWindow::printSel( ) 1884void MainWindow::printSel( )
1886{ 1885{
1887 mView->viewManager()->agendaView()->agenda()->printSelection(); 1886 mView->viewManager()->agendaView()->agenda()->printSelection();
1888} 1887}
1889 1888
1890void MainWindow::printCal() 1889void MainWindow::printCal()
1891{ 1890{
1892 mView->print();//mCp->showDialog(); 1891 mView->print();//mCp->showDialog();
1893} 1892}
1894 1893