author | zautrix <zautrix> | 2005-07-29 17:41:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-29 17:41:39 (UTC) |
commit | 9553b882522708477d131d0d9a2c581724940ba3 (patch) (side-by-side diff) | |
tree | c44ccf8238ed9aa2991aad829dc75302b2992f9b | |
parent | 2f3e1ae3d057b10aa6b4dbc3de109da32563dfb3 (diff) | |
download | kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.zip kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.tar.gz kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.tar.bz2 |
fixx
-rw-r--r-- | korganizer/koeditordetails.cpp | 10 | ||||
-rw-r--r-- | korganizer/koeditordetails.h | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 479bd8b..b90b9eb 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp @@ -88,66 +88,64 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); mListView = new KListView(this,"mListView"); mListView->addColumn(i18n("Name"),180); mListView->addColumn(i18n("Email"),180); mListView->addColumn(i18n("Role"),60); mListView->addColumn(i18n("Status"),100); mListView->addColumn(i18n("RSVP"),35); if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { int hei = 80; if ( QApplication::desktop()->height() <= 240 ) hei = 60; mListView->setFixedHeight(hei); } mListView->setAllColumnsShowFocus (true ); //mListView->setSingleClick( true ); connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateAttendeeInput())); connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); mRsvpButton = new QCheckBox(this); mRsvpButton->setText(i18n("Request response")); mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); QLabel *attendeeLabel = new QLabel(this); attendeeLabel->setText(i18n("Name:")); attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); mNameEdit = new QLineEdit(this); connect(mNameEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); - mUidEdit = new QLineEdit(0); - mUidEdit->setText(""); QLabel *emailLabel = new QLabel(this); emailLabel->setText(i18n("Email:")); mEmailEdit = new QLineEdit(this); connect(mEmailEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); QLabel *attendeeRoleLabel = new QLabel(this); attendeeRoleLabel->setText(i18n("Role:")); mRoleCombo = new QComboBox(false,this); mRoleCombo->insertStringList(Attendee::roleList()); connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); QLabel *statusLabel = new QLabel(this); statusLabel->setText( i18n("Status:") ); mStatusCombo = new QComboBox(false,this); mStatusCombo->insertStringList(Attendee::statusList()); connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); QWidget *buttonBox = new QWidget(this); QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); buttonLayout->addWidget(newButton); connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); buttonLayout->addWidget(mRemoveButton); connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); @@ -326,157 +324,157 @@ void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& name QString _email = emailList[i]; QString _uid = uidList[i]; Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); insertAttendee(a); } } } void KOEditorDetails::insertAttendee(Attendee *a) { AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); while (first) { if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) return; first = (AttendeeListItem*) first->nextSibling(); } AttendeeListItem *item = new AttendeeListItem(a,mListView); mListView->setSelected( item, true ); } void KOEditorDetails::setDefaults() { mRsvpButton->setChecked(true); mListView->clear(); mdelAttendees.clear(); clearAttendeeInput(); mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); mNameEdit->setText(""); - mUidEdit->setText(""); + mUidEdit = ""; mEmailEdit->setText(""); mRoleCombo->setCurrentItem( 0 ); mStatusCombo->setCurrentItem( 0 ); } void KOEditorDetails::readEvent(Incidence *event) { setDefaults(); //mListView->clear(); //mdelAttendees.clear(); QPtrList<Attendee> tmpAList = event->attendees(); Attendee *a; for (a = tmpAList.first(); a; a = tmpAList.next()) insertAttendee(new Attendee(*a)); mListView->setSelected( mListView->firstChild(), true ); mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); } void KOEditorDetails::writeEvent(Incidence *event) { event->clearAttendees(); QListViewItem *item; AttendeeListItem *a; for (item = mListView->firstChild(); item; item = item->nextSibling()) { a = (AttendeeListItem *)item; event->addAttendee(new Attendee(*(a->data()))); } event->setOrganizer(KOPrefs::instance()->email()); } void KOEditorDetails::cancelAttendeeEvent(Incidence *event) { event->clearAttendees(); Attendee * att; for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { event->addAttendee(new Attendee(*att)); } mdelAttendees.clear(); } bool KOEditorDetails::validateInput() { return true; } void KOEditorDetails::updateAttendeeInput() { QListViewItem *item = mListView->selectedItem(); AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); if (aItem) { fillAttendeeInput( aItem ); } else { clearAttendeeInput(); } } void KOEditorDetails::clearAttendeeInput() { mNameEdit->setText(""); - mUidEdit->setText(""); + mUidEdit = ""; mEmailEdit->setText(""); mRoleCombo->setCurrentItem(0); mStatusCombo->setCurrentItem(0); mRsvpButton->setChecked(true); setEnabledAttendeeInput( false ); } void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) { Attendee *a = aItem->data(); mDisableItemUpdate = true; mNameEdit->setText(a->name()); - mUidEdit->setText(a->uid()); + mUidEdit = a->uid(); mEmailEdit->setText(a->email()); mRoleCombo->setCurrentItem(a->role()); mStatusCombo->setCurrentItem(a->status()); mRsvpButton->setChecked(a->RSVP()); mDisableItemUpdate = false; setEnabledAttendeeInput( true ); } void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) { mNameEdit->setEnabled( enabled ); mEmailEdit->setEnabled( enabled ); mRoleCombo->setEnabled( enabled ); mStatusCombo->setEnabled( enabled ); mRsvpButton->setEnabled( enabled ); mRemoveButton->setEnabled( enabled ); } void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) { if ( item && c == 4 ) { mRsvpButton->setChecked( !mRsvpButton->isChecked() ); updateAttendeeItem(); } } void KOEditorDetails::updateAttendeeItem() { if (mDisableItemUpdate) return; QListViewItem *item = mListView->selectedItem(); AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); if ( !aItem ) return; Attendee *a = aItem->data(); a->setName( mNameEdit->text() ); - a->setUid( mUidEdit->text() ); + a->setUid( mUidEdit ); a->setEmail( mEmailEdit->text() ); if ( mEmailEdit->text().isEmpty() ) mRsvpButton->setChecked( false ); a->setRSVP( mRsvpButton->isChecked() ); a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); aItem->updateItem(); } diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h index a33ee82..5f8f6f2 100644 --- a/korganizer/koeditordetails.h +++ b/korganizer/koeditordetails.h @@ -62,48 +62,48 @@ class KOEditorDetails : public QWidget /** Read event object and setup widgets accordingly */ void readEvent(Incidence *); /** Write event settings to event object */ void writeEvent(Incidence *); /** return a clone of the event with attendees to be canceld*/ void cancelAttendeeEvent(Incidence *); /** Check if the input is valid. */ bool validateInput(); public slots: void insertAttendee(Attendee *); // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi // The first parameter is a uniqueid. It can be used to identify if event void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); protected slots: void addNewAttendee(); void removeAttendee(); void openAddressBook(); void updateAttendeeInput(); void clearAttendeeInput(); void fillAttendeeInput(AttendeeListItem *); void itemClicked(QListViewItem *,const QPoint & pnt, int c); void updateAttendeeItem(); void setEnabledAttendeeInput(bool); private: bool mDisableItemUpdate; QLineEdit *mNameEdit; - QLineEdit *mUidEdit; + QString mUidEdit; QLineEdit *mEmailEdit; KListView *mListView; QComboBox* mRoleCombo; QCheckBox* mRsvpButton; QComboBox* mStatusCombo; QLabel *mOrganizerLabel; QPushButton* mAddButton; QPushButton* mRemoveButton; QPushButton* mAddressBookButton; QPtrList<Attendee> mdelAttendees; }; #endif |