-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 98a820d..7ce0251 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1384,772 +1384,772 @@ void MainWindow::initActions() | |||
1384 | configureToolBarMenu->setItemChecked( 110, true ); | 1384 | configureToolBarMenu->setItemChecked( 110, true ); |
1385 | if (p-> mShowIconJournal) | 1385 | if (p-> mShowIconJournal) |
1386 | configureToolBarMenu->setItemChecked( 90, true ); | 1386 | configureToolBarMenu->setItemChecked( 90, true ); |
1387 | if (p-> mShowIconWhatsThis) | 1387 | if (p-> mShowIconWhatsThis) |
1388 | configureToolBarMenu->setItemChecked( 300, true ); | 1388 | configureToolBarMenu->setItemChecked( 300, true ); |
1389 | if (p-> mShowIconWeekNum) | 1389 | if (p-> mShowIconWeekNum) |
1390 | configureToolBarMenu->setItemChecked( 400, true ); | 1390 | configureToolBarMenu->setItemChecked( 400, true ); |
1391 | if (!p-> mShowIconStretch) { | 1391 | if (!p-> mShowIconStretch) { |
1392 | QLabel* dummy = new QLabel( iconToolBar ); | 1392 | QLabel* dummy = new QLabel( iconToolBar ); |
1393 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1393 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1394 | dummy->setMinimumWidth( 0 ); | 1394 | dummy->setMinimumWidth( 0 ); |
1395 | iconToolBar->setStretchableWidget ( dummy ) ; | 1395 | iconToolBar->setStretchableWidget ( dummy ) ; |
1396 | } | 1396 | } |
1397 | else { | 1397 | else { |
1398 | iconToolBar->setHorizontalStretchable (true ); | 1398 | iconToolBar->setHorizontalStretchable (true ); |
1399 | viewToolBar->setHorizontalStretchable (true ); | 1399 | viewToolBar->setHorizontalStretchable (true ); |
1400 | navigatorToolBar->setHorizontalStretchable (true ); | 1400 | navigatorToolBar->setHorizontalStretchable (true ); |
1401 | iconToolBar->setVerticalStretchable (true ); | 1401 | iconToolBar->setVerticalStretchable (true ); |
1402 | viewToolBar->setVerticalStretchable (true ); | 1402 | viewToolBar->setVerticalStretchable (true ); |
1403 | navigatorToolBar->setVerticalStretchable (true ); | 1403 | navigatorToolBar->setVerticalStretchable (true ); |
1404 | configureToolBarMenu->setItemChecked( 5, true ); | 1404 | configureToolBarMenu->setItemChecked( 5, true ); |
1405 | } | 1405 | } |
1406 | if (p-> mShowIconFilter) | 1406 | if (p-> mShowIconFilter) |
1407 | configureToolBarMenu->setItemChecked( 7, true ); | 1407 | configureToolBarMenu->setItemChecked( 7, true ); |
1408 | if (p-> mShowIconOnetoolbar) | 1408 | if (p-> mShowIconOnetoolbar) |
1409 | configureToolBarMenu->setItemChecked( 6, true ); | 1409 | configureToolBarMenu->setItemChecked( 6, true ); |
1410 | 1410 | ||
1411 | 1411 | ||
1412 | if ( filterMenubar ) { | 1412 | if ( filterMenubar ) { |
1413 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1413 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1414 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1414 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1415 | } | 1415 | } |
1416 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1416 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1417 | configureAgenda( p->mHourSize ); | 1417 | configureAgenda( p->mHourSize ); |
1418 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1418 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1419 | } | 1419 | } |
1420 | void MainWindow::calHint() | 1420 | void MainWindow::calHint() |
1421 | { | 1421 | { |
1422 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1422 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1423 | 1423 | ||
1424 | KMessageBox::information( this, message); | 1424 | KMessageBox::information( this, message); |
1425 | } | 1425 | } |
1426 | void MainWindow::exportToPhone( int mode ) | 1426 | void MainWindow::exportToPhone( int mode ) |
1427 | { | 1427 | { |
1428 | 1428 | ||
1429 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1429 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1430 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1430 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1431 | KOex2phonePrefs ex2phone; | 1431 | KOex2phonePrefs ex2phone; |
1432 | 1432 | ||
1433 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1433 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1434 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1434 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1435 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1435 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1436 | if ( mode == 1 ) | 1436 | if ( mode == 1 ) |
1437 | ex2phone.setCaption(i18n("Export complete calendar")); | 1437 | ex2phone.setCaption(i18n("Export complete calendar")); |
1438 | if ( mode == 2 ) | 1438 | if ( mode == 2 ) |
1439 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1439 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1440 | 1440 | ||
1441 | if ( !ex2phone.exec() ) { | 1441 | if ( !ex2phone.exec() ) { |
1442 | return; | 1442 | return; |
1443 | } | 1443 | } |
1444 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1444 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1445 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1445 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1446 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1446 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1447 | 1447 | ||
1448 | int inFuture = 0; | 1448 | int inFuture = 0; |
1449 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1449 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1450 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1450 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1451 | QPtrList<Incidence> delSel; | 1451 | QPtrList<Incidence> delSel; |
1452 | if ( mode == 1 ) | 1452 | if ( mode == 1 ) |
1453 | delSel = mCalendar->rawIncidences(); | 1453 | delSel = mCalendar->rawIncidences(); |
1454 | if ( mode == 2 ) | 1454 | if ( mode == 2 ) |
1455 | delSel = mCalendar->incidences(); | 1455 | delSel = mCalendar->incidences(); |
1456 | CalendarLocal* cal = new CalendarLocal(); | 1456 | CalendarLocal* cal = new CalendarLocal(); |
1457 | cal->setLocalTime(); | 1457 | cal->setLocalTime(); |
1458 | Incidence *incidence = delSel.first(); | 1458 | Incidence *incidence = delSel.first(); |
1459 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1459 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1460 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1460 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1461 | while ( incidence ) { | 1461 | while ( incidence ) { |
1462 | if ( incidence->typeID() != journalID ) { | 1462 | if ( incidence->typeID() != journalID ) { |
1463 | bool add = true; | 1463 | bool add = true; |
1464 | if ( inFuture ) { | 1464 | if ( inFuture ) { |
1465 | QDateTime dt; | 1465 | QDateTime dt; |
1466 | if ( incidence->typeID() == todoID ) { | 1466 | if ( incidence->typeID() == todoID ) { |
1467 | Todo * t = (Todo*)incidence; | 1467 | Todo * t = (Todo*)incidence; |
1468 | if ( t->hasDueDate() ) | 1468 | if ( t->hasDueDate() ) |
1469 | dt = t->dtDue(); | 1469 | dt = t->dtDue(); |
1470 | else | 1470 | else |
1471 | dt = cur.addSecs( 62 ); | 1471 | dt = cur.addSecs( 62 ); |
1472 | } | 1472 | } |
1473 | else { | 1473 | else { |
1474 | bool ok; | 1474 | bool ok; |
1475 | dt = incidence->getNextOccurence( cur, &ok ); | 1475 | dt = incidence->getNextOccurence( cur, &ok ); |
1476 | if ( !ok ) | 1476 | if ( !ok ) |
1477 | dt = cur.addSecs( -62 ); | 1477 | dt = cur.addSecs( -62 ); |
1478 | } | 1478 | } |
1479 | if ( dt < cur || dt > end ) { | 1479 | if ( dt < cur || dt > end ) { |
1480 | add = false; | 1480 | add = false; |
1481 | } | 1481 | } |
1482 | } | 1482 | } |
1483 | if ( add ) { | 1483 | if ( add ) { |
1484 | Incidence *in = incidence->clone(); | 1484 | Incidence *in = incidence->clone(); |
1485 | cal->addIncidence( in ); | 1485 | cal->addIncidence( in ); |
1486 | } | 1486 | } |
1487 | } | 1487 | } |
1488 | incidence = delSel.next(); | 1488 | incidence = delSel.next(); |
1489 | } | 1489 | } |
1490 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1490 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1491 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1491 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1492 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1492 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1493 | 1493 | ||
1494 | setCaption( i18n("Writing to phone...")); | 1494 | setCaption( i18n("Writing to phone...")); |
1495 | if ( PhoneFormat::writeToPhone( cal ) ) | 1495 | if ( PhoneFormat::writeToPhone( cal ) ) |
1496 | setCaption( i18n("Export to phone successful!")); | 1496 | setCaption( i18n("Export to phone successful!")); |
1497 | else | 1497 | else |
1498 | setCaption( i18n("Error exporting to phone!")); | 1498 | setCaption( i18n("Error exporting to phone!")); |
1499 | delete cal; | 1499 | delete cal; |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | 1502 | ||
1503 | void MainWindow::setDefaultPreferences() | 1503 | void MainWindow::setDefaultPreferences() |
1504 | { | 1504 | { |
1505 | KOPrefs *p = KOPrefs::instance(); | 1505 | KOPrefs *p = KOPrefs::instance(); |
1506 | 1506 | ||
1507 | p->mCompactDialogs = true; | 1507 | p->mCompactDialogs = true; |
1508 | p->mConfirm = true; | 1508 | p->mConfirm = true; |
1509 | // p->mEnableQuickTodo = false; | 1509 | // p->mEnableQuickTodo = false; |
1510 | 1510 | ||
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | QString MainWindow::resourcePath() | 1513 | QString MainWindow::resourcePath() |
1514 | { | 1514 | { |
1515 | return KGlobal::iconLoader()->iconPath(); | 1515 | return KGlobal::iconLoader()->iconPath(); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | void MainWindow::displayText( QString text ,QString cap ) | 1518 | void MainWindow::displayText( QString text ,QString cap ) |
1519 | { | 1519 | { |
1520 | QDialog dia( this, "name", true ); ; | 1520 | QDialog dia( this, "name", true ); ; |
1521 | dia.setCaption( cap ); | 1521 | dia.setCaption( cap ); |
1522 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1522 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1523 | lay->setSpacing( 3 ); | 1523 | lay->setSpacing( 3 ); |
1524 | lay->setMargin( 3 ); | 1524 | lay->setMargin( 3 ); |
1525 | QTextBrowser tb ( &dia ); | 1525 | QTextBrowser tb ( &dia ); |
1526 | lay->addWidget( &tb ); | 1526 | lay->addWidget( &tb ); |
1527 | tb.setText( text ); | 1527 | tb.setText( text ); |
1528 | #ifdef DESKTOP_VERSION | 1528 | #ifdef DESKTOP_VERSION |
1529 | dia.resize( 640, 480); | 1529 | dia.resize( 640, 480); |
1530 | #else | 1530 | #else |
1531 | dia.showMaximized(); | 1531 | dia.showMaximized(); |
1532 | #endif | 1532 | #endif |
1533 | dia.exec(); | 1533 | dia.exec(); |
1534 | } | 1534 | } |
1535 | 1535 | ||
1536 | void MainWindow::features() | 1536 | void MainWindow::features() |
1537 | { | 1537 | { |
1538 | 1538 | ||
1539 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1539 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | void MainWindow::usertrans() | 1542 | void MainWindow::usertrans() |
1543 | { | 1543 | { |
1544 | 1544 | ||
1545 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1545 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1546 | } | 1546 | } |
1547 | 1547 | ||
1548 | void MainWindow::storagehowto() | 1548 | void MainWindow::storagehowto() |
1549 | { | 1549 | { |
1550 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1550 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1551 | } | 1551 | } |
1552 | void MainWindow::timetrackinghowto() | 1552 | void MainWindow::timetrackinghowto() |
1553 | { | 1553 | { |
1554 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1554 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1555 | } | 1555 | } |
1556 | void MainWindow::kdesynchowto() | 1556 | void MainWindow::kdesynchowto() |
1557 | { | 1557 | { |
1558 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1558 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1559 | } | 1559 | } |
1560 | void MainWindow::multisynchowto() | 1560 | void MainWindow::multisynchowto() |
1561 | { | 1561 | { |
1562 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1562 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1563 | } | 1563 | } |
1564 | void MainWindow::synchowto() | 1564 | void MainWindow::synchowto() |
1565 | { | 1565 | { |
1566 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1566 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1567 | } | 1567 | } |
1568 | void MainWindow::faq() | 1568 | void MainWindow::faq() |
1569 | { | 1569 | { |
1570 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1570 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1571 | 1571 | ||
1572 | } | 1572 | } |
1573 | void MainWindow::whatsNew() | 1573 | void MainWindow::whatsNew() |
1574 | { | 1574 | { |
1575 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1575 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1576 | 1576 | ||
1577 | } | 1577 | } |
1578 | void MainWindow::licence() | 1578 | void MainWindow::licence() |
1579 | { | 1579 | { |
1580 | KApplication::showLicence(); | 1580 | KApplication::showLicence(); |
1581 | 1581 | ||
1582 | } | 1582 | } |
1583 | void MainWindow::about() | 1583 | void MainWindow::about() |
1584 | { | 1584 | { |
1585 | QString version; | 1585 | QString version; |
1586 | #include <../version> | 1586 | #include <../version> |
1587 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1587 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1588 | i18n("KOrganizer/Platform-independent\n") + | 1588 | i18n("KOrganizer/Platform-independent\n") + |
1589 | "(KO/Pi) " + version + " - " + | 1589 | "(KO/Pi) " + version + " - " + |
1590 | 1590 | ||
1591 | #ifdef DESKTOP_VERSION | 1591 | #ifdef DESKTOP_VERSION |
1592 | i18n("Desktop Edition\n") + | 1592 | i18n("Desktop Edition\n") + |
1593 | #else | 1593 | #else |
1594 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1594 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1595 | #endif | 1595 | #endif |
1596 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1596 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1597 | } | 1597 | } |
1598 | void MainWindow::keyBindings() | 1598 | void MainWindow::keyBindings() |
1599 | { | 1599 | { |
1600 | QString cap = i18n("KO/Pi Keys + Colors"); | 1600 | QString cap = i18n("KO/Pi Keys + Colors"); |
1601 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1601 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1602 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1602 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1603 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1603 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1604 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1604 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1605 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1605 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1606 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1606 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1607 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1607 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1608 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1608 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1609 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1609 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1610 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1610 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1611 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1611 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1612 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1612 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1613 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1613 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1614 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1614 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1615 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1615 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1616 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1616 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1617 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1617 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1618 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1618 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1619 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1619 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1620 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1620 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1621 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1621 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1622 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1622 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1623 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1623 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1624 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1624 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1625 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1625 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1626 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1626 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1627 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1627 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1628 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1628 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1629 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1629 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1630 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1630 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1631 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1631 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1632 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1632 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1633 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1633 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1634 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1634 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1635 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1635 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1636 | i18n("<p><h3>In list view:</h3></p>\n") + | 1636 | i18n("<p><h3>In list view:</h3></p>\n") + |
1637 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1637 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1638 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1638 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1639 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1639 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1640 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1640 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1641 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1641 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1642 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1642 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1643 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1643 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1644 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1644 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1645 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1645 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1646 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1646 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1647 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1647 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1648 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1648 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1649 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1649 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1650 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1650 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1651 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1651 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1652 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1652 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1653 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1653 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1654 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1654 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1655 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1655 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1656 | displayText( text, cap); | 1656 | displayText( text, cap); |
1657 | } | 1657 | } |
1658 | void MainWindow::aboutAutoSaving() | 1658 | void MainWindow::aboutAutoSaving() |
1659 | { | 1659 | { |
1660 | 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"); | 1660 | 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"); |
1661 | 1661 | ||
1662 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1662 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1663 | 1663 | ||
1664 | } | 1664 | } |
1665 | void MainWindow::aboutKnownBugs() | 1665 | void MainWindow::aboutKnownBugs() |
1666 | { | 1666 | { |
1667 | QMessageBox* msg; | 1667 | QMessageBox* msg; |
1668 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1668 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1669 | 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")+ | 1669 | 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")+ |
1670 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1670 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1671 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1671 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1672 | i18n("\nor report them in the bugtracker on\n") + | 1672 | i18n("\nor report them in the bugtracker on\n") + |
1673 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1673 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1674 | QMessageBox::NoIcon, | 1674 | QMessageBox::NoIcon, |
1675 | QMessageBox::Ok, | 1675 | QMessageBox::Ok, |
1676 | QMessageBox::NoButton, | 1676 | QMessageBox::NoButton, |
1677 | QMessageBox::NoButton); | 1677 | QMessageBox::NoButton); |
1678 | msg->exec(); | 1678 | msg->exec(); |
1679 | delete msg; | 1679 | delete msg; |
1680 | 1680 | ||
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | QString MainWindow::defaultFileName() | 1683 | QString MainWindow::defaultFileName() |
1684 | { | 1684 | { |
1685 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1685 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1686 | } | 1686 | } |
1687 | QString MainWindow::syncFileName() | 1687 | QString MainWindow::syncFileName() |
1688 | { | 1688 | { |
1689 | #ifdef DESKTOP_VERSION | 1689 | #ifdef DESKTOP_VERSION |
1690 | return locateLocal( "tmp", "synccalendar.ics" ); | 1690 | return locateLocal( "tmp", "synccalendar.ics" ); |
1691 | #else | 1691 | #else |
1692 | return QString( "/tmp/synccalendar.ics" ); | 1692 | return QString( "/tmp/synccalendar.ics" ); |
1693 | #endif | 1693 | #endif |
1694 | } | 1694 | } |
1695 | #include "koglobals.h" | 1695 | #include "koglobals.h" |
1696 | #include <kcalendarsystem.h> | 1696 | #include <kcalendarsystem.h> |
1697 | void MainWindow::updateWeek(QDate seda) | 1697 | void MainWindow::updateWeek(QDate seda) |
1698 | { | 1698 | { |
1699 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1699 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1700 | mWeekPixmap.fill( mWeekBgColor ); | 1700 | mWeekPixmap.fill( mWeekBgColor ); |
1701 | QPainter p ( &mWeekPixmap ); | 1701 | QPainter p ( &mWeekPixmap ); |
1702 | p.setFont( mWeekFont ); | 1702 | p.setFont( mWeekFont ); |
1703 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1703 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1704 | p.end(); | 1704 | p.end(); |
1705 | QIconSet icon3 ( mWeekPixmap ); | 1705 | QIconSet icon3 ( mWeekPixmap ); |
1706 | mWeekAction->setIconSet ( icon3 ); | 1706 | mWeekAction->setIconSet ( icon3 ); |
1707 | 1707 | ||
1708 | } | 1708 | } |
1709 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1709 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1710 | { | 1710 | { |
1711 | updateWeek( selectedDates.first() ); | 1711 | updateWeek( selectedDates.first() ); |
1712 | } | 1712 | } |
1713 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1713 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1714 | { | 1714 | { |
1715 | if ( !incidence ) { | 1715 | if ( !incidence ) { |
1716 | mShowAction->setMenuText( i18n("Show") ); | 1716 | mShowAction->setMenuText( i18n("Show") ); |
1717 | enableIncidenceActions( false ); | 1717 | enableIncidenceActions( false ); |
1718 | mNewSubTodoAction->setEnabled( false ); | 1718 | mNewSubTodoAction->setEnabled( false ); |
1719 | setCaptionToDates(); | 1719 | setCaptionToDates(); |
1720 | return; | 1720 | return; |
1721 | } | 1721 | } |
1722 | QString startString = ""; | 1722 | QString startString = ""; |
1723 | if ( incidence->typeID() != todoID ) { | 1723 | if ( incidence->typeID() != todoID ) { |
1724 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1724 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1725 | if ( incidence->doesFloat() ) { | 1725 | if ( incidence->doesFloat() ) { |
1726 | startString += ": "+incidence->dtStartDateStr( true ); | 1726 | startString += ": "+incidence->dtStartDateStr( true ); |
1727 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1727 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1728 | } else { | 1728 | } else { |
1729 | startString = ": "+incidence->dtStartStr(true); | 1729 | startString = ": "+incidence->dtStartStr(true); |
1730 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1730 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1731 | } | 1731 | } |
1732 | } else { | 1732 | } else { |
1733 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1733 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1734 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1734 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1735 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1735 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1736 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1736 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1737 | bool ok; | 1737 | bool ok; |
1738 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1738 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1739 | if ( ok ) { | 1739 | if ( ok ) { |
1740 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1740 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1741 | startString += i18n(" (%1 y.)"). arg( years ); | 1741 | startString += i18n(" (%1 y.)"). arg( years ); |
1742 | } | 1742 | } |
1743 | } | 1743 | } |
1744 | else | 1744 | else |
1745 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1745 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1746 | } | 1746 | } |
1747 | } | 1747 | } |
1748 | else { | 1748 | else { |
1749 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1749 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1750 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1750 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1751 | else | 1751 | else |
1752 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1752 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1753 | } | 1753 | } |
1754 | if ( !incidence->location().isEmpty() ) | 1754 | if ( !incidence->location().isEmpty() ) |
1755 | startString += " (" +incidence->location()+")"; | 1755 | startString += " (" +incidence->location()+")"; |
1756 | setCaption( incidence->summary()+startString); | 1756 | setCaption( incidence->summary()+startString); |
1757 | enableIncidenceActions( true ); | 1757 | enableIncidenceActions( true ); |
1758 | if ( incidence->typeID() == eventID ) { | 1758 | if ( incidence->typeID() == eventID ) { |
1759 | mShowAction->setMenuText( i18n("Show Event") ); | 1759 | mShowAction->setMenuText( i18n("Show Event") ); |
1760 | mNewSubTodoAction->setEnabled( false ); | 1760 | mNewSubTodoAction->setEnabled( false ); |
1761 | } else if ( incidence->typeID() == todoID ) { | 1761 | } else if ( incidence->typeID() == todoID ) { |
1762 | mShowAction->setMenuText( i18n("Show Todo") ); | 1762 | mShowAction->setMenuText( i18n("Show Todo") ); |
1763 | mNewSubTodoAction->setEnabled( true ); | 1763 | mNewSubTodoAction->setEnabled( true ); |
1764 | } else { | 1764 | } else { |
1765 | mShowAction->setMenuText( i18n("Show") ); | 1765 | mShowAction->setMenuText( i18n("Show") ); |
1766 | mNewSubTodoAction->setEnabled( false ); | 1766 | mNewSubTodoAction->setEnabled( false ); |
1767 | } | 1767 | } |
1768 | #ifdef DESKTOP_VERSION | ||
1768 | static QPixmap jP = SmallIcon( "journal" ); | 1769 | static QPixmap jP = SmallIcon( "journal" ); |
1769 | static QPixmap eP = SmallIcon( "newevent" ); | 1770 | static QPixmap eP = SmallIcon( "newevent" ); |
1770 | static QPixmap tP = SmallIcon( "newtodo" ); | 1771 | static QPixmap tP = SmallIcon( "newtodo" ); |
1771 | #ifdef DESKTOP_VERSION | ||
1772 | QIconSet icon; | 1772 | QIconSet icon; |
1773 | if ( incidence->typeID() == todoID ) | 1773 | if ( incidence->typeID() == todoID ) |
1774 | icon = QIconSet ( tP ); | 1774 | icon = QIconSet ( tP ); |
1775 | else if ( incidence->typeID() == eventID ) | 1775 | else if ( incidence->typeID() == eventID ) |
1776 | icon = QIconSet ( eP ); | 1776 | icon = QIconSet ( eP ); |
1777 | else if ( incidence->typeID() == journalID ) | 1777 | else if ( incidence->typeID() == journalID ) |
1778 | icon = QIconSet ( jP ); | 1778 | icon = QIconSet ( jP ); |
1779 | mPrintSelAction->setIconSet ( icon ); | 1779 | mPrintSelAction->setIconSet ( icon ); |
1780 | #endif | 1780 | #endif |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | void MainWindow::enableIncidenceActions( bool enabled ) | 1783 | void MainWindow::enableIncidenceActions( bool enabled ) |
1784 | { | 1784 | { |
1785 | mShowAction->setEnabled( enabled ); | 1785 | mShowAction->setEnabled( enabled ); |
1786 | mEditAction->setEnabled( enabled ); | 1786 | mEditAction->setEnabled( enabled ); |
1787 | mDeleteAction->setEnabled( enabled ); | 1787 | mDeleteAction->setEnabled( enabled ); |
1788 | 1788 | ||
1789 | mCloneAction->setEnabled( enabled ); | 1789 | mCloneAction->setEnabled( enabled ); |
1790 | mMoveAction->setEnabled( enabled ); | 1790 | mMoveAction->setEnabled( enabled ); |
1791 | #ifndef DESKTOP_VERSION | 1791 | #ifndef DESKTOP_VERSION |
1792 | mBeamAction->setEnabled( enabled ); | 1792 | mBeamAction->setEnabled( enabled ); |
1793 | #else | 1793 | #else |
1794 | mPrintSelAction->setEnabled( enabled ); | 1794 | mPrintSelAction->setEnabled( enabled ); |
1795 | #endif | 1795 | #endif |
1796 | mCancelAction->setEnabled( enabled ); | 1796 | mCancelAction->setEnabled( enabled ); |
1797 | } | 1797 | } |
1798 | 1798 | ||
1799 | void MainWindow::importOL() | 1799 | void MainWindow::importOL() |
1800 | { | 1800 | { |
1801 | #ifdef _OL_IMPORT_ | 1801 | #ifdef _OL_IMPORT_ |
1802 | mView->clearAllViews(); | 1802 | mView->clearAllViews(); |
1803 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1803 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1804 | id->exec(); | 1804 | id->exec(); |
1805 | delete id; | 1805 | delete id; |
1806 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1806 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1807 | mView->updateView(); | 1807 | mView->updateView(); |
1808 | #endif | 1808 | #endif |
1809 | } | 1809 | } |
1810 | void MainWindow::importBday() | 1810 | void MainWindow::importBday() |
1811 | { | 1811 | { |
1812 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1812 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1813 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1813 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1814 | i18n("Import!"), i18n("Cancel"), 0, | 1814 | i18n("Import!"), i18n("Cancel"), 0, |
1815 | 0, 1 ); | 1815 | 0, 1 ); |
1816 | if ( result == 0 ) { | 1816 | if ( result == 0 ) { |
1817 | mView->importBday(); | 1817 | mView->importBday(); |
1818 | 1818 | ||
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | 1821 | ||
1822 | } | 1822 | } |
1823 | void MainWindow::importQtopia() | 1823 | void MainWindow::importQtopia() |
1824 | { | 1824 | { |
1825 | //#ifndef DESKTOP_VERSION | 1825 | //#ifndef DESKTOP_VERSION |
1826 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1826 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1827 | #ifdef DESKTOP_VERSION | 1827 | #ifdef DESKTOP_VERSION |
1828 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1828 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1829 | #endif | 1829 | #endif |
1830 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1830 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1831 | i18n("Import!"), i18n("Cancel"), 0, | 1831 | i18n("Import!"), i18n("Cancel"), 0, |
1832 | 0, 1 ); | 1832 | 0, 1 ); |
1833 | if ( result == 0 ) { | 1833 | if ( result == 0 ) { |
1834 | #ifndef DESKTOP_VERSION | 1834 | #ifndef DESKTOP_VERSION |
1835 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1835 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1836 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1836 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1837 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1837 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1838 | #else | 1838 | #else |
1839 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1839 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1840 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1840 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1841 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1841 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1842 | #endif | 1842 | #endif |
1843 | mView->importQtopia( categories, datebook, todolist ); | 1843 | mView->importQtopia( categories, datebook, todolist ); |
1844 | } | 1844 | } |
1845 | mView->calendar()->reInitAlarmSettings(); | 1845 | mView->calendar()->reInitAlarmSettings(); |
1846 | #if 0 | 1846 | #if 0 |
1847 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1847 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1848 | i18n("Not supported \non desktop!\n"), | 1848 | i18n("Not supported \non desktop!\n"), |
1849 | i18n("Ok"), i18n("Cancel"), 0, | 1849 | i18n("Ok"), i18n("Cancel"), 0, |
1850 | 0, 1 ); | 1850 | 0, 1 ); |
1851 | 1851 | ||
1852 | #endif | 1852 | #endif |
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | void MainWindow::saveOnClose() | 1855 | void MainWindow::saveOnClose() |
1856 | { | 1856 | { |
1857 | KOPrefs *p = KOPrefs::instance(); | 1857 | KOPrefs *p = KOPrefs::instance(); |
1858 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1858 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1859 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1859 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1860 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1860 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1861 | if ( filterToolBar ) { | 1861 | if ( filterToolBar ) { |
1862 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1862 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1863 | } | 1863 | } |
1864 | #ifdef DESKTOP_VERSION | 1864 | #ifdef DESKTOP_VERSION |
1865 | 1865 | ||
1866 | QPoint myP; | 1866 | QPoint myP; |
1867 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1867 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1868 | if ( p->mToolBarHor ) | 1868 | if ( p->mToolBarHor ) |
1869 | p->mToolBarUp = myP.y() > height()/2; | 1869 | p->mToolBarUp = myP.y() > height()/2; |
1870 | else | 1870 | else |
1871 | p->mToolBarUp = myP.x() > width()/2; | 1871 | p->mToolBarUp = myP.x() > width()/2; |
1872 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1872 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1873 | if ( p->mToolBarHorV ) | 1873 | if ( p->mToolBarHorV ) |
1874 | p->mToolBarUpV = myP.y() > height()/2; | 1874 | p->mToolBarUpV = myP.y() > height()/2; |
1875 | else | 1875 | else |
1876 | p->mToolBarUpV = myP.x() > width()/2 ; | 1876 | p->mToolBarUpV = myP.x() > width()/2 ; |
1877 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1877 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1878 | if ( p->mToolBarHorN ) | 1878 | if ( p->mToolBarHorN ) |
1879 | p->mToolBarUpN = myP.y() > height()/2; | 1879 | p->mToolBarUpN = myP.y() > height()/2; |
1880 | else | 1880 | else |
1881 | p->mToolBarUpN = myP.x() > width()/2 ; | 1881 | p->mToolBarUpN = myP.x() > width()/2 ; |
1882 | if ( filterToolBar ) { | 1882 | if ( filterToolBar ) { |
1883 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1883 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1884 | if ( p->mToolBarHorF ) | 1884 | if ( p->mToolBarHorF ) |
1885 | p->mToolBarUpF = myP.y() > height()/2; | 1885 | p->mToolBarUpF = myP.y() > height()/2; |
1886 | else | 1886 | else |
1887 | p->mToolBarUpF = myP.x() > width()/2 ; | 1887 | p->mToolBarUpF = myP.x() > width()/2 ; |
1888 | } | 1888 | } |
1889 | #else | 1889 | #else |
1890 | if ( p->mToolBarHor ) | 1890 | if ( p->mToolBarHor ) |
1891 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1891 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1892 | else | 1892 | else |
1893 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1893 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1894 | if ( p->mToolBarHorV ) | 1894 | if ( p->mToolBarHorV ) |
1895 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1895 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1896 | else | 1896 | else |
1897 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1897 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1898 | 1898 | ||
1899 | if ( p->mToolBarHorN ) | 1899 | if ( p->mToolBarHorN ) |
1900 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1900 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1901 | else | 1901 | else |
1902 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1902 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1903 | if ( filterToolBar ) { | 1903 | if ( filterToolBar ) { |
1904 | if ( p->mToolBarHorF ) | 1904 | if ( p->mToolBarHorF ) |
1905 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1905 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1906 | else | 1906 | else |
1907 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1907 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1908 | } | 1908 | } |
1909 | #endif | 1909 | #endif |
1910 | save(); | 1910 | save(); |
1911 | mView->writeSettings(); | 1911 | mView->writeSettings(); |
1912 | mView->checkSuspendAlarm(); | 1912 | mView->checkSuspendAlarm(); |
1913 | } | 1913 | } |
1914 | void MainWindow::slotModifiedChanged( bool ) | 1914 | void MainWindow::slotModifiedChanged( bool ) |
1915 | { | 1915 | { |
1916 | if ( mBlockAtStartup ) | 1916 | if ( mBlockAtStartup ) |
1917 | return; | 1917 | return; |
1918 | 1918 | ||
1919 | int msec; | 1919 | int msec; |
1920 | if ( mCalendarModifiedFlag ) { | 1920 | if ( mCalendarModifiedFlag ) { |
1921 | //qDebug(" MainWindow timer is running "); | 1921 | //qDebug(" MainWindow timer is running "); |
1922 | return; | 1922 | return; |
1923 | } | 1923 | } |
1924 | // we store the changes after 1 minute, | 1924 | // we store the changes after 1 minute, |
1925 | // and for safety reasons after 10 minutes again | 1925 | // and for safety reasons after 10 minutes again |
1926 | if ( !mSyncManager->blockSave() ) | 1926 | if ( !mSyncManager->blockSave() ) |
1927 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1927 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1928 | else | 1928 | else |
1929 | msec = 1000 * 600; | 1929 | msec = 1000 * 600; |
1930 | mSaveTimer.start( msec, true ); // 1 minute | 1930 | mSaveTimer.start( msec, true ); // 1 minute |
1931 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1931 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1932 | mCalendarModifiedFlag = true; | 1932 | mCalendarModifiedFlag = true; |
1933 | } | 1933 | } |
1934 | void MainWindow::saveStopTimer() | 1934 | void MainWindow::saveStopTimer() |
1935 | { | 1935 | { |
1936 | mSaveTimer.stop(); | 1936 | mSaveTimer.stop(); |
1937 | } | 1937 | } |
1938 | void MainWindow::backupAllFiles() | 1938 | void MainWindow::backupAllFiles() |
1939 | { | 1939 | { |
1940 | QDate reference ( 2000,1,1); | 1940 | QDate reference ( 2000,1,1); |
1941 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1941 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1942 | setCaption(i18n("Creating backup ... please wait ..." )); | 1942 | setCaption(i18n("Creating backup ... please wait ..." )); |
1943 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1943 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1944 | // we need the file path, the backup dir and the number of bups as param | 1944 | // we need the file path, the backup dir and the number of bups as param |
1945 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1945 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1946 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1946 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1947 | bupDir = KGlobalSettings::backupDataDir(); | 1947 | bupDir = KGlobalSettings::backupDataDir(); |
1948 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1948 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1949 | if ( retval == 0 ) { | 1949 | if ( retval == 0 ) { |
1950 | setCaption(i18n("Backup cancelled" )); | 1950 | setCaption(i18n("Backup cancelled" )); |
1951 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1951 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1952 | // retval == 0 : backup skipped for today, try again tomorrow | 1952 | // retval == 0 : backup skipped for today, try again tomorrow |
1953 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1953 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1954 | } else if ( retval == 1 ){ | 1954 | } else if ( retval == 1 ){ |
1955 | qDebug("KO: Backup created."); | 1955 | qDebug("KO: Backup created."); |
1956 | // backup ok | 1956 | // backup ok |
1957 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1957 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1958 | KopiCalendarFile * cal = calendars.first(); | 1958 | KopiCalendarFile * cal = calendars.first(); |
1959 | cal = calendars.next(); | 1959 | cal = calendars.next(); |
1960 | while ( cal ) { | 1960 | while ( cal ) { |
1961 | if ( !cal->mErrorOnLoad ) { | 1961 | if ( !cal->mErrorOnLoad ) { |
1962 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1962 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1963 | } | 1963 | } |
1964 | cal = calendars.next(); | 1964 | cal = calendars.next(); |
1965 | } | 1965 | } |
1966 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1966 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1967 | setCaption(i18n("Backup succesfully finished" )); | 1967 | setCaption(i18n("Backup succesfully finished" )); |
1968 | } else if ( retval == 2 ){ | 1968 | } else if ( retval == 2 ){ |
1969 | setCaption(i18n("Backup globally disabled" )); | 1969 | setCaption(i18n("Backup globally disabled" )); |
1970 | qDebug("KO: Backup globally cancelled."); | 1970 | qDebug("KO: Backup globally cancelled."); |
1971 | // backup globally cancelled | 1971 | // backup globally cancelled |
1972 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1972 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1973 | } | 1973 | } |
1974 | // retval == 3: do nothing, try again later | 1974 | // retval == 3: do nothing, try again later |
1975 | } | 1975 | } |
1976 | void MainWindow::save() | 1976 | void MainWindow::save() |
1977 | { | 1977 | { |
1978 | 1978 | ||
1979 | if ( mView->viewManager()->journalView() ) | 1979 | if ( mView->viewManager()->journalView() ) |
1980 | mView->viewManager()->journalView()->checkModified(); | 1980 | mView->viewManager()->journalView()->checkModified(); |
1981 | if ( !mCalendarModifiedFlag ) { | 1981 | if ( !mCalendarModifiedFlag ) { |
1982 | qDebug("KO: Calendar not modified. Nothing saved."); | 1982 | qDebug("KO: Calendar not modified. Nothing saved."); |
1983 | return; | 1983 | return; |
1984 | } | 1984 | } |
1985 | if ( mSyncManager->blockSave() ) { | 1985 | if ( mSyncManager->blockSave() ) { |
1986 | return; | 1986 | return; |
1987 | } | 1987 | } |
1988 | mSyncManager->setBlockSave(true); | 1988 | mSyncManager->setBlockSave(true); |
1989 | if ( mView->checkAllFileVersions() ) { | 1989 | if ( mView->checkAllFileVersions() ) { |
1990 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1990 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1991 | QDate reference ( 2000,1,1); | 1991 | QDate reference ( 2000,1,1); |
1992 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1992 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1993 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1993 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1994 | backupAllFiles(); | 1994 | backupAllFiles(); |
1995 | } | 1995 | } |
1996 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1996 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1997 | } | 1997 | } |
1998 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1998 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1999 | if ( !isMinimized () ) | 1999 | if ( !isMinimized () ) |
2000 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2000 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2001 | qDebug("KO: Start saving data to file!"); | 2001 | qDebug("KO: Start saving data to file!"); |
2002 | mView->saveCalendars(); | 2002 | mView->saveCalendars(); |
2003 | mCalendarModifiedFlag = false; | 2003 | mCalendarModifiedFlag = false; |
2004 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 2004 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
2005 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2005 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
2006 | QString savemes; | 2006 | QString savemes; |
2007 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2007 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2008 | if ( !isMinimized () ) | 2008 | if ( !isMinimized () ) |
2009 | setCaption(savemes); | 2009 | setCaption(savemes); |
2010 | else | 2010 | else |
2011 | qDebug(savemes); | 2011 | qDebug(savemes); |
2012 | } else { | 2012 | } else { |
2013 | setCaption(i18n("Saving cancelled!")); | 2013 | setCaption(i18n("Saving cancelled!")); |
2014 | mCalendarModifiedFlag = false; | 2014 | mCalendarModifiedFlag = false; |
2015 | slotModifiedChanged( true ); | 2015 | slotModifiedChanged( true ); |
2016 | } | 2016 | } |
2017 | mSyncManager->setBlockSave( false ); | 2017 | mSyncManager->setBlockSave( false ); |
2018 | } | 2018 | } |
2019 | 2019 | ||
2020 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2020 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2021 | { | 2021 | { |
2022 | if ( !e->isAutoRepeat() ) { | 2022 | if ( !e->isAutoRepeat() ) { |
2023 | mFlagKeyPressed = false; | 2023 | mFlagKeyPressed = false; |
2024 | } | 2024 | } |
2025 | } | 2025 | } |
2026 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2026 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2027 | { | 2027 | { |
2028 | qApp->processEvents(); | 2028 | qApp->processEvents(); |
2029 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2029 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2030 | e->ignore(); | 2030 | e->ignore(); |
2031 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2031 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2032 | return; | 2032 | return; |
2033 | } | 2033 | } |
2034 | if (! e->isAutoRepeat() ) | 2034 | if (! e->isAutoRepeat() ) |
2035 | mFlagKeyPressed = true; | 2035 | mFlagKeyPressed = true; |
2036 | KOPrefs *p = KOPrefs::instance(); | 2036 | KOPrefs *p = KOPrefs::instance(); |
2037 | bool showSelectedDates = false; | 2037 | bool showSelectedDates = false; |
2038 | int size; | 2038 | int size; |
2039 | int pro = 0; | 2039 | int pro = 0; |
2040 | //qDebug("MainWindow::keyPressEvent "); | 2040 | //qDebug("MainWindow::keyPressEvent "); |
2041 | switch ( e->key() ) { | 2041 | switch ( e->key() ) { |
2042 | case Qt::Key_Right: | 2042 | case Qt::Key_Right: |
2043 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2043 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2044 | mView->goNextMonth(); | 2044 | mView->goNextMonth(); |
2045 | else | 2045 | else |
2046 | mView->goNext(); | 2046 | mView->goNext(); |
2047 | showSelectedDates = true; | 2047 | showSelectedDates = true; |
2048 | break; | 2048 | break; |
2049 | case Qt::Key_Left: | 2049 | case Qt::Key_Left: |
2050 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2050 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2051 | mView->goPreviousMonth(); | 2051 | mView->goPreviousMonth(); |
2052 | else | 2052 | else |
2053 | mView->goPrevious(); | 2053 | mView->goPrevious(); |
2054 | showSelectedDates = true; | 2054 | showSelectedDates = true; |
2055 | break; | 2055 | break; |
2056 | case Qt::Key_Down: | 2056 | case Qt::Key_Down: |
2057 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2057 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2058 | break; | 2058 | break; |
2059 | case Qt::Key_Up: | 2059 | case Qt::Key_Up: |
2060 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2060 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2061 | break; | 2061 | break; |
2062 | case Qt::Key_K: | 2062 | case Qt::Key_K: |
2063 | mView->viewManager()->showMonthViewWeek(); | 2063 | mView->viewManager()->showMonthViewWeek(); |
2064 | break; | 2064 | break; |
2065 | case Qt::Key_I: | 2065 | case Qt::Key_I: |
2066 | mView->showIncidence(); | 2066 | mView->showIncidence(); |
2067 | break; | 2067 | break; |
2068 | case Qt::Key_Delete: | 2068 | case Qt::Key_Delete: |
2069 | case Qt::Key_Backspace: | 2069 | case Qt::Key_Backspace: |
2070 | mView->deleteIncidence(); | 2070 | mView->deleteIncidence(); |
2071 | break; | 2071 | break; |
2072 | case Qt::Key_D: | 2072 | case Qt::Key_D: |
2073 | mView->viewManager()->showDayView(); | 2073 | mView->viewManager()->showDayView(); |
2074 | showSelectedDates = true; | 2074 | showSelectedDates = true; |
2075 | break; | 2075 | break; |
2076 | case Qt::Key_O: | 2076 | case Qt::Key_O: |
2077 | mView->toggleFilerEnabled( ); | 2077 | mView->toggleFilerEnabled( ); |
2078 | break; | 2078 | break; |
2079 | case Qt::Key_0: | 2079 | case Qt::Key_0: |
2080 | case Qt::Key_1: | 2080 | case Qt::Key_1: |
2081 | case Qt::Key_2: | 2081 | case Qt::Key_2: |
2082 | case Qt::Key_3: | 2082 | case Qt::Key_3: |
2083 | case Qt::Key_4: | 2083 | case Qt::Key_4: |
2084 | case Qt::Key_5: | 2084 | case Qt::Key_5: |
2085 | case Qt::Key_6: | 2085 | case Qt::Key_6: |
2086 | case Qt::Key_7: | 2086 | case Qt::Key_7: |
2087 | case Qt::Key_8: | 2087 | case Qt::Key_8: |
2088 | case Qt::Key_9: | 2088 | case Qt::Key_9: |
2089 | pro = e->key()-48; | 2089 | pro = e->key()-48; |
2090 | if ( pro == 0 ) | 2090 | if ( pro == 0 ) |
2091 | pro = 10; | 2091 | pro = 10; |
2092 | if ( e->state() == Qt::ControlButton) | 2092 | if ( e->state() == Qt::ControlButton) |
2093 | pro += 10; | 2093 | pro += 10; |
2094 | break; | 2094 | break; |
2095 | case Qt::Key_M: | 2095 | case Qt::Key_M: |
2096 | mView->viewManager()->showMonthView(); | 2096 | mView->viewManager()->showMonthView(); |
2097 | showSelectedDates = true; | 2097 | showSelectedDates = true; |
2098 | break; | 2098 | break; |
2099 | case Qt::Key_Insert: | 2099 | case Qt::Key_Insert: |
2100 | mView->newEvent(); | 2100 | mView->newEvent(); |
2101 | break; | 2101 | break; |
2102 | case Qt::Key_S : | 2102 | case Qt::Key_S : |
2103 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2103 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2104 | mView->newSubTodo(); | 2104 | mView->newSubTodo(); |
2105 | else | 2105 | else |
2106 | mView->dialogManager()->showSearchDialog(); | 2106 | mView->dialogManager()->showSearchDialog(); |
2107 | break; | 2107 | break; |
2108 | case Qt::Key_Y : | 2108 | case Qt::Key_Y : |
2109 | case Qt::Key_Z : | 2109 | case Qt::Key_Z : |
2110 | mView->viewManager()->showWorkWeekView(); | 2110 | mView->viewManager()->showWorkWeekView(); |
2111 | showSelectedDates = true; | 2111 | showSelectedDates = true; |
2112 | break; | 2112 | break; |
2113 | case Qt::Key_U : | 2113 | case Qt::Key_U : |
2114 | mView->viewManager()->showWeekView(); | 2114 | mView->viewManager()->showWeekView(); |
2115 | showSelectedDates = true; | 2115 | showSelectedDates = true; |
2116 | break; | 2116 | break; |
2117 | case Qt::Key_H : | 2117 | case Qt::Key_H : |
2118 | keyBindings(); | 2118 | keyBindings(); |
2119 | break; | 2119 | break; |
2120 | case Qt::Key_W: | 2120 | case Qt::Key_W: |
2121 | mView->viewManager()->showWhatsNextView(); | 2121 | mView->viewManager()->showWhatsNextView(); |
2122 | break; | 2122 | break; |
2123 | case Qt::Key_L: | 2123 | case Qt::Key_L: |
2124 | mView->viewManager()->showListView(); | 2124 | mView->viewManager()->showListView(); |
2125 | break; | 2125 | break; |
2126 | case Qt::Key_N: | 2126 | case Qt::Key_N: |
2127 | mView->viewManager()->showNextView(); | 2127 | mView->viewManager()->showNextView(); |
2128 | break; | 2128 | break; |
2129 | case Qt::Key_V: | 2129 | case Qt::Key_V: |
2130 | mView->viewManager()->showTodoView(); | 2130 | mView->viewManager()->showTodoView(); |
2131 | break; | 2131 | break; |
2132 | case Qt::Key_C: | 2132 | case Qt::Key_C: |
2133 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2133 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2134 | break; | 2134 | break; |
2135 | case Qt::Key_P: | 2135 | case Qt::Key_P: |
2136 | mView->showDatePicker( ); | 2136 | mView->showDatePicker( ); |
2137 | break; | 2137 | break; |
2138 | case Qt::Key_F: | 2138 | case Qt::Key_F: |
2139 | mView->editFilters(); | 2139 | mView->editFilters(); |
2140 | break; | 2140 | break; |
2141 | case Qt::Key_R: | 2141 | case Qt::Key_R: |
2142 | mView->toggleFilter(); | 2142 | mView->toggleFilter(); |
2143 | break; | 2143 | break; |
2144 | case Qt::Key_X: | 2144 | case Qt::Key_X: |
2145 | if ( e->state() == Qt::ControlButton ) | 2145 | if ( e->state() == Qt::ControlButton ) |
2146 | mView->toggleDateNavigatorWidget(); | 2146 | mView->toggleDateNavigatorWidget(); |
2147 | else { | 2147 | else { |
2148 | mView->viewManager()->showNextXView(); | 2148 | mView->viewManager()->showNextXView(); |
2149 | showSelectedDates = true; | 2149 | showSelectedDates = true; |
2150 | } | 2150 | } |
2151 | break; | 2151 | break; |
2152 | case Qt::Key_Space: | 2152 | case Qt::Key_Space: |
2153 | mView->toggleExpand(); | 2153 | mView->toggleExpand(); |
2154 | break; | 2154 | break; |
2155 | case Qt::Key_A: | 2155 | case Qt::Key_A: |