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) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/navigatorbar.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-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 | |||
@@ -5,80 +5,83 @@ | |||
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <q3frame.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <q3popupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <QDesktopWidget> | ||
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
33 | 36 | ||
34 | #include <kdebug.h> | 37 | #include <kdebug.h> |
35 | #include <klocale.h> | 38 | #include <klocale.h> |
36 | #include <kglobal.h> | 39 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 41 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 42 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 43 | #include "kdatetbl.h" |
41 | 44 | ||
42 | #include "koglobals.h" | 45 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 46 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 47 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 49 | #include "kocore.h" |
47 | #endif | 50 | #endif |
48 | 51 | ||
49 | #include <kcalendarsystem.h> | 52 | #include <kcalendarsystem.h> |
50 | 53 | ||
51 | #include "navigatorbar.h" | 54 | #include "navigatorbar.h" |
52 | 55 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 56 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 57 | : QWidget( parent, name ) |
55 | { | 58 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 59 | Q3BoxLayout *topLayout = new Q3HBoxLayout( this ); |
57 | 60 | ||
58 | // Set up the control buttons and date label | 61 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 62 | mCtrlFrame = new Q3Frame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 63 | mCtrlFrame->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 64 | mCtrlFrame->setLineWidth(1); |
62 | 65 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 66 | topLayout->addWidget( mCtrlFrame ); |
64 | 67 | ||
65 | 68 | ||
66 | 69 | ||
67 | bool isRTL = KOGlobals::self()->reverseLayout(); | 70 | bool isRTL = KOGlobals::self()->reverseLayout(); |
68 | #ifndef DESKTOP_VERSION | 71 | #ifndef DESKTOP_VERSION |
69 | bool isDesktop = false; | 72 | bool isDesktop = false; |
70 | #else | 73 | #else |
71 | bool isDesktop = true; | 74 | bool isDesktop = true; |
72 | #endif | 75 | #endif |
73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 76 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
74 | isDesktop = true; | 77 | isDesktop = true; |
75 | // Create backward navigation buttons | 78 | // Create backward navigation buttons |
76 | mPrevYear = new QPushButton( mCtrlFrame ); | 79 | mPrevYear = new QPushButton( mCtrlFrame ); |
77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); | 80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); |
78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
79 | 82 | ||
80 | mPrevMonth = new QPushButton( mCtrlFrame ); | 83 | mPrevMonth = new QPushButton( mCtrlFrame ); |
81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); | 84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); |
82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
83 | 86 | ||
84 | // Create forward navigation buttons | 87 | // Create forward navigation buttons |
@@ -108,76 +111,76 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 111 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 112 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 113 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 114 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 115 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 116 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 117 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 118 | mPrevWeek->setFlat( true); |
116 | 119 | ||
117 | mPrevYear->setAutoRepeat( true ); | 120 | mPrevYear->setAutoRepeat( true ); |
118 | mPrevMonth->setAutoRepeat( true ); | 121 | mPrevMonth->setAutoRepeat( true ); |
119 | mNextMonth->setAutoRepeat( true ); | 122 | mNextMonth->setAutoRepeat( true ); |
120 | mPrevWeek->setAutoRepeat( true ); | 123 | mPrevWeek->setAutoRepeat( true ); |
121 | mNextWeek->setAutoRepeat( true ); | 124 | mNextWeek->setAutoRepeat( true ); |
122 | mNextYear->setAutoRepeat( true ); | 125 | mNextYear->setAutoRepeat( true ); |
123 | } else { | 126 | } else { |
124 | mPrevWeek->hide(); | 127 | mPrevWeek->hide(); |
125 | mNextWeek->hide(); | 128 | mNextWeek->hide(); |
126 | } | 129 | } |
127 | 130 | ||
128 | resetFont( font() ); | 131 | resetFont( font() ); |
129 | 132 | ||
130 | 133 | ||
131 | // set up control frame layout | 134 | // set up control frame layout |
132 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 135 | Q3BoxLayout *ctrlLayout = new Q3HBoxLayout( mCtrlFrame, 1 ); |
133 | ctrlLayout->addWidget( mPrevYear, 3 ); | 136 | ctrlLayout->addWidget( mPrevYear, 3 ); |
134 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 137 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
135 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 138 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
136 | //ctrlLayout->addStretch( 1 ); | 139 | //ctrlLayout->addStretch( 1 ); |
137 | // ctrlLayout->addSpacing( 1 ); | 140 | // ctrlLayout->addSpacing( 1 ); |
138 | // ctrlLayout->addWidget( mDateLabel ); | 141 | // ctrlLayout->addWidget( mDateLabel ); |
139 | ctrlLayout->addWidget( mSelectMonth ); | 142 | ctrlLayout->addWidget( mSelectMonth ); |
140 | // ctrlLayout->addSpacing( 1 ); | 143 | // ctrlLayout->addSpacing( 1 ); |
141 | // ctrlLayout->addStretch( 1 ); | 144 | // ctrlLayout->addStretch( 1 ); |
142 | ctrlLayout->addWidget( mNextWeek, 3 ); | 145 | ctrlLayout->addWidget( mNextWeek, 3 ); |
143 | ctrlLayout->addWidget( mNextMonth, 3 ); | 146 | ctrlLayout->addWidget( mNextMonth, 3 ); |
144 | ctrlLayout->addWidget( mNextYear, 3 ); | 147 | ctrlLayout->addWidget( mNextYear, 3 ); |
145 | 148 | ||
146 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 149 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
147 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 150 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
148 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 151 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
149 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 152 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
150 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 153 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 154 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 155 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
153 | mPrevYear->setFocusPolicy(NoFocus); | 156 | mPrevYear->setFocusPolicy(Qt::NoFocus); |
154 | mPrevMonth->setFocusPolicy(NoFocus); | 157 | mPrevMonth->setFocusPolicy(Qt::NoFocus); |
155 | mNextMonth->setFocusPolicy(NoFocus); | 158 | mNextMonth->setFocusPolicy(Qt::NoFocus); |
156 | mPrevWeek->setFocusPolicy(NoFocus); | 159 | mPrevWeek->setFocusPolicy(Qt::NoFocus); |
157 | mNextWeek->setFocusPolicy(NoFocus); | 160 | mNextWeek->setFocusPolicy(Qt::NoFocus); |
158 | mNextYear->setFocusPolicy(NoFocus); | 161 | mNextYear->setFocusPolicy(Qt::NoFocus); |
159 | mSelectMonth->setFocusPolicy(NoFocus); | 162 | mSelectMonth->setFocusPolicy(Qt::NoFocus); |
160 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 163 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
161 | 164 | ||
162 | } | 165 | } |
163 | 166 | ||
164 | NavigatorBar::~NavigatorBar() | 167 | NavigatorBar::~NavigatorBar() |
165 | { | 168 | { |
166 | } | 169 | } |
167 | QSize NavigatorBar::sizeHint() const | 170 | QSize NavigatorBar::sizeHint() const |
168 | { | 171 | { |
169 | int wid = mCurrentMinWid ; | 172 | int wid = mCurrentMinWid ; |
170 | if ( mPrevYear->isVisible() ) | 173 | if ( mPrevYear->isVisible() ) |
171 | wid += mCurrentButtonMinWid; | 174 | wid += mCurrentButtonMinWid; |
172 | if ( mPrevMonth->isVisible() ) | 175 | if ( mPrevMonth->isVisible() ) |
173 | wid += mCurrentButtonMinWid; | 176 | wid += mCurrentButtonMinWid; |
174 | if ( mPrevWeek->isVisible() ) | 177 | if ( mPrevWeek->isVisible() ) |
175 | wid += mCurrentButtonMinWid; | 178 | wid += mCurrentButtonMinWid; |
176 | if ( mNextMonth->isVisible() ) | 179 | if ( mNextMonth->isVisible() ) |
177 | wid += mCurrentButtonMinWid; | 180 | wid += mCurrentButtonMinWid; |
178 | if ( mNextWeek->isVisible() ) | 181 | if ( mNextWeek->isVisible() ) |
179 | wid += mCurrentButtonMinWid; | 182 | wid += mCurrentButtonMinWid; |
180 | if ( mNextYear->isVisible() ) | 183 | if ( mNextYear->isVisible() ) |
181 | wid += mCurrentButtonMinWid; | 184 | wid += mCurrentButtonMinWid; |
182 | //qDebug("ret %d %d ", wid, mCurrentHei); | 185 | //qDebug("ret %d %d ", wid, mCurrentHei); |
183 | return QSize ( wid, mCurrentHei ); | 186 | return QSize ( wid, mCurrentHei ); |