summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-06 01:23:43 (UTC)
committer zautrix <zautrix>2005-02-06 01:23:43 (UTC)
commit118f5aab05c9ace5612d5c4fd69e7c5a59bed67b (patch) (unidiff)
treee097f3fecb6e2ae692b91ac29e58e6d5a51154c8
parent659f07aa44f44aebb74c83e7319021cfeb87f275 (diff)
downloadkdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.zip
kdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.tar.gz
kdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.tar.bz2
better week choose
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/koagendaview.cpp72
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/mainwindow.cpp62
-rw-r--r--korganizer/mainwindow.h7
-rw-r--r--korganizer/navigatorbar.cpp37
7 files changed, 77 insertions, 111 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
@@ -2,2 +2,7 @@ Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.4 ************
4
5KO/Pi:
6Fixed problem loading translations for summary/location edit boxes in event/todo editor.
7
3********** VERSION 2.0.3 ************ 8********** VERSION 2.0.3 ************
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
@@ -1207,4 +1207,4 @@
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..." },
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 36c66ea..0d36946 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -427,32 +427,3 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
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
@@ -589,16 +560,3 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
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}
@@ -1110,28 +1068,2 @@ void KOAgendaView::fillAgenda()
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());
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index ba9bc93..4a058ce 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -218,3 +218,2 @@ class KOAgendaView : public KOEventView {
218 protected: 218 protected:
219 QLabel * mDummyAllDayRightL;
220 KOAgendaButton* getNewDaylabel(); 219 KOAgendaButton* getNewDaylabel();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e32c18..1c74307 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -286,3 +286,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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;
@@ -556,2 +558,26 @@ void MainWindow::initActions()
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 // ******************
@@ -1318,5 +1344,39 @@ QString MainWindow::syncFileName()
1318} 1344}
1345void 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}
1375void MainWindow::updateWeekNum(const DateList &selectedDates)
1376{
1377 updateWeek( selectedDates.first() );
1378}
1320void MainWindow::processIncidenceSelection( Incidence *incidence ) 1379void MainWindow::processIncidenceSelection( Incidence *incidence )
1321{ 1380{
1381
1322 if ( !incidence ) { 1382 if ( !incidence ) {
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 8dd55ac..076ab94 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -25,2 +25,3 @@ class KSyncProfile;
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar;
26 27
@@ -44,2 +45,4 @@ class MainWindow : public QMainWindow
44 public slots: 45 public slots:
46 void updateWeekNum(const KCal::DateList &);
47 void updateWeek(QDate);
45 virtual void showMaximized (); 48 virtual void showMaximized ();
@@ -86,3 +89,4 @@ class MainWindow : public QMainWindow
86 void disableBR(bool); 89 void disableBR(bool);
87 90 signals:
91 void selectWeek ( int );
88 private slots: 92 private slots:
@@ -118,2 +122,3 @@ class MainWindow : public QMainWindow
118 QAction *mNewSubTodoAction; 122 QAction *mNewSubTodoAction;
123 QPEMenuBar *menuBarWeek;
119 124
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 24de01f..657f98d 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -74,4 +74,3 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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;
@@ -91,9 +90,2 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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 );
@@ -114,4 +106,2 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
114 mPrevMonth->setFlat( true); 106 mPrevMonth->setFlat( true);
115 if ( insertWeek )
116 selWeek->setFlat( true);
117 } 107 }
@@ -137,25 +127,2 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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 );
@@ -178,4 +145,2 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
178 ctrlLayout->addWidget( mNextYear, 3 ); 145 ctrlLayout->addWidget( mNextYear, 3 );
179 if ( insertWeek )
180 ctrlLayout->addWidget( selWeek );
181 146