[Kde-pim] [patch] korganizer - printing calendar item recurrence

Sentinel hprins at multidataservices.com
Mon Sep 29 21:52:12 BST 2008


I also have had the same problem compiling PIM with AkonadiConfig.cmake. 
Although I am not sure if I'm 
not just downloading Akonadi from the wrong "kdesupport" directory.

svn checkout svn://anonsvn.kde.org/home/kde/trunk/kdesupport

after compileing and then installing as root I still get the same error
message

CMake Error: Akonadi_DIR is not set.  It must be set to the directory
containing AkonadiConfig.cmake in order to use Akonadi.

yet I searched my entire hardrive and have not come up with a file called
AkonadiConfig.cmake

someone please help me



Ron Goodheart wrote:
> 
> HI all,
> Got the following on my printout when printing my scheduled event on
> korganizer.
>    "Repeat: TODO: Convert Repeat to String!"
> 
> So created the attached patch to print the recurrence information.
> 
> However, have only tested with 3.5 - could not get trunk to compile
> due to never finding "AkonadiConfig.cmake".
> The patch does support all of the recurrence available on the 3.5 GUI.
> 
> Regards,
> Ron
> 
> Index: printing/calprintdefaultplugins.cpp
> ===================================================================
> --- printing/calprintdefaultplugins.cpp	(revision 850710)
> +++ printing/calprintdefaultplugins.cpp	(working copy)
> @@ -37,6 +37,7 @@
>  #include <kcalendarsystem.h>
>  #include <knuminput.h>
>  #include <kcombobox.h>
> +#include "koglobals.h"
>  
>  #include "calprintdefaultplugins.h"
>  
> @@ -280,12 +281,126 @@
>        h = QMAX( printCaptionAndText( p, textRect, stringVis.mEndCaption,
> stringVis.mEndString, captionFont, textFont ), h );
>      }
>      
> -    
> +    // Convert recurrence to a string
>      if ( (*it)->doesRecur() ) {
>        QRect recurBox( timesBox.left()+padding(), h+padding(),
> timesBox.right()-padding(), lineHeight );
> -      // TODO: Convert the recurrence to a string and print it out!
> -      QString recurString( "TODO: Convert Repeat to String!" );
> -      h = QMAX( printCaptionAndText( p, recurBox, i18n("Repeats: "),
> recurString, captionFont, textFont ), h );
> +      KCal::Recurrence *recurs = (*it)->recurrence();
> +      // recurrence
> +      QStringList dayList;
> +      dayList.push_back( i18n("5th Last") );
> +      dayList.push_back( i18n("4th Last") );
> +      dayList.push_back( i18n("3rd Last") );
> +      dayList.push_back( i18n("2nd Last") );
> +      dayList.push_back( i18n("Last") ); 
> +      dayList.push_back( i18n("unknown") ); // zero
> +      dayList.push_back( i18n("1st") );
> +      dayList.push_back( i18n("2nd") );
> +      dayList.push_back( i18n("3rd") );
> +      dayList.push_back( i18n("4th") );
> +      dayList.push_back( i18n("5th") );      
> +      QString recurString;
> +      const KCalendarSystem *calSys =
> KOGlobals::self()->calendarSystem();
> +      switch(recurs->recurrenceType()) {
> +        case Recurrence::rNone:
> +          recurString = i18n("None");
> +          break;
> +        case Recurrence::rDaily:
> +          recurString = i18n("Every 1 day","Every %1
> days",recurs->frequency()).arg(recurs->frequency());
> +          break;
> +        case Recurrence::rWeekly: 
> +        {
> +          QString dayNames;
> +          // Respect start of week setting
> +          int weekStart = KGlobal::locale()->weekStartDay();
> +          bool addSpace = false;
> +          for ( int i = 0; i < 7; ++i ) { 
> +            if ( recurs->days().testBit( (i+weekStart+6)%7 )) {
> +              if (addSpace) dayNames.append(" ");  
> +              dayNames.append( calSys->weekDayName(
> ((i+weekStart+6)%7)+1, true ) );
> +              addSpace=true;
> +            }
> +          }
> +          recurString = i18n("Every %1 week on %2","Every %1 weeks on
> %2",recurs->frequency()).arg(recurs->frequency()).arg(dayNames);
> +          break;
> +        }
> +        case Recurrence::rMonthlyPos:
> +        {
> +          KCal::RecurrenceRule::WDayPos rule =
> recurs->monthPositions()[0];
> +          recurString = i18n("Every %1 month on the %2 %3","Every %1
> months on the %2 %3",recurs->frequency())
> +                            .arg(recurs->frequency())
> +                            .arg(dayList[rule.pos() + 5])
> +                            .arg(calSys->weekDayName(rule.day()));
> +          break;
> +        }
> +        case Recurrence::rMonthlyDay:
> +        {     
> +          int days = recurs->monthDays()[0];
> +          if (days < 0) {
> +            recurString = i18n("Every %1 month on the %2 day","Every %1
> months on the %2 day",recurs->frequency())
> +                              .arg( recurs->frequency() )
> +                              .arg( dayList[days + 5] );
> +          } else {
> +            recurString = i18n("Every %1 month on day %2","Every %1
> months on day %2",recurs->frequency())
> +                              .arg(recurs->frequency())
> +                              .arg(recurs->monthDays()[0]);
> +          }
> +          break;
> +        }                              
> +
> +        case Recurrence::rYearlyMonth:
> +          recurString = i18n("Every %1 year on day %2 of %3","Every %1
> years on day %2 of %3",recurs->frequency())
> +                            .arg(recurs->frequency())
> +                            .arg(recurs->yearDates()[0])
> +                           
> .arg(calSys->monthName(recurs->yearMonths()[0],1960));
> +          break;
> +        case Recurrence::rYearlyPos:
> +        {
> +          KCal::RecurrenceRule::WDayPos rule =
> recurs->yearPositions()[0];
> +          recurString = i18n("Every %1 year on the %2 %3 of %4","Every %1
> years on the %2 %3 %4",recurs->frequency())
> +                            .arg( recurs->frequency() )
> +                            .arg( dayList[rule.pos() + 5] )
> +                            .arg( calSys->weekDayName(rule.day()) )
> +                            .arg(
> calSys->monthName(recurs->yearMonths()[0],1960) );
> +          break;
> +        }
> +        case Recurrence::rYearlyDay:
> +          recurString = i18n("Every %1 year on day %2","Every %1 years on
> day %2",recurs->frequency())
> +                            .arg( recurs->frequency() )
> +                            .arg( recurs->yearDays()[0] );
> +          break;
> +      }      
> +      // occurrances
> +      QString occurString;
> +      switch (recurs->duration()) {
> +        case 0: // end date set
> +          occurString = i18n("until
> %1").arg(KGlobal::locale()->formatDate(recurs->endDate(),true));
> +          break;
> +        case -1: // infinite
> +          break;
> +        default: // number of occurrances
> +          occurString = i18n("for 1 occurance","for %1
> occurances",recurs->duration()).arg(recurs->duration());
> +          break;
> +      }
> +      // exception dates
> +      QString exceptString;
> +      if ( !recurs->exDates().isEmpty() ) {
> +        exceptString = i18n("except");
> +        for ( unsigned i = 0; i < recurs->exDates().size(); i++ ) {
> +          if (true == recurs->recursOn(recurs->exDates()[i]))
> +            exceptString.append("@");
> +          exceptString.append(" ");
> +          exceptString.append( KGlobal::locale()->formatDate(
> recurs->exDates()[i],true) );
> +        }
> +      }      
> +      QString displayString;
> +      displayString.append(recurString);
> +      if (!displayString.endsWith(" "))
> +        displayString.append(" ");
> +      displayString.append(occurString);
> +      if (!displayString.endsWith(" "))
> +        displayString.append(" ");
> +      displayString.append(exceptString);
> +      h = QMAX( printCaptionAndText( p, recurBox, i18n("Repeats: "),
> displayString, captionFont, textFont ), h );
>      }
>      
>      QRect alarmBox( timesBox.left()+padding(), h+padding(),
> timesBox.right()-padding(), lineHeight );
> 
> _______________________________________________
> KDE PIM mailing list kde-pim at kde.org
> https://mail.kde.org/mailman/listinfo/kde-pim
> KDE PIM home page at http://pim.kde.org/
> 

-- 
View this message in context: http://www.nabble.com/-patch--korganizer---printing-calendar-item-recurrence-tp19101585p19731512.html
Sent from the kde-pim-general mailing list archive at Nabble.com.

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list