summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
Unidiff
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp39
1 files changed, 2 insertions, 37 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 24de01f..657f98d 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -69,14 +69,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
69 bool isRTL = KOGlobals::self()->reverseLayout(); 69 bool isRTL = KOGlobals::self()->reverseLayout();
70#ifndef DESKTOP_VERSION 70#ifndef DESKTOP_VERSION
71 bool isDesktop = false; 71 bool isDesktop = false;
72#else 72#else
73 bool isDesktop = true; 73 bool isDesktop = true;
74#endif 74#endif
75 bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; 75 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
76 if ( insertWeek && QApplication::desktop()->width() > 320 )
77 isDesktop = true; 76 isDesktop = true;
78 // Create backward navigation buttons 77 // Create backward navigation buttons
79 mPrevYear = new QPushButton( mCtrlFrame ); 78 mPrevYear = new QPushButton( mCtrlFrame );
80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 79 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
81 QToolTip::add( mPrevYear, i18n("Previous Year") ); 80 QToolTip::add( mPrevYear, i18n("Previous Year") );
82 81
@@ -86,19 +85,12 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
86 85
87 // Create forward navigation buttons 86 // Create forward navigation buttons
88 mNextMonth = new QPushButton( mCtrlFrame ); 87 mNextMonth = new QPushButton( mCtrlFrame );
89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 88 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
90 QToolTip::add( mNextMonth, i18n("Next Month") ); 89 QToolTip::add( mNextMonth, i18n("Next Month") );
91 90
92 QPushButton * selWeek = 0;
93 if ( insertWeek ) {
94 selWeek = new QPushButton( mCtrlFrame );
95 QToolTip::add( selWeek, i18n("Select Week") );
96 selWeek->setFocusPolicy(NoFocus);
97 }
98
99 mNextYear = new QPushButton( mCtrlFrame ); 91 mNextYear = new QPushButton( mCtrlFrame );
100 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 92 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
101 QToolTip::add( mNextYear, i18n("Next Year") ); 93 QToolTip::add( mNextYear, i18n("Next Year") );
102 mSelectMonth = new QPushButton( mCtrlFrame ); 94 mSelectMonth = new QPushButton( mCtrlFrame );
103 // Create month name label 95 // Create month name label
104 //selectMonth->setFont( tfont ); 96 //selectMonth->setFont( tfont );
@@ -108,15 +100,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
108 //mDateLabel->setAlignment( AlignCenter ); 100 //mDateLabel->setAlignment( AlignCenter );
109 if ( QString ( name ) == QString("useBigPixmaps") ) { 101 if ( QString ( name ) == QString("useBigPixmaps") ) {
110 mNextMonth->setFlat( true); 102 mNextMonth->setFlat( true);
111 mNextYear->setFlat( true); 103 mNextYear->setFlat( true);
112 mSelectMonth->setFlat( true); 104 mSelectMonth->setFlat( true);
113 mPrevYear->setFlat( true); 105 mPrevYear->setFlat( true);
114 mPrevMonth->setFlat( true); 106 mPrevMonth->setFlat( true);
115 if ( insertWeek )
116 selWeek->setFlat( true);
117 } 107 }
118 mSelectMonth->setFont( tfont ); 108 mSelectMonth->setFont( tfont );
119 // Set minimum width to width of widest month name label 109 // Set minimum width to width of widest month name label
120 int i; 110 int i;
121 int maxwidth = 0; 111 int maxwidth = 0;
122 QFontMetrics fm ( mSelectMonth->font() ); 112 QFontMetrics fm ( mSelectMonth->font() );
@@ -132,35 +122,12 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
132 int size = fm.height()+2; 122 int size = fm.height()+2;
133 if ( QApplication::desktop()->width() >= 480 ) { 123 if ( QApplication::desktop()->width() >= 480 ) {
134 size += 6; 124 size += 6;
135 maxwidth+= 6; 125 maxwidth+= 6;
136 } 126 }
137 127
138 if ( insertWeek ) {
139 QPopupMenu * wpo = new QPopupMenu (this);
140 QPopupMenu * all = new QPopupMenu (this);
141 //wpo->insertItem( i18n("W#"), 0 );
142 int first = 1;
143 for ( i = 1; i < 50; ++i ) {
144 if ( !(i%10) ) {
145 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
146 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
147 first = i;
148 wpo = new QPopupMenu (this);
149 }
150 wpo->insertItem( QString::number(i), i );
151 }
152 for ( i = 50; i < 53; ++i ) {
153 wpo->insertItem( QString::number(i), i);
154 }
155 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
156 selWeek->setPopup( all );
157 selWeek->setFixedWidth( (size/5)*4 );
158 selWeek->setFixedHeight( size );
159 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
160 }
161 mSelectMonth->setFixedWidth( maxwidth ); 128 mSelectMonth->setFixedWidth( maxwidth );
162 mSelectMonth->setFixedHeight( size ); 129 mSelectMonth->setFixedHeight( size );
163 mPrevYear->setFixedHeight( size ); 130 mPrevYear->setFixedHeight( size );
164 mPrevMonth->setFixedHeight( size ); 131 mPrevMonth->setFixedHeight( size );
165 mNextMonth->setFixedHeight( size ); 132 mNextMonth->setFixedHeight( size );
166 mNextYear->setFixedHeight ( size ); 133 mNextYear->setFixedHeight ( size );
@@ -173,14 +140,12 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
173 // ctrlLayout->addWidget( mDateLabel ); 140 // ctrlLayout->addWidget( mDateLabel );
174 ctrlLayout->addWidget( mSelectMonth ); 141 ctrlLayout->addWidget( mSelectMonth );
175 // ctrlLayout->addSpacing( 1 ); 142 // ctrlLayout->addSpacing( 1 );
176 // ctrlLayout->addStretch( 1 ); 143 // ctrlLayout->addStretch( 1 );
177 ctrlLayout->addWidget( mNextMonth, 3 ); 144 ctrlLayout->addWidget( mNextMonth, 3 );
178 ctrlLayout->addWidget( mNextYear, 3 ); 145 ctrlLayout->addWidget( mNextYear, 3 );
179 if ( insertWeek )
180 ctrlLayout->addWidget( selWeek );
181 146
182 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 147 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
183 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 148 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
184 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 149 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
185 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 150 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
186 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 151 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );