-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d959a7a..53b65b2 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1485,422 +1485,424 @@ void MainWindow::keyBindings() | |||
1485 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1485 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1486 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1486 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1487 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1487 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1488 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1488 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1489 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1489 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1490 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1490 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1491 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1491 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1492 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1492 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1493 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1493 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1494 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1494 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1495 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1495 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1496 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1496 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1497 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1497 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1498 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1498 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1499 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1499 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1500 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1500 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1501 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1501 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1502 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1502 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1503 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1503 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1504 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1504 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1505 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1505 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1506 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1506 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1507 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1507 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1508 | i18n("<p><h3>In list view:</h3></p>\n") + | 1508 | i18n("<p><h3>In list view:</h3></p>\n") + |
1509 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1509 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1510 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1510 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1511 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1511 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1512 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1512 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1513 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1513 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1514 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1514 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1515 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1515 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1516 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1516 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1517 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1517 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1518 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1518 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1519 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1519 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1520 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1520 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1521 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1521 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1522 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1522 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1523 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1523 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1524 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1524 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1525 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1525 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1526 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1526 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1527 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1527 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1528 | displayText( text, cap); | 1528 | displayText( text, cap); |
1529 | } | 1529 | } |
1530 | void MainWindow::aboutAutoSaving() | 1530 | void MainWindow::aboutAutoSaving() |
1531 | { | 1531 | { |
1532 | 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"); | 1532 | 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"); |
1533 | 1533 | ||
1534 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1534 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1535 | 1535 | ||
1536 | } | 1536 | } |
1537 | void MainWindow::aboutKnownBugs() | 1537 | void MainWindow::aboutKnownBugs() |
1538 | { | 1538 | { |
1539 | QMessageBox* msg; | 1539 | QMessageBox* msg; |
1540 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1540 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1541 | 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")+ | 1541 | 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")+ |
1542 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1542 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1543 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1543 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1544 | i18n("\nor report them in the bugtracker on\n") + | 1544 | i18n("\nor report them in the bugtracker on\n") + |
1545 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1545 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1546 | QMessageBox::NoIcon, | 1546 | QMessageBox::NoIcon, |
1547 | QMessageBox::Ok, | 1547 | QMessageBox::Ok, |
1548 | QMessageBox::NoButton, | 1548 | QMessageBox::NoButton, |
1549 | QMessageBox::NoButton); | 1549 | QMessageBox::NoButton); |
1550 | msg->exec(); | 1550 | msg->exec(); |
1551 | delete msg; | 1551 | delete msg; |
1552 | 1552 | ||
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | QString MainWindow::defaultFileName() | 1555 | QString MainWindow::defaultFileName() |
1556 | { | 1556 | { |
1557 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1557 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1558 | } | 1558 | } |
1559 | QString MainWindow::syncFileName() | 1559 | QString MainWindow::syncFileName() |
1560 | { | 1560 | { |
1561 | #ifdef DESKTOP_VERSION | 1561 | #ifdef DESKTOP_VERSION |
1562 | return locateLocal( "tmp", "synccalendar.ics" ); | 1562 | return locateLocal( "tmp", "synccalendar.ics" ); |
1563 | #else | 1563 | #else |
1564 | return QString( "/tmp/synccalendar.ics" ); | 1564 | return QString( "/tmp/synccalendar.ics" ); |
1565 | #endif | 1565 | #endif |
1566 | } | 1566 | } |
1567 | #include "koglobals.h" | 1567 | #include "koglobals.h" |
1568 | #include <kcalendarsystem.h> | 1568 | #include <kcalendarsystem.h> |
1569 | void MainWindow::updateWeek(QDate seda) | 1569 | void MainWindow::updateWeek(QDate seda) |
1570 | { | 1570 | { |
1571 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1571 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1572 | mWeekPixmap.fill( mWeekBgColor ); | 1572 | mWeekPixmap.fill( mWeekBgColor ); |
1573 | QPainter p ( &mWeekPixmap ); | 1573 | QPainter p ( &mWeekPixmap ); |
1574 | p.setFont( mWeekFont ); | 1574 | p.setFont( mWeekFont ); |
1575 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1575 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1576 | p.end(); | 1576 | p.end(); |
1577 | QIconSet icon3 ( mWeekPixmap ); | 1577 | QIconSet icon3 ( mWeekPixmap ); |
1578 | mWeekAction->setIconSet ( icon3 ); | 1578 | mWeekAction->setIconSet ( icon3 ); |
1579 | 1579 | ||
1580 | } | 1580 | } |
1581 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1581 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1582 | { | 1582 | { |
1583 | updateWeek( selectedDates.first() ); | 1583 | updateWeek( selectedDates.first() ); |
1584 | } | 1584 | } |
1585 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1585 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1586 | { | 1586 | { |
1587 | 1587 | ||
1588 | if ( !incidence ) { | 1588 | if ( !incidence ) { |
1589 | enableIncidenceActions( false ); | 1589 | enableIncidenceActions( false ); |
1590 | 1590 | ||
1591 | mNewSubTodoAction->setEnabled( false ); | 1591 | mNewSubTodoAction->setEnabled( false ); |
1592 | setCaptionToDates(); | 1592 | setCaptionToDates(); |
1593 | return; | 1593 | return; |
1594 | 1594 | ||
1595 | } | 1595 | } |
1596 | 1596 | ||
1597 | //KGlobal::locale()->formatDateTime(nextA, true); | 1597 | //KGlobal::locale()->formatDateTime(nextA, true); |
1598 | QString startString = ""; | 1598 | QString startString = ""; |
1599 | if ( incidence->type() != "Todo" ) { | 1599 | if ( incidence->type() != "Todo" ) { |
1600 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1600 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1601 | if ( incidence->doesFloat() ) { | 1601 | if ( incidence->doesFloat() ) { |
1602 | startString += ": "+incidence->dtStartDateStr( true ); | 1602 | startString += ": "+incidence->dtStartDateStr( true ); |
1603 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1603 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1604 | 1604 | ||
1605 | } else { | 1605 | } else { |
1606 | startString = ": "+incidence->dtStartStr(true); | 1606 | startString = ": "+incidence->dtStartStr(true); |
1607 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1607 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1608 | 1608 | ||
1609 | } | 1609 | } |
1610 | 1610 | ||
1611 | } else { | 1611 | } else { |
1612 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1612 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1613 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1613 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1614 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1614 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1615 | 1615 | ||
1616 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1616 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1617 | bool ok; | 1617 | bool ok; |
1618 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1618 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1619 | if ( ok ) { | 1619 | if ( ok ) { |
1620 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1620 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1621 | startString += i18n(" (%1 y.)"). arg( years ); | 1621 | startString += i18n(" (%1 y.)"). arg( years ); |
1622 | } | 1622 | } |
1623 | } | 1623 | } |
1624 | else | 1624 | else |
1625 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1625 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | } | 1628 | } |
1629 | else | 1629 | else |
1630 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1630 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1631 | if ( !incidence->location().isEmpty() ) | 1631 | if ( !incidence->location().isEmpty() ) |
1632 | startString += " (" +incidence->location()+")"; | 1632 | startString += " (" +incidence->location()+")"; |
1633 | setCaption( incidence->summary()+startString); | 1633 | setCaption( incidence->summary()+startString); |
1634 | 1634 | ||
1635 | enableIncidenceActions( true ); | 1635 | enableIncidenceActions( true ); |
1636 | 1636 | ||
1637 | if ( incidence->type() == "Event" ) { | 1637 | if ( incidence->type() == "Event" ) { |
1638 | mShowAction->setText( i18n("Show Event...") ); | 1638 | mShowAction->setText( i18n("Show Event...") ); |
1639 | mEditAction->setText( i18n("Edit Event...") ); | 1639 | mEditAction->setText( i18n("Edit Event...") ); |
1640 | mDeleteAction->setText( i18n("Delete Event...") ); | 1640 | mDeleteAction->setText( i18n("Delete Event...") ); |
1641 | 1641 | ||
1642 | mNewSubTodoAction->setEnabled( false ); | 1642 | mNewSubTodoAction->setEnabled( false ); |
1643 | } else if ( incidence->type() == "Todo" ) { | 1643 | } else if ( incidence->type() == "Todo" ) { |
1644 | mShowAction->setText( i18n("Show Todo...") ); | 1644 | mShowAction->setText( i18n("Show Todo...") ); |
1645 | mEditAction->setText( i18n("Edit Todo...") ); | 1645 | mEditAction->setText( i18n("Edit Todo...") ); |
1646 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1646 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1647 | 1647 | ||
1648 | mNewSubTodoAction->setEnabled( true ); | 1648 | mNewSubTodoAction->setEnabled( true ); |
1649 | } else { | 1649 | } else { |
1650 | mShowAction->setText( i18n("Show...") ); | 1650 | mShowAction->setText( i18n("Show...") ); |
1651 | mShowAction->setText( i18n("Edit...") ); | 1651 | mShowAction->setText( i18n("Edit...") ); |
1652 | mShowAction->setText( i18n("Delete...") ); | 1652 | mShowAction->setText( i18n("Delete...") ); |
1653 | 1653 | ||
1654 | mNewSubTodoAction->setEnabled( false ); | 1654 | mNewSubTodoAction->setEnabled( false ); |
1655 | } | 1655 | } |
1656 | } | 1656 | } |
1657 | 1657 | ||
1658 | void MainWindow::enableIncidenceActions( bool enabled ) | 1658 | void MainWindow::enableIncidenceActions( bool enabled ) |
1659 | { | 1659 | { |
1660 | mShowAction->setEnabled( enabled ); | 1660 | mShowAction->setEnabled( enabled ); |
1661 | mEditAction->setEnabled( enabled ); | 1661 | mEditAction->setEnabled( enabled ); |
1662 | mDeleteAction->setEnabled( enabled ); | 1662 | mDeleteAction->setEnabled( enabled ); |
1663 | 1663 | ||
1664 | mCloneAction->setEnabled( enabled ); | 1664 | mCloneAction->setEnabled( enabled ); |
1665 | mMoveAction->setEnabled( enabled ); | 1665 | mMoveAction->setEnabled( enabled ); |
1666 | mBeamAction->setEnabled( enabled ); | 1666 | mBeamAction->setEnabled( enabled ); |
1667 | mCancelAction->setEnabled( enabled ); | 1667 | mCancelAction->setEnabled( enabled ); |
1668 | } | 1668 | } |
1669 | 1669 | ||
1670 | void MainWindow::importOL() | 1670 | void MainWindow::importOL() |
1671 | { | 1671 | { |
1672 | #ifdef _OL_IMPORT_ | 1672 | #ifdef _OL_IMPORT_ |
1673 | mView->clearAllViews(); | 1673 | mView->clearAllViews(); |
1674 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1674 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1675 | id->exec(); | 1675 | id->exec(); |
1676 | delete id; | 1676 | delete id; |
1677 | mView->calendar()->checkAlarmForIncidence( 0, true ); | ||
1677 | mView->updateView(); | 1678 | mView->updateView(); |
1678 | #endif | 1679 | #endif |
1679 | } | 1680 | } |
1680 | void MainWindow::importBday() | 1681 | void MainWindow::importBday() |
1681 | { | 1682 | { |
1682 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1683 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1683 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1684 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1684 | i18n("Import!"), i18n("Cancel"), 0, | 1685 | i18n("Import!"), i18n("Cancel"), 0, |
1685 | 0, 1 ); | 1686 | 0, 1 ); |
1686 | if ( result == 0 ) { | 1687 | if ( result == 0 ) { |
1687 | mView->importBday(); | 1688 | mView->importBday(); |
1688 | 1689 | ||
1689 | } | 1690 | } |
1690 | 1691 | ||
1691 | 1692 | ||
1692 | } | 1693 | } |
1693 | void MainWindow::importQtopia() | 1694 | void MainWindow::importQtopia() |
1694 | { | 1695 | { |
1695 | //#ifndef DESKTOP_VERSION | 1696 | //#ifndef DESKTOP_VERSION |
1696 | 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"); | 1697 | 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"); |
1697 | #ifdef DESKTOP_VERSION | 1698 | #ifdef DESKTOP_VERSION |
1698 | 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"); | 1699 | 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"); |
1699 | #endif | 1700 | #endif |
1700 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1701 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1701 | i18n("Import!"), i18n("Cancel"), 0, | 1702 | i18n("Import!"), i18n("Cancel"), 0, |
1702 | 0, 1 ); | 1703 | 0, 1 ); |
1703 | if ( result == 0 ) { | 1704 | if ( result == 0 ) { |
1704 | #ifndef DESKTOP_VERSION | 1705 | #ifndef DESKTOP_VERSION |
1705 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1706 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1706 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1707 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1707 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1708 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1708 | #else | 1709 | #else |
1709 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1710 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1710 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1711 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1711 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1712 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1712 | #endif | 1713 | #endif |
1713 | mView->importQtopia( categories, datebook, todolist ); | 1714 | mView->importQtopia( categories, datebook, todolist ); |
1714 | } | 1715 | } |
1716 | mView->calendar()->reInitAlarmSettings(); | ||
1715 | #if 0 | 1717 | #if 0 |
1716 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1718 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1717 | i18n("Not supported \non desktop!\n"), | 1719 | i18n("Not supported \non desktop!\n"), |
1718 | i18n("Ok"), i18n("Cancel"), 0, | 1720 | i18n("Ok"), i18n("Cancel"), 0, |
1719 | 0, 1 ); | 1721 | 0, 1 ); |
1720 | 1722 | ||
1721 | #endif | 1723 | #endif |
1722 | } | 1724 | } |
1723 | 1725 | ||
1724 | void MainWindow::saveOnClose() | 1726 | void MainWindow::saveOnClose() |
1725 | { | 1727 | { |
1726 | KOPrefs *p = KOPrefs::instance(); | 1728 | KOPrefs *p = KOPrefs::instance(); |
1727 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1729 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1728 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1730 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1729 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1731 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1730 | if ( filterToolBar ) { | 1732 | if ( filterToolBar ) { |
1731 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1733 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1732 | } | 1734 | } |
1733 | #ifdef DESKTOP_VERSION | 1735 | #ifdef DESKTOP_VERSION |
1734 | 1736 | ||
1735 | QPoint myP; | 1737 | QPoint myP; |
1736 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1738 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1737 | if ( p->mToolBarHor ) | 1739 | if ( p->mToolBarHor ) |
1738 | p->mToolBarUp = myP.y() > height()/2; | 1740 | p->mToolBarUp = myP.y() > height()/2; |
1739 | else | 1741 | else |
1740 | p->mToolBarUp = myP.x() > width()/2; | 1742 | p->mToolBarUp = myP.x() > width()/2; |
1741 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1743 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1742 | if ( p->mToolBarHorV ) | 1744 | if ( p->mToolBarHorV ) |
1743 | p->mToolBarUpV = myP.y() > height()/2; | 1745 | p->mToolBarUpV = myP.y() > height()/2; |
1744 | else | 1746 | else |
1745 | p->mToolBarUpV = myP.x() > width()/2 ; | 1747 | p->mToolBarUpV = myP.x() > width()/2 ; |
1746 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1748 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1747 | if ( p->mToolBarHorN ) | 1749 | if ( p->mToolBarHorN ) |
1748 | p->mToolBarUpN = myP.y() > height()/2; | 1750 | p->mToolBarUpN = myP.y() > height()/2; |
1749 | else | 1751 | else |
1750 | p->mToolBarUpN = myP.x() > width()/2 ; | 1752 | p->mToolBarUpN = myP.x() > width()/2 ; |
1751 | if ( filterToolBar ) { | 1753 | if ( filterToolBar ) { |
1752 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1754 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1753 | if ( p->mToolBarHorF ) | 1755 | if ( p->mToolBarHorF ) |
1754 | p->mToolBarUpF = myP.y() > height()/2; | 1756 | p->mToolBarUpF = myP.y() > height()/2; |
1755 | else | 1757 | else |
1756 | p->mToolBarUpF = myP.x() > width()/2 ; | 1758 | p->mToolBarUpF = myP.x() > width()/2 ; |
1757 | } | 1759 | } |
1758 | #else | 1760 | #else |
1759 | if ( p->mToolBarHor ) | 1761 | if ( p->mToolBarHor ) |
1760 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1762 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1761 | else | 1763 | else |
1762 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1764 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1763 | if ( p->mToolBarHorV ) | 1765 | if ( p->mToolBarHorV ) |
1764 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1766 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1765 | else | 1767 | else |
1766 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1768 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1767 | 1769 | ||
1768 | if ( p->mToolBarHorN ) | 1770 | if ( p->mToolBarHorN ) |
1769 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1771 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1770 | else | 1772 | else |
1771 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1773 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1772 | if ( filterToolBar ) { | 1774 | if ( filterToolBar ) { |
1773 | if ( p->mToolBarHorF ) | 1775 | if ( p->mToolBarHorF ) |
1774 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1776 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1775 | else | 1777 | else |
1776 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1778 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1777 | } | 1779 | } |
1778 | #endif | 1780 | #endif |
1779 | 1781 | ||
1780 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1782 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1781 | save(); | 1783 | save(); |
1782 | mView->writeSettings(); | 1784 | mView->writeSettings(); |
1783 | } | 1785 | } |
1784 | void MainWindow::slotModifiedChanged( bool changed ) | 1786 | void MainWindow::slotModifiedChanged( bool changed ) |
1785 | { | 1787 | { |
1786 | if ( mBlockAtStartup ) | 1788 | if ( mBlockAtStartup ) |
1787 | return; | 1789 | return; |
1788 | 1790 | ||
1789 | int msec; | 1791 | int msec; |
1790 | // we store the changes after 1 minute, | 1792 | // we store the changes after 1 minute, |
1791 | // and for safety reasons after 10 minutes again | 1793 | // and for safety reasons after 10 minutes again |
1792 | if ( !mSyncManager->blockSave() ) | 1794 | if ( !mSyncManager->blockSave() ) |
1793 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1795 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1794 | else | 1796 | else |
1795 | msec = 1000 * 600; | 1797 | msec = 1000 * 600; |
1796 | mSaveTimer.start( msec, true ); // 1 minute | 1798 | mSaveTimer.start( msec, true ); // 1 minute |
1797 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1799 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1798 | mCalendarModifiedFlag = true; | 1800 | mCalendarModifiedFlag = true; |
1799 | } | 1801 | } |
1800 | void MainWindow::saveStopTimer() | 1802 | void MainWindow::saveStopTimer() |
1801 | { | 1803 | { |
1802 | mSaveTimer.stop(); | 1804 | mSaveTimer.stop(); |
1803 | } | 1805 | } |
1804 | void MainWindow::save() | 1806 | void MainWindow::save() |
1805 | { | 1807 | { |
1806 | if ( !mCalendarModifiedFlag ) { | 1808 | if ( !mCalendarModifiedFlag ) { |
1807 | qDebug("KO: Calendar not modified. Nothing saved."); | 1809 | qDebug("KO: Calendar not modified. Nothing saved."); |
1808 | return; | 1810 | return; |
1809 | } | 1811 | } |
1810 | if ( mSyncManager->blockSave() ) | 1812 | if ( mSyncManager->blockSave() ) |
1811 | return; | 1813 | return; |
1812 | mSyncManager->setBlockSave(true); | 1814 | mSyncManager->setBlockSave(true); |
1813 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1815 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1814 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1816 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1815 | QDate reference ( 2000,1,1); | 1817 | QDate reference ( 2000,1,1); |
1816 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1818 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1817 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1819 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1818 | setCaption(i18n("Creating backup ... please wait ..." )); | 1820 | setCaption(i18n("Creating backup ... please wait ..." )); |
1819 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1821 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1820 | // we need the file path, the backup dir and the number of bups as param | 1822 | // we need the file path, the backup dir and the number of bups as param |
1821 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1823 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1822 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1824 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1823 | bupDir = KGlobalSettings::backupDataDir(); | 1825 | bupDir = KGlobalSettings::backupDataDir(); |
1824 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1826 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1825 | if ( retval == 0 ) { | 1827 | if ( retval == 0 ) { |
1826 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1828 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1827 | // retval == 0 : backup skipped for today, try again tomorrow | 1829 | // retval == 0 : backup skipped for today, try again tomorrow |
1828 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1830 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1829 | } else if ( retval == 1 ){ | 1831 | } else if ( retval == 1 ){ |
1830 | qDebug("KO: Backup created."); | 1832 | qDebug("KO: Backup created."); |
1831 | // backup ok | 1833 | // backup ok |
1832 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1834 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1833 | 1835 | ||
1834 | } else if ( retval == 2 ){ | 1836 | } else if ( retval == 2 ){ |
1835 | qDebug("KO: Backup globally cancelled."); | 1837 | qDebug("KO: Backup globally cancelled."); |
1836 | // backup globally cancelled | 1838 | // backup globally cancelled |
1837 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1839 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1838 | } | 1840 | } |
1839 | // retval == 3: do nothing, try again later | 1841 | // retval == 3: do nothing, try again later |
1840 | } | 1842 | } |
1841 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1843 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1842 | } | 1844 | } |
1843 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1845 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1844 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1846 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1845 | qDebug("KO: Start saving data to file!"); | 1847 | qDebug("KO: Start saving data to file!"); |
1846 | mView->saveCalendar( defaultFileName() ); | 1848 | mView->saveCalendar( defaultFileName() ); |
1847 | mCalendarModifiedFlag = false; | 1849 | mCalendarModifiedFlag = false; |
1848 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1850 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1849 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1851 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1850 | QString savemes; | 1852 | QString savemes; |
1851 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1853 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1852 | setCaption(savemes); | 1854 | setCaption(savemes); |
1853 | } else | 1855 | } else |
1854 | setCaption(i18n("Saving cancelled!")); | 1856 | setCaption(i18n("Saving cancelled!")); |
1855 | mSyncManager->setBlockSave( false ); | 1857 | mSyncManager->setBlockSave( false ); |
1856 | } | 1858 | } |
1857 | 1859 | ||
1858 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1860 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1859 | { | 1861 | { |
1860 | if ( !e->isAutoRepeat() ) { | 1862 | if ( !e->isAutoRepeat() ) { |
1861 | mFlagKeyPressed = false; | 1863 | mFlagKeyPressed = false; |
1862 | } | 1864 | } |
1863 | } | 1865 | } |
1864 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1866 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1865 | { | 1867 | { |
1866 | qApp->processEvents(); | 1868 | qApp->processEvents(); |
1867 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1869 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1868 | e->ignore(); | 1870 | e->ignore(); |
1869 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1871 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1870 | return; | 1872 | return; |
1871 | } | 1873 | } |
1872 | if (! e->isAutoRepeat() ) | 1874 | if (! e->isAutoRepeat() ) |
1873 | mFlagKeyPressed = true; | 1875 | mFlagKeyPressed = true; |
1874 | KOPrefs *p = KOPrefs::instance(); | 1876 | KOPrefs *p = KOPrefs::instance(); |
1875 | bool showSelectedDates = false; | 1877 | bool showSelectedDates = false; |
1876 | int size; | 1878 | int size; |
1877 | int pro = 0; | 1879 | int pro = 0; |
1878 | //qDebug("MainWindow::keyPressEvent "); | 1880 | //qDebug("MainWindow::keyPressEvent "); |
1879 | switch ( e->key() ) { | 1881 | switch ( e->key() ) { |
1880 | case Qt::Key_Right: | 1882 | case Qt::Key_Right: |
1881 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1883 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1882 | mView->goNextMonth(); | 1884 | mView->goNextMonth(); |
1883 | else | 1885 | else |
1884 | mView->goNext(); | 1886 | mView->goNext(); |
1885 | showSelectedDates = true; | 1887 | showSelectedDates = true; |
1886 | break; | 1888 | break; |
1887 | case Qt::Key_Left: | 1889 | case Qt::Key_Left: |
1888 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1890 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1889 | mView->goPreviousMonth(); | 1891 | mView->goPreviousMonth(); |
1890 | else | 1892 | else |
1891 | mView->goPrevious(); | 1893 | mView->goPrevious(); |
1892 | showSelectedDates = true; | 1894 | showSelectedDates = true; |
1893 | break; | 1895 | break; |
1894 | case Qt::Key_Down: | 1896 | case Qt::Key_Down: |
1895 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1897 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1896 | break; | 1898 | break; |
1897 | case Qt::Key_Up: | 1899 | case Qt::Key_Up: |
1898 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1900 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1899 | break; | 1901 | break; |
1900 | case Qt::Key_K: | 1902 | case Qt::Key_K: |
1901 | mView->viewManager()->showMonthViewWeek(); | 1903 | mView->viewManager()->showMonthViewWeek(); |
1902 | break; | 1904 | break; |
1903 | case Qt::Key_I: | 1905 | case Qt::Key_I: |
1904 | mView->showIncidence(); | 1906 | mView->showIncidence(); |
1905 | break; | 1907 | break; |
1906 | case Qt::Key_Delete: | 1908 | case Qt::Key_Delete: |