author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/kdatenavigator.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/kdatenavigator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kdatenavigator.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 6697602..ecc7a2f 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -1,152 +1,156 @@ /* This file is part of KOrganizer. Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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 <qstring.h> -#include <qkeycode.h> +#include <qnamespace.h> #include <qlayout.h> #include <qtimer.h> -#include <qframe.h> +#include <q3frame.h> #include <qlabel.h> #include <qapplication.h> +//Added by qt3to4: +#include <QWheelEvent> +#include <Q3GridLayout> +#include <QEvent> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include "koglobals.h" #include "koprefs.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include <kcalendarsystem.h> #include "navigatorbar.h" #include "kdatenavigator.h" KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) - : QFrame(parent, name), + : Q3Frame(parent, name), updateTimer(0L) { - setFrameStyle(QFrame::NoFrame); + setFrameStyle(Q3Frame::NoFrame); QDate startDate = QDate::currentDate(); - QGridLayout *topLayout = new QGridLayout(this,8,8); + Q3GridLayout *topLayout = new Q3GridLayout(this,8,8); if (! startDate.isValid()) { qDebug("KDateNavigator::invalid startdate "); startDate = QDate::currentDate(); } mMonthSignalOffset = 0; mSelectedDates.append(startDate); m_MthYr = startDate; m_bShowWeekNums = true; setFont( KOPrefs::instance()->mDateNavigatorFont ); mNavigatorBar = new NavigatorBar( startDate, this ); topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); //mNavigatorBar->resize( 1,1); connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); // get the day of the week on the first day QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); m_fstDayOfWk = dayone.dayOfWeek(); int i; // Set up the heading fields. for( i = 0; i < 7; i++ ) { headings[i] = new QLabel("",this); //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); - headings[i]->setAlignment(AlignCenter); + headings[i]->setAlignment(Qt::AlignCenter); headings[i]->installEventFilter(this); topLayout->addWidget(headings[i],1,i+1); } // Create the weeknumber labels for( i = 0; i < 6; i++ ) { weeknos[i] = new QLabel(this); - weeknos[i]->setAlignment(AlignCenter ); + weeknos[i]->setAlignment(Qt::AlignCenter ); //weeknos[i]->setFont(QFont("Arial", 10)); if(!m_bShowWeekNums) { weeknos[i]->hide(); } weeknos[i]->installEventFilter(this); topLayout->addWidget(weeknos[i],i+2,0); } daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); - daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); + daymatrix->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken); daymatrix->setLineWidth(1); connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), SIGNAL( datesSelected( const KCal::DateList & ) ) ); connect( daymatrix, SIGNAL( eventDropped( Event * ) ), SIGNAL( eventDropped( Event * ) ) ); topLayout->addMultiCellWidget(daymatrix,2,7,1,7); // read settings from configuration file. updateConfig(); enableRollover(FollowMonth); mySizeHint = sizeHintTwoButtons(); myFullSizeHint = sizeHintTwoButtons( 4 ); mFontChanged = false; //resize ( 3,3 ); } void KDateNavigator::changeFont ( QFont fo ) { setFont( fo ); mNavigatorBar->resetFont( fo ); } QFont KDateNavigator::yourFontHint( QSize si , bool *b) { QFont fo = KOPrefs::instance()->mDateNavigatorFont; *b = false; int fontPoint = fo.pointSize(); while ( fontPoint > 5 ) { --fontPoint; fo.setPointSize( fontPoint ); setFont( fo ); mFontChanged = true; mNavigatorBar->resetFont( fo ); QSize sh = sizeHintTwoButtons( 2 ); //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); if ( si.width() > sh.width() && si.height() > sh.height()) { if ( si.width() / sh.width() == 1 ) { if ( si.width() < sizeHintTwoButtons( 4 ).width()) continue; } *b = true; break; } } return fo; } |