author | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
commit | 38898c49275bf27fb8c2df96d145f2a5abb62331 (patch) (side-by-side diff) | |
tree | b96f0a336fccf4d6c67e6a4b5c1239b4d647b3b9 /korganizer | |
parent | 26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (diff) | |
download | kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.zip kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.gz kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.bz2 |
fixxeess
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 96 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
4 files changed, 59 insertions, 45 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index ce66863..da5ef07 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -143,49 +143,49 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) mCompletedCombo->insertItem(i18n(" 60 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 80 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n("100 %")); connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); topLayout->addWidget(mCompletedCombo); mCompletedLabel = new QLabel(i18n("completed"),parent); topLayout->addWidget(mCompletedLabel); mCompleteDateEdit = new KDateEdit(parent); topLayout->addWidget(mCompleteDateEdit ); mCompleteTimeEdit = new KOTimeEdit(parent); topLayout->addWidget( mCompleteTimeEdit); mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); if ( QApplication::desktop()->width() <= 480 ) { if ( QApplication::desktop()->width() < 320 ) mCompleteDateEdit->setMaximumWidth( 85 ); else - mCompleteDateEdit->setMaximumWidth( 130 ); + mCompleteDateEdit->setMaximumWidth( 140 ); topLayout->setSpacing( 0 ); } } void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) { QHBox* h = new QHBox ( parent ); topLayout->addWidget( h ); QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); // topLayout->addWidget(priorityLabel); mPriorityCombo = new QComboBox( h ); mPriorityCombo->insertItem(i18n("1 (high)")); mPriorityCombo->insertItem(i18n("2")); mPriorityCombo->insertItem(i18n("3")); mPriorityCombo->insertItem(i18n("4")); mPriorityCombo->insertItem(i18n("5 (low)")); //topLayout->addWidget(mPriorityCombo); } void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *statusLayout = new QHBoxLayout(topLayout); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 5926abe..ffb2e1e 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -71,49 +71,49 @@ protected: return _wid->getWhatsThisText(p) ; }; private: KNoScrollListBox* _wid; }; KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) : QListBox(parent, name, WRepaintNoErase) { #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif mWT = new KNOWhatsThis(this); } KNoScrollListBox::~KNoScrollListBox() { } QString KNoScrollListBox::getWhatsThisText(QPoint p) { QListBoxItem* item = itemAt ( p ); if ( ! item ) { - return i18n("Click in the cell\nto add an event!"); + return i18n("Click in the cell\nto add an event!"); } return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); } void KNoScrollListBox::keyPressEvent(QKeyEvent *e) { switch(e->key()) { case Key_Right: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { e->ignore(); return; } scrollBy(10,0); break; case Key_Left: if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { e->ignore(); return; } scrollBy(-10,0); break; case Key_Up: @@ -298,49 +298,49 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) //mLabel->setLineWidth( 1 ); //mLabel->setAlignment( AlignCenter ); mLabel->setFlat( true ); mLabel->setFocusPolicy(NoFocus); mItemList = new KNoScrollListBox( this ); mItemList->setMinimumSize( 10, 10 ); mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); mItemList->setLineWidth( 1 ); topLayout->addWidget( mItemList ); mLabel->raise(); // QColor( 0,0,255 ) QColor( 160,1600,255 ) mStandardPalette = palette(); mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); enableScrollBars( false ); updateConfig(); //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), SLOT( defaultAction( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint &) ), SLOT( contextMenu( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), - SLOT( selection( QListBoxItem * ) ) ); + SLOT( selection( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), SLOT( cellClicked( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), SLOT( selection( QListBoxItem * ) ) ); } #ifdef DESKTOP_VERSION QToolTipGroup *MonthViewCell::toolTipGroup() { if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); return mToolTipGroup; } #endif void MonthViewCell::setDate( const QDate &date ) { // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; mDate = date; //resizeEvent( 0 ); } QDate MonthViewCell::date() const @@ -531,85 +531,86 @@ void MonthViewCell::insertEvent(Event *event) } else { pal = mStandardPalette ; } item->setPalette( pal ); item->setRecur( event->recurrence()->doesRecur() ); item->setAlarm( event->isAlarmEnabled() ); item->setMoreInfo( event->description().length() > 0 ); #ifdef DESKTOP_VERSION Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, KOPrefs::instance()->email()); if ( me != 0 ) { if ( me->status() == Attendee::NeedsAction && me->RSVP()) item->setReply(true); else item->setReply(false); } else item->setReply(false); #endif mItemList->insertItem( item ); mToolTip += "\n"; } void MonthViewCell::insertTodo(Todo *todo) { - QString text; - if (todo->hasDueDate()) { - if (!todo->doesFloat()) { - text += KGlobal::locale()->formatTime(todo->dtDue().time()); - text += " "; - } + QString text; + mItemList->setFocusPolicy(WheelFocus); + if (todo->hasDueDate()) { + if (!todo->doesFloat()) { + text += KGlobal::locale()->formatTime(todo->dtDue().time()); + text += " "; } - text += i18n("Td: %1").arg(todo->summary()); - - MonthViewItem *item = new MonthViewItem( todo, mDate, text ); - //item->setPalette( mStandardPalette ); - QPalette pal; - if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { - QStringList categories = todo->categories(); - QString cat = categories.first(); - if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { - pal = getPalette(); - if (cat.isEmpty()) { - pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); - } else { - pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); - } - + } + text += i18n("T: %1").arg(todo->summary()); + + MonthViewItem *item = new MonthViewItem( todo, mDate, text ); + //item->setPalette( mStandardPalette ); + QPalette pal; + if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { + QStringList categories = todo->categories(); + QString cat = categories.first(); + if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { + pal = getPalette(); + if (cat.isEmpty()) { + pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); } else { - if (cat.isEmpty()) { - pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); - } else { - pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); - } + pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); } - + } else { - pal = mStandardPalette ; + if (cat.isEmpty()) { + pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); + } else { + pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); + } } - item->setPalette( pal ); - mItemList->insertItem( item ); - mToolTip += text+"\n"; + + } else { + pal = mStandardPalette ; + } + item->setPalette( pal ); + mItemList->insertItem( item ); + mToolTip += text+"\n"; } void MonthViewCell::finishUpdateCell() { #ifdef DESKTOP_VERSION if (mToolTip != "") QToolTip::add(this,mToolTip,toolTipGroup(),""); #endif mItemList->sort(); //setMyPalette(); setMyPalette(); QString text; bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; mLabel->resize( mLabelBigSize ); text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); } else { mLabel->resize( mLabelSize ); text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); } mLabel->setText( text ); resizeEvent( 0 ); } @@ -761,49 +762,48 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) if ( lastClicked ) if ( ! item ) { if ( lastClicked->listBox() != item->listBox() ) lastClicked->listBox()->clearSelection(); } */ mMonthView->setSelectedCell( this ); if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); select(); } void MonthViewCell::contextMenu( QListBoxItem *item ) { if ( !item ) 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 ) { ignoreResizeEvent = 0; mShortDayLabelsW = false; mShortDayLabelsM = false; clPending = true; mWidStack = new QWidgetStack( this ); QHBoxLayout* hb = new QHBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); #if QT_VERSION >= 0x030000 mWidStack->addWidget(mMonthView ); @@ -1244,51 +1244,57 @@ void KOMonthView::updateView() (*cells)[0]->setFocus(); #else // old code //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); int i; for( i = 0; i < (*cells).count(); ++i ) { (*cells)[i]->updateCell(); } //qDebug("KOMonthView::updateView() "); processSelectionChange(); // qDebug("---------------------------------------------------------------------+ "); (*cells)[0]->setFocus(); #endif //qDebug("update time %d ", ti.elapsed()); } void KOMonthView::resizeEvent(QResizeEvent * e) { qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); if ( ignoreResizeEvent ) { - qDebug("KOMonthView::resizeEvent ignored "); - --ignoreResizeEvent; - return; + int diff = e->size().height() - e->oldSize().height(); + if ( diff < 0 ) + diff = diff * (-1); + if ( diff == ignoreResizeEventHeight ) { + qDebug("KOMonthView::resizeEvent ignored "); + --ignoreResizeEvent; + return; + } + ignoreResizeEvent = 0; } if ( e->size().width()+ e->size().height() < 240 ) return; computeLayout(); clPending = true; if ( mShowWeekView ) mCellsW[0]->setFocus(); else mCells[0]->setFocus(); } void KOMonthView::computeLayoutWeek() { int daysToShow; int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); int wid = size().width();//e int hei = size().height()-1; if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) return; if ( wid < hei ) @@ -1490,87 +1496,93 @@ void KOMonthView::computeLayout() updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); if ( forceUpdate ) updateView(); } void KOMonthView::showContextMenu( Incidence *incidence ) { mContextMenu->showIncidencePopup(incidence); /* 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 %x ", 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() { QPtrList<Incidence> incidences = selectedIncidences(); if (incidences.count() > 0) { emit incidenceSelected( incidences.first() ); } else { emit incidenceSelected( 0 ); } } void KOMonthView::clearSelection() { if ( mSelectedCell ) { mSelectedCell->deselect(); mSelectedCell = 0; } } void KOMonthView::keyPressEvent ( QKeyEvent * e ) { //qDebug("KOMonthView::keyPressEvent "); switch(e->key()) { case Key_Up: { emit prevMonth(); - mCells[0]->setFocus(); + if ( mShowWeekView ) + mCellsW[0]->setFocus(); + else + mCells[0]->setFocus(); } e->accept(); break; case Key_Down: { emit nextMonth(); - mCells[0]->setFocus(); - + if ( mShowWeekView ) + mCellsW[0]->setFocus(); + else + mCells[0]->setFocus(); + } e->accept(); break; case Key_Return: case Key_Enter: { selectInternalWeekNum ( currentWeek() ); } e->accept(); break; default: e->ignore(); break; } } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 9dbe319..d70cda1 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -205,82 +205,83 @@ class MonthViewCell : public QWidget class KOMonthView: public KOEventView { Q_OBJECT public: KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); ~KOMonthView(); /** Returns maximum number of days supported by the komonthview */ virtual int maxDatesHint(); /** Returns number of currently shown dates. */ virtual int currentDateCount(); /** returns the currently selected events */ virtual QPtrList<Incidence> selectedIncidences(); /** returns dates of the currently selected events */ virtual DateList selectedDates(); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); bool isMonthView() { return true; } bool isUpdatePossible() { return updatePossible; } - void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} + void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} MonthViewCell * selectedCell(); public slots: 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 * ); protected slots: void selectInternalWeekNum ( int ); void switchView(); void processSelectionChange(); signals: void nextMonth(); void prevMonth(); void showNavigator( bool ); void selectWeekNum ( int ); void showDaySignal( QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: int ignoreResizeEvent; + int ignoreResizeEventHeight; int currentWeek(); bool clPending; QWidgetStack * mWidStack; QWidget* mMonthView; QWidget* mWeekView; bool mShowWeekView; bool updatePossible; int mDaysPerWeek; int mNumWeeks; int mNumCells; bool mWeekStartsMonday; void computeLayout(); 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; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index dcb51dc..c35de0a 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -202,49 +202,50 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) } else { mCurrentView = view; // bool full = fullScreen; bool isFull = !mMainView->leftFrame()->isVisible(); if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) full = true; if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) full = false; } if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); //raiseCurrentView( full ); mMainView->processIncidenceSelection( 0 ); //mMainView->updateView(); raiseCurrentView( full, true ); mMainView->adaptNavigationUnits(); } void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) { mCurrentAgendaView = 0; int wid = mMainView->width() ; int hei = mMainView->height(); if ( mCurrentView == mMonthView ) { if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { - mMonthView->setIgnoreResizeEvent( 2 ); + + mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); mMainView->navigatorBar()->show(); hei -= mMainView->navigatorBar()->sizeHint().height(); } //mMainView->navigatorBar()->hide(); } else { mMainView->navigatorBar()->hide(); } if ( fullScreen ) { mMainView->leftFrame()->hide(); } else { mMainView->leftFrame()->show(); if ( KOPrefs::instance()->mVerticalScreen ) hei -= mMainView->leftFrame()->height(); else wid -= mMainView->leftFrame()->width(); } emit signalFullScreen( !fullScreen ); if ( callUpdateView ) mMainView->updateView(); if ( globalFlagBlockAgenda == 5 ) { globalFlagBlockAgenda = 4; globalFlagBlockAgendaItemPaint = 1; } |