author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/kolistview.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | korganizer/kolistview.cpp | 193 |
1 files changed, 101 insertions, 92 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 192f8c0..0ea1d50 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -17,30 +17,39 @@ | |||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <q3listview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <q3popupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <q3progressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <q3textstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <q3whatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qpaintdevicemetrics.h> | 38 | #include <q3paintdevicemetrics.h> |
39 | //Added by qt3to4: | ||
40 | #include <QPixmap> | ||
41 | #include <QMouseEvent> | ||
42 | #include <QKeyEvent> | ||
43 | #include <QEvent> | ||
44 | #include <Q3VBoxLayout> | ||
45 | #include <Q3PtrList> | ||
46 | |||
47 | #include<QDesktopWidget> | ||
39 | 48 | ||
40 | #include <klocale.h> | 49 | #include <klocale.h> |
41 | #include <kdebug.h> | 50 | #include <kdebug.h> |
42 | #include <kiconloader.h> | 51 | #include <kiconloader.h> |
43 | #include <kglobal.h> | 52 | #include <kglobal.h> |
44 | 53 | ||
45 | #include <libkdepim/kpimglobalprefs.h> | 54 | #include <libkdepim/kpimglobalprefs.h> |
46 | #include <libkcal/calendar.h> | 55 | #include <libkcal/calendar.h> |
@@ -65,20 +74,20 @@ | |||
65 | #include "kfiledialog.h" | 74 | #include "kfiledialog.h" |
66 | 75 | ||
67 | #include "kolistview.h" | 76 | #include "kolistview.h" |
68 | #include "koeventviewer.h" | 77 | #include "koeventviewer.h" |
69 | 78 | ||
70 | extern QPixmap* sgListViewCompletedPix[6]; | 79 | extern QPixmap* sgListViewCompletedPix[6]; |
71 | extern QPixmap* sgListViewJournalPix; | 80 | extern QPixmap* sgListViewJournalPix; |
72 | 81 | ||
73 | class KOListViewWhatsThis :public QWhatsThis | 82 | class KOListViewWhatsThis :public Q3WhatsThis |
74 | { | 83 | { |
75 | public: | 84 | public: |
76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 85 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { }; |
77 | 86 | ||
78 | protected: | 87 | protected: |
79 | virtual QString text( const QPoint& p) | 88 | virtual QString text( const QPoint& p) |
80 | { | 89 | { |
81 | return _view->getWhatsThisText(p) ; | 90 | return _view->getWhatsThisText(p) ; |
82 | } | 91 | } |
83 | private: | 92 | private: |
84 | QWidget* _wid; | 93 | QWidget* _wid; |
@@ -269,73 +278,73 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
269 | mListView->addColumn(i18n("Duration")); | 278 | mListView->addColumn(i18n("Duration")); |
270 | mListView->addColumn(i18n("Alarm")); // alarm set? | 279 | mListView->addColumn(i18n("Alarm")); // alarm set? |
271 | mListView->addColumn(i18n("Recurs")); // recurs? | 280 | mListView->addColumn(i18n("Recurs")); // recurs? |
272 | mListView->addColumn(i18n("Cancelled")); | 281 | mListView->addColumn(i18n("Cancelled")); |
273 | mListView->addColumn(i18n("Categories")); | 282 | mListView->addColumn(i18n("Categories")); |
274 | mListView->addColumn(i18n("Calendar")); | 283 | mListView->addColumn(i18n("Calendar")); |
275 | mListView->addColumn(i18n("Last Modified")); | 284 | mListView->addColumn(i18n("Last Modified")); |
276 | 285 | ||
277 | mListView->setColumnAlignment(0,AlignLeft); | 286 | mListView->setColumnAlignment(0,Qt::AlignLeft); |
278 | mListView->setColumnAlignment(1,AlignLeft); | 287 | mListView->setColumnAlignment(1,Qt::AlignLeft); |
279 | mListView->setColumnAlignment(2,AlignHCenter); | 288 | mListView->setColumnAlignment(2,Qt::AlignHCenter); |
280 | mListView->setColumnAlignment(3,AlignLeft); | 289 | mListView->setColumnAlignment(3,Qt::AlignLeft); |
281 | mListView->setColumnAlignment(4,AlignHCenter); | 290 | mListView->setColumnAlignment(4,Qt::AlignHCenter); |
282 | mListView->setColumnAlignment(5,AlignLeft); | 291 | mListView->setColumnAlignment(5,Qt::AlignLeft); |
283 | mListView->setColumnAlignment(6,AlignLeft); | 292 | mListView->setColumnAlignment(6,Qt::AlignLeft); |
284 | mListView->setColumnAlignment(7,AlignLeft); | 293 | mListView->setColumnAlignment(7,Qt::AlignLeft); |
285 | mListView->setColumnAlignment(8,AlignLeft); | 294 | mListView->setColumnAlignment(8,Qt::AlignLeft); |
286 | mListView->setColumnAlignment(9,AlignLeft); | 295 | mListView->setColumnAlignment(9,Qt::AlignLeft); |
287 | mListView->setColumnAlignment(10,AlignLeft); | 296 | mListView->setColumnAlignment(10,Qt::AlignLeft); |
288 | mListView->setColumnAlignment(11,AlignLeft); | 297 | mListView->setColumnAlignment(11,Qt::AlignLeft); |
289 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 298 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
290 | 299 | ||
291 | int iii = 0; | 300 | int iii = 0; |
292 | for ( iii = 0; iii< 12 ; ++iii ) | 301 | for ( iii = 0; iii< 12 ; ++iii ) |
293 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 302 | mListView->setColumnWidthMode( iii, Q3ListView::Manual ); |
294 | 303 | ||
295 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 304 | Q3BoxLayout *layoutTop = new Q3VBoxLayout(this); |
296 | layoutTop->addWidget(mListView); | 305 | layoutTop->addWidget(mListView); |
297 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 306 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
298 | mPopupMenu = eventPopup(); | 307 | mPopupMenu = eventPopup(); |
299 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 308 | Q3PopupMenu* selPopup = new Q3PopupMenu ( this ); |
300 | mPopupMenu->insertSeparator(); | 309 | mPopupMenu->insertSeparator(); |
301 | 310 | ||
302 | selPopup->insertItem(i18n("All"),this, | 311 | selPopup->insertItem(i18n("All"),this, |
303 | SLOT(allSelection())); | 312 | SLOT(allSelection())); |
304 | selPopup->insertItem(i18n("None"),this, | 313 | selPopup->insertItem(i18n("None"),this, |
305 | SLOT(clearSelection())); | 314 | SLOT(clearSelection())); |
306 | selPopup->insertItem(i18n("Delete selected..."),this, | 315 | selPopup->insertItem(i18n("Delete selected..."),this, |
307 | SLOT(deleteAll())); | 316 | SLOT(deleteAll())); |
308 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 317 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 318 | mPopupMenu->addAdditionalItem(QIcon(QPixmap()), |
310 | i18n("Hide all selected"),this, | 319 | i18n("Hide all selected"),this, |
311 | SLOT(hideAll()),true); | 320 | SLOT(hideAll()),true); |
312 | 321 | ||
313 | selPopup->insertSeparator(); | 322 | selPopup->insertSeparator(); |
314 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 323 | Q3PopupMenu * exportPO = new Q3PopupMenu ( this ); |
315 | selPopup->insertItem( i18n("Export"), exportPO ); | 324 | selPopup->insertItem( i18n("Export"), exportPO ); |
316 | #ifdef DESKTOP_VERSION | 325 | #ifdef DESKTOP_VERSION |
317 | mPopupMenu->insertSeparator(); | 326 | mPopupMenu->insertSeparator(); |
318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 327 | mPopupMenu->addAdditionalItem(QIcon(QPixmap()), |
319 | i18n("Print complete list..."),this, | 328 | i18n("Print complete list..."),this, |
320 | SLOT(printList()),true); | 329 | SLOT(printList()),true); |
321 | #endif | 330 | #endif |
322 | mCalPopup = new QPopupMenu ( this ); | 331 | mCalPopup = new Q3PopupMenu ( this ); |
323 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 332 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
324 | 333 | ||
325 | selPopup->insertItem(i18n("Set categories")+"...",this, | 334 | selPopup->insertItem(i18n("Set categories")+"...",this, |
326 | SLOT(setCat()) ); | 335 | SLOT(setCat()) ); |
327 | selPopup->insertItem( i18n("Set alarm..."),this, | 336 | selPopup->insertItem( i18n("Set alarm..."),this, |
328 | SLOT(setAlarm())); | 337 | SLOT(setAlarm())); |
329 | #if 0 | 338 | #if 0 |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 339 | mPopupMenu->addAdditionalItem(QIcon(QPixmap()), |
331 | i18n("Set categories")+"...",this, | 340 | i18n("Set categories")+"...",this, |
332 | SLOT(setCat()),true); | 341 | SLOT(setCat()),true); |
333 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 342 | mPopupMenu->addAdditionalItem(QIcon(QPixmap()), |
334 | i18n("Set alarm..."),this, | 343 | i18n("Set alarm..."),this, |
335 | SLOT(setAlarm()),true); | 344 | SLOT(setAlarm()),true); |
336 | #endif | 345 | #endif |
337 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 346 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
338 | SLOT( populateCalPopup() )); | 347 | SLOT( populateCalPopup() )); |
339 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 348 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
340 | SLOT( setCalendar( int ) )); | 349 | SLOT( setCalendar( int ) )); |
341 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 350 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
@@ -351,17 +360,17 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
351 | // i18n("Add Categ. to selected..."),this, | 360 | // i18n("Add Categ. to selected..."),this, |
352 | // SLOT(addCat()),true); | 361 | // SLOT(addCat()),true); |
353 | //mPopupMenu->insertSeparator(); | 362 | //mPopupMenu->insertSeparator(); |
354 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
355 | selPopup->insertSeparator(); | 364 | selPopup->insertSeparator(); |
356 | selPopup->insertItem( i18n("Beam via IR..."),this, | 365 | selPopup->insertItem( i18n("Beam via IR..."),this, |
357 | SLOT(beamSelected())); | 366 | SLOT(beamSelected())); |
358 | #if 0 | 367 | #if 0 |
359 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 368 | mPopupMenu->addAdditionalItem(QIcon(QPixmap()), |
360 | i18n("Beam via IR"),this, | 369 | i18n("Beam via IR"),this, |
361 | SLOT(beamSelected()),true); | 370 | SLOT(beamSelected()),true); |
362 | #endif | 371 | #endif |
363 | #endif | 372 | #endif |
364 | /* | 373 | /* |
365 | mPopupMenu = new QPopupMenu; | 374 | mPopupMenu = new QPopupMenu; |
366 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 375 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
367 | SLOT (editEvent())); | 376 | SLOT (editEvent())); |
@@ -370,23 +379,23 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
370 | mPopupMenu->insertSeparator(); | 379 | mPopupMenu->insertSeparator(); |
371 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 380 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
372 | SLOT(showDates())); | 381 | SLOT(showDates())); |
373 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 382 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
374 | SLOT(hideDates())); | 383 | SLOT(hideDates())); |
375 | */ | 384 | */ |
376 | QObject::connect(mListView,SIGNAL( newEvent()), | 385 | QObject::connect(mListView,SIGNAL( newEvent()), |
377 | this,SIGNAL(signalNewEvent())); | 386 | this,SIGNAL(signalNewEvent())); |
378 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 387 | QObject::connect(mListView,SIGNAL(doubleClicked(Q3ListViewItem *)), |
379 | this,SLOT(defaultItemAction(QListViewItem *))); | 388 | this,SLOT(defaultItemAction(Q3ListViewItem *))); |
380 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 389 | QObject::connect(mListView,SIGNAL(rightButtonPressed( Q3ListViewItem *, |
381 | const QPoint &, int )), | 390 | const QPoint &, int )), |
382 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 391 | this,SLOT(popupMenu(Q3ListViewItem *,const QPoint &,int))); |
383 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 392 | QObject::connect(mListView,SIGNAL(currentChanged(Q3ListViewItem *)), |
384 | SLOT(processSelectionChange(QListViewItem *))); | 393 | SLOT(processSelectionChange(Q3ListViewItem *))); |
385 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 394 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
386 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 395 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
387 | 396 | ||
388 | readSettings(KOGlobals::config(),"KOListView Layout"); | 397 | readSettings(KOGlobals::config(),"KOListView Layout"); |
389 | } | 398 | } |
390 | 399 | ||
391 | KOListView::~KOListView() | 400 | KOListView::~KOListView() |
392 | { | 401 | { |
@@ -423,31 +432,31 @@ void KOListView::setCalendar( int c ) | |||
423 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 432 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
424 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 433 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
425 | i18n("Continue"), i18n("Cancel"), 0, | 434 | i18n("Continue"), i18n("Cancel"), 0, |
426 | 0, 1 ); | 435 | 0, 1 ); |
427 | if ( result != 0 ) { | 436 | if ( result != 0 ) { |
428 | return; | 437 | return; |
429 | } | 438 | } |
430 | 439 | ||
431 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 440 | Q3PtrList<Incidence> delSel = getSelectedIncidences() ; |
432 | int icount = delSel.count(); | 441 | int icount = delSel.count(); |
433 | if ( icount ) { | 442 | if ( icount ) { |
434 | Incidence *incidence = delSel.first(); | 443 | Incidence *incidence = delSel.first(); |
435 | while ( incidence ) { | 444 | while ( incidence ) { |
436 | incidence->setCalID( c ); | 445 | incidence->setCalID( c ); |
437 | KOListViewItem * item = getItemForEvent( incidence ); | 446 | KOListViewItem * item = getItemForEvent( incidence ); |
438 | if ( item ) { | 447 | if ( item ) { |
439 | ListItemVisitor v(item, mStartDate ); | 448 | ListItemVisitor v(item, mStartDate ); |
440 | incidence->accept(v); | 449 | incidence->accept(v); |
441 | } | 450 | } |
442 | incidence = delSel.next(); | 451 | incidence = delSel.next(); |
443 | } | 452 | } |
444 | } | 453 | } |
445 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 454 | Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
446 | KopiCalendarFile * cal = calendars.first(); | 455 | KopiCalendarFile * cal = calendars.first(); |
447 | while ( cal ) { | 456 | while ( cal ) { |
448 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 457 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
449 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 458 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
450 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 459 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
451 | if ( cal->isStandard ) | 460 | if ( cal->isStandard ) |
452 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 461 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
453 | cal = calendars.next(); | 462 | cal = calendars.next(); |
@@ -492,17 +501,17 @@ void KOListView::setCat() | |||
492 | setCategories( set ); | 501 | setCategories( set ); |
493 | } | 502 | } |
494 | 503 | ||
495 | void KOListView::setAlarm() | 504 | void KOListView::setAlarm() |
496 | { | 505 | { |
497 | KOAlarmPrefs kap( this); | 506 | KOAlarmPrefs kap( this); |
498 | if ( !kap.exec() ) | 507 | if ( !kap.exec() ) |
499 | return; | 508 | return; |
500 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 509 | Q3PtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
501 | Incidence* inc = delSel.first(); | 510 | Incidence* inc = delSel.first(); |
502 | int count = 0; | 511 | int count = 0; |
503 | while ( inc ) { | 512 | while ( inc ) { |
504 | ++count; | 513 | ++count; |
505 | if (kap.mAlarmButton->isChecked()) { | 514 | if (kap.mAlarmButton->isChecked()) { |
506 | if (inc->alarms().count() == 0) | 515 | if (inc->alarms().count() == 0) |
507 | inc->newAlarm(); | 516 | inc->newAlarm(); |
508 | Alarm *alarm = inc->alarms().first(); | 517 | Alarm *alarm = inc->alarms().first(); |
@@ -517,17 +526,17 @@ void KOListView::setAlarm() | |||
517 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 526 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
518 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 527 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
519 | } | 528 | } |
520 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 529 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
521 | alarm->setAudioAlarm(kap.mAlarmSound); | 530 | alarm->setAudioAlarm(kap.mAlarmSound); |
522 | else | 531 | else |
523 | alarm->setType(Alarm::Invalid); | 532 | alarm->setType(Alarm::Invalid); |
524 | } else { | 533 | } else { |
525 | QPtrList<Alarm> alarms = inc->alarms(); | 534 | Q3PtrList<Alarm> alarms = inc->alarms(); |
526 | Alarm *alarm; | 535 | Alarm *alarm; |
527 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 536 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
528 | alarm->setEnabled(false); | 537 | alarm->setEnabled(false); |
529 | alarm->setType(Alarm::Invalid); | 538 | alarm->setType(Alarm::Invalid); |
530 | } | 539 | } |
531 | } | 540 | } |
532 | KOListViewItem* item = getItemForEvent(inc); | 541 | KOListViewItem* item = getItemForEvent(inc); |
533 | if (item) { | 542 | if (item) { |
@@ -547,17 +556,17 @@ void KOListView::setCategories( bool removeOld ) | |||
547 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 556 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
548 | csd->setColorEnabled(); | 557 | csd->setColorEnabled(); |
549 | if (! csd->exec()) { | 558 | if (! csd->exec()) { |
550 | delete csd; | 559 | delete csd; |
551 | return; | 560 | return; |
552 | } | 561 | } |
553 | QStringList catList = csd->selectedCategories(); | 562 | QStringList catList = csd->selectedCategories(); |
554 | delete csd; | 563 | delete csd; |
555 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 564 | Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
556 | Incidence* inc = delSel.first(); | 565 | Incidence* inc = delSel.first(); |
557 | while ( inc ) { | 566 | while ( inc ) { |
558 | if ( removeOld ) { | 567 | if ( removeOld ) { |
559 | inc->setCategories( catList, false ); | 568 | inc->setCategories( catList, false ); |
560 | } else { | 569 | } else { |
561 | inc->addCategories( catList, false ); | 570 | inc->addCategories( catList, false ); |
562 | } | 571 | } |
563 | KOListViewItem* item = getItemForEvent(inc); | 572 | KOListViewItem* item = getItemForEvent(inc); |
@@ -567,32 +576,32 @@ void KOListView::setCategories( bool removeOld ) | |||
567 | } | 576 | } |
568 | inc = delSel.next(); | 577 | inc = delSel.next(); |
569 | } | 578 | } |
570 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 579 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
571 | } | 580 | } |
572 | 581 | ||
573 | void KOListView::beamSelected() | 582 | void KOListView::beamSelected() |
574 | { | 583 | { |
575 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 584 | Q3PtrList<Incidence> delSel = getSelectedIncidences() ; |
576 | if ( delSel.count() ) | 585 | if ( delSel.count() ) |
577 | emit beamIncidenceList( delSel ); | 586 | emit beamIncidenceList( delSel ); |
578 | } | 587 | } |
579 | 588 | ||
580 | void KOListView::saveDescriptionToFile() | 589 | void KOListView::saveDescriptionToFile() |
581 | { | 590 | { |
582 | 591 | ||
583 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 592 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
584 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 593 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
585 | i18n("Continue"), i18n("Cancel"), 0, | 594 | i18n("Continue"), i18n("Cancel"), 0, |
586 | 0, 1 ); | 595 | 0, 1 ); |
587 | if ( result != 0 ) { | 596 | if ( result != 0 ) { |
588 | return; | 597 | return; |
589 | } | 598 | } |
590 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 599 | Q3PtrList<Incidence> delSel = getSelectedIncidences() ; |
591 | int icount = delSel.count(); | 600 | int icount = delSel.count(); |
592 | if ( icount ) { | 601 | if ( icount ) { |
593 | QString fn = KOPrefs::instance()->mLastSaveFile; | 602 | QString fn = KOPrefs::instance()->mLastSaveFile; |
594 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 603 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
595 | 604 | ||
596 | if ( fn == "" ) | 605 | if ( fn == "" ) |
597 | return; | 606 | return; |
598 | QFileInfo info; | 607 | QFileInfo info; |
@@ -640,21 +649,21 @@ void KOListView::saveDescriptionToFile() | |||
640 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 649 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
641 | ++icount; | 650 | ++icount; |
642 | 651 | ||
643 | } | 652 | } |
644 | } | 653 | } |
645 | incidence = delSel.next(); | 654 | incidence = delSel.next(); |
646 | } | 655 | } |
647 | QFile file( fn ); | 656 | QFile file( fn ); |
648 | if (!file.open( IO_WriteOnly ) ) { | 657 | if (!file.open( QIODevice::WriteOnly ) ) { |
649 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 658 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
650 | return; | 659 | return; |
651 | } | 660 | } |
652 | QTextStream ts( &file ); | 661 | Q3TextStream ts( &file ); |
653 | ts << text; | 662 | ts << text; |
654 | file.close(); | 663 | file.close(); |
655 | //qDebug("%s ", text.latin1()); | 664 | //qDebug("%s ", text.latin1()); |
656 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 665 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
657 | KOPrefs::instance()->mLastSaveFile = fn; | 666 | KOPrefs::instance()->mLastSaveFile = fn; |
658 | topLevelWidget()->setCaption(mes); | 667 | topLevelWidget()->setCaption(mes); |
659 | } | 668 | } |
660 | } | 669 | } |
@@ -662,22 +671,22 @@ void KOListView::saveDescriptionToFile() | |||
662 | void KOListView::saveToFileVCS() | 671 | void KOListView::saveToFileVCS() |
663 | { | 672 | { |
664 | writeToFile( false ); | 673 | writeToFile( false ); |
665 | } | 674 | } |
666 | void KOListView::saveToFile() | 675 | void KOListView::saveToFile() |
667 | { | 676 | { |
668 | writeToFile( true ); | 677 | writeToFile( true ); |
669 | } | 678 | } |
670 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 679 | Q3PtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
671 | { | 680 | { |
672 | QPtrList<Incidence> delSel ; | 681 | Q3PtrList<Incidence> delSel ; |
673 | bool addSubTodos = false; | 682 | bool addSubTodos = false; |
674 | bool askSubTodos = true; | 683 | bool askSubTodos = true; |
675 | QListViewItem *item = mListView->firstChild (); | 684 | Q3ListViewItem *item = mListView->firstChild (); |
676 | while ( item ) { | 685 | while ( item ) { |
677 | if ( item->isSelected() ) { | 686 | if ( item->isSelected() ) { |
678 | Incidence* inc = ((KOListViewItem *)item)->data(); | 687 | Incidence* inc = ((KOListViewItem *)item)->data(); |
679 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 688 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
680 | if ( (inc->typeID() == todoID && includeTodos) || | 689 | if ( (inc->typeID() == todoID && includeTodos) || |
681 | (inc->typeID() == eventID && includeEvents) || | 690 | (inc->typeID() == eventID && includeEvents) || |
682 | (inc->typeID() == journalID && includeJournals) ) { | 691 | (inc->typeID() == journalID && includeJournals) ) { |
683 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 692 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
@@ -701,17 +710,17 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool | |||
701 | delSel.clear(); | 710 | delSel.clear(); |
702 | return delSel; | 711 | return delSel; |
703 | } | 712 | } |
704 | if (result == KMessageBox::Yes) | 713 | if (result == KMessageBox::Yes) |
705 | addSubTodos = true; | 714 | addSubTodos = true; |
706 | askSubTodos = false; | 715 | askSubTodos = false; |
707 | } | 716 | } |
708 | if ( addSubTodos ) { | 717 | if ( addSubTodos ) { |
709 | QPtrList<Incidence> tempSel ; | 718 | Q3PtrList<Incidence> tempSel ; |
710 | inc->addRelationsToList( &tempSel ); | 719 | inc->addRelationsToList( &tempSel ); |
711 | Incidence* tempinc = tempSel.first(); | 720 | Incidence* tempinc = tempSel.first(); |
712 | while ( tempinc ) { | 721 | while ( tempinc ) { |
713 | if ( delSel.findRef( tempinc ) == -1 ) { | 722 | if ( delSel.findRef( tempinc ) == -1 ) { |
714 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | 723 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { |
715 | if ( ((Todo*)tempinc)->hasDueDate() ) | 724 | if ( ((Todo*)tempinc)->hasDueDate() ) |
716 | delSel.append( tempinc ); | 725 | delSel.append( tempinc ); |
717 | } else | 726 | } else |
@@ -725,17 +734,17 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool | |||
725 | } | 734 | } |
726 | item = item->nextSibling(); | 735 | item = item->nextSibling(); |
727 | } | 736 | } |
728 | return delSel; | 737 | return delSel; |
729 | } | 738 | } |
730 | 739 | ||
731 | void KOListView::writeToFile( bool iCal ) | 740 | void KOListView::writeToFile( bool iCal ) |
732 | { | 741 | { |
733 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 742 | Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
734 | if ( !iCal ) { | 743 | if ( !iCal ) { |
735 | bool journal = false; | 744 | bool journal = false; |
736 | Incidence *incidence = delSel.first(); | 745 | Incidence *incidence = delSel.first(); |
737 | while ( incidence ) { | 746 | while ( incidence ) { |
738 | if ( incidence->typeID() == journalID ) { | 747 | if ( incidence->typeID() == journalID ) { |
739 | journal = true; | 748 | journal = true; |
740 | break; | 749 | break; |
741 | } | 750 | } |
@@ -798,56 +807,56 @@ void KOListView::writeToFile( bool iCal ) | |||
798 | KOPrefs::instance()->mLastSaveFile = fn; | 807 | KOPrefs::instance()->mLastSaveFile = fn; |
799 | topLevelWidget()->setCaption(mes); | 808 | topLevelWidget()->setCaption(mes); |
800 | } | 809 | } |
801 | } | 810 | } |
802 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 811 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
803 | } | 812 | } |
804 | void KOListView::hideAll() | 813 | void KOListView::hideAll() |
805 | { | 814 | { |
806 | QPtrList<QListViewItem> delSel ; | 815 | Q3PtrList<Q3ListViewItem> delSel ; |
807 | QListViewItem *item = mListView->firstChild (); | 816 | Q3ListViewItem *item = mListView->firstChild (); |
808 | while ( item ) { | 817 | while ( item ) { |
809 | if ( item->isSelected() ) { | 818 | if ( item->isSelected() ) { |
810 | delSel.append(item); | 819 | delSel.append(item); |
811 | } | 820 | } |
812 | item = item->nextSibling(); | 821 | item = item->nextSibling(); |
813 | } | 822 | } |
814 | item = delSel.first() ; | 823 | item = delSel.first() ; |
815 | while ( item ) { | 824 | while ( item ) { |
816 | QListViewItem * del = item; | 825 | Q3ListViewItem * del = item; |
817 | item = delSel.next(); | 826 | item = delSel.next(); |
818 | delete del; | 827 | delete del; |
819 | } | 828 | } |
820 | } | 829 | } |
821 | void KOListView::printList() | 830 | void KOListView::printList() |
822 | { | 831 | { |
823 | mListView->printList(); | 832 | mListView->printList(); |
824 | } | 833 | } |
825 | void KOListView::deleteAll() | 834 | void KOListView::deleteAll() |
826 | { | 835 | { |
827 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; | 836 | Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; |
828 | if ( delSel.count() ) { | 837 | if ( delSel.count() ) { |
829 | int icount = delSel.count(); | 838 | int icount = delSel.count(); |
830 | Incidence *incidence = delSel.first(); | 839 | Incidence *incidence = delSel.first(); |
831 | Incidence *toDelete; | 840 | Incidence *toDelete; |
832 | KOPrefs *p = KOPrefs::instance(); | 841 | KOPrefs *p = KOPrefs::instance(); |
833 | bool confirm = p->mConfirm; | 842 | bool confirm = p->mConfirm; |
834 | QString mess; | 843 | QString mess; |
835 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 844 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
836 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 845 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
837 | p->mConfirm = false; | 846 | p->mConfirm = false; |
838 | int delCounter = 0; | 847 | int delCounter = 0; |
839 | QDialog dia ( this, "p-dialog", true ); | 848 | QDialog dia ( this, "p-dialog", true ); |
840 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 849 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
841 | QVBoxLayout lay( &dia ); | 850 | Q3VBoxLayout lay( &dia ); |
842 | lay.setMargin(7); | 851 | lay.setMargin(7); |
843 | lay.setSpacing(7); | 852 | lay.setSpacing(7); |
844 | lay.addWidget( &lab); | 853 | lay.addWidget( &lab); |
845 | QProgressBar bar( icount, &dia ); | 854 | Q3ProgressBar bar( icount, &dia ); |
846 | lay.addWidget( &bar); | 855 | lay.addWidget( &bar); |
847 | int w = 220; | 856 | int w = 220; |
848 | int h = 50; | 857 | int h = 50; |
849 | int dw = QApplication::desktop()->width(); | 858 | int dw = QApplication::desktop()->width(); |
850 | int dh = QApplication::desktop()->height(); | 859 | int dh = QApplication::desktop()->height(); |
851 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 860 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
852 | //dia.resize( 240,50 ); | 861 | //dia.resize( 240,50 ); |
853 | dia.show(); | 862 | dia.show(); |
@@ -879,20 +888,20 @@ int KOListView::maxDatesHint() | |||
879 | return 0; | 888 | return 0; |
880 | } | 889 | } |
881 | 890 | ||
882 | int KOListView::currentDateCount() | 891 | int KOListView::currentDateCount() |
883 | { | 892 | { |
884 | return 0; | 893 | return 0; |
885 | } | 894 | } |
886 | 895 | ||
887 | QPtrList<Incidence> KOListView::selectedIncidences() | 896 | Q3PtrList<Incidence> KOListView::selectedIncidences() |
888 | { | 897 | { |
889 | QPtrList<Incidence> eventList; | 898 | Q3PtrList<Incidence> eventList; |
890 | QListViewItem *item = mListView->firstChild (); | 899 | Q3ListViewItem *item = mListView->firstChild (); |
891 | while ( item ) { | 900 | while ( item ) { |
892 | if ( item->isSelected() ) { | 901 | if ( item->isSelected() ) { |
893 | eventList.append(((KOListViewItem *)item)->data()); | 902 | eventList.append(((KOListViewItem *)item)->data()); |
894 | } | 903 | } |
895 | 904 | ||
896 | item = item->nextSibling(); | 905 | item = item->nextSibling(); |
897 | } | 906 | } |
898 | 907 | ||
@@ -982,39 +991,39 @@ void KOListView::showDates(const QDate &start, const QDate &end) | |||
982 | addJournals( calendar()->journals4Date(date) ); | 991 | addJournals( calendar()->journals4Date(date) ); |
983 | date = date.addDays( 1 ); | 992 | date = date.addDays( 1 ); |
984 | } | 993 | } |
985 | //emit incidenceSelected( 0 ); | 994 | //emit incidenceSelected( 0 ); |
986 | updateView(); | 995 | updateView(); |
987 | 996 | ||
988 | } | 997 | } |
989 | 998 | ||
990 | void KOListView::addEvents(QPtrList<Event> eventList) | 999 | void KOListView::addEvents(Q3PtrList<Event> eventList) |
991 | { | 1000 | { |
992 | 1001 | ||
993 | Event *ev; | 1002 | Event *ev; |
994 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1003 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
995 | addIncidence(ev); | 1004 | addIncidence(ev); |
996 | } | 1005 | } |
997 | if ( !mListView->currentItem() ){ | 1006 | if ( !mListView->currentItem() ){ |
998 | updateView(); | 1007 | updateView(); |
999 | } | 1008 | } |
1000 | } | 1009 | } |
1001 | 1010 | ||
1002 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1011 | void KOListView::addTodos(Q3PtrList<Todo> eventList) |
1003 | { | 1012 | { |
1004 | Todo *ev; | 1013 | Todo *ev; |
1005 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1014 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1006 | addIncidence(ev); | 1015 | addIncidence(ev); |
1007 | } | 1016 | } |
1008 | if ( !mListView->currentItem() ){ | 1017 | if ( !mListView->currentItem() ){ |
1009 | updateView(); | 1018 | updateView(); |
1010 | } | 1019 | } |
1011 | } | 1020 | } |
1012 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1021 | void KOListView::addJournals(Q3PtrList<Journal> eventList) |
1013 | { | 1022 | { |
1014 | Journal *ev; | 1023 | Journal *ev; |
1015 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1024 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1016 | addIncidence(ev); | 1025 | addIncidence(ev); |
1017 | } | 1026 | } |
1018 | if ( !mListView->currentItem() ){ | 1027 | if ( !mListView->currentItem() ){ |
1019 | updateView(); | 1028 | updateView(); |
1020 | } | 1029 | } |
@@ -1039,17 +1048,17 @@ void KOListView::addIncidence(Incidence *incidence) | |||
1039 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1048 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1040 | ListItemVisitor v(item, mStartDate ); | 1049 | ListItemVisitor v(item, mStartDate ); |
1041 | if (incidence->accept(v)) { | 1050 | if (incidence->accept(v)) { |
1042 | return; | 1051 | return; |
1043 | } | 1052 | } |
1044 | else delete item; | 1053 | else delete item; |
1045 | } | 1054 | } |
1046 | 1055 | ||
1047 | void KOListView::showEvents(QPtrList<Event> eventList) | 1056 | void KOListView::showEvents(Q3PtrList<Event> eventList) |
1048 | { | 1057 | { |
1049 | clear(); | 1058 | clear(); |
1050 | 1059 | ||
1051 | addEvents(eventList); | 1060 | addEvents(eventList); |
1052 | 1061 | ||
1053 | // After new creation of list view no events are selected. | 1062 | // After new creation of list view no events are selected. |
1054 | emit incidenceSelected( 0 ); | 1063 | emit incidenceSelected( 0 ); |
1055 | } | 1064 | } |
@@ -1090,24 +1099,24 @@ KOListViewItem *KOListView::getItemForEvent(Incidence *event) | |||
1090 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1099 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1091 | while (item) { | 1100 | while (item) { |
1092 | if (item->data() == event) return item; | 1101 | if (item->data() == event) return item; |
1093 | item = (KOListViewItem *)item->nextSibling(); | 1102 | item = (KOListViewItem *)item->nextSibling(); |
1094 | } | 1103 | } |
1095 | return 0; | 1104 | return 0; |
1096 | } | 1105 | } |
1097 | 1106 | ||
1098 | void KOListView::defaultItemAction(QListViewItem *i) | 1107 | void KOListView::defaultItemAction(Q3ListViewItem *i) |
1099 | { | 1108 | { |
1100 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1109 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1101 | if ( item ) defaultAction( item->data() ); | 1110 | if ( item ) defaultAction( item->data() ); |
1102 | 1111 | ||
1103 | } | 1112 | } |
1104 | 1113 | ||
1105 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1114 | void KOListView::popupMenu(Q3ListViewItem *item,const QPoint &,int) |
1106 | { | 1115 | { |
1107 | mActiveItem = (KOListViewItem *)item; | 1116 | mActiveItem = (KOListViewItem *)item; |
1108 | if (mActiveItem) { | 1117 | if (mActiveItem) { |
1109 | Incidence *incidence = mActiveItem->data(); | 1118 | Incidence *incidence = mActiveItem->data(); |
1110 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1119 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1111 | mPopupMenu->showIncidencePopup(incidence); | 1120 | mPopupMenu->showIncidencePopup(incidence); |
1112 | 1121 | ||
1113 | /* | 1122 | /* |
@@ -1126,17 +1135,17 @@ void KOListView::readSettings(KConfig *config, QString setting) | |||
1126 | } | 1135 | } |
1127 | 1136 | ||
1128 | void KOListView::writeSettings(KConfig *config, QString setting) | 1137 | void KOListView::writeSettings(KConfig *config, QString setting) |
1129 | { | 1138 | { |
1130 | // qDebug("KOListView::writeSettings "); | 1139 | // qDebug("KOListView::writeSettings "); |
1131 | mListView->saveLayout(config, setting); | 1140 | mListView->saveLayout(config, setting); |
1132 | } | 1141 | } |
1133 | 1142 | ||
1134 | void KOListView::processSelectionChange(QListViewItem *) | 1143 | void KOListView::processSelectionChange(Q3ListViewItem *) |
1135 | { | 1144 | { |
1136 | 1145 | ||
1137 | KOListViewItem *item = | 1146 | KOListViewItem *item = |
1138 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 1147 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
1139 | 1148 | ||
1140 | if ( !item ) { | 1149 | if ( !item ) { |
1141 | emit incidenceSelected( 0 ); | 1150 | emit incidenceSelected( 0 ); |
1142 | } else { | 1151 | } else { |
@@ -1175,82 +1184,82 @@ void KOListView::keyPressEvent ( QKeyEvent *e) | |||
1175 | 1184 | ||
1176 | e->ignore(); | 1185 | e->ignore(); |
1177 | } | 1186 | } |
1178 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1187 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1179 | { | 1188 | { |
1180 | 1189 | ||
1181 | switch ( e->key() ) { | 1190 | switch ( e->key() ) { |
1182 | case Qt::Key_Down: | 1191 | case Qt::Key_Down: |
1183 | if ( e->state() == ShiftButton ) { | 1192 | if ( e->state() == Qt::ShiftButton ) { |
1184 | QListViewItem* cn = currentItem(); | 1193 | Q3ListViewItem* cn = currentItem(); |
1185 | if ( !cn ) | 1194 | if ( !cn ) |
1186 | cn = firstChild(); | 1195 | cn = firstChild(); |
1187 | if ( !cn ) | 1196 | if ( !cn ) |
1188 | return; | 1197 | return; |
1189 | while ( cn->nextSibling() ) | 1198 | while ( cn->nextSibling() ) |
1190 | cn = cn->nextSibling(); | 1199 | cn = cn->nextSibling(); |
1191 | setCurrentItem ( cn ); | 1200 | setCurrentItem ( cn ); |
1192 | ensureItemVisible ( cn ); | 1201 | ensureItemVisible ( cn ); |
1193 | 1202 | ||
1194 | e->accept(); | 1203 | e->accept(); |
1195 | return; | 1204 | return; |
1196 | } | 1205 | } |
1197 | if ( e->state() == ControlButton ) { | 1206 | if ( e->state() == Qt::ControlButton ) { |
1198 | int count = childCount (); | 1207 | int count = childCount (); |
1199 | int jump = count / 5; | 1208 | int jump = count / 5; |
1200 | QListViewItem* cn; | 1209 | Q3ListViewItem* cn; |
1201 | cn = currentItem(); | 1210 | cn = currentItem(); |
1202 | if ( ! cn ) | 1211 | if ( ! cn ) |
1203 | return; | 1212 | return; |
1204 | if ( jump == 0 ) | 1213 | if ( jump == 0 ) |
1205 | jump = 1; | 1214 | jump = 1; |
1206 | while ( jump && cn->nextSibling() ) { | 1215 | while ( jump && cn->nextSibling() ) { |
1207 | cn = cn->nextSibling(); | 1216 | cn = cn->nextSibling(); |
1208 | --jump; | 1217 | --jump; |
1209 | } | 1218 | } |
1210 | setCurrentItem ( cn ); | 1219 | setCurrentItem ( cn ); |
1211 | ensureItemVisible ( cn ); | 1220 | ensureItemVisible ( cn ); |
1212 | 1221 | ||
1213 | } else | 1222 | } else |
1214 | QListView::keyPressEvent ( e ) ; | 1223 | Q3ListView::keyPressEvent ( e ) ; |
1215 | e->accept(); | 1224 | e->accept(); |
1216 | break; | 1225 | break; |
1217 | 1226 | ||
1218 | case Qt::Key_Up: | 1227 | case Qt::Key_Up: |
1219 | if ( e->state() == ShiftButton ) { | 1228 | if ( e->state() == Qt::ShiftButton ) { |
1220 | QListViewItem* cn = firstChild(); | 1229 | Q3ListViewItem* cn = firstChild(); |
1221 | if ( cn ) { | 1230 | if ( cn ) { |
1222 | setCurrentItem ( cn ); | 1231 | setCurrentItem ( cn ); |
1223 | ensureItemVisible ( cn ); | 1232 | ensureItemVisible ( cn ); |
1224 | } | 1233 | } |
1225 | e->accept(); | 1234 | e->accept(); |
1226 | return; | 1235 | return; |
1227 | } | 1236 | } |
1228 | if ( e->state() == ControlButton ) { | 1237 | if ( e->state() == Qt::ControlButton ) { |
1229 | int count = childCount (); | 1238 | int count = childCount (); |
1230 | int jump = count / 5; | 1239 | int jump = count / 5; |
1231 | QListViewItem* cn; | 1240 | Q3ListViewItem* cn; |
1232 | cn = currentItem(); | 1241 | cn = currentItem(); |
1233 | if ( ! cn ) | 1242 | if ( ! cn ) |
1234 | return; | 1243 | return; |
1235 | if ( jump == 0 ) | 1244 | if ( jump == 0 ) |
1236 | jump = 1; | 1245 | jump = 1; |
1237 | while ( jump && cn->itemAbove ()) { | 1246 | while ( jump && cn->itemAbove ()) { |
1238 | cn = cn->itemAbove (); | 1247 | cn = cn->itemAbove (); |
1239 | --jump; | 1248 | --jump; |
1240 | } | 1249 | } |
1241 | setCurrentItem ( cn ); | 1250 | setCurrentItem ( cn ); |
1242 | ensureItemVisible ( cn ); | 1251 | ensureItemVisible ( cn ); |
1243 | } else | 1252 | } else |
1244 | QListView::keyPressEvent ( e ) ; | 1253 | Q3ListView::keyPressEvent ( e ) ; |
1245 | e->accept(); | 1254 | e->accept(); |
1246 | break; | 1255 | break; |
1247 | case Qt::Key_I: { | 1256 | case Qt::Key_I: { |
1248 | QListViewItem* cn; | 1257 | Q3ListViewItem* cn; |
1249 | cn = currentItem(); | 1258 | cn = currentItem(); |
1250 | if ( cn ) { | 1259 | if ( cn ) { |
1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1260 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1252 | if ( ci ){ | 1261 | if ( ci ){ |
1253 | //emit showIncidence( ci->data()); | 1262 | //emit showIncidence( ci->data()); |
1254 | cn = cn->nextSibling(); | 1263 | cn = cn->nextSibling(); |
1255 | if ( cn ) { | 1264 | if ( cn ) { |
1256 | setCurrentItem ( cn ); | 1265 | setCurrentItem ( cn ); |
@@ -1260,22 +1269,22 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1260 | } | 1269 | } |
1261 | } | 1270 | } |
1262 | e->accept(); | 1271 | e->accept(); |
1263 | } | 1272 | } |
1264 | break; | 1273 | break; |
1265 | case Qt::Key_Return: | 1274 | case Qt::Key_Return: |
1266 | case Qt::Key_Enter: | 1275 | case Qt::Key_Enter: |
1267 | { | 1276 | { |
1268 | QListViewItem* cn; | 1277 | Q3ListViewItem* cn; |
1269 | cn = currentItem(); | 1278 | cn = currentItem(); |
1270 | if ( cn ) { | 1279 | if ( cn ) { |
1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1280 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1272 | if ( ci ){ | 1281 | if ( ci ){ |
1273 | if ( e->state() == ShiftButton ) | 1282 | if ( e->state() == Qt::ShiftButton ) |
1274 | ci->setSelected( false ); | 1283 | ci->setSelected( false ); |
1275 | else | 1284 | else |
1276 | ci->setSelected( true ); | 1285 | ci->setSelected( true ); |
1277 | cn = cn->nextSibling(); | 1286 | cn = cn->nextSibling(); |
1278 | if ( cn ) { | 1287 | if ( cn ) { |
1279 | setCurrentItem ( cn ); | 1288 | setCurrentItem ( cn ); |
1280 | ensureItemVisible ( cn ); | 1289 | ensureItemVisible ( cn ); |
1281 | } else { | 1290 | } else { |
@@ -1295,47 +1304,47 @@ KOListViewListView::KOListViewListView(KOListView * lv ) | |||
1295 | { | 1304 | { |
1296 | mYMousePos = 0; | 1305 | mYMousePos = 0; |
1297 | setAllColumnsShowFocus( true ); | 1306 | setAllColumnsShowFocus( true ); |
1298 | mPopupTimer = new QTimer(this); | 1307 | mPopupTimer = new QTimer(this); |
1299 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1308 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1300 | #ifndef DESKTOP_VERSION | 1309 | #ifndef DESKTOP_VERSION |
1301 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1310 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1302 | #endif | 1311 | #endif |
1303 | setSelectionMode( QListView::Multi ); | 1312 | setSelectionMode( Q3ListView::Multi ); |
1304 | setMultiSelection( true); | 1313 | setMultiSelection( true); |
1305 | } | 1314 | } |
1306 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1315 | bool KOListViewListView::hasMultiSelection(Q3ListViewItem* item) |
1307 | { | 1316 | { |
1308 | QListViewItem *qitem = firstChild (); | 1317 | Q3ListViewItem *qitem = firstChild (); |
1309 | while ( qitem ) { | 1318 | while ( qitem ) { |
1310 | if ( qitem->isSelected() && item != qitem ) | 1319 | if ( qitem->isSelected() && item != qitem ) |
1311 | return true; | 1320 | return true; |
1312 | qitem = qitem->nextSibling(); | 1321 | qitem = qitem->nextSibling(); |
1313 | } | 1322 | } |
1314 | return false; | 1323 | return false; |
1315 | } | 1324 | } |
1316 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1325 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1317 | { | 1326 | { |
1318 | if (!e) return; | 1327 | if (!e) return; |
1319 | QPoint vp = contentsToViewport(e->pos()); | 1328 | QPoint vp = contentsToViewport(e->pos()); |
1320 | QListViewItem *item = itemAt(vp); | 1329 | Q3ListViewItem *item = itemAt(vp); |
1321 | if (!item) { | 1330 | if (!item) { |
1322 | emit newEvent(); | 1331 | emit newEvent(); |
1323 | return; | 1332 | return; |
1324 | } | 1333 | } |
1325 | KListView::contentsMouseDoubleClickEvent(e); | 1334 | KListView::contentsMouseDoubleClickEvent(e); |
1326 | } | 1335 | } |
1327 | #if 0 | 1336 | #if 0 |
1328 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1337 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1329 | { | 1338 | { |
1330 | //qDebug("contentsMousePressEvent++++ "); | 1339 | //qDebug("contentsMousePressEvent++++ "); |
1331 | KListView::contentsMousePressEvent( e ); | 1340 | KListView::contentsMousePressEvent( e ); |
1332 | if ( e->button() == RightButton ) { | 1341 | if ( e->button() == Qt::RightButton ) { |
1333 | QListViewItem* ci = currentItem(); | 1342 | Q3ListViewItem* ci = currentItem(); |
1334 | clearSelection () ; | 1343 | clearSelection () ; |
1335 | if ( ci ) | 1344 | if ( ci ) |
1336 | ci->setSelected( true ); | 1345 | ci->setSelected( true ); |
1337 | } | 1346 | } |
1338 | } | 1347 | } |
1339 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1348 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1340 | { | 1349 | { |
1341 | KListView::contentsMouseReleaseEvent(e); | 1350 | KListView::contentsMouseReleaseEvent(e); |
@@ -1343,32 +1352,32 @@ void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | |||
1343 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1352 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1344 | { | 1353 | { |
1345 | KListView::contentsMouseMoveEvent(e); | 1354 | KListView::contentsMouseMoveEvent(e); |
1346 | } | 1355 | } |
1347 | #endif | 1356 | #endif |
1348 | void KOListViewListView::popupMenu() | 1357 | void KOListViewListView::popupMenu() |
1349 | { | 1358 | { |
1350 | mPopupTimer->stop(); | 1359 | mPopupTimer->stop(); |
1351 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1360 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, Qt::RightButton , Qt::RightButton ); |
1352 | QApplication::postEvent( this->viewport(), e ); | 1361 | QApplication::postEvent( this->viewport(), e ); |
1353 | 1362 | ||
1354 | } | 1363 | } |
1355 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1364 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1356 | { | 1365 | { |
1357 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); | 1366 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); |
1358 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1367 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1359 | if ( e->button() == LeftButton ) { | 1368 | if ( e->button() == Qt::LeftButton ) { |
1360 | mPopupTimer->start( 600 ); | 1369 | mPopupTimer->start( 600 ); |
1361 | mEventPos = contentsToViewport(e->pos()); | 1370 | mEventPos = contentsToViewport(e->pos()); |
1362 | mEventGlobalPos = e->globalPos(); | 1371 | mEventGlobalPos = e->globalPos(); |
1363 | } | 1372 | } |
1364 | KListView::contentsMousePressEvent( e ); | 1373 | KListView::contentsMousePressEvent( e ); |
1365 | if ( e->button() == RightButton ) { | 1374 | if ( e->button() == Qt::RightButton ) { |
1366 | QListViewItem* ci = currentItem(); | 1375 | Q3ListViewItem* ci = currentItem(); |
1367 | //clearSelection(); | 1376 | //clearSelection(); |
1368 | if ( ci ) | 1377 | if ( ci ) |
1369 | ci->setSelected( true ); | 1378 | ci->setSelected( true ); |
1370 | } | 1379 | } |
1371 | } | 1380 | } |
1372 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1381 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1373 | { | 1382 | { |
1374 | mPopupTimer->stop(); | 1383 | mPopupTimer->stop(); |
@@ -1385,34 +1394,34 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | |||
1385 | else { | 1394 | else { |
1386 | mEventPos = contentsToViewport(e->pos()); | 1395 | mEventPos = contentsToViewport(e->pos()); |
1387 | mEventGlobalPos = e->globalPos(); | 1396 | mEventGlobalPos = e->globalPos(); |
1388 | } | 1397 | } |
1389 | KListView::contentsMouseMoveEvent(e); | 1398 | KListView::contentsMouseMoveEvent(e); |
1390 | } | 1399 | } |
1391 | 1400 | ||
1392 | #define protected public | 1401 | #define protected public |
1393 | #include <qheader.h> | 1402 | #include <q3header.h> |
1394 | #undef protected | 1403 | #undef protected |
1395 | void KOListViewListView::printList() | 1404 | void KOListViewListView::printList() |
1396 | { | 1405 | { |
1397 | #ifdef DESKTOP_VERSION | 1406 | #ifdef DESKTOP_VERSION |
1398 | KOPrintPrefs pp ( this ); | 1407 | KOPrintPrefs pp ( this ); |
1399 | if (!pp.exec() ) | 1408 | if (!pp.exec() ) |
1400 | return; | 1409 | return; |
1401 | int scaleval = pp.printMode() ; | 1410 | int scaleval = pp.printMode() ; |
1402 | 1411 | ||
1403 | QPrinter printer; | 1412 | QPrinter printer; |
1404 | if (!printer.setup() ) | 1413 | if (!printer.setup() ) |
1405 | return; | 1414 | return; |
1406 | clearSelection (); | 1415 | clearSelection (); |
1407 | QPainter p; | 1416 | QPainter p; |
1408 | p.begin ( &printer ); | 1417 | p.begin ( &printer ); |
1409 | p.setFont(font()); | 1418 | p.setFont(font()); |
1410 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 1419 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
1411 | float dx, dy; | 1420 | float dx, dy; |
1412 | int wid = (m.width() * 9)/10; | 1421 | int wid = (m.width() * 9)/10; |
1413 | dx = (float) wid/(float)contentsWidth (); | 1422 | dx = (float) wid/(float)contentsWidth (); |
1414 | dy = (float)(m.height()) / (float)contentsHeight (); | 1423 | dy = (float)(m.height()) / (float)contentsHeight (); |
1415 | float scale; | 1424 | float scale; |
1416 | // scale to fit the width or height of the paper | 1425 | // scale to fit the width or height of the paper |
1417 | if ( dx < dy ) | 1426 | if ( dx < dy ) |
1418 | scale = dx; | 1427 | scale = dx; |
@@ -1438,17 +1447,17 @@ void KOListViewListView::printList() | |||
1438 | const QColorGroup &cg = colorGroup(); | 1447 | const QColorGroup &cg = colorGroup(); |
1439 | KOListViewItem* item = (KOListViewItem* )firstChild(); | 1448 | KOListViewItem* item = (KOListViewItem* )firstChild(); |
1440 | int yOff = 0; | 1449 | int yOff = 0; |
1441 | while ( item ) { | 1450 | while ( item ) { |
1442 | p.translate( 0, yOff ); | 1451 | p.translate( 0, yOff ); |
1443 | p.save(); | 1452 | p.save(); |
1444 | for ( iii = 0; iii < cou; ++iii ) { | 1453 | for ( iii = 0; iii < cou; ++iii ) { |
1445 | int align = columnAlignment( iii ); | 1454 | int align = columnAlignment( iii ); |
1446 | if ( align == AlignAuto ) align = AlignLeft; | 1455 | if ( align == Qt::AlignLeft ) align = Qt::AlignLeft; |
1447 | p.restore(); | 1456 | p.restore(); |
1448 | p.save(); | 1457 | p.save(); |
1449 | p.translate( header()->sectionPos( iii ), 0); | 1458 | p.translate( header()->sectionPos( iii ), 0); |
1450 | item->paintCell( &p, cg, iii, header()->sectionSize (iii), align ); | 1459 | item->paintCell( &p, cg, iii, header()->sectionSize (iii), align ); |
1451 | } | 1460 | } |
1452 | yOff = item->height(); | 1461 | yOff = item->height(); |
1453 | item = (KOListViewItem* )(item->itemBelow()); | 1462 | item = (KOListViewItem* )(item->itemBelow()); |
1454 | p.restore(); | 1463 | p.restore(); |