summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 88dbd4f..cbf6096 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1637,98 +1637,102 @@ void MainWindow::updateWeek(QDate seda)
1637 mWeekPixmap.fill( mWeekBgColor ); 1637 mWeekPixmap.fill( mWeekBgColor );
1638 QPainter p ( &mWeekPixmap ); 1638 QPainter p ( &mWeekPixmap );
1639 p.setFont( mWeekFont ); 1639 p.setFont( mWeekFont );
1640 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1640 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1641 p.end(); 1641 p.end();
1642 QIconSet icon3 ( mWeekPixmap ); 1642 QIconSet icon3 ( mWeekPixmap );
1643 mWeekAction->setIconSet ( icon3 ); 1643 mWeekAction->setIconSet ( icon3 );
1644 1644
1645} 1645}
1646void MainWindow::updateWeekNum(const DateList &selectedDates) 1646void MainWindow::updateWeekNum(const DateList &selectedDates)
1647{ 1647{
1648 updateWeek( selectedDates.first() ); 1648 updateWeek( selectedDates.first() );
1649} 1649}
1650void MainWindow::processIncidenceSelection( Incidence *incidence ) 1650void MainWindow::processIncidenceSelection( Incidence *incidence )
1651{ 1651{
1652 if ( !incidence ) { 1652 if ( !incidence ) {
1653 mShowAction->setMenuText( i18n("Show") ); 1653 mShowAction->setMenuText( i18n("Show") );
1654 enableIncidenceActions( false ); 1654 enableIncidenceActions( false );
1655 mNewSubTodoAction->setEnabled( false ); 1655 mNewSubTodoAction->setEnabled( false );
1656 setCaptionToDates(); 1656 setCaptionToDates();
1657 return; 1657 return;
1658 } 1658 }
1659 QString startString = ""; 1659 QString startString = "";
1660 if ( incidence->typeID() != todoID ) { 1660 if ( incidence->typeID() != todoID ) {
1661 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1661 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1662 if ( incidence->doesFloat() ) { 1662 if ( incidence->doesFloat() ) {
1663 startString += ": "+incidence->dtStartDateStr( true ); 1663 startString += ": "+incidence->dtStartDateStr( true );
1664 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1664 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1665 } else { 1665 } else {
1666 startString = ": "+incidence->dtStartStr(true); 1666 startString = ": "+incidence->dtStartStr(true);
1667 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1667 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1668 } 1668 }
1669 } else { 1669 } else {
1670 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1670 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1671 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1671 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1672 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1672 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1673 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1673 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1674 bool ok; 1674 bool ok;
1675 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1675 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1676 if ( ok ) { 1676 if ( ok ) {
1677 int years = noc.date().year() - incidence->dtStart().date().year(); 1677 int years = noc.date().year() - incidence->dtStart().date().year();
1678 startString += i18n(" (%1 y.)"). arg( years ); 1678 startString += i18n(" (%1 y.)"). arg( years );
1679 } 1679 }
1680 } 1680 }
1681 else 1681 else
1682 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1682 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1683 } 1683 }
1684 } 1684 }
1685 else {
1686 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1687 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1685 else 1688 else
1686 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1689 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1690 }
1687 if ( !incidence->location().isEmpty() ) 1691 if ( !incidence->location().isEmpty() )
1688 startString += " (" +incidence->location()+")"; 1692 startString += " (" +incidence->location()+")";
1689 setCaption( incidence->summary()+startString); 1693 setCaption( incidence->summary()+startString);
1690 enableIncidenceActions( true ); 1694 enableIncidenceActions( true );
1691 if ( incidence->typeID() == eventID ) { 1695 if ( incidence->typeID() == eventID ) {
1692 mShowAction->setMenuText( i18n("Show Event") ); 1696 mShowAction->setMenuText( i18n("Show Event") );
1693 mNewSubTodoAction->setEnabled( false ); 1697 mNewSubTodoAction->setEnabled( false );
1694 } else if ( incidence->typeID() == todoID ) { 1698 } else if ( incidence->typeID() == todoID ) {
1695 mShowAction->setMenuText( i18n("Show Todo") ); 1699 mShowAction->setMenuText( i18n("Show Todo") );
1696 mNewSubTodoAction->setEnabled( true ); 1700 mNewSubTodoAction->setEnabled( true );
1697 } else { 1701 } else {
1698 mShowAction->setMenuText( i18n("Show") ); 1702 mShowAction->setMenuText( i18n("Show") );
1699 mNewSubTodoAction->setEnabled( false ); 1703 mNewSubTodoAction->setEnabled( false );
1700 } 1704 }
1701} 1705}
1702 1706
1703void MainWindow::enableIncidenceActions( bool enabled ) 1707void MainWindow::enableIncidenceActions( bool enabled )
1704{ 1708{
1705 mShowAction->setEnabled( enabled ); 1709 mShowAction->setEnabled( enabled );
1706 mEditAction->setEnabled( enabled ); 1710 mEditAction->setEnabled( enabled );
1707 mDeleteAction->setEnabled( enabled ); 1711 mDeleteAction->setEnabled( enabled );
1708 1712
1709 mCloneAction->setEnabled( enabled ); 1713 mCloneAction->setEnabled( enabled );
1710 mMoveAction->setEnabled( enabled ); 1714 mMoveAction->setEnabled( enabled );
1711#ifndef DESKTOP_VERSION 1715#ifndef DESKTOP_VERSION
1712 mBeamAction->setEnabled( enabled ); 1716 mBeamAction->setEnabled( enabled );
1713#endif 1717#endif
1714 mCancelAction->setEnabled( enabled ); 1718 mCancelAction->setEnabled( enabled );
1715} 1719}
1716 1720
1717void MainWindow::importOL() 1721void MainWindow::importOL()
1718{ 1722{
1719#ifdef _OL_IMPORT_ 1723#ifdef _OL_IMPORT_
1720 mView->clearAllViews(); 1724 mView->clearAllViews();
1721 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1725 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1722 id->exec(); 1726 id->exec();
1723 delete id; 1727 delete id;
1724 mView->calendar()->checkAlarmForIncidence( 0, true ); 1728 mView->calendar()->checkAlarmForIncidence( 0, true );
1725 mView->updateView(); 1729 mView->updateView();
1726#endif 1730#endif
1727} 1731}
1728void MainWindow::importBday() 1732void MainWindow::importBday()
1729{ 1733{
1730 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1734 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1731 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1735 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1732 i18n("Import!"), i18n("Cancel"), 0, 1736 i18n("Import!"), i18n("Cancel"), 0,
1733 0, 1 ); 1737 0, 1 );
1734 if ( result == 0 ) { 1738 if ( result == 0 ) {