-rw-r--r-- | korganizer/calendarview.cpp | 17 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 32 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 3 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 4 | ||||
-rw-r--r-- | korganizer/main.cpp | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 9 |
6 files changed, 55 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 08909ed..f179c58 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1586,110 +1586,124 @@ void CalendarView::syncExternal( int mode ) | |||
1586 | } | 1586 | } |
1587 | } | 1587 | } |
1588 | } else { | 1588 | } else { |
1589 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1589 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1590 | } | 1590 | } |
1591 | setModified( true ); | 1591 | setModified( true ); |
1592 | } else { | 1592 | } else { |
1593 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1593 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1594 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1594 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1595 | question, i18n("Ok")) ; | 1595 | question, i18n("Ok")) ; |
1596 | 1596 | ||
1597 | } | 1597 | } |
1598 | delete calendar; | 1598 | delete calendar; |
1599 | updateView(); | 1599 | updateView(); |
1600 | emit tempDisableBR(false); | 1600 | emit tempDisableBR(false); |
1601 | return ;//syncOK; | 1601 | return ;//syncOK; |
1602 | 1602 | ||
1603 | } | 1603 | } |
1604 | 1604 | ||
1605 | bool CalendarView::importBday() | 1605 | bool CalendarView::importBday() |
1606 | { | 1606 | { |
1607 | #ifndef KORG_NOKABC | 1607 | #ifndef KORG_NOKABC |
1608 | 1608 | ||
1609 | #ifdef DESKTOP_VERSION | 1609 | #ifdef DESKTOP_VERSION |
1610 | int curCal = mCalendar->defaultCalendar(); | ||
1611 | int bd = mCalEditView->getBirtdayID(); | ||
1612 | if ( bd == 0 ) | ||
1613 | return; | ||
1614 | mCalendar->setDefaultCalendar( bd ); | ||
1610 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1615 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1611 | KABC::AddressBook::Iterator it; | 1616 | KABC::AddressBook::Iterator it; |
1612 | int count = 0; | 1617 | int count = 0; |
1613 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1618 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1614 | ++count; | 1619 | ++count; |
1615 | } | 1620 | } |
1616 | QProgressBar bar(count,0 ); | 1621 | QProgressBar bar(count,0 ); |
1617 | int w = 300; | 1622 | int w = 300; |
1618 | if ( QApplication::desktop()->width() < 320 ) | 1623 | if ( QApplication::desktop()->width() < 320 ) |
1619 | w = 220; | 1624 | w = 220; |
1620 | int h = bar.sizeHint().height() ; | 1625 | int h = bar.sizeHint().height() ; |
1621 | int dw = QApplication::desktop()->width(); | 1626 | int dw = QApplication::desktop()->width(); |
1622 | int dh = QApplication::desktop()->height(); | 1627 | int dh = QApplication::desktop()->height(); |
1623 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1628 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1624 | bar.show(); | 1629 | bar.show(); |
1625 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1630 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1626 | qApp->processEvents(); | 1631 | qApp->processEvents(); |
1627 | count = 0; | 1632 | count = 0; |
1628 | int addCount = 0; | 1633 | int addCount = 0; |
1629 | KCal::Attendee* a = 0; | 1634 | KCal::Attendee* a = 0; |
1630 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1635 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1631 | if ( ! bar.isVisible() ) | 1636 | if ( ! bar.isVisible() ) |
1632 | return false; | 1637 | return false; |
1633 | bar.setProgress( count++ ); | 1638 | bar.setProgress( count++ ); |
1634 | qApp->processEvents(); | 1639 | qApp->processEvents(); |
1635 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1640 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1636 | if ( (*it).birthday().date().isValid() ){ | 1641 | if ( (*it).birthday().date().isValid() ){ |
1637 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1638 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1643 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1639 | ++addCount; | 1644 | ++addCount; |
1640 | } | 1645 | } |
1641 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1646 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1642 | if ( anni.isValid() ){ | 1647 | if ( anni.isValid() ){ |
1643 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1648 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1644 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1649 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1645 | ++addCount; | 1650 | ++addCount; |
1646 | } | 1651 | } |
1647 | } | 1652 | } |
1653 | mCalendar->setDefaultCalendar( curCal ); | ||
1648 | updateView(); | 1654 | updateView(); |
1649 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1655 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1650 | #else //DESKTOP_VERSION | 1656 | #else //DESKTOP_VERSION |
1651 | 1657 | ||
1652 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1658 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1653 | // the result should now arrive through method insertBirthdays | 1659 | // the result should now arrive through method insertBirthdays |
1654 | 1660 | ||
1655 | #endif //DESKTOP_VERSION | 1661 | #endif //DESKTOP_VERSION |
1656 | 1662 | ||
1657 | #endif //KORG_NOKABC | 1663 | #endif //KORG_NOKABC |
1658 | 1664 | ||
1659 | 1665 | ||
1660 | return true; | 1666 | return true; |
1661 | } | 1667 | } |
1662 | 1668 | ||
1663 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1669 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1664 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1670 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1665 | const QStringList& anniversaryList, const QStringList& realNameList, | 1671 | const QStringList& anniversaryList, const QStringList& realNameList, |
1666 | const QStringList& emailList, const QStringList& assembledNameList, | 1672 | const QStringList& emailList, const QStringList& assembledNameList, |
1667 | const QStringList& uidList) | 1673 | const QStringList& uidList) |
1668 | { | 1674 | { |
1675 | |||
1669 | //qDebug("KO::CalendarView::insertBirthdays"); | 1676 | //qDebug("KO::CalendarView::insertBirthdays"); |
1670 | if (uid == this->name()) | 1677 | if (uid == this->name()) |
1671 | { | 1678 | { |
1679 | int curCal = mCalendar->defaultCalendar(); | ||
1680 | int bd = mCalEditView->getBirtdayID(); | ||
1681 | if ( bd == 0 ) | ||
1682 | return; | ||
1683 | mCalendar->setDefaultCalendar( bd ); | ||
1684 | |||
1685 | |||
1672 | int count = birthdayList.count(); | 1686 | int count = birthdayList.count(); |
1673 | int addCount = 0; | 1687 | int addCount = 0; |
1674 | KCal::Attendee* a = 0; | 1688 | KCal::Attendee* a = 0; |
1675 | 1689 | ||
1676 | //qDebug("CalView 1 %i", count); | 1690 | //qDebug("CalView 1 %i", count); |
1677 | 1691 | ||
1678 | QProgressBar bar(count,0 ); | 1692 | QProgressBar bar(count,0 ); |
1679 | int w = 300; | 1693 | int w = 300; |
1680 | if ( QApplication::desktop()->width() < 320 ) | 1694 | if ( QApplication::desktop()->width() < 320 ) |
1681 | w = 220; | 1695 | w = 220; |
1682 | int h = bar.sizeHint().height() ; | 1696 | int h = bar.sizeHint().height() ; |
1683 | int dw = QApplication::desktop()->width(); | 1697 | int dw = QApplication::desktop()->width(); |
1684 | int dh = QApplication::desktop()->height(); | 1698 | int dh = QApplication::desktop()->height(); |
1685 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1699 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1686 | bar.show(); | 1700 | bar.show(); |
1687 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1701 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1688 | qApp->processEvents(); | 1702 | qApp->processEvents(); |
1689 | 1703 | ||
1690 | QDate birthday; | 1704 | QDate birthday; |
1691 | QDate anniversary; | 1705 | QDate anniversary; |
1692 | QString realName; | 1706 | QString realName; |
1693 | QString email; | 1707 | QString email; |
1694 | QString assembledName; | 1708 | QString assembledName; |
1695 | QString uid; | 1709 | QString uid; |
@@ -1710,48 +1724,49 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd | |||
1710 | if (!ok) { | 1724 | if (!ok) { |
1711 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1725 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1712 | } | 1726 | } |
1713 | realName = realNameList[i]; | 1727 | realName = realNameList[i]; |
1714 | email = emailList[i]; | 1728 | email = emailList[i]; |
1715 | assembledName = assembledNameList[i]; | 1729 | assembledName = assembledNameList[i]; |
1716 | uid = uidList[i]; | 1730 | uid = uidList[i]; |
1717 | //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() ); | 1731 | //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() ); |
1718 | 1732 | ||
1719 | if ( birthday.isValid() ){ | 1733 | if ( birthday.isValid() ){ |
1720 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1734 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1721 | KCal::Attendee::ReqParticipant,uid) ; | 1735 | KCal::Attendee::ReqParticipant,uid) ; |
1722 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1736 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1723 | ++addCount; | 1737 | ++addCount; |
1724 | } | 1738 | } |
1725 | 1739 | ||
1726 | if ( anniversary.isValid() ){ | 1740 | if ( anniversary.isValid() ){ |
1727 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1741 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1728 | KCal::Attendee::ReqParticipant,uid) ; | 1742 | KCal::Attendee::ReqParticipant,uid) ; |
1729 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1743 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1730 | ++addCount; | 1744 | ++addCount; |
1731 | } | 1745 | } |
1732 | } | 1746 | } |
1733 | 1747 | ||
1748 | mCalendar->setDefaultCalendar( curCal ); | ||
1734 | updateView(); | 1749 | updateView(); |
1735 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1750 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1736 | 1751 | ||
1737 | } | 1752 | } |
1738 | 1753 | ||
1739 | } | 1754 | } |
1740 | 1755 | ||
1741 | 1756 | ||
1742 | 1757 | ||
1743 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1758 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1744 | { | 1759 | { |
1745 | //qDebug("addAnni "); | 1760 | //qDebug("addAnni "); |
1746 | Event * ev = new Event(); | 1761 | Event * ev = new Event(); |
1747 | ev->setOrganizer(KOPrefs::instance()->email()); | 1762 | ev->setOrganizer(KOPrefs::instance()->email()); |
1748 | if ( a ) { | 1763 | if ( a ) { |
1749 | ev->addAttendee( a ); | 1764 | ev->addAttendee( a ); |
1750 | } | 1765 | } |
1751 | QString kind; | 1766 | QString kind; |
1752 | if ( birthday ) { | 1767 | if ( birthday ) { |
1753 | kind = i18n( "Birthday" ); | 1768 | kind = i18n( "Birthday" ); |
1754 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1769 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1755 | } | 1770 | } |
1756 | else { | 1771 | else { |
1757 | kind = i18n( "Anniversary" ); | 1772 | kind = i18n( "Anniversary" ); |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index a8a3052..3cde103 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -333,93 +333,113 @@ void KOCalEditView::readConfig() | |||
333 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 333 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
334 | int hei = calb->sizeHint().height(); | 334 | int hei = calb->sizeHint().height(); |
335 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 335 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
336 | } | 336 | } |
337 | ++row; | 337 | ++row; |
338 | kkf = KOPrefs::instance()->mCalendars.next(); | 338 | kkf = KOPrefs::instance()->mCalendars.next(); |
339 | } | 339 | } |
340 | lab = new QLabel ( "", mw ); | 340 | lab = new QLabel ( "", mw ); |
341 | mainLayout->addWidget( lab,row,0 ); | 341 | mainLayout->addWidget( lab,row,0 ); |
342 | mw->show(); | 342 | mw->show(); |
343 | 343 | ||
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | void KOCalEditView::defaultInfo() | 347 | void KOCalEditView::defaultInfo() |
348 | { | 348 | { |
349 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); | 349 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); |
350 | } | 350 | } |
351 | void KOCalEditView::addCal() | 351 | void KOCalEditView::addCal() |
352 | { | 352 | { |
353 | bool tryagain = true; | 353 | bool tryagain = true; |
354 | QString name, file; | 354 | QString name, file; |
355 | while ( tryagain ) { | 355 | while ( tryagain ) { |
356 | KONewCalPrefs prefs ( this ); | 356 | KONewCalPrefs prefs ( this ); |
357 | prefs.nameE->setText( name ); | 357 | prefs.nameE->setText( name ); |
358 | prefs.url->setURL( file ); | 358 | prefs.url->setURL( file ); |
359 | if ( ! prefs.exec() ) | 359 | if ( ! prefs.exec() ) |
360 | return; | 360 | return; |
361 | name = prefs.calName(); | 361 | name = prefs.calName(); |
362 | file = prefs.calFileName(); | 362 | file = prefs.calFileName(); |
363 | tryagain = false; | 363 | tryagain = false; |
364 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 364 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
365 | while ( kkf ) { | 365 | while ( kkf ) { |
366 | if ( kkf->mName == name ) { | 366 | if ( kkf->mName == name ) { |
367 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 367 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
368 | name = ""; | 368 | name = ""; |
369 | tryagain = true; | 369 | tryagain = true; |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | if ( kkf->mFileName == file ) { | 372 | if ( kkf->mFileName == file ) { |
373 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); | 373 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
374 | tryagain = true; | 374 | tryagain = true; |
375 | file = ""; | 375 | file = ""; |
376 | break; | 376 | break; |
377 | } | 377 | } |
378 | kkf = KOPrefs::instance()->mCalendars.next(); | 378 | kkf = KOPrefs::instance()->mCalendars.next(); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | addCalendar ( name, file ); | ||
382 | } | ||
383 | int KOCalEditView::addCalendar( QString name, QString file, bool ask ) | ||
384 | { | ||
385 | |||
381 | QFileInfo fi ( file ); | 386 | QFileInfo fi ( file ); |
382 | if (!fi.exists() ) { | 387 | if (!fi.exists() ) { |
383 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) | 388 | if ( ask ) |
384 | return; | 389 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) |
390 | return 0; | ||
385 | QFile fileIn( file ); | 391 | QFile fileIn( file ); |
386 | if (!fileIn.open( IO_WriteOnly ) ) { | 392 | if (!fileIn.open( IO_WriteOnly ) ) { |
387 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); | 393 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); |
388 | return; | 394 | return 0; |
389 | } | 395 | } |
390 | QTextStream tsIn( &fileIn ); | 396 | QTextStream tsIn( &fileIn ); |
391 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 397 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
392 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; | 398 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; |
393 | fileIn.close(); | 399 | fileIn.close(); |
394 | } | 400 | } |
395 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 401 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
396 | kkf->mName = name; | 402 | kkf->mName = name; |
397 | kkf->mFileName = file; | 403 | kkf->mFileName = file; |
398 | emit calendarAdded( kkf->mCalNumber ); | 404 | emit calendarAdded( kkf->mCalNumber ); |
399 | emit needsUpdate(); | 405 | if ( ask ) |
400 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 406 | emit needsUpdate(); |
407 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | ||
408 | return kkf->mCalNumber; | ||
401 | } | 409 | } |
410 | int KOCalEditView::getBirtdayID() | ||
411 | { | ||
412 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
413 | while ( kkf ) { | ||
414 | if ( kkf->mName == i18n("Birthdays") ) | ||
415 | return kkf->mCalNumber; | ||
416 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
417 | } | ||
418 | QString file = locateLocal( "data", "korganizer/birthdays.ics" ); | ||
419 | return addCalendar( i18n("Birthdays"), file, false ); | ||
420 | } | ||
421 | |||
402 | void KOCalEditView::enableAll() | 422 | void KOCalEditView::enableAll() |
403 | { | 423 | { |
404 | toggleList( mEnabledB ); | 424 | toggleList( mEnabledB ); |
405 | } | 425 | } |
406 | void KOCalEditView::enableAlarm() | 426 | void KOCalEditView::enableAlarm() |
407 | { | 427 | { |
408 | toggleList( mAlarmB ); | 428 | toggleList( mAlarmB ); |
409 | } | 429 | } |
410 | void KOCalEditView::disableRO() | 430 | void KOCalEditView::disableRO() |
411 | { | 431 | { |
412 | toggleList( mROB ); | 432 | toggleList( mROB ); |
413 | } | 433 | } |
414 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 434 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
415 | { | 435 | { |
416 | bool dis = false; | 436 | bool dis = false; |
417 | KOCalCheckButton* it = list.first(); | 437 | KOCalCheckButton* it = list.first(); |
418 | while ( it ) { | 438 | while ( it ) { |
419 | if ( !it->isChecked() ) { | 439 | if ( !it->isChecked() ) { |
420 | dis = true; | 440 | dis = true; |
421 | break; | 441 | break; |
422 | } | 442 | } |
423 | it = list.next(); | 443 | it = list.next(); |
424 | } | 444 | } |
425 | it = list.first(); | 445 | it = list.first(); |
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index b57a6e9..54fe2c5 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -187,49 +187,50 @@ class KOFilterView : public KOFilterView_base | |||
187 | ~KOFilterView(); | 187 | ~KOFilterView(); |
188 | 188 | ||
189 | void updateFilters(); | 189 | void updateFilters(); |
190 | 190 | ||
191 | bool filtersEnabled(); | 191 | bool filtersEnabled(); |
192 | void setFiltersEnabled(bool); | 192 | void setFiltersEnabled(bool); |
193 | CalFilter *selectedFilter(); | 193 | CalFilter *selectedFilter(); |
194 | void setSelectedFilter(QString); | 194 | void setSelectedFilter(QString); |
195 | void setSelectedFilter( int ); | 195 | void setSelectedFilter( int ); |
196 | 196 | ||
197 | signals: | 197 | signals: |
198 | void filterChanged(); | 198 | void filterChanged(); |
199 | void editFilters(); | 199 | void editFilters(); |
200 | 200 | ||
201 | private: | 201 | private: |
202 | QPtrList<CalFilter> *mFilters; | 202 | QPtrList<CalFilter> *mFilters; |
203 | }; | 203 | }; |
204 | 204 | ||
205 | class KOCalEditView : public QScrollView | 205 | class KOCalEditView : public QScrollView |
206 | { | 206 | { |
207 | Q_OBJECT | 207 | Q_OBJECT |
208 | public: | 208 | public: |
209 | KOCalEditView( QWidget* parent=0,const char* name=0); | 209 | KOCalEditView( QWidget* parent=0,const char* name=0); |
210 | ~KOCalEditView(); | 210 | ~KOCalEditView(); |
211 | 211 | int addCalendar( QString calName, QString fileName, bool ask = true ); | |
212 | int getBirtdayID(); | ||
212 | public slots: | 213 | public slots: |
213 | void addCal(); | 214 | void addCal(); |
214 | void enableAll(); | 215 | void enableAll(); |
215 | void enableAlarm(); | 216 | void enableAlarm(); |
216 | void disableRO(); | 217 | void disableRO(); |
217 | void deleteAll(); | 218 | void deleteAll(); |
218 | void selectStdCal(int,bool ); | 219 | void selectStdCal(int,bool ); |
219 | void selectCal(int,bool ); | 220 | void selectCal(int,bool ); |
220 | void selectCalAlarm(int,bool ); | 221 | void selectCalAlarm(int,bool ); |
221 | void selectReadOnly(int,bool ); | 222 | void selectReadOnly(int,bool ); |
222 | void setColor(const QColor &,int) ; | 223 | void setColor(const QColor &,int) ; |
223 | void deleteCal(int) ; | 224 | void deleteCal(int) ; |
224 | void infoCal(int) ; | 225 | void infoCal(int) ; |
225 | void readConfig(); | 226 | void readConfig(); |
226 | void defaultInfo(); | 227 | void defaultInfo(); |
227 | signals: | 228 | signals: |
228 | void alarmEnabled ( int cal, bool enable ); | 229 | void alarmEnabled ( int cal, bool enable ); |
229 | void calendarEnabled ( int cal, bool enable ); | 230 | void calendarEnabled ( int cal, bool enable ); |
230 | void calendarReadonly ( int cal, bool readonly ); | 231 | void calendarReadonly ( int cal, bool readonly ); |
231 | void setCalendarDefault ( int cal ); | 232 | void setCalendarDefault ( int cal ); |
232 | void removeCalendar ( int cal ); | 233 | void removeCalendar ( int cal ); |
233 | void calendarAdded( int ); | 234 | void calendarAdded( int ); |
234 | void needsUpdate(); | 235 | void needsUpdate(); |
235 | 236 | ||
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index a4ea3d3..7ba7269 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -439,48 +439,52 @@ void KOPrefs::usrReadConfig() | |||
439 | KConfig fc (locateLocal("config","kopicalendarrc")); | 439 | KConfig fc (locateLocal("config","kopicalendarrc")); |
440 | fc.setGroup("CC"); | 440 | fc.setGroup("CC"); |
441 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 441 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
442 | mNextAvailableCalendar = 1; | 442 | mNextAvailableCalendar = 1; |
443 | if ( numCals == 0 ) { | 443 | if ( numCals == 0 ) { |
444 | KopiCalendarFile *kkf = getNewCalendar(); | 444 | KopiCalendarFile *kkf = getNewCalendar(); |
445 | kkf->isStandard = true; | 445 | kkf->isStandard = true; |
446 | kkf->mName = i18n("Standard"); | 446 | kkf->mName = i18n("Standard"); |
447 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 447 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
448 | } | 448 | } |
449 | while ( mNextAvailableCalendar <= numCals ) { | 449 | while ( mNextAvailableCalendar <= numCals ) { |
450 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); | 450 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); |
451 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); | 451 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); |
452 | KopiCalendarFile *kkf = getNewCalendar(); | 452 | KopiCalendarFile *kkf = getNewCalendar(); |
453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); | 455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); |
456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); | 456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); |
457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); | 457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); |
458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); | 458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); |
459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); | 459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); |
460 | if ( kkf->mCalNumber == 1 ) { | 460 | if ( kkf->mCalNumber == 1 ) { |
461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
462 | } | 462 | } |
463 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); | ||
464 | if ( kkf->mName == i18n("Birthdays") ) { | ||
465 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); | ||
466 | } | ||
463 | } | 467 | } |
464 | 468 | ||
465 | KPimPrefs::usrReadConfig(); | 469 | KPimPrefs::usrReadConfig(); |
466 | } | 470 | } |
467 | 471 | ||
468 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 472 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
469 | { | 473 | { |
470 | return mDefCalColors[num-1]; | 474 | return mDefCalColors[num-1]; |
471 | } | 475 | } |
472 | 476 | ||
473 | KopiCalendarFile * KOPrefs::getNewCalendar() | 477 | KopiCalendarFile * KOPrefs::getNewCalendar() |
474 | { | 478 | { |
475 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 479 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
476 | kkf->mCalNumber = mNextAvailableCalendar; | 480 | kkf->mCalNumber = mNextAvailableCalendar; |
477 | mDefCalColors.resize( mNextAvailableCalendar ); | 481 | mDefCalColors.resize( mNextAvailableCalendar ); |
478 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 482 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
479 | ++mNextAvailableCalendar; | 483 | ++mNextAvailableCalendar; |
480 | kkf->mDefaultColor = mEventColor; | 484 | kkf->mDefaultColor = mEventColor; |
481 | kkf->mName = i18n("New Calendar"); | 485 | kkf->mName = i18n("New Calendar"); |
482 | mCalendars.append( kkf ); | 486 | mCalendars.append( kkf ); |
483 | return kkf; | 487 | return kkf; |
484 | } | 488 | } |
485 | void KOPrefs::deleteCalendar( int num ) | 489 | void KOPrefs::deleteCalendar( int num ) |
486 | { | 490 | { |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 2bf46b9..c9d1345 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -64,48 +64,49 @@ int main( int argc, char **argv ) | |||
64 | printf(" -showWeek: Week view\n"); | 64 | printf(" -showWeek: Week view\n"); |
65 | printf(" -showTodo: Todo view\n"); | 65 | printf(" -showTodo: Todo view\n"); |
66 | printf(" -showJournal: Journal view\n"); | 66 | printf(" -showJournal: Journal view\n"); |
67 | printf(" -showKO: Next Days view\n"); | 67 | printf(" -showKO: Next Days view\n"); |
68 | printf(" -showWNext: What's Next view\n"); | 68 | printf(" -showWNext: What's Next view\n"); |
69 | printf(" -showNextXView: Next X View\n"); | 69 | printf(" -showNextXView: Next X View\n"); |
70 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 70 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
71 | printf(" KO/Pi is exiting now. Bye!\n"); | 71 | printf(" KO/Pi is exiting now. Bye!\n"); |
72 | exitHelp = true; | 72 | exitHelp = true; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | if ( ! exitHelp ) { | 75 | if ( ! exitHelp ) { |
76 | KGlobal::setAppName( "korganizer" ); | 76 | KGlobal::setAppName( "korganizer" ); |
77 | QString fileName ; | 77 | QString fileName ; |
78 | #ifndef DESKTOP_VERSION | 78 | #ifndef DESKTOP_VERSION |
79 | fileName = getenv("QPEDIR"); | 79 | fileName = getenv("QPEDIR"); |
80 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 80 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
81 | #else | 81 | #else |
82 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 82 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
83 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 83 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
84 | #endif | 84 | #endif |
85 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 85 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
86 | 86 | ||
87 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 87 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
88 | KPimGlobalPrefs::instance()->setGlobalConfig(); | ||
88 | MainWindow m; | 89 | MainWindow m; |
89 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
90 | 91 | ||
91 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 92 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
92 | a.showMainWidget(&m ); | 93 | a.showMainWidget(&m ); |
93 | #else | 94 | #else |
94 | a.setMainWidget(&m ); | 95 | a.setMainWidget(&m ); |
95 | m.show(); | 96 | m.show(); |
96 | //m.resize( 800, 600 ); | 97 | //m.resize( 800, 600 ); |
97 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 98 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
98 | #endif | 99 | #endif |
99 | if ( argc > 1 ) { | 100 | if ( argc > 1 ) { |
100 | QCString command = argv[1]; | 101 | QCString command = argv[1]; |
101 | if ( argc > 2 ) | 102 | if ( argc > 2 ) |
102 | command += argv[2]; | 103 | command += argv[2]; |
103 | qApp->processEvents(); | 104 | qApp->processEvents(); |
104 | m.recieve(command, QByteArray() ); | 105 | m.recieve(command, QByteArray() ); |
105 | 106 | ||
106 | } | 107 | } |
107 | 108 | ||
108 | a.exec(); | 109 | a.exec(); |
109 | dumpMissing(); | 110 | dumpMissing(); |
110 | 111 | ||
111 | KPimGlobalPrefs::instance()->writeConfig(); | 112 | KPimGlobalPrefs::instance()->writeConfig(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index b9d8742..68233e8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -152,49 +152,49 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
152 | int heihei = size/2; | 152 | int heihei = size/2; |
153 | int x = 1; | 153 | int x = 1; |
154 | p.drawLine ( 2, 5, 4 , 7 ) ; | 154 | p.drawLine ( 2, 5, 4 , 7 ) ; |
155 | p.drawLine ( 4 , 7 , 8, 3) ; | 155 | p.drawLine ( 4 , 7 , 8, 3) ; |
156 | int iii = 0; | 156 | int iii = 0; |
157 | for ( iii = 0; iii < 5; ++iii ) { | 157 | for ( iii = 0; iii < 5; ++iii ) { |
158 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 158 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
159 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 159 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
160 | QPainter p ( sgListViewCompletedPix[iii] ); | 160 | QPainter p ( sgListViewCompletedPix[iii] ); |
161 | p.drawRect( 0,0,11,11); | 161 | p.drawRect( 0,0,11,11); |
162 | if ( iii ) | 162 | if ( iii ) |
163 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 163 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | mClosed = false; | 166 | mClosed = false; |
167 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 167 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
168 | QString confFile = locateLocal("config","korganizerrc"); | 168 | QString confFile = locateLocal("config","korganizerrc"); |
169 | QFileInfo finf ( confFile ); | 169 | QFileInfo finf ( confFile ); |
170 | bool showWarning = !finf.exists(); | 170 | bool showWarning = !finf.exists(); |
171 | setIcon(SmallIcon( "ko24" ) ); | 171 | setIcon(SmallIcon( "ko24" ) ); |
172 | mBlockAtStartup = true; | 172 | mBlockAtStartup = true; |
173 | mFlagKeyPressed = false; | 173 | mFlagKeyPressed = false; |
174 | setCaption("KO/Pi"); | 174 | setCaption("KO/Pi"); |
175 | KOPrefs *p = KOPrefs::instance(); | 175 | KOPrefs *p = KOPrefs::instance(); |
176 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 176 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
177 | p->mCurrentDisplayedView = 0; | 177 | p->mCurrentDisplayedView = 0; |
178 | if ( p->mHourSize > 22 ) | 178 | if ( p->mHourSize > 22 ) |
179 | p->mHourSize = 22; | 179 | p->mHourSize = 22; |
180 | QMainWindow::ToolBarDock tbd; | 180 | QMainWindow::ToolBarDock tbd; |
181 | if ( p->mToolBarHor ) { | 181 | if ( p->mToolBarHor ) { |
182 | if ( p->mToolBarUp ) | 182 | if ( p->mToolBarUp ) |
183 | tbd = Bottom; | 183 | tbd = Bottom; |
184 | else | 184 | else |
185 | tbd = Top; | 185 | tbd = Top; |
186 | } | 186 | } |
187 | else { | 187 | else { |
188 | if ( p->mToolBarUp ) | 188 | if ( p->mToolBarUp ) |
189 | tbd = Right; | 189 | tbd = Right; |
190 | else | 190 | else |
191 | tbd = Left; | 191 | tbd = Left; |
192 | } | 192 | } |
193 | if ( KOPrefs::instance()->mUseAppColors ) | 193 | if ( KOPrefs::instance()->mUseAppColors ) |
194 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 194 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
195 | globalFlagBlockStartup = 1; | 195 | globalFlagBlockStartup = 1; |
196 | iconToolBar = new QPEToolBar( this ); | 196 | iconToolBar = new QPEToolBar( this ); |
197 | addToolBar (iconToolBar , tbd ); | 197 | addToolBar (iconToolBar , tbd ); |
198 | 198 | ||
199 | #ifdef DESKTOP_VERSION | 199 | #ifdef DESKTOP_VERSION |
200 | if ( KOPrefs::instance()->mShowIconFilter ) | 200 | if ( KOPrefs::instance()->mShowIconFilter ) |
@@ -1702,49 +1702,49 @@ void MainWindow::enableIncidenceActions( bool enabled ) | |||
1702 | { | 1702 | { |
1703 | mShowAction->setEnabled( enabled ); | 1703 | mShowAction->setEnabled( enabled ); |
1704 | mEditAction->setEnabled( enabled ); | 1704 | mEditAction->setEnabled( enabled ); |
1705 | mDeleteAction->setEnabled( enabled ); | 1705 | mDeleteAction->setEnabled( enabled ); |
1706 | 1706 | ||
1707 | mCloneAction->setEnabled( enabled ); | 1707 | mCloneAction->setEnabled( enabled ); |
1708 | mMoveAction->setEnabled( enabled ); | 1708 | mMoveAction->setEnabled( enabled ); |
1709 | mBeamAction->setEnabled( enabled ); | 1709 | mBeamAction->setEnabled( enabled ); |
1710 | mCancelAction->setEnabled( enabled ); | 1710 | mCancelAction->setEnabled( enabled ); |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | void MainWindow::importOL() | 1713 | void MainWindow::importOL() |
1714 | { | 1714 | { |
1715 | #ifdef _OL_IMPORT_ | 1715 | #ifdef _OL_IMPORT_ |
1716 | mView->clearAllViews(); | 1716 | mView->clearAllViews(); |
1717 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1717 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1718 | id->exec(); | 1718 | id->exec(); |
1719 | delete id; | 1719 | delete id; |
1720 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1720 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1721 | mView->updateView(); | 1721 | mView->updateView(); |
1722 | #endif | 1722 | #endif |
1723 | } | 1723 | } |
1724 | void MainWindow::importBday() | 1724 | void MainWindow::importBday() |
1725 | { | 1725 | { |
1726 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1726 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1727 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1727 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1728 | i18n("Import!"), i18n("Cancel"), 0, | 1728 | i18n("Import!"), i18n("Cancel"), 0, |
1729 | 0, 1 ); | 1729 | 0, 1 ); |
1730 | if ( result == 0 ) { | 1730 | if ( result == 0 ) { |
1731 | mView->importBday(); | 1731 | mView->importBday(); |
1732 | 1732 | ||
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | 1735 | ||
1736 | } | 1736 | } |
1737 | void MainWindow::importQtopia() | 1737 | void MainWindow::importQtopia() |
1738 | { | 1738 | { |
1739 | //#ifndef DESKTOP_VERSION | 1739 | //#ifndef DESKTOP_VERSION |
1740 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1740 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1741 | #ifdef DESKTOP_VERSION | 1741 | #ifdef DESKTOP_VERSION |
1742 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1742 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1743 | #endif | 1743 | #endif |
1744 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1744 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1745 | i18n("Import!"), i18n("Cancel"), 0, | 1745 | i18n("Import!"), i18n("Cancel"), 0, |
1746 | 0, 1 ); | 1746 | 0, 1 ); |
1747 | if ( result == 0 ) { | 1747 | if ( result == 0 ) { |
1748 | #ifndef DESKTOP_VERSION | 1748 | #ifndef DESKTOP_VERSION |
1749 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1749 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1750 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1750 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
@@ -2289,57 +2289,60 @@ void MainWindow::setCaptionToDates() | |||
2289 | if ( !addString.isEmpty() ) | 2289 | if ( !addString.isEmpty() ) |
2290 | selDates = addString+", "+selDates ; | 2290 | selDates = addString+", "+selDates ; |
2291 | } | 2291 | } |
2292 | setCaption( i18n("Dates: ") + selDates ); | 2292 | setCaption( i18n("Dates: ") + selDates ); |
2293 | 2293 | ||
2294 | } | 2294 | } |
2295 | void MainWindow::showConfigureAgenda( ) | 2295 | void MainWindow::showConfigureAgenda( ) |
2296 | { | 2296 | { |
2297 | int iii; | 2297 | int iii; |
2298 | for ( iii = 1;iii<= 10 ;++iii ){ | 2298 | for ( iii = 1;iii<= 10 ;++iii ){ |
2299 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2299 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2300 | } | 2300 | } |
2301 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2301 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2302 | } | 2302 | } |
2303 | void MainWindow::configureAgenda( int item ) | 2303 | void MainWindow::configureAgenda( int item ) |
2304 | { | 2304 | { |
2305 | if ( KOPrefs::instance()->mHourSize == item ) | 2305 | if ( KOPrefs::instance()->mHourSize == item ) |
2306 | return; | 2306 | return; |
2307 | KOPrefs::instance()->mHourSize=item; | 2307 | KOPrefs::instance()->mHourSize=item; |
2308 | mView->viewManager()->agendaView()->updateConfig(); | 2308 | mView->viewManager()->agendaView()->updateConfig(); |
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | void MainWindow::saveCalendar() | 2311 | void MainWindow::saveCalendar() |
2312 | { | 2312 | { |
2313 | |||
2314 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2313 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2315 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2314 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2316 | bupDir = KGlobalSettings::backupDataDir(); | 2315 | bupDir = KGlobalSettings::backupDataDir(); |
2317 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); | 2316 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2318 | QString bupHint; | 2317 | QString bupHint; |
2319 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) | 2318 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2320 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); | 2319 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); |
2321 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; | 2320 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; |
2321 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; | ||
2322 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | ||
2323 | save(); | ||
2324 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; | ||
2322 | backupAllFiles(); | 2325 | backupAllFiles(); |
2323 | } | 2326 | } |
2324 | void MainWindow::loadCalendar() | 2327 | void MainWindow::loadCalendar() |
2325 | { | 2328 | { |
2326 | 2329 | ||
2327 | 2330 | ||
2328 | #if 0 | 2331 | #if 0 |
2329 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2332 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2330 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2333 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2331 | 2334 | ||
2332 | if ( fn == "" ) | 2335 | if ( fn == "" ) |
2333 | return; | 2336 | return; |
2334 | QFileInfo info; | 2337 | QFileInfo info; |
2335 | info.setFile( fn ); | 2338 | info.setFile( fn ); |
2336 | QString mess; | 2339 | QString mess; |
2337 | bool loadbup = true; | 2340 | bool loadbup = true; |
2338 | if ( info. exists() ) { | 2341 | if ( info. exists() ) { |
2339 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2342 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2340 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2343 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2341 | mess, | 2344 | mess, |
2342 | i18n("Load!"), i18n("Cancel"), 0, | 2345 | i18n("Load!"), i18n("Cancel"), 0, |
2343 | 0, 1 ); | 2346 | 0, 1 ); |
2344 | if ( result != 0 ) { | 2347 | if ( result != 0 ) { |
2345 | loadbup = false; | 2348 | loadbup = false; |