-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/incomingdialog.cpp | 3 | ||||
-rw-r--r-- | korganizer/korganizerE.pro | 4 | ||||
-rw-r--r-- | korganizer/publishdialog.cpp | 3 |
4 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 369c7a0..56b3fb0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1137,427 +1137,429 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | inL = el.next(); | 1139 | inL = el.next(); |
1140 | } | 1140 | } |
1141 | int delFut = 0; | 1141 | int delFut = 0; |
1142 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1142 | if ( KOPrefs::instance()->mWriteBackInFuture ) { |
1143 | er = remote->rawIncidences(); | 1143 | er = remote->rawIncidences(); |
1144 | inR = er.first(); | 1144 | inR = er.first(); |
1145 | QDateTime dt; | 1145 | QDateTime dt; |
1146 | QDateTime cur = QDateTime::currentDateTime(); | 1146 | QDateTime cur = QDateTime::currentDateTime(); |
1147 | QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); | 1147 | QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); |
1148 | while ( inR ) { | 1148 | while ( inR ) { |
1149 | if ( inR->type() == "Todo" ) { | 1149 | if ( inR->type() == "Todo" ) { |
1150 | Todo * t = (Todo*)inR; | 1150 | Todo * t = (Todo*)inR; |
1151 | if ( t->hasDueDate() ) | 1151 | if ( t->hasDueDate() ) |
1152 | dt = t->dtDue(); | 1152 | dt = t->dtDue(); |
1153 | else | 1153 | else |
1154 | dt = cur.addSecs( 62 ); | 1154 | dt = cur.addSecs( 62 ); |
1155 | } | 1155 | } |
1156 | else if (inR->type() == "Event" ) { | 1156 | else if (inR->type() == "Event" ) { |
1157 | bool ok; | 1157 | bool ok; |
1158 | dt = inR->getNextOccurence( cur, &ok ); | 1158 | dt = inR->getNextOccurence( cur, &ok ); |
1159 | if ( !ok ) | 1159 | if ( !ok ) |
1160 | dt = cur.addSecs( -62 ); | 1160 | dt = cur.addSecs( -62 ); |
1161 | } | 1161 | } |
1162 | else | 1162 | else |
1163 | dt = inR->dtStart(); | 1163 | dt = inR->dtStart(); |
1164 | if ( dt < cur || dt > end ) { | 1164 | if ( dt < cur || dt > end ) { |
1165 | remote->deleteIncidence( inR ); | 1165 | remote->deleteIncidence( inR ); |
1166 | ++delFut; | 1166 | ++delFut; |
1167 | } | 1167 | } |
1168 | inR = er.next(); | 1168 | inR = er.next(); |
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | bar.hide(); | 1171 | bar.hide(); |
1172 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1172 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1173 | eventLSync->setReadOnly( false ); | 1173 | eventLSync->setReadOnly( false ); |
1174 | eventLSync->setDtStart( mLastCalendarSync ); | 1174 | eventLSync->setDtStart( mLastCalendarSync ); |
1175 | eventRSync->setDtStart( mLastCalendarSync ); | 1175 | eventRSync->setDtStart( mLastCalendarSync ); |
1176 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1176 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1177 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1177 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1178 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1178 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1179 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1179 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1180 | eventLSync->setReadOnly( true ); | 1180 | eventLSync->setReadOnly( true ); |
1181 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1181 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1182 | remote->addEvent( eventRSync ); | 1182 | remote->addEvent( eventRSync ); |
1183 | QString mes; | 1183 | QString mes; |
1184 | 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 ); | 1184 | 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 ); |
1185 | QString delmess; | 1185 | QString delmess; |
1186 | if ( delFut ) { | 1186 | if ( delFut ) { |
1187 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); | 1187 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); |
1188 | mes += delmess; | 1188 | mes += delmess; |
1189 | } | 1189 | } |
1190 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1190 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1191 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1191 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1192 | } | 1192 | } |
1193 | qDebug( mes ); | 1193 | qDebug( mes ); |
1194 | mCalendar->checkAlarmForIncidence( 0, true ); | 1194 | mCalendar->checkAlarmForIncidence( 0, true ); |
1195 | return syncOK; | 1195 | return syncOK; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | void CalendarView::setSyncDevice( QString s ) | 1198 | void CalendarView::setSyncDevice( QString s ) |
1199 | { | 1199 | { |
1200 | mCurrentSyncDevice= s; | 1200 | mCurrentSyncDevice= s; |
1201 | } | 1201 | } |
1202 | void CalendarView::setSyncName( QString s ) | 1202 | void CalendarView::setSyncName( QString s ) |
1203 | { | 1203 | { |
1204 | mCurrentSyncName= s; | 1204 | mCurrentSyncName= s; |
1205 | } | 1205 | } |
1206 | bool CalendarView::syncCalendar(QString filename, int mode) | 1206 | bool CalendarView::syncCalendar(QString filename, int mode) |
1207 | { | 1207 | { |
1208 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1208 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1209 | CalendarLocal* calendar = new CalendarLocal(); | 1209 | CalendarLocal* calendar = new CalendarLocal(); |
1210 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1210 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1211 | FileStorage* storage = new FileStorage( calendar ); | 1211 | FileStorage* storage = new FileStorage( calendar ); |
1212 | bool syncOK = false; | 1212 | bool syncOK = false; |
1213 | storage->setFileName( filename ); | 1213 | storage->setFileName( filename ); |
1214 | // qDebug("loading ... "); | 1214 | // qDebug("loading ... "); |
1215 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1215 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1216 | getEventViewerDialog()->setSyncMode( true ); | 1216 | getEventViewerDialog()->setSyncMode( true ); |
1217 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1217 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1218 | getEventViewerDialog()->setSyncMode( false ); | 1218 | getEventViewerDialog()->setSyncMode( false ); |
1219 | if ( syncOK ) { | 1219 | if ( syncOK ) { |
1220 | if ( KOPrefs::instance()->mWriteBackFile ) | 1220 | if ( KOPrefs::instance()->mWriteBackFile ) |
1221 | { | 1221 | { |
1222 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1222 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1223 | storage->save(); | 1223 | storage->save(); |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | setModified( true ); | 1226 | setModified( true ); |
1227 | } | 1227 | } |
1228 | delete storage; | 1228 | delete storage; |
1229 | delete calendar; | 1229 | delete calendar; |
1230 | if ( syncOK ) | 1230 | if ( syncOK ) |
1231 | updateView(); | 1231 | updateView(); |
1232 | return syncOK; | 1232 | return syncOK; |
1233 | } | 1233 | } |
1234 | void CalendarView::syncPhone() | 1234 | void CalendarView::syncPhone() |
1235 | { | 1235 | { |
1236 | syncExternal( 1 ); | 1236 | syncExternal( 1 ); |
1237 | } | 1237 | } |
1238 | void CalendarView::syncExternal( int mode ) | 1238 | void CalendarView::syncExternal( int mode ) |
1239 | { | 1239 | { |
1240 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1240 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1241 | //mCurrentSyncDevice = "sharp-DTM"; | 1241 | //mCurrentSyncDevice = "sharp-DTM"; |
1242 | if ( KOPrefs::instance()->mAskForPreferences ) | 1242 | if ( KOPrefs::instance()->mAskForPreferences ) |
1243 | edit_sync_options(); | 1243 | edit_sync_options(); |
1244 | qApp->processEvents(); | 1244 | qApp->processEvents(); |
1245 | CalendarLocal* calendar = new CalendarLocal(); | 1245 | CalendarLocal* calendar = new CalendarLocal(); |
1246 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1246 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1247 | bool syncOK = false; | 1247 | bool syncOK = false; |
1248 | bool loadSuccess = false; | 1248 | bool loadSuccess = false; |
1249 | PhoneFormat* phoneFormat = 0; | 1249 | PhoneFormat* phoneFormat = 0; |
1250 | #ifndef DESKTOP_VERSION | 1250 | #ifndef DESKTOP_VERSION |
1251 | SharpFormat* sharpFormat = 0; | 1251 | SharpFormat* sharpFormat = 0; |
1252 | if ( mode == 0 ) { // sharp | 1252 | if ( mode == 0 ) { // sharp |
1253 | sharpFormat = new SharpFormat () ; | 1253 | sharpFormat = new SharpFormat () ; |
1254 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1254 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1255 | 1255 | ||
1256 | } else | 1256 | } else |
1257 | #endif | 1257 | #endif |
1258 | if ( mode == 1 ) { // phone | 1258 | if ( mode == 1 ) { // phone |
1259 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1259 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1260 | KOPrefs::instance()->mPhoneDevice, | 1260 | KOPrefs::instance()->mPhoneDevice, |
1261 | KOPrefs::instance()->mPhoneConnection, | 1261 | KOPrefs::instance()->mPhoneConnection, |
1262 | KOPrefs::instance()->mPhoneModel); | 1262 | KOPrefs::instance()->mPhoneModel); |
1263 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1263 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1264 | 1264 | ||
1265 | } else | 1265 | } else |
1266 | return; | 1266 | return; |
1267 | if ( loadSuccess ) { | 1267 | if ( loadSuccess ) { |
1268 | getEventViewerDialog()->setSyncMode( true ); | 1268 | getEventViewerDialog()->setSyncMode( true ); |
1269 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1269 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1270 | getEventViewerDialog()->setSyncMode( false ); | 1270 | getEventViewerDialog()->setSyncMode( false ); |
1271 | qApp->processEvents(); | 1271 | qApp->processEvents(); |
1272 | if ( syncOK ) { | 1272 | if ( syncOK ) { |
1273 | if ( KOPrefs::instance()->mWriteBackFile ) | 1273 | if ( KOPrefs::instance()->mWriteBackFile ) |
1274 | { | 1274 | { |
1275 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1275 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1276 | Incidence* inc = iL.first(); | 1276 | Incidence* inc = iL.first(); |
1277 | if ( phoneFormat ) { | 1277 | if ( phoneFormat ) { |
1278 | while ( inc ) { | 1278 | while ( inc ) { |
1279 | inc->removeID(mCurrentSyncDevice); | 1279 | inc->removeID(mCurrentSyncDevice); |
1280 | inc = iL.next(); | 1280 | inc = iL.next(); |
1281 | } | 1281 | } |
1282 | } | 1282 | } |
1283 | #ifndef DESKTOP_VERSION | 1283 | #ifndef DESKTOP_VERSION |
1284 | if ( sharpFormat ) | 1284 | if ( sharpFormat ) |
1285 | sharpFormat->save(calendar); | 1285 | sharpFormat->save(calendar); |
1286 | #endif | 1286 | #endif |
1287 | if ( phoneFormat ) | 1287 | if ( phoneFormat ) |
1288 | phoneFormat->save(calendar); | 1288 | phoneFormat->save(calendar); |
1289 | iL = calendar->rawIncidences(); | 1289 | iL = calendar->rawIncidences(); |
1290 | inc = iL.first(); | 1290 | inc = iL.first(); |
1291 | Incidence* loc; | 1291 | Incidence* loc; |
1292 | while ( inc ) { | 1292 | while ( inc ) { |
1293 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1293 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1294 | loc = mCalendar->incidence(inc->uid() ); | 1294 | loc = mCalendar->incidence(inc->uid() ); |
1295 | if ( loc ) { | 1295 | if ( loc ) { |
1296 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1296 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1297 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1297 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1298 | } | 1298 | } |
1299 | } | 1299 | } |
1300 | inc = iL.next(); | 1300 | inc = iL.next(); |
1301 | } | 1301 | } |
1302 | Incidence* lse = getLastSyncEvent(); | 1302 | Incidence* lse = getLastSyncEvent(); |
1303 | if ( lse ) { | 1303 | if ( lse ) { |
1304 | lse->setReadOnly( false ); | 1304 | lse->setReadOnly( false ); |
1305 | lse->setDescription( "" ); | 1305 | lse->setDescription( "" ); |
1306 | lse->setReadOnly( true ); | 1306 | lse->setReadOnly( true ); |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | setModified( true ); | 1310 | setModified( true ); |
1311 | } else { | 1311 | } else { |
1312 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1312 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1313 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1313 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1314 | question, i18n("Ok")) ; | 1314 | question, i18n("Ok")) ; |
1315 | 1315 | ||
1316 | } | 1316 | } |
1317 | delete calendar; | 1317 | delete calendar; |
1318 | updateView(); | 1318 | updateView(); |
1319 | return ;//syncOK; | 1319 | return ;//syncOK; |
1320 | 1320 | ||
1321 | } | 1321 | } |
1322 | void CalendarView::syncSharp() | 1322 | void CalendarView::syncSharp() |
1323 | { | 1323 | { |
1324 | syncExternal( 0 ); | 1324 | syncExternal( 0 ); |
1325 | 1325 | ||
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | 1328 | ||
1329 | #include <kabc/stdaddressbook.h> | 1329 | //#include <kabc/stdaddressbook.h> |
1330 | bool CalendarView::importBday() | 1330 | bool CalendarView::importBday() |
1331 | { | 1331 | { |
1332 | #if 0 | ||
1332 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1333 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1333 | KABC::AddressBook::Iterator it; | 1334 | KABC::AddressBook::Iterator it; |
1334 | int count = 0; | 1335 | int count = 0; |
1335 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1336 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1336 | ++count; | 1337 | ++count; |
1337 | } | 1338 | } |
1338 | QProgressBar bar(count,0 ); | 1339 | QProgressBar bar(count,0 ); |
1339 | int w = 300; | 1340 | int w = 300; |
1340 | if ( QApplication::desktop()->width() < 320 ) | 1341 | if ( QApplication::desktop()->width() < 320 ) |
1341 | w = 220; | 1342 | w = 220; |
1342 | int h = bar.sizeHint().height() ; | 1343 | int h = bar.sizeHint().height() ; |
1343 | int dw = QApplication::desktop()->width(); | 1344 | int dw = QApplication::desktop()->width(); |
1344 | int dh = QApplication::desktop()->height(); | 1345 | int dh = QApplication::desktop()->height(); |
1345 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1346 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1346 | bar.show(); | 1347 | bar.show(); |
1347 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1348 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1348 | qApp->processEvents(); | 1349 | qApp->processEvents(); |
1349 | count = 0; | 1350 | count = 0; |
1350 | int addCount = 0; | 1351 | int addCount = 0; |
1351 | KCal::Attendee* a = 0; | 1352 | KCal::Attendee* a = 0; |
1352 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1353 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1353 | if ( ! bar.isVisible() ) | 1354 | if ( ! bar.isVisible() ) |
1354 | return false; | 1355 | return false; |
1355 | bar.setProgress( count++ ); | 1356 | bar.setProgress( count++ ); |
1356 | qApp->processEvents(); | 1357 | qApp->processEvents(); |
1357 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1358 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1358 | if ( (*it).birthday().date().isValid() ){ | 1359 | if ( (*it).birthday().date().isValid() ){ |
1359 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1360 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1360 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1361 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1361 | ++addCount; | 1362 | ++addCount; |
1362 | } | 1363 | } |
1363 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1364 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1364 | if ( anni.isValid() ){ | 1365 | if ( anni.isValid() ){ |
1365 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1366 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1366 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1367 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1367 | ++addCount; | 1368 | ++addCount; |
1368 | } | 1369 | } |
1369 | } | 1370 | } |
1370 | updateView(); | 1371 | updateView(); |
1371 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1372 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1373 | #endif | ||
1372 | return true; | 1374 | return true; |
1373 | } | 1375 | } |
1374 | 1376 | ||
1375 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1377 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1376 | { | 1378 | { |
1377 | //qDebug("addAnni "); | 1379 | //qDebug("addAnni "); |
1378 | Event * ev = new Event(); | 1380 | Event * ev = new Event(); |
1379 | if ( a ) { | 1381 | if ( a ) { |
1380 | ev->addAttendee( a ); | 1382 | ev->addAttendee( a ); |
1381 | } | 1383 | } |
1382 | QString kind; | 1384 | QString kind; |
1383 | if ( birthday ) | 1385 | if ( birthday ) |
1384 | kind = i18n( "Birthday" ); | 1386 | kind = i18n( "Birthday" ); |
1385 | else | 1387 | else |
1386 | kind = i18n( "Anniversary" ); | 1388 | kind = i18n( "Anniversary" ); |
1387 | ev->setSummary( name + " - " + kind ); | 1389 | ev->setSummary( name + " - " + kind ); |
1388 | ev->setOrganizer( "nobody@nowhere" ); | 1390 | ev->setOrganizer( "nobody@nowhere" ); |
1389 | ev->setCategories( kind ); | 1391 | ev->setCategories( kind ); |
1390 | ev->setDtStart( QDateTime(date) ); | 1392 | ev->setDtStart( QDateTime(date) ); |
1391 | ev->setDtEnd( QDateTime(date) ); | 1393 | ev->setDtEnd( QDateTime(date) ); |
1392 | ev->setFloats( true ); | 1394 | ev->setFloats( true ); |
1393 | Recurrence * rec = ev->recurrence(); | 1395 | Recurrence * rec = ev->recurrence(); |
1394 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1396 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1395 | rec->addYearlyNum( date.month() ); | 1397 | rec->addYearlyNum( date.month() ); |
1396 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1398 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1397 | delete ev; | 1399 | delete ev; |
1398 | return false; | 1400 | return false; |
1399 | } | 1401 | } |
1400 | return true; | 1402 | return true; |
1401 | 1403 | ||
1402 | } | 1404 | } |
1403 | bool CalendarView::importQtopia( const QString &categories, | 1405 | bool CalendarView::importQtopia( const QString &categories, |
1404 | const QString &datebook, | 1406 | const QString &datebook, |
1405 | const QString &todolist ) | 1407 | const QString &todolist ) |
1406 | { | 1408 | { |
1407 | 1409 | ||
1408 | QtopiaFormat qtopiaFormat; | 1410 | QtopiaFormat qtopiaFormat; |
1409 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1411 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1410 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1412 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1411 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1413 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1412 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1414 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1413 | 1415 | ||
1414 | updateView(); | 1416 | updateView(); |
1415 | return true; | 1417 | return true; |
1416 | 1418 | ||
1417 | #if 0 | 1419 | #if 0 |
1418 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1420 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1419 | mCurrentSyncDevice = "qtopia-XML"; | 1421 | mCurrentSyncDevice = "qtopia-XML"; |
1420 | if ( KOPrefs::instance()->mAskForPreferences ) | 1422 | if ( KOPrefs::instance()->mAskForPreferences ) |
1421 | edit_sync_options(); | 1423 | edit_sync_options(); |
1422 | qApp->processEvents(); | 1424 | qApp->processEvents(); |
1423 | CalendarLocal* calendar = new CalendarLocal(); | 1425 | CalendarLocal* calendar = new CalendarLocal(); |
1424 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1426 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1425 | bool syncOK = false; | 1427 | bool syncOK = false; |
1426 | QtopiaFormat qtopiaFormat; | 1428 | QtopiaFormat qtopiaFormat; |
1427 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1429 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1428 | bool loadOk = true; | 1430 | bool loadOk = true; |
1429 | if ( !categories.isEmpty() ) | 1431 | if ( !categories.isEmpty() ) |
1430 | loadOk = qtopiaFormat.load( calendar, categories ); | 1432 | loadOk = qtopiaFormat.load( calendar, categories ); |
1431 | if ( loadOk && !datebook.isEmpty() ) | 1433 | if ( loadOk && !datebook.isEmpty() ) |
1432 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1434 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1433 | if ( loadOk && !todolist.isEmpty() ) | 1435 | if ( loadOk && !todolist.isEmpty() ) |
1434 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1436 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1435 | 1437 | ||
1436 | if ( loadOk ) { | 1438 | if ( loadOk ) { |
1437 | getEventViewerDialog()->setSyncMode( true ); | 1439 | getEventViewerDialog()->setSyncMode( true ); |
1438 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1440 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1439 | getEventViewerDialog()->setSyncMode( false ); | 1441 | getEventViewerDialog()->setSyncMode( false ); |
1440 | qApp->processEvents(); | 1442 | qApp->processEvents(); |
1441 | if ( syncOK ) { | 1443 | if ( syncOK ) { |
1442 | if ( KOPrefs::instance()->mWriteBackFile ) | 1444 | if ( KOPrefs::instance()->mWriteBackFile ) |
1443 | { | 1445 | { |
1444 | // write back XML file | 1446 | // write back XML file |
1445 | 1447 | ||
1446 | } | 1448 | } |
1447 | setModified( true ); | 1449 | setModified( true ); |
1448 | } | 1450 | } |
1449 | } else { | 1451 | } else { |
1450 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1452 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1451 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1453 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1452 | question, i18n("Ok")) ; | 1454 | question, i18n("Ok")) ; |
1453 | } | 1455 | } |
1454 | delete calendar; | 1456 | delete calendar; |
1455 | updateView(); | 1457 | updateView(); |
1456 | return syncOK; | 1458 | return syncOK; |
1457 | 1459 | ||
1458 | 1460 | ||
1459 | #endif | 1461 | #endif |
1460 | 1462 | ||
1461 | } | 1463 | } |
1462 | 1464 | ||
1463 | void CalendarView::setSyncEventsReadOnly() | 1465 | void CalendarView::setSyncEventsReadOnly() |
1464 | { | 1466 | { |
1465 | Event * ev; | 1467 | Event * ev; |
1466 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1468 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1467 | ev = eL.first(); | 1469 | ev = eL.first(); |
1468 | while ( ev ) { | 1470 | while ( ev ) { |
1469 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1471 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1470 | ev->setReadOnly( true ); | 1472 | ev->setReadOnly( true ); |
1471 | ev = eL.next(); | 1473 | ev = eL.next(); |
1472 | } | 1474 | } |
1473 | } | 1475 | } |
1474 | bool CalendarView::openCalendar(QString filename, bool merge) | 1476 | bool CalendarView::openCalendar(QString filename, bool merge) |
1475 | { | 1477 | { |
1476 | 1478 | ||
1477 | if (filename.isEmpty()) { | 1479 | if (filename.isEmpty()) { |
1478 | return false; | 1480 | return false; |
1479 | } | 1481 | } |
1480 | 1482 | ||
1481 | if (!QFile::exists(filename)) { | 1483 | if (!QFile::exists(filename)) { |
1482 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1484 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1483 | return false; | 1485 | return false; |
1484 | } | 1486 | } |
1485 | 1487 | ||
1486 | globalFlagBlockAgenda = 1; | 1488 | globalFlagBlockAgenda = 1; |
1487 | if (!merge) mCalendar->close(); | 1489 | if (!merge) mCalendar->close(); |
1488 | 1490 | ||
1489 | mStorage->setFileName( filename ); | 1491 | mStorage->setFileName( filename ); |
1490 | 1492 | ||
1491 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1493 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1492 | if ( merge ) ;//setModified( true ); | 1494 | if ( merge ) ;//setModified( true ); |
1493 | else { | 1495 | else { |
1494 | //setModified( true ); | 1496 | //setModified( true ); |
1495 | mViewManager->setDocumentId( filename ); | 1497 | mViewManager->setDocumentId( filename ); |
1496 | mDialogManager->setDocumentId( filename ); | 1498 | mDialogManager->setDocumentId( filename ); |
1497 | mTodoList->setDocumentId( filename ); | 1499 | mTodoList->setDocumentId( filename ); |
1498 | } | 1500 | } |
1499 | globalFlagBlockAgenda = 2; | 1501 | globalFlagBlockAgenda = 2; |
1500 | // if ( getLastSyncEvent() ) | 1502 | // if ( getLastSyncEvent() ) |
1501 | // getLastSyncEvent()->setReadOnly( true ); | 1503 | // getLastSyncEvent()->setReadOnly( true ); |
1502 | mCalendar->reInitAlarmSettings(); | 1504 | mCalendar->reInitAlarmSettings(); |
1503 | setSyncEventsReadOnly(); | 1505 | setSyncEventsReadOnly(); |
1504 | updateUnmanagedViews(); | 1506 | updateUnmanagedViews(); |
1505 | updateView(); | 1507 | updateView(); |
1506 | if ( filename != MainWindow::defaultFileName() ) | 1508 | if ( filename != MainWindow::defaultFileName() ) |
1507 | saveCalendar( MainWindow::defaultFileName() ); | 1509 | saveCalendar( MainWindow::defaultFileName() ); |
1508 | loadedFileVersion = QDateTime::currentDateTime(); | 1510 | loadedFileVersion = QDateTime::currentDateTime(); |
1509 | return true; | 1511 | return true; |
1510 | } else { | 1512 | } else { |
1511 | // while failing to load, the calendar object could | 1513 | // while failing to load, the calendar object could |
1512 | // have become partially populated. Clear it out. | 1514 | // have become partially populated. Clear it out. |
1513 | if ( !merge ) mCalendar->close(); | 1515 | if ( !merge ) mCalendar->close(); |
1514 | 1516 | ||
1515 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1517 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1516 | 1518 | ||
1517 | globalFlagBlockAgenda = 2; | 1519 | globalFlagBlockAgenda = 2; |
1518 | updateView(); | 1520 | updateView(); |
1519 | } | 1521 | } |
1520 | return false; | 1522 | return false; |
1521 | } | 1523 | } |
1522 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1524 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1523 | { | 1525 | { |
1524 | loadedFileVersion = dt; | 1526 | loadedFileVersion = dt; |
1525 | } | 1527 | } |
1526 | bool CalendarView::checkFileChanged(QString fn) | 1528 | bool CalendarView::checkFileChanged(QString fn) |
1527 | { | 1529 | { |
1528 | QFileInfo finf ( fn ); | 1530 | QFileInfo finf ( fn ); |
1529 | if ( !finf.exists() ) | 1531 | if ( !finf.exists() ) |
1530 | return true; | 1532 | return true; |
1531 | QDateTime dt = finf.lastModified (); | 1533 | QDateTime dt = finf.lastModified (); |
1532 | if ( dt <= loadedFileVersion ) | 1534 | if ( dt <= loadedFileVersion ) |
1533 | return false; | 1535 | return false; |
1534 | return true; | 1536 | return true; |
1535 | 1537 | ||
1536 | } | 1538 | } |
1537 | bool CalendarView::checkFileVersion(QString fn) | 1539 | bool CalendarView::checkFileVersion(QString fn) |
1538 | { | 1540 | { |
1539 | QFileInfo finf ( fn ); | 1541 | QFileInfo finf ( fn ); |
1540 | if ( !finf.exists() ) | 1542 | if ( !finf.exists() ) |
1541 | return true; | 1543 | return true; |
1542 | QDateTime dt = finf.lastModified (); | 1544 | QDateTime dt = finf.lastModified (); |
1543 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1545 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1544 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1546 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1545 | if ( dt <= loadedFileVersion ) | 1547 | if ( dt <= loadedFileVersion ) |
1546 | return true; | 1548 | return true; |
1547 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1549 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , |
1548 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1550 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1549 | i18n("Sync+save")); | 1551 | i18n("Sync+save")); |
1550 | 1552 | ||
1551 | if ( km == KMessageBox::Cancel ) | 1553 | if ( km == KMessageBox::Cancel ) |
1552 | return false; | 1554 | return false; |
1553 | if ( km == KMessageBox::Yes ) | 1555 | if ( km == KMessageBox::Yes ) |
1554 | return true; | 1556 | return true; |
1555 | 1557 | ||
1556 | setSyncDevice("deleteaftersync" ); | 1558 | setSyncDevice("deleteaftersync" ); |
1557 | KOPrefs::instance()->mAskForPreferences = true; | 1559 | KOPrefs::instance()->mAskForPreferences = true; |
1558 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1560 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1559 | KOPrefs::instance()->mWriteBackFile = false; | 1561 | KOPrefs::instance()->mWriteBackFile = false; |
1560 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1562 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1561 | KOPrefs::instance()->mShowSyncSummary = false; | 1563 | KOPrefs::instance()->mShowSyncSummary = false; |
1562 | syncCalendar( fn, 3 ); | 1564 | syncCalendar( fn, 3 ); |
1563 | Event * e = getLastSyncEvent(); | 1565 | Event * e = getLastSyncEvent(); |
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index f3bd09f..50e3077 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp | |||
@@ -1,245 +1,246 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlistview.h> | 20 | #include <qlistview.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qdir.h> | 22 | #include <qdir.h> |
23 | #include <qmap.h> | 23 | #include <qmap.h> |
24 | 24 | ||
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | #include <klocale.h> | 26 | #include <klocale.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <kstandarddirs.h> | 28 | #include <kstandarddirs.h> |
29 | #include <kmessagebox.h> | 29 | #include <kmessagebox.h> |
30 | 30 | ||
31 | #include <libkcal/incidence.h> | 31 | #include <libkcal/incidence.h> |
32 | #include <libkcal/event.h> | 32 | #include <libkcal/event.h> |
33 | #include <libkcal/calendar.h> | 33 | #include <libkcal/calendar.h> |
34 | #include <libkcal/freebusy.h> | 34 | #include <libkcal/freebusy.h> |
35 | #include <libkcal/attendee.h> | 35 | #include <libkcal/attendee.h> |
36 | #include <libkcal/calendarresources.h> | 36 | #include <libkcal/calendarresources.h> |
37 | #include <libkcal/resourcecalendar.h> | 37 | #include <libkcal/resourcecalendar.h> |
38 | #include <kresources/resourceselectdialog.h> | 38 | #include <kresources/resourceselectdialog.h> |
39 | 39 | ||
40 | #ifndef KORG_NOMAIL | 40 | #ifndef KORG_NOMAIL |
41 | #include "mailscheduler.h" | 41 | #include "mailscheduler.h" |
42 | #else | 42 | #else |
43 | #include <libkcal/dummyscheduler.h> | 43 | #include <libkcal/dummyscheduler.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | #include "incomingdialog.h" | 47 | #include "incomingdialog.h" |
48 | #include "koeventviewerdialog.h" | 48 | #include "koeventviewerdialog.h" |
49 | #include "kocounterdialog.h" | 49 | #include "kocounterdialog.h" |
50 | #include "koprefs.h" | 50 | #include "koprefs.h" |
51 | 51 | ||
52 | #ifndef KORG_NOKABC | 52 | #ifndef KORG_NOKABC |
53 | #include <kabc/stdaddressbook.h> | 53 | #define KORG_NOKABC |
54 | //#include <kabc/stdaddressbook.h> | ||
54 | #define size count | 55 | #define size count |
55 | #endif | 56 | #endif |
56 | 57 | ||
57 | 58 | ||
58 | ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, | 59 | ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, |
59 | Scheduler::Method method,ScheduleMessage::Status status) | 60 | Scheduler::Method method,ScheduleMessage::Status status) |
60 | : QListViewItem(parent) | 61 | : QListViewItem(parent) |
61 | { | 62 | { |
62 | mIncidence = ev; | 63 | mIncidence = ev; |
63 | mMethod = method; | 64 | mMethod = method; |
64 | mStatus = status; | 65 | mStatus = status; |
65 | setText(6,Scheduler::translatedMethodName(mMethod)+" "); | 66 | setText(6,Scheduler::translatedMethodName(mMethod)+" "); |
66 | setText(7,ScheduleMessage::statusName(status)); | 67 | setText(7,ScheduleMessage::statusName(status)); |
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | /* Visitor */ | 71 | /* Visitor */ |
71 | ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item) | 72 | ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item) |
72 | { | 73 | { |
73 | mItem = item; | 74 | mItem = item; |
74 | } | 75 | } |
75 | 76 | ||
76 | ScheduleItemVisitor::~ScheduleItemVisitor() | 77 | ScheduleItemVisitor::~ScheduleItemVisitor() |
77 | { | 78 | { |
78 | } | 79 | } |
79 | 80 | ||
80 | bool ScheduleItemVisitor::visit(Event *e) | 81 | bool ScheduleItemVisitor::visit(Event *e) |
81 | { | 82 | { |
82 | mItem->setText(0,e->summary()); | 83 | mItem->setText(0,e->summary()); |
83 | mItem->setText(1,e->dtStartDateStr()); | 84 | mItem->setText(1,e->dtStartDateStr()); |
84 | if (e->doesFloat()) { | 85 | if (e->doesFloat()) { |
85 | mItem->setText(2,i18n("no time ")); | 86 | mItem->setText(2,i18n("no time ")); |
86 | mItem->setText(4,i18n("no time ")); | 87 | mItem->setText(4,i18n("no time ")); |
87 | } | 88 | } |
88 | else { | 89 | else { |
89 | mItem->setText(2,e->dtStartTimeStr()); | 90 | mItem->setText(2,e->dtStartTimeStr()); |
90 | mItem->setText(4,e->dtEndTimeStr()); | 91 | mItem->setText(4,e->dtEndTimeStr()); |
91 | } | 92 | } |
92 | if (e->hasEndDate()) { | 93 | if (e->hasEndDate()) { |
93 | mItem->setText(3,e->dtEndDateStr()); | 94 | mItem->setText(3,e->dtEndDateStr()); |
94 | } | 95 | } |
95 | else { | 96 | else { |
96 | mItem->setText(3,""); | 97 | mItem->setText(3,""); |
97 | } | 98 | } |
98 | mItem->setText(5,e->organizer()+" "); | 99 | mItem->setText(5,e->organizer()+" "); |
99 | 100 | ||
100 | return true; | 101 | return true; |
101 | } | 102 | } |
102 | 103 | ||
103 | bool ScheduleItemVisitor::visit(Todo *e) | 104 | bool ScheduleItemVisitor::visit(Todo *e) |
104 | { | 105 | { |
105 | mItem->setText(0,e->summary()); | 106 | mItem->setText(0,e->summary()); |
106 | if (e->hasStartDate()) { | 107 | if (e->hasStartDate()) { |
107 | mItem->setText(1,e->dtStartDateStr()); | 108 | mItem->setText(1,e->dtStartDateStr()); |
108 | if (!e->doesFloat()) { | 109 | if (!e->doesFloat()) { |
109 | mItem->setText(2,e->dtStartTimeStr()); | 110 | mItem->setText(2,e->dtStartTimeStr()); |
110 | } | 111 | } |
111 | } | 112 | } |
112 | if (e->hasDueDate()) { | 113 | if (e->hasDueDate()) { |
113 | mItem->setText(1,e->dtDueDateStr()); | 114 | mItem->setText(1,e->dtDueDateStr()); |
114 | if (!e->doesFloat()) { | 115 | if (!e->doesFloat()) { |
115 | mItem->setText(2,e->dtDueTimeStr()); | 116 | mItem->setText(2,e->dtDueTimeStr()); |
116 | } | 117 | } |
117 | } | 118 | } |
118 | mItem->setText(5,e->organizer()+" "); | 119 | mItem->setText(5,e->organizer()+" "); |
119 | 120 | ||
120 | return true; | 121 | return true; |
121 | } | 122 | } |
122 | 123 | ||
123 | bool ScheduleItemVisitor::visit(Journal *) | 124 | bool ScheduleItemVisitor::visit(Journal *) |
124 | { | 125 | { |
125 | return false; | 126 | return false; |
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | /* | 130 | /* |
130 | * Constructs a IncomingDialog which is a child of 'parent', with the | 131 | * Constructs a IncomingDialog which is a child of 'parent', with the |
131 | * name 'name' and widget flags set to 'f' | 132 | * name 'name' and widget flags set to 'f' |
132 | * | 133 | * |
133 | * The dialog will by default be modeless, unless you set 'modal' to | 134 | * The dialog will by default be modeless, unless you set 'modal' to |
134 | * TRUE to construct a modal dialog. | 135 | * TRUE to construct a modal dialog. |
135 | */ | 136 | */ |
136 | IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, | 137 | IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, |
137 | QWidget* parent,const char* name,bool modal,WFlags fl) : | 138 | QWidget* parent,const char* name,bool modal,WFlags fl) : |
138 | IncomingDialog_base(parent,name,modal,fl) | 139 | IncomingDialog_base(parent,name,modal,fl) |
139 | { | 140 | { |
140 | mCalendar = calendar; | 141 | mCalendar = calendar; |
141 | mOutgoing = outgoing; | 142 | mOutgoing = outgoing; |
142 | #ifndef KORG_NOMAIL | 143 | #ifndef KORG_NOMAIL |
143 | mScheduler = new MailScheduler(mCalendar); | 144 | mScheduler = new MailScheduler(mCalendar); |
144 | #else | 145 | #else |
145 | mScheduler = new DummyScheduler(mCalendar); | 146 | mScheduler = new DummyScheduler(mCalendar); |
146 | #endif | 147 | #endif |
147 | mMessageListView->setColumnAlignment(1,AlignHCenter); | 148 | mMessageListView->setColumnAlignment(1,AlignHCenter); |
148 | mMessageListView->setColumnAlignment(2,AlignHCenter); | 149 | mMessageListView->setColumnAlignment(2,AlignHCenter); |
149 | mMessageListView->setColumnAlignment(3,AlignHCenter); | 150 | mMessageListView->setColumnAlignment(3,AlignHCenter); |
150 | mMessageListView->setColumnAlignment(4,AlignHCenter); | 151 | mMessageListView->setColumnAlignment(4,AlignHCenter); |
151 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), | 152 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), |
152 | this,SLOT(showEvent(QListViewItem *))); | 153 | this,SLOT(showEvent(QListViewItem *))); |
153 | retrieve(); | 154 | retrieve(); |
154 | } | 155 | } |
155 | 156 | ||
156 | /* | 157 | /* |
157 | * Destroys the object and frees any allocated resources | 158 | * Destroys the object and frees any allocated resources |
158 | */ | 159 | */ |
159 | IncomingDialog::~IncomingDialog() | 160 | IncomingDialog::~IncomingDialog() |
160 | { | 161 | { |
161 | // no need to delete child widgets, Qt does it all for us | 162 | // no need to delete child widgets, Qt does it all for us |
162 | } | 163 | } |
163 | 164 | ||
164 | void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) | 165 | void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) |
165 | { | 166 | { |
166 | mOutgoing = outgoing; | 167 | mOutgoing = outgoing; |
167 | } | 168 | } |
168 | 169 | ||
169 | void IncomingDialog::retrieve() | 170 | void IncomingDialog::retrieve() |
170 | { | 171 | { |
171 | QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); | 172 | QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); |
172 | 173 | ||
173 | ScheduleMessage *message; | 174 | ScheduleMessage *message; |
174 | for(message = messages.first();message;message = messages.next()) { | 175 | for(message = messages.first();message;message = messages.next()) { |
175 | IncidenceBase *inc = message->event(); | 176 | IncidenceBase *inc = message->event(); |
176 | Scheduler::Method method = (Scheduler::Method)message->method(); | 177 | Scheduler::Method method = (Scheduler::Method)message->method(); |
177 | ScheduleMessage::Status status = message->status(); | 178 | ScheduleMessage::Status status = message->status(); |
178 | 179 | ||
179 | ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); | 180 | ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); |
180 | if(inc->type()!="FreeBusy") { | 181 | if(inc->type()!="FreeBusy") { |
181 | Incidence *incidence = static_cast<Incidence *>(inc); | 182 | Incidence *incidence = static_cast<Incidence *>(inc); |
182 | ScheduleItemVisitor v(item); | 183 | ScheduleItemVisitor v(item); |
183 | if (!incidence->accept(v)) delete item; | 184 | if (!incidence->accept(v)) delete item; |
184 | } else { | 185 | } else { |
185 | FreeBusy *fb = static_cast<FreeBusy *>(item->event()); | 186 | FreeBusy *fb = static_cast<FreeBusy *>(item->event()); |
186 | item->setText(0, "FreeBusy"); | 187 | item->setText(0, "FreeBusy"); |
187 | item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); | 188 | item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); |
188 | item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); | 189 | item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); |
189 | item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); | 190 | item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); |
190 | item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); | 191 | item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); |
191 | item->setText(5, fb->organizer()); | 192 | item->setText(5, fb->organizer()); |
192 | } | 193 | } |
193 | automaticAction(item); | 194 | automaticAction(item); |
194 | } | 195 | } |
195 | emit numMessagesChanged(mMessageListView->childCount()); | 196 | emit numMessagesChanged(mMessageListView->childCount()); |
196 | } | 197 | } |
197 | 198 | ||
198 | void IncomingDialog::acceptAllMessages() | 199 | void IncomingDialog::acceptAllMessages() |
199 | { | 200 | { |
200 | bool success = false; | 201 | bool success = false; |
201 | 202 | ||
202 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); | 203 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); |
203 | while(item) { | 204 | while(item) { |
204 | ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); | 205 | ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); |
205 | if (acceptMessage(item)) success = true; | 206 | if (acceptMessage(item)) success = true; |
206 | item = nextitem; | 207 | item = nextitem; |
207 | } | 208 | } |
208 | 209 | ||
209 | if (success) emit calendarUpdated(); | 210 | if (success) emit calendarUpdated(); |
210 | } | 211 | } |
211 | 212 | ||
212 | void IncomingDialog::acceptMessage() | 213 | void IncomingDialog::acceptMessage() |
213 | { | 214 | { |
214 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); | 215 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); |
215 | if (item) { | 216 | if (item) { |
216 | if (acceptMessage(item)) emit calendarUpdated(); | 217 | if (acceptMessage(item)) emit calendarUpdated(); |
217 | } | 218 | } |
218 | } | 219 | } |
219 | 220 | ||
220 | bool IncomingDialog::acceptMessage(ScheduleItemIn *item) | 221 | bool IncomingDialog::acceptMessage(ScheduleItemIn *item) |
221 | { | 222 | { |
222 | switch (item->method()) { | 223 | switch (item->method()) { |
223 | case Scheduler::Refresh: | 224 | case Scheduler::Refresh: |
224 | return incomeRefresh(item); | 225 | return incomeRefresh(item); |
225 | break; | 226 | break; |
226 | case Scheduler::Counter: | 227 | case Scheduler::Counter: |
227 | return incomeCounter(item); | 228 | return incomeCounter(item); |
228 | break; | 229 | break; |
229 | case Scheduler::Declinecounter: | 230 | case Scheduler::Declinecounter: |
230 | return incomeDeclineCounter(item); | 231 | return incomeDeclineCounter(item); |
231 | break; | 232 | break; |
232 | case Scheduler::Add: | 233 | case Scheduler::Add: |
233 | return incomeAdd(item); | 234 | return incomeAdd(item); |
234 | break; | 235 | break; |
235 | case Scheduler::Request: | 236 | case Scheduler::Request: |
236 | return incomeRequest(item); | 237 | return incomeRequest(item); |
237 | break; | 238 | break; |
238 | default: | 239 | default: |
239 | return incomeDefault(item); | 240 | return incomeDefault(item); |
240 | } | 241 | } |
241 | return false; | 242 | return false; |
242 | } | 243 | } |
243 | 244 | ||
244 | void IncomingDialog::rejectMessage() | 245 | void IncomingDialog::rejectMessage() |
245 | { | 246 | { |
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro index 4247838..d841193 100644 --- a/korganizer/korganizerE.pro +++ b/korganizer/korganizerE.pro | |||
@@ -1,155 +1,157 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = kopi | 3 | TARGET = kopi |
4 | OBJECTS_DIR = obj/$(PLATFORM) | 4 | OBJECTS_DIR = obj/$(PLATFORM) |
5 | MOC_DIR = moc/$(PLATFORM) | 5 | MOC_DIR = moc/$(PLATFORM) |
6 | DESTDIR=$(QPEDIR)/bin | 6 | DESTDIR=$(QPEDIR)/bin |
7 | 7 | ||
8 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include | 8 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include |
9 | 9 | ||
10 | DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL | 10 | DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL |
11 | DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER | 11 | DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER |
12 | DEFINES += KORG_NOLVALTERNATION | 12 | DEFINES += KORG_NOLVALTERNATION |
13 | #KORG_NOKABC | 13 | #KORG_NOKABC |
14 | LIBS += -lmicrokdepim | 14 | LIBS += -lmicrokdepim |
15 | LIBS += -lmicrokcal | 15 | LIBS += -lmicrokcal |
16 | LIBS += -lmicrokde | 16 | LIBS += -lmicrokde |
17 | LIBS += -lmicroqtcompat | 17 | LIBS += -lmicroqtcompat |
18 | LIBS += -lmicrokabc | 18 | #LIBS += -lmicrokabc |
19 | 19 | ||
20 | #LIBS += $(QPEDIR)/lib/gammu | 20 | #LIBS += $(QPEDIR)/lib/gammu |
21 | #LIBS += -lmicrogammu | 21 | #LIBS += -lmicrogammu |
22 | #LIBS += -lbluetooth | 22 | #LIBS += -lbluetooth |
23 | #LIBS += -lsdp | 23 | #LIBS += -lsdp |
24 | LIBS += $(GCC3EXTRALIB1) | ||
25 | LIBS += $(GCC3EXTRALIB2) | ||
24 | 26 | ||
25 | 27 | ||
26 | LIBS += -lqpe | 28 | LIBS += -lqpe |
27 | LIBS += -ljpeg | 29 | LIBS += -ljpeg |
28 | LIBS += $(QTOPIALIB) | 30 | LIBS += $(QTOPIALIB) |
29 | LIBS += -L$(QPEDIR)/lib | 31 | LIBS += -L$(QPEDIR)/lib |
30 | 32 | ||
31 | INTERFACES = kofilterview_base.ui | 33 | INTERFACES = kofilterview_base.ui |
32 | #filteredit_base.ui | 34 | #filteredit_base.ui |
33 | 35 | ||
34 | HEADERS = \ | 36 | HEADERS = \ |
35 | wordsgerman.h \ | 37 | wordsgerman.h \ |
36 | filteredit_base.h \ | 38 | filteredit_base.h \ |
37 | alarmclient.h \ | 39 | alarmclient.h \ |
38 | calendarview.h \ | 40 | calendarview.h \ |
39 | customlistviewitem.h \ | 41 | customlistviewitem.h \ |
40 | datenavigator.h \ | 42 | datenavigator.h \ |
41 | docprefs.h \ | 43 | docprefs.h \ |
42 | filtereditdialog.h \ | 44 | filtereditdialog.h \ |
43 | incomingdialog.h \ | 45 | incomingdialog.h \ |
44 | incomingdialog_base.h \ | 46 | incomingdialog_base.h \ |
45 | interfaces/korganizer/baseview.h \ | 47 | interfaces/korganizer/baseview.h \ |
46 | interfaces/korganizer/calendarviewbase.h \ | 48 | interfaces/korganizer/calendarviewbase.h \ |
47 | journalentry.h \ | 49 | journalentry.h \ |
48 | kdateedit.h \ | 50 | kdateedit.h \ |
49 | kdatenavigator.h \ | 51 | kdatenavigator.h \ |
50 | koagenda.h \ | 52 | koagenda.h \ |
51 | koagendaitem.h \ | 53 | koagendaitem.h \ |
52 | koagendaview.h \ | 54 | koagendaview.h \ |
53 | kocounterdialog.h \ | 55 | kocounterdialog.h \ |
54 | kodaymatrix.h \ | 56 | kodaymatrix.h \ |
55 | kodialogmanager.h \ | 57 | kodialogmanager.h \ |
56 | koeditordetails.h \ | 58 | koeditordetails.h \ |
57 | koeditorgeneral.h \ | 59 | koeditorgeneral.h \ |
58 | koeditorgeneralevent.h \ | 60 | koeditorgeneralevent.h \ |
59 | koeditorgeneraltodo.h \ | 61 | koeditorgeneraltodo.h \ |
60 | koeditorrecurrence.h \ | 62 | koeditorrecurrence.h \ |
61 | koeventeditor.h \ | 63 | koeventeditor.h \ |
62 | koeventpopupmenu.h \ | 64 | koeventpopupmenu.h \ |
63 | koeventview.h \ | 65 | koeventview.h \ |
64 | koeventviewer.h \ | 66 | koeventviewer.h \ |
65 | koeventviewerdialog.h \ | 67 | koeventviewerdialog.h \ |
66 | kofilterview.h \ | 68 | kofilterview.h \ |
67 | koglobals.h \ | 69 | koglobals.h \ |
68 | koincidenceeditor.h \ | 70 | koincidenceeditor.h \ |
69 | kojournalview.h \ | 71 | kojournalview.h \ |
70 | kolistview.h \ | 72 | kolistview.h \ |
71 | kolocationbox.h \ | 73 | kolocationbox.h \ |
72 | komonthview.h \ | 74 | komonthview.h \ |
73 | koprefs.h \ | 75 | koprefs.h \ |
74 | koprefsdialog.h \ | 76 | koprefsdialog.h \ |
75 | kotimespanview.h \ | 77 | kotimespanview.h \ |
76 | kotodoeditor.h \ | 78 | kotodoeditor.h \ |
77 | kotodoview.h \ | 79 | kotodoview.h \ |
78 | kotodoviewitem.h \ | 80 | kotodoviewitem.h \ |
79 | koviewmanager.h \ | 81 | koviewmanager.h \ |
80 | kowhatsnextview.h \ | 82 | kowhatsnextview.h \ |
81 | ktimeedit.h \ | 83 | ktimeedit.h \ |
82 | lineview.h \ | 84 | lineview.h \ |
83 | mainwindow.h \ | 85 | mainwindow.h \ |
84 | navigatorbar.h \ | 86 | navigatorbar.h \ |
85 | outgoingdialog.h \ | 87 | outgoingdialog.h \ |
86 | outgoingdialog_base.h \ | 88 | outgoingdialog_base.h \ |
87 | publishdialog.h \ | 89 | publishdialog.h \ |
88 | publishdialog_base.h \ | 90 | publishdialog_base.h \ |
89 | savetemplatedialog.h \ | 91 | savetemplatedialog.h \ |
90 | searchdialog.h \ | 92 | searchdialog.h \ |
91 | simplealarmclient.h \ | 93 | simplealarmclient.h \ |
92 | statusdialog.h \ | 94 | statusdialog.h \ |
93 | timeline.h \ | 95 | timeline.h \ |
94 | timespanview.h \ | 96 | timespanview.h \ |
95 | version.h \ | 97 | version.h \ |
96 | ../kalarmd/alarmdialog.h | 98 | ../kalarmd/alarmdialog.h |
97 | 99 | ||
98 | SOURCES = \ | 100 | SOURCES = \ |
99 | filteredit_base.cpp \ | 101 | filteredit_base.cpp \ |
100 | calendarview.cpp \ | 102 | calendarview.cpp \ |
101 | datenavigator.cpp \ | 103 | datenavigator.cpp \ |
102 | docprefs.cpp \ | 104 | docprefs.cpp \ |
103 | filtereditdialog.cpp \ | 105 | filtereditdialog.cpp \ |
104 | incomingdialog.cpp \ | 106 | incomingdialog.cpp \ |
105 | incomingdialog_base.cpp \ | 107 | incomingdialog_base.cpp \ |
106 | journalentry.cpp \ | 108 | journalentry.cpp \ |
107 | kdatenavigator.cpp \ | 109 | kdatenavigator.cpp \ |
108 | koagenda.cpp \ | 110 | koagenda.cpp \ |
109 | koagendaitem.cpp \ | 111 | koagendaitem.cpp \ |
110 | koagendaview.cpp \ | 112 | koagendaview.cpp \ |
111 | kocounterdialog.cpp \ | 113 | kocounterdialog.cpp \ |
112 | kodaymatrix.cpp \ | 114 | kodaymatrix.cpp \ |
113 | kodialogmanager.cpp \ | 115 | kodialogmanager.cpp \ |
114 | koeditordetails.cpp \ | 116 | koeditordetails.cpp \ |
115 | koeditorgeneral.cpp \ | 117 | koeditorgeneral.cpp \ |
116 | koeditorgeneralevent.cpp \ | 118 | koeditorgeneralevent.cpp \ |
117 | koeditorgeneraltodo.cpp \ | 119 | koeditorgeneraltodo.cpp \ |
118 | koeditorrecurrence.cpp \ | 120 | koeditorrecurrence.cpp \ |
119 | koeventeditor.cpp \ | 121 | koeventeditor.cpp \ |
120 | koeventpopupmenu.cpp \ | 122 | koeventpopupmenu.cpp \ |
121 | koeventview.cpp \ | 123 | koeventview.cpp \ |
122 | koeventviewer.cpp \ | 124 | koeventviewer.cpp \ |
123 | koeventviewerdialog.cpp \ | 125 | koeventviewerdialog.cpp \ |
124 | kofilterview.cpp \ | 126 | kofilterview.cpp \ |
125 | koglobals.cpp \ | 127 | koglobals.cpp \ |
126 | koincidenceeditor.cpp \ | 128 | koincidenceeditor.cpp \ |
127 | kojournalview.cpp \ | 129 | kojournalview.cpp \ |
128 | kolistview.cpp \ | 130 | kolistview.cpp \ |
129 | kolocationbox.cpp \ | 131 | kolocationbox.cpp \ |
130 | komonthview.cpp \ | 132 | komonthview.cpp \ |
131 | koprefs.cpp \ | 133 | koprefs.cpp \ |
132 | koprefsdialog.cpp \ | 134 | koprefsdialog.cpp \ |
133 | kotimespanview.cpp \ | 135 | kotimespanview.cpp \ |
134 | kotodoeditor.cpp \ | 136 | kotodoeditor.cpp \ |
135 | kotodoview.cpp \ | 137 | kotodoview.cpp \ |
136 | kotodoviewitem.cpp \ | 138 | kotodoviewitem.cpp \ |
137 | koviewmanager.cpp \ | 139 | koviewmanager.cpp \ |
138 | kowhatsnextview.cpp \ | 140 | kowhatsnextview.cpp \ |
139 | ktimeedit.cpp \ | 141 | ktimeedit.cpp \ |
140 | lineview.cpp \ | 142 | lineview.cpp \ |
141 | main.cpp \ | 143 | main.cpp \ |
142 | mainwindow.cpp \ | 144 | mainwindow.cpp \ |
143 | navigatorbar.cpp \ | 145 | navigatorbar.cpp \ |
144 | outgoingdialog.cpp \ | 146 | outgoingdialog.cpp \ |
145 | outgoingdialog_base.cpp \ | 147 | outgoingdialog_base.cpp \ |
146 | publishdialog.cpp \ | 148 | publishdialog.cpp \ |
147 | publishdialog_base.cpp \ | 149 | publishdialog_base.cpp \ |
148 | savetemplatedialog.cpp \ | 150 | savetemplatedialog.cpp \ |
149 | searchdialog.cpp \ | 151 | searchdialog.cpp \ |
150 | simplealarmclient.cpp \ | 152 | simplealarmclient.cpp \ |
151 | statusdialog.cpp \ | 153 | statusdialog.cpp \ |
152 | timeline.cpp \ | 154 | timeline.cpp \ |
153 | timespanview.cpp \ | 155 | timespanview.cpp \ |
154 | ../kalarmd/alarmdialog.cpp | 156 | ../kalarmd/alarmdialog.cpp |
155 | 157 | ||
diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp index 4323b91..2ae6720 100644 --- a/korganizer/publishdialog.cpp +++ b/korganizer/publishdialog.cpp | |||
@@ -1,150 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
25 | #include <kdebug.h> | 25 | #include <kdebug.h> |
26 | 26 | ||
27 | #include <kglobal.h> | 27 | #include <kglobal.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #ifndef KORG_NOKABC | 29 | #ifndef KORG_NOKABC |
30 | #include <kabc/addresseedialog.h> | 30 | #define KORG_NOKABC |
31 | //#include <kabc/addresseedialog.h> | ||
31 | #endif | 32 | #endif |
32 | 33 | ||
33 | #include "koprefs.h" | 34 | #include "koprefs.h" |
34 | #include "publishdialog.h" | 35 | #include "publishdialog.h" |
35 | 36 | ||
36 | PublishDialog::PublishDialog(QWidget* parent, const char* name, | 37 | PublishDialog::PublishDialog(QWidget* parent, const char* name, |
37 | bool modal, WFlags fl) | 38 | bool modal, WFlags fl) |
38 | : PublishDialog_base(parent,name,modal,fl) | 39 | : PublishDialog_base(parent,name,modal,fl) |
39 | { | 40 | { |
40 | setCaption(i18n("Select Addresses")); | 41 | setCaption(i18n("Select Addresses")); |
41 | mNameLineEdit->setEnabled(false); | 42 | mNameLineEdit->setEnabled(false); |
42 | mEmailLineEdit->setEnabled(false); | 43 | mEmailLineEdit->setEnabled(false); |
43 | connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), | 44 | connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), |
44 | SLOT(updateInput())); | 45 | SLOT(updateInput())); |
45 | } | 46 | } |
46 | 47 | ||
47 | PublishDialog::~PublishDialog() | 48 | PublishDialog::~PublishDialog() |
48 | { | 49 | { |
49 | } | 50 | } |
50 | 51 | ||
51 | void PublishDialog::addAttendee(Attendee *attendee) | 52 | void PublishDialog::addAttendee(Attendee *attendee) |
52 | { | 53 | { |
53 | mNameLineEdit->setEnabled(true); | 54 | mNameLineEdit->setEnabled(true); |
54 | mEmailLineEdit->setEnabled(true); | 55 | mEmailLineEdit->setEnabled(true); |
55 | QListViewItem *item = new QListViewItem(mAddressListView); | 56 | QListViewItem *item = new QListViewItem(mAddressListView); |
56 | item->setText(0,attendee->name()); | 57 | item->setText(0,attendee->name()); |
57 | item->setText(1,attendee->email()); | 58 | item->setText(1,attendee->email()); |
58 | mAddressListView->insertItem(item); | 59 | mAddressListView->insertItem(item); |
59 | } | 60 | } |
60 | 61 | ||
61 | QString PublishDialog::addresses() | 62 | QString PublishDialog::addresses() |
62 | { | 63 | { |
63 | QString to = ""; | 64 | QString to = ""; |
64 | QListViewItem *item; | 65 | QListViewItem *item; |
65 | int i, count; | 66 | int i, count; |
66 | count = mAddressListView->childCount(); | 67 | count = mAddressListView->childCount(); |
67 | for (i=0;i<count;i++) { | 68 | for (i=0;i<count;i++) { |
68 | item = mAddressListView->firstChild(); | 69 | item = mAddressListView->firstChild(); |
69 | mAddressListView->takeItem(item); | 70 | mAddressListView->takeItem(item); |
70 | to += item->text(1); | 71 | to += item->text(1); |
71 | if (i<count-1) { | 72 | if (i<count-1) { |
72 | to += ", "; | 73 | to += ", "; |
73 | } | 74 | } |
74 | } | 75 | } |
75 | return to; | 76 | return to; |
76 | } | 77 | } |
77 | 78 | ||
78 | void PublishDialog::addItem() | 79 | void PublishDialog::addItem() |
79 | { | 80 | { |
80 | mNameLineEdit->setEnabled(true); | 81 | mNameLineEdit->setEnabled(true); |
81 | mEmailLineEdit->setEnabled(true); | 82 | mEmailLineEdit->setEnabled(true); |
82 | QListViewItem *item = new QListViewItem(mAddressListView); | 83 | QListViewItem *item = new QListViewItem(mAddressListView); |
83 | mAddressListView->insertItem(item); | 84 | mAddressListView->insertItem(item); |
84 | mAddressListView->setSelected(item,true); | 85 | mAddressListView->setSelected(item,true); |
85 | mNameLineEdit->setText(i18n("(EmptyName)")); | 86 | mNameLineEdit->setText(i18n("(EmptyName)")); |
86 | mEmailLineEdit->setText(i18n("(EmptyEmail)")); | 87 | mEmailLineEdit->setText(i18n("(EmptyEmail)")); |
87 | } | 88 | } |
88 | 89 | ||
89 | void PublishDialog::removeItem() | 90 | void PublishDialog::removeItem() |
90 | { | 91 | { |
91 | QListViewItem *item; | 92 | QListViewItem *item; |
92 | item = mAddressListView->selectedItem(); | 93 | item = mAddressListView->selectedItem(); |
93 | if (!item) return; | 94 | if (!item) return; |
94 | mAddressListView->takeItem(item); | 95 | mAddressListView->takeItem(item); |
95 | item = mAddressListView->selectedItem(); | 96 | item = mAddressListView->selectedItem(); |
96 | if (!item) { | 97 | if (!item) { |
97 | mNameLineEdit->setText(""); | 98 | mNameLineEdit->setText(""); |
98 | mEmailLineEdit->setText(""); | 99 | mEmailLineEdit->setText(""); |
99 | mNameLineEdit->setEnabled(false); | 100 | mNameLineEdit->setEnabled(false); |
100 | mEmailLineEdit->setEnabled(false); | 101 | mEmailLineEdit->setEnabled(false); |
101 | } | 102 | } |
102 | if (mAddressListView->childCount() == 0) { | 103 | if (mAddressListView->childCount() == 0) { |
103 | mNameLineEdit->setEnabled(false); | 104 | mNameLineEdit->setEnabled(false); |
104 | mEmailLineEdit->setEnabled(false); | 105 | mEmailLineEdit->setEnabled(false); |
105 | } | 106 | } |
106 | } | 107 | } |
107 | 108 | ||
108 | void PublishDialog::openAddressbook() | 109 | void PublishDialog::openAddressbook() |
109 | { | 110 | { |
110 | #ifndef KORG_NOKABC | 111 | #ifndef KORG_NOKABC |
111 | KABC::Addressee::List addressList; | 112 | KABC::Addressee::List addressList; |
112 | addressList = KABC::AddresseeDialog::getAddressees(this); | 113 | addressList = KABC::AddresseeDialog::getAddressees(this); |
113 | //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 114 | //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
114 | KABC::Addressee a = addressList.first(); | 115 | KABC::Addressee a = addressList.first(); |
115 | if (!a.isEmpty()) { | 116 | if (!a.isEmpty()) { |
116 | uint i; | 117 | uint i; |
117 | for (i=0;i<addressList.count();i++) { | 118 | for (i=0;i<addressList.count();i++) { |
118 | a = addressList[i]; | 119 | a = addressList[i]; |
119 | mNameLineEdit->setEnabled(true); | 120 | mNameLineEdit->setEnabled(true); |
120 | mEmailLineEdit->setEnabled(true); | 121 | mEmailLineEdit->setEnabled(true); |
121 | QListViewItem *item = new QListViewItem(mAddressListView); | 122 | QListViewItem *item = new QListViewItem(mAddressListView); |
122 | mAddressListView->setSelected(item,true); | 123 | mAddressListView->setSelected(item,true); |
123 | mNameLineEdit->setText(a.realName()); | 124 | mNameLineEdit->setText(a.realName()); |
124 | mEmailLineEdit->setText(a.preferredEmail()); | 125 | mEmailLineEdit->setText(a.preferredEmail()); |
125 | mAddressListView->insertItem(item); | 126 | mAddressListView->insertItem(item); |
126 | } | 127 | } |
127 | } | 128 | } |
128 | #endif | 129 | #endif |
129 | } | 130 | } |
130 | 131 | ||
131 | void PublishDialog::updateItem() | 132 | void PublishDialog::updateItem() |
132 | { | 133 | { |
133 | QListViewItem *item; | 134 | QListViewItem *item; |
134 | item = mAddressListView->selectedItem(); | 135 | item = mAddressListView->selectedItem(); |
135 | if (!item) return; | 136 | if (!item) return; |
136 | item->setText(0,mNameLineEdit->text()); | 137 | item->setText(0,mNameLineEdit->text()); |
137 | item->setText(1,mEmailLineEdit->text()); | 138 | item->setText(1,mEmailLineEdit->text()); |
138 | } | 139 | } |
139 | 140 | ||
140 | void PublishDialog::updateInput() | 141 | void PublishDialog::updateInput() |
141 | { | 142 | { |
142 | QListViewItem *item; | 143 | QListViewItem *item; |
143 | item = mAddressListView->selectedItem(); | 144 | item = mAddressListView->selectedItem(); |
144 | if (!item) return; | 145 | if (!item) return; |
145 | mNameLineEdit->setEnabled(true); | 146 | mNameLineEdit->setEnabled(true); |
146 | mEmailLineEdit->setEnabled(true); | 147 | mEmailLineEdit->setEnabled(true); |
147 | QString mail = item->text(1); | 148 | QString mail = item->text(1); |
148 | mNameLineEdit->setText(item->text(0)); | 149 | mNameLineEdit->setText(item->text(0)); |
149 | mEmailLineEdit->setText(mail); | 150 | mEmailLineEdit->setText(mail); |
150 | } | 151 | } |