-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 4 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 72 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 62 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 7 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 39 |
7 files changed, 78 insertions, 112 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 41c60ea..4251283 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,18 +1,23 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.4 ************ | ||
4 | |||
5 | KO/Pi: | ||
6 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | ||
7 | |||
3 | ********** VERSION 2.0.3 ************ | 8 | ********** VERSION 2.0.3 ************ |
4 | 9 | ||
5 | KO/Pi: | 10 | KO/Pi: |
6 | Added feature for changing alarm settings for many items at once: | 11 | Added feature for changing alarm settings for many items at once: |
7 | Open list view (or search dialog), select the desired items and choose in | 12 | Open list view (or search dialog), select the desired items and choose in |
8 | the popup menu: Set alarm for selected... | 13 | the popup menu: Set alarm for selected... |
9 | 14 | ||
10 | Added to the event/todo viewer the option to send an email to | 15 | Added to the event/todo viewer the option to send an email to |
11 | all attendees or all selected (with RSVP) attendees. | 16 | all attendees or all selected (with RSVP) attendees. |
12 | 17 | ||
13 | Made the week-month mode changing in month view faster. | 18 | Made the week-month mode changing in month view faster. |
14 | 19 | ||
15 | Made month view better useable with keyboard. | 20 | Made month view better useable with keyboard. |
16 | Now TAB key jumps to next cell with an event/todo. | 21 | Now TAB key jumps to next cell with an event/todo. |
17 | Scroll in cell with coursor keys, scroll in time (next week) with | 22 | Scroll in cell with coursor keys, scroll in time (next week) with |
18 | Shift/Control + coursorkeys. | 23 | Shift/Control + coursorkeys. |
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 5c18aaa..e9ba8db 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1192,34 +1192,34 @@ | |||
1192 | { "Size %1","Größe %1" }, | 1192 | { "Size %1","Größe %1" }, |
1193 | { "New Agendasize: %1","Neue Agendagröße: %1" }, | 1193 | { "New Agendasize: %1","Neue Agendagröße: %1" }, |
1194 | { " (%1 y.)"," (%1 J.)" }, | 1194 | { " (%1 y.)"," (%1 J.)" }, |
1195 | { "Allday:","Ganztägig:" }, | 1195 | { "Allday:","Ganztägig:" }, |
1196 | { "compl.todos","erled.Todos" }, | 1196 | { "compl.todos","erled.Todos" }, |
1197 | { "Day view","Tagesansicht" }, | 1197 | { "Day view","Tagesansicht" }, |
1198 | { "Next days","Nächste Tage" }, | 1198 | { "Next days","Nächste Tage" }, |
1199 | { "Next week","Nächste Woche" }, | 1199 | { "Next week","Nächste Woche" }, |
1200 | { "Next two weeks","Nächste zwei Wochen" }, | 1200 | { "Next two weeks","Nächste zwei Wochen" }, |
1201 | { "Next month","Nächster Monat" }, | 1201 | { "Next month","Nächster Monat" }, |
1202 | { "Journal view","Journal" }, | 1202 | { "Journal view","Journal" }, |
1203 | { "Display all opened","Zeige alle geöffnet" }, | 1203 | { "Display all opened","Zeige alle geöffnet" }, |
1204 | { "Display all closed","Zeige alle geschlossen" }, | 1204 | { "Display all closed","Zeige alle geschlossen" }, |
1205 | { "Display all flat","Zeige alle flach" }, | 1205 | { "Display all flat","Zeige alle flach" }, |
1206 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, | 1206 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, |
1207 | { "Default todo done color:","Standard Todo erledigt Farbe" }, | 1207 | { "Default todo done color:","Standard Todo erledigt Farbe" }, |
1208 | { "Select week %1-%2","Selektiere Woche %1-%2" }, | 1208 | { "Select week %1-%2","Wähle Woche %1-%2" }, |
1209 | { "Select Week","Selektiere Woche" }, | 1209 | { "Select Week","Wähle Woche" }, |
1210 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, | 1210 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, |
1211 | { "Set Alarm!","Setze Alarm!" }, | 1211 | { "Set Alarm!","Setze Alarm!" }, |
1212 | { "Canged alarm for %1 items","Alarm für %1 Items geändert" }, | 1212 | { "Canged alarm for %1 items","Alarm für %1 Items geändert" }, |
1213 | { " and "," und " }, | 1213 | { " and "," und " }, |
1214 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, | 1214 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, |
1215 | { "Mail to selected","Mail an Ausgewählte" }, | 1215 | { "Mail to selected","Mail an Ausgewählte" }, |
1216 | { "Mail to all","Mail an Alle" }, | 1216 | { "Mail to all","Mail an Alle" }, |
1217 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, | 1217 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, |
1218 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, | 1218 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, |
1219 | { " on"," am" }, | 1219 | { " on"," am" }, |
1220 | { " completed on "," erledigt am " }, | 1220 | { " completed on "," erledigt am " }, |
1221 | { "Save as Event template","Speichere als Vorlage" }, | 1221 | { "Save as Event template","Speichere als Vorlage" }, |
1222 | { "Load Event template","Lade Termin Vorlage" }, | 1222 | { "Load Event template","Lade Termin Vorlage" }, |
1223 | { "Save as Journal template","Speichere als Journal Vorlage" }, | 1223 | { "Save as Journal template","Speichere als Journal Vorlage" }, |
1224 | { "Insert Journal template","Füge Journal Vorlage ein" }, | 1224 | { "Insert Journal template","Füge Journal Vorlage ein" }, |
1225 | { "","" }, | 1225 | { "","" }, |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 36c66ea..0d36946 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -412,62 +412,33 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
429 | |||
430 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); | ||
431 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | ||
432 | new QLabel ( dummyAllDayRight ); | ||
433 | mDummyAllDayRightL->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,QSizePolicy::Fixed ) ); | ||
434 | dummyAllDayRightB->setFlat( true ); | ||
435 | dummyAllDayRightB->setFocusPolicy(NoFocus); | ||
436 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); | ||
437 | |||
438 | QPopupMenu * wpo = new QPopupMenu (this); | ||
439 | QPopupMenu * all = new QPopupMenu (this); | ||
440 | //wpo->insertItem( i18n("W#"), 0 ); | ||
441 | int first = 1; | ||
442 | int i; | ||
443 | for ( i = 1; i < 50; ++i ) { | ||
444 | if ( !(i%10) ) { | ||
445 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
446 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | ||
447 | first = i; | ||
448 | wpo = new QPopupMenu (this); | ||
449 | } | ||
450 | wpo->insertItem( QString::number(i), i ); | ||
451 | } | ||
452 | for ( i = 50; i < 53; ++i ) { | ||
453 | wpo->insertItem( QString::number(i), i); | ||
454 | } | ||
455 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
456 | dummyAllDayRightB->setPopup( all ); | ||
457 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | ||
458 | 429 | ||
459 | // Create event context menu for all day agenda | 430 | // Create event context menu for all day agenda |
460 | mAllDayAgendaPopup = eventPopup(); | 431 | mAllDayAgendaPopup = eventPopup(); |
461 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 432 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
462 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 433 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
463 | 434 | ||
464 | // Create agenda frame | 435 | // Create agenda frame |
465 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 436 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
466 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 437 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
467 | 438 | ||
468 | // create event indicator bars | 439 | // create event indicator bars |
469 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 440 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
470 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 441 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
471 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 442 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
472 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 443 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
473 | agendaFrame); | 444 | agendaFrame); |
@@ -574,46 +545,33 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
574 | mAllDayAgenda, SLOT( deselectItem() ) ); | 545 | mAllDayAgenda, SLOT( deselectItem() ) ); |
575 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 546 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
576 | mAgenda, SLOT( deselectItem() ) ); | 547 | mAgenda, SLOT( deselectItem() ) ); |
577 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 548 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
578 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 549 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
579 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 550 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
580 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 551 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
581 | connect( mAgenda, SIGNAL( resizedSignal() ), | 552 | connect( mAgenda, SIGNAL( resizedSignal() ), |
582 | SLOT( updateConfig( ) ) ); | 553 | SLOT( updateConfig( ) ) ); |
583 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 554 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
584 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 555 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
585 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 556 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
586 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 557 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
587 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 558 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
588 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 559 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
589 | 560 | ||
590 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 561 | |
591 | QFontMetrics fm ( dlf ); | ||
592 | QString dayTest = "30"; | ||
593 | int wid = fm.width( dayTest ); | ||
594 | int maxWid = dummyAllDayRight->width()-2; | ||
595 | int fontPoint = dlf.pointSize(); | ||
596 | while ( wid > maxWid ) { | ||
597 | --fontPoint; | ||
598 | dlf.setPointSize( fontPoint ); | ||
599 | QFontMetrics f( dlf ); | ||
600 | wid = f.width( dayTest ); | ||
601 | } | ||
602 | mDummyAllDayRightL->setFont( dlf ); | ||
603 | mDummyAllDayRightL->setAlignment( AlignHCenter ); | ||
604 | } | 562 | } |
605 | 563 | ||
606 | void KOAgendaView::toggleAllDay() | 564 | void KOAgendaView::toggleAllDay() |
607 | { | 565 | { |
608 | if ( mSplitterAgenda->firstHandle() ) | 566 | if ( mSplitterAgenda->firstHandle() ) |
609 | mSplitterAgenda->firstHandle()->toggle(); | 567 | mSplitterAgenda->firstHandle()->toggle(); |
610 | } | 568 | } |
611 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 569 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
612 | { | 570 | { |
613 | calendar()->addIncidence( inc ); | 571 | calendar()->addIncidence( inc ); |
614 | 572 | ||
615 | if ( incOld ) { | 573 | if ( incOld ) { |
616 | if ( incOld->type() == "Todo" ) | 574 | if ( incOld->type() == "Todo" ) |
617 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 575 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
618 | else | 576 | else |
619 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 577 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
@@ -1095,58 +1053,32 @@ void KOAgendaView::fillAgenda(const QDate &) | |||
1095 | 1053 | ||
1096 | void KOAgendaView::fillAgenda() | 1054 | void KOAgendaView::fillAgenda() |
1097 | { | 1055 | { |
1098 | if ( globalFlagBlockStartup ) | 1056 | if ( globalFlagBlockStartup ) |
1099 | return; | 1057 | return; |
1100 | if ( globalFlagBlockAgenda == 1 ) | 1058 | if ( globalFlagBlockAgenda == 1 ) |
1101 | return; | 1059 | return; |
1102 | //if ( globalFlagBlockAgenda == 2 ) | 1060 | //if ( globalFlagBlockAgenda == 2 ) |
1103 | //globalFlagBlockAgenda = 0; | 1061 | //globalFlagBlockAgenda = 0; |
1104 | // globalFlagBlockPainting = false; | 1062 | // globalFlagBlockPainting = false; |
1105 | if ( globalFlagBlockAgenda == 0 ) | 1063 | if ( globalFlagBlockAgenda == 0 ) |
1106 | globalFlagBlockAgenda = 1; | 1064 | globalFlagBlockAgenda = 1; |
1107 | // clearView(); | 1065 | // clearView(); |
1108 | //qDebug("fillAgenda()++++ "); | 1066 | //qDebug("fillAgenda()++++ "); |
1109 | globalFlagBlockAgendaItemPaint = 1; | 1067 | globalFlagBlockAgendaItemPaint = 1; |
1110 | 1068 | ||
1111 | int weekNum = 0; | ||
1112 | QDate seda = mSelectedDates.first(); | ||
1113 | QDate d = QDate ( seda.year(), 1,1); | ||
1114 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1115 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1116 | if ( seda.year() != d.year() ) { | ||
1117 | if ( d.dayOfWeek() > 4 ) | ||
1118 | d = QDate ( seda.year(), 1,1); | ||
1119 | else | ||
1120 | weekNum = 1; | ||
1121 | } else { | ||
1122 | QDate dd( seda.year()+1, 1,1); | ||
1123 | if ( dd.dayOfWeek() <= 4 ) | ||
1124 | weekNum = 1; | ||
1125 | } | ||
1126 | } | ||
1127 | if ( weekNum == 0 ){ | ||
1128 | int dow = d.dayOfWeek(); | ||
1129 | if ( dow <= 4 ) | ||
1130 | d = d.addDays( 1-dow ); | ||
1131 | else // 5,6,7 | ||
1132 | d = d.addDays( 8-dow ); | ||
1133 | // we have the first week of the year.we are on monday | ||
1134 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1135 | } | ||
1136 | mDummyAllDayRightL->setText( QString::number( weekNum) ); | ||
1137 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1069 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1138 | mAgenda->changeColumns(mSelectedDates.count()); | 1070 | mAgenda->changeColumns(mSelectedDates.count()); |
1139 | qApp->processEvents(); | 1071 | qApp->processEvents(); |
1140 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1072 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1141 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1073 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1142 | setHolidayMasks(); | 1074 | setHolidayMasks(); |
1143 | 1075 | ||
1144 | //mAgenda->hideUnused(); | 1076 | //mAgenda->hideUnused(); |
1145 | //mAllDayAgenda->hideUnused(); | 1077 | //mAllDayAgenda->hideUnused(); |
1146 | 1078 | ||
1147 | // mAgenda->blockNextRepaint( false ); | 1079 | // mAgenda->blockNextRepaint( false ); |
1148 | // mAgenda->viewport()->repaint(); | 1080 | // mAgenda->viewport()->repaint(); |
1149 | // mAgenda->blockNextRepaint( true ); | 1081 | // mAgenda->blockNextRepaint( true ); |
1150 | mMinY.resize(mSelectedDates.count()); | 1082 | mMinY.resize(mSelectedDates.count()); |
1151 | mMaxY.resize(mSelectedDates.count()); | 1083 | mMaxY.resize(mSelectedDates.count()); |
1152 | 1084 | ||
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index ba9bc93..4a058ce 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -203,33 +203,32 @@ class KOAgendaView : public KOEventView { | |||
203 | 203 | ||
204 | void setExpandedButton( bool expanded ); | 204 | void setExpandedButton( bool expanded ); |
205 | void scrollOneHourUp(); | 205 | void scrollOneHourUp(); |
206 | void scrollOneHourDown(); | 206 | void scrollOneHourDown(); |
207 | void addToCalSlot(Incidence *, Incidence *); | 207 | void addToCalSlot(Incidence *, Incidence *); |
208 | 208 | ||
209 | signals: | 209 | signals: |
210 | void showDateView( int, QDate ); | 210 | void showDateView( int, QDate ); |
211 | void newTodoSignal( QDateTime ,bool ); | 211 | void newTodoSignal( QDateTime ,bool ); |
212 | void toggleExpand(); | 212 | void toggleExpand(); |
213 | void selectWeekNum( int ); | 213 | void selectWeekNum( int ); |
214 | void todoMoved( Todo *, int ); | 214 | void todoMoved( Todo *, int ); |
215 | void incidenceChanged(Incidence * , int ); | 215 | void incidenceChanged(Incidence * , int ); |
216 | // void cloneIncidenceSignal(Incidence *); | 216 | // void cloneIncidenceSignal(Incidence *); |
217 | 217 | ||
218 | protected: | 218 | protected: |
219 | QLabel * mDummyAllDayRightL; | ||
220 | KOAgendaButton* getNewDaylabel(); | 219 | KOAgendaButton* getNewDaylabel(); |
221 | bool mBlockUpdating; | 220 | bool mBlockUpdating; |
222 | int mUpcomingWidth; | 221 | int mUpcomingWidth; |
223 | /** Fill agenda beginning with date startDate */ | 222 | /** Fill agenda beginning with date startDate */ |
224 | void fillAgenda(const QDate &startDate); | 223 | void fillAgenda(const QDate &startDate); |
225 | void resizeEvent( QResizeEvent* e ); | 224 | void resizeEvent( QResizeEvent* e ); |
226 | /** Fill agenda using the current set value for the start date */ | 225 | /** Fill agenda using the current set value for the start date */ |
227 | void fillAgenda(); | 226 | void fillAgenda(); |
228 | 227 | ||
229 | /** Create labels for the selected dates. */ | 228 | /** Create labels for the selected dates. */ |
230 | void createDayLabels(); | 229 | void createDayLabels(); |
231 | 230 | ||
232 | /** | 231 | /** |
233 | Set the masks on the agenda widgets indicating, which days are holidays. | 232 | Set the masks on the agenda widgets indicating, which days are holidays. |
234 | */ | 233 | */ |
235 | void setHolidayMasks(); | 234 | void setHolidayMasks(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9e32c18..1c74307 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -271,33 +271,35 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
271 | 271 | ||
272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
273 | if ( showWarning ) { | 273 | if ( showWarning ) { |
274 | KMessageBox::information( this, | 274 | KMessageBox::information( this, |
275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
276 | qApp->processEvents(); | 276 | qApp->processEvents(); |
277 | mView->dialogManager()->showSyncOptions(); | 277 | mView->dialogManager()->showSyncOptions(); |
278 | } | 278 | } |
279 | 279 | ||
280 | //US listen for result adressed from Ka/Pi | 280 | //US listen for result adressed from Ka/Pi |
281 | #ifndef DESKTOP_VERSION | 281 | #ifndef DESKTOP_VERSION |
282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
283 | #endif | 283 | #endif |
284 | #ifndef DESKTOP_VERSION | 284 | #ifndef DESKTOP_VERSION |
285 | infrared = 0; | 285 | infrared = 0; |
286 | #endif | 286 | #endif |
287 | 287 | updateWeek( mView->startDate() ); | |
288 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | ||
289 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | ||
288 | mBRdisabled = false; | 290 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 291 | //toggleBeamReceive(); |
290 | } | 292 | } |
291 | MainWindow::~MainWindow() | 293 | MainWindow::~MainWindow() |
292 | { | 294 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 295 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 296 | //save toolbar location |
295 | delete mCalendar; | 297 | delete mCalendar; |
296 | delete mSyncManager; | 298 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 299 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 300 | if ( infrared ) |
299 | delete infrared; | 301 | delete infrared; |
300 | #endif | 302 | #endif |
301 | 303 | ||
302 | 304 | ||
303 | } | 305 | } |
@@ -541,32 +543,56 @@ void MainWindow::initActions() | |||
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 543 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 544 | menuBar1->insertItem( i18n("ME"), menuBar); |
543 | menuBar->insertItem( i18n("File"), importMenu ); | 545 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 546 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 547 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 548 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 549 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 550 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 551 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 552 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 553 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 554 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 555 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 556 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 557 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | 558 | ||
559 | menuBarWeek = new QPEMenuBar( iconToolBar ); | ||
560 | QPopupMenu * wpo = new QPopupMenu (this); | ||
561 | QPopupMenu * all = new QPopupMenu (this); | ||
562 | //wpo->insertItem( i18n("W#"), 0 ); | ||
563 | int first = 1; | ||
564 | int i; | ||
565 | for ( i = 1; i < 50; ++i ) { | ||
566 | if ( !(i%10) ) { | ||
567 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
568 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
569 | first = i; | ||
570 | wpo = new QPopupMenu (this); | ||
571 | } | ||
572 | wpo->insertItem( QString::number(i), i ); | ||
573 | } | ||
574 | for ( i = 50; i < 53; ++i ) { | ||
575 | wpo->insertItem( QString::number(i), i); | ||
576 | } | ||
577 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
578 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
579 | menuBarWeek->insertItem( "00",all,1); | ||
580 | menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); | ||
581 | |||
582 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | ||
557 | // ****************** | 583 | // ****************** |
558 | QAction *action; | 584 | QAction *action; |
559 | QIconSet icon; | 585 | QIconSet icon; |
560 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 586 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
561 | configureToolBarMenu->setCheckable( true ); | 587 | configureToolBarMenu->setCheckable( true ); |
562 | 588 | ||
563 | QString pathString = ""; | 589 | QString pathString = ""; |
564 | if ( !p->mToolBarMiniIcons ) { | 590 | if ( !p->mToolBarMiniIcons ) { |
565 | if ( QApplication::desktop()->width() < 480 ) | 591 | if ( QApplication::desktop()->width() < 480 ) |
566 | pathString += "icons16/"; | 592 | pathString += "icons16/"; |
567 | } else | 593 | } else |
568 | pathString += "iconsmini/"; | 594 | pathString += "iconsmini/"; |
569 | configureAgendaMenu->setCheckable( true ); | 595 | configureAgendaMenu->setCheckable( true ); |
570 | int iii ; | 596 | int iii ; |
571 | for ( iii = 1;iii<= 10 ;++iii ){ | 597 | for ( iii = 1;iii<= 10 ;++iii ){ |
572 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 598 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
@@ -1303,35 +1329,69 @@ void MainWindow::aboutKnownBugs() | |||
1303 | delete msg; | 1329 | delete msg; |
1304 | 1330 | ||
1305 | } | 1331 | } |
1306 | 1332 | ||
1307 | QString MainWindow::defaultFileName() | 1333 | QString MainWindow::defaultFileName() |
1308 | { | 1334 | { |
1309 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1335 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1310 | } | 1336 | } |
1311 | QString MainWindow::syncFileName() | 1337 | QString MainWindow::syncFileName() |
1312 | { | 1338 | { |
1313 | #ifdef DESKTOP_VERSION | 1339 | #ifdef DESKTOP_VERSION |
1314 | return locateLocal( "tmp", "synccalendar.ics" ); | 1340 | return locateLocal( "tmp", "synccalendar.ics" ); |
1315 | #else | 1341 | #else |
1316 | return QString( "/tmp/synccalendar.ics" ); | 1342 | return QString( "/tmp/synccalendar.ics" ); |
1317 | #endif | 1343 | #endif |
1318 | } | 1344 | } |
1345 | void MainWindow::updateWeek(QDate seda) | ||
1346 | { | ||
1347 | int weekNum = 0; | ||
1348 | QDate d = QDate ( seda.year(), 1,1); | ||
1349 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1350 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1351 | if ( seda.year() != d.year() ) { | ||
1352 | if ( d.dayOfWeek() > 4 ) | ||
1353 | d = QDate ( seda.year(), 1,1); | ||
1354 | else | ||
1355 | weekNum = 1; | ||
1356 | } else { | ||
1357 | QDate dd( seda.year()+1, 1,1); | ||
1358 | if ( dd.dayOfWeek() <= 4 ) | ||
1359 | weekNum = 1; | ||
1360 | } | ||
1361 | } | ||
1362 | if ( weekNum == 0 ){ | ||
1363 | int dow = d.dayOfWeek(); | ||
1364 | if ( dow <= 4 ) | ||
1365 | d = d.addDays( 1-dow ); | ||
1366 | else // 5,6,7 | ||
1367 | d = d.addDays( 8-dow ); | ||
1368 | // we have the first week of the year.we are on monday | ||
1369 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1370 | } | ||
1371 | //qDebug("weeknum %s ", QString::number( weekNum).latin1()); | ||
1372 | menuBarWeek-> changeItem(1, QString::number( weekNum) ); | ||
1319 | 1373 | ||
1374 | } | ||
1375 | void MainWindow::updateWeekNum(const DateList &selectedDates) | ||
1376 | { | ||
1377 | updateWeek( selectedDates.first() ); | ||
1378 | } | ||
1320 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1379 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1321 | { | 1380 | { |
1381 | |||
1322 | if ( !incidence ) { | 1382 | if ( !incidence ) { |
1323 | enableIncidenceActions( false ); | 1383 | enableIncidenceActions( false ); |
1324 | 1384 | ||
1325 | mNewSubTodoAction->setEnabled( false ); | 1385 | mNewSubTodoAction->setEnabled( false ); |
1326 | setCaptionToDates(); | 1386 | setCaptionToDates(); |
1327 | return; | 1387 | return; |
1328 | 1388 | ||
1329 | } | 1389 | } |
1330 | 1390 | ||
1331 | //KGlobal::locale()->formatDateTime(nextA, true); | 1391 | //KGlobal::locale()->formatDateTime(nextA, true); |
1332 | QString startString = ""; | 1392 | QString startString = ""; |
1333 | if ( incidence->type() != "Todo" ) { | 1393 | if ( incidence->type() != "Todo" ) { |
1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1394 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1335 | if ( incidence->doesFloat() ) { | 1395 | if ( incidence->doesFloat() ) { |
1336 | startString += ": "+incidence->dtStartDateStr( true ); | 1396 | startString += ": "+incidence->dtStartDateStr( true ); |
1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1397 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8dd55ac..076ab94 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -10,51 +10,54 @@ | |||
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
21 | 21 | ||
22 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | class QPEMenuBar; | ||
26 | 27 | ||
27 | 28 | ||
28 | namespace KCal { | 29 | namespace KCal { |
29 | class CalendarLocal; | 30 | class CalendarLocal; |
30 | } | 31 | } |
31 | 32 | ||
32 | using namespace KCal; | 33 | using namespace KCal; |
33 | 34 | ||
34 | class MainWindow : public QMainWindow | 35 | class MainWindow : public QMainWindow |
35 | { | 36 | { |
36 | Q_OBJECT | 37 | Q_OBJECT |
37 | public: | 38 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 39 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
39 | ~MainWindow(); | 40 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 41 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 43 | static QString syncFileName(); |
43 | static QString resourcePath(); | 44 | static QString resourcePath(); |
44 | public slots: | 45 | public slots: |
46 | void updateWeekNum(const KCal::DateList &); | ||
47 | void updateWeek(QDate); | ||
45 | virtual void showMaximized (); | 48 | virtual void showMaximized (); |
46 | void configureAgenda( int ); | 49 | void configureAgenda( int ); |
47 | void recieve( const QCString& msg, const QByteArray& data ); | 50 | void recieve( const QCString& msg, const QByteArray& data ); |
48 | protected slots: | 51 | protected slots: |
49 | void setCaptionToDates(); | 52 | void setCaptionToDates(); |
50 | void about(); | 53 | void about(); |
51 | void licence(); | 54 | void licence(); |
52 | void faq(); | 55 | void faq(); |
53 | void usertrans(); | 56 | void usertrans(); |
54 | void features(); | 57 | void features(); |
55 | void synchowto(); | 58 | void synchowto(); |
56 | void kdesynchowto(); | 59 | void kdesynchowto(); |
57 | void multisynchowto(); | 60 | void multisynchowto(); |
58 | void whatsNew(); | 61 | void whatsNew(); |
59 | void keyBindings(); | 62 | void keyBindings(); |
60 | void aboutAutoSaving();; | 63 | void aboutAutoSaving();; |
@@ -71,64 +74,66 @@ class MainWindow : public QMainWindow | |||
71 | 74 | ||
72 | void slotModifiedChanged( bool ); | 75 | void slotModifiedChanged( bool ); |
73 | 76 | ||
74 | void save(); | 77 | void save(); |
75 | void saveStopTimer(); | 78 | void saveStopTimer(); |
76 | void configureToolBar( int ); | 79 | void configureToolBar( int ); |
77 | void printSel(); | 80 | void printSel(); |
78 | void printCal(); | 81 | void printCal(); |
79 | void saveCalendar(); | 82 | void saveCalendar(); |
80 | void loadCalendar(); | 83 | void loadCalendar(); |
81 | void exportVCalendar(); | 84 | void exportVCalendar(); |
82 | void fillFilterMenu(); | 85 | void fillFilterMenu(); |
83 | void selectFilter( int ); | 86 | void selectFilter( int ); |
84 | void exportToPhone( int ); | 87 | void exportToPhone( int ); |
85 | void toggleBeamReceive(); | 88 | void toggleBeamReceive(); |
86 | void disableBR(bool); | 89 | void disableBR(bool); |
87 | 90 | signals: | |
91 | void selectWeek ( int ); | ||
88 | private slots: | 92 | private slots: |
89 | void showConfigureAgenda(); | 93 | void showConfigureAgenda(); |
90 | void getFile( bool ); | 94 | void getFile( bool ); |
91 | void syncFileRequest(); | 95 | void syncFileRequest(); |
92 | 96 | ||
93 | protected: | 97 | protected: |
94 | void displayText( QString, QString); | 98 | void displayText( QString, QString); |
95 | void enableIncidenceActions( bool ); | 99 | void enableIncidenceActions( bool ); |
96 | 100 | ||
97 | private: | 101 | private: |
98 | bool mBRdisabled; | 102 | bool mBRdisabled; |
99 | #ifndef DESKTOP_VERSION | 103 | #ifndef DESKTOP_VERSION |
100 | QCopChannel* infrared; | 104 | QCopChannel* infrared; |
101 | #endif | 105 | #endif |
102 | QAction* brAction; | 106 | QAction* brAction; |
103 | KSyncManager* mSyncManager; | 107 | KSyncManager* mSyncManager; |
104 | bool mClosed; | 108 | bool mClosed; |
105 | void saveOnClose(); | 109 | void saveOnClose(); |
106 | bool mFlagKeyPressed; | 110 | bool mFlagKeyPressed; |
107 | bool mBlockAtStartup; | 111 | bool mBlockAtStartup; |
108 | QPEToolBar *iconToolBar; | 112 | QPEToolBar *iconToolBar; |
109 | void initActions(); | 113 | void initActions(); |
110 | void setDefaultPreferences(); | 114 | void setDefaultPreferences(); |
111 | void keyPressEvent ( QKeyEvent * ) ; | 115 | void keyPressEvent ( QKeyEvent * ) ; |
112 | void keyReleaseEvent ( QKeyEvent * ) ; | 116 | void keyReleaseEvent ( QKeyEvent * ) ; |
113 | QPopupMenu *configureToolBarMenu; | 117 | QPopupMenu *configureToolBarMenu; |
114 | QPopupMenu *selectFilterMenu; | 118 | QPopupMenu *selectFilterMenu; |
115 | QPopupMenu *configureAgendaMenu, *syncMenu; | 119 | QPopupMenu *configureAgendaMenu, *syncMenu; |
116 | CalendarLocal *mCalendar; | 120 | CalendarLocal *mCalendar; |
117 | CalendarView *mView; | 121 | CalendarView *mView; |
118 | QAction *mNewSubTodoAction; | 122 | QAction *mNewSubTodoAction; |
123 | QPEMenuBar *menuBarWeek; | ||
119 | 124 | ||
120 | QAction *mShowAction; | 125 | QAction *mShowAction; |
121 | QAction *mEditAction; | 126 | QAction *mEditAction; |
122 | QAction *mDeleteAction; | 127 | QAction *mDeleteAction; |
123 | QAction *mCloneAction; | 128 | QAction *mCloneAction; |
124 | QAction *mMoveAction; | 129 | QAction *mMoveAction; |
125 | QAction *mBeamAction; | 130 | QAction *mBeamAction; |
126 | QAction *mCancelAction; | 131 | QAction *mCancelAction; |
127 | 132 | ||
128 | QAction *mToggleNav; | 133 | QAction *mToggleNav; |
129 | QAction *mToggleFilter; | 134 | QAction *mToggleFilter; |
130 | QAction *mToggleAllday; | 135 | QAction *mToggleAllday; |
131 | 136 | ||
132 | 137 | ||
133 | void closeEvent( QCloseEvent* ce ); | 138 | void closeEvent( QCloseEvent* ce ); |
134 | SimpleAlarmClient mAlarmClient; | 139 | SimpleAlarmClient mAlarmClient; |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 24de01f..657f98d 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -59,138 +59,103 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
60 | mCtrlFrame->setLineWidth(1); | 60 | mCtrlFrame->setLineWidth(1); |
61 | 61 | ||
62 | topLayout->addWidget( mCtrlFrame ); | 62 | topLayout->addWidget( mCtrlFrame ); |
63 | 63 | ||
64 | QFont tfont = font(); | 64 | QFont tfont = font(); |
65 | if ( QApplication::desktop()->width() >= 480 ) | 65 | if ( QApplication::desktop()->width() >= 480 ) |
66 | tfont.setPointSize(tfont.pointSize()+2); | 66 | tfont.setPointSize(tfont.pointSize()+2); |
67 | tfont.setBold(true); | 67 | tfont.setBold(true); |
68 | 68 | ||
69 | bool isRTL = KOGlobals::self()->reverseLayout(); | 69 | bool isRTL = KOGlobals::self()->reverseLayout(); |
70 | #ifndef DESKTOP_VERSION | 70 | #ifndef DESKTOP_VERSION |
71 | bool isDesktop = false; | 71 | bool isDesktop = false; |
72 | #else | 72 | #else |
73 | bool isDesktop = true; | 73 | bool isDesktop = true; |
74 | #endif | 74 | #endif |
75 | bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; | 75 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
76 | if ( insertWeek && QApplication::desktop()->width() > 320 ) | ||
77 | isDesktop = true; | 76 | isDesktop = true; |
78 | // Create backward navigation buttons | 77 | // Create backward navigation buttons |
79 | mPrevYear = new QPushButton( mCtrlFrame ); | 78 | mPrevYear = new QPushButton( mCtrlFrame ); |
80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 79 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 80 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
82 | 81 | ||
83 | mPrevMonth = new QPushButton( mCtrlFrame ); | 82 | mPrevMonth = new QPushButton( mCtrlFrame ); |
84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 83 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 84 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
86 | 85 | ||
87 | // Create forward navigation buttons | 86 | // Create forward navigation buttons |
88 | mNextMonth = new QPushButton( mCtrlFrame ); | 87 | mNextMonth = new QPushButton( mCtrlFrame ); |
89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 88 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
90 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 89 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
91 | 90 | ||
92 | QPushButton * selWeek = 0; | ||
93 | if ( insertWeek ) { | ||
94 | selWeek = new QPushButton( mCtrlFrame ); | ||
95 | QToolTip::add( selWeek, i18n("Select Week") ); | ||
96 | selWeek->setFocusPolicy(NoFocus); | ||
97 | } | ||
98 | |||
99 | mNextYear = new QPushButton( mCtrlFrame ); | 91 | mNextYear = new QPushButton( mCtrlFrame ); |
100 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 92 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
101 | QToolTip::add( mNextYear, i18n("Next Year") ); | 93 | QToolTip::add( mNextYear, i18n("Next Year") ); |
102 | mSelectMonth = new QPushButton( mCtrlFrame ); | 94 | mSelectMonth = new QPushButton( mCtrlFrame ); |
103 | // Create month name label | 95 | // Create month name label |
104 | //selectMonth->setFont( tfont ); | 96 | //selectMonth->setFont( tfont ); |
105 | // selectMonth->setAlignment( AlignCenter ); | 97 | // selectMonth->setAlignment( AlignCenter ); |
106 | //mDateLabel = new QLabel( selectMonth ); | 98 | //mDateLabel = new QLabel( selectMonth ); |
107 | //mDateLabel->setFont( tfont ); | 99 | //mDateLabel->setFont( tfont ); |
108 | //mDateLabel->setAlignment( AlignCenter ); | 100 | //mDateLabel->setAlignment( AlignCenter ); |
109 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 101 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
110 | mNextMonth->setFlat( true); | 102 | mNextMonth->setFlat( true); |
111 | mNextYear->setFlat( true); | 103 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 104 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 105 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 106 | mPrevMonth->setFlat( true); |
115 | if ( insertWeek ) | ||
116 | selWeek->setFlat( true); | ||
117 | } | 107 | } |
118 | mSelectMonth->setFont( tfont ); | 108 | mSelectMonth->setFont( tfont ); |
119 | // Set minimum width to width of widest month name label | 109 | // Set minimum width to width of widest month name label |
120 | int i; | 110 | int i; |
121 | int maxwidth = 0; | 111 | int maxwidth = 0; |
122 | QFontMetrics fm ( mSelectMonth->font() ); | 112 | QFontMetrics fm ( mSelectMonth->font() ); |
123 | int width = fm.width("September '00" ); | 113 | int width = fm.width("September '00" ); |
124 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 114 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
125 | // ++i ) { | 115 | // ++i ) { |
126 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 116 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
127 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 117 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
128 | // int width = fm.width("September 2000" ); | 118 | // int width = fm.width("September 2000" ); |
129 | // if ( width > maxwidth ) maxwidth = width; | 119 | // if ( width > maxwidth ) maxwidth = width; |
130 | // } | 120 | // } |
131 | maxwidth = width+2; | 121 | maxwidth = width+2; |
132 | int size = fm.height()+2; | 122 | int size = fm.height()+2; |
133 | if ( QApplication::desktop()->width() >= 480 ) { | 123 | if ( QApplication::desktop()->width() >= 480 ) { |
134 | size += 6; | 124 | size += 6; |
135 | maxwidth+= 6; | 125 | maxwidth+= 6; |
136 | } | 126 | } |
137 | 127 | ||
138 | if ( insertWeek ) { | ||
139 | QPopupMenu * wpo = new QPopupMenu (this); | ||
140 | QPopupMenu * all = new QPopupMenu (this); | ||
141 | //wpo->insertItem( i18n("W#"), 0 ); | ||
142 | int first = 1; | ||
143 | for ( i = 1; i < 50; ++i ) { | ||
144 | if ( !(i%10) ) { | ||
145 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
146 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
147 | first = i; | ||
148 | wpo = new QPopupMenu (this); | ||
149 | } | ||
150 | wpo->insertItem( QString::number(i), i ); | ||
151 | } | ||
152 | for ( i = 50; i < 53; ++i ) { | ||
153 | wpo->insertItem( QString::number(i), i); | ||
154 | } | ||
155 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
156 | selWeek->setPopup( all ); | ||
157 | selWeek->setFixedWidth( (size/5)*4 ); | ||
158 | selWeek->setFixedHeight( size ); | ||
159 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
160 | } | ||
161 | mSelectMonth->setFixedWidth( maxwidth ); | 128 | mSelectMonth->setFixedWidth( maxwidth ); |
162 | mSelectMonth->setFixedHeight( size ); | 129 | mSelectMonth->setFixedHeight( size ); |
163 | mPrevYear->setFixedHeight( size ); | 130 | mPrevYear->setFixedHeight( size ); |
164 | mPrevMonth->setFixedHeight( size ); | 131 | mPrevMonth->setFixedHeight( size ); |
165 | mNextMonth->setFixedHeight( size ); | 132 | mNextMonth->setFixedHeight( size ); |
166 | mNextYear->setFixedHeight ( size ); | 133 | mNextYear->setFixedHeight ( size ); |
167 | // set up control frame layout | 134 | // set up control frame layout |
168 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 135 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
169 | ctrlLayout->addWidget( mPrevYear, 3 ); | 136 | ctrlLayout->addWidget( mPrevYear, 3 ); |
170 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 137 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
171 | //ctrlLayout->addStretch( 1 ); | 138 | //ctrlLayout->addStretch( 1 ); |
172 | // ctrlLayout->addSpacing( 1 ); | 139 | // ctrlLayout->addSpacing( 1 ); |
173 | // ctrlLayout->addWidget( mDateLabel ); | 140 | // ctrlLayout->addWidget( mDateLabel ); |
174 | ctrlLayout->addWidget( mSelectMonth ); | 141 | ctrlLayout->addWidget( mSelectMonth ); |
175 | // ctrlLayout->addSpacing( 1 ); | 142 | // ctrlLayout->addSpacing( 1 ); |
176 | // ctrlLayout->addStretch( 1 ); | 143 | // ctrlLayout->addStretch( 1 ); |
177 | ctrlLayout->addWidget( mNextMonth, 3 ); | 144 | ctrlLayout->addWidget( mNextMonth, 3 ); |
178 | ctrlLayout->addWidget( mNextYear, 3 ); | 145 | ctrlLayout->addWidget( mNextYear, 3 ); |
179 | if ( insertWeek ) | ||
180 | ctrlLayout->addWidget( selWeek ); | ||
181 | 146 | ||
182 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 147 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
183 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 148 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
184 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 149 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
185 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 150 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
186 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 151 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
187 | mPrevYear->setFocusPolicy(NoFocus); | 152 | mPrevYear->setFocusPolicy(NoFocus); |
188 | mPrevMonth->setFocusPolicy(NoFocus); | 153 | mPrevMonth->setFocusPolicy(NoFocus); |
189 | mNextMonth->setFocusPolicy(NoFocus); | 154 | mNextMonth->setFocusPolicy(NoFocus); |
190 | mNextYear->setFocusPolicy(NoFocus); | 155 | mNextYear->setFocusPolicy(NoFocus); |
191 | mSelectMonth->setFocusPolicy(NoFocus); | 156 | mSelectMonth->setFocusPolicy(NoFocus); |
192 | 157 | ||
193 | } | 158 | } |
194 | 159 | ||
195 | NavigatorBar::~NavigatorBar() | 160 | NavigatorBar::~NavigatorBar() |
196 | { | 161 | { |