summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-07 05:27:32 (UTC)
committer zautrix <zautrix>2005-06-07 05:27:32 (UTC)
commit79f58240bc34d20601abe3325e1dc7e76e1ebe39 (patch) (unidiff)
treeb212a9fea1fd11148f19dd22889984437d8c953b
parent0bbef196163a267722978e34db2ba3daaee76f88 (diff)
downloadkdepimpi-79f58240bc34d20601abe3325e1dc7e76e1ebe39.zip
kdepimpi-79f58240bc34d20601abe3325e1dc7e76e1ebe39.tar.gz
kdepimpi-79f58240bc34d20601abe3325e1dc7e76e1ebe39.tar.bz2
alarm import ol fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index d959a7a..53b65b2 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -909,1574 +909,1576 @@ void MainWindow::initActions()
909 mNewSubTodoAction->addTo( actionMenu ); 909 mNewSubTodoAction->addTo( actionMenu );
910 connect( mNewSubTodoAction, SIGNAL( activated() ), 910 connect( mNewSubTodoAction, SIGNAL( activated() ),
911 mView, SLOT( newSubTodo() ) ); 911 mView, SLOT( newSubTodo() ) );
912 912
913 actionMenu->insertSeparator(); 913 actionMenu->insertSeparator();
914 914
915 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 915 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
916 mShowAction->addTo( actionMenu ); 916 mShowAction->addTo( actionMenu );
917 connect( mShowAction, SIGNAL( activated() ), 917 connect( mShowAction, SIGNAL( activated() ),
918 mView, SLOT( showIncidence() ) ); 918 mView, SLOT( showIncidence() ) );
919 919
920 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 920 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
921 mEditAction->addTo( actionMenu ); 921 mEditAction->addTo( actionMenu );
922 connect( mEditAction, SIGNAL( activated() ), 922 connect( mEditAction, SIGNAL( activated() ),
923 mView, SLOT( editIncidence() ) ); 923 mView, SLOT( editIncidence() ) );
924 924
925 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 925 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
926 mDeleteAction->addTo( actionMenu ); 926 mDeleteAction->addTo( actionMenu );
927 connect( mDeleteAction, SIGNAL( activated() ), 927 connect( mDeleteAction, SIGNAL( activated() ),
928 mView, SLOT( deleteIncidence() ) ); 928 mView, SLOT( deleteIncidence() ) );
929 929
930 930
931 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 931 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
932 mCloneAction->addTo( actionMenu ); 932 mCloneAction->addTo( actionMenu );
933 connect( mCloneAction, SIGNAL( activated() ), 933 connect( mCloneAction, SIGNAL( activated() ),
934 mView, SLOT( cloneIncidence() ) ); 934 mView, SLOT( cloneIncidence() ) );
935 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 935 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
936 mMoveAction->addTo( actionMenu ); 936 mMoveAction->addTo( actionMenu );
937 connect( mMoveAction, SIGNAL( activated() ), 937 connect( mMoveAction, SIGNAL( activated() ),
938 mView, SLOT( moveIncidence() ) ); 938 mView, SLOT( moveIncidence() ) );
939 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 939 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
940 mBeamAction->addTo( actionMenu ); 940 mBeamAction->addTo( actionMenu );
941 connect( mBeamAction, SIGNAL( activated() ), 941 connect( mBeamAction, SIGNAL( activated() ),
942 mView, SLOT( beamIncidence() ) ); 942 mView, SLOT( beamIncidence() ) );
943 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 943 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
944 mCancelAction->addTo( actionMenu ); 944 mCancelAction->addTo( actionMenu );
945 connect( mCancelAction, SIGNAL( activated() ), 945 connect( mCancelAction, SIGNAL( activated() ),
946 mView, SLOT( toggleCancelIncidence() ) ); 946 mView, SLOT( toggleCancelIncidence() ) );
947 947
948 actionMenu->insertSeparator(); 948 actionMenu->insertSeparator();
949 949
950 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 950 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
951 this ); 951 this );
952 action->addTo( actionMenu ); 952 action->addTo( actionMenu );
953 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 953 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
954 954
955 icon = loadPixmap( pathString + "search" ); 955 icon = loadPixmap( pathString + "search" );
956 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 956 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
957 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 957 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
958 search_action->addTo( actionMenu ); 958 search_action->addTo( actionMenu );
959 connect( search_action, SIGNAL( activated() ), 959 connect( search_action, SIGNAL( activated() ),
960 mView->dialogManager(), SLOT( showSearchDialog() ) ); 960 mView->dialogManager(), SLOT( showSearchDialog() ) );
961 961
962 962
963 963
964 if ( KOPrefs::instance()->mShowFullMenu ) { 964 if ( KOPrefs::instance()->mShowFullMenu ) {
965 actionMenu->insertSeparator(); 965 actionMenu->insertSeparator();
966 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 966 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
967 967
968 } 968 }
969 // actionMenu->insertSeparator(); 969 // actionMenu->insertSeparator();
970 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 970 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
971 this ); 971 this );
972 action->addTo( importMenu_X ); 972 action->addTo( importMenu_X );
973 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 973 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
974 action = new QAction( "import_quick", i18n("Import last file"), 0, 974 action = new QAction( "import_quick", i18n("Import last file"), 0,
975 this ); 975 this );
976 action->addTo( importMenu_X ); 976 action->addTo( importMenu_X );
977 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 977 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
978 importMenu_X->insertSeparator(); 978 importMenu_X->insertSeparator();
979 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 979 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
980 this ); 980 this );
981 action->addTo( importMenu_X ); 981 action->addTo( importMenu_X );
982 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 982 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
983 //#ifndef DESKTOP_VERSION 983 //#ifndef DESKTOP_VERSION
984 importMenu_X->insertSeparator(); 984 importMenu_X->insertSeparator();
985 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 985 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
986 this ); 986 this );
987 action->addTo( importMenu_X ); 987 action->addTo( importMenu_X );
988 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 988 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
989 //#else 989 //#else
990#ifdef _OL_IMPORT_ 990#ifdef _OL_IMPORT_
991 importMenu_X->insertSeparator(); 991 importMenu_X->insertSeparator();
992 action = new QAction( "import_ol", i18n("Import from OL"), 0, 992 action = new QAction( "import_ol", i18n("Import from OL"), 0,
993 this ); 993 this );
994 action->addTo( importMenu_X ); 994 action->addTo( importMenu_X );
995 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 995 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
996#endif 996#endif
997 //#endif 997 //#endif
998 998
999 //importMenu->insertSeparator(); 999 //importMenu->insertSeparator();
1000 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1000 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1001 this ); 1001 this );
1002 action->addTo( importMenu ); 1002 action->addTo( importMenu );
1003 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1003 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1004 1004
1005 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1005 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
1006 this ); 1006 this );
1007 action->addTo( importMenu ); 1007 action->addTo( importMenu );
1008 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1008 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1009 importMenu->insertSeparator(); 1009 importMenu->insertSeparator();
1010 importMenu->insertItem( i18n("Import"), importMenu_X ); 1010 importMenu->insertItem( i18n("Import"), importMenu_X );
1011 //importMenu->insertSeparator(); 1011 //importMenu->insertSeparator();
1012 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1012 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1013 this ); 1013 this );
1014 action->addTo( exportMenu_X ); 1014 action->addTo( exportMenu_X );
1015 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1015 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1016 1016
1017 1017
1018 //LR 1018 //LR
1019 QPopupMenu *ex2phone = new QPopupMenu( this ); 1019 QPopupMenu *ex2phone = new QPopupMenu( this );
1020 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1020 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1021 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1021 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1022 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1022 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1023 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1023 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1024 1024
1025 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1025 importMenu->insertItem( i18n("Export"), exportMenu_X );
1026#ifndef DESKTOP_VERSION 1026#ifndef DESKTOP_VERSION
1027 //importMenu->insertSeparator(); 1027 //importMenu->insertSeparator();
1028 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1028 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1029 this ); 1029 this );
1030 brAction->addTo( beamMenu_X ); 1030 brAction->addTo( beamMenu_X );
1031 brAction->setToggleAction (true ) ; 1031 brAction->setToggleAction (true ) ;
1032 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1032 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1033 1033
1034 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1034 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1035 this ); 1035 this );
1036 action->addTo( beamMenu_X ); 1036 action->addTo( beamMenu_X );
1037 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1037 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1038 1038
1039 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1039 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1040 this ); 1040 this );
1041 action->addTo( beamMenu_X ); 1041 action->addTo( beamMenu_X );
1042 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1042 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1043 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1043 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1044#else 1044#else
1045 //importMenu->insertSeparator(); 1045 //importMenu->insertSeparator();
1046 icon = loadPixmap( pathString + "print" ); 1046 icon = loadPixmap( pathString + "print" );
1047 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1047 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1048 action->addTo( beamMenu_X ); 1048 action->addTo( beamMenu_X );
1049 connect( action, SIGNAL( activated() ), 1049 connect( action, SIGNAL( activated() ),
1050 this, SLOT( printCal() ) ); 1050 this, SLOT( printCal() ) );
1051 1051
1052 icon = loadPixmap( pathString + "print" ); 1052 icon = loadPixmap( pathString + "print" );
1053 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1053 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1054 action->addTo( beamMenu_X ); 1054 action->addTo( beamMenu_X );
1055 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1056 this, SLOT( printSel() ) ); 1056 this, SLOT( printSel() ) );
1057 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1057 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1058 action->addTo( beamMenu_X ); 1058 action->addTo( beamMenu_X );
1059 connect( action, SIGNAL( activated() ), 1059 connect( action, SIGNAL( activated() ),
1060 mView->viewManager(), SLOT( slotprintWNV() ) ); 1060 mView->viewManager(), SLOT( slotprintWNV() ) );
1061 1061
1062 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1062 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1063 action->addTo( beamMenu_X ); 1063 action->addTo( beamMenu_X );
1064 connect( action, SIGNAL( activated() ), 1064 connect( action, SIGNAL( activated() ),
1065 mView, SLOT( slotprintSelInc() ) ); 1065 mView, SLOT( slotprintSelInc() ) );
1066 1066
1067 1067
1068 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1068 importMenu->insertItem( i18n("Print"), beamMenu_X );
1069#endif 1069#endif
1070 importMenu->insertSeparator(); 1070 importMenu->insertSeparator();
1071 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1071 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1072 this ); 1072 this );
1073 action->addTo( importMenu ); 1073 action->addTo( importMenu );
1074 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1074 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1075 importMenu->insertSeparator(); 1075 importMenu->insertSeparator();
1076 action = new QAction( "beam all", i18n("Save"), 0, 1076 action = new QAction( "beam all", i18n("Save"), 0,
1077 this ); 1077 this );
1078 action->addTo( importMenu ); 1078 action->addTo( importMenu );
1079 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1079 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1080 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1080 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1081 this ); 1081 this );
1082 action->addTo( importMenu ); 1082 action->addTo( importMenu );
1083 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1083 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1084 1084
1085 //menuBar->insertItem( "Configure",configureMenu ); 1085 //menuBar->insertItem( "Configure",configureMenu );
1086 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1086 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1087 icon = loadPixmap( "korganizer/korganizer" ); 1087 icon = loadPixmap( "korganizer/korganizer" );
1088 1088
1089 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1089 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1090 action->addTo( helpMenu ); 1090 action->addTo( helpMenu );
1091 connect( action, SIGNAL( activated() ), 1091 connect( action, SIGNAL( activated() ),
1092 SLOT( whatsNew() ) ); 1092 SLOT( whatsNew() ) );
1093 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1093 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1094 action->addTo( helpMenu ); 1094 action->addTo( helpMenu );
1095 connect( action, SIGNAL( activated() ), 1095 connect( action, SIGNAL( activated() ),
1096 SLOT( features() ) ); 1096 SLOT( features() ) );
1097 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1097 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1098 action->addTo( helpMenu ); 1098 action->addTo( helpMenu );
1099 connect( action, SIGNAL( activated() ), 1099 connect( action, SIGNAL( activated() ),
1100 SLOT( keyBindings() ) ); 1100 SLOT( keyBindings() ) );
1101 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1101 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1102 action->addTo( helpMenu ); 1102 action->addTo( helpMenu );
1103 connect( action, SIGNAL( activated() ), 1103 connect( action, SIGNAL( activated() ),
1104 SLOT( storagehowto() ) ); 1104 SLOT( storagehowto() ) );
1105 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1105 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1106 action->addTo( helpMenu ); 1106 action->addTo( helpMenu );
1107 connect( action, SIGNAL( activated() ), 1107 connect( action, SIGNAL( activated() ),
1108 SLOT( timetrackinghowto() ) ); 1108 SLOT( timetrackinghowto() ) );
1109 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1109 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1110 action->addTo( helpMenu ); 1110 action->addTo( helpMenu );
1111 connect( action, SIGNAL( activated() ), 1111 connect( action, SIGNAL( activated() ),
1112 SLOT( synchowto() ) ); 1112 SLOT( synchowto() ) );
1113 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1113 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1114 action->addTo( helpMenu ); 1114 action->addTo( helpMenu );
1115 connect( action, SIGNAL( activated() ), 1115 connect( action, SIGNAL( activated() ),
1116 SLOT( kdesynchowto() ) ); 1116 SLOT( kdesynchowto() ) );
1117 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1117 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1118 action->addTo( helpMenu ); 1118 action->addTo( helpMenu );
1119 connect( action, SIGNAL( activated() ), 1119 connect( action, SIGNAL( activated() ),
1120 SLOT( multisynchowto() ) ); 1120 SLOT( multisynchowto() ) );
1121 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1121 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1122 action->addTo( helpMenu ); 1122 action->addTo( helpMenu );
1123 connect( action, SIGNAL( activated() ), 1123 connect( action, SIGNAL( activated() ),
1124 SLOT( aboutAutoSaving() ) ); 1124 SLOT( aboutAutoSaving() ) );
1125 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1125 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1126 action->addTo( helpMenu ); 1126 action->addTo( helpMenu );
1127 connect( action, SIGNAL( activated() ), 1127 connect( action, SIGNAL( activated() ),
1128 SLOT( aboutKnownBugs() ) ); 1128 SLOT( aboutKnownBugs() ) );
1129 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1129 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1130 action->addTo( helpMenu ); 1130 action->addTo( helpMenu );
1131 connect( action, SIGNAL( activated() ), 1131 connect( action, SIGNAL( activated() ),
1132 SLOT( usertrans() ) ); 1132 SLOT( usertrans() ) );
1133 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1133 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1134 action->addTo( helpMenu ); 1134 action->addTo( helpMenu );
1135 connect( action, SIGNAL( activated() ), 1135 connect( action, SIGNAL( activated() ),
1136 SLOT( faq() ) ); 1136 SLOT( faq() ) );
1137 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1137 action = new QAction( "licence", i18n("Licence..."), 0, this );
1138 action->addTo( helpMenu ); 1138 action->addTo( helpMenu );
1139 connect( action, SIGNAL( activated() ), 1139 connect( action, SIGNAL( activated() ),
1140 SLOT( licence() ) ); 1140 SLOT( licence() ) );
1141 action = new QAction( "about", i18n("About..."), 0, this ); 1141 action = new QAction( "about", i18n("About..."), 0, this );
1142 action->addTo( helpMenu ); 1142 action->addTo( helpMenu );
1143 connect( action, SIGNAL( activated() ), 1143 connect( action, SIGNAL( activated() ),
1144 SLOT( about() ) ); 1144 SLOT( about() ) );
1145 //menuBar->insertSeparator(); 1145 //menuBar->insertSeparator();
1146 1146
1147 // ****************************************************** 1147 // ******************************************************
1148 // menubar icons 1148 // menubar icons
1149 1149
1150 1150
1151 1151
1152 //menuBar->insertItem( iconToolBar ); 1152 //menuBar->insertItem( iconToolBar );
1153 //xdays_action 1153 //xdays_action
1154 if (p-> mShowIconNewEvent) 1154 if (p-> mShowIconNewEvent)
1155 ne_action->addTo( iconToolBar ); 1155 ne_action->addTo( iconToolBar );
1156 if (p->mShowIconNewTodo ) 1156 if (p->mShowIconNewTodo )
1157 nt_action->addTo( iconToolBar ); 1157 nt_action->addTo( iconToolBar );
1158 if (p-> mShowIconSearch) 1158 if (p-> mShowIconSearch)
1159 search_action->addTo( iconToolBar ); 1159 search_action->addTo( iconToolBar );
1160 if (p-> mShowIconWhatsThis) 1160 if (p-> mShowIconWhatsThis)
1161 QWhatsThis::whatsThisButton ( iconToolBar ); 1161 QWhatsThis::whatsThisButton ( iconToolBar );
1162 if (p-> mShowIconNext) 1162 if (p-> mShowIconNext)
1163 whatsnext_action->addTo( viewToolBar ); 1163 whatsnext_action->addTo( viewToolBar );
1164 if (p-> mShowIconNextDays) 1164 if (p-> mShowIconNextDays)
1165 xdays_action->addTo( viewToolBar ); 1165 xdays_action->addTo( viewToolBar );
1166 if (p-> mShowIconJournal) 1166 if (p-> mShowIconJournal)
1167 viewjournal_action->addTo( viewToolBar ); 1167 viewjournal_action->addTo( viewToolBar );
1168 if (p-> mShowIconDay1) 1168 if (p-> mShowIconDay1)
1169 day1_action->addTo( viewToolBar ); 1169 day1_action->addTo( viewToolBar );
1170 if (p-> mShowIconDay5) 1170 if (p-> mShowIconDay5)
1171 day5_action->addTo( viewToolBar ); 1171 day5_action->addTo( viewToolBar );
1172 if (p-> mShowIconDay7) 1172 if (p-> mShowIconDay7)
1173 day7_action->addTo( viewToolBar ); 1173 day7_action->addTo( viewToolBar );
1174 if (p-> mShowIconDay6) 1174 if (p-> mShowIconDay6)
1175 day6_action->addTo( viewToolBar ); 1175 day6_action->addTo( viewToolBar );
1176 if (p-> mShowIconMonth) 1176 if (p-> mShowIconMonth)
1177 month_action->addTo( viewToolBar ); 1177 month_action->addTo( viewToolBar );
1178 if (p-> mShowIconList) 1178 if (p-> mShowIconList)
1179 showlist_action->addTo( viewToolBar ); 1179 showlist_action->addTo( viewToolBar );
1180 if (p-> mShowIconTodoview) 1180 if (p-> mShowIconTodoview)
1181 todoview_action->addTo( viewToolBar ); 1181 todoview_action->addTo( viewToolBar );
1182 1182
1183 icon = loadPixmap( pathString + "2leftarrowB" ); 1183 icon = loadPixmap( pathString + "2leftarrowB" );
1184 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1184 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1185 if (p-> mShowIconBackFast) { 1185 if (p-> mShowIconBackFast) {
1186 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1186 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1187 connect( action, SIGNAL( activated() ), 1187 connect( action, SIGNAL( activated() ),
1188 mView, SLOT( goPreviousMonth() ) ); 1188 mView, SLOT( goPreviousMonth() ) );
1189 action->addTo( navigatorToolBar ); 1189 action->addTo( navigatorToolBar );
1190 } 1190 }
1191 icon = loadPixmap( pathString + "1leftarrowB" ); 1191 icon = loadPixmap( pathString + "1leftarrowB" );
1192 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1192 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1193 if (p-> mShowIconBack) { 1193 if (p-> mShowIconBack) {
1194 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1194 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1195 connect( action, SIGNAL( activated() ), 1195 connect( action, SIGNAL( activated() ),
1196 mView, SLOT( goPrevious() ) ); 1196 mView, SLOT( goPrevious() ) );
1197 action->addTo( navigatorToolBar ); 1197 action->addTo( navigatorToolBar );
1198 } 1198 }
1199 icon = loadPixmap( pathString + "today" ); 1199 icon = loadPixmap( pathString + "today" );
1200 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1200 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1201 if (p-> mShowIconToday) 1201 if (p-> mShowIconToday)
1202 today_action->addTo( navigatorToolBar ); 1202 today_action->addTo( navigatorToolBar );
1203 icon = loadPixmap( pathString + "1rightarrowB" ); 1203 icon = loadPixmap( pathString + "1rightarrowB" );
1204 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1204 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1205 if (p-> mShowIconForward) { 1205 if (p-> mShowIconForward) {
1206 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1206 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1207 connect( action, SIGNAL( activated() ), 1207 connect( action, SIGNAL( activated() ),
1208 mView, SLOT( goNext() ) ); 1208 mView, SLOT( goNext() ) );
1209 action->addTo( navigatorToolBar ); 1209 action->addTo( navigatorToolBar );
1210 } 1210 }
1211 icon = loadPixmap( pathString + "2rightarrowB" ); 1211 icon = loadPixmap( pathString + "2rightarrowB" );
1212 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1212 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1213 if (p-> mShowIconForwardFast) { 1213 if (p-> mShowIconForwardFast) {
1214 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1214 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1215 connect( action, SIGNAL( activated() ), 1215 connect( action, SIGNAL( activated() ),
1216 mView, SLOT( goNextMonth() ) ); 1216 mView, SLOT( goNextMonth() ) );
1217 action->addTo( navigatorToolBar ); 1217 action->addTo( navigatorToolBar );
1218 } 1218 }
1219 1219
1220 1220
1221 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1221 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1222 1222
1223 1223
1224 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1224 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1225 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1225 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1226 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1226 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1227 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1227 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1228 1228
1229 if (p-> mShowIconNewEvent) 1229 if (p-> mShowIconNewEvent)
1230 configureToolBarMenu->setItemChecked( 10, true ); 1230 configureToolBarMenu->setItemChecked( 10, true );
1231 if (p->mShowIconNewTodo ) 1231 if (p->mShowIconNewTodo )
1232 configureToolBarMenu->setItemChecked( 20, true ); 1232 configureToolBarMenu->setItemChecked( 20, true );
1233 if (p-> mShowIconSearch) 1233 if (p-> mShowIconSearch)
1234 configureToolBarMenu->setItemChecked( 120, true ); 1234 configureToolBarMenu->setItemChecked( 120, true );
1235 if (p-> mShowIconList) 1235 if (p-> mShowIconList)
1236 configureToolBarMenu->setItemChecked( 30, true ); 1236 configureToolBarMenu->setItemChecked( 30, true );
1237 if (p-> mShowIconDay1) 1237 if (p-> mShowIconDay1)
1238 configureToolBarMenu->setItemChecked( 40, true ); 1238 configureToolBarMenu->setItemChecked( 40, true );
1239 if (p-> mShowIconDay5) 1239 if (p-> mShowIconDay5)
1240 configureToolBarMenu->setItemChecked( 50, true ); 1240 configureToolBarMenu->setItemChecked( 50, true );
1241 if (p-> mShowIconDay6) 1241 if (p-> mShowIconDay6)
1242 configureToolBarMenu->setItemChecked( 75, true ); 1242 configureToolBarMenu->setItemChecked( 75, true );
1243 if (p-> mShowIconDay7) 1243 if (p-> mShowIconDay7)
1244 configureToolBarMenu->setItemChecked( 60, true ); 1244 configureToolBarMenu->setItemChecked( 60, true );
1245 if (p-> mShowIconMonth) 1245 if (p-> mShowIconMonth)
1246 configureToolBarMenu->setItemChecked( 70, true ); 1246 configureToolBarMenu->setItemChecked( 70, true );
1247 if (p-> mShowIconTodoview) 1247 if (p-> mShowIconTodoview)
1248 configureToolBarMenu->setItemChecked( 80, true ); 1248 configureToolBarMenu->setItemChecked( 80, true );
1249 if (p-> mShowIconBackFast) 1249 if (p-> mShowIconBackFast)
1250 configureToolBarMenu->setItemChecked( 200, true ); 1250 configureToolBarMenu->setItemChecked( 200, true );
1251 if (p-> mShowIconBack) 1251 if (p-> mShowIconBack)
1252 configureToolBarMenu->setItemChecked( 210, true ); 1252 configureToolBarMenu->setItemChecked( 210, true );
1253 if (p-> mShowIconToday) 1253 if (p-> mShowIconToday)
1254 configureToolBarMenu->setItemChecked( 130, true ); 1254 configureToolBarMenu->setItemChecked( 130, true );
1255 if (p-> mShowIconForward) 1255 if (p-> mShowIconForward)
1256 configureToolBarMenu->setItemChecked( 220, true ); 1256 configureToolBarMenu->setItemChecked( 220, true );
1257 if (p-> mShowIconForwardFast) 1257 if (p-> mShowIconForwardFast)
1258 configureToolBarMenu->setItemChecked( 230, true ); 1258 configureToolBarMenu->setItemChecked( 230, true );
1259 if (p-> mShowIconNextDays) 1259 if (p-> mShowIconNextDays)
1260 configureToolBarMenu->setItemChecked( 100, true ); 1260 configureToolBarMenu->setItemChecked( 100, true );
1261 if (p-> mShowIconNext) 1261 if (p-> mShowIconNext)
1262 configureToolBarMenu->setItemChecked( 110, true ); 1262 configureToolBarMenu->setItemChecked( 110, true );
1263 if (p-> mShowIconJournal) 1263 if (p-> mShowIconJournal)
1264 configureToolBarMenu->setItemChecked( 90, true ); 1264 configureToolBarMenu->setItemChecked( 90, true );
1265 if (p-> mShowIconWhatsThis) 1265 if (p-> mShowIconWhatsThis)
1266 configureToolBarMenu->setItemChecked( 300, true ); 1266 configureToolBarMenu->setItemChecked( 300, true );
1267 if (p-> mShowIconWeekNum) 1267 if (p-> mShowIconWeekNum)
1268 configureToolBarMenu->setItemChecked( 400, true ); 1268 configureToolBarMenu->setItemChecked( 400, true );
1269 if (!p-> mShowIconStretch) { 1269 if (!p-> mShowIconStretch) {
1270 QLabel* dummy = new QLabel( iconToolBar ); 1270 QLabel* dummy = new QLabel( iconToolBar );
1271 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1271 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1272 dummy->setMinimumWidth( 0 ); 1272 dummy->setMinimumWidth( 0 );
1273 iconToolBar->setStretchableWidget ( dummy ) ; 1273 iconToolBar->setStretchableWidget ( dummy ) ;
1274 } 1274 }
1275 else { 1275 else {
1276 iconToolBar->setHorizontalStretchable (true ); 1276 iconToolBar->setHorizontalStretchable (true );
1277 viewToolBar->setHorizontalStretchable (true ); 1277 viewToolBar->setHorizontalStretchable (true );
1278 navigatorToolBar->setHorizontalStretchable (true ); 1278 navigatorToolBar->setHorizontalStretchable (true );
1279 iconToolBar->setVerticalStretchable (true ); 1279 iconToolBar->setVerticalStretchable (true );
1280 viewToolBar->setVerticalStretchable (true ); 1280 viewToolBar->setVerticalStretchable (true );
1281 navigatorToolBar->setVerticalStretchable (true ); 1281 navigatorToolBar->setVerticalStretchable (true );
1282 configureToolBarMenu->setItemChecked( 5, true ); 1282 configureToolBarMenu->setItemChecked( 5, true );
1283 } 1283 }
1284 if (p-> mShowIconFilter) 1284 if (p-> mShowIconFilter)
1285 configureToolBarMenu->setItemChecked( 7, true ); 1285 configureToolBarMenu->setItemChecked( 7, true );
1286 if (p-> mShowIconOnetoolbar) 1286 if (p-> mShowIconOnetoolbar)
1287 configureToolBarMenu->setItemChecked( 6, true ); 1287 configureToolBarMenu->setItemChecked( 6, true );
1288 1288
1289 1289
1290 if ( filterMenubar ) { 1290 if ( filterMenubar ) {
1291 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1291 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1292 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1292 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1293 } 1293 }
1294 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1294 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1295 configureAgenda( p->mHourSize ); 1295 configureAgenda( p->mHourSize );
1296 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1296 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1297} 1297}
1298 1298
1299void MainWindow::exportToPhone( int mode ) 1299void MainWindow::exportToPhone( int mode )
1300{ 1300{
1301 1301
1302 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1302 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1303 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1303 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1304 KOex2phonePrefs ex2phone; 1304 KOex2phonePrefs ex2phone;
1305 1305
1306 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1306 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1307 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1307 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1308 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1308 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1309 if ( mode == 1 ) 1309 if ( mode == 1 )
1310 ex2phone.setCaption(i18n("Export complete calendar")); 1310 ex2phone.setCaption(i18n("Export complete calendar"));
1311 if ( mode == 2 ) 1311 if ( mode == 2 )
1312 ex2phone.setCaption(i18n("Export filtered calendar")); 1312 ex2phone.setCaption(i18n("Export filtered calendar"));
1313 1313
1314 if ( !ex2phone.exec() ) { 1314 if ( !ex2phone.exec() ) {
1315 return; 1315 return;
1316 } 1316 }
1317 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1317 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1318 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1318 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1319 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1319 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1320 1320
1321 int inFuture = 0; 1321 int inFuture = 0;
1322 if ( ex2phone.mWriteBackFuture->isChecked() ) 1322 if ( ex2phone.mWriteBackFuture->isChecked() )
1323 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1323 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1324 QPtrList<Incidence> delSel; 1324 QPtrList<Incidence> delSel;
1325 if ( mode == 1 ) 1325 if ( mode == 1 )
1326 delSel = mCalendar->rawIncidences(); 1326 delSel = mCalendar->rawIncidences();
1327 if ( mode == 2 ) 1327 if ( mode == 2 )
1328 delSel = mCalendar->incidences(); 1328 delSel = mCalendar->incidences();
1329 CalendarLocal* cal = new CalendarLocal(); 1329 CalendarLocal* cal = new CalendarLocal();
1330 cal->setLocalTime(); 1330 cal->setLocalTime();
1331 Incidence *incidence = delSel.first(); 1331 Incidence *incidence = delSel.first();
1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1334 while ( incidence ) { 1334 while ( incidence ) {
1335 if ( incidence->type() != "Journal" ) { 1335 if ( incidence->type() != "Journal" ) {
1336 bool add = true; 1336 bool add = true;
1337 if ( inFuture ) { 1337 if ( inFuture ) {
1338 QDateTime dt; 1338 QDateTime dt;
1339 if ( incidence->type() == "Todo" ) { 1339 if ( incidence->type() == "Todo" ) {
1340 Todo * t = (Todo*)incidence; 1340 Todo * t = (Todo*)incidence;
1341 if ( t->hasDueDate() ) 1341 if ( t->hasDueDate() )
1342 dt = t->dtDue(); 1342 dt = t->dtDue();
1343 else 1343 else
1344 dt = cur.addSecs( 62 ); 1344 dt = cur.addSecs( 62 );
1345 } 1345 }
1346 else { 1346 else {
1347 bool ok; 1347 bool ok;
1348 dt = incidence->getNextOccurence( cur, &ok ); 1348 dt = incidence->getNextOccurence( cur, &ok );
1349 if ( !ok ) 1349 if ( !ok )
1350 dt = cur.addSecs( -62 ); 1350 dt = cur.addSecs( -62 );
1351 } 1351 }
1352 if ( dt < cur || dt > end ) { 1352 if ( dt < cur || dt > end ) {
1353 add = false; 1353 add = false;
1354 } 1354 }
1355 } 1355 }
1356 if ( add ) { 1356 if ( add ) {
1357 Incidence *in = incidence->clone(); 1357 Incidence *in = incidence->clone();
1358 cal->addIncidence( in ); 1358 cal->addIncidence( in );
1359 } 1359 }
1360 } 1360 }
1361 incidence = delSel.next(); 1361 incidence = delSel.next();
1362 } 1362 }
1363 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1363 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1364 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1364 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1365 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1365 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1366 1366
1367 setCaption( i18n("Writing to phone...")); 1367 setCaption( i18n("Writing to phone..."));
1368 if ( PhoneFormat::writeToPhone( cal ) ) 1368 if ( PhoneFormat::writeToPhone( cal ) )
1369 setCaption( i18n("Export to phone successful!")); 1369 setCaption( i18n("Export to phone successful!"));
1370 else 1370 else
1371 setCaption( i18n("Error exporting to phone!")); 1371 setCaption( i18n("Error exporting to phone!"));
1372 delete cal; 1372 delete cal;
1373} 1373}
1374 1374
1375 1375
1376void MainWindow::setDefaultPreferences() 1376void MainWindow::setDefaultPreferences()
1377{ 1377{
1378 KOPrefs *p = KOPrefs::instance(); 1378 KOPrefs *p = KOPrefs::instance();
1379 1379
1380 p->mCompactDialogs = true; 1380 p->mCompactDialogs = true;
1381 p->mConfirm = true; 1381 p->mConfirm = true;
1382 // p->mEnableQuickTodo = false; 1382 // p->mEnableQuickTodo = false;
1383 1383
1384} 1384}
1385 1385
1386QString MainWindow::resourcePath() 1386QString MainWindow::resourcePath()
1387{ 1387{
1388 return KGlobal::iconLoader()->iconPath(); 1388 return KGlobal::iconLoader()->iconPath();
1389} 1389}
1390 1390
1391void MainWindow::displayText( QString text ,QString cap ) 1391void MainWindow::displayText( QString text ,QString cap )
1392{ 1392{
1393 QDialog dia( this, "name", true ); ; 1393 QDialog dia( this, "name", true ); ;
1394 dia.setCaption( cap ); 1394 dia.setCaption( cap );
1395 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1395 QVBoxLayout* lay = new QVBoxLayout( &dia );
1396 lay->setSpacing( 3 ); 1396 lay->setSpacing( 3 );
1397 lay->setMargin( 3 ); 1397 lay->setMargin( 3 );
1398 QTextBrowser tb ( &dia ); 1398 QTextBrowser tb ( &dia );
1399 lay->addWidget( &tb ); 1399 lay->addWidget( &tb );
1400 tb.setText( text ); 1400 tb.setText( text );
1401#ifdef DESKTOP_VERSION 1401#ifdef DESKTOP_VERSION
1402 dia.resize( 640, 480); 1402 dia.resize( 640, 480);
1403#else 1403#else
1404 dia.showMaximized(); 1404 dia.showMaximized();
1405#endif 1405#endif
1406 dia.exec(); 1406 dia.exec();
1407} 1407}
1408 1408
1409void MainWindow::features() 1409void MainWindow::features()
1410{ 1410{
1411 1411
1412 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1412 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1413} 1413}
1414 1414
1415void MainWindow::usertrans() 1415void MainWindow::usertrans()
1416{ 1416{
1417 1417
1418 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1418 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1419} 1419}
1420 1420
1421void MainWindow::storagehowto() 1421void MainWindow::storagehowto()
1422{ 1422{
1423 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1423 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1424} 1424}
1425void MainWindow::timetrackinghowto() 1425void MainWindow::timetrackinghowto()
1426{ 1426{
1427 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1427 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1428} 1428}
1429void MainWindow::kdesynchowto() 1429void MainWindow::kdesynchowto()
1430{ 1430{
1431 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1431 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1432} 1432}
1433void MainWindow::multisynchowto() 1433void MainWindow::multisynchowto()
1434{ 1434{
1435 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1435 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1436} 1436}
1437void MainWindow::synchowto() 1437void MainWindow::synchowto()
1438{ 1438{
1439 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1439 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1440} 1440}
1441void MainWindow::faq() 1441void MainWindow::faq()
1442{ 1442{
1443 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1443 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1444 1444
1445} 1445}
1446void MainWindow::whatsNew() 1446void MainWindow::whatsNew()
1447{ 1447{
1448 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1448 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1449 1449
1450} 1450}
1451void MainWindow::licence() 1451void MainWindow::licence()
1452{ 1452{
1453 KApplication::showLicence(); 1453 KApplication::showLicence();
1454 1454
1455} 1455}
1456void MainWindow::about() 1456void MainWindow::about()
1457{ 1457{
1458 QString version; 1458 QString version;
1459#include <../version> 1459#include <../version>
1460 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1460 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1461 i18n("KOrganizer/Platform-independent\n") + 1461 i18n("KOrganizer/Platform-independent\n") +
1462 "(KO/Pi) " + version + " - " + 1462 "(KO/Pi) " + version + " - " +
1463 1463
1464#ifdef DESKTOP_VERSION 1464#ifdef DESKTOP_VERSION
1465 i18n("Desktop Edition\n") + 1465 i18n("Desktop Edition\n") +
1466#else 1466#else
1467 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1467 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1468#endif 1468#endif
1469 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!") ); 1469 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!") );
1470} 1470}
1471void MainWindow::keyBindings() 1471void MainWindow::keyBindings()
1472{ 1472{
1473 QString cap = i18n("KO/Pi Keys + Colors"); 1473 QString cap = i18n("KO/Pi Keys + Colors");
1474 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1474 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1475 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1475 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1476 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1476 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1477 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1477 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1478 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1478 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1479 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1479 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1480 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1480 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1481 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1481 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1482 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1482 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1483 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1483 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1484 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1484 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1485 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1485 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1486 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1486 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1487 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1487 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1488 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1488 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1489 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1489 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1490 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1490 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1491 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1491 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1492 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1492 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1493 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1493 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1494 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1494 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1495 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1495 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1496 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1496 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1497 i18n("<p><h3>In agenda view:</h3></p>\n") + 1497 i18n("<p><h3>In agenda view:</h3></p>\n") +
1498 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1498 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1499 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1499 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1500 i18n("<p><h3>In todo view:</h3></p>\n") + 1500 i18n("<p><h3>In todo view:</h3></p>\n") +
1501 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1501 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1502 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1502 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1503 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1503 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1504 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1504 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1505 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1505 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1506 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1506 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1507 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1507 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1508 i18n("<p><h3>In list view:</h3></p>\n") + 1508 i18n("<p><h3>In list view:</h3></p>\n") +
1509 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1509 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1510 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1510 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1511 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1511 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1512 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1512 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1513 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1513 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1514 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1514 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1515 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1515 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1516 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1516 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1517 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1517 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1518 i18n("<p><b>E</b>: Edit item</p>\n") + 1518 i18n("<p><b>E</b>: Edit item</p>\n") +
1519 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1519 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1520 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1520 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1521 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1521 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1522 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1522 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1523 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1523 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1524 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1524 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1525 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1525 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1526 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1526 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1527 i18n("<p><b>White</b>: Item readonly</p>\n"); 1527 i18n("<p><b>White</b>: Item readonly</p>\n");
1528 displayText( text, cap); 1528 displayText( text, cap);
1529} 1529}
1530void MainWindow::aboutAutoSaving() 1530void MainWindow::aboutAutoSaving()
1531{ 1531{
1532 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"); 1532 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");
1533 1533
1534 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1534 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1535 1535
1536} 1536}
1537void MainWindow::aboutKnownBugs() 1537void MainWindow::aboutKnownBugs()
1538{ 1538{
1539 QMessageBox* msg; 1539 QMessageBox* msg;
1540 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1540 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1541 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")+ 1541 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")+
1542 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1542 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1543 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1543 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1544 i18n("\nor report them in the bugtracker on\n") + 1544 i18n("\nor report them in the bugtracker on\n") +
1545 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1545 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1546 QMessageBox::NoIcon, 1546 QMessageBox::NoIcon,
1547 QMessageBox::Ok, 1547 QMessageBox::Ok,
1548 QMessageBox::NoButton, 1548 QMessageBox::NoButton,
1549 QMessageBox::NoButton); 1549 QMessageBox::NoButton);
1550 msg->exec(); 1550 msg->exec();
1551 delete msg; 1551 delete msg;
1552 1552
1553} 1553}
1554 1554
1555QString MainWindow::defaultFileName() 1555QString MainWindow::defaultFileName()
1556{ 1556{
1557 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1557 return locateLocal( "data", "korganizer/mycalendar.ics" );
1558} 1558}
1559QString MainWindow::syncFileName() 1559QString MainWindow::syncFileName()
1560{ 1560{
1561#ifdef DESKTOP_VERSION 1561#ifdef DESKTOP_VERSION
1562 return locateLocal( "tmp", "synccalendar.ics" ); 1562 return locateLocal( "tmp", "synccalendar.ics" );
1563#else 1563#else
1564 return QString( "/tmp/synccalendar.ics" ); 1564 return QString( "/tmp/synccalendar.ics" );
1565#endif 1565#endif
1566} 1566}
1567#include "koglobals.h" 1567#include "koglobals.h"
1568#include <kcalendarsystem.h> 1568#include <kcalendarsystem.h>
1569void MainWindow::updateWeek(QDate seda) 1569void MainWindow::updateWeek(QDate seda)
1570{ 1570{
1571 int weekNum = KGlobal::locale()->weekNum ( seda ); 1571 int weekNum = KGlobal::locale()->weekNum ( seda );
1572 mWeekPixmap.fill( mWeekBgColor ); 1572 mWeekPixmap.fill( mWeekBgColor );
1573 QPainter p ( &mWeekPixmap ); 1573 QPainter p ( &mWeekPixmap );
1574 p.setFont( mWeekFont ); 1574 p.setFont( mWeekFont );
1575 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1575 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1576 p.end(); 1576 p.end();
1577 QIconSet icon3 ( mWeekPixmap ); 1577 QIconSet icon3 ( mWeekPixmap );
1578 mWeekAction->setIconSet ( icon3 ); 1578 mWeekAction->setIconSet ( icon3 );
1579 1579
1580} 1580}
1581void MainWindow::updateWeekNum(const DateList &selectedDates) 1581void MainWindow::updateWeekNum(const DateList &selectedDates)
1582{ 1582{
1583 updateWeek( selectedDates.first() ); 1583 updateWeek( selectedDates.first() );
1584} 1584}
1585void MainWindow::processIncidenceSelection( Incidence *incidence ) 1585void MainWindow::processIncidenceSelection( Incidence *incidence )
1586{ 1586{
1587 1587
1588 if ( !incidence ) { 1588 if ( !incidence ) {
1589 enableIncidenceActions( false ); 1589 enableIncidenceActions( false );
1590 1590
1591 mNewSubTodoAction->setEnabled( false ); 1591 mNewSubTodoAction->setEnabled( false );
1592 setCaptionToDates(); 1592 setCaptionToDates();
1593 return; 1593 return;
1594 1594
1595 } 1595 }
1596 1596
1597 //KGlobal::locale()->formatDateTime(nextA, true); 1597 //KGlobal::locale()->formatDateTime(nextA, true);
1598 QString startString = ""; 1598 QString startString = "";
1599 if ( incidence->type() != "Todo" ) { 1599 if ( incidence->type() != "Todo" ) {
1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1601 if ( incidence->doesFloat() ) { 1601 if ( incidence->doesFloat() ) {
1602 startString += ": "+incidence->dtStartDateStr( true ); 1602 startString += ": "+incidence->dtStartDateStr( true );
1603 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1603 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1604 1604
1605 } else { 1605 } else {
1606 startString = ": "+incidence->dtStartStr(true); 1606 startString = ": "+incidence->dtStartStr(true);
1607 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1607 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1608 1608
1609 } 1609 }
1610 1610
1611 } else { 1611 } else {
1612 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1612 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1613 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1613 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1614 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1614 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1615 1615
1616 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1616 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1617 bool ok; 1617 bool ok;
1618 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1618 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1619 if ( ok ) { 1619 if ( ok ) {
1620 int years = noc.date().year() - incidence->dtStart().date().year(); 1620 int years = noc.date().year() - incidence->dtStart().date().year();
1621 startString += i18n(" (%1 y.)"). arg( years ); 1621 startString += i18n(" (%1 y.)"). arg( years );
1622 } 1622 }
1623 } 1623 }
1624 else 1624 else
1625 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1625 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1626 } 1626 }
1627 1627
1628 } 1628 }
1629 else 1629 else
1630 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1630 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1631 if ( !incidence->location().isEmpty() ) 1631 if ( !incidence->location().isEmpty() )
1632 startString += " (" +incidence->location()+")"; 1632 startString += " (" +incidence->location()+")";
1633 setCaption( incidence->summary()+startString); 1633 setCaption( incidence->summary()+startString);
1634 1634
1635 enableIncidenceActions( true ); 1635 enableIncidenceActions( true );
1636 1636
1637 if ( incidence->type() == "Event" ) { 1637 if ( incidence->type() == "Event" ) {
1638 mShowAction->setText( i18n("Show Event...") ); 1638 mShowAction->setText( i18n("Show Event...") );
1639 mEditAction->setText( i18n("Edit Event...") ); 1639 mEditAction->setText( i18n("Edit Event...") );
1640 mDeleteAction->setText( i18n("Delete Event...") ); 1640 mDeleteAction->setText( i18n("Delete Event...") );
1641 1641
1642 mNewSubTodoAction->setEnabled( false ); 1642 mNewSubTodoAction->setEnabled( false );
1643 } else if ( incidence->type() == "Todo" ) { 1643 } else if ( incidence->type() == "Todo" ) {
1644 mShowAction->setText( i18n("Show Todo...") ); 1644 mShowAction->setText( i18n("Show Todo...") );
1645 mEditAction->setText( i18n("Edit Todo...") ); 1645 mEditAction->setText( i18n("Edit Todo...") );
1646 mDeleteAction->setText( i18n("Delete Todo...") ); 1646 mDeleteAction->setText( i18n("Delete Todo...") );
1647 1647
1648 mNewSubTodoAction->setEnabled( true ); 1648 mNewSubTodoAction->setEnabled( true );
1649 } else { 1649 } else {
1650 mShowAction->setText( i18n("Show...") ); 1650 mShowAction->setText( i18n("Show...") );
1651 mShowAction->setText( i18n("Edit...") ); 1651 mShowAction->setText( i18n("Edit...") );
1652 mShowAction->setText( i18n("Delete...") ); 1652 mShowAction->setText( i18n("Delete...") );
1653 1653
1654 mNewSubTodoAction->setEnabled( false ); 1654 mNewSubTodoAction->setEnabled( false );
1655 } 1655 }
1656} 1656}
1657 1657
1658void MainWindow::enableIncidenceActions( bool enabled ) 1658void MainWindow::enableIncidenceActions( bool enabled )
1659{ 1659{
1660 mShowAction->setEnabled( enabled ); 1660 mShowAction->setEnabled( enabled );
1661 mEditAction->setEnabled( enabled ); 1661 mEditAction->setEnabled( enabled );
1662 mDeleteAction->setEnabled( enabled ); 1662 mDeleteAction->setEnabled( enabled );
1663 1663
1664 mCloneAction->setEnabled( enabled ); 1664 mCloneAction->setEnabled( enabled );
1665 mMoveAction->setEnabled( enabled ); 1665 mMoveAction->setEnabled( enabled );
1666 mBeamAction->setEnabled( enabled ); 1666 mBeamAction->setEnabled( enabled );
1667 mCancelAction->setEnabled( enabled ); 1667 mCancelAction->setEnabled( enabled );
1668} 1668}
1669 1669
1670void MainWindow::importOL() 1670void MainWindow::importOL()
1671{ 1671{
1672#ifdef _OL_IMPORT_ 1672#ifdef _OL_IMPORT_
1673 mView->clearAllViews(); 1673 mView->clearAllViews();
1674 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1674 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1675 id->exec(); 1675 id->exec();
1676 delete id; 1676 delete id;
1677 mView->calendar()->checkAlarmForIncidence( 0, true );
1677 mView->updateView(); 1678 mView->updateView();
1678#endif 1679#endif
1679} 1680}
1680void MainWindow::importBday() 1681void MainWindow::importBday()
1681{ 1682{
1682 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1683 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1683 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1684 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1684 i18n("Import!"), i18n("Cancel"), 0, 1685 i18n("Import!"), i18n("Cancel"), 0,
1685 0, 1 ); 1686 0, 1 );
1686 if ( result == 0 ) { 1687 if ( result == 0 ) {
1687 mView->importBday(); 1688 mView->importBday();
1688 1689
1689 } 1690 }
1690 1691
1691 1692
1692} 1693}
1693void MainWindow::importQtopia() 1694void MainWindow::importQtopia()
1694{ 1695{
1695 //#ifndef DESKTOP_VERSION 1696 //#ifndef DESKTOP_VERSION
1696 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"); 1697 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");
1697#ifdef DESKTOP_VERSION 1698#ifdef DESKTOP_VERSION
1698 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"); 1699 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");
1699#endif 1700#endif
1700 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1701 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1701 i18n("Import!"), i18n("Cancel"), 0, 1702 i18n("Import!"), i18n("Cancel"), 0,
1702 0, 1 ); 1703 0, 1 );
1703 if ( result == 0 ) { 1704 if ( result == 0 ) {
1704#ifndef DESKTOP_VERSION 1705#ifndef DESKTOP_VERSION
1705 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1706 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1706 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1707 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1707 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1708 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1708#else 1709#else
1709 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1710 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1710 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1711 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1711 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1712 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1712#endif 1713#endif
1713 mView->importQtopia( categories, datebook, todolist ); 1714 mView->importQtopia( categories, datebook, todolist );
1714 } 1715 }
1716 mView->calendar()->reInitAlarmSettings();
1715#if 0 1717#if 0
1716 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1718 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1717 i18n("Not supported \non desktop!\n"), 1719 i18n("Not supported \non desktop!\n"),
1718 i18n("Ok"), i18n("Cancel"), 0, 1720 i18n("Ok"), i18n("Cancel"), 0,
1719 0, 1 ); 1721 0, 1 );
1720 1722
1721#endif 1723#endif
1722} 1724}
1723 1725
1724void MainWindow::saveOnClose() 1726void MainWindow::saveOnClose()
1725{ 1727{
1726 KOPrefs *p = KOPrefs::instance(); 1728 KOPrefs *p = KOPrefs::instance();
1727 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1729 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1728 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1730 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1729 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1731 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1730 if ( filterToolBar ) { 1732 if ( filterToolBar ) {
1731 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1733 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1732 } 1734 }
1733#ifdef DESKTOP_VERSION 1735#ifdef DESKTOP_VERSION
1734 1736
1735 QPoint myP; 1737 QPoint myP;
1736 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1738 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1737 if ( p->mToolBarHor ) 1739 if ( p->mToolBarHor )
1738 p->mToolBarUp = myP.y() > height()/2; 1740 p->mToolBarUp = myP.y() > height()/2;
1739 else 1741 else
1740 p->mToolBarUp = myP.x() > width()/2; 1742 p->mToolBarUp = myP.x() > width()/2;
1741 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1743 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1742 if ( p->mToolBarHorV ) 1744 if ( p->mToolBarHorV )
1743 p->mToolBarUpV = myP.y() > height()/2; 1745 p->mToolBarUpV = myP.y() > height()/2;
1744 else 1746 else
1745 p->mToolBarUpV = myP.x() > width()/2 ; 1747 p->mToolBarUpV = myP.x() > width()/2 ;
1746 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1748 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1747 if ( p->mToolBarHorN ) 1749 if ( p->mToolBarHorN )
1748 p->mToolBarUpN = myP.y() > height()/2; 1750 p->mToolBarUpN = myP.y() > height()/2;
1749 else 1751 else
1750 p->mToolBarUpN = myP.x() > width()/2 ; 1752 p->mToolBarUpN = myP.x() > width()/2 ;
1751 if ( filterToolBar ) { 1753 if ( filterToolBar ) {
1752 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1754 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1753 if ( p->mToolBarHorF ) 1755 if ( p->mToolBarHorF )
1754 p->mToolBarUpF = myP.y() > height()/2; 1756 p->mToolBarUpF = myP.y() > height()/2;
1755 else 1757 else
1756 p->mToolBarUpF = myP.x() > width()/2 ; 1758 p->mToolBarUpF = myP.x() > width()/2 ;
1757 } 1759 }
1758#else 1760#else
1759 if ( p->mToolBarHor ) 1761 if ( p->mToolBarHor )
1760 p->mToolBarUp = iconToolBar->y() > height()/2; 1762 p->mToolBarUp = iconToolBar->y() > height()/2;
1761 else 1763 else
1762 p->mToolBarUp = iconToolBar->x() > width()/2; 1764 p->mToolBarUp = iconToolBar->x() > width()/2;
1763 if ( p->mToolBarHorV ) 1765 if ( p->mToolBarHorV )
1764 p->mToolBarUpV = viewToolBar->y() > height()/2; 1766 p->mToolBarUpV = viewToolBar->y() > height()/2;
1765 else 1767 else
1766 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1768 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1767 1769
1768 if ( p->mToolBarHorN ) 1770 if ( p->mToolBarHorN )
1769 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1771 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1770 else 1772 else
1771 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1773 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1772 if ( filterToolBar ) { 1774 if ( filterToolBar ) {
1773 if ( p->mToolBarHorF ) 1775 if ( p->mToolBarHorF )
1774 p->mToolBarUpF = filterToolBar->y() > height()/2; 1776 p->mToolBarUpF = filterToolBar->y() > height()/2;
1775 else 1777 else
1776 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1778 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1777 } 1779 }
1778#endif 1780#endif
1779 1781
1780 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1782 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1781 save(); 1783 save();
1782 mView->writeSettings(); 1784 mView->writeSettings();
1783} 1785}
1784void MainWindow::slotModifiedChanged( bool changed ) 1786void MainWindow::slotModifiedChanged( bool changed )
1785{ 1787{
1786 if ( mBlockAtStartup ) 1788 if ( mBlockAtStartup )
1787 return; 1789 return;
1788 1790
1789 int msec; 1791 int msec;
1790 // we store the changes after 1 minute, 1792 // we store the changes after 1 minute,
1791 // and for safety reasons after 10 minutes again 1793 // and for safety reasons after 10 minutes again
1792 if ( !mSyncManager->blockSave() ) 1794 if ( !mSyncManager->blockSave() )
1793 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1795 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1794 else 1796 else
1795 msec = 1000 * 600; 1797 msec = 1000 * 600;
1796 mSaveTimer.start( msec, true ); // 1 minute 1798 mSaveTimer.start( msec, true ); // 1 minute
1797 qDebug("KO: Saving File in %d secs!", msec/1000); 1799 qDebug("KO: Saving File in %d secs!", msec/1000);
1798 mCalendarModifiedFlag = true; 1800 mCalendarModifiedFlag = true;
1799} 1801}
1800void MainWindow::saveStopTimer() 1802void MainWindow::saveStopTimer()
1801{ 1803{
1802 mSaveTimer.stop(); 1804 mSaveTimer.stop();
1803} 1805}
1804void MainWindow::save() 1806void MainWindow::save()
1805{ 1807{
1806 if ( !mCalendarModifiedFlag ) { 1808 if ( !mCalendarModifiedFlag ) {
1807 qDebug("KO: Calendar not modified. Nothing saved."); 1809 qDebug("KO: Calendar not modified. Nothing saved.");
1808 return; 1810 return;
1809 } 1811 }
1810 if ( mSyncManager->blockSave() ) 1812 if ( mSyncManager->blockSave() )
1811 return; 1813 return;
1812 mSyncManager->setBlockSave(true); 1814 mSyncManager->setBlockSave(true);
1813 if ( mView->checkFileVersion( defaultFileName()) ) { 1815 if ( mView->checkFileVersion( defaultFileName()) ) {
1814 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1816 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1815 QDate reference ( 2000,1,1); 1817 QDate reference ( 2000,1,1);
1816 int daysTo = reference.daysTo ( QDate::currentDate() ); 1818 int daysTo = reference.daysTo ( QDate::currentDate() );
1817 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1819 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1818 setCaption(i18n("Creating backup ... please wait ..." )); 1820 setCaption(i18n("Creating backup ... please wait ..." ));
1819 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1821 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1820 // we need the file path, the backup dir and the number of bups as param 1822 // we need the file path, the backup dir and the number of bups as param
1821 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1823 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1822 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1824 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1823 bupDir = KGlobalSettings::backupDataDir(); 1825 bupDir = KGlobalSettings::backupDataDir();
1824 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1826 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1825 if ( retval == 0 ) { 1827 if ( retval == 0 ) {
1826 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1828 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1827 // retval == 0 : backup skipped for today, try again tomorrow 1829 // retval == 0 : backup skipped for today, try again tomorrow
1828 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1830 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1829 } else if ( retval == 1 ){ 1831 } else if ( retval == 1 ){
1830 qDebug("KO: Backup created."); 1832 qDebug("KO: Backup created.");
1831 // backup ok 1833 // backup ok
1832 KOPrefs::instance()->mLastBackupDate = daysTo; 1834 KOPrefs::instance()->mLastBackupDate = daysTo;
1833 1835
1834 } else if ( retval == 2 ){ 1836 } else if ( retval == 2 ){
1835 qDebug("KO: Backup globally cancelled."); 1837 qDebug("KO: Backup globally cancelled.");
1836 // backup globally cancelled 1838 // backup globally cancelled
1837 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1839 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1838 } 1840 }
1839 // retval == 3: do nothing, try again later 1841 // retval == 3: do nothing, try again later
1840 } 1842 }
1841 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1843 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1842 } 1844 }
1843 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1845 QTime neededSaveTime = QDateTime::currentDateTime().time();
1844 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1846 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1845 qDebug("KO: Start saving data to file!"); 1847 qDebug("KO: Start saving data to file!");
1846 mView->saveCalendar( defaultFileName() ); 1848 mView->saveCalendar( defaultFileName() );
1847 mCalendarModifiedFlag = false; 1849 mCalendarModifiedFlag = false;
1848 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1850 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1849 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1851 qDebug("KO: Needed %d ms for saving.",msNeeded );
1850 QString savemes; 1852 QString savemes;
1851 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1853 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1852 setCaption(savemes); 1854 setCaption(savemes);
1853 } else 1855 } else
1854 setCaption(i18n("Saving cancelled!")); 1856 setCaption(i18n("Saving cancelled!"));
1855 mSyncManager->setBlockSave( false ); 1857 mSyncManager->setBlockSave( false );
1856} 1858}
1857 1859
1858void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1860void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1859{ 1861{
1860 if ( !e->isAutoRepeat() ) { 1862 if ( !e->isAutoRepeat() ) {
1861 mFlagKeyPressed = false; 1863 mFlagKeyPressed = false;
1862 } 1864 }
1863} 1865}
1864void MainWindow::keyPressEvent ( QKeyEvent * e ) 1866void MainWindow::keyPressEvent ( QKeyEvent * e )
1865{ 1867{
1866 qApp->processEvents(); 1868 qApp->processEvents();
1867 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1869 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1868 e->ignore(); 1870 e->ignore();
1869 // qDebug(" ignore %d",e->isAutoRepeat() ); 1871 // qDebug(" ignore %d",e->isAutoRepeat() );
1870 return; 1872 return;
1871 } 1873 }
1872 if (! e->isAutoRepeat() ) 1874 if (! e->isAutoRepeat() )
1873 mFlagKeyPressed = true; 1875 mFlagKeyPressed = true;
1874 KOPrefs *p = KOPrefs::instance(); 1876 KOPrefs *p = KOPrefs::instance();
1875 bool showSelectedDates = false; 1877 bool showSelectedDates = false;
1876 int size; 1878 int size;
1877 int pro = 0; 1879 int pro = 0;
1878 //qDebug("MainWindow::keyPressEvent "); 1880 //qDebug("MainWindow::keyPressEvent ");
1879 switch ( e->key() ) { 1881 switch ( e->key() ) {
1880 case Qt::Key_Right: 1882 case Qt::Key_Right:
1881 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1883 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1882 mView->goNextMonth(); 1884 mView->goNextMonth();
1883 else 1885 else
1884 mView->goNext(); 1886 mView->goNext();
1885 showSelectedDates = true; 1887 showSelectedDates = true;
1886 break; 1888 break;
1887 case Qt::Key_Left: 1889 case Qt::Key_Left:
1888 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1890 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1889 mView->goPreviousMonth(); 1891 mView->goPreviousMonth();
1890 else 1892 else
1891 mView->goPrevious(); 1893 mView->goPrevious();
1892 showSelectedDates = true; 1894 showSelectedDates = true;
1893 break; 1895 break;
1894 case Qt::Key_Down: 1896 case Qt::Key_Down:
1895 mView->viewManager()->agendaView()->scrollOneHourDown(); 1897 mView->viewManager()->agendaView()->scrollOneHourDown();
1896 break; 1898 break;
1897 case Qt::Key_Up: 1899 case Qt::Key_Up:
1898 mView->viewManager()->agendaView()->scrollOneHourUp(); 1900 mView->viewManager()->agendaView()->scrollOneHourUp();
1899 break; 1901 break;
1900 case Qt::Key_K: 1902 case Qt::Key_K:
1901 mView->viewManager()->showMonthViewWeek(); 1903 mView->viewManager()->showMonthViewWeek();
1902 break; 1904 break;
1903 case Qt::Key_I: 1905 case Qt::Key_I:
1904 mView->showIncidence(); 1906 mView->showIncidence();
1905 break; 1907 break;
1906 case Qt::Key_Delete: 1908 case Qt::Key_Delete:
1907 case Qt::Key_Backspace: 1909 case Qt::Key_Backspace:
1908 mView->deleteIncidence(); 1910 mView->deleteIncidence();
1909 break; 1911 break;
1910 case Qt::Key_D: 1912 case Qt::Key_D:
1911 mView->viewManager()->showDayView(); 1913 mView->viewManager()->showDayView();
1912 showSelectedDates = true; 1914 showSelectedDates = true;
1913 break; 1915 break;
1914 case Qt::Key_O: 1916 case Qt::Key_O:
1915 mView->toggleFilerEnabled( ); 1917 mView->toggleFilerEnabled( );
1916 break; 1918 break;
1917 case Qt::Key_0: 1919 case Qt::Key_0:
1918 case Qt::Key_1: 1920 case Qt::Key_1:
1919 case Qt::Key_2: 1921 case Qt::Key_2:
1920 case Qt::Key_3: 1922 case Qt::Key_3:
1921 case Qt::Key_4: 1923 case Qt::Key_4:
1922 case Qt::Key_5: 1924 case Qt::Key_5:
1923 case Qt::Key_6: 1925 case Qt::Key_6:
1924 case Qt::Key_7: 1926 case Qt::Key_7:
1925 case Qt::Key_8: 1927 case Qt::Key_8:
1926 case Qt::Key_9: 1928 case Qt::Key_9:
1927 pro = e->key()-48; 1929 pro = e->key()-48;
1928 if ( pro == 0 ) 1930 if ( pro == 0 )
1929 pro = 10; 1931 pro = 10;
1930 if ( e->state() == Qt::ControlButton) 1932 if ( e->state() == Qt::ControlButton)
1931 pro += 10; 1933 pro += 10;
1932 break; 1934 break;
1933 case Qt::Key_M: 1935 case Qt::Key_M:
1934 mView->viewManager()->showMonthView(); 1936 mView->viewManager()->showMonthView();
1935 showSelectedDates = true; 1937 showSelectedDates = true;
1936 break; 1938 break;
1937 case Qt::Key_Insert: 1939 case Qt::Key_Insert:
1938 mView->newEvent(); 1940 mView->newEvent();
1939 break; 1941 break;
1940 case Qt::Key_S : 1942 case Qt::Key_S :
1941 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1943 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1942 mView->newSubTodo(); 1944 mView->newSubTodo();
1943 else 1945 else
1944 mView->dialogManager()->showSearchDialog(); 1946 mView->dialogManager()->showSearchDialog();
1945 break; 1947 break;
1946 case Qt::Key_Y : 1948 case Qt::Key_Y :
1947 case Qt::Key_Z : 1949 case Qt::Key_Z :
1948 mView->viewManager()->showWorkWeekView(); 1950 mView->viewManager()->showWorkWeekView();
1949 showSelectedDates = true; 1951 showSelectedDates = true;
1950 break; 1952 break;
1951 case Qt::Key_U : 1953 case Qt::Key_U :
1952 mView->viewManager()->showWeekView(); 1954 mView->viewManager()->showWeekView();
1953 showSelectedDates = true; 1955 showSelectedDates = true;
1954 break; 1956 break;
1955 case Qt::Key_H : 1957 case Qt::Key_H :
1956 keyBindings(); 1958 keyBindings();
1957 break; 1959 break;
1958 case Qt::Key_W: 1960 case Qt::Key_W:
1959 mView->viewManager()->showWhatsNextView(); 1961 mView->viewManager()->showWhatsNextView();
1960 break; 1962 break;
1961 case Qt::Key_L: 1963 case Qt::Key_L:
1962 mView->viewManager()->showListView(); 1964 mView->viewManager()->showListView();
1963 break; 1965 break;
1964 case Qt::Key_N: 1966 case Qt::Key_N:
1965 mView->viewManager()->showNextView(); 1967 mView->viewManager()->showNextView();
1966 break; 1968 break;
1967 case Qt::Key_V: 1969 case Qt::Key_V:
1968 mView->viewManager()->showTodoView(); 1970 mView->viewManager()->showTodoView();
1969 break; 1971 break;
1970 case Qt::Key_C: 1972 case Qt::Key_C:
1971 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1973 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1972 break; 1974 break;
1973 case Qt::Key_P: 1975 case Qt::Key_P:
1974 mView->showDatePicker( ); 1976 mView->showDatePicker( );
1975 break; 1977 break;
1976 case Qt::Key_F: 1978 case Qt::Key_F:
1977 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1979 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1978 mView->editFilters(); 1980 mView->editFilters();
1979 else 1981 else
1980 mView->toggleFilter(); 1982 mView->toggleFilter();
1981 break; 1983 break;
1982 case Qt::Key_X: 1984 case Qt::Key_X:
1983 if ( e->state() == Qt::ControlButton ) 1985 if ( e->state() == Qt::ControlButton )
1984 mView->toggleDateNavigatorWidget(); 1986 mView->toggleDateNavigatorWidget();
1985 else { 1987 else {
1986 mView->viewManager()->showNextXView(); 1988 mView->viewManager()->showNextXView();
1987 showSelectedDates = true; 1989 showSelectedDates = true;
1988 } 1990 }
1989 break; 1991 break;
1990 case Qt::Key_Space: 1992 case Qt::Key_Space:
1991 mView->toggleExpand(); 1993 mView->toggleExpand();
1992 break; 1994 break;
1993 case Qt::Key_A: 1995 case Qt::Key_A:
1994 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1996 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1995 mView->showNextAlarms(); 1997 mView->showNextAlarms();
1996 else 1998 else
1997 mView->toggleAllDaySize(); 1999 mView->toggleAllDaySize();
1998 break; 2000 break;
1999 case Qt::Key_T: 2001 case Qt::Key_T:
2000 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2002 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2001 mView->newTodo(); 2003 mView->newTodo();
2002 else { 2004 else {
2003 mView->goToday(); 2005 mView->goToday();
2004 showSelectedDates = true; 2006 showSelectedDates = true;
2005 } 2007 }
2006 break; 2008 break;
2007 case Qt::Key_J: 2009 case Qt::Key_J:
2008 mView->viewManager()->showJournalView(); 2010 mView->viewManager()->showJournalView();
2009 break; 2011 break;
2010 case Qt::Key_B: 2012 case Qt::Key_B:
2011 mView->editIncidenceDescription();; 2013 mView->editIncidenceDescription();;
2012 break; 2014 break;
2013 // case Qt::Key_Return: 2015 // case Qt::Key_Return:
2014 case Qt::Key_E: 2016 case Qt::Key_E:
2015 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2017 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2016 mView->newEvent(); 2018 mView->newEvent();
2017 else 2019 else
2018 mView->editIncidence(); 2020 mView->editIncidence();
2019 break; 2021 break;
2020 case Qt::Key_Plus: 2022 case Qt::Key_Plus:
2021 size = p->mHourSize +2; 2023 size = p->mHourSize +2;
2022 if ( size <= 22 ) 2024 if ( size <= 22 )
2023 configureAgenda( size ); 2025 configureAgenda( size );
2024 break; 2026 break;
2025 case Qt::Key_Minus: 2027 case Qt::Key_Minus:
2026 size = p->mHourSize - 2; 2028 size = p->mHourSize - 2;
2027 if ( size >= 4 ) 2029 if ( size >= 4 )
2028 configureAgenda( size ); 2030 configureAgenda( size );
2029 break; 2031 break;
2030 2032
2031 2033
2032 default: 2034 default:
2033 e->ignore(); 2035 e->ignore();
2034 } 2036 }
2035 if ( pro > 0 ) { 2037 if ( pro > 0 ) {
2036 mView->selectFilter( pro-1 ); 2038 mView->selectFilter( pro-1 );
2037 } 2039 }
2038 if ( showSelectedDates ) { 2040 if ( showSelectedDates ) {
2039 ;// setCaptionToDates(); 2041 ;// setCaptionToDates();
2040 } 2042 }
2041 2043
2042} 2044}
2043void MainWindow::fillFilterMenuTB() 2045void MainWindow::fillFilterMenuTB()
2044{ 2046{
2045 selectFilterMenuTB->clear(); 2047 selectFilterMenuTB->clear();
2046 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2048 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2047 selectFilterMenuTB->insertSeparator(); 2049 selectFilterMenuTB->insertSeparator();
2048 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2050 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2049 2051
2050 selectFilterMenuTB->insertSeparator(); 2052 selectFilterMenuTB->insertSeparator();
2051 QPtrList<CalFilter> fili = mView->filters(); 2053 QPtrList<CalFilter> fili = mView->filters();
2052 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2054 CalFilter *curfilter = mView->filterView()->selectedFilter();
2053 CalFilter *filter = fili.first(); 2055 CalFilter *filter = fili.first();
2054 int iii = 2; 2056 int iii = 2;
2055 bool checkitem = mView->filterView()->filtersEnabled(); 2057 bool checkitem = mView->filterView()->filtersEnabled();
2056 while(filter) { 2058 while(filter) {
2057 selectFilterMenuTB->insertItem( filter->name(), iii ); 2059 selectFilterMenuTB->insertItem( filter->name(), iii );
2058 if ( filter == curfilter) 2060 if ( filter == curfilter)
2059 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2061 selectFilterMenuTB->setItemChecked( iii, checkitem );
2060 filter = fili.next(); 2062 filter = fili.next();
2061 ++iii; 2063 ++iii;
2062 } 2064 }
2063 if ( !checkitem ) 2065 if ( !checkitem )
2064 selectFilterMenuTB->setItemChecked( 1, true ); 2066 selectFilterMenuTB->setItemChecked( 1, true );
2065 2067
2066 int x = 0; 2068 int x = 0;
2067 int y = iconToolBar->height(); 2069 int y = iconToolBar->height();
2068 int dX = 0; 2070 int dX = 0;
2069 int dY = 0; 2071 int dY = 0;
2070 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2072 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2071 if ( iconToolBar->y() > height()/2 ) { 2073 if ( iconToolBar->y() > height()/2 ) {
2072 dY = selectFilterMenuTB->sizeHint().height()+8; 2074 dY = selectFilterMenuTB->sizeHint().height()+8;
2073 y = 0; 2075 y = 0;
2074 } 2076 }
2075 } else { 2077 } else {
2076 if ( iconToolBar->x() > width()/2 ) { // right side 2078 if ( iconToolBar->x() > width()/2 ) { // right side
2077 x=0; 2079 x=0;
2078 dX= selectFilterMenuTB->sizeHint().width()+8; 2080 dX= selectFilterMenuTB->sizeHint().width()+8;
2079 y = 0; 2081 y = 0;
2080 } else { 2082 } else {
2081 x= iconToolBar->width(); 2083 x= iconToolBar->width();
2082 y = 0; 2084 y = 0;
2083 } 2085 }
2084 } 2086 }
2085 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2087 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2086 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2088 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2087} 2089}
2088void MainWindow::fillFilterMenu() 2090void MainWindow::fillFilterMenu()
2089{ 2091{
2090 selectFilterMenu->clear(); 2092 selectFilterMenu->clear();
2091 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2093 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2092 selectFilterMenu->insertSeparator(); 2094 selectFilterMenu->insertSeparator();
2093 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2095 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2094 2096
2095 selectFilterMenu->insertSeparator(); 2097 selectFilterMenu->insertSeparator();
2096 QPtrList<CalFilter> fili = mView->filters(); 2098 QPtrList<CalFilter> fili = mView->filters();
2097 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2099 CalFilter *curfilter = mView->filterView()->selectedFilter();
2098 CalFilter *filter = fili.first(); 2100 CalFilter *filter = fili.first();
2099 int iii = 2; 2101 int iii = 2;
2100 bool checkitem = mView->filterView()->filtersEnabled(); 2102 bool checkitem = mView->filterView()->filtersEnabled();
2101 while(filter) { 2103 while(filter) {
2102 selectFilterMenu->insertItem( filter->name(), iii ); 2104 selectFilterMenu->insertItem( filter->name(), iii );
2103 if ( filter == curfilter) 2105 if ( filter == curfilter)
2104 selectFilterMenu->setItemChecked( iii, checkitem ); 2106 selectFilterMenu->setItemChecked( iii, checkitem );
2105 filter = fili.next(); 2107 filter = fili.next();
2106 ++iii; 2108 ++iii;
2107 } 2109 }
2108 if ( !checkitem ) 2110 if ( !checkitem )
2109 selectFilterMenu->setItemChecked( 1, true ); 2111 selectFilterMenu->setItemChecked( 1, true );
2110} 2112}
2111void MainWindow::fillFilterMenuPopup() 2113void MainWindow::fillFilterMenuPopup()
2112{ 2114{
2113 filterPopupMenu->clear(); 2115 filterPopupMenu->clear();
2114 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2116 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2115 2117
2116 filterPopupMenu->insertSeparator(); 2118 filterPopupMenu->insertSeparator();
2117 QPtrList<CalFilter> fili = mView->filters(); 2119 QPtrList<CalFilter> fili = mView->filters();
2118 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2120 CalFilter *curfilter = mView->filterView()->selectedFilter();
2119 CalFilter *filter = fili.first(); 2121 CalFilter *filter = fili.first();
2120 int iii = 1; 2122 int iii = 1;
2121 bool checkitem = mView->filterView()->filtersEnabled(); 2123 bool checkitem = mView->filterView()->filtersEnabled();
2122 while(filter) { 2124 while(filter) {
2123 filterPopupMenu->insertItem( filter->name(), iii ); 2125 filterPopupMenu->insertItem( filter->name(), iii );
2124 if ( filter == curfilter) 2126 if ( filter == curfilter)
2125 filterPopupMenu->setItemChecked( iii, checkitem ); 2127 filterPopupMenu->setItemChecked( iii, checkitem );
2126 filter = fili.next(); 2128 filter = fili.next();
2127 ++iii; 2129 ++iii;
2128 } 2130 }
2129 if ( !checkitem ) 2131 if ( !checkitem )
2130 filterPopupMenu->setItemChecked( 0, true ); 2132 filterPopupMenu->setItemChecked( 0, true );
2131} 2133}
2132void MainWindow::selectFilter( int fil ) 2134void MainWindow::selectFilter( int fil )
2133{ 2135{
2134 2136
2135 if ( fil == 0 ) { 2137 if ( fil == 0 ) {
2136 mView->editFilters( ); 2138 mView->editFilters( );
2137 } else if ( fil == 1 ){ 2139 } else if ( fil == 1 ){
2138 if ( mView->filterView()->filtersEnabled() ) 2140 if ( mView->filterView()->filtersEnabled() )
2139 mView->toggleFilerEnabled( ); 2141 mView->toggleFilerEnabled( );
2140 } else { 2142 } else {
2141 if ( !mView->filterView()->filtersEnabled() ) { 2143 if ( !mView->filterView()->filtersEnabled() ) {
2142 mView->filterView()->blockSignals( true ); 2144 mView->filterView()->blockSignals( true );
2143 mView->toggleFilerEnabled( ); 2145 mView->toggleFilerEnabled( );
2144 mView->filterView()->blockSignals( false ); 2146 mView->filterView()->blockSignals( false );
2145 } 2147 }
2146 mView->selectFilter( fil-2 ); 2148 mView->selectFilter( fil-2 );
2147 } 2149 }
2148} 2150}
2149void MainWindow::updateFilterToolbar() 2151void MainWindow::updateFilterToolbar()
2150{ 2152{
2151 if ( filterMenubar ) { 2153 if ( filterMenubar ) {
2152 if ( !mView->filterView()->filtersEnabled() ) { 2154 if ( !mView->filterView()->filtersEnabled() ) {
2153 filterMenubar->changeItem( 0, i18n("No Filter") ); 2155 filterMenubar->changeItem( 0, i18n("No Filter") );
2154 } else { 2156 } else {
2155 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2157 CalFilter *curfilter = mView->filterView()->selectedFilter();
2156 if ( curfilter ) { 2158 if ( curfilter ) {
2157 filterMenubar->changeItem( 0, curfilter->name() ); 2159 filterMenubar->changeItem( 0, curfilter->name() );
2158 } 2160 }
2159 } 2161 }
2160 } 2162 }
2161} 2163}
2162void MainWindow::selectFilterPopup( int fil ) 2164void MainWindow::selectFilterPopup( int fil )
2163{ 2165{
2164 selectFilter( fil + 1 ); 2166 selectFilter( fil + 1 );
2165 2167
2166} 2168}
2167void MainWindow::configureToolBar( int item ) 2169void MainWindow::configureToolBar( int item )
2168{ 2170{
2169 2171
2170 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2172 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2171 KOPrefs *p = KOPrefs::instance(); 2173 KOPrefs *p = KOPrefs::instance();
2172 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2174 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2173 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2175 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2174 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2176 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2175 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2177 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2176 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2178 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2177 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2179 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2178 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2180 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2179 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2181 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2180 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2182 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2181 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2183 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2182 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2184 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2183 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2185 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2184 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2186 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2185 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2187 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2186 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2188 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2187 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2189 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2188 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2190 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2189 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2191 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2190 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2192 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2191 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2193 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2192 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2194 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2193 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2195 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2194 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2196 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2195 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2197 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2196 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2198 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2197 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2199 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2198 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2200 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2199 // initActions(); 2201 // initActions();
2200} 2202}
2201void MainWindow::setCaption ( const QString & c ) 2203void MainWindow::setCaption ( const QString & c )
2202{ 2204{
2203 QString cap = c; 2205 QString cap = c;
2204 cap.replace( QRegExp("\n"), " " ); 2206 cap.replace( QRegExp("\n"), " " );
2205 cap = cap.stripWhiteSpace(); 2207 cap = cap.stripWhiteSpace();
2206 if ( cap.isEmpty() ) 2208 if ( cap.isEmpty() )
2207 cap = "KO/Pi"; 2209 cap = "KO/Pi";
2208 QWidget::setCaption( cap ); 2210 QWidget::setCaption( cap );
2209} 2211}
2210void MainWindow::setCaptionToDates() 2212void MainWindow::setCaptionToDates()
2211{ 2213{
2212 QString selDates; 2214 QString selDates;
2213 QDate date = mView->startDate(); 2215 QDate date = mView->startDate();
2214 if ( ! date.isValid() ) { 2216 if ( ! date.isValid() ) {
2215 setCaption(""); 2217 setCaption("");
2216 return; 2218 return;
2217 } 2219 }
2218 selDates = KGlobal::locale()->formatDate( date, true); 2220 selDates = KGlobal::locale()->formatDate( date, true);
2219 if (mView->startDate() < mView->endDate() ) 2221 if (mView->startDate() < mView->endDate() )
2220 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2222 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2221 else { 2223 else {
2222 QString addString; 2224 QString addString;
2223 if ( date == QDateTime::currentDateTime().date() ) 2225 if ( date == QDateTime::currentDateTime().date() )
2224 addString = i18n("Today"); 2226 addString = i18n("Today");
2225 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2227 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2226 addString = i18n("Tomorrow"); 2228 addString = i18n("Tomorrow");
2227 if ( !addString.isEmpty() ) 2229 if ( !addString.isEmpty() )
2228 selDates = addString+", "+selDates ; 2230 selDates = addString+", "+selDates ;
2229 } 2231 }
2230 setCaption( i18n("Dates: ") + selDates ); 2232 setCaption( i18n("Dates: ") + selDates );
2231 2233
2232} 2234}
2233void MainWindow::showConfigureAgenda( ) 2235void MainWindow::showConfigureAgenda( )
2234{ 2236{
2235 int iii; 2237 int iii;
2236 for ( iii = 1;iii<= 10 ;++iii ){ 2238 for ( iii = 1;iii<= 10 ;++iii ){
2237 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2239 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2238 } 2240 }
2239 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2241 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2240} 2242}
2241void MainWindow::configureAgenda( int item ) 2243void MainWindow::configureAgenda( int item )
2242{ 2244{
2243 if ( KOPrefs::instance()->mHourSize == item ) 2245 if ( KOPrefs::instance()->mHourSize == item )
2244 return; 2246 return;
2245 KOPrefs::instance()->mHourSize=item; 2247 KOPrefs::instance()->mHourSize=item;
2246 mView->viewManager()->agendaView()->updateConfig(); 2248 mView->viewManager()->agendaView()->updateConfig();
2247} 2249}
2248 2250
2249void MainWindow::saveCalendar() 2251void MainWindow::saveCalendar()
2250{ 2252{
2251 QString fn = KOPrefs::instance()->mLastSaveFile; 2253 QString fn = KOPrefs::instance()->mLastSaveFile;
2252 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2254 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2253 2255
2254 if ( fn == "" ) 2256 if ( fn == "" )
2255 return; 2257 return;
2256 QFileInfo info; 2258 QFileInfo info;
2257 info.setFile( fn ); 2259 info.setFile( fn );
2258 QString mes; 2260 QString mes;
2259 bool createbup = true; 2261 bool createbup = true;
2260 if ( info. exists() ) { 2262 if ( info. exists() ) {
2261 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2263 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2262 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2264 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2263 i18n("Overwrite!"), i18n("Cancel"), 0, 2265 i18n("Overwrite!"), i18n("Cancel"), 0,
2264 0, 1 ); 2266 0, 1 );
2265 if ( result != 0 ) { 2267 if ( result != 0 ) {
2266 createbup = false; 2268 createbup = false;
2267 } 2269 }
2268 } 2270 }
2269 if ( createbup ) { 2271 if ( createbup ) {
2270 mView->saveCalendar( fn ); 2272 mView->saveCalendar( fn );
2271 mes = i18n("KO/Pi:Saved %1").arg(fn); 2273 mes = i18n("KO/Pi:Saved %1").arg(fn);
2272 KOPrefs::instance()->mLastSaveFile = fn; 2274 KOPrefs::instance()->mLastSaveFile = fn;
2273 setCaption(mes); 2275 setCaption(mes);
2274 } 2276 }
2275} 2277}
2276void MainWindow::loadCalendar() 2278void MainWindow::loadCalendar()
2277{ 2279{
2278 2280
2279 QString fn = KOPrefs::instance()->mLastLoadFile; 2281 QString fn = KOPrefs::instance()->mLastLoadFile;
2280 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2282 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2281 2283
2282 if ( fn == "" ) 2284 if ( fn == "" )
2283 return; 2285 return;
2284 QFileInfo info; 2286 QFileInfo info;
2285 info.setFile( fn ); 2287 info.setFile( fn );
2286 QString mess; 2288 QString mess;
2287 bool loadbup = true; 2289 bool loadbup = true;
2288 if ( info. exists() ) { 2290 if ( info. exists() ) {
2289 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2291 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2290 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2292 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2291 mess, 2293 mess,
2292 i18n("Load!"), i18n("Cancel"), 0, 2294 i18n("Load!"), i18n("Cancel"), 0,
2293 0, 1 ); 2295 0, 1 );
2294 if ( result != 0 ) { 2296 if ( result != 0 ) {
2295 loadbup = false; 2297 loadbup = false;
2296 } 2298 }
2297 } else { 2299 } else {
2298 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2300 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2299 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2301 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2300 0, 1 ); 2302 0, 1 );
2301 2303
2302 return; 2304 return;
2303 } 2305 }
2304 if ( loadbup ) { 2306 if ( loadbup ) {
2305 mView->openCalendar( fn ); 2307 mView->openCalendar( fn );
2306 KOPrefs::instance()->mLastLoadFile = fn; 2308 KOPrefs::instance()->mLastLoadFile = fn;
2307 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2309 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2308 setCaption(mess); 2310 setCaption(mess);
2309 } 2311 }
2310 2312
2311} 2313}
2312void MainWindow::quickImportIcal() 2314void MainWindow::quickImportIcal()
2313{ 2315{
2314 importFile( KOPrefs::instance()->mLastImportFile, false ); 2316 importFile( KOPrefs::instance()->mLastImportFile, false );
2315} 2317}
2316void MainWindow::importFile( QString fn, bool quick ) 2318void MainWindow::importFile( QString fn, bool quick )
2317{ 2319{
2318 QFileInfo info; 2320 QFileInfo info;
2319 info.setFile( fn ); 2321 info.setFile( fn );
2320 QString mess; 2322 QString mess;
2321 bool loadbup = true; 2323 bool loadbup = true;
2322 if ( !info. exists() ) { 2324 if ( !info. exists() ) {
2323 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2325 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2324 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2326 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2325 mess ); 2327 mess );
2326 return; 2328 return;
2327 } 2329 }
2328 int result = 0; 2330 int result = 0;
2329 if ( !quick ) { 2331 if ( !quick ) {
2330 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2332 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2331 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2333 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2332 mess, 2334 mess,
2333 "Import", "Cancel", 0, 2335 "Import", "Cancel", 0,
2334 0, 1 ); 2336 0, 1 );
2335 } 2337 }
2336 if ( result == 0 ) { 2338 if ( result == 0 ) {
2337 if ( mView->openCalendar( fn, true )) { 2339 if ( mView->openCalendar( fn, true )) {
2338 KOPrefs::instance()->mLastImportFile = fn; 2340 KOPrefs::instance()->mLastImportFile = fn;
2339 setCaption(i18n("Imported file successfully")); 2341 setCaption(i18n("Imported file successfully"));
2340 } else { 2342 } else {
2341 setCaption(i18n("Error importing file")); 2343 setCaption(i18n("Error importing file"));
2342 } 2344 }
2343 } 2345 }
2344} 2346}
2345 2347
2346void MainWindow::importIcal() 2348void MainWindow::importIcal()
2347{ 2349{
2348 2350
2349 QString fn =KOPrefs::instance()->mLastImportFile; 2351 QString fn =KOPrefs::instance()->mLastImportFile;
2350 2352
2351 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2353 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2352 if ( fn == "" ) 2354 if ( fn == "" )
2353 return; 2355 return;
2354 importFile( fn, true ); 2356 importFile( fn, true );
2355 2357
2356} 2358}
2357 2359
2358void MainWindow::exportVCalendar() 2360void MainWindow::exportVCalendar()
2359{ 2361{
2360 QString fn = KOPrefs::instance()->mLastVcalFile; 2362 QString fn = KOPrefs::instance()->mLastVcalFile;
2361 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2363 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2362 if ( fn == "" ) 2364 if ( fn == "" )
2363 return; 2365 return;
2364 QFileInfo info; 2366 QFileInfo info;
2365 info.setFile( fn ); 2367 info.setFile( fn );
2366 QString mes; 2368 QString mes;
2367 bool createbup = true; 2369 bool createbup = true;
2368 if ( info. exists() ) { 2370 if ( info. exists() ) {
2369 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2371 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2370 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2372 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2371 i18n("Overwrite!"), i18n("Cancel"), 0, 2373 i18n("Overwrite!"), i18n("Cancel"), 0,
2372 0, 1 ); 2374 0, 1 );
2373 if ( result != 0 ) { 2375 if ( result != 0 ) {
2374 createbup = false; 2376 createbup = false;
2375 } 2377 }
2376 } 2378 }
2377 if ( createbup ) { 2379 if ( createbup ) {
2378 if ( mView->exportVCalendar( fn ) ) { 2380 if ( mView->exportVCalendar( fn ) ) {
2379 KOPrefs::instance()->mLastVcalFile = fn; 2381 KOPrefs::instance()->mLastVcalFile = fn;
2380 if ( fn.length() > 20 ) 2382 if ( fn.length() > 20 )
2381 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2383 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2382 else 2384 else
2383 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2385 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2384 setCaption(mes); 2386 setCaption(mes);
2385 } 2387 }
2386 } 2388 }
2387 2389
2388} 2390}
2389QString MainWindow::sentSyncFile() 2391QString MainWindow::sentSyncFile()
2390{ 2392{
2391#ifdef DESKTOP_VERSION 2393#ifdef DESKTOP_VERSION
2392 return locateLocal( "tmp", "copysynccal.ics" ); 2394 return locateLocal( "tmp", "copysynccal.ics" );
2393#else 2395#else
2394 return QString( "/tmp/copysynccal.ics" ); 2396 return QString( "/tmp/copysynccal.ics" );
2395#endif 2397#endif
2396} 2398}
2397 2399
2398void MainWindow::syncFileRequest() 2400void MainWindow::syncFileRequest()
2399{ 2401{
2400 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2402 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2401 mSyncManager->slotSyncMenu( 999 ); 2403 mSyncManager->slotSyncMenu( 999 );
2402 } 2404 }
2403 2405
2404 setCaption(i18n("Saving Data to temp file ..." )); 2406 setCaption(i18n("Saving Data to temp file ..." ));
2405 mView->saveCalendar( sentSyncFile() ); 2407 mView->saveCalendar( sentSyncFile() );
2406 setCaption(i18n("Data saved to temp file!" )); 2408 setCaption(i18n("Data saved to temp file!" ));
2407 2409
2408} 2410}
2409void MainWindow::getFile( bool success ) 2411void MainWindow::getFile( bool success )
2410{ 2412{
2411 if ( ! success ) { 2413 if ( ! success ) {
2412 setCaption( i18n("Error receiving file. Nothing changed!") ); 2414 setCaption( i18n("Error receiving file. Nothing changed!") );
2413 return; 2415 return;
2414 } 2416 }
2415 mView->openCalendar( sentSyncFile() ); 2417 mView->openCalendar( sentSyncFile() );
2416 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2418 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2417 mSyncManager->slotSyncMenu( 999 ); 2419 mSyncManager->slotSyncMenu( 999 );
2418 } 2420 }
2419 setCaption( i18n("Pi-Sync successful!") ); 2421 setCaption( i18n("Pi-Sync successful!") );
2420} 2422}
2421 2423
2422void MainWindow::printSel( ) 2424void MainWindow::printSel( )
2423{ 2425{
2424 mView->viewManager()->agendaView()->agenda()->printSelection(); 2426 mView->viewManager()->agendaView()->agenda()->printSelection();
2425} 2427}
2426 2428
2427void MainWindow::printCal() 2429void MainWindow::printCal()
2428{ 2430{
2429 mView->print();//mCp->showDialog(); 2431 mView->print();//mCp->showDialog();
2430} 2432}
2431 2433
2432 2434
2433#include "libkdepim/kdatepicker.h" 2435#include "libkdepim/kdatepicker.h"
2434#include <kdatetbl.h> 2436#include <kdatetbl.h>
2435 2437
2436void MainWindow::weekAction() 2438void MainWindow::weekAction()
2437{ 2439{
2438 int month; 2440 int month;
2439 KPopupFrame* popup = new KPopupFrame(this); 2441 KPopupFrame* popup = new KPopupFrame(this);
2440 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2442 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2441 // ----- 2443 // -----
2442 picker->resize(picker->sizeHint()); 2444 picker->resize(picker->sizeHint());
2443 popup->setMainWidget(picker); 2445 popup->setMainWidget(picker);
2444 picker->setFocus(); 2446 picker->setFocus();
2445 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2447 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2446 int x = 0; 2448 int x = 0;
2447 int y = iconToolBar->height(); 2449 int y = iconToolBar->height();
2448 int dX = 0; 2450 int dX = 0;
2449 int dY = 0; 2451 int dY = 0;
2450 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2452 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2451 if ( iconToolBar->y() > height()/2 ) { 2453 if ( iconToolBar->y() > height()/2 ) {
2452 dY = picker->sizeHint().height()+8; 2454 dY = picker->sizeHint().height()+8;
2453 y = 0; 2455 y = 0;
2454 } 2456 }
2455 } else { 2457 } else {
2456 if ( iconToolBar->x() > width()/2 ) { // right side 2458 if ( iconToolBar->x() > width()/2 ) { // right side
2457 x=0; 2459 x=0;
2458 dX= picker->sizeHint().width()+8; 2460 dX= picker->sizeHint().width()+8;
2459 y = 0; 2461 y = 0;
2460 } else { 2462 } else {
2461 x= iconToolBar->width(); 2463 x= iconToolBar->width();
2462 y = 0; 2464 y = 0;
2463 } 2465 }
2464 } 2466 }
2465 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2467 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2466 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2468 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2467 { 2469 {
2468 month = picker->getResult(); 2470 month = picker->getResult();
2469 emit selectWeek ( month ); 2471 emit selectWeek ( month );
2470 //qDebug("weekSelected %d ", month); 2472 //qDebug("weekSelected %d ", month);
2471 } 2473 }
2472 delete popup; 2474 delete popup;
2473} 2475}
2474 2476
2475void MainWindow::hideEvent ( QHideEvent * ) 2477void MainWindow::hideEvent ( QHideEvent * )
2476{ 2478{
2477 QString message; 2479 QString message;
2478 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2480 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2479 if ( nextA.isValid() ) { 2481 if ( nextA.isValid() ) {
2480 QString sum = mCalendar->nextSummary(); 2482 QString sum = mCalendar->nextSummary();
2481 2483
2482 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2484 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));