Diffstat (limited to 'korganizer/koeditordetails.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditordetails.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 9a4b4ec..a01c838 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -1,239 +1,245 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in thse hope that it will be useful, | 10 | This program is distributed in thse hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <q3filedialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <q3vbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <q3buttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <q3vgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <q3widgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapp.h> | 32 | #include <qapplication.h> |
33 | #include <QDesktopWidget> | ||
34 | //Added by qt3to4: | ||
35 | #include <Q3GridLayout> | ||
36 | #include <QLabel> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3VBoxLayout> | ||
33 | 39 | ||
34 | #include <klocale.h> | 40 | #include <klocale.h> |
35 | #include <kglobal.h> | 41 | #include <kglobal.h> |
36 | #include <kdialog.h> | 42 | #include <kdialog.h> |
37 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
38 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
39 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
40 | #ifndef KORG_NOKABC | 46 | #ifndef KORG_NOKABC |
41 | 47 | ||
42 | #ifdef DESKTOP_VERSION | 48 | #ifdef DESKTOP_VERSION |
43 | #include <kabc/addresseedialog.h> | 49 | #include <kabc/addresseedialog.h> |
44 | #else //DESKTOP_VERSION | 50 | #else //DESKTOP_VERSION |
45 | #include <externalapphandler.h> | 51 | #include <externalapphandler.h> |
46 | #endif //DESKTOP_VERSION | 52 | #endif //DESKTOP_VERSION |
47 | 53 | ||
48 | #endif | 54 | #endif |
49 | 55 | ||
50 | #include <libkcal/incidence.h> | 56 | #include <libkcal/incidence.h> |
51 | 57 | ||
52 | #include "koprefs.h" | 58 | #include "koprefs.h" |
53 | 59 | ||
54 | #include "koeditordetails.h" | 60 | #include "koeditordetails.h" |
55 | 61 | ||
56 | template <> | 62 | template <> |
57 | CustomListViewItem<Attendee *>::~CustomListViewItem() | 63 | CustomListViewItem<Attendee *>::~CustomListViewItem() |
58 | { | 64 | { |
59 | delete mData; | 65 | delete mData; |
60 | } | 66 | } |
61 | 67 | ||
62 | template <> | 68 | template <> |
63 | void CustomListViewItem<Attendee *>::updateItem() | 69 | void CustomListViewItem<Attendee *>::updateItem() |
64 | { | 70 | { |
65 | setText(0,mData->name()); | 71 | setText(0,mData->name()); |
66 | setText(1,mData->email()); | 72 | setText(1,mData->email()); |
67 | setText(2,mData->roleStr()); | 73 | setText(2,mData->roleStr()); |
68 | setText(3,mData->statusStr()); | 74 | setText(3,mData->statusStr()); |
69 | if (mData->RSVP() && !mData->email().isEmpty()) { | 75 | if (mData->RSVP() && !mData->email().isEmpty()) { |
70 | setPixmap(4,SmallIcon("mailappt")); | 76 | setPixmap(4,SmallIcon("mailappt")); |
71 | setSortKey(4,"j"); | 77 | setSortKey(4,"j"); |
72 | } | 78 | } |
73 | else { | 79 | else { |
74 | setPixmap(4,SmallIcon("nomailappt")); | 80 | setPixmap(4,SmallIcon("nomailappt")); |
75 | setSortKey(4,"n"); | 81 | setSortKey(4,"n"); |
76 | } | 82 | } |
77 | } | 83 | } |
78 | 84 | ||
79 | 85 | ||
80 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 86 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
81 | : QWidget( parent, name), mDisableItemUpdate( false ) | 87 | : QWidget( parent, name), mDisableItemUpdate( false ) |
82 | { | 88 | { |
83 | QGridLayout *topLayout = new QGridLayout(this); | 89 | Q3GridLayout *topLayout = new Q3GridLayout(this); |
84 | topLayout->setSpacing(spacing); | 90 | topLayout->setSpacing(spacing); |
85 | topLayout->setMargin(KDialog::marginHint()-2); | 91 | topLayout->setMargin(KDialog::marginHint()-2); |
86 | 92 | ||
87 | QString organizer = KOPrefs::instance()->email(); | 93 | QString organizer = KOPrefs::instance()->email(); |
88 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 94 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
89 | 95 | ||
90 | mListView = new KListView(this,"mListView"); | 96 | mListView = new KListView(this,"mListView"); |
91 | mListView->addColumn(i18n("Name"),180); | 97 | mListView->addColumn(i18n("Name"),180); |
92 | mListView->addColumn(i18n("Email"),180); | 98 | mListView->addColumn(i18n("Email"),180); |
93 | mListView->addColumn(i18n("Role"),60); | 99 | mListView->addColumn(i18n("Role"),60); |
94 | mListView->addColumn(i18n("Status"),100); | 100 | mListView->addColumn(i18n("Status"),100); |
95 | mListView->addColumn(i18n("RSVP"),35); | 101 | mListView->addColumn(i18n("RSVP"),35); |
96 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { | 102 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { |
97 | int hei = 80; | 103 | int hei = 80; |
98 | if ( QApplication::desktop()->height() <= 240 ) | 104 | if ( QApplication::desktop()->height() <= 240 ) |
99 | hei = 60; | 105 | hei = 60; |
100 | mListView->setFixedHeight(hei); | 106 | mListView->setFixedHeight(hei); |
101 | } | 107 | } |
102 | mListView->setAllColumnsShowFocus (true ); | 108 | mListView->setAllColumnsShowFocus (true ); |
103 | //mListView->setSingleClick( true ); | 109 | //mListView->setSingleClick( true ); |
104 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 110 | connect(mListView,SIGNAL(selectionChanged(Q3ListViewItem *)), |
105 | SLOT(updateAttendeeInput())); | 111 | SLOT(updateAttendeeInput())); |
106 | 112 | ||
107 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 113 | connect(mListView,SIGNAL(executed(Q3ListViewItem * ,const QPoint&, int )), |
108 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 114 | SLOT(itemClicked(Q3ListViewItem * ,const QPoint& , int ))); |
109 | 115 | ||
110 | mRsvpButton = new QCheckBox(this); | 116 | mRsvpButton = new QCheckBox(this); |
111 | mRsvpButton->setText(i18n("Request response")); | 117 | mRsvpButton->setText(i18n("Request response")); |
112 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 118 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
113 | QLabel *attendeeLabel = new QLabel(this); | 119 | QLabel *attendeeLabel = new QLabel(this); |
114 | attendeeLabel->setText(i18n("Name:")); | 120 | attendeeLabel->setText(i18n("Name:")); |
115 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 121 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
116 | mNameEdit = new QLineEdit(this); | 122 | mNameEdit = new QLineEdit(this); |
117 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 123 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
118 | SLOT(updateAttendeeItem())); | 124 | SLOT(updateAttendeeItem())); |
119 | 125 | ||
120 | 126 | ||
121 | QLabel *emailLabel = new QLabel(this); | 127 | QLabel *emailLabel = new QLabel(this); |
122 | emailLabel->setText(i18n("Email:")); | 128 | emailLabel->setText(i18n("Email:")); |
123 | mEmailEdit = new QLineEdit(this); | 129 | mEmailEdit = new QLineEdit(this); |
124 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 130 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
125 | SLOT(updateAttendeeItem())); | 131 | SLOT(updateAttendeeItem())); |
126 | 132 | ||
127 | QLabel *attendeeRoleLabel = new QLabel(this); | 133 | QLabel *attendeeRoleLabel = new QLabel(this); |
128 | attendeeRoleLabel->setText(i18n("Role:")); | 134 | attendeeRoleLabel->setText(i18n("Role:")); |
129 | mRoleCombo = new QComboBox(false,this); | 135 | mRoleCombo = new QComboBox(false,this); |
130 | mRoleCombo->insertStringList(Attendee::roleList()); | 136 | mRoleCombo->insertStringList(Attendee::roleList()); |
131 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 137 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
132 | 138 | ||
133 | QLabel *statusLabel = new QLabel(this); | 139 | QLabel *statusLabel = new QLabel(this); |
134 | statusLabel->setText( i18n("Status:") ); | 140 | statusLabel->setText( i18n("Status:") ); |
135 | 141 | ||
136 | mStatusCombo = new QComboBox(false,this); | 142 | mStatusCombo = new QComboBox(false,this); |
137 | mStatusCombo->insertStringList(Attendee::statusList()); | 143 | mStatusCombo->insertStringList(Attendee::statusList()); |
138 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 144 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
139 | 145 | ||
140 | 146 | ||
141 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 147 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
142 | QWidget *buttonBox = new QWidget(this); | 148 | QWidget *buttonBox = new QWidget(this); |
143 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 149 | Q3VBoxLayout *buttonLayout = new Q3VBoxLayout(buttonBox); |
144 | 150 | ||
145 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 151 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
146 | buttonLayout->addWidget(newButton); | 152 | buttonLayout->addWidget(newButton); |
147 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 153 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
148 | 154 | ||
149 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 155 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
150 | buttonLayout->addWidget(mRemoveButton); | 156 | buttonLayout->addWidget(mRemoveButton); |
151 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 157 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
152 | 158 | ||
153 | // buttonLayout->addWidget(mAddressBookButton); | 159 | // buttonLayout->addWidget(mAddressBookButton); |
154 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 160 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
155 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 161 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
156 | if ( QApplication::desktop()->height() <= 240 ) { | 162 | if ( QApplication::desktop()->height() <= 240 ) { |
157 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 163 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
158 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 164 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
159 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 165 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
160 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 166 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
161 | topLayout->addWidget(attendeeLabel,3,0); | 167 | topLayout->addWidget(attendeeLabel,3,0); |
162 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 168 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
163 | topLayout->addWidget(emailLabel,4,0); | 169 | topLayout->addWidget(emailLabel,4,0); |
164 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 170 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
165 | topLayout->addWidget(attendeeRoleLabel,5,0); | 171 | topLayout->addWidget(attendeeRoleLabel,5,0); |
166 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 172 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
167 | topLayout->addWidget(statusLabel,5,3); | 173 | topLayout->addWidget(statusLabel,5,3); |
168 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 174 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
169 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); | 175 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); |
170 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 176 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
171 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 177 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
172 | topLayout->setRowStretch(1,5); | 178 | topLayout->setRowStretch(1,5); |
173 | topLayout->setColStretch(0,0); | 179 | topLayout->setColStretch(0,0); |
174 | } else { | 180 | } else { |
175 | if (qApp->desktop()->width() < 640 ) { | 181 | if (qApp->desktop()->width() < 640 ) { |
176 | if ( qApp->desktop()->width() < 300 ) | 182 | if ( qApp->desktop()->width() < 300 ) |
177 | topLayout->setSpacing(1); | 183 | topLayout->setSpacing(1); |
178 | ;//mListView->setFixedHeight(80); | 184 | ;//mListView->setFixedHeight(80); |
179 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | 185 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); |
180 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | 186 | topLayout->addMultiCellWidget(mListView,1,1,0,3); |
181 | topLayout->addWidget(attendeeLabel,3,0); | 187 | topLayout->addWidget(attendeeLabel,3,0); |
182 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | 188 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); |
183 | topLayout->addWidget(emailLabel,4,0); | 189 | topLayout->addWidget(emailLabel,4,0); |
184 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | 190 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); |
185 | topLayout->addWidget(attendeeRoleLabel,5,0); | 191 | topLayout->addWidget(attendeeRoleLabel,5,0); |
186 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | 192 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); |
187 | topLayout->addWidget(statusLabel,6,0); | 193 | topLayout->addWidget(statusLabel,6,0); |
188 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | 194 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); |
189 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | 195 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); |
190 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 196 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
191 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | 197 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); |
192 | topLayout->setRowStretch(1,2); | 198 | topLayout->setRowStretch(1,2); |
193 | topLayout->setColStretch(0,0); | 199 | topLayout->setColStretch(0,0); |
194 | topLayout->setColStretch(1,2); | 200 | topLayout->setColStretch(1,2); |
195 | topLayout->setColStretch(2,1); | 201 | topLayout->setColStretch(2,1); |
196 | topLayout->setColStretch(3,1); | 202 | topLayout->setColStretch(3,1); |
197 | } else { | 203 | } else { |
198 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 204 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
199 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 205 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
200 | topLayout->addWidget(attendeeLabel,3,0); | 206 | topLayout->addWidget(attendeeLabel,3,0); |
201 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 207 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
202 | topLayout->addWidget(emailLabel,4,0); | 208 | topLayout->addWidget(emailLabel,4,0); |
203 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 209 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
204 | topLayout->addWidget(attendeeRoleLabel,5,0); | 210 | topLayout->addWidget(attendeeRoleLabel,5,0); |
205 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 211 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
206 | topLayout->addWidget(statusLabel,5,3); | 212 | topLayout->addWidget(statusLabel,5,3); |
207 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 213 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
208 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | 214 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); |
209 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 215 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
210 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 216 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
211 | topLayout->setRowStretch(1,5); | 217 | topLayout->setRowStretch(1,5); |
212 | topLayout->setColStretch(0,0); | 218 | topLayout->setColStretch(0,0); |
213 | } | 219 | } |
214 | } | 220 | } |
215 | // #if 0 | 221 | // #if 0 |
216 | // topLayout->setColStretch(2,1); | 222 | // topLayout->setColStretch(2,1); |
217 | // topLayout->addWidget(statusLabel,3,3); | 223 | // topLayout->addWidget(statusLabel,3,3); |
218 | // topLayout->addWidget(mStatusCombo,3,4); | 224 | // topLayout->addWidget(mStatusCombo,3,4); |
219 | // #else | 225 | // #else |
220 | // topLayout->addWidget(statusLabel,4,3); | 226 | // topLayout->addWidget(statusLabel,4,3); |
221 | // // topLayout->addWidget(mStatusCombo,4,3); | 227 | // // topLayout->addWidget(mStatusCombo,4,3); |
222 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 228 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
223 | 229 | ||
224 | // #endif | 230 | // #endif |
225 | // // topLayout->setRowStretch(5,1); | 231 | // // topLayout->setRowStretch(5,1); |
226 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 232 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
227 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 233 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
228 | // topLayout->setRowStretch(1,5); | 234 | // topLayout->setRowStretch(1,5); |
229 | // topLayout->setColStretch(0,0); | 235 | // topLayout->setColStretch(0,0); |
230 | 236 | ||
231 | #ifdef KORG_NOKABC | 237 | #ifdef KORG_NOKABC |
232 | mAddressBookButton->hide(); | 238 | mAddressBookButton->hide(); |
233 | #endif | 239 | #endif |
234 | 240 | ||
235 | updateAttendeeInput(); | 241 | updateAttendeeInput(); |
236 | #ifndef DESKTOP_VERSION | 242 | #ifndef DESKTOP_VERSION |
237 | //US listen for arriving address resultsets | 243 | //US listen for arriving address resultsets |
238 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 244 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
239 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 245 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
@@ -272,209 +278,209 @@ void KOEditorDetails::openAddressBook() | |||
272 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); | 278 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); |
273 | } | 279 | } |
274 | #else | 280 | #else |
275 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 281 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
276 | // the result should now arrive through method insertAttendees | 282 | // the result should now arrive through method insertAttendees |
277 | #endif | 283 | #endif |
278 | 284 | ||
279 | 285 | ||
280 | #if 0 | 286 | #if 0 |
281 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 287 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
282 | if (!a.isEmpty()) { | 288 | if (!a.isEmpty()) { |
283 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); | 289 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); |
284 | } | 290 | } |
285 | #endif | 291 | #endif |
286 | #endif | 292 | #endif |
287 | } | 293 | } |
288 | 294 | ||
289 | 295 | ||
290 | void KOEditorDetails::addNewAttendee() | 296 | void KOEditorDetails::addNewAttendee() |
291 | { | 297 | { |
292 | #if 0 | 298 | #if 0 |
293 | // this is cool. If they didn't enter an email address, | 299 | // this is cool. If they didn't enter an email address, |
294 | // try to look it up in the address book and fill it in for them. | 300 | // try to look it up in the address book and fill it in for them. |
295 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { | 301 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { |
296 | KabAPI addrBook; | 302 | KabAPI addrBook; |
297 | QString name; | 303 | QString name; |
298 | std::list<AddressBook::Entry> entries; | 304 | std::list<AddressBook::Entry> entries; |
299 | name = mNameEdit->text(); | 305 | name = mNameEdit->text(); |
300 | if (addrBook.init() == AddressBook::NoError) { | 306 | if (addrBook.init() == AddressBook::NoError) { |
301 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { | 307 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { |
302 | kdDebug() << "positive match" << endl; | 308 | kdDebug() << "positive match" << endl; |
303 | // take first email address | 309 | // take first email address |
304 | if (!entries.front().emails.isEmpty() && | 310 | if (!entries.front().emails.isEmpty() && |
305 | entries.front().emails.first().length()>0) | 311 | entries.front().emails.first().length()>0) |
306 | mEmailEdit->setText(entries.front().emails.first()); | 312 | mEmailEdit->setText(entries.front().emails.first()); |
307 | } | 313 | } |
308 | } | 314 | } |
309 | } | 315 | } |
310 | #endif | 316 | #endif |
311 | 317 | ||
312 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); | 318 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); |
313 | insertAttendee(a); | 319 | insertAttendee(a); |
314 | } | 320 | } |
315 | 321 | ||
316 | //the map includes name/email pairs, that comes from Ka/Pi | 322 | //the map includes name/email pairs, that comes from Ka/Pi |
317 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 323 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
318 | { | 324 | { |
319 | if (uid == this->name()) | 325 | if (uid == this->name()) |
320 | { | 326 | { |
321 | for ( int i = 0; i < nameList.count(); i++) | 327 | for ( int i = 0; i < nameList.count(); i++) |
322 | { | 328 | { |
323 | QString _name = nameList[i]; | 329 | QString _name = nameList[i]; |
324 | QString _email = emailList[i]; | 330 | QString _email = emailList[i]; |
325 | QString _uid = uidList[i]; | 331 | QString _uid = uidList[i]; |
326 | 332 | ||
327 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); | 333 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); |
328 | insertAttendee(a); | 334 | insertAttendee(a); |
329 | } | 335 | } |
330 | } | 336 | } |
331 | 337 | ||
332 | } | 338 | } |
333 | 339 | ||
334 | void KOEditorDetails::insertAttendee(Attendee *a) | 340 | void KOEditorDetails::insertAttendee(Attendee *a) |
335 | { | 341 | { |
336 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); | 342 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); |
337 | while (first) { | 343 | while (first) { |
338 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) | 344 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) |
339 | return; | 345 | return; |
340 | first = (AttendeeListItem*) first->nextSibling(); | 346 | first = (AttendeeListItem*) first->nextSibling(); |
341 | } | 347 | } |
342 | 348 | ||
343 | AttendeeListItem *item = new AttendeeListItem(a,mListView); | 349 | AttendeeListItem *item = new AttendeeListItem(a,mListView); |
344 | mListView->setSelected( item, true ); | 350 | mListView->setSelected( item, true ); |
345 | } | 351 | } |
346 | 352 | ||
347 | void KOEditorDetails::setDefaults() | 353 | void KOEditorDetails::setDefaults() |
348 | { | 354 | { |
349 | mRsvpButton->setChecked(true); | 355 | mRsvpButton->setChecked(true); |
350 | mListView->clear(); | 356 | mListView->clear(); |
351 | mdelAttendees.clear(); | 357 | mdelAttendees.clear(); |
352 | clearAttendeeInput(); | 358 | clearAttendeeInput(); |
353 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); | 359 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); |
354 | 360 | ||
355 | mNameEdit->setText(""); | 361 | mNameEdit->setText(""); |
356 | mUidEdit = ""; | 362 | mUidEdit = ""; |
357 | mEmailEdit->setText(""); | 363 | mEmailEdit->setText(""); |
358 | mRoleCombo->setCurrentItem( 0 ); | 364 | mRoleCombo->setCurrentItem( 0 ); |
359 | mStatusCombo->setCurrentItem( 0 ); | 365 | mStatusCombo->setCurrentItem( 0 ); |
360 | 366 | ||
361 | } | 367 | } |
362 | 368 | ||
363 | void KOEditorDetails::readEvent(Incidence *event) | 369 | void KOEditorDetails::readEvent(Incidence *event) |
364 | { | 370 | { |
365 | setDefaults(); | 371 | setDefaults(); |
366 | //mListView->clear(); | 372 | //mListView->clear(); |
367 | //mdelAttendees.clear(); | 373 | //mdelAttendees.clear(); |
368 | QPtrList<Attendee> tmpAList = event->attendees(); | 374 | Q3PtrList<Attendee> tmpAList = event->attendees(); |
369 | Attendee *a; | 375 | Attendee *a; |
370 | for (a = tmpAList.first(); a; a = tmpAList.next()) | 376 | for (a = tmpAList.first(); a; a = tmpAList.next()) |
371 | insertAttendee(new Attendee(*a)); | 377 | insertAttendee(new Attendee(*a)); |
372 | 378 | ||
373 | mListView->setSelected( mListView->firstChild(), true ); | 379 | mListView->setSelected( mListView->firstChild(), true ); |
374 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); | 380 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); |
375 | } | 381 | } |
376 | 382 | ||
377 | void KOEditorDetails::writeEvent(Incidence *event) | 383 | void KOEditorDetails::writeEvent(Incidence *event) |
378 | { | 384 | { |
379 | event->clearAttendees(); | 385 | event->clearAttendees(); |
380 | QListViewItem *item; | 386 | Q3ListViewItem *item; |
381 | AttendeeListItem *a; | 387 | AttendeeListItem *a; |
382 | for (item = mListView->firstChild(); item; | 388 | for (item = mListView->firstChild(); item; |
383 | item = item->nextSibling()) { | 389 | item = item->nextSibling()) { |
384 | a = (AttendeeListItem *)item; | 390 | a = (AttendeeListItem *)item; |
385 | event->addAttendee(new Attendee(*(a->data()))); | 391 | event->addAttendee(new Attendee(*(a->data()))); |
386 | } | 392 | } |
387 | event->setOrganizer(KOPrefs::instance()->email()); | 393 | event->setOrganizer(KOPrefs::instance()->email()); |
388 | } | 394 | } |
389 | 395 | ||
390 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | 396 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) |
391 | { | 397 | { |
392 | event->clearAttendees(); | 398 | event->clearAttendees(); |
393 | Attendee * att; | 399 | Attendee * att; |
394 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { | 400 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { |
395 | event->addAttendee(new Attendee(*att)); | 401 | event->addAttendee(new Attendee(*att)); |
396 | } | 402 | } |
397 | mdelAttendees.clear(); | 403 | mdelAttendees.clear(); |
398 | } | 404 | } |
399 | 405 | ||
400 | bool KOEditorDetails::validateInput() | 406 | bool KOEditorDetails::validateInput() |
401 | { | 407 | { |
402 | return true; | 408 | return true; |
403 | } | 409 | } |
404 | 410 | ||
405 | void KOEditorDetails::updateAttendeeInput() | 411 | void KOEditorDetails::updateAttendeeInput() |
406 | { | 412 | { |
407 | QListViewItem *item = mListView->selectedItem(); | 413 | Q3ListViewItem *item = mListView->selectedItem(); |
408 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 414 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
409 | if (aItem) { | 415 | if (aItem) { |
410 | fillAttendeeInput( aItem ); | 416 | fillAttendeeInput( aItem ); |
411 | } else { | 417 | } else { |
412 | clearAttendeeInput(); | 418 | clearAttendeeInput(); |
413 | } | 419 | } |
414 | } | 420 | } |
415 | 421 | ||
416 | void KOEditorDetails::clearAttendeeInput() | 422 | void KOEditorDetails::clearAttendeeInput() |
417 | { | 423 | { |
418 | mNameEdit->setText(""); | 424 | mNameEdit->setText(""); |
419 | mUidEdit = ""; | 425 | mUidEdit = ""; |
420 | mEmailEdit->setText(""); | 426 | mEmailEdit->setText(""); |
421 | mRoleCombo->setCurrentItem(0); | 427 | mRoleCombo->setCurrentItem(0); |
422 | mStatusCombo->setCurrentItem(0); | 428 | mStatusCombo->setCurrentItem(0); |
423 | mRsvpButton->setChecked(true); | 429 | mRsvpButton->setChecked(true); |
424 | setEnabledAttendeeInput( false ); | 430 | setEnabledAttendeeInput( false ); |
425 | } | 431 | } |
426 | 432 | ||
427 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | 433 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) |
428 | { | 434 | { |
429 | Attendee *a = aItem->data(); | 435 | Attendee *a = aItem->data(); |
430 | mDisableItemUpdate = true; | 436 | mDisableItemUpdate = true; |
431 | mNameEdit->setText(a->name()); | 437 | mNameEdit->setText(a->name()); |
432 | mUidEdit = a->uid(); | 438 | mUidEdit = a->uid(); |
433 | mEmailEdit->setText(a->email()); | 439 | mEmailEdit->setText(a->email()); |
434 | mRoleCombo->setCurrentItem(a->role()); | 440 | mRoleCombo->setCurrentItem(a->role()); |
435 | mStatusCombo->setCurrentItem(a->status()); | 441 | mStatusCombo->setCurrentItem(a->status()); |
436 | mRsvpButton->setChecked(a->RSVP()); | 442 | mRsvpButton->setChecked(a->RSVP()); |
437 | 443 | ||
438 | mDisableItemUpdate = false; | 444 | mDisableItemUpdate = false; |
439 | 445 | ||
440 | setEnabledAttendeeInput( true ); | 446 | setEnabledAttendeeInput( true ); |
441 | } | 447 | } |
442 | 448 | ||
443 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 449 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
444 | { | 450 | { |
445 | mNameEdit->setEnabled( enabled ); | 451 | mNameEdit->setEnabled( enabled ); |
446 | mEmailEdit->setEnabled( enabled ); | 452 | mEmailEdit->setEnabled( enabled ); |
447 | mRoleCombo->setEnabled( enabled ); | 453 | mRoleCombo->setEnabled( enabled ); |
448 | mStatusCombo->setEnabled( enabled ); | 454 | mStatusCombo->setEnabled( enabled ); |
449 | mRsvpButton->setEnabled( enabled ); | 455 | mRsvpButton->setEnabled( enabled ); |
450 | 456 | ||
451 | mRemoveButton->setEnabled( enabled ); | 457 | mRemoveButton->setEnabled( enabled ); |
452 | } | 458 | } |
453 | 459 | ||
454 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 460 | void KOEditorDetails::itemClicked(Q3ListViewItem * item ,const QPoint & pnt, int c ) |
455 | { | 461 | { |
456 | if ( item && c == 4 ) { | 462 | if ( item && c == 4 ) { |
457 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 463 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
458 | updateAttendeeItem(); | 464 | updateAttendeeItem(); |
459 | } | 465 | } |
460 | } | 466 | } |
461 | void KOEditorDetails::updateAttendeeItem() | 467 | void KOEditorDetails::updateAttendeeItem() |
462 | { | 468 | { |
463 | if (mDisableItemUpdate) return; | 469 | if (mDisableItemUpdate) return; |
464 | 470 | ||
465 | QListViewItem *item = mListView->selectedItem(); | 471 | Q3ListViewItem *item = mListView->selectedItem(); |
466 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 472 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
467 | if ( !aItem ) return; | 473 | if ( !aItem ) return; |
468 | 474 | ||
469 | Attendee *a = aItem->data(); | 475 | Attendee *a = aItem->data(); |
470 | 476 | ||
471 | a->setName( mNameEdit->text() ); | 477 | a->setName( mNameEdit->text() ); |
472 | a->setUid( mUidEdit ); | 478 | a->setUid( mUidEdit ); |
473 | a->setEmail( mEmailEdit->text() ); | 479 | a->setEmail( mEmailEdit->text() ); |
474 | if ( mEmailEdit->text().isEmpty() ) | 480 | if ( mEmailEdit->text().isEmpty() ) |
475 | mRsvpButton->setChecked( false ); | 481 | mRsvpButton->setChecked( false ); |
476 | a->setRSVP( mRsvpButton->isChecked() ); | 482 | a->setRSVP( mRsvpButton->isChecked() ); |
477 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); | 483 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); |
478 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); | 484 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); |
479 | aItem->updateItem(); | 485 | aItem->updateItem(); |
480 | } | 486 | } |