summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/koagendaview.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp78
1 files changed, 45 insertions, 33 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 6e65a03..87993ae 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -18,27 +18,39 @@
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlayout.h>
#ifndef KORG_NOSPLITTER
#include <qsplitter.h>
#endif
#include <qfont.h>
#include <qfontmetrics.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qtooltip.h>
#include <qpainter.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <Q3GridLayout>
+#include <Q3ValueList>
+#include <QKeyEvent>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <QPaintEvent>
+#include <Q3PtrList>
#include <kapplication.h>
#include <KDGanttMinimizeSplitter.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
@@ -75,14 +87,14 @@ extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockLabel;
using namespace KOrg;
#define IDLETIMEOUT 45
-TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
- QScrollView(parent,name,f)
+TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,Qt::WFlags f) :
+ Q3ScrollView(parent,name,f)
{
myPix.resize( 1, 1 );
mRows = rows;
mRedrawNeeded = true;
setMinimumHeight( 20 );
@@ -92,13 +104,13 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
resizeContents(50,mRows * mCellHeight);
- viewport()->setBackgroundMode( PaletteBackground );
+ viewport()->setBackgroundMode( Qt::PaletteBackground );
}
void TimeLabels::setCellHeight(int height)
{
mCellHeight = height;
}
@@ -280,13 +292,13 @@ void TimeLabels::paintEvent(QPaintEvent*)
repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
}
////////////////////////////////////////////////////////////////////////////
EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
- : QFrame(parent,name)
+ : Q3Frame(parent,name)
{
mColumns = 1;
mTopBox = 0;
mLocation = loc;
mTopLayout = 0;
mPaintWidget = 0;
@@ -390,60 +402,60 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
if ( KOPrefs::instance()->mVerticalScreen ) {
expandPix = SmallIcon( "1updownarrow" );
} else {
expandPix = SmallIcon("1leftrightarrow" );
}
- QBoxLayout *topLayout = new QVBoxLayout(this);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
// Create day name labels for agenda columns
// Create agenda splitter
mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
topLayout->addWidget( mSplitterAgenda );
- mAllDayFrame = new QHBox(mSplitterAgenda);
- mAllDayFrame->setFocusPolicy(NoFocus);
+ mAllDayFrame = new Q3HBox(mSplitterAgenda);
+ mAllDayFrame->setFocusPolicy(Qt::NoFocus);
QWidget *agendaFrame = new QWidget(mSplitterAgenda);
- agendaFrame->setFocusPolicy(NoFocus);
+ agendaFrame->setFocusPolicy(Qt::NoFocus);
// Create all-day agenda widget
- mDummyAllDayLeft = new QVBox( mAllDayFrame );
+ mDummyAllDayLeft = new Q3VBox( mAllDayFrame );
mExpandButton = new QPushButton(mDummyAllDayLeft);
mExpandButton->setPixmap( expandPix );
int widebut = mExpandButton->sizeHint().width()+4;
int heibut = mExpandButton->sizeHint().height()+4;
if ( heibut > widebut )
widebut = heibut ;
//mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
// QSizePolicy::Fixed ) );
mExpandButton->setFixedSize( widebut, widebut);
connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
- mExpandButton->setFocusPolicy(NoFocus);
+ mExpandButton->setFocusPolicy(Qt::NoFocus);
mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
- mAllDayAgenda->setFocusPolicy(NoFocus);
+ mAllDayAgenda->setFocusPolicy(Qt::NoFocus);
QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
// Create event context menu for all day agenda
//mAllDayAgendaPopup = eventPopup();
// Create agenda frame
- QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
+ Q3GridLayout *agendaLayout = new Q3GridLayout(agendaFrame,4,3);
// QHBox *agendaFrame = new QHBox(splitterAgenda);
// create event indicator bars
mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
#ifndef DESKTOP_VERSION
mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
#endif
- mDayLabelsFrame = new QHBox(agendaFrame);
+ mDayLabelsFrame = new Q3HBox(agendaFrame);
//topLayout->addWidget(mDayLabelsFrame);
- mDayLabels = new QFrame (mDayLabelsFrame);
- mLayoutDayLabels = new QHBoxLayout(mDayLabels);
+ mDayLabels = new Q3Frame (mDayLabelsFrame);
+ mLayoutDayLabels = new Q3HBoxLayout(mDayLabels);
agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
agendaLayout->addWidget(mEventIndicatorTop,1,1);
mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
agendaFrame);
agendaLayout->addWidget(mEventIndicatorBottom,3,1);
@@ -457,18 +469,18 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
this,SLOT(updateConfig()));
// Create agenda
mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
agendaLayout->setColStretch(1,1);
- mAgenda->setFocusPolicy(NoFocus);
+ mAgenda->setFocusPolicy(Qt::NoFocus);
// Create event context menu for agenda
mAllAgendaPopup = eventPopup();
#if 0
- mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
+ mAllAgendaPopup->addAdditionalItem(QIcon(SmallIcon("bell")),
i18n("Toggle Alarm"),mAgenda,
SLOT(popupAlarm()),true);
#endif
connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
@@ -915,15 +927,15 @@ int KOAgendaView::maxDatesHint()
int KOAgendaView::currentDateCount()
{
return mSelectedDates.count();
}
-QPtrList<Incidence> KOAgendaView::selectedIncidences()
+Q3PtrList<Incidence> KOAgendaView::selectedIncidences()
{
- QPtrList<Incidence> selected;
+ Q3PtrList<Incidence> selected;
Incidence *incidence;
incidence = mAgenda->selectedIncidence();
if (incidence) selected.append(incidence);
incidence = mAllDayAgenda->selectedIncidence();
@@ -984,14 +996,14 @@ void KOAgendaView::updateConfig()
// for some reason, this needs to be called explicitly
mTimeLabels->repaint();
mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
// ToolTips displaying summary of events
- KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
- ->mEnableToolTips);
+ /* TODO:hacker: KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
+ ->mEnableToolTips); */
//setHolidayMasks();
//createDayLabels(); called by via updateView();
mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
updateView();
@@ -1114,13 +1126,13 @@ void KOAgendaView::showDates( const QDate &start, const QDate &end )
// and update the view
fillAgenda();
}
-void KOAgendaView::showEvents(QPtrList<Event>)
+void KOAgendaView::showEvents(Q3PtrList<Event>)
{
kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
}
void KOAgendaView::changeEventDisplay(Event *, int)
{
@@ -1162,17 +1174,17 @@ void KOAgendaView::fillAgenda()
mEventIndicatorBottom->changeColumns(mSelectedDates.count());
setHolidayMasks();
mMinY.resize(mSelectedDates.count());
mMaxY.resize(mSelectedDates.count());
- QPtrList<Event> dayEvents;
+ Q3PtrList<Event> dayEvents;
// ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
// Therefore, gtodoset all of them.
- QPtrList<Todo> todos = calendar()->todos();
+ Q3PtrList<Todo> todos = calendar()->todos();
mAgenda->setDateList(mSelectedDates);
QDate today = QDate::currentDate();
DateList::ConstIterator dit;
@@ -1297,13 +1309,13 @@ void KOAgendaView::fillAgenda()
if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue;
// ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
// Already completed items can be displayed on their original due date
//if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
- bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
+ bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)today) && KOPrefs::instance()->mShowTodoInAgenda;
bool fillIn = false;
if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
fillIn = true;
if ( ! fillIn && !todo->hasCompletedDate() )
fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
if ( fillIn ) {
@@ -1500,13 +1512,13 @@ void KOAgendaView::readSettings(KConfig *config)
{
// kdDebug() << "KOAgendaView::readSettings()" << endl;
config->setGroup("Views");
//#ifndef KORG_NOSPLITTER
- QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
+ Q3ValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
if (sizes.count() == 2) {
if ( sizes[0] < 20 ) {
sizes[1] = sizes[1] +20 - sizes[0];
sizes[0] = 20;
}
mSplitterAgenda->setSizes(sizes);
@@ -1521,13 +1533,13 @@ void KOAgendaView::writeSettings(KConfig *config)
{
// kdDebug() << "KOAgendaView::writeSettings()" << endl;
config->setGroup("Views");
//#ifndef KORG_NOSPLITTER
- QValueList<int> list = mSplitterAgenda->sizes();
+ Q3ValueList<int> list = mSplitterAgenda->sizes();
config->writeEntry("Separator AgendaView",list);
//qDebug("write %d %d ", list[0],list[1] );
//#endif
}
void KOAgendaView::setHolidayMasks()
@@ -1538,13 +1550,13 @@ void KOAgendaView::setHolidayMasks()
for(i=0;i<mSelectedDates.count();++i) {
QDate date = mSelectedDates[i];
bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
bool showHoliday = false;
if ( KOPrefs::instance()->mExcludeHolidays ) {
- QPtrList<Event> events = calendar()->events( date, true );
+ Q3PtrList<Event> events = calendar()->events( date, true );
Event *event;
for( event = events.first(); event; event = events.next() ) {
if ( event->isHoliday()) {
showHoliday = true;
break;
}
@@ -1660,13 +1672,13 @@ void KOAgendaView::updateTodo( Todo * t, int )
da = t->dtDue().date();
if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
remove = true;
removeAD = true;
}
else {
- bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
+ bool overdue = (!t->isCompleted()) && (t->dtDue() < (QDateTime)QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
if ( overdue &&
QDate::currentDate() >= mSelectedDates.first() &&
QDate::currentDate() <= mSelectedDates.last()) {
removeAD = false;
remove = true;
}