-rw-r--r-- | korganizer/navigatorbar.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index b03870f..f6a1a6a 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,279 +1,279 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
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 <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | bool isRTL = KOGlobals::self()->reverseLayout(); | 67 | bool isRTL = KOGlobals::self()->reverseLayout(); |
68 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
69 | bool isDesktop = false; | 69 | bool isDesktop = false; |
70 | #else | 70 | #else |
71 | bool isDesktop = true; | 71 | bool isDesktop = true; |
72 | #endif | 72 | #endif |
73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
74 | isDesktop = true; | 74 | isDesktop = true; |
75 | // Create backward navigation buttons | 75 | // Create backward navigation buttons |
76 | mPrevYear = new QPushButton( mCtrlFrame ); | 76 | mPrevYear = new QPushButton( mCtrlFrame ); |
77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); | 77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); |
78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
79 | 79 | ||
80 | mPrevMonth = new QPushButton( mCtrlFrame ); | 80 | mPrevMonth = new QPushButton( mCtrlFrame ); |
81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); | 81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); |
82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
83 | 83 | ||
84 | // Create forward navigation buttons | 84 | // Create forward navigation buttons |
85 | mNextMonth = new QPushButton( mCtrlFrame ); | 85 | mNextMonth = new QPushButton( mCtrlFrame ); |
86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); | 86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); |
87 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 87 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
88 | 88 | ||
89 | mPrevWeek = new QPushButton( mCtrlFrame ); | 89 | mPrevWeek = new QPushButton( mCtrlFrame ); |
90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); | 91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); |
92 | 92 | ||
93 | // Create forward navigation buttons | 93 | // Create forward navigation buttons |
94 | mNextWeek = new QPushButton( mCtrlFrame ); | 94 | mNextWeek = new QPushButton( mCtrlFrame ); |
95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
96 | QToolTip::add( mNextWeek, i18n("Next Week") ); | 96 | QToolTip::add( mNextWeek, i18n("Next Week") ); |
97 | 97 | ||
98 | mNextYear = new QPushButton( mCtrlFrame ); | 98 | mNextYear = new QPushButton( mCtrlFrame ); |
99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); | 99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); |
100 | QToolTip::add( mNextYear, i18n("Next Year") ); | 100 | QToolTip::add( mNextYear, i18n("Next Year") ); |
101 | mSelectMonth = new QPushButton( mCtrlFrame ); | 101 | mSelectMonth = new QPushButton( mCtrlFrame ); |
102 | // Create month name label | 102 | // Create month name label |
103 | //selectMonth->setFont( tfont ); | 103 | //selectMonth->setFont( tfont ); |
104 | // selectMonth->setAlignment( AlignCenter ); | 104 | // selectMonth->setAlignment( AlignCenter ); |
105 | //mDateLabel = new QLabel( selectMonth ); | 105 | //mDateLabel = new QLabel( selectMonth ); |
106 | //mDateLabel->setFont( tfont ); | 106 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 107 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 108 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 109 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 110 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
116 | 116 | ||
117 | mPrevYear->setAutoRepeat( true ); | 117 | mPrevYear->setAutoRepeat( true ); |
118 | mPrevMonth->setAutoRepeat( true ); | 118 | mPrevMonth->setAutoRepeat( true ); |
119 | mNextMonth->setAutoRepeat( true ); | 119 | mNextMonth->setAutoRepeat( true ); |
120 | mPrevWeek->setAutoRepeat( true ); | 120 | mPrevWeek->setAutoRepeat( true ); |
121 | mNextWeek->setAutoRepeat( true ); | 121 | mNextWeek->setAutoRepeat( true ); |
122 | mNextYear->setAutoRepeat( true ); | 122 | mNextYear->setAutoRepeat( true ); |
123 | } else { | 123 | } else { |
124 | mPrevWeek->hide(); | 124 | mPrevWeek->hide(); |
125 | mNextWeek->hide(); | 125 | mNextWeek->hide(); |
126 | } | 126 | } |
127 | 127 | ||
128 | resetFont( font() ); | 128 | resetFont( font() ); |
129 | 129 | ||
130 | 130 | ||
131 | // set up control frame layout | 131 | // set up control frame layout |
132 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 132 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
133 | ctrlLayout->addWidget( mPrevYear, 3 ); | 133 | ctrlLayout->addWidget( mPrevYear, 3 ); |
134 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 134 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
135 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 135 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
136 | //ctrlLayout->addStretch( 1 ); | 136 | //ctrlLayout->addStretch( 1 ); |
137 | // ctrlLayout->addSpacing( 1 ); | 137 | // ctrlLayout->addSpacing( 1 ); |
138 | // ctrlLayout->addWidget( mDateLabel ); | 138 | // ctrlLayout->addWidget( mDateLabel ); |
139 | ctrlLayout->addWidget( mSelectMonth ); | 139 | ctrlLayout->addWidget( mSelectMonth ); |
140 | // ctrlLayout->addSpacing( 1 ); | 140 | // ctrlLayout->addSpacing( 1 ); |
141 | // ctrlLayout->addStretch( 1 ); | 141 | // ctrlLayout->addStretch( 1 ); |
142 | ctrlLayout->addWidget( mNextWeek, 3 ); | 142 | ctrlLayout->addWidget( mNextWeek, 3 ); |
143 | ctrlLayout->addWidget( mNextMonth, 3 ); | 143 | ctrlLayout->addWidget( mNextMonth, 3 ); |
144 | ctrlLayout->addWidget( mNextYear, 3 ); | 144 | ctrlLayout->addWidget( mNextYear, 3 ); |
145 | 145 | ||
146 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 146 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
147 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 147 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
148 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 148 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
149 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 149 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
150 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 150 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
153 | mPrevYear->setFocusPolicy(NoFocus); | 153 | mPrevYear->setFocusPolicy(NoFocus); |
154 | mPrevMonth->setFocusPolicy(NoFocus); | 154 | mPrevMonth->setFocusPolicy(NoFocus); |
155 | mNextMonth->setFocusPolicy(NoFocus); | 155 | mNextMonth->setFocusPolicy(NoFocus); |
156 | mPrevWeek->setFocusPolicy(NoFocus); | 156 | mPrevWeek->setFocusPolicy(NoFocus); |
157 | mNextWeek->setFocusPolicy(NoFocus); | 157 | mNextWeek->setFocusPolicy(NoFocus); |
158 | mNextYear->setFocusPolicy(NoFocus); | 158 | mNextYear->setFocusPolicy(NoFocus); |
159 | mSelectMonth->setFocusPolicy(NoFocus); | 159 | mSelectMonth->setFocusPolicy(NoFocus); |
160 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 160 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
161 | 161 | ||
162 | } | 162 | } |
163 | 163 | ||
164 | NavigatorBar::~NavigatorBar() | 164 | NavigatorBar::~NavigatorBar() |
165 | { | 165 | { |
166 | } | 166 | } |
167 | QSize NavigatorBar::sizeHint() const | 167 | QSize NavigatorBar::sizeHint() const |
168 | { | 168 | { |
169 | int wid = mCurrentMinWid ; | 169 | int wid = mCurrentMinWid ; |
170 | if ( mPrevYear->isVisible() ) | 170 | if ( mPrevYear->isVisible() ) |
171 | wid += mCurrentButtonMinWid; | 171 | wid += mCurrentButtonMinWid; |
172 | if ( mPrevMonth->isVisible() ) | 172 | if ( mPrevMonth->isVisible() ) |
173 | wid += mCurrentButtonMinWid; | 173 | wid += mCurrentButtonMinWid; |
174 | if ( mPrevWeek->isVisible() ) | 174 | if ( mPrevWeek->isVisible() ) |
175 | wid += mCurrentButtonMinWid; | 175 | wid += mCurrentButtonMinWid; |
176 | if ( mNextMonth->isVisible() ) | 176 | if ( mNextMonth->isVisible() ) |
177 | wid += mCurrentButtonMinWid; | 177 | wid += mCurrentButtonMinWid; |
178 | if ( mNextWeek->isVisible() ) | 178 | if ( mNextWeek->isVisible() ) |
179 | wid += mCurrentButtonMinWid; | 179 | wid += mCurrentButtonMinWid; |
180 | if ( mNextYear->isVisible() ) | 180 | if ( mNextYear->isVisible() ) |
181 | wid += mCurrentButtonMinWid; | 181 | wid += mCurrentButtonMinWid; |
182 | //qDebug("ret %d %d ", wid, mCurrentHei); | 182 | //qDebug("ret %d %d ", wid, mCurrentHei); |
183 | return QSize ( wid, mCurrentHei ); | 183 | return QSize ( wid, mCurrentHei ); |
184 | } | 184 | } |
185 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const | 185 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const |
186 | { | 186 | { |
187 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); | 187 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); |
188 | } | 188 | } |
189 | void NavigatorBar::resetFont ( QFont fo ) | 189 | void NavigatorBar::resetFont ( QFont fo ) |
190 | { | 190 | { |
191 | 191 | ||
192 | QFont tfont = fo; | 192 | QFont tfont = fo; |
193 | if ( QApplication::desktop()->width() >= 480 ) | 193 | if ( QApplication::desktop()->width() >= 480 ) |
194 | tfont.setPointSize(tfont.pointSize()+2); | 194 | tfont.setPointSize(tfont.pointSize()+2); |
195 | tfont.setBold(true); | 195 | tfont.setBold(true); |
196 | 196 | ||
197 | mSelectMonth->setFont( tfont ); | 197 | mSelectMonth->setFont( tfont ); |
198 | // Set minimum width to width of widest month name label | 198 | // Set minimum width to width of widest month name label |
199 | int i; | 199 | int i; |
200 | int maxwidth = 0; | 200 | int maxwidth = 0; |
201 | QFontMetrics fm ( mSelectMonth->font() ); | 201 | QFontMetrics fm ( mSelectMonth->font() ); |
202 | int width = fm.width("September '00" ); | 202 | int width = fm.width("September '00" ); |
203 | maxwidth = width+2; | 203 | maxwidth = width+2; |
204 | int size = fm.height()+2; | 204 | int size = fm.height()+2; |
205 | if ( QApplication::desktop()->width() >= 480 ) { | 205 | if ( QApplication::desktop()->width() >= 480 ) { |
206 | size += 6; | 206 | size += 6; |
207 | maxwidth+= 6; | 207 | maxwidth+= 6; |
208 | } | 208 | } |
209 | mSelectMonth->setMinimumWidth( maxwidth ); | 209 | mSelectMonth->setMinimumWidth( maxwidth ); |
210 | mSelectMonth->setFixedHeight( size ); | 210 | mSelectMonth->setFixedHeight( size ); |
211 | mPrevYear->setFixedHeight( size ); | 211 | mPrevYear->setFixedHeight( size ); |
212 | mPrevMonth->setFixedHeight( size ); | 212 | mPrevMonth->setFixedHeight( size ); |
213 | mPrevWeek->setFixedHeight( size ); | 213 | mPrevWeek->setFixedHeight( size ); |
214 | mNextMonth->setFixedHeight( size ); | 214 | mNextMonth->setFixedHeight( size ); |
215 | mNextWeek->setFixedHeight( size ); | 215 | mNextWeek->setFixedHeight( size ); |
216 | mNextYear->setFixedHeight ( size ); | 216 | mNextYear->setFixedHeight ( size ); |
217 | mCurrentHei = size +2; | 217 | mCurrentHei = size +2; |
218 | mCurrentMinWid = maxwidth+2; | 218 | mCurrentMinWid = maxwidth+2; |
219 | mCurrentButtonMinWid = mPrevYear->sizeHint().width(); | 219 | mCurrentButtonMinWid = mPrevYear->sizeHint().width(); |
220 | } | 220 | } |
221 | 221 | ||
222 | void NavigatorBar::showButtons( bool left, bool right ) | 222 | void NavigatorBar::showButtons( bool left, bool right ) |
223 | { | 223 | { |
224 | if ( left ) { | 224 | if ( left ) { |
225 | mPrevYear->show(); | 225 | mPrevYear->show(); |
226 | mPrevMonth->show(); | 226 | mPrevMonth->show(); |
227 | } else { | 227 | } else { |
228 | mPrevYear->hide(); | 228 | mPrevYear->hide(); |
229 | mPrevMonth->hide(); | 229 | mPrevMonth->hide(); |
230 | } | 230 | } |
231 | 231 | ||
232 | if ( right ) { | 232 | if ( right ) { |
233 | mNextYear->show(); | 233 | mNextYear->show(); |
234 | mNextMonth->show(); | 234 | mNextMonth->show(); |
235 | } else { | 235 | } else { |
236 | mNextYear->hide(); | 236 | mNextYear->hide(); |
237 | mNextMonth->hide(); | 237 | mNextMonth->hide(); |
238 | } | 238 | } |
239 | if ( !left && !right ) { | 239 | if ( !left && !right ) { |
240 | //mSelectMonth->setMaximumWidth( 1024 ); | 240 | //mSelectMonth->setMaximumWidth( 1024 ); |
241 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 241 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void NavigatorBar::selectMonth() | 245 | void NavigatorBar::selectMonth() |
246 | { | 246 | { |
247 | 247 | ||
248 | int month; | 248 | int month; |
249 | KPopupFrame* popup = new KPopupFrame(this); | 249 | KPopupFrame* popup = new KPopupFrame(this); |
250 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); | 250 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); |
251 | // ----- | 251 | // ----- |
252 | picker->resize(picker->sizeHint()); | 252 | picker->resize(picker->sizeHint()); |
253 | popup->setMainWidget(picker); | 253 | popup->setMainWidget(picker); |
254 | picker->setFocus(); | 254 | picker->setFocus(); |
255 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 255 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
256 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 256 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
257 | { | 257 | { |
258 | month = picker->getResult(); | 258 | month = picker->getResult(); |
259 | emit monthSelected ( month ); | 259 | emit monthSelected ( month ); |
260 | } else { | 260 | } else { |
261 | KNotifyClient::beep(); | 261 | KNotifyClient::beep(); |
262 | } | 262 | } |
263 | delete popup; | 263 | delete popup; |
264 | } | 264 | } |
265 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 265 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
266 | { | 266 | { |
267 | if (dateList.count() > 0) { | 267 | if (dateList.count() > 0) { |
268 | QDate date = dateList.first(); | 268 | QDate date = dateList.first(); |
269 | 269 | ||
270 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 270 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
271 | 271 | ||
272 | // compute the label at the top of the navigator | 272 | // compute the label at the top of the navigator |
273 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 273 | QString dtstr = calSys->monthName( date ) + " '" + |
274 | QString::number( calSys->year( date ) ).right(2); | 274 | QString::number( calSys->year( date ) ).right(2); |
275 | 275 | ||
276 | mSelectMonth->setText( dtstr ); | 276 | mSelectMonth->setText( dtstr ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||