-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 5 | ||||
-rw-r--r-- | korganizer/main.cpp | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 64 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 6 |
5 files changed, 61 insertions, 22 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e3b62de..9928b48 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2370,50 +2370,50 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
2370 | return false; | 2370 | return false; |
2371 | } | 2371 | } |
2372 | 2372 | ||
2373 | globalFlagBlockAgenda = 1; | 2373 | globalFlagBlockAgenda = 1; |
2374 | clearAllViews(); | 2374 | clearAllViews(); |
2375 | if (!merge) { | 2375 | if (!merge) { |
2376 | mViewManager->setDocumentId( filename ); | 2376 | mViewManager->setDocumentId( filename ); |
2377 | mCalendar->close(); | 2377 | mCalendar->close(); |
2378 | } | 2378 | } |
2379 | mStorage->setFileName( filename ); | 2379 | mStorage->setFileName( filename ); |
2380 | 2380 | ||
2381 | if ( mStorage->load() ) { | 2381 | if ( mStorage->load() ) { |
2382 | if ( merge ) ;//setModified( true ); | 2382 | if ( merge ) ;//setModified( true ); |
2383 | else { | 2383 | else { |
2384 | //setModified( true ); | 2384 | //setModified( true ); |
2385 | mViewManager->setDocumentId( filename ); | 2385 | mViewManager->setDocumentId( filename ); |
2386 | mDialogManager->setDocumentId( filename ); | 2386 | mDialogManager->setDocumentId( filename ); |
2387 | mTodoList->setDocumentId( filename ); | 2387 | mTodoList->setDocumentId( filename ); |
2388 | } | 2388 | } |
2389 | globalFlagBlockAgenda = 2; | 2389 | globalFlagBlockAgenda = 2; |
2390 | // if ( getLastSyncEvent() ) | 2390 | // if ( getLastSyncEvent() ) |
2391 | // getLastSyncEvent()->setReadOnly( true ); | 2391 | // getLastSyncEvent()->setReadOnly( true ); |
2392 | mCalendar->reInitAlarmSettings(); | 2392 | mCalendar->reInitAlarmSettings(); |
2393 | setSyncEventsReadOnly(); | 2393 | setSyncEventsReadOnly(); |
2394 | updateUnmanagedViews(); | 2394 | //updateUnmanagedViews(); |
2395 | updateView(); | 2395 | //updateView(); |
2396 | if ( filename != MainWindow::defaultFileName() ) { | 2396 | if ( filename != MainWindow::defaultFileName() ) { |
2397 | saveCalendar( MainWindow::defaultFileName() ); | 2397 | saveCalendar( MainWindow::defaultFileName() ); |
2398 | } else { | 2398 | } else { |
2399 | QFileInfo finf ( MainWindow::defaultFileName()); | 2399 | QFileInfo finf ( MainWindow::defaultFileName()); |
2400 | if ( finf.exists() ) { | 2400 | if ( finf.exists() ) { |
2401 | setLoadedFileVersion( finf.lastModified () ); | 2401 | setLoadedFileVersion( finf.lastModified () ); |
2402 | } | 2402 | } |
2403 | } | 2403 | } |
2404 | return true; | 2404 | return true; |
2405 | } else { | 2405 | } else { |
2406 | // while failing to load, the calendar object could | 2406 | // while failing to load, the calendar object could |
2407 | // have become partially populated. Clear it out. | 2407 | // have become partially populated. Clear it out. |
2408 | if ( !merge ) { | 2408 | if ( !merge ) { |
2409 | mCalendar->close(); | 2409 | mCalendar->close(); |
2410 | mViewManager->setDocumentId( filename ); | 2410 | mViewManager->setDocumentId( filename ); |
2411 | mDialogManager->setDocumentId( filename ); | 2411 | mDialogManager->setDocumentId( filename ); |
2412 | mTodoList->setDocumentId( filename ); | 2412 | mTodoList->setDocumentId( filename ); |
2413 | } | 2413 | } |
2414 | 2414 | ||
2415 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 2415 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
2416 | 2416 | ||
2417 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 2417 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
2418 | globalFlagBlockAgenda = 2; | 2418 | globalFlagBlockAgenda = 2; |
2419 | mCalendar->reInitAlarmSettings(); | 2419 | mCalendar->reInitAlarmSettings(); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 17248dc..07bfdbf 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -483,48 +483,53 @@ KOQuickTodo::KOQuickTodo(QWidget *parent) : | |||
483 | QLineEdit(parent) | 483 | QLineEdit(parent) |
484 | { | 484 | { |
485 | setText(i18n("Click to add new Todo")); | 485 | setText(i18n("Click to add new Todo")); |
486 | setFocusPolicy ( QWidget::ClickFocus ); | 486 | setFocusPolicy ( QWidget::ClickFocus ); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | if ( text()==i18n("Click to add new Todo") ) | 491 | if ( text()==i18n("Click to add new Todo") ) |
492 | setText(""); | 492 | setText(""); |
493 | QLineEdit::focusInEvent(ev); | 493 | QLineEdit::focusInEvent(ev); |
494 | } | 494 | } |
495 | 495 | ||
496 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 496 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
497 | { | 497 | { |
498 | setText(i18n("Click to add new Todo")); | 498 | setText(i18n("Click to add new Todo")); |
499 | QLineEdit::focusOutEvent(ev); | 499 | QLineEdit::focusOutEvent(ev); |
500 | } | 500 | } |
501 | 501 | ||
502 | ///////////////////////////////////////////////////////////////////////////// | 502 | ///////////////////////////////////////////////////////////////////////////// |
503 | 503 | ||
504 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 504 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
505 | KOrg::BaseView(calendar,parent,name) | 505 | KOrg::BaseView(calendar,parent,name) |
506 | { | 506 | { |
507 | |||
508 | mCurItem = 0; | ||
509 | mCurItemRootParent = 0; | ||
510 | mCurItemParent = 0; | ||
511 | mCurItemAbove = 0; | ||
507 | mActiveItem = 0; | 512 | mActiveItem = 0; |
508 | mCategoryPopupMenu = 0; | 513 | mCategoryPopupMenu = 0; |
509 | mPendingUpdateBeforeRepaint = false; | 514 | mPendingUpdateBeforeRepaint = false; |
510 | isFlatDisplay = false; | 515 | isFlatDisplay = false; |
511 | mNavigator = 0; | 516 | mNavigator = 0; |
512 | QBoxLayout *topLayout = new QVBoxLayout(this); | 517 | QBoxLayout *topLayout = new QVBoxLayout(this); |
513 | mName = QString ( name ); | 518 | mName = QString ( name ); |
514 | mBlockUpdate = false; | 519 | mBlockUpdate = false; |
515 | mQuickBar = new QWidget( this ); | 520 | mQuickBar = new QWidget( this ); |
516 | topLayout->addWidget(mQuickBar); | 521 | topLayout->addWidget(mQuickBar); |
517 | 522 | ||
518 | mQuickAdd = new KOQuickTodo(mQuickBar); | 523 | mQuickAdd = new KOQuickTodo(mQuickBar); |
519 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 524 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
520 | quickLayout->addWidget( mQuickAdd ); | 525 | quickLayout->addWidget( mQuickAdd ); |
521 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 526 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
522 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 527 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
523 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 528 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
524 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 529 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
525 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 530 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
526 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 531 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
527 | 532 | ||
528 | int fixwid = mQuickAdd->sizeHint().height(); | 533 | int fixwid = mQuickAdd->sizeHint().height(); |
529 | int fixhei = fixwid; | 534 | int fixhei = fixwid; |
530 | if ( QApplication::desktop()->width() > 800 ) | 535 | if ( QApplication::desktop()->width() > 800 ) |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index c9d1345..6339370 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -68,48 +68,48 @@ int main( int argc, char **argv ) | |||
68 | printf(" -showWNext: What's Next view\n"); | 68 | printf(" -showWNext: What's Next view\n"); |
69 | printf(" -showNextXView: Next X View\n"); | 69 | printf(" -showNextXView: Next X View\n"); |
70 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 70 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
71 | printf(" KO/Pi is exiting now. Bye!\n"); | 71 | printf(" KO/Pi is exiting now. Bye!\n"); |
72 | exitHelp = true; | 72 | exitHelp = true; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | if ( ! exitHelp ) { | 75 | if ( ! exitHelp ) { |
76 | KGlobal::setAppName( "korganizer" ); | 76 | KGlobal::setAppName( "korganizer" ); |
77 | QString fileName ; | 77 | QString fileName ; |
78 | #ifndef DESKTOP_VERSION | 78 | #ifndef DESKTOP_VERSION |
79 | fileName = getenv("QPEDIR"); | 79 | fileName = getenv("QPEDIR"); |
80 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 80 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
81 | #else | 81 | #else |
82 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 82 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
83 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 83 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
84 | #endif | 84 | #endif |
85 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 85 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
86 | 86 | ||
87 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 87 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
88 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 88 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
89 | MainWindow m; | 89 | MainWindow m; |
90 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
91 | 91 | ||
92 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 92 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
93 | a.showMainWidget(&m ); | 93 | a.showMainWidget(&m ); |
94 | #else | 94 | #else |
95 | a.setMainWidget(&m ); | 95 | a.setMainWidget(&m ); |
96 | m.show(); | 96 | m.show(); |
97 | //m.resize( 800, 600 ); | 97 | //m.resize( 800, 600 ); |
98 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 98 | //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
99 | #endif | 99 | #endif |
100 | if ( argc > 1 ) { | 100 | if ( argc > 1 ) { |
101 | QCString command = argv[1]; | 101 | QCString command = argv[1]; |
102 | if ( argc > 2 ) | 102 | if ( argc > 2 ) |
103 | command += argv[2]; | 103 | command += argv[2]; |
104 | qApp->processEvents(); | 104 | qApp->processEvents(); |
105 | m.recieve(command, QByteArray() ); | 105 | m.recieve(command, QByteArray() ); |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | a.exec(); | 109 | a.exec(); |
110 | dumpMissing(); | 110 | dumpMissing(); |
111 | 111 | ||
112 | KPimGlobalPrefs::instance()->writeConfig(); | 112 | KPimGlobalPrefs::instance()->writeConfig(); |
113 | } | 113 | } |
114 | qDebug("KO: Bye! "); | 114 | qDebug("KO: Bye! "); |
115 | } | 115 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9ae393d..8c72d89 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -325,128 +325,150 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
325 | mView->readSettings(); | 325 | mView->readSettings(); |
326 | bool newFile = false; | 326 | bool newFile = false; |
327 | if( !QFile::exists( defaultFileName() ) ) { | 327 | if( !QFile::exists( defaultFileName() ) ) { |
328 | QFileInfo finfo ( defaultFileName() ); | 328 | QFileInfo finfo ( defaultFileName() ); |
329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
331 | finfo.setFile( oldFile ); | 331 | finfo.setFile( oldFile ); |
332 | if (finfo.exists() ) { | 332 | if (finfo.exists() ) { |
333 | KMessageBox::information( this, message); | 333 | KMessageBox::information( this, message); |
334 | mView->openCalendar( oldFile ); | 334 | mView->openCalendar( oldFile ); |
335 | qApp->processEvents(); | 335 | qApp->processEvents(); |
336 | } else { | 336 | } else { |
337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
338 | finfo.setFile( oldFile ); | 338 | finfo.setFile( oldFile ); |
339 | if (finfo.exists() ) { | 339 | if (finfo.exists() ) { |
340 | KMessageBox::information( this, message); | 340 | KMessageBox::information( this, message); |
341 | mView->openCalendar( oldFile ); | 341 | mView->openCalendar( oldFile ); |
342 | qApp->processEvents(); | 342 | qApp->processEvents(); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | mView->saveCalendar( defaultFileName() ); | 345 | mView->saveCalendar( defaultFileName() ); |
346 | newFile = true; | 346 | newFile = true; |
347 | } | 347 | } |
348 | 348 | ||
349 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 349 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
350 | mView->loadCalendars(); | 350 | //mView->loadCalendars(); |
351 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 351 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
352 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 352 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
353 | 353 | ||
354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
355 | KOPrefs::instance()->setAllDefaults(); | 355 | KOPrefs::instance()->setAllDefaults(); |
356 | } | 356 | } |
357 | processIncidenceSelection( 0 ); | ||
358 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | ||
359 | SLOT( processIncidenceSelection( Incidence * ) ) ); | ||
360 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | ||
361 | SLOT( slotModifiedChanged( bool ) ) ); | ||
362 | 357 | ||
363 | 358 | ||
364 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 359 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
365 | SLOT( disableBR(bool) ) ); | 360 | SLOT( disableBR(bool) ) ); |
366 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 361 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
367 | mView->setModified( false ); | ||
368 | mBlockAtStartup = false; | ||
369 | mView->setModified( false ); | ||
370 | setCentralWidget( mView ); | 362 | setCentralWidget( mView ); |
371 | globalFlagBlockStartup = 0; | 363 | globalFlagBlockStartup = 0; |
372 | mView->show(); | 364 | mView->show(); |
373 | delete splash; | 365 | delete splash; |
374 | if ( newFile ) | 366 | if ( newFile ) |
375 | mView->updateConfig(); | 367 | mView->updateConfig(); |
376 | // qApp->processEvents(); | 368 | // qApp->processEvents(); |
377 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 369 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
378 | //fillSyncMenu(); | 370 | //fillSyncMenu(); |
379 | 371 | ||
380 | 372 | ||
381 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 373 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
382 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | ||
383 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 374 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
384 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 375 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
385 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 376 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
386 | mSyncManager->setDefaultFileName( sentSyncFile()); | 377 | mSyncManager->setDefaultFileName( sentSyncFile()); |
387 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 378 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
388 | mSyncManager->fillSyncMenu(); | 379 | mSyncManager->fillSyncMenu(); |
389 | 380 | ||
390 | 381 | ||
391 | 382 | ||
392 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 383 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
393 | if ( showWarning ) { | 384 | if ( showWarning ) { |
394 | KMessageBox::information( this, | 385 | KMessageBox::information( this, |
395 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 386 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
396 | qApp->processEvents(); | 387 | qApp->processEvents(); |
397 | mView->dialogManager()->showSyncOptions(); | 388 | mView->dialogManager()->showSyncOptions(); |
398 | } | 389 | } |
399 | 390 | ||
400 | //US listen for result adressed from Ka/Pi | 391 | //US listen for result adressed from Ka/Pi |
401 | #ifndef DESKTOP_VERSION | 392 | |
402 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | ||
403 | #endif | ||
404 | #ifndef DESKTOP_VERSION | 393 | #ifndef DESKTOP_VERSION |
405 | infrared = 0; | 394 | infrared = 0; |
406 | #endif | 395 | #endif |
407 | updateFilterToolbar(); | 396 | updateFilterToolbar(); |
408 | updateWeek( mView->startDate() ); | 397 | updateWeek( mView->startDate() ); |
409 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 398 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
410 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 399 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
411 | mBRdisabled = false; | 400 | mBRdisabled = false; |
412 | //toggleBeamReceive(); | 401 | //toggleBeamReceive(); |
413 | 402 | ||
414 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 403 | setCaption(i18n("Loading calendar files ... please wait" )); |
404 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); | ||
415 | } | 405 | } |
416 | MainWindow::~MainWindow() | 406 | MainWindow::~MainWindow() |
417 | { | 407 | { |
418 | //qDebug("MainWindow::~MainWindow() "); | 408 | //qDebug("MainWindow::~MainWindow() "); |
419 | //save toolbar location | 409 | //save toolbar location |
420 | delete mCalendar; | 410 | delete mCalendar; |
421 | delete mSyncManager; | 411 | delete mSyncManager; |
422 | #ifndef DESKTOP_VERSION | 412 | #ifndef DESKTOP_VERSION |
423 | if ( infrared ) | 413 | if ( infrared ) |
424 | delete infrared; | 414 | delete infrared; |
425 | #endif | 415 | #endif |
426 | 416 | ||
427 | 417 | ||
428 | } | 418 | } |
419 | |||
420 | void MainWindow::loadDataAfterStart() | ||
421 | { | ||
422 | |||
423 | qDebug("KO: Start loading files..." ); | ||
424 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | ||
425 | mView->loadCalendars(); | ||
426 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | ||
427 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | ||
428 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | ||
429 | mView->setModified( false ); | ||
430 | mBlockAtStartup = false; | ||
431 | mView->setModified( false ); | ||
432 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | ||
433 | processIncidenceSelection( 0 ); | ||
434 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | ||
435 | SLOT( processIncidenceSelection( Incidence * ) ) ); | ||
436 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | ||
437 | SLOT( slotModifiedChanged( bool ) ) ); | ||
438 | |||
439 | #ifndef DESKTOP_VERSION | ||
440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | ||
441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | ||
443 | if ( !mCStringMess.isEmpty() ) | ||
444 | recieve( mCStringMess, mByteData ); | ||
445 | #endif | ||
446 | |||
447 | |||
448 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | ||
449 | } | ||
450 | |||
429 | void MainWindow::slotResetFocus() | 451 | void MainWindow::slotResetFocus() |
430 | { | 452 | { |
431 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 453 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
432 | mFocusLoop = 3; | 454 | mFocusLoop = 3; |
433 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 455 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
434 | } | 456 | } |
435 | void MainWindow::slotResetFocusLoop() | 457 | void MainWindow::slotResetFocusLoop() |
436 | { | 458 | { |
437 | --mFocusLoop; | 459 | --mFocusLoop; |
438 | QWidget* fw = mView->viewManager()->currentView(); | 460 | QWidget* fw = mView->viewManager()->currentView(); |
439 | if ( fw ) { | 461 | if ( fw ) { |
440 | //qDebug("loop "); | 462 | //qDebug("loop "); |
441 | fw->setFocus(); | 463 | fw->setFocus(); |
442 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 464 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
443 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 465 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
444 | } | 466 | } |
445 | 467 | ||
446 | } | 468 | } |
447 | void MainWindow::disableBR(bool b) | 469 | void MainWindow::disableBR(bool b) |
448 | { | 470 | { |
449 | #ifndef DESKTOP_VERSION | 471 | #ifndef DESKTOP_VERSION |
450 | if ( b ) { | 472 | if ( b ) { |
451 | if ( infrared ) { | 473 | if ( infrared ) { |
452 | toggleBeamReceive(); | 474 | toggleBeamReceive(); |
@@ -519,49 +541,54 @@ void MainWindow::closeEvent( QCloseEvent* ce ) | |||
519 | switch( QMessageBox::information( this, "KO/Pi", | 541 | switch( QMessageBox::information( this, "KO/Pi", |
520 | i18n("Do you really want\nto close KO/Pi?"), | 542 | i18n("Do you really want\nto close KO/Pi?"), |
521 | i18n("Close"), i18n("No"), | 543 | i18n("Close"), i18n("No"), |
522 | 0, 0 ) ) { | 544 | 0, 0 ) ) { |
523 | case 0: | 545 | case 0: |
524 | saveOnClose(); | 546 | saveOnClose(); |
525 | if ( mCalendarModifiedFlag ) { | 547 | if ( mCalendarModifiedFlag ) { |
526 | ce->ignore(); | 548 | ce->ignore(); |
527 | return; | 549 | return; |
528 | } | 550 | } |
529 | mClosed = true; | 551 | mClosed = true; |
530 | ce->accept(); | 552 | ce->accept(); |
531 | break; | 553 | break; |
532 | case 1: | 554 | case 1: |
533 | ce->ignore(); | 555 | ce->ignore(); |
534 | break; | 556 | break; |
535 | case 2: | 557 | case 2: |
536 | 558 | ||
537 | default: | 559 | default: |
538 | break; | 560 | break; |
539 | } | 561 | } |
540 | 562 | ||
541 | 563 | ||
542 | } | 564 | } |
543 | 565 | void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) | |
566 | { | ||
567 | qDebug("KO: QCOP start message received: %s ", cmsg.data() ); | ||
568 | mCStringMess = cmsg; | ||
569 | mByteData = data; | ||
570 | } | ||
544 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 571 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
545 | { | 572 | { |
546 | QDataStream stream( data, IO_ReadOnly ); | 573 | QDataStream stream( data, IO_ReadOnly ); |
547 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 574 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
548 | //QString datamess; | 575 | //QString datamess; |
549 | //qDebug("message "); | 576 | //qDebug("message "); |
550 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 577 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
551 | 578 | ||
552 | if ( cmsg == "setDocument(QString)" ) { | 579 | if ( cmsg == "setDocument(QString)" ) { |
553 | QDataStream stream( data, IO_ReadOnly ); | 580 | QDataStream stream( data, IO_ReadOnly ); |
554 | QString fileName; | 581 | QString fileName; |
555 | stream >> fileName; | 582 | stream >> fileName; |
556 | //qDebug("filename %s ", fileName.latin1()); | 583 | //qDebug("filename %s ", fileName.latin1()); |
557 | showMaximized(); | 584 | showMaximized(); |
558 | raise(); | 585 | raise(); |
559 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 586 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
560 | mSyncManager->slotSyncMenu( 1002 ); | 587 | mSyncManager->slotSyncMenu( 1002 ); |
561 | return; | 588 | return; |
562 | } | 589 | } |
563 | 590 | ||
564 | if ( cmsg == "-writeFile" ) { | 591 | if ( cmsg == "-writeFile" ) { |
565 | // I made from the "-writeFile" an "-writeAlarm" | 592 | // I made from the "-writeFile" an "-writeAlarm" |
566 | mView->viewManager()->showWhatsNextView(); | 593 | mView->viewManager()->showWhatsNextView(); |
567 | mCalendar->checkAlarmForIncidence( 0, true); | 594 | mCalendar->checkAlarmForIncidence( 0, true); |
@@ -2495,48 +2522,49 @@ void MainWindow::importFile( QString fn, bool quick ) | |||
2495 | QFileInfo info; | 2522 | QFileInfo info; |
2496 | info.setFile( fn ); | 2523 | info.setFile( fn ); |
2497 | QString mess; | 2524 | QString mess; |
2498 | if ( !info. exists() ) { | 2525 | if ( !info. exists() ) { |
2499 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2526 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2500 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2527 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2501 | mess ); | 2528 | mess ); |
2502 | return; | 2529 | return; |
2503 | } | 2530 | } |
2504 | int result = 0; | 2531 | int result = 0; |
2505 | if ( !quick ) { | 2532 | if ( !quick ) { |
2506 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2533 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2507 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2534 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2508 | mess, | 2535 | mess, |
2509 | "Import", "Cancel", 0, | 2536 | "Import", "Cancel", 0, |
2510 | 0, 1 ); | 2537 | 0, 1 ); |
2511 | } | 2538 | } |
2512 | if ( result == 0 ) { | 2539 | if ( result == 0 ) { |
2513 | if ( mView->openCalendar( fn, true )) { | 2540 | if ( mView->openCalendar( fn, true )) { |
2514 | KOPrefs::instance()->mLastImportFile = fn; | 2541 | KOPrefs::instance()->mLastImportFile = fn; |
2515 | setCaption(i18n("Imported file successfully")); | 2542 | setCaption(i18n("Imported file successfully")); |
2516 | } else { | 2543 | } else { |
2517 | setCaption(i18n("Error importing file")); | 2544 | setCaption(i18n("Error importing file")); |
2518 | } | 2545 | } |
2546 | mView->updateView(); | ||
2519 | } | 2547 | } |
2520 | } | 2548 | } |
2521 | 2549 | ||
2522 | void MainWindow::importIcal() | 2550 | void MainWindow::importIcal() |
2523 | { | 2551 | { |
2524 | 2552 | ||
2525 | QString fn =KOPrefs::instance()->mLastImportFile; | 2553 | QString fn =KOPrefs::instance()->mLastImportFile; |
2526 | 2554 | ||
2527 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2555 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2528 | if ( fn == "" ) | 2556 | if ( fn == "" ) |
2529 | return; | 2557 | return; |
2530 | importFile( fn, true ); | 2558 | importFile( fn, true ); |
2531 | 2559 | ||
2532 | } | 2560 | } |
2533 | 2561 | ||
2534 | void MainWindow::exportVCalendar() | 2562 | void MainWindow::exportVCalendar() |
2535 | { | 2563 | { |
2536 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2564 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2537 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2565 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2538 | if ( fn == "" ) | 2566 | if ( fn == "" ) |
2539 | return; | 2567 | return; |
2540 | QFileInfo info; | 2568 | QFileInfo info; |
2541 | info.setFile( fn ); | 2569 | info.setFile( fn ); |
2542 | QString mes; | 2570 | QString mes; |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7d3d492..fdcf7c4 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -29,49 +29,51 @@ namespace KCal { | |||
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 41 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 42 | static QString syncFileName(); |
43 | static QString resourcePath(); | 43 | static QString resourcePath(); |
44 | public slots: | 44 | public slots: |
45 | void setUsesBigPixmaps ( bool ); | 45 | void setUsesBigPixmaps ( bool ); |
46 | void setCaption ( const QString & ); | 46 | void setCaption ( const QString & ); |
47 | void updateWeekNum(const KCal::DateList &); | 47 | void updateWeekNum(const KCal::DateList &); |
48 | void updateWeek(QDate); | 48 | void updateWeek(QDate); |
49 | void updateFilterToolbar(); | 49 | void updateFilterToolbar(); |
50 | virtual void showMaximized (); | 50 | virtual void showMaximized (); |
51 | void configureAgenda( int ); | 51 | void configureAgenda( int ); |
52 | void recieve( const QCString& msg, const QByteArray& data ); | 52 | void recieve( const QCString& msg, const QByteArray& data ); |
53 | void receiveStart( const QCString& msg, const QByteArray& data ); | ||
53 | protected slots: | 54 | protected slots: |
55 | void loadDataAfterStart(); | ||
54 | void calHint(); | 56 | void calHint(); |
55 | void startMultiSync(); | 57 | void startMultiSync(); |
56 | void setCaptionToDates(); | 58 | void setCaptionToDates(); |
57 | void weekAction(); | 59 | void weekAction(); |
58 | void about(); | 60 | void about(); |
59 | void licence(); | 61 | void licence(); |
60 | void faq(); | 62 | void faq(); |
61 | void usertrans(); | 63 | void usertrans(); |
62 | void features(); | 64 | void features(); |
63 | void synchowto(); | 65 | void synchowto(); |
64 | void storagehowto(); | 66 | void storagehowto(); |
65 | void timetrackinghowto(); | 67 | void timetrackinghowto(); |
66 | void kdesynchowto(); | 68 | void kdesynchowto(); |
67 | void multisynchowto(); | 69 | void multisynchowto(); |
68 | void whatsNew(); | 70 | void whatsNew(); |
69 | void keyBindings(); | 71 | void keyBindings(); |
70 | void aboutAutoSaving();; | 72 | void aboutAutoSaving();; |
71 | void aboutKnownBugs(); | 73 | void aboutKnownBugs(); |
72 | 74 | ||
73 | void processIncidenceSelection( Incidence * ); | 75 | void processIncidenceSelection( Incidence * ); |
74 | 76 | ||
75 | void importQtopia(); | 77 | void importQtopia(); |
76 | void importBday(); | 78 | void importBday(); |
77 | void importOL(); | 79 | void importOL(); |
@@ -95,48 +97,52 @@ class MainWindow : public QMainWindow | |||
95 | void fillFilterMenuTB(); | 97 | void fillFilterMenuTB(); |
96 | void selectFilter( int ); | 98 | void selectFilter( int ); |
97 | void fillFilterMenuPopup(); | 99 | void fillFilterMenuPopup(); |
98 | void selectFilterPopup( int ); | 100 | void selectFilterPopup( int ); |
99 | void exportToPhone( int ); | 101 | void exportToPhone( int ); |
100 | void toggleBeamReceive(); | 102 | void toggleBeamReceive(); |
101 | void disableBR(bool); | 103 | void disableBR(bool); |
102 | signals: | 104 | signals: |
103 | void selectWeek ( int ); | 105 | void selectWeek ( int ); |
104 | private slots: | 106 | private slots: |
105 | void slotResetFocus(); | 107 | void slotResetFocus(); |
106 | void slotResetFocusLoop(); | 108 | void slotResetFocusLoop(); |
107 | void showConfigureAgenda(); | 109 | void showConfigureAgenda(); |
108 | void getFile( bool ); | 110 | void getFile( bool ); |
109 | void syncFileRequest(); | 111 | void syncFileRequest(); |
110 | 112 | ||
111 | protected: | 113 | protected: |
112 | int mFocusLoop; | 114 | int mFocusLoop; |
113 | void hideEvent ( QHideEvent * ); | 115 | void hideEvent ( QHideEvent * ); |
114 | QString sentSyncFile(); | 116 | QString sentSyncFile(); |
115 | void displayText( QString, QString); | 117 | void displayText( QString, QString); |
116 | void enableIncidenceActions( bool ); | 118 | void enableIncidenceActions( bool ); |
117 | 119 | ||
118 | private: | 120 | private: |
121 | |||
122 | QCString mCStringMess; | ||
123 | QByteArray mByteData; | ||
124 | |||
119 | //void setMenuBar( QMenuBar * ); | 125 | //void setMenuBar( QMenuBar * ); |
120 | bool mBRdisabled; | 126 | bool mBRdisabled; |
121 | #ifndef DESKTOP_VERSION | 127 | #ifndef DESKTOP_VERSION |
122 | QCopChannel* infrared; | 128 | QCopChannel* infrared; |
123 | #endif | 129 | #endif |
124 | QAction* brAction; | 130 | QAction* brAction; |
125 | KSyncManager* mSyncManager; | 131 | KSyncManager* mSyncManager; |
126 | bool mClosed; | 132 | bool mClosed; |
127 | void saveOnClose(); | 133 | void saveOnClose(); |
128 | bool mFlagKeyPressed; | 134 | bool mFlagKeyPressed; |
129 | bool mBlockAtStartup; | 135 | bool mBlockAtStartup; |
130 | KMenuBar *menuBar1; | 136 | KMenuBar *menuBar1; |
131 | QPEToolBar *iconToolBar; | 137 | QPEToolBar *iconToolBar; |
132 | QPEToolBar *viewToolBar; | 138 | QPEToolBar *viewToolBar; |
133 | QPEToolBar *navigatorToolBar; | 139 | QPEToolBar *navigatorToolBar; |
134 | QPEToolBar *filterToolBar; | 140 | QPEToolBar *filterToolBar; |
135 | KMenuBar *filterMenubar; | 141 | KMenuBar *filterMenubar; |
136 | QPopupMenu * filterPopupMenu; | 142 | QPopupMenu * filterPopupMenu; |
137 | QPopupMenu * mCurrentItemMenu; | 143 | QPopupMenu * mCurrentItemMenu; |
138 | void initActions(); | 144 | void initActions(); |
139 | void setDefaultPreferences(); | 145 | void setDefaultPreferences(); |
140 | void resizeEvent( QResizeEvent* e); | 146 | void resizeEvent( QResizeEvent* e); |
141 | void keyPressEvent ( QKeyEvent * ) ; | 147 | void keyPressEvent ( QKeyEvent * ) ; |
142 | void keyReleaseEvent ( QKeyEvent * ) ; | 148 | void keyReleaseEvent ( QKeyEvent * ) ; |