summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-30 23:17:42 (UTC)
committer zautrix <zautrix>2005-03-30 23:17:42 (UTC)
commit529c0fb8a8bf15e7bd375ddeb355c5802baf4c93 (patch) (unidiff)
tree72ebca6de7e54f2cf89d3d6df61d3b40aa66a444 /korganizer
parent28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (diff)
downloadkdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.zip
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.gz
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.bz2
key fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp19
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/mainwindow.cpp26
-rw-r--r--korganizer/mainwindow.h1
4 files changed, 46 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ca35a86..b9ce4f4 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -979,48 +979,49 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
979 979
980 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 980 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
981 Incidence *incidence = eventItem->incidence(); 981 Incidence *incidence = eventItem->incidence();
982 if ( incidence ) mMonthView->showContextMenu( incidence ); 982 if ( incidence ) mMonthView->showContextMenu( incidence );
983} 983}
984 984
985void MonthViewCell::selection( QListBoxItem *item ) 985void MonthViewCell::selection( QListBoxItem *item )
986{ 986{
987 if ( !item ) return; 987 if ( !item ) return;
988 988
989 mMonthView->setSelectedCell( this ); 989 mMonthView->setSelectedCell( this );
990} 990}
991 991
992 992
993// ******************************************************************************* 993// *******************************************************************************
994// ******************************************************************************* 994// *******************************************************************************
995// ******************************************************************************* 995// *******************************************************************************
996 996
997 997
998KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 998KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
999 : KOEventView( calendar, parent, name ), 999 : KOEventView( calendar, parent, name ),
1000 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1000 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1001 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1001 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1002{ 1002{
1003 mFlagKeyPressed = false;
1003 mShortDayLabelsM = false; 1004 mShortDayLabelsM = false;
1004 mShortDayLabelsW = false; 1005 mShortDayLabelsW = false;
1005 skipResize = false; 1006 skipResize = false;
1006 clPending = true; 1007 clPending = true;
1007 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1008 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1008 mWidStack = new QWidgetStack( this ); 1009 mWidStack = new QWidgetStack( this );
1009 QVBoxLayout* hb = new QVBoxLayout( this ); 1010 QVBoxLayout* hb = new QVBoxLayout( this );
1010 mMonthView = new QWidget( mWidStack ); 1011 mMonthView = new QWidget( mWidStack );
1011 mWeekView = new QWidget( mWidStack ); 1012 mWeekView = new QWidget( mWidStack );
1012#if QT_VERSION >= 0x030000 1013#if QT_VERSION >= 0x030000
1013 mWidStack->addWidget(mMonthView ); 1014 mWidStack->addWidget(mMonthView );
1014 mWidStack->addWidget(mWeekView ); 1015 mWidStack->addWidget(mWeekView );
1015#else 1016#else
1016 mWidStack->addWidget( mMonthView, 1 ); 1017 mWidStack->addWidget( mMonthView, 1 );
1017 mWidStack->addWidget( mWeekView , 1 ); 1018 mWidStack->addWidget( mWeekView , 1 );
1018#endif 1019#endif
1019 hb->addWidget( mNavigatorBar ); 1020 hb->addWidget( mNavigatorBar );
1020 hb->addWidget( mWidStack ); 1021 hb->addWidget( mWidStack );
1021 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1022 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1022 updatePossible = false; 1023 updatePossible = false;
1023 //updatePossible = true; 1024 //updatePossible = true;
1024 mCells.setAutoDelete( true ); 1025 mCells.setAutoDelete( true );
1025 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1026 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1026 mDayLabels.resize( mDaysPerWeek ); 1027 mDayLabels.resize( mDaysPerWeek );
@@ -1816,51 +1817,67 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
1816 if ( !mSelectedCell ) 1817 if ( !mSelectedCell )
1817 emit incidenceSelected( 0 ); 1818 emit incidenceSelected( 0 );
1818 else 1819 else
1819 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1820 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1820} 1821}
1821 1822
1822void KOMonthView::processSelectionChange() 1823void KOMonthView::processSelectionChange()
1823{ 1824{
1824 QPtrList<Incidence> incidences = selectedIncidences(); 1825 QPtrList<Incidence> incidences = selectedIncidences();
1825 if (incidences.count() > 0) { 1826 if (incidences.count() > 0) {
1826 emit incidenceSelected( incidences.first() ); 1827 emit incidenceSelected( incidences.first() );
1827 } else { 1828 } else {
1828 emit incidenceSelected( 0 ); 1829 emit incidenceSelected( 0 );
1829 clearSelection(); 1830 clearSelection();
1830 } 1831 }
1831} 1832}
1832 1833
1833void KOMonthView::clearSelection() 1834void KOMonthView::clearSelection()
1834{ 1835{
1835 if ( mSelectedCell ) { 1836 if ( mSelectedCell ) {
1836 mSelectedCell->deselect(); 1837 mSelectedCell->deselect();
1837 mSelectedCell = 0; 1838 mSelectedCell = 0;
1838 } 1839 }
1839} 1840}
1841
1842void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
1843{
1844 if ( !e->isAutoRepeat() ) {
1845 mFlagKeyPressed = false;
1846 }
1847}
1848
1840void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1849void KOMonthView::keyPressEvent ( QKeyEvent * e )
1841{ 1850{
1842 //qDebug("KOMonthView::keyPressEvent "); 1851
1852 qApp->processEvents();
1853 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1854 //e->ignore();
1855 e->accept();
1856 return;
1857 }
1858 if (! e->isAutoRepeat() )
1859 mFlagKeyPressed = true;
1843 switch(e->key()) { 1860 switch(e->key()) {
1844 case Key_Up: 1861 case Key_Up:
1845 { 1862 {
1846 if ( mShowWeekView ) { 1863 if ( mShowWeekView ) {
1847 emit selectWeekNum ( currentWeek() - 1 ); 1864 emit selectWeekNum ( currentWeek() - 1 );
1848 } 1865 }
1849 else { 1866 else {
1850 emit prevMonth(); 1867 emit prevMonth();
1851 } 1868 }
1852 } 1869 }
1853 e->accept(); 1870 e->accept();
1854 break; 1871 break;
1855 case Key_Down: 1872 case Key_Down:
1856 { 1873 {
1857 if ( mShowWeekView ) { 1874 if ( mShowWeekView ) {
1858 emit selectWeekNum ( currentWeek() +1); 1875 emit selectWeekNum ( currentWeek() +1);
1859 } 1876 }
1860 else { 1877 else {
1861 emit nextMonth(); 1878 emit nextMonth();
1862 } 1879 }
1863 1880
1864 } 1881 }
1865 e->accept(); 1882 e->accept();
1866 break; 1883 break;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c1ca3d4..88050fe 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -290,31 +290,32 @@ class KOMonthView: public KOEventView
290 bool mShowWeekView; 290 bool mShowWeekView;
291 bool updatePossible; 291 bool updatePossible;
292 int mDaysPerWeek; 292 int mDaysPerWeek;
293 int mNumWeeks; 293 int mNumWeeks;
294 int mNumCells; 294 int mNumCells;
295 //bool mWeekStartsMonday; 295 //bool mWeekStartsMonday;
296 bool mShowSatSunComp; 296 bool mShowSatSunComp;
297 void computeLayout(); 297 void computeLayout();
298 void computeLayoutWeek(); 298 void computeLayoutWeek();
299 299
300 QPtrVector<MonthViewCell> mCells; 300 QPtrVector<MonthViewCell> mCells;
301 QPtrVector<QLabel> mDayLabels; 301 QPtrVector<QLabel> mDayLabels;
302 QPtrVector<KOWeekButton> mWeekLabels; 302 QPtrVector<KOWeekButton> mWeekLabels;
303 QPtrVector<MonthViewCell> mCellsW; 303 QPtrVector<MonthViewCell> mCellsW;
304 QPtrVector<QLabel> mDayLabelsW; 304 QPtrVector<QLabel> mDayLabelsW;
305 QPtrVector<KOWeekButton> mWeekLabelsW; 305 QPtrVector<KOWeekButton> mWeekLabelsW;
306 306
307 bool mShortDayLabelsM; 307 bool mShortDayLabelsM;
308 bool mShortDayLabelsW; 308 bool mShortDayLabelsW;
309 int mWidthLongDayLabel; 309 int mWidthLongDayLabel;
310 310
311 QDate mStartDate; 311 QDate mStartDate;
312 312
313 MonthViewCell *mSelectedCell; 313 MonthViewCell *mSelectedCell;
314 314 bool mFlagKeyPressed;
315 KOEventPopupMenu *mContextMenu; 315 KOEventPopupMenu *mContextMenu;
316 void keyPressEvent ( QKeyEvent * ) ; 316 void keyPressEvent ( QKeyEvent * ) ;
317 void keyReleaseEvent ( QKeyEvent * ) ;
317 318
318}; 319};
319 320
320#endif 321#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ae03a09..09a0880 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -145,84 +145,95 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
149 p->mHourSize = 22; 149 p->mHourSize = 22;
150 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
151 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
152 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
153 tbd = Bottom; 153 tbd = Bottom;
154 else 154 else
155 tbd = Top; 155 tbd = Top;
156 } 156 }
157 else { 157 else {
158 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
159 tbd = Right; 159 tbd = Right;
160 else 160 else
161 tbd = Left; 161 tbd = Left;
162 } 162 }
163 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
165 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
166 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
167 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168 168
169 if ( KOPrefs::instance()->mShowIconFilter ) { 169#ifdef DESKTOP_VERSION
170 if ( KOPrefs::instance()->mShowIconFilter )
171#else
172 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
173#endif
174
175{
170 if ( p->mToolBarHorF ) { 176 if ( p->mToolBarHorF ) {
171 if ( p->mToolBarUpF ) 177 if ( p->mToolBarUpF )
172 tbd = Bottom; 178 tbd = Bottom;
173 else 179 else
174 tbd = Top; 180 tbd = Top;
175 } 181 }
176 else { 182 else {
177 if ( p->mToolBarUpF ) 183 if ( p->mToolBarUpF )
178 tbd = Right; 184 tbd = Right;
179 else 185 else
180 tbd = Left; 186 tbd = Left;
181 } 187 }
182 filterToolBar = new QPEToolBar ( this ); 188 filterToolBar = new QPEToolBar ( this );
183 filterMenubar = new QPEMenuBar( filterToolBar ); 189 filterMenubar = new QPEMenuBar( filterToolBar );
184 QFontMetrics fm ( filterMenubar->font() ); 190 QFontMetrics fm ( filterMenubar->font() );
185 191
186 filterPopupMenu = new QPopupMenu( this ); 192 filterPopupMenu = new QPopupMenu( this );
187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 193 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
188 QString addTest = "Ax"; 194 QString addTest = "Ax";
189#ifdef DESKTOP_VERSION 195#ifdef DESKTOP_VERSION
190 addTest = "AAAx"; 196 addTest = "AAAx";
191#endif 197#endif
192 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); 198 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) );
193 addToolBar (filterToolBar , tbd ); 199 addToolBar (filterToolBar , tbd );
194 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 200 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
195 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 201 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
202 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
203 filterToolBar->hide();
196 } else { 204 } else {
197 filterToolBar = 0; 205 filterToolBar = 0;
198 filterMenubar = 0; 206 filterMenubar = 0;
199 filterPopupMenu = 0; 207 filterPopupMenu = 0;
200 } 208 }
201 if ( p->mShowIconOnetoolbar ) { 209 if ( p->mShowIconOnetoolbar ) {
202 viewToolBar = iconToolBar ; 210 viewToolBar = iconToolBar ;
203 navigatorToolBar = iconToolBar ; 211 navigatorToolBar = iconToolBar ;
204 } else { 212 } else {
213#ifndef DESKTOP_VERSION
214 setToolBarsMovable( false );
215#endif
205 if ( p->mToolBarHorV ) { 216 if ( p->mToolBarHorV ) {
206 if ( p->mToolBarUpV ) 217 if ( p->mToolBarUpV )
207 tbd = Bottom; 218 tbd = Bottom;
208 else 219 else
209 tbd = Top; 220 tbd = Top;
210 } 221 }
211 else { 222 else {
212 if ( p->mToolBarUpV ) 223 if ( p->mToolBarUpV )
213 tbd = Right; 224 tbd = Right;
214 else 225 else
215 tbd = Left; 226 tbd = Left;
216 } 227 }
217 viewToolBar = new QPEToolBar( this ); 228 viewToolBar = new QPEToolBar( this );
218 addToolBar (viewToolBar , tbd ); 229 addToolBar (viewToolBar , tbd );
219 if ( p->mToolBarHorN ) { 230 if ( p->mToolBarHorN ) {
220 if ( p->mToolBarUpN ) 231 if ( p->mToolBarUpN )
221 tbd = Bottom; 232 tbd = Bottom;
222 else 233 else
223 tbd = Top; 234 tbd = Top;
224 } 235 }
225 else { 236 else {
226 if ( p->mToolBarUpN ) 237 if ( p->mToolBarUpN )
227 tbd = Right; 238 tbd = Right;
228 else 239 else
@@ -2389,24 +2400,37 @@ void MainWindow::weekAction()
2389 y = 0; 2400 y = 0;
2390 } 2401 }
2391 } 2402 }
2392 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2403 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2393 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2404 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2394 { 2405 {
2395 month = picker->getResult(); 2406 month = picker->getResult();
2396 emit selectWeek ( month ); 2407 emit selectWeek ( month );
2397 //qDebug("weekSelected %d ", month); 2408 //qDebug("weekSelected %d ", month);
2398 } 2409 }
2399 delete popup; 2410 delete popup;
2400} 2411}
2401 2412
2402void MainWindow::hideEvent ( QHideEvent * ) 2413void MainWindow::hideEvent ( QHideEvent * )
2403{ 2414{
2404 QString message; 2415 QString message;
2405 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2416 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2406 if ( nextA.isValid() ) { 2417 if ( nextA.isValid() ) {
2407 QString sum = mCalendar->nextSummary(); 2418 QString sum = mCalendar->nextSummary();
2408 2419
2409 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2420 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2410 setCaption( message ); 2421 setCaption( message );
2411 } 2422 }
2412} 2423}
2424
2425void MainWindow::resizeEvent( QResizeEvent* e)
2426{
2427#ifndef DESKTOP_VERSION
2428 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) {
2429 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2430 filterToolBar->hide();
2431 else
2432 filterToolBar->show();
2433 }
2434#endif
2435 QMainWindow::resizeEvent( e);
2436}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 7c16aeb..4d1753f 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -112,48 +112,49 @@ class MainWindow : public QMainWindow
112 void hideEvent ( QHideEvent * ); 112 void hideEvent ( QHideEvent * );
113 QString sentSyncFile(); 113 QString sentSyncFile();
114 void displayText( QString, QString); 114 void displayText( QString, QString);
115 void enableIncidenceActions( bool ); 115 void enableIncidenceActions( bool );
116 116
117 private: 117 private:
118 bool mBRdisabled; 118 bool mBRdisabled;
119#ifndef DESKTOP_VERSION 119#ifndef DESKTOP_VERSION
120 QCopChannel* infrared; 120 QCopChannel* infrared;
121#endif 121#endif
122 QAction* brAction; 122 QAction* brAction;
123 KSyncManager* mSyncManager; 123 KSyncManager* mSyncManager;
124 bool mClosed; 124 bool mClosed;
125 void saveOnClose(); 125 void saveOnClose();
126 bool mFlagKeyPressed; 126 bool mFlagKeyPressed;
127 bool mBlockAtStartup; 127 bool mBlockAtStartup;
128 QPEToolBar *iconToolBar; 128 QPEToolBar *iconToolBar;
129 QPEToolBar *viewToolBar; 129 QPEToolBar *viewToolBar;
130 QPEToolBar *navigatorToolBar; 130 QPEToolBar *navigatorToolBar;
131 QPEToolBar *filterToolBar; 131 QPEToolBar *filterToolBar;
132 QPEMenuBar *filterMenubar; 132 QPEMenuBar *filterMenubar;
133 QPopupMenu * filterPopupMenu; 133 QPopupMenu * filterPopupMenu;
134 void initActions(); 134 void initActions();
135 void setDefaultPreferences(); 135 void setDefaultPreferences();
136 void resizeEvent( QResizeEvent* e);
136 void keyPressEvent ( QKeyEvent * ) ; 137 void keyPressEvent ( QKeyEvent * ) ;
137 void keyReleaseEvent ( QKeyEvent * ) ; 138 void keyReleaseEvent ( QKeyEvent * ) ;
138 QPopupMenu *configureToolBarMenu; 139 QPopupMenu *configureToolBarMenu;
139 QPopupMenu *selectFilterMenu; 140 QPopupMenu *selectFilterMenu;
140 QPopupMenu *selectFilterMenuTB; 141 QPopupMenu *selectFilterMenuTB;
141 QPopupMenu *configureAgendaMenu, *syncMenu; 142 QPopupMenu *configureAgendaMenu, *syncMenu;
142 CalendarLocal *mCalendar; 143 CalendarLocal *mCalendar;
143 CalendarView *mView; 144 CalendarView *mView;
144 QAction *mNewSubTodoAction; 145 QAction *mNewSubTodoAction;
145 QAction *mWeekAction; 146 QAction *mWeekAction;
146 QFont mWeekFont; 147 QFont mWeekFont;
147 QPixmap mWeekPixmap; 148 QPixmap mWeekPixmap;
148 QColor mWeekBgColor; 149 QColor mWeekBgColor;
149 150
150 QAction *mShowAction; 151 QAction *mShowAction;
151 QAction *mEditAction; 152 QAction *mEditAction;
152 QAction *mDeleteAction; 153 QAction *mDeleteAction;
153 QAction *mCloneAction; 154 QAction *mCloneAction;
154 QAction *mMoveAction; 155 QAction *mMoveAction;
155 QAction *mBeamAction; 156 QAction *mBeamAction;
156 QAction *mCancelAction; 157 QAction *mCancelAction;
157 158
158 QAction *mToggleNav; 159 QAction *mToggleNav;
159 QAction *mToggleFilter; 160 QAction *mToggleFilter;