summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp22
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp6
2 files changed, 26 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b378330..192f8c0 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -897,542 +897,562 @@ QPtrList<Incidence> KOListView::selectedIncidences()
897 } 897 }
898 898
899 // // QListViewItem *item = mListView->selectedItem(); 899 // // QListViewItem *item = mListView->selectedItem();
900 //if (item) eventList.append(((KOListViewItem *)item)->data()); 900 //if (item) eventList.append(((KOListViewItem *)item)->data());
901 901
902 return eventList; 902 return eventList;
903} 903}
904 904
905DateList KOListView::selectedDates() 905DateList KOListView::selectedDates()
906{ 906{
907 DateList eventList; 907 DateList eventList;
908 return eventList; 908 return eventList;
909} 909}
910 910
911void KOListView::showDates(bool show) 911void KOListView::showDates(bool show)
912{ 912{
913 // Shouldn't we set it to a value greater 0? When showDates is called with 913 // Shouldn't we set it to a value greater 0? When showDates is called with
914 // show == true at first, then the columnwidths are set to zero. 914 // show == true at first, then the columnwidths are set to zero.
915 static int oldColWidth1 = 0; 915 static int oldColWidth1 = 0;
916 static int oldColWidth3 = 0; 916 static int oldColWidth3 = 0;
917 917
918 if (!show) { 918 if (!show) {
919 oldColWidth1 = mListView->columnWidth(1); 919 oldColWidth1 = mListView->columnWidth(1);
920 oldColWidth3 = mListView->columnWidth(3); 920 oldColWidth3 = mListView->columnWidth(3);
921 mListView->setColumnWidth(1, 0); 921 mListView->setColumnWidth(1, 0);
922 mListView->setColumnWidth(3, 0); 922 mListView->setColumnWidth(3, 0);
923 } else { 923 } else {
924 mListView->setColumnWidth(1, oldColWidth1); 924 mListView->setColumnWidth(1, oldColWidth1);
925 mListView->setColumnWidth(3, oldColWidth3); 925 mListView->setColumnWidth(3, oldColWidth3);
926 } 926 }
927 mListView->repaint(); 927 mListView->repaint();
928} 928}
929 929
930void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 930void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
931 const QDate &td) 931 const QDate &td)
932{ 932{
933#ifndef KORG_NOPRINTER 933#ifndef KORG_NOPRINTER
934 calPrinter->preview(CalPrinter::Day, fd, td); 934 calPrinter->preview(CalPrinter::Day, fd, td);
935#endif 935#endif
936} 936}
937 937
938void KOListView::showDates() 938void KOListView::showDates()
939{ 939{
940 showDates(true); 940 showDates(true);
941} 941}
942 942
943void KOListView::hideDates() 943void KOListView::hideDates()
944{ 944{
945 showDates(false); 945 showDates(false);
946} 946}
947 947
948void KOListView::resetFocus() 948void KOListView::resetFocus()
949{ 949{
950 topLevelWidget()->setActiveWindow(); 950 topLevelWidget()->setActiveWindow();
951 topLevelWidget()->raise(); 951 topLevelWidget()->raise();
952 mListView->setFocus(); 952 mListView->setFocus();
953} 953}
954void KOListView::updateView() 954void KOListView::updateView()
955{ 955{
956 mListView->setFocus(); 956 mListView->setFocus();
957 if ( mListView->firstChild () ) { 957 if ( mListView->firstChild () ) {
958 mListView->setCurrentItem( mListView->firstChild () ); 958 mListView->setCurrentItem( mListView->firstChild () );
959 } 959 }
960 processSelectionChange( mListView->firstChild () ); 960 processSelectionChange( mListView->firstChild () );
961} 961}
962void KOListView::updateConfig() 962void KOListView::updateConfig()
963{ 963{
964 964
965 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 965 mListView->setFont ( KOPrefs::instance()->mListViewFont );
966 updateView(); 966 updateView();
967 967
968} 968}
969void KOListView::setStartDate(const QDate &start) 969void KOListView::setStartDate(const QDate &start)
970{ 970{
971 mStartDate = start; 971 mStartDate = start;
972} 972}
973 973
974void KOListView::showDates(const QDate &start, const QDate &end) 974void KOListView::showDates(const QDate &start, const QDate &end)
975{ 975{
976 clear(); 976 clear();
977 mStartDate = start; 977 mStartDate = start;
978 QDate date = start; 978 QDate date = start;
979 while( date <= end ) { 979 while( date <= end ) {
980 addEvents(calendar()->events(date)); 980 addEvents(calendar()->events(date));
981 addTodos(calendar()->todos(date)); 981 addTodos(calendar()->todos(date));
982 addJournals( calendar()->journals4Date(date) ); 982 addJournals( calendar()->journals4Date(date) );
983 date = date.addDays( 1 ); 983 date = date.addDays( 1 );
984 } 984 }
985 //emit incidenceSelected( 0 ); 985 //emit incidenceSelected( 0 );
986 updateView(); 986 updateView();
987 987
988} 988}
989 989
990void KOListView::addEvents(QPtrList<Event> eventList) 990void KOListView::addEvents(QPtrList<Event> eventList)
991{ 991{
992 992
993 Event *ev; 993 Event *ev;
994 for(ev = eventList.first(); ev; ev = eventList.next()) { 994 for(ev = eventList.first(); ev; ev = eventList.next()) {
995 addIncidence(ev); 995 addIncidence(ev);
996 } 996 }
997 if ( !mListView->currentItem() ){ 997 if ( !mListView->currentItem() ){
998 updateView(); 998 updateView();
999 } 999 }
1000} 1000}
1001 1001
1002void KOListView::addTodos(QPtrList<Todo> eventList) 1002void KOListView::addTodos(QPtrList<Todo> eventList)
1003{ 1003{
1004 Todo *ev; 1004 Todo *ev;
1005 for(ev = eventList.first(); ev; ev = eventList.next()) { 1005 for(ev = eventList.first(); ev; ev = eventList.next()) {
1006 addIncidence(ev); 1006 addIncidence(ev);
1007 } 1007 }
1008 if ( !mListView->currentItem() ){ 1008 if ( !mListView->currentItem() ){
1009 updateView(); 1009 updateView();
1010 } 1010 }
1011} 1011}
1012void KOListView::addJournals(QPtrList<Journal> eventList) 1012void KOListView::addJournals(QPtrList<Journal> eventList)
1013{ 1013{
1014 Journal *ev; 1014 Journal *ev;
1015 for(ev = eventList.first(); ev; ev = eventList.next()) { 1015 for(ev = eventList.first(); ev; ev = eventList.next()) {
1016 addIncidence(ev); 1016 addIncidence(ev);
1017 } 1017 }
1018 if ( !mListView->currentItem() ){ 1018 if ( !mListView->currentItem() ){
1019 updateView(); 1019 updateView();
1020 } 1020 }
1021} 1021}
1022 1022
1023void KOListView::showCompletedTodos() 1023void KOListView::showCompletedTodos()
1024{ 1024{
1025 mForceShowCompletedTodos = true; 1025 mForceShowCompletedTodos = true;
1026} 1026}
1027void KOListView::addIncidence(Incidence *incidence) 1027void KOListView::addIncidence(Incidence *incidence)
1028{ 1028{
1029 if ( mUidDict.find( incidence->uid() ) ) return; 1029 if ( mUidDict.find( incidence->uid() ) ) return;
1030 1030
1031 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 1031 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
1032 if ( incidence->typeID() == todoID ) { 1032 if ( incidence->typeID() == todoID ) {
1033 if ( ! mForceShowCompletedTodos ) { 1033 if ( ! mForceShowCompletedTodos ) {
1034 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) 1034 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() )
1035 return; 1035 return;
1036 } 1036 }
1037 } 1037 }
1038 mUidDict.insert( incidence->uid(), incidence ); 1038 mUidDict.insert( incidence->uid(), incidence );
1039 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 1039 KOListViewItem *item = new KOListViewItem( incidence, mListView );
1040 ListItemVisitor v(item, mStartDate ); 1040 ListItemVisitor v(item, mStartDate );
1041 if (incidence->accept(v)) { 1041 if (incidence->accept(v)) {
1042 return; 1042 return;
1043 } 1043 }
1044 else delete item; 1044 else delete item;
1045} 1045}
1046 1046
1047void KOListView::showEvents(QPtrList<Event> eventList) 1047void KOListView::showEvents(QPtrList<Event> eventList)
1048{ 1048{
1049 clear(); 1049 clear();
1050 1050
1051 addEvents(eventList); 1051 addEvents(eventList);
1052 1052
1053 // After new creation of list view no events are selected. 1053 // After new creation of list view no events are selected.
1054 emit incidenceSelected( 0 ); 1054 emit incidenceSelected( 0 );
1055} 1055}
1056int KOListView::count() 1056int KOListView::count()
1057{ 1057{
1058 return mListView->childCount(); 1058 return mListView->childCount();
1059} 1059}
1060 1060
1061void KOListView::changeEventDisplay(Event *event, int action) 1061void KOListView::changeEventDisplay(Event *event, int action)
1062{ 1062{
1063 KOListViewItem *item; 1063 KOListViewItem *item;
1064 1064
1065 switch(action) { 1065 switch(action) {
1066 case KOGlobals::EVENTADDED: 1066 case KOGlobals::EVENTADDED:
1067 addIncidence( event ); 1067 addIncidence( event );
1068 break; 1068 break;
1069 case KOGlobals::EVENTEDITED: 1069 case KOGlobals::EVENTEDITED:
1070 item = getItemForEvent(event); 1070 item = getItemForEvent(event);
1071 if (item) { 1071 if (item) {
1072 ListItemVisitor v(item, mStartDate ); 1072 ListItemVisitor v(item, mStartDate );
1073 ((Incidence*)event)->accept(v); 1073 ((Incidence*)event)->accept(v);
1074 } 1074 }
1075 break; 1075 break;
1076 case KOGlobals::EVENTDELETED: 1076 case KOGlobals::EVENTDELETED:
1077 item = getItemForEvent(event); 1077 item = getItemForEvent(event);
1078 if (item) { 1078 if (item) {
1079 mUidDict.remove( event->uid() ); 1079 mUidDict.remove( event->uid() );
1080 delete item; 1080 delete item;
1081 } 1081 }
1082 break; 1082 break;
1083 default: 1083 default:
1084 ; 1084 ;
1085 } 1085 }
1086} 1086}
1087 1087
1088KOListViewItem *KOListView::getItemForEvent(Incidence *event) 1088KOListViewItem *KOListView::getItemForEvent(Incidence *event)
1089{ 1089{
1090 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 1090 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
1091 while (item) { 1091 while (item) {
1092 if (item->data() == event) return item; 1092 if (item->data() == event) return item;
1093 item = (KOListViewItem *)item->nextSibling(); 1093 item = (KOListViewItem *)item->nextSibling();
1094 } 1094 }
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098void KOListView::defaultItemAction(QListViewItem *i) 1098void KOListView::defaultItemAction(QListViewItem *i)
1099{ 1099{
1100 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 1100 KOListViewItem *item = static_cast<KOListViewItem *>( i );
1101 if ( item ) defaultAction( item->data() ); 1101 if ( item ) defaultAction( item->data() );
1102 1102
1103} 1103}
1104 1104
1105void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 1105void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
1106{ 1106{
1107 mActiveItem = (KOListViewItem *)item; 1107 mActiveItem = (KOListViewItem *)item;
1108 if (mActiveItem) { 1108 if (mActiveItem) {
1109 Incidence *incidence = mActiveItem->data(); 1109 Incidence *incidence = mActiveItem->data();
1110 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); 1110 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
1111 mPopupMenu->showIncidencePopup(incidence); 1111 mPopupMenu->showIncidencePopup(incidence);
1112 1112
1113 /* 1113 /*
1114 if ( incidence && incidence->type() == "Event" ) { 1114 if ( incidence && incidence->type() == "Event" ) {
1115 Event *event = static_cast<Event *>( incidence ); 1115 Event *event = static_cast<Event *>( incidence );
1116 mPopupMenu->showEventPopup(event); 1116 mPopupMenu->showEventPopup(event);
1117 } 1117 }
1118 */ 1118 */
1119 } 1119 }
1120} 1120}
1121 1121
1122void KOListView::readSettings(KConfig *config, QString setting) 1122void KOListView::readSettings(KConfig *config, QString setting)
1123{ 1123{
1124 // qDebug("KOListView::readSettings "); 1124 // qDebug("KOListView::readSettings ");
1125 mListView->restoreLayout(config,setting); 1125 mListView->restoreLayout(config,setting);
1126} 1126}
1127 1127
1128void KOListView::writeSettings(KConfig *config, QString setting) 1128void KOListView::writeSettings(KConfig *config, QString setting)
1129{ 1129{
1130 // qDebug("KOListView::writeSettings "); 1130 // qDebug("KOListView::writeSettings ");
1131 mListView->saveLayout(config, setting); 1131 mListView->saveLayout(config, setting);
1132} 1132}
1133 1133
1134void KOListView::processSelectionChange(QListViewItem *) 1134void KOListView::processSelectionChange(QListViewItem *)
1135{ 1135{
1136 1136
1137 KOListViewItem *item = 1137 KOListViewItem *item =
1138 static_cast<KOListViewItem *>( mListView->currentItem() ); 1138 static_cast<KOListViewItem *>( mListView->currentItem() );
1139 1139
1140 if ( !item ) { 1140 if ( !item ) {
1141 emit incidenceSelected( 0 ); 1141 emit incidenceSelected( 0 );
1142 } else { 1142 } else {
1143 emit incidenceSelected( item->data() ); 1143 emit incidenceSelected( item->data() );
1144 } 1144 }
1145} 1145}
1146 1146
1147void KOListView::clearSelection() 1147void KOListView::clearSelection()
1148{ 1148{
1149 mListView->selectAll( false ); 1149 mListView->selectAll( false );
1150} 1150}
1151void KOListView::allSelection() 1151void KOListView::allSelection()
1152{ 1152{
1153 mListView->selectAll( true ); 1153 mListView->selectAll( true );
1154} 1154}
1155 1155
1156void KOListView::clear() 1156void KOListView::clear()
1157{ 1157{
1158 mListView->clear(); 1158 mListView->clear();
1159 mUidDict.clear(); 1159 mUidDict.clear();
1160} 1160}
1161 1161
1162Incidence* KOListView::currentItem() 1162Incidence* KOListView::currentItem()
1163{ 1163{
1164 if ( mListView->currentItem() ) 1164 if ( mListView->currentItem() )
1165 return ((KOListViewItem*) mListView->currentItem())->data(); 1165 return ((KOListViewItem*) mListView->currentItem())->data();
1166 return 0; 1166 return 0;
1167} 1167}
1168void KOListView::keyPressEvent ( QKeyEvent *e) 1168void KOListView::keyPressEvent ( QKeyEvent *e)
1169{ 1169{
1170 1170
1171 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1171 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1172 deleteAll(); 1172 deleteAll();
1173 return; 1173 return;
1174 } 1174 }
1175 1175
1176 e->ignore(); 1176 e->ignore();
1177} 1177}
1178void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1178void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1179{ 1179{
1180 1180
1181 switch ( e->key() ) { 1181 switch ( e->key() ) {
1182 case Qt::Key_Down: 1182 case Qt::Key_Down:
1183 if ( e->state() == ShiftButton ) { 1183 if ( e->state() == ShiftButton ) {
1184 QListViewItem* cn = currentItem(); 1184 QListViewItem* cn = currentItem();
1185 if ( !cn ) 1185 if ( !cn )
1186 cn = firstChild(); 1186 cn = firstChild();
1187 if ( !cn ) 1187 if ( !cn )
1188 return; 1188 return;
1189 while ( cn->nextSibling() ) 1189 while ( cn->nextSibling() )
1190 cn = cn->nextSibling(); 1190 cn = cn->nextSibling();
1191 setCurrentItem ( cn ); 1191 setCurrentItem ( cn );
1192 ensureItemVisible ( cn ); 1192 ensureItemVisible ( cn );
1193 1193
1194 e->accept(); 1194 e->accept();
1195 return; 1195 return;
1196 } 1196 }
1197 if ( e->state() == ControlButton ) { 1197 if ( e->state() == ControlButton ) {
1198 int count = childCount (); 1198 int count = childCount ();
1199 int jump = count / 5; 1199 int jump = count / 5;
1200 QListViewItem* cn; 1200 QListViewItem* cn;
1201 cn = currentItem(); 1201 cn = currentItem();
1202 if ( ! cn ) 1202 if ( ! cn )
1203 return; 1203 return;
1204 if ( jump == 0 ) 1204 if ( jump == 0 )
1205 jump = 1; 1205 jump = 1;
1206 while ( jump && cn->nextSibling() ) { 1206 while ( jump && cn->nextSibling() ) {
1207 cn = cn->nextSibling(); 1207 cn = cn->nextSibling();
1208 --jump; 1208 --jump;
1209 } 1209 }
1210 setCurrentItem ( cn ); 1210 setCurrentItem ( cn );
1211 ensureItemVisible ( cn ); 1211 ensureItemVisible ( cn );
1212 1212
1213 } else 1213 } else
1214 QListView::keyPressEvent ( e ) ; 1214 QListView::keyPressEvent ( e ) ;
1215 e->accept(); 1215 e->accept();
1216 break; 1216 break;
1217 1217
1218 case Qt::Key_Up: 1218 case Qt::Key_Up:
1219 if ( e->state() == ShiftButton ) { 1219 if ( e->state() == ShiftButton ) {
1220 QListViewItem* cn = firstChild(); 1220 QListViewItem* cn = firstChild();
1221 if ( cn ) { 1221 if ( cn ) {
1222 setCurrentItem ( cn ); 1222 setCurrentItem ( cn );
1223 ensureItemVisible ( cn ); 1223 ensureItemVisible ( cn );
1224 } 1224 }
1225 e->accept(); 1225 e->accept();
1226 return; 1226 return;
1227 } 1227 }
1228 if ( e->state() == ControlButton ) { 1228 if ( e->state() == ControlButton ) {
1229 int count = childCount (); 1229 int count = childCount ();
1230 int jump = count / 5; 1230 int jump = count / 5;
1231 QListViewItem* cn; 1231 QListViewItem* cn;
1232 cn = currentItem(); 1232 cn = currentItem();
1233 if ( ! cn ) 1233 if ( ! cn )
1234 return; 1234 return;
1235 if ( jump == 0 ) 1235 if ( jump == 0 )
1236 jump = 1; 1236 jump = 1;
1237 while ( jump && cn->itemAbove ()) { 1237 while ( jump && cn->itemAbove ()) {
1238 cn = cn->itemAbove (); 1238 cn = cn->itemAbove ();
1239 --jump; 1239 --jump;
1240 } 1240 }
1241 setCurrentItem ( cn ); 1241 setCurrentItem ( cn );
1242 ensureItemVisible ( cn ); 1242 ensureItemVisible ( cn );
1243 } else 1243 } else
1244 QListView::keyPressEvent ( e ) ; 1244 QListView::keyPressEvent ( e ) ;
1245 e->accept(); 1245 e->accept();
1246 break; 1246 break;
1247 case Qt::Key_I: { 1247 case Qt::Key_I: {
1248 QListViewItem* cn; 1248 QListViewItem* cn;
1249 cn = currentItem(); 1249 cn = currentItem();
1250 if ( cn ) { 1250 if ( cn ) {
1251 KOListViewItem* ci = (KOListViewItem*)( cn ); 1251 KOListViewItem* ci = (KOListViewItem*)( cn );
1252 if ( ci ){ 1252 if ( ci ){
1253 //emit showIncidence( ci->data()); 1253 //emit showIncidence( ci->data());
1254 cn = cn->nextSibling(); 1254 cn = cn->nextSibling();
1255 if ( cn ) { 1255 if ( cn ) {
1256 setCurrentItem ( cn ); 1256 setCurrentItem ( cn );
1257 ensureItemVisible ( cn ); 1257 ensureItemVisible ( cn );
1258 } 1258 }
1259 emit showIncidence( ci->data()); 1259 emit showIncidence( ci->data());
1260 } 1260 }
1261 } 1261 }
1262 e->accept(); 1262 e->accept();
1263 } 1263 }
1264 break; 1264 break;
1265 case Qt::Key_Return: 1265 case Qt::Key_Return:
1266 case Qt::Key_Enter: 1266 case Qt::Key_Enter:
1267 { 1267 {
1268 QListViewItem* cn; 1268 QListViewItem* cn;
1269 cn = currentItem(); 1269 cn = currentItem();
1270 if ( cn ) { 1270 if ( cn ) {
1271 KOListViewItem* ci = (KOListViewItem*)( cn ); 1271 KOListViewItem* ci = (KOListViewItem*)( cn );
1272 if ( ci ){ 1272 if ( ci ){
1273 if ( e->state() == ShiftButton ) 1273 if ( e->state() == ShiftButton )
1274 ci->setSelected( false ); 1274 ci->setSelected( false );
1275 else 1275 else
1276 ci->setSelected( true ); 1276 ci->setSelected( true );
1277 cn = cn->nextSibling(); 1277 cn = cn->nextSibling();
1278 if ( cn ) { 1278 if ( cn ) {
1279 setCurrentItem ( cn ); 1279 setCurrentItem ( cn );
1280 ensureItemVisible ( cn ); 1280 ensureItemVisible ( cn );
1281 } else { 1281 } else {
1282 emit currentChanged( ci ); 1282 emit currentChanged( ci );
1283 } 1283 }
1284 } 1284 }
1285 } 1285 }
1286 e->accept(); 1286 e->accept();
1287 } 1287 }
1288 break; 1288 break;
1289 default: 1289 default:
1290 e->ignore(); 1290 e->ignore();
1291 } 1291 }
1292} 1292}
1293KOListViewListView::KOListViewListView(KOListView * lv ) 1293KOListViewListView::KOListViewListView(KOListView * lv )
1294 : KListView( lv, "kolistlistview", false ) 1294 : KListView( lv, "kolistlistview", false )
1295{ 1295{
1296 mYMousePos = 0; 1296 mYMousePos = 0;
1297 setAllColumnsShowFocus( true ); 1297 setAllColumnsShowFocus( true );
1298 mPopupTimer = new QTimer(this); 1298 mPopupTimer = new QTimer(this);
1299 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1299 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1300#ifndef DESKTOP_VERSION 1300#ifndef DESKTOP_VERSION
1301 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1301 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1302#endif 1302#endif
1303 setSelectionMode( QListView::Multi ); 1303 setSelectionMode( QListView::Multi );
1304 setMultiSelection( true); 1304 setMultiSelection( true);
1305} 1305}
1306bool KOListViewListView::hasMultiSelection(QListViewItem* item) 1306bool KOListViewListView::hasMultiSelection(QListViewItem* item)
1307{ 1307{
1308 QListViewItem *qitem = firstChild (); 1308 QListViewItem *qitem = firstChild ();
1309 while ( qitem ) { 1309 while ( qitem ) {
1310 if ( qitem->isSelected() && item != qitem ) 1310 if ( qitem->isSelected() && item != qitem )
1311 return true; 1311 return true;
1312 qitem = qitem->nextSibling(); 1312 qitem = qitem->nextSibling();
1313 } 1313 }
1314 return false; 1314 return false;
1315} 1315}
1316void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1316void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1317{ 1317{
1318 if (!e) return; 1318 if (!e) return;
1319 QPoint vp = contentsToViewport(e->pos()); 1319 QPoint vp = contentsToViewport(e->pos());
1320 QListViewItem *item = itemAt(vp); 1320 QListViewItem *item = itemAt(vp);
1321 if (!item) { 1321 if (!item) {
1322 emit newEvent(); 1322 emit newEvent();
1323 return; 1323 return;
1324 } 1324 }
1325 KListView::contentsMouseDoubleClickEvent(e); 1325 KListView::contentsMouseDoubleClickEvent(e);
1326} 1326}
1327#if 0 1327#if 0
1328void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1328void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1329{ 1329{
1330 //qDebug("contentsMousePressEvent++++ "); 1330 //qDebug("contentsMousePressEvent++++ ");
1331 KListView::contentsMousePressEvent( e ); 1331 KListView::contentsMousePressEvent( e );
1332 if ( e->button() == RightButton ) { 1332 if ( e->button() == RightButton ) {
1333 QListViewItem* ci = currentItem(); 1333 QListViewItem* ci = currentItem();
1334 clearSelection () ; 1334 clearSelection () ;
1335 if ( ci ) 1335 if ( ci )
1336 ci->setSelected( true ); 1336 ci->setSelected( true );
1337 } 1337 }
1338} 1338}
1339void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1339void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1340{ 1340{
1341 KListView::contentsMouseReleaseEvent(e); 1341 KListView::contentsMouseReleaseEvent(e);
1342} 1342}
1343void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1343void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1344{ 1344{
1345 KListView::contentsMouseMoveEvent(e); 1345 KListView::contentsMouseMoveEvent(e);
1346} 1346}
1347#endif 1347#endif
1348void KOListViewListView::popupMenu() 1348void KOListViewListView::popupMenu()
1349{ 1349{
1350 mPopupTimer->stop(); 1350 mPopupTimer->stop();
1351 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1351 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1352 QApplication::postEvent( this->viewport(), e ); 1352 QApplication::postEvent( this->viewport(), e );
1353 1353
1354} 1354}
1355void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1355void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1356{ 1356{
1357 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1357 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1358 mYMousePos = mapToGlobal( (e->pos())).y(); 1358 mYMousePos = mapToGlobal( (e->pos())).y();
1359 if ( e->button() == LeftButton ) { 1359 if ( e->button() == LeftButton ) {
1360 mPopupTimer->start( 600 ); 1360 mPopupTimer->start( 600 );
1361 mEventPos = contentsToViewport(e->pos()); 1361 mEventPos = contentsToViewport(e->pos());
1362 mEventGlobalPos = e->globalPos(); 1362 mEventGlobalPos = e->globalPos();
1363 } 1363 }
1364 KListView::contentsMousePressEvent( e ); 1364 KListView::contentsMousePressEvent( e );
1365 if ( e->button() == RightButton ) { 1365 if ( e->button() == RightButton ) {
1366 QListViewItem* ci = currentItem(); 1366 QListViewItem* ci = currentItem();
1367 //clearSelection(); 1367 //clearSelection();
1368 if ( ci ) 1368 if ( ci )
1369 ci->setSelected( true ); 1369 ci->setSelected( true );
1370 } 1370 }
1371} 1371}
1372void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1372void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1373{ 1373{
1374 mPopupTimer->stop(); 1374 mPopupTimer->stop();
1375 KListView::contentsMouseReleaseEvent(e); 1375 KListView::contentsMouseReleaseEvent(e);
1376} 1376}
1377void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1377void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1378{ 1378{
1379 // qDebug("contentsMouseMoveEv....... "); 1379 // qDebug("contentsMouseMoveEv....... ");
1380 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1380 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1381 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1381 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1382 if ( diff < 0 ) diff = -diff; 1382 if ( diff < 0 ) diff = -diff;
1383 if ( diff > 15 ) 1383 if ( diff > 15 )
1384 mPopupTimer->stop(); 1384 mPopupTimer->stop();
1385 else { 1385 else {
1386 mEventPos = contentsToViewport(e->pos()); 1386 mEventPos = contentsToViewport(e->pos());
1387 mEventGlobalPos = e->globalPos(); 1387 mEventGlobalPos = e->globalPos();
1388 } 1388 }
1389 KListView::contentsMouseMoveEvent(e); 1389 KListView::contentsMouseMoveEvent(e);
1390} 1390}
1391 1391
1392#define protected public 1392#define protected public
1393#include <qheader.h> 1393#include <qheader.h>
1394#undef protected 1394#undef protected
1395void KOListViewListView::printList() 1395void KOListViewListView::printList()
1396{ 1396{
1397#ifdef DESKTOP_VERSION 1397#ifdef DESKTOP_VERSION
1398 KOPrintPrefs pp ( this ); 1398 KOPrintPrefs pp ( this );
1399 if (!pp.exec() ) 1399 if (!pp.exec() )
1400 return; 1400 return;
1401 int scaleval = pp.printMode() ; 1401 int scaleval = pp.printMode() ;
1402 1402
1403 QPrinter printer; 1403 QPrinter printer;
1404 if (!printer.setup() ) 1404 if (!printer.setup() )
1405 return; 1405 return;
1406 clearSelection (); 1406 clearSelection ();
1407 QPainter p; 1407 QPainter p;
1408 p.begin ( &printer ); 1408 p.begin ( &printer );
1409 p.setFont(font());
1409 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 1410 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
1410 float dx, dy; 1411 float dx, dy;
1411 int wid = (m.width() * 9)/10; 1412 int wid = (m.width() * 9)/10;
1412 dx = (float) wid/(float)contentsWidth (); 1413 dx = (float) wid/(float)contentsWidth ();
1413 dy = (float)(m.height()) / (float)contentsHeight (); 1414 dy = (float)(m.height()) / (float)contentsHeight ();
1414 float scale; 1415 float scale;
1415 // scale to fit the width or height of the paper 1416 // scale to fit the width or height of the paper
1416 if ( dx < dy ) 1417 if ( dx < dy )
1417 scale = dx; 1418 scale = dx;
1418 else 1419 else
1419 scale = dy; 1420 scale = dy;
1420 1421
1421 p.translate( m.width()/10,m.width()/10 ); 1422 p.translate( m.width()/10,m.width()/10 );
1422 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 1423 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
1423 p.scale( scale, scale ); 1424 p.scale( scale, scale );
1424 } 1425 }
1425 1426
1426 int cou = header()->count(); 1427 int cou = header()->count();
1427 int iii; 1428 int iii;
1428 QRect rect ( 0,0,0, header()->height()); 1429 QRect rect ( 0,0,0, header()->height());
1429 for ( iii = 0; iii < cou; ++iii ) { 1430 for ( iii = 0; iii < cou; ++iii ) {
1430 rect.setLeft ( header()->sectionPos( iii ) ); 1431 rect.setLeft ( header()->sectionPos( iii ) );
1431 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); 1432 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
1432 header()->paintSection ( & p, header()->mapToIndex (iii), rect ); 1433 header()->paintSection ( & p, header()->mapToIndex (iii), rect );
1433 } 1434 }
1434 p.translate( 0, header()->height()); 1435 p.translate( 0, header()->height());
1435 drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); 1436 //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
1437
1438 const QColorGroup &cg = colorGroup();
1439 KOListViewItem* item = (KOListViewItem* )firstChild();
1440 int yOff = 0;
1441 while ( item ) {
1442 p.translate( 0, yOff );
1443 p.save();
1444 for ( iii = 0; iii < cou; ++iii ) {
1445 int align = columnAlignment( iii );
1446 if ( align == AlignAuto ) align = AlignLeft;
1447 p.restore();
1448 p.save();
1449 p.translate( header()->sectionPos( iii ), 0);
1450 item->paintCell( &p, cg, iii, header()->sectionSize (iii), align );
1451 }
1452 yOff = item->height();
1453 item = (KOListViewItem* )(item->itemBelow());
1454 p.restore();
1455 }
1436 p.end(); 1456 p.end();
1437#endif 1457#endif
1438} 1458}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 764c495..292951b 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -416,592 +416,596 @@ void KDEPIMConfigWidget::setupLocaleDateTab()
416 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 416 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
417} 417}
418 418
419void KDEPIMConfigWidget::setupLocaleTab() 419void KDEPIMConfigWidget::setupLocaleTab()
420{ 420{
421 421
422 QWidget *topFrame = new QWidget( this ); 422 QWidget *topFrame = new QWidget( this );
423 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 423 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
424 424
425 topLayout->setSpacing(KDialog::spacingHint()); 425 topLayout->setSpacing(KDialog::spacingHint());
426 topLayout->setMargin(KDialog::marginHint()); 426 topLayout->setMargin(KDialog::marginHint());
427 int iii = 0; 427 int iii = 0;
428 KPrefsWidRadios *syncPrefsGroup = 428 KPrefsWidRadios *syncPrefsGroup =
429 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 429 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
430 syncPrefsGroup->addRadio(i18n("English")); 430 syncPrefsGroup->addRadio(i18n("English"));
431 syncPrefsGroup->addRadio(i18n("German")); 431 syncPrefsGroup->addRadio(i18n("German"));
432 syncPrefsGroup->addRadio(i18n("French")); 432 syncPrefsGroup->addRadio(i18n("French"));
433 syncPrefsGroup->addRadio(i18n("Italian")); 433 syncPrefsGroup->addRadio(i18n("Italian"));
434 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 434 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
435 if ( QApplication::desktop()->width() < 300 ) { 435 if ( QApplication::desktop()->width() < 300 ) {
436 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 436 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
437 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 437 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
438 } 438 }
439 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 439 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
440 ++iii; 440 ++iii;
441 441
442 442
443 tabWidget->addTab( topFrame, i18n( "Language" ) ); 443 tabWidget->addTab( topFrame, i18n( "Language" ) );
444 topFrame = new QWidget( this ); 444 topFrame = new QWidget( this );
445 topLayout = new QGridLayout(topFrame,4,2); 445 topLayout = new QGridLayout(topFrame,4,2);
446 446
447 topLayout->setSpacing(KDialog::spacingHint()); 447 topLayout->setSpacing(KDialog::spacingHint());
448 topLayout->setMargin(KDialog::marginHint()); 448 topLayout->setMargin(KDialog::marginHint());
449 iii = 0; 449 iii = 0;
450 syncPrefsGroup = 450 syncPrefsGroup =
451 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 451 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
452 if ( QApplication::desktop()->width() > 300 ) 452 if ( QApplication::desktop()->width() > 300 )
453 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 453 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
454 syncPrefsGroup->addRadio(i18n("24:00")); 454 syncPrefsGroup->addRadio(i18n("24:00"));
455 syncPrefsGroup->addRadio(i18n("12:00am")); 455 syncPrefsGroup->addRadio(i18n("12:00am"));
456 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 456 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
457 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 457 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
458 ++iii; 458 ++iii;
459 459
460 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 460 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
461 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 461 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
462 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 462 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
463 ++iii; 463 ++iii;
464 464
465 465
466 tabWidget->addTab( topFrame, i18n( "Time Format" ) ); 466 tabWidget->addTab( topFrame, i18n( "Time Format" ) );
467 467
468} 468}
469 469
470 470
471void KDEPIMConfigWidget::setupTimeZoneTab() 471void KDEPIMConfigWidget::setupTimeZoneTab()
472{ 472{
473 QWidget *topFrame; 473 QWidget *topFrame;
474 QGridLayout *topLayout ; 474 QGridLayout *topLayout ;
475 475
476 476
477 477
478 478
479 479
480 480
481 topFrame = new QWidget( this ); 481 topFrame = new QWidget( this );
482 topLayout = new QGridLayout( topFrame, 5, 2); 482 topLayout = new QGridLayout( topFrame, 5, 2);
483 topLayout->setSpacing(KDialog::spacingHintSmall()); 483 topLayout->setSpacing(KDialog::spacingHintSmall());
484 topLayout->setMargin(KDialog::marginHintSmall()); 484 topLayout->setMargin(KDialog::marginHintSmall());
485 485
486 QHBox *timeZoneBox = new QHBox( topFrame ); 486 QHBox *timeZoneBox = new QHBox( topFrame );
487 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 487 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
488 488
489 new QLabel( i18n("Timezone:"), timeZoneBox ); 489 new QLabel( i18n("Timezone:"), timeZoneBox );
490 mTimeZoneCombo = new QComboBox( timeZoneBox ); 490 mTimeZoneCombo = new QComboBox( timeZoneBox );
491 if ( QApplication::desktop()->width() < 300 ) { 491 if ( QApplication::desktop()->width() < 300 ) {
492 mTimeZoneCombo->setMaximumWidth(150); 492 mTimeZoneCombo->setMaximumWidth(150);
493 } 493 }
494 494
495 QStringList list; 495 QStringList list;
496 list = KGlobal::locale()->timeZoneList(); 496 list = KGlobal::locale()->timeZoneList();
497 mTimeZoneCombo->insertStringList(list); 497 mTimeZoneCombo->insertStringList(list);
498 498
499 // find the currently set time zone and select it 499 // find the currently set time zone and select it
500 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 500 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
501 int nCurrentlySet = 11; 501 int nCurrentlySet = 11;
502 for (int i = 0; i < mTimeZoneCombo->count(); i++) 502 for (int i = 0; i < mTimeZoneCombo->count(); i++)
503 { 503 {
504 if (mTimeZoneCombo->text(i) == sCurrentlySet) 504 if (mTimeZoneCombo->text(i) == sCurrentlySet)
505 { 505 {
506 nCurrentlySet = i; 506 nCurrentlySet = i;
507 break; 507 break;
508 } 508 }
509 } 509 }
510 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 510 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
511 int iii = 1; 511 int iii = 1;
512 KPrefsWidBool *sb = 512 KPrefsWidBool *sb =
513 addWidBool(i18n("Add 30 min to selected Timezone"), 513 addWidBool(i18n("Add 30 min to selected Timezone"),
514 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 514 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
515 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 515 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
516 ++iii; 516 ++iii;
517 sb = 517 sb =
518 addWidBool(i18n("Timezone has daylight saving"), 518 addWidBool(i18n("Timezone has daylight saving"),
519 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 519 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
520 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 520 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
521 ++iii; 521 ++iii;
522 QLabel* lab; 522 QLabel* lab;
523 523
524 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 524 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
525 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 525 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
526 ++iii; 526 ++iii;
527 527
528 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 528 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
529 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 529 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
530 ++iii; 530 ++iii;
531 lab = new QLabel( i18n("Daylight start:"), topFrame ); 531 lab = new QLabel( i18n("Daylight start:"), topFrame );
532 topLayout->addWidget(lab, iii,0); 532 topLayout->addWidget(lab, iii,0);
533 mStartDateSavingEdit = new KDateEdit(topFrame); 533 mStartDateSavingEdit = new KDateEdit(topFrame);
534 topLayout->addWidget(mStartDateSavingEdit, iii,1); 534 topLayout->addWidget(mStartDateSavingEdit, iii,1);
535 ++iii; 535 ++iii;
536 536
537 lab = new QLabel( i18n("Daylight end:"), topFrame ); 537 lab = new QLabel( i18n("Daylight end:"), topFrame );
538 topLayout->addWidget(lab, iii,0); 538 topLayout->addWidget(lab, iii,0);
539 mEndDateSavingEdit = new KDateEdit(topFrame); 539 mEndDateSavingEdit = new KDateEdit(topFrame);
540 topLayout->addWidget(mEndDateSavingEdit, iii,1); 540 topLayout->addWidget(mEndDateSavingEdit, iii,1);
541 ++iii; 541 ++iii;
542 QDate current ( 2001, 1,1); 542 QDate current ( 2001, 1,1);
543 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 543 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
544 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 544 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
545 545
546 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 546 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
547 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 547 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
548 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 548 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
549 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 549 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
550 550
551 551
552 topFrame = new QWidget( this ); 552 topFrame = new QWidget( this );
553 topLayout = new QGridLayout( topFrame, 3, 2); 553 topLayout = new QGridLayout( topFrame, 3, 2);
554 topLayout->setSpacing(KDialog::spacingHintSmall()); 554 topLayout->setSpacing(KDialog::spacingHintSmall());
555 topLayout->setMargin(KDialog::marginHintSmall()); 555 topLayout->setMargin(KDialog::marginHintSmall());
556 tabWidget->addTab( topFrame, i18n( "Fonts" ) ); 556 tabWidget->addTab( topFrame, i18n( "Fonts" ) );
557 557
558 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); 558 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
559 topLayout->addMultiCellWidget(labb,0,0,0,2); 559 topLayout->addMultiCellWidget(labb,0,0,0,2);
560 int i = 1; 560 int i = 1;
561 KPrefsWidFont *timeLabelsFont = 561 KPrefsWidFont *timeLabelsFont =
562 addWidFont(i18n("Kx/Pi"),i18n("Application Font"), 562 addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
563 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); 563 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
564 topLayout->addWidget(timeLabelsFont->label(),i,0); 564 topLayout->addWidget(timeLabelsFont->label(),i,0);
565 topLayout->addWidget(timeLabelsFont->preview(),i,1); 565 topLayout->addWidget(timeLabelsFont->preview(),i,1);
566 topLayout->addWidget(timeLabelsFont->button(),i,2); 566 topLayout->addWidget(timeLabelsFont->button(),i,2);
567} 567}
568 568
569void KDEPIMConfigWidget::externalapp_changed( int newApp ) 569void KDEPIMConfigWidget::externalapp_changed( int newApp )
570{ 570{
571 // first store the current data 571 // first store the current data
572 saveEditFieldSettings(); 572 saveEditFieldSettings();
573 573
574 // set mCurrentApp 574 // set mCurrentApp
575 mCurrentApp = (ExternalAppHandler::Types)newApp; 575 mCurrentApp = (ExternalAppHandler::Types)newApp;
576 576
577 // set mCurrentClient 577 // set mCurrentClient
578 switch(mCurrentApp) 578 switch(mCurrentApp)
579 { 579 {
580 case(ExternalAppHandler::EMAIL): 580 case(ExternalAppHandler::EMAIL):
581 mCurrentClient = mEmailClient; 581 mCurrentClient = mEmailClient;
582 break; 582 break;
583 case(ExternalAppHandler::PHONE): 583 case(ExternalAppHandler::PHONE):
584 mCurrentClient = mPhoneClient; 584 mCurrentClient = mPhoneClient;
585 break; 585 break;
586 case(ExternalAppHandler::SMS): 586 case(ExternalAppHandler::SMS):
587 mCurrentClient = mSMSClient; 587 mCurrentClient = mSMSClient;
588 break; 588 break;
589 case(ExternalAppHandler::FAX): 589 case(ExternalAppHandler::FAX):
590 mCurrentClient = mFaxClient; 590 mCurrentClient = mFaxClient;
591 break; 591 break;
592 case(ExternalAppHandler::PAGER): 592 case(ExternalAppHandler::PAGER):
593 mCurrentClient = mPagerClient; 593 mCurrentClient = mPagerClient;
594 break; 594 break;
595 case(ExternalAppHandler::SIP): 595 case(ExternalAppHandler::SIP):
596 mCurrentClient = mSipClient; 596 mCurrentClient = mSipClient;
597 break; 597 break;
598 default: 598 default:
599 return; 599 return;
600 } 600 }
601 601
602 // and at last update the widgets 602 // and at last update the widgets
603 updateClientWidgets(); 603 updateClientWidgets();
604} 604}
605 605
606 606
607 607
608void KDEPIMConfigWidget::client_changed( int newClient ) 608void KDEPIMConfigWidget::client_changed( int newClient )
609{ 609{
610 if (newClient == mCurrentClient) 610 if (newClient == mCurrentClient)
611 return; 611 return;
612 612
613 // first store the current data 613 // first store the current data
614 saveEditFieldSettings(); 614 saveEditFieldSettings();
615 615
616 616
617 //then reset the clientvariable 617 //then reset the clientvariable
618 mCurrentClient = newClient; 618 mCurrentClient = newClient;
619 619
620 // and at last update the widgets 620 // and at last update the widgets
621 updateClientWidgets(); 621 updateClientWidgets();
622 622
623 KPrefsWidget::modified(); 623 KPrefsWidget::modified();
624} 624}
625 625
626void KDEPIMConfigWidget::saveEditFieldSettings() 626void KDEPIMConfigWidget::saveEditFieldSettings()
627{ 627{
628 628
629 switch(mCurrentApp) 629 switch(mCurrentApp)
630 { 630 {
631 case(ExternalAppHandler::EMAIL): 631 case(ExternalAppHandler::EMAIL):
632 mEmailClient = mClient->currentItem(); 632 mEmailClient = mClient->currentItem();
633 break; 633 break;
634 case(ExternalAppHandler::PHONE): 634 case(ExternalAppHandler::PHONE):
635 mPhoneClient= mClient->currentItem(); 635 mPhoneClient= mClient->currentItem();
636 break; 636 break;
637 case(ExternalAppHandler::SMS): 637 case(ExternalAppHandler::SMS):
638 mSMSClient = mClient->currentItem(); 638 mSMSClient = mClient->currentItem();
639 break; 639 break;
640 case(ExternalAppHandler::FAX): 640 case(ExternalAppHandler::FAX):
641 mFaxClient = mClient->currentItem(); 641 mFaxClient = mClient->currentItem();
642 break; 642 break;
643 case(ExternalAppHandler::PAGER): 643 case(ExternalAppHandler::PAGER):
644 mPagerClient = mClient->currentItem(); 644 mPagerClient = mClient->currentItem();
645 break; 645 break;
646 case(ExternalAppHandler::SIP): 646 case(ExternalAppHandler::SIP):
647 mSipClient = mClient->currentItem(); 647 mSipClient = mClient->currentItem();
648 break; 648 break;
649 default: 649 default:
650 return; 650 return;
651 } 651 }
652 652
653 //store the current data back to the apropriate membervariables if we had set it to "other" 653 //store the current data back to the apropriate membervariables if we had set it to "other"
654 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 654 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
655 { 655 {
656 mEmailOtherChannel = mChannel->text(); 656 mEmailOtherChannel = mChannel->text();
657 mEmailOtherMessage = mMessage->text(); 657 mEmailOtherMessage = mMessage->text();
658 mEmailOtherMessageParameters = mParameters->text(); 658 mEmailOtherMessageParameters = mParameters->text();
659 if ( mMessage2 ) 659 if ( mMessage2 )
660 mEmailOtherMessage2 = mMessage2->text(); 660 mEmailOtherMessage2 = mMessage2->text();
661 if ( mParameters2 ) 661 if ( mParameters2 )
662 mEmailOtherMessageParameters2 = mParameters2->text(); 662 mEmailOtherMessageParameters2 = mParameters2->text();
663 } 663 }
664 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 664 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
665 { 665 {
666 mPhoneOtherChannel = mChannel->text(); 666 mPhoneOtherChannel = mChannel->text();
667 mPhoneOtherMessage = mMessage->text(); 667 mPhoneOtherMessage = mMessage->text();
668 mPhoneOtherMessageParameters = mParameters->text(); 668 mPhoneOtherMessageParameters = mParameters->text();
669 } 669 }
670 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 670 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
671 { 671 {
672 mSMSOtherChannel = mChannel->text(); 672 mSMSOtherChannel = mChannel->text();
673 mSMSOtherMessage = mMessage->text(); 673 mSMSOtherMessage = mMessage->text();
674 mSMSOtherMessageParameters = mParameters->text(); 674 mSMSOtherMessageParameters = mParameters->text();
675 } 675 }
676 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 676 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
677 { 677 {
678 mFaxOtherChannel = mChannel->text(); 678 mFaxOtherChannel = mChannel->text();
679 mFaxOtherMessage = mMessage->text(); 679 mFaxOtherMessage = mMessage->text();
680 mFaxOtherMessageParameters = mParameters->text(); 680 mFaxOtherMessageParameters = mParameters->text();
681 } 681 }
682 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 682 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
683 { 683 {
684 mPagerOtherChannel = mChannel->text(); 684 mPagerOtherChannel = mChannel->text();
685 mPagerOtherMessage = mMessage->text(); 685 mPagerOtherMessage = mMessage->text();
686 mPagerOtherMessageParameters = mParameters->text(); 686 mPagerOtherMessageParameters = mParameters->text();
687 } 687 }
688 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 688 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
689 { 689 {
690 mSipOtherChannel = mChannel->text(); 690 mSipOtherChannel = mChannel->text();
691 mSipOtherMessage = mMessage->text(); 691 mSipOtherMessage = mMessage->text();
692 mSipOtherMessageParameters = mParameters->text(); 692 mSipOtherMessageParameters = mParameters->text();
693 } 693 }
694 694
695 695
696} 696}
697 697
698void KDEPIMConfigWidget::updateClientWidgets() 698void KDEPIMConfigWidget::updateClientWidgets()
699{ 699{
700 bool blocked = signalsBlocked(); 700 bool blocked = signalsBlocked();
701 blockSignals( true ); 701 blockSignals( true );
702 702
703 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 703 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
704 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 704 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
705 if (it == mExternalAppsMap.end()) 705 if (it == mExternalAppsMap.end())
706 return; 706 return;
707 707
708 // update group box 708 // update group box
709 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 709 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
710 710
711 //update the entries in the client combobox 711 //update the entries in the client combobox
712 mClient->clear(); 712 mClient->clear();
713 713
714 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 714 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
715 DefaultAppItem* dai; 715 DefaultAppItem* dai;
716 for ( dai=items.first(); dai != 0; dai=items.next() ) 716 for ( dai=items.first(); dai != 0; dai=items.next() )
717 { 717 {
718 mClient->insertItem( i18n(dai->_label), dai->_id ); 718 mClient->insertItem( i18n(dai->_label), dai->_id );
719 719
720 if (dai->_id == mCurrentClient) 720 if (dai->_id == mCurrentClient)
721 { 721 {
722 //restore the edit fields with the data of the local membervariables if we had set it to "other". 722 //restore the edit fields with the data of the local membervariables if we had set it to "other".
723 //Otherwise take the default data from externalapphandler. 723 //Otherwise take the default data from externalapphandler.
724 mChannel->setText(dai->_channel); 724 mChannel->setText(dai->_channel);
725 mMessage->setText(dai->_message); 725 mMessage->setText(dai->_message);
726 mParameters->setText(dai->_parameters); 726 mParameters->setText(dai->_parameters);
727 if ( mMessage2 ) 727 if ( mMessage2 )
728 mMessage2->setText(dai->_message2); 728 mMessage2->setText(dai->_message2);
729 if ( mParameters2 ) 729 if ( mParameters2 )
730 mParameters2->setText(dai->_parameters2); 730 mParameters2->setText(dai->_parameters2);
731 731
732 732
733 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 733 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
734 { 734 {
735 mChannel->setText(mEmailOtherChannel); 735 mChannel->setText(mEmailOtherChannel);
736 mMessage->setText(mEmailOtherMessage); 736 mMessage->setText(mEmailOtherMessage);
737 mParameters->setText(mEmailOtherMessageParameters); 737 mParameters->setText(mEmailOtherMessageParameters);
738 if ( mMessage2 ) 738 if ( mMessage2 )
739 mMessage2->setText(mEmailOtherMessage2); 739 mMessage2->setText(mEmailOtherMessage2);
740 if ( mParameters2 ) 740 if ( mParameters2 )
741 mParameters2->setText(mEmailOtherMessageParameters2); 741 mParameters2->setText(mEmailOtherMessageParameters2);
742 } 742 }
743 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 743 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
744 { 744 {
745 mChannel->setText(mPhoneOtherChannel); 745 mChannel->setText(mPhoneOtherChannel);
746 mMessage->setText(mPhoneOtherMessage); 746 mMessage->setText(mPhoneOtherMessage);
747 mParameters->setText(mPhoneOtherMessageParameters); 747 mParameters->setText(mPhoneOtherMessageParameters);
748 } 748 }
749 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 749 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
750 { 750 {
751 mChannel->setText(mSMSOtherChannel); 751 mChannel->setText(mSMSOtherChannel);
752 mMessage->setText(mSMSOtherMessage); 752 mMessage->setText(mSMSOtherMessage);
753 mParameters->setText(mSMSOtherMessageParameters); 753 mParameters->setText(mSMSOtherMessageParameters);
754 } 754 }
755 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 755 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
756 { 756 {
757 mChannel->setText(mFaxOtherChannel); 757 mChannel->setText(mFaxOtherChannel);
758 mMessage->setText(mFaxOtherMessage); 758 mMessage->setText(mFaxOtherMessage);
759 mParameters->setText(mFaxOtherMessageParameters); 759 mParameters->setText(mFaxOtherMessageParameters);
760 } 760 }
761 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 761 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
762 { 762 {
763 mChannel->setText(mPagerOtherChannel); 763 mChannel->setText(mPagerOtherChannel);
764 mMessage->setText(mPagerOtherMessage); 764 mMessage->setText(mPagerOtherMessage);
765 mParameters->setText(mPagerOtherMessageParameters); 765 mParameters->setText(mPagerOtherMessageParameters);
766 } 766 }
767 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 767 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
768 { 768 {
769 mChannel->setText(mSipOtherChannel); 769 mChannel->setText(mSipOtherChannel);
770 mMessage->setText(mSipOtherMessage); 770 mMessage->setText(mSipOtherMessage);
771 mParameters->setText(mSipOtherMessageParameters); 771 mParameters->setText(mSipOtherMessageParameters);
772 } 772 }
773 } 773 }
774 774
775 } 775 }
776 776
777 bool readonly; 777 bool readonly;
778 bool enabled; 778 bool enabled;
779 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 779 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
780 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 780 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
781 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 781 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
782 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 782 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
783 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 783 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
784 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 784 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
785 { 785 {
786 readonly = false; 786 readonly = false;
787 } 787 }
788 else 788 else
789 { 789 {
790 readonly = true; 790 readonly = true;
791 } 791 }
792 792
793 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 793 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
794 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 794 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
795 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 795 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
796 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 796 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
797 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 797 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
798 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 798 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
799 { 799 {
800 enabled = false; 800 enabled = false;
801 } 801 }
802 else 802 else
803 { 803 {
804 enabled = true; 804 enabled = true;
805 } 805 }
806 806
807 807
808 mChannel->setReadOnly(readonly); 808 mChannel->setReadOnly(readonly);
809 mMessage->setReadOnly(readonly); 809 mMessage->setReadOnly(readonly);
810 mParameters->setReadOnly(readonly); 810 mParameters->setReadOnly(readonly);
811 if ( mMessage2 ) 811 if ( mMessage2 )
812 mMessage2->setReadOnly(readonly); 812 mMessage2->setReadOnly(readonly);
813 if ( mParameters2 ) 813 if ( mParameters2 )
814 mParameters2->setReadOnly(readonly); 814 mParameters2->setReadOnly(readonly);
815 815
816 mChannel->setEnabled(enabled); 816 mChannel->setEnabled(enabled);
817 mMessage->setEnabled(enabled); 817 mMessage->setEnabled(enabled);
818 mParameters->setEnabled(enabled); 818 mParameters->setEnabled(enabled);
819 if ( mMessage2 ) 819 if ( mMessage2 )
820 mMessage2->setEnabled(enabled); 820 mMessage2->setEnabled(enabled);
821 if ( mParameters2 ) 821 if ( mParameters2 )
822 mParameters2->setEnabled(enabled); 822 mParameters2->setEnabled(enabled);
823 823
824 824
825 825
826 mClient->setCurrentItem(mCurrentClient); 826 mClient->setCurrentItem(mCurrentClient);
827 827
828 828
829 // enable/disable the extra message/parameter field 829 // enable/disable the extra message/parameter field
830 if (mCurrentApp == ExternalAppHandler::EMAIL) 830 if (mCurrentApp == ExternalAppHandler::EMAIL)
831 { 831 {
832 } 832 }
833 else 833 else
834 { 834 {
835 if ( mMessage2 ) 835 if ( mMessage2 )
836 mMessage2->setText( "" ); 836 mMessage2->setText( "" );
837 if ( mParameters2 ) 837 if ( mParameters2 )
838 mParameters2->setText( "" ); 838 mParameters2->setText( "" );
839 } 839 }
840 840
841 if (enabled == true) { 841 if (enabled == true) {
842 if ( mMessage2 ) 842 if ( mMessage2 )
843 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 843 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
844 if ( mParameters2 ) 844 if ( mParameters2 )
845 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 845 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
846 } 846 }
847 847
848 848
849 blockSignals( blocked ); 849 blockSignals( blocked );
850 850
851} 851}
852 852
853void KDEPIMConfigWidget::usrReadConfig() 853void KDEPIMConfigWidget::usrReadConfig()
854{ 854{
855 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 855 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
856 856
857 bool blocked = signalsBlocked(); 857 bool blocked = signalsBlocked();
858 blockSignals( true ); 858 blockSignals( true );
859 859
860 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) 860 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
861 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 861 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
862 else { 862 else {
863 mBackupUrl->setURL(prefs->mBackupDatadir); 863 mBackupUrl->setURL(prefs->mBackupDatadir);
864 864
865 } 865 }
866 mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); 866 mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
867 mBackupDayCountSpin->setValue( prefs->mBackupDayCount); 867 mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
868 868
869 QString dummy = prefs->mUserDateFormatLong; 869 QString dummy = prefs->mUserDateFormatLong;
870 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 870 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
871 dummy = prefs->mUserDateFormatShort; 871 dummy = prefs->mUserDateFormatShort;
872 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 872 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
873 873
874 QDate current ( 2001, 1,1); 874 QDate current ( 2001, 1,1);
875 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 875 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
876 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 876 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
877 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 877 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
878 878
879 mEmailClient = prefs->mEmailClient; 879 mEmailClient = prefs->mEmailClient;
880 mEmailOtherChannel = prefs->mEmailOtherChannel; 880 mEmailOtherChannel = prefs->mEmailOtherChannel;
881 mEmailOtherMessage = prefs->mEmailOtherMessage; 881 mEmailOtherMessage = prefs->mEmailOtherMessage;
882 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 882 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
883 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 883 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
884 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 884 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
885 885
886 mPhoneClient = prefs->mPhoneClient; 886 mPhoneClient = prefs->mPhoneClient;
887 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 887 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
888 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 888 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
889 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 889 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
890 890
891 mFaxClient = prefs->mFaxClient; 891 mFaxClient = prefs->mFaxClient;
892 mFaxOtherChannel = prefs->mFaxOtherChannel; 892 mFaxOtherChannel = prefs->mFaxOtherChannel;
893 mFaxOtherMessage = prefs->mFaxOtherMessage; 893 mFaxOtherMessage = prefs->mFaxOtherMessage;
894 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 894 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
895 895
896 mSMSClient = prefs->mSMSClient; 896 mSMSClient = prefs->mSMSClient;
897 mSMSOtherChannel = prefs->mSMSOtherChannel; 897 mSMSOtherChannel = prefs->mSMSOtherChannel;
898 mSMSOtherMessage = prefs->mSMSOtherMessage; 898 mSMSOtherMessage = prefs->mSMSOtherMessage;
899 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 899 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
900 900
901 mPagerClient = prefs->mPagerClient; 901 mPagerClient = prefs->mPagerClient;
902 mPagerOtherChannel = prefs->mPagerOtherChannel; 902 mPagerOtherChannel = prefs->mPagerOtherChannel;
903 mPagerOtherMessage = prefs->mPagerOtherMessage; 903 mPagerOtherMessage = prefs->mPagerOtherMessage;
904 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 904 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
905 905
906 mSipClient = prefs->mSipClient; 906 mSipClient = prefs->mSipClient;
907 mSipOtherChannel = prefs->mSipOtherChannel; 907 mSipOtherChannel = prefs->mSipOtherChannel;
908 mSipOtherMessage = prefs->mSipOtherMessage; 908 mSipOtherMessage = prefs->mSipOtherMessage;
909 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 909 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
910 910
911 mCurrentApp = ExternalAppHandler::EMAIL; 911 mCurrentApp = ExternalAppHandler::EMAIL;
912 mCurrentClient = mEmailClient; 912 mCurrentClient = mEmailClient;
913 913
914 updateClientWidgets(); 914 updateClientWidgets();
915 915
916 blockSignals( blocked ); 916 blockSignals( blocked );
917 917
918} 918}
919 919
920void KDEPIMConfigWidget::usrWriteConfig() 920void KDEPIMConfigWidget::usrWriteConfig()
921{ 921{
922 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 922 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
923 923
924 saveEditFieldSettings(); 924 saveEditFieldSettings();
925 925
926 prefs->mBackupNumbers = mBackupNumbersSpin->value(); 926 prefs->mBackupNumbers = mBackupNumbersSpin->value();
927 prefs->mBackupDayCount = mBackupDayCountSpin->value(); 927 prefs->mBackupDayCount = mBackupDayCountSpin->value();
928 prefs->mBackupDatadir = mBackupUrl->url(); 928 QString bup_url = mBackupUrl->url();
929 if ( bup_url.right(1) != "/" && bup_url.right(1) != "\\" )
930 bup_url += "/";
931
932 prefs->mBackupDatadir = bup_url;
929 933
930 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 934 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
931 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 935 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
932 936
933 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 937 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
934 QDate date; 938 QDate date;
935 date = mStartDateSavingEdit->date(); 939 date = mStartDateSavingEdit->date();
936 int sub = 0; 940 int sub = 0;
937 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 941 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
938 sub = 1; 942 sub = 1;
939 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 943 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
940 date = mEndDateSavingEdit->date(); 944 date = mEndDateSavingEdit->date();
941 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 945 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
942 sub = 1; 946 sub = 1;
943 else 947 else
944 sub = 0; 948 sub = 0;
945 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 949 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
946 950
947 951
948 prefs->mEmailClient = mEmailClient; 952 prefs->mEmailClient = mEmailClient;
949 prefs->mEmailOtherChannel = mEmailOtherChannel; 953 prefs->mEmailOtherChannel = mEmailOtherChannel;
950 prefs->mEmailOtherMessage = mEmailOtherMessage; 954 prefs->mEmailOtherMessage = mEmailOtherMessage;
951 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 955 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
952 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 956 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
953 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 957 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
954 958
955 prefs->mPhoneClient = mPhoneClient; 959 prefs->mPhoneClient = mPhoneClient;
956 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 960 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
957 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 961 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
958 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 962 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
959 963
960 prefs->mFaxClient = mFaxClient; 964 prefs->mFaxClient = mFaxClient;
961 prefs->mFaxOtherChannel = mFaxOtherChannel; 965 prefs->mFaxOtherChannel = mFaxOtherChannel;
962 prefs->mFaxOtherMessage = mFaxOtherMessage; 966 prefs->mFaxOtherMessage = mFaxOtherMessage;
963 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 967 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
964 968
965 prefs->mSMSClient = mSMSClient; 969 prefs->mSMSClient = mSMSClient;
966 prefs->mSMSOtherChannel = mSMSOtherChannel; 970 prefs->mSMSOtherChannel = mSMSOtherChannel;
967 prefs->mSMSOtherMessage = mSMSOtherMessage; 971 prefs->mSMSOtherMessage = mSMSOtherMessage;
968 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 972 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
969 973
970 prefs->mPagerClient = mPagerClient; 974 prefs->mPagerClient = mPagerClient;
971 prefs->mPagerOtherChannel = mPagerOtherChannel; 975 prefs->mPagerOtherChannel = mPagerOtherChannel;
972 prefs->mPagerOtherMessage = mPagerOtherMessage; 976 prefs->mPagerOtherMessage = mPagerOtherMessage;
973 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 977 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
974 978
975 979
976 prefs->mSipClient = mSipClient; 980 prefs->mSipClient = mSipClient;
977 prefs->mSipOtherChannel = mSipOtherChannel; 981 prefs->mSipOtherChannel = mSipOtherChannel;
978 prefs->mSipOtherMessage = mSipOtherMessage; 982 prefs->mSipOtherMessage = mSipOtherMessage;
979 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 983 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
980 984
981 //release the cache that other views can access the changed values instantanious 985 //release the cache that other views can access the changed values instantanious
982 ExternalAppHandler::instance()->loadConfig(); 986 ExternalAppHandler::instance()->loadConfig();
983 KPimGlobalPrefs::instance()->setGlobalConfig(); 987 KPimGlobalPrefs::instance()->setGlobalConfig();
984} 988}
985 989
986 990
987void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, 991void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
988 const QStringList *tags) 992 const QStringList *tags)
989{ 993{
990 if (tags) { 994 if (tags) {
991 int i = tags->findIndex(text); 995 int i = tags->findIndex(text);
992 if (i > 0) combo->setCurrentItem(i); 996 if (i > 0) combo->setCurrentItem(i);
993 } else { 997 } else {
994 for(int i=0;i<combo->count();++i) { 998 for(int i=0;i<combo->count();++i) {
995 if (combo->text(i) == text) { 999 if (combo->text(i) == text) {
996 combo->setCurrentItem(i); 1000 combo->setCurrentItem(i);
997 break; 1001 break;
998 } 1002 }
999 } 1003 }
1000 } 1004 }
1001} 1005}
1002 1006
1003 1007
1004void KDEPIMConfigWidget::textChanged( const QString& text ) 1008void KDEPIMConfigWidget::textChanged( const QString& text )
1005{ 1009{
1006 emit changed( true ); 1010 emit changed( true );
1007} 1011}