From 118f5aab05c9ace5612d5c4fd69e7c5a59bed67b Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 06 Feb 2005 01:23:43 +0000 Subject: better week choose --- 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,5 +1,10 @@ Info about the changes in new versions of KDE-Pim/Pi +********** VERSION 2.0.4 ************ + +KO/Pi: +Fixed problem loading translations for summary/location edit boxes in event/todo editor. + ********** VERSION 2.0.3 ************ KO/Pi: 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 @@ -1205,8 +1205,8 @@ { "Display all flat","Zeige alle flach" }, { "

Completed on %1

","

Erledigt am %1

" }, { "Default todo done color:","Standard Todo erledigt Farbe" }, -{ "Select week %1-%2","Selektiere Woche %1-%2" }, -{ "Select Week","Selektiere Woche" }, +{ "Select week %1-%2","Wähle Woche %1-%2" }, +{ "Select Week","Wähle Woche" }, { "Set alarm for selected...","Setze Alarm für Selekt..." }, { "Set Alarm!","Setze Alarm!" }, { "Canged alarm for %1 items","Alarm für %1 Items geändert" }, diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 36c66ea..0d36946 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -425,36 +425,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : mExpandButton->setFocusPolicy(NoFocus); mAllDayAgenda = new KOAgenda(1,mAllDayFrame); mAllDayAgenda->setFocusPolicy(NoFocus); - QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); - - mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); - QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); - new QLabel ( dummyAllDayRight ); - mDummyAllDayRightL->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,QSizePolicy::Fixed ) ); - dummyAllDayRightB->setFlat( true ); - dummyAllDayRightB->setFocusPolicy(NoFocus); - dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); - - QPopupMenu * wpo = new QPopupMenu (this); - QPopupMenu * all = new QPopupMenu (this); - //wpo->insertItem( i18n("W#"), 0 ); - int first = 1; - int i; - for ( i = 1; i < 50; ++i ) { - if ( !(i%10) ) { - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); - first = i; - wpo = new QPopupMenu (this); - } - wpo->insertItem( QString::number(i), i ); - } - for ( i = 50; i < 53; ++i ) { - wpo->insertItem( QString::number(i), i); - } - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - dummyAllDayRightB->setPopup( all ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); + QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); // Create event context menu for all day agenda mAllDayAgendaPopup = eventPopup(); @@ -587,20 +558,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); - QFont dlf = KOPrefs::instance()->mTimeLabelsFont; - QFontMetrics fm ( dlf ); - QString dayTest = "30"; - int wid = fm.width( dayTest ); - int maxWid = dummyAllDayRight->width()-2; - int fontPoint = dlf.pointSize(); - while ( wid > maxWid ) { - --fontPoint; - dlf.setPointSize( fontPoint ); - QFontMetrics f( dlf ); - wid = f.width( dayTest ); - } - mDummyAllDayRightL->setFont( dlf ); - mDummyAllDayRightL->setAlignment( AlignHCenter ); + } void KOAgendaView::toggleAllDay() @@ -1108,32 +1066,6 @@ void KOAgendaView::fillAgenda() //qDebug("fillAgenda()++++ "); globalFlagBlockAgendaItemPaint = 1; - int weekNum = 0; - QDate seda = mSelectedDates.first(); - QDate d = QDate ( seda.year(), 1,1); - seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday - if ( seda.addDays(6).year() != seda.year() ) { - if ( seda.year() != d.year() ) { - if ( d.dayOfWeek() > 4 ) - d = QDate ( seda.year(), 1,1); - else - weekNum = 1; - } else { - QDate dd( seda.year()+1, 1,1); - if ( dd.dayOfWeek() <= 4 ) - weekNum = 1; - } - } - if ( weekNum == 0 ){ - int dow = d.dayOfWeek(); - if ( dow <= 4 ) - d = d.addDays( 1-dow ); - else // 5,6,7 - d = d.addDays( 8-dow ); - // we have the first week of the year.we are on monday - weekNum = d.daysTo( seda ) / 7 +1; - } - mDummyAllDayRightL->setText( QString::number( weekNum) ); mAllDayAgenda->changeColumns(mSelectedDates.count()); mAgenda->changeColumns(mSelectedDates.count()); qApp->processEvents(); diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index ba9bc93..4a058ce 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -216,7 +216,6 @@ class KOAgendaView : public KOEventView { // void cloneIncidenceSignal(Incidence *); protected: - QLabel * mDummyAllDayRightL; KOAgendaButton* getNewDaylabel(); bool mBlockUpdating; int mUpcomingWidth; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9e32c18..1c74307 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -284,7 +284,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : #ifndef DESKTOP_VERSION infrared = 0; #endif - + updateWeek( mView->startDate() ); + connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), + SLOT( updateWeekNum( const KCal::DateList & ) ) ); mBRdisabled = false; //toggleBeamReceive(); } @@ -554,6 +556,30 @@ void MainWindow::initActions() connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); + menuBarWeek = new QPEMenuBar( iconToolBar ); + QPopupMenu * wpo = new QPopupMenu (this); + QPopupMenu * all = new QPopupMenu (this); + //wpo->insertItem( i18n("W#"), 0 ); + int first = 1; + int i; + for ( i = 1; i < 50; ++i ) { + if ( !(i%10) ) { + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); + first = i; + wpo = new QPopupMenu (this); + } + wpo->insertItem( QString::number(i), i ); + } + for ( i = 50; i < 53; ++i ) { + wpo->insertItem( QString::number(i), i); + } + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); + menuBarWeek->insertItem( "00",all,1); + menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); + + connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); // ****************** QAction *action; QIconSet icon; @@ -1316,9 +1342,43 @@ QString MainWindow::syncFileName() return QString( "/tmp/synccalendar.ics" ); #endif } +void MainWindow::updateWeek(QDate seda) +{ + int weekNum = 0; + QDate d = QDate ( seda.year(), 1,1); + seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday + if ( seda.addDays(6).year() != seda.year() ) { + if ( seda.year() != d.year() ) { + if ( d.dayOfWeek() > 4 ) + d = QDate ( seda.year(), 1,1); + else + weekNum = 1; + } else { + QDate dd( seda.year()+1, 1,1); + if ( dd.dayOfWeek() <= 4 ) + weekNum = 1; + } + } + if ( weekNum == 0 ){ + int dow = d.dayOfWeek(); + if ( dow <= 4 ) + d = d.addDays( 1-dow ); + else // 5,6,7 + d = d.addDays( 8-dow ); + // we have the first week of the year.we are on monday + weekNum = d.daysTo( seda ) / 7 +1; + } + //qDebug("weeknum %s ", QString::number( weekNum).latin1()); + menuBarWeek-> changeItem(1, QString::number( weekNum) ); +} +void MainWindow::updateWeekNum(const DateList &selectedDates) +{ + updateWeek( selectedDates.first() ); +} void MainWindow::processIncidenceSelection( Incidence *incidence ) { + if ( !incidence ) { enableIncidenceActions( false ); diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8dd55ac..076ab94 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -23,6 +23,7 @@ class KSyncProfile; #define QPEMenuBar QMenuBar #endif class QPEToolBar; +class QPEMenuBar; namespace KCal { @@ -42,6 +43,8 @@ class MainWindow : public QMainWindow static QString syncFileName(); static QString resourcePath(); public slots: + void updateWeekNum(const KCal::DateList &); + void updateWeek(QDate); virtual void showMaximized (); void configureAgenda( int ); void recieve( const QCString& msg, const QByteArray& data ); @@ -84,7 +87,8 @@ class MainWindow : public QMainWindow void exportToPhone( int ); void toggleBeamReceive(); void disableBR(bool); - + signals: + void selectWeek ( int ); private slots: void showConfigureAgenda(); void getFile( bool ); @@ -116,6 +120,7 @@ class MainWindow : public QMainWindow CalendarLocal *mCalendar; CalendarView *mView; QAction *mNewSubTodoAction; + QPEMenuBar *menuBarWeek; QAction *mShowAction; QAction *mEditAction; diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 24de01f..657f98d 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -72,8 +72,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam #else bool isDesktop = true; #endif - bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; - if ( insertWeek && QApplication::desktop()->width() > 320 ) + if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons mPrevYear = new QPushButton( mCtrlFrame ); @@ -89,13 +88,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); QToolTip::add( mNextMonth, i18n("Next Month") ); - QPushButton * selWeek = 0; - if ( insertWeek ) { - selWeek = new QPushButton( mCtrlFrame ); - QToolTip::add( selWeek, i18n("Select Week") ); - selWeek->setFocusPolicy(NoFocus); - } - mNextYear = new QPushButton( mCtrlFrame ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); QToolTip::add( mNextYear, i18n("Next Year") ); @@ -111,9 +103,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); - mPrevMonth->setFlat( true); - if ( insertWeek ) - selWeek->setFlat( true); + mPrevMonth->setFlat( true); } mSelectMonth->setFont( tfont ); // Set minimum width to width of widest month name label @@ -135,29 +125,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam maxwidth+= 6; } - if ( insertWeek ) { - QPopupMenu * wpo = new QPopupMenu (this); - QPopupMenu * all = new QPopupMenu (this); - //wpo->insertItem( i18n("W#"), 0 ); - int first = 1; - for ( i = 1; i < 50; ++i ) { - if ( !(i%10) ) { - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); - first = i; - wpo = new QPopupMenu (this); - } - wpo->insertItem( QString::number(i), i ); - } - for ( i = 50; i < 53; ++i ) { - wpo->insertItem( QString::number(i), i); - } - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - selWeek->setPopup( all ); - selWeek->setFixedWidth( (size/5)*4 ); - selWeek->setFixedHeight( size ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); - } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); @@ -176,8 +143,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); - if ( insertWeek ) - ctrlLayout->addWidget( selWeek ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); -- cgit v0.9.0.2