-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 4 | ||||
-rw-r--r-- | korganizer/koprefs.h | 11 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 20 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 47 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 1 |
7 files changed, 75 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1e83236..beb19d9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1330,1054 +1330,1058 @@ void CalendarView::syncExternal( int mode ) | |||
1330 | } else { | 1330 | } else { |
1331 | emit tempDisableBR(false); | 1331 | emit tempDisableBR(false); |
1332 | return; | 1332 | return; |
1333 | } | 1333 | } |
1334 | if ( loadSuccess ) { | 1334 | if ( loadSuccess ) { |
1335 | getEventViewerDialog()->setSyncMode( true ); | 1335 | getEventViewerDialog()->setSyncMode( true ); |
1336 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1336 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1337 | getEventViewerDialog()->setSyncMode( false ); | 1337 | getEventViewerDialog()->setSyncMode( false ); |
1338 | qApp->processEvents(); | 1338 | qApp->processEvents(); |
1339 | if ( syncOK ) { | 1339 | if ( syncOK ) { |
1340 | if ( mSyncManager->mWriteBackFile ) | 1340 | if ( mSyncManager->mWriteBackFile ) |
1341 | { | 1341 | { |
1342 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1342 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1343 | Incidence* inc = iL.first(); | 1343 | Incidence* inc = iL.first(); |
1344 | if ( phoneFormat ) { | 1344 | if ( phoneFormat ) { |
1345 | while ( inc ) { | 1345 | while ( inc ) { |
1346 | inc->removeID(mCurrentSyncDevice); | 1346 | inc->removeID(mCurrentSyncDevice); |
1347 | inc = iL.next(); | 1347 | inc = iL.next(); |
1348 | } | 1348 | } |
1349 | } | 1349 | } |
1350 | #ifndef DESKTOP_VERSION | 1350 | #ifndef DESKTOP_VERSION |
1351 | if ( sharpFormat ) | 1351 | if ( sharpFormat ) |
1352 | sharpFormat->save(calendar); | 1352 | sharpFormat->save(calendar); |
1353 | #endif | 1353 | #endif |
1354 | if ( phoneFormat ) | 1354 | if ( phoneFormat ) |
1355 | phoneFormat->save(calendar); | 1355 | phoneFormat->save(calendar); |
1356 | iL = calendar->rawIncidences(); | 1356 | iL = calendar->rawIncidences(); |
1357 | inc = iL.first(); | 1357 | inc = iL.first(); |
1358 | Incidence* loc; | 1358 | Incidence* loc; |
1359 | while ( inc ) { | 1359 | while ( inc ) { |
1360 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1360 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1361 | loc = mCalendar->incidence(inc->uid() ); | 1361 | loc = mCalendar->incidence(inc->uid() ); |
1362 | if ( loc ) { | 1362 | if ( loc ) { |
1363 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1363 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1364 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1364 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1365 | } | 1365 | } |
1366 | } | 1366 | } |
1367 | inc = iL.next(); | 1367 | inc = iL.next(); |
1368 | } | 1368 | } |
1369 | Incidence* lse = getLastSyncEvent(); | 1369 | Incidence* lse = getLastSyncEvent(); |
1370 | if ( lse ) { | 1370 | if ( lse ) { |
1371 | lse->setReadOnly( false ); | 1371 | lse->setReadOnly( false ); |
1372 | lse->setDescription( "" ); | 1372 | lse->setDescription( "" ); |
1373 | lse->setReadOnly( true ); | 1373 | lse->setReadOnly( true ); |
1374 | } | 1374 | } |
1375 | } | 1375 | } |
1376 | } else { | 1376 | } else { |
1377 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1377 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1378 | } | 1378 | } |
1379 | setModified( true ); | 1379 | setModified( true ); |
1380 | } else { | 1380 | } else { |
1381 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1381 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1382 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1382 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1383 | question, i18n("Ok")) ; | 1383 | question, i18n("Ok")) ; |
1384 | 1384 | ||
1385 | } | 1385 | } |
1386 | delete calendar; | 1386 | delete calendar; |
1387 | updateView(); | 1387 | updateView(); |
1388 | emit tempDisableBR(false); | 1388 | emit tempDisableBR(false); |
1389 | return ;//syncOK; | 1389 | return ;//syncOK; |
1390 | 1390 | ||
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | bool CalendarView::importBday() | 1393 | bool CalendarView::importBday() |
1394 | { | 1394 | { |
1395 | #ifndef KORG_NOKABC | 1395 | #ifndef KORG_NOKABC |
1396 | 1396 | ||
1397 | #ifdef DESKTOP_VERSION | 1397 | #ifdef DESKTOP_VERSION |
1398 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1398 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1399 | KABC::AddressBook::Iterator it; | 1399 | KABC::AddressBook::Iterator it; |
1400 | int count = 0; | 1400 | int count = 0; |
1401 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1401 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1402 | ++count; | 1402 | ++count; |
1403 | } | 1403 | } |
1404 | QProgressBar bar(count,0 ); | 1404 | QProgressBar bar(count,0 ); |
1405 | int w = 300; | 1405 | int w = 300; |
1406 | if ( QApplication::desktop()->width() < 320 ) | 1406 | if ( QApplication::desktop()->width() < 320 ) |
1407 | w = 220; | 1407 | w = 220; |
1408 | int h = bar.sizeHint().height() ; | 1408 | int h = bar.sizeHint().height() ; |
1409 | int dw = QApplication::desktop()->width(); | 1409 | int dw = QApplication::desktop()->width(); |
1410 | int dh = QApplication::desktop()->height(); | 1410 | int dh = QApplication::desktop()->height(); |
1411 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1411 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1412 | bar.show(); | 1412 | bar.show(); |
1413 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1413 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1414 | qApp->processEvents(); | 1414 | qApp->processEvents(); |
1415 | count = 0; | 1415 | count = 0; |
1416 | int addCount = 0; | 1416 | int addCount = 0; |
1417 | KCal::Attendee* a = 0; | 1417 | KCal::Attendee* a = 0; |
1418 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1418 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1419 | if ( ! bar.isVisible() ) | 1419 | if ( ! bar.isVisible() ) |
1420 | return false; | 1420 | return false; |
1421 | bar.setProgress( count++ ); | 1421 | bar.setProgress( count++ ); |
1422 | qApp->processEvents(); | 1422 | qApp->processEvents(); |
1423 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1423 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1424 | if ( (*it).birthday().date().isValid() ){ | 1424 | if ( (*it).birthday().date().isValid() ){ |
1425 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1425 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1426 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1426 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1427 | ++addCount; | 1427 | ++addCount; |
1428 | } | 1428 | } |
1429 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1429 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1430 | if ( anni.isValid() ){ | 1430 | if ( anni.isValid() ){ |
1431 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1431 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1432 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1432 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1433 | ++addCount; | 1433 | ++addCount; |
1434 | } | 1434 | } |
1435 | } | 1435 | } |
1436 | updateView(); | 1436 | updateView(); |
1437 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1437 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1438 | #else //DESKTOP_VERSION | 1438 | #else //DESKTOP_VERSION |
1439 | 1439 | ||
1440 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1440 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1441 | // the result should now arrive through method insertBirthdays | 1441 | // the result should now arrive through method insertBirthdays |
1442 | 1442 | ||
1443 | #endif //DESKTOP_VERSION | 1443 | #endif //DESKTOP_VERSION |
1444 | 1444 | ||
1445 | #endif //KORG_NOKABC | 1445 | #endif //KORG_NOKABC |
1446 | 1446 | ||
1447 | 1447 | ||
1448 | return true; | 1448 | return true; |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1451 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1452 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1452 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1453 | const QStringList& anniversaryList, const QStringList& realNameList, | 1453 | const QStringList& anniversaryList, const QStringList& realNameList, |
1454 | const QStringList& emailList, const QStringList& assembledNameList, | 1454 | const QStringList& emailList, const QStringList& assembledNameList, |
1455 | const QStringList& uidList) | 1455 | const QStringList& uidList) |
1456 | { | 1456 | { |
1457 | //qDebug("KO::CalendarView::insertBirthdays"); | 1457 | //qDebug("KO::CalendarView::insertBirthdays"); |
1458 | if (uid == this->name()) | 1458 | if (uid == this->name()) |
1459 | { | 1459 | { |
1460 | int count = birthdayList.count(); | 1460 | int count = birthdayList.count(); |
1461 | int addCount = 0; | 1461 | int addCount = 0; |
1462 | KCal::Attendee* a = 0; | 1462 | KCal::Attendee* a = 0; |
1463 | 1463 | ||
1464 | //qDebug("CalView 1 %i", count); | 1464 | //qDebug("CalView 1 %i", count); |
1465 | 1465 | ||
1466 | QProgressBar bar(count,0 ); | 1466 | QProgressBar bar(count,0 ); |
1467 | int w = 300; | 1467 | int w = 300; |
1468 | if ( QApplication::desktop()->width() < 320 ) | 1468 | if ( QApplication::desktop()->width() < 320 ) |
1469 | w = 220; | 1469 | w = 220; |
1470 | int h = bar.sizeHint().height() ; | 1470 | int h = bar.sizeHint().height() ; |
1471 | int dw = QApplication::desktop()->width(); | 1471 | int dw = QApplication::desktop()->width(); |
1472 | int dh = QApplication::desktop()->height(); | 1472 | int dh = QApplication::desktop()->height(); |
1473 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1473 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1474 | bar.show(); | 1474 | bar.show(); |
1475 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1475 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1476 | qApp->processEvents(); | 1476 | qApp->processEvents(); |
1477 | 1477 | ||
1478 | QDate birthday; | 1478 | QDate birthday; |
1479 | QDate anniversary; | 1479 | QDate anniversary; |
1480 | QString realName; | 1480 | QString realName; |
1481 | QString email; | 1481 | QString email; |
1482 | QString assembledName; | 1482 | QString assembledName; |
1483 | QString uid; | 1483 | QString uid; |
1484 | bool ok = true; | 1484 | bool ok = true; |
1485 | for ( int i = 0; i < count; i++) | 1485 | for ( int i = 0; i < count; i++) |
1486 | { | 1486 | { |
1487 | if ( ! bar.isVisible() ) | 1487 | if ( ! bar.isVisible() ) |
1488 | return; | 1488 | return; |
1489 | bar.setProgress( i ); | 1489 | bar.setProgress( i ); |
1490 | qApp->processEvents(); | 1490 | qApp->processEvents(); |
1491 | 1491 | ||
1492 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1492 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1493 | if (!ok) { | 1493 | if (!ok) { |
1494 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1494 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1497 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1498 | if (!ok) { | 1498 | if (!ok) { |
1499 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1499 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1500 | } | 1500 | } |
1501 | realName = realNameList[i]; | 1501 | realName = realNameList[i]; |
1502 | email = emailList[i]; | 1502 | email = emailList[i]; |
1503 | assembledName = assembledNameList[i]; | 1503 | assembledName = assembledNameList[i]; |
1504 | uid = uidList[i]; | 1504 | uid = uidList[i]; |
1505 | //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() ); | 1505 | //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() ); |
1506 | 1506 | ||
1507 | if ( birthday.isValid() ){ | 1507 | if ( birthday.isValid() ){ |
1508 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1508 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1509 | KCal::Attendee::ReqParticipant,uid) ; | 1509 | KCal::Attendee::ReqParticipant,uid) ; |
1510 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1510 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1511 | ++addCount; | 1511 | ++addCount; |
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | if ( anniversary.isValid() ){ | 1514 | if ( anniversary.isValid() ){ |
1515 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1515 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1516 | KCal::Attendee::ReqParticipant,uid) ; | 1516 | KCal::Attendee::ReqParticipant,uid) ; |
1517 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1517 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1518 | ++addCount; | 1518 | ++addCount; |
1519 | } | 1519 | } |
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | updateView(); | 1522 | updateView(); |
1523 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1523 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1524 | 1524 | ||
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | 1529 | ||
1530 | 1530 | ||
1531 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1531 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1532 | { | 1532 | { |
1533 | //qDebug("addAnni "); | 1533 | //qDebug("addAnni "); |
1534 | Event * ev = new Event(); | 1534 | Event * ev = new Event(); |
1535 | ev->setOrganizer(KOPrefs::instance()->email()); | 1535 | ev->setOrganizer(KOPrefs::instance()->email()); |
1536 | if ( a ) { | 1536 | if ( a ) { |
1537 | ev->addAttendee( a ); | 1537 | ev->addAttendee( a ); |
1538 | } | 1538 | } |
1539 | QString kind; | 1539 | QString kind; |
1540 | if ( birthday ) { | 1540 | if ( birthday ) { |
1541 | kind = i18n( "Birthday" ); | 1541 | kind = i18n( "Birthday" ); |
1542 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1542 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1543 | } | 1543 | } |
1544 | else { | 1544 | else { |
1545 | kind = i18n( "Anniversary" ); | 1545 | kind = i18n( "Anniversary" ); |
1546 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1546 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1547 | } | 1547 | } |
1548 | ev->setCategories( kind ); | 1548 | ev->setCategories( kind ); |
1549 | ev->setDtStart( QDateTime(date) ); | 1549 | ev->setDtStart( QDateTime(date) ); |
1550 | ev->setDtEnd( QDateTime(date) ); | 1550 | ev->setDtEnd( QDateTime(date) ); |
1551 | ev->setFloats( true ); | 1551 | ev->setFloats( true ); |
1552 | Recurrence * rec = ev->recurrence(); | 1552 | Recurrence * rec = ev->recurrence(); |
1553 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1553 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1554 | rec->addYearlyNum( date.month() ); | 1554 | rec->addYearlyNum( date.month() ); |
1555 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1555 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1556 | delete ev; | 1556 | delete ev; |
1557 | return false; | 1557 | return false; |
1558 | } | 1558 | } |
1559 | return true; | 1559 | return true; |
1560 | 1560 | ||
1561 | } | 1561 | } |
1562 | bool CalendarView::importQtopia( const QString &categories, | 1562 | bool CalendarView::importQtopia( const QString &categories, |
1563 | const QString &datebook, | 1563 | const QString &datebook, |
1564 | const QString &todolist ) | 1564 | const QString &todolist ) |
1565 | { | 1565 | { |
1566 | 1566 | ||
1567 | QtopiaFormat qtopiaFormat; | 1567 | QtopiaFormat qtopiaFormat; |
1568 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1568 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1569 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1569 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1570 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1570 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1571 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1571 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1572 | 1572 | ||
1573 | updateView(); | 1573 | updateView(); |
1574 | return true; | 1574 | return true; |
1575 | 1575 | ||
1576 | #if 0 | 1576 | #if 0 |
1577 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1577 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1578 | mCurrentSyncDevice = "qtopia-XML"; | 1578 | mCurrentSyncDevice = "qtopia-XML"; |
1579 | if ( mSyncManager->mAskForPreferences ) | 1579 | if ( mSyncManager->mAskForPreferences ) |
1580 | edit_sync_options(); | 1580 | edit_sync_options(); |
1581 | qApp->processEvents(); | 1581 | qApp->processEvents(); |
1582 | CalendarLocal* calendar = new CalendarLocal(); | 1582 | CalendarLocal* calendar = new CalendarLocal(); |
1583 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1583 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1584 | bool syncOK = false; | 1584 | bool syncOK = false; |
1585 | QtopiaFormat qtopiaFormat; | 1585 | QtopiaFormat qtopiaFormat; |
1586 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1586 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1587 | bool loadOk = true; | 1587 | bool loadOk = true; |
1588 | if ( !categories.isEmpty() ) | 1588 | if ( !categories.isEmpty() ) |
1589 | loadOk = qtopiaFormat.load( calendar, categories ); | 1589 | loadOk = qtopiaFormat.load( calendar, categories ); |
1590 | if ( loadOk && !datebook.isEmpty() ) | 1590 | if ( loadOk && !datebook.isEmpty() ) |
1591 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1591 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1592 | if ( loadOk && !todolist.isEmpty() ) | 1592 | if ( loadOk && !todolist.isEmpty() ) |
1593 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1593 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1594 | 1594 | ||
1595 | if ( loadOk ) { | 1595 | if ( loadOk ) { |
1596 | getEventViewerDialog()->setSyncMode( true ); | 1596 | getEventViewerDialog()->setSyncMode( true ); |
1597 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1597 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1598 | getEventViewerDialog()->setSyncMode( false ); | 1598 | getEventViewerDialog()->setSyncMode( false ); |
1599 | qApp->processEvents(); | 1599 | qApp->processEvents(); |
1600 | if ( syncOK ) { | 1600 | if ( syncOK ) { |
1601 | if ( mSyncManager->mWriteBackFile ) | 1601 | if ( mSyncManager->mWriteBackFile ) |
1602 | { | 1602 | { |
1603 | // write back XML file | 1603 | // write back XML file |
1604 | 1604 | ||
1605 | } | 1605 | } |
1606 | setModified( true ); | 1606 | setModified( true ); |
1607 | } | 1607 | } |
1608 | } else { | 1608 | } else { |
1609 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1609 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1610 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1610 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1611 | question, i18n("Ok")) ; | 1611 | question, i18n("Ok")) ; |
1612 | } | 1612 | } |
1613 | delete calendar; | 1613 | delete calendar; |
1614 | updateView(); | 1614 | updateView(); |
1615 | return syncOK; | 1615 | return syncOK; |
1616 | 1616 | ||
1617 | 1617 | ||
1618 | #endif | 1618 | #endif |
1619 | 1619 | ||
1620 | } | 1620 | } |
1621 | 1621 | ||
1622 | void CalendarView::setSyncEventsReadOnly() | 1622 | void CalendarView::setSyncEventsReadOnly() |
1623 | { | 1623 | { |
1624 | Event * ev; | 1624 | Event * ev; |
1625 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1625 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1626 | ev = eL.first(); | 1626 | ev = eL.first(); |
1627 | while ( ev ) { | 1627 | while ( ev ) { |
1628 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1628 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1629 | ev->setReadOnly( true ); | 1629 | ev->setReadOnly( true ); |
1630 | ev = eL.next(); | 1630 | ev = eL.next(); |
1631 | } | 1631 | } |
1632 | } | 1632 | } |
1633 | bool CalendarView::openCalendar(QString filename, bool merge) | 1633 | bool CalendarView::openCalendar(QString filename, bool merge) |
1634 | { | 1634 | { |
1635 | 1635 | ||
1636 | if (filename.isEmpty()) { | 1636 | if (filename.isEmpty()) { |
1637 | return false; | 1637 | return false; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | if (!QFile::exists(filename)) { | 1640 | if (!QFile::exists(filename)) { |
1641 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1641 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1642 | return false; | 1642 | return false; |
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | globalFlagBlockAgenda = 1; | 1645 | globalFlagBlockAgenda = 1; |
1646 | if (!merge) mCalendar->close(); | 1646 | if (!merge) mCalendar->close(); |
1647 | 1647 | ||
1648 | mStorage->setFileName( filename ); | 1648 | mStorage->setFileName( filename ); |
1649 | 1649 | ||
1650 | if ( mStorage->load() ) { | 1650 | if ( mStorage->load() ) { |
1651 | if ( merge ) ;//setModified( true ); | 1651 | if ( merge ) ;//setModified( true ); |
1652 | else { | 1652 | else { |
1653 | //setModified( true ); | 1653 | //setModified( true ); |
1654 | mViewManager->setDocumentId( filename ); | 1654 | mViewManager->setDocumentId( filename ); |
1655 | mDialogManager->setDocumentId( filename ); | 1655 | mDialogManager->setDocumentId( filename ); |
1656 | mTodoList->setDocumentId( filename ); | 1656 | mTodoList->setDocumentId( filename ); |
1657 | } | 1657 | } |
1658 | globalFlagBlockAgenda = 2; | 1658 | globalFlagBlockAgenda = 2; |
1659 | // if ( getLastSyncEvent() ) | 1659 | // if ( getLastSyncEvent() ) |
1660 | // getLastSyncEvent()->setReadOnly( true ); | 1660 | // getLastSyncEvent()->setReadOnly( true ); |
1661 | mCalendar->reInitAlarmSettings(); | 1661 | mCalendar->reInitAlarmSettings(); |
1662 | setSyncEventsReadOnly(); | 1662 | setSyncEventsReadOnly(); |
1663 | updateUnmanagedViews(); | 1663 | updateUnmanagedViews(); |
1664 | updateView(); | 1664 | updateView(); |
1665 | if ( filename != MainWindow::defaultFileName() ) { | 1665 | if ( filename != MainWindow::defaultFileName() ) { |
1666 | saveCalendar( MainWindow::defaultFileName() ); | 1666 | saveCalendar( MainWindow::defaultFileName() ); |
1667 | } else { | 1667 | } else { |
1668 | QFileInfo finf ( MainWindow::defaultFileName()); | 1668 | QFileInfo finf ( MainWindow::defaultFileName()); |
1669 | if ( finf.exists() ) { | 1669 | if ( finf.exists() ) { |
1670 | setLoadedFileVersion( finf.lastModified () ); | 1670 | setLoadedFileVersion( finf.lastModified () ); |
1671 | } | 1671 | } |
1672 | } | 1672 | } |
1673 | return true; | 1673 | return true; |
1674 | } else { | 1674 | } else { |
1675 | // while failing to load, the calendar object could | 1675 | // while failing to load, the calendar object could |
1676 | // have become partially populated. Clear it out. | 1676 | // have become partially populated. Clear it out. |
1677 | if ( !merge ) { | 1677 | if ( !merge ) { |
1678 | mCalendar->close(); | 1678 | mCalendar->close(); |
1679 | mViewManager->setDocumentId( filename ); | 1679 | mViewManager->setDocumentId( filename ); |
1680 | mDialogManager->setDocumentId( filename ); | 1680 | mDialogManager->setDocumentId( filename ); |
1681 | mTodoList->setDocumentId( filename ); | 1681 | mTodoList->setDocumentId( filename ); |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1684 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1685 | 1685 | ||
1686 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1686 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1687 | globalFlagBlockAgenda = 2; | 1687 | globalFlagBlockAgenda = 2; |
1688 | mCalendar->reInitAlarmSettings(); | 1688 | mCalendar->reInitAlarmSettings(); |
1689 | setSyncEventsReadOnly(); | 1689 | setSyncEventsReadOnly(); |
1690 | updateUnmanagedViews(); | 1690 | updateUnmanagedViews(); |
1691 | updateView(); | 1691 | updateView(); |
1692 | } | 1692 | } |
1693 | return false; | 1693 | return false; |
1694 | } | 1694 | } |
1695 | void CalendarView::showOpenError() | 1695 | void CalendarView::showOpenError() |
1696 | { | 1696 | { |
1697 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1697 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1698 | } | 1698 | } |
1699 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1699 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1700 | { | 1700 | { |
1701 | loadedFileVersion = dt; | 1701 | loadedFileVersion = dt; |
1702 | } | 1702 | } |
1703 | bool CalendarView::checkFileChanged(QString fn) | 1703 | bool CalendarView::checkFileChanged(QString fn) |
1704 | { | 1704 | { |
1705 | QFileInfo finf ( fn ); | 1705 | QFileInfo finf ( fn ); |
1706 | if ( !finf.exists() ) | 1706 | if ( !finf.exists() ) |
1707 | return true; | 1707 | return true; |
1708 | QDateTime dt = finf.lastModified (); | 1708 | QDateTime dt = finf.lastModified (); |
1709 | if ( dt <= loadedFileVersion ) | 1709 | if ( dt <= loadedFileVersion ) |
1710 | return false; | 1710 | return false; |
1711 | return true; | 1711 | return true; |
1712 | 1712 | ||
1713 | } | 1713 | } |
1714 | void CalendarView::watchSavedFile() | 1714 | void CalendarView::watchSavedFile() |
1715 | { | 1715 | { |
1716 | QFileInfo finf ( MainWindow::defaultFileName()); | 1716 | QFileInfo finf ( MainWindow::defaultFileName()); |
1717 | if ( !finf.exists() ) | 1717 | if ( !finf.exists() ) |
1718 | return; | 1718 | return; |
1719 | QDateTime dt = finf.lastModified (); | 1719 | QDateTime dt = finf.lastModified (); |
1720 | if ( dt < loadedFileVersion ) { | 1720 | if ( dt < loadedFileVersion ) { |
1721 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1721 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1722 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1722 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1723 | return; | 1723 | return; |
1724 | } | 1724 | } |
1725 | loadedFileVersion = dt; | 1725 | loadedFileVersion = dt; |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | bool CalendarView::checkFileVersion(QString fn) | 1728 | bool CalendarView::checkFileVersion(QString fn) |
1729 | { | 1729 | { |
1730 | QFileInfo finf ( fn ); | 1730 | QFileInfo finf ( fn ); |
1731 | if ( !finf.exists() ) | 1731 | if ( !finf.exists() ) |
1732 | return true; | 1732 | return true; |
1733 | QDateTime dt = finf.lastModified (); | 1733 | QDateTime dt = finf.lastModified (); |
1734 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1734 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1735 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1735 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1736 | if ( dt <= loadedFileVersion ) | 1736 | if ( dt <= loadedFileVersion ) |
1737 | return true; | 1737 | return true; |
1738 | 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, true)) , | 1738 | 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, true)) , |
1739 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1739 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1740 | i18n("Sync+save")); | 1740 | i18n("Sync+save")); |
1741 | 1741 | ||
1742 | if ( km == KMessageBox::Cancel ) | 1742 | if ( km == KMessageBox::Cancel ) |
1743 | return false; | 1743 | return false; |
1744 | if ( km == KMessageBox::Yes ) | 1744 | if ( km == KMessageBox::Yes ) |
1745 | return true; | 1745 | return true; |
1746 | 1746 | ||
1747 | setSyncDevice("deleteaftersync" ); | 1747 | setSyncDevice("deleteaftersync" ); |
1748 | mSyncManager->mAskForPreferences = true; | 1748 | mSyncManager->mAskForPreferences = true; |
1749 | mSyncManager->mSyncAlgoPrefs = 3; | 1749 | mSyncManager->mSyncAlgoPrefs = 3; |
1750 | mSyncManager->mWriteBackFile = false; | 1750 | mSyncManager->mWriteBackFile = false; |
1751 | mSyncManager->mWriteBackExistingOnly = false; | 1751 | mSyncManager->mWriteBackExistingOnly = false; |
1752 | mSyncManager->mShowSyncSummary = false; | 1752 | mSyncManager->mShowSyncSummary = false; |
1753 | syncCalendar( fn, 3 ); | 1753 | syncCalendar( fn, 3 ); |
1754 | Event * e = getLastSyncEvent(); | 1754 | Event * e = getLastSyncEvent(); |
1755 | mCalendar->deleteEvent ( e ); | 1755 | mCalendar->deleteEvent ( e ); |
1756 | updateView(); | 1756 | updateView(); |
1757 | return true; | 1757 | return true; |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | bool CalendarView::saveCalendar( QString filename ) | 1760 | bool CalendarView::saveCalendar( QString filename ) |
1761 | { | 1761 | { |
1762 | 1762 | ||
1763 | // Store back all unsaved data into calendar object | 1763 | // Store back all unsaved data into calendar object |
1764 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1764 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1765 | if ( mViewManager->currentView() ) | 1765 | if ( mViewManager->currentView() ) |
1766 | mViewManager->currentView()->flushView(); | 1766 | mViewManager->currentView()->flushView(); |
1767 | 1767 | ||
1768 | 1768 | ||
1769 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1769 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1770 | mStorage->setSaveFormat( new ICalFormat() ); | 1770 | mStorage->setSaveFormat( new ICalFormat() ); |
1771 | mStorage->setFileName( filename ); | 1771 | mStorage->setFileName( filename ); |
1772 | bool success; | 1772 | bool success; |
1773 | success = mStorage->save(); | 1773 | success = mStorage->save(); |
1774 | if ( !success ) { | 1774 | if ( !success ) { |
1775 | return false; | 1775 | return false; |
1776 | } | 1776 | } |
1777 | if ( filename == MainWindow::defaultFileName() ) { | 1777 | if ( filename == MainWindow::defaultFileName() ) { |
1778 | setLoadedFileVersion( lfv ); | 1778 | setLoadedFileVersion( lfv ); |
1779 | watchSavedFile(); | 1779 | watchSavedFile(); |
1780 | } | 1780 | } |
1781 | return true; | 1781 | return true; |
1782 | } | 1782 | } |
1783 | 1783 | ||
1784 | void CalendarView::closeCalendar() | 1784 | void CalendarView::closeCalendar() |
1785 | { | 1785 | { |
1786 | 1786 | ||
1787 | // child windows no longer valid | 1787 | // child windows no longer valid |
1788 | emit closingDown(); | 1788 | emit closingDown(); |
1789 | 1789 | ||
1790 | mCalendar->close(); | 1790 | mCalendar->close(); |
1791 | setModified(false); | 1791 | setModified(false); |
1792 | updateView(); | 1792 | updateView(); |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | void CalendarView::archiveCalendar() | 1795 | void CalendarView::archiveCalendar() |
1796 | { | 1796 | { |
1797 | mDialogManager->showArchiveDialog(); | 1797 | mDialogManager->showArchiveDialog(); |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | 1800 | ||
1801 | void CalendarView::readSettings() | 1801 | void CalendarView::readSettings() |
1802 | { | 1802 | { |
1803 | 1803 | ||
1804 | 1804 | ||
1805 | // mViewManager->showAgendaView(); | 1805 | // mViewManager->showAgendaView(); |
1806 | QString str; | 1806 | QString str; |
1807 | //qDebug("CalendarView::readSettings() "); | 1807 | //qDebug("CalendarView::readSettings() "); |
1808 | // read settings from the KConfig, supplying reasonable | 1808 | // read settings from the KConfig, supplying reasonable |
1809 | // defaults where none are to be found | 1809 | // defaults where none are to be found |
1810 | KConfig *config = KOGlobals::config(); | 1810 | KConfig *config = KOGlobals::config(); |
1811 | #ifndef KORG_NOSPLITTER | 1811 | #ifndef KORG_NOSPLITTER |
1812 | config->setGroup("KOrganizer Geometry"); | 1812 | config->setGroup("KOrganizer Geometry"); |
1813 | 1813 | ||
1814 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1814 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1815 | if (sizes.count() != 2) { | 1815 | if (sizes.count() != 2) { |
1816 | sizes << mDateNavigator->minimumSizeHint().width(); | 1816 | sizes << mDateNavigator->minimumSizeHint().width(); |
1817 | sizes << 300; | 1817 | sizes << 300; |
1818 | } | 1818 | } |
1819 | mPanner->setSizes(sizes); | 1819 | mPanner->setSizes(sizes); |
1820 | 1820 | ||
1821 | sizes = config->readIntListEntry("Separator2"); | 1821 | sizes = config->readIntListEntry("Separator2"); |
1822 | if ( ( mResourceView && sizes.count() == 4 ) || | 1822 | if ( ( mResourceView && sizes.count() == 4 ) || |
1823 | ( !mResourceView && sizes.count() == 3 ) ) { | 1823 | ( !mResourceView && sizes.count() == 3 ) ) { |
1824 | mLeftSplitter->setSizes(sizes); | 1824 | mLeftSplitter->setSizes(sizes); |
1825 | } | 1825 | } |
1826 | #endif | 1826 | #endif |
1827 | globalFlagBlockAgenda = 1; | 1827 | globalFlagBlockAgenda = 1; |
1828 | mViewManager->showAgendaView(); | 1828 | mViewManager->showAgendaView(); |
1829 | //mViewManager->readSettings( config ); | 1829 | //mViewManager->readSettings( config ); |
1830 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1830 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1831 | readFilterSettings(config); | 1831 | readFilterSettings(config); |
1832 | 1832 | ||
1833 | #ifdef DESKTOP_VERSION | 1833 | #ifdef DESKTOP_VERSION |
1834 | config->setGroup("WidgetLayout"); | 1834 | config->setGroup("WidgetLayout"); |
1835 | QStringList list; | 1835 | QStringList list; |
1836 | list = config->readListEntry("MainLayout"); | 1836 | list = config->readListEntry("MainLayout"); |
1837 | int x,y,w,h; | 1837 | int x,y,w,h; |
1838 | if ( ! list.isEmpty() ) { | 1838 | if ( ! list.isEmpty() ) { |
1839 | x = list[0].toInt(); | 1839 | x = list[0].toInt(); |
1840 | y = list[1].toInt(); | 1840 | y = list[1].toInt(); |
1841 | w = list[2].toInt(); | 1841 | w = list[2].toInt(); |
1842 | h = list[3].toInt(); | 1842 | h = list[3].toInt(); |
1843 | KApplication::testCoords( &x,&y,&w,&h ); | ||
1843 | topLevelWidget()->setGeometry(x,y,w,h); | 1844 | topLevelWidget()->setGeometry(x,y,w,h); |
1844 | 1845 | ||
1845 | } else { | 1846 | } else { |
1846 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1847 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1847 | } | 1848 | } |
1848 | list = config->readListEntry("EditEventLayout"); | 1849 | list = config->readListEntry("EditEventLayout"); |
1849 | if ( ! list.isEmpty() ) { | 1850 | if ( ! list.isEmpty() ) { |
1850 | x = list[0].toInt(); | 1851 | x = list[0].toInt(); |
1851 | y = list[1].toInt(); | 1852 | y = list[1].toInt(); |
1852 | w = list[2].toInt(); | 1853 | w = list[2].toInt(); |
1853 | h = list[3].toInt(); | 1854 | h = list[3].toInt(); |
1855 | KApplication::testCoords( &x,&y,&w,&h ); | ||
1854 | mEventEditor->setGeometry(x,y,w,h); | 1856 | mEventEditor->setGeometry(x,y,w,h); |
1855 | 1857 | ||
1856 | } | 1858 | } |
1857 | list = config->readListEntry("EditTodoLayout"); | 1859 | list = config->readListEntry("EditTodoLayout"); |
1858 | if ( ! list.isEmpty() ) { | 1860 | if ( ! list.isEmpty() ) { |
1859 | x = list[0].toInt(); | 1861 | x = list[0].toInt(); |
1860 | y = list[1].toInt(); | 1862 | y = list[1].toInt(); |
1861 | w = list[2].toInt(); | 1863 | w = list[2].toInt(); |
1862 | h = list[3].toInt(); | 1864 | h = list[3].toInt(); |
1865 | KApplication::testCoords( &x,&y,&w,&h ); | ||
1863 | mTodoEditor->setGeometry(x,y,w,h); | 1866 | mTodoEditor->setGeometry(x,y,w,h); |
1864 | 1867 | ||
1865 | } | 1868 | } |
1866 | list = config->readListEntry("ViewerLayout"); | 1869 | list = config->readListEntry("ViewerLayout"); |
1867 | if ( ! list.isEmpty() ) { | 1870 | if ( ! list.isEmpty() ) { |
1868 | x = list[0].toInt(); | 1871 | x = list[0].toInt(); |
1869 | y = list[1].toInt(); | 1872 | y = list[1].toInt(); |
1870 | w = list[2].toInt(); | 1873 | w = list[2].toInt(); |
1871 | h = list[3].toInt(); | 1874 | h = list[3].toInt(); |
1875 | KApplication::testCoords( &x,&y,&w,&h ); | ||
1872 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1876 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1873 | } | 1877 | } |
1874 | #endif | 1878 | #endif |
1875 | config->setGroup( "Views" ); | 1879 | config->setGroup( "Views" ); |
1876 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1880 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1877 | 1881 | ||
1878 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1882 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1879 | 1883 | ||
1880 | int resetval = 0; | 1884 | int resetval = 0; |
1881 | int maxVal = 0; | 1885 | int maxVal = 0; |
1882 | if (sizes.count() != 3) { | 1886 | if (sizes.count() != 3) { |
1883 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1887 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1884 | resetval = mDateNavigator->sizeHint().width()+2; | 1888 | resetval = mDateNavigator->sizeHint().width()+2; |
1885 | } else { | 1889 | } else { |
1886 | resetval = mDateNavigator->sizeHint().height()+2; | 1890 | resetval = mDateNavigator->sizeHint().height()+2; |
1887 | } | 1891 | } |
1888 | } | 1892 | } |
1889 | if ( resetval ) { | 1893 | if ( resetval ) { |
1890 | sizes.clear(); | 1894 | sizes.clear(); |
1891 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1895 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1892 | maxVal = QApplication::desktop()->width() -10; | 1896 | maxVal = QApplication::desktop()->width() -10; |
1893 | } else { | 1897 | } else { |
1894 | maxVal = QApplication::desktop()->height()-10; | 1898 | maxVal = QApplication::desktop()->height()-10; |
1895 | } | 1899 | } |
1896 | sizes << resetval; | 1900 | sizes << resetval; |
1897 | if ( maxVal < resetval + resetval) | 1901 | if ( maxVal < resetval + resetval) |
1898 | resetval = maxVal - resetval; | 1902 | resetval = maxVal - resetval; |
1899 | sizes << resetval; | 1903 | sizes << resetval; |
1900 | sizes << 100; | 1904 | sizes << 100; |
1901 | } | 1905 | } |
1902 | mLeftFrame->setSizes(sizes); | 1906 | mLeftFrame->setSizes(sizes); |
1903 | sizes = config->readIntListEntry("Main Splitter Frame"); | 1907 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1904 | resetval = 0; | 1908 | resetval = 0; |
1905 | maxVal = 0; | 1909 | maxVal = 0; |
1906 | if (sizes.count() != 2) { | 1910 | if (sizes.count() != 2) { |
1907 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1911 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1908 | resetval = mDateNavigator->sizeHint().width()+2; | 1912 | resetval = mDateNavigator->sizeHint().width()+2; |
1909 | } else { | 1913 | } else { |
1910 | resetval = mDateNavigator->sizeHint().height()+2; | 1914 | resetval = mDateNavigator->sizeHint().height()+2; |
1911 | } | 1915 | } |
1912 | } | 1916 | } |
1913 | if ( resetval ) { | 1917 | if ( resetval ) { |
1914 | sizes.clear(); | 1918 | sizes.clear(); |
1915 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1919 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1916 | maxVal = QApplication::desktop()->width() -10; | 1920 | maxVal = QApplication::desktop()->width() -10; |
1917 | } else { | 1921 | } else { |
1918 | maxVal = QApplication::desktop()->height()-10; | 1922 | maxVal = QApplication::desktop()->height()-10; |
1919 | } | 1923 | } |
1920 | sizes << resetval; | 1924 | sizes << resetval; |
1921 | if ( maxVal < resetval + resetval) | 1925 | if ( maxVal < resetval + resetval) |
1922 | resetval = maxVal - resetval; | 1926 | resetval = maxVal - resetval; |
1923 | sizes << resetval; | 1927 | sizes << resetval; |
1924 | } | 1928 | } |
1925 | mMainFrame->setSizes(sizes); | 1929 | mMainFrame->setSizes(sizes); |
1926 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1930 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1927 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1931 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1928 | else mNavigator->selectDates( dateCount ); | 1932 | else mNavigator->selectDates( dateCount ); |
1929 | // mViewManager->readSettings( config ); | 1933 | // mViewManager->readSettings( config ); |
1930 | updateConfig(); | 1934 | updateConfig(); |
1931 | globalFlagBlockAgenda = 2; | 1935 | globalFlagBlockAgenda = 2; |
1932 | mViewManager->readSettings( config ); | 1936 | mViewManager->readSettings( config ); |
1933 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 1937 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
1934 | } | 1938 | } |
1935 | 1939 | ||
1936 | 1940 | ||
1937 | void CalendarView::writeSettings() | 1941 | void CalendarView::writeSettings() |
1938 | { | 1942 | { |
1939 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1943 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1940 | 1944 | ||
1941 | KConfig *config = KOGlobals::config(); | 1945 | KConfig *config = KOGlobals::config(); |
1942 | 1946 | ||
1943 | mViewManager->writeSettings( config ); | 1947 | mViewManager->writeSettings( config ); |
1944 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1948 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1945 | mDialogManager->writeSettings( config ); | 1949 | mDialogManager->writeSettings( config ); |
1946 | //KOPrefs::instance()->usrWriteConfig(); | 1950 | //KOPrefs::instance()->usrWriteConfig(); |
1947 | KOPrefs::instance()->writeConfig(); | 1951 | KOPrefs::instance()->writeConfig(); |
1948 | 1952 | ||
1949 | writeFilterSettings(config); | 1953 | writeFilterSettings(config); |
1950 | 1954 | ||
1951 | config->setGroup( "Views" ); | 1955 | config->setGroup( "Views" ); |
1952 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1956 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1953 | 1957 | ||
1954 | QValueList<int> listINT = mLeftFrame->sizes(); | 1958 | QValueList<int> listINT = mLeftFrame->sizes(); |
1955 | config->writeEntry("Left Splitter Frame",listINT); | 1959 | config->writeEntry("Left Splitter Frame",listINT); |
1956 | QValueList<int> listINT2 = mMainFrame->sizes(); | 1960 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1957 | config->writeEntry("Main Splitter Frame",listINT2); | 1961 | config->writeEntry("Main Splitter Frame",listINT2); |
1958 | #ifdef DESKTOP_VERSION | 1962 | #ifdef DESKTOP_VERSION |
1959 | config->setGroup("WidgetLayout"); | 1963 | config->setGroup("WidgetLayout"); |
1960 | QStringList list ;//= config->readListEntry("MainLayout"); | 1964 | QStringList list ;//= config->readListEntry("MainLayout"); |
1961 | int x,y,w,h; | 1965 | int x,y,w,h; |
1962 | QWidget* wid; | 1966 | QWidget* wid; |
1963 | wid = topLevelWidget(); | 1967 | wid = topLevelWidget(); |
1964 | x = wid->geometry().x(); | 1968 | x = wid->geometry().x(); |
1965 | y = wid->geometry().y(); | 1969 | y = wid->geometry().y(); |
1966 | w = wid->width(); | 1970 | w = wid->width(); |
1967 | h = wid->height(); | 1971 | h = wid->height(); |
1968 | list.clear(); | 1972 | list.clear(); |
1969 | list << QString::number( x ); | 1973 | list << QString::number( x ); |
1970 | list << QString::number( y ); | 1974 | list << QString::number( y ); |
1971 | list << QString::number( w ); | 1975 | list << QString::number( w ); |
1972 | list << QString::number( h ); | 1976 | list << QString::number( h ); |
1973 | config->writeEntry("MainLayout",list ); | 1977 | config->writeEntry("MainLayout",list ); |
1974 | 1978 | ||
1975 | wid = mEventEditor; | 1979 | wid = mEventEditor; |
1976 | x = wid->geometry().x(); | 1980 | x = wid->geometry().x(); |
1977 | y = wid->geometry().y(); | 1981 | y = wid->geometry().y(); |
1978 | w = wid->width(); | 1982 | w = wid->width(); |
1979 | h = wid->height(); | 1983 | h = wid->height(); |
1980 | list.clear(); | 1984 | list.clear(); |
1981 | list << QString::number( x ); | 1985 | list << QString::number( x ); |
1982 | list << QString::number( y ); | 1986 | list << QString::number( y ); |
1983 | list << QString::number( w ); | 1987 | list << QString::number( w ); |
1984 | list << QString::number( h ); | 1988 | list << QString::number( h ); |
1985 | config->writeEntry("EditEventLayout",list ); | 1989 | config->writeEntry("EditEventLayout",list ); |
1986 | 1990 | ||
1987 | wid = mTodoEditor; | 1991 | wid = mTodoEditor; |
1988 | x = wid->geometry().x(); | 1992 | x = wid->geometry().x(); |
1989 | y = wid->geometry().y(); | 1993 | y = wid->geometry().y(); |
1990 | w = wid->width(); | 1994 | w = wid->width(); |
1991 | h = wid->height(); | 1995 | h = wid->height(); |
1992 | list.clear(); | 1996 | list.clear(); |
1993 | list << QString::number( x ); | 1997 | list << QString::number( x ); |
1994 | list << QString::number( y ); | 1998 | list << QString::number( y ); |
1995 | list << QString::number( w ); | 1999 | list << QString::number( w ); |
1996 | list << QString::number( h ); | 2000 | list << QString::number( h ); |
1997 | config->writeEntry("EditTodoLayout",list ); | 2001 | config->writeEntry("EditTodoLayout",list ); |
1998 | wid = getEventViewerDialog(); | 2002 | wid = getEventViewerDialog(); |
1999 | x = wid->geometry().x(); | 2003 | x = wid->geometry().x(); |
2000 | y = wid->geometry().y(); | 2004 | y = wid->geometry().y(); |
2001 | w = wid->width(); | 2005 | w = wid->width(); |
2002 | h = wid->height(); | 2006 | h = wid->height(); |
2003 | list.clear(); | 2007 | list.clear(); |
2004 | list << QString::number( x ); | 2008 | list << QString::number( x ); |
2005 | list << QString::number( y ); | 2009 | list << QString::number( y ); |
2006 | list << QString::number( w ); | 2010 | list << QString::number( w ); |
2007 | list << QString::number( h ); | 2011 | list << QString::number( h ); |
2008 | config->writeEntry("ViewerLayout",list ); | 2012 | config->writeEntry("ViewerLayout",list ); |
2009 | wid = mDialogManager->getSearchDialog(); | 2013 | wid = mDialogManager->getSearchDialog(); |
2010 | if ( wid ) { | 2014 | if ( wid ) { |
2011 | x = wid->geometry().x(); | 2015 | x = wid->geometry().x(); |
2012 | y = wid->geometry().y(); | 2016 | y = wid->geometry().y(); |
2013 | w = wid->width(); | 2017 | w = wid->width(); |
2014 | h = wid->height(); | 2018 | h = wid->height(); |
2015 | list.clear(); | 2019 | list.clear(); |
2016 | list << QString::number( x ); | 2020 | list << QString::number( x ); |
2017 | list << QString::number( y ); | 2021 | list << QString::number( y ); |
2018 | list << QString::number( w ); | 2022 | list << QString::number( w ); |
2019 | list << QString::number( h ); | 2023 | list << QString::number( h ); |
2020 | config->writeEntry("SearchLayout",list ); | 2024 | config->writeEntry("SearchLayout",list ); |
2021 | } | 2025 | } |
2022 | #endif | 2026 | #endif |
2023 | 2027 | ||
2024 | 2028 | ||
2025 | config->sync(); | 2029 | config->sync(); |
2026 | } | 2030 | } |
2027 | 2031 | ||
2028 | void CalendarView::readFilterSettings(KConfig *config) | 2032 | void CalendarView::readFilterSettings(KConfig *config) |
2029 | { | 2033 | { |
2030 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2034 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2031 | 2035 | ||
2032 | mFilters.clear(); | 2036 | mFilters.clear(); |
2033 | 2037 | ||
2034 | config->setGroup("General"); | 2038 | config->setGroup("General"); |
2035 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2039 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2036 | 2040 | ||
2037 | QStringList::ConstIterator it = filterList.begin(); | 2041 | QStringList::ConstIterator it = filterList.begin(); |
2038 | QStringList::ConstIterator end = filterList.end(); | 2042 | QStringList::ConstIterator end = filterList.end(); |
2039 | while(it != end) { | 2043 | while(it != end) { |
2040 | // kdDebug() << " filter: " << (*it) << endl; | 2044 | // kdDebug() << " filter: " << (*it) << endl; |
2041 | 2045 | ||
2042 | CalFilter *filter; | 2046 | CalFilter *filter; |
2043 | filter = new CalFilter(*it); | 2047 | filter = new CalFilter(*it); |
2044 | config->setGroup("Filter_" + (*it).utf8()); | 2048 | config->setGroup("Filter_" + (*it).utf8()); |
2045 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2049 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2046 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2050 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2047 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2051 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2048 | mFilters.append(filter); | 2052 | mFilters.append(filter); |
2049 | 2053 | ||
2050 | ++it; | 2054 | ++it; |
2051 | } | 2055 | } |
2052 | 2056 | ||
2053 | if (mFilters.count() == 0) { | 2057 | if (mFilters.count() == 0) { |
2054 | CalFilter *filter = new CalFilter(i18n("Default")); | 2058 | CalFilter *filter = new CalFilter(i18n("Default")); |
2055 | mFilters.append(filter); | 2059 | mFilters.append(filter); |
2056 | } | 2060 | } |
2057 | mFilterView->updateFilters(); | 2061 | mFilterView->updateFilters(); |
2058 | config->setGroup("FilterView"); | 2062 | config->setGroup("FilterView"); |
2059 | 2063 | ||
2060 | mFilterView->blockSignals(true); | 2064 | mFilterView->blockSignals(true); |
2061 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2065 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2062 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2066 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2063 | mFilterView->blockSignals(false); | 2067 | mFilterView->blockSignals(false); |
2064 | // We do it manually to avoid it being done twice by the above calls | 2068 | // We do it manually to avoid it being done twice by the above calls |
2065 | updateFilter(); | 2069 | updateFilter(); |
2066 | } | 2070 | } |
2067 | 2071 | ||
2068 | void CalendarView::writeFilterSettings(KConfig *config) | 2072 | void CalendarView::writeFilterSettings(KConfig *config) |
2069 | { | 2073 | { |
2070 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2074 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2071 | 2075 | ||
2072 | QStringList filterList; | 2076 | QStringList filterList; |
2073 | 2077 | ||
2074 | CalFilter *filter = mFilters.first(); | 2078 | CalFilter *filter = mFilters.first(); |
2075 | while(filter) { | 2079 | while(filter) { |
2076 | // kdDebug() << " fn: " << filter->name() << endl; | 2080 | // kdDebug() << " fn: " << filter->name() << endl; |
2077 | filterList << filter->name(); | 2081 | filterList << filter->name(); |
2078 | config->setGroup("Filter_" + filter->name().utf8()); | 2082 | config->setGroup("Filter_" + filter->name().utf8()); |
2079 | config->writeEntry("Criteria",filter->criteria()); | 2083 | config->writeEntry("Criteria",filter->criteria()); |
2080 | config->writeEntry("CategoryList",filter->categoryList()); | 2084 | config->writeEntry("CategoryList",filter->categoryList()); |
2081 | filter = mFilters.next(); | 2085 | filter = mFilters.next(); |
2082 | } | 2086 | } |
2083 | config->setGroup("General"); | 2087 | config->setGroup("General"); |
2084 | config->writeEntry("CalendarFilters",filterList); | 2088 | config->writeEntry("CalendarFilters",filterList); |
2085 | 2089 | ||
2086 | config->setGroup("FilterView"); | 2090 | config->setGroup("FilterView"); |
2087 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2091 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2088 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2092 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2089 | } | 2093 | } |
2090 | 2094 | ||
2091 | 2095 | ||
2092 | void CalendarView::goToday() | 2096 | void CalendarView::goToday() |
2093 | { | 2097 | { |
2094 | if ( mViewManager->currentView()->isMonthView() ) | 2098 | if ( mViewManager->currentView()->isMonthView() ) |
2095 | mNavigator->selectTodayMonth(); | 2099 | mNavigator->selectTodayMonth(); |
2096 | else | 2100 | else |
2097 | mNavigator->selectToday(); | 2101 | mNavigator->selectToday(); |
2098 | } | 2102 | } |
2099 | 2103 | ||
2100 | void CalendarView::goNext() | 2104 | void CalendarView::goNext() |
2101 | { | 2105 | { |
2102 | mNavigator->selectNext(); | 2106 | mNavigator->selectNext(); |
2103 | } | 2107 | } |
2104 | 2108 | ||
2105 | void CalendarView::goPrevious() | 2109 | void CalendarView::goPrevious() |
2106 | { | 2110 | { |
2107 | mNavigator->selectPrevious(); | 2111 | mNavigator->selectPrevious(); |
2108 | } | 2112 | } |
2109 | void CalendarView::goNextMonth() | 2113 | void CalendarView::goNextMonth() |
2110 | { | 2114 | { |
2111 | mNavigator->selectNextMonth(); | 2115 | mNavigator->selectNextMonth(); |
2112 | } | 2116 | } |
2113 | 2117 | ||
2114 | void CalendarView::goPreviousMonth() | 2118 | void CalendarView::goPreviousMonth() |
2115 | { | 2119 | { |
2116 | mNavigator->selectPreviousMonth(); | 2120 | mNavigator->selectPreviousMonth(); |
2117 | } | 2121 | } |
2118 | void CalendarView::writeLocale() | 2122 | void CalendarView::writeLocale() |
2119 | { | 2123 | { |
2120 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2124 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2121 | #if 0 | 2125 | #if 0 |
2122 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2126 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2123 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2127 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2124 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2128 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2125 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2129 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2126 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2130 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2127 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2131 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2128 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2132 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2129 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2133 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2130 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2134 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2131 | KOPrefs::instance()->mDaylightsavingStart, | 2135 | KOPrefs::instance()->mDaylightsavingStart, |
2132 | KOPrefs::instance()->mDaylightsavingEnd ); | 2136 | KOPrefs::instance()->mDaylightsavingEnd ); |
2133 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2137 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2134 | #endif | 2138 | #endif |
2135 | } | 2139 | } |
2136 | void CalendarView::updateConfig() | 2140 | void CalendarView::updateConfig() |
2137 | { | 2141 | { |
2138 | writeLocale(); | 2142 | writeLocale(); |
2139 | if ( KOPrefs::instance()->mUseAppColors ) | 2143 | if ( KOPrefs::instance()->mUseAppColors ) |
2140 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2144 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2141 | emit configChanged(); | 2145 | emit configChanged(); |
2142 | mTodoList->updateConfig(); | 2146 | mTodoList->updateConfig(); |
2143 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2147 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2144 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2148 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2145 | // To make the "fill window" configurations work | 2149 | // To make the "fill window" configurations work |
2146 | //mViewManager->raiseCurrentView(); | 2150 | //mViewManager->raiseCurrentView(); |
2147 | } | 2151 | } |
2148 | 2152 | ||
2149 | 2153 | ||
2150 | void CalendarView::eventChanged(Event *event) | 2154 | void CalendarView::eventChanged(Event *event) |
2151 | { | 2155 | { |
2152 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2156 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2153 | //updateUnmanagedViews(); | 2157 | //updateUnmanagedViews(); |
2154 | } | 2158 | } |
2155 | 2159 | ||
2156 | void CalendarView::eventAdded(Event *event) | 2160 | void CalendarView::eventAdded(Event *event) |
2157 | { | 2161 | { |
2158 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2162 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2159 | } | 2163 | } |
2160 | 2164 | ||
2161 | void CalendarView::eventToBeDeleted(Event *) | 2165 | void CalendarView::eventToBeDeleted(Event *) |
2162 | { | 2166 | { |
2163 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2167 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2164 | } | 2168 | } |
2165 | 2169 | ||
2166 | void CalendarView::eventDeleted() | 2170 | void CalendarView::eventDeleted() |
2167 | { | 2171 | { |
2168 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2172 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2169 | } | 2173 | } |
2170 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2174 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2171 | { | 2175 | { |
2172 | changeIncidenceDisplay((Incidence *)which, action); | 2176 | changeIncidenceDisplay((Incidence *)which, action); |
2173 | mDateNavigator->updateView(); //LR | 2177 | mDateNavigator->updateView(); //LR |
2174 | //mDialogManager->updateSearchDialog(); | 2178 | //mDialogManager->updateSearchDialog(); |
2175 | 2179 | ||
2176 | if (which) { | 2180 | if (which) { |
2177 | mViewManager->updateWNview(); | 2181 | mViewManager->updateWNview(); |
2178 | //mTodoList->updateView(); | 2182 | //mTodoList->updateView(); |
2179 | } | 2183 | } |
2180 | 2184 | ||
2181 | } | 2185 | } |
2182 | 2186 | ||
2183 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2187 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2184 | { | 2188 | { |
2185 | updateUnmanagedViews(); | 2189 | updateUnmanagedViews(); |
2186 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2190 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2187 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2191 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2188 | mCalendar->checkAlarmForIncidence( 0, true ); | 2192 | mCalendar->checkAlarmForIncidence( 0, true ); |
2189 | if ( mEventViewerDialog ) | 2193 | if ( mEventViewerDialog ) |
2190 | mEventViewerDialog->hide(); | 2194 | mEventViewerDialog->hide(); |
2191 | } | 2195 | } |
2192 | else | 2196 | else |
2193 | mCalendar->checkAlarmForIncidence( which , false ); | 2197 | mCalendar->checkAlarmForIncidence( which , false ); |
2194 | } | 2198 | } |
2195 | 2199 | ||
2196 | // most of the changeEventDisplays() right now just call the view's | 2200 | // most of the changeEventDisplays() right now just call the view's |
2197 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2201 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2198 | void CalendarView::changeEventDisplay(Event *which, int action) | 2202 | void CalendarView::changeEventDisplay(Event *which, int action) |
2199 | { | 2203 | { |
2200 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2204 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2201 | changeIncidenceDisplay((Incidence *)which, action); | 2205 | changeIncidenceDisplay((Incidence *)which, action); |
2202 | mDateNavigator->updateView(); | 2206 | mDateNavigator->updateView(); |
2203 | //mDialogManager->updateSearchDialog(); | 2207 | //mDialogManager->updateSearchDialog(); |
2204 | 2208 | ||
2205 | if (which) { | 2209 | if (which) { |
2206 | // If there is an event view visible update the display | 2210 | // If there is an event view visible update the display |
2207 | mViewManager->currentView()->changeEventDisplay(which,action); | 2211 | mViewManager->currentView()->changeEventDisplay(which,action); |
2208 | // TODO: check, if update needed | 2212 | // TODO: check, if update needed |
2209 | // if (which->getTodoStatus()) { | 2213 | // if (which->getTodoStatus()) { |
2210 | mTodoList->updateView(); | 2214 | mTodoList->updateView(); |
2211 | // } | 2215 | // } |
2212 | } else { | 2216 | } else { |
2213 | mViewManager->currentView()->updateView(); | 2217 | mViewManager->currentView()->updateView(); |
2214 | } | 2218 | } |
2215 | } | 2219 | } |
2216 | 2220 | ||
2217 | 2221 | ||
2218 | void CalendarView::updateTodoViews() | 2222 | void CalendarView::updateTodoViews() |
2219 | { | 2223 | { |
2220 | mTodoList->updateView(); | 2224 | mTodoList->updateView(); |
2221 | mViewManager->currentView()->updateView(); | 2225 | mViewManager->currentView()->updateView(); |
2222 | 2226 | ||
2223 | } | 2227 | } |
2224 | 2228 | ||
2225 | 2229 | ||
2226 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2230 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2227 | { | 2231 | { |
2228 | mTodoList->updateView(); | 2232 | mTodoList->updateView(); |
2229 | mViewManager->updateView(start, end); | 2233 | mViewManager->updateView(start, end); |
2230 | //mDateNavigator->updateView(); | 2234 | //mDateNavigator->updateView(); |
2231 | } | 2235 | } |
2232 | 2236 | ||
2233 | void CalendarView::updateView() | 2237 | void CalendarView::updateView() |
2234 | { | 2238 | { |
2235 | DateList tmpList = mNavigator->selectedDates(); | 2239 | DateList tmpList = mNavigator->selectedDates(); |
2236 | 2240 | ||
2237 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2241 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2238 | mTodoList->updateView(); | 2242 | mTodoList->updateView(); |
2239 | // We assume that the navigator only selects consecutive days. | 2243 | // We assume that the navigator only selects consecutive days. |
2240 | updateView( tmpList.first(), tmpList.last() ); | 2244 | updateView( tmpList.first(), tmpList.last() ); |
2241 | } | 2245 | } |
2242 | 2246 | ||
2243 | void CalendarView::updateUnmanagedViews() | 2247 | void CalendarView::updateUnmanagedViews() |
2244 | { | 2248 | { |
2245 | mDateNavigator->updateDayMatrix(); | 2249 | mDateNavigator->updateDayMatrix(); |
2246 | } | 2250 | } |
2247 | 2251 | ||
2248 | int CalendarView::msgItemDelete(const QString name) | 2252 | int CalendarView::msgItemDelete(const QString name) |
2249 | { | 2253 | { |
2250 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2254 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2251 | i18n("This item will be\npermanently deleted."), | 2255 | i18n("This item will be\npermanently deleted."), |
2252 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2256 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2253 | } | 2257 | } |
2254 | 2258 | ||
2255 | 2259 | ||
2256 | void CalendarView::edit_cut() | 2260 | void CalendarView::edit_cut() |
2257 | { | 2261 | { |
2258 | Event *anEvent=0; | 2262 | Event *anEvent=0; |
2259 | 2263 | ||
2260 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2264 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2261 | 2265 | ||
2262 | if (mViewManager->currentView()->isEventView()) { | 2266 | if (mViewManager->currentView()->isEventView()) { |
2263 | if ( incidence && incidence->type() == "Event" ) { | 2267 | if ( incidence && incidence->type() == "Event" ) { |
2264 | anEvent = static_cast<Event *>(incidence); | 2268 | anEvent = static_cast<Event *>(incidence); |
2265 | } | 2269 | } |
2266 | } | 2270 | } |
2267 | 2271 | ||
2268 | if (!anEvent) { | 2272 | if (!anEvent) { |
2269 | KNotifyClient::beep(); | 2273 | KNotifyClient::beep(); |
2270 | return; | 2274 | return; |
2271 | } | 2275 | } |
2272 | DndFactory factory( mCalendar ); | 2276 | DndFactory factory( mCalendar ); |
2273 | factory.cutIncidence(anEvent); | 2277 | factory.cutIncidence(anEvent); |
2274 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2278 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2275 | } | 2279 | } |
2276 | 2280 | ||
2277 | void CalendarView::edit_copy() | 2281 | void CalendarView::edit_copy() |
2278 | { | 2282 | { |
2279 | Event *anEvent=0; | 2283 | Event *anEvent=0; |
2280 | 2284 | ||
2281 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2285 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2282 | 2286 | ||
2283 | if (mViewManager->currentView()->isEventView()) { | 2287 | if (mViewManager->currentView()->isEventView()) { |
2284 | if ( incidence && incidence->type() == "Event" ) { | 2288 | if ( incidence && incidence->type() == "Event" ) { |
2285 | anEvent = static_cast<Event *>(incidence); | 2289 | anEvent = static_cast<Event *>(incidence); |
2286 | } | 2290 | } |
2287 | } | 2291 | } |
2288 | 2292 | ||
2289 | if (!anEvent) { | 2293 | if (!anEvent) { |
2290 | KNotifyClient::beep(); | 2294 | KNotifyClient::beep(); |
2291 | return; | 2295 | return; |
2292 | } | 2296 | } |
2293 | DndFactory factory( mCalendar ); | 2297 | DndFactory factory( mCalendar ); |
2294 | factory.copyIncidence(anEvent); | 2298 | factory.copyIncidence(anEvent); |
2295 | } | 2299 | } |
2296 | 2300 | ||
2297 | void CalendarView::edit_paste() | 2301 | void CalendarView::edit_paste() |
2298 | { | 2302 | { |
2299 | QDate date = mNavigator->selectedDates().first(); | 2303 | QDate date = mNavigator->selectedDates().first(); |
2300 | 2304 | ||
2301 | DndFactory factory( mCalendar ); | 2305 | DndFactory factory( mCalendar ); |
2302 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2306 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2303 | 2307 | ||
2304 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2308 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2305 | } | 2309 | } |
2306 | 2310 | ||
2307 | void CalendarView::edit_options() | 2311 | void CalendarView::edit_options() |
2308 | { | 2312 | { |
2309 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2313 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2310 | emit save(); | 2314 | emit save(); |
2311 | emit saveStopTimer(); | 2315 | emit saveStopTimer(); |
2312 | mDialogManager->showOptionsDialog(); | 2316 | mDialogManager->showOptionsDialog(); |
2313 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2317 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2314 | emit saveStopTimer(); | 2318 | emit saveStopTimer(); |
2315 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2319 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2316 | i18n("Timezone settings"),i18n("Reload"))) { | 2320 | i18n("Timezone settings"),i18n("Reload"))) { |
2317 | qDebug("KO: TZ reload cancelled "); | 2321 | qDebug("KO: TZ reload cancelled "); |
2318 | return; | 2322 | return; |
2319 | } | 2323 | } |
2320 | qDebug("KO: Timezone change "); | 2324 | qDebug("KO: Timezone change "); |
2321 | openCalendar( MainWindow::defaultFileName() ); | 2325 | openCalendar( MainWindow::defaultFileName() ); |
2322 | setModified(true); | 2326 | setModified(true); |
2323 | } | 2327 | } |
2324 | else | 2328 | else |
2325 | qDebug("KO: No tz change "); | 2329 | qDebug("KO: No tz change "); |
2326 | 2330 | ||
2327 | } | 2331 | } |
2328 | 2332 | ||
2329 | 2333 | ||
2330 | void CalendarView::slotSelectPickerDate( QDate d) | 2334 | void CalendarView::slotSelectPickerDate( QDate d) |
2331 | { | 2335 | { |
2332 | mDateFrame->hide(); | 2336 | mDateFrame->hide(); |
2333 | if ( mDatePickerMode == 1 ) { | 2337 | if ( mDatePickerMode == 1 ) { |
2334 | mNavigator->slotDaySelect( d ); | 2338 | mNavigator->slotDaySelect( d ); |
2335 | } else if ( mDatePickerMode == 2 ) { | 2339 | } else if ( mDatePickerMode == 2 ) { |
2336 | if ( mMoveIncidence->type() == "Todo" ) { | 2340 | if ( mMoveIncidence->type() == "Todo" ) { |
2337 | Todo * to = (Todo *) mMoveIncidence; | 2341 | Todo * to = (Todo *) mMoveIncidence; |
2338 | QTime tim; | 2342 | QTime tim; |
2339 | int len = 0; | 2343 | int len = 0; |
2340 | if ( to->hasStartDate() && to->hasDueDate() ) | 2344 | if ( to->hasStartDate() && to->hasDueDate() ) |
2341 | len = to->dtStart().secsTo( to->dtDue()); | 2345 | len = to->dtStart().secsTo( to->dtDue()); |
2342 | if ( to->hasDueDate() ) | 2346 | if ( to->hasDueDate() ) |
2343 | tim = to->dtDue().time(); | 2347 | tim = to->dtDue().time(); |
2344 | else { | 2348 | else { |
2345 | tim = QTime ( 0,0,0 ); | 2349 | tim = QTime ( 0,0,0 ); |
2346 | to->setFloats( true ); | 2350 | to->setFloats( true ); |
2347 | to->setHasDueDate( true ); | 2351 | to->setHasDueDate( true ); |
2348 | } | 2352 | } |
2349 | QDateTime dt ( d,tim ); | 2353 | QDateTime dt ( d,tim ); |
2350 | to->setDtDue( dt ); | 2354 | to->setDtDue( dt ); |
2351 | 2355 | ||
2352 | if ( to->hasStartDate() ) { | 2356 | if ( to->hasStartDate() ) { |
2353 | if ( len>0 ) | 2357 | if ( len>0 ) |
2354 | to->setDtStart(to->dtDue().addSecs( -len )); | 2358 | to->setDtStart(to->dtDue().addSecs( -len )); |
2355 | else | 2359 | else |
2356 | if (to->dtStart() > to->dtDue() ) | 2360 | if (to->dtStart() > to->dtDue() ) |
2357 | to->setDtStart(to->dtDue().addDays( -3 )); | 2361 | to->setDtStart(to->dtDue().addDays( -3 )); |
2358 | } | 2362 | } |
2359 | 2363 | ||
2360 | todoChanged( to ); | 2364 | todoChanged( to ); |
2361 | } else { | 2365 | } else { |
2362 | if ( mMoveIncidence->doesRecur() ) { | 2366 | if ( mMoveIncidence->doesRecur() ) { |
2363 | #if 0 | 2367 | #if 0 |
2364 | // PENDING implement this | 2368 | // PENDING implement this |
2365 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2369 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2366 | mCalendar()->addIncidence( newInc ); | 2370 | mCalendar()->addIncidence( newInc ); |
2367 | if ( mMoveIncidence->type() == "Todo" ) | 2371 | if ( mMoveIncidence->type() == "Todo" ) |
2368 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2372 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2369 | else | 2373 | else |
2370 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2374 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2371 | mMoveIncidence = newInc; | 2375 | mMoveIncidence = newInc; |
2372 | 2376 | ||
2373 | #endif | 2377 | #endif |
2374 | } | 2378 | } |
2375 | QTime tim = mMoveIncidence->dtStart().time(); | 2379 | QTime tim = mMoveIncidence->dtStart().time(); |
2376 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2380 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2377 | QDateTime dt ( d,tim ); | 2381 | QDateTime dt ( d,tim ); |
2378 | mMoveIncidence->setDtStart( dt ); | 2382 | mMoveIncidence->setDtStart( dt ); |
2379 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2383 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2380 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2384 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2381 | } | 2385 | } |
2382 | 2386 | ||
2383 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2387 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index a8652ea..c927b37 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp | |||
@@ -1,350 +1,352 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <libkdepim/categoryeditdialog.h> | 22 | #include <libkdepim/categoryeditdialog.h> |
23 | 23 | ||
24 | #include "calendarview.h" | 24 | #include "calendarview.h" |
25 | #include "incomingdialog.h" | 25 | #include "incomingdialog.h" |
26 | #include "outgoingdialog.h" | 26 | #include "outgoingdialog.h" |
27 | #include "koprefsdialog.h" | 27 | #include "koprefsdialog.h" |
28 | #include "koeventeditor.h" | 28 | #include "koeventeditor.h" |
29 | #include "koprefs.h" | 29 | #include "koprefs.h" |
30 | #include "datenavigator.h" | 30 | #include "datenavigator.h" |
31 | #include "kotodoeditor.h" | 31 | #include "kotodoeditor.h" |
32 | #include "searchdialog.h" | 32 | #include "searchdialog.h" |
33 | #include "filtereditdialog.h" | 33 | #include "filtereditdialog.h" |
34 | #ifndef KORG_NOPLUGINS | 34 | #ifndef KORG_NOPLUGINS |
35 | #include "plugindialog.h" | 35 | #include "plugindialog.h" |
36 | #endif | 36 | #endif |
37 | #ifndef KORG_NOARCHIVE | 37 | #ifndef KORG_NOARCHIVE |
38 | #include "archivedialog.h" | 38 | #include "archivedialog.h" |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include "kconfig.h" | 41 | #include "kconfig.h" |
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include <kapplication.h> | ||
43 | 44 | ||
44 | KODialogManager::KODialogManager( CalendarView *mainView ) : | 45 | KODialogManager::KODialogManager( CalendarView *mainView ) : |
45 | QObject(), mMainView( mainView ) | 46 | QObject(), mMainView( mainView ) |
46 | { | 47 | { |
47 | mOutgoingDialog = 0; | 48 | mOutgoingDialog = 0; |
48 | mIncomingDialog = 0; | 49 | mIncomingDialog = 0; |
49 | mOptionsDialog = 0; | 50 | mOptionsDialog = 0; |
50 | mSearchDialog = 0; | 51 | mSearchDialog = 0; |
51 | mArchiveDialog = 0; | 52 | mArchiveDialog = 0; |
52 | mFilterEditDialog = 0; | 53 | mFilterEditDialog = 0; |
53 | mPluginDialog = 0; | 54 | mPluginDialog = 0; |
54 | 55 | ||
55 | // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); | 56 | // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); |
56 | //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); | 57 | //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); |
57 | } | 58 | } |
58 | 59 | ||
59 | KODialogManager::~KODialogManager() | 60 | KODialogManager::~KODialogManager() |
60 | { | 61 | { |
61 | delete mOutgoingDialog; | 62 | delete mOutgoingDialog; |
62 | delete mIncomingDialog; | 63 | delete mIncomingDialog; |
63 | delete mOptionsDialog; | 64 | delete mOptionsDialog; |
64 | delete mSearchDialog; | 65 | delete mSearchDialog; |
65 | #ifndef KORG_NOARCHIVE | 66 | #ifndef KORG_NOARCHIVE |
66 | delete mArchiveDialog; | 67 | delete mArchiveDialog; |
67 | #endif | 68 | #endif |
68 | delete mFilterEditDialog; | 69 | delete mFilterEditDialog; |
69 | #ifndef KORG_NOPLUGINS | 70 | #ifndef KORG_NOPLUGINS |
70 | delete mPluginDialog; | 71 | delete mPluginDialog; |
71 | #endif | 72 | #endif |
72 | } | 73 | } |
73 | 74 | ||
74 | OutgoingDialog *KODialogManager::outgoingDialog() | 75 | OutgoingDialog *KODialogManager::outgoingDialog() |
75 | { | 76 | { |
76 | createOutgoingDialog(); | 77 | createOutgoingDialog(); |
77 | return mOutgoingDialog; | 78 | return mOutgoingDialog; |
78 | } | 79 | } |
79 | 80 | ||
80 | void KODialogManager::createOutgoingDialog() | 81 | void KODialogManager::createOutgoingDialog() |
81 | { | 82 | { |
82 | if (!mOutgoingDialog) { | 83 | if (!mOutgoingDialog) { |
83 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); | 84 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); |
84 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); | 85 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); |
85 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), | 86 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), |
86 | mMainView,SIGNAL(numOutgoingChanged(int))); | 87 | mMainView,SIGNAL(numOutgoingChanged(int))); |
87 | } | 88 | } |
88 | } | 89 | } |
89 | 90 | ||
90 | void KODialogManager::showOptionsDialog( bool showSync ) | 91 | void KODialogManager::showOptionsDialog( bool showSync ) |
91 | { | 92 | { |
92 | 93 | ||
93 | if (!mOptionsDialog) { | 94 | if (!mOptionsDialog) { |
94 | mOptionsDialog = new KOPrefsDialog(mMainView); | 95 | mOptionsDialog = new KOPrefsDialog(mMainView); |
95 | //mOptionsDialog->readConfig(); | 96 | //mOptionsDialog->readConfig(); |
96 | connect(mOptionsDialog,SIGNAL(configChanged()), | 97 | connect(mOptionsDialog,SIGNAL(configChanged()), |
97 | mMainView,SLOT(updateConfig())); | 98 | mMainView,SLOT(updateConfig())); |
98 | //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 99 | //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
99 | // mOptionsDialog,SLOT(updateCategories())); | 100 | // mOptionsDialog,SLOT(updateCategories())); |
100 | 101 | ||
101 | } | 102 | } |
102 | mOptionsDialog->readConfig(); | 103 | mOptionsDialog->readConfig(); |
103 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
104 | mOptionsDialog->showMaximized(); | 105 | mOptionsDialog->showMaximized(); |
105 | #else | 106 | #else |
106 | mOptionsDialog->show(); | 107 | mOptionsDialog->show(); |
107 | #endif | 108 | #endif |
108 | if ( showSync ) | 109 | if ( showSync ) |
109 | mOptionsDialog->showSyncPage(); | 110 | mOptionsDialog->showSyncPage(); |
110 | mOptionsDialog->exec(); | 111 | mOptionsDialog->exec(); |
111 | 112 | ||
112 | } | 113 | } |
113 | void KODialogManager::showSyncOptions() | 114 | void KODialogManager::showSyncOptions() |
114 | { | 115 | { |
115 | showOptionsDialog( true ); | 116 | showOptionsDialog( true ); |
116 | 117 | ||
117 | } | 118 | } |
118 | void KODialogManager::showOutgoingDialog() | 119 | void KODialogManager::showOutgoingDialog() |
119 | { | 120 | { |
120 | createOutgoingDialog(); | 121 | createOutgoingDialog(); |
121 | mOutgoingDialog->show(); | 122 | mOutgoingDialog->show(); |
122 | mOutgoingDialog->raise(); | 123 | mOutgoingDialog->raise(); |
123 | } | 124 | } |
124 | 125 | ||
125 | IncomingDialog *KODialogManager::incomingDialog() | 126 | IncomingDialog *KODialogManager::incomingDialog() |
126 | { | 127 | { |
127 | createOutgoingDialog(); | 128 | createOutgoingDialog(); |
128 | if (!mIncomingDialog) { | 129 | if (!mIncomingDialog) { |
129 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); | 130 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); |
130 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), | 131 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), |
131 | mMainView,SIGNAL(numIncomingChanged(int))); | 132 | mMainView,SIGNAL(numIncomingChanged(int))); |
132 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), | 133 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), |
133 | mMainView,SLOT(updateView())); | 134 | mMainView,SLOT(updateView())); |
134 | } | 135 | } |
135 | return mIncomingDialog; | 136 | return mIncomingDialog; |
136 | } | 137 | } |
137 | 138 | ||
138 | void KODialogManager::createIncomingDialog() | 139 | void KODialogManager::createIncomingDialog() |
139 | { | 140 | { |
140 | createOutgoingDialog(); | 141 | createOutgoingDialog(); |
141 | if (!mIncomingDialog) { | 142 | if (!mIncomingDialog) { |
142 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); | 143 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); |
143 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), | 144 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), |
144 | mMainView,SIGNAL(numIncomingChanged(int))); | 145 | mMainView,SIGNAL(numIncomingChanged(int))); |
145 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), | 146 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), |
146 | mMainView,SLOT(updateView())); | 147 | mMainView,SLOT(updateView())); |
147 | } | 148 | } |
148 | } | 149 | } |
149 | 150 | ||
150 | void KODialogManager::showIncomingDialog() | 151 | void KODialogManager::showIncomingDialog() |
151 | { | 152 | { |
152 | createIncomingDialog(); | 153 | createIncomingDialog(); |
153 | mIncomingDialog->show(); | 154 | mIncomingDialog->show(); |
154 | mIncomingDialog->raise(); | 155 | mIncomingDialog->raise(); |
155 | } | 156 | } |
156 | /* | 157 | /* |
157 | void KODialogManager::showCategoryEditDialog() | 158 | void KODialogManager::showCategoryEditDialog() |
158 | { | 159 | { |
159 | mCategoryEditDialog->show(); | 160 | mCategoryEditDialog->show(); |
160 | } | 161 | } |
161 | */ | 162 | */ |
162 | void KODialogManager::hideSearchDialog() | 163 | void KODialogManager::hideSearchDialog() |
163 | { | 164 | { |
164 | if (mSearchDialog) | 165 | if (mSearchDialog) |
165 | mSearchDialog->hide(); | 166 | mSearchDialog->hide(); |
166 | } | 167 | } |
167 | 168 | ||
168 | void KODialogManager::showSearchDialog() | 169 | void KODialogManager::showSearchDialog() |
169 | { | 170 | { |
170 | if (!mSearchDialog) { | 171 | if (!mSearchDialog) { |
171 | mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); | 172 | mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); |
172 | KOListView * lview = mSearchDialog->listview(); | 173 | KOListView * lview = mSearchDialog->listview(); |
173 | 174 | ||
174 | connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), | 175 | connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), |
175 | mMainView, SLOT(showIncidence(Incidence *))); | 176 | mMainView, SLOT(showIncidence(Incidence *))); |
176 | connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), | 177 | connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), |
177 | mMainView, SLOT(editIncidence(Incidence *))); | 178 | mMainView, SLOT(editIncidence(Incidence *))); |
178 | connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), | 179 | connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), |
179 | mMainView, SLOT(deleteIncidence(Incidence *))); | 180 | mMainView, SLOT(deleteIncidence(Incidence *))); |
180 | connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), | 181 | connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), |
181 | mMainView, SLOT(cloneIncidence(Incidence *))); | 182 | mMainView, SLOT(cloneIncidence(Incidence *))); |
182 | connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), | 183 | connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), |
183 | mMainView, SLOT(beamIncidence(Incidence *))); | 184 | mMainView, SLOT(beamIncidence(Incidence *))); |
184 | connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), | 185 | connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), |
185 | mMainView, SLOT(moveIncidence(Incidence *))); | 186 | mMainView, SLOT(moveIncidence(Incidence *))); |
186 | connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), | 187 | connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), |
187 | mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); | 188 | mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); |
188 | 189 | ||
189 | connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); | 190 | connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); |
190 | connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); | 191 | connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); |
191 | // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), | 192 | // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), |
192 | // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 193 | // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
193 | #ifndef DESKTOP_VERSION | 194 | #ifndef DESKTOP_VERSION |
194 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); | 195 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); |
195 | mSearchDialog->showMaximized(); | 196 | mSearchDialog->showMaximized(); |
196 | #else | 197 | #else |
197 | KConfig *config = KOGlobals::config(); | 198 | KConfig *config = KOGlobals::config(); |
198 | config->setGroup("WidgetLayout"); | 199 | config->setGroup("WidgetLayout"); |
199 | QStringList list; | 200 | QStringList list; |
200 | list = config->readListEntry("SearchLayout"); | 201 | list = config->readListEntry("SearchLayout"); |
201 | int x,y,w,h; | 202 | int x,y,w,h; |
202 | if ( ! list.isEmpty() ) { | 203 | if ( ! list.isEmpty() ) { |
203 | x = list[0].toInt(); | 204 | x = list[0].toInt(); |
204 | y = list[1].toInt(); | 205 | y = list[1].toInt(); |
205 | w = list[2].toInt(); | 206 | w = list[2].toInt(); |
206 | h = list[3].toInt(); | 207 | h = list[3].toInt(); |
208 | KApplication::testCoords( &x,&y,&w,&h ); | ||
207 | mSearchDialog->setGeometry(x,y,w,h); | 209 | mSearchDialog->setGeometry(x,y,w,h); |
208 | 210 | ||
209 | } | 211 | } |
210 | 212 | ||
211 | #endif | 213 | #endif |
212 | } | 214 | } |
213 | // make sure the widget is on top again | 215 | // make sure the widget is on top again |
214 | #ifdef DESKTOP_VERSION | 216 | #ifdef DESKTOP_VERSION |
215 | mSearchDialog->show(); | 217 | mSearchDialog->show(); |
216 | #else | 218 | #else |
217 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); | 219 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); |
218 | mSearchDialog->showMaximized(); | 220 | mSearchDialog->showMaximized(); |
219 | #endif | 221 | #endif |
220 | mSearchDialog->raise(); | 222 | mSearchDialog->raiseAndSelect(); |
221 | } | 223 | } |
222 | 224 | ||
223 | SearchDialog * KODialogManager::getSearchDialog() | 225 | SearchDialog * KODialogManager::getSearchDialog() |
224 | { | 226 | { |
225 | return mSearchDialog; | 227 | return mSearchDialog; |
226 | } | 228 | } |
227 | void KODialogManager::showArchiveDialog() | 229 | void KODialogManager::showArchiveDialog() |
228 | { | 230 | { |
229 | #ifndef KORG_NOARCHIVE | 231 | #ifndef KORG_NOARCHIVE |
230 | if (!mArchiveDialog) { | 232 | if (!mArchiveDialog) { |
231 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); | 233 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); |
232 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), | 234 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), |
233 | mMainView,SLOT(updateView())); | 235 | mMainView,SLOT(updateView())); |
234 | } | 236 | } |
235 | mArchiveDialog->show(); | 237 | mArchiveDialog->show(); |
236 | mArchiveDialog->raise(); | 238 | mArchiveDialog->raise(); |
237 | 239 | ||
238 | // Workaround. | 240 | // Workaround. |
239 | QApplication::restoreOverrideCursor(); | 241 | QApplication::restoreOverrideCursor(); |
240 | #endif | 242 | #endif |
241 | } | 243 | } |
242 | 244 | ||
243 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) | 245 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) |
244 | { | 246 | { |
245 | if (!mFilterEditDialog) { | 247 | if (!mFilterEditDialog) { |
246 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); | 248 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); |
247 | connect(mFilterEditDialog,SIGNAL(filterChanged()), | 249 | connect(mFilterEditDialog,SIGNAL(filterChanged()), |
248 | mMainView,SLOT(filterEdited())); | 250 | mMainView,SLOT(filterEdited())); |
249 | 251 | ||
250 | } | 252 | } |
251 | 253 | ||
252 | #ifndef DESKTOP_VERSION | 254 | #ifndef DESKTOP_VERSION |
253 | mFilterEditDialog->showMaximized(); | 255 | mFilterEditDialog->showMaximized(); |
254 | #else | 256 | #else |
255 | mFilterEditDialog->show(); | 257 | mFilterEditDialog->show(); |
256 | #endif | 258 | #endif |
257 | mFilterEditDialog->raise(); | 259 | mFilterEditDialog->raise(); |
258 | } | 260 | } |
259 | 261 | ||
260 | void KODialogManager::showPluginDialog() | 262 | void KODialogManager::showPluginDialog() |
261 | { | 263 | { |
262 | #ifndef KORG_NOPLUGINS | 264 | #ifndef KORG_NOPLUGINS |
263 | if (!mPluginDialog) { | 265 | if (!mPluginDialog) { |
264 | mPluginDialog = new PluginDialog(mMainView); | 266 | mPluginDialog = new PluginDialog(mMainView); |
265 | connect(mPluginDialog,SIGNAL(configChanged()), | 267 | connect(mPluginDialog,SIGNAL(configChanged()), |
266 | mMainView,SLOT(updateConfig())); | 268 | mMainView,SLOT(updateConfig())); |
267 | } | 269 | } |
268 | mPluginDialog->show(); | 270 | mPluginDialog->show(); |
269 | mPluginDialog->raise(); | 271 | mPluginDialog->raise(); |
270 | #endif | 272 | #endif |
271 | } | 273 | } |
272 | 274 | ||
273 | KOEventEditor *KODialogManager::getEventEditor() | 275 | KOEventEditor *KODialogManager::getEventEditor() |
274 | { | 276 | { |
275 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), | 277 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), |
276 | mMainView ); | 278 | mMainView ); |
277 | 279 | ||
278 | connect(eventEditor,SIGNAL(eventAdded(Event *)), | 280 | connect(eventEditor,SIGNAL(eventAdded(Event *)), |
279 | mMainView,SLOT(eventAdded(Event *))); | 281 | mMainView,SLOT(eventAdded(Event *))); |
280 | connect(eventEditor,SIGNAL(eventChanged(Event *)), | 282 | connect(eventEditor,SIGNAL(eventChanged(Event *)), |
281 | mMainView,SLOT(eventChanged(Event *))); | 283 | mMainView,SLOT(eventChanged(Event *))); |
282 | connect(eventEditor,SIGNAL(eventDeleted()), | 284 | connect(eventEditor,SIGNAL(eventDeleted()), |
283 | mMainView,SLOT(eventDeleted())); | 285 | mMainView,SLOT(eventDeleted())); |
284 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), | 286 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), |
285 | mMainView,SLOT(schedule_cancel(Incidence *))); | 287 | mMainView,SLOT(schedule_cancel(Incidence *))); |
286 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), | 288 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), |
287 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 289 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
288 | connect( eventEditor, SIGNAL( showAgendaView( bool)), | 290 | connect( eventEditor, SIGNAL( showAgendaView( bool)), |
289 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 291 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
290 | 292 | ||
291 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 293 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
292 | // eventEditor,SLOT(updateCategoryConfig())); | 294 | // eventEditor,SLOT(updateCategoryConfig())); |
293 | // connect(eventEditor,SIGNAL(editCategories()), | 295 | // connect(eventEditor,SIGNAL(editCategories()), |
294 | // mCategoryEditDialog,SLOT(show())); | 296 | // mCategoryEditDialog,SLOT(show())); |
295 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), | 297 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), |
296 | mMainView,SLOT(dialogClosing(Incidence*))); | 298 | mMainView,SLOT(dialogClosing(Incidence*))); |
297 | 299 | ||
298 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); | 300 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); |
299 | 301 | ||
300 | #ifndef DESKTOP_VERSION | 302 | #ifndef DESKTOP_VERSION |
301 | eventEditor->resize( QApplication::desktop()->width() -20, 100 ); | 303 | eventEditor->resize( QApplication::desktop()->width() -20, 100 ); |
302 | #endif | 304 | #endif |
303 | return eventEditor; | 305 | return eventEditor; |
304 | } | 306 | } |
305 | 307 | ||
306 | KOTodoEditor *KODialogManager::getTodoEditor() | 308 | KOTodoEditor *KODialogManager::getTodoEditor() |
307 | { | 309 | { |
308 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), | 310 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), |
309 | mMainView ); | 311 | mMainView ); |
310 | 312 | ||
311 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 313 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
312 | // todoEditor,SLOT(updateCategoryConfig())); | 314 | // todoEditor,SLOT(updateCategoryConfig())); |
313 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); | 315 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); |
314 | 316 | ||
315 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), | 317 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), |
316 | mMainView,SLOT(todoAdded(Todo *))); | 318 | mMainView,SLOT(todoAdded(Todo *))); |
317 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), | 319 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), |
318 | mMainView,SLOT(todoChanged(Todo *))); | 320 | mMainView,SLOT(todoChanged(Todo *))); |
319 | connect(todoEditor,SIGNAL(todoDeleted()), | 321 | connect(todoEditor,SIGNAL(todoDeleted()), |
320 | mMainView,SLOT(todoDeleted())); | 322 | mMainView,SLOT(todoDeleted())); |
321 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), | 323 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), |
322 | mMainView,SLOT(dialogClosing(Incidence*))); | 324 | mMainView,SLOT(dialogClosing(Incidence*))); |
323 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), | 325 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), |
324 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 326 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
325 | connect( todoEditor, SIGNAL( showAgendaView( bool)), | 327 | connect( todoEditor, SIGNAL( showAgendaView( bool)), |
326 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 328 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
327 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), | 329 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), |
328 | // mMainView,SLOT(schedule_cancel(Incidence *))); | 330 | // mMainView,SLOT(schedule_cancel(Incidence *))); |
329 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); | 331 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); |
330 | #ifndef DESKTOP_VERSION | 332 | #ifndef DESKTOP_VERSION |
331 | todoEditor->resize( QApplication::desktop()->width() -20, 100 ); | 333 | todoEditor->resize( QApplication::desktop()->width() -20, 100 ); |
332 | #endif | 334 | #endif |
333 | return todoEditor; | 335 | return todoEditor; |
334 | } | 336 | } |
335 | 337 | ||
336 | void KODialogManager::updateSearchDialog() | 338 | void KODialogManager::updateSearchDialog() |
337 | { | 339 | { |
338 | if (mSearchDialog) mSearchDialog->updateView(); | 340 | if (mSearchDialog) mSearchDialog->updateView(); |
339 | } | 341 | } |
340 | 342 | ||
341 | void KODialogManager::setDocumentId( const QString &id ) | 343 | void KODialogManager::setDocumentId( const QString &id ) |
342 | { | 344 | { |
343 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); | 345 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); |
344 | } | 346 | } |
345 | 347 | ||
346 | void KODialogManager::writeSettings( KConfig *config ) | 348 | void KODialogManager::writeSettings( KConfig *config ) |
347 | { | 349 | { |
348 | if (mSearchDialog) | 350 | if (mSearchDialog) |
349 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); | 351 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); |
350 | } | 352 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 3a07348..cf8dae6 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,305 +1,316 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | #define VIEW_WN_VIEW 1 | ||
36 | #define VIEW_NX_VIEW 2 | ||
37 | #define VIEW_J_VIEW 3 | ||
38 | #define VIEW_A_VIEW 4 | ||
39 | #define VIEW_ML_VIEW 5 | ||
40 | #define VIEW_M_VIEW 6 | ||
41 | #define VIEW_L_VIEW 7 | ||
42 | #define VIEW_T_VIEW 8 | ||
43 | |||
35 | class KOPrefs : public KPimPrefs | 44 | class KOPrefs : public KPimPrefs |
36 | { | 45 | { |
37 | public: | 46 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 47 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 48 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 49 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 50 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 51 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 52 | enum { standardDestination, askDestination }; |
44 | 53 | ||
45 | virtual ~KOPrefs(); | 54 | virtual ~KOPrefs(); |
46 | 55 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 56 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 57 | instance. */ |
49 | static KOPrefs *instance(); | 58 | static KOPrefs *instance(); |
50 | 59 | ||
51 | /** Set preferences to default values */ | 60 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 61 | void usrSetDefaults(); |
53 | 62 | ||
54 | /** Read preferences from config file */ | 63 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 64 | void usrReadConfig(); |
56 | 65 | ||
57 | /** Write preferences to config file */ | 66 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 67 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 68 | void setCategoryDefaults(); |
60 | void setAllDefaults(); | 69 | void setAllDefaults(); |
61 | 70 | ||
62 | protected: | 71 | protected: |
63 | void setTimeZoneIdDefault(); | 72 | void setTimeZoneIdDefault(); |
64 | 73 | ||
65 | /** Fill empty mail fields with default values. */ | 74 | /** Fill empty mail fields with default values. */ |
66 | void fillMailDefaults(); | 75 | void fillMailDefaults(); |
67 | 76 | ||
68 | private: | 77 | private: |
69 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 78 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
70 | object. */ | 79 | object. */ |
71 | KOPrefs(); | 80 | KOPrefs(); |
72 | 81 | ||
73 | static KOPrefs *mInstance; | 82 | static KOPrefs *mInstance; |
74 | QStringList getDefaultList(); | 83 | QStringList getDefaultList(); |
75 | QStringList getLocationDefaultList(); | 84 | QStringList getLocationDefaultList(); |
76 | public: | 85 | public: |
77 | // preferences data | 86 | // preferences data |
78 | KConfig* getConfig(); | 87 | KConfig* getConfig(); |
79 | void setFullName(const QString &); | 88 | void setFullName(const QString &); |
80 | QString fullName(); | 89 | QString fullName(); |
81 | void setEmail(const QString &); | 90 | void setEmail(const QString &); |
82 | QString email(); | 91 | QString email(); |
83 | 92 | ||
84 | QString mAdditional; | 93 | QString mAdditional; |
85 | 94 | ||
86 | bool mEmailControlCenter; | 95 | bool mEmailControlCenter; |
87 | 96 | ||
88 | bool mBcc; | 97 | bool mBcc; |
89 | bool mAutoSave; | 98 | bool mAutoSave; |
90 | int mAutoSaveInterval; | 99 | int mAutoSaveInterval; |
91 | bool mConfirm; | 100 | bool mConfirm; |
92 | 101 | ||
93 | bool mEnableGroupScheduling; | 102 | bool mEnableGroupScheduling; |
94 | bool mEnableProjectView; | 103 | bool mEnableProjectView; |
95 | 104 | ||
96 | int mDefaultFormat; | 105 | int mDefaultFormat; |
97 | int mMailClient; | 106 | int mMailClient; |
98 | 107 | ||
99 | int mStartTime; | 108 | int mStartTime; |
100 | int mDefaultDuration; | 109 | int mDefaultDuration; |
101 | int mAlarmTime; | 110 | int mAlarmTime; |
102 | 111 | ||
103 | int mWorkingHoursStart; | 112 | int mWorkingHoursStart; |
104 | int mWorkingHoursEnd; | 113 | int mWorkingHoursEnd; |
105 | bool mExcludeHolidays; | 114 | bool mExcludeHolidays; |
106 | bool mExcludeSaturdays; | 115 | bool mExcludeSaturdays; |
107 | bool mMarcusBainsShowSeconds; | 116 | bool mMarcusBainsShowSeconds; |
108 | 117 | ||
109 | QFont mTimeBarFont; | 118 | QFont mTimeBarFont; |
110 | QFont mMonthViewFont; | 119 | QFont mMonthViewFont; |
111 | QFont mAgendaViewFont; | 120 | QFont mAgendaViewFont; |
112 | QFont mMarcusBainsFont; | 121 | QFont mMarcusBainsFont; |
113 | QFont mTimeLabelsFont; | 122 | QFont mTimeLabelsFont; |
114 | QFont mTodoViewFont; | 123 | QFont mTodoViewFont; |
115 | QFont mListViewFont; | 124 | QFont mListViewFont; |
116 | QFont mDateNavigatorFont; | 125 | QFont mDateNavigatorFont; |
117 | QFont mEditBoxFont; | 126 | QFont mEditBoxFont; |
118 | QFont mJornalViewFont; | 127 | QFont mJornalViewFont; |
119 | QFont mWhatsNextFont; | 128 | QFont mWhatsNextFont; |
120 | QFont mEventViewFont; | 129 | QFont mEventViewFont; |
121 | 130 | ||
122 | 131 | ||
123 | 132 | ||
124 | 133 | ||
125 | QColor mHolidayColor; | 134 | QColor mHolidayColor; |
126 | QColor mHighlightColor; | 135 | QColor mHighlightColor; |
127 | QColor mEventColor; | 136 | QColor mEventColor; |
128 | QColor mTodoDoneColor; | 137 | QColor mTodoDoneColor; |
129 | QColor mAgendaBgColor; | 138 | QColor mAgendaBgColor; |
130 | QColor mWorkingHoursColor; | 139 | QColor mWorkingHoursColor; |
131 | QColor mTodoDueTodayColor; | 140 | QColor mTodoDueTodayColor; |
132 | QColor mTodoOverdueColor; | 141 | QColor mTodoOverdueColor; |
133 | QColor mMonthViewEvenColor; | 142 | QColor mMonthViewEvenColor; |
134 | QColor mMonthViewOddColor; | 143 | QColor mMonthViewOddColor; |
135 | QColor mMonthViewHolidayColor; | 144 | QColor mMonthViewHolidayColor; |
136 | bool mMonthViewUsesDayColors; | 145 | bool mMonthViewUsesDayColors; |
137 | bool mMonthViewSatSunTog; | 146 | bool mMonthViewSatSunTog; |
138 | bool mMonthViewWeek; | 147 | bool mMonthViewWeek; |
139 | QColor mAppColor1; | 148 | QColor mAppColor1; |
140 | QColor mAppColor2; | 149 | QColor mAppColor2; |
141 | bool mUseAppColors; | 150 | bool mUseAppColors; |
142 | 151 | ||
143 | int mDayBegins; | 152 | int mDayBegins; |
144 | int mHourSize; | 153 | int mHourSize; |
145 | int mAllDaySize; | 154 | int mAllDaySize; |
146 | bool mShowFullMenu; | 155 | bool mShowFullMenu; |
147 | bool mDailyRecur; | 156 | bool mDailyRecur; |
148 | bool mWeeklyRecur; | 157 | bool mWeeklyRecur; |
149 | bool mMonthDailyRecur; | 158 | bool mMonthDailyRecur; |
150 | bool mMonthWeeklyRecur; | 159 | bool mMonthWeeklyRecur; |
151 | bool mMonthShowIcons; | 160 | bool mMonthShowIcons; |
152 | bool mMonthShowShort; | 161 | bool mMonthShowShort; |
153 | bool mEnableToolTips; | 162 | bool mEnableToolTips; |
154 | bool mEnableMonthScroll; | 163 | bool mEnableMonthScroll; |
155 | bool mFullViewMonth; | 164 | bool mFullViewMonth; |
156 | bool mMonthViewUsesCategoryColor; | 165 | bool mMonthViewUsesCategoryColor; |
157 | bool mFullViewTodo; | 166 | bool mFullViewTodo; |
158 | bool mShowCompletedTodo; | 167 | bool mShowCompletedTodo; |
159 | bool mMarcusBainsEnabled; | 168 | bool mMarcusBainsEnabled; |
160 | int mNextXDays; | 169 | int mNextXDays; |
161 | int mWhatsNextDays; | 170 | int mWhatsNextDays; |
162 | int mWhatsNextPrios; | 171 | int mWhatsNextPrios; |
163 | bool mEnableQuickTodo; | 172 | bool mEnableQuickTodo; |
164 | 173 | ||
165 | bool mCompactDialogs; | 174 | bool mCompactDialogs; |
166 | bool mVerticalScreen; | 175 | bool mVerticalScreen; |
167 | 176 | ||
168 | bool mShowIconNewTodo; | 177 | bool mShowIconNewTodo; |
169 | bool mShowIconNewEvent; | 178 | bool mShowIconNewEvent; |
170 | bool mShowIconSearch; | 179 | bool mShowIconSearch; |
171 | bool mShowIconList; | 180 | bool mShowIconList; |
172 | bool mShowIconDay1; | 181 | bool mShowIconDay1; |
173 | bool mShowIconDay5; | 182 | bool mShowIconDay5; |
174 | bool mShowIconDay6; | 183 | bool mShowIconDay6; |
175 | bool mShowIconDay7; | 184 | bool mShowIconDay7; |
176 | bool mShowIconMonth; | 185 | bool mShowIconMonth; |
177 | bool mShowIconTodoview; | 186 | bool mShowIconTodoview; |
178 | bool mShowIconBackFast; | 187 | bool mShowIconBackFast; |
179 | bool mShowIconBack; | 188 | bool mShowIconBack; |
180 | bool mShowIconToday; | 189 | bool mShowIconToday; |
181 | bool mShowIconForward; | 190 | bool mShowIconForward; |
182 | bool mShowIconForwardFast; | 191 | bool mShowIconForwardFast; |
183 | bool mShowIconWhatsThis; | 192 | bool mShowIconWhatsThis; |
184 | bool mShowIconWeekNum; | 193 | bool mShowIconWeekNum; |
185 | bool mShowIconNextDays; | 194 | bool mShowIconNextDays; |
186 | bool mShowIconNext; | 195 | bool mShowIconNext; |
187 | bool mShowIconJournal; | 196 | bool mShowIconJournal; |
188 | bool mShowIconFilter; | 197 | bool mShowIconFilter; |
189 | bool mShowIconOnetoolbar; | 198 | bool mShowIconOnetoolbar; |
190 | bool mShowIconNavigator; | 199 | bool mShowIconNavigator; |
191 | bool mShowIconAllday; | 200 | bool mShowIconAllday; |
192 | bool mShowIconFilterview; | 201 | bool mShowIconFilterview; |
193 | bool mShowIconToggleFull; | 202 | bool mShowIconToggleFull; |
194 | 203 | ||
195 | bool mShowIconStretch; | 204 | bool mShowIconStretch; |
196 | 205 | ||
197 | bool mToolBarHor; | 206 | bool mToolBarHor; |
198 | bool mToolBarUp; | 207 | bool mToolBarUp; |
199 | bool mToolBarHorV; | 208 | bool mToolBarHorV; |
200 | bool mToolBarUpV; | 209 | bool mToolBarUpV; |
201 | bool mToolBarHorN; | 210 | bool mToolBarHorN; |
202 | bool mToolBarUpN; | 211 | bool mToolBarUpN; |
203 | bool mToolBarHorF; | 212 | bool mToolBarHorF; |
204 | bool mToolBarUpF; | 213 | bool mToolBarUpF; |
205 | bool mToolBarMiniIcons; | 214 | bool mToolBarMiniIcons; |
206 | 215 | ||
207 | bool mAskForQuit; | 216 | bool mAskForQuit; |
208 | bool mUsePassWd; | 217 | bool mUsePassWd; |
209 | bool mShowSyncEvents; | 218 | bool mShowSyncEvents; |
210 | bool mShowTodoInAgenda; | 219 | bool mShowTodoInAgenda; |
211 | bool mShowTimeInAgenda; | 220 | bool mShowTimeInAgenda; |
212 | bool mHideNonStartedTodos; | 221 | bool mHideNonStartedTodos; |
213 | 222 | ||
214 | int mLastSyncTime; | 223 | int mLastSyncTime; |
215 | void setCategoryColor(QString cat,const QColor & color); | 224 | void setCategoryColor(QString cat,const QColor & color); |
216 | QColor *categoryColor(QString cat); | 225 | QColor *categoryColor(QString cat); |
217 | 226 | ||
218 | QString mArchiveFile; | 227 | QString mArchiveFile; |
219 | QString mHtmlExportFile; | 228 | QString mHtmlExportFile; |
220 | bool mHtmlWithSave; | 229 | bool mHtmlWithSave; |
221 | 230 | ||
222 | QStringList mSelectedPlugins; | 231 | QStringList mSelectedPlugins; |
223 | 232 | ||
224 | QString mLastImportFile; | 233 | QString mLastImportFile; |
225 | QString mLastVcalFile; | 234 | QString mLastVcalFile; |
226 | QString mLastSaveFile; | 235 | QString mLastSaveFile; |
227 | QString mLastLoadFile; | 236 | QString mLastLoadFile; |
228 | 237 | ||
229 | 238 | ||
230 | QString mDefaultAlarmFile; | 239 | QString mDefaultAlarmFile; |
231 | int mIMIPScheduler; | 240 | int mIMIPScheduler; |
232 | int mIMIPSend; | 241 | int mIMIPSend; |
233 | QStringList mAdditionalMails; | 242 | QStringList mAdditionalMails; |
234 | int mIMIPAutoRefresh; | 243 | int mIMIPAutoRefresh; |
235 | int mIMIPAutoInsertReply; | 244 | int mIMIPAutoInsertReply; |
236 | int mIMIPAutoInsertRequest; | 245 | int mIMIPAutoInsertRequest; |
237 | int mIMIPAutoFreeBusy; | 246 | int mIMIPAutoFreeBusy; |
238 | int mIMIPAutoFreeBusyReply; | 247 | int mIMIPAutoFreeBusyReply; |
239 | 248 | ||
240 | QStringList mTodoTemplates; | 249 | QStringList mTodoTemplates; |
241 | QStringList mEventTemplates; | 250 | QStringList mEventTemplates; |
242 | 251 | ||
243 | int mDestination; | 252 | int mDestination; |
244 | 253 | ||
245 | 254 | ||
246 | bool mEditOnDoubleClick; | 255 | bool mEditOnDoubleClick; |
247 | bool mViewChangeHoldFullscreen; | 256 | bool mViewChangeHoldFullscreen; |
248 | bool mViewChangeHoldNonFullscreen; | 257 | bool mViewChangeHoldNonFullscreen; |
249 | bool mCenterOnCurrentTime; | 258 | bool mCenterOnCurrentTime; |
250 | bool mSetTimeToDayStartAt; | 259 | bool mSetTimeToDayStartAt; |
251 | bool mHighlightCurrentDay; | 260 | bool mHighlightCurrentDay; |
252 | bool mUseHighlightLightColor; | 261 | bool mUseHighlightLightColor; |
253 | bool mListViewMonthTimespan; | 262 | bool mListViewMonthTimespan; |
254 | bool mWNViewShowsParents; | 263 | bool mWNViewShowsParents; |
255 | bool mWNViewShowsPast; | 264 | bool mWNViewShowsPast; |
256 | bool mWNViewShowLocation; | 265 | bool mWNViewShowLocation; |
257 | bool mTodoViewShowsPercentage; | 266 | bool mTodoViewShowsPercentage; |
258 | bool mTodoViewUsesCatColors; | 267 | bool mTodoViewUsesCatColors; |
259 | bool mMonthViewUsesBigFont; | 268 | bool mMonthViewUsesBigFont; |
260 | bool mTodoViewUsesSmallFont; | 269 | bool mTodoViewUsesSmallFont; |
261 | bool mTodoViewUsesForegroundColor; | 270 | bool mTodoViewUsesForegroundColor; |
262 | bool mMonthViewUsesForegroundColor; | 271 | bool mMonthViewUsesForegroundColor; |
263 | 272 | ||
264 | bool mHightlightDateTimeEdit; | 273 | bool mHightlightDateTimeEdit; |
265 | bool mShortDateInViewer; | 274 | bool mShortDateInViewer; |
266 | 275 | ||
267 | bool mShowDateNavigator; | 276 | bool mShowDateNavigator; |
268 | 277 | ||
269 | QStringList mLocationDefaults; | 278 | QStringList mLocationDefaults; |
270 | QStringList mEventSummaryUser; | 279 | QStringList mEventSummaryUser; |
271 | QStringList mTodoSummaryUser; | 280 | QStringList mTodoSummaryUser; |
272 | 281 | ||
273 | bool mUseInternalAlarmNotification; | 282 | bool mUseInternalAlarmNotification; |
274 | int mAlarmPlayBeeps; | 283 | int mAlarmPlayBeeps; |
275 | int mAlarmSuspendTime; | 284 | int mAlarmSuspendTime; |
276 | int mAlarmSuspendCount; | 285 | int mAlarmSuspendCount; |
277 | int mAlarmBeepInterval; | 286 | int mAlarmBeepInterval; |
278 | int mOldLanguage; | 287 | int mOldLanguage; |
279 | int mOldLoadedLanguage; | 288 | int mOldLoadedLanguage; |
280 | 289 | ||
281 | 290 | ||
282 | QString mActiveSyncPort; | 291 | QString mActiveSyncPort; |
283 | QString mActiveSyncIP; | 292 | QString mActiveSyncIP; |
284 | 293 | ||
285 | // settings for eventviewer | 294 | // settings for eventviewer |
286 | bool mEVshowDetails; | 295 | bool mEVshowDetails; |
287 | bool mEVshowCreated; | 296 | bool mEVshowCreated; |
288 | bool mEVshowChanged; | 297 | bool mEVshowChanged; |
289 | bool mWTshowDetails; | 298 | bool mWTshowDetails; |
290 | bool mWTshowCreated; | 299 | bool mWTshowCreated; |
291 | bool mWTshowChanged; | 300 | bool mWTshowChanged; |
292 | 301 | ||
302 | int mCurrentDisplayedView; | ||
303 | |||
293 | private: | 304 | private: |
294 | QDict<QColor> mCategoryColors; | 305 | QDict<QColor> mCategoryColors; |
295 | QColor mDefaultCategoryColor; | 306 | QColor mDefaultCategoryColor; |
296 | 307 | ||
297 | QFont mDefaultTimeBarFont; | 308 | QFont mDefaultTimeBarFont; |
298 | QFont mDefaultViewFont; | 309 | QFont mDefaultViewFont; |
299 | QFont mDefaultMonthViewFont; | 310 | QFont mDefaultMonthViewFont; |
300 | 311 | ||
301 | QString mName; | 312 | QString mName; |
302 | QString mEmail; | 313 | QString mEmail; |
303 | }; | 314 | }; |
304 | 315 | ||
305 | #endif | 316 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c442d0b..406e741 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,829 +1,827 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | flagResetViewChangeDate = 0; | 64 | flagResetViewChangeDate = 0; |
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") { | 91 | else if (view == "Month") { |
92 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 92 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
93 | showMonthView(); | 93 | showMonthView(); |
94 | else | 94 | else |
95 | showMonthViewWeek(); | 95 | showMonthViewWeek(); |
96 | } | 96 | } |
97 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
98 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
99 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
100 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
101 | else { | 101 | else { |
102 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
104 | mCurrentAgendaView = dateCount; | 104 | mCurrentAgendaView = dateCount; |
105 | showAgendaView(); | 105 | showAgendaView(); |
106 | mCurrentAgendaView = dateCount; | 106 | mCurrentAgendaView = dateCount; |
107 | #ifdef DESKTOP_VERSION | 107 | #ifdef DESKTOP_VERSION |
108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | void KOViewManager::showDateView( int view, QDate date) | 113 | void KOViewManager::showDateView( int view, QDate date) |
114 | { | 114 | { |
115 | static int lastMode = 0; | 115 | static int lastMode = 0; |
116 | static int lastCount = 0; | 116 | static int lastCount = 0; |
117 | static bool lastNDMode = false; | 117 | static bool lastNDMode = false; |
118 | static QDate lastDate; | 118 | static QDate lastDate; |
119 | //qDebug("date %d %s", view, date.toString().latin1()); | 119 | //qDebug("date %d %s", view, date.toString().latin1()); |
120 | 120 | ||
121 | if (view != 9) | 121 | if (view != 9) |
122 | lastMode = 0; | 122 | lastMode = 0; |
123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
125 | mFlagShowNextxDays = false; | 125 | mFlagShowNextxDays = false; |
126 | if ( view == 3 ) { | 126 | if ( view == 3 ) { |
127 | //mCurrentAgendaView = 1 ; | 127 | //mCurrentAgendaView = 1 ; |
128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
130 | lastNDMode = savemFlagShowNextxDays; | 130 | lastNDMode = savemFlagShowNextxDays; |
131 | mMainView->dateNavigator()->selectDate( date ); | 131 | mMainView->dateNavigator()->selectDate( date ); |
132 | lastMode = 1; | 132 | lastMode = 1; |
133 | mCurrentAgendaView = 1 ; | 133 | mCurrentAgendaView = 1 ; |
134 | } else if (view == 4 ) { | 134 | } else if (view == 4 ) { |
135 | mCurrentAgendaView = 7 ; | 135 | mCurrentAgendaView = 7 ; |
136 | mMainView->dateNavigator()->selectDates( date, 7 ); | 136 | mMainView->dateNavigator()->selectDates( date, 7 ); |
137 | } else if (view == 5 ) { | 137 | } else if (view == 5 ) { |
138 | mCurrentAgendaView = 14 ; | 138 | mCurrentAgendaView = 14 ; |
139 | mMainView->dateNavigator()->selectDates( date, 14); | 139 | mMainView->dateNavigator()->selectDates( date, 14); |
140 | } else if (view == 6 ) { | 140 | } else if (view == 6 ) { |
141 | resetDateSilent( date,1); | 141 | resetDateSilent( date,1); |
142 | showMonthView(); | 142 | showMonthView(); |
143 | } else if (view == 7 ) { | 143 | } else if (view == 7 ) { |
144 | mMainView->dateNavigator()->selectDate( date ); | 144 | mMainView->dateNavigator()->selectDate( date ); |
145 | showJournalView(); | 145 | showJournalView(); |
146 | } else if (view == 8 ) { | 146 | } else if (view == 8 ) { |
147 | globalFlagBlockAgenda = 1; | 147 | globalFlagBlockAgenda = 1; |
148 | if ( mCurrentAgendaView != 3 ) | 148 | if ( mCurrentAgendaView != 3 ) |
149 | mCurrentAgendaView = -1; | 149 | mCurrentAgendaView = -1; |
150 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 150 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
151 | globalFlagBlockAgenda = 2; | 151 | globalFlagBlockAgenda = 2; |
152 | mMainView->dateNavigator()->selectDates( date , | 152 | mMainView->dateNavigator()->selectDates( date , |
153 | KOPrefs::instance()->mNextXDays ); | 153 | KOPrefs::instance()->mNextXDays ); |
154 | mFlagShowNextxDays = true; | 154 | mFlagShowNextxDays = true; |
155 | mCurrentAgendaView = 3 ; | 155 | mCurrentAgendaView = 3 ; |
156 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 156 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
157 | if ( lastMode ) { | 157 | if ( lastMode ) { |
158 | mCurrentAgendaView = lastCount ; | 158 | mCurrentAgendaView = lastCount ; |
159 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 159 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
160 | mFlagShowNextxDays = lastNDMode; | 160 | mFlagShowNextxDays = lastNDMode; |
161 | if ( mFlagShowNextxDays ) { | 161 | if ( mFlagShowNextxDays ) { |
162 | mCurrentAgendaView = 3 ; | 162 | mCurrentAgendaView = 3 ; |
163 | } | 163 | } |
164 | } else | 164 | } else |
165 | showWeekView(); | 165 | showWeekView(); |
166 | } else if (view == 10) { | 166 | } else if (view == 10) { |
167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | void KOViewManager::writeSettings(KConfig *config) | 173 | void KOViewManager::writeSettings(KConfig *config) |
174 | { | 174 | { |
175 | config->setGroup("General"); | 175 | config->setGroup("General"); |
176 | 176 | ||
177 | QString view; | 177 | QString view; |
178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
179 | else if (mCurrentView == mMonthView) view = "Month"; | 179 | else if (mCurrentView == mMonthView) view = "Month"; |
180 | else if (mCurrentView == mListView) view = "List"; | 180 | else if (mCurrentView == mListView) view = "List"; |
181 | else if (mCurrentView == mJournalView) view = "Journal"; | 181 | else if (mCurrentView == mJournalView) view = "Journal"; |
182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
183 | else if (mCurrentView == mTodoView) view = "Todo"; | 183 | else if (mCurrentView == mTodoView) view = "Todo"; |
184 | else view = "Agenda"; | 184 | else view = "Agenda"; |
185 | 185 | ||
186 | config->writeEntry("Current View",view); | 186 | config->writeEntry("Current View",view); |
187 | 187 | ||
188 | if (mAgendaView) { | 188 | if (mAgendaView) { |
189 | mAgendaView->writeSettings(config); | 189 | mAgendaView->writeSettings(config); |
190 | } | 190 | } |
191 | if (mTimeSpanView) { | 191 | if (mTimeSpanView) { |
192 | mTimeSpanView->writeSettings(config); | 192 | mTimeSpanView->writeSettings(config); |
193 | } | 193 | } |
194 | if (mListView) { | 194 | if (mListView) { |
195 | mListView->writeSettings(config); | 195 | mListView->writeSettings(config); |
196 | } | 196 | } |
197 | if (mTodoView) { | 197 | if (mTodoView) { |
198 | mTodoView->saveLayout(config,"Todo View"); | 198 | mTodoView->saveLayout(config,"Todo View"); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | void KOViewManager::showNextView() | 201 | void KOViewManager::showNextView() |
202 | { | 202 | { |
203 | static int selecteddatescount = 0; | 203 | static int selecteddatescount = 0; |
204 | static QDate selecteddate = QDate ( 2000, 1, 1 ); | 204 | static QDate selecteddate = QDate ( 2000, 1, 1 ); |
205 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); | 205 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); |
206 | int newCount = mMainView->dateNavigator()->selectedDates().count(); | 206 | int newCount = mMainView->dateNavigator()->selectedDates().count(); |
207 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { | 207 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { |
208 | flagResetViewChangeDate = 1; | 208 | flagResetViewChangeDate = 1; |
209 | } | 209 | } |
210 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) | 210 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) |
211 | flagResetViewChangeDate = 1; | 211 | flagResetViewChangeDate = 1; |
212 | if ( flagResetViewChangeDate > 0 ) { | 212 | if ( flagResetViewChangeDate > 0 ) { |
213 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); | 213 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); |
214 | //qDebug("newCycle "); | 214 | //qDebug("newCycle "); |
215 | } | 215 | } |
216 | if (mCurrentView == mWhatsNextView) goto NEXT_X; | 216 | if (mCurrentView == mWhatsNextView) goto NEXT_X; |
217 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; | 217 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; |
218 | if (mCurrentView == mJournalView ) goto DAY_1; | 218 | if (mCurrentView == mJournalView ) goto DAY_1; |
219 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; | 219 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; |
220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; | 220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; |
221 | if (mCurrentView == mAgendaView ) goto DAY_6; | 221 | if (mCurrentView == mAgendaView ) goto DAY_6; |
222 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; | 222 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; |
223 | if (mCurrentView == mMonthView ) goto LIST; | 223 | if (mCurrentView == mMonthView ) goto LIST; |
224 | if (mCurrentView == mListView ) goto TODO; | 224 | if (mCurrentView == mListView ) goto TODO; |
225 | // if (mCurrentView == mTodoView ) goto NEXT; | 225 | // if (mCurrentView == mTodoView ) goto NEXT; |
226 | NEXT: | 226 | NEXT: |
227 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} | 227 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} |
228 | NEXT_X: | 228 | NEXT_X: |
229 | if ( KOPrefs::instance()->mShowIconNextDays ) { | 229 | if ( KOPrefs::instance()->mShowIconNextDays ) { |
230 | globalFlagBlockAgenda = 1; | 230 | showNextXView(); |
231 | if ( mCurrentAgendaView != 3 ) | ||
232 | mCurrentAgendaView = -1; | ||
233 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | ||
234 | globalFlagBlockAgenda = 2; | ||
235 | mMainView->dateNavigator()->selectDates( baseCycleDate , | ||
236 | KOPrefs::instance()->mNextXDays ); | ||
237 | mFlagShowNextxDays = true; | ||
238 | mCurrentAgendaView = 3 ; | ||
239 | goto ENTE ; | 231 | goto ENTE ; |
240 | } | 232 | } |
241 | JOURNAL: | 233 | JOURNAL: |
242 | if ( KOPrefs::instance()->mShowIconJournal ) { | 234 | if ( KOPrefs::instance()->mShowIconJournal ) { |
243 | resetDateSilent( baseCycleDate , 1 ); | 235 | resetDateSilent( baseCycleDate , 1 ); |
244 | showJournalView() ;goto ENTE ;} | 236 | showJournalView() ;goto ENTE ;} |
245 | DAY_1: | 237 | DAY_1: |
246 | if ( KOPrefs::instance()->mShowIconDay1 ) { | 238 | if ( KOPrefs::instance()->mShowIconDay1 ) { |
247 | resetDateSilent( baseCycleDate , 2 ); | 239 | resetDateSilent( baseCycleDate , 2 ); |
248 | showDayView() ;goto ENTE ;} | 240 | showDayView() ;goto ENTE ;} |
249 | DAY_5: | 241 | DAY_5: |
250 | if ( KOPrefs::instance()->mShowIconDay5 ) { | 242 | if ( KOPrefs::instance()->mShowIconDay5 ) { |
251 | resetDateSilent( baseCycleDate , 2 ); | 243 | resetDateSilent( baseCycleDate , 2 ); |
252 | showWorkWeekView() ;goto ENTE ;} | 244 | showWorkWeekView() ;goto ENTE ;} |
253 | DAY_7: | 245 | DAY_7: |
254 | if ( KOPrefs::instance()->mShowIconDay7 ) { | 246 | if ( KOPrefs::instance()->mShowIconDay7 ) { |
255 | resetDateSilent( baseCycleDate , 2 ); | 247 | resetDateSilent( baseCycleDate , 2 ); |
256 | showWeekView();goto ENTE ;} | 248 | showWeekView();goto ENTE ;} |
257 | DAY_6: | 249 | DAY_6: |
258 | if ( KOPrefs::instance()->mShowIconDay6 ) { | 250 | if ( KOPrefs::instance()->mShowIconDay6 ) { |
259 | resetDateSilent( baseCycleDate , 2 ); | 251 | resetDateSilent( baseCycleDate , 2 ); |
260 | showMonthViewWeek();goto ENTE ;} | 252 | showMonthViewWeek();goto ENTE ;} |
261 | MONTH: | 253 | MONTH: |
262 | if ( KOPrefs::instance()->mShowIconMonth ) { | 254 | if ( KOPrefs::instance()->mShowIconMonth ) { |
263 | resetDateSilent( baseCycleDate , 2 ); | 255 | resetDateSilent( baseCycleDate , 2 ); |
264 | showMonthView();goto ENTE ;} | 256 | showMonthView();goto ENTE ;} |
265 | LIST: | 257 | LIST: |
266 | if ( KOPrefs::instance()->mShowIconList ) { | 258 | if ( KOPrefs::instance()->mShowIconList ) { |
267 | resetDateSilent( baseCycleDate , 2 ); | 259 | resetDateSilent( baseCycleDate , 2 ); |
268 | showListView() ;goto ENTE ;} | 260 | showListView() ;goto ENTE ;} |
269 | TODO: | 261 | TODO: |
270 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 262 | if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
271 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} | 263 | if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} |
272 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} | 264 | if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} |
273 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} | 265 | if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} |
274 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} | 266 | if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} |
275 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} | 267 | if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} |
276 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} | 268 | if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} |
277 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} | 269 | if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} |
278 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} | 270 | if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} |
279 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} | 271 | if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} |
280 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} | 272 | //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} |
281 | ENTE: | 273 | ENTE: |
282 | flagResetViewChangeDate = 0; | 274 | flagResetViewChangeDate = 0; |
283 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); | 275 | selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); |
284 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); | 276 | selecteddate = mMainView->dateNavigator()->selectedDates().first(); |
285 | 277 | ||
286 | } | 278 | } |
287 | void KOViewManager::resetDateSilent( QDate date , int days ) | 279 | void KOViewManager::resetDateSilent( QDate date , int days ) |
288 | { | 280 | { |
289 | mMainView->dateNavigator()->blockSignals( true ); | 281 | mMainView->dateNavigator()->blockSignals( true ); |
290 | mMainView->dateNavigator()->selectDates( date , days ); | 282 | mMainView->dateNavigator()->selectDates( date , days ); |
291 | mMainView->dateNavigator()->blockSignals( false ); | 283 | mMainView->dateNavigator()->blockSignals( false ); |
292 | } | 284 | } |
293 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 285 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
294 | { | 286 | { |
295 | if ( flagResetViewChangeDate < 10 ) | 287 | if ( flagResetViewChangeDate < 10 ) |
296 | ++flagResetViewChangeDate; | 288 | ++flagResetViewChangeDate; |
297 | //mFlagShowNextxDays = false; | 289 | //mFlagShowNextxDays = false; |
298 | //if(view == mCurrentView) return; | 290 | //if(view == mCurrentView) return; |
299 | if ( view == 0 ) { | 291 | if ( view == 0 ) { |
300 | view = mCurrentView; | 292 | view = mCurrentView; |
301 | if ( view == 0 ) | 293 | if ( view == 0 ) |
302 | return; | 294 | return; |
303 | } | 295 | } |
304 | bool callupdate = !(view == mCurrentView); | 296 | bool callupdate = !(view == mCurrentView); |
305 | bool full = fullScreen; | 297 | bool full = fullScreen; |
306 | if(view == mCurrentView && view != mWhatsNextView ) { | 298 | if(view == mCurrentView && view != mWhatsNextView ) { |
307 | if ( mCurrentAgendaView < 0 ) | 299 | if ( mCurrentAgendaView < 0 ) |
308 | return; | 300 | return; |
309 | if ( view != mMonthView ) | 301 | if ( view != mMonthView ) |
310 | full = mMainView->leftFrame()->isVisible(); | 302 | full = mMainView->leftFrame()->isVisible(); |
311 | } else { | 303 | } else { |
312 | if ( view == mMonthView && mMonthView) | 304 | if ( view == mMonthView && mMonthView) |
313 | ;//mMonthView->skipResize = true ; | 305 | ;//mMonthView->skipResize = true ; |
314 | mCurrentView = view; | 306 | mCurrentView = view; |
315 | // bool full = fullScreen; | 307 | // bool full = fullScreen; |
316 | bool isFull = !mMainView->leftFrame()->isVisible(); | 308 | bool isFull = !mMainView->leftFrame()->isVisible(); |
317 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 309 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
318 | full = true; | 310 | full = true; |
319 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 311 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
320 | full = false; | 312 | full = false; |
321 | } | 313 | } |
322 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 314 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
323 | //raiseCurrentView( full ); | 315 | //raiseCurrentView( full ); |
324 | mMainView->processIncidenceSelection( 0 ); | 316 | mMainView->processIncidenceSelection( 0 ); |
325 | //mMainView->updateView(); | 317 | //mMainView->updateView(); |
326 | raiseCurrentView( full, callupdate ); | 318 | raiseCurrentView( full, callupdate ); |
327 | mMainView->adaptNavigationUnits(); | 319 | mMainView->adaptNavigationUnits(); |
328 | } | 320 | } |
329 | 321 | ||
330 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 322 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
331 | { | 323 | { |
332 | mCurrentAgendaView = 0; | 324 | mCurrentAgendaView = 0; |
333 | if ( fullScreen ) { | 325 | if ( fullScreen ) { |
334 | mMainView->leftFrame()->hide(); | 326 | mMainView->leftFrame()->hide(); |
335 | } else { | 327 | } else { |
336 | mMainView->leftFrame()->show(); | 328 | mMainView->leftFrame()->show(); |
337 | } | 329 | } |
338 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); | 330 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); |
339 | emit signalFullScreen( !fullScreen ); | 331 | emit signalFullScreen( !fullScreen ); |
340 | if ( callUpdateView ) | 332 | if ( callUpdateView ) |
341 | mMainView->updateView(); | 333 | mMainView->updateView(); |
342 | 334 | ||
343 | if ( globalFlagBlockAgenda == 5 ) { | 335 | if ( globalFlagBlockAgenda == 5 ) { |
344 | globalFlagBlockAgenda = 4; | 336 | globalFlagBlockAgenda = 4; |
345 | globalFlagBlockAgendaItemPaint = 1; | 337 | globalFlagBlockAgendaItemPaint = 1; |
346 | } | 338 | } |
347 | mMainView->viewStack()->raiseWidget(mCurrentView); | 339 | mMainView->viewStack()->raiseWidget(mCurrentView); |
348 | if ( globalFlagBlockAgenda == 4 ) { | 340 | if ( globalFlagBlockAgenda == 4 ) { |
349 | if ( mCurrentView == mAgendaView ) { | 341 | if ( mCurrentView == mAgendaView ) { |
350 | //globalFlagBlockAgenda =1 ; | 342 | //globalFlagBlockAgenda =1 ; |
351 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 343 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
352 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 344 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
353 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 345 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
354 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 346 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
355 | qApp->processEvents(); | 347 | qApp->processEvents(); |
356 | //qDebug("qApp->processEvents() "); | 348 | //qDebug("qApp->processEvents() "); |
357 | globalFlagBlockAgenda = 0; | 349 | globalFlagBlockAgenda = 0; |
358 | mAgendaView->repaintAgenda(); | 350 | mAgendaView->repaintAgenda(); |
359 | 351 | ||
360 | } | 352 | } |
361 | globalFlagBlockAgenda = 0; | 353 | globalFlagBlockAgenda = 0; |
362 | } | 354 | } |
363 | emit signalAgendaView( mCurrentView == mAgendaView ); | 355 | emit signalAgendaView( mCurrentView == mAgendaView ); |
364 | //qDebug("raiseCurrentView ende "); | 356 | //qDebug("raiseCurrentView ende "); |
365 | 357 | ||
366 | } | 358 | } |
367 | 359 | ||
368 | void KOViewManager::updateView() | 360 | void KOViewManager::updateView() |
369 | { | 361 | { |
370 | // qDebug("KOViewManager::updateView() "); | 362 | // qDebug("KOViewManager::updateView() "); |
371 | // if we are updating mTodoView, we get endless recursion | 363 | // if we are updating mTodoView, we get endless recursion |
372 | if ( mTodoView == mCurrentView ) | 364 | if ( mTodoView == mCurrentView ) |
373 | return; | 365 | return; |
374 | if ( mCurrentView ) mCurrentView->updateView(); | 366 | if ( mCurrentView ) mCurrentView->updateView(); |
375 | 367 | ||
376 | } | 368 | } |
377 | 369 | ||
378 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 370 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
379 | { | 371 | { |
380 | // kdDebug() << "KOViewManager::updateView()" << endl; | 372 | // kdDebug() << "KOViewManager::updateView()" << endl; |
381 | 373 | ||
382 | if (mCurrentView) mCurrentView->showDates(start, end); | 374 | if (mCurrentView) mCurrentView->showDates(start, end); |
383 | 375 | ||
384 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 376 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
385 | } | 377 | } |
386 | 378 | ||
387 | 379 | ||
388 | void KOViewManager::updateWNview() | 380 | void KOViewManager::updateWNview() |
389 | { | 381 | { |
390 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 382 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
391 | mWhatsNextView->updateView(); | 383 | mWhatsNextView->updateView(); |
392 | if ( mCurrentView == mMonthView && mMonthView ) | 384 | if ( mCurrentView == mMonthView && mMonthView ) |
393 | mMonthView->updateView(); | 385 | mMonthView->updateView(); |
394 | 386 | ||
395 | } | 387 | } |
396 | void KOViewManager::showWhatsNextView() | 388 | void KOViewManager::showWhatsNextView() |
397 | { | 389 | { |
398 | if (!mWhatsNextView) { | 390 | if (!mWhatsNextView) { |
399 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 391 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
400 | "KOViewManager::WhatsNextView"); | 392 | "KOViewManager::WhatsNextView"); |
401 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 393 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
402 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 394 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
403 | addView(mWhatsNextView); | 395 | addView(mWhatsNextView); |
404 | connect(this, SIGNAL( printWNV() ), | 396 | connect(this, SIGNAL( printWNV() ), |
405 | mWhatsNextView, SLOT( printMe() ) ); | 397 | mWhatsNextView, SLOT( printMe() ) ); |
406 | } | 398 | } |
407 | globalFlagBlockAgenda = 1; | 399 | globalFlagBlockAgenda = 1; |
408 | showView(mWhatsNextView, true ); | 400 | showView(mWhatsNextView, true ); |
409 | //mWhatsNextView->updateView(); | 401 | //mWhatsNextView->updateView(); |
410 | 402 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; | |
411 | } | 403 | } |
412 | 404 | ||
413 | void KOViewManager::slotprintWNV() | 405 | void KOViewManager::slotprintWNV() |
414 | { | 406 | { |
415 | if (!mWhatsNextView) | 407 | if (!mWhatsNextView) |
416 | showWhatsNextView(); | 408 | showWhatsNextView(); |
417 | emit printWNV(); | 409 | emit printWNV(); |
418 | 410 | ||
419 | } | 411 | } |
420 | void KOViewManager::showListView() | 412 | void KOViewManager::showListView() |
421 | { | 413 | { |
422 | if (!mListView) { | 414 | if (!mListView) { |
423 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 415 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
424 | addView(mListView); | 416 | addView(mListView); |
425 | 417 | ||
426 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 418 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
427 | mMainView, SLOT(showIncidence(Incidence *))); | 419 | mMainView, SLOT(showIncidence(Incidence *))); |
428 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 420 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
429 | mMainView, SLOT(editIncidence(Incidence *))); | 421 | mMainView, SLOT(editIncidence(Incidence *))); |
430 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 422 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
431 | mMainView, SLOT(deleteIncidence(Incidence *))); | 423 | mMainView, SLOT(deleteIncidence(Incidence *))); |
432 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 424 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
433 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 425 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
434 | connect( mListView, SIGNAL( signalNewEvent() ), | 426 | connect( mListView, SIGNAL( signalNewEvent() ), |
435 | mMainView, SLOT( newEvent() ) ); | 427 | mMainView, SLOT( newEvent() ) ); |
436 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 428 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
437 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 429 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
438 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 430 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
439 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 431 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
440 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 432 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
441 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 433 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 434 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
443 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 435 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 436 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
445 | } | 437 | } |
446 | // bool temp = mFlagShowNextxDays; | 438 | // bool temp = mFlagShowNextxDays; |
447 | //globalFlagBlockPainting = true; | 439 | //globalFlagBlockPainting = true; |
448 | globalFlagBlockAgenda = 1; | 440 | globalFlagBlockAgenda = 1; |
449 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 441 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
450 | mMainView->setBlockShowDates( true ); | 442 | mMainView->setBlockShowDates( true ); |
451 | mMainView->dateNavigator()->selectMonth(); | 443 | mMainView->dateNavigator()->selectMonth(); |
452 | mMainView->setBlockShowDates( false ); | 444 | mMainView->setBlockShowDates( false ); |
453 | } | 445 | } |
454 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 446 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
455 | //mFlagShowNextxDays = temp; | 447 | //mFlagShowNextxDays = temp; |
448 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; | ||
456 | } | 449 | } |
457 | 450 | ||
458 | void KOViewManager::showAgendaView( bool fullScreen ) | 451 | void KOViewManager::showAgendaView( bool fullScreen ) |
459 | { | 452 | { |
460 | 453 | ||
461 | mMainView->dialogManager()->hideSearchDialog(); | 454 | mMainView->dialogManager()->hideSearchDialog(); |
462 | // qDebug("KOViewManager::showAgendaView "); | 455 | // qDebug("KOViewManager::showAgendaView "); |
463 | bool full; | 456 | bool full; |
464 | full = fullScreen; | 457 | full = fullScreen; |
465 | if (!mAgendaView) { | 458 | if (!mAgendaView) { |
466 | full = false; | 459 | full = false; |
467 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 460 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
468 | addView(mAgendaView); | 461 | addView(mAgendaView); |
469 | #ifndef DESKTOP_VERSION | 462 | #ifndef DESKTOP_VERSION |
470 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 463 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
471 | #endif | 464 | #endif |
472 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 465 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
473 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 466 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
474 | 467 | ||
475 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 468 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
476 | 469 | ||
477 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 470 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
478 | 471 | ||
479 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 472 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
480 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 473 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
481 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 474 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
482 | mMainView, SLOT(newEvent(QDateTime))); | 475 | mMainView, SLOT(newEvent(QDateTime))); |
483 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 476 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
484 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 477 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
485 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 478 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
486 | mMainView, SLOT(newEvent(QDate))); | 479 | mMainView, SLOT(newEvent(QDate))); |
487 | 480 | ||
488 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 481 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
489 | mMainView, SLOT(editIncidence(Incidence *))); | 482 | mMainView, SLOT(editIncidence(Incidence *))); |
490 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 483 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
491 | mMainView, SLOT(showIncidence(Incidence *))); | 484 | mMainView, SLOT(showIncidence(Incidence *))); |
492 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 485 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
493 | mMainView, SLOT(deleteIncidence(Incidence *))); | 486 | mMainView, SLOT(deleteIncidence(Incidence *))); |
494 | 487 | ||
495 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 488 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
496 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 489 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
497 | 490 | ||
498 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 491 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
499 | mMainView, SLOT( toggleExpand() ) ); | 492 | mMainView, SLOT( toggleExpand() ) ); |
500 | 493 | ||
501 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 494 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
502 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 495 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
503 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 496 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
504 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 497 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
505 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 498 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
506 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 499 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
507 | SLOT( updateTodo( Todo *, int ) ) ); | 500 | SLOT( updateTodo( Todo *, int ) ) ); |
508 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 501 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
509 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 502 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
510 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 503 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
511 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 504 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
512 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 505 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
513 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 506 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
514 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 507 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
515 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 508 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
516 | mAgendaView->readSettings(); | 509 | mAgendaView->readSettings(); |
517 | mAgendaView->updateConfig(); | 510 | mAgendaView->updateConfig(); |
518 | } | 511 | } |
519 | 512 | ||
520 | showView( mAgendaView, full); | 513 | showView( mAgendaView, full); |
521 | 514 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; | |
522 | } | 515 | } |
523 | 516 | ||
524 | void KOViewManager::showDayView() | 517 | void KOViewManager::showDayView() |
525 | { | 518 | { |
526 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 519 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
527 | mFlagShowNextxDays = false; | 520 | mFlagShowNextxDays = false; |
528 | globalFlagBlockLabel = 1; | 521 | globalFlagBlockLabel = 1; |
529 | globalFlagBlockAgenda = 1; | 522 | globalFlagBlockAgenda = 1; |
530 | if ( mCurrentAgendaView != 1 ) | 523 | if ( mCurrentAgendaView != 1 ) |
531 | mCurrentAgendaView = -1; | 524 | mCurrentAgendaView = -1; |
532 | showAgendaView(); | 525 | showAgendaView(); |
533 | qApp->processEvents(); | 526 | qApp->processEvents(); |
534 | globalFlagBlockAgenda = 2; | 527 | globalFlagBlockAgenda = 2; |
535 | globalFlagBlockLabel = 0; | 528 | globalFlagBlockLabel = 0; |
536 | mMainView->dateNavigator()->selectDates( 1 ); | 529 | mMainView->dateNavigator()->selectDates( 1 ); |
537 | mCurrentAgendaView = 1 ; | 530 | mCurrentAgendaView = 1 ; |
538 | 531 | ||
539 | } | 532 | } |
540 | 533 | ||
541 | void KOViewManager::showWorkWeekView() | 534 | void KOViewManager::showWorkWeekView() |
542 | { | 535 | { |
543 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 536 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
544 | mFlagShowNextxDays = false; | 537 | mFlagShowNextxDays = false; |
545 | globalFlagBlockAgenda = 1; | 538 | globalFlagBlockAgenda = 1; |
546 | globalFlagBlockLabel = 1; | 539 | globalFlagBlockLabel = 1; |
547 | if ( mCurrentAgendaView != 5 ) | 540 | if ( mCurrentAgendaView != 5 ) |
548 | mCurrentAgendaView = -1; | 541 | mCurrentAgendaView = -1; |
549 | showAgendaView(); | 542 | showAgendaView(); |
550 | qApp->processEvents(); | 543 | qApp->processEvents(); |
551 | globalFlagBlockAgenda = 2; | 544 | globalFlagBlockAgenda = 2; |
552 | globalFlagBlockLabel = 0; | 545 | globalFlagBlockLabel = 0; |
553 | mMainView->dateNavigator()->selectWorkWeek(); | 546 | mMainView->dateNavigator()->selectWorkWeek(); |
554 | mCurrentAgendaView = 5 ; | 547 | mCurrentAgendaView = 5 ; |
555 | 548 | ||
556 | } | 549 | } |
557 | 550 | ||
558 | void KOViewManager::showWeekView() | 551 | void KOViewManager::showWeekView() |
559 | { | 552 | { |
560 | /* | 553 | /* |
561 | globalFlagBlockAgenda = 2; | 554 | globalFlagBlockAgenda = 2; |
562 | qDebug("4globalFlagBlockAgenda = 2; "); | 555 | qDebug("4globalFlagBlockAgenda = 2; "); |
563 | //globalFlagBlockPainting = true; | 556 | //globalFlagBlockPainting = true; |
564 | mMainView->dateNavigator()->selectWeek(); | 557 | mMainView->dateNavigator()->selectWeek(); |
565 | showAgendaView(); | 558 | showAgendaView(); |
566 | */ | 559 | */ |
567 | 560 | ||
568 | 561 | ||
569 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 562 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
570 | mFlagShowNextxDays = false; | 563 | mFlagShowNextxDays = false; |
571 | globalFlagBlockAgenda = 1; | 564 | globalFlagBlockAgenda = 1; |
572 | globalFlagBlockLabel = 1; | 565 | globalFlagBlockLabel = 1; |
573 | if ( mCurrentAgendaView != 7 ) | 566 | if ( mCurrentAgendaView != 7 ) |
574 | mCurrentAgendaView = -1; | 567 | mCurrentAgendaView = -1; |
575 | showAgendaView(); | 568 | showAgendaView(); |
576 | qApp->processEvents(); | 569 | qApp->processEvents(); |
577 | globalFlagBlockAgenda = 2; | 570 | globalFlagBlockAgenda = 2; |
578 | globalFlagBlockLabel = 0; | 571 | globalFlagBlockLabel = 0; |
579 | mMainView->dateNavigator()->selectWeek(); | 572 | mMainView->dateNavigator()->selectWeek(); |
580 | mCurrentAgendaView = 7 ; | 573 | mCurrentAgendaView = 7 ; |
581 | } | 574 | } |
582 | 575 | ||
583 | void KOViewManager::showNextXView() | 576 | void KOViewManager::showNextXView() |
584 | { | 577 | { |
585 | 578 | ||
586 | globalFlagBlockAgenda = 1; | 579 | globalFlagBlockAgenda = 1; |
587 | if ( mCurrentAgendaView != 3 ) | 580 | if ( mCurrentAgendaView != 3 ) |
588 | mCurrentAgendaView = -1; | 581 | mCurrentAgendaView = -1; |
589 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 582 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
590 | globalFlagBlockAgenda = 2; | 583 | globalFlagBlockAgenda = 2; |
591 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 584 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
592 | KOPrefs::instance()->mNextXDays ); | 585 | KOPrefs::instance()->mNextXDays ); |
593 | mFlagShowNextxDays = true; | 586 | mFlagShowNextxDays = true; |
594 | mCurrentAgendaView = 3 ; | 587 | mCurrentAgendaView = 3 ; |
588 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; | ||
595 | } | 589 | } |
596 | bool KOViewManager::showsNextDays() | 590 | bool KOViewManager::showsNextDays() |
597 | { | 591 | { |
598 | return mFlagShowNextxDays; | 592 | return mFlagShowNextxDays; |
599 | } | 593 | } |
600 | void KOViewManager::createMonthView() | 594 | void KOViewManager::createMonthView() |
601 | { | 595 | { |
602 | if (!mMonthView) { | 596 | if (!mMonthView) { |
603 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 597 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
604 | 598 | ||
605 | addView(mMonthView); | 599 | addView(mMonthView); |
606 | // mMonthView->show(); | 600 | // mMonthView->show(); |
607 | // SIGNALS/SLOTS FOR MONTH VIEW | 601 | // SIGNALS/SLOTS FOR MONTH VIEW |
608 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 602 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
609 | mMainView, SLOT(newEvent(QDateTime))); | 603 | mMainView, SLOT(newEvent(QDateTime))); |
610 | 604 | ||
611 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 605 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
612 | mMainView, SLOT(showIncidence(Incidence *))); | 606 | mMainView, SLOT(showIncidence(Incidence *))); |
613 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 607 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
614 | mMainView, SLOT(editIncidence(Incidence *))); | 608 | mMainView, SLOT(editIncidence(Incidence *))); |
615 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 609 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
616 | mMainView, SLOT(deleteIncidence(Incidence *))); | 610 | mMainView, SLOT(deleteIncidence(Incidence *))); |
617 | 611 | ||
618 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 612 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
619 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 613 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
620 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 614 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
621 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 615 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
622 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 616 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
623 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 617 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
624 | 618 | ||
625 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 619 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
626 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 620 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
627 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 621 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
628 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 622 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
629 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 623 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
630 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); | 624 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); |
631 | connect( mMonthView, SIGNAL( selectMonth() ), | 625 | connect( mMonthView, SIGNAL( selectMonth() ), |
632 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); | 626 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); |
633 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 627 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
634 | mMainView, SLOT ( showDay( QDate ) ) ); | 628 | mMainView, SLOT ( showDay( QDate ) ) ); |
635 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 629 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
636 | connect( mMonthView, SIGNAL(nextMonth() ), | 630 | connect( mMonthView, SIGNAL(nextMonth() ), |
637 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 631 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
638 | connect( mMonthView, SIGNAL(prevMonth() ), | 632 | connect( mMonthView, SIGNAL(prevMonth() ), |
639 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 633 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
640 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), | 634 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), |
641 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); | 635 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); |
642 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), | 636 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), |
643 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); | 637 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); |
644 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), | 638 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), |
645 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); | 639 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); |
646 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), | 640 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), |
647 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); | 641 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); |
648 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), | 642 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), |
649 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); | 643 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); |
650 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), | 644 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), |
651 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); | 645 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); |
652 | 646 | ||
653 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 647 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
654 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); | 648 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); |
655 | 649 | ||
656 | 650 | ||
657 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), | 651 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), |
658 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); | 652 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); |
659 | 653 | ||
660 | } | 654 | } |
661 | } | 655 | } |
662 | void KOViewManager::showMonthViewWeek() | 656 | void KOViewManager::showMonthViewWeek() |
663 | { | 657 | { |
664 | createMonthView(); | 658 | createMonthView(); |
665 | globalFlagBlockAgenda = 1; | 659 | globalFlagBlockAgenda = 1; |
666 | bool full = true; | 660 | bool full = true; |
667 | if ( mCurrentView == mMonthView) | 661 | if ( mCurrentView == mMonthView) |
668 | full = mMainView->leftFrame()->isVisible(); | 662 | full = mMainView->leftFrame()->isVisible(); |
669 | if ( !KOPrefs::instance()->mMonthViewWeek ) { | 663 | if ( !KOPrefs::instance()->mMonthViewWeek ) { |
670 | mMonthView->switchView(); | 664 | mMonthView->switchView(); |
671 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | 665 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) |
672 | full = false; | 666 | full = false; |
673 | else | 667 | else |
674 | full = true; | 668 | full = true; |
675 | } | 669 | } |
676 | mMainView->dateNavigator()->selectWeek(); | 670 | mMainView->dateNavigator()->selectWeek(); |
677 | showView(mMonthView, full ); | 671 | showView(mMonthView, full ); |
678 | mMonthView->setKeyBFocus(); | 672 | mMonthView->setKeyBFocus(); |
673 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; | ||
679 | } | 674 | } |
680 | 675 | ||
681 | void KOViewManager::showMonth( const QDate & date ) | 676 | void KOViewManager::showMonth( const QDate & date ) |
682 | { | 677 | { |
683 | mMainView->dateNavigator()->blockSignals( true ); | 678 | mMainView->dateNavigator()->blockSignals( true ); |
684 | mMainView->dateNavigator()->selectDate( date ); | 679 | mMainView->dateNavigator()->selectDate( date ); |
685 | mMainView->dateNavigator()->blockSignals( false ); | 680 | mMainView->dateNavigator()->blockSignals( false ); |
686 | showMonthView(); | 681 | showMonthView(); |
687 | } | 682 | } |
688 | void KOViewManager::showMonthView() | 683 | void KOViewManager::showMonthView() |
689 | { | 684 | { |
690 | 685 | ||
691 | createMonthView(); | 686 | createMonthView(); |
692 | globalFlagBlockAgenda = 1; | 687 | globalFlagBlockAgenda = 1; |
693 | //mFlagShowNextxDays = false; | 688 | //mFlagShowNextxDays = false; |
694 | bool full = true; | 689 | bool full = true; |
695 | if ( mCurrentView == mMonthView) | 690 | if ( mCurrentView == mMonthView) |
696 | full = mMainView->leftFrame()->isVisible(); | 691 | full = mMainView->leftFrame()->isVisible(); |
697 | // if(mMonthView == mCurrentView) return; | 692 | // if(mMonthView == mCurrentView) return; |
698 | if ( KOPrefs::instance()->mMonthViewWeek ) { | 693 | if ( KOPrefs::instance()->mMonthViewWeek ) { |
699 | mMonthView->switchView(); | 694 | mMonthView->switchView(); |
700 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | 695 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) |
701 | full = false; | 696 | full = false; |
702 | else | 697 | else |
703 | full = true; | 698 | full = true; |
704 | } | 699 | } |
705 | mMainView->dateNavigator()->selectMonth(); | 700 | mMainView->dateNavigator()->selectMonth(); |
706 | 701 | ||
707 | showView(mMonthView, full ); | 702 | showView(mMonthView, full ); |
708 | mMonthView->setKeyBFocus(); | 703 | mMonthView->setKeyBFocus(); |
704 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; | ||
709 | 705 | ||
710 | } | 706 | } |
711 | 707 | ||
712 | void KOViewManager::showTodoView() | 708 | void KOViewManager::showTodoView() |
713 | { | 709 | { |
714 | //mFlagShowNextxDays = false; | 710 | //mFlagShowNextxDays = false; |
715 | if ( !mTodoView ) { | 711 | if ( !mTodoView ) { |
716 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 712 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
717 | "KOViewManager::TodoView" ); | 713 | "KOViewManager::TodoView" ); |
718 | 714 | ||
719 | addView( mTodoView ); | 715 | addView( mTodoView ); |
720 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 716 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
721 | 717 | ||
722 | // SIGNALS/SLOTS FOR TODO VIEW | 718 | // SIGNALS/SLOTS FOR TODO VIEW |
723 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 719 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
724 | mMainView, SLOT( newTodo() ) ); | 720 | mMainView, SLOT( newTodo() ) ); |
725 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 721 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
726 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 722 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
727 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 723 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
728 | mMainView, SLOT( showTodo( Todo * ) ) ); | 724 | mMainView, SLOT( showTodo( Todo * ) ) ); |
729 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 725 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
730 | mMainView, SLOT( editTodo( Todo * ) ) ); | 726 | mMainView, SLOT( editTodo( Todo * ) ) ); |
731 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 727 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
732 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 728 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
733 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 729 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
734 | mMainView, SLOT( purgeCompleted() ) ); | 730 | mMainView, SLOT( purgeCompleted() ) ); |
735 | 731 | ||
736 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 732 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
737 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 733 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
738 | 734 | ||
739 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 735 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
740 | SLOT( updateConfig() ) ); | 736 | SLOT( updateConfig() ) ); |
741 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 737 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
742 | SLOT( updateTodo( Todo *, int ) ) ); | 738 | SLOT( updateTodo( Todo *, int ) ) ); |
743 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 739 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
744 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 740 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
745 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 741 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
746 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 742 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
747 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 743 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
748 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 744 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
749 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 745 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
750 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 746 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
751 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 747 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
752 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 748 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
753 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 749 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
754 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 750 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
755 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 751 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
756 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 752 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
757 | KConfig *config = KOGlobals::config(); | 753 | KConfig *config = KOGlobals::config(); |
758 | mTodoView->restoreLayout(config,"Todo View"); | 754 | mTodoView->restoreLayout(config,"Todo View"); |
759 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 755 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
760 | } | 756 | } |
761 | 757 | ||
762 | globalFlagBlockAgenda = 1; | 758 | globalFlagBlockAgenda = 1; |
763 | showView( mTodoView, true ); | 759 | showView( mTodoView, true ); |
760 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; | ||
764 | 761 | ||
765 | } | 762 | } |
766 | 763 | ||
767 | void KOViewManager::showJournalView() | 764 | void KOViewManager::showJournalView() |
768 | { | 765 | { |
769 | //mFlagShowNextxDays = false; | 766 | //mFlagShowNextxDays = false; |
770 | if (!mJournalView) { | 767 | if (!mJournalView) { |
771 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 768 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
772 | "KOViewManager::JournalView"); | 769 | "KOViewManager::JournalView"); |
773 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 770 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
774 | SLOT( updateConfig() ) ); | 771 | SLOT( updateConfig() ) ); |
775 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 772 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
776 | addView(mJournalView); | 773 | addView(mJournalView); |
777 | } | 774 | } |
778 | 775 | ||
779 | showView(mJournalView); | 776 | showView(mJournalView); |
780 | mMainView->dateNavigator()->selectDates( 1 ); | 777 | mMainView->dateNavigator()->selectDates( 1 ); |
778 | KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; | ||
781 | } | 779 | } |
782 | 780 | ||
783 | void KOViewManager::showTimeSpanView() | 781 | void KOViewManager::showTimeSpanView() |
784 | { | 782 | { |
785 | //mFlagShowNextxDays = false; | 783 | //mFlagShowNextxDays = false; |
786 | if (!mTimeSpanView) { | 784 | if (!mTimeSpanView) { |
787 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 785 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
788 | "KOViewManager::TimeSpanView"); | 786 | "KOViewManager::TimeSpanView"); |
789 | addView(mTimeSpanView); | 787 | addView(mTimeSpanView); |
790 | 788 | ||
791 | mTimeSpanView->readSettings(); | 789 | mTimeSpanView->readSettings(); |
792 | } | 790 | } |
793 | 791 | ||
794 | showView(mTimeSpanView); | 792 | showView(mTimeSpanView); |
795 | } | 793 | } |
796 | 794 | ||
797 | Incidence *KOViewManager::currentSelection() | 795 | Incidence *KOViewManager::currentSelection() |
798 | { | 796 | { |
799 | if (!mCurrentView) return 0; | 797 | if (!mCurrentView) return 0; |
800 | if ( mCurrentView == mListView ) { | 798 | if ( mCurrentView == mListView ) { |
801 | if ( mListView->currentItem() ) | 799 | if ( mListView->currentItem() ) |
802 | return mListView->currentItem(); | 800 | return mListView->currentItem(); |
803 | } | 801 | } |
804 | return mCurrentView->selectedIncidences().first(); | 802 | return mCurrentView->selectedIncidences().first(); |
805 | } | 803 | } |
806 | 804 | ||
807 | QDate KOViewManager::currentSelectionDate() | 805 | QDate KOViewManager::currentSelectionDate() |
808 | { | 806 | { |
809 | QDate qd; | 807 | QDate qd; |
810 | if (mCurrentView) { | 808 | if (mCurrentView) { |
811 | DateList qvl = mCurrentView->selectedDates(); | 809 | DateList qvl = mCurrentView->selectedDates(); |
812 | if (!qvl.isEmpty()) qd = qvl.first(); | 810 | if (!qvl.isEmpty()) qd = qvl.first(); |
813 | } | 811 | } |
814 | return qd; | 812 | return qd; |
815 | } | 813 | } |
816 | 814 | ||
817 | void KOViewManager::addView(KOrg::BaseView *view) | 815 | void KOViewManager::addView(KOrg::BaseView *view) |
818 | { | 816 | { |
819 | #if QT_VERSION >= 0x030000 | 817 | #if QT_VERSION >= 0x030000 |
820 | mMainView->viewStack()->addWidget( view ); | 818 | mMainView->viewStack()->addWidget( view ); |
821 | #else | 819 | #else |
822 | mMainView->viewStack()->addWidget( view, 1 ); | 820 | mMainView->viewStack()->addWidget( view, 1 ); |
823 | #endif | 821 | #endif |
824 | } | 822 | } |
825 | 823 | ||
826 | void KOViewManager::setDocumentId( const QString &id ) | 824 | void KOViewManager::setDocumentId( const QString &id ) |
827 | { | 825 | { |
828 | if (mTodoView) mTodoView->setDocumentId( id ); | 826 | if (mTodoView) mTodoView->setDocumentId( id ); |
829 | } | 827 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d98915b..357154e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,659 +1,660 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
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 "ktoolbar.h" | 60 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 61 | #include "klocale.h" |
62 | #include "kconfig.h" | 62 | #include "kconfig.h" |
63 | #include "simplealarmclient.h" | 63 | #include "simplealarmclient.h" |
64 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
65 | 65 | ||
66 | using namespace KCal; | 66 | using namespace KCal; |
67 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 68 | #include <unistd.h> |
69 | #else | 69 | #else |
70 | #ifdef _OL_IMPORT_ | 70 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 71 | #include "koimportoldialog.h" |
72 | #endif | 72 | #endif |
73 | #endif | 73 | #endif |
74 | #include "mainwindow.h" | 74 | #include "mainwindow.h" |
75 | 75 | ||
76 | 76 | ||
77 | class KOex2phonePrefs : public QDialog | 77 | class KOex2phonePrefs : public QDialog |
78 | { | 78 | { |
79 | public: | 79 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 81 | QDialog( parent, name, true ) |
82 | { | 82 | { |
83 | setCaption( i18n("Export to phone options") ); | 83 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 84 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 85 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 86 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 87 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 89 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 90 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 92 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 93 | mPhoneDevice = 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("Connection: "), temphb ); | 96 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 97 | mPhoneConnection = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | temphb = new QHBox( this ); | 99 | temphb = new QHBox( this ); |
100 | new QLabel( i18n("Model(opt.): "), temphb ); | 100 | new QLabel( i18n("Model(opt.): "), temphb ); |
101 | mPhoneModel = new QLineEdit( temphb); | 101 | mPhoneModel = new QLineEdit( temphb); |
102 | lay->addWidget( temphb ); | 102 | lay->addWidget( temphb ); |
103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
104 | mWriteBackFuture->setChecked( true ); | 104 | mWriteBackFuture->setChecked( true ); |
105 | lay->addWidget( mWriteBackFuture ); | 105 | lay->addWidget( mWriteBackFuture ); |
106 | temphb = new QHBox( this ); | 106 | temphb = new QHBox( this ); |
107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
109 | mWriteBackFutureWeeks->setValue( 8 ); | 109 | mWriteBackFutureWeeks->setValue( 8 ); |
110 | lay->addWidget( temphb ); | 110 | lay->addWidget( temphb ); |
111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
112 | lab->setAlignment (AlignHCenter ); | 112 | lab->setAlignment (AlignHCenter ); |
113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
114 | lay->addWidget( ok ); | 114 | lay->addWidget( ok ); |
115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
116 | lay->addWidget( cancel ); | 116 | lay->addWidget( cancel ); |
117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
119 | resize( 220, 240 ); | 119 | resize( 220, 240 ); |
120 | qApp->processEvents(); | 120 | qApp->processEvents(); |
121 | int dw = QApplication::desktop()->width(); | 121 | int dw = QApplication::desktop()->width(); |
122 | int dh = QApplication::desktop()->height(); | 122 | int dh = QApplication::desktop()->height(); |
123 | move( (dw-width())/2, (dh - height() )/2 ); | 123 | move( (dw-width())/2, (dh - height() )/2 ); |
124 | } | 124 | } |
125 | 125 | ||
126 | public: | 126 | public: |
127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
128 | QCheckBox* mWriteBackFuture; | 128 | QCheckBox* mWriteBackFuture; |
129 | QSpinBox* mWriteBackFutureWeeks; | 129 | QSpinBox* mWriteBackFutureWeeks; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | int globalFlagBlockStartup; | 132 | int globalFlagBlockStartup; |
133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
134 | QMainWindow( parent, name ) | 134 | QMainWindow( parent, name ) |
135 | { | 135 | { |
136 | 136 | ||
137 | mClosed = false; | 137 | mClosed = false; |
138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
139 | QString confFile = locateLocal("config","korganizerrc"); | 139 | QString confFile = locateLocal("config","korganizerrc"); |
140 | QFileInfo finf ( confFile ); | 140 | QFileInfo finf ( confFile ); |
141 | bool showWarning = !finf.exists(); | 141 | bool showWarning = !finf.exists(); |
142 | setIcon(SmallIcon( "ko24" ) ); | 142 | setIcon(SmallIcon( "ko24" ) ); |
143 | mBlockAtStartup = true; | 143 | mBlockAtStartup = true; |
144 | mFlagKeyPressed = false; | 144 | mFlagKeyPressed = false; |
145 | setCaption("KO/Pi"); | 145 | setCaption("KO/Pi"); |
146 | KOPrefs *p = KOPrefs::instance(); | 146 | KOPrefs *p = KOPrefs::instance(); |
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 147 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
148 | p->mCurrentDisplayedView = 0; | ||
148 | if ( p->mHourSize > 22 ) | 149 | if ( p->mHourSize > 22 ) |
149 | p->mHourSize = 22; | 150 | p->mHourSize = 22; |
150 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
151 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
152 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
153 | tbd = Bottom; | 154 | tbd = Bottom; |
154 | else | 155 | else |
155 | tbd = Top; | 156 | tbd = Top; |
156 | } | 157 | } |
157 | else { | 158 | else { |
158 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
159 | tbd = Right; | 160 | tbd = Right; |
160 | else | 161 | else |
161 | tbd = Left; | 162 | tbd = Left; |
162 | } | 163 | } |
163 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
164 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
165 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
166 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
167 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
168 | 169 | ||
169 | #ifdef DESKTOP_VERSION | 170 | #ifdef DESKTOP_VERSION |
170 | if ( KOPrefs::instance()->mShowIconFilter ) | 171 | if ( KOPrefs::instance()->mShowIconFilter ) |
171 | #else | 172 | #else |
172 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 173 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
173 | #endif | 174 | #endif |
174 | 175 | ||
175 | { | 176 | { |
176 | if ( p->mToolBarHorF ) { | 177 | if ( p->mToolBarHorF ) { |
177 | if ( p->mToolBarUpF ) | 178 | if ( p->mToolBarUpF ) |
178 | tbd = Bottom; | 179 | tbd = Bottom; |
179 | else | 180 | else |
180 | tbd = Top; | 181 | tbd = Top; |
181 | } | 182 | } |
182 | else { | 183 | else { |
183 | if ( p->mToolBarUpF ) | 184 | if ( p->mToolBarUpF ) |
184 | tbd = Right; | 185 | tbd = Right; |
185 | else | 186 | else |
186 | tbd = Left; | 187 | tbd = Left; |
187 | } | 188 | } |
188 | filterToolBar = new QPEToolBar ( this ); | 189 | filterToolBar = new QPEToolBar ( this ); |
189 | filterMenubar = new QPEMenuBar( filterToolBar ); | 190 | filterMenubar = new QPEMenuBar( filterToolBar ); |
190 | QFontMetrics fm ( filterMenubar->font() ); | 191 | QFontMetrics fm ( filterMenubar->font() ); |
191 | 192 | ||
192 | filterPopupMenu = new QPopupMenu( this ); | 193 | filterPopupMenu = new QPopupMenu( this ); |
193 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 194 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
194 | QString addTest = "Ax"; | 195 | QString addTest = "Ax"; |
195 | #ifdef DESKTOP_VERSION | 196 | #ifdef DESKTOP_VERSION |
196 | addTest = "AAAx"; | 197 | addTest = "AAAx"; |
197 | #endif | 198 | #endif |
198 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); | 199 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); |
199 | addToolBar (filterToolBar , tbd ); | 200 | addToolBar (filterToolBar , tbd ); |
200 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 201 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
201 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 202 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
202 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 203 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
203 | filterToolBar->hide(); | 204 | filterToolBar->hide(); |
204 | } else { | 205 | } else { |
205 | filterToolBar = 0; | 206 | filterToolBar = 0; |
206 | filterMenubar = 0; | 207 | filterMenubar = 0; |
207 | filterPopupMenu = 0; | 208 | filterPopupMenu = 0; |
208 | } | 209 | } |
209 | if ( p->mShowIconOnetoolbar ) { | 210 | if ( p->mShowIconOnetoolbar ) { |
210 | viewToolBar = iconToolBar ; | 211 | viewToolBar = iconToolBar ; |
211 | navigatorToolBar = iconToolBar ; | 212 | navigatorToolBar = iconToolBar ; |
212 | } else { | 213 | } else { |
213 | #ifndef DESKTOP_VERSION | 214 | #ifndef DESKTOP_VERSION |
214 | setToolBarsMovable( false ); | 215 | setToolBarsMovable( false ); |
215 | #endif | 216 | #endif |
216 | if ( p->mToolBarHorV ) { | 217 | if ( p->mToolBarHorV ) { |
217 | if ( p->mToolBarUpV ) | 218 | if ( p->mToolBarUpV ) |
218 | tbd = Bottom; | 219 | tbd = Bottom; |
219 | else | 220 | else |
220 | tbd = Top; | 221 | tbd = Top; |
221 | } | 222 | } |
222 | else { | 223 | else { |
223 | if ( p->mToolBarUpV ) | 224 | if ( p->mToolBarUpV ) |
224 | tbd = Right; | 225 | tbd = Right; |
225 | else | 226 | else |
226 | tbd = Left; | 227 | tbd = Left; |
227 | } | 228 | } |
228 | viewToolBar = new QPEToolBar( this ); | 229 | viewToolBar = new QPEToolBar( this ); |
229 | addToolBar (viewToolBar , tbd ); | 230 | addToolBar (viewToolBar , tbd ); |
230 | if ( p->mToolBarHorN ) { | 231 | if ( p->mToolBarHorN ) { |
231 | if ( p->mToolBarUpN ) | 232 | if ( p->mToolBarUpN ) |
232 | tbd = Bottom; | 233 | tbd = Bottom; |
233 | else | 234 | else |
234 | tbd = Top; | 235 | tbd = Top; |
235 | } | 236 | } |
236 | else { | 237 | else { |
237 | if ( p->mToolBarUpN ) | 238 | if ( p->mToolBarUpN ) |
238 | tbd = Right; | 239 | tbd = Right; |
239 | else | 240 | else |
240 | tbd = Left; | 241 | tbd = Left; |
241 | } | 242 | } |
242 | navigatorToolBar = new QPEToolBar( this ); | 243 | navigatorToolBar = new QPEToolBar( this ); |
243 | addToolBar (navigatorToolBar , tbd ); | 244 | addToolBar (navigatorToolBar , tbd ); |
244 | } | 245 | } |
245 | 246 | ||
246 | 247 | ||
247 | 248 | ||
248 | mCalendarModifiedFlag = false; | 249 | mCalendarModifiedFlag = false; |
249 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 250 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
250 | splash->setAlignment ( AlignCenter ); | 251 | splash->setAlignment ( AlignCenter ); |
251 | setCentralWidget( splash ); | 252 | setCentralWidget( splash ); |
252 | #ifndef DESKTOP_VERSION | 253 | #ifndef DESKTOP_VERSION |
253 | showMaximized(); | 254 | showMaximized(); |
254 | #endif | 255 | #endif |
255 | 256 | ||
256 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 257 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
257 | setDefaultPreferences(); | 258 | setDefaultPreferences(); |
258 | mCalendar = new CalendarLocal(); | 259 | mCalendar = new CalendarLocal(); |
259 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 260 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
260 | mView->hide(); | 261 | mView->hide(); |
261 | //mView->resize(splash->size() ); | 262 | //mView->resize(splash->size() ); |
262 | initActions(); | 263 | initActions(); |
263 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 264 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
264 | mSyncManager->setBlockSave(false); | 265 | mSyncManager->setBlockSave(false); |
265 | mView->setSyncManager(mSyncManager); | 266 | mView->setSyncManager(mSyncManager); |
266 | #ifndef DESKTOP_VERSION | 267 | #ifndef DESKTOP_VERSION |
267 | iconToolBar->show(); | 268 | iconToolBar->show(); |
268 | qApp->processEvents(); | 269 | qApp->processEvents(); |
269 | #endif | 270 | #endif |
270 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 271 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
271 | int vh = height() ; | 272 | int vh = height() ; |
272 | int vw = width(); | 273 | int vw = width(); |
273 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 274 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
274 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 275 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
275 | vh -= iconToolBar->height(); | 276 | vh -= iconToolBar->height(); |
276 | } else { | 277 | } else { |
277 | vw -= iconToolBar->height(); | 278 | vw -= iconToolBar->height(); |
278 | } | 279 | } |
279 | //mView->setMaximumSize( splash->size() ); | 280 | //mView->setMaximumSize( splash->size() ); |
280 | //mView->resize( splash->size() ); | 281 | //mView->resize( splash->size() ); |
281 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 282 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
282 | mView->readSettings(); | 283 | mView->readSettings(); |
283 | bool newFile = false; | 284 | bool newFile = false; |
284 | if( !QFile::exists( defaultFileName() ) ) { | 285 | if( !QFile::exists( defaultFileName() ) ) { |
285 | QFileInfo finfo ( defaultFileName() ); | 286 | QFileInfo finfo ( defaultFileName() ); |
286 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 287 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
287 | qDebug("oldfile %s ", oldFile.latin1()); | 288 | qDebug("oldfile %s ", oldFile.latin1()); |
288 | 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"; | 289 | 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"; |
289 | finfo.setFile( oldFile ); | 290 | finfo.setFile( oldFile ); |
290 | if (finfo.exists() ) { | 291 | if (finfo.exists() ) { |
291 | KMessageBox::information( this, message); | 292 | KMessageBox::information( this, message); |
292 | mView->openCalendar( oldFile ); | 293 | mView->openCalendar( oldFile ); |
293 | qApp->processEvents(); | 294 | qApp->processEvents(); |
294 | } else { | 295 | } else { |
295 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 296 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
296 | finfo.setFile( oldFile ); | 297 | finfo.setFile( oldFile ); |
297 | if (finfo.exists() ) { | 298 | if (finfo.exists() ) { |
298 | KMessageBox::information( this, message); | 299 | KMessageBox::information( this, message); |
299 | mView->openCalendar( oldFile ); | 300 | mView->openCalendar( oldFile ); |
300 | qApp->processEvents(); | 301 | qApp->processEvents(); |
301 | } | 302 | } |
302 | } | 303 | } |
303 | mView->saveCalendar( defaultFileName() ); | 304 | mView->saveCalendar( defaultFileName() ); |
304 | newFile = true; | 305 | newFile = true; |
305 | } | 306 | } |
306 | 307 | ||
307 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 308 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
308 | mView->openCalendar( defaultFileName() ); | 309 | mView->openCalendar( defaultFileName() ); |
309 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 310 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
310 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 311 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
311 | 312 | ||
312 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 313 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
313 | KOPrefs::instance()->setAllDefaults(); | 314 | KOPrefs::instance()->setAllDefaults(); |
314 | int count = mView->addCategories(); | 315 | int count = mView->addCategories(); |
315 | } | 316 | } |
316 | processIncidenceSelection( 0 ); | 317 | processIncidenceSelection( 0 ); |
317 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 318 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
318 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 319 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
319 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 320 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
320 | SLOT( slotModifiedChanged( bool ) ) ); | 321 | SLOT( slotModifiedChanged( bool ) ) ); |
321 | 322 | ||
322 | 323 | ||
323 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 324 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
324 | SLOT( disableBR(bool) ) ); | 325 | SLOT( disableBR(bool) ) ); |
325 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 326 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
326 | mView->setModified( false ); | 327 | mView->setModified( false ); |
327 | mBlockAtStartup = false; | 328 | mBlockAtStartup = false; |
328 | mView->setModified( false ); | 329 | mView->setModified( false ); |
329 | setCentralWidget( mView ); | 330 | setCentralWidget( mView ); |
330 | globalFlagBlockStartup = 0; | 331 | globalFlagBlockStartup = 0; |
331 | mView->show(); | 332 | mView->show(); |
332 | delete splash; | 333 | delete splash; |
333 | if ( newFile ) | 334 | if ( newFile ) |
334 | mView->updateConfig(); | 335 | mView->updateConfig(); |
335 | // qApp->processEvents(); | 336 | // qApp->processEvents(); |
336 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 337 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
337 | //fillSyncMenu(); | 338 | //fillSyncMenu(); |
338 | 339 | ||
339 | 340 | ||
340 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 341 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
341 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 342 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
342 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 343 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
343 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 344 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
344 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 345 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
345 | mSyncManager->setDefaultFileName( sentSyncFile()); | 346 | mSyncManager->setDefaultFileName( sentSyncFile()); |
346 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 347 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
347 | mSyncManager->fillSyncMenu(); | 348 | mSyncManager->fillSyncMenu(); |
348 | 349 | ||
349 | 350 | ||
350 | 351 | ||
351 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 352 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
352 | if ( showWarning ) { | 353 | if ( showWarning ) { |
353 | KMessageBox::information( this, | 354 | KMessageBox::information( this, |
354 | "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"); | 355 | "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"); |
355 | qApp->processEvents(); | 356 | qApp->processEvents(); |
356 | mView->dialogManager()->showSyncOptions(); | 357 | mView->dialogManager()->showSyncOptions(); |
357 | } | 358 | } |
358 | 359 | ||
359 | //US listen for result adressed from Ka/Pi | 360 | //US listen for result adressed from Ka/Pi |
360 | #ifndef DESKTOP_VERSION | 361 | #ifndef DESKTOP_VERSION |
361 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 362 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
362 | #endif | 363 | #endif |
363 | #ifndef DESKTOP_VERSION | 364 | #ifndef DESKTOP_VERSION |
364 | infrared = 0; | 365 | infrared = 0; |
365 | #endif | 366 | #endif |
366 | updateFilterToolbar(); | 367 | updateFilterToolbar(); |
367 | updateWeek( mView->startDate() ); | 368 | updateWeek( mView->startDate() ); |
368 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 369 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
369 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 370 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
370 | mBRdisabled = false; | 371 | mBRdisabled = false; |
371 | //toggleBeamReceive(); | 372 | //toggleBeamReceive(); |
372 | } | 373 | } |
373 | MainWindow::~MainWindow() | 374 | MainWindow::~MainWindow() |
374 | { | 375 | { |
375 | //qDebug("MainWindow::~MainWindow() "); | 376 | //qDebug("MainWindow::~MainWindow() "); |
376 | //save toolbar location | 377 | //save toolbar location |
377 | delete mCalendar; | 378 | delete mCalendar; |
378 | delete mSyncManager; | 379 | delete mSyncManager; |
379 | #ifndef DESKTOP_VERSION | 380 | #ifndef DESKTOP_VERSION |
380 | if ( infrared ) | 381 | if ( infrared ) |
381 | delete infrared; | 382 | delete infrared; |
382 | #endif | 383 | #endif |
383 | 384 | ||
384 | 385 | ||
385 | } | 386 | } |
386 | 387 | ||
387 | void MainWindow::disableBR(bool b) | 388 | void MainWindow::disableBR(bool b) |
388 | { | 389 | { |
389 | #ifndef DESKTOP_VERSION | 390 | #ifndef DESKTOP_VERSION |
390 | if ( b ) { | 391 | if ( b ) { |
391 | if ( infrared ) { | 392 | if ( infrared ) { |
392 | toggleBeamReceive(); | 393 | toggleBeamReceive(); |
393 | mBRdisabled = true; | 394 | mBRdisabled = true; |
394 | } | 395 | } |
395 | mBRdisabled = true; | 396 | mBRdisabled = true; |
396 | } else { | 397 | } else { |
397 | if ( mBRdisabled ) { | 398 | if ( mBRdisabled ) { |
398 | mBRdisabled = false; | 399 | mBRdisabled = false; |
399 | //makes no sense,because other cal ap is probably running | 400 | //makes no sense,because other cal ap is probably running |
400 | // toggleBeamReceive(); | 401 | // toggleBeamReceive(); |
401 | } | 402 | } |
402 | } | 403 | } |
403 | #endif | 404 | #endif |
404 | 405 | ||
405 | } | 406 | } |
406 | bool MainWindow::beamReceiveEnabled() | 407 | bool MainWindow::beamReceiveEnabled() |
407 | { | 408 | { |
408 | #ifndef DESKTOP_VERSION | 409 | #ifndef DESKTOP_VERSION |
409 | return ( infrared != 0 ); | 410 | return ( infrared != 0 ); |
410 | #endif | 411 | #endif |
411 | return false; | 412 | return false; |
412 | } | 413 | } |
413 | 414 | ||
414 | void MainWindow::toggleBeamReceive() | 415 | void MainWindow::toggleBeamReceive() |
415 | { | 416 | { |
416 | if ( mBRdisabled ) | 417 | if ( mBRdisabled ) |
417 | return; | 418 | return; |
418 | #ifndef DESKTOP_VERSION | 419 | #ifndef DESKTOP_VERSION |
419 | if ( infrared ) { | 420 | if ( infrared ) { |
420 | qDebug("disable BeamReceive "); | 421 | qDebug("disable BeamReceive "); |
421 | delete infrared; | 422 | delete infrared; |
422 | infrared = 0; | 423 | infrared = 0; |
423 | brAction->setOn(false); | 424 | brAction->setOn(false); |
424 | return; | 425 | return; |
425 | } | 426 | } |
426 | qDebug("enable BeamReceive "); | 427 | qDebug("enable BeamReceive "); |
427 | brAction->setOn(true); | 428 | brAction->setOn(true); |
428 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 429 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
429 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 430 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
430 | #endif | 431 | #endif |
431 | } | 432 | } |
432 | void MainWindow::showMaximized () | 433 | void MainWindow::showMaximized () |
433 | { | 434 | { |
434 | #ifndef DESKTOP_VERSION | 435 | #ifndef DESKTOP_VERSION |
435 | if ( ! globalFlagBlockStartup ) | 436 | if ( ! globalFlagBlockStartup ) |
436 | if ( mClosed ) | 437 | if ( mClosed ) |
437 | mView->goToday(); | 438 | mView->goToday(); |
438 | #endif | 439 | #endif |
439 | QWidget::showMaximized () ; | 440 | QWidget::showMaximized () ; |
440 | mClosed = false; | 441 | mClosed = false; |
441 | } | 442 | } |
442 | void MainWindow::closeEvent( QCloseEvent* ce ) | 443 | void MainWindow::closeEvent( QCloseEvent* ce ) |
443 | { | 444 | { |
444 | 445 | ||
445 | 446 | ||
446 | 447 | ||
447 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 448 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
448 | saveOnClose(); | 449 | saveOnClose(); |
449 | mClosed = true; | 450 | mClosed = true; |
450 | ce->accept(); | 451 | ce->accept(); |
451 | return; | 452 | return; |
452 | 453 | ||
453 | } | 454 | } |
454 | 455 | ||
455 | switch( QMessageBox::information( this, "KO/Pi", | 456 | switch( QMessageBox::information( this, "KO/Pi", |
456 | i18n("Do you really want\nto close KO/Pi?"), | 457 | i18n("Do you really want\nto close KO/Pi?"), |
457 | i18n("Close"), i18n("No"), | 458 | i18n("Close"), i18n("No"), |
458 | 0, 0 ) ) { | 459 | 0, 0 ) ) { |
459 | case 0: | 460 | case 0: |
460 | saveOnClose(); | 461 | saveOnClose(); |
461 | mClosed = true; | 462 | mClosed = true; |
462 | ce->accept(); | 463 | ce->accept(); |
463 | break; | 464 | break; |
464 | case 1: | 465 | case 1: |
465 | ce->ignore(); | 466 | ce->ignore(); |
466 | break; | 467 | break; |
467 | case 2: | 468 | case 2: |
468 | 469 | ||
469 | default: | 470 | default: |
470 | break; | 471 | break; |
471 | } | 472 | } |
472 | 473 | ||
473 | 474 | ||
474 | } | 475 | } |
475 | 476 | ||
476 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 477 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
477 | { | 478 | { |
478 | QDataStream stream( data, IO_ReadOnly ); | 479 | QDataStream stream( data, IO_ReadOnly ); |
479 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 480 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
480 | //QString datamess; | 481 | //QString datamess; |
481 | //qDebug("message "); | 482 | //qDebug("message "); |
482 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 483 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
483 | 484 | ||
484 | if ( cmsg == "setDocument(QString)" ) { | 485 | if ( cmsg == "setDocument(QString)" ) { |
485 | QDataStream stream( data, IO_ReadOnly ); | 486 | QDataStream stream( data, IO_ReadOnly ); |
486 | QString fileName; | 487 | QString fileName; |
487 | stream >> fileName; | 488 | stream >> fileName; |
488 | //qDebug("filename %s ", fileName.latin1()); | 489 | //qDebug("filename %s ", fileName.latin1()); |
489 | showMaximized(); | 490 | showMaximized(); |
490 | raise(); | 491 | raise(); |
491 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 492 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
492 | mSyncManager->slotSyncMenu( 1002 ); | 493 | mSyncManager->slotSyncMenu( 1002 ); |
493 | return; | 494 | return; |
494 | } | 495 | } |
495 | 496 | ||
496 | if ( cmsg == "-writeFile" ) { | 497 | if ( cmsg == "-writeFile" ) { |
497 | // I made from the "-writeFile" an "-writeAlarm" | 498 | // I made from the "-writeFile" an "-writeAlarm" |
498 | mView->viewManager()->showWhatsNextView(); | 499 | mView->viewManager()->showWhatsNextView(); |
499 | mCalendar->checkAlarmForIncidence( 0, true); | 500 | mCalendar->checkAlarmForIncidence( 0, true); |
500 | showMaximized(); | 501 | showMaximized(); |
501 | raise(); | 502 | raise(); |
502 | return; | 503 | return; |
503 | 504 | ||
504 | } | 505 | } |
505 | if ( cmsg == "-writeFileSilent" ) { | 506 | if ( cmsg == "-writeFileSilent" ) { |
506 | // I made from the "-writeFile" an "-writeAlarm" | 507 | // I made from the "-writeFile" an "-writeAlarm" |
507 | // mView->viewManager()->showWhatsNextView(); | 508 | // mView->viewManager()->showWhatsNextView(); |
508 | mCalendar->checkAlarmForIncidence( 0, true); | 509 | mCalendar->checkAlarmForIncidence( 0, true); |
509 | //showMaximized(); | 510 | //showMaximized(); |
510 | //raise(); | 511 | //raise(); |
511 | hide(); | 512 | hide(); |
512 | return; | 513 | return; |
513 | } | 514 | } |
514 | if ( cmsg == "-newCountdown" ) { | 515 | if ( cmsg == "-newCountdown" ) { |
515 | qDebug("newCountdown "); | 516 | qDebug("newCountdown "); |
516 | 517 | ||
517 | } | 518 | } |
518 | QString msg ; | 519 | QString msg ; |
519 | QString allmsg = cmsg; | 520 | QString allmsg = cmsg; |
520 | while ( allmsg.length() > 0 ) { | 521 | while ( allmsg.length() > 0 ) { |
521 | int nextC = allmsg.find( "-", 1 ); | 522 | int nextC = allmsg.find( "-", 1 ); |
522 | if ( nextC == -1 ) { | 523 | if ( nextC == -1 ) { |
523 | msg = allmsg; | 524 | msg = allmsg; |
524 | allmsg = ""; | 525 | allmsg = ""; |
525 | } else{ | 526 | } else{ |
526 | msg = allmsg.left( nextC ); | 527 | msg = allmsg.left( nextC ); |
527 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 528 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
528 | } | 529 | } |
529 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 530 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
530 | if ( msg == "-newEvent" ) { | 531 | if ( msg == "-newEvent" ) { |
531 | mView->newEvent(); | 532 | mView->newEvent(); |
532 | } | 533 | } |
533 | if ( msg == "-newTodo" ) { | 534 | if ( msg == "-newTodo" ) { |
534 | mView->newTodo(); | 535 | mView->newTodo(); |
535 | 536 | ||
536 | } | 537 | } |
537 | if ( msg == "-showWN" ) { | 538 | if ( msg == "-showWN" ) { |
538 | mView->viewManager()->showWhatsNextView(); | 539 | mView->viewManager()->showWhatsNextView(); |
539 | } | 540 | } |
540 | if ( msg == "-showTodo" ) { | 541 | if ( msg == "-showTodo" ) { |
541 | mView->viewManager()->showTodoView(); | 542 | mView->viewManager()->showTodoView(); |
542 | } | 543 | } |
543 | if ( msg == "-showList" ) { | 544 | if ( msg == "-showList" ) { |
544 | mView->viewManager()->showListView(); | 545 | mView->viewManager()->showListView(); |
545 | } | 546 | } |
546 | else if ( msg == "-showDay" ) { | 547 | else if ( msg == "-showDay" ) { |
547 | mView->viewManager()->showDayView(); | 548 | mView->viewManager()->showDayView(); |
548 | } | 549 | } |
549 | else if ( msg == "-showWWeek" ) { | 550 | else if ( msg == "-showWWeek" ) { |
550 | mView->viewManager()->showWorkWeekView(); | 551 | mView->viewManager()->showWorkWeekView(); |
551 | } | 552 | } |
552 | else if ( msg == "-ringSync" ) { | 553 | else if ( msg == "-ringSync" ) { |
553 | mSyncManager->multiSync( false ); | 554 | mSyncManager->multiSync( false ); |
554 | } | 555 | } |
555 | else if ( msg == "-showWeek" ) { | 556 | else if ( msg == "-showWeek" ) { |
556 | mView->viewManager()->showWeekView(); | 557 | mView->viewManager()->showWeekView(); |
557 | } | 558 | } |
558 | else if ( msg == "-showTodo" ) { | 559 | else if ( msg == "-showTodo" ) { |
559 | mView->viewManager()->showTodoView(); | 560 | mView->viewManager()->showTodoView(); |
560 | } | 561 | } |
561 | else if ( msg == "-showJournal" ) { | 562 | else if ( msg == "-showJournal" ) { |
562 | mView->dateNavigator()->selectDates( 1 ); | 563 | mView->dateNavigator()->selectDates( 1 ); |
563 | mView->dateNavigator()->selectToday(); | 564 | mView->dateNavigator()->selectToday(); |
564 | mView->viewManager()->showJournalView(); | 565 | mView->viewManager()->showJournalView(); |
565 | } | 566 | } |
566 | else if ( msg == "-showKO" ) { | 567 | else if ( msg == "-showKO" ) { |
567 | mView->viewManager()->showNextXView(); | 568 | mView->viewManager()->showNextXView(); |
568 | } | 569 | } |
569 | else if ( msg == "-showWNext" ) { | 570 | else if ( msg == "-showWNext" ) { |
570 | mView->viewManager()->showWhatsNextView(); | 571 | mView->viewManager()->showWhatsNextView(); |
571 | } | 572 | } |
572 | else if ( msg == "nextView()" ) { | 573 | else if ( msg == "nextView()" ) { |
573 | mView->viewManager()->showNextView(); | 574 | mView->viewManager()->showNextView(); |
574 | } | 575 | } |
575 | else if ( msg == "-showNextXView" ) { | 576 | else if ( msg == "-showNextXView" ) { |
576 | mView->viewManager()->showNextXView(); | 577 | mView->viewManager()->showNextXView(); |
577 | } | 578 | } |
578 | 579 | ||
579 | 580 | ||
580 | } | 581 | } |
581 | 582 | ||
582 | showMaximized(); | 583 | showMaximized(); |
583 | raise(); | 584 | raise(); |
584 | } | 585 | } |
585 | 586 | ||
586 | QPixmap MainWindow::loadPixmap( QString name ) | 587 | QPixmap MainWindow::loadPixmap( QString name ) |
587 | { | 588 | { |
588 | return SmallIcon( name ); | 589 | return SmallIcon( name ); |
589 | 590 | ||
590 | } | 591 | } |
591 | void MainWindow::initActions() | 592 | void MainWindow::initActions() |
592 | { | 593 | { |
593 | //KOPrefs::instance()->mShowFullMenu | 594 | //KOPrefs::instance()->mShowFullMenu |
594 | iconToolBar->clear(); | 595 | iconToolBar->clear(); |
595 | KOPrefs *p = KOPrefs::instance(); | 596 | KOPrefs *p = KOPrefs::instance(); |
596 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 597 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
597 | 598 | ||
598 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 599 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
599 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 600 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
600 | QPopupMenu *importMenu = new QPopupMenu( this ); | 601 | QPopupMenu *importMenu = new QPopupMenu( this ); |
601 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 602 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
602 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 603 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
603 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 604 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
604 | selectFilterMenu = new QPopupMenu( this ); | 605 | selectFilterMenu = new QPopupMenu( this ); |
605 | selectFilterMenu->setCheckable( true ); | 606 | selectFilterMenu->setCheckable( true ); |
606 | syncMenu = new QPopupMenu( this ); | 607 | syncMenu = new QPopupMenu( this ); |
607 | configureAgendaMenu = new QPopupMenu( this ); | 608 | configureAgendaMenu = new QPopupMenu( this ); |
608 | configureToolBarMenu = new QPopupMenu( this ); | 609 | configureToolBarMenu = new QPopupMenu( this ); |
609 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 610 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
610 | QIconSet icon; | 611 | QIconSet icon; |
611 | int pixWid = 22, pixHei = 22; | 612 | int pixWid = 22, pixHei = 22; |
612 | QString pathString = ""; | 613 | QString pathString = ""; |
613 | if ( !p->mToolBarMiniIcons ) { | 614 | if ( !p->mToolBarMiniIcons ) { |
614 | if ( QApplication::desktop()->width() < 480 ) { | 615 | if ( QApplication::desktop()->width() < 480 ) { |
615 | pathString += "icons16/"; | 616 | pathString += "icons16/"; |
616 | pixWid = 18; pixHei = 16; | 617 | pixWid = 18; pixHei = 16; |
617 | } | 618 | } |
618 | } else { | 619 | } else { |
619 | pathString += "iconsmini/"; | 620 | pathString += "iconsmini/"; |
620 | pixWid = 18; pixHei = 16; | 621 | pixWid = 18; pixHei = 16; |
621 | } | 622 | } |
622 | if ( KOPrefs::instance()->mShowFullMenu ) { | 623 | if ( KOPrefs::instance()->mShowFullMenu ) { |
623 | QMenuBar *menuBar1; | 624 | QMenuBar *menuBar1; |
624 | menuBar1 = menuBar(); | 625 | menuBar1 = menuBar(); |
625 | menuBar1->insertItem( i18n("File"), importMenu ); | 626 | menuBar1->insertItem( i18n("File"), importMenu ); |
626 | menuBar1->insertItem( i18n("View"), viewMenu ); | 627 | menuBar1->insertItem( i18n("View"), viewMenu ); |
627 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 628 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
628 | #ifdef DESKTOP_VERSION | 629 | #ifdef DESKTOP_VERSION |
629 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 630 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
630 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 631 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
631 | #else | 632 | #else |
632 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 633 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
633 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 634 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
634 | #endif | 635 | #endif |
635 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 636 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
636 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 637 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
637 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 638 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
638 | } else { | 639 | } else { |
639 | QPEMenuBar *menuBar1; | 640 | QPEMenuBar *menuBar1; |
640 | menuBar1 = new QPEMenuBar( iconToolBar ); | 641 | menuBar1 = new QPEMenuBar( iconToolBar ); |
641 | QPopupMenu *menuBar = new QPopupMenu( this ); | 642 | QPopupMenu *menuBar = new QPopupMenu( this ); |
642 | icon = loadPixmap( pathString + "z_menu" ); | 643 | icon = loadPixmap( pathString + "z_menu" ); |
643 | menuBar1->insertItem( icon.pixmap(), menuBar); | 644 | menuBar1->insertItem( icon.pixmap(), menuBar); |
644 | //menuBar1->insertItem( i18n("ME"), menuBar); | 645 | //menuBar1->insertItem( i18n("ME"), menuBar); |
645 | menuBar->insertItem( i18n("File"), importMenu ); | 646 | menuBar->insertItem( i18n("File"), importMenu ); |
646 | menuBar->insertItem( i18n("View"), viewMenu ); | 647 | menuBar->insertItem( i18n("View"), viewMenu ); |
647 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 648 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
648 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 649 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
649 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 650 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
650 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 651 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
651 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 652 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
652 | menuBar->insertItem( i18n("Help"), helpMenu ); | 653 | menuBar->insertItem( i18n("Help"), helpMenu ); |
653 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 654 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
654 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 655 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
655 | } | 656 | } |
656 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 657 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
657 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 658 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
658 | 659 | ||
659 | 660 | ||
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 341a839..db60383 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,417 +1,460 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 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 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qgroupbox.h> | 27 | #include <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkdepim/kdateedit.h> | 37 | #include <libkdepim/kdateedit.h> |
38 | 38 | ||
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "klineedit.h" | 41 | #include "klineedit.h" |
42 | 42 | ||
43 | #include "calendarview.h" | 43 | #include "calendarview.h" |
44 | #include "koviewmanager.h" | 44 | #include "koviewmanager.h" |
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | searchLabel = new QLabel(topFrame); | 58 | searchLabel = new QLabel(topFrame); |
59 | searchLabel->setText(i18n("Search for:")); | 59 | searchLabel->setText(i18n("Search for:")); |
60 | subLayout->addWidget(searchLabel); | 60 | subLayout->addWidget(searchLabel); |
61 | 61 | ||
62 | searchEdit = new KLineEdit(topFrame); | 62 | searchEdit = new KLineEdit(topFrame); |
63 | subLayout->addWidget(searchEdit); | 63 | subLayout->addWidget(searchEdit); |
64 | QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); | 64 | QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); |
65 | //OkButton->setDefault( true ); | 65 | //OkButton->setDefault( true ); |
66 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 66 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
67 | subLayout->addWidget(OkButton); | 67 | subLayout->addWidget(OkButton); |
68 | searchEdit->setText("*"); // Find all events by default | 68 | searchEdit->setText("*"); // Find all events by default |
69 | searchEdit->setFocus(); | 69 | searchEdit->setFocus(); |
70 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 70 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
71 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 71 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
72 | // Subjects to search | 72 | // Subjects to search |
73 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 73 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
74 | // topFrame); | 74 | // topFrame); |
75 | 75 | ||
76 | QHBox *incidenceGroup = new QHBox( topFrame ); | 76 | QHBox *incidenceGroup = new QHBox( topFrame ); |
77 | layout->addWidget(incidenceGroup); | 77 | layout->addWidget(incidenceGroup); |
78 | 78 | ||
79 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 79 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
80 | mSearchEvent->setChecked(true); | 80 | //mSearchEvent->setChecked(true); |
81 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 81 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
82 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 82 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
83 | 83 | ||
84 | QHBox *subjectGroup = new QHBox( topFrame ); | 84 | QHBox *subjectGroup = new QHBox( topFrame ); |
85 | layout->addWidget(subjectGroup); | 85 | layout->addWidget(subjectGroup); |
86 | 86 | ||
87 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 87 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
88 | mSummaryCheck->setChecked(true); | 88 | mSummaryCheck->setChecked(true); |
89 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 89 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
90 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 90 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
91 | 91 | ||
92 | QHBox *attendeeGroup = new QHBox( topFrame ); | 92 | QHBox *attendeeGroup = new QHBox( topFrame ); |
93 | layout->addWidget(attendeeGroup ); | 93 | layout->addWidget(attendeeGroup ); |
94 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 94 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
95 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 95 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
96 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 96 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
97 | // Date range | 97 | // Date range |
98 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 98 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
99 | // topFrame); | 99 | // topFrame); |
100 | // layout->addWidget(rangeGroup); | 100 | // layout->addWidget(rangeGroup); |
101 | 101 | ||
102 | QWidget *rangeWidget = new QWidget(topFrame); | 102 | QWidget *rangeWidget = new QWidget(topFrame); |
103 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 103 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
104 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 104 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
105 | mStartDate = new KDateEdit(rangeWidget); | 105 | mStartDate = new KDateEdit(rangeWidget); |
106 | rangeLayout->addWidget(mStartDate); | 106 | rangeLayout->addWidget(mStartDate); |
107 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 107 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
108 | mEndDate = new KDateEdit(rangeWidget); | 108 | mEndDate = new KDateEdit(rangeWidget); |
109 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 109 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
110 | rangeLayout->addWidget(mEndDate); | 110 | rangeLayout->addWidget(mEndDate); |
111 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 111 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
112 | rangeLayout->addWidget( (QWidget*)wt ); | 112 | rangeLayout->addWidget( (QWidget*)wt ); |
113 | layout->addWidget(rangeWidget); | 113 | layout->addWidget(rangeWidget); |
114 | // Results list view | 114 | // Results list view |
115 | listView = new KOListView(mCalendar,topFrame); | 115 | listView = new KOListView(mCalendar,topFrame); |
116 | layout->addWidget(listView); | 116 | layout->addWidget(listView); |
117 | 117 | ||
118 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 118 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
119 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 119 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
120 | 120 | ||
121 | setCaption( i18n("KO/Pi Find: ")); | 121 | setCaption( i18n("KO/Pi Find: ")); |
122 | #ifdef DESKTOP_VERSION | 122 | #ifdef DESKTOP_VERSION |
123 | OkButton = new QPushButton( i18n("Close"), this ); | 123 | OkButton = new QPushButton( i18n("Close"), this ); |
124 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 124 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
125 | #endif | 125 | #endif |
126 | } | 126 | } |
127 | 127 | ||
128 | SearchDialog::~SearchDialog() | 128 | SearchDialog::~SearchDialog() |
129 | { | 129 | { |
130 | 130 | ||
131 | } | 131 | } |
132 | void SearchDialog::raiseAndSelect() | ||
133 | { | ||
134 | |||
135 | static int currentState = 0; | ||
136 | |||
137 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | ||
138 | currentState = 0; | ||
139 | int newState = 0; | ||
140 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | ||
141 | newState = VIEW_J_VIEW; | ||
142 | } | ||
143 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | ||
144 | newState = VIEW_T_VIEW; | ||
145 | } | ||
146 | else { | ||
147 | newState = VIEW_A_VIEW; | ||
148 | } | ||
149 | if ( newState != currentState ) { | ||
150 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | ||
151 | if ( ! mSearchJournal->isChecked() ) { | ||
152 | mSearchJournal->setChecked( true ); | ||
153 | mSearchTodo->setChecked( false ); | ||
154 | mSearchEvent->setChecked( false ); | ||
155 | } | ||
156 | } | ||
157 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | ||
158 | if ( ! mSearchTodo->isChecked() ) { | ||
159 | mSearchTodo->setChecked( true ); | ||
160 | mSearchJournal->setChecked( false ); | ||
161 | mSearchEvent->setChecked( false ); | ||
162 | } | ||
163 | } | ||
164 | else { | ||
165 | if ( ! mSearchEvent->isChecked() ) { | ||
166 | mSearchEvent->setChecked( true ); | ||
167 | mSearchJournal->setChecked( false ); | ||
168 | mSearchTodo->setChecked( false ); | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | currentState = newState; | ||
173 | raise(); | ||
174 | } | ||
132 | void SearchDialog::setFocusToList() | 175 | void SearchDialog::setFocusToList() |
133 | { | 176 | { |
134 | listView->resetFocus(); | 177 | listView->resetFocus(); |
135 | } | 178 | } |
136 | void SearchDialog::accept() | 179 | void SearchDialog::accept() |
137 | { | 180 | { |
138 | doSearch(); | 181 | doSearch(); |
139 | } | 182 | } |
140 | void SearchDialog::updateList() | 183 | void SearchDialog::updateList() |
141 | { | 184 | { |
142 | //listView->updateList(); | 185 | //listView->updateList(); |
143 | if ( isVisible() ) { | 186 | if ( isVisible() ) { |
144 | updateView(); | 187 | updateView(); |
145 | //qDebug("SearchDialog::updated "); | 188 | //qDebug("SearchDialog::updated "); |
146 | } | 189 | } |
147 | else { | 190 | else { |
148 | listView->clear(); | 191 | listView->clear(); |
149 | //qDebug("SearchDialog::cleared "); | 192 | //qDebug("SearchDialog::cleared "); |
150 | 193 | ||
151 | } | 194 | } |
152 | } | 195 | } |
153 | void SearchDialog::searchTextChanged( const QString &_text ) | 196 | void SearchDialog::searchTextChanged( const QString &_text ) |
154 | { | 197 | { |
155 | #if 0 | 198 | #if 0 |
156 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 199 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
157 | #endif | 200 | #endif |
158 | } | 201 | } |
159 | 202 | ||
160 | void SearchDialog::doSearch() | 203 | void SearchDialog::doSearch() |
161 | { | 204 | { |
162 | QRegExp re; | 205 | QRegExp re; |
163 | 206 | ||
164 | re.setWildcard(true); // most people understand these better. | 207 | re.setWildcard(true); // most people understand these better. |
165 | re.setCaseSensitive(false); | 208 | re.setCaseSensitive(false); |
166 | re.setPattern(searchEdit->text()); | 209 | re.setPattern(searchEdit->text()); |
167 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 210 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
168 | KMessageBox::sorry(this, | 211 | KMessageBox::sorry(this, |
169 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 212 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
170 | return; | 213 | return; |
171 | } | 214 | } |
172 | if (!re.isValid() ) { | 215 | if (!re.isValid() ) { |
173 | KMessageBox::sorry(this, | 216 | KMessageBox::sorry(this, |
174 | i18n("Invalid search expression,\ncannot perform " | 217 | i18n("Invalid search expression,\ncannot perform " |
175 | "the search.\nPlease enter a search expression\n" | 218 | "the search.\nPlease enter a search expression\n" |
176 | "using the wildcard characters\n '*' and '?'" | 219 | "using the wildcard characters\n '*' and '?'" |
177 | "where needed.")); | 220 | "where needed.")); |
178 | return; | 221 | return; |
179 | } | 222 | } |
180 | 223 | ||
181 | search(re); | 224 | search(re); |
182 | 225 | ||
183 | listView->setStartDate( mStartDate->date() ); | 226 | listView->setStartDate( mStartDate->date() ); |
184 | listView->showEvents(mMatchedEvents); | 227 | listView->showEvents(mMatchedEvents); |
185 | listView->addTodos(mMatchedTodos); | 228 | listView->addTodos(mMatchedTodos); |
186 | listView->addJournals(mMatchedJournals); | 229 | listView->addJournals(mMatchedJournals); |
187 | 230 | ||
188 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 231 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
189 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 232 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
190 | } else { | 233 | } else { |
191 | QString mess; | 234 | QString mess; |
192 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 235 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
193 | setCaption( i18n("KO/Pi Find: ") + mess); | 236 | setCaption( i18n("KO/Pi Find: ") + mess); |
194 | 237 | ||
195 | } | 238 | } |
196 | searchEdit->setFocus(); | 239 | searchEdit->setFocus(); |
197 | } | 240 | } |
198 | void SearchDialog::updateConfig() | 241 | void SearchDialog::updateConfig() |
199 | { | 242 | { |
200 | listView->updateConfig(); | 243 | listView->updateConfig(); |
201 | } | 244 | } |
202 | void SearchDialog::updateView() | 245 | void SearchDialog::updateView() |
203 | { | 246 | { |
204 | 247 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | |
205 | QRegExp re; | 248 | QRegExp re; |
206 | re.setWildcard(true); // most people understand these better. | 249 | re.setWildcard(true); // most people understand these better. |
207 | re.setCaseSensitive(false); | 250 | re.setCaseSensitive(false); |
208 | re.setPattern(searchEdit->text()); | 251 | re.setPattern(searchEdit->text()); |
209 | if (re.isValid()) { | 252 | if (re.isValid()) { |
210 | search(re); | 253 | search(re); |
211 | } else { | 254 | } else { |
212 | mMatchedEvents.clear(); | 255 | mMatchedEvents.clear(); |
213 | mMatchedTodos.clear(); | 256 | mMatchedTodos.clear(); |
214 | mMatchedJournals.clear(); | 257 | mMatchedJournals.clear(); |
215 | } | 258 | } |
216 | listView->setStartDate( mStartDate->date() ); | 259 | listView->setStartDate( mStartDate->date() ); |
217 | listView->showEvents(mMatchedEvents); | 260 | listView->showEvents(mMatchedEvents); |
218 | listView->addTodos(mMatchedTodos); | 261 | listView->addTodos(mMatchedTodos); |
219 | listView->addJournals(mMatchedJournals); | 262 | listView->addJournals(mMatchedJournals); |
220 | } | 263 | } |
221 | 264 | ||
222 | void SearchDialog::search(const QRegExp &re) | 265 | void SearchDialog::search(const QRegExp &re) |
223 | { | 266 | { |
224 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 267 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
225 | mEndDate->date(), | 268 | mEndDate->date(), |
226 | false /*mInclusiveCheck->isChecked()*/ ); | 269 | false /*mInclusiveCheck->isChecked()*/ ); |
227 | 270 | ||
228 | mMatchedEvents.clear(); | 271 | mMatchedEvents.clear(); |
229 | if ( mSearchEvent->isChecked() ) { | 272 | if ( mSearchEvent->isChecked() ) { |
230 | Event *ev; | 273 | Event *ev; |
231 | for(ev=events.first();ev;ev=events.next()) { | 274 | for(ev=events.first();ev;ev=events.next()) { |
232 | if (mSummaryCheck->isChecked()) { | 275 | if (mSummaryCheck->isChecked()) { |
233 | #if QT_VERSION >= 0x030000 | 276 | #if QT_VERSION >= 0x030000 |
234 | if (re.search(ev->summary()) != -1) | 277 | if (re.search(ev->summary()) != -1) |
235 | #else | 278 | #else |
236 | if (re.match(ev->summary()) != -1) | 279 | if (re.match(ev->summary()) != -1) |
237 | #endif | 280 | #endif |
238 | { | 281 | { |
239 | mMatchedEvents.append(ev); | 282 | mMatchedEvents.append(ev); |
240 | continue; | 283 | continue; |
241 | } | 284 | } |
242 | #if QT_VERSION >= 0x030000 | 285 | #if QT_VERSION >= 0x030000 |
243 | if (re.search(ev->location()) != -1) | 286 | if (re.search(ev->location()) != -1) |
244 | #else | 287 | #else |
245 | if (re.match(ev->location()) != -1) | 288 | if (re.match(ev->location()) != -1) |
246 | #endif | 289 | #endif |
247 | { | 290 | { |
248 | mMatchedEvents.append(ev); | 291 | mMatchedEvents.append(ev); |
249 | continue; | 292 | continue; |
250 | } | 293 | } |
251 | } | 294 | } |
252 | if (mDescriptionCheck->isChecked()) { | 295 | if (mDescriptionCheck->isChecked()) { |
253 | #if QT_VERSION >= 0x030000 | 296 | #if QT_VERSION >= 0x030000 |
254 | if (re.search(ev->description()) != -1) | 297 | if (re.search(ev->description()) != -1) |
255 | #else | 298 | #else |
256 | if (re.match(ev->description()) != -1) | 299 | if (re.match(ev->description()) != -1) |
257 | #endif | 300 | #endif |
258 | { | 301 | { |
259 | mMatchedEvents.append(ev); | 302 | mMatchedEvents.append(ev); |
260 | continue; | 303 | continue; |
261 | } | 304 | } |
262 | } | 305 | } |
263 | if (mCategoryCheck->isChecked()) { | 306 | if (mCategoryCheck->isChecked()) { |
264 | #if QT_VERSION >= 0x030000 | 307 | #if QT_VERSION >= 0x030000 |
265 | if (re.search(ev->categoriesStr()) != -1) | 308 | if (re.search(ev->categoriesStr()) != -1) |
266 | #else | 309 | #else |
267 | if (re.match(ev->categoriesStr()) != -1) | 310 | if (re.match(ev->categoriesStr()) != -1) |
268 | #endif | 311 | #endif |
269 | { | 312 | { |
270 | mMatchedEvents.append(ev); | 313 | mMatchedEvents.append(ev); |
271 | continue; | 314 | continue; |
272 | } | 315 | } |
273 | } | 316 | } |
274 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 317 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
275 | QPtrList<Attendee> tmpAList = ev->attendees(); | 318 | QPtrList<Attendee> tmpAList = ev->attendees(); |
276 | Attendee *a; | 319 | Attendee *a; |
277 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 320 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
278 | if (mSearchAName->isChecked()) { | 321 | if (mSearchAName->isChecked()) { |
279 | #if QT_VERSION >= 0x030000 | 322 | #if QT_VERSION >= 0x030000 |
280 | if (re.search(a->name()) != -1) | 323 | if (re.search(a->name()) != -1) |
281 | #else | 324 | #else |
282 | if (re.match(a->name()) != -1) | 325 | if (re.match(a->name()) != -1) |
283 | #endif | 326 | #endif |
284 | { | 327 | { |
285 | mMatchedEvents.append(ev); | 328 | mMatchedEvents.append(ev); |
286 | break; | 329 | break; |
287 | } | 330 | } |
288 | } | 331 | } |
289 | if (mSearchAEmail->isChecked()) { | 332 | if (mSearchAEmail->isChecked()) { |
290 | #if QT_VERSION >= 0x030000 | 333 | #if QT_VERSION >= 0x030000 |
291 | if (re.search(a->email()) != -1) | 334 | if (re.search(a->email()) != -1) |
292 | #else | 335 | #else |
293 | if (re.match(a->email()) != -1) | 336 | if (re.match(a->email()) != -1) |
294 | #endif | 337 | #endif |
295 | { | 338 | { |
296 | mMatchedEvents.append(ev); | 339 | mMatchedEvents.append(ev); |
297 | break; | 340 | break; |
298 | } | 341 | } |
299 | } | 342 | } |
300 | } | 343 | } |
301 | } | 344 | } |
302 | } | 345 | } |
303 | } | 346 | } |
304 | QPtrList<Todo> todos = mCalendar->todos( ); | 347 | QPtrList<Todo> todos = mCalendar->todos( ); |
305 | mMatchedTodos.clear(); | 348 | mMatchedTodos.clear(); |
306 | if ( mSearchTodo->isChecked() ) { | 349 | if ( mSearchTodo->isChecked() ) { |
307 | Todo *tod; | 350 | Todo *tod; |
308 | for(tod=todos.first();tod;tod=todos.next()) { | 351 | for(tod=todos.first();tod;tod=todos.next()) { |
309 | if (mSummaryCheck->isChecked()) { | 352 | if (mSummaryCheck->isChecked()) { |
310 | #if QT_VERSION >= 0x030000 | 353 | #if QT_VERSION >= 0x030000 |
311 | if (re.search(tod->summary()) != -1) | 354 | if (re.search(tod->summary()) != -1) |
312 | #else | 355 | #else |
313 | if (re.match(tod->summary()) != -1) | 356 | if (re.match(tod->summary()) != -1) |
314 | #endif | 357 | #endif |
315 | { | 358 | { |
316 | mMatchedTodos.append(tod); | 359 | mMatchedTodos.append(tod); |
317 | continue; | 360 | continue; |
318 | } | 361 | } |
319 | } | 362 | } |
320 | if (mDescriptionCheck->isChecked()) { | 363 | if (mDescriptionCheck->isChecked()) { |
321 | #if QT_VERSION >= 0x030000 | 364 | #if QT_VERSION >= 0x030000 |
322 | if (re.search(tod->description()) != -1) | 365 | if (re.search(tod->description()) != -1) |
323 | #else | 366 | #else |
324 | if (re.match(tod->description()) != -1) | 367 | if (re.match(tod->description()) != -1) |
325 | #endif | 368 | #endif |
326 | { | 369 | { |
327 | mMatchedTodos.append(tod); | 370 | mMatchedTodos.append(tod); |
328 | continue; | 371 | continue; |
329 | } | 372 | } |
330 | } | 373 | } |
331 | if (mCategoryCheck->isChecked()) { | 374 | if (mCategoryCheck->isChecked()) { |
332 | #if QT_VERSION >= 0x030000 | 375 | #if QT_VERSION >= 0x030000 |
333 | if (re.search(tod->categoriesStr()) != -1) | 376 | if (re.search(tod->categoriesStr()) != -1) |
334 | #else | 377 | #else |
335 | if (re.match(tod->categoriesStr()) != -1) | 378 | if (re.match(tod->categoriesStr()) != -1) |
336 | #endif | 379 | #endif |
337 | { | 380 | { |
338 | mMatchedTodos.append(tod); | 381 | mMatchedTodos.append(tod); |
339 | continue; | 382 | continue; |
340 | } | 383 | } |
341 | } | 384 | } |
342 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 385 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
343 | QPtrList<Attendee> tmpAList = tod->attendees(); | 386 | QPtrList<Attendee> tmpAList = tod->attendees(); |
344 | Attendee *a; | 387 | Attendee *a; |
345 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 388 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
346 | if (mSearchAName->isChecked()) { | 389 | if (mSearchAName->isChecked()) { |
347 | #if QT_VERSION >= 0x030000 | 390 | #if QT_VERSION >= 0x030000 |
348 | if (re.search(a->name()) != -1) | 391 | if (re.search(a->name()) != -1) |
349 | #else | 392 | #else |
350 | if (re.match(a->name()) != -1) | 393 | if (re.match(a->name()) != -1) |
351 | #endif | 394 | #endif |
352 | { | 395 | { |
353 | mMatchedTodos.append(tod); | 396 | mMatchedTodos.append(tod); |
354 | break; | 397 | break; |
355 | } | 398 | } |
356 | } | 399 | } |
357 | if (mSearchAEmail->isChecked()) { | 400 | if (mSearchAEmail->isChecked()) { |
358 | #if QT_VERSION >= 0x030000 | 401 | #if QT_VERSION >= 0x030000 |
359 | if (re.search(a->email()) != -1) | 402 | if (re.search(a->email()) != -1) |
360 | #else | 403 | #else |
361 | if (re.match(a->email()) != -1) | 404 | if (re.match(a->email()) != -1) |
362 | #endif | 405 | #endif |
363 | { | 406 | { |
364 | mMatchedTodos.append(tod); | 407 | mMatchedTodos.append(tod); |
365 | break; | 408 | break; |
366 | } | 409 | } |
367 | } | 410 | } |
368 | } | 411 | } |
369 | } | 412 | } |
370 | } | 413 | } |
371 | } | 414 | } |
372 | mMatchedJournals.clear(); | 415 | mMatchedJournals.clear(); |
373 | if (mSearchJournal->isChecked() ) { | 416 | if (mSearchJournal->isChecked() ) { |
374 | QPtrList<Journal> journals = mCalendar->journals( ); | 417 | QPtrList<Journal> journals = mCalendar->journals( ); |
375 | Journal* journ; | 418 | Journal* journ; |
376 | 419 | ||
377 | for(journ=journals.first();journ;journ=journals.next()) { | 420 | for(journ=journals.first();journ;journ=journals.next()) { |
378 | if ( journ->dtStart().date() <= mEndDate->date() | 421 | if ( journ->dtStart().date() <= mEndDate->date() |
379 | &&journ->dtStart().date() >= mStartDate->date()) { | 422 | &&journ->dtStart().date() >= mStartDate->date()) { |
380 | #if QT_VERSION >= 0x030000 | 423 | #if QT_VERSION >= 0x030000 |
381 | if (re.search(journ->description()) != -1) | 424 | if (re.search(journ->description()) != -1) |
382 | #else | 425 | #else |
383 | if (re.match(journ->description()) != -1) | 426 | if (re.match(journ->description()) != -1) |
384 | #endif | 427 | #endif |
385 | { | 428 | { |
386 | mMatchedJournals.append(journ); | 429 | mMatchedJournals.append(journ); |
387 | continue; | 430 | continue; |
388 | } | 431 | } |
389 | } | 432 | } |
390 | } | 433 | } |
391 | } | 434 | } |
392 | 435 | ||
393 | } | 436 | } |
394 | 437 | ||
395 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 438 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
396 | { | 439 | { |
397 | switch ( e->key() ) { | 440 | switch ( e->key() ) { |
398 | case Qt::Key_Escape: | 441 | case Qt::Key_Escape: |
399 | hide(); | 442 | hide(); |
400 | break; | 443 | break; |
401 | case Qt::Key_F: | 444 | case Qt::Key_F: |
402 | if ( e->state() == Qt::ControlButton ) { | 445 | if ( e->state() == Qt::ControlButton ) { |
403 | qDebug("full "); | 446 | qDebug("full "); |
404 | 447 | ||
405 | } | 448 | } |
406 | break; | 449 | break; |
407 | case Qt::Key_Return: | 450 | case Qt::Key_Return: |
408 | case Qt::Key_Enter: | 451 | case Qt::Key_Enter: |
409 | doSearch(); | 452 | doSearch(); |
410 | break; | 453 | break; |
411 | 454 | ||
412 | default: | 455 | default: |
413 | e->ignore(); | 456 | e->ignore(); |
414 | } | 457 | } |
415 | } | 458 | } |
416 | 459 | ||
417 | //mMatchedJournals; | 460 | //mMatchedJournals; |
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index b730ed5..4559d20 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h | |||
@@ -1,94 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 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 SEARCHDIALOG_H | 24 | #ifndef SEARCHDIALOG_H |
25 | #define SEARCHDIALOG_H | 25 | #define SEARCHDIALOG_H |
26 | 26 | ||
27 | #include <qregexp.h> | 27 | #include <qregexp.h> |
28 | 28 | ||
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | 31 | ||
32 | #include <libkcal/calendar.h> | 32 | #include <libkcal/calendar.h> |
33 | 33 | ||
34 | #include "kolistview.h" | 34 | #include "kolistview.h" |
35 | 35 | ||
36 | class KDateEdit; | 36 | class KDateEdit; |
37 | class QCheckBox; | 37 | class QCheckBox; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class KLineEdit; | 39 | class KLineEdit; |
40 | class QLabel; | 40 | class QLabel; |
41 | class CalendarView; | 41 | class CalendarView; |
42 | 42 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | class SearchDialog : public QVBox | 44 | class SearchDialog : public QVBox |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | SearchDialog(Calendar *calendar,CalendarView *parent=0); | 48 | SearchDialog(Calendar *calendar,CalendarView *parent=0); |
49 | virtual ~SearchDialog(); | 49 | virtual ~SearchDialog(); |
50 | KOListView *listview(){ return listView;} | 50 | KOListView *listview(){ return listView;} |
51 | void updateView(); | 51 | void updateView(); |
52 | void raiseAndSelect(); | ||
52 | 53 | ||
53 | public slots: | 54 | public slots: |
54 | void changeEventDisplay(Event *, int) { updateView(); } | 55 | void changeEventDisplay(Event *, int) { updateView(); } |
55 | void updateConfig(); | 56 | void updateConfig(); |
56 | void updateList(); | 57 | void updateList(); |
57 | protected slots: | 58 | protected slots: |
58 | void setFocusToList(); | 59 | void setFocusToList(); |
59 | void accept(); | 60 | void accept(); |
60 | void doSearch(); | 61 | void doSearch(); |
61 | void searchTextChanged( const QString &_text ); | 62 | void searchTextChanged( const QString &_text ); |
62 | 63 | ||
63 | signals: | 64 | signals: |
64 | void showEventSignal(Event *); | 65 | void showEventSignal(Event *); |
65 | void editEventSignal(Event *); | 66 | void editEventSignal(Event *); |
66 | void deleteEventSignal(Event *); | 67 | void deleteEventSignal(Event *); |
67 | 68 | ||
68 | private: | 69 | private: |
69 | void search(const QRegExp &); | 70 | void search(const QRegExp &); |
70 | 71 | ||
71 | Calendar *mCalendar; | 72 | Calendar *mCalendar; |
72 | 73 | ||
73 | QPtrList<Event> mMatchedEvents; | 74 | QPtrList<Event> mMatchedEvents; |
74 | QPtrList<Todo> mMatchedTodos; | 75 | QPtrList<Todo> mMatchedTodos; |
75 | QPtrList<Journal> mMatchedJournals; | 76 | QPtrList<Journal> mMatchedJournals; |
76 | 77 | ||
77 | QLabel *searchLabel; | 78 | QLabel *searchLabel; |
78 | KLineEdit *searchEdit; | 79 | KLineEdit *searchEdit; |
79 | KOListView *listView; | 80 | KOListView *listView; |
80 | 81 | ||
81 | KDateEdit *mStartDate; | 82 | KDateEdit *mStartDate; |
82 | KDateEdit *mEndDate; | 83 | KDateEdit *mEndDate; |
83 | QCheckBox *mSummaryCheck; | 84 | QCheckBox *mSummaryCheck; |
84 | QCheckBox *mDescriptionCheck; | 85 | QCheckBox *mDescriptionCheck; |
85 | QCheckBox *mCategoryCheck; | 86 | QCheckBox *mCategoryCheck; |
86 | QCheckBox *mSearchEvent; | 87 | QCheckBox *mSearchEvent; |
87 | QCheckBox *mSearchTodo; | 88 | QCheckBox *mSearchTodo; |
88 | QCheckBox *mSearchJournal; | 89 | QCheckBox *mSearchJournal; |
89 | QCheckBox *mSearchAName; | 90 | QCheckBox *mSearchAName; |
90 | QCheckBox *mSearchAEmail; | 91 | QCheckBox *mSearchAEmail; |
91 | void keyPressEvent ( QKeyEvent *e) ; | 92 | void keyPressEvent ( QKeyEvent *e) ; |
92 | }; | 93 | }; |
93 | 94 | ||
94 | #endif | 95 | #endif |