summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7ce0251..45775c5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1602,1065 +1602,1072 @@ void MainWindow::keyBindings()
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}
1658void MainWindow::aboutAutoSaving() 1658void 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}
1665void MainWindow::aboutKnownBugs() 1665void 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
1683QString MainWindow::defaultFileName() 1683QString MainWindow::defaultFileName()
1684{ 1684{
1685 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1685 return locateLocal( "data", "korganizer/mycalendar.ics" );
1686} 1686}
1687QString MainWindow::syncFileName() 1687QString 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>
1697void MainWindow::updateWeek(QDate seda) 1697void 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}
1709void MainWindow::updateWeekNum(const DateList &selectedDates) 1709void MainWindow::updateWeekNum(const DateList &selectedDates)
1710{ 1710{
1711 updateWeek( selectedDates.first() ); 1711 updateWeek( selectedDates.first() );
1712} 1712}
1713void MainWindow::processIncidenceSelection( Incidence *incidence ) 1713void 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#ifdef DESKTOP_VERSION
1769 static QPixmap jP = SmallIcon( "journal" ); 1769 static QPixmap jP = SmallIcon( "journal" );
1770 static QPixmap eP = SmallIcon( "newevent" ); 1770 static QPixmap eP = SmallIcon( "newevent" );
1771 static QPixmap tP = SmallIcon( "newtodo" ); 1771 static QPixmap tP = SmallIcon( "newtodo" );
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
1783void MainWindow::enableIncidenceActions( bool enabled ) 1783void 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
1799void MainWindow::importOL() 1799void 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}
1810void MainWindow::importBday() 1810void 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}
1823void MainWindow::importQtopia() 1823void 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
1855void MainWindow::saveOnClose() 1855void 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}
1914void MainWindow::slotModifiedChanged( bool ) 1914void 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}
1934void MainWindow::saveStopTimer() 1934void MainWindow::saveStopTimer()
1935{ 1935{
1936 mSaveTimer.stop(); 1936 mSaveTimer.stop();
1937} 1937}
1938void MainWindow::backupAllFiles() 1938void 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}
1976void MainWindow::save() 1976void 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 slotModifiedChanged( true );
1986 return; 1987 return;
1987 } 1988 }
1988 mSyncManager->setBlockSave(true); 1989 mSyncManager->setBlockSave(true);
1989 if ( mView->checkAllFileVersions() ) { 1990 if ( mView->checkAllFileVersions() ) {
1990 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1991 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1991 QDate reference ( 2000,1,1); 1992 QDate reference ( 2000,1,1);
1992 int daysTo = reference.daysTo ( QDate::currentDate() ); 1993 int daysTo = reference.daysTo ( QDate::currentDate() );
1993 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1994 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1994 backupAllFiles(); 1995 backupAllFiles();
1995 } 1996 }
1996 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1997 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1997 } 1998 }
1998 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1999 QTime neededSaveTime = QDateTime::currentDateTime().time();
1999 if ( !isMinimized () ) 2000 if ( !isMinimized () )
2000 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 2001 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
2001 qDebug("KO: Start saving data to file!"); 2002 qDebug("KO: Start saving data to file!");
2002 mView->saveCalendars(); 2003 mView->saveCalendars();
2003 mCalendarModifiedFlag = false; 2004 mCalendarModifiedFlag = false;
2004 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 2005 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
2005 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2006 qDebug("KO: Needed %d ms for saving.",msNeeded );
2006 QString savemes; 2007 QString savemes;
2007 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2008 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2008 if ( !isMinimized () ) 2009 if ( !isMinimized () )
2009 setCaption(savemes); 2010 setCaption(savemes);
2010 else 2011 else
2011 qDebug(savemes); 2012 qDebug(savemes);
2012 } else { 2013 } else {
2013 setCaption(i18n("Saving cancelled!")); 2014 setCaption(i18n("Saving cancelled!"));
2014 mCalendarModifiedFlag = false; 2015 mCalendarModifiedFlag = false;
2015 slotModifiedChanged( true ); 2016 slotModifiedChanged( true );
2016 } 2017 }
2017 mSyncManager->setBlockSave( false ); 2018 mSyncManager->setBlockSave( false );
2018} 2019}
2019 2020
2020void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2021void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2021{ 2022{
2022 if ( !e->isAutoRepeat() ) { 2023 if ( !e->isAutoRepeat() ) {
2023 mFlagKeyPressed = false; 2024 mFlagKeyPressed = false;
2024 } 2025 }
2025} 2026}
2026void MainWindow::keyPressEvent ( QKeyEvent * e ) 2027void MainWindow::keyPressEvent ( QKeyEvent * e )
2027{ 2028{
2028 qApp->processEvents(); 2029 qApp->processEvents();
2029 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2030 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2030 e->ignore(); 2031 e->ignore();
2031 // qDebug(" ignore %d",e->isAutoRepeat() ); 2032 // qDebug(" ignore %d",e->isAutoRepeat() );
2032 return; 2033 return;
2033 } 2034 }
2034 if (! e->isAutoRepeat() ) 2035 if (! e->isAutoRepeat() )
2035 mFlagKeyPressed = true; 2036 mFlagKeyPressed = true;
2036 KOPrefs *p = KOPrefs::instance(); 2037 KOPrefs *p = KOPrefs::instance();
2037 bool showSelectedDates = false; 2038 bool showSelectedDates = false;
2038 int size; 2039 int size;
2039 int pro = 0; 2040 int pro = 0;
2040 //qDebug("MainWindow::keyPressEvent "); 2041 //qDebug("MainWindow::keyPressEvent ");
2041 switch ( e->key() ) { 2042 switch ( e->key() ) {
2042 case Qt::Key_Right: 2043 case Qt::Key_Right:
2043 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2044 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2044 mView->goNextMonth(); 2045 mView->goNextMonth();
2045 else 2046 else
2046 mView->goNext(); 2047 mView->goNext();
2047 showSelectedDates = true; 2048 showSelectedDates = true;
2048 break; 2049 break;
2049 case Qt::Key_Left: 2050 case Qt::Key_Left:
2050 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2051 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2051 mView->goPreviousMonth(); 2052 mView->goPreviousMonth();
2052 else 2053 else
2053 mView->goPrevious(); 2054 mView->goPrevious();
2054 showSelectedDates = true; 2055 showSelectedDates = true;
2055 break; 2056 break;
2056 case Qt::Key_Down: 2057 case Qt::Key_Down:
2057 mView->viewManager()->agendaView()->scrollOneHourDown(); 2058 mView->viewManager()->agendaView()->scrollOneHourDown();
2058 break; 2059 break;
2059 case Qt::Key_Up: 2060 case Qt::Key_Up:
2060 mView->viewManager()->agendaView()->scrollOneHourUp(); 2061 mView->viewManager()->agendaView()->scrollOneHourUp();
2061 break; 2062 break;
2062 case Qt::Key_K: 2063 case Qt::Key_K:
2063 mView->viewManager()->showMonthViewWeek(); 2064 mView->viewManager()->showMonthViewWeek();
2064 break; 2065 break;
2065 case Qt::Key_I: 2066 case Qt::Key_I:
2066 mView->showIncidence(); 2067 mView->showIncidence();
2067 break; 2068 break;
2068 case Qt::Key_Delete: 2069 case Qt::Key_Delete:
2069 case Qt::Key_Backspace: 2070 case Qt::Key_Backspace:
2070 mView->deleteIncidence(); 2071 mView->deleteIncidence();
2071 break; 2072 break;
2072 case Qt::Key_D: 2073 case Qt::Key_D:
2073 mView->viewManager()->showDayView(); 2074 mView->viewManager()->showDayView();
2074 showSelectedDates = true; 2075 showSelectedDates = true;
2075 break; 2076 break;
2076 case Qt::Key_O: 2077 case Qt::Key_O:
2077 mView->toggleFilerEnabled( ); 2078 mView->toggleFilerEnabled( );
2078 break; 2079 break;
2079 case Qt::Key_0: 2080 case Qt::Key_0:
2080 case Qt::Key_1: 2081 case Qt::Key_1:
2081 case Qt::Key_2: 2082 case Qt::Key_2:
2082 case Qt::Key_3: 2083 case Qt::Key_3:
2083 case Qt::Key_4: 2084 case Qt::Key_4:
2084 case Qt::Key_5: 2085 case Qt::Key_5:
2085 case Qt::Key_6: 2086 case Qt::Key_6:
2086 case Qt::Key_7: 2087 case Qt::Key_7:
2087 case Qt::Key_8: 2088 case Qt::Key_8:
2088 case Qt::Key_9: 2089 case Qt::Key_9:
2089 pro = e->key()-48; 2090 pro = e->key()-48;
2090 if ( pro == 0 ) 2091 if ( pro == 0 )
2091 pro = 10; 2092 pro = 10;
2092 if ( e->state() == Qt::ControlButton) 2093 if ( e->state() == Qt::ControlButton)
2093 pro += 10; 2094 pro += 10;
2094 break; 2095 break;
2095 case Qt::Key_M: 2096 case Qt::Key_M:
2096 mView->viewManager()->showMonthView(); 2097 mView->viewManager()->showMonthView();
2097 showSelectedDates = true; 2098 showSelectedDates = true;
2098 break; 2099 break;
2099 case Qt::Key_Insert: 2100 case Qt::Key_Insert:
2100 mView->newEvent(); 2101 mView->newEvent();
2101 break; 2102 break;
2102 case Qt::Key_S : 2103 case Qt::Key_S :
2103 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2104 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2104 mView->newSubTodo(); 2105 mView->newSubTodo();
2105 else 2106 else
2106 mView->dialogManager()->showSearchDialog(); 2107 mView->dialogManager()->showSearchDialog();
2107 break; 2108 break;
2108 case Qt::Key_Y : 2109 case Qt::Key_Y :
2109 case Qt::Key_Z : 2110 case Qt::Key_Z :
2110 mView->viewManager()->showWorkWeekView(); 2111 mView->viewManager()->showWorkWeekView();
2111 showSelectedDates = true; 2112 showSelectedDates = true;
2112 break; 2113 break;
2113 case Qt::Key_U : 2114 case Qt::Key_U :
2114 mView->viewManager()->showWeekView(); 2115 mView->viewManager()->showWeekView();
2115 showSelectedDates = true; 2116 showSelectedDates = true;
2116 break; 2117 break;
2117 case Qt::Key_H : 2118 case Qt::Key_H :
2118 keyBindings(); 2119 keyBindings();
2119 break; 2120 break;
2120 case Qt::Key_W: 2121 case Qt::Key_W:
2121 mView->viewManager()->showWhatsNextView(); 2122 mView->viewManager()->showWhatsNextView();
2122 break; 2123 break;
2123 case Qt::Key_L: 2124 case Qt::Key_L:
2124 mView->viewManager()->showListView(); 2125 mView->viewManager()->showListView();
2125 break; 2126 break;
2126 case Qt::Key_N: 2127 case Qt::Key_N:
2127 mView->viewManager()->showNextView(); 2128 mView->viewManager()->showNextView();
2128 break; 2129 break;
2129 case Qt::Key_V: 2130 case Qt::Key_V:
2130 mView->viewManager()->showTodoView(); 2131 mView->viewManager()->showTodoView();
2131 break; 2132 break;
2132 case Qt::Key_C: 2133 case Qt::Key_C:
2133 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2134 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2134 break; 2135 break;
2135 case Qt::Key_P: 2136 case Qt::Key_P:
2136 mView->showDatePicker( ); 2137 mView->showDatePicker( );
2137 break; 2138 break;
2138 case Qt::Key_F: 2139 case Qt::Key_F:
2139 mView->editFilters(); 2140 mView->editFilters();
2140 break; 2141 break;
2141 case Qt::Key_R: 2142 case Qt::Key_R:
2142 mView->toggleFilter(); 2143 mView->toggleFilter();
2143 break; 2144 break;
2144 case Qt::Key_X: 2145 case Qt::Key_X:
2145 if ( e->state() == Qt::ControlButton ) 2146 if ( e->state() == Qt::ControlButton )
2146 mView->toggleDateNavigatorWidget(); 2147 mView->toggleDateNavigatorWidget();
2147 else { 2148 else {
2148 mView->viewManager()->showNextXView(); 2149 mView->viewManager()->showNextXView();
2149 showSelectedDates = true; 2150 showSelectedDates = true;
2150 } 2151 }
2151 break; 2152 break;
2152 case Qt::Key_Space: 2153 case Qt::Key_Space:
2153 mView->toggleExpand(); 2154 mView->toggleExpand();
2154 break; 2155 break;
2155 case Qt::Key_A: 2156 case Qt::Key_A:
2156 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2157 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2157 mView->showNextAlarms(); 2158 mView->showNextAlarms();
2158 else 2159 else
2159 mView->toggleAllDaySize(); 2160 mView->toggleAllDaySize();
2160 break; 2161 break;
2161 case Qt::Key_T: 2162 case Qt::Key_T:
2162 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2163 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2163 mView->newTodo(); 2164 mView->newTodo();
2164 else { 2165 else {
2165 mView->goToday(); 2166 mView->goToday();
2166 showSelectedDates = true; 2167 showSelectedDates = true;
2167 } 2168 }
2168 break; 2169 break;
2169 case Qt::Key_Q: 2170 case Qt::Key_Q:
2170 if ( e->state() == Qt::ControlButton ) 2171 if ( e->state() == Qt::ControlButton )
2171 mView->conflictNotAll(); 2172 mView->conflictNotAll();
2172 else if ( e->state() == Qt::ShiftButton ) 2173 else if ( e->state() == Qt::ShiftButton )
2173 mView->conflictAllday(); 2174 mView->conflictAllday();
2174 else 2175 else
2175 mView->conflictAll(); 2176 mView->conflictAll();
2176 break; 2177 break;
2177 case Qt::Key_J: 2178 case Qt::Key_J:
2178 mView->viewManager()->showJournalView(); 2179 mView->viewManager()->showJournalView();
2179 break; 2180 break;
2180 case Qt::Key_B: 2181 case Qt::Key_B:
2181 mView->editIncidenceDescription();; 2182 mView->editIncidenceDescription();;
2182 break; 2183 break;
2183 // case Qt::Key_Return: 2184 // case Qt::Key_Return:
2184 case Qt::Key_E: 2185 case Qt::Key_E:
2185 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2186 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2186 mView->newEvent(); 2187 mView->newEvent();
2187 else 2188 else
2188 mView->editIncidence(); 2189 mView->editIncidence();
2189 break; 2190 break;
2190 case Qt::Key_Plus: 2191 case Qt::Key_Plus:
2191 size = p->mHourSize +2; 2192 size = p->mHourSize +2;
2192 if ( size <= 22 ) 2193 if ( size <= 22 )
2193 configureAgenda( size ); 2194 configureAgenda( size );
2194 break; 2195 break;
2195 case Qt::Key_Minus: 2196 case Qt::Key_Minus:
2196 size = p->mHourSize - 2; 2197 size = p->mHourSize - 2;
2197 if ( size >= 4 ) 2198 if ( size >= 4 )
2198 configureAgenda( size ); 2199 configureAgenda( size );
2199 break; 2200 break;
2200 2201
2201 2202
2202 default: 2203 default:
2203 e->ignore(); 2204 e->ignore();
2204 } 2205 }
2205 if ( pro > 0 ) { 2206 if ( pro > 0 ) {
2206 selectFilter( pro+1 ); 2207 selectFilter( pro+1 );
2207 } 2208 }
2208 if ( showSelectedDates ) { 2209 if ( showSelectedDates ) {
2209 ;// setCaptionToDates(); 2210 ;// setCaptionToDates();
2210 } 2211 }
2211 2212
2212} 2213}
2213void MainWindow::fillFilterMenuTB() 2214void MainWindow::fillFilterMenuTB()
2214{ 2215{
2215 selectFilterMenuTB->clear(); 2216 selectFilterMenuTB->clear();
2216 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2217 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2217 selectFilterMenuTB->insertSeparator(); 2218 selectFilterMenuTB->insertSeparator();
2218 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2219 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2219 2220
2220 selectFilterMenuTB->insertSeparator(); 2221 selectFilterMenuTB->insertSeparator();
2221 QPtrList<CalFilter> fili = mView->filters(); 2222 QPtrList<CalFilter> fili = mView->filters();
2222 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2223 CalFilter *curfilter = mView->filterView()->selectedFilter();
2223 CalFilter *filter = fili.first(); 2224 CalFilter *filter = fili.first();
2224 int iii = 2; 2225 int iii = 2;
2225 bool checkitem = mView->filterView()->filtersEnabled(); 2226 bool checkitem = mView->filterView()->filtersEnabled();
2226 while(filter) { 2227 while(filter) {
2227 selectFilterMenuTB->insertItem( filter->name(), iii ); 2228 selectFilterMenuTB->insertItem( filter->name(), iii );
2228 if ( filter == curfilter) 2229 if ( filter == curfilter)
2229 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2230 selectFilterMenuTB->setItemChecked( iii, checkitem );
2230 filter = fili.next(); 2231 filter = fili.next();
2231 ++iii; 2232 ++iii;
2232 } 2233 }
2233 if ( !checkitem ) 2234 if ( !checkitem )
2234 selectFilterMenuTB->setItemChecked( 1, true ); 2235 selectFilterMenuTB->setItemChecked( 1, true );
2235 2236
2236 int x = 0; 2237 int x = 0;
2237 int y = iconToolBar->height(); 2238 int y = iconToolBar->height();
2238 int dX = 0; 2239 int dX = 0;
2239 int dY = 0; 2240 int dY = 0;
2240 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2241 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2241 if ( iconToolBar->y() > height()/2 ) { 2242 if ( iconToolBar->y() > height()/2 ) {
2242 dY = selectFilterMenuTB->sizeHint().height()+8; 2243 dY = selectFilterMenuTB->sizeHint().height()+8;
2243 y = 0; 2244 y = 0;
2244 } 2245 }
2245 } else { 2246 } else {
2246 if ( iconToolBar->x() > width()/2 ) { // right side 2247 if ( iconToolBar->x() > width()/2 ) { // right side
2247 x=0; 2248 x=0;
2248 dX= selectFilterMenuTB->sizeHint().width()+8; 2249 dX= selectFilterMenuTB->sizeHint().width()+8;
2249 y = 0; 2250 y = 0;
2250 } else { 2251 } else {
2251 x= iconToolBar->width(); 2252 x= iconToolBar->width();
2252 y = 0; 2253 y = 0;
2253 } 2254 }
2254 } 2255 }
2255 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2256 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2256 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2257 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2257} 2258}
2258void MainWindow::fillFilterMenu() 2259void MainWindow::fillFilterMenu()
2259{ 2260{
2260 selectFilterMenu->clear(); 2261 selectFilterMenu->clear();
2261 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2262 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2262 selectFilterMenu->insertSeparator(); 2263 selectFilterMenu->insertSeparator();
2263 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2264 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2264 2265
2265 selectFilterMenu->insertSeparator(); 2266 selectFilterMenu->insertSeparator();
2266 QPtrList<CalFilter> fili = mView->filters(); 2267 QPtrList<CalFilter> fili = mView->filters();
2267 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2268 CalFilter *curfilter = mView->filterView()->selectedFilter();
2268 CalFilter *filter = fili.first(); 2269 CalFilter *filter = fili.first();
2269 int iii = 2; 2270 int iii = 2;
2270 bool checkitem = mView->filterView()->filtersEnabled(); 2271 bool checkitem = mView->filterView()->filtersEnabled();
2271 while(filter) { 2272 while(filter) {
2272 selectFilterMenu->insertItem( filter->name(), iii ); 2273 selectFilterMenu->insertItem( filter->name(), iii );
2273 if ( filter == curfilter) 2274 if ( filter == curfilter)
2274 selectFilterMenu->setItemChecked( iii, checkitem ); 2275 selectFilterMenu->setItemChecked( iii, checkitem );
2275 filter = fili.next(); 2276 filter = fili.next();
2276 ++iii; 2277 ++iii;
2277 } 2278 }
2278 if ( !checkitem ) 2279 if ( !checkitem )
2279 selectFilterMenu->setItemChecked( 1, true ); 2280 selectFilterMenu->setItemChecked( 1, true );
2280} 2281}
2281void MainWindow::fillFilterMenuPopup() 2282void MainWindow::fillFilterMenuPopup()
2282{ 2283{
2283 filterPopupMenu->clear(); 2284 filterPopupMenu->clear();
2284 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2285 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2285 2286
2286 filterPopupMenu->insertSeparator(); 2287 filterPopupMenu->insertSeparator();
2287 QPtrList<CalFilter> fili = mView->filters(); 2288 QPtrList<CalFilter> fili = mView->filters();
2288 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2289 CalFilter *curfilter = mView->filterView()->selectedFilter();
2289 CalFilter *filter = fili.first(); 2290 CalFilter *filter = fili.first();
2290 int iii = 1; 2291 int iii = 1;
2291 bool checkitem = mView->filterView()->filtersEnabled(); 2292 bool checkitem = mView->filterView()->filtersEnabled();
2292 while(filter) { 2293 while(filter) {
2293 filterPopupMenu->insertItem( filter->name(), iii ); 2294 filterPopupMenu->insertItem( filter->name(), iii );
2294 if ( filter == curfilter) 2295 if ( filter == curfilter)
2295 filterPopupMenu->setItemChecked( iii, checkitem ); 2296 filterPopupMenu->setItemChecked( iii, checkitem );
2296 filter = fili.next(); 2297 filter = fili.next();
2297 ++iii; 2298 ++iii;
2298 } 2299 }
2299 if ( !checkitem ) 2300 if ( !checkitem )
2300 filterPopupMenu->setItemChecked( 0, true ); 2301 filterPopupMenu->setItemChecked( 0, true );
2301} 2302}
2302void MainWindow::selectFilter( int fil ) 2303void MainWindow::selectFilter( int fil )
2303{ 2304{
2304 2305
2305 if ( fil == 0 ) { 2306 if ( fil == 0 ) {
2306 mView->editFilters( ); 2307 mView->editFilters( );
2307 } else if ( fil == 1 ){ 2308 } else if ( fil == 1 ){
2308 if ( mView->filterView()->filtersEnabled() ) 2309 if ( mView->filterView()->filtersEnabled() )
2309 mView->toggleFilerEnabled( ); 2310 mView->toggleFilerEnabled( );
2310 } else { 2311 } else {
2311 if ( !mView->filterView()->filtersEnabled() ) { 2312 if ( !mView->filterView()->filtersEnabled() ) {
2312 mView->filterView()->blockSignals( true ); 2313 mView->filterView()->blockSignals( true );
2313 mView->toggleFilerEnabled( ); 2314 mView->toggleFilerEnabled( );
2314 mView->filterView()->blockSignals( false ); 2315 mView->filterView()->blockSignals( false );
2315 } 2316 }
2316 mView->selectFilter( fil-2 ); 2317 mView->selectFilter( fil-2 );
2317 } 2318 }
2318} 2319}
2319void MainWindow::updateFilterToolbar() 2320void MainWindow::updateFilterToolbar()
2320{ 2321{
2321 if ( filterMenubar ) { 2322 if ( filterMenubar ) {
2322 if ( !mView->filterView()->filtersEnabled() ) { 2323 if ( !mView->filterView()->filtersEnabled() ) {
2323 filterMenubar->changeItem( 0, i18n("No Filter") ); 2324 filterMenubar->changeItem( 0, i18n("No Filter") );
2324 } else { 2325 } else {
2325 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2326 CalFilter *curfilter = mView->filterView()->selectedFilter();
2326 if ( curfilter ) { 2327 if ( curfilter ) {
2327 filterMenubar->changeItem( 0, curfilter->name() ); 2328 filterMenubar->changeItem( 0, curfilter->name() );
2328 } 2329 }
2329 } 2330 }
2330 } 2331 }
2331} 2332}
2332void MainWindow::selectFilterPopup( int fil ) 2333void MainWindow::selectFilterPopup( int fil )
2333{ 2334{
2334 selectFilter( fil + 1 ); 2335 selectFilter( fil + 1 );
2335 2336
2336} 2337}
2337void MainWindow::configureToolBar( int item ) 2338void MainWindow::configureToolBar( int item )
2338{ 2339{
2339 2340
2340 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2341 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2341 KOPrefs *p = KOPrefs::instance(); 2342 KOPrefs *p = KOPrefs::instance();
2342 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2343 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2343 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2344 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2344 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2345 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2345 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2346 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2346 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2347 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2347 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2348 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2348 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2349 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2349 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2350 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2350 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2351 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2351 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2352 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2352 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2353 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2353 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2354 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2354 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2355 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2355 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2356 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2356 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2357 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2357 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2358 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2358 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2359 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2359 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2360 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2360 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2361 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2361 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2362 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2362 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2363 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2363 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2364 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2364 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2365 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2365 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2366 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2366 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2367 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2367 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2368 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2368 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2369 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2369 // initActions(); 2370 // initActions();
2370 setCaption ( i18n("Toolbar changes needs a restart!") ); 2371 setCaption ( i18n("Toolbar changes needs a restart!") );
2371} 2372}
2372void MainWindow::setCaption ( const QString & c ) 2373void MainWindow::setCaption ( const QString & c )
2373{ 2374{
2374 QString cap = c; 2375 QString cap = c;
2375 cap.replace( QRegExp("\n"), " " ); 2376 cap.replace( QRegExp("\n"), " " );
2376 cap = cap.stripWhiteSpace(); 2377 cap = cap.stripWhiteSpace();
2377 if ( cap.isEmpty() ) 2378 if ( cap.isEmpty() )
2378 cap = "KO/Pi"; 2379 cap = "KO/Pi";
2379 QWidget::setCaption( cap ); 2380 QWidget::setCaption( cap );
2380} 2381}
2381void MainWindow::setCaptionToDates() 2382void MainWindow::setCaptionToDates()
2382{ 2383{
2383 QString selDates; 2384 QString selDates;
2384 QDate date = mView->startDate(); 2385 QDate date = mView->startDate();
2385 if ( ! date.isValid() ) { 2386 if ( ! date.isValid() ) {
2386 setCaption(""); 2387 setCaption("");
2387 return; 2388 return;
2388 } 2389 }
2389 selDates = KGlobal::locale()->formatDate( date, true); 2390 selDates = KGlobal::locale()->formatDate( date, true);
2390 if (mView->startDate() < mView->endDate() ) 2391 if (mView->startDate() < mView->endDate() )
2391 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2392 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2392 else { 2393 else {
2393 QString addString; 2394 QString addString;
2394 if ( date == QDateTime::currentDateTime().date() ) 2395 if ( date == QDateTime::currentDateTime().date() )
2395 addString = i18n("Today"); 2396 addString = i18n("Today");
2396 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2397 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2397 addString = i18n("Tomorrow"); 2398 addString = i18n("Tomorrow");
2398 if ( !addString.isEmpty() ) 2399 if ( !addString.isEmpty() )
2399 selDates = addString+", "+selDates ; 2400 selDates = addString+", "+selDates ;
2400 } 2401 }
2401 setCaption( i18n("Dates: ") + selDates ); 2402 setCaption( i18n("Dates: ") + selDates );
2402 2403
2403} 2404}
2404void MainWindow::showConfigureAgenda( ) 2405void MainWindow::showConfigureAgenda( )
2405{ 2406{
2406 int iii; 2407 int iii;
2407 for ( iii = 1;iii<= 10 ;++iii ){ 2408 for ( iii = 1;iii<= 10 ;++iii ){
2408 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2409 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2409 } 2410 }
2410 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2411 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2411} 2412}
2412void MainWindow::configureAgenda( int item ) 2413void MainWindow::configureAgenda( int item )
2413{ 2414{
2414 if ( KOPrefs::instance()->mHourSize == item ) 2415 if ( KOPrefs::instance()->mHourSize == item )
2415 return; 2416 return;
2416 KOPrefs::instance()->mHourSize=item; 2417 KOPrefs::instance()->mHourSize=item;
2417 mView->viewManager()->agendaView()->updateConfig(); 2418 mView->viewManager()->agendaView()->updateConfig();
2418} 2419}
2419 2420
2420void MainWindow::saveCalendar() 2421void MainWindow::saveCalendar()
2421{ 2422{
2422 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2423 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2423 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2424 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2424 bupDir = KGlobalSettings::backupDataDir(); 2425 bupDir = KGlobalSettings::backupDataDir();
2425 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2426 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2426 QString bupHint; 2427 QString bupHint;
2427 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2428 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2428 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2429 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2429 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2430 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2430 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2431 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2431 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2432 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2432 save(); 2433 save();
2433 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2434 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2434 backupAllFiles(); 2435 backupAllFiles();
2435} 2436}
2436void MainWindow::loadCalendar() 2437void MainWindow::loadCalendar()
2437{ 2438{
2438 2439
2439 2440
2440#if 0 2441#if 0
2441 QString fn = KOPrefs::instance()->mLastLoadFile; 2442 QString fn = KOPrefs::instance()->mLastLoadFile;
2442 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2443 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2443 2444
2444 if ( fn == "" ) 2445 if ( fn == "" )
2445 return; 2446 return;
2446 QFileInfo info; 2447 QFileInfo info;
2447 info.setFile( fn ); 2448 info.setFile( fn );
2448 QString mess; 2449 QString mess;
2449 bool loadbup = true; 2450 bool loadbup = true;
2450 if ( info. exists() ) { 2451 if ( info. exists() ) {
2451 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2452 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2452 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2453 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2453 mess, 2454 mess,
2454 i18n("Load!"), i18n("Cancel"), 0, 2455 i18n("Load!"), i18n("Cancel"), 0,
2455 0, 1 ); 2456 0, 1 );
2456 if ( result != 0 ) { 2457 if ( result != 0 ) {
2457 loadbup = false; 2458 loadbup = false;
2458 } 2459 }
2459 } else { 2460 } else {
2460 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2461 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2461 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2462 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2462 0, 1 ); 2463 0, 1 );
2463 2464
2464 return; 2465 return;
2465 } 2466 }
2466 if ( loadbup ) { 2467 if ( loadbup ) {
2467 mView->openCalendar( fn ); 2468 mView->openCalendar( fn );
2468 KOPrefs::instance()->mLastLoadFile = fn; 2469 KOPrefs::instance()->mLastLoadFile = fn;
2469 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2470 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2470 setCaption(mess); 2471 setCaption(mess);
2471 } 2472 }
2472#endif 2473#endif
2473 2474
2474} 2475}
2475void MainWindow::quickImportIcal() 2476void MainWindow::quickImportIcal()
2476{ 2477{
2477 importFile( KOPrefs::instance()->mLastImportFile, false ); 2478 importFile( KOPrefs::instance()->mLastImportFile, false );
2478} 2479}
2479void MainWindow::importFile( QString fn, bool quick ) 2480void MainWindow::importFile( QString fn, bool quick )
2480{ 2481{
2481 QFileInfo info; 2482 QFileInfo info;
2482 info.setFile( fn ); 2483 info.setFile( fn );
2483 QString mess; 2484 QString mess;
2484 if ( !info. exists() ) { 2485 if ( !info. exists() ) {
2485 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2486 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2486 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2487 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2487 mess ); 2488 mess );
2488 return; 2489 return;
2489 } 2490 }
2490 int result = 0; 2491 int result = 0;
2491 if ( !quick ) { 2492 if ( !quick ) {
2492 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2493 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2493 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2494 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2494 mess, 2495 mess,
2495 "Import", "Cancel", 0, 2496 "Import", "Cancel", 0,
2496 0, 1 ); 2497 0, 1 );
2497 } 2498 }
2498 if ( result == 0 ) { 2499 if ( result == 0 ) {
2499 if ( mView->openCalendar( fn, true )) { 2500 if ( mView->openCalendar( fn, true )) {
2500 KOPrefs::instance()->mLastImportFile = fn; 2501 KOPrefs::instance()->mLastImportFile = fn;
2501 setCaption(i18n("Imported file successfully")); 2502 setCaption(i18n("Imported file successfully"));
2502 } else { 2503 } else {
2503 setCaption(i18n("Error importing file")); 2504 setCaption(i18n("Error importing file"));
2504 } 2505 }
2505 } 2506 }
2506} 2507}
2507 2508
2508void MainWindow::importIcal() 2509void MainWindow::importIcal()
2509{ 2510{
2510 2511
2511 QString fn =KOPrefs::instance()->mLastImportFile; 2512 QString fn =KOPrefs::instance()->mLastImportFile;
2512 2513
2513 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2514 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2514 if ( fn == "" ) 2515 if ( fn == "" )
2515 return; 2516 return;
2516 importFile( fn, true ); 2517 importFile( fn, true );
2517 2518
2518} 2519}
2519 2520
2520void MainWindow::exportVCalendar() 2521void MainWindow::exportVCalendar()
2521{ 2522{
2522 QString fn = KOPrefs::instance()->mLastVcalFile; 2523 QString fn = KOPrefs::instance()->mLastVcalFile;
2523 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2524 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2524 if ( fn == "" ) 2525 if ( fn == "" )
2525 return; 2526 return;
2526 QFileInfo info; 2527 QFileInfo info;
2527 info.setFile( fn ); 2528 info.setFile( fn );
2528 QString mes; 2529 QString mes;
2529 bool createbup = true; 2530 bool createbup = true;
2530 if ( info. exists() ) { 2531 if ( info. exists() ) {
2531 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2532 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2532 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2533 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2533 i18n("Overwrite!"), i18n("Cancel"), 0, 2534 i18n("Overwrite!"), i18n("Cancel"), 0,
2534 0, 1 ); 2535 0, 1 );
2535 if ( result != 0 ) { 2536 if ( result != 0 ) {
2536 createbup = false; 2537 createbup = false;
2537 } 2538 }
2538 } 2539 }
2539 if ( createbup ) { 2540 if ( createbup ) {
2540 if ( mView->exportVCalendar( fn ) ) { 2541 if ( mView->exportVCalendar( fn ) ) {
2541 KOPrefs::instance()->mLastVcalFile = fn; 2542 KOPrefs::instance()->mLastVcalFile = fn;
2542 if ( fn.length() > 20 ) 2543 if ( fn.length() > 20 )
2543 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2544 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2544 else 2545 else
2545 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2546 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2546 setCaption(mes); 2547 setCaption(mes);
2547 } 2548 }
2548 } 2549 }
2549 2550
2550} 2551}
2551QString MainWindow::sentSyncFile() 2552QString MainWindow::sentSyncFile()
2552{ 2553{
2553#ifdef DESKTOP_VERSION 2554#ifdef DESKTOP_VERSION
2554 return locateLocal( "tmp", "copysynccal.ics" ); 2555 return locateLocal( "tmp", "copysynccal.ics" );
2555#else 2556#else
2556 return QString( "/tmp/copysynccal.ics" ); 2557 return QString( "/tmp/copysynccal.ics" );
2557#endif 2558#endif
2558} 2559}
2559 2560
2560void MainWindow::syncFileRequest() 2561void MainWindow::syncFileRequest()
2561{ 2562{
2563 while ( mSyncManager->blockSave() ) {
2564 qApp->processEvents();
2565 }
2566 mSyncManager->setBlockSave(true);
2567
2562 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2568 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2563 mSyncManager->slotSyncMenu( 999 ); 2569 mSyncManager->slotSyncMenu( 999 );
2564 } 2570 }
2565 2571
2566 setCaption(i18n("Saving Data to temp file ..." )); 2572 setCaption(i18n("Saving Data to temp file ..." ));
2567 mView->saveCalendar( sentSyncFile() ); 2573 mView->saveCalendar( sentSyncFile() );
2568 setCaption(i18n("Data saved to temp file!" )); 2574 setCaption(i18n("Data saved to temp file!" ));
2575 mSyncManager->setBlockSave( false );
2569 2576
2570} 2577}
2571void MainWindow::getFile( bool success ) 2578void MainWindow::getFile( bool success )
2572{ 2579{
2573 if ( ! success ) { 2580 if ( ! success ) {
2574 setCaption( i18n("Error receiving file. Nothing changed!") ); 2581 setCaption( i18n("Error receiving file. Nothing changed!") );
2575 return; 2582 return;
2576 } 2583 }
2577 mView->mergeFile( sentSyncFile() ); 2584 mView->mergeFile( sentSyncFile() );
2578 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2585 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2579 mSyncManager->slotSyncMenu( 999 ); 2586 mSyncManager->slotSyncMenu( 999 );
2580 } 2587 }
2581 setCaption( i18n("Pi-Sync successful!") ); 2588 setCaption( i18n("Pi-Sync successful!") );
2582} 2589}
2583void MainWindow::printListView() 2590void MainWindow::printListView()
2584{ 2591{
2585 2592
2586 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2593 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2587 2594
2588 KMessageBox::information( this, message); 2595 KMessageBox::information( this, message);
2589} 2596}
2590void MainWindow::printSel( ) 2597void MainWindow::printSel( )
2591{ 2598{
2592 mView->viewManager()->agendaView()->agenda()->printSelection(); 2599 mView->viewManager()->agendaView()->agenda()->printSelection();
2593} 2600}
2594 2601
2595void MainWindow::printCal() 2602void MainWindow::printCal()
2596{ 2603{
2597 mView->print();//mCp->showDialog(); 2604 mView->print();//mCp->showDialog();
2598} 2605}
2599 2606
2600 2607
2601#include "libkdepim/kdatepicker.h" 2608#include "libkdepim/kdatepicker.h"
2602#include <kdatetbl.h> 2609#include <kdatetbl.h>
2603 2610
2604void MainWindow::weekAction() 2611void MainWindow::weekAction()
2605{ 2612{
2606 int month; 2613 int month;
2607 KPopupFrame* popup = new KPopupFrame(this); 2614 KPopupFrame* popup = new KPopupFrame(this);
2608 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2615 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2609 // ----- 2616 // -----
2610 picker->resize(picker->sizeHint()); 2617 picker->resize(picker->sizeHint());
2611 popup->setMainWidget(picker); 2618 popup->setMainWidget(picker);
2612 picker->setFocus(); 2619 picker->setFocus();
2613 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2620 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2614 int x = 0; 2621 int x = 0;
2615 int y = iconToolBar->height(); 2622 int y = iconToolBar->height();
2616 int dX = 0; 2623 int dX = 0;
2617 int dY = 0; 2624 int dY = 0;
2618 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2625 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2619 if ( iconToolBar->y() > height()/2 ) { 2626 if ( iconToolBar->y() > height()/2 ) {
2620 dY = picker->sizeHint().height()+8; 2627 dY = picker->sizeHint().height()+8;
2621 y = 0; 2628 y = 0;
2622 } 2629 }
2623 } else { 2630 } else {
2624 if ( iconToolBar->x() > width()/2 ) { // right side 2631 if ( iconToolBar->x() > width()/2 ) { // right side
2625 x=0; 2632 x=0;
2626 dX= picker->sizeHint().width()+8; 2633 dX= picker->sizeHint().width()+8;
2627 y = 0; 2634 y = 0;
2628 } else { 2635 } else {
2629 x= iconToolBar->width(); 2636 x= iconToolBar->width();
2630 y = 0; 2637 y = 0;
2631 } 2638 }
2632 } 2639 }
2633 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2640 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2634 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2641 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2635 { 2642 {
2636 month = picker->getResult(); 2643 month = picker->getResult();
2637 emit selectWeek ( month ); 2644 emit selectWeek ( month );
2638 //qDebug("weekSelected %d ", month); 2645 //qDebug("weekSelected %d ", month);
2639 } 2646 }
2640 delete popup; 2647 delete popup;
2641} 2648}
2642 2649
2643void MainWindow::hideEvent ( QHideEvent * ) 2650void MainWindow::hideEvent ( QHideEvent * )
2644{ 2651{
2645 QString message; 2652 QString message;
2646 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2653 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2647 if ( nextA.isValid() ) { 2654 if ( nextA.isValid() ) {
2648 QString sum = mCalendar->nextSummary(); 2655 QString sum = mCalendar->nextSummary();
2649 2656
2650 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2657 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2651 setCaption( message ); 2658 setCaption( message );
2652 } 2659 }
2653} 2660}
2654 2661
2655void MainWindow::resizeEvent( QResizeEvent* e) 2662void MainWindow::resizeEvent( QResizeEvent* e)
2656{ 2663{
2657#ifndef DESKTOP_VERSION 2664#ifndef DESKTOP_VERSION
2658 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2665 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2659 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2666 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2660 filterToolBar->hide(); 2667 filterToolBar->hide();
2661 else 2668 else
2662 filterToolBar->show(); 2669 filterToolBar->show();
2663 } 2670 }
2664#endif 2671#endif
2665 QMainWindow::resizeEvent( e); 2672 QMainWindow::resizeEvent( e);
2666} 2673}