summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-30 00:33:46 (UTC)
committer zautrix <zautrix>2005-01-30 00:33:46 (UTC)
commita8fae20ad7bcb59df9a603c88accf3a10401c2f9 (patch) (unidiff)
tree12deeef9bae6d470c244ce9a9916c59d6879f9b2
parentd94b52aa95cc52aa1bef7c9cd99f43c725ed8042 (diff)
downloadkdepimpi-a8fae20ad7bcb59df9a603c88accf3a10401c2f9.zip
kdepimpi-a8fae20ad7bcb59df9a603c88accf3a10401c2f9.tar.gz
kdepimpi-a8fae20ad7bcb59df9a603c88accf3a10401c2f9.tar.bz2
f
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/koeditordetails.cpp13
-rw-r--r--korganizer/koeditordetails.h1
-rw-r--r--korganizer/koeventviewer.cpp6
-rw-r--r--libkcal/dndfactory.h9
5 files changed, 28 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 74aefb7..96fb5ca 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1474,109 +1474,109 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
1474 if ( ! bar.isVisible() ) 1474 if ( ! bar.isVisible() )
1475 return; 1475 return;
1476 bar.setProgress( i ); 1476 bar.setProgress( i );
1477 qApp->processEvents(); 1477 qApp->processEvents();
1478 1478
1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1480 if (!ok) { 1480 if (!ok) {
1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1482 } 1482 }
1483 1483
1484 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1484 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1485 if (!ok) { 1485 if (!ok) {
1486 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1486 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1487 } 1487 }
1488 realName = realNameList[i]; 1488 realName = realNameList[i];
1489 email = emailList[i]; 1489 email = emailList[i];
1490 assembledName = assembledNameList[i]; 1490 assembledName = assembledNameList[i];
1491 uid = uidList[i]; 1491 uid = uidList[i];
1492 //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() ); 1492 //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() );
1493 1493
1494 if ( birthday.isValid() ){ 1494 if ( birthday.isValid() ){
1495 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1495 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1496 KCal::Attendee::ReqParticipant,uid) ; 1496 KCal::Attendee::ReqParticipant,uid) ;
1497 if ( addAnniversary( birthday, assembledName, a, true ) ) 1497 if ( addAnniversary( birthday, assembledName, a, true ) )
1498 ++addCount; 1498 ++addCount;
1499 } 1499 }
1500 1500
1501 if ( anniversary.isValid() ){ 1501 if ( anniversary.isValid() ){
1502 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1502 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1503 KCal::Attendee::ReqParticipant,uid) ; 1503 KCal::Attendee::ReqParticipant,uid) ;
1504 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1504 if ( addAnniversary( anniversary, assembledName, a, false ) )
1505 ++addCount; 1505 ++addCount;
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 updateView(); 1509 updateView();
1510 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1510 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1511 1511
1512 } 1512 }
1513 1513
1514} 1514}
1515 1515
1516 1516
1517 1517
1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1518bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1519{ 1519{
1520 //qDebug("addAnni "); 1520 //qDebug("addAnni ");
1521 Event * ev = new Event(); 1521 Event * ev = new Event();
1522 ev->setOrganizer(KOPrefs::instance()->email());
1522 if ( a ) { 1523 if ( a ) {
1523 ev->addAttendee( a ); 1524 ev->addAttendee( a );
1524 } 1525 }
1525 QString kind; 1526 QString kind;
1526 if ( birthday ) { 1527 if ( birthday ) {
1527 kind = i18n( "Birthday" ); 1528 kind = i18n( "Birthday" );
1528 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1529 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1529 } 1530 }
1530 else { 1531 else {
1531 kind = i18n( "Anniversary" ); 1532 kind = i18n( "Anniversary" );
1532 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1533 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1533 } 1534 }
1534 //ev->setOrganizer(a->email());
1535 ev->setCategories( kind ); 1535 ev->setCategories( kind );
1536 ev->setDtStart( QDateTime(date) ); 1536 ev->setDtStart( QDateTime(date) );
1537 ev->setDtEnd( QDateTime(date) ); 1537 ev->setDtEnd( QDateTime(date) );
1538 ev->setFloats( true ); 1538 ev->setFloats( true );
1539 Recurrence * rec = ev->recurrence(); 1539 Recurrence * rec = ev->recurrence();
1540 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1540 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1541 rec->addYearlyNum( date.month() ); 1541 rec->addYearlyNum( date.month() );
1542 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1542 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1543 delete ev; 1543 delete ev;
1544 return false; 1544 return false;
1545 } 1545 }
1546 return true; 1546 return true;
1547 1547
1548} 1548}
1549bool CalendarView::importQtopia( const QString &categories, 1549bool CalendarView::importQtopia( const QString &categories,
1550 const QString &datebook, 1550 const QString &datebook,
1551 const QString &todolist ) 1551 const QString &todolist )
1552{ 1552{
1553 1553
1554 QtopiaFormat qtopiaFormat; 1554 QtopiaFormat qtopiaFormat;
1555 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1555 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1556 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1556 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1557 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1557 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1558 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1558 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1559 1559
1560 updateView(); 1560 updateView();
1561 return true; 1561 return true;
1562 1562
1563#if 0 1563#if 0
1564 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1564 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1565 mCurrentSyncDevice = "qtopia-XML"; 1565 mCurrentSyncDevice = "qtopia-XML";
1566 if ( mSyncManager->mAskForPreferences ) 1566 if ( mSyncManager->mAskForPreferences )
1567 edit_sync_options(); 1567 edit_sync_options();
1568 qApp->processEvents(); 1568 qApp->processEvents();
1569 CalendarLocal* calendar = new CalendarLocal(); 1569 CalendarLocal* calendar = new CalendarLocal();
1570 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1570 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1571 bool syncOK = false; 1571 bool syncOK = false;
1572 QtopiaFormat qtopiaFormat; 1572 QtopiaFormat qtopiaFormat;
1573 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1573 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1574 bool loadOk = true; 1574 bool loadOk = true;
1575 if ( !categories.isEmpty() ) 1575 if ( !categories.isEmpty() )
1576 loadOk = qtopiaFormat.load( calendar, categories ); 1576 loadOk = qtopiaFormat.load( calendar, categories );
1577 if ( loadOk && !datebook.isEmpty() ) 1577 if ( loadOk && !datebook.isEmpty() )
1578 loadOk = qtopiaFormat.load( calendar, datebook ); 1578 loadOk = qtopiaFormat.load( calendar, datebook );
1579 if ( loadOk && !todolist.isEmpty() ) 1579 if ( loadOk && !todolist.isEmpty() )
1580 loadOk = qtopiaFormat.load( calendar, todolist ); 1580 loadOk = qtopiaFormat.load( calendar, todolist );
1581 1581
1582 if ( loadOk ) { 1582 if ( loadOk ) {
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index cf0a458..ef8025b 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -45,100 +45,104 @@
45#endif //DESKTOP_VERSION 45#endif //DESKTOP_VERSION
46 46
47#endif 47#endif
48 48
49#include <libkcal/incidence.h> 49#include <libkcal/incidence.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52 52
53#include "koeditordetails.h" 53#include "koeditordetails.h"
54 54
55template <> 55template <>
56CustomListViewItem<class Attendee *>::~CustomListViewItem() 56CustomListViewItem<class Attendee *>::~CustomListViewItem()
57{ 57{
58 delete mData; 58 delete mData;
59} 59}
60 60
61template <> 61template <>
62void CustomListViewItem<class Attendee *>::updateItem() 62void CustomListViewItem<class Attendee *>::updateItem()
63{ 63{
64 setText(0,mData->name()); 64 setText(0,mData->name());
65 setText(1,mData->email()); 65 setText(1,mData->email());
66 setText(2,mData->roleStr()); 66 setText(2,mData->roleStr());
67 setText(3,mData->statusStr()); 67 setText(3,mData->statusStr());
68 if (mData->RSVP() && !mData->email().isEmpty()) 68 if (mData->RSVP() && !mData->email().isEmpty())
69 setPixmap(4,SmallIcon("mailappt")); 69 setPixmap(4,SmallIcon("mailappt"));
70 else 70 else
71 setPixmap(4,SmallIcon("nomailappt")); 71 setPixmap(4,SmallIcon("nomailappt"));
72} 72}
73 73
74 74
75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
76 : QWidget( parent, name), mDisableItemUpdate( false ) 76 : QWidget( parent, name), mDisableItemUpdate( false )
77{ 77{
78 QGridLayout *topLayout = new QGridLayout(this); 78 QGridLayout *topLayout = new QGridLayout(this);
79 topLayout->setSpacing(spacing); 79 topLayout->setSpacing(spacing);
80 80
81 QString organizer = KOPrefs::instance()->email(); 81 QString organizer = KOPrefs::instance()->email();
82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
83 83
84 mListView = new KListView(this,"mListView"); 84 mListView = new KListView(this,"mListView");
85 mListView->addColumn(i18n("Name"),180); 85 mListView->addColumn(i18n("Name"),180);
86 mListView->addColumn(i18n("Email"),180); 86 mListView->addColumn(i18n("Email"),180);
87 mListView->addColumn(i18n("Role"),60); 87 mListView->addColumn(i18n("Role"),60);
88 mListView->addColumn(i18n("Status"),100); 88 mListView->addColumn(i18n("Status"),100);
89 mListView->addColumn(i18n("RSVP"),35); 89 mListView->addColumn(i18n("RSVP"),35);
90 if ( KOPrefs::instance()->mCompactDialogs ) { 90 if ( KOPrefs::instance()->mCompactDialogs ) {
91 //mListView->setFixedHeight(78); 91 //mListView->setFixedHeight(78);
92 } 92 }
93 93 mListView->setAllColumnsShowFocus (true );
94 //mListView->setSingleClick( true );
94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 95 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
95 SLOT(updateAttendeeInput())); 96 SLOT(updateAttendeeInput()));
96 97
98 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )),
99 SLOT(itemClicked(QListViewItem * ,const QPoint& , int )));
100
97 QLabel *attendeeLabel = new QLabel(this); 101 QLabel *attendeeLabel = new QLabel(this);
98 attendeeLabel->setText(i18n("Name:")); 102 attendeeLabel->setText(i18n("Name:"));
99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 103 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
100 mNameEdit = new QLineEdit(this); 104 mNameEdit = new QLineEdit(this);
101 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 105 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
102 SLOT(updateAttendeeItem())); 106 SLOT(updateAttendeeItem()));
103 107
104 mUidEdit = new QLineEdit(0); 108 mUidEdit = new QLineEdit(0);
105 mUidEdit->setText(""); 109 mUidEdit->setText("");
106 110
107 QLabel *emailLabel = new QLabel(this); 111 QLabel *emailLabel = new QLabel(this);
108 emailLabel->setText(i18n("Email:")); 112 emailLabel->setText(i18n("Email:"));
109 mEmailEdit = new QLineEdit(this); 113 mEmailEdit = new QLineEdit(this);
110 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 114 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
111 SLOT(updateAttendeeItem())); 115 SLOT(updateAttendeeItem()));
112 116
113 QLabel *attendeeRoleLabel = new QLabel(this); 117 QLabel *attendeeRoleLabel = new QLabel(this);
114 attendeeRoleLabel->setText(i18n("Role:")); 118 attendeeRoleLabel->setText(i18n("Role:"));
115 mRoleCombo = new QComboBox(false,this); 119 mRoleCombo = new QComboBox(false,this);
116 mRoleCombo->insertStringList(Attendee::roleList()); 120 mRoleCombo->insertStringList(Attendee::roleList());
117 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 121 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
118 122
119 QLabel *statusLabel = new QLabel(this); 123 QLabel *statusLabel = new QLabel(this);
120 statusLabel->setText( i18n("Status:") ); 124 statusLabel->setText( i18n("Status:") );
121 125
122 mStatusCombo = new QComboBox(false,this); 126 mStatusCombo = new QComboBox(false,this);
123 mStatusCombo->insertStringList(Attendee::statusList()); 127 mStatusCombo->insertStringList(Attendee::statusList());
124 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 128 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
125 129
126 mRsvpButton = new QCheckBox(this); 130 mRsvpButton = new QCheckBox(this);
127 mRsvpButton->setText(i18n("Request response")); 131 mRsvpButton->setText(i18n("Request response"));
128 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 132 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
129 QWidget *buttonBox = new QWidget(this); 133 QWidget *buttonBox = new QWidget(this);
130 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 134 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
131 135
132 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 136 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
133 buttonLayout->addWidget(newButton); 137 buttonLayout->addWidget(newButton);
134 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 138 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
135 139
136 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 140 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
137 buttonLayout->addWidget(mRemoveButton); 141 buttonLayout->addWidget(mRemoveButton);
138 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 142 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
139 143
140 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 144 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
141 // buttonLayout->addWidget(mAddressBookButton); 145 // buttonLayout->addWidget(mAddressBookButton);
142 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 146 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
143 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 147 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
144 148
@@ -376,66 +380,73 @@ void KOEditorDetails::updateAttendeeInput()
376{ 380{
377 QListViewItem *item = mListView->selectedItem(); 381 QListViewItem *item = mListView->selectedItem();
378 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 382 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
379 if (aItem) { 383 if (aItem) {
380 fillAttendeeInput( aItem ); 384 fillAttendeeInput( aItem );
381 } else { 385 } else {
382 clearAttendeeInput(); 386 clearAttendeeInput();
383 } 387 }
384} 388}
385 389
386void KOEditorDetails::clearAttendeeInput() 390void KOEditorDetails::clearAttendeeInput()
387{ 391{
388 mNameEdit->setText(""); 392 mNameEdit->setText("");
389 mUidEdit->setText(""); 393 mUidEdit->setText("");
390 mEmailEdit->setText(""); 394 mEmailEdit->setText("");
391 mRoleCombo->setCurrentItem(0); 395 mRoleCombo->setCurrentItem(0);
392 mStatusCombo->setCurrentItem(0); 396 mStatusCombo->setCurrentItem(0);
393 mRsvpButton->setChecked(true); 397 mRsvpButton->setChecked(true);
394 setEnabledAttendeeInput( false ); 398 setEnabledAttendeeInput( false );
395} 399}
396 400
397void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) 401void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
398{ 402{
399 Attendee *a = aItem->data(); 403 Attendee *a = aItem->data();
400 mDisableItemUpdate = true; 404 mDisableItemUpdate = true;
401 mNameEdit->setText(a->name()); 405 mNameEdit->setText(a->name());
402 mUidEdit->setText(a->uid()); 406 mUidEdit->setText(a->uid());
403 mEmailEdit->setText(a->email()); 407 mEmailEdit->setText(a->email());
404 mRoleCombo->setCurrentItem(a->role()); 408 mRoleCombo->setCurrentItem(a->role());
405 mStatusCombo->setCurrentItem(a->status()); 409 mStatusCombo->setCurrentItem(a->status());
406 mRsvpButton->setChecked(a->RSVP()); 410 mRsvpButton->setChecked(a->RSVP());
407 411
408 mDisableItemUpdate = false; 412 mDisableItemUpdate = false;
409 413
410 setEnabledAttendeeInput( true ); 414 setEnabledAttendeeInput( true );
411} 415}
412 416
413void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) 417void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
414{ 418{
415 mNameEdit->setEnabled( enabled ); 419 mNameEdit->setEnabled( enabled );
416 mEmailEdit->setEnabled( enabled ); 420 mEmailEdit->setEnabled( enabled );
417 mRoleCombo->setEnabled( enabled ); 421 mRoleCombo->setEnabled( enabled );
418 mStatusCombo->setEnabled( enabled ); 422 mStatusCombo->setEnabled( enabled );
419 mRsvpButton->setEnabled( enabled ); 423 mRsvpButton->setEnabled( enabled );
420 424
421 mRemoveButton->setEnabled( enabled ); 425 mRemoveButton->setEnabled( enabled );
422} 426}
423 427
428void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c )
429{
430 if ( item && c == 4 ) {
431 mRsvpButton->setChecked( !mRsvpButton->isChecked() );
432 updateAttendeeItem();
433 }
434}
424void KOEditorDetails::updateAttendeeItem() 435void KOEditorDetails::updateAttendeeItem()
425{ 436{
426 if (mDisableItemUpdate) return; 437 if (mDisableItemUpdate) return;
427 438
428 QListViewItem *item = mListView->selectedItem(); 439 QListViewItem *item = mListView->selectedItem();
429 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 440 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
430 if ( !aItem ) return; 441 if ( !aItem ) return;
431 442
432 Attendee *a = aItem->data(); 443 Attendee *a = aItem->data();
433 444
434 a->setName( mNameEdit->text() ); 445 a->setName( mNameEdit->text() );
435 a->setUid( mUidEdit->text() ); 446 a->setUid( mUidEdit->text() );
436 a->setEmail( mEmailEdit->text() ); 447 a->setEmail( mEmailEdit->text() );
437 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); 448 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
438 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); 449 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
439 a->setRSVP( mRsvpButton->isChecked() ); 450 a->setRSVP( mRsvpButton->isChecked() );
440 aItem->updateItem(); 451 aItem->updateItem();
441} 452}
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h
index 0cc807f..a33ee82 100644
--- a/korganizer/koeditordetails.h
+++ b/korganizer/koeditordetails.h
@@ -38,71 +38,72 @@
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40 40
41#include <libkcal/event.h> 41#include <libkcal/event.h>
42 42
43#include "ktimeedit.h" 43#include "ktimeedit.h"
44#include "customlistviewitem.h" 44#include "customlistviewitem.h"
45 45
46class KDateEdit; 46class KDateEdit;
47 47
48using namespace KCal; 48using namespace KCal;
49 49
50typedef CustomListViewItem<Attendee *> AttendeeListItem; 50typedef CustomListViewItem<Attendee *> AttendeeListItem;
51 51
52 52
53class KOEditorDetails : public QWidget 53class KOEditorDetails : public QWidget
54{ 54{
55 Q_OBJECT 55 Q_OBJECT
56 public: 56 public:
57 KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0); 57 KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0);
58 virtual ~KOEditorDetails(); 58 virtual ~KOEditorDetails();
59 59
60 /** Set widgets to default values */ 60 /** Set widgets to default values */
61 void setDefaults(); 61 void setDefaults();
62 /** Read event object and setup widgets accordingly */ 62 /** Read event object and setup widgets accordingly */
63 void readEvent(Incidence *); 63 void readEvent(Incidence *);
64 /** Write event settings to event object */ 64 /** Write event settings to event object */
65 void writeEvent(Incidence *); 65 void writeEvent(Incidence *);
66 66
67 /** return a clone of the event with attendees to be canceld*/ 67 /** return a clone of the event with attendees to be canceld*/
68 void cancelAttendeeEvent(Incidence *); 68 void cancelAttendeeEvent(Incidence *);
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput(); 70 bool validateInput();
71 71
72 public slots: 72 public slots:
73 void insertAttendee(Attendee *); 73 void insertAttendee(Attendee *);
74 // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi 74 // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi
75 // The first parameter is a uniqueid. It can be used to identify if event 75 // The first parameter is a uniqueid. It can be used to identify if event
76 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); 76 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
77 77
78 78
79 protected slots: 79 protected slots:
80 void addNewAttendee(); 80 void addNewAttendee();
81 void removeAttendee(); 81 void removeAttendee();
82 void openAddressBook(); 82 void openAddressBook();
83 void updateAttendeeInput(); 83 void updateAttendeeInput();
84 void clearAttendeeInput(); 84 void clearAttendeeInput();
85 void fillAttendeeInput(AttendeeListItem *); 85 void fillAttendeeInput(AttendeeListItem *);
86 void itemClicked(QListViewItem *,const QPoint & pnt, int c);
86 void updateAttendeeItem(); 87 void updateAttendeeItem();
87 void setEnabledAttendeeInput(bool); 88 void setEnabledAttendeeInput(bool);
88 89
89 private: 90 private:
90 bool mDisableItemUpdate; 91 bool mDisableItemUpdate;
91 92
92 QLineEdit *mNameEdit; 93 QLineEdit *mNameEdit;
93 QLineEdit *mUidEdit; 94 QLineEdit *mUidEdit;
94 QLineEdit *mEmailEdit; 95 QLineEdit *mEmailEdit;
95 KListView *mListView; 96 KListView *mListView;
96 QComboBox* mRoleCombo; 97 QComboBox* mRoleCombo;
97 QCheckBox* mRsvpButton; 98 QCheckBox* mRsvpButton;
98 QComboBox* mStatusCombo; 99 QComboBox* mStatusCombo;
99 QLabel *mOrganizerLabel; 100 QLabel *mOrganizerLabel;
100 101
101 QPushButton* mAddButton; 102 QPushButton* mAddButton;
102 QPushButton* mRemoveButton; 103 QPushButton* mRemoveButton;
103 QPushButton* mAddressBookButton; 104 QPushButton* mAddressBookButton;
104 105
105 QPtrList<Attendee> mdelAttendees; 106 QPtrList<Attendee> mdelAttendees;
106}; 107};
107 108
108#endif 109#endif
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 5de667e..2f0fa9e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -372,173 +372,177 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
372 if (!event->description().isEmpty()) { 372 if (!event->description().isEmpty()) {
373 addTag("p",i18n("<b>Details: </b>")); 373 addTag("p",i18n("<b>Details: </b>"));
374 addTag("p",event->description()); 374 addTag("p",event->description());
375 } 375 }
376 376
377 formatCategories(event); 377 formatCategories(event);
378 378
379 mText.append(i18n("<p><b>Priority:</b> %2</p>") 379 mText.append(i18n("<p><b>Priority:</b> %2</p>")
380 .arg(QString::number(event->priority()))); 380 .arg(QString::number(event->priority())));
381 381
382 mText.append(i18n("<p><i>%1 % completed</i></p>") 382 mText.append(i18n("<p><i>%1 % completed</i></p>")
383 .arg(event->percentComplete())); 383 .arg(event->percentComplete()));
384 384
385 formatReadOnly(event); 385 formatReadOnly(event);
386 formatAttendees(event); 386 formatAttendees(event);
387 if ( event->relatedTo() ) { 387 if ( event->relatedTo() ) {
388 addTag("b",i18n("Parent todo: ")); 388 addTag("b",i18n("Parent todo: "));
389 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 389 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
390 } 390 }
391 QPtrList<Incidence> Relations = event->relations(); 391 QPtrList<Incidence> Relations = event->relations();
392 Incidence *to; 392 Incidence *to;
393 if ( Relations.first() ) 393 if ( Relations.first() )
394 addTag("b",i18n("Sub todos:<br>")); 394 addTag("b",i18n("Sub todos:<br>"));
395 for (to=Relations.first();to;to=Relations.next()) { 395 for (to=Relations.first();to;to=Relations.next()) {
396 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 396 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
397 397
398 } 398 }
399 setText(mText); 399 setText(mText);
400} 400}
401 401
402void KOEventViewer::formatCategories(Incidence *event) 402void KOEventViewer::formatCategories(Incidence *event)
403{ 403{
404 if (!event->categoriesStr().isEmpty()) { 404 if (!event->categoriesStr().isEmpty()) {
405 if (event->categories().count() == 1) { 405 if (event->categories().count() == 1) {
406 addTag("h3",i18n("Category")); 406 addTag("h3",i18n("Category"));
407 } else { 407 } else {
408 addTag("h3",i18n("Categories")); 408 addTag("h3",i18n("Categories"));
409 } 409 }
410 addTag("p",event->categoriesStr()); 410 addTag("p",event->categoriesStr());
411 } 411 }
412} 412}
413void KOEventViewer::formatAttendees(Incidence *event) 413void KOEventViewer::formatAttendees(Incidence *event)
414{ 414{
415 QPtrList<Attendee> attendees = event->attendees(); 415 QPtrList<Attendee> attendees = event->attendees();
416 if (attendees.count()) { 416 if (attendees.count()) {
417 417
418 418
419 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 419 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
420 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
420 addTag("h3",i18n("Organizer")); 421 addTag("h3",i18n("Organizer"));
421 mText.append("<ul><li>"); 422 mText.append("<ul><li>");
422#ifndef KORG_NOKABC 423#ifndef KORG_NOKABC
423 424
424#ifdef DESKTOP_VERSION 425#ifdef DESKTOP_VERSION
425 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 426 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
426 KABC::Addressee::List addressList; 427 KABC::Addressee::List addressList;
427 addressList = add_book->findByEmail(event->organizer()); 428 addressList = add_book->findByEmail(event->organizer());
428 KABC::Addressee o = addressList.first(); 429 KABC::Addressee o = addressList.first();
429 if (!o.isEmpty() && addressList.size()<2) { 430 if (!o.isEmpty() && addressList.size()<2) {
430 mText += "<a href=\"uid:" + o.uid() + "\">"; 431 mText += "<a href=\"uid:" + o.uid() + "\">";
431 mText += o.formattedName(); 432 mText += o.formattedName();
432 mText += "</a>\n"; 433 mText += "</a>\n";
433 } else { 434 } else {
434 mText.append(event->organizer()); 435 mText.append(event->organizer());
435 } 436 }
436#else //DESKTOP_VERSION 437#else //DESKTOP_VERSION
437 mText += "<a href=\"uid:organizer\">"; 438 mText += "<a href=\"uid:organizer\">";
438 mText += event->organizer(); 439 mText += event->organizer();
439 mText += "</a>\n"; 440 mText += "</a>\n";
440#endif //DESKTOP_VERSION 441#endif //DESKTOP_VERSION
441 442
442 443
443#else 444#else
444 mText.append(event->organizer()); 445 mText.append(event->organizer());
445#endif 446#endif
446 447
447 if (iconPath) { 448 if (iconPath) {
448 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 449 mText += " <a href=\"mailto:" + event->organizer() + "\">";
449 mText += "<IMG src=\"" + iconPath + "\">"; 450 mText += "<IMG src=\"" + iconPath + "\">";
450 mText += "</a>\n"; 451 mText += "</a>\n";
451 } 452 }
452 mText.append("</li></ul>"); 453 mText.append("</li></ul>");
453 454
454 addTag("h3",i18n("Attendees")); 455 addTag("h3",i18n("Attendees"));
455 Attendee *a; 456 Attendee *a;
456 mText.append("<ul>"); 457 mText.append("<ul>");
457 for(a=attendees.first();a;a=attendees.next()) { 458 for(a=attendees.first();a;a=attendees.next()) {
458#ifndef KORG_NOKABC 459#ifndef KORG_NOKABC
459#ifdef DESKTOP_VERSION 460#ifdef DESKTOP_VERSION
460 if (a->name().isEmpty()) { 461 if (a->name().isEmpty()) {
461 addressList = add_book->findByEmail(a->email()); 462 addressList = add_book->findByEmail(a->email());
462 KABC::Addressee o = addressList.first(); 463 KABC::Addressee o = addressList.first();
463 if (!o.isEmpty() && addressList.size()<2) { 464 if (!o.isEmpty() && addressList.size()<2) {
464 mText += "<a href=\"uid:" + o.uid() + "\">"; 465 mText += "<a href=\"uid:" + o.uid() + "\">";
465 mText += o.formattedName(); 466 mText += o.formattedName();
466 mText += "</a>\n"; 467 mText += "</a>\n";
467 } else { 468 } else {
468 mText += "<li>"; 469 mText += "<li>";
469 mText.append(a->email()); 470 mText.append(a->email());
470 mText += "\n"; 471 mText += "\n";
471 } 472 }
472 } else { 473 } else {
473 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 474 mText += "<li><a href=\"uid:" + a->uid() + "\">";
474 if (!a->name().isEmpty()) mText += a->name(); 475 if (!a->name().isEmpty()) mText += a->name();
475 else mText += a->email(); 476 else mText += a->email();
476 mText += "</a>\n"; 477 mText += "</a>\n";
477 } 478 }
478#else //DESKTOP_VERSION 479#else //DESKTOP_VERSION
479 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 480 mText += "<li><a href=\"uid:" + a->uid() + "\">";
480 if (!a->name().isEmpty()) mText += a->name(); 481 if (!a->name().isEmpty()) mText += a->name();
481 else mText += a->email(); 482 else mText += a->email();
482 mText += "</a>\n"; 483 mText += "</a>\n";
483#endif //DESKTOP_VERSION 484#endif //DESKTOP_VERSION
484#else 485#else
485 //qDebug("nokabc "); 486 //qDebug("nokabc ");
486 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 487 mText += "<li><a href=\"uid:" + a->uid() + "\">";
487 if (!a->name().isEmpty()) mText += a->name(); 488 if (!a->name().isEmpty()) mText += a->name();
488 else mText += a->email(); 489 else mText += a->email();
489 mText += "</a>\n"; 490 mText += "</a>\n";
490#endif 491#endif
491 492
492 493
493 if (!a->email().isEmpty()) { 494 if (!a->email().isEmpty()) {
494 if (iconPath) { 495 if (iconPath) {
495 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 496 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
496 mText += "<IMG src=\"" + iconPath + "\">"; 497 if ( a->RSVP() )
498 mText += "<IMG src=\"" + iconPath + "\">";
499 else
500 mText += "<IMG src=\"" + NOiconPath + "\">";
497 mText += "</a>\n"; 501 mText += "</a>\n";
498 } 502 }
499 } 503 }
500 if (a->status() != Attendee::NeedsAction ) 504 if (a->status() != Attendee::NeedsAction )
501 mText +="[" + a->statusStr() + "] "; 505 mText +="[" + a->statusStr() + "] ";
502 if (a->role() == Attendee::Chair ) 506 if (a->role() == Attendee::Chair )
503 mText +="(" + a->roleStr().left(1) + ".)"; 507 mText +="(" + a->roleStr().left(1) + ".)";
504 } 508 }
505 mText.append("</li></ul>"); 509 mText.append("</li></ul>");
506 } 510 }
507 511
508} 512}
509void KOEventViewer::appendJournal(Journal *jour, int mode ) 513void KOEventViewer::appendJournal(Journal *jour, int mode )
510{ 514{
511 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 515 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
512 if (mode == 0 ) { 516 if (mode == 0 ) {
513 addTag("h2",i18n("Journal from: ")); 517 addTag("h2",i18n("Journal from: "));
514 } 518 }
515 else { 519 else {
516 if ( mode == 1 ) { 520 if ( mode == 1 ) {
517 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 521 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
518 } else { 522 } else {
519 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 523 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
520 } 524 }
521 } 525 }
522 topLevelWidget()->setCaption("Journal Viewer"); 526 topLevelWidget()->setCaption("Journal Viewer");
523 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 527 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
524 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 528 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
525 if (!jour->description().isEmpty()) { 529 if (!jour->description().isEmpty()) {
526 addTag("p",jour->description()); 530 addTag("p",jour->description());
527 } 531 }
528 setText(mText); 532 setText(mText);
529} 533}
530 534
531void KOEventViewer::formatReadOnly(Incidence *event) 535void KOEventViewer::formatReadOnly(Incidence *event)
532{ 536{
533 if (event->isReadOnly()) { 537 if (event->isReadOnly()) {
534 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 538 addTag("p","<em>(" + i18n("read-only") + ")</em>");
535 } 539 }
536} 540}
537void KOEventViewer::setSyncMode( bool b ) 541void KOEventViewer::setSyncMode( bool b )
538{ 542{
539 mSyncMode = b; 543 mSyncMode = b;
540} 544}
541 545
542 546
543void KOEventViewer::setTodo(Todo *event, bool clearV ) 547void KOEventViewer::setTodo(Todo *event, bool clearV )
544{ 548{
diff --git a/libkcal/dndfactory.h b/libkcal/dndfactory.h
index 7e2ca04..2df5259 100644
--- a/libkcal/dndfactory.h
+++ b/libkcal/dndfactory.h
@@ -1,74 +1,83 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
6 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 6 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details. 16 Library General Public License for more details.
17 17
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22*/ 22*/
23 23
24#ifdef DESKTOP_VERSION
25
24#ifndef KCAL_DNDFACTORY_H 26#ifndef KCAL_DNDFACTORY_H
25#define KCAL_DNDFACTORY_H 27#define KCAL_DNDFACTORY_H
26 28
27//#include "libkcal_export.h" 29//#include "libkcal_export.h"
28 30
29namespace KCal { 31namespace KCal {
30 32
31class ICalDrag; 33class ICalDrag;
32class Event; 34class Event;
33class Todo; 35class Todo;
34class Calendar; 36class Calendar;
35#define LIBKCAL_EXPORT 37#define LIBKCAL_EXPORT
36 38
37/** 39/**
38 This class implements functions to create Drag and Drop objects used for 40 This class implements functions to create Drag and Drop objects used for
39 Drag-and-Drop and Copy-and-Paste. 41 Drag-and-Drop and Copy-and-Paste.
40 42
41 @short vCalendar/iCalendar Drag-and-Drop object factory. 43 @short vCalendar/iCalendar Drag-and-Drop object factory.
42*/ 44*/
43class LIBKCAL_EXPORT DndFactory 45class LIBKCAL_EXPORT DndFactory
44{ 46{
45 public: 47 public:
46 DndFactory( Calendar * ); 48 DndFactory( Calendar * );
47 49
48 /** 50 /**
49 Create a drag object. 51 Create a drag object.
50 */ 52 */
51 ICalDrag *createDrag( Incidence *incidence, QWidget *owner ); 53 ICalDrag *createDrag( Incidence *incidence, QWidget *owner );
52 54
53 /** Create Todo object from drop event */ 55 /** Create Todo object from drop event */
54 Todo *createDropTodo(QDropEvent *de); 56 Todo *createDropTodo(QDropEvent *de);
55 /** Create Event object from drop event */ 57 /** Create Event object from drop event */
56 Event *createDrop(QDropEvent *de); 58 Event *createDrop(QDropEvent *de);
57 59
58 /** cut incidence to clipboard */ 60 /** cut incidence to clipboard */
59 void cutIncidence( Incidence * ); 61 void cutIncidence( Incidence * );
60 /** copy the incidence to clipboard */ 62 /** copy the incidence to clipboard */
61 bool copyIncidence( Incidence * ); 63 bool copyIncidence( Incidence * );
62 /** pastes the event or todo and returns a pointer to the new incidence pasted. */ 64 /** pastes the event or todo and returns a pointer to the new incidence pasted. */
63 Incidence *pasteIncidence( const QDate &, const QTime *newTime = 0 ); 65 Incidence *pasteIncidence( const QDate &, const QTime *newTime = 0 );
64 66
65 private: 67 private:
66 Calendar *mCalendar; 68 Calendar *mCalendar;
67 69
68 class Private; 70 class Private;
69 Private *d; 71 Private *d;
70}; 72};
71 73
72} 74}
73 75
74#endif 76#endif
77
78#else // dummy implementation for embedded
79#include "dndfactory_dummy.h"
80#define cutIncidence cutEvent
81#define pasteIncidence pasteEvent
82#define copyIncidence copyEvent
83#endif