Diffstat (limited to 'korganizer/koeditordetails.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditordetails.cpp | 102 |
1 files changed, 61 insertions, 41 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 802261c..bdfc637 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -43,195 +43,215 @@ | |||
43 | #else //DESKTOP_VERSION | 43 | #else //DESKTOP_VERSION |
44 | #include <externalapphandler.h> | 44 | #include <externalapphandler.h> |
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 | ||
55 | template <> | 55 | template <> |
56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
57 | { | 57 | { |
58 | delete mData; | 58 | delete mData; |
59 | } | 59 | } |
60 | 60 | ||
61 | template <> | 61 | template <> |
62 | void CustomListViewItem<class Attendee *>::updateItem() | 62 | void 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 | ||
75 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 75 | KOEditorDetails::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 ( QApplication::desktop()->width() <= 320 ) { | 90 | if ( QApplication::desktop()->width() <= 320 ) { |
91 | //mListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding) ); | 91 | int hei = 80; |
92 | mListView->setFixedHeight(80); | 92 | if ( QApplication::desktop()->height() <= 240 ) |
93 | hei = 60; | ||
94 | mListView->setFixedHeight(hei); | ||
93 | } | 95 | } |
94 | mListView->setAllColumnsShowFocus (true ); | 96 | mListView->setAllColumnsShowFocus (true ); |
95 | //mListView->setSingleClick( true ); | 97 | //mListView->setSingleClick( true ); |
96 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 98 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
97 | SLOT(updateAttendeeInput())); | 99 | SLOT(updateAttendeeInput())); |
98 | 100 | ||
99 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 101 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), |
100 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 102 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); |
101 | 103 | ||
102 | mRsvpButton = new QCheckBox(this); | 104 | mRsvpButton = new QCheckBox(this); |
103 | mRsvpButton->setText(i18n("Request response")); | 105 | mRsvpButton->setText(i18n("Request response")); |
104 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 106 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
105 | QLabel *attendeeLabel = new QLabel(this); | 107 | QLabel *attendeeLabel = new QLabel(this); |
106 | attendeeLabel->setText(i18n("Name:")); | 108 | attendeeLabel->setText(i18n("Name:")); |
107 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 109 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
108 | mNameEdit = new QLineEdit(this); | 110 | mNameEdit = new QLineEdit(this); |
109 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 111 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
110 | SLOT(updateAttendeeItem())); | 112 | SLOT(updateAttendeeItem())); |
111 | 113 | ||
112 | mUidEdit = new QLineEdit(0); | 114 | mUidEdit = new QLineEdit(0); |
113 | mUidEdit->setText(""); | 115 | mUidEdit->setText(""); |
114 | 116 | ||
115 | QLabel *emailLabel = new QLabel(this); | 117 | QLabel *emailLabel = new QLabel(this); |
116 | emailLabel->setText(i18n("Email:")); | 118 | emailLabel->setText(i18n("Email:")); |
117 | mEmailEdit = new QLineEdit(this); | 119 | mEmailEdit = new QLineEdit(this); |
118 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 120 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
119 | SLOT(updateAttendeeItem())); | 121 | SLOT(updateAttendeeItem())); |
120 | 122 | ||
121 | QLabel *attendeeRoleLabel = new QLabel(this); | 123 | QLabel *attendeeRoleLabel = new QLabel(this); |
122 | attendeeRoleLabel->setText(i18n("Role:")); | 124 | attendeeRoleLabel->setText(i18n("Role:")); |
123 | mRoleCombo = new QComboBox(false,this); | 125 | mRoleCombo = new QComboBox(false,this); |
124 | mRoleCombo->insertStringList(Attendee::roleList()); | 126 | mRoleCombo->insertStringList(Attendee::roleList()); |
125 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 127 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
126 | 128 | ||
127 | QLabel *statusLabel = new QLabel(this); | 129 | QLabel *statusLabel = new QLabel(this); |
128 | statusLabel->setText( i18n("Status:") ); | 130 | statusLabel->setText( i18n("Status:") ); |
129 | 131 | ||
130 | mStatusCombo = new QComboBox(false,this); | 132 | mStatusCombo = new QComboBox(false,this); |
131 | mStatusCombo->insertStringList(Attendee::statusList()); | 133 | mStatusCombo->insertStringList(Attendee::statusList()); |
132 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 134 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
133 | 135 | ||
134 | 136 | ||
135 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 137 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
136 | QWidget *buttonBox = new QWidget(this); | 138 | QWidget *buttonBox = new QWidget(this); |
137 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 139 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); |
138 | 140 | ||
139 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 141 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
140 | buttonLayout->addWidget(newButton); | 142 | buttonLayout->addWidget(newButton); |
141 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 143 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
142 | 144 | ||
143 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 145 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
144 | buttonLayout->addWidget(mRemoveButton); | 146 | buttonLayout->addWidget(mRemoveButton); |
145 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 147 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
146 | 148 | ||
147 | // buttonLayout->addWidget(mAddressBookButton); | 149 | // buttonLayout->addWidget(mAddressBookButton); |
148 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 150 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
149 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 151 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
150 | 152 | if ( QApplication::desktop()->height() <= 240 ) { | |
151 | if (qApp->desktop()->width() < 640 ) { | 153 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
152 | if ( qApp->desktop()->width() < 300 ) | 154 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
153 | topLayout->setSpacing(1); | ||
154 | ;//mListView->setFixedHeight(80); | ||
155 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | ||
156 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | ||
157 | topLayout->addWidget(attendeeLabel,3,0); | ||
158 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | ||
159 | topLayout->addWidget(emailLabel,4,0); | ||
160 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | ||
161 | topLayout->addWidget(attendeeRoleLabel,5,0); | ||
162 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | ||
163 | topLayout->addWidget(statusLabel,6,0); | ||
164 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | ||
165 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | ||
166 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | ||
167 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | ||
168 | topLayout->setRowStretch(1,2); | ||
169 | topLayout->setColStretch(0,0); | ||
170 | topLayout->setColStretch(1,2); | ||
171 | topLayout->setColStretch(2,1); | ||
172 | topLayout->setColStretch(3,1); | ||
173 | |||
174 | } else { | ||
175 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 155 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
176 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 156 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
177 | topLayout->addWidget(attendeeLabel,3,0); | 157 | topLayout->addWidget(attendeeLabel,3,0); |
178 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 158 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
179 | topLayout->addWidget(emailLabel,4,0); | 159 | topLayout->addWidget(emailLabel,4,0); |
180 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 160 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
181 | topLayout->addWidget(attendeeRoleLabel,5,0); | 161 | topLayout->addWidget(attendeeRoleLabel,5,0); |
182 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 162 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
183 | topLayout->addWidget(statusLabel,5,3); | 163 | topLayout->addWidget(statusLabel,5,3); |
184 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 164 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
185 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | 165 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); |
186 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 166 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
187 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 167 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
188 | topLayout->setRowStretch(1,5); | 168 | topLayout->setRowStretch(1,5); |
189 | topLayout->setColStretch(0,0); | 169 | topLayout->setColStretch(0,0); |
170 | } else { | ||
171 | if (qApp->desktop()->width() < 640 ) { | ||
172 | if ( qApp->desktop()->width() < 300 ) | ||
173 | topLayout->setSpacing(1); | ||
174 | ;//mListView->setFixedHeight(80); | ||
175 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | ||
176 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | ||
177 | topLayout->addWidget(attendeeLabel,3,0); | ||
178 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | ||
179 | topLayout->addWidget(emailLabel,4,0); | ||
180 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | ||
181 | topLayout->addWidget(attendeeRoleLabel,5,0); | ||
182 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | ||
183 | topLayout->addWidget(statusLabel,6,0); | ||
184 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | ||
185 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | ||
186 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | ||
187 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | ||
188 | topLayout->setRowStretch(1,2); | ||
189 | topLayout->setColStretch(0,0); | ||
190 | topLayout->setColStretch(1,2); | ||
191 | topLayout->setColStretch(2,1); | ||
192 | topLayout->setColStretch(3,1); | ||
193 | } else { | ||
194 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | ||
195 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | ||
196 | topLayout->addWidget(attendeeLabel,3,0); | ||
197 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | ||
198 | topLayout->addWidget(emailLabel,4,0); | ||
199 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | ||
200 | topLayout->addWidget(attendeeRoleLabel,5,0); | ||
201 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | ||
202 | topLayout->addWidget(statusLabel,5,3); | ||
203 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | ||
204 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | ||
205 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | ||
206 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | ||
207 | topLayout->setRowStretch(1,5); | ||
208 | topLayout->setColStretch(0,0); | ||
209 | } | ||
190 | } | 210 | } |
191 | // #if 0 | 211 | // #if 0 |
192 | // topLayout->setColStretch(2,1); | 212 | // topLayout->setColStretch(2,1); |
193 | // topLayout->addWidget(statusLabel,3,3); | 213 | // topLayout->addWidget(statusLabel,3,3); |
194 | // topLayout->addWidget(mStatusCombo,3,4); | 214 | // topLayout->addWidget(mStatusCombo,3,4); |
195 | // #else | 215 | // #else |
196 | // topLayout->addWidget(statusLabel,4,3); | 216 | // topLayout->addWidget(statusLabel,4,3); |
197 | // // topLayout->addWidget(mStatusCombo,4,3); | 217 | // // topLayout->addWidget(mStatusCombo,4,3); |
198 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 218 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
199 | 219 | ||
200 | // #endif | 220 | // #endif |
201 | // // topLayout->setRowStretch(5,1); | 221 | // // topLayout->setRowStretch(5,1); |
202 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 222 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
203 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 223 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
204 | // topLayout->setRowStretch(1,5); | 224 | // topLayout->setRowStretch(1,5); |
205 | // topLayout->setColStretch(0,0); | 225 | // topLayout->setColStretch(0,0); |
206 | 226 | ||
207 | #ifdef KORG_NOKABC | 227 | #ifdef KORG_NOKABC |
208 | mAddressBookButton->hide(); | 228 | mAddressBookButton->hide(); |
209 | #endif | 229 | #endif |
210 | 230 | ||
211 | updateAttendeeInput(); | 231 | updateAttendeeInput(); |
212 | #ifndef DESKTOP_VERSION | 232 | #ifndef DESKTOP_VERSION |
213 | //US listen for arriving address resultsets | 233 | //US listen for arriving address resultsets |
214 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 234 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
215 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 235 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
216 | #endif | 236 | #endif |
217 | 237 | ||
218 | } | 238 | } |
219 | 239 | ||
220 | KOEditorDetails::~KOEditorDetails() | 240 | KOEditorDetails::~KOEditorDetails() |
221 | { | 241 | { |
222 | } | 242 | } |
223 | 243 | ||
224 | void KOEditorDetails::removeAttendee() | 244 | void KOEditorDetails::removeAttendee() |
225 | { | 245 | { |
226 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); | 246 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); |
227 | if (!aItem) return; | 247 | if (!aItem) return; |
228 | 248 | ||
229 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), | 249 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), |
230 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), | 250 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), |
231 | aItem->data()->uid()); | 251 | aItem->data()->uid()); |
232 | mdelAttendees.append(delA); | 252 | mdelAttendees.append(delA); |
233 | 253 | ||
234 | delete aItem; | 254 | delete aItem; |
235 | 255 | ||
236 | updateAttendeeInput(); | 256 | updateAttendeeInput(); |
237 | } | 257 | } |