summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calprintbase.cpp2
-rw-r--r--korganizer/mainwindow.cpp23
2 files changed, 17 insertions, 8 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp
index af32ebc..6bb407d 100644
--- a/korganizer/calprintbase.cpp
+++ b/korganizer/calprintbase.cpp
@@ -728,385 +728,385 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
728 } 728 }
729 729
730 } // doesFloat 730 } // doesFloat
731 731
732 p.drawText(x+5, y+textY, width-10, lineSpacing, 732 p.drawText(x+5, y+textY, width-10, lineSpacing,
733 AlignLeft|AlignBottom, outStr); 733 AlignLeft|AlignBottom, outStr);
734 textY+=lineSpacing; 734 textY+=lineSpacing;
735 } 735 }
736 736
737 if ( textY<height ) { 737 if ( textY<height ) {
738 738
739 Todo::List::ConstIterator it2; 739 Todo::List::ConstIterator it2;
740 for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) { 740 for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) {
741 Todo *todo = *it2; 741 Todo *todo = *it2;
742 QString text; 742 QString text;
743 if (todo->hasDueDate()) { 743 if (todo->hasDueDate()) {
744 if (!todo->doesFloat()) { 744 if (!todo->doesFloat()) {
745 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 745 text += KGlobal::locale()->formatTime(todo->dtDue().time());
746 text += " "; 746 text += " ";
747 } 747 }
748 } 748 }
749 text += i18n("To-Do: %1").arg(todo->summary()); 749 text += i18n("To-Do: %1").arg(todo->summary());
750 750
751 p.drawText(x+5, y+textY, width-10, lineSpacing, 751 p.drawText(x+5, y+textY, width-10, lineSpacing,
752 AlignLeft|AlignBottom, text); 752 AlignLeft|AlignBottom, text);
753 textY+=lineSpacing; 753 textY+=lineSpacing;
754 } 754 }
755 } 755 }
756} 756}
757 757
758 758
759/////////////////////////////////////////////////////////////////////////////// 759///////////////////////////////////////////////////////////////////////////////
760 760
761void CalPrintBase::drawWeek(QPainter &p, const QDate &qd, 761void CalPrintBase::drawWeek(QPainter &p, const QDate &qd,
762 int x, int y, int width, int height) 762 int x, int y, int width, int height)
763{ 763{
764 QDate weekDate = qd; 764 QDate weekDate = qd;
765 bool portrait = ( mPrinter->orientation() == KPrinter::Portrait ); 765 bool portrait = ( mPrinter->orientation() == KPrinter::Portrait );
766 int cellWidth, cellHeight; 766 int cellWidth, cellHeight;
767 int vcells; 767 int vcells;
768 if (portrait) { 768 if (portrait) {
769 cellWidth = width/2; 769 cellWidth = width/2;
770 vcells=3; 770 vcells=3;
771 } else { 771 } else {
772 cellWidth = width/6; 772 cellWidth = width/6;
773 vcells=1; 773 vcells=1;
774 } 774 }
775 cellHeight = height/vcells; 775 cellHeight = height/vcells;
776 776
777 // correct begin of week 777 // correct begin of week
778 int weekdayCol = weekdayColumn( qd.dayOfWeek() ); 778 int weekdayCol = weekdayColumn( qd.dayOfWeek() );
779 weekDate = qd.addDays( -weekdayCol ); 779 weekDate = qd.addDays( -weekdayCol );
780 780
781 for (int i = 0; i < 7; i++, weekDate = weekDate.addDays(1)) { 781 for (int i = 0; i < 7; i++, weekDate = weekDate.addDays(1)) {
782 if (i<5) { 782 if (i<5) {
783 drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells), 783 drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells),
784 cellWidth, cellHeight, true); 784 cellWidth, cellHeight, true);
785 } else if (i==5) { 785 } else if (i==5) {
786 drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells), 786 drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells),
787 cellWidth, cellHeight/2, true); 787 cellWidth, cellHeight/2, true);
788 } else if (i==6) { 788 } else if (i==6) {
789 drawDayBox(p, weekDate, x+cellWidth*(int)((i-1)/vcells), 789 drawDayBox(p, weekDate, x+cellWidth*(int)((i-1)/vcells),
790 y+cellHeight*((i-1)%vcells)+cellHeight/2, cellWidth, cellHeight/2, true); 790 y+cellHeight*((i-1)%vcells)+cellHeight/2, cellWidth, cellHeight/2, true);
791 } 791 }
792 } // for i through all weekdays 792 } // for i through all weekdays
793} 793}
794 794
795 795
796void CalPrintBase::drawTimeTable(QPainter &p, 796void CalPrintBase::drawTimeTable(QPainter &p,
797 const QDate &fromDate, const QDate &toDate, 797 const QDate &fromDate, const QDate &toDate,
798 QTime &fromTime, QTime &toTime, 798 QTime &fromTime, QTime &toTime,
799 int x, int y, int width, int height) 799 int x, int y, int width, int height)
800{ 800{
801 // timeline is 1.5 hours: 801 // timeline is 1.5 hours:
802 int alldayHeight = (int)( 3600.*height/(fromTime.secsTo(toTime)+3600.) ); 802 int alldayHeight = (int)( 3600.*height/(fromTime.secsTo(toTime)+3600.) );
803 int timelineWidth = 60; 803 int timelineWidth = 60;
804 int cellWidth = (int)( (width-timelineWidth)/(fromDate.daysTo(toDate)+1) ); 804 int cellWidth = (int)( (width-timelineWidth)/(fromDate.daysTo(toDate)+1) );
805 int currY=y; 805 int currY=y;
806 int currX=x; 806 int currX=x;
807 807
808 drawDaysOfWeek( p, fromDate, toDate, x+timelineWidth, currY, width-timelineWidth, mSubHeaderHeight); 808 drawDaysOfWeek( p, fromDate, toDate, x+timelineWidth, currY, width-timelineWidth, mSubHeaderHeight);
809 currY+=mSubHeaderHeight; 809 currY+=mSubHeaderHeight;
810 drawTimeLine( p, fromTime, toTime, x, currY+alldayHeight, 810 drawTimeLine( p, fromTime, toTime, x, currY+alldayHeight,
811 timelineWidth, height-mSubHeaderHeight-alldayHeight ); 811 timelineWidth, height-mSubHeaderHeight-alldayHeight );
812 812
813 currX=x+timelineWidth; 813 currX=x+timelineWidth;
814 // draw each day 814 // draw each day
815 QDate curDate(fromDate); 815 QDate curDate(fromDate);
816 while (curDate<=toDate) {Event::List eventList; 816 while (curDate<=toDate) {Event::List eventList;
817 eventList.fill( mCalendar->events(curDate, true)); 817 eventList.fill( mCalendar->events(curDate, true));
818 drawAllDayBox( p, eventList, curDate, false, currX, currY, cellWidth, alldayHeight); 818 drawAllDayBox( p, eventList, curDate, false, currX, currY, cellWidth, alldayHeight);
819 drawAgendaDayBox( p, eventList, curDate, false, fromTime, toTime, currX, 819 drawAgendaDayBox( p, eventList, curDate, false, fromTime, toTime, currX,
820 currY+alldayHeight, cellWidth, height-mSubHeaderHeight-alldayHeight ); 820 currY+alldayHeight, cellWidth, height-mSubHeaderHeight-alldayHeight );
821 currX+=cellWidth; 821 currX+=cellWidth;
822 curDate=curDate.addDays(1); 822 curDate=curDate.addDays(1);
823 } 823 }
824 824
825} 825}
826 826
827 827
828/////////////////////////////////////////////////////////////////////////////// 828///////////////////////////////////////////////////////////////////////////////
829 829
830void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, 830void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers,
831 int x, int y, int width, int height) 831 int x, int y, int width, int height)
832{ 832{
833 833
834 int yoffset = mSubHeaderHeight; 834 int yoffset = mSubHeaderHeight;
835 int xoffset = 0; 835 int xoffset = 0;
836 836
837 QDate monthDate(QDate(qd.year(), qd.month(), 1)); 837 QDate monthDate(QDate(qd.year(), qd.month(), 1));
838 QDate monthFirst(monthDate); 838 QDate monthFirst(monthDate);
839 QDate monthLast(monthDate.addMonths(1).addDays(-1)); 839 QDate monthLast(monthDate.addMonths(1).addDays(-1));
840 840
841 841
842 int weekdayCol = weekdayColumn( monthDate.dayOfWeek() ); 842 int weekdayCol = weekdayColumn( monthDate.dayOfWeek() );
843 monthDate = monthDate.addDays(-weekdayCol); 843 monthDate = monthDate.addDays(-weekdayCol);
844 844
845 int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1; 845 int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1;
846 int cellHeight = (height-yoffset) / rows; 846 int cellHeight = (height-yoffset) / rows;
847 847
848 if (weeknumbers) { 848 if (weeknumbers) {
849 QFont oldFont(p.font()); 849 QFont oldFont(p.font());
850 QFont newFont(p.font()); 850 QFont newFont(p.font());
851 newFont.setPointSize(7); 851 newFont.setPointSize(7);
852 p.setFont(newFont); 852 p.setFont(newFont);
853 xoffset += 18; 853 xoffset += 18;
854 QDate weekDate(monthDate); 854 QDate weekDate(monthDate);
855 for (int row = 0; row<rows; row++) { 855 for (int row = 0; row<rows; row++) {
856 int calWeek = weekDate.weekNumber(); 856 int calWeek = weekDate.weekNumber();
857 QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight); 857 QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight);
858 p.drawText( rc, AlignRight|AlignVCenter, QString::number(calWeek) ); 858 p.drawText( rc, AlignRight|AlignVCenter, QString::number(calWeek) );
859 weekDate = weekDate.addDays(7); 859 weekDate = weekDate.addDays(7);
860 } 860 }
861 p.setFont(oldFont); 861 p.setFont(oldFont);
862 } 862 }
863 863
864 drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight ); 864 drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight );
865 int cellWidth = (width-xoffset) / 7; 865 int cellWidth = (width-xoffset) / 7;
866 866
867 QColor back = p.backgroundColor(); 867 QColor back = p.backgroundColor();
868 bool darkbg = false; 868 bool darkbg = false;
869 for (int row = 0; row < rows; row++) { 869 for (int row = 0; row < rows; row++) {
870 for (int col = 0; col < 7; col++) { 870 for (int col = 0; col < 7; col++) {
871 // show days from previous/next month with a grayed background 871 // show days from previous/next month with a grayed background
872 if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { 872 if ( (monthDate < monthFirst) || (monthDate > monthLast) ) {
873 p.setBackgroundColor( QColor( 240, 240, 240) ); 873 p.setBackgroundColor( QColor( 240, 240, 240) );
874 darkbg = true; 874 darkbg = true;
875 } 875 }
876 drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight); 876 drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight);
877 if ( darkbg ) { 877 if ( darkbg ) {
878 p.setBackgroundColor( back ); 878 p.setBackgroundColor( back );
879 darkbg = false; 879 darkbg = false;
880 } 880 }
881 monthDate = monthDate.addDays(1); 881 monthDate = monthDate.addDays(1);
882 } 882 }
883 } 883 }
884} 884}
885 885
886 886
887/////////////////////////////////////////////////////////////////////////////// 887///////////////////////////////////////////////////////////////////////////////
888 888
889void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos, 889void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos,
890 bool desc, int pospriority, int possummary, int posDueDt, int level, 890 bool desc, int pospriority, int possummary, int posDueDt, int level,
891 int x, int &y, int width, int &height, int pageHeight, 891 int x, int &y, int width, int &height, int pageHeight,
892 TodoParentStart *r ) 892 TodoParentStart *r )
893{ 893{
894 if ( !completed && item->isCompleted() ) 894 if ( !completed && item->isCompleted() )
895 return; 895 return;
896 QString outStr; 896 QString outStr;
897// int fontHeight = 10; 897// int fontHeight = 10;
898 const KLocale *local = KGlobal::locale(); 898 const KLocale *local = KGlobal::locale();
899 int priority=item->priority(); 899 int priority=item->priority();
900 int posdue=posDueDt; 900 int posdue=posDueDt;
901 if (posdue<0) posdue=x+width; 901 if (posdue<0) posdue=x+width;
902 QRect rect; 902 QRect rect;
903 TodoParentStart startpt; 903 TodoParentStart startpt;
904 // This list keeps all starting points of the parent todos so the connection 904 // This list keeps all starting points of the parent todos so the connection
905 // lines of the tree can easily be drawn (needed if a new page is started) 905 // lines of the tree can easily be drawn (needed if a new page is started)
906 static QPtrList<TodoParentStart> startPoints; 906 static QPtrList<TodoParentStart> startPoints;
907 if (level<1) { 907 if (level<1) {
908 startPoints.clear(); 908 startPoints.clear();
909 } 909 }
910 910
911 // size of item 911 // size of item
912 outStr=item->summary(); 912 outStr=item->summary();
913 if ( ! item->location().isEmpty() ) 913 if ( ! item->location().isEmpty() )
914 outStr += " ("+item->location()+")"; 914 outStr += " ("+item->location()+")";
915 if ( item->hasDueDate() && posDueDt>=0 ) { 915 if ( item->hasDueDate() && posDueDt>=0 ) {
916 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; 916 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]";
917 } 917 }
918 int left = possummary+(level*10); 918 int left = possummary+(level*10);
919 rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); 919 rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr);
920 if ( !item->description().isEmpty() && !desc ) { 920 if ( !item->description().isEmpty() && desc ) {
921 outStr = item->description(); 921 outStr = item->description();
922 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, 922 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1,
923 WordBreak, outStr ); 923 WordBreak, outStr );
924 } 924 }
925 // if too big make new page 925 // if too big make new page
926 if ( rect.bottom() > y+height) { 926 if ( rect.bottom() > y+height) {
927 // first draw the connection lines from parent todos: 927 // first draw the connection lines from parent todos:
928 if (level > 0 && connectSubTodos) { 928 if (level > 0 && connectSubTodos) {
929 TodoParentStart *rct; 929 TodoParentStart *rct;
930 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { 930 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) {
931 int start; 931 int start;
932 int center = rct->mRect.left() + (rct->mRect.width()/2); 932 int center = rct->mRect.left() + (rct->mRect.width()/2);
933 int to = p.viewport().bottom(); 933 int to = p.viewport().bottom();
934 934
935 // draw either from start point of parent or from top of the page 935 // draw either from start point of parent or from top of the page
936 if (rct->mSamePage) 936 if (rct->mSamePage)
937 start = rct->mRect.bottom() + 1; 937 start = rct->mRect.bottom() + 1;
938 else 938 else
939 start = p.viewport().top(); 939 start = p.viewport().top();
940 p.moveTo( center, start ); 940 p.moveTo( center, start );
941 p.lineTo( center, to ); 941 p.lineTo( center, to );
942 rct->mSamePage=false; 942 rct->mSamePage=false;
943 } 943 }
944 } 944 }
945 y=0; 945 y=0;
946 height=pageHeight-y; 946 height=pageHeight-y;
947 mPrinter->newPage(); 947 mPrinter->newPage();
948 } 948 }
949 949
950 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up 950 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up
951 //to the RH side of the parent item's priority 951 //to the RH side of the parent item's priority
952 if (r && pospriority >= 0 ) { 952 if (r && pospriority >= 0 ) {
953 pospriority = r->mRect.right() + 1; 953 pospriority = r->mRect.right() + 1;
954 } 954 }
955 955
956 // Priority 956 // Priority
957 outStr.setNum(priority); 957 outStr.setNum(priority);
958 rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); 958 rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr);
959 // Make it a more reasonable size 959 // Make it a more reasonable size
960 rect.setWidth(19); 960 rect.setWidth(19);
961 rect.setHeight(19); 961 rect.setHeight(19);
962 if ( priority > 0 && pospriority>=0 ) { 962 if ( priority > 0 && pospriority>=0 ) {
963 p.drawText(rect, AlignCenter, outStr); 963 p.drawText(rect, AlignCenter, outStr);
964 p.drawRect(rect); 964 p.drawRect(rect);
965 // cross out the rectangle for completed items 965 // cross out the rectangle for completed items
966 if ( item->isCompleted() ) { 966 if ( item->isCompleted() ) {
967 p.drawLine( rect.topLeft(), rect.bottomRight() ); 967 p.drawLine( rect.topLeft(), rect.bottomRight() );
968 p.drawLine( rect.topRight(), rect.bottomLeft() ); 968 p.drawLine( rect.topRight(), rect.bottomLeft() );
969 } 969 }
970 } 970 }
971 startpt.mRect = rect; //save for later 971 startpt.mRect = rect; //save for later
972 972
973 // Connect the dots 973 // Connect the dots
974 if (level > 0 && connectSubTodos) { 974 if (level > 0 && connectSubTodos) {
975 int bottom; 975 int bottom;
976 int center( r->mRect.left() + (r->mRect.width()/2)+1 ); 976 int center( r->mRect.left() + (r->mRect.width()/2)+1 );
977 if (r->mSamePage ) 977 if (r->mSamePage )
978 bottom = r->mRect.bottom();//lutz + 1; 978 bottom = r->mRect.bottom();//lutz + 1;
979 else 979 else
980 bottom = 0; 980 bottom = 0;
981 int to( rect.top() + (rect.height()/2)+1 ); 981 int to( rect.top() + (rect.height()/2)+1 );
982 int endx( rect.left() ); 982 int endx( rect.left() );
983 p.moveTo(center, bottom); 983 p.moveTo(center, bottom);
984 p.lineTo(center, to); 984 p.lineTo(center, to);
985 p.lineTo(endx, to); 985 p.lineTo(endx, to);
986 } 986 }
987 987
988 // if completed, use strike out font 988 // if completed, use strike out font
989 QFont ft=p.font(); 989 QFont ft=p.font();
990 ft.setStrikeOut( item->isCompleted() ); 990 ft.setStrikeOut( item->isCompleted() );
991 p.setFont( ft ); 991 p.setFont( ft );
992 // summary 992 // summary
993 outStr=item->summary(); 993 outStr=item->summary();
994 if ( ! item->location().isEmpty() ) 994 if ( ! item->location().isEmpty() )
995 outStr += " ("+item->location()+")"; 995 outStr += " ("+item->location()+")";
996 if ( item->hasDueDate() && posDueDt>=0 ) { 996 if ( item->hasDueDate() && posDueDt>=0 ) {
997 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; 997 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]";
998 } 998 }
999 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), 999 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)),
1000 -1, WordBreak, outStr); 1000 -1, WordBreak, outStr);
1001 QRect newrect; 1001 QRect newrect;
1002 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1002 p.drawText( rect, WordBreak, outStr, -1, &newrect );
1003 ft.setStrikeOut(false); 1003 ft.setStrikeOut(false);
1004 p.setFont(ft); 1004 p.setFont(ft);
1005 1005
1006 // due 1006 // due
1007 // if ( item->hasDueDate() && posDueDt>=0 ) { 1007 // if ( item->hasDueDate() && posDueDt>=0 ) {
1008// outStr = local->formatDate(item->dtDue().date(),true); 1008// outStr = local->formatDate(item->dtDue().date(),true);
1009// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); 1009// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr);
1010// p.drawText(rect, AlignTop|AlignLeft, outStr); 1010// p.drawText(rect, AlignTop|AlignLeft, outStr);
1011// } 1011// }
1012 1012
1013 if ( !item->description().isEmpty() && desc ) { 1013 if ( !item->description().isEmpty() && desc ) {
1014 y=newrect.bottom() + 5; 1014 y=newrect.bottom() + 5;
1015 outStr = item->description(); 1015 outStr = item->description();
1016 rect = p.boundingRect( left+20, y, x+width-(left+10), -1, 1016 rect = p.boundingRect( left+20, y, x+width-(left+10), -1,
1017 WordBreak, outStr ); 1017 WordBreak, outStr );
1018 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1018 p.drawText( rect, WordBreak, outStr, -1, &newrect );
1019 } 1019 }
1020 1020
1021 // Set the new line position 1021 // Set the new line position
1022 y=newrect.bottom() + 10; //set the line position 1022 y=newrect.bottom() + 10; //set the line position
1023 1023
1024 // If the item has subitems, we need to call ourselves recursively 1024 // If the item has subitems, we need to call ourselves recursively
1025 Incidence::List l;l.fill( item->relations()); 1025 Incidence::List l;l.fill( item->relations());
1026 Incidence::List::ConstIterator it; 1026 Incidence::List::ConstIterator it;
1027 startPoints.append( &startpt ); 1027 startPoints.append( &startpt );
1028 for( it = l.begin(); it != l.end(); ++it ) { 1028 for( it = l.begin(); it != l.end(); ++it ) {
1029 count++; 1029 count++;
1030 drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos, 1030 drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos,
1031 desc, pospriority, possummary, posDueDt, level+1, 1031 desc, pospriority, possummary, posDueDt, level+1,
1032 x, y, width, height, pageHeight, &startpt); 1032 x, y, width, height, pageHeight, &startpt);
1033 } 1033 }
1034 startPoints.remove(&startpt); 1034 startPoints.remove(&startpt);
1035} 1035}
1036 1036
1037int CalPrintBase::weekdayColumn( int weekday ) 1037int CalPrintBase::weekdayColumn( int weekday )
1038{ 1038{
1039 return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7; 1039 return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7;
1040} 1040}
1041 1041
1042void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd, 1042void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd,
1043 const QDate &td ) 1043 const QDate &td )
1044{ 1044{
1045 QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek; 1045 QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek;
1046 1046
1047 mPrinter->setOrientation(KPrinter::Portrait); 1047 mPrinter->setOrientation(KPrinter::Portrait);
1048 1048
1049 int minus = 0; 1049 int minus = 0;
1050 if (KGlobal::locale()->weekStartsMonday()) { 1050 if (KGlobal::locale()->weekStartsMonday()) {
1051 // correct to monday 1051 // correct to monday
1052 fromWeek = fd.addDays(-(fd.dayOfWeek()-1)); 1052 fromWeek = fd.addDays(-(fd.dayOfWeek()-1));
1053 // correct to sunday 1053 // correct to sunday
1054 toWeek = td.addDays(7-fd.dayOfWeek()); 1054 toWeek = td.addDays(7-fd.dayOfWeek());
1055 minus = 1; 1055 minus = 1;
1056 } else { 1056 } else {
1057 // correct to sunday 1057 // correct to sunday
1058 fromWeek = fd.addDays(-(fd.dayOfWeek()%7)); 1058 fromWeek = fd.addDays(-(fd.dayOfWeek()%7));
1059 // correct to saturday 1059 // correct to saturday
1060 toWeek = td.addDays(6-td.dayOfWeek()); 1060 toWeek = td.addDays(6-td.dayOfWeek());
1061 } 1061 }
1062 1062
1063 fromDay = fd; 1063 fromDay = fd;
1064 curDay = fd; 1064 curDay = fd;
1065 toDay = td; 1065 toDay = td;
1066 p.setFont( QFont("Helvetica") ); 1066 p.setFont( QFont("Helvetica") );
1067 // the painter initially begins at 72 dpi per the Qt docs. 1067 // the painter initially begins at 72 dpi per the Qt docs.
1068 int pageWidth = p.viewport().width(); 1068 int pageWidth = p.viewport().width();
1069 int pageHeight = p.viewport().height(); 1069 int pageHeight = p.viewport().height();
1070 int margin=0; 1070 int margin=0;
1071 mHeaderHeight = 110; 1071 mHeaderHeight = 110;
1072 mSubHeaderHeight = 20; 1072 mSubHeaderHeight = 20;
1073 1073
1074 p.setViewport(margin, margin, 1074 p.setViewport(margin, margin,
1075 p.viewport().width()-margin, 1075 p.viewport().width()-margin,
1076 p.viewport().height()-margin); 1076 p.viewport().height()-margin);
1077 1077
1078 curWeek = fromWeek.addDays(6); 1078 curWeek = fromWeek.addDays(6);
1079 1079
1080 int columnWidth = int( pageWidth / 4.5 ); 1080 int columnWidth = int( pageWidth / 4.5 );
1081 1081
1082 do { 1082 do {
1083 1083
1084 // if ( (curDay.dayOfWeek()-1)%7 < 3 ) 1084 // if ( (curDay.dayOfWeek()-1)%7 < 3 )
1085 switch((curDay.dayOfWeek()-minus)%7){ 1085 switch((curDay.dayOfWeek()-minus)%7){
1086 case 0: 1086 case 0:
1087 drawSplitTimes( p, pageWidth, columnWidth, pageHeight ); 1087 drawSplitTimes( p, pageWidth, columnWidth, pageHeight );
1088 drawSplitDay( p, curDay, columnWidth, pageHeight, 1088 drawSplitDay( p, curDay, columnWidth, pageHeight,
1089 int( columnWidth * 0.5 ) ); 1089 int( columnWidth * 0.5 ) );
1090 break; 1090 break;
1091 case 1: 1091 case 1:
1092 drawSplitDay( p, curDay, columnWidth, pageHeight, 1092 drawSplitDay( p, curDay, columnWidth, pageHeight,
1093 int( columnWidth * 1.5 ) ); 1093 int( columnWidth * 1.5 ) );
1094 break; 1094 break;
1095 case 2: 1095 case 2:
1096 drawSplitDay( p, curDay, columnWidth, pageHeight, 1096 drawSplitDay( p, curDay, columnWidth, pageHeight,
1097 int( columnWidth * 2.5 ) ); 1097 int( columnWidth * 2.5 ) );
1098 break; 1098 break;
1099 case 3: 1099 case 3:
1100 drawSplitDay( p, curDay, columnWidth, pageHeight, 1100 drawSplitDay( p, curDay, columnWidth, pageHeight,
1101 int( columnWidth * 3.5 ) ); 1101 int( columnWidth * 3.5 ) );
1102 mPrinter->newPage(); 1102 mPrinter->newPage();
1103 break; 1103 break;
1104 case 4: 1104 case 4:
1105 drawSplitTimes( p, int( pageWidth * ( 3.5/ 4.5 ) ), columnWidth, 1105 drawSplitTimes( p, int( pageWidth * ( 3.5/ 4.5 ) ), columnWidth,
1106 pageHeight ); 1106 pageHeight );
1107 drawSplitDay( p, curDay, columnWidth, pageHeight, 1107 drawSplitDay( p, curDay, columnWidth, pageHeight,
1108 int( columnWidth * 0.5 ) ); 1108 int( columnWidth * 0.5 ) );
1109 drawSplitHeaderRight( p, curWeek.addDays( -6 ), curWeek, 1109 drawSplitHeaderRight( p, curWeek.addDays( -6 ), curWeek,
1110 curWeek, pageWidth, mHeaderHeight ); 1110 curWeek, pageWidth, mHeaderHeight );
1111 break; 1111 break;
1112 case 5: 1112 case 5:
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 2de7f28..006a8dd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -644,399 +644,399 @@ void MainWindow::initActions()
644 viewMenu->insertSeparator(); 644 viewMenu->insertSeparator();
645 645
646 icon = loadPixmap( pathString + "navi" ); 646 icon = loadPixmap( pathString + "navi" );
647 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 647 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
648 action->addTo( viewMenu ); 648 action->addTo( viewMenu );
649 connect( action, SIGNAL( activated() ), 649 connect( action, SIGNAL( activated() ),
650 mView, SLOT( toggleDateNavigatorWidget() ) ); 650 mView, SLOT( toggleDateNavigatorWidget() ) );
651 mToggleNav = action ; 651 mToggleNav = action ;
652 icon = loadPixmap( pathString + "filter" ); 652 icon = loadPixmap( pathString + "filter" );
653 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 653 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
654 action->addTo( viewMenu ); 654 action->addTo( viewMenu );
655 connect( action, SIGNAL( activated() ), 655 connect( action, SIGNAL( activated() ),
656 mView, SLOT( toggleFilter() ) ); 656 mView, SLOT( toggleFilter() ) );
657 mToggleFilter = action; 657 mToggleFilter = action;
658 icon = loadPixmap( pathString + "allday" ); 658 icon = loadPixmap( pathString + "allday" );
659 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 659 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
660 action->addTo( viewMenu ); 660 action->addTo( viewMenu );
661 connect( action, SIGNAL( activated() ), 661 connect( action, SIGNAL( activated() ),
662 mView, SLOT( toggleAllDaySize() ) ); 662 mView, SLOT( toggleAllDaySize() ) );
663 mToggleAllday = action; 663 mToggleAllday = action;
664 664
665 665
666 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 666 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
667 mToggleNav, SLOT( setEnabled ( bool ) ) ); 667 mToggleNav, SLOT( setEnabled ( bool ) ) );
668 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 668 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
669 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 669 mToggleFilter, SLOT( setEnabled ( bool ) ) );
670 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 670 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
671 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 671 mToggleAllday, SLOT( setEnabled ( bool ) ) );
672 672
673 viewMenu->insertSeparator(); 673 viewMenu->insertSeparator();
674 icon = loadPixmap( pathString + "picker" ); 674 icon = loadPixmap( pathString + "picker" );
675 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 675 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
676 action->addTo( viewMenu ); 676 action->addTo( viewMenu );
677 connect( action, SIGNAL( activated() ), 677 connect( action, SIGNAL( activated() ),
678 mView, SLOT( showDatePicker() ) ); 678 mView, SLOT( showDatePicker() ) );
679 action->addTo( iconToolBar ); 679 action->addTo( iconToolBar );
680 viewMenu->insertSeparator(); 680 viewMenu->insertSeparator();
681 icon = loadPixmap( pathString + "list" ); 681 icon = loadPixmap( pathString + "list" );
682 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 682 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
683 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 683 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
684 showlist_action->addTo( viewMenu ); 684 showlist_action->addTo( viewMenu );
685 connect( showlist_action, SIGNAL( activated() ), 685 connect( showlist_action, SIGNAL( activated() ),
686 mView->viewManager(), SLOT( showListView() ) ); 686 mView->viewManager(), SLOT( showListView() ) );
687 687
688 688
689 icon = loadPixmap( pathString + "day" ); 689 icon = loadPixmap( pathString + "day" );
690 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 690 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
691 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 691 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
692 day1_action->addTo( viewMenu ); 692 day1_action->addTo( viewMenu );
693 // action->addTo( toolBar ); 693 // action->addTo( toolBar );
694 connect( day1_action, SIGNAL( activated() ), 694 connect( day1_action, SIGNAL( activated() ),
695 mView->viewManager(), SLOT( showDayView() ) ); 695 mView->viewManager(), SLOT( showDayView() ) );
696 696
697 icon = loadPixmap( pathString + "workweek" ); 697 icon = loadPixmap( pathString + "workweek" );
698 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 698 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
699 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 699 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
700 day5_action->addTo( viewMenu ); 700 day5_action->addTo( viewMenu );
701 connect( day5_action, SIGNAL( activated() ), 701 connect( day5_action, SIGNAL( activated() ),
702 mView->viewManager(), SLOT( showWorkWeekView() ) ); 702 mView->viewManager(), SLOT( showWorkWeekView() ) );
703 703
704 icon = loadPixmap( pathString + "week" ); 704 icon = loadPixmap( pathString + "week" );
705 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 705 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
706 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 706 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
707 day7_action->addTo( viewMenu ); 707 day7_action->addTo( viewMenu );
708 connect( day7_action, SIGNAL( activated() ), 708 connect( day7_action, SIGNAL( activated() ),
709 mView->viewManager(), SLOT( showWeekView() ) ); 709 mView->viewManager(), SLOT( showWeekView() ) );
710 710
711 icon = loadPixmap( pathString + "workweek2" ); 711 icon = loadPixmap( pathString + "workweek2" );
712 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 712 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
713 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 713 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
714 day6_action->addTo( viewMenu ); 714 day6_action->addTo( viewMenu );
715 connect( day6_action, SIGNAL( activated() ), 715 connect( day6_action, SIGNAL( activated() ),
716 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 716 mView->viewManager(), SLOT( showMonthViewWeek() ) );
717 717
718 icon = loadPixmap( pathString + "month" ); 718 icon = loadPixmap( pathString + "month" );
719 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 719 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
720 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 720 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
721 month_action->addTo( viewMenu ); 721 month_action->addTo( viewMenu );
722 connect( month_action, SIGNAL( activated() ), 722 connect( month_action, SIGNAL( activated() ),
723 mView->viewManager(), SLOT( showMonthView() ) ); 723 mView->viewManager(), SLOT( showMonthView() ) );
724 724
725 icon = loadPixmap( pathString + "todo" ); 725 icon = loadPixmap( pathString + "todo" );
726 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 726 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
727 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 727 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
728 todoview_action->addTo( viewMenu ); 728 todoview_action->addTo( viewMenu );
729 connect( todoview_action, SIGNAL( activated() ), 729 connect( todoview_action, SIGNAL( activated() ),
730 mView->viewManager(), SLOT( showTodoView() ) ); 730 mView->viewManager(), SLOT( showTodoView() ) );
731 731
732 icon = loadPixmap( pathString + "journal" ); 732 icon = loadPixmap( pathString + "journal" );
733 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 733 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
734 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 734 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
735 viewjournal_action->addTo( viewMenu ); 735 viewjournal_action->addTo( viewMenu );
736 connect( viewjournal_action, SIGNAL( activated() ), 736 connect( viewjournal_action, SIGNAL( activated() ),
737 mView->viewManager(), SLOT( showJournalView() ) ); 737 mView->viewManager(), SLOT( showJournalView() ) );
738 738
739 icon = loadPixmap( pathString + "xdays" ); 739 icon = loadPixmap( pathString + "xdays" );
740 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 740 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
741 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 741 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
742 xdays_action->addTo( viewMenu ); 742 xdays_action->addTo( viewMenu );
743 connect( xdays_action, SIGNAL( activated() ), 743 connect( xdays_action, SIGNAL( activated() ),
744 mView->viewManager(), SLOT( showNextXView() ) ); 744 mView->viewManager(), SLOT( showNextXView() ) );
745 745
746 icon = loadPixmap( pathString + "whatsnext" ); 746 icon = loadPixmap( pathString + "whatsnext" );
747 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 747 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
748 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 748 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
749 whatsnext_action->addTo( viewMenu ); 749 whatsnext_action->addTo( viewMenu );
750 connect( whatsnext_action, SIGNAL( activated() ), 750 connect( whatsnext_action, SIGNAL( activated() ),
751 mView->viewManager(), SLOT( showWhatsNextView() ) ); 751 mView->viewManager(), SLOT( showWhatsNextView() ) );
752 752
753#if 0 753#if 0
754 action = new QAction( "view_timespan", "Time Span", 0, this ); 754 action = new QAction( "view_timespan", "Time Span", 0, this );
755 action->addTo( viewMenu ); 755 action->addTo( viewMenu );
756 connect( action, SIGNAL( activated() ), 756 connect( action, SIGNAL( activated() ),
757 mView->viewManager(), SLOT( showTimeSpanView() ) ); 757 mView->viewManager(), SLOT( showTimeSpanView() ) );
758#endif 758#endif
759 759
760 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 760 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
761 this ); 761 this );
762 mNewSubTodoAction->addTo( actionMenu ); 762 mNewSubTodoAction->addTo( actionMenu );
763 connect( mNewSubTodoAction, SIGNAL( activated() ), 763 connect( mNewSubTodoAction, SIGNAL( activated() ),
764 mView, SLOT( newSubTodo() ) ); 764 mView, SLOT( newSubTodo() ) );
765 765
766 actionMenu->insertSeparator(); 766 actionMenu->insertSeparator();
767 767
768 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 768 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
769 mShowAction->addTo( actionMenu ); 769 mShowAction->addTo( actionMenu );
770 connect( mShowAction, SIGNAL( activated() ), 770 connect( mShowAction, SIGNAL( activated() ),
771 mView, SLOT( showIncidence() ) ); 771 mView, SLOT( showIncidence() ) );
772 772
773 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 773 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
774 mEditAction->addTo( actionMenu ); 774 mEditAction->addTo( actionMenu );
775 connect( mEditAction, SIGNAL( activated() ), 775 connect( mEditAction, SIGNAL( activated() ),
776 mView, SLOT( editIncidence() ) ); 776 mView, SLOT( editIncidence() ) );
777 777
778 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 778 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
779 mDeleteAction->addTo( actionMenu ); 779 mDeleteAction->addTo( actionMenu );
780 connect( mDeleteAction, SIGNAL( activated() ), 780 connect( mDeleteAction, SIGNAL( activated() ),
781 mView, SLOT( deleteIncidence() ) ); 781 mView, SLOT( deleteIncidence() ) );
782 782
783 783
784 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 784 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
785 mCloneAction->addTo( actionMenu ); 785 mCloneAction->addTo( actionMenu );
786 connect( mCloneAction, SIGNAL( activated() ), 786 connect( mCloneAction, SIGNAL( activated() ),
787 mView, SLOT( cloneIncidence() ) ); 787 mView, SLOT( cloneIncidence() ) );
788 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 788 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
789 mMoveAction->addTo( actionMenu ); 789 mMoveAction->addTo( actionMenu );
790 connect( mMoveAction, SIGNAL( activated() ), 790 connect( mMoveAction, SIGNAL( activated() ),
791 mView, SLOT( moveIncidence() ) ); 791 mView, SLOT( moveIncidence() ) );
792 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 792 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
793 mBeamAction->addTo( actionMenu ); 793 mBeamAction->addTo( actionMenu );
794 connect( mBeamAction, SIGNAL( activated() ), 794 connect( mBeamAction, SIGNAL( activated() ),
795 mView, SLOT( beamIncidence() ) ); 795 mView, SLOT( beamIncidence() ) );
796 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 796 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
797 mCancelAction->addTo( actionMenu ); 797 mCancelAction->addTo( actionMenu );
798 connect( mCancelAction, SIGNAL( activated() ), 798 connect( mCancelAction, SIGNAL( activated() ),
799 mView, SLOT( toggleCancelIncidence() ) ); 799 mView, SLOT( toggleCancelIncidence() ) );
800 800
801 actionMenu->insertSeparator(); 801 actionMenu->insertSeparator();
802 802
803 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 803 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
804 this ); 804 this );
805 action->addTo( actionMenu ); 805 action->addTo( actionMenu );
806 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 806 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
807 807
808 icon = loadPixmap( pathString + "search" ); 808 icon = loadPixmap( pathString + "search" );
809 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 809 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
810 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 810 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
811 search_action->addTo( actionMenu ); 811 search_action->addTo( actionMenu );
812 connect( search_action, SIGNAL( activated() ), 812 connect( search_action, SIGNAL( activated() ),
813 mView->dialogManager(), SLOT( showSearchDialog() ) ); 813 mView->dialogManager(), SLOT( showSearchDialog() ) );
814 814
815 815
816 816
817 if ( KOPrefs::instance()->mShowFullMenu ) { 817 if ( KOPrefs::instance()->mShowFullMenu ) {
818 actionMenu->insertSeparator(); 818 actionMenu->insertSeparator();
819 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 819 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
820 820
821 } 821 }
822 // actionMenu->insertSeparator(); 822 // actionMenu->insertSeparator();
823 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 823 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
824 this ); 824 this );
825 action->addTo( importMenu ); 825 action->addTo( importMenu );
826 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 826 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
827 action = new QAction( "import_quick", i18n("Import last file"), 0, 827 action = new QAction( "import_quick", i18n("Import last file"), 0,
828 this ); 828 this );
829 action->addTo( importMenu ); 829 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 830 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
831 importMenu->insertSeparator(); 831 importMenu->insertSeparator();
832 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 832 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
833 this ); 833 this );
834 action->addTo( importMenu ); 834 action->addTo( importMenu );
835 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 835 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
836#ifndef DESKTOP_VERSION 836 //#ifndef DESKTOP_VERSION
837 importMenu->insertSeparator(); 837 importMenu->insertSeparator();
838 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 838 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
839 this ); 839 this );
840 action->addTo( importMenu ); 840 action->addTo( importMenu );
841 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 841 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
842#else 842 //#else
843#ifdef _OL_IMPORT_ 843#ifdef _OL_IMPORT_
844 importMenu->insertSeparator(); 844 importMenu->insertSeparator();
845 action = new QAction( "import_ol", i18n("Import from OL"), 0, 845 action = new QAction( "import_ol", i18n("Import from OL"), 0,
846 this ); 846 this );
847 action->addTo( importMenu ); 847 action->addTo( importMenu );
848 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 848 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
849#endif 849#endif
850#endif 850 //#endif
851 851
852 importMenu->insertSeparator(); 852 importMenu->insertSeparator();
853 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 853 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
854 this ); 854 this );
855 action->addTo( importMenu ); 855 action->addTo( importMenu );
856 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 856 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
857 857
858 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 858 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
859 this ); 859 this );
860 action->addTo( importMenu ); 860 action->addTo( importMenu );
861 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 861 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
862 862
863 importMenu->insertSeparator(); 863 importMenu->insertSeparator();
864 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 864 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
865 this ); 865 this );
866 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 866 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
867 867
868 868
869 //LR 869 //LR
870 QPopupMenu *ex2phone = new QPopupMenu( this ); 870 QPopupMenu *ex2phone = new QPopupMenu( this );
871 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 871 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
872 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 872 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
873 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 873 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
874 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 874 importMenu->insertItem( i18n("Export to phone"), ex2phone );
875 875
876 importMenu->insertSeparator(); 876 importMenu->insertSeparator();
877 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 877 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
878 this ); 878 this );
879 action->addTo( importMenu ); 879 action->addTo( importMenu );
880 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 880 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
881#ifndef DESKTOP_VERSION 881#ifndef DESKTOP_VERSION
882 importMenu->insertSeparator(); 882 importMenu->insertSeparator();
883 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 883 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
884 this ); 884 this );
885 brAction->addTo( importMenu ); 885 brAction->addTo( importMenu );
886 brAction->setToggleAction (true ) ; 886 brAction->setToggleAction (true ) ;
887 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 887 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
888 888
889 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 889 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
890 this ); 890 this );
891 action->addTo( importMenu ); 891 action->addTo( importMenu );
892 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 892 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
893 893
894 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 894 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
895 this ); 895 this );
896 action->addTo( importMenu ); 896 action->addTo( importMenu );
897 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 897 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
898#else 898#else
899 importMenu->insertSeparator(); 899 importMenu->insertSeparator();
900 icon = loadPixmap( pathString + "print" ); 900 icon = loadPixmap( pathString + "print" );
901 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 901 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
902 action->addTo( importMenu ); 902 action->addTo( importMenu );
903 connect( action, SIGNAL( activated() ), 903 connect( action, SIGNAL( activated() ),
904 this, SLOT( printCal() ) ); 904 this, SLOT( printCal() ) );
905 905
906 icon = loadPixmap( pathString + "print" ); 906 icon = loadPixmap( pathString + "print" );
907 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 907 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
908 action->addTo( importMenu ); 908 action->addTo( importMenu );
909 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
910 this, SLOT( printSel() ) ); 910 this, SLOT( printSel() ) );
911 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 911 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
912 action->addTo( importMenu ); 912 action->addTo( importMenu );
913 connect( action, SIGNAL( activated() ), 913 connect( action, SIGNAL( activated() ),
914 mView->viewManager(), SIGNAL( printWNV() ) ); 914 mView->viewManager(), SIGNAL( printWNV() ) );
915#endif 915#endif
916 importMenu->insertSeparator(); 916 importMenu->insertSeparator();
917 action = new QAction( "beam all", i18n("Save"), 0, 917 action = new QAction( "beam all", i18n("Save"), 0,
918 this ); 918 this );
919 action->addTo( importMenu ); 919 action->addTo( importMenu );
920 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 920 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
921 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 921 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
922 this ); 922 this );
923 action->addTo( importMenu ); 923 action->addTo( importMenu );
924 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 924 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
925 925
926 //menuBar->insertItem( "Configure",configureMenu ); 926 //menuBar->insertItem( "Configure",configureMenu );
927 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 927 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
928 icon = loadPixmap( "korganizer/korganizer" ); 928 icon = loadPixmap( "korganizer/korganizer" );
929 929
930 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 930 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
931 action->addTo( helpMenu ); 931 action->addTo( helpMenu );
932 connect( action, SIGNAL( activated() ), 932 connect( action, SIGNAL( activated() ),
933 SLOT( whatsNew() ) ); 933 SLOT( whatsNew() ) );
934 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 934 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
935 action->addTo( helpMenu ); 935 action->addTo( helpMenu );
936 connect( action, SIGNAL( activated() ), 936 connect( action, SIGNAL( activated() ),
937 SLOT( features() ) ); 937 SLOT( features() ) );
938 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 938 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
939 action->addTo( helpMenu ); 939 action->addTo( helpMenu );
940 connect( action, SIGNAL( activated() ), 940 connect( action, SIGNAL( activated() ),
941 SLOT( keyBindings() ) ); 941 SLOT( keyBindings() ) );
942 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 942 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
943 action->addTo( helpMenu ); 943 action->addTo( helpMenu );
944 connect( action, SIGNAL( activated() ), 944 connect( action, SIGNAL( activated() ),
945 SLOT( synchowto() ) ); 945 SLOT( synchowto() ) );
946 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 946 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
947 action->addTo( helpMenu ); 947 action->addTo( helpMenu );
948 connect( action, SIGNAL( activated() ), 948 connect( action, SIGNAL( activated() ),
949 SLOT( kdesynchowto() ) ); 949 SLOT( kdesynchowto() ) );
950 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 950 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
951 action->addTo( helpMenu ); 951 action->addTo( helpMenu );
952 connect( action, SIGNAL( activated() ), 952 connect( action, SIGNAL( activated() ),
953 SLOT( multisynchowto() ) ); 953 SLOT( multisynchowto() ) );
954 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 954 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
955 action->addTo( helpMenu ); 955 action->addTo( helpMenu );
956 connect( action, SIGNAL( activated() ), 956 connect( action, SIGNAL( activated() ),
957 SLOT( aboutAutoSaving() ) ); 957 SLOT( aboutAutoSaving() ) );
958 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 958 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
959 action->addTo( helpMenu ); 959 action->addTo( helpMenu );
960 connect( action, SIGNAL( activated() ), 960 connect( action, SIGNAL( activated() ),
961 SLOT( aboutKnownBugs() ) ); 961 SLOT( aboutKnownBugs() ) );
962 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 962 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
963 action->addTo( helpMenu ); 963 action->addTo( helpMenu );
964 connect( action, SIGNAL( activated() ), 964 connect( action, SIGNAL( activated() ),
965 SLOT( usertrans() ) ); 965 SLOT( usertrans() ) );
966 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 966 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
967 action->addTo( helpMenu ); 967 action->addTo( helpMenu );
968 connect( action, SIGNAL( activated() ), 968 connect( action, SIGNAL( activated() ),
969 SLOT( faq() ) ); 969 SLOT( faq() ) );
970 action = new QAction( "licence", i18n("Licence..."), 0, this ); 970 action = new QAction( "licence", i18n("Licence..."), 0, this );
971 action->addTo( helpMenu ); 971 action->addTo( helpMenu );
972 connect( action, SIGNAL( activated() ), 972 connect( action, SIGNAL( activated() ),
973 SLOT( licence() ) ); 973 SLOT( licence() ) );
974 action = new QAction( "about", i18n("About..."), 0, this ); 974 action = new QAction( "about", i18n("About..."), 0, this );
975 action->addTo( helpMenu ); 975 action->addTo( helpMenu );
976 connect( action, SIGNAL( activated() ), 976 connect( action, SIGNAL( activated() ),
977 SLOT( about() ) ); 977 SLOT( about() ) );
978 //menuBar->insertSeparator(); 978 //menuBar->insertSeparator();
979 979
980 // ****************************************************** 980 // ******************************************************
981 // menubar icons 981 // menubar icons
982 982
983 983
984 iconToolBar->setHorizontalStretchable (true ); 984 iconToolBar->setHorizontalStretchable (true );
985 //menuBar->insertItem( iconToolBar ); 985 //menuBar->insertItem( iconToolBar );
986 //xdays_action 986 //xdays_action
987 if (p-> mShowIconNewEvent) 987 if (p-> mShowIconNewEvent)
988 ne_action->addTo( iconToolBar ); 988 ne_action->addTo( iconToolBar );
989 if (p->mShowIconNewTodo ) 989 if (p->mShowIconNewTodo )
990 nt_action->addTo( iconToolBar ); 990 nt_action->addTo( iconToolBar );
991 if (p-> mShowIconSearch) 991 if (p-> mShowIconSearch)
992 search_action->addTo( iconToolBar ); 992 search_action->addTo( iconToolBar );
993 if (p-> mShowIconNext) 993 if (p-> mShowIconNext)
994 whatsnext_action->addTo( iconToolBar ); 994 whatsnext_action->addTo( iconToolBar );
995 if (p-> mShowIconNextDays) 995 if (p-> mShowIconNextDays)
996 xdays_action->addTo( iconToolBar ); 996 xdays_action->addTo( iconToolBar );
997 if (p-> mShowIconList) 997 if (p-> mShowIconList)
998 showlist_action->addTo( iconToolBar ); 998 showlist_action->addTo( iconToolBar );
999 if (p-> mShowIconDay1) 999 if (p-> mShowIconDay1)
1000 day1_action->addTo( iconToolBar ); 1000 day1_action->addTo( iconToolBar );
1001 if (p-> mShowIconDay5) 1001 if (p-> mShowIconDay5)
1002 day5_action->addTo( iconToolBar ); 1002 day5_action->addTo( iconToolBar );
1003 if (p-> mShowIconDay7) 1003 if (p-> mShowIconDay7)
1004 day7_action->addTo( iconToolBar ); 1004 day7_action->addTo( iconToolBar );
1005 if (p-> mShowIconDay6) 1005 if (p-> mShowIconDay6)
1006 day6_action->addTo( iconToolBar ); 1006 day6_action->addTo( iconToolBar );
1007 if (p-> mShowIconMonth) 1007 if (p-> mShowIconMonth)
1008 month_action->addTo( iconToolBar ); 1008 month_action->addTo( iconToolBar );
1009 if (p-> mShowIconTodoview) 1009 if (p-> mShowIconTodoview)
1010 todoview_action->addTo( iconToolBar ); 1010 todoview_action->addTo( iconToolBar );
1011 if (p-> mShowIconJournal) 1011 if (p-> mShowIconJournal)
1012 viewjournal_action->addTo( iconToolBar ); 1012 viewjournal_action->addTo( iconToolBar );
1013 icon = loadPixmap( pathString + "2leftarrowB" ); 1013 icon = loadPixmap( pathString + "2leftarrowB" );
1014 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1014 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1015 if (p-> mShowIconBackFast) { 1015 if (p-> mShowIconBackFast) {
1016 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1016 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1017 connect( action, SIGNAL( activated() ), 1017 connect( action, SIGNAL( activated() ),
1018 mView, SLOT( goPreviousMonth() ) ); 1018 mView, SLOT( goPreviousMonth() ) );
1019 action->addTo( iconToolBar ); 1019 action->addTo( iconToolBar );
1020 } 1020 }
1021 icon = loadPixmap( pathString + "1leftarrowB" ); 1021 icon = loadPixmap( pathString + "1leftarrowB" );
1022 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1022 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1023 if (p-> mShowIconBack) { 1023 if (p-> mShowIconBack) {
1024 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1024 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1025 connect( action, SIGNAL( activated() ), 1025 connect( action, SIGNAL( activated() ),
1026 mView, SLOT( goPrevious() ) ); 1026 mView, SLOT( goPrevious() ) );
1027 action->addTo( iconToolBar ); 1027 action->addTo( iconToolBar );
1028 } 1028 }
1029 icon = loadPixmap( pathString + "today" ); 1029 icon = loadPixmap( pathString + "today" );
1030 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1030 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1031 if (p-> mShowIconToday) 1031 if (p-> mShowIconToday)
1032 today_action->addTo( iconToolBar ); 1032 today_action->addTo( iconToolBar );
1033 icon = loadPixmap( pathString + "1rightarrowB" ); 1033 icon = loadPixmap( pathString + "1rightarrowB" );
1034 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1034 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1035 if (p-> mShowIconForward) { 1035 if (p-> mShowIconForward) {
1036 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1036 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1037 connect( action, SIGNAL( activated() ), 1037 connect( action, SIGNAL( activated() ),
1038 mView, SLOT( goNext() ) ); 1038 mView, SLOT( goNext() ) );
1039 action->addTo( iconToolBar ); 1039 action->addTo( iconToolBar );
1040 } 1040 }
1041 icon = loadPixmap( pathString + "2rightarrowB" ); 1041 icon = loadPixmap( pathString + "2rightarrowB" );
1042 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1042 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
@@ -1320,396 +1320,405 @@ void MainWindow::keyBindings()
1320 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1320 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1321 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1321 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1322 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1322 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1323 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1323 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1324 i18n("<p><b>White</b>: Item readonly</p>\n"); 1324 i18n("<p><b>White</b>: Item readonly</p>\n");
1325 displayText( text, cap); 1325 displayText( text, cap);
1326} 1326}
1327void MainWindow::aboutAutoSaving() 1327void MainWindow::aboutAutoSaving()
1328{ 1328{
1329 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"); 1329 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");
1330 1330
1331 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1331 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1332 1332
1333} 1333}
1334void MainWindow::aboutKnownBugs() 1334void MainWindow::aboutKnownBugs()
1335{ 1335{
1336 QMessageBox* msg; 1336 QMessageBox* msg;
1337 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1337 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1338 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")+ 1338 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")+
1339 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1339 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1340 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1340 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1341 i18n("\nor report them in the bugtracker on\n") + 1341 i18n("\nor report them in the bugtracker on\n") +
1342 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1342 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1343 QMessageBox::NoIcon, 1343 QMessageBox::NoIcon,
1344 QMessageBox::Ok, 1344 QMessageBox::Ok,
1345 QMessageBox::NoButton, 1345 QMessageBox::NoButton,
1346 QMessageBox::NoButton); 1346 QMessageBox::NoButton);
1347 msg->exec(); 1347 msg->exec();
1348 delete msg; 1348 delete msg;
1349 1349
1350} 1350}
1351 1351
1352QString MainWindow::defaultFileName() 1352QString MainWindow::defaultFileName()
1353{ 1353{
1354 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1354 return locateLocal( "data", "korganizer/mycalendar.ics" );
1355} 1355}
1356QString MainWindow::syncFileName() 1356QString MainWindow::syncFileName()
1357{ 1357{
1358#ifdef DESKTOP_VERSION 1358#ifdef DESKTOP_VERSION
1359 return locateLocal( "tmp", "synccalendar.ics" ); 1359 return locateLocal( "tmp", "synccalendar.ics" );
1360#else 1360#else
1361 return QString( "/tmp/synccalendar.ics" ); 1361 return QString( "/tmp/synccalendar.ics" );
1362#endif 1362#endif
1363} 1363}
1364void MainWindow::updateWeek(QDate seda) 1364void MainWindow::updateWeek(QDate seda)
1365{ 1365{
1366 int weekNum = 0; 1366 int weekNum = 0;
1367 QDate d = QDate ( seda.year(), 1,1); 1367 QDate d = QDate ( seda.year(), 1,1);
1368 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1368 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1369 if ( seda.addDays(6).year() != seda.year() ) { 1369 if ( seda.addDays(6).year() != seda.year() ) {
1370 if ( seda.year() != d.year() ) { 1370 if ( seda.year() != d.year() ) {
1371 if ( d.dayOfWeek() > 4 ) 1371 if ( d.dayOfWeek() > 4 )
1372 d = QDate ( seda.year(), 1,1); 1372 d = QDate ( seda.year(), 1,1);
1373 else 1373 else
1374 weekNum = 1; 1374 weekNum = 1;
1375 } else { 1375 } else {
1376 QDate dd( seda.year()+1, 1,1); 1376 QDate dd( seda.year()+1, 1,1);
1377 if ( dd.dayOfWeek() <= 4 ) 1377 if ( dd.dayOfWeek() <= 4 )
1378 weekNum = 1; 1378 weekNum = 1;
1379 } 1379 }
1380 } 1380 }
1381 if ( weekNum == 0 ){ 1381 if ( weekNum == 0 ){
1382 int dow = d.dayOfWeek(); 1382 int dow = d.dayOfWeek();
1383 if ( dow <= 4 ) 1383 if ( dow <= 4 )
1384 d = d.addDays( 1-dow ); 1384 d = d.addDays( 1-dow );
1385 else // 5,6,7 1385 else // 5,6,7
1386 d = d.addDays( 8-dow ); 1386 d = d.addDays( 8-dow );
1387 // we have the first week of the year.we are on monday 1387 // we have the first week of the year.we are on monday
1388 weekNum = d.daysTo( seda ) / 7 +1; 1388 weekNum = d.daysTo( seda ) / 7 +1;
1389 } 1389 }
1390 1390
1391 mWeekPixmap.fill( mWeekBgColor ); 1391 mWeekPixmap.fill( mWeekBgColor );
1392 QPainter p ( &mWeekPixmap ); 1392 QPainter p ( &mWeekPixmap );
1393 p.setFont( mWeekFont ); 1393 p.setFont( mWeekFont );
1394 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1394 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1395 p.end(); 1395 p.end();
1396 QIconSet icon3 ( mWeekPixmap ); 1396 QIconSet icon3 ( mWeekPixmap );
1397 mWeekAction->setIconSet ( icon3 ); 1397 mWeekAction->setIconSet ( icon3 );
1398 1398
1399} 1399}
1400void MainWindow::updateWeekNum(const DateList &selectedDates) 1400void MainWindow::updateWeekNum(const DateList &selectedDates)
1401{ 1401{
1402 updateWeek( selectedDates.first() ); 1402 updateWeek( selectedDates.first() );
1403} 1403}
1404void MainWindow::processIncidenceSelection( Incidence *incidence ) 1404void MainWindow::processIncidenceSelection( Incidence *incidence )
1405{ 1405{
1406 1406
1407 if ( !incidence ) { 1407 if ( !incidence ) {
1408 enableIncidenceActions( false ); 1408 enableIncidenceActions( false );
1409 1409
1410 mNewSubTodoAction->setEnabled( false ); 1410 mNewSubTodoAction->setEnabled( false );
1411 setCaptionToDates(); 1411 setCaptionToDates();
1412 return; 1412 return;
1413 1413
1414 } 1414 }
1415 1415
1416 //KGlobal::locale()->formatDateTime(nextA, true); 1416 //KGlobal::locale()->formatDateTime(nextA, true);
1417 QString startString = ""; 1417 QString startString = "";
1418 if ( incidence->type() != "Todo" ) { 1418 if ( incidence->type() != "Todo" ) {
1419 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1419 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1420 if ( incidence->doesFloat() ) { 1420 if ( incidence->doesFloat() ) {
1421 startString += ": "+incidence->dtStartDateStr( true ); 1421 startString += ": "+incidence->dtStartDateStr( true );
1422 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1422 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1423 1423
1424 } else { 1424 } else {
1425 startString = ": "+incidence->dtStartStr(true); 1425 startString = ": "+incidence->dtStartStr(true);
1426 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1426 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1427 1427
1428 } 1428 }
1429 1429
1430 } else { 1430 } else {
1431 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1431 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1432 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1432 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1433 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1433 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1434 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1434 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1435 bool ok; 1435 bool ok;
1436 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1436 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1437 if ( ok ) { 1437 if ( ok ) {
1438 int years = noc.date().year() - incidence->dtStart().date().year(); 1438 int years = noc.date().year() - incidence->dtStart().date().year();
1439 startString += i18n(" (%1 y.)"). arg( years ); 1439 startString += i18n(" (%1 y.)"). arg( years );
1440 } 1440 }
1441 } 1441 }
1442 else 1442 else
1443 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1443 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1444 } 1444 }
1445 1445
1446 } 1446 }
1447 else 1447 else
1448 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1448 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1449 if ( !incidence->location().isEmpty() ) 1449 if ( !incidence->location().isEmpty() )
1450 startString += " (" +incidence->location()+")"; 1450 startString += " (" +incidence->location()+")";
1451 setCaption( incidence->summary()+startString); 1451 setCaption( incidence->summary()+startString);
1452 1452
1453 enableIncidenceActions( true ); 1453 enableIncidenceActions( true );
1454 1454
1455 if ( incidence->type() == "Event" ) { 1455 if ( incidence->type() == "Event" ) {
1456 mShowAction->setText( i18n("Show Event...") ); 1456 mShowAction->setText( i18n("Show Event...") );
1457 mEditAction->setText( i18n("Edit Event...") ); 1457 mEditAction->setText( i18n("Edit Event...") );
1458 mDeleteAction->setText( i18n("Delete Event...") ); 1458 mDeleteAction->setText( i18n("Delete Event...") );
1459 1459
1460 mNewSubTodoAction->setEnabled( false ); 1460 mNewSubTodoAction->setEnabled( false );
1461 } else if ( incidence->type() == "Todo" ) { 1461 } else if ( incidence->type() == "Todo" ) {
1462 mShowAction->setText( i18n("Show Todo...") ); 1462 mShowAction->setText( i18n("Show Todo...") );
1463 mEditAction->setText( i18n("Edit Todo...") ); 1463 mEditAction->setText( i18n("Edit Todo...") );
1464 mDeleteAction->setText( i18n("Delete Todo...") ); 1464 mDeleteAction->setText( i18n("Delete Todo...") );
1465 1465
1466 mNewSubTodoAction->setEnabled( true ); 1466 mNewSubTodoAction->setEnabled( true );
1467 } else { 1467 } else {
1468 mShowAction->setText( i18n("Show...") ); 1468 mShowAction->setText( i18n("Show...") );
1469 mShowAction->setText( i18n("Edit...") ); 1469 mShowAction->setText( i18n("Edit...") );
1470 mShowAction->setText( i18n("Delete...") ); 1470 mShowAction->setText( i18n("Delete...") );
1471 1471
1472 mNewSubTodoAction->setEnabled( false ); 1472 mNewSubTodoAction->setEnabled( false );
1473 } 1473 }
1474} 1474}
1475 1475
1476void MainWindow::enableIncidenceActions( bool enabled ) 1476void MainWindow::enableIncidenceActions( bool enabled )
1477{ 1477{
1478 mShowAction->setEnabled( enabled ); 1478 mShowAction->setEnabled( enabled );
1479 mEditAction->setEnabled( enabled ); 1479 mEditAction->setEnabled( enabled );
1480 mDeleteAction->setEnabled( enabled ); 1480 mDeleteAction->setEnabled( enabled );
1481 1481
1482 mCloneAction->setEnabled( enabled ); 1482 mCloneAction->setEnabled( enabled );
1483 mMoveAction->setEnabled( enabled ); 1483 mMoveAction->setEnabled( enabled );
1484 mBeamAction->setEnabled( enabled ); 1484 mBeamAction->setEnabled( enabled );
1485 mCancelAction->setEnabled( enabled ); 1485 mCancelAction->setEnabled( enabled );
1486} 1486}
1487 1487
1488void MainWindow::importOL() 1488void MainWindow::importOL()
1489{ 1489{
1490#ifdef _OL_IMPORT_ 1490#ifdef _OL_IMPORT_
1491 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1491 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1492 id->exec(); 1492 id->exec();
1493 delete id; 1493 delete id;
1494 mView->updateView(); 1494 mView->updateView();
1495#endif 1495#endif
1496} 1496}
1497void MainWindow::importBday() 1497void MainWindow::importBday()
1498{ 1498{
1499 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1499 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1500 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1500 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1501 i18n("Import!"), i18n("Cancel"), 0, 1501 i18n("Import!"), i18n("Cancel"), 0,
1502 0, 1 ); 1502 0, 1 );
1503 if ( result == 0 ) { 1503 if ( result == 0 ) {
1504 mView->importBday(); 1504 mView->importBday();
1505 1505
1506 } 1506 }
1507 1507
1508 1508
1509} 1509}
1510void MainWindow::importQtopia() 1510void MainWindow::importQtopia()
1511{ 1511{
1512#ifndef DESKTOP_VERSION 1512 //#ifndef DESKTOP_VERSION
1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1513 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");
1514 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"), 1514#ifdef DESKTOP_VERSION
1515 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");
1516#endif
1517 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1515 i18n("Import!"), i18n("Cancel"), 0, 1518 i18n("Import!"), i18n("Cancel"), 0,
1516 0, 1 ); 1519 0, 1 );
1517 if ( result == 0 ) { 1520 if ( result == 0 ) {
1521#ifndef DESKTOP_VERSION
1518 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1522 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1519 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1523 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1520 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1524 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1525#else
1526 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1527 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1528 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1529#endif
1521 mView->importQtopia( categories, datebook, todolist ); 1530 mView->importQtopia( categories, datebook, todolist );
1522 } 1531 }
1523#else 1532#if 0
1524 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1533 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1525 i18n("Not supported \non desktop!\n"), 1534 i18n("Not supported \non desktop!\n"),
1526 i18n("Ok"), i18n("Cancel"), 0, 1535 i18n("Ok"), i18n("Cancel"), 0,
1527 0, 1 ); 1536 0, 1 );
1528 1537
1529#endif 1538#endif
1530} 1539}
1531 1540
1532void MainWindow::saveOnClose() 1541void MainWindow::saveOnClose()
1533{ 1542{
1534 KOPrefs *p = KOPrefs::instance(); 1543 KOPrefs *p = KOPrefs::instance();
1535 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1544 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1536 p->mToolBarUp = iconToolBar->x() > width()/2 || 1545 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1537 iconToolBar->y() > height()/2; 1546 iconToolBar->y() > height()/2;
1538 mView->writeSettings(); 1547 mView->writeSettings();
1539 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1548 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1540 save(); 1549 save();
1541} 1550}
1542void MainWindow::slotModifiedChanged( bool changed ) 1551void MainWindow::slotModifiedChanged( bool changed )
1543{ 1552{
1544 if ( mBlockAtStartup ) 1553 if ( mBlockAtStartup )
1545 return; 1554 return;
1546 1555
1547 int msec; 1556 int msec;
1548 // we store the changes after 1 minute, 1557 // we store the changes after 1 minute,
1549 // and for safety reasons after 10 minutes again 1558 // and for safety reasons after 10 minutes again
1550 if ( !mSyncManager->blockSave() ) 1559 if ( !mSyncManager->blockSave() )
1551 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1560 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1552 else 1561 else
1553 msec = 1000 * 600; 1562 msec = 1000 * 600;
1554 mSaveTimer.start( msec, true ); // 1 minute 1563 mSaveTimer.start( msec, true ); // 1 minute
1555 qDebug("KO: Saving File in %d secs!", msec/1000); 1564 qDebug("KO: Saving File in %d secs!", msec/1000);
1556 mCalendarModifiedFlag = true; 1565 mCalendarModifiedFlag = true;
1557} 1566}
1558void MainWindow::saveStopTimer() 1567void MainWindow::saveStopTimer()
1559{ 1568{
1560 mSaveTimer.stop(); 1569 mSaveTimer.stop();
1561 if (mSaveTimer.isActive() ) 1570 if (mSaveTimer.isActive() )
1562 qDebug("ti active "); 1571 qDebug("ti active ");
1563 else 1572 else
1564 qDebug("KO: Save timer stopped"); 1573 qDebug("KO: Save timer stopped");
1565} 1574}
1566void MainWindow::save() 1575void MainWindow::save()
1567{ 1576{
1568 if ( !mCalendarModifiedFlag ) { 1577 if ( !mCalendarModifiedFlag ) {
1569 qDebug("KO: Calendar not modified. Nothing saved."); 1578 qDebug("KO: Calendar not modified. Nothing saved.");
1570 return; 1579 return;
1571 } 1580 }
1572 if ( mSyncManager->blockSave() ) 1581 if ( mSyncManager->blockSave() )
1573 return; 1582 return;
1574 mSyncManager->setBlockSave(true); 1583 mSyncManager->setBlockSave(true);
1575 if ( mView->checkFileVersion( defaultFileName()) ) { 1584 if ( mView->checkFileVersion( defaultFileName()) ) {
1576 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1585 QTime neededSaveTime = QDateTime::currentDateTime().time();
1577 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1586 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1578 qDebug("KO: Start saving data to file!"); 1587 qDebug("KO: Start saving data to file!");
1579 mView->saveCalendar( defaultFileName() ); 1588 mView->saveCalendar( defaultFileName() );
1580 mCalendarModifiedFlag = false; 1589 mCalendarModifiedFlag = false;
1581 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1590 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1582 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1591 qDebug("KO: Needed %d ms for saving.",msNeeded );
1583 QString savemes; 1592 QString savemes;
1584 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1593 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1585 setCaption(savemes); 1594 setCaption(savemes);
1586 } else 1595 } else
1587 setCaption(i18n("Saving cancelled!")); 1596 setCaption(i18n("Saving cancelled!"));
1588 mSyncManager->setBlockSave( false ); 1597 mSyncManager->setBlockSave( false );
1589} 1598}
1590 1599
1591void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1600void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1592{ 1601{
1593 if ( !e->isAutoRepeat() ) { 1602 if ( !e->isAutoRepeat() ) {
1594 mFlagKeyPressed = false; 1603 mFlagKeyPressed = false;
1595 } 1604 }
1596} 1605}
1597void MainWindow::keyPressEvent ( QKeyEvent * e ) 1606void MainWindow::keyPressEvent ( QKeyEvent * e )
1598{ 1607{
1599 qApp->processEvents(); 1608 qApp->processEvents();
1600 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1609 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1601 e->ignore(); 1610 e->ignore();
1602 // qDebug(" ignore %d",e->isAutoRepeat() ); 1611 // qDebug(" ignore %d",e->isAutoRepeat() );
1603 return; 1612 return;
1604 } 1613 }
1605 if (! e->isAutoRepeat() ) 1614 if (! e->isAutoRepeat() )
1606 mFlagKeyPressed = true; 1615 mFlagKeyPressed = true;
1607 KOPrefs *p = KOPrefs::instance(); 1616 KOPrefs *p = KOPrefs::instance();
1608 bool showSelectedDates = false; 1617 bool showSelectedDates = false;
1609 int size; 1618 int size;
1610 int pro = 0; 1619 int pro = 0;
1611 //qDebug("MainWindow::keyPressEvent "); 1620 //qDebug("MainWindow::keyPressEvent ");
1612 switch ( e->key() ) { 1621 switch ( e->key() ) {
1613 case Qt::Key_Right: 1622 case Qt::Key_Right:
1614 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1623 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1615 mView->goNextMonth(); 1624 mView->goNextMonth();
1616 else 1625 else
1617 mView->goNext(); 1626 mView->goNext();
1618 showSelectedDates = true; 1627 showSelectedDates = true;
1619 break; 1628 break;
1620 case Qt::Key_Left: 1629 case Qt::Key_Left:
1621 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1630 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1622 mView->goPreviousMonth(); 1631 mView->goPreviousMonth();
1623 else 1632 else
1624 mView->goPrevious(); 1633 mView->goPrevious();
1625 showSelectedDates = true; 1634 showSelectedDates = true;
1626 break; 1635 break;
1627 case Qt::Key_Down: 1636 case Qt::Key_Down:
1628 mView->viewManager()->agendaView()->scrollOneHourDown(); 1637 mView->viewManager()->agendaView()->scrollOneHourDown();
1629 break; 1638 break;
1630 case Qt::Key_Up: 1639 case Qt::Key_Up:
1631 mView->viewManager()->agendaView()->scrollOneHourUp(); 1640 mView->viewManager()->agendaView()->scrollOneHourUp();
1632 break; 1641 break;
1633 case Qt::Key_K: 1642 case Qt::Key_K:
1634 mView->viewManager()->showMonthViewWeek(); 1643 mView->viewManager()->showMonthViewWeek();
1635 break; 1644 break;
1636 case Qt::Key_I: 1645 case Qt::Key_I:
1637 mView->showIncidence(); 1646 mView->showIncidence();
1638 break; 1647 break;
1639 case Qt::Key_Delete: 1648 case Qt::Key_Delete:
1640 case Qt::Key_Backspace: 1649 case Qt::Key_Backspace:
1641 mView->deleteIncidence(); 1650 mView->deleteIncidence();
1642 break; 1651 break;
1643 case Qt::Key_D: 1652 case Qt::Key_D:
1644 mView->viewManager()->showDayView(); 1653 mView->viewManager()->showDayView();
1645 showSelectedDates = true; 1654 showSelectedDates = true;
1646 break; 1655 break;
1647 case Qt::Key_O: 1656 case Qt::Key_O:
1648 mView->toggleFilerEnabled( ); 1657 mView->toggleFilerEnabled( );
1649 break; 1658 break;
1650 case Qt::Key_0: 1659 case Qt::Key_0:
1651 case Qt::Key_1: 1660 case Qt::Key_1:
1652 case Qt::Key_2: 1661 case Qt::Key_2:
1653 case Qt::Key_3: 1662 case Qt::Key_3:
1654 case Qt::Key_4: 1663 case Qt::Key_4:
1655 case Qt::Key_5: 1664 case Qt::Key_5:
1656 case Qt::Key_6: 1665 case Qt::Key_6:
1657 case Qt::Key_7: 1666 case Qt::Key_7:
1658 case Qt::Key_8: 1667 case Qt::Key_8:
1659 case Qt::Key_9: 1668 case Qt::Key_9:
1660 pro = e->key()-48; 1669 pro = e->key()-48;
1661 if ( pro == 0 ) 1670 if ( pro == 0 )
1662 pro = 10; 1671 pro = 10;
1663 if ( e->state() == Qt::ControlButton) 1672 if ( e->state() == Qt::ControlButton)
1664 pro += 10; 1673 pro += 10;
1665 break; 1674 break;
1666 case Qt::Key_M: 1675 case Qt::Key_M:
1667 mView->viewManager()->showMonthView(); 1676 mView->viewManager()->showMonthView();
1668 showSelectedDates = true; 1677 showSelectedDates = true;
1669 break; 1678 break;
1670 case Qt::Key_Insert: 1679 case Qt::Key_Insert:
1671 mView->newEvent(); 1680 mView->newEvent();
1672 break; 1681 break;
1673 case Qt::Key_S : 1682 case Qt::Key_S :
1674 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1683 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1675 mView->newSubTodo(); 1684 mView->newSubTodo();
1676 else 1685 else
1677 mView->dialogManager()->showSearchDialog(); 1686 mView->dialogManager()->showSearchDialog();
1678 break; 1687 break;
1679 case Qt::Key_Y : 1688 case Qt::Key_Y :
1680 case Qt::Key_Z : 1689 case Qt::Key_Z :
1681 mView->viewManager()->showWorkWeekView(); 1690 mView->viewManager()->showWorkWeekView();
1682 showSelectedDates = true; 1691 showSelectedDates = true;
1683 break; 1692 break;
1684 case Qt::Key_U : 1693 case Qt::Key_U :
1685 mView->viewManager()->showWeekView(); 1694 mView->viewManager()->showWeekView();
1686 showSelectedDates = true; 1695 showSelectedDates = true;
1687 break; 1696 break;
1688 case Qt::Key_H : 1697 case Qt::Key_H :
1689 keyBindings(); 1698 keyBindings();
1690 break; 1699 break;
1691 case Qt::Key_W: 1700 case Qt::Key_W:
1692 mView->viewManager()->showWhatsNextView(); 1701 mView->viewManager()->showWhatsNextView();
1693 break; 1702 break;
1694 case Qt::Key_L: 1703 case Qt::Key_L:
1695 mView->viewManager()->showListView(); 1704 mView->viewManager()->showListView();
1696 break; 1705 break;
1697 case Qt::Key_N: 1706 case Qt::Key_N:
1698 mView->viewManager()->showNextXView(); 1707 mView->viewManager()->showNextXView();
1699 showSelectedDates = true; 1708 showSelectedDates = true;
1700 break; 1709 break;
1701 case Qt::Key_V: 1710 case Qt::Key_V:
1702 mView->viewManager()->showTodoView(); 1711 mView->viewManager()->showTodoView();
1703 break; 1712 break;
1704 case Qt::Key_C: 1713 case Qt::Key_C:
1705 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1714 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1706 break; 1715 break;
1707 case Qt::Key_P: 1716 case Qt::Key_P:
1708 mView->showDatePicker( ); 1717 mView->showDatePicker( );
1709 break; 1718 break;
1710 case Qt::Key_F: 1719 case Qt::Key_F:
1711 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1720 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1712 mView->editFilters(); 1721 mView->editFilters();
1713 else 1722 else
1714 mView->toggleFilter(); 1723 mView->toggleFilter();
1715 break; 1724 break;