summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/timetrackerhowto.txt68
-rw-r--r--korganizer/mainwindow.cpp10
-rw-r--r--korganizer/mainwindow.h1
-rw-r--r--libkcal/todo.cpp4
4 files changed, 80 insertions, 3 deletions
diff --git a/bin/kdepim/timetrackerhowto.txt b/bin/kdepim/timetrackerhowto.txt
new file mode 100644
index 0000000..69fe1ea
--- a/dev/null
+++ b/bin/kdepim/timetrackerhowto.txt
@@ -0,0 +1,68 @@
1
2KO/Pi timetracker HowTo
3
4In KO/Pi you can set a todo in a "running" state to track your working time on that todo.
5This Howto is about to use that timetracking feature.
6
7CONTENT:
8
90) Tracking time - setting a todo to started and stopped
101) Getting the time information
112) Overview and analysis of the timetracking data
12
13********************************************
140) Tracking time - setting a todo to started
15********************************************
16
17To track time open the todo view in KO/Pi.
18There you can set a todo to the "running" state.
19You can do this by choosing "Start/Stop todo.." from the context menu for that todo or by double clicking on the start time or start date column of that todo.
20A started todo is displayed green and the start time and date values in the todo list are displaying the start time.
21If a parent todo with a running sub todo is displayed closed in the todo view that parent todo is displayed green as well.
22If a todo is running the running information is stored every five minutes (not configureable).
23(Nothing is changed in the todo itself: If the todo has a start datetime set only the display changes for the time this todo is set to running.)
24You can edit a running todo as usual.
25If you delete a running todo its running information is saved automatically
26You can set the todo to "stopped" in the same way.
27If a todo is set to "stopped" within 30 seconds after the start, nothing is stored.
28If a todo is set to stopped, its running information is stored in the directory
29<yourhome>/kdepim/apps/timetrackerdir/
30If you close the application all running todos are set to stopped and the running information is stored automatically.
31That does mean: If you start KO/Pi there will be no todo in the "running" state.
32
33********************************************
341) Getting the time information
35********************************************
36
37All data is stored in the dir
38<yourhome>/kdepim/apps/timetrackerdir/
39
40There are two kind of files:
41E.g.
4220050417-090628-libkcal-1503885238.271.ics
43and
44libkcal-1387036159.309.ics
45
46The filenames with the datetime at the beginning contains the actual tracking data:
47The datetime part of the filename is the start datetime of this run of that todo.
48The same value you can find in the file as "DTSTART" value.
49The end datetime of the tracking you can find in the file as the "DUE" value.
50
51A file without a datetime at the beginning
52(libkcal-1387036159.309.ics in our example)
53contains no timetracking information and contains only information about a parent todo of a todo with timetracking information.
54This file is needed to display the parent-child relationchip you can see in the KO/Pi todo view in the timetracking overview application:
55
56********************************************
572) Overview and analysis of the timetracking data
58********************************************
59
60Because every timetracking run is stored in a single file it is easy to merge the data from several computers of the same person or from several persons by copying all the files into the same directory.
61There is an application which reads the content of that directory and displays the running information of each todo in a so called timetable "Gantt" view.
62It makes it possible to create and print reports for specific time frames.
63The default display is exactly like the parent-child relationchip displayed in the KO/Pi todo view, but it is possible to sort items by categories and by attendees.
64This program will only be available for the desktop (Windows and Linux).
65This program is not free open source software.
66There are no decisions about the distribution model (licence model and price) yet.
67You can find more information about that program after the beginning of June 2005 at www.pi-sync.net.
68 \ No newline at end of file
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ffc4d9a..8e5d108 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -897,699 +897,707 @@ void MainWindow::initActions()
897 897
898 actionMenu->insertSeparator(); 898 actionMenu->insertSeparator();
899 899
900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
901 mShowAction->addTo( actionMenu ); 901 mShowAction->addTo( actionMenu );
902 connect( mShowAction, SIGNAL( activated() ), 902 connect( mShowAction, SIGNAL( activated() ),
903 mView, SLOT( showIncidence() ) ); 903 mView, SLOT( showIncidence() ) );
904 904
905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
906 mEditAction->addTo( actionMenu ); 906 mEditAction->addTo( actionMenu );
907 connect( mEditAction, SIGNAL( activated() ), 907 connect( mEditAction, SIGNAL( activated() ),
908 mView, SLOT( editIncidence() ) ); 908 mView, SLOT( editIncidence() ) );
909 909
910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
911 mDeleteAction->addTo( actionMenu ); 911 mDeleteAction->addTo( actionMenu );
912 connect( mDeleteAction, SIGNAL( activated() ), 912 connect( mDeleteAction, SIGNAL( activated() ),
913 mView, SLOT( deleteIncidence() ) ); 913 mView, SLOT( deleteIncidence() ) );
914 914
915 915
916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
917 mCloneAction->addTo( actionMenu ); 917 mCloneAction->addTo( actionMenu );
918 connect( mCloneAction, SIGNAL( activated() ), 918 connect( mCloneAction, SIGNAL( activated() ),
919 mView, SLOT( cloneIncidence() ) ); 919 mView, SLOT( cloneIncidence() ) );
920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
921 mMoveAction->addTo( actionMenu ); 921 mMoveAction->addTo( actionMenu );
922 connect( mMoveAction, SIGNAL( activated() ), 922 connect( mMoveAction, SIGNAL( activated() ),
923 mView, SLOT( moveIncidence() ) ); 923 mView, SLOT( moveIncidence() ) );
924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
925 mBeamAction->addTo( actionMenu ); 925 mBeamAction->addTo( actionMenu );
926 connect( mBeamAction, SIGNAL( activated() ), 926 connect( mBeamAction, SIGNAL( activated() ),
927 mView, SLOT( beamIncidence() ) ); 927 mView, SLOT( beamIncidence() ) );
928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
929 mCancelAction->addTo( actionMenu ); 929 mCancelAction->addTo( actionMenu );
930 connect( mCancelAction, SIGNAL( activated() ), 930 connect( mCancelAction, SIGNAL( activated() ),
931 mView, SLOT( toggleCancelIncidence() ) ); 931 mView, SLOT( toggleCancelIncidence() ) );
932 932
933 actionMenu->insertSeparator(); 933 actionMenu->insertSeparator();
934 934
935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
936 this ); 936 this );
937 action->addTo( actionMenu ); 937 action->addTo( actionMenu );
938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
939 939
940 icon = loadPixmap( pathString + "search" ); 940 icon = loadPixmap( pathString + "search" );
941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
943 search_action->addTo( actionMenu ); 943 search_action->addTo( actionMenu );
944 connect( search_action, SIGNAL( activated() ), 944 connect( search_action, SIGNAL( activated() ),
945 mView->dialogManager(), SLOT( showSearchDialog() ) ); 945 mView->dialogManager(), SLOT( showSearchDialog() ) );
946 946
947 947
948 948
949 if ( KOPrefs::instance()->mShowFullMenu ) { 949 if ( KOPrefs::instance()->mShowFullMenu ) {
950 actionMenu->insertSeparator(); 950 actionMenu->insertSeparator();
951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
952 952
953 } 953 }
954 // actionMenu->insertSeparator(); 954 // actionMenu->insertSeparator();
955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
956 this ); 956 this );
957 action->addTo( importMenu_X ); 957 action->addTo( importMenu_X );
958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
959 action = new QAction( "import_quick", i18n("Import last file"), 0, 959 action = new QAction( "import_quick", i18n("Import last file"), 0,
960 this ); 960 this );
961 action->addTo( importMenu_X ); 961 action->addTo( importMenu_X );
962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
963 importMenu_X->insertSeparator(); 963 importMenu_X->insertSeparator();
964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
965 this ); 965 this );
966 action->addTo( importMenu_X ); 966 action->addTo( importMenu_X );
967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
968 //#ifndef DESKTOP_VERSION 968 //#ifndef DESKTOP_VERSION
969 importMenu_X->insertSeparator(); 969 importMenu_X->insertSeparator();
970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
971 this ); 971 this );
972 action->addTo( importMenu_X ); 972 action->addTo( importMenu_X );
973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
974 //#else 974 //#else
975#ifdef _OL_IMPORT_ 975#ifdef _OL_IMPORT_
976 importMenu_X->insertSeparator(); 976 importMenu_X->insertSeparator();
977 action = new QAction( "import_ol", i18n("Import from OL"), 0, 977 action = new QAction( "import_ol", i18n("Import from OL"), 0,
978 this ); 978 this );
979 action->addTo( importMenu_X ); 979 action->addTo( importMenu_X );
980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
981#endif 981#endif
982 //#endif 982 //#endif
983 983
984 //importMenu->insertSeparator(); 984 //importMenu->insertSeparator();
985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
986 this ); 986 this );
987 action->addTo( importMenu ); 987 action->addTo( importMenu );
988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
989 989
990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
991 this ); 991 this );
992 action->addTo( importMenu ); 992 action->addTo( importMenu );
993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
994 importMenu->insertSeparator(); 994 importMenu->insertSeparator();
995 importMenu->insertItem( i18n("Import"), importMenu_X ); 995 importMenu->insertItem( i18n("Import"), importMenu_X );
996 //importMenu->insertSeparator(); 996 //importMenu->insertSeparator();
997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
998 this ); 998 this );
999 action->addTo( exportMenu_X ); 999 action->addTo( exportMenu_X );
1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1001 1001
1002 1002
1003 //LR 1003 //LR
1004 QPopupMenu *ex2phone = new QPopupMenu( this ); 1004 QPopupMenu *ex2phone = new QPopupMenu( this );
1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1009 1009
1010 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1010 importMenu->insertItem( i18n("Export"), exportMenu_X );
1011#ifndef DESKTOP_VERSION 1011#ifndef DESKTOP_VERSION
1012 //importMenu->insertSeparator(); 1012 //importMenu->insertSeparator();
1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1014 this ); 1014 this );
1015 brAction->addTo( beamMenu_X ); 1015 brAction->addTo( beamMenu_X );
1016 brAction->setToggleAction (true ) ; 1016 brAction->setToggleAction (true ) ;
1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1018 1018
1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1020 this ); 1020 this );
1021 action->addTo( beamMenu_X ); 1021 action->addTo( beamMenu_X );
1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1023 1023
1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1025 this ); 1025 this );
1026 action->addTo( beamMenu_X ); 1026 action->addTo( beamMenu_X );
1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1028 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1028 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1029#else 1029#else
1030 //importMenu->insertSeparator(); 1030 //importMenu->insertSeparator();
1031 icon = loadPixmap( pathString + "print" ); 1031 icon = loadPixmap( pathString + "print" );
1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1033 action->addTo( beamMenu_X ); 1033 action->addTo( beamMenu_X );
1034 connect( action, SIGNAL( activated() ), 1034 connect( action, SIGNAL( activated() ),
1035 this, SLOT( printCal() ) ); 1035 this, SLOT( printCal() ) );
1036 1036
1037 icon = loadPixmap( pathString + "print" ); 1037 icon = loadPixmap( pathString + "print" );
1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1039 action->addTo( beamMenu_X ); 1039 action->addTo( beamMenu_X );
1040 connect( action, SIGNAL( activated() ), 1040 connect( action, SIGNAL( activated() ),
1041 this, SLOT( printSel() ) ); 1041 this, SLOT( printSel() ) );
1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1043 action->addTo( beamMenu_X ); 1043 action->addTo( beamMenu_X );
1044 connect( action, SIGNAL( activated() ), 1044 connect( action, SIGNAL( activated() ),
1045 mView->viewManager(), SLOT( slotprintWNV() ) ); 1045 mView->viewManager(), SLOT( slotprintWNV() ) );
1046 1046
1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1048 action->addTo( beamMenu_X ); 1048 action->addTo( beamMenu_X );
1049 connect( action, SIGNAL( activated() ), 1049 connect( action, SIGNAL( activated() ),
1050 mView, SLOT( slotprintSelInc() ) ); 1050 mView, SLOT( slotprintSelInc() ) );
1051 1051
1052 1052
1053 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1053 importMenu->insertItem( i18n("Print"), beamMenu_X );
1054#endif 1054#endif
1055 importMenu->insertSeparator(); 1055 importMenu->insertSeparator();
1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1057 this ); 1057 this );
1058 action->addTo( importMenu ); 1058 action->addTo( importMenu );
1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1060 importMenu->insertSeparator(); 1060 importMenu->insertSeparator();
1061 action = new QAction( "beam all", i18n("Save"), 0, 1061 action = new QAction( "beam all", i18n("Save"), 0,
1062 this ); 1062 this );
1063 action->addTo( importMenu ); 1063 action->addTo( importMenu );
1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1066 this ); 1066 this );
1067 action->addTo( importMenu ); 1067 action->addTo( importMenu );
1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1069 1069
1070 //menuBar->insertItem( "Configure",configureMenu ); 1070 //menuBar->insertItem( "Configure",configureMenu );
1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1072 icon = loadPixmap( "korganizer/korganizer" ); 1072 icon = loadPixmap( "korganizer/korganizer" );
1073 1073
1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1075 action->addTo( helpMenu ); 1075 action->addTo( helpMenu );
1076 connect( action, SIGNAL( activated() ), 1076 connect( action, SIGNAL( activated() ),
1077 SLOT( whatsNew() ) ); 1077 SLOT( whatsNew() ) );
1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1079 action->addTo( helpMenu ); 1079 action->addTo( helpMenu );
1080 connect( action, SIGNAL( activated() ), 1080 connect( action, SIGNAL( activated() ),
1081 SLOT( features() ) ); 1081 SLOT( features() ) );
1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1083 action->addTo( helpMenu ); 1083 action->addTo( helpMenu );
1084 connect( action, SIGNAL( activated() ), 1084 connect( action, SIGNAL( activated() ),
1085 SLOT( keyBindings() ) ); 1085 SLOT( keyBindings() ) );
1086 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1086 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1087 action->addTo( helpMenu ); 1087 action->addTo( helpMenu );
1088 connect( action, SIGNAL( activated() ), 1088 connect( action, SIGNAL( activated() ),
1089 SLOT( storagehowto() ) ); 1089 SLOT( storagehowto() ) );
1090 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1091 action->addTo( helpMenu );
1092 connect( action, SIGNAL( activated() ),
1093 SLOT( timetrackinghowto() ) );
1090 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1094 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1091 action->addTo( helpMenu ); 1095 action->addTo( helpMenu );
1092 connect( action, SIGNAL( activated() ), 1096 connect( action, SIGNAL( activated() ),
1093 SLOT( synchowto() ) ); 1097 SLOT( synchowto() ) );
1094 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1098 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1095 action->addTo( helpMenu ); 1099 action->addTo( helpMenu );
1096 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1097 SLOT( kdesynchowto() ) ); 1101 SLOT( kdesynchowto() ) );
1098 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1102 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1099 action->addTo( helpMenu ); 1103 action->addTo( helpMenu );
1100 connect( action, SIGNAL( activated() ), 1104 connect( action, SIGNAL( activated() ),
1101 SLOT( multisynchowto() ) ); 1105 SLOT( multisynchowto() ) );
1102 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1106 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1103 action->addTo( helpMenu ); 1107 action->addTo( helpMenu );
1104 connect( action, SIGNAL( activated() ), 1108 connect( action, SIGNAL( activated() ),
1105 SLOT( aboutAutoSaving() ) ); 1109 SLOT( aboutAutoSaving() ) );
1106 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1110 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1107 action->addTo( helpMenu ); 1111 action->addTo( helpMenu );
1108 connect( action, SIGNAL( activated() ), 1112 connect( action, SIGNAL( activated() ),
1109 SLOT( aboutKnownBugs() ) ); 1113 SLOT( aboutKnownBugs() ) );
1110 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1114 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1111 action->addTo( helpMenu ); 1115 action->addTo( helpMenu );
1112 connect( action, SIGNAL( activated() ), 1116 connect( action, SIGNAL( activated() ),
1113 SLOT( usertrans() ) ); 1117 SLOT( usertrans() ) );
1114 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1118 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1115 action->addTo( helpMenu ); 1119 action->addTo( helpMenu );
1116 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1117 SLOT( faq() ) ); 1121 SLOT( faq() ) );
1118 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1122 action = new QAction( "licence", i18n("Licence..."), 0, this );
1119 action->addTo( helpMenu ); 1123 action->addTo( helpMenu );
1120 connect( action, SIGNAL( activated() ), 1124 connect( action, SIGNAL( activated() ),
1121 SLOT( licence() ) ); 1125 SLOT( licence() ) );
1122 action = new QAction( "about", i18n("About..."), 0, this ); 1126 action = new QAction( "about", i18n("About..."), 0, this );
1123 action->addTo( helpMenu ); 1127 action->addTo( helpMenu );
1124 connect( action, SIGNAL( activated() ), 1128 connect( action, SIGNAL( activated() ),
1125 SLOT( about() ) ); 1129 SLOT( about() ) );
1126 //menuBar->insertSeparator(); 1130 //menuBar->insertSeparator();
1127 1131
1128 // ****************************************************** 1132 // ******************************************************
1129 // menubar icons 1133 // menubar icons
1130 1134
1131 1135
1132 1136
1133 //menuBar->insertItem( iconToolBar ); 1137 //menuBar->insertItem( iconToolBar );
1134 //xdays_action 1138 //xdays_action
1135 if (p-> mShowIconNewEvent) 1139 if (p-> mShowIconNewEvent)
1136 ne_action->addTo( iconToolBar ); 1140 ne_action->addTo( iconToolBar );
1137 if (p->mShowIconNewTodo ) 1141 if (p->mShowIconNewTodo )
1138 nt_action->addTo( iconToolBar ); 1142 nt_action->addTo( iconToolBar );
1139 if (p-> mShowIconSearch) 1143 if (p-> mShowIconSearch)
1140 search_action->addTo( iconToolBar ); 1144 search_action->addTo( iconToolBar );
1141 if (p-> mShowIconWhatsThis) 1145 if (p-> mShowIconWhatsThis)
1142 QWhatsThis::whatsThisButton ( iconToolBar ); 1146 QWhatsThis::whatsThisButton ( iconToolBar );
1143 if (p-> mShowIconNext) 1147 if (p-> mShowIconNext)
1144 whatsnext_action->addTo( viewToolBar ); 1148 whatsnext_action->addTo( viewToolBar );
1145 if (p-> mShowIconNextDays) 1149 if (p-> mShowIconNextDays)
1146 xdays_action->addTo( viewToolBar ); 1150 xdays_action->addTo( viewToolBar );
1147 if (p-> mShowIconJournal) 1151 if (p-> mShowIconJournal)
1148 viewjournal_action->addTo( viewToolBar ); 1152 viewjournal_action->addTo( viewToolBar );
1149 if (p-> mShowIconDay1) 1153 if (p-> mShowIconDay1)
1150 day1_action->addTo( viewToolBar ); 1154 day1_action->addTo( viewToolBar );
1151 if (p-> mShowIconDay5) 1155 if (p-> mShowIconDay5)
1152 day5_action->addTo( viewToolBar ); 1156 day5_action->addTo( viewToolBar );
1153 if (p-> mShowIconDay7) 1157 if (p-> mShowIconDay7)
1154 day7_action->addTo( viewToolBar ); 1158 day7_action->addTo( viewToolBar );
1155 if (p-> mShowIconDay6) 1159 if (p-> mShowIconDay6)
1156 day6_action->addTo( viewToolBar ); 1160 day6_action->addTo( viewToolBar );
1157 if (p-> mShowIconMonth) 1161 if (p-> mShowIconMonth)
1158 month_action->addTo( viewToolBar ); 1162 month_action->addTo( viewToolBar );
1159 if (p-> mShowIconList) 1163 if (p-> mShowIconList)
1160 showlist_action->addTo( viewToolBar ); 1164 showlist_action->addTo( viewToolBar );
1161 if (p-> mShowIconTodoview) 1165 if (p-> mShowIconTodoview)
1162 todoview_action->addTo( viewToolBar ); 1166 todoview_action->addTo( viewToolBar );
1163 1167
1164 icon = loadPixmap( pathString + "2leftarrowB" ); 1168 icon = loadPixmap( pathString + "2leftarrowB" );
1165 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1169 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1166 if (p-> mShowIconBackFast) { 1170 if (p-> mShowIconBackFast) {
1167 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1171 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1168 connect( action, SIGNAL( activated() ), 1172 connect( action, SIGNAL( activated() ),
1169 mView, SLOT( goPreviousMonth() ) ); 1173 mView, SLOT( goPreviousMonth() ) );
1170 action->addTo( navigatorToolBar ); 1174 action->addTo( navigatorToolBar );
1171 } 1175 }
1172 icon = loadPixmap( pathString + "1leftarrowB" ); 1176 icon = loadPixmap( pathString + "1leftarrowB" );
1173 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1177 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1174 if (p-> mShowIconBack) { 1178 if (p-> mShowIconBack) {
1175 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1179 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1176 connect( action, SIGNAL( activated() ), 1180 connect( action, SIGNAL( activated() ),
1177 mView, SLOT( goPrevious() ) ); 1181 mView, SLOT( goPrevious() ) );
1178 action->addTo( navigatorToolBar ); 1182 action->addTo( navigatorToolBar );
1179 } 1183 }
1180 icon = loadPixmap( pathString + "today" ); 1184 icon = loadPixmap( pathString + "today" );
1181 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1185 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1182 if (p-> mShowIconToday) 1186 if (p-> mShowIconToday)
1183 today_action->addTo( navigatorToolBar ); 1187 today_action->addTo( navigatorToolBar );
1184 icon = loadPixmap( pathString + "1rightarrowB" ); 1188 icon = loadPixmap( pathString + "1rightarrowB" );
1185 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1189 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1186 if (p-> mShowIconForward) { 1190 if (p-> mShowIconForward) {
1187 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1191 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1188 connect( action, SIGNAL( activated() ), 1192 connect( action, SIGNAL( activated() ),
1189 mView, SLOT( goNext() ) ); 1193 mView, SLOT( goNext() ) );
1190 action->addTo( navigatorToolBar ); 1194 action->addTo( navigatorToolBar );
1191 } 1195 }
1192 icon = loadPixmap( pathString + "2rightarrowB" ); 1196 icon = loadPixmap( pathString + "2rightarrowB" );
1193 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1197 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1194 if (p-> mShowIconForwardFast) { 1198 if (p-> mShowIconForwardFast) {
1195 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1199 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1196 connect( action, SIGNAL( activated() ), 1200 connect( action, SIGNAL( activated() ),
1197 mView, SLOT( goNextMonth() ) ); 1201 mView, SLOT( goNextMonth() ) );
1198 action->addTo( navigatorToolBar ); 1202 action->addTo( navigatorToolBar );
1199 } 1203 }
1200 1204
1201 1205
1202 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1206 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1203 1207
1204 1208
1205 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1209 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1206 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1210 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1207 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1211 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1208 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1212 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1209 1213
1210 if (p-> mShowIconNewEvent) 1214 if (p-> mShowIconNewEvent)
1211 configureToolBarMenu->setItemChecked( 10, true ); 1215 configureToolBarMenu->setItemChecked( 10, true );
1212 if (p->mShowIconNewTodo ) 1216 if (p->mShowIconNewTodo )
1213 configureToolBarMenu->setItemChecked( 20, true ); 1217 configureToolBarMenu->setItemChecked( 20, true );
1214 if (p-> mShowIconSearch) 1218 if (p-> mShowIconSearch)
1215 configureToolBarMenu->setItemChecked( 120, true ); 1219 configureToolBarMenu->setItemChecked( 120, true );
1216 if (p-> mShowIconList) 1220 if (p-> mShowIconList)
1217 configureToolBarMenu->setItemChecked( 30, true ); 1221 configureToolBarMenu->setItemChecked( 30, true );
1218 if (p-> mShowIconDay1) 1222 if (p-> mShowIconDay1)
1219 configureToolBarMenu->setItemChecked( 40, true ); 1223 configureToolBarMenu->setItemChecked( 40, true );
1220 if (p-> mShowIconDay5) 1224 if (p-> mShowIconDay5)
1221 configureToolBarMenu->setItemChecked( 50, true ); 1225 configureToolBarMenu->setItemChecked( 50, true );
1222 if (p-> mShowIconDay6) 1226 if (p-> mShowIconDay6)
1223 configureToolBarMenu->setItemChecked( 75, true ); 1227 configureToolBarMenu->setItemChecked( 75, true );
1224 if (p-> mShowIconDay7) 1228 if (p-> mShowIconDay7)
1225 configureToolBarMenu->setItemChecked( 60, true ); 1229 configureToolBarMenu->setItemChecked( 60, true );
1226 if (p-> mShowIconMonth) 1230 if (p-> mShowIconMonth)
1227 configureToolBarMenu->setItemChecked( 70, true ); 1231 configureToolBarMenu->setItemChecked( 70, true );
1228 if (p-> mShowIconTodoview) 1232 if (p-> mShowIconTodoview)
1229 configureToolBarMenu->setItemChecked( 80, true ); 1233 configureToolBarMenu->setItemChecked( 80, true );
1230 if (p-> mShowIconBackFast) 1234 if (p-> mShowIconBackFast)
1231 configureToolBarMenu->setItemChecked( 200, true ); 1235 configureToolBarMenu->setItemChecked( 200, true );
1232 if (p-> mShowIconBack) 1236 if (p-> mShowIconBack)
1233 configureToolBarMenu->setItemChecked( 210, true ); 1237 configureToolBarMenu->setItemChecked( 210, true );
1234 if (p-> mShowIconToday) 1238 if (p-> mShowIconToday)
1235 configureToolBarMenu->setItemChecked( 130, true ); 1239 configureToolBarMenu->setItemChecked( 130, true );
1236 if (p-> mShowIconForward) 1240 if (p-> mShowIconForward)
1237 configureToolBarMenu->setItemChecked( 220, true ); 1241 configureToolBarMenu->setItemChecked( 220, true );
1238 if (p-> mShowIconForwardFast) 1242 if (p-> mShowIconForwardFast)
1239 configureToolBarMenu->setItemChecked( 230, true ); 1243 configureToolBarMenu->setItemChecked( 230, true );
1240 if (p-> mShowIconNextDays) 1244 if (p-> mShowIconNextDays)
1241 configureToolBarMenu->setItemChecked( 100, true ); 1245 configureToolBarMenu->setItemChecked( 100, true );
1242 if (p-> mShowIconNext) 1246 if (p-> mShowIconNext)
1243 configureToolBarMenu->setItemChecked( 110, true ); 1247 configureToolBarMenu->setItemChecked( 110, true );
1244 if (p-> mShowIconJournal) 1248 if (p-> mShowIconJournal)
1245 configureToolBarMenu->setItemChecked( 90, true ); 1249 configureToolBarMenu->setItemChecked( 90, true );
1246 if (p-> mShowIconWhatsThis) 1250 if (p-> mShowIconWhatsThis)
1247 configureToolBarMenu->setItemChecked( 300, true ); 1251 configureToolBarMenu->setItemChecked( 300, true );
1248 if (p-> mShowIconWeekNum) 1252 if (p-> mShowIconWeekNum)
1249 configureToolBarMenu->setItemChecked( 400, true ); 1253 configureToolBarMenu->setItemChecked( 400, true );
1250 if (!p-> mShowIconStretch) { 1254 if (!p-> mShowIconStretch) {
1251 QLabel* dummy = new QLabel( iconToolBar ); 1255 QLabel* dummy = new QLabel( iconToolBar );
1252 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1256 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1253 dummy->setMinimumWidth( 0 ); 1257 dummy->setMinimumWidth( 0 );
1254 iconToolBar->setStretchableWidget ( dummy ) ; 1258 iconToolBar->setStretchableWidget ( dummy ) ;
1255 } 1259 }
1256 else { 1260 else {
1257 iconToolBar->setHorizontalStretchable (true ); 1261 iconToolBar->setHorizontalStretchable (true );
1258 viewToolBar->setHorizontalStretchable (true ); 1262 viewToolBar->setHorizontalStretchable (true );
1259 navigatorToolBar->setHorizontalStretchable (true ); 1263 navigatorToolBar->setHorizontalStretchable (true );
1260 iconToolBar->setVerticalStretchable (true ); 1264 iconToolBar->setVerticalStretchable (true );
1261 viewToolBar->setVerticalStretchable (true ); 1265 viewToolBar->setVerticalStretchable (true );
1262 navigatorToolBar->setVerticalStretchable (true ); 1266 navigatorToolBar->setVerticalStretchable (true );
1263 configureToolBarMenu->setItemChecked( 5, true ); 1267 configureToolBarMenu->setItemChecked( 5, true );
1264 } 1268 }
1265 if (p-> mShowIconFilter) 1269 if (p-> mShowIconFilter)
1266 configureToolBarMenu->setItemChecked( 7, true ); 1270 configureToolBarMenu->setItemChecked( 7, true );
1267 if (p-> mShowIconOnetoolbar) 1271 if (p-> mShowIconOnetoolbar)
1268 configureToolBarMenu->setItemChecked( 6, true ); 1272 configureToolBarMenu->setItemChecked( 6, true );
1269 1273
1270 1274
1271 if ( filterMenubar ) 1275 if ( filterMenubar )
1272 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1276 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1273 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1277 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1274 configureAgenda( p->mHourSize ); 1278 configureAgenda( p->mHourSize );
1275 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1279 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1276} 1280}
1277 1281
1278void MainWindow::exportToPhone( int mode ) 1282void MainWindow::exportToPhone( int mode )
1279{ 1283{
1280 1284
1281 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1285 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1282 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1286 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1283 KOex2phonePrefs ex2phone; 1287 KOex2phonePrefs ex2phone;
1284 1288
1285 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1289 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1286 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1290 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1287 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1291 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1288 if ( mode == 1 ) 1292 if ( mode == 1 )
1289 ex2phone.setCaption(i18n("Export complete calendar")); 1293 ex2phone.setCaption(i18n("Export complete calendar"));
1290 if ( mode == 2 ) 1294 if ( mode == 2 )
1291 ex2phone.setCaption(i18n("Export filtered calendar")); 1295 ex2phone.setCaption(i18n("Export filtered calendar"));
1292 1296
1293 if ( !ex2phone.exec() ) { 1297 if ( !ex2phone.exec() ) {
1294 return; 1298 return;
1295 } 1299 }
1296 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1300 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1297 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1301 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1298 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1302 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1299 1303
1300 int inFuture = 0; 1304 int inFuture = 0;
1301 if ( ex2phone.mWriteBackFuture->isChecked() ) 1305 if ( ex2phone.mWriteBackFuture->isChecked() )
1302 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1306 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1303 QPtrList<Incidence> delSel; 1307 QPtrList<Incidence> delSel;
1304 if ( mode == 1 ) 1308 if ( mode == 1 )
1305 delSel = mCalendar->rawIncidences(); 1309 delSel = mCalendar->rawIncidences();
1306 if ( mode == 2 ) 1310 if ( mode == 2 )
1307 delSel = mCalendar->incidences(); 1311 delSel = mCalendar->incidences();
1308 CalendarLocal* cal = new CalendarLocal(); 1312 CalendarLocal* cal = new CalendarLocal();
1309 cal->setLocalTime(); 1313 cal->setLocalTime();
1310 Incidence *incidence = delSel.first(); 1314 Incidence *incidence = delSel.first();
1311 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1315 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1312 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1316 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1313 while ( incidence ) { 1317 while ( incidence ) {
1314 if ( incidence->type() != "Journal" ) { 1318 if ( incidence->type() != "Journal" ) {
1315 bool add = true; 1319 bool add = true;
1316 if ( inFuture ) { 1320 if ( inFuture ) {
1317 QDateTime dt; 1321 QDateTime dt;
1318 if ( incidence->type() == "Todo" ) { 1322 if ( incidence->type() == "Todo" ) {
1319 Todo * t = (Todo*)incidence; 1323 Todo * t = (Todo*)incidence;
1320 if ( t->hasDueDate() ) 1324 if ( t->hasDueDate() )
1321 dt = t->dtDue(); 1325 dt = t->dtDue();
1322 else 1326 else
1323 dt = cur.addSecs( 62 ); 1327 dt = cur.addSecs( 62 );
1324 } 1328 }
1325 else { 1329 else {
1326 bool ok; 1330 bool ok;
1327 dt = incidence->getNextOccurence( cur, &ok ); 1331 dt = incidence->getNextOccurence( cur, &ok );
1328 if ( !ok ) 1332 if ( !ok )
1329 dt = cur.addSecs( -62 ); 1333 dt = cur.addSecs( -62 );
1330 } 1334 }
1331 if ( dt < cur || dt > end ) { 1335 if ( dt < cur || dt > end ) {
1332 add = false; 1336 add = false;
1333 } 1337 }
1334 } 1338 }
1335 if ( add ) { 1339 if ( add ) {
1336 Incidence *in = incidence->clone(); 1340 Incidence *in = incidence->clone();
1337 cal->addIncidence( in ); 1341 cal->addIncidence( in );
1338 } 1342 }
1339 } 1343 }
1340 incidence = delSel.next(); 1344 incidence = delSel.next();
1341 } 1345 }
1342 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1346 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1343 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1347 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1344 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1348 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1345 1349
1346 setCaption( i18n("Writing to phone...")); 1350 setCaption( i18n("Writing to phone..."));
1347 if ( PhoneFormat::writeToPhone( cal ) ) 1351 if ( PhoneFormat::writeToPhone( cal ) )
1348 setCaption( i18n("Export to phone successful!")); 1352 setCaption( i18n("Export to phone successful!"));
1349 else 1353 else
1350 setCaption( i18n("Error exporting to phone!")); 1354 setCaption( i18n("Error exporting to phone!"));
1351 delete cal; 1355 delete cal;
1352} 1356}
1353 1357
1354 1358
1355void MainWindow::setDefaultPreferences() 1359void MainWindow::setDefaultPreferences()
1356{ 1360{
1357 KOPrefs *p = KOPrefs::instance(); 1361 KOPrefs *p = KOPrefs::instance();
1358 1362
1359 p->mCompactDialogs = true; 1363 p->mCompactDialogs = true;
1360 p->mConfirm = true; 1364 p->mConfirm = true;
1361 // p->mEnableQuickTodo = false; 1365 // p->mEnableQuickTodo = false;
1362 1366
1363} 1367}
1364 1368
1365QString MainWindow::resourcePath() 1369QString MainWindow::resourcePath()
1366{ 1370{
1367 return KGlobal::iconLoader()->iconPath(); 1371 return KGlobal::iconLoader()->iconPath();
1368} 1372}
1369 1373
1370void MainWindow::displayText( QString text ,QString cap ) 1374void MainWindow::displayText( QString text ,QString cap )
1371{ 1375{
1372 QDialog dia( this, "name", true ); ; 1376 QDialog dia( this, "name", true ); ;
1373 dia.setCaption( cap ); 1377 dia.setCaption( cap );
1374 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1378 QVBoxLayout* lay = new QVBoxLayout( &dia );
1375 lay->setSpacing( 3 ); 1379 lay->setSpacing( 3 );
1376 lay->setMargin( 3 ); 1380 lay->setMargin( 3 );
1377 QTextBrowser tb ( &dia ); 1381 QTextBrowser tb ( &dia );
1378 lay->addWidget( &tb ); 1382 lay->addWidget( &tb );
1379 tb.setText( text ); 1383 tb.setText( text );
1380#ifdef DESKTOP_VERSION 1384#ifdef DESKTOP_VERSION
1381 dia.resize( 640, 480); 1385 dia.resize( 640, 480);
1382#else 1386#else
1383 dia.showMaximized(); 1387 dia.showMaximized();
1384#endif 1388#endif
1385 dia.exec(); 1389 dia.exec();
1386} 1390}
1387 1391
1388void MainWindow::features() 1392void MainWindow::features()
1389{ 1393{
1390 1394
1391 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1395 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1392} 1396}
1393 1397
1394void MainWindow::usertrans() 1398void MainWindow::usertrans()
1395{ 1399{
1396 1400
1397 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1401 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1398} 1402}
1399 1403
1400void MainWindow::storagehowto() 1404void MainWindow::storagehowto()
1401{ 1405{
1402 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1406 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1403} 1407}
1408void MainWindow::timetrackinghowto()
1409{
1410 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1411}
1404void MainWindow::kdesynchowto() 1412void MainWindow::kdesynchowto()
1405{ 1413{
1406 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1414 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1407} 1415}
1408void MainWindow::multisynchowto() 1416void MainWindow::multisynchowto()
1409{ 1417{
1410 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1418 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1411} 1419}
1412void MainWindow::synchowto() 1420void MainWindow::synchowto()
1413{ 1421{
1414 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1422 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1415} 1423}
1416void MainWindow::faq() 1424void MainWindow::faq()
1417{ 1425{
1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1426 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1419 1427
1420} 1428}
1421void MainWindow::whatsNew() 1429void MainWindow::whatsNew()
1422{ 1430{
1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1431 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1424 1432
1425} 1433}
1426void MainWindow::licence() 1434void MainWindow::licence()
1427{ 1435{
1428 KApplication::showLicence(); 1436 KApplication::showLicence();
1429 1437
1430} 1438}
1431void MainWindow::about() 1439void MainWindow::about()
1432{ 1440{
1433 QString version; 1441 QString version;
1434#include <../version> 1442#include <../version>
1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1443 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1436 i18n("KOrganizer/Platform-independent\n") + 1444 i18n("KOrganizer/Platform-independent\n") +
1437 "(KO/Pi) " + version + " - " + 1445 "(KO/Pi) " + version + " - " +
1438 1446
1439#ifdef DESKTOP_VERSION 1447#ifdef DESKTOP_VERSION
1440 i18n("Desktop Edition\n") + 1448 i18n("Desktop Edition\n") +
1441#else 1449#else
1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1450 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1443#endif 1451#endif
1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1452 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1445} 1453}
1446void MainWindow::keyBindings() 1454void MainWindow::keyBindings()
1447{ 1455{
1448 QString cap = i18n("KO/Pi Keys + Colors"); 1456 QString cap = i18n("KO/Pi Keys + Colors");
1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1457 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1458 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1459 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1460 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1461 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1462 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1463 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1464 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1465 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1466 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1467 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1468 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1469 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1470 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1471 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1472 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1473 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1474 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1475 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1476 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1477 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1478 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1479 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1472 i18n("<p><h3>In agenda view:</h3></p>\n") + 1480 i18n("<p><h3>In agenda view:</h3></p>\n") +
1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1481 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1482 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1475 i18n("<p><h3>In todo view:</h3></p>\n") + 1483 i18n("<p><h3>In todo view:</h3></p>\n") +
1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1484 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1485 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1486 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1487 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1488 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1489 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1490 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1483 i18n("<p><h3>In list view:</h3></p>\n") + 1491 i18n("<p><h3>In list view:</h3></p>\n") +
1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1492 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1493 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1494 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1495 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1496 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1497 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1498 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1499 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1500 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1493 i18n("<p><b>E</b>: Edit item</p>\n") + 1501 i18n("<p><b>E</b>: Edit item</p>\n") +
1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1502 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1503 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1504 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1505 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1506 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1507 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1508 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1509 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1502 i18n("<p><b>White</b>: Item readonly</p>\n"); 1510 i18n("<p><b>White</b>: Item readonly</p>\n");
1503 displayText( text, cap); 1511 displayText( text, cap);
1504} 1512}
1505void MainWindow::aboutAutoSaving() 1513void MainWindow::aboutAutoSaving()
1506{ 1514{
1507 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"); 1515 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");
1508 1516
1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1517 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1510 1518
1511} 1519}
1512void MainWindow::aboutKnownBugs() 1520void MainWindow::aboutKnownBugs()
1513{ 1521{
1514 QMessageBox* msg; 1522 QMessageBox* msg;
1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1523 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1516 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")+ 1524 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")+
1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1525 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1526 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1519 i18n("\nor report them in the bugtracker on\n") + 1527 i18n("\nor report them in the bugtracker on\n") +
1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1528 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1521 QMessageBox::NoIcon, 1529 QMessageBox::NoIcon,
1522 QMessageBox::Ok, 1530 QMessageBox::Ok,
1523 QMessageBox::NoButton, 1531 QMessageBox::NoButton,
1524 QMessageBox::NoButton); 1532 QMessageBox::NoButton);
1525 msg->exec(); 1533 msg->exec();
1526 delete msg; 1534 delete msg;
1527 1535
1528} 1536}
1529 1537
1530QString MainWindow::defaultFileName() 1538QString MainWindow::defaultFileName()
1531{ 1539{
1532 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1540 return locateLocal( "data", "korganizer/mycalendar.ics" );
1533} 1541}
1534QString MainWindow::syncFileName() 1542QString MainWindow::syncFileName()
1535{ 1543{
1536#ifdef DESKTOP_VERSION 1544#ifdef DESKTOP_VERSION
1537 return locateLocal( "tmp", "synccalendar.ics" ); 1545 return locateLocal( "tmp", "synccalendar.ics" );
1538#else 1546#else
1539 return QString( "/tmp/synccalendar.ics" ); 1547 return QString( "/tmp/synccalendar.ics" );
1540#endif 1548#endif
1541} 1549}
1542#include "koglobals.h" 1550#include "koglobals.h"
1543#include <kcalendarsystem.h> 1551#include <kcalendarsystem.h>
1544void MainWindow::updateWeek(QDate seda) 1552void MainWindow::updateWeek(QDate seda)
1545{ 1553{
1546 int weekNum = KGlobal::locale()->weekNum ( seda ); 1554 int weekNum = KGlobal::locale()->weekNum ( seda );
1547 mWeekPixmap.fill( mWeekBgColor ); 1555 mWeekPixmap.fill( mWeekBgColor );
1548 QPainter p ( &mWeekPixmap ); 1556 QPainter p ( &mWeekPixmap );
1549 p.setFont( mWeekFont ); 1557 p.setFont( mWeekFont );
1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1558 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1551 p.end(); 1559 p.end();
1552 QIconSet icon3 ( mWeekPixmap ); 1560 QIconSet icon3 ( mWeekPixmap );
1553 mWeekAction->setIconSet ( icon3 ); 1561 mWeekAction->setIconSet ( icon3 );
1554 1562
1555} 1563}
1556void MainWindow::updateWeekNum(const DateList &selectedDates) 1564void MainWindow::updateWeekNum(const DateList &selectedDates)
1557{ 1565{
1558 updateWeek( selectedDates.first() ); 1566 updateWeek( selectedDates.first() );
1559} 1567}
1560void MainWindow::processIncidenceSelection( Incidence *incidence ) 1568void MainWindow::processIncidenceSelection( Incidence *incidence )
1561{ 1569{
1562 1570
1563 if ( !incidence ) { 1571 if ( !incidence ) {
1564 enableIncidenceActions( false ); 1572 enableIncidenceActions( false );
1565 1573
1566 mNewSubTodoAction->setEnabled( false ); 1574 mNewSubTodoAction->setEnabled( false );
1567 setCaptionToDates(); 1575 setCaptionToDates();
1568 return; 1576 return;
1569 1577
1570 } 1578 }
1571 1579
1572 //KGlobal::locale()->formatDateTime(nextA, true); 1580 //KGlobal::locale()->formatDateTime(nextA, true);
1573 QString startString = ""; 1581 QString startString = "";
1574 if ( incidence->type() != "Todo" ) { 1582 if ( incidence->type() != "Todo" ) {
1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1583 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1576 if ( incidence->doesFloat() ) { 1584 if ( incidence->doesFloat() ) {
1577 startString += ": "+incidence->dtStartDateStr( true ); 1585 startString += ": "+incidence->dtStartDateStr( true );
1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1586 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1579 1587
1580 } else { 1588 } else {
1581 startString = ": "+incidence->dtStartStr(true); 1589 startString = ": "+incidence->dtStartStr(true);
1582 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1590 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1583 1591
1584 } 1592 }
1585 1593
1586 } else { 1594 } else {
1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1595 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1596 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1597 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1590 1598
1591 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1599 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1592 bool ok; 1600 bool ok;
1593 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1601 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1594 if ( ok ) { 1602 if ( ok ) {
1595 int years = noc.date().year() - incidence->dtStart().date().year(); 1603 int years = noc.date().year() - incidence->dtStart().date().year();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 3151f50..f2a6c60 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,174 +1,175 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27class QPEMenuBar; 27class QPEMenuBar;
28 28
29 29
30namespace KCal { 30namespace KCal {
31class CalendarLocal; 31class CalendarLocal;
32} 32}
33 33
34class KOMenuBar : public QMenuBar 34class KOMenuBar : public QMenuBar
35{ 35{
36 public: 36 public:
37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
39}; 39};
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43class MainWindow : public QMainWindow 43class MainWindow : public QMainWindow
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 public: 46 public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
48 ~MainWindow(); 48 ~MainWindow();
49 bool beamReceiveEnabled(); 49 bool beamReceiveEnabled();
50 static QString defaultFileName(); 50 static QString defaultFileName();
51 static QString syncFileName(); 51 static QString syncFileName();
52 static QString resourcePath(); 52 static QString resourcePath();
53 public slots: 53 public slots:
54 void setCaption ( const QString & ); 54 void setCaption ( const QString & );
55 void updateWeekNum(const KCal::DateList &); 55 void updateWeekNum(const KCal::DateList &);
56 void updateWeek(QDate); 56 void updateWeek(QDate);
57 void updateFilterToolbar(); 57 void updateFilterToolbar();
58 virtual void showMaximized (); 58 virtual void showMaximized ();
59 void configureAgenda( int ); 59 void configureAgenda( int );
60 void recieve( const QCString& msg, const QByteArray& data ); 60 void recieve( const QCString& msg, const QByteArray& data );
61 protected slots: 61 protected slots:
62 void setCaptionToDates(); 62 void setCaptionToDates();
63 void weekAction(); 63 void weekAction();
64 void about(); 64 void about();
65 void licence(); 65 void licence();
66 void faq(); 66 void faq();
67 void usertrans(); 67 void usertrans();
68 void features(); 68 void features();
69 void synchowto(); 69 void synchowto();
70 void storagehowto(); 70 void storagehowto();
71 void timetrackinghowto();
71 void kdesynchowto(); 72 void kdesynchowto();
72 void multisynchowto(); 73 void multisynchowto();
73 void whatsNew(); 74 void whatsNew();
74 void keyBindings(); 75 void keyBindings();
75 void aboutAutoSaving();; 76 void aboutAutoSaving();;
76 void aboutKnownBugs(); 77 void aboutKnownBugs();
77 78
78 void processIncidenceSelection( Incidence * ); 79 void processIncidenceSelection( Incidence * );
79 80
80 void importQtopia(); 81 void importQtopia();
81 void importBday(); 82 void importBday();
82 void importOL(); 83 void importOL();
83 void importIcal(); 84 void importIcal();
84 void importFile( QString, bool ); 85 void importFile( QString, bool );
85 void quickImportIcal(); 86 void quickImportIcal();
86 87
87 void slotModifiedChanged( bool ); 88 void slotModifiedChanged( bool );
88 89
89 void save(); 90 void save();
90 void saveStopTimer(); 91 void saveStopTimer();
91 void configureToolBar( int ); 92 void configureToolBar( int );
92 void printSel(); 93 void printSel();
93 void printCal(); 94 void printCal();
94 void saveCalendar(); 95 void saveCalendar();
95 void loadCalendar(); 96 void loadCalendar();
96 void exportVCalendar(); 97 void exportVCalendar();
97 void fillFilterMenu(); 98 void fillFilterMenu();
98 void fillFilterMenuTB(); 99 void fillFilterMenuTB();
99 void selectFilter( int ); 100 void selectFilter( int );
100 void fillFilterMenuPopup(); 101 void fillFilterMenuPopup();
101 void selectFilterPopup( int ); 102 void selectFilterPopup( int );
102 void exportToPhone( int ); 103 void exportToPhone( int );
103 void toggleBeamReceive(); 104 void toggleBeamReceive();
104 void disableBR(bool); 105 void disableBR(bool);
105 signals: 106 signals:
106 void selectWeek ( int ); 107 void selectWeek ( int );
107 private slots: 108 private slots:
108 void showConfigureAgenda(); 109 void showConfigureAgenda();
109 void getFile( bool ); 110 void getFile( bool );
110 void syncFileRequest(); 111 void syncFileRequest();
111 112
112 protected: 113 protected:
113 void hideEvent ( QHideEvent * ); 114 void hideEvent ( QHideEvent * );
114 QString sentSyncFile(); 115 QString sentSyncFile();
115 void displayText( QString, QString); 116 void displayText( QString, QString);
116 void enableIncidenceActions( bool ); 117 void enableIncidenceActions( bool );
117 118
118 private: 119 private:
119 bool mBRdisabled; 120 bool mBRdisabled;
120#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
121 QCopChannel* infrared; 122 QCopChannel* infrared;
122#endif 123#endif
123 QAction* brAction; 124 QAction* brAction;
124 KSyncManager* mSyncManager; 125 KSyncManager* mSyncManager;
125 bool mClosed; 126 bool mClosed;
126 void saveOnClose(); 127 void saveOnClose();
127 bool mFlagKeyPressed; 128 bool mFlagKeyPressed;
128 bool mBlockAtStartup; 129 bool mBlockAtStartup;
129 QPEToolBar *iconToolBar; 130 QPEToolBar *iconToolBar;
130 QPEToolBar *viewToolBar; 131 QPEToolBar *viewToolBar;
131 QPEToolBar *navigatorToolBar; 132 QPEToolBar *navigatorToolBar;
132 QPEToolBar *filterToolBar; 133 QPEToolBar *filterToolBar;
133 QPEMenuBar *filterMenubar; 134 QPEMenuBar *filterMenubar;
134 QPopupMenu * filterPopupMenu; 135 QPopupMenu * filterPopupMenu;
135 void initActions(); 136 void initActions();
136 void setDefaultPreferences(); 137 void setDefaultPreferences();
137 void resizeEvent( QResizeEvent* e); 138 void resizeEvent( QResizeEvent* e);
138 void keyPressEvent ( QKeyEvent * ) ; 139 void keyPressEvent ( QKeyEvent * ) ;
139 void keyReleaseEvent ( QKeyEvent * ) ; 140 void keyReleaseEvent ( QKeyEvent * ) ;
140 QPopupMenu *configureToolBarMenu; 141 QPopupMenu *configureToolBarMenu;
141 QPopupMenu *selectFilterMenu; 142 QPopupMenu *selectFilterMenu;
142 QPopupMenu *selectFilterMenuTB; 143 QPopupMenu *selectFilterMenuTB;
143 QPopupMenu *configureAgendaMenu, *syncMenu; 144 QPopupMenu *configureAgendaMenu, *syncMenu;
144 CalendarLocal *mCalendar; 145 CalendarLocal *mCalendar;
145 CalendarView *mView; 146 CalendarView *mView;
146 QAction *mNewSubTodoAction; 147 QAction *mNewSubTodoAction;
147 QAction *mWeekAction; 148 QAction *mWeekAction;
148 QFont mWeekFont; 149 QFont mWeekFont;
149 QPixmap mWeekPixmap; 150 QPixmap mWeekPixmap;
150 QColor mWeekBgColor; 151 QColor mWeekBgColor;
151 152
152 QAction *mShowAction; 153 QAction *mShowAction;
153 QAction *mEditAction; 154 QAction *mEditAction;
154 QAction *mDeleteAction; 155 QAction *mDeleteAction;
155 QAction *mCloneAction; 156 QAction *mCloneAction;
156 QAction *mMoveAction; 157 QAction *mMoveAction;
157 QAction *mBeamAction; 158 QAction *mBeamAction;
158 QAction *mCancelAction; 159 QAction *mCancelAction;
159 160
160 QAction *mToggleNav; 161 QAction *mToggleNav;
161 QAction *mToggleFilter; 162 QAction *mToggleFilter;
162 QAction *mToggleAllday; 163 QAction *mToggleAllday;
163 QAction *actionFilterMenuTB; 164 QAction *actionFilterMenuTB;
164 165
165 void closeEvent( QCloseEvent* ce ); 166 void closeEvent( QCloseEvent* ce );
166 SimpleAlarmClient mAlarmClient; 167 SimpleAlarmClient mAlarmClient;
167 QTimer mSaveTimer; 168 QTimer mSaveTimer;
168 //bool mBlockSaveFlag; 169 //bool mBlockSaveFlag;
169 bool mCalendarModifiedFlag; 170 bool mCalendarModifiedFlag;
170 QPixmap loadPixmap( QString ); 171 QPixmap loadPixmap( QString );
171}; 172};
172 173
173 174
174#endif 175#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 6a6c137..002d3f2 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -1,324 +1,324 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <kglobalsettings.h> 22#include <kglobalsettings.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kdebug.h> 24#include <kdebug.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27 27
28#include "calendarlocal.h" 28#include "calendarlocal.h"
29#include "icalformat.h" 29#include "icalformat.h"
30#include "todo.h" 30#include "todo.h"
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34Todo::Todo(): QObject(), Incidence() 34Todo::Todo(): QObject(), Incidence()
35{ 35{
36// mStatus = TENTATIVE; 36// mStatus = TENTATIVE;
37 37
38 mHasDueDate = false; 38 mHasDueDate = false;
39 setHasStartDate( false ); 39 setHasStartDate( false );
40 mCompleted = getEvenTime(QDateTime::currentDateTime()); 40 mCompleted = getEvenTime(QDateTime::currentDateTime());
41 mHasCompletedDate = false; 41 mHasCompletedDate = false;
42 mPercentComplete = 0; 42 mPercentComplete = 0;
43 mRunning = false; 43 mRunning = false;
44 mRunSaveTimer = 0; 44 mRunSaveTimer = 0;
45} 45}
46 46
47Todo::Todo(const Todo &t) : QObject(),Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
48{ 48{
49 mDtDue = t.mDtDue; 49 mDtDue = t.mDtDue;
50 mHasDueDate = t.mHasDueDate; 50 mHasDueDate = t.mHasDueDate;
51 mCompleted = t.mCompleted; 51 mCompleted = t.mCompleted;
52 mHasCompletedDate = t.mHasCompletedDate; 52 mHasCompletedDate = t.mHasCompletedDate;
53 mPercentComplete = t.mPercentComplete; 53 mPercentComplete = t.mPercentComplete;
54 mRunning = false; 54 mRunning = false;
55 mRunSaveTimer = 0; 55 mRunSaveTimer = 0;
56} 56}
57 57
58Todo::~Todo() 58Todo::~Todo()
59{ 59{
60 setRunning( false ); 60 setRunning( false );
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunning( bool run ) 64void Todo::setRunning( bool run )
65{ 65{
66 if ( run == mRunning ) 66 if ( run == mRunning )
67 return; 67 return;
68 //qDebug("Todo::setRunning %d ", run); 68 //qDebug("Todo::setRunning %d ", run);
69 if ( !mRunSaveTimer ) { 69 if ( !mRunSaveTimer ) {
70 mRunSaveTimer = new QTimer ( this ); 70 mRunSaveTimer = new QTimer ( this );
71 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 71 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
72 } 72 }
73 mRunning = run; 73 mRunning = run;
74 if ( mRunning ) { 74 if ( mRunning ) {
75 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 75 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
76 mRunStart = QDateTime::currentDateTime(); 76 mRunStart = QDateTime::currentDateTime();
77 } else { 77 } else {
78 mRunSaveTimer->stop(); 78 mRunSaveTimer->stop();
79 saveRunningInfoToFile(); 79 saveRunningInfoToFile();
80 } 80 }
81} 81}
82 82
83void Todo::saveRunningInfoToFile() 83void Todo::saveRunningInfoToFile()
84{ 84{
85 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 85 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
86 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { 86 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) {
87 qDebug("Running time < 30 seconds. Skipped. "); 87 qDebug("Running time < 30 seconds. Skipped. ");
88 return; 88 return;
89 } 89 }
90 QString dir = KGlobalSettings::timeTrackerDir(); 90 QString dir = KGlobalSettings::timeTrackerDir();
91 //qDebug("%s ", dir.latin1()); 91 //qDebug("%s ", dir.latin1());
92 QString file = "%1%2%3-%4%5%6-"; 92 QString file = "%1%2%3-%4%5%6-";
93 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 93 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
94 file.replace ( QRegExp (" "), "0" ); 94 file.replace ( QRegExp (" "), "0" );
95 file += uid(); 95 file += uid();
96 //qDebug("File %s ",file.latin1() ); 96 //qDebug("File %s ",file.latin1() );
97 CalendarLocal cal; 97 CalendarLocal cal;
98 cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); 98 cal.setLocalTime();
99 Todo * to = (Todo*) clone(); 99 Todo * to = (Todo*) clone();
100 to->setFloats( false ); 100 to->setFloats( false );
101 to->setDtStart( mRunStart ); 101 to->setDtStart( mRunStart );
102 to->setHasStartDate( true ); 102 to->setHasStartDate( true );
103 to->setDtDue( QDateTime::currentDateTime() ); 103 to->setDtDue( QDateTime::currentDateTime() );
104 to->setHasDueDate( true ); 104 to->setHasDueDate( true );
105 to->setUid( file ); 105 to->setUid( file );
106 cal.addIncidence( to ); 106 cal.addIncidence( to );
107 ICalFormat format; 107 ICalFormat format;
108 file = dir +"/" +file +".ics"; 108 file = dir +"/" +file +".ics";
109 format.save( &cal, file ); 109 format.save( &cal, file );
110 saveParents(); 110 saveParents();
111 111
112} 112}
113void Todo::saveParents() 113void Todo::saveParents()
114{ 114{
115 if (!relatedTo() ) 115 if (!relatedTo() )
116 return; 116 return;
117 Incidence * inc = relatedTo(); 117 Incidence * inc = relatedTo();
118 if ( inc->type() != "Todo" ) 118 if ( inc->type() != "Todo" )
119 return; 119 return;
120 Todo* to = (Todo*)inc; 120 Todo* to = (Todo*)inc;
121 bool saveTodo = false; 121 bool saveTodo = false;
122 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 122 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
123 QFileInfo fi ( file ); 123 QFileInfo fi ( file );
124 if ( fi.exists() ) { 124 if ( fi.exists() ) {
125 if ( fi.lastModified () < to->lastModified ()) 125 if ( fi.lastModified () < to->lastModified ())
126 saveTodo = true; 126 saveTodo = true;
127 } else { 127 } else {
128 saveTodo = true; 128 saveTodo = true;
129 } 129 }
130 if ( saveTodo ) { 130 if ( saveTodo ) {
131 CalendarLocal cal; 131 CalendarLocal cal;
132 cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); 132 cal.setLocalTime();
133 Todo * par = (Todo *) to->clone(); 133 Todo * par = (Todo *) to->clone();
134 cal.addIncidence( par ); 134 cal.addIncidence( par );
135 ICalFormat format; 135 ICalFormat format;
136 format.save( &cal, file ); 136 format.save( &cal, file );
137 } 137 }
138 to->saveParents(); 138 to->saveParents();
139} 139}
140 140
141int Todo::runTime() 141int Todo::runTime()
142{ 142{
143 if ( !mRunning ) 143 if ( !mRunning )
144 return 0; 144 return 0;
145 return mRunStart.secsTo( QDateTime::currentDateTime() ); 145 return mRunStart.secsTo( QDateTime::currentDateTime() );
146} 146}
147bool Todo::hasRunningSub() 147bool Todo::hasRunningSub()
148{ 148{
149 if ( mRunning ) 149 if ( mRunning )
150 return true; 150 return true;
151 Incidence *aTodo; 151 Incidence *aTodo;
152 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 152 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
153 if ( ((Todo*)aTodo)->hasRunningSub() ) 153 if ( ((Todo*)aTodo)->hasRunningSub() )
154 return true; 154 return true;
155 } 155 }
156 return false; 156 return false;
157} 157}
158Incidence *Todo::clone() 158Incidence *Todo::clone()
159{ 159{
160 return new Todo(*this); 160 return new Todo(*this);
161} 161}
162 162
163bool Todo::contains ( Todo* from ) 163bool Todo::contains ( Todo* from )
164{ 164{
165 165
166 if ( !from->summary().isEmpty() ) 166 if ( !from->summary().isEmpty() )
167 if ( !summary().startsWith( from->summary() )) 167 if ( !summary().startsWith( from->summary() ))
168 return false; 168 return false;
169 if ( from->hasStartDate() ) { 169 if ( from->hasStartDate() ) {
170 if ( !hasStartDate() ) 170 if ( !hasStartDate() )
171 return false; 171 return false;
172 if ( from->dtStart() != dtStart()) 172 if ( from->dtStart() != dtStart())
173 return false; 173 return false;
174 } 174 }
175 if ( from->hasDueDate() ){ 175 if ( from->hasDueDate() ){
176 if ( !hasDueDate() ) 176 if ( !hasDueDate() )
177 return false; 177 return false;
178 if ( from->dtDue() != dtDue()) 178 if ( from->dtDue() != dtDue())
179 return false; 179 return false;
180 } 180 }
181 if ( !from->location().isEmpty() ) 181 if ( !from->location().isEmpty() )
182 if ( !location().startsWith( from->location() ) ) 182 if ( !location().startsWith( from->location() ) )
183 return false; 183 return false;
184 if ( !from->description().isEmpty() ) 184 if ( !from->description().isEmpty() )
185 if ( !description().startsWith( from->description() )) 185 if ( !description().startsWith( from->description() ))
186 return false; 186 return false;
187 if ( from->alarms().count() ) { 187 if ( from->alarms().count() ) {
188 Alarm *a = from->alarms().first(); 188 Alarm *a = from->alarms().first();
189 if ( a->enabled() ){ 189 if ( a->enabled() ){
190 if ( !alarms().count() ) 190 if ( !alarms().count() )
191 return false; 191 return false;
192 Alarm *b = alarms().first(); 192 Alarm *b = alarms().first();
193 if( ! b->enabled() ) 193 if( ! b->enabled() )
194 return false; 194 return false;
195 if ( ! (a->offset() == b->offset() )) 195 if ( ! (a->offset() == b->offset() ))
196 return false; 196 return false;
197 } 197 }
198 } 198 }
199 199
200 QStringList cat = categories(); 200 QStringList cat = categories();
201 QStringList catFrom = from->categories(); 201 QStringList catFrom = from->categories();
202 QString nCat; 202 QString nCat;
203 unsigned int iii; 203 unsigned int iii;
204 for ( iii = 0; iii < catFrom.count();++iii ) { 204 for ( iii = 0; iii < catFrom.count();++iii ) {
205 nCat = catFrom[iii]; 205 nCat = catFrom[iii];
206 if ( !nCat.isEmpty() ) 206 if ( !nCat.isEmpty() )
207 if ( !cat.contains( nCat )) { 207 if ( !cat.contains( nCat )) {
208 return false; 208 return false;
209 } 209 }
210 } 210 }
211 if ( from->isCompleted() ) { 211 if ( from->isCompleted() ) {
212 if ( !isCompleted() ) 212 if ( !isCompleted() )
213 return false; 213 return false;
214 } 214 }
215 if( priority() != from->priority() ) 215 if( priority() != from->priority() )
216 return false; 216 return false;
217 217
218 218
219 return true; 219 return true;
220 220
221} 221}
222bool KCal::operator==( const Todo& t1, const Todo& t2 ) 222bool KCal::operator==( const Todo& t1, const Todo& t2 )
223{ 223{
224 224
225 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 225 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
226 if ( ! ret ) 226 if ( ! ret )
227 return false; 227 return false;
228 if ( t1.hasDueDate() == t2.hasDueDate() ) { 228 if ( t1.hasDueDate() == t2.hasDueDate() ) {
229 if ( t1.hasDueDate() ) { 229 if ( t1.hasDueDate() ) {
230 if ( t1.doesFloat() == t2.doesFloat() ) { 230 if ( t1.doesFloat() == t2.doesFloat() ) {
231 if ( t1.doesFloat() ) { 231 if ( t1.doesFloat() ) {
232 if ( t1.dtDue().date() != t2.dtDue().date() ) 232 if ( t1.dtDue().date() != t2.dtDue().date() )
233 return false; 233 return false;
234 } else 234 } else
235 if ( t1.dtDue() != t2.dtDue() ) 235 if ( t1.dtDue() != t2.dtDue() )
236 return false; 236 return false;
237 } else 237 } else
238 return false;// float != 238 return false;// float !=
239 } 239 }
240 240
241 } else 241 } else
242 return false; 242 return false;
243 if ( t1.percentComplete() != t2.percentComplete() ) 243 if ( t1.percentComplete() != t2.percentComplete() )
244 return false; 244 return false;
245 if ( t1.isCompleted() ) { 245 if ( t1.isCompleted() ) {
246 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 246 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
247 if ( t1.hasCompletedDate() ) { 247 if ( t1.hasCompletedDate() ) {
248 if ( t1.completed() != t2.completed() ) 248 if ( t1.completed() != t2.completed() )
249 return false; 249 return false;
250 } 250 }
251 251
252 } else 252 } else
253 return false; 253 return false;
254 } 254 }
255 return true; 255 return true;
256 256
257} 257}
258 258
259void Todo::setDtDue(const QDateTime &dtDue) 259void Todo::setDtDue(const QDateTime &dtDue)
260{ 260{
261 //int diffsecs = mDtDue.secsTo(dtDue); 261 //int diffsecs = mDtDue.secsTo(dtDue);
262 262
263 /*if (mReadOnly) return; 263 /*if (mReadOnly) return;
264 const QPtrList<Alarm>& alarms = alarms(); 264 const QPtrList<Alarm>& alarms = alarms();
265 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 265 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
266 if (alarm->enabled()) { 266 if (alarm->enabled()) {
267 alarm->setTime(alarm->time().addSecs(diffsecs)); 267 alarm->setTime(alarm->time().addSecs(diffsecs));
268 } 268 }
269 }*/ 269 }*/
270 mDtDue = getEvenTime(dtDue); 270 mDtDue = getEvenTime(dtDue);
271 271
272 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 272 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;
273 273
274 /*const QPtrList<Alarm>& alarms = alarms(); 274 /*const QPtrList<Alarm>& alarms = alarms();
275 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) 275 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next())
276 alarm->setAlarmStart(mDtDue);*/ 276 alarm->setAlarmStart(mDtDue);*/
277 updated(); 277 updated();
278} 278}
279 279
280QDateTime Todo::dtDue() const 280QDateTime Todo::dtDue() const
281{ 281{
282 return mDtDue; 282 return mDtDue;
283} 283}
284 284
285QString Todo::dtDueTimeStr() const 285QString Todo::dtDueTimeStr() const
286{ 286{
287 return KGlobal::locale()->formatTime(mDtDue.time()); 287 return KGlobal::locale()->formatTime(mDtDue.time());
288} 288}
289 289
290QString Todo::dtDueDateStr(bool shortfmt) const 290QString Todo::dtDueDateStr(bool shortfmt) const
291{ 291{
292 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 292 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
293} 293}
294 294
295QString Todo::dtDueStr(bool shortfmt) const 295QString Todo::dtDueStr(bool shortfmt) const
296{ 296{
297 if ( doesFloat() ) 297 if ( doesFloat() )
298 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 298 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
299 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); 299 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt);
300} 300}
301// retval 0 : no found 301// retval 0 : no found
302// 1 : due for date found 302// 1 : due for date found
303// 2 : overdue for date found 303// 2 : overdue for date found
304int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) 304int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos )
305{ 305{
306 int retval = 0; 306 int retval = 0;
307 if ( isCompleted() ) 307 if ( isCompleted() )
308 return 0; 308 return 0;
309 if ( hasDueDate() ) { 309 if ( hasDueDate() ) {
310 if ( dtDue().date() < date ) 310 if ( dtDue().date() < date )
311 return 2; 311 return 2;
312 // we do not return, because we may find an overdue sub todo 312 // we do not return, because we may find an overdue sub todo
313 if ( dtDue().date() == date ) 313 if ( dtDue().date() == date )
314 retval = 1; 314 retval = 1;
315 } 315 }
316 if ( checkSubtodos ) { 316 if ( checkSubtodos ) {
317 Incidence *aTodo; 317 Incidence *aTodo;
318 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 318 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
319 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); 319 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos );
320 if ( ret == 2 ) 320 if ( ret == 2 )
321 return 2; 321 return 2;
322 if ( ret == 1) 322 if ( ret == 1)
323 retval = 1; 323 retval = 1;
324 } 324 }