-rw-r--r-- | korganizer/navigatorbar.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index f6a1a6a..59c3e45 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -1,92 +1,95 @@ /* This file is part of KOrganizer. Copyright (c) 2003 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 <qtooltip.h> #include <qpushbutton.h> #include <qlayout.h> -#include <qframe.h> +#include <q3frame.h> #include <qlabel.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qapplication.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <Q3HBoxLayout> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include "libkdepim/kdatepicker.h" #include <knotifyclient.h> #include "kdatetbl.h" #include "koglobals.h" #include <kglobalsettings.h> #include "koprefs.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include <kcalendarsystem.h> #include "navigatorbar.h" NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) : QWidget( parent, name ) { - QBoxLayout *topLayout = new QHBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3HBoxLayout( this ); // Set up the control buttons and date label - mCtrlFrame = new QFrame( this ); - mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); + mCtrlFrame = new Q3Frame( this ); + mCtrlFrame->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised); mCtrlFrame->setLineWidth(1); topLayout->addWidget( mCtrlFrame ); bool isRTL = KOGlobals::self()->reverseLayout(); #ifndef DESKTOP_VERSION bool isDesktop = false; #else bool isDesktop = true; #endif if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons mPrevYear = new QPushButton( mCtrlFrame ); mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); QToolTip::add( mPrevYear, i18n("Previous Year") ); mPrevMonth = new QPushButton( mCtrlFrame ); mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); QToolTip::add( mPrevMonth, i18n("Previous Month") ); // Create forward navigation buttons mNextMonth = new QPushButton( mCtrlFrame ); mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); QToolTip::add( mNextMonth, i18n("Next Month") ); mPrevWeek = new QPushButton( mCtrlFrame ); mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); QToolTip::add( mPrevWeek, i18n("Previous Week") ); @@ -100,92 +103,92 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam QToolTip::add( mNextYear, i18n("Next Year") ); mSelectMonth = new QPushButton( mCtrlFrame ); // Create month name label //selectMonth->setFont( tfont ); // selectMonth->setAlignment( AlignCenter ); //mDateLabel = new QLabel( selectMonth ); //mDateLabel->setFont( tfont ); //mDateLabel->setAlignment( AlignCenter ); if ( QString ( name ) == QString("useBigPixmaps") ) { mNextMonth->setFlat( true); mNextWeek->setFlat( true); mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); mPrevMonth->setFlat( true); mPrevWeek->setFlat( true); mPrevYear->setAutoRepeat( true ); mPrevMonth->setAutoRepeat( true ); mNextMonth->setAutoRepeat( true ); mPrevWeek->setAutoRepeat( true ); mNextWeek->setAutoRepeat( true ); mNextYear->setAutoRepeat( true ); } else { mPrevWeek->hide(); mNextWeek->hide(); } resetFont( font() ); // set up control frame layout - QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); + Q3BoxLayout *ctrlLayout = new Q3HBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); ctrlLayout->addWidget( mPrevWeek, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextWeek, 3 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); - mPrevYear->setFocusPolicy(NoFocus); - mPrevMonth->setFocusPolicy(NoFocus); - mNextMonth->setFocusPolicy(NoFocus); - mPrevWeek->setFocusPolicy(NoFocus); - mNextWeek->setFocusPolicy(NoFocus); - mNextYear->setFocusPolicy(NoFocus); - mSelectMonth->setFocusPolicy(NoFocus); + mPrevYear->setFocusPolicy(Qt::NoFocus); + mPrevMonth->setFocusPolicy(Qt::NoFocus); + mNextMonth->setFocusPolicy(Qt::NoFocus); + mPrevWeek->setFocusPolicy(Qt::NoFocus); + mNextWeek->setFocusPolicy(Qt::NoFocus); + mNextYear->setFocusPolicy(Qt::NoFocus); + mSelectMonth->setFocusPolicy(Qt::NoFocus); setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } NavigatorBar::~NavigatorBar() { } QSize NavigatorBar::sizeHint() const { int wid = mCurrentMinWid ; if ( mPrevYear->isVisible() ) wid += mCurrentButtonMinWid; if ( mPrevMonth->isVisible() ) wid += mCurrentButtonMinWid; if ( mPrevWeek->isVisible() ) wid += mCurrentButtonMinWid; if ( mNextMonth->isVisible() ) wid += mCurrentButtonMinWid; if ( mNextWeek->isVisible() ) wid += mCurrentButtonMinWid; if ( mNextYear->isVisible() ) wid += mCurrentButtonMinWid; //qDebug("ret %d %d ", wid, mCurrentHei); return QSize ( wid, mCurrentHei ); } QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const { return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); } void NavigatorBar::resetFont ( QFont fo ) { |