summaryrefslogtreecommitdiffabout
path: root/korganizer/incomingdialog.cpp
Unidiff
Diffstat (limited to 'korganizer/incomingdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/incomingdialog.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index fe78356..c2402d4 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -12,20 +12,22 @@
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 19
20#include <qlistview.h> 20#include <q3listview.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qdir.h> 22#include <qdir.h>
23#include <qmap.h> 23#include <qmap.h>
24//Added by qt3to4:
25#include <Q3PtrList>
24 26
25#include <kglobal.h> 27#include <kglobal.h>
26#include <klocale.h> 28#include <klocale.h>
27#include <kdebug.h> 29#include <kdebug.h>
28#include <kstandarddirs.h> 30#include <kstandarddirs.h>
29#include <kmessagebox.h> 31#include <kmessagebox.h>
30 32
31#include <libkcal/incidence.h> 33#include <libkcal/incidence.h>
@@ -51,19 +53,19 @@
51 53
52#ifndef KORG_NOKABC 54#ifndef KORG_NOKABC
53#define KORG_NOKABC 55#define KORG_NOKABC
54//#include <kabc/stdaddressbook.h> 56//#include <kabc/stdaddressbook.h>
55#define size count 57#define size count
56#endif 58#endif
57 59
58 60
59ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, 61ScheduleItemIn::ScheduleItemIn(Q3ListView *parent,IncidenceBase *ev,
60 Scheduler::Method method,ScheduleMessage::Status status) 62 Scheduler::Method method,ScheduleMessage::Status status)
61 : QListViewItem(parent) 63 : Q3ListViewItem(parent)
62{ 64{
63 mIncidence = ev; 65 mIncidence = ev;
64 mMethod = method; 66 mMethod = method;
65 mStatus = status; 67 mStatus = status;
66 setText(6,Scheduler::translatedMethodName(mMethod)+" "); 68 setText(6,Scheduler::translatedMethodName(mMethod)+" ");
67 setText(7,ScheduleMessage::statusName(status)); 69 setText(7,ScheduleMessage::statusName(status));
68} 70}
69 71
@@ -130,32 +132,32 @@ bool ScheduleItemVisitor::visit(Journal *)
130/* 132/*
131 * Constructs a IncomingDialog which is a child of 'parent', with the 133 * Constructs a IncomingDialog which is a child of 'parent', with the
132 * name 'name' and widget flags set to 'f' 134 * name 'name' and widget flags set to 'f'
133 * 135 *
134 * The dialog will by default be modeless, unless you set 'modal' to 136 * The dialog will by default be modeless, unless you set 'modal' to
135 * TRUE to construct a modal dialog. 137 * TRUE to construct a modal dialog.
136 */ 138 */
137IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, 139IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing,
138 QWidget* parent,const char* name,bool modal,WFlags fl) : 140 QWidget* parent,const char* name,bool modal,Qt::WFlags fl) :
139 IncomingDialog_base(parent,name,modal,fl) 141 IncomingDialog_base(parent,name,modal,fl)
140{ 142{
141 mCalendar = calendar; 143 mCalendar = calendar;
142 mOutgoing = outgoing; 144 mOutgoing = outgoing;
143#ifndef KORG_NOMAIL 145#ifndef KORG_NOMAIL
144 mScheduler = new MailScheduler(mCalendar); 146 mScheduler = new MailScheduler(mCalendar);
145#else 147#else
146 mScheduler = new DummyScheduler(mCalendar); 148 mScheduler = new DummyScheduler(mCalendar);
147#endif 149#endif
148 mMessageListView->setColumnAlignment(1,AlignHCenter); 150 mMessageListView->setColumnAlignment(1,Qt::AlignHCenter);
149 mMessageListView->setColumnAlignment(2,AlignHCenter); 151 mMessageListView->setColumnAlignment(2,Qt::AlignHCenter);
150 mMessageListView->setColumnAlignment(3,AlignHCenter); 152 mMessageListView->setColumnAlignment(3,Qt::AlignHCenter);
151 mMessageListView->setColumnAlignment(4,AlignHCenter); 153 mMessageListView->setColumnAlignment(4,Qt::AlignHCenter);
152 QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), 154 QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
153 this,SLOT(showEvent(QListViewItem *))); 155 this,SLOT(showEvent(Q3ListViewItem *)));
154 retrieve(); 156 retrieve();
155} 157}
156 158
157/* 159/*
158 * Destroys the object and frees any allocated resources 160 * Destroys the object and frees any allocated resources
159 */ 161 */
160IncomingDialog::~IncomingDialog() 162IncomingDialog::~IncomingDialog()
161{ 163{
@@ -164,17 +166,17 @@ IncomingDialog::~IncomingDialog()
164 166
165void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) 167void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing)
166{ 168{
167 mOutgoing = outgoing; 169 mOutgoing = outgoing;
168} 170}
169 171
170void IncomingDialog::retrieve() 172void IncomingDialog::retrieve()
171{ 173{
172 QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); 174 Q3PtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions();
173 175
174 ScheduleMessage *message; 176 ScheduleMessage *message;
175 for(message = messages.first();message;message = messages.next()) { 177 for(message = messages.first();message;message = messages.next()) {
176 IncidenceBase *inc = message->event(); 178 IncidenceBase *inc = message->event();
177 Scheduler::Method method = (Scheduler::Method)message->method(); 179 Scheduler::Method method = (Scheduler::Method)message->method();
178 ScheduleMessage::Status status = message->status(); 180 ScheduleMessage::Status status = message->status();
179 181
180 ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); 182 ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status);
@@ -247,34 +249,34 @@ void IncomingDialog::rejectMessage()
247 ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); 249 ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem();
248 if (item) { 250 if (item) {
249 mScheduler->deleteTransaction(item->event()); 251 mScheduler->deleteTransaction(item->event());
250 delete item; 252 delete item;
251 emit numMessagesChanged(mMessageListView->childCount()); 253 emit numMessagesChanged(mMessageListView->childCount());
252 } 254 }
253} 255}
254 256
255void IncomingDialog::showEvent(QListViewItem *item) 257void IncomingDialog::showEvent(Q3ListViewItem *item)
256{ 258{
257 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); 259 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
258 if( incidence && incidence->typeID() == eventID ) { 260 if( incidence && incidence->typeID() == eventID ) {
259 Event *event = static_cast<Event *>(incidence); 261 Event *event = static_cast<Event *>(incidence);
260 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); 262 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this);
261 eventViewer->setEvent(event); 263 eventViewer->setEvent(event);
262 eventViewer->show(); 264 eventViewer->show();
263 } 265 }
264} 266}
265 267
266bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) 268bool IncomingDialog::incomeRefresh(ScheduleItemIn *item)
267{ 269{
268 Event *ev = mCalendar->event(item->event()->uid()); 270 Event *ev = mCalendar->event(item->event()->uid());
269 if (ev) { 271 if (ev) {
270 //user interaction before?? 272 //user interaction before??
271 Attendee *att; 273 Attendee *att;
272 QPtrList<Attendee> attlist = ev->attendees(); 274 Q3PtrList<Attendee> attlist = ev->attendees();
273 for (att=attlist.first(); att; att=attlist.next()) { 275 for (att=attlist.first(); att; att=attlist.next()) {
274 Event *event = new Event(*ev); 276 Event *event = new Event(*ev);
275 mOutgoing->addMessage(event,Scheduler::Request,att->email()); 277 mOutgoing->addMessage(event,Scheduler::Request,att->email());
276 delete(event); 278 delete(event);
277 } 279 }
278 mScheduler->deleteTransaction(item->event()); 280 mScheduler->deleteTransaction(item->event());
279 delete item; 281 delete item;
280 emit numMessagesChanged(mMessageListView->childCount()); 282 emit numMessagesChanged(mMessageListView->childCount());
@@ -509,17 +511,17 @@ bool IncomingDialog::checkOrganizerInAddressbook(QString organizer)
509} 511}
510 512
511bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) 513bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc)
512{ 514{
513 bool inBook = false; 515 bool inBook = false;
514#ifndef KORG_NOKABC 516#ifndef KORG_NOKABC
515 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 517 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
516 KABC::Addressee::List addressList; 518 KABC::Addressee::List addressList;
517 QPtrList <Attendee> attendees; 519 Q3PtrList <Attendee> attendees;
518 Attendee *att; 520 Attendee *att;
519 attendees = inc->attendees(); 521 attendees = inc->attendees();
520 for (att=attendees.first();att;att=attendees.next()) { 522 for (att=attendees.first();att;att=attendees.next()) {
521 addressList = add_book->findByEmail(att->email()); 523 addressList = add_book->findByEmail(att->email());
522 if (addressList.size()>0 ) inBook = true; 524 if (addressList.size()>0 ) inBook = true;
523 } 525 }
524#endif 526#endif
525 return inBook; 527 return inBook;