author | zautrix <zautrix> | 2005-04-17 10:42:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 10:42:07 (UTC) |
commit | ff7743ec82aa6d70325e613d0a1054c7de83a76c (patch) (side-by-side diff) | |
tree | e6d4c46a26e120817acd5ab7e47ef41b1428700b | |
parent | fd67a473a94c5a3d63a89c52fb8f612cb19b5363 (diff) | |
download | kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.zip kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.gz kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.bz2 |
fixes
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 95 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 4 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 7 |
7 files changed, 106 insertions, 12 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 4e6f994..2981762 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1338,23 +1338,23 @@ { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, { "Todo is started","Todo is gestarted" }, { "Stop todo","Stoppe Todo" }, { "Todo is stopped","Todo ist gestoppt" }, { "Start todo","Starte Todo" }, { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, { "Todo has subtodos","Todo hat Untertodos" }, { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, { "Colors","Farben" }, { "Click on new parent item","Klicke auf neues Übertodo" }, { "Reparenting aborted!","Übertodo setzen abgebrochen" }, { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, -{ "","" }, +{ "times","Zeiten" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index b175f9a..2b7e41f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -393,38 +393,48 @@ void MonthViewItem::paint(QPainter *p) } else { int val = td->percentComplete()/20; p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); p->drawRect ( x, y-2,7,size+4); x += size + 3; } } QFontMetrics fm = p->fontMetrics(); int yPos; int pmheight = size; if( pmheight < fm.height() ) yPos = fm.ascent() + fm.leading()/2; else yPos = pmheight/2 - fm.height()/2 + fm.ascent(); p->setPen( palette().color( QPalette::Normal, sel ? \ QColorGroup::HighlightedText : QColorGroup::Foreground ) ); - p->drawText( x, yPos, text() ); - if ( mIncidence->cancelled() ) { - int wid = fm.width( text() ); - p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); - } - + if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { + p->drawText( x, yPos, text() ); + if ( mIncidence->cancelled() ) { + int wid = fm.width( text() ); + p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); + } + } else { + QString pText = text(); + if( pText.mid(2,1) == ":" ) + pText = pText.mid( 6 ); + p->drawText( x, yPos, pText ); + if ( mIncidence->cancelled() ) { + int wid = fm.width( pText ); + p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); + } + } } int MonthViewItem::height(const QListBox *lb) const { int ret = 10; if ( lb ) ret = lb->fontMetrics().lineSpacing()+1; return ret; } int MonthViewItem::width(const QListBox *lb) const { if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { int size = PIXMAP_SIZE; if ( QApplication::desktop()->width() < 300 ) size = 3; @@ -1029,73 +1039,78 @@ void MonthViewCell::defaultAction( QListBoxItem *item ) MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); if ( incidence ) mMonthView->defaultAction( incidence ); } void MonthViewCell::showDay() { emit showDaySignal( date() ); } void MonthViewCell::newEvent() { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); } void MonthViewCell::cellClicked( QListBoxItem *item ) { + mMonthView->setSelectedCell( this ); qDebug("CELL "); if ( item == 0 ) { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); return; } } void MonthViewCell::contextMenu( QListBoxItem *item ) { - if ( !item ) return; - + mMonthView->setPopupCell( this ); + if ( !item ) { + mMonthView->showContextMenu( 0 ); + return; + } MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); if ( incidence ) mMonthView->showContextMenu( incidence ); } void MonthViewCell::selection( QListBoxItem *item ) { if ( !item ) return; mMonthView->setSelectedCell( this ); } // ******************************************************************************* // ******************************************************************************* // ******************************************************************************* KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView( calendar, parent, name ), mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) { mFlagKeyPressed = false; mShortDayLabelsM = false; mShortDayLabelsW = false; skipResize = false; clPending = true; + mPopupCell = 0; mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); mWidStack = new QWidgetStack( this ); QVBoxLayout* hb = new QVBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); #if QT_VERSION >= 0x030000 mWidStack->addWidget(mMonthView ); mWidStack->addWidget(mWeekView ); #else mWidStack->addWidget( mMonthView, 1 ); mWidStack->addWidget( mWeekView , 1 ); #endif hb->addWidget( mNavigatorBar ); hb->addWidget( mWidStack ); mShowWeekView = KOPrefs::instance()->mMonthViewWeek; updatePossible = false; @@ -1187,32 +1202,55 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) connect( cell, SIGNAL( defaultAction( Incidence * ) ), SLOT( defaultAction( Incidence * ) ) ); connect( cell, SIGNAL( newEventSignal( QDateTime ) ), SIGNAL( newEventSignal( QDateTime ) ) ); connect( cell, SIGNAL( showDaySignal( QDate ) ), SIGNAL( showDaySignal( QDate ) ) ); connect( cell, SIGNAL( nextCell() ), SLOT( nextCell() ) ); connect( cell, SIGNAL( prevCell() ), SLOT( prevCell() ) ); cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); } //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); mContextMenu = eventPopup(); + mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + i18n("New Event..."),this, + SLOT(slotNewEvent()),false); + mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + i18n("New Todo..."),this, + SLOT(slotNewTodo()),false); + mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + i18n("Journal"),this, + SLOT(slotEditJournal()),false); + + + + QString pathString = ""; + if ( !KOPrefs::instance()->mToolBarMiniIcons ) { + if ( QApplication::desktop()->width() < 480 ) + pathString += "icons16/"; + } else + pathString += "iconsmini/"; + mNewItemMenu = new QPopupMenu( this ); + mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); + mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); + mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); + // updateConfig(); //useless here... // ... but we need mWidthLongDayLabel computed QFontMetrics fontmetric(mDayLabels[0]->font()); mWidthLongDayLabel = 0; for (int i = 0; i < 7; i++) { int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; } //mWeekLabels[mNumWeeks]->setText( i18n("W")); #if 0 if ( mShowWeekView ) mWidStack->raiseWidget( mWeekView ); else mWidStack->raiseWidget( mMonthView ); @@ -1880,49 +1918,54 @@ void KOMonthView::computeLayout() ++h; mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); y += h; } mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; updateDayLabels(); //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); } void KOMonthView::showContextMenu( Incidence *incidence ) { - mContextMenu->showIncidencePopup(incidence); + if( incidence ) + mContextMenu->showIncidencePopup(incidence); + else { + //qDebug("KOMonthView::showContextMenu "); + mNewItemMenu->popup(QCursor::pos()); + } /* if( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>(incidence); mContextMenu->showEventPopup(event); } else { kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; } */ } MonthViewCell * KOMonthView::selectedCell( ) { return mSelectedCell; } void KOMonthView::setSelectedCell( MonthViewCell *cell ) { - //qDebug("KOMonthView::setSelectedCell "); + //qDebug("KOMonthView::setSelectedCell %d", cell); if ( mSelectedCell && mSelectedCell != cell ) { MonthViewCell * mvc = mSelectedCell; mSelectedCell = cell; mvc->deselect(); } else mSelectedCell = cell; // if ( mSelectedCell ) // mSelectedCell->select(); if ( !mSelectedCell ) emit incidenceSelected( 0 ); else emit incidenceSelected( mSelectedCell->selectedIncidence() ); } void KOMonthView::processSelectionChange() { @@ -2001,16 +2044,48 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) } break; default: e->ignore(); break; } } void KOMonthView::nextCell() { bool res = focusNextPrevChild ( true ); } void KOMonthView::prevCell() { focusNextPrevChild ( false ); } + +void KOMonthView::slotNewTodo() +{ + //qDebug("KOMonthView::slotNewTodo() "); + if ( mPopupCell ){ + QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); + emit newTodoSignal(dt,true); + } + mPopupCell = 0; +} +void KOMonthView::slotNewEvent() +{ + if ( mPopupCell ) { + QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); + emit newEventSignal( dt ); + } + //qDebug("KOMonthView::slotNewEvent() "); + mPopupCell = 0; +} + +void KOMonthView::slotEditJournal() +{ + if ( mPopupCell ) + emit showJournalSignal( 7, mPopupCell->date() ); + //qDebug("KOMonthView::slotEditJournal() "); + mPopupCell = 0; +} + +void KOMonthView::setPopupCell( MonthViewCell * c) +{ + mPopupCell = c; +} diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index c6b6b5e..de5c014 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -258,46 +258,52 @@ class KOMonthView: public KOEventView NavigatorBar* navigatorBar() { return mNavigatorBar ;} public slots: void nextCell(); void prevCell(); virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); void clearSelection(); void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); + void setPopupCell( MonthViewCell * ); void switchView(); void setKeyBoardFocus(); void setKeyBFocus(); protected slots: + void slotNewTodo(); + void slotNewEvent(); + void slotEditJournal(); void slotComputeLayout(); void selectInternalWeekNum ( int ); void processSelectionChange(); signals: void nextMonth(); void prevMonth(); void selectWeekNum ( int ); void selectMonth (); void showDaySignal( QDate ); + void newTodoSignal( QDateTime, bool ); + void showJournalSignal( int,QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: QTimer* mComputeLayoutTimer; NavigatorBar* mNavigatorBar; int currentWeek(); bool clPending; QWidgetStack * mWidStack; QWidget* mMonthView; QWidget* mWeekView; bool mShowWeekView; bool updatePossible; int mDaysPerWeek; @@ -309,24 +315,26 @@ class KOMonthView: public KOEventView void computeLayoutWeek(); QPtrVector<MonthViewCell> mCells; QPtrVector<QLabel> mDayLabels; QPtrVector<KOWeekButton> mWeekLabels; QPtrVector<MonthViewCell> mCellsW; QPtrVector<QLabel> mDayLabelsW; QPtrVector<KOWeekButton> mWeekLabelsW; bool mShortDayLabelsM; bool mShortDayLabelsW; int mWidthLongDayLabel; QDate mStartDate; MonthViewCell *mSelectedCell; + MonthViewCell *mPopupCell; bool mFlagKeyPressed; KOEventPopupMenu *mContextMenu; + QPopupMenu *mNewItemMenu; void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; }; #endif diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index a571ed4..34044ab 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -224,32 +224,33 @@ KOPrefs::KOPrefs() : addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); addItemBool("UseAppColors",&mUseAppColors,false); KPrefs::setCurrentGroup("Views"); addItemBool("Block Popup Menu",&mBlockPopupMenu,true); addItemBool("Show Date Navigator",&mShowDateNavigator,true); addItemInt("Hour Size",&mHourSize,8); addItemBool("Show Daily Recurrences",&mDailyRecur,true); addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); addItemBool("ShowShortMonthName",&mMonthShowShort,false); addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); + addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); #ifdef DESKTOP_VERION addItemBool("Enable ToolTips",&mEnableToolTips,true); #else addItemBool("Enable ToolTips",&mEnableToolTips,false); #endif addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 2a0ee64..e06df1c 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -146,32 +146,33 @@ class KOPrefs : public KPimPrefs bool mMonthViewUsesDayColors; bool mMonthViewSatSunTog; bool mMonthViewWeek; QColor mAppColor1; QColor mAppColor2; bool mUseAppColors; int mDayBegins; int mHourSize; int mAllDaySize; bool mShowFullMenu; bool mDailyRecur; bool mWeeklyRecur; bool mMonthDailyRecur; bool mMonthWeeklyRecur; bool mMonthShowIcons; + bool mMonthShowTimes; bool mMonthShowShort; bool mEnableToolTips; bool mEnableMonthScroll; bool mFullViewMonth; bool mMonthViewUsesCategoryColor; bool mFullViewTodo; bool mShowCompletedTodo; bool mMarcusBainsEnabled; int mNextXDays; int mWhatsNextDays; int mWhatsNextPrios; bool mEnableQuickTodo; bool mCompactDialogs; bool mVerticalScreen; diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index ad3c61c..cb9c272 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp @@ -751,33 +751,35 @@ void KOPrefsDialog::setupViewsTab() habo = new QHBox( topFrame ); if ( QApplication::desktop()->width() <= 480 ) { lab = new QLabel (i18n("Show in every cell ") , topFrame ); topLayout->addMultiCellWidget(lab,ii, ii,0,1); ii++; } else { new QLabel ( i18n("Show in every cell "), habo ); } weeklyRecur = addWidBool(i18n("short month"), &(KOPrefs::instance()->mMonthShowShort),habo); weeklyRecur = addWidBool(i18n("icons"), &(KOPrefs::instance()->mMonthShowIcons),habo); - + weeklyRecur = + addWidBool(i18n("times"), + &(KOPrefs::instance()->mMonthShowTimes),habo); topLayout->addMultiCellWidget(habo,ii, ii,0,1); ii++; #ifdef DESKTOP_VERSION KPrefsDialogWidBool *enableMonthScroll = addWidBool(i18n("Enable scrollbars in month view cells"), &(KOPrefs::instance()->mEnableMonthScroll),topFrame); topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); #endif dummy = addWidBool(i18n("Week view mode uses bigger font"), &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Show Sat/Sun together"), &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 406e741..f1f2dd2 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -586,32 +586,39 @@ void KOViewManager::showNextXView() mFlagShowNextxDays = true; mCurrentAgendaView = 3 ; KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; } bool KOViewManager::showsNextDays() { return mFlagShowNextxDays; } void KOViewManager::createMonthView() { if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); addView(mMonthView); // mMonthView->show(); // SIGNALS/SLOTS FOR MONTH VIEW + + connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); + + connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), + mMainView, SLOT(newTodoDateTime(QDateTime, bool))); + + connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), mMainView, SLOT(newEvent(QDateTime))); connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |