author | zautrix <zautrix> | 2005-07-03 15:58:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-03 15:58:48 (UTC) |
commit | 9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e (patch) (unidiff) | |
tree | 4e5e6a4e6eac36df79891d61ed1d1cd76ed6105d /korganizer/koeventviewer.cpp | |
parent | 0c632bafd2d058504118dc8957fc4808a784f548 (diff) | |
download | kdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.zip kdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.tar.gz kdepimpi-9be5bd1c7e9ee829dd73f5b4a36a2f4331edf68e.tar.bz2 |
fixes
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f6c252b..2d0bfff 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -81,64 +81,74 @@ void KOEventViewer::printMe() | |||
81 | return; | 81 | return; |
82 | int scaleval = pp.printMode() ; | 82 | int scaleval = pp.printMode() ; |
83 | 83 | ||
84 | QPrinter printer; | 84 | QPrinter printer; |
85 | if (!printer.setup() ) | 85 | if (!printer.setup() ) |
86 | return; | 86 | return; |
87 | QPainter p; | 87 | QPainter p; |
88 | p.begin ( &printer ); | 88 | p.begin ( &printer ); |
89 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 89 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
90 | float dx, dy; | 90 | float dx, dy; |
91 | int wid = (m.width() * 9)/10; | 91 | int wid = (m.width() * 9)/10; |
92 | dx = (float) wid/(float)contentsWidth (); | 92 | dx = (float) wid/(float)contentsWidth (); |
93 | dy = (float)(m.height()) / (float)contentsHeight (); | 93 | dy = (float)(m.height()) / (float)contentsHeight (); |
94 | float scale; | 94 | float scale; |
95 | // scale to fit the width or height of the paper | 95 | // scale to fit the width or height of the paper |
96 | if ( dx < dy ) | 96 | if ( dx < dy ) |
97 | scale = dx; | 97 | scale = dx; |
98 | else | 98 | else |
99 | scale = dy; | 99 | scale = dy; |
100 | 100 | ||
101 | p.translate( m.width()/10,0 ); | 101 | p.translate( m.width()/10,0 ); |
102 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 102 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
103 | p.scale( scale, scale ); | 103 | p.scale( scale, scale ); |
104 | } | 104 | } |
105 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 105 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
106 | p.end(); | 106 | p.end(); |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | } | 109 | } |
110 | void KOEventViewer::setSource(const QString& n) | 110 | void KOEventViewer::setSource(const QString& n) |
111 | { | 111 | { |
112 | 112 | ||
113 | if ( n.left(8) == "todo_uid" ) { | ||
114 | int midstr = 9; | ||
115 | #ifdef DESKTOP_VERSION | ||
116 | midstr = 11; | ||
117 | #endif | ||
118 | qDebug("-%s- ", n.mid(midstr).latin1()); | ||
119 | emit showIncidence( n.mid(midstr) ); | ||
120 | return; | ||
121 | } | ||
122 | |||
113 | if ( n.left(3) == "uid" ) | 123 | if ( n.left(3) == "uid" ) |
114 | #ifdef DESKTOP_VERSION | 124 | #ifdef DESKTOP_VERSION |
115 | { | 125 | { |
116 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 126 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
117 | KABC::AddressBook::Iterator it; | 127 | KABC::AddressBook::Iterator it; |
118 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 128 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
119 | // LR I do not understand, why the uid string is different on zaurus and desktop | 129 | // LR I do not understand, why the uid string is different on zaurus and desktop |
120 | QString uid = "uid://"+(*it).uid(); | 130 | QString uid = "uid://"+(*it).uid(); |
121 | 131 | ||
122 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 132 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
123 | if (n == uid ) { | 133 | if (n == uid ) { |
124 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 134 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
125 | QDialog dia( this,"dia123", true ); | 135 | QDialog dia( this,"dia123", true ); |
126 | dia.setCaption( i18n("Details of attendee") ); | 136 | dia.setCaption( i18n("Details of attendee") ); |
127 | QVBoxLayout lay ( &dia ); | 137 | QVBoxLayout lay ( &dia ); |
128 | KABC::AddresseeView av ( &dia ); | 138 | KABC::AddresseeView av ( &dia ); |
129 | av.setAddressee( (*it) ); | 139 | av.setAddressee( (*it) ); |
130 | lay.addWidget( &av ); | 140 | lay.addWidget( &av ); |
131 | if ( QApplication::desktop()->width() < 480 ) | 141 | if ( QApplication::desktop()->width() < 480 ) |
132 | dia.resize( 220, 240); | 142 | dia.resize( 220, 240); |
133 | else { | 143 | else { |
134 | dia.resize( 400,400); | 144 | dia.resize( 400,400); |
135 | } | 145 | } |
136 | dia.exec(); | 146 | dia.exec(); |
137 | break; | 147 | break; |
138 | } | 148 | } |
139 | } | 149 | } |
140 | return; | 150 | return; |
141 | } | 151 | } |
142 | #else | 152 | #else |
143 | { | 153 | { |
144 | if ( "uid:organizer" == n ) { | 154 | if ( "uid:organizer" == n ) { |
@@ -501,72 +511,84 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
501 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 511 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
502 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 512 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
503 | } | 513 | } |
504 | } | 514 | } |
505 | 515 | ||
506 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 516 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
507 | 517 | ||
508 | formatCategories(event); | 518 | formatCategories(event); |
509 | 519 | ||
510 | formatAttendees(event); | 520 | formatAttendees(event); |
511 | 521 | ||
512 | if ( KOPrefs::instance()->mEVshowCreated ) { | 522 | if ( KOPrefs::instance()->mEVshowCreated ) { |
513 | if(wideScreen ){ | 523 | if(wideScreen ){ |
514 | 524 | ||
515 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 525 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
516 | 526 | ||
517 | } else { | 527 | } else { |
518 | addTag("p",i18n("<b>Created: ") +" </b>"); | 528 | addTag("p",i18n("<b>Created: ") +" </b>"); |
519 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 529 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
520 | } | 530 | } |
521 | } | 531 | } |
522 | if ( KOPrefs::instance()->mEVshowChanged ) { | 532 | if ( KOPrefs::instance()->mEVshowChanged ) { |
523 | if(wideScreen ){ | 533 | if(wideScreen ){ |
524 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 534 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
525 | 535 | ||
526 | } else { | 536 | } else { |
527 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 537 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
528 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 538 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
529 | } | 539 | } |
530 | } | 540 | } |
531 | if ( event->relatedTo() ) { | 541 | if ( event->relatedTo() ) { |
532 | addTag("b",i18n("Parent todo:<br>")); | 542 | addTag("b",i18n("Parent todo:<br>")); |
533 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 543 | |
544 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); | ||
545 | |||
546 | mText += t_name; | ||
547 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; | ||
548 | mText += deTag(event->relatedTo()->summary()); | ||
549 | mText += "</a><br>"; | ||
550 | |||
551 | // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); | ||
534 | } | 552 | } |
535 | QPtrList<Incidence> Relations = event->relations(); | 553 | QPtrList<Incidence> Relations = event->relations(); |
536 | Incidence *to; | 554 | Incidence *to; |
537 | if ( Relations.first() ) | 555 | if ( Relations.first() ) |
538 | addTag("b",i18n("Sub todos:<br>")); | 556 | addTag("b",i18n("Sub todos:<br>")); |
539 | for (to=Relations.first();to;to=Relations.next()) { | 557 | for (to=Relations.first();to;to=Relations.next()) { |
540 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 558 | QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); |
559 | mText += t_name; | ||
560 | mText += "<a href=\"todo_uid:" + to->uid() + "\">"; | ||
561 | mText += deTag(to->summary()); | ||
562 | mText += "</a><br>"; | ||
541 | 563 | ||
542 | } | 564 | } |
543 | 565 | ||
544 | if ( KOPrefs::instance()->mEVshowDetails ) { | 566 | if ( KOPrefs::instance()->mEVshowDetails ) { |
545 | if (!event->description().isEmpty()) { | 567 | if (!event->description().isEmpty()) { |
546 | addTag("p",i18n("<b>Details: </b>")); | 568 | addTag("p",i18n("<b>Details: </b>")); |
547 | addTag("p",deTag(event->description())); | 569 | addTag("p",deTag(event->description())); |
548 | } | 570 | } |
549 | } | 571 | } |
550 | setText(mText); | 572 | setText(mText); |
551 | } | 573 | } |
552 | 574 | ||
553 | void KOEventViewer::formatCategories(Incidence *event) | 575 | void KOEventViewer::formatCategories(Incidence *event) |
554 | { | 576 | { |
555 | if (!event->categoriesStr().isEmpty()) { | 577 | if (!event->categoriesStr().isEmpty()) { |
556 | if (event->categories().count() == 1) { | 578 | if (event->categories().count() == 1) { |
557 | addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); | 579 | addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); |
558 | } else { | 580 | } else { |
559 | addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; | 581 | addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; |
560 | } | 582 | } |
561 | } | 583 | } |
562 | } | 584 | } |
563 | void KOEventViewer::formatAttendees(Incidence *event) | 585 | void KOEventViewer::formatAttendees(Incidence *event) |
564 | { | 586 | { |
565 | QPtrList<Attendee> attendees = event->attendees(); | 587 | QPtrList<Attendee> attendees = event->attendees(); |
566 | if (attendees.count()) { | 588 | if (attendees.count()) { |
567 | 589 | ||
568 | 590 | ||
569 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 591 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
570 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 592 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
571 | addTag("h3",i18n("Organizer")); | 593 | addTag("h3",i18n("Organizer")); |
572 | mText.append("<ul><li>"); | 594 | mText.append("<ul><li>"); |