-rw-r--r-- | korganizer/komonthview.cpp | 218 |
1 files changed, 115 insertions, 103 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 85e9166..ca55c43 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -19,9 +19,9 @@ -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qfont.h> #include <qfontmetrics.h> -#include <qkeycode.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qwidgetstack.h> +#include <qnamespace.h> +#include <q3hbox.h> +#include <q3vbox.h> +#include <q3widgetstack.h> #include <qpushbutton.h> @@ -30,3 +30,3 @@ #include <qtimer.h> -#include <qwhatsthis.h> +#include <q3whatsthis.h> #ifndef DESKTOP_VERSION @@ -35,2 +35,14 @@ #include <qapplication.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <QResizeEvent> +#include <QLabel> +#include <QPixmap> +#include <QFocusEvent> +#include <QMouseEvent> +#include <QKeyEvent> +#include <Q3VBoxLayout> +#include <Q3Frame> +#include <Q3PointArray> +#include <Q3PtrList> #endif @@ -61,6 +73,6 @@ QToolTipGroup *MonthViewCell::mToolTipGroup = 0; #endif -class KNOWhatsThis :public QWhatsThis +class KNOWhatsThis :public Q3WhatsThis { public: - KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; + KNOWhatsThis( KNoScrollListBox* sbox ) : Q3WhatsThis( sbox ), _wid( sbox) { }; //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; @@ -79,3 +91,3 @@ private: KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) - : QListBox(parent, name, WRepaintNoErase) + : Q3ListBox(parent, name, Qt::WNoAutoErase) { @@ -87,4 +99,4 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) resetOnFocusIn = true; - setVScrollBarMode(QScrollView::AlwaysOff); - setHScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(Q3ScrollView::AlwaysOff); + setHScrollBarMode(Q3ScrollView::AlwaysOff); } @@ -102,3 +114,3 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) { - QListBox::focusInEvent ( e ); + Q3ListBox::focusInEvent ( e ); if ( count() ){ @@ -114,3 +126,3 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { - QListBoxItem *fi = firstItem (); + Q3ListBoxItem *fi = firstItem (); if (fi ) { @@ -119,15 +131,15 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) if ( hei < height() - horizontalScrollBar()->height () ) { - setVScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(Q3ScrollView::AlwaysOff); } else - setVScrollBarMode(QScrollView::Auto); + setVScrollBarMode(Q3ScrollView::Auto); if ( ihei *3 > height() ) { - setHScrollBarMode(QScrollView::AlwaysOff); + setHScrollBarMode(Q3ScrollView::AlwaysOff); } else { - setHScrollBarMode(QScrollView::Auto); + setHScrollBarMode(Q3ScrollView::Auto); } } else { - setVScrollBarMode(QScrollView::Auto); - setHScrollBarMode(QScrollView::Auto); + setVScrollBarMode(Q3ScrollView::Auto); + setHScrollBarMode(Q3ScrollView::Auto); } @@ -143,6 +155,6 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) } - QListBox::focusOutEvent ( e ); + Q3ListBox::focusOutEvent ( e ); } - setVScrollBarMode(QScrollView::AlwaysOff); - setHScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(Q3ScrollView::AlwaysOff); + setHScrollBarMode(Q3ScrollView::AlwaysOff); if ( ! mBlockDeselect ) @@ -154,3 +166,3 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p) { - QListBoxItem* item = itemAt ( p ); + Q3ListBoxItem* item = itemAt ( p ); if ( ! item ) { @@ -167,3 +179,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) switch(e->key()) { - case Key_Right: + case Qt::Key_Right: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) @@ -175,3 +187,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_Left: + case Qt::Key_Left: if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) @@ -183,3 +195,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_Up: + case Qt::Key_Up: if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { @@ -203,3 +215,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_Down: + case Qt::Key_Down: if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { @@ -223,3 +235,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_I: + case Qt::Key_I: QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); @@ -227,4 +239,4 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: { @@ -238,3 +250,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; - case Key_Shift: + case Qt::Key_Shift: emit shiftDown(); @@ -268,3 +280,3 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) switch(e->key()) { - case Key_Shift: + case Qt::Key_Shift: emit shiftUp(); @@ -278,5 +290,5 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e) { - QListBox::mousePressEvent(e); + Q3ListBox::mousePressEvent(e); - if(e->button() == RightButton) { + if(e->button() == Qt::RightButton) { emit rightClick(); @@ -286,3 +298,3 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e) MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) - : QListBoxItem() + : Q3ListBoxItem() { @@ -397,3 +409,3 @@ void MonthViewItem::paint(QPainter *p) if ( mMultiday == 2 || mMultiday == 3 ) { - QPointArray pa ( 3 ); + Q3PointArray pa ( 3 ); pa.setPoint (0, x, yyy ); @@ -404,3 +416,3 @@ void MonthViewItem::paint(QPainter *p) if ( mMultiday == 2 || mMultiday == 1 ) { - QPointArray pa ( 3 ); + Q3PointArray pa ( 3 ); pa.setPoint (0, x+sizeM +sizeM/2, yyy ); @@ -464,3 +476,3 @@ void MonthViewItem::paint(QPainter *p) -int MonthViewItem::height(const QListBox *lb) const +int MonthViewItem::height(const Q3ListBox *lb) const { @@ -472,3 +484,3 @@ int MonthViewItem::height(const QListBox *lb) const -int MonthViewItem::width(const QListBox *lb) const +int MonthViewItem::width(const Q3ListBox *lb) const { @@ -516,6 +528,6 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) mLabel->setFlat( true ); - mLabel->setFocusPolicy(NoFocus); + mLabel->setFocusPolicy(Qt::NoFocus); //mItemList = new KNoScrollListBox( this ); setMinimumSize( 10, 10 ); - setFrameStyle( QFrame::Panel | QFrame::Plain ); + setFrameStyle( Q3Frame::Panel | Q3Frame::Plain ); setLineWidth( 1 ); @@ -531,9 +543,9 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); - connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), - SLOT( defaultAction( QListBoxItem * ) ) ); - connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, + connect( this , SIGNAL( doubleClicked( Q3ListBoxItem *) ), + SLOT( defaultAction( Q3ListBoxItem * ) ) ); + connect( this, SIGNAL( rightButtonPressed( Q3ListBoxItem *, const QPoint &) ), - SLOT( contextMenu( QListBoxItem * ) ) ); - connect( this, SIGNAL( highlighted( QListBoxItem *) ), - SLOT( selection( QListBoxItem * ) ) ); + SLOT( contextMenu( Q3ListBoxItem * ) ) ); + connect( this, SIGNAL( highlighted( Q3ListBoxItem *) ), + SLOT( selection( Q3ListBoxItem * ) ) ); @@ -547,3 +559,3 @@ QToolTipGroup *MonthViewCell::toolTipGroup() { - if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); + /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */ return mToolTipGroup; @@ -639,3 +651,3 @@ void MonthViewCell::startUpdateCell() mdayCount = 0; - setFocusPolicy(NoFocus); + setFocusPolicy(Qt::NoFocus); if ( !mMonthView->isUpdatePossible() ) @@ -694,3 +706,3 @@ int MonthViewCell::insertEvent(Event *event) QString mToolTipText; - setFocusPolicy(WheelFocus); + setFocusPolicy(Qt::WheelFocus); if ( !(event->doesRecur() == Recurrence::rNone) ) { @@ -836,3 +848,3 @@ int MonthViewCell::insertEvent(Event *event) // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); - QListBoxItem* it = this->item ( i ); + Q3ListBoxItem* it = this->item ( i ); if ( it && text < it->text() ) { @@ -852,3 +864,3 @@ void MonthViewCell::insertTodo(Todo *todo) { - setFocusPolicy(WheelFocus); + setFocusPolicy(Qt::WheelFocus); QString text; @@ -924,3 +936,3 @@ void MonthViewCell::finishUpdateCell() mToolTip.sort(); - QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); + /* TODO: hacker: QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); */ } @@ -940,3 +952,3 @@ void MonthViewCell::updateCell() //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); - QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); + Q3PtrList<Event> events = mMonthView->calendar()->events( mDate, true ); Event *event; @@ -946,3 +958,3 @@ void MonthViewCell::updateCell() // insert due todos - QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); + Q3PtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); Todo *todo; @@ -994,3 +1006,3 @@ void MonthViewCell::enableScrollBars( bool enabled ) if ( enabled ) { - QListBoxItem *fi = firstItem (); + Q3ListBoxItem *fi = firstItem (); if (fi ) { @@ -999,19 +1011,19 @@ void MonthViewCell::enableScrollBars( bool enabled ) if ( hei < height() - horizontalScrollBar()->height () ) { - setVScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(Q3ScrollView::AlwaysOff); } else - setVScrollBarMode(QScrollView::Auto); + setVScrollBarMode(Q3ScrollView::Auto); if ( ihei *3 > height() ) { - setHScrollBarMode(QScrollView::AlwaysOff); + setHScrollBarMode(Q3ScrollView::AlwaysOff); } else { - setHScrollBarMode(QScrollView::Auto); + setHScrollBarMode(Q3ScrollView::Auto); } } else { - setVScrollBarMode(QScrollView::Auto); - setHScrollBarMode(QScrollView::Auto); + setVScrollBarMode(Q3ScrollView::Auto); + setHScrollBarMode(Q3ScrollView::Auto); } } else { - setVScrollBarMode(QScrollView::AlwaysOff); - setHScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(Q3ScrollView::AlwaysOff); + setHScrollBarMode(Q3ScrollView::AlwaysOff); } @@ -1085,3 +1097,3 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) -void MonthViewCell::defaultAction( QListBoxItem *item ) +void MonthViewCell::defaultAction( Q3ListBoxItem *item ) { @@ -1107,3 +1119,3 @@ void MonthViewCell::newEvent() } -void MonthViewCell::cellClicked( QListBoxItem *item ) +void MonthViewCell::cellClicked( Q3ListBoxItem *item ) { @@ -1118,3 +1130,3 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) -void MonthViewCell::contextMenu( QListBoxItem *item ) +void MonthViewCell::contextMenu( Q3ListBoxItem *item ) { @@ -1135,3 +1147,3 @@ void MonthViewCell::contextMenu( QListBoxItem *item ) -void MonthViewCell::selection( QListBoxItem *item ) +void MonthViewCell::selection( Q3ListBoxItem *item ) { @@ -1187,4 +1199,4 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); - mWidStack = new QWidgetStack( this ); - QVBoxLayout* hb = new QVBoxLayout( this ); + mWidStack = new Q3WidgetStack( this ); + Q3VBoxLayout* hb = new Q3VBoxLayout( this ); mMonthView = new QWidget( mWidStack ); @@ -1217,5 +1229,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) label->setFont(bfont); - label->setFrameStyle(QFrame::Panel|QFrame::Raised); + label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised); label->setLineWidth(1); - label->setAlignment(AlignCenter); + label->setAlignment(Qt::AlignCenter); mDayLabels.insert( i, label ); @@ -1223,5 +1235,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) label->setFont(bfont); - label->setFrameStyle(QFrame::Panel|QFrame::Raised); + label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised); label->setLineWidth(1); - label->setAlignment(AlignCenter); + label->setAlignment(Qt::AlignCenter); mDayLabelsW.insert( i, label ); @@ -1234,3 +1246,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) KOWeekButton *label = new KOWeekButton( mMonthView ); - label->setFocusPolicy(NoFocus); + label->setFocusPolicy(Qt::NoFocus); label->setFont(bfont); @@ -1238,3 +1250,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) label->setFlat(true); - QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); + Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); //label->setFrameStyle(QFrame::Panel|QFrame::Raised); @@ -1245,4 +1257,4 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekLabels[mNumWeeks]->setText( i18n("W")); - mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); - QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); + mWeekLabels[mNumWeeks]->setFocusPolicy(Qt::WheelFocus); + Q3WhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); @@ -1250,3 +1262,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) KOWeekButton *label = new KOWeekButton( mWeekView ); - label->setFocusPolicy(NoFocus); + label->setFocusPolicy(Qt::NoFocus); label->setFont(bfont); @@ -1254,3 +1266,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) label->setFlat(true); - QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); + Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); //label->setFrameStyle(QFrame::Panel|QFrame::Raised); @@ -1261,3 +1273,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekLabelsW[1]->setText( i18n("W")); - mWeekLabelsW[1]->setFocusPolicy(WheelFocus); + mWeekLabelsW[1]->setFocusPolicy(Qt::WheelFocus); @@ -1307,9 +1319,9 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mContextMenu = eventPopup(); - mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + mContextMenu->addAdditionalItem(QIcon(QPixmap()), i18n("New Event..."),this, SLOT(slotNewEvent()),false); - mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + mContextMenu->addAdditionalItem(QIcon(QPixmap()), i18n("New Todo..."),this, SLOT(slotNewTodo()),false); - mContextMenu->addAdditionalItem(QIconSet(QPixmap()), + mContextMenu->addAdditionalItem(QIcon(QPixmap()), i18n("Journal"),this, @@ -1327,3 +1339,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) pathString += "iconsmini/"; - mNewItemMenu = new QPopupMenu( this ); + mNewItemMenu = new Q3PopupMenu( this ); mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); @@ -1399,3 +1411,3 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int } - QPtrVector<MonthViewCell> *cells; + Q3PtrVector<MonthViewCell> *cells; if ( weekview ) @@ -1497,5 +1509,5 @@ int KOMonthView::currentDateCount() -QPtrList<Incidence> KOMonthView::selectedIncidences() +Q3PtrList<Incidence> KOMonthView::selectedIncidences() { - QPtrList<Incidence> selected; + Q3PtrList<Incidence> selected; @@ -1563,3 +1575,3 @@ void KOMonthView::updateConfig() #ifdef DESKTOP_VERSION - MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); + /* TODO:hacker: MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); */ #endif @@ -1571,3 +1583,3 @@ void KOMonthView::updateDayLabels() - QPtrVector<QLabel> *mDayLabelsT; + Q3PtrVector<QLabel> *mDayLabelsT; @@ -1612,5 +1624,5 @@ void KOMonthView::showDates(const QDate &start, const QDate &) - QPtrVector<MonthViewCell> *cells; - QPtrVector<QLabel> *dayLabels; - QPtrVector<KOWeekButton> *weekLabels; + Q3PtrVector<MonthViewCell> *cells; + Q3PtrVector<QLabel> *dayLabels; + Q3PtrVector<KOWeekButton> *weekLabels; uint weekNum = 6; @@ -1670,3 +1682,3 @@ void KOMonthView::showDates(const QDate &start, const QDate &) -void KOMonthView::showEvents(QPtrList<Event>) +void KOMonthView::showEvents(Q3PtrList<Event>) { @@ -1692,3 +1704,3 @@ void KOMonthView::updateView() clearSelection(); - QPtrVector<MonthViewCell> *cells; + Q3PtrVector<MonthViewCell> *cells; if ( mShowWeekView ) { @@ -1707,3 +1719,3 @@ void KOMonthView::updateView() - QPtrList<Event> events = calendar()->events(); + Q3PtrList<Event> events = calendar()->events(); Event *event; @@ -1771,3 +1783,3 @@ void KOMonthView::updateView() // insert due todos - QPtrList<Todo> todos = calendar()->todos( ); + Q3PtrList<Todo> todos = calendar()->todos( ); Todo *todo; @@ -2227,3 +2239,3 @@ void KOMonthView::processSelectionChange() { - QPtrList<Incidence> incidences = selectedIncidences(); + Q3PtrList<Incidence> incidences = selectedIncidences(); if (incidences.count() > 0) { @@ -2263,3 +2275,3 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) switch(e->key()) { - case Key_Up: + case Qt::Key_Up: { @@ -2274,3 +2286,3 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) break; - case Key_Down: + case Qt::Key_Down: { @@ -2286,4 +2298,4 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) break; - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: { @@ -2293,3 +2305,3 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) break; - case Key_D: + case Qt::Key_D: if ( mSelectedCell ) { |