summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp59
-rw-r--r--korganizer/mainwindow.h12
5 files changed, 77 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 884c61a..0306e07 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1045,453 +1045,457 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1045 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1045 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1046 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1046 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1047 //remote->deleteIncidence( inR ); 1047 //remote->deleteIncidence( inR );
1048 ++deletedEventR; 1048 ++deletedEventR;
1049 } else { 1049 } else {
1050 inR->setLastModified( modifiedCalendar ); 1050 inR->setLastModified( modifiedCalendar );
1051 inL = inR->clone(); 1051 inL = inR->clone();
1052 local->addIncidence( inL ); 1052 local->addIncidence( inL );
1053 ++addedEvent; 1053 ++addedEvent;
1054 } 1054 }
1055 } else { 1055 } else {
1056 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1056 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1057 inR->setLastModified( modifiedCalendar ); 1057 inR->setLastModified( modifiedCalendar );
1058 local->addIncidence( inR->clone() ); 1058 local->addIncidence( inR->clone() );
1059 ++addedEvent; 1059 ++addedEvent;
1060 } else { 1060 } else {
1061 checkExternSyncEvent(eventRSyncSharp, inR); 1061 checkExternSyncEvent(eventRSyncSharp, inR);
1062 remote->deleteIncidence( inR ); 1062 remote->deleteIncidence( inR );
1063 ++deletedEventR; 1063 ++deletedEventR;
1064 } 1064 }
1065 } 1065 }
1066 } 1066 }
1067 } 1067 }
1068 inR = er.next(); 1068 inR = er.next();
1069 } 1069 }
1070 QPtrList<Incidence> el = local->rawIncidences(); 1070 QPtrList<Incidence> el = local->rawIncidences();
1071 inL = el.first(); 1071 inL = el.first();
1072 modulo = (el.count()/10)+1; 1072 modulo = (el.count()/10)+1;
1073 bar.setCaption (i18n("Add / remove events") ); 1073 bar.setCaption (i18n("Add / remove events") );
1074 bar.setTotalSteps ( el.count() ) ; 1074 bar.setTotalSteps ( el.count() ) ;
1075 bar.show(); 1075 bar.show();
1076 incCounter = 0; 1076 incCounter = 0;
1077 1077
1078 while ( inL ) { 1078 while ( inL ) {
1079 1079
1080 qApp->processEvents(); 1080 qApp->processEvents();
1081 if ( ! bar.isVisible() ) 1081 if ( ! bar.isVisible() )
1082 return false; 1082 return false;
1083 if ( incCounter % modulo == 0 ) 1083 if ( incCounter % modulo == 0 )
1084 bar.setProgress( incCounter ); 1084 bar.setProgress( incCounter );
1085 ++incCounter; 1085 ++incCounter;
1086 uid = inL->uid(); 1086 uid = inL->uid();
1087 bool skipIncidence = false; 1087 bool skipIncidence = false;
1088 if ( uid.left(15) == QString("last-syncEvent-") ) 1088 if ( uid.left(15) == QString("last-syncEvent-") )
1089 skipIncidence = true; 1089 skipIncidence = true;
1090 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1090 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1091 skipIncidence = true; 1091 skipIncidence = true;
1092 if ( !skipIncidence ) { 1092 if ( !skipIncidence ) {
1093 inR = remote->incidence( uid ); 1093 inR = remote->incidence( uid );
1094 if ( ! inR ) { 1094 if ( ! inR ) {
1095 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1095 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1096 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1096 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1097 checkExternSyncEvent(eventLSyncSharp, inL); 1097 checkExternSyncEvent(eventLSyncSharp, inL);
1098 local->deleteIncidence( inL ); 1098 local->deleteIncidence( inL );
1099 ++deletedEventL; 1099 ++deletedEventL;
1100 } else { 1100 } else {
1101 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1101 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1102 inL->removeID(mCurrentSyncDevice ); 1102 inL->removeID(mCurrentSyncDevice );
1103 ++addedEventR; 1103 ++addedEventR;
1104 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1104 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1105 inL->setLastModified( modifiedCalendar ); 1105 inL->setLastModified( modifiedCalendar );
1106 inR = inL->clone(); 1106 inR = inL->clone();
1107 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1107 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1108 remote->addIncidence( inR ); 1108 remote->addIncidence( inR );
1109 } 1109 }
1110 } 1110 }
1111 } else { 1111 } else {
1112 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1112 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1113 checkExternSyncEvent(eventLSyncSharp, inL); 1113 checkExternSyncEvent(eventLSyncSharp, inL);
1114 local->deleteIncidence( inL ); 1114 local->deleteIncidence( inL );
1115 ++deletedEventL; 1115 ++deletedEventL;
1116 } else { 1116 } else {
1117 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1117 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1118 ++addedEventR; 1118 ++addedEventR;
1119 inL->setLastModified( modifiedCalendar ); 1119 inL->setLastModified( modifiedCalendar );
1120 remote->addIncidence( inL->clone() ); 1120 remote->addIncidence( inL->clone() );
1121 } 1121 }
1122 } 1122 }
1123 } 1123 }
1124 } 1124 }
1125 } 1125 }
1126 inL = el.next(); 1126 inL = el.next();
1127 } 1127 }
1128 int delFut = 0; 1128 int delFut = 0;
1129 int remRem = 0; 1129 int remRem = 0;
1130 if ( mSyncManager->mWriteBackInFuture ) { 1130 if ( mSyncManager->mWriteBackInFuture ) {
1131 er = remote->rawIncidences(); 1131 er = remote->rawIncidences();
1132 remRem = er.count(); 1132 remRem = er.count();
1133 inR = er.first(); 1133 inR = er.first();
1134 QDateTime dt; 1134 QDateTime dt;
1135 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1135 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1136 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1136 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1137 while ( inR ) { 1137 while ( inR ) {
1138 if ( inR->type() == "Todo" ) { 1138 if ( inR->type() == "Todo" ) {
1139 Todo * t = (Todo*)inR; 1139 Todo * t = (Todo*)inR;
1140 if ( t->hasDueDate() ) 1140 if ( t->hasDueDate() )
1141 dt = t->dtDue(); 1141 dt = t->dtDue();
1142 else 1142 else
1143 dt = cur.addSecs( 62 ); 1143 dt = cur.addSecs( 62 );
1144 } 1144 }
1145 else if (inR->type() == "Event" ) { 1145 else if (inR->type() == "Event" ) {
1146 bool ok; 1146 bool ok;
1147 dt = inR->getNextOccurence( cur, &ok ); 1147 dt = inR->getNextOccurence( cur, &ok );
1148 if ( !ok ) 1148 if ( !ok )
1149 dt = cur.addSecs( -62 ); 1149 dt = cur.addSecs( -62 );
1150 } 1150 }
1151 else 1151 else
1152 dt = inR->dtStart(); 1152 dt = inR->dtStart();
1153 if ( dt < cur || dt > end ) { 1153 if ( dt < cur || dt > end ) {
1154 remote->deleteIncidence( inR ); 1154 remote->deleteIncidence( inR );
1155 ++delFut; 1155 ++delFut;
1156 } 1156 }
1157 inR = er.next(); 1157 inR = er.next();
1158 } 1158 }
1159 } 1159 }
1160 bar.hide(); 1160 bar.hide();
1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1162 eventLSync->setReadOnly( false ); 1162 eventLSync->setReadOnly( false );
1163 eventLSync->setDtStart( mLastCalendarSync ); 1163 eventLSync->setDtStart( mLastCalendarSync );
1164 eventRSync->setDtStart( mLastCalendarSync ); 1164 eventRSync->setDtStart( mLastCalendarSync );
1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1169 eventLSync->setReadOnly( true ); 1169 eventLSync->setReadOnly( true );
1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... 1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
1171 remote->addEvent( eventRSync ); 1171 remote->addEvent( eventRSync );
1172 else 1172 else
1173 delete eventRSync; 1173 delete eventRSync;
1174 QString mes; 1174 QString mes;
1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1176 QString delmess; 1176 QString delmess;
1177 if ( delFut ) { 1177 if ( delFut ) {
1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1179 mes += delmess; 1179 mes += delmess;
1180 } 1180 }
1181 if ( mSyncManager->mShowSyncSummary ) { 1181 if ( mSyncManager->mShowSyncSummary ) {
1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1183 } 1183 }
1184 qDebug( mes ); 1184 qDebug( mes );
1185 mCalendar->checkAlarmForIncidence( 0, true ); 1185 mCalendar->checkAlarmForIncidence( 0, true );
1186 return syncOK; 1186 return syncOK;
1187} 1187}
1188 1188
1189void CalendarView::setSyncDevice( QString s ) 1189void CalendarView::setSyncDevice( QString s )
1190{ 1190{
1191 mCurrentSyncDevice= s; 1191 mCurrentSyncDevice= s;
1192} 1192}
1193void CalendarView::setSyncName( QString s ) 1193void CalendarView::setSyncName( QString s )
1194{ 1194{
1195 mCurrentSyncName= s; 1195 mCurrentSyncName= s;
1196} 1196}
1197bool CalendarView::syncCalendar(QString filename, int mode) 1197bool CalendarView::syncCalendar(QString filename, int mode)
1198{ 1198{
1199 //qDebug("syncCalendar %s ", filename.latin1()); 1199 //qDebug("syncCalendar %s ", filename.latin1());
1200 mGlobalSyncMode = SYNC_MODE_NORMAL; 1200 mGlobalSyncMode = SYNC_MODE_NORMAL;
1201 CalendarLocal* calendar = new CalendarLocal(); 1201 CalendarLocal* calendar = new CalendarLocal();
1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1203 FileStorage* storage = new FileStorage( calendar ); 1203 FileStorage* storage = new FileStorage( calendar );
1204 bool syncOK = false; 1204 bool syncOK = false;
1205 storage->setFileName( filename ); 1205 storage->setFileName( filename );
1206 // qDebug("loading ... "); 1206 // qDebug("loading ... ");
1207 if ( storage->load() ) { 1207 if ( storage->load() ) {
1208 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1210 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
1211 if ( syncOK ) { 1211 if ( syncOK ) {
1212 if ( mSyncManager->mWriteBackFile ) 1212 if ( mSyncManager->mWriteBackFile )
1213 { 1213 {
1214 storage->setSaveFormat( new ICalFormat() ); 1214 storage->setSaveFormat( new ICalFormat() );
1215 storage->save(); 1215 storage->save();
1216 } 1216 }
1217 } 1217 }
1218 setModified( true ); 1218 setModified( true );
1219 } 1219 }
1220 delete storage; 1220 delete storage;
1221 delete calendar; 1221 delete calendar;
1222 if ( syncOK ) 1222 if ( syncOK )
1223 updateView(); 1223 updateView();
1224 return syncOK; 1224 return syncOK;
1225} 1225}
1226 1226
1227void CalendarView::syncExternal( int mode ) 1227void CalendarView::syncExternal( int mode )
1228{ 1228{
1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1230 1230
1231 qApp->processEvents(); 1231 qApp->processEvents();
1232 CalendarLocal* calendar = new CalendarLocal(); 1232 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1234 bool syncOK = false; 1234 bool syncOK = false;
1235 bool loadSuccess = false; 1235 bool loadSuccess = false;
1236 PhoneFormat* phoneFormat = 0; 1236 PhoneFormat* phoneFormat = 0;
1237 emit tempDisableBR(true);
1237#ifndef DESKTOP_VERSION 1238#ifndef DESKTOP_VERSION
1238 SharpFormat* sharpFormat = 0; 1239 SharpFormat* sharpFormat = 0;
1239 if ( mode == 0 ) { // sharp 1240 if ( mode == 0 ) { // sharp
1240 sharpFormat = new SharpFormat () ; 1241 sharpFormat = new SharpFormat () ;
1241 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1242 loadSuccess = sharpFormat->load( calendar, mCalendar );
1242 1243
1243 } else 1244 } else
1244#endif 1245#endif
1245 if ( mode == 1 ) { // phone 1246 if ( mode == 1 ) { // phone
1246 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1247 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1247 mSyncManager->mPhoneDevice, 1248 mSyncManager->mPhoneDevice,
1248 mSyncManager->mPhoneConnection, 1249 mSyncManager->mPhoneConnection,
1249 mSyncManager->mPhoneModel); 1250 mSyncManager->mPhoneModel);
1250 loadSuccess = phoneFormat->load( calendar,mCalendar); 1251 loadSuccess = phoneFormat->load( calendar,mCalendar);
1251 1252
1252 } else 1253 } else {
1253 return; 1254 emit tempDisableBR(false);
1255 return;
1256 }
1254 if ( loadSuccess ) { 1257 if ( loadSuccess ) {
1255 getEventViewerDialog()->setSyncMode( true ); 1258 getEventViewerDialog()->setSyncMode( true );
1256 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1259 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1257 getEventViewerDialog()->setSyncMode( false ); 1260 getEventViewerDialog()->setSyncMode( false );
1258 qApp->processEvents(); 1261 qApp->processEvents();
1259 if ( syncOK ) { 1262 if ( syncOK ) {
1260 if ( mSyncManager->mWriteBackFile ) 1263 if ( mSyncManager->mWriteBackFile )
1261 { 1264 {
1262 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1265 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1263 Incidence* inc = iL.first(); 1266 Incidence* inc = iL.first();
1264 if ( phoneFormat ) { 1267 if ( phoneFormat ) {
1265 while ( inc ) { 1268 while ( inc ) {
1266 inc->removeID(mCurrentSyncDevice); 1269 inc->removeID(mCurrentSyncDevice);
1267 inc = iL.next(); 1270 inc = iL.next();
1268 } 1271 }
1269 } 1272 }
1270#ifndef DESKTOP_VERSION 1273#ifndef DESKTOP_VERSION
1271 if ( sharpFormat ) 1274 if ( sharpFormat )
1272 sharpFormat->save(calendar); 1275 sharpFormat->save(calendar);
1273#endif 1276#endif
1274 if ( phoneFormat ) 1277 if ( phoneFormat )
1275 phoneFormat->save(calendar); 1278 phoneFormat->save(calendar);
1276 iL = calendar->rawIncidences(); 1279 iL = calendar->rawIncidences();
1277 inc = iL.first(); 1280 inc = iL.first();
1278 Incidence* loc; 1281 Incidence* loc;
1279 while ( inc ) { 1282 while ( inc ) {
1280 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1283 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1281 loc = mCalendar->incidence(inc->uid() ); 1284 loc = mCalendar->incidence(inc->uid() );
1282 if ( loc ) { 1285 if ( loc ) {
1283 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1286 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1284 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1287 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1285 } 1288 }
1286 } 1289 }
1287 inc = iL.next(); 1290 inc = iL.next();
1288 } 1291 }
1289 Incidence* lse = getLastSyncEvent(); 1292 Incidence* lse = getLastSyncEvent();
1290 if ( lse ) { 1293 if ( lse ) {
1291 lse->setReadOnly( false ); 1294 lse->setReadOnly( false );
1292 lse->setDescription( "" ); 1295 lse->setDescription( "" );
1293 lse->setReadOnly( true ); 1296 lse->setReadOnly( true );
1294 } 1297 }
1295 } 1298 }
1296 } 1299 }
1297 setModified( true ); 1300 setModified( true );
1298 } else { 1301 } else {
1299 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1302 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1300 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1303 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1301 question, i18n("Ok")) ; 1304 question, i18n("Ok")) ;
1302 1305
1303 } 1306 }
1304 delete calendar; 1307 delete calendar;
1305 updateView(); 1308 updateView();
1309 emit tempDisableBR(false);
1306 return ;//syncOK; 1310 return ;//syncOK;
1307 1311
1308} 1312}
1309 1313
1310bool CalendarView::importBday() 1314bool CalendarView::importBday()
1311{ 1315{
1312#ifndef KORG_NOKABC 1316#ifndef KORG_NOKABC
1313 1317
1314#ifdef DESKTOP_VERSION 1318#ifdef DESKTOP_VERSION
1315 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1319 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1316 KABC::AddressBook::Iterator it; 1320 KABC::AddressBook::Iterator it;
1317 int count = 0; 1321 int count = 0;
1318 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1322 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1319 ++count; 1323 ++count;
1320 } 1324 }
1321 QProgressBar bar(count,0 ); 1325 QProgressBar bar(count,0 );
1322 int w = 300; 1326 int w = 300;
1323 if ( QApplication::desktop()->width() < 320 ) 1327 if ( QApplication::desktop()->width() < 320 )
1324 w = 220; 1328 w = 220;
1325 int h = bar.sizeHint().height() ; 1329 int h = bar.sizeHint().height() ;
1326 int dw = QApplication::desktop()->width(); 1330 int dw = QApplication::desktop()->width();
1327 int dh = QApplication::desktop()->height(); 1331 int dh = QApplication::desktop()->height();
1328 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1332 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1329 bar.show(); 1333 bar.show();
1330 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1334 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1331 qApp->processEvents(); 1335 qApp->processEvents();
1332 count = 0; 1336 count = 0;
1333 int addCount = 0; 1337 int addCount = 0;
1334 KCal::Attendee* a = 0; 1338 KCal::Attendee* a = 0;
1335 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1339 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1336 if ( ! bar.isVisible() ) 1340 if ( ! bar.isVisible() )
1337 return false; 1341 return false;
1338 bar.setProgress( count++ ); 1342 bar.setProgress( count++ );
1339 qApp->processEvents(); 1343 qApp->processEvents();
1340 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1344 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1341 if ( (*it).birthday().date().isValid() ){ 1345 if ( (*it).birthday().date().isValid() ){
1342 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1346 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1343 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1347 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1344 ++addCount; 1348 ++addCount;
1345 } 1349 }
1346 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1350 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1347 if ( anni.isValid() ){ 1351 if ( anni.isValid() ){
1348 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1352 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1349 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1353 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1350 ++addCount; 1354 ++addCount;
1351 } 1355 }
1352 } 1356 }
1353 updateView(); 1357 updateView();
1354 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1358 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1355#else //DESKTOP_VERSION 1359#else //DESKTOP_VERSION
1356 1360
1357 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1361 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1358 // the result should now arrive through method insertBirthdays 1362 // the result should now arrive through method insertBirthdays
1359 1363
1360#endif //DESKTOP_VERSION 1364#endif //DESKTOP_VERSION
1361 1365
1362#endif //KORG_NOKABC 1366#endif //KORG_NOKABC
1363 1367
1364 1368
1365 return true; 1369 return true;
1366} 1370}
1367 1371
1368// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1372// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1369void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1373void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1370 const QStringList& anniversaryList, const QStringList& realNameList, 1374 const QStringList& anniversaryList, const QStringList& realNameList,
1371 const QStringList& emailList, const QStringList& assembledNameList, 1375 const QStringList& emailList, const QStringList& assembledNameList,
1372 const QStringList& uidList) 1376 const QStringList& uidList)
1373{ 1377{
1374 qDebug("CalendarView::insertBirthdays"); 1378 qDebug("CalendarView::insertBirthdays");
1375 if (uid == this->name()) 1379 if (uid == this->name())
1376 { 1380 {
1377 int count = birthdayList.count(); 1381 int count = birthdayList.count();
1378 int addCount = 0; 1382 int addCount = 0;
1379 KCal::Attendee* a = 0; 1383 KCal::Attendee* a = 0;
1380 1384
1381 qDebug("CalView 1 %i", count); 1385 qDebug("CalView 1 %i", count);
1382 1386
1383 QProgressBar bar(count,0 ); 1387 QProgressBar bar(count,0 );
1384 int w = 300; 1388 int w = 300;
1385 if ( QApplication::desktop()->width() < 320 ) 1389 if ( QApplication::desktop()->width() < 320 )
1386 w = 220; 1390 w = 220;
1387 int h = bar.sizeHint().height() ; 1391 int h = bar.sizeHint().height() ;
1388 int dw = QApplication::desktop()->width(); 1392 int dw = QApplication::desktop()->width();
1389 int dh = QApplication::desktop()->height(); 1393 int dh = QApplication::desktop()->height();
1390 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1394 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1391 bar.show(); 1395 bar.show();
1392 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1396 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1393 qApp->processEvents(); 1397 qApp->processEvents();
1394 1398
1395 QDate birthday; 1399 QDate birthday;
1396 QDate anniversary; 1400 QDate anniversary;
1397 QString realName; 1401 QString realName;
1398 QString email; 1402 QString email;
1399 QString assembledName; 1403 QString assembledName;
1400 QString uid; 1404 QString uid;
1401 bool ok = true; 1405 bool ok = true;
1402 for ( int i = 0; i < count; i++) 1406 for ( int i = 0; i < count; i++)
1403 { 1407 {
1404 if ( ! bar.isVisible() ) 1408 if ( ! bar.isVisible() )
1405 return; 1409 return;
1406 bar.setProgress( i ); 1410 bar.setProgress( i );
1407 qApp->processEvents(); 1411 qApp->processEvents();
1408 1412
1409 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1413 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1410 if (!ok) { 1414 if (!ok) {
1411 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1415 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1412 } 1416 }
1413 1417
1414 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1418 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1415 if (!ok) { 1419 if (!ok) {
1416 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1420 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1417 } 1421 }
1418 realName = realNameList[i]; 1422 realName = realNameList[i];
1419 email = emailList[i]; 1423 email = emailList[i];
1420 assembledName = assembledNameList[i]; 1424 assembledName = assembledNameList[i];
1421 uid = uidList[i]; 1425 uid = uidList[i];
1422 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1426 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1423 1427
1424 if ( birthday.isValid() ){ 1428 if ( birthday.isValid() ){
1425 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1429 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1426 KCal::Attendee::ReqParticipant,uid) ; 1430 KCal::Attendee::ReqParticipant,uid) ;
1427 if ( addAnniversary( birthday, assembledName, a, true ) ) 1431 if ( addAnniversary( birthday, assembledName, a, true ) )
1428 ++addCount; 1432 ++addCount;
1429 } 1433 }
1430 1434
1431 if ( anniversary.isValid() ){ 1435 if ( anniversary.isValid() ){
1432 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1436 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1433 KCal::Attendee::ReqParticipant,uid) ; 1437 KCal::Attendee::ReqParticipant,uid) ;
1434 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1438 if ( addAnniversary( anniversary, assembledName, a, false ) )
1435 ++addCount; 1439 ++addCount;
1436 } 1440 }
1437 } 1441 }
1438 1442
1439 updateView(); 1443 updateView();
1440 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1444 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1441 1445
1442 } 1446 }
1443 1447
1444} 1448}
1445 1449
1446 1450
1447 1451
1448bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1452bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1449{ 1453{
1450 //qDebug("addAnni "); 1454 //qDebug("addAnni ");
1451 Event * ev = new Event(); 1455 Event * ev = new Event();
1452 if ( a ) { 1456 if ( a ) {
1453 ev->addAttendee( a ); 1457 ev->addAttendee( a );
1454 } 1458 }
1455 QString kind; 1459 QString kind;
1456 if ( birthday ) 1460 if ( birthday )
1457 kind = i18n( "Birthday" ); 1461 kind = i18n( "Birthday" );
1458 else 1462 else
1459 kind = i18n( "Anniversary" ); 1463 kind = i18n( "Anniversary" );
1460 ev->setSummary( name + " - " + kind ); 1464 ev->setSummary( name + " - " + kind );
1461 ev->setOrganizer( "nobody@nowhere" ); 1465 ev->setOrganizer( "nobody@nowhere" );
1462 ev->setCategories( kind ); 1466 ev->setCategories( kind );
1463 ev->setDtStart( QDateTime(date) ); 1467 ev->setDtStart( QDateTime(date) );
1464 ev->setDtEnd( QDateTime(date) ); 1468 ev->setDtEnd( QDateTime(date) );
1465 ev->setFloats( true ); 1469 ev->setFloats( true );
1466 Recurrence * rec = ev->recurrence(); 1470 Recurrence * rec = ev->recurrence();
1467 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1471 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1468 rec->addYearlyNum( date.month() ); 1472 rec->addYearlyNum( date.month() );
1469 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1473 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1470 delete ev; 1474 delete ev;
1471 return false; 1475 return false;
1472 } 1476 }
1473 return true; 1477 return true;
1474 1478
1475} 1479}
1476bool CalendarView::importQtopia( const QString &categories, 1480bool CalendarView::importQtopia( const QString &categories,
1477 const QString &datebook, 1481 const QString &datebook,
1478 const QString &todolist ) 1482 const QString &todolist )
1479{ 1483{
1480 1484
1481 QtopiaFormat qtopiaFormat; 1485 QtopiaFormat qtopiaFormat;
1482 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1486 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1483 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1487 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1484 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1488 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1485 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1489 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1486 1490
1487 updateView(); 1491 updateView();
1488 return true; 1492 return true;
1489 1493
1490#if 0 1494#if 0
1491 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1495 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1492 mCurrentSyncDevice = "qtopia-XML"; 1496 mCurrentSyncDevice = "qtopia-XML";
1493 if ( mSyncManager->mAskForPreferences ) 1497 if ( mSyncManager->mAskForPreferences )
1494 edit_sync_options(); 1498 edit_sync_options();
1495 qApp->processEvents(); 1499 qApp->processEvents();
1496 CalendarLocal* calendar = new CalendarLocal(); 1500 CalendarLocal* calendar = new CalendarLocal();
1497 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1501 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 1cd896d..2818ee9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,311 +1,312 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45#include <ksyncmanager.h> 45#include <ksyncmanager.h>
46 46
47class QWidgetStack; 47class QWidgetStack;
48class QSplitter; 48class QSplitter;
49 49
50class CalPrinter; 50class CalPrinter;
51class KOFilterView; 51class KOFilterView;
52class KOViewManager; 52class KOViewManager;
53class KODialogManager; 53class KODialogManager;
54class KOTodoView; 54class KOTodoView;
55class KDateNavigator; 55class KDateNavigator;
56class DateNavigator; 56class DateNavigator;
57class KOIncidenceEditor; 57class KOIncidenceEditor;
58class KDatePicker; 58class KDatePicker;
59class ResourceView; 59class ResourceView;
60class NavigatorBar; 60class NavigatorBar;
61class KOEventEditor; 61class KOEventEditor;
62class KOTodoEditor ; 62class KOTodoEditor ;
63class KOEventViewerDialog; 63class KOEventViewerDialog;
64class KOBeamPrefs; 64class KOBeamPrefs;
65class KSyncProfile; 65class KSyncProfile;
66class AlarmDialog; 66class AlarmDialog;
67class KCal::Attendee; 67class KCal::Attendee;
68 68
69namespace KCal { class FileStorage; } 69namespace KCal { class FileStorage; }
70 70
71using namespace KCal; 71using namespace KCal;
72 72
73/** 73/**
74 This is the main calendar widget. It provides the different vies on t he 74 This is the main calendar widget. It provides the different vies on t he
75 calendar data as well as the date navigator. It also handles synchronisation 75 calendar data as well as the date navigator. It also handles synchronisation
76 of the different views and controls the different dialogs like preferences, 76 of the different views and controls the different dialogs like preferences,
77 event editor, search dialog etc. 77 event editor, search dialog etc.
78 78
79 @short main calendar view widget 79 @short main calendar view widget
80 @author Cornelius Schumacher 80 @author Cornelius Schumacher
81*/ 81*/
82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
83{ 83{
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 /** 86 /**
87 Constructs a new calendar view widget. 87 Constructs a new calendar view widget.
88 88
89 @param calendar calendar document 89 @param calendar calendar document
90 @param parent parent window 90 @param parent parent window
91 @param name Qt internal widget object name 91 @param name Qt internal widget object name
92 */ 92 */
93 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 93 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 CalendarView( Calendar *calendar, QWidget *parent = 0, 95 CalendarView( Calendar *calendar, QWidget *parent = 0,
96 const char *name = 0 ); 96 const char *name = 0 );
97 virtual ~CalendarView(); 97 virtual ~CalendarView();
98 98
99 Calendar *calendar() { return mCalendar; } 99 Calendar *calendar() { return mCalendar; }
100 100
101 KOViewManager *viewManager(); 101 KOViewManager *viewManager();
102 KODialogManager *dialogManager(); 102 KODialogManager *dialogManager();
103 103
104 QDate startDate(); 104 QDate startDate();
105 QDate endDate(); 105 QDate endDate();
106 106
107 QWidgetStack *viewStack(); 107 QWidgetStack *viewStack();
108 QWidget *leftFrame(); 108 QWidget *leftFrame();
109 NavigatorBar *navigatorBar(); 109 NavigatorBar *navigatorBar();
110 110
111 DateNavigator *dateNavigator(); 111 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 112 KDateNavigator *dateNavigatorWidget();
113 113
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void tempDisableBR(bool);
120 /** This todo has been modified */ 121 /** This todo has been modified */
121 void todoModified(Todo *, int); 122 void todoModified(Todo *, int);
122 123
123 /** when change is made to options dialog, the topwidget will catch this 124 /** when change is made to options dialog, the topwidget will catch this
124 * and emit this signal which notifies all widgets which have registered 125 * and emit this signal which notifies all widgets which have registered
125 * for notification to update their settings. */ 126 * for notification to update their settings. */
126 void configChanged(); 127 void configChanged();
127 /** emitted when the topwidget is closing down, so that any attached 128 /** emitted when the topwidget is closing down, so that any attached
128 child windows can also close. */ 129 child windows can also close. */
129 void closingDown(); 130 void closingDown();
130 /** emitted right before we die */ 131 /** emitted right before we die */
131 void closed(QWidget *); 132 void closed(QWidget *);
132 133
133 /** Emitted when state of modified flag changes */ 134 /** Emitted when state of modified flag changes */
134 void modifiedChanged(bool); 135 void modifiedChanged(bool);
135 void signalmodified(); 136 void signalmodified();
136 137
137 /** Emitted when state of read-only flag changes */ 138 /** Emitted when state of read-only flag changes */
138 void readOnlyChanged(bool); 139 void readOnlyChanged(bool);
139 140
140 /** Emitted when the unit of navigation changes */ 141 /** Emitted when the unit of navigation changes */
141 void changeNavStringPrev(const QString &); 142 void changeNavStringPrev(const QString &);
142 void changeNavStringNext(const QString &); 143 void changeNavStringNext(const QString &);
143 144
144 /** Emitted when state of events selection has changed and user is organizer*/ 145 /** Emitted when state of events selection has changed and user is organizer*/
145 void organizerEventsSelected(bool); 146 void organizerEventsSelected(bool);
146 /** Emitted when state of events selection has changed and user is attendee*/ 147 /** Emitted when state of events selection has changed and user is attendee*/
147 void groupEventsSelected(bool); 148 void groupEventsSelected(bool);
148 /** 149 /**
149 Emitted when an incidence gets selected. If the selection is cleared the 150 Emitted when an incidence gets selected. If the selection is cleared the
150 signal is emitted with 0 as argument. 151 signal is emitted with 0 as argument.
151 */ 152 */
152 void incidenceSelected( Incidence * ); 153 void incidenceSelected( Incidence * );
153 /** Emitted, when a todoitem is selected or deselected. */ 154 /** Emitted, when a todoitem is selected or deselected. */
154 void todoSelected( bool ); 155 void todoSelected( bool );
155 156
156 /** 157 /**
157 Emitted, when clipboard content changes. Parameter indicates if paste 158 Emitted, when clipboard content changes. Parameter indicates if paste
158 is possible or not. 159 is possible or not.
159 */ 160 */
160 void pasteEnabled(bool); 161 void pasteEnabled(bool);
161 162
162 /** Emitted, when the number of incoming messages has changed. */ 163 /** Emitted, when the number of incoming messages has changed. */
163 void numIncomingChanged(int); 164 void numIncomingChanged(int);
164 165
165 /** Emitted, when the number of outgoing messages has changed. */ 166 /** Emitted, when the number of outgoing messages has changed. */
166 void numOutgoingChanged(int); 167 void numOutgoingChanged(int);
167 168
168 /** Send status message, which can e.g. be displayed in the status bar. */ 169 /** Send status message, which can e.g. be displayed in the status bar. */
169 void statusMessage(const QString &); 170 void statusMessage(const QString &);
170 171
171 void calendarViewExpanded( bool ); 172 void calendarViewExpanded( bool );
172 void updateSearchDialog(); 173 void updateSearchDialog();
173 174
174 175
175 public slots: 176 public slots:
176 void showOpenError(); 177 void showOpenError();
177 void watchSavedFile(); 178 void watchSavedFile();
178 void recheckTimerAlarm(); 179 void recheckTimerAlarm();
179 void checkNextTimerAlarm(); 180 void checkNextTimerAlarm();
180 void addAlarm(const QDateTime &qdt, const QString &noti ); 181 void addAlarm(const QDateTime &qdt, const QString &noti );
181 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 182 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
182 void removeAlarm(const QDateTime &qdt, const QString &noti ); 183 void removeAlarm(const QDateTime &qdt, const QString &noti );
183 184
184 /** options dialog made a changed to the configuration. we catch this 185 /** options dialog made a changed to the configuration. we catch this
185 * and notify all widgets which need to update their configuration. */ 186 * and notify all widgets which need to update their configuration. */
186 void updateConfig(); 187 void updateConfig();
187 188
188 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 189 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
189 const QStringList& anniversaryList, const QStringList& realNameList, 190 const QStringList& anniversaryList, const QStringList& realNameList,
190 const QStringList& emailList, const QStringList& assembledNameList, 191 const QStringList& emailList, const QStringList& assembledNameList,
191 const QStringList& uidList); 192 const QStringList& uidList);
192 193
193 /** 194 /**
194 Load calendar from file \a filename. If \a merge is true, load 195 Load calendar from file \a filename. If \a merge is true, load
195 calendar into existing one, if it is false, clear calendar, before 196 calendar into existing one, if it is false, clear calendar, before
196 loading. Return true, if calendar could be successfully loaded. 197 loading. Return true, if calendar could be successfully loaded.
197 */ 198 */
198 bool openCalendar(QString filename, bool merge=false); 199 bool openCalendar(QString filename, bool merge=false);
199 bool syncCalendar(QString filename,int mode = 0 ); 200 bool syncCalendar(QString filename,int mode = 0 );
200 201
201 /** 202 /**
202 Save calendar data to file. Return true if calendar could be 203 Save calendar data to file. Return true if calendar could be
203 successfully saved. 204 successfully saved.
204 */ 205 */
205 bool saveCalendar(QString filename); 206 bool saveCalendar(QString filename);
206 207
207 /** 208 /**
208 Close calendar. Clear calendar data and reset views to display an empty 209 Close calendar. Clear calendar data and reset views to display an empty
209 calendar. 210 calendar.
210 */ 211 */
211 void closeCalendar(); 212 void closeCalendar();
212 213
213 /** Archive old events of calendar */ 214 /** Archive old events of calendar */
214 void archiveCalendar(); 215 void archiveCalendar();
215 216
216 void showIncidence(); 217 void showIncidence();
217 void editIncidence(); 218 void editIncidence();
218 void editIncidenceDescription(); 219 void editIncidenceDescription();
219 void deleteIncidence(); 220 void deleteIncidence();
220 void cloneIncidence(); 221 void cloneIncidence();
221 void moveIncidence(); 222 void moveIncidence();
222 void beamIncidence(); 223 void beamIncidence();
223 void toggleCancelIncidence(); 224 void toggleCancelIncidence();
224 225
225 /** create an editeventwin with supplied date/time, and if bool is true, 226 /** create an editeventwin with supplied date/time, and if bool is true,
226 * make the event take all day. */ 227 * make the event take all day. */
227 void newEvent(QDateTime, QDateTime, bool allDay = false); 228 void newEvent(QDateTime, QDateTime, bool allDay = false);
228 void newEvent(QDateTime fh); 229 void newEvent(QDateTime fh);
229 void newEvent(QDate dt); 230 void newEvent(QDate dt);
230 /** create new event without having a date hint. Takes current date as 231 /** create new event without having a date hint. Takes current date as
231 default hint. */ 232 default hint. */
232 void newEvent(); 233 void newEvent();
233 void newFloatingEvent(); 234 void newFloatingEvent();
234 235
235 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 236 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
236 void showIncidence(Incidence *); 237 void showIncidence(Incidence *);
237 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 238 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
238 void editIncidence(Incidence *); 239 void editIncidence(Incidence *);
239 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 240 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
240 void deleteIncidence(Incidence *); 241 void deleteIncidence(Incidence *);
241 void cloneIncidence(Incidence *); 242 void cloneIncidence(Incidence *);
242 void cancelIncidence(Incidence *); 243 void cancelIncidence(Incidence *);
243 /** Create an editor for the supplied event. */ 244 /** Create an editor for the supplied event. */
244 void editEvent(Event *); 245 void editEvent(Event *);
245 /** Delete the supplied event. */ 246 /** Delete the supplied event. */
246 void deleteEvent(Event *); 247 void deleteEvent(Event *);
247 /** Delete the event with the given unique ID. Returns false, if event wasn't 248 /** Delete the event with the given unique ID. Returns false, if event wasn't
248 found. */ 249 found. */
249 bool deleteEvent(const QString &uid); 250 bool deleteEvent(const QString &uid);
250 /** Create a read-only viewer dialog for the supplied event. */ 251 /** Create a read-only viewer dialog for the supplied event. */
251 void showEvent(Event *); 252 void showEvent(Event *);
252 253
253 void editJournal(Journal *); 254 void editJournal(Journal *);
254 void showJournal(Journal *); 255 void showJournal(Journal *);
255 void deleteJournal(Journal *); 256 void deleteJournal(Journal *);
256 /** Create an editor dialog for a todo */ 257 /** Create an editor dialog for a todo */
257 void editTodo(Todo *); 258 void editTodo(Todo *);
258 /** Create a read-only viewer dialog for the supplied todo */ 259 /** Create a read-only viewer dialog for the supplied todo */
259 void showTodo(Todo *); 260 void showTodo(Todo *);
260 /** create new todo */ 261 /** create new todo */
261 void newTodo(); 262 void newTodo();
262 /** create new todo with a parent todo */ 263 /** create new todo with a parent todo */
263 void newSubTodo(); 264 void newSubTodo();
264 /** create new todo with a parent todo */ 265 /** create new todo with a parent todo */
265 void newSubTodo(Todo *); 266 void newSubTodo(Todo *);
266 /** Delete todo */ 267 /** Delete todo */
267 void deleteTodo(Todo *); 268 void deleteTodo(Todo *);
268 269
269 270
270 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 271 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
271 * emitted as result. */ 272 * emitted as result. */
272 void checkClipboard(); 273 void checkClipboard();
273 274
274 /** using the KConfig associated with the kapp variable, read in the 275 /** using the KConfig associated with the kapp variable, read in the
275 * settings from the config file. 276 * settings from the config file.
276 */ 277 */
277 void readSettings(); 278 void readSettings();
278 279
279 /** write current state to config file. */ 280 /** write current state to config file. */
280 void writeSettings(); 281 void writeSettings();
281 282
282 /** read settings for calendar filters */ 283 /** read settings for calendar filters */
283 void readFilterSettings(KConfig *config); 284 void readFilterSettings(KConfig *config);
284 285
285 /** write settings for calendar filters */ 286 /** write settings for calendar filters */
286 void writeFilterSettings(KConfig *config); 287 void writeFilterSettings(KConfig *config);
287 288
288 /** passes on the message that an event has changed to the currently 289 /** passes on the message that an event has changed to the currently
289 * activated view so that it can make appropriate display changes. */ 290 * activated view so that it can make appropriate display changes. */
290 void changeEventDisplay(Event *, int); 291 void changeEventDisplay(Event *, int);
291 void changeIncidenceDisplay(Incidence *, int); 292 void changeIncidenceDisplay(Incidence *, int);
292 void changeTodoDisplay(Todo *, int); 293 void changeTodoDisplay(Todo *, int);
293 294
294 void eventAdded(Event *); 295 void eventAdded(Event *);
295 void eventChanged(Event *); 296 void eventChanged(Event *);
296 void eventToBeDeleted(Event *); 297 void eventToBeDeleted(Event *);
297 void eventDeleted(); 298 void eventDeleted();
298 299
299 void todoAdded(Todo *); 300 void todoAdded(Todo *);
300 void todoChanged(Todo *); 301 void todoChanged(Todo *);
301 void todoToBeDeleted(Todo *); 302 void todoToBeDeleted(Todo *);
302 void todoDeleted(); 303 void todoDeleted();
303 304
304 void updateView(const QDate &start, const QDate &end); 305 void updateView(const QDate &start, const QDate &end);
305 void updateView(); 306 void updateView();
306 307
307 /** Full update of visible todo views */ 308 /** Full update of visible todo views */
308 void updateTodoViews(); 309 void updateTodoViews();
309 310
310 void updateUnmanagedViews(); 311 void updateUnmanagedViews();
311 312
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,108 +1,104 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15 15
16#include <qdir.h> 16#include <qdir.h>
17#include <kstandarddirs.h> 17#include <kstandarddirs.h>
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21 21
22int main( int argc, char **argv ) 22int main( int argc, char **argv )
23{ 23{
24#ifndef DESKTOP_VERSION 24#ifndef DESKTOP_VERSION
25 QPEApplication a( argc, argv ); 25 QPEApplication a( argc, argv );
26 a.setKeepRunning (); 26 a.setKeepRunning ();
27#else 27#else
28 QApplication a( argc, argv ); 28 QApplication a( argc, argv );
29 QApplication::setStyle( new QPlatinumStyle ()); 29 QApplication::setStyle( new QPlatinumStyle ());
30 QString hdir = QDir::homeDirPath(); 30 QString hdir = QDir::homeDirPath();
31 // there is a bug when creating dirs for WIN 98 31 // there is a bug when creating dirs for WIN 98
32 // it is difficult to fix, because we have no WIN 98 runnung 32 // it is difficult to fix, because we have no WIN 98 runnung
33 // such that we try it to create the dirs at startup here 33 // such that we try it to create the dirs at startup here
34 if ( hdir == "C:\\" ) { // win 98 or ME 34 if ( hdir == "C:\\" ) { // win 98 or ME
35 QDir app_dir; 35 QDir app_dir;
36 if ( !app_dir.exists("C:\\kdepim") ) 36 if ( !app_dir.exists("C:\\kdepim") )
37 app_dir.mkdir ("C:\\kdepim"); 37 app_dir.mkdir ("C:\\kdepim");
38 if ( !app_dir.exists("C:\\kdepim\\apps") ) 38 if ( !app_dir.exists("C:\\kdepim\\apps") )
39 app_dir.mkdir ("C:\\kdepim\\apps"); 39 app_dir.mkdir ("C:\\kdepim\\apps");
40 if ( !app_dir.exists("C:\\kdepim\\config") ) 40 if ( !app_dir.exists("C:\\kdepim\\config") )
41 app_dir.mkdir ("C:\\kdepim\\config"); 41 app_dir.mkdir ("C:\\kdepim\\config");
42 if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) 42 if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") )
43 app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); 43 app_dir.mkdir ("C:\\kdepim\\apps\\korganizer");
44 } 44 }
45#endif 45#endif
46 bool exitHelp = false; 46 bool exitHelp = false;
47 if ( argc > 1 ) { 47 if ( argc > 1 ) {
48 QString command = argv[1]; 48 QString command = argv[1];
49 if ( command == "-help" ){ 49 if ( command == "-help" ){
50 printf("KO/Pi command line commands:\n"); 50 printf("KO/Pi command line commands:\n");
51 printf(" no command: Start KO/Pi in usual way\n"); 51 printf(" no command: Start KO/Pi in usual way\n");
52 printf(" -help: This output\n"); 52 printf(" -help: This output\n");
53 printf("Next Option: Open or Show after start:\n"); 53 printf("Next Option: Open or Show after start:\n");
54 printf(" -newTodo: New Todo dialog\n"); 54 printf(" -newTodo: New Todo dialog\n");
55 printf(" -newEvent: New Event dialog\n"); 55 printf(" -newEvent: New Event dialog\n");
56 printf(" -showList: List view\n"); 56 printf(" -showList: List view\n");
57 printf(" -showDay: Day view\n"); 57 printf(" -showDay: Day view\n");
58 printf(" -showWWeek: Work Week view\n"); 58 printf(" -showWWeek: Work Week view\n");
59 printf(" -showWeek: Week view\n"); 59 printf(" -showWeek: Week view\n");
60 printf(" -showTodo: Todo view\n"); 60 printf(" -showTodo: Todo view\n");
61 printf(" -showJournal: Journal view\n"); 61 printf(" -showJournal: Journal view\n");
62 printf(" -showKO: Next Days view\n"); 62 printf(" -showKO: Next Days view\n");
63 printf(" -showWNext: What's Next view\n"); 63 printf(" -showWNext: What's Next view\n");
64 printf(" -showNextXView: Next X View\n"); 64 printf(" -showNextXView: Next X View\n");
65 printf(" -new[Y] and -show[X] may be used togehther\n"); 65 printf(" -new[Y] and -show[X] may be used togehther\n");
66 printf(" KO/Pi is exiting now. Bye!\n"); 66 printf(" KO/Pi is exiting now. Bye!\n");
67 exitHelp = true; 67 exitHelp = true;
68 } 68 }
69 } 69 }
70 if ( ! exitHelp ) { 70 if ( ! exitHelp ) {
71 KGlobal::setAppName( "korganizer" ); 71 KGlobal::setAppName( "korganizer" );
72 QString fileName ; 72 QString fileName ;
73#ifndef DESKTOP_VERSION 73#ifndef DESKTOP_VERSION
74 fileName = getenv("QPEDIR"); 74 fileName = getenv("QPEDIR");
75 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 75 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
76#else 76#else
77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
79#endif 79#endif
80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
81 MainWindow m; 81 MainWindow m;
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; 83
84 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
85 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 84 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
86 a.showMainWidget(&m ); 85 a.showMainWidget(&m );
87#else 86#else
88 a.setMainWidget(&m ); 87 a.setMainWidget(&m );
89 m.show(); 88 m.show();
90 //m.resize( 800, 600 ); 89 //m.resize( 800, 600 );
91 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 90 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
92#endif 91#endif
93 if ( argc > 1 ) { 92 if ( argc > 1 ) {
94 QCString command = argv[1]; 93 QCString command = argv[1];
95 if ( argc > 2 ) 94 if ( argc > 2 )
96 command += argv[2]; 95 command += argv[2];
97 qApp->processEvents(); 96 qApp->processEvents();
98 m.recieve(command, QByteArray() ); 97 m.recieve(command, QByteArray() );
99 98
100 } 99 }
101 a.exec(); 100 a.exec();
102#ifndef DESKTOP_VERSION
103 delete c1;
104#endif
105 101
106 } 102 }
107 qDebug("KO: Bye! "); 103 qDebug("KO: Bye! ");
108} 104}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -48,430 +48,481 @@
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#include "koimportoldialog.h" 69#include "koimportoldialog.h"
70#endif 70#endif
71#include "mainwindow.h" 71#include "mainwindow.h"
72 72
73class KOex2phonePrefs : public QDialog 73class KOex2phonePrefs : public QDialog
74{ 74{
75 public: 75 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 77 QDialog( parent, name, true )
78 { 78 {
79 setCaption( i18n("Export to phone options") ); 79 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 80 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 81 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 82 lay->setMargin( 3 );
83 QLabel *lab; 83 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 85 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 86 QHBox* temphb;
87 temphb = new QHBox( this ); 87 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 88 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 89 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 90 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 92 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 93 mPhoneConnection = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Model(opt.): "), temphb ); 96 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 97 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mClosed = false; 133 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 139 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 145 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
149 tbd = Bottom; 149 tbd = Bottom;
150 else 150 else
151 tbd = Top; 151 tbd = Top;
152 } 152 }
153 else { 153 else {
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) );
240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
241 mView->setModified( false ); 243 mView->setModified( false );
242 mBlockAtStartup = false; 244 mBlockAtStartup = false;
243 mView->setModified( false ); 245 mView->setModified( false );
244 setCentralWidget( mView ); 246 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
246 mView->show(); 248 mView->show();
247 delete splash; 249 delete splash;
248 if ( newFile ) 250 if ( newFile )
249 mView->updateConfig(); 251 mView->updateConfig();
250 // qApp->processEvents(); 252 // qApp->processEvents();
251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
252 //fillSyncMenu(); 254 //fillSyncMenu();
253 255
254 256
255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
258 mSyncManager->setDefaultFileName( defaultFileName()); 260 mSyncManager->setDefaultFileName( defaultFileName());
259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
260 mSyncManager->fillSyncMenu(); 262 mSyncManager->fillSyncMenu();
261 263
262 264
263 265
264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
265 if ( showWarning ) { 267 if ( showWarning ) {
266 KMessageBox::information( this, 268 KMessageBox::information( this,
267 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 269 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
268 qApp->processEvents(); 270 qApp->processEvents();
269 mView->dialogManager()->showSyncOptions(); 271 mView->dialogManager()->showSyncOptions();
270 } 272 }
271 273
272 //US listen for result adressed from Ka/Pi 274 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 277#endif
276 278#ifndef DESKTOP_VERSION
279 infrared = 0;
280#endif
281
282 mBRdisabled = false;
283 toggleBeamReceive();
277} 284}
278MainWindow::~MainWindow() 285MainWindow::~MainWindow()
279{ 286{
280 //qDebug("MainWindow::~MainWindow() "); 287 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 288 //save toolbar location
282 delete mCalendar; 289 delete mCalendar;
283 delete mSyncManager; 290 delete mSyncManager;
291 if ( infrared )
292 delete infrared;
293
294
295}
296
297void MainWindow::disableBR(bool b)
298{
299 if ( b ) {
300 if ( infrared ) {
301 toggleBeamReceive();
302 mBRdisabled = true;
303 }
304 } else {
305 if ( mBRdisabled ) {
306 mBRdisabled = false;
307 toggleBeamReceive();
308 }
309 }
284 310
311}
312bool MainWindow::beamReceiveEnabled()
313{
314#ifndef DESKTOP_VERSION
315 return ( infrared != 0 );
316#endif
317 return false;
318}
285 319
320void MainWindow::toggleBeamReceive()
321{
322 if ( mBRdisabled )
323 return;
324#ifndef DESKTOP_VERSION
325 if ( infrared ) {
326 qDebug("disable BeamReceive ");
327 delete infrared;
328 infrared = 0;
329 brAction->setOn(false);
330 return;
331 }
332 qDebug("enable BeamReceive ");
333 brAction->setOn(true);
334 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
335 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
336#endif
286} 337}
287void MainWindow::showMaximized () 338void MainWindow::showMaximized ()
288{ 339{
289#ifndef DESKTOP_VERSION 340#ifndef DESKTOP_VERSION
290 if ( ! globalFlagBlockStartup ) 341 if ( ! globalFlagBlockStartup )
291 if ( mClosed ) 342 if ( mClosed )
292 mView->goToday(); 343 mView->goToday();
293#endif 344#endif
294 QWidget::showMaximized () ; 345 QWidget::showMaximized () ;
295 mClosed = false; 346 mClosed = false;
296} 347}
297void MainWindow::closeEvent( QCloseEvent* ce ) 348void MainWindow::closeEvent( QCloseEvent* ce )
298{ 349{
299 350
300 351
301 352
302 if ( ! KOPrefs::instance()->mAskForQuit ) { 353 if ( ! KOPrefs::instance()->mAskForQuit ) {
303 saveOnClose(); 354 saveOnClose();
304 mClosed = true; 355 mClosed = true;
305 ce->accept(); 356 ce->accept();
306 return; 357 return;
307 358
308 } 359 }
309 360
310 switch( QMessageBox::information( this, "KO/Pi", 361 switch( QMessageBox::information( this, "KO/Pi",
311 i18n("Do you really want\nto close KO/Pi?"), 362 i18n("Do you really want\nto close KO/Pi?"),
312 i18n("Close"), i18n("No"), 363 i18n("Close"), i18n("No"),
313 0, 0 ) ) { 364 0, 0 ) ) {
314 case 0: 365 case 0:
315 saveOnClose(); 366 saveOnClose();
316 mClosed = true; 367 mClosed = true;
317 ce->accept(); 368 ce->accept();
318 break; 369 break;
319 case 1: 370 case 1:
320 ce->ignore(); 371 ce->ignore();
321 break; 372 break;
322 case 2: 373 case 2:
323 374
324 default: 375 default:
325 break; 376 break;
326 } 377 }
327 378
328 379
329} 380}
330 381
331void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 382void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
332{ 383{
333 QDataStream stream( data, IO_ReadOnly ); 384 QDataStream stream( data, IO_ReadOnly );
334 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 385 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
335 //QString datamess; 386 //QString datamess;
336 //qDebug("message "); 387 //qDebug("message ");
337 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 388 qDebug("KO: QCOP message received: %s ", cmsg.data() );
338 389
339 if ( cmsg == "setDocument(QString)" ) { 390 if ( cmsg == "setDocument(QString)" ) {
340 QDataStream stream( data, IO_ReadOnly ); 391 QDataStream stream( data, IO_ReadOnly );
341 QString fileName; 392 QString fileName;
342 stream >> fileName; 393 stream >> fileName;
343 //qDebug("filename %s ", fileName.latin1()); 394 //qDebug("filename %s ", fileName.latin1());
344 showMaximized(); 395 showMaximized();
345 raise(); 396 raise();
346 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 397 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
347 mSyncManager->slotSyncMenu( 1002 ); 398 mSyncManager->slotSyncMenu( 1002 );
348 return; 399 return;
349 } 400 }
350 401
351 if ( cmsg == "-writeFile" ) { 402 if ( cmsg == "-writeFile" ) {
352 // I made from the "-writeFile" an "-writeAlarm" 403 // I made from the "-writeFile" an "-writeAlarm"
353 mView->viewManager()->showWhatsNextView(); 404 mView->viewManager()->showWhatsNextView();
354 mCalendar->checkAlarmForIncidence( 0, true); 405 mCalendar->checkAlarmForIncidence( 0, true);
355 showMaximized(); 406 showMaximized();
356 raise(); 407 raise();
357 return; 408 return;
358 409
359 } 410 }
360 if ( cmsg == "-writeFileSilent" ) { 411 if ( cmsg == "-writeFileSilent" ) {
361 // I made from the "-writeFile" an "-writeAlarm" 412 // I made from the "-writeFile" an "-writeAlarm"
362 // mView->viewManager()->showWhatsNextView(); 413 // mView->viewManager()->showWhatsNextView();
363 mCalendar->checkAlarmForIncidence( 0, true); 414 mCalendar->checkAlarmForIncidence( 0, true);
364 //showMaximized(); 415 //showMaximized();
365 //raise(); 416 //raise();
366 hide(); 417 hide();
367 return; 418 return;
368 } 419 }
369 if ( cmsg == "-newCountdown" ) { 420 if ( cmsg == "-newCountdown" ) {
370 qDebug("newCountdown "); 421 qDebug("newCountdown ");
371 422
372 } 423 }
373 QString msg ; 424 QString msg ;
374 QString allmsg = cmsg; 425 QString allmsg = cmsg;
375 while ( allmsg.length() > 0 ) { 426 while ( allmsg.length() > 0 ) {
376 int nextC = allmsg.find( "-", 1 ); 427 int nextC = allmsg.find( "-", 1 );
377 if ( nextC == -1 ) { 428 if ( nextC == -1 ) {
378 msg = allmsg; 429 msg = allmsg;
379 allmsg = ""; 430 allmsg = "";
380 } else{ 431 } else{
381 msg = allmsg.left( nextC ); 432 msg = allmsg.left( nextC );
382 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 433 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
383 } 434 }
384 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 435 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
385 if ( msg == "-newEvent" ) { 436 if ( msg == "-newEvent" ) {
386 mView->newEvent(); 437 mView->newEvent();
387 } 438 }
388 if ( msg == "-newTodo" ) { 439 if ( msg == "-newTodo" ) {
389 mView->newTodo(); 440 mView->newTodo();
390 441
391 } 442 }
392 if ( msg == "-showWN" ) { 443 if ( msg == "-showWN" ) {
393 mView->viewManager()->showWhatsNextView(); 444 mView->viewManager()->showWhatsNextView();
394 } 445 }
395 if ( msg == "-showTodo" ) { 446 if ( msg == "-showTodo" ) {
396 mView->viewManager()->showTodoView(); 447 mView->viewManager()->showTodoView();
397 } 448 }
398 if ( msg == "-showList" ) { 449 if ( msg == "-showList" ) {
399 mView->viewManager()->showListView(); 450 mView->viewManager()->showListView();
400 } 451 }
401 else if ( msg == "-showDay" ) { 452 else if ( msg == "-showDay" ) {
402 mView->viewManager()->showDayView(); 453 mView->viewManager()->showDayView();
403 } 454 }
404 else if ( msg == "-showWWeek" ) { 455 else if ( msg == "-showWWeek" ) {
405 mView->viewManager()->showWorkWeekView(); 456 mView->viewManager()->showWorkWeekView();
406 } 457 }
407 else if ( msg == "-ringSync" ) { 458 else if ( msg == "-ringSync" ) {
408 mSyncManager->multiSync( false ); 459 mSyncManager->multiSync( false );
409 } 460 }
410 else if ( msg == "-showWeek" ) { 461 else if ( msg == "-showWeek" ) {
411 mView->viewManager()->showWeekView(); 462 mView->viewManager()->showWeekView();
412 } 463 }
413 else if ( msg == "-showTodo" ) { 464 else if ( msg == "-showTodo" ) {
414 mView->viewManager()->showTodoView(); 465 mView->viewManager()->showTodoView();
415 } 466 }
416 else if ( msg == "-showJournal" ) { 467 else if ( msg == "-showJournal" ) {
417 mView->dateNavigator()->selectDates( 1 ); 468 mView->dateNavigator()->selectDates( 1 );
418 mView->dateNavigator()->selectToday(); 469 mView->dateNavigator()->selectToday();
419 mView->viewManager()->showJournalView(); 470 mView->viewManager()->showJournalView();
420 } 471 }
421 else if ( msg == "-showKO" ) { 472 else if ( msg == "-showKO" ) {
422 mView->viewManager()->showNextXView(); 473 mView->viewManager()->showNextXView();
423 } 474 }
424 else if ( msg == "-showWNext" || msg == "nextView()" ) { 475 else if ( msg == "-showWNext" || msg == "nextView()" ) {
425 mView->viewManager()->showWhatsNextView(); 476 mView->viewManager()->showWhatsNextView();
426 } 477 }
427 else if ( msg == "-showNextXView" ) { 478 else if ( msg == "-showNextXView" ) {
428 mView->viewManager()->showNextXView(); 479 mView->viewManager()->showNextXView();
429 } 480 }
430 481
431 482
432 } 483 }
433 484
434 showMaximized(); 485 showMaximized();
435 raise(); 486 raise();
436} 487}
437 488
438QPixmap MainWindow::loadPixmap( QString name ) 489QPixmap MainWindow::loadPixmap( QString name )
439{ 490{
440 return SmallIcon( name ); 491 return SmallIcon( name );
441 492
442} 493}
443void MainWindow::initActions() 494void MainWindow::initActions()
444{ 495{
445 //KOPrefs::instance()->mShowFullMenu 496 //KOPrefs::instance()->mShowFullMenu
446 iconToolBar->clear(); 497 iconToolBar->clear();
447 KOPrefs *p = KOPrefs::instance(); 498 KOPrefs *p = KOPrefs::instance();
448 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 499 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
449 500
450 QPopupMenu *viewMenu = new QPopupMenu( this ); 501 QPopupMenu *viewMenu = new QPopupMenu( this );
451 QPopupMenu *actionMenu = new QPopupMenu( this ); 502 QPopupMenu *actionMenu = new QPopupMenu( this );
452 QPopupMenu *importMenu = new QPopupMenu( this ); 503 QPopupMenu *importMenu = new QPopupMenu( this );
453 selectFilterMenu = new QPopupMenu( this ); 504 selectFilterMenu = new QPopupMenu( this );
454 selectFilterMenu->setCheckable( true ); 505 selectFilterMenu->setCheckable( true );
455 syncMenu = new QPopupMenu( this ); 506 syncMenu = new QPopupMenu( this );
456 configureAgendaMenu = new QPopupMenu( this ); 507 configureAgendaMenu = new QPopupMenu( this );
457 configureToolBarMenu = new QPopupMenu( this ); 508 configureToolBarMenu = new QPopupMenu( this );
458 QPopupMenu *helpMenu = new QPopupMenu( this ); 509 QPopupMenu *helpMenu = new QPopupMenu( this );
459 if ( KOPrefs::instance()->mShowFullMenu ) { 510 if ( KOPrefs::instance()->mShowFullMenu ) {
460 QMenuBar *menuBar1; 511 QMenuBar *menuBar1;
461 menuBar1 = menuBar(); 512 menuBar1 = menuBar();
462 menuBar1->insertItem( i18n("File"), importMenu ); 513 menuBar1->insertItem( i18n("File"), importMenu );
463 menuBar1->insertItem( i18n("View"), viewMenu ); 514 menuBar1->insertItem( i18n("View"), viewMenu );
464 menuBar1->insertItem( i18n("Actions"), actionMenu ); 515 menuBar1->insertItem( i18n("Actions"), actionMenu );
465 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 516 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
466 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 517 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
467 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 518 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
468 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 519 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
469 menuBar1->insertItem( i18n("Help"), helpMenu ); 520 menuBar1->insertItem( i18n("Help"), helpMenu );
470 } else { 521 } else {
471 QPEMenuBar *menuBar1; 522 QPEMenuBar *menuBar1;
472 menuBar1 = new QPEMenuBar( iconToolBar ); 523 menuBar1 = new QPEMenuBar( iconToolBar );
473 QPopupMenu *menuBar = new QPopupMenu( this ); 524 QPopupMenu *menuBar = new QPopupMenu( this );
474 menuBar1->insertItem( i18n("ME"), menuBar); 525 menuBar1->insertItem( i18n("ME"), menuBar);
475 menuBar->insertItem( i18n("File"), importMenu ); 526 menuBar->insertItem( i18n("File"), importMenu );
476 menuBar->insertItem( i18n("View"), viewMenu ); 527 menuBar->insertItem( i18n("View"), viewMenu );
477 menuBar->insertItem( i18n("Actions"), actionMenu ); 528 menuBar->insertItem( i18n("Actions"), actionMenu );
@@ -562,384 +613,390 @@ void MainWindow::initActions()
562 icon = loadPixmap( pathString + "day" ); 613 icon = loadPixmap( pathString + "day" );
563 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 614 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
564 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 615 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
565 day1_action->addTo( viewMenu ); 616 day1_action->addTo( viewMenu );
566 // action->addTo( toolBar ); 617 // action->addTo( toolBar );
567 connect( day1_action, SIGNAL( activated() ), 618 connect( day1_action, SIGNAL( activated() ),
568 mView->viewManager(), SLOT( showDayView() ) ); 619 mView->viewManager(), SLOT( showDayView() ) );
569 620
570 icon = loadPixmap( pathString + "workweek" ); 621 icon = loadPixmap( pathString + "workweek" );
571 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 622 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
572 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 623 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
573 day5_action->addTo( viewMenu ); 624 day5_action->addTo( viewMenu );
574 connect( day5_action, SIGNAL( activated() ), 625 connect( day5_action, SIGNAL( activated() ),
575 mView->viewManager(), SLOT( showWorkWeekView() ) ); 626 mView->viewManager(), SLOT( showWorkWeekView() ) );
576 627
577 icon = loadPixmap( pathString + "week" ); 628 icon = loadPixmap( pathString + "week" );
578 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 629 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
579 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 630 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
580 day7_action->addTo( viewMenu ); 631 day7_action->addTo( viewMenu );
581 connect( day7_action, SIGNAL( activated() ), 632 connect( day7_action, SIGNAL( activated() ),
582 mView->viewManager(), SLOT( showWeekView() ) ); 633 mView->viewManager(), SLOT( showWeekView() ) );
583 634
584 icon = loadPixmap( pathString + "month" ); 635 icon = loadPixmap( pathString + "month" );
585 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 636 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
586 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 637 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
587 month_action->addTo( viewMenu ); 638 month_action->addTo( viewMenu );
588 connect( month_action, SIGNAL( activated() ), 639 connect( month_action, SIGNAL( activated() ),
589 mView->viewManager(), SLOT( showMonthView() ) ); 640 mView->viewManager(), SLOT( showMonthView() ) );
590 641
591 icon = loadPixmap( pathString + "todo" ); 642 icon = loadPixmap( pathString + "todo" );
592 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 643 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
593 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 644 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
594 todoview_action->addTo( viewMenu ); 645 todoview_action->addTo( viewMenu );
595 connect( todoview_action, SIGNAL( activated() ), 646 connect( todoview_action, SIGNAL( activated() ),
596 mView->viewManager(), SLOT( showTodoView() ) ); 647 mView->viewManager(), SLOT( showTodoView() ) );
597 648
598 icon = loadPixmap( pathString + "journal" ); 649 icon = loadPixmap( pathString + "journal" );
599 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 650 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
600 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 651 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
601 viewjournal_action->addTo( viewMenu ); 652 viewjournal_action->addTo( viewMenu );
602 connect( viewjournal_action, SIGNAL( activated() ), 653 connect( viewjournal_action, SIGNAL( activated() ),
603 mView->viewManager(), SLOT( showJournalView() ) ); 654 mView->viewManager(), SLOT( showJournalView() ) );
604 655
605 icon = loadPixmap( pathString + "xdays" ); 656 icon = loadPixmap( pathString + "xdays" );
606 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 657 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
607 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 658 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
608 xdays_action->addTo( viewMenu ); 659 xdays_action->addTo( viewMenu );
609 connect( xdays_action, SIGNAL( activated() ), 660 connect( xdays_action, SIGNAL( activated() ),
610 mView->viewManager(), SLOT( showNextXView() ) ); 661 mView->viewManager(), SLOT( showNextXView() ) );
611 662
612 icon = loadPixmap( pathString + "whatsnext" ); 663 icon = loadPixmap( pathString + "whatsnext" );
613 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 664 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
614 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 665 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
615 whatsnext_action->addTo( viewMenu ); 666 whatsnext_action->addTo( viewMenu );
616 connect( whatsnext_action, SIGNAL( activated() ), 667 connect( whatsnext_action, SIGNAL( activated() ),
617 mView->viewManager(), SLOT( showWhatsNextView() ) ); 668 mView->viewManager(), SLOT( showWhatsNextView() ) );
618 669
619#if 0 670#if 0
620 action = new QAction( "view_timespan", "Time Span", 0, this ); 671 action = new QAction( "view_timespan", "Time Span", 0, this );
621 action->addTo( viewMenu ); 672 action->addTo( viewMenu );
622 connect( action, SIGNAL( activated() ), 673 connect( action, SIGNAL( activated() ),
623 mView->viewManager(), SLOT( showTimeSpanView() ) ); 674 mView->viewManager(), SLOT( showTimeSpanView() ) );
624#endif 675#endif
625 676
626 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 677 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
627 this ); 678 this );
628 mNewSubTodoAction->addTo( actionMenu ); 679 mNewSubTodoAction->addTo( actionMenu );
629 connect( mNewSubTodoAction, SIGNAL( activated() ), 680 connect( mNewSubTodoAction, SIGNAL( activated() ),
630 mView, SLOT( newSubTodo() ) ); 681 mView, SLOT( newSubTodo() ) );
631 682
632 actionMenu->insertSeparator(); 683 actionMenu->insertSeparator();
633 684
634 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 685 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
635 mShowAction->addTo( actionMenu ); 686 mShowAction->addTo( actionMenu );
636 connect( mShowAction, SIGNAL( activated() ), 687 connect( mShowAction, SIGNAL( activated() ),
637 mView, SLOT( showIncidence() ) ); 688 mView, SLOT( showIncidence() ) );
638 689
639 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 690 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
640 mEditAction->addTo( actionMenu ); 691 mEditAction->addTo( actionMenu );
641 connect( mEditAction, SIGNAL( activated() ), 692 connect( mEditAction, SIGNAL( activated() ),
642 mView, SLOT( editIncidence() ) ); 693 mView, SLOT( editIncidence() ) );
643 694
644 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 695 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
645 mDeleteAction->addTo( actionMenu ); 696 mDeleteAction->addTo( actionMenu );
646 connect( mDeleteAction, SIGNAL( activated() ), 697 connect( mDeleteAction, SIGNAL( activated() ),
647 mView, SLOT( deleteIncidence() ) ); 698 mView, SLOT( deleteIncidence() ) );
648 699
649 700
650 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 701 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
651 mCloneAction->addTo( actionMenu ); 702 mCloneAction->addTo( actionMenu );
652 connect( mCloneAction, SIGNAL( activated() ), 703 connect( mCloneAction, SIGNAL( activated() ),
653 mView, SLOT( cloneIncidence() ) ); 704 mView, SLOT( cloneIncidence() ) );
654 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 705 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
655 mMoveAction->addTo( actionMenu ); 706 mMoveAction->addTo( actionMenu );
656 connect( mMoveAction, SIGNAL( activated() ), 707 connect( mMoveAction, SIGNAL( activated() ),
657 mView, SLOT( moveIncidence() ) ); 708 mView, SLOT( moveIncidence() ) );
658 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 709 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
659 mBeamAction->addTo( actionMenu ); 710 mBeamAction->addTo( actionMenu );
660 connect( mBeamAction, SIGNAL( activated() ), 711 connect( mBeamAction, SIGNAL( activated() ),
661 mView, SLOT( beamIncidence() ) ); 712 mView, SLOT( beamIncidence() ) );
662 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 713 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
663 mCancelAction->addTo( actionMenu ); 714 mCancelAction->addTo( actionMenu );
664 connect( mCancelAction, SIGNAL( activated() ), 715 connect( mCancelAction, SIGNAL( activated() ),
665 mView, SLOT( toggleCancelIncidence() ) ); 716 mView, SLOT( toggleCancelIncidence() ) );
666 717
667 actionMenu->insertSeparator(); 718 actionMenu->insertSeparator();
668 719
669 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 720 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
670 this ); 721 this );
671 action->addTo( actionMenu ); 722 action->addTo( actionMenu );
672 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 723 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
673 724
674 icon = loadPixmap( pathString + "search" ); 725 icon = loadPixmap( pathString + "search" );
675 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 726 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
676 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 727 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
677 search_action->addTo( actionMenu ); 728 search_action->addTo( actionMenu );
678 connect( search_action, SIGNAL( activated() ), 729 connect( search_action, SIGNAL( activated() ),
679 mView->dialogManager(), SLOT( showSearchDialog() ) ); 730 mView->dialogManager(), SLOT( showSearchDialog() ) );
680 731
681 icon = loadPixmap( pathString + "today" ); 732 icon = loadPixmap( pathString + "today" );
682 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 733 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
683 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 734 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
684 today_action->addTo( actionMenu ); 735 today_action->addTo( actionMenu );
685 connect( today_action, SIGNAL( activated() ), 736 connect( today_action, SIGNAL( activated() ),
686 mView, SLOT( goToday() ) ); 737 mView, SLOT( goToday() ) );
687 738
688 if ( KOPrefs::instance()->mShowFullMenu ) { 739 if ( KOPrefs::instance()->mShowFullMenu ) {
689 actionMenu->insertSeparator(); 740 actionMenu->insertSeparator();
690 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 741 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
691 742
692 } 743 }
693 // actionMenu->insertSeparator(); 744 // actionMenu->insertSeparator();
694 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 745 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
695 this ); 746 this );
696 action->addTo( importMenu ); 747 action->addTo( importMenu );
697 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 748 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
698 action = new QAction( "import_quick", i18n("Import last file"), 0, 749 action = new QAction( "import_quick", i18n("Import last file"), 0,
699 this ); 750 this );
700 action->addTo( importMenu ); 751 action->addTo( importMenu );
701 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 752 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
702 importMenu->insertSeparator(); 753 importMenu->insertSeparator();
703 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 754 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
704 this ); 755 this );
705 action->addTo( importMenu ); 756 action->addTo( importMenu );
706 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 757 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
707#ifndef DESKTOP_VERSION 758#ifndef DESKTOP_VERSION
708 importMenu->insertSeparator(); 759 importMenu->insertSeparator();
709 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 760 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
710 this ); 761 this );
711 action->addTo( importMenu ); 762 action->addTo( importMenu );
712 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 763 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
713#else 764#else
714#ifdef _WIN32_ 765#ifdef _WIN32_
715 importMenu->insertSeparator(); 766 importMenu->insertSeparator();
716 action = new QAction( "import_ol", i18n("Import from OL"), 0, 767 action = new QAction( "import_ol", i18n("Import from OL"), 0,
717 this ); 768 this );
718 action->addTo( importMenu ); 769 action->addTo( importMenu );
719 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 770 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
720#endif 771#endif
721#endif 772#endif
722 773
723 importMenu->insertSeparator(); 774 importMenu->insertSeparator();
724 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 775 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
725 this ); 776 this );
726 action->addTo( importMenu ); 777 action->addTo( importMenu );
727 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 778 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
728 779
729 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 780 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
730 this ); 781 this );
731 action->addTo( importMenu ); 782 action->addTo( importMenu );
732 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 783 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
733 784
734 importMenu->insertSeparator(); 785 importMenu->insertSeparator();
735 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 786 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
736 this ); 787 this );
737 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 788 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
738 789
739 790
740 //LR 791 //LR
741 QPopupMenu *ex2phone = new QPopupMenu( this ); 792 QPopupMenu *ex2phone = new QPopupMenu( this );
742 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 793 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
743 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 794 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
744 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 795 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
745 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 796 importMenu->insertItem( i18n("Export to phone"), ex2phone );
746 797
747 importMenu->insertSeparator(); 798 importMenu->insertSeparator();
748 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 799 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
749 this ); 800 this );
750 action->addTo( importMenu ); 801 action->addTo( importMenu );
751 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 802 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
752#ifndef DESKTOP_VERSION 803#ifndef DESKTOP_VERSION
753 importMenu->insertSeparator(); 804 importMenu->insertSeparator();
805 brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
806 this );
807 brAction->addTo( importMenu );
808 brAction->setToggleAction (true ) ;
809 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
810
754 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 811 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
755 this ); 812 this );
756 action->addTo( importMenu ); 813 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 814 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
758 815
759 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 816 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
760 this ); 817 this );
761 action->addTo( importMenu ); 818 action->addTo( importMenu );
762 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 819 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
763#else 820#else
764 importMenu->insertSeparator(); 821 importMenu->insertSeparator();
765 icon = loadPixmap( pathString + "print" ); 822 icon = loadPixmap( pathString + "print" );
766 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 823 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
767 action->addTo( importMenu ); 824 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), 825 connect( action, SIGNAL( activated() ),
769 this, SLOT( printCal() ) ); 826 this, SLOT( printCal() ) );
770 827
771 icon = loadPixmap( pathString + "print" ); 828 icon = loadPixmap( pathString + "print" );
772 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 829 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
773 action->addTo( importMenu ); 830 action->addTo( importMenu );
774 connect( action, SIGNAL( activated() ), 831 connect( action, SIGNAL( activated() ),
775 this, SLOT( printSel() ) ); 832 this, SLOT( printSel() ) );
776#endif 833#endif
777 importMenu->insertSeparator(); 834 importMenu->insertSeparator();
778 action = new QAction( "beam all", i18n("Save"), 0, 835 action = new QAction( "beam all", i18n("Save"), 0,
779 this ); 836 this );
780 action->addTo( importMenu ); 837 action->addTo( importMenu );
781 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 838 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
782 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 839 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
783 this ); 840 this );
784 action->addTo( importMenu ); 841 action->addTo( importMenu );
785 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 842 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
786 843
787 //menuBar->insertItem( "Configure",configureMenu ); 844 //menuBar->insertItem( "Configure",configureMenu );
788 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 845 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
789 icon = loadPixmap( "korganizer/korganizer" ); 846 icon = loadPixmap( "korganizer/korganizer" );
790 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 847 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
791 action->addTo( helpMenu ); 848 action->addTo( helpMenu );
792 connect( action, SIGNAL( activated() ), 849 connect( action, SIGNAL( activated() ),
793 SLOT( keyBindings() ) ); 850 SLOT( keyBindings() ) );
794 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 851 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
795 action->addTo( helpMenu ); 852 action->addTo( helpMenu );
796 connect( action, SIGNAL( activated() ), 853 connect( action, SIGNAL( activated() ),
797 SLOT( features() ) ); 854 SLOT( features() ) );
798 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 855 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
799 action->addTo( helpMenu ); 856 action->addTo( helpMenu );
800 connect( action, SIGNAL( activated() ), 857 connect( action, SIGNAL( activated() ),
801 SLOT( aboutAutoSaving() ) ); 858 SLOT( aboutAutoSaving() ) );
802 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 859 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
803 action->addTo( helpMenu ); 860 action->addTo( helpMenu );
804 connect( action, SIGNAL( activated() ), 861 connect( action, SIGNAL( activated() ),
805 SLOT( aboutKnownBugs() ) ); 862 SLOT( aboutKnownBugs() ) );
806 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 863 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
807 action->addTo( helpMenu ); 864 action->addTo( helpMenu );
808 connect( action, SIGNAL( activated() ), 865 connect( action, SIGNAL( activated() ),
809 SLOT( usertrans() ) ); 866 SLOT( usertrans() ) );
810 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 867 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
811 action->addTo( helpMenu ); 868 action->addTo( helpMenu );
812 connect( action, SIGNAL( activated() ), 869 connect( action, SIGNAL( activated() ),
813 SLOT( synchowto() ) ); 870 SLOT( synchowto() ) );
814 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 871 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
815 action->addTo( helpMenu ); 872 action->addTo( helpMenu );
816 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
817 SLOT( whatsNew() ) ); 874 SLOT( whatsNew() ) );
818 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 875 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
819 action->addTo( helpMenu ); 876 action->addTo( helpMenu );
820 connect( action, SIGNAL( activated() ), 877 connect( action, SIGNAL( activated() ),
821 SLOT( faq() ) ); 878 SLOT( faq() ) );
822 879
823 880
824 action = new QAction( "about", i18n("About..."), 0, this ); 881 action = new QAction( "about", i18n("About..."), 0, this );
825 action->addTo( helpMenu ); 882 action->addTo( helpMenu );
826 connect( action, SIGNAL( activated() ), 883 connect( action, SIGNAL( activated() ),
827 SLOT( about() ) ); 884 SLOT( about() ) );
828 action = new QAction( "licence", i18n("Licence..."), 0, this ); 885 action = new QAction( "licence", i18n("Licence..."), 0, this );
829 action->addTo( helpMenu ); 886 action->addTo( helpMenu );
830 connect( action, SIGNAL( activated() ), 887 connect( action, SIGNAL( activated() ),
831 SLOT( licence() ) ); 888 SLOT( licence() ) );
832 //menuBar->insertSeparator(); 889 //menuBar->insertSeparator();
833 890
834 // ****************************************************** 891 // ******************************************************
835 // menubar icons 892 // menubar icons
836 893
837 894
838 iconToolBar->setHorizontalStretchable (true ); 895 iconToolBar->setHorizontalStretchable (true );
839 //menuBar->insertItem( iconToolBar ); 896 //menuBar->insertItem( iconToolBar );
840 //xdays_action 897 //xdays_action
841 if (p-> mShowIconNewEvent) 898 if (p-> mShowIconNewEvent)
842 ne_action->addTo( iconToolBar ); 899 ne_action->addTo( iconToolBar );
843 if (p->mShowIconNewTodo ) 900 if (p->mShowIconNewTodo )
844 nt_action->addTo( iconToolBar ); 901 nt_action->addTo( iconToolBar );
845 if (p-> mShowIconSearch) 902 if (p-> mShowIconSearch)
846 search_action->addTo( iconToolBar ); 903 search_action->addTo( iconToolBar );
847 if (p-> mShowIconNext) 904 if (p-> mShowIconNext)
848 whatsnext_action->addTo( iconToolBar ); 905 whatsnext_action->addTo( iconToolBar );
849 if (p-> mShowIconNextDays) 906 if (p-> mShowIconNextDays)
850 xdays_action->addTo( iconToolBar ); 907 xdays_action->addTo( iconToolBar );
851 if (p-> mShowIconList) 908 if (p-> mShowIconList)
852 showlist_action->addTo( iconToolBar ); 909 showlist_action->addTo( iconToolBar );
853 if (p-> mShowIconDay1) 910 if (p-> mShowIconDay1)
854 day1_action->addTo( iconToolBar ); 911 day1_action->addTo( iconToolBar );
855 if (p-> mShowIconDay5) 912 if (p-> mShowIconDay5)
856 day5_action->addTo( iconToolBar ); 913 day5_action->addTo( iconToolBar );
857 if (p-> mShowIconDay7) 914 if (p-> mShowIconDay7)
858 day7_action->addTo( iconToolBar ); 915 day7_action->addTo( iconToolBar );
859 if (p-> mShowIconMonth) 916 if (p-> mShowIconMonth)
860 month_action->addTo( iconToolBar ); 917 month_action->addTo( iconToolBar );
861 if (p-> mShowIconTodoview) 918 if (p-> mShowIconTodoview)
862 todoview_action->addTo( iconToolBar ); 919 todoview_action->addTo( iconToolBar );
863 if (p-> mShowIconJournal) 920 if (p-> mShowIconJournal)
864 viewjournal_action->addTo( iconToolBar ); 921 viewjournal_action->addTo( iconToolBar );
865 icon = loadPixmap( pathString + "2leftarrowB" ); 922 icon = loadPixmap( pathString + "2leftarrowB" );
866 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 923 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
867 if (p-> mShowIconBackFast) { 924 if (p-> mShowIconBackFast) {
868 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 925 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
869 connect( action, SIGNAL( activated() ), 926 connect( action, SIGNAL( activated() ),
870 mView, SLOT( goPreviousMonth() ) ); 927 mView, SLOT( goPreviousMonth() ) );
871 action->addTo( iconToolBar ); 928 action->addTo( iconToolBar );
872 } 929 }
873 icon = loadPixmap( pathString + "1leftarrowB" ); 930 icon = loadPixmap( pathString + "1leftarrowB" );
874 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 931 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
875 if (p-> mShowIconBack) { 932 if (p-> mShowIconBack) {
876 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 933 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
877 connect( action, SIGNAL( activated() ), 934 connect( action, SIGNAL( activated() ),
878 mView, SLOT( goPrevious() ) ); 935 mView, SLOT( goPrevious() ) );
879 action->addTo( iconToolBar ); 936 action->addTo( iconToolBar );
880 } 937 }
881 if (p-> mShowIconToday) 938 if (p-> mShowIconToday)
882 today_action->addTo( iconToolBar ); 939 today_action->addTo( iconToolBar );
883 icon = loadPixmap( pathString + "1rightarrowB" ); 940 icon = loadPixmap( pathString + "1rightarrowB" );
884 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 941 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
885 if (p-> mShowIconForward) { 942 if (p-> mShowIconForward) {
886 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 943 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
887 connect( action, SIGNAL( activated() ), 944 connect( action, SIGNAL( activated() ),
888 mView, SLOT( goNext() ) ); 945 mView, SLOT( goNext() ) );
889 action->addTo( iconToolBar ); 946 action->addTo( iconToolBar );
890 } 947 }
891 icon = loadPixmap( pathString + "2rightarrowB" ); 948 icon = loadPixmap( pathString + "2rightarrowB" );
892 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 949 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
893 if (p-> mShowIconForwardFast) { 950 if (p-> mShowIconForwardFast) {
894 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 951 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
895 connect( action, SIGNAL( activated() ), 952 connect( action, SIGNAL( activated() ),
896 mView, SLOT( goNextMonth() ) ); 953 mView, SLOT( goNextMonth() ) );
897 action->addTo( iconToolBar ); 954 action->addTo( iconToolBar );
898 } 955 }
899 956
900 957
901 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 958 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
902 959
903 if (p-> mShowIconNewEvent) 960 if (p-> mShowIconNewEvent)
904 configureToolBarMenu->setItemChecked( 10, true ); 961 configureToolBarMenu->setItemChecked( 10, true );
905 if (p->mShowIconNewTodo ) 962 if (p->mShowIconNewTodo )
906 configureToolBarMenu->setItemChecked( 20, true ); 963 configureToolBarMenu->setItemChecked( 20, true );
907 if (p-> mShowIconSearch) 964 if (p-> mShowIconSearch)
908 configureToolBarMenu->setItemChecked( 120, true ); 965 configureToolBarMenu->setItemChecked( 120, true );
909 if (p-> mShowIconList) 966 if (p-> mShowIconList)
910 configureToolBarMenu->setItemChecked( 30, true ); 967 configureToolBarMenu->setItemChecked( 30, true );
911 if (p-> mShowIconDay1) 968 if (p-> mShowIconDay1)
912 configureToolBarMenu->setItemChecked( 40, true ); 969 configureToolBarMenu->setItemChecked( 40, true );
913 if (p-> mShowIconDay5) 970 if (p-> mShowIconDay5)
914 configureToolBarMenu->setItemChecked( 50, true ); 971 configureToolBarMenu->setItemChecked( 50, true );
915 if (p-> mShowIconDay7) 972 if (p-> mShowIconDay7)
916 configureToolBarMenu->setItemChecked( 60, true ); 973 configureToolBarMenu->setItemChecked( 60, true );
917 if (p-> mShowIconMonth) 974 if (p-> mShowIconMonth)
918 configureToolBarMenu->setItemChecked( 70, true ); 975 configureToolBarMenu->setItemChecked( 70, true );
919 if (p-> mShowIconTodoview) 976 if (p-> mShowIconTodoview)
920 configureToolBarMenu->setItemChecked( 80, true ); 977 configureToolBarMenu->setItemChecked( 80, true );
921 if (p-> mShowIconBackFast) 978 if (p-> mShowIconBackFast)
922 configureToolBarMenu->setItemChecked( 200, true ); 979 configureToolBarMenu->setItemChecked( 200, true );
923 if (p-> mShowIconBack) 980 if (p-> mShowIconBack)
924 configureToolBarMenu->setItemChecked( 210, true ); 981 configureToolBarMenu->setItemChecked( 210, true );
925 if (p-> mShowIconToday) 982 if (p-> mShowIconToday)
926 configureToolBarMenu->setItemChecked( 130, true ); 983 configureToolBarMenu->setItemChecked( 130, true );
927 if (p-> mShowIconForward) 984 if (p-> mShowIconForward)
928 configureToolBarMenu->setItemChecked( 220, true ); 985 configureToolBarMenu->setItemChecked( 220, true );
929 if (p-> mShowIconForwardFast) 986 if (p-> mShowIconForwardFast)
930 configureToolBarMenu->setItemChecked( 230, true ); 987 configureToolBarMenu->setItemChecked( 230, true );
931 if (p-> mShowIconNextDays) 988 if (p-> mShowIconNextDays)
932 configureToolBarMenu->setItemChecked( 100, true ); 989 configureToolBarMenu->setItemChecked( 100, true );
933 if (p-> mShowIconNext) 990 if (p-> mShowIconNext)
934 configureToolBarMenu->setItemChecked( 110, true ); 991 configureToolBarMenu->setItemChecked( 110, true );
935 if (p-> mShowIconJournal) 992 if (p-> mShowIconJournal)
936 configureToolBarMenu->setItemChecked( 90, true ); 993 configureToolBarMenu->setItemChecked( 90, true );
937 if (p-> mShowIconWhatsThis) 994 if (p-> mShowIconWhatsThis)
938 configureToolBarMenu->setItemChecked( 300, true ); 995 configureToolBarMenu->setItemChecked( 300, true );
939 996
940 QLabel* dummy = new QLabel( iconToolBar ); 997 QLabel* dummy = new QLabel( iconToolBar );
941 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 998 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
942 if (!p-> mShowIconStretch) 999 if (!p-> mShowIconStretch)
943 iconToolBar->setStretchableWidget ( dummy ) ; 1000 iconToolBar->setStretchableWidget ( dummy ) ;
944 else 1001 else
945 configureToolBarMenu->setItemChecked( 5, true ); 1002 configureToolBarMenu->setItemChecked( 5, true );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,128 +1,138 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h>
16#endif
15class QAction; 17class QAction;
16class CalendarView; 18class CalendarView;
17class KSyncProfile; 19class KSyncProfile;
18#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
19 21
20#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
21#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
22#endif 24#endif
23class QPEToolBar; 25class QPEToolBar;
24 26
25 27
26namespace KCal { 28namespace KCal {
27class CalendarLocal; 29class CalendarLocal;
28} 30}
29 31
30using namespace KCal; 32using namespace KCal;
31 33
32class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
33{ 35{
34 Q_OBJECT 36 Q_OBJECT
35 public: 37 public:
36 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
37 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled();
38 public slots: 41 public slots:
39 virtual void showMaximized (); 42 virtual void showMaximized ();
40 void configureAgenda( int ); 43 void configureAgenda( int );
41 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
42 static QString defaultFileName(); 45 static QString defaultFileName();
43 static QString syncFileName(); 46 static QString syncFileName();
44 static QString resourcePath(); 47 static QString resourcePath();
45 protected slots: 48 protected slots:
46 void setCaptionToDates(); 49 void setCaptionToDates();
47 void about(); 50 void about();
48 void licence(); 51 void licence();
49 void faq(); 52 void faq();
50 void usertrans(); 53 void usertrans();
51 void features(); 54 void features();
52 void synchowto(); 55 void synchowto();
53 void whatsNew(); 56 void whatsNew();
54 void keyBindings(); 57 void keyBindings();
55 void aboutAutoSaving();; 58 void aboutAutoSaving();;
56 void aboutKnownBugs(); 59 void aboutKnownBugs();
57 60
58 void processIncidenceSelection( Incidence * ); 61 void processIncidenceSelection( Incidence * );
59 62
60 void importQtopia(); 63 void importQtopia();
61 void importBday(); 64 void importBday();
62 void importOL(); 65 void importOL();
63 void importIcal(); 66 void importIcal();
64 void importFile( QString, bool ); 67 void importFile( QString, bool );
65 void quickImportIcal(); 68 void quickImportIcal();
66 69
67 void slotModifiedChanged( bool ); 70 void slotModifiedChanged( bool );
68 71
69 void save(); 72 void save();
70 void configureToolBar( int ); 73 void configureToolBar( int );
71 void printSel(); 74 void printSel();
72 void printCal(); 75 void printCal();
73 void saveCalendar(); 76 void saveCalendar();
74 void loadCalendar(); 77 void loadCalendar();
75 void exportVCalendar(); 78 void exportVCalendar();
76 void fillFilterMenu(); 79 void fillFilterMenu();
77 void selectFilter( int ); 80 void selectFilter( int );
78 void exportToPhone( int ); 81 void exportToPhone( int );
82 void toggleBeamReceive();
83 void disableBR(bool);
79 84
80 85
81 protected: 86 protected:
82 void displayText( QString, QString); 87 void displayText( QString, QString);
83 void displayFile( QString, QString); 88 void displayFile( QString, QString);
84 89
85 void enableIncidenceActions( bool ); 90 void enableIncidenceActions( bool );
86 91
87 private slots: 92 private slots:
88 QSocket* piSocket; 93 QSocket* piSocket;
89 QString piFileString; 94 QString piFileString;
90 QTime piTime; 95 QTime piTime;
91 void getFile( bool ); 96 void getFile( bool );
92 void syncFileRequest(); 97 void syncFileRequest();
93 private: 98 private:
99 bool mBRdisabled;
100#ifndef DESKTOP_VERSION
101 QCopChannel* infrared;
102#endif
103 QAction* brAction;
94 KSyncManager* mSyncManager; 104 KSyncManager* mSyncManager;
95 bool mClosed; 105 bool mClosed;
96 void saveOnClose(); 106 void saveOnClose();
97 bool mFlagKeyPressed; 107 bool mFlagKeyPressed;
98 bool mBlockAtStartup; 108 bool mBlockAtStartup;
99 QPEToolBar *iconToolBar; 109 QPEToolBar *iconToolBar;
100 void initActions(); 110 void initActions();
101 void setDefaultPreferences(); 111 void setDefaultPreferences();
102 void keyPressEvent ( QKeyEvent * ) ; 112 void keyPressEvent ( QKeyEvent * ) ;
103 void keyReleaseEvent ( QKeyEvent * ) ; 113 void keyReleaseEvent ( QKeyEvent * ) ;
104 QPopupMenu *configureToolBarMenu; 114 QPopupMenu *configureToolBarMenu;
105 QPopupMenu *selectFilterMenu; 115 QPopupMenu *selectFilterMenu;
106 QPopupMenu *configureAgendaMenu, *syncMenu; 116 QPopupMenu *configureAgendaMenu, *syncMenu;
107 CalendarLocal *mCalendar; 117 CalendarLocal *mCalendar;
108 CalendarView *mView; 118 CalendarView *mView;
109 QAction *mNewSubTodoAction; 119 QAction *mNewSubTodoAction;
110 120
111 QAction *mShowAction; 121 QAction *mShowAction;
112 QAction *mEditAction; 122 QAction *mEditAction;
113 QAction *mDeleteAction; 123 QAction *mDeleteAction;
114 QAction *mCloneAction; 124 QAction *mCloneAction;
115 QAction *mMoveAction; 125 QAction *mMoveAction;
116 QAction *mBeamAction; 126 QAction *mBeamAction;
117 QAction *mCancelAction; 127 QAction *mCancelAction;
118 128
119 void closeEvent( QCloseEvent* ce ); 129 void closeEvent( QCloseEvent* ce );
120 SimpleAlarmClient mAlarmClient; 130 SimpleAlarmClient mAlarmClient;
121 QTimer mSaveTimer; 131 QTimer mSaveTimer;
122 //bool mBlockSaveFlag; 132 //bool mBlockSaveFlag;
123 bool mCalendarModifiedFlag; 133 bool mCalendarModifiedFlag;
124 QPixmap loadPixmap( QString ); 134 QPixmap loadPixmap( QString );
125}; 135};
126 136
127 137
128#endif 138#endif