summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e32c18..1c74307 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -95,654 +95,680 @@ class KOex2phonePrefs : public QDialog
95 mPhoneConnection = new QLineEdit( temphb); 95 mPhoneConnection = new QLineEdit( temphb);
96 lay->addWidget( temphb ); 96 lay->addWidget( temphb );
97 temphb = new QHBox( this ); 97 temphb = new QHBox( this );
98 new QLabel( i18n("Model(opt.): "), temphb ); 98 new QLabel( i18n("Model(opt.): "), temphb );
99 mPhoneModel = new QLineEdit( temphb); 99 mPhoneModel = new QLineEdit( temphb);
100 lay->addWidget( temphb ); 100 lay->addWidget( temphb );
101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
102 mWriteBackFuture->setChecked( true ); 102 mWriteBackFuture->setChecked( true );
103 lay->addWidget( mWriteBackFuture ); 103 lay->addWidget( mWriteBackFuture );
104 temphb = new QHBox( this ); 104 temphb = new QHBox( this );
105 new QLabel( i18n("Max. weeks in future: ") , temphb ); 105 new QLabel( i18n("Max. weeks in future: ") , temphb );
106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
107 mWriteBackFutureWeeks->setValue( 8 ); 107 mWriteBackFutureWeeks->setValue( 8 );
108 lay->addWidget( temphb ); 108 lay->addWidget( temphb );
109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
110 lab->setAlignment (AlignHCenter ); 110 lab->setAlignment (AlignHCenter );
111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
112 lay->addWidget( ok ); 112 lay->addWidget( ok );
113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
114 lay->addWidget( cancel ); 114 lay->addWidget( cancel );
115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
117 resize( 220, 240 ); 117 resize( 220, 240 );
118 qApp->processEvents(); 118 qApp->processEvents();
119 int dw = QApplication::desktop()->width(); 119 int dw = QApplication::desktop()->width();
120 int dh = QApplication::desktop()->height(); 120 int dh = QApplication::desktop()->height();
121 move( (dw-width())/2, (dh - height() )/2 ); 121 move( (dw-width())/2, (dh - height() )/2 );
122 } 122 }
123 123
124public: 124public:
125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
126 QCheckBox* mWriteBackFuture; 126 QCheckBox* mWriteBackFuture;
127 QSpinBox* mWriteBackFutureWeeks; 127 QSpinBox* mWriteBackFutureWeeks;
128}; 128};
129 129
130int globalFlagBlockStartup; 130int globalFlagBlockStartup;
131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
132 QMainWindow( parent, name ) 132 QMainWindow( parent, name )
133{ 133{
134 134
135#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
136 setFont( QFont("Arial"), 14 ); 136 setFont( QFont("Arial"), 14 );
137#endif 137#endif
138 mClosed = false; 138 mClosed = false;
139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
140 QString confFile = locateLocal("config","korganizerrc"); 140 QString confFile = locateLocal("config","korganizerrc");
141 QFileInfo finf ( confFile ); 141 QFileInfo finf ( confFile );
142 bool showWarning = !finf.exists(); 142 bool showWarning = !finf.exists();
143 setIcon(SmallIcon( "ko24" ) ); 143 setIcon(SmallIcon( "ko24" ) );
144 mBlockAtStartup = true; 144 mBlockAtStartup = true;
145 mFlagKeyPressed = false; 145 mFlagKeyPressed = false;
146 setCaption("KOrganizer/Pi"); 146 setCaption("KOrganizer/Pi");
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 KOPrefs *p = KOPrefs::instance(); 148 KOPrefs *p = KOPrefs::instance();
149 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
150 p->mHourSize = 18; 150 p->mHourSize = 18;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 mCalendarModifiedFlag = false; 169 mCalendarModifiedFlag = false;
170 170
171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
172 splash->setAlignment ( AlignCenter ); 172 splash->setAlignment ( AlignCenter );
173 setCentralWidget( splash ); 173 setCentralWidget( splash );
174#ifndef DESKTOP_VERSION 174#ifndef DESKTOP_VERSION
175 showMaximized(); 175 showMaximized();
176#endif 176#endif
177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
178 setDefaultPreferences(); 178 setDefaultPreferences();
179 mCalendar = new CalendarLocal(); 179 mCalendar = new CalendarLocal();
180 mView = new CalendarView( mCalendar, this,"mCalendar " ); 180 mView = new CalendarView( mCalendar, this,"mCalendar " );
181 mView->hide(); 181 mView->hide();
182 //mView->resize(splash->size() ); 182 //mView->resize(splash->size() );
183 initActions(); 183 initActions();
184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
185 mSyncManager->setBlockSave(false); 185 mSyncManager->setBlockSave(false);
186 mView->setSyncManager(mSyncManager); 186 mView->setSyncManager(mSyncManager);
187#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
188 iconToolBar->show(); 188 iconToolBar->show();
189 qApp->processEvents(); 189 qApp->processEvents();
190#endif 190#endif
191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
192 int vh = height() ; 192 int vh = height() ;
193 int vw = width(); 193 int vw = width();
194 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 194 //qDebug("Toolbar hei %d ",iconToolBar->height() );
195 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 195 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
196 vh -= iconToolBar->height(); 196 vh -= iconToolBar->height();
197 } else { 197 } else {
198 vw -= iconToolBar->height(); 198 vw -= iconToolBar->height();
199 } 199 }
200 //mView->setMaximumSize( splash->size() ); 200 //mView->setMaximumSize( splash->size() );
201 //mView->resize( splash->size() ); 201 //mView->resize( splash->size() );
202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
203 mView->readSettings(); 203 mView->readSettings();
204 bool newFile = false; 204 bool newFile = false;
205 if( !QFile::exists( defaultFileName() ) ) { 205 if( !QFile::exists( defaultFileName() ) ) {
206 QFileInfo finfo ( defaultFileName() ); 206 QFileInfo finfo ( defaultFileName() );
207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
208 qDebug("oldfile %s ", oldFile.latin1()); 208 qDebug("oldfile %s ", oldFile.latin1());
209 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"; 209 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";
210 finfo.setFile( oldFile ); 210 finfo.setFile( oldFile );
211 if (finfo.exists() ) { 211 if (finfo.exists() ) {
212 KMessageBox::information( this, message); 212 KMessageBox::information( this, message);
213 mView->openCalendar( oldFile ); 213 mView->openCalendar( oldFile );
214 qApp->processEvents(); 214 qApp->processEvents();
215 } else { 215 } else {
216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
217 finfo.setFile( oldFile ); 217 finfo.setFile( oldFile );
218 if (finfo.exists() ) { 218 if (finfo.exists() ) {
219 KMessageBox::information( this, message); 219 KMessageBox::information( this, message);
220 mView->openCalendar( oldFile ); 220 mView->openCalendar( oldFile );
221 qApp->processEvents(); 221 qApp->processEvents();
222 } 222 }
223 } 223 }
224 mView->saveCalendar( defaultFileName() ); 224 mView->saveCalendar( defaultFileName() );
225 newFile = true; 225 newFile = true;
226 } 226 }
227 227
228 QTime neededSaveTime = QDateTime::currentDateTime().time(); 228 QTime neededSaveTime = QDateTime::currentDateTime().time();
229 mView->openCalendar( defaultFileName() ); 229 mView->openCalendar( defaultFileName() );
230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
231 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 231 qDebug("KO: Calendar loading time: %d ms",msNeeded );
232 232
233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
234 KOPrefs::instance()->setCategoryDefaults(); 234 KOPrefs::instance()->setCategoryDefaults();
235 int count = mView->addCategories(); 235 int count = mView->addCategories();
236 } 236 }
237 processIncidenceSelection( 0 ); 237 processIncidenceSelection( 0 );
238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
239 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
240 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
241 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
242 242
243 243
244 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
245 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
247 mView->setModified( false ); 247 mView->setModified( false );
248 mBlockAtStartup = false; 248 mBlockAtStartup = false;
249 mView->setModified( false ); 249 mView->setModified( false );
250 setCentralWidget( mView ); 250 setCentralWidget( mView );
251 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
252 mView->show(); 252 mView->show();
253 delete splash; 253 delete splash;
254 if ( newFile ) 254 if ( newFile )
255 mView->updateConfig(); 255 mView->updateConfig();
256 // qApp->processEvents(); 256 // qApp->processEvents();
257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
258 //fillSyncMenu(); 258 //fillSyncMenu();
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
266 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
268 mSyncManager->fillSyncMenu(); 268 mSyncManager->fillSyncMenu();
269 269
270 270
271 271
272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
273 if ( showWarning ) { 273 if ( showWarning ) {
274 KMessageBox::information( this, 274 KMessageBox::information( this,
275 "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"); 275 "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");
276 qApp->processEvents(); 276 qApp->processEvents();
277 mView->dialogManager()->showSyncOptions(); 277 mView->dialogManager()->showSyncOptions();
278 } 278 }
279 279
280 //US listen for result adressed from Ka/Pi 280 //US listen for result adressed from Ka/Pi
281#ifndef DESKTOP_VERSION 281#ifndef DESKTOP_VERSION
282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
283#endif 283#endif
284#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
285 infrared = 0; 285 infrared = 0;
286#endif 286#endif
287 287 updateWeek( mView->startDate() );
288 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
289 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 290 mBRdisabled = false;
289 //toggleBeamReceive(); 291 //toggleBeamReceive();
290} 292}
291MainWindow::~MainWindow() 293MainWindow::~MainWindow()
292{ 294{
293 //qDebug("MainWindow::~MainWindow() "); 295 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 296 //save toolbar location
295 delete mCalendar; 297 delete mCalendar;
296 delete mSyncManager; 298 delete mSyncManager;
297#ifndef DESKTOP_VERSION 299#ifndef DESKTOP_VERSION
298 if ( infrared ) 300 if ( infrared )
299 delete infrared; 301 delete infrared;
300#endif 302#endif
301 303
302 304
303} 305}
304 306
305void MainWindow::disableBR(bool b) 307void MainWindow::disableBR(bool b)
306{ 308{
307#ifndef DESKTOP_VERSION 309#ifndef DESKTOP_VERSION
308 if ( b ) { 310 if ( b ) {
309 if ( infrared ) { 311 if ( infrared ) {
310 toggleBeamReceive(); 312 toggleBeamReceive();
311 mBRdisabled = true; 313 mBRdisabled = true;
312 } 314 }
313 mBRdisabled = true; 315 mBRdisabled = true;
314 } else { 316 } else {
315 if ( mBRdisabled ) { 317 if ( mBRdisabled ) {
316 mBRdisabled = false; 318 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 319 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 320 // toggleBeamReceive();
319 } 321 }
320 } 322 }
321#endif 323#endif
322 324
323} 325}
324bool MainWindow::beamReceiveEnabled() 326bool MainWindow::beamReceiveEnabled()
325{ 327{
326#ifndef DESKTOP_VERSION 328#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 329 return ( infrared != 0 );
328#endif 330#endif
329 return false; 331 return false;
330} 332}
331 333
332void MainWindow::toggleBeamReceive() 334void MainWindow::toggleBeamReceive()
333{ 335{
334 if ( mBRdisabled ) 336 if ( mBRdisabled )
335 return; 337 return;
336#ifndef DESKTOP_VERSION 338#ifndef DESKTOP_VERSION
337 if ( infrared ) { 339 if ( infrared ) {
338 qDebug("disable BeamReceive "); 340 qDebug("disable BeamReceive ");
339 delete infrared; 341 delete infrared;
340 infrared = 0; 342 infrared = 0;
341 brAction->setOn(false); 343 brAction->setOn(false);
342 return; 344 return;
343 } 345 }
344 qDebug("enable BeamReceive "); 346 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 347 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 348 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 349 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 350#endif
349} 351}
350void MainWindow::showMaximized () 352void MainWindow::showMaximized ()
351{ 353{
352#ifndef DESKTOP_VERSION 354#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 355 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 356 if ( mClosed )
355 mView->goToday(); 357 mView->goToday();
356#endif 358#endif
357 QWidget::showMaximized () ; 359 QWidget::showMaximized () ;
358 mClosed = false; 360 mClosed = false;
359} 361}
360void MainWindow::closeEvent( QCloseEvent* ce ) 362void MainWindow::closeEvent( QCloseEvent* ce )
361{ 363{
362 364
363 365
364 366
365 if ( ! KOPrefs::instance()->mAskForQuit ) { 367 if ( ! KOPrefs::instance()->mAskForQuit ) {
366 saveOnClose(); 368 saveOnClose();
367 mClosed = true; 369 mClosed = true;
368 ce->accept(); 370 ce->accept();
369 return; 371 return;
370 372
371 } 373 }
372 374
373 switch( QMessageBox::information( this, "KO/Pi", 375 switch( QMessageBox::information( this, "KO/Pi",
374 i18n("Do you really want\nto close KO/Pi?"), 376 i18n("Do you really want\nto close KO/Pi?"),
375 i18n("Close"), i18n("No"), 377 i18n("Close"), i18n("No"),
376 0, 0 ) ) { 378 0, 0 ) ) {
377 case 0: 379 case 0:
378 saveOnClose(); 380 saveOnClose();
379 mClosed = true; 381 mClosed = true;
380 ce->accept(); 382 ce->accept();
381 break; 383 break;
382 case 1: 384 case 1:
383 ce->ignore(); 385 ce->ignore();
384 break; 386 break;
385 case 2: 387 case 2:
386 388
387 default: 389 default:
388 break; 390 break;
389 } 391 }
390 392
391 393
392} 394}
393 395
394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 396void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
395{ 397{
396 QDataStream stream( data, IO_ReadOnly ); 398 QDataStream stream( data, IO_ReadOnly );
397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 399 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
398 //QString datamess; 400 //QString datamess;
399 //qDebug("message "); 401 //qDebug("message ");
400 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 402 qDebug("KO: QCOP message received: %s ", cmsg.data() );
401 403
402 if ( cmsg == "setDocument(QString)" ) { 404 if ( cmsg == "setDocument(QString)" ) {
403 QDataStream stream( data, IO_ReadOnly ); 405 QDataStream stream( data, IO_ReadOnly );
404 QString fileName; 406 QString fileName;
405 stream >> fileName; 407 stream >> fileName;
406 //qDebug("filename %s ", fileName.latin1()); 408 //qDebug("filename %s ", fileName.latin1());
407 showMaximized(); 409 showMaximized();
408 raise(); 410 raise();
409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 411 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
410 mSyncManager->slotSyncMenu( 1002 ); 412 mSyncManager->slotSyncMenu( 1002 );
411 return; 413 return;
412 } 414 }
413 415
414 if ( cmsg == "-writeFile" ) { 416 if ( cmsg == "-writeFile" ) {
415 // I made from the "-writeFile" an "-writeAlarm" 417 // I made from the "-writeFile" an "-writeAlarm"
416 mView->viewManager()->showWhatsNextView(); 418 mView->viewManager()->showWhatsNextView();
417 mCalendar->checkAlarmForIncidence( 0, true); 419 mCalendar->checkAlarmForIncidence( 0, true);
418 showMaximized(); 420 showMaximized();
419 raise(); 421 raise();
420 return; 422 return;
421 423
422 } 424 }
423 if ( cmsg == "-writeFileSilent" ) { 425 if ( cmsg == "-writeFileSilent" ) {
424 // I made from the "-writeFile" an "-writeAlarm" 426 // I made from the "-writeFile" an "-writeAlarm"
425 // mView->viewManager()->showWhatsNextView(); 427 // mView->viewManager()->showWhatsNextView();
426 mCalendar->checkAlarmForIncidence( 0, true); 428 mCalendar->checkAlarmForIncidence( 0, true);
427 //showMaximized(); 429 //showMaximized();
428 //raise(); 430 //raise();
429 hide(); 431 hide();
430 return; 432 return;
431 } 433 }
432 if ( cmsg == "-newCountdown" ) { 434 if ( cmsg == "-newCountdown" ) {
433 qDebug("newCountdown "); 435 qDebug("newCountdown ");
434 436
435 } 437 }
436 QString msg ; 438 QString msg ;
437 QString allmsg = cmsg; 439 QString allmsg = cmsg;
438 while ( allmsg.length() > 0 ) { 440 while ( allmsg.length() > 0 ) {
439 int nextC = allmsg.find( "-", 1 ); 441 int nextC = allmsg.find( "-", 1 );
440 if ( nextC == -1 ) { 442 if ( nextC == -1 ) {
441 msg = allmsg; 443 msg = allmsg;
442 allmsg = ""; 444 allmsg = "";
443 } else{ 445 } else{
444 msg = allmsg.left( nextC ); 446 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 447 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 448 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 449 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 450 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 451 mView->newEvent();
450 } 452 }
451 if ( msg == "-newTodo" ) { 453 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 454 mView->newTodo();
453 455
454 } 456 }
455 if ( msg == "-showWN" ) { 457 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 458 mView->viewManager()->showWhatsNextView();
457 } 459 }
458 if ( msg == "-showTodo" ) { 460 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 461 mView->viewManager()->showTodoView();
460 } 462 }
461 if ( msg == "-showList" ) { 463 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 464 mView->viewManager()->showListView();
463 } 465 }
464 else if ( msg == "-showDay" ) { 466 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 467 mView->viewManager()->showDayView();
466 } 468 }
467 else if ( msg == "-showWWeek" ) { 469 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 470 mView->viewManager()->showWorkWeekView();
469 } 471 }
470 else if ( msg == "-ringSync" ) { 472 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 473 mSyncManager->multiSync( false );
472 } 474 }
473 else if ( msg == "-showWeek" ) { 475 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 476 mView->viewManager()->showWeekView();
475 } 477 }
476 else if ( msg == "-showTodo" ) { 478 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 479 mView->viewManager()->showTodoView();
478 } 480 }
479 else if ( msg == "-showJournal" ) { 481 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 482 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 483 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 484 mView->viewManager()->showJournalView();
483 } 485 }
484 else if ( msg == "-showKO" ) { 486 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 487 mView->viewManager()->showNextXView();
486 } 488 }
487 else if ( msg == "-showWNext" || msg == "nextView()" ) { 489 else if ( msg == "-showWNext" || msg == "nextView()" ) {
488 mView->viewManager()->showWhatsNextView(); 490 mView->viewManager()->showWhatsNextView();
489 } 491 }
490 else if ( msg == "-showNextXView" ) { 492 else if ( msg == "-showNextXView" ) {
491 mView->viewManager()->showNextXView(); 493 mView->viewManager()->showNextXView();
492 } 494 }
493 495
494 496
495 } 497 }
496 498
497 showMaximized(); 499 showMaximized();
498 raise(); 500 raise();
499} 501}
500 502
501QPixmap MainWindow::loadPixmap( QString name ) 503QPixmap MainWindow::loadPixmap( QString name )
502{ 504{
503 return SmallIcon( name ); 505 return SmallIcon( name );
504 506
505} 507}
506void MainWindow::initActions() 508void MainWindow::initActions()
507{ 509{
508 //KOPrefs::instance()->mShowFullMenu 510 //KOPrefs::instance()->mShowFullMenu
509 iconToolBar->clear(); 511 iconToolBar->clear();
510 KOPrefs *p = KOPrefs::instance(); 512 KOPrefs *p = KOPrefs::instance();
511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 513 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
512 514
513 QPopupMenu *viewMenu = new QPopupMenu( this ); 515 QPopupMenu *viewMenu = new QPopupMenu( this );
514 QPopupMenu *actionMenu = new QPopupMenu( this ); 516 QPopupMenu *actionMenu = new QPopupMenu( this );
515 QPopupMenu *importMenu = new QPopupMenu( this ); 517 QPopupMenu *importMenu = new QPopupMenu( this );
516 selectFilterMenu = new QPopupMenu( this ); 518 selectFilterMenu = new QPopupMenu( this );
517 selectFilterMenu->setCheckable( true ); 519 selectFilterMenu->setCheckable( true );
518 syncMenu = new QPopupMenu( this ); 520 syncMenu = new QPopupMenu( this );
519 configureAgendaMenu = new QPopupMenu( this ); 521 configureAgendaMenu = new QPopupMenu( this );
520 configureToolBarMenu = new QPopupMenu( this ); 522 configureToolBarMenu = new QPopupMenu( this );
521 QPopupMenu *helpMenu = new QPopupMenu( this ); 523 QPopupMenu *helpMenu = new QPopupMenu( this );
522 if ( KOPrefs::instance()->mShowFullMenu ) { 524 if ( KOPrefs::instance()->mShowFullMenu ) {
523 QMenuBar *menuBar1; 525 QMenuBar *menuBar1;
524 menuBar1 = menuBar(); 526 menuBar1 = menuBar();
525 menuBar1->insertItem( i18n("File"), importMenu ); 527 menuBar1->insertItem( i18n("File"), importMenu );
526 menuBar1->insertItem( i18n("View"), viewMenu ); 528 menuBar1->insertItem( i18n("View"), viewMenu );
527 menuBar1->insertItem( i18n("Actions"), actionMenu ); 529 menuBar1->insertItem( i18n("Actions"), actionMenu );
528#ifdef DESKTOP_VERSION 530#ifdef DESKTOP_VERSION
529 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 531 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 532 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
531#else 533#else
532 menuBar1->insertItem( i18n("Sync"), syncMenu ); 534 menuBar1->insertItem( i18n("Sync"), syncMenu );
533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 535 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
534#endif 536#endif
535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 537 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 538 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
537 menuBar1->insertItem( i18n("Help"), helpMenu ); 539 menuBar1->insertItem( i18n("Help"), helpMenu );
538 } else { 540 } else {
539 QPEMenuBar *menuBar1; 541 QPEMenuBar *menuBar1;
540 menuBar1 = new QPEMenuBar( iconToolBar ); 542 menuBar1 = new QPEMenuBar( iconToolBar );
541 QPopupMenu *menuBar = new QPopupMenu( this ); 543 QPopupMenu *menuBar = new QPopupMenu( this );
542 menuBar1->insertItem( i18n("ME"), menuBar); 544 menuBar1->insertItem( i18n("ME"), menuBar);
543 menuBar->insertItem( i18n("File"), importMenu ); 545 menuBar->insertItem( i18n("File"), importMenu );
544 menuBar->insertItem( i18n("View"), viewMenu ); 546 menuBar->insertItem( i18n("View"), viewMenu );
545 menuBar->insertItem( i18n("Actions"), actionMenu ); 547 menuBar->insertItem( i18n("Actions"), actionMenu );
546 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 548 menuBar->insertItem( i18n("Synchronize"), syncMenu );
547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 549 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 550 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
549 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 551 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
550 menuBar->insertItem( i18n("Help"), helpMenu ); 552 menuBar->insertItem( i18n("Help"), helpMenu );
551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 553 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
552 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 554 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
553 } 555 }
554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 556 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 557 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
556 558
559 menuBarWeek = new QPEMenuBar( iconToolBar );
560 QPopupMenu * wpo = new QPopupMenu (this);
561 QPopupMenu * all = new QPopupMenu (this);
562 //wpo->insertItem( i18n("W#"), 0 );
563 int first = 1;
564 int i;
565 for ( i = 1; i < 50; ++i ) {
566 if ( !(i%10) ) {
567 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
568 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
569 first = i;
570 wpo = new QPopupMenu (this);
571 }
572 wpo->insertItem( QString::number(i), i );
573 }
574 for ( i = 50; i < 53; ++i ) {
575 wpo->insertItem( QString::number(i), i);
576 }
577 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
578 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
579 menuBarWeek->insertItem( "00",all,1);
580 menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( ));
581
582 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
557 // ****************** 583 // ******************
558 QAction *action; 584 QAction *action;
559 QIconSet icon; 585 QIconSet icon;
560 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 586 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
561 configureToolBarMenu->setCheckable( true ); 587 configureToolBarMenu->setCheckable( true );
562 588
563 QString pathString = ""; 589 QString pathString = "";
564 if ( !p->mToolBarMiniIcons ) { 590 if ( !p->mToolBarMiniIcons ) {
565 if ( QApplication::desktop()->width() < 480 ) 591 if ( QApplication::desktop()->width() < 480 )
566 pathString += "icons16/"; 592 pathString += "icons16/";
567 } else 593 } else
568 pathString += "iconsmini/"; 594 pathString += "iconsmini/";
569 configureAgendaMenu->setCheckable( true ); 595 configureAgendaMenu->setCheckable( true );
570 int iii ; 596 int iii ;
571 for ( iii = 1;iii<= 10 ;++iii ){ 597 for ( iii = 1;iii<= 10 ;++iii ){
572 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 598 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
573 } 599 }
574 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 600 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
575 601
576 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 602 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
577 this, SLOT( showConfigureAgenda( ) ) ); 603 this, SLOT( showConfigureAgenda( ) ) );
578 604
579 icon = loadPixmap( pathString + "configure" ); 605 icon = loadPixmap( pathString + "configure" );
580 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 606 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
581 action->addTo( actionMenu ); 607 action->addTo( actionMenu );
582 connect( action, SIGNAL( activated() ), 608 connect( action, SIGNAL( activated() ),
583 mView, SLOT( edit_options() ) ); 609 mView, SLOT( edit_options() ) );
584 actionMenu->insertSeparator(); 610 actionMenu->insertSeparator();
585 611
586 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 612 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
587 action->addTo( actionMenu ); 613 action->addTo( actionMenu );
588 connect( action, SIGNAL( activated() ), 614 connect( action, SIGNAL( activated() ),
589 mView, SLOT( undo_delete() ) ); 615 mView, SLOT( undo_delete() ) );
590 actionMenu->insertSeparator(); 616 actionMenu->insertSeparator();
591 617
592 icon = loadPixmap( pathString + "newevent" ); 618 icon = loadPixmap( pathString + "newevent" );
593 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 619 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
594 configureToolBarMenu->insertSeparator(); 620 configureToolBarMenu->insertSeparator();
595 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 621 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
596 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 622 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
597 ne_action->addTo( actionMenu ); 623 ne_action->addTo( actionMenu );
598 connect( ne_action, SIGNAL( activated() ), 624 connect( ne_action, SIGNAL( activated() ),
599 mView, SLOT( newEvent() ) ); 625 mView, SLOT( newEvent() ) );
600 icon = loadPixmap( pathString + "newtodo" ); 626 icon = loadPixmap( pathString + "newtodo" );
601 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 627 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
602 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 628 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
603 nt_action->addTo( actionMenu ); 629 nt_action->addTo( actionMenu );
604 connect( nt_action, SIGNAL( activated() ), 630 connect( nt_action, SIGNAL( activated() ),
605 mView, SLOT( newTodo() ) ); 631 mView, SLOT( newTodo() ) );
606 632
607 icon = loadPixmap( pathString + "today" ); 633 icon = loadPixmap( pathString + "today" );
608 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 634 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
609 today_action->addTo( viewMenu ); 635 today_action->addTo( viewMenu );
610 connect( today_action, SIGNAL( activated() ), 636 connect( today_action, SIGNAL( activated() ),
611 mView, SLOT( goToday() ) ); 637 mView, SLOT( goToday() ) );
612 viewMenu->insertSeparator(); 638 viewMenu->insertSeparator();
613 639
614 icon = loadPixmap( pathString + "navi" ); 640 icon = loadPixmap( pathString + "navi" );
615 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 641 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
616 action->addTo( viewMenu ); 642 action->addTo( viewMenu );
617 connect( action, SIGNAL( activated() ), 643 connect( action, SIGNAL( activated() ),
618 mView, SLOT( toggleDateNavigatorWidget() ) ); 644 mView, SLOT( toggleDateNavigatorWidget() ) );
619 mToggleNav = action ; 645 mToggleNav = action ;
620 icon = loadPixmap( pathString + "filter" ); 646 icon = loadPixmap( pathString + "filter" );
621 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 647 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
622 action->addTo( viewMenu ); 648 action->addTo( viewMenu );
623 connect( action, SIGNAL( activated() ), 649 connect( action, SIGNAL( activated() ),
624 mView, SLOT( toggleFilter() ) ); 650 mView, SLOT( toggleFilter() ) );
625 mToggleFilter = action; 651 mToggleFilter = action;
626 icon = loadPixmap( pathString + "allday" ); 652 icon = loadPixmap( pathString + "allday" );
627 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 653 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
628 action->addTo( viewMenu ); 654 action->addTo( viewMenu );
629 connect( action, SIGNAL( activated() ), 655 connect( action, SIGNAL( activated() ),
630 mView, SLOT( toggleAllDaySize() ) ); 656 mView, SLOT( toggleAllDaySize() ) );
631 mToggleAllday = action; 657 mToggleAllday = action;
632 658
633 659
634 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 660 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
635 mToggleNav, SLOT( setEnabled ( bool ) ) ); 661 mToggleNav, SLOT( setEnabled ( bool ) ) );
636 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 662 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
637 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 663 mToggleFilter, SLOT( setEnabled ( bool ) ) );
638 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 664 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
639 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 665 mToggleAllday, SLOT( setEnabled ( bool ) ) );
640 666
641 viewMenu->insertSeparator(); 667 viewMenu->insertSeparator();
642 icon = loadPixmap( pathString + "picker" ); 668 icon = loadPixmap( pathString + "picker" );
643 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 669 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
644 action->addTo( viewMenu ); 670 action->addTo( viewMenu );
645 connect( action, SIGNAL( activated() ), 671 connect( action, SIGNAL( activated() ),
646 mView, SLOT( showDatePicker() ) ); 672 mView, SLOT( showDatePicker() ) );
647 action->addTo( iconToolBar ); 673 action->addTo( iconToolBar );
648 viewMenu->insertSeparator(); 674 viewMenu->insertSeparator();
649 icon = loadPixmap( pathString + "list" ); 675 icon = loadPixmap( pathString + "list" );
650 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 676 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
651 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 677 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
652 showlist_action->addTo( viewMenu ); 678 showlist_action->addTo( viewMenu );
653 connect( showlist_action, SIGNAL( activated() ), 679 connect( showlist_action, SIGNAL( activated() ),
654 mView->viewManager(), SLOT( showListView() ) ); 680 mView->viewManager(), SLOT( showListView() ) );
655 681
656 682
657 icon = loadPixmap( pathString + "day" ); 683 icon = loadPixmap( pathString + "day" );
658 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 684 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
659 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 685 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
660 day1_action->addTo( viewMenu ); 686 day1_action->addTo( viewMenu );
661 // action->addTo( toolBar ); 687 // action->addTo( toolBar );
662 connect( day1_action, SIGNAL( activated() ), 688 connect( day1_action, SIGNAL( activated() ),
663 mView->viewManager(), SLOT( showDayView() ) ); 689 mView->viewManager(), SLOT( showDayView() ) );
664 690
665 icon = loadPixmap( pathString + "workweek" ); 691 icon = loadPixmap( pathString + "workweek" );
666 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 692 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
667 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 693 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
668 day5_action->addTo( viewMenu ); 694 day5_action->addTo( viewMenu );
669 connect( day5_action, SIGNAL( activated() ), 695 connect( day5_action, SIGNAL( activated() ),
670 mView->viewManager(), SLOT( showWorkWeekView() ) ); 696 mView->viewManager(), SLOT( showWorkWeekView() ) );
671 697
672 icon = loadPixmap( pathString + "week" ); 698 icon = loadPixmap( pathString + "week" );
673 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 699 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
674 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 700 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
675 day7_action->addTo( viewMenu ); 701 day7_action->addTo( viewMenu );
676 connect( day7_action, SIGNAL( activated() ), 702 connect( day7_action, SIGNAL( activated() ),
677 mView->viewManager(), SLOT( showWeekView() ) ); 703 mView->viewManager(), SLOT( showWeekView() ) );
678 704
679 icon = loadPixmap( pathString + "month" ); 705 icon = loadPixmap( pathString + "month" );
680 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 706 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
681 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 707 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
682 month_action->addTo( viewMenu ); 708 month_action->addTo( viewMenu );
683 connect( month_action, SIGNAL( activated() ), 709 connect( month_action, SIGNAL( activated() ),
684 mView->viewManager(), SLOT( showMonthView() ) ); 710 mView->viewManager(), SLOT( showMonthView() ) );
685 711
686 icon = loadPixmap( pathString + "todo" ); 712 icon = loadPixmap( pathString + "todo" );
687 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 713 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
688 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 714 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
689 todoview_action->addTo( viewMenu ); 715 todoview_action->addTo( viewMenu );
690 connect( todoview_action, SIGNAL( activated() ), 716 connect( todoview_action, SIGNAL( activated() ),
691 mView->viewManager(), SLOT( showTodoView() ) ); 717 mView->viewManager(), SLOT( showTodoView() ) );
692 718
693 icon = loadPixmap( pathString + "journal" ); 719 icon = loadPixmap( pathString + "journal" );
694 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 720 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
695 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 721 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
696 viewjournal_action->addTo( viewMenu ); 722 viewjournal_action->addTo( viewMenu );
697 connect( viewjournal_action, SIGNAL( activated() ), 723 connect( viewjournal_action, SIGNAL( activated() ),
698 mView->viewManager(), SLOT( showJournalView() ) ); 724 mView->viewManager(), SLOT( showJournalView() ) );
699 725
700 icon = loadPixmap( pathString + "xdays" ); 726 icon = loadPixmap( pathString + "xdays" );
701 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 727 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
702 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 728 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
703 xdays_action->addTo( viewMenu ); 729 xdays_action->addTo( viewMenu );
704 connect( xdays_action, SIGNAL( activated() ), 730 connect( xdays_action, SIGNAL( activated() ),
705 mView->viewManager(), SLOT( showNextXView() ) ); 731 mView->viewManager(), SLOT( showNextXView() ) );
706 732
707 icon = loadPixmap( pathString + "whatsnext" ); 733 icon = loadPixmap( pathString + "whatsnext" );
708 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 734 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
709 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 735 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
710 whatsnext_action->addTo( viewMenu ); 736 whatsnext_action->addTo( viewMenu );
711 connect( whatsnext_action, SIGNAL( activated() ), 737 connect( whatsnext_action, SIGNAL( activated() ),
712 mView->viewManager(), SLOT( showWhatsNextView() ) ); 738 mView->viewManager(), SLOT( showWhatsNextView() ) );
713 739
714#if 0 740#if 0
715 action = new QAction( "view_timespan", "Time Span", 0, this ); 741 action = new QAction( "view_timespan", "Time Span", 0, this );
716 action->addTo( viewMenu ); 742 action->addTo( viewMenu );
717 connect( action, SIGNAL( activated() ), 743 connect( action, SIGNAL( activated() ),
718 mView->viewManager(), SLOT( showTimeSpanView() ) ); 744 mView->viewManager(), SLOT( showTimeSpanView() ) );
719#endif 745#endif
720 746
721 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 747 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
722 this ); 748 this );
723 mNewSubTodoAction->addTo( actionMenu ); 749 mNewSubTodoAction->addTo( actionMenu );
724 connect( mNewSubTodoAction, SIGNAL( activated() ), 750 connect( mNewSubTodoAction, SIGNAL( activated() ),
725 mView, SLOT( newSubTodo() ) ); 751 mView, SLOT( newSubTodo() ) );
726 752
727 actionMenu->insertSeparator(); 753 actionMenu->insertSeparator();
728 754
729 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 755 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
730 mShowAction->addTo( actionMenu ); 756 mShowAction->addTo( actionMenu );
731 connect( mShowAction, SIGNAL( activated() ), 757 connect( mShowAction, SIGNAL( activated() ),
732 mView, SLOT( showIncidence() ) ); 758 mView, SLOT( showIncidence() ) );
733 759
734 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 760 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
735 mEditAction->addTo( actionMenu ); 761 mEditAction->addTo( actionMenu );
736 connect( mEditAction, SIGNAL( activated() ), 762 connect( mEditAction, SIGNAL( activated() ),
737 mView, SLOT( editIncidence() ) ); 763 mView, SLOT( editIncidence() ) );
738 764
739 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 765 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
740 mDeleteAction->addTo( actionMenu ); 766 mDeleteAction->addTo( actionMenu );
741 connect( mDeleteAction, SIGNAL( activated() ), 767 connect( mDeleteAction, SIGNAL( activated() ),
742 mView, SLOT( deleteIncidence() ) ); 768 mView, SLOT( deleteIncidence() ) );
743 769
744 770
745 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 771 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
746 mCloneAction->addTo( actionMenu ); 772 mCloneAction->addTo( actionMenu );
747 connect( mCloneAction, SIGNAL( activated() ), 773 connect( mCloneAction, SIGNAL( activated() ),
748 mView, SLOT( cloneIncidence() ) ); 774 mView, SLOT( cloneIncidence() ) );
@@ -1127,387 +1153,421 @@ void MainWindow::exportToPhone( int mode )
1127 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1153 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1128 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1154 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1129 1155
1130 setCaption( i18n("Writing to phone...")); 1156 setCaption( i18n("Writing to phone..."));
1131 if ( PhoneFormat::writeToPhone( cal ) ) 1157 if ( PhoneFormat::writeToPhone( cal ) )
1132 setCaption( i18n("Export to phone successful!")); 1158 setCaption( i18n("Export to phone successful!"));
1133 else 1159 else
1134 setCaption( i18n("Error exporting to phone!")); 1160 setCaption( i18n("Error exporting to phone!"));
1135 delete cal; 1161 delete cal;
1136} 1162}
1137 1163
1138 1164
1139void MainWindow::setDefaultPreferences() 1165void MainWindow::setDefaultPreferences()
1140{ 1166{
1141 KOPrefs *p = KOPrefs::instance(); 1167 KOPrefs *p = KOPrefs::instance();
1142 1168
1143 p->mCompactDialogs = true; 1169 p->mCompactDialogs = true;
1144 p->mConfirm = true; 1170 p->mConfirm = true;
1145 // p->mEnableQuickTodo = false; 1171 // p->mEnableQuickTodo = false;
1146 1172
1147} 1173}
1148 1174
1149QString MainWindow::resourcePath() 1175QString MainWindow::resourcePath()
1150{ 1176{
1151 return KGlobal::iconLoader()->iconPath(); 1177 return KGlobal::iconLoader()->iconPath();
1152} 1178}
1153 1179
1154void MainWindow::displayText( QString text ,QString cap ) 1180void MainWindow::displayText( QString text ,QString cap )
1155{ 1181{
1156 QDialog dia( this, "name", true ); ; 1182 QDialog dia( this, "name", true ); ;
1157 dia.setCaption( cap ); 1183 dia.setCaption( cap );
1158 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1184 QVBoxLayout* lay = new QVBoxLayout( &dia );
1159 lay->setSpacing( 3 ); 1185 lay->setSpacing( 3 );
1160 lay->setMargin( 3 ); 1186 lay->setMargin( 3 );
1161 QTextBrowser tb ( &dia ); 1187 QTextBrowser tb ( &dia );
1162 lay->addWidget( &tb ); 1188 lay->addWidget( &tb );
1163 tb.setText( text ); 1189 tb.setText( text );
1164#ifdef DESKTOP_VERSION 1190#ifdef DESKTOP_VERSION
1165 dia.resize( 640, 480); 1191 dia.resize( 640, 480);
1166#else 1192#else
1167 dia.showMaximized(); 1193 dia.showMaximized();
1168#endif 1194#endif
1169 dia.exec(); 1195 dia.exec();
1170} 1196}
1171 1197
1172void MainWindow::features() 1198void MainWindow::features()
1173{ 1199{
1174 1200
1175 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1201 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1176} 1202}
1177 1203
1178void MainWindow::usertrans() 1204void MainWindow::usertrans()
1179{ 1205{
1180 1206
1181 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1207 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1182} 1208}
1183 1209
1184void MainWindow::kdesynchowto() 1210void MainWindow::kdesynchowto()
1185{ 1211{
1186 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1212 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1187} 1213}
1188void MainWindow::multisynchowto() 1214void MainWindow::multisynchowto()
1189{ 1215{
1190 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1216 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1191} 1217}
1192void MainWindow::synchowto() 1218void MainWindow::synchowto()
1193{ 1219{
1194 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1220 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1195} 1221}
1196void MainWindow::faq() 1222void MainWindow::faq()
1197{ 1223{
1198 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1224 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1199 1225
1200} 1226}
1201void MainWindow::whatsNew() 1227void MainWindow::whatsNew()
1202{ 1228{
1203 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1229 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1204 1230
1205} 1231}
1206void MainWindow::licence() 1232void MainWindow::licence()
1207{ 1233{
1208 KApplication::showLicence(); 1234 KApplication::showLicence();
1209 1235
1210} 1236}
1211void MainWindow::about() 1237void MainWindow::about()
1212{ 1238{
1213 QString version; 1239 QString version;
1214#include <../version> 1240#include <../version>
1215 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1241 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1216 i18n("KOrganizer/Platform-independent\n") + 1242 i18n("KOrganizer/Platform-independent\n") +
1217 "(KO/Pi) " + version + " - " + 1243 "(KO/Pi) " + version + " - " +
1218 1244
1219#ifdef DESKTOP_VERSION 1245#ifdef DESKTOP_VERSION
1220 i18n("Desktop Edition\n") + 1246 i18n("Desktop Edition\n") +
1221#else 1247#else
1222 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1248 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1223#endif 1249#endif
1224 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") ); 1250 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") );
1225} 1251}
1226void MainWindow::keyBindings() 1252void MainWindow::keyBindings()
1227{ 1253{
1228 QString cap = i18n("KO/Pi Keys + Colors"); 1254 QString cap = i18n("KO/Pi Keys + Colors");
1229 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1255 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1230 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1256 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1231 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1257 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1232 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1258 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1233 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1259 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1234 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1260 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1235 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1261 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1236 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1262 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1237 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1263 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1238 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1264 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1239 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1265 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1240 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1266 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1241 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1267 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1242 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1268 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1243 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1269 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1244 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1270 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1245 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1271 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1246 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1272 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1247 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1273 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1248 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1274 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1249 i18n("<p><h3>In agenda view:</h3></p>\n") + 1275 i18n("<p><h3>In agenda view:</h3></p>\n") +
1250 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1276 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1251 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1277 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1252 i18n("<p><h3>In todo view:</h3></p>\n") + 1278 i18n("<p><h3>In todo view:</h3></p>\n") +
1253 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1279 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1254 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1280 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1255 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1281 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1256 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1282 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1257 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1283 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1258 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1284 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1259 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1285 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1260 i18n("<p><h3>In list view:</h3></p>\n") + 1286 i18n("<p><h3>In list view:</h3></p>\n") +
1261 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1287 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1262 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1288 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1263 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1289 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1264 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1290 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1265 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1291 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1266 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1292 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1267 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1293 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1268 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1294 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1269 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1295 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1270 i18n("<p><b>E</b>: Edit item</p>\n") + 1296 i18n("<p><b>E</b>: Edit item</p>\n") +
1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1297 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1298 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1299 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1300 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1301 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1302 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1303 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1304 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1279 i18n("<p><b>White</b>: Item readonly</p>\n"); 1305 i18n("<p><b>White</b>: Item readonly</p>\n");
1280 displayText( text, cap); 1306 displayText( text, cap);
1281} 1307}
1282void MainWindow::aboutAutoSaving() 1308void MainWindow::aboutAutoSaving()
1283{ 1309{
1284 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1310 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1285 1311
1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1312 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1287 1313
1288} 1314}
1289void MainWindow::aboutKnownBugs() 1315void MainWindow::aboutKnownBugs()
1290{ 1316{
1291 QMessageBox* msg; 1317 QMessageBox* msg;
1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1318 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1293 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")+ 1319 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")+
1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1320 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1321 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1296 i18n("\nor report them in the bugtracker on\n") + 1322 i18n("\nor report them in the bugtracker on\n") +
1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1323 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1298 QMessageBox::NoIcon, 1324 QMessageBox::NoIcon,
1299 QMessageBox::Ok, 1325 QMessageBox::Ok,
1300 QMessageBox::NoButton, 1326 QMessageBox::NoButton,
1301 QMessageBox::NoButton); 1327 QMessageBox::NoButton);
1302 msg->exec(); 1328 msg->exec();
1303 delete msg; 1329 delete msg;
1304 1330
1305} 1331}
1306 1332
1307QString MainWindow::defaultFileName() 1333QString MainWindow::defaultFileName()
1308{ 1334{
1309 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1335 return locateLocal( "data", "korganizer/mycalendar.ics" );
1310} 1336}
1311QString MainWindow::syncFileName() 1337QString MainWindow::syncFileName()
1312{ 1338{
1313#ifdef DESKTOP_VERSION 1339#ifdef DESKTOP_VERSION
1314 return locateLocal( "tmp", "synccalendar.ics" ); 1340 return locateLocal( "tmp", "synccalendar.ics" );
1315#else 1341#else
1316 return QString( "/tmp/synccalendar.ics" ); 1342 return QString( "/tmp/synccalendar.ics" );
1317#endif 1343#endif
1318} 1344}
1345void MainWindow::updateWeek(QDate seda)
1346{
1347 int weekNum = 0;
1348 QDate d = QDate ( seda.year(), 1,1);
1349 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1350 if ( seda.addDays(6).year() != seda.year() ) {
1351 if ( seda.year() != d.year() ) {
1352 if ( d.dayOfWeek() > 4 )
1353 d = QDate ( seda.year(), 1,1);
1354 else
1355 weekNum = 1;
1356 } else {
1357 QDate dd( seda.year()+1, 1,1);
1358 if ( dd.dayOfWeek() <= 4 )
1359 weekNum = 1;
1360 }
1361 }
1362 if ( weekNum == 0 ){
1363 int dow = d.dayOfWeek();
1364 if ( dow <= 4 )
1365 d = d.addDays( 1-dow );
1366 else // 5,6,7
1367 d = d.addDays( 8-dow );
1368 // we have the first week of the year.we are on monday
1369 weekNum = d.daysTo( seda ) / 7 +1;
1370 }
1371 //qDebug("weeknum %s ", QString::number( weekNum).latin1());
1372 menuBarWeek-> changeItem(1, QString::number( weekNum) );
1319 1373
1374}
1375void MainWindow::updateWeekNum(const DateList &selectedDates)
1376{
1377 updateWeek( selectedDates.first() );
1378}
1320void MainWindow::processIncidenceSelection( Incidence *incidence ) 1379void MainWindow::processIncidenceSelection( Incidence *incidence )
1321{ 1380{
1381
1322 if ( !incidence ) { 1382 if ( !incidence ) {
1323 enableIncidenceActions( false ); 1383 enableIncidenceActions( false );
1324 1384
1325 mNewSubTodoAction->setEnabled( false ); 1385 mNewSubTodoAction->setEnabled( false );
1326 setCaptionToDates(); 1386 setCaptionToDates();
1327 return; 1387 return;
1328 1388
1329 } 1389 }
1330 1390
1331 //KGlobal::locale()->formatDateTime(nextA, true); 1391 //KGlobal::locale()->formatDateTime(nextA, true);
1332 QString startString = ""; 1392 QString startString = "";
1333 if ( incidence->type() != "Todo" ) { 1393 if ( incidence->type() != "Todo" ) {
1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1394 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1335 if ( incidence->doesFloat() ) { 1395 if ( incidence->doesFloat() ) {
1336 startString += ": "+incidence->dtStartDateStr( true ); 1396 startString += ": "+incidence->dtStartDateStr( true );
1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1397 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1338 1398
1339 } else { 1399 } else {
1340 startString = ": "+incidence->dtStartStr(true); 1400 startString = ": "+incidence->dtStartStr(true);
1341 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1401 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1342 1402
1343 } 1403 }
1344 1404
1345 } else { 1405 } else {
1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1406 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1407 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1408 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1349 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1409 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1350 bool ok; 1410 bool ok;
1351 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1411 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1352 if ( ok ) { 1412 if ( ok ) {
1353 int years = noc.date().year() - incidence->dtStart().date().year(); 1413 int years = noc.date().year() - incidence->dtStart().date().year();
1354 startString += i18n(" (%1 y.)"). arg( years ); 1414 startString += i18n(" (%1 y.)"). arg( years );
1355 } 1415 }
1356 } 1416 }
1357 else 1417 else
1358 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1418 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1359 } 1419 }
1360 1420
1361 } 1421 }
1362 else 1422 else
1363 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1423 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1364 if ( !incidence->location().isEmpty() ) 1424 if ( !incidence->location().isEmpty() )
1365 startString += " (" +incidence->location()+")"; 1425 startString += " (" +incidence->location()+")";
1366 setCaption( incidence->summary()+startString); 1426 setCaption( incidence->summary()+startString);
1367 1427
1368 enableIncidenceActions( true ); 1428 enableIncidenceActions( true );
1369 1429
1370 if ( incidence->type() == "Event" ) { 1430 if ( incidence->type() == "Event" ) {
1371 mShowAction->setText( i18n("Show Event...") ); 1431 mShowAction->setText( i18n("Show Event...") );
1372 mEditAction->setText( i18n("Edit Event...") ); 1432 mEditAction->setText( i18n("Edit Event...") );
1373 mDeleteAction->setText( i18n("Delete Event...") ); 1433 mDeleteAction->setText( i18n("Delete Event...") );
1374 1434
1375 mNewSubTodoAction->setEnabled( false ); 1435 mNewSubTodoAction->setEnabled( false );
1376 } else if ( incidence->type() == "Todo" ) { 1436 } else if ( incidence->type() == "Todo" ) {
1377 mShowAction->setText( i18n("Show Todo...") ); 1437 mShowAction->setText( i18n("Show Todo...") );
1378 mEditAction->setText( i18n("Edit Todo...") ); 1438 mEditAction->setText( i18n("Edit Todo...") );
1379 mDeleteAction->setText( i18n("Delete Todo...") ); 1439 mDeleteAction->setText( i18n("Delete Todo...") );
1380 1440
1381 mNewSubTodoAction->setEnabled( true ); 1441 mNewSubTodoAction->setEnabled( true );
1382 } else { 1442 } else {
1383 mShowAction->setText( i18n("Show...") ); 1443 mShowAction->setText( i18n("Show...") );
1384 mShowAction->setText( i18n("Edit...") ); 1444 mShowAction->setText( i18n("Edit...") );
1385 mShowAction->setText( i18n("Delete...") ); 1445 mShowAction->setText( i18n("Delete...") );
1386 1446
1387 mNewSubTodoAction->setEnabled( false ); 1447 mNewSubTodoAction->setEnabled( false );
1388 } 1448 }
1389} 1449}
1390 1450
1391void MainWindow::enableIncidenceActions( bool enabled ) 1451void MainWindow::enableIncidenceActions( bool enabled )
1392{ 1452{
1393 mShowAction->setEnabled( enabled ); 1453 mShowAction->setEnabled( enabled );
1394 mEditAction->setEnabled( enabled ); 1454 mEditAction->setEnabled( enabled );
1395 mDeleteAction->setEnabled( enabled ); 1455 mDeleteAction->setEnabled( enabled );
1396 1456
1397 mCloneAction->setEnabled( enabled ); 1457 mCloneAction->setEnabled( enabled );
1398 mMoveAction->setEnabled( enabled ); 1458 mMoveAction->setEnabled( enabled );
1399 mBeamAction->setEnabled( enabled ); 1459 mBeamAction->setEnabled( enabled );
1400 mCancelAction->setEnabled( enabled ); 1460 mCancelAction->setEnabled( enabled );
1401} 1461}
1402 1462
1403void MainWindow::importOL() 1463void MainWindow::importOL()
1404{ 1464{
1405#ifdef _OL_IMPORT_ 1465#ifdef _OL_IMPORT_
1406 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1466 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1407 id->exec(); 1467 id->exec();
1408 delete id; 1468 delete id;
1409 mView->updateView(); 1469 mView->updateView();
1410#endif 1470#endif
1411} 1471}
1412void MainWindow::importBday() 1472void MainWindow::importBday()
1413{ 1473{
1414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1474 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1415 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1475 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1416 i18n("Import!"), i18n("Cancel"), 0, 1476 i18n("Import!"), i18n("Cancel"), 0,
1417 0, 1 ); 1477 0, 1 );
1418 if ( result == 0 ) { 1478 if ( result == 0 ) {
1419 mView->importBday(); 1479 mView->importBday();
1420 1480
1421 } 1481 }
1422 1482
1423 1483
1424} 1484}
1425void MainWindow::importQtopia() 1485void MainWindow::importQtopia()
1426{ 1486{
1427#ifndef DESKTOP_VERSION 1487#ifndef DESKTOP_VERSION
1428 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1488 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1429 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"), 1489 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"),
1430 i18n("Import!"), i18n("Cancel"), 0, 1490 i18n("Import!"), i18n("Cancel"), 0,
1431 0, 1 ); 1491 0, 1 );
1432 if ( result == 0 ) { 1492 if ( result == 0 ) {
1433 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1493 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1434 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1494 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1435 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1495 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1436 mView->importQtopia( categories, datebook, todolist ); 1496 mView->importQtopia( categories, datebook, todolist );
1437 } 1497 }
1438#else 1498#else
1439 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1499 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1440 i18n("Not supported \non desktop!\n"), 1500 i18n("Not supported \non desktop!\n"),
1441 i18n("Ok"), i18n("Cancel"), 0, 1501 i18n("Ok"), i18n("Cancel"), 0,
1442 0, 1 ); 1502 0, 1 );
1443 1503
1444#endif 1504#endif
1445} 1505}
1446 1506
1447void MainWindow::saveOnClose() 1507void MainWindow::saveOnClose()
1448{ 1508{
1449 KOPrefs *p = KOPrefs::instance(); 1509 KOPrefs *p = KOPrefs::instance();
1450 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1510 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1451 p->mToolBarUp = iconToolBar->x() > width()/2 || 1511 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1452 iconToolBar->y() > height()/2; 1512 iconToolBar->y() > height()/2;
1453 mView->writeSettings(); 1513 mView->writeSettings();
1454 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1514 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1455 save(); 1515 save();
1456} 1516}
1457void MainWindow::slotModifiedChanged( bool changed ) 1517void MainWindow::slotModifiedChanged( bool changed )
1458{ 1518{
1459 if ( mBlockAtStartup ) 1519 if ( mBlockAtStartup )
1460 return; 1520 return;
1461 1521
1462 int msec; 1522 int msec;
1463 // we store the changes after 1 minute, 1523 // we store the changes after 1 minute,
1464 // and for safety reasons after 10 minutes again 1524 // and for safety reasons after 10 minutes again
1465 if ( !mSyncManager->blockSave() ) 1525 if ( !mSyncManager->blockSave() )
1466 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1526 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1467 else 1527 else
1468 msec = 1000 * 600; 1528 msec = 1000 * 600;
1469 mSaveTimer.start( msec, true ); // 1 minute 1529 mSaveTimer.start( msec, true ); // 1 minute
1470 qDebug("KO: Saving File in %d secs!", msec/1000); 1530 qDebug("KO: Saving File in %d secs!", msec/1000);
1471 mCalendarModifiedFlag = true; 1531 mCalendarModifiedFlag = true;
1472} 1532}
1473void MainWindow::saveStopTimer() 1533void MainWindow::saveStopTimer()
1474{ 1534{
1475 mSaveTimer.stop(); 1535 mSaveTimer.stop();
1476 if (mSaveTimer.isActive() ) 1536 if (mSaveTimer.isActive() )
1477 qDebug("ti active "); 1537 qDebug("ti active ");
1478 else 1538 else
1479 qDebug("KO: Save timer stopped"); 1539 qDebug("KO: Save timer stopped");
1480} 1540}
1481void MainWindow::save() 1541void MainWindow::save()
1482{ 1542{
1483 if ( !mCalendarModifiedFlag ) { 1543 if ( !mCalendarModifiedFlag ) {
1484 qDebug("KO: Calendar not modified. Nothing saved."); 1544 qDebug("KO: Calendar not modified. Nothing saved.");
1485 return; 1545 return;
1486 } 1546 }
1487 if ( mSyncManager->blockSave() ) 1547 if ( mSyncManager->blockSave() )
1488 return; 1548 return;
1489 mSyncManager->setBlockSave(true); 1549 mSyncManager->setBlockSave(true);
1490 if ( mView->checkFileVersion( defaultFileName()) ) { 1550 if ( mView->checkFileVersion( defaultFileName()) ) {
1491 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1551 QTime neededSaveTime = QDateTime::currentDateTime().time();
1492 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1552 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1493 qDebug("KO: Start saving data to file!"); 1553 qDebug("KO: Start saving data to file!");
1494 mView->saveCalendar( defaultFileName() ); 1554 mView->saveCalendar( defaultFileName() );
1495 mCalendarModifiedFlag = false; 1555 mCalendarModifiedFlag = false;
1496 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1556 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1497 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1557 qDebug("KO: Needed %d ms for saving.",msNeeded );
1498 QString savemes; 1558 QString savemes;
1499 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1559 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1500 setCaption(savemes); 1560 setCaption(savemes);
1501 } else 1561 } else
1502 setCaption(i18n("Saving cancelled!")); 1562 setCaption(i18n("Saving cancelled!"));
1503 mSyncManager->setBlockSave( false ); 1563 mSyncManager->setBlockSave( false );
1504} 1564}
1505 1565
1506void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1566void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1507{ 1567{
1508 if ( !e->isAutoRepeat() ) { 1568 if ( !e->isAutoRepeat() ) {
1509 mFlagKeyPressed = false; 1569 mFlagKeyPressed = false;
1510 } 1570 }
1511} 1571}
1512void MainWindow::keyPressEvent ( QKeyEvent * e ) 1572void MainWindow::keyPressEvent ( QKeyEvent * e )
1513{ 1573{