summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-02 15:12:43 (UTC)
committer zautrix <zautrix>2005-03-02 15:12:43 (UTC)
commit9e0ceaa58a686fb64f8133ffa9e73866e985a464 (patch) (unidiff)
tree794d5af071dba939d4ff6b27544274c36b5ecec5
parent6733b0548df446fade0a58d409d5f80314e5ed4b (diff)
downloadkdepimpi-9e0ceaa58a686fb64f8133ffa9e73866e985a464.zip
kdepimpi-9e0ceaa58a686fb64f8133ffa9e73866e985a464.tar.gz
kdepimpi-9e0ceaa58a686fb64f8133ffa9e73866e985a464.tar.bz2
print fix. added desktop Qtopia import
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
@@ -856,129 +856,129 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers,
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);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 2de7f28..006a8dd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -772,143 +772,143 @@ void MainWindow::initActions()
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() ) );
@@ -1448,140 +1448,149 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
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!"));