summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-30 23:17:42 (UTC)
committer zautrix <zautrix>2005-03-30 23:17:42 (UTC)
commit529c0fb8a8bf15e7bd375ddeb355c5802baf4c93 (patch) (unidiff)
tree72ebca6de7e54f2cf89d3d6df61d3b40aa66a444
parent28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (diff)
downloadkdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.zip
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.gz
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.bz2
key fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.cpp2
-rw-r--r--kaddressbook/kaddressbookview.h2
-rw-r--r--kaddressbook/views/cardview.cpp31
-rw-r--r--kaddressbook/views/cardview.h5
-rw-r--r--kaddressbook/views/contactlistview.cpp29
-rw-r--r--kaddressbook/views/contactlistview.h4
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp4
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp4
-rw-r--r--korganizer/komonthview.cpp19
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/mainwindow.cpp26
-rw-r--r--korganizer/mainwindow.h1
12 files changed, 125 insertions, 5 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp
index 09859c2..86898e2 100644
--- a/kaddressbook/kaddressbookview.cpp
+++ b/kaddressbook/kaddressbookview.cpp
@@ -172,15 +172,17 @@ KABC::AddressBook *KAddressBookView::addressBook() const
172QWidget *KAddressBookView::viewWidget() 172QWidget *KAddressBookView::viewWidget()
173{ 173{
174 return mViewWidget; 174 return mViewWidget;
175} 175}
176 176
177ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, 177ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
178 QWidget *parent, 178 QWidget *parent,
179 const char *name ) 179 const char *name )
180{ 180{
181 return new ViewConfigureWidget( ab, parent, name ); 181 return new ViewConfigureWidget( ab, parent, name );
182} 182}
183 183
184
185
184#ifndef KAB_EMBEDDED 186#ifndef KAB_EMBEDDED
185#include "kaddressbookview.moc" 187#include "kaddressbookview.moc"
186#endif //KAB_EMBEDDED 188#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 6bbb9c2..3a3f71a 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -222,24 +222,25 @@ class KAddressBookView : public QWidget
222 to create a QDragObject. 222 to create a QDragObject.
223 */ 223 */
224 void startDrag(); 224 void startDrag();
225 225
226 /** 226 /**
227 This signal is emitted whenever the user drops something on the 227 This signal is emitted whenever the user drops something on the
228 view. The individual view should handle checking if the item is 228 view. The individual view should handle checking if the item is
229 droppable (ie: if it is a vcard). 229 droppable (ie: if it is a vcard).
230 */ 230 */
231 void dropped( QDropEvent* ); 231 void dropped( QDropEvent* );
232 232
233 protected: 233 protected:
234
234 /** 235 /**
235 Returns a list of the addressees that should be displayed. This method 236 Returns a list of the addressees that should be displayed. This method
236 should always be used by the subclass to get a list of addressees. This 237 should always be used by the subclass to get a list of addressees. This
237 method internally takes many factors into account, including the current 238 method internally takes many factors into account, including the current
238 filter. 239 filter.
239 */ 240 */
240 KABC::Addressee::List addressees(); 241 KABC::Addressee::List addressees();
241 242
242 /** 243 /**
243 This method returns the widget that should be used as the parent for 244 This method returns the widget that should be used as the parent for
244 all view components. By using this widget as the parent and not 245 all view components. By using this widget as the parent and not
245 'this', the view subclass has the option of placing other widgets 246 'this', the view subclass has the option of placing other widgets
@@ -297,16 +298,17 @@ class ViewFactory
297 */ 298 */
298 virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, 299 virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab,
299 QWidget *parent, 300 QWidget *parent,
300 const char *name = 0 ); 301 const char *name = 0 );
301 302
302 protected: 303 protected:
303 virtual QObject* createObject( QObject*, const char*, const char*, 304 virtual QObject* createObject( QObject*, const char*, const char*,
304 const QStringList & ) 305 const QStringList & )
305 { 306 {
306 return 0; 307 return 0;
307 } 308 }
308 309
310
309}; 311};
310 312
311 313
312#endif 314#endif
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index 03df444..84d3116 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -24,24 +24,25 @@
24//BEGIN Includes 24//BEGIN Includes
25#include "cardview.h" 25#include "cardview.h"
26 26
27#include <limits.h> 27#include <limits.h>
28 28
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qstyle.h> 33#include <qstyle.h>
34#include <qcursor.h> 34#include <qcursor.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qapplication.h>
36 37
37#include "kabprefs.h" 38#include "kabprefs.h"
38#include <kdebug.h> 39#include <kdebug.h>
39#include <kglobalsettings.h> 40#include <kglobalsettings.h>
40//END includes 41//END includes
41 42
42#define MIN_ITEM_WIDTH 80 43#define MIN_ITEM_WIDTH 80
43 44
44//BEGIN Helpers 45//BEGIN Helpers
45////////////////////////////////////// 46//////////////////////////////////////
46// CardViewTip 47// CardViewTip
47class CardViewTip : public QLabel { 48class CardViewTip : public QLabel {
@@ -630,24 +631,26 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const
630 break; 631 break;
631 } 632 }
632 return f ? f : 0; 633 return f ? f : 0;
633} 634}
634//END CardViewItem 635//END CardViewItem
635 636
636//BEGIN CardView 637//BEGIN CardView
637 638
638CardView::CardView(QWidget *parent, const char *name) 639CardView::CardView(QWidget *parent, const char *name)
639 : QScrollView(parent, name), 640 : QScrollView(parent, name),
640 d(new CardViewPrivate()) 641 d(new CardViewPrivate())
641{ 642{
643 mFlagKeyPressed = false;
644 mFlagBlockKeyPressed = false;
642 d->mItemList.setAutoDelete(true); 645 d->mItemList.setAutoDelete(true);
643 d->mSeparatorList.setAutoDelete(true); 646 d->mSeparatorList.setAutoDelete(true);
644 647
645 QFont f = font(); 648 QFont f = font();
646 d->mFm = new QFontMetrics(f); 649 d->mFm = new QFontMetrics(f);
647 f.setBold(true); 650 f.setBold(true);
648 d->mHeaderFont = f; 651 d->mHeaderFont = f;
649 d->mBFm = new QFontMetrics(f); 652 d->mBFm = new QFontMetrics(f);
650 d->mTip = ( new CardViewTip( viewport() ) ), 653 d->mTip = ( new CardViewTip( viewport() ) ),
651 d->mTip->hide(); 654 d->mTip->hide();
652 d->mTimer = ( new QTimer(this, "mouseTimer") ), 655 d->mTimer = ( new QTimer(this, "mouseTimer") ),
653 656
@@ -1342,25 +1345,33 @@ void CardView::focusOutEvent( QFocusEvent * )
1342{ 1345{
1343 if (d->mCurrentItem) 1346 if (d->mCurrentItem)
1344 d->mCurrentItem->repaintCard(); 1347 d->mCurrentItem->repaintCard();
1345} 1348}
1346 1349
1347void CardView::keyPressEvent( QKeyEvent *e ) 1350void CardView::keyPressEvent( QKeyEvent *e )
1348{ 1351{
1349 if ( ! ( childCount() && d->mCurrentItem ) ) 1352 if ( ! ( childCount() && d->mCurrentItem ) )
1350 { 1353 {
1351 e->ignore(); 1354 e->ignore();
1352 return; 1355 return;
1353 } 1356 }
1354 1357 if ( mFlagBlockKeyPressed )
1358 return;
1359 qApp->processEvents();
1360 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1361 e->accept();
1362 return;
1363 }
1364 if (! e->isAutoRepeat() )
1365 mFlagKeyPressed = true;
1355 uint pos = d->mItemList.findRef( d->mCurrentItem ); 1366 uint pos = d->mItemList.findRef( d->mCurrentItem );
1356 CardViewItem *aItem = 0L; // item that gets the focus 1367 CardViewItem *aItem = 0L; // item that gets the focus
1357 CardViewItem *old = d->mCurrentItem; 1368 CardViewItem *old = d->mCurrentItem;
1358 1369
1359 switch ( e->key() ) 1370 switch ( e->key() )
1360 { 1371 {
1361 case Key_Up: 1372 case Key_Up:
1362 if ( pos > 0 ) 1373 if ( pos > 0 )
1363 { 1374 {
1364 aItem = d->mItemList.at( pos - 1 ); 1375 aItem = d->mItemList.at( pos - 1 );
1365 setCurrentItem( aItem ); 1376 setCurrentItem( aItem );
1366 } 1377 }
@@ -1706,17 +1717,35 @@ void CardView::setSeparatorWidth( int width )
1706} 1717}
1707 1718
1708int CardView::maxFieldLines() const 1719int CardView::maxFieldLines() const
1709{ 1720{
1710 return d->mMaxFieldLines; 1721 return d->mMaxFieldLines;
1711} 1722}
1712 1723
1713void CardView::setMaxFieldLines( int howmany ) 1724void CardView::setMaxFieldLines( int howmany )
1714{ 1725{
1715 d->mMaxFieldLines = howmany ? howmany : INT_MAX; 1726 d->mMaxFieldLines = howmany ? howmany : INT_MAX;
1716 // FIXME update, forcing the items to recalc height!! 1727 // FIXME update, forcing the items to recalc height!!
1717} 1728}
1729
1730void CardView::keyReleaseEvent ( QKeyEvent * e )
1731{
1732 if ( mFlagBlockKeyPressed )
1733 return;
1734 if ( !e->isAutoRepeat() ) {
1735 mFlagBlockKeyPressed = true;
1736 qApp->processEvents();
1737 mFlagBlockKeyPressed = false;
1738 mFlagKeyPressed = false;
1739 }
1740 QScrollView::keyReleaseEvent ( e );
1741}
1742
1743
1744
1745
1746
1718//END Cardview 1747//END Cardview
1719 1748
1720#ifndef KAB_EMBEDDED 1749#ifndef KAB_EMBEDDED
1721#include "cardview.moc" 1750#include "cardview.moc"
1722#endif //KAB_EMBEDDED 1751#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/cardview.h b/kaddressbook/views/cardview.h
index 37dddb6..2ea3771 100644
--- a/kaddressbook/views/cardview.h
+++ b/kaddressbook/views/cardview.h
@@ -397,24 +397,28 @@ class CardView : public QScrollView
397 */ 397 */
398 void doubleClicked(CardViewItem *); 398 void doubleClicked(CardViewItem *);
399 399
400 /** Emitted when the current item changes 400 /** Emitted when the current item changes
401 */ 401 */
402 void currentChanged( CardViewItem * ); 402 void currentChanged( CardViewItem * );
403 403
404 /** Emitted when the return key is pressed in an item. 404 /** Emitted when the return key is pressed in an item.
405 */ 405 */
406 void returnPressed( CardViewItem * ); 406 void returnPressed( CardViewItem * );
407 407
408 protected: 408 protected:
409 bool mFlagKeyPressed;
410 bool mFlagBlockKeyPressed;
411 virtual void keyPressEvent ( QKeyEvent * );
412 virtual void keyReleaseEvent ( QKeyEvent * );
409 /** Determines which cards intersect that region and tells them to paint 413 /** Determines which cards intersect that region and tells them to paint
410 * themselves. 414 * themselves.
411 */ 415 */
412 void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph); 416 void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph);
413 417
414 /** Sets the layout to dirty and repaints. 418 /** Sets the layout to dirty and repaints.
415 */ 419 */
416 void resizeEvent(QResizeEvent *e); 420 void resizeEvent(QResizeEvent *e);
417 421
418 /** Changes the direction the canvas scolls. 422 /** Changes the direction the canvas scolls.
419 */ 423 */
420 void contentsWheelEvent(QWheelEvent *e); 424 void contentsWheelEvent(QWheelEvent *e);
@@ -435,25 +439,24 @@ class CardView : public QScrollView
435 439
436 virtual void contentsMousePressEvent(QMouseEvent *e); 440 virtual void contentsMousePressEvent(QMouseEvent *e);
437 virtual void contentsMouseMoveEvent(QMouseEvent *e); 441 virtual void contentsMouseMoveEvent(QMouseEvent *e);
438 virtual void contentsMouseReleaseEvent(QMouseEvent *e); 442 virtual void contentsMouseReleaseEvent(QMouseEvent *e);
439 virtual void contentsMouseDoubleClickEvent(QMouseEvent *e); 443 virtual void contentsMouseDoubleClickEvent(QMouseEvent *e);
440 444
441 virtual void enterEvent( QEvent * ); 445 virtual void enterEvent( QEvent * );
442 virtual void leaveEvent( QEvent * ); 446 virtual void leaveEvent( QEvent * );
443 447
444 virtual void focusInEvent( QFocusEvent * ); 448 virtual void focusInEvent( QFocusEvent * );
445 virtual void focusOutEvent( QFocusEvent * ); 449 virtual void focusOutEvent( QFocusEvent * );
446 450
447 virtual void keyPressEvent( QKeyEvent * );
448 451
449 /** Overload this method to be told when a drag should be started. 452 /** Overload this method to be told when a drag should be started.
450 * In most cases you will want to start a drag event with the currently 453 * In most cases you will want to start a drag event with the currently
451 * selected item. 454 * selected item.
452 */ 455 */
453 virtual void startDrag(); 456 virtual void startDrag();
454 457
455 private slots: 458 private slots:
456 /** Called by a timer to display a label with truncated text. 459 /** Called by a timer to display a label with truncated text.
457 * Pop up a label, if there is a field with obscured text or 460 * Pop up a label, if there is a field with obscured text or
458 * label at the cursor position. 461 * label at the cursor position.
459 */ 462 */
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index e75810e..09d9c03 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -20,24 +20,25 @@
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qheader.h> 24#include <qheader.h>
25#include <qiconset.h> 25#include <qiconset.h>
26#include <qimage.h> 26#include <qimage.h>
27#include <qdragobject.h> 27#include <qdragobject.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qbrush.h> 30#include <qbrush.h>
31#include <qevent.h> 31#include <qevent.h>
32#include <qapplication.h>
32 33
33#include <klocale.h> 34#include <klocale.h>
34#include <kglobalsettings.h> 35#include <kglobalsettings.h>
35#include <kiconloader.h> 36#include <kiconloader.h>
36#include <kdebug.h> 37#include <kdebug.h>
37#include <kconfig.h> 38#include <kconfig.h>
38#include <kapplication.h> 39#include <kapplication.h>
39#include <kurl.h> 40#include <kurl.h>
40 41
41#include "kaddressbooktableview.h" 42#include "kaddressbooktableview.h"
42 43
43#include "contactlistview.h" 44#include "contactlistview.h"
@@ -239,24 +240,26 @@ void ContactListViewItem::refresh()
239 240
240/////////////////////////////// 241///////////////////////////////
241// ContactListView 242// ContactListView
242 243
243ContactListView::ContactListView(KAddressBookTableView *view, 244ContactListView::ContactListView(KAddressBookTableView *view,
244 KABC::AddressBook* /* doc */, 245 KABC::AddressBook* /* doc */,
245 QWidget *parent, 246 QWidget *parent,
246 const char *name ) 247 const char *name )
247 : KListView( parent, name ), 248 : KListView( parent, name ),
248 pabWidget( view ), 249 pabWidget( view ),
249 oldColumn( 0 ) 250 oldColumn( 0 )
250{ 251{
252 mFlagBlockKeyPressed = false;
253 mFlagKeyPressed = false;
251 mABackground = true; 254 mABackground = true;
252 mSingleLine = false; 255 mSingleLine = false;
253 mToolTips = true; 256 mToolTips = true;
254#ifndef KAB_EMBEDDED 257#ifndef KAB_EMBEDDED
255 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 258 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
256#else //KAB_EMBEDDED 259#else //KAB_EMBEDDED
257 mAlternateColor = QColor(240, 240, 240); 260 mAlternateColor = QColor(240, 240, 240);
258#endif //KAB_EMBEDDED 261#endif //KAB_EMBEDDED
259 262
260 setAlternateBackgroundEnabled(mABackground); 263 setAlternateBackgroundEnabled(mABackground);
261 setAcceptDrops( true ); 264 setAcceptDrops( true );
262 viewport()->setAcceptDrops( true ); 265 viewport()->setAcceptDrops( true );
@@ -386,15 +389,41 @@ void ContactListView::setBackgroundPixmap(const QString &filename)
386 if (filename.isEmpty()) 389 if (filename.isEmpty())
387 { 390 {
388 unsetPalette(); 391 unsetPalette();
389 } 392 }
390 else 393 else
391 { 394 {
392 qDebug("ContactListView::setBackgroundPixmap has to be verified"); 395 qDebug("ContactListView::setBackgroundPixmap has to be verified");
393//US setPaletteBackgroundPixmap(QPixmap(filename)); 396//US setPaletteBackgroundPixmap(QPixmap(filename));
394 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); 397 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename));
395 } 398 }
396 399
397} 400}
401
402void ContactListView::keyPressEvent ( QKeyEvent * e )
403{
404 if ( mFlagBlockKeyPressed )
405 return;
406 qApp->processEvents();
407 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
408 e->accept();
409 return;
410 }
411 if (! e->isAutoRepeat() )
412 mFlagKeyPressed = true;
413 KListView::keyPressEvent ( e );
414}
415void ContactListView::keyReleaseEvent ( QKeyEvent * e )
416{
417 if ( mFlagBlockKeyPressed )
418 return;
419 if ( !e->isAutoRepeat() ) {
420 mFlagBlockKeyPressed = true;
421 qApp->processEvents();
422 mFlagBlockKeyPressed = false;
423 mFlagKeyPressed = false;
424 }
425 KListView::keyReleaseEvent ( e );
426}
398#ifndef KAB_EMBEDDED 427#ifndef KAB_EMBEDDED
399#include "contactlistview.moc" 428#include "contactlistview.moc"
400#endif //KAB_EMBEDDED 429#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h
index 9d1a672..46477e1 100644
--- a/kaddressbook/views/contactlistview.h
+++ b/kaddressbook/views/contactlistview.h
@@ -83,24 +83,28 @@ public:
83 void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; } 83 void setSingleLineEnabled(bool enabled) { mSingleLine = enabled; }
84 84
85 const QColor &alternateColor() const { return mAlternateColor; } 85 const QColor &alternateColor() const { return mAlternateColor; }
86 void setAlternateColor(const QColor &mAlternateColor); 86 void setAlternateColor(const QColor &mAlternateColor);
87 87
88 /** Sets the background pixmap to <i>filename</i>. If the 88 /** Sets the background pixmap to <i>filename</i>. If the
89 * QString is empty (QString::isEmpty()), then the background 89 * QString is empty (QString::isEmpty()), then the background
90 * pixmap will be disabled. 90 * pixmap will be disabled.
91 */ 91 */
92 void setBackgroundPixmap(const QString &filename); 92 void setBackgroundPixmap(const QString &filename);
93 93
94protected: 94protected:
95 bool mFlagKeyPressed;
96 bool mFlagBlockKeyPressed;
97 virtual void keyPressEvent ( QKeyEvent * );
98 virtual void keyReleaseEvent ( QKeyEvent * );
95 /** Paints the background pixmap in the empty area. This method is needed 99 /** Paints the background pixmap in the empty area. This method is needed
96 * since Qt::FixedPixmap will not scroll with the list view. 100 * since Qt::FixedPixmap will not scroll with the list view.
97 */ 101 */
98 virtual void paintEmptyArea( QPainter * p, const QRect & rect ); 102 virtual void paintEmptyArea( QPainter * p, const QRect & rect );
99 virtual void contentsMousePressEvent(QMouseEvent*); 103 virtual void contentsMousePressEvent(QMouseEvent*);
100 void contentsMouseMoveEvent( QMouseEvent *e ); 104 void contentsMouseMoveEvent( QMouseEvent *e );
101 void contentsDropEvent( QDropEvent *e ); 105 void contentsDropEvent( QDropEvent *e );
102 virtual bool acceptDrag(QDropEvent *e) const; 106 virtual bool acceptDrag(QDropEvent *e) const;
103 107
104protected slots: 108protected slots:
105 void itemDropped(QDropEvent *e); 109 void itemDropped(QDropEvent *e);
106 110
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index cce68b9..9c35fd6 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -199,30 +199,34 @@ KAddressBookCardView::~KAddressBookCardView()
199{ 199{
200} 200}
201void KAddressBookCardView::setFocusAV() 201void KAddressBookCardView::setFocusAV()
202{ 202{
203 if ( mCardView ) 203 if ( mCardView )
204 mCardView->setFocus(); 204 mCardView->setFocus();
205 205
206} 206}
207void KAddressBookCardView::scrollUP() 207void KAddressBookCardView::scrollUP()
208{ 208{
209 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 209 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
210 QApplication::postEvent( mCardView, ev ); 210 QApplication::postEvent( mCardView, ev );
211 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
212 QApplication::postEvent( mCardView, ev );
211 213
212} 214}
213void KAddressBookCardView::scrollDOWN() 215void KAddressBookCardView::scrollDOWN()
214{ 216{
215 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 217 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
216 QApplication::postEvent( mCardView, ev ); 218 QApplication::postEvent( mCardView, ev );
219 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
220 QApplication::postEvent( mCardView, ev );
217} 221}
218void KAddressBookCardView::readConfig(KConfig *config) 222void KAddressBookCardView::readConfig(KConfig *config)
219{ 223{
220 KAddressBookView::readConfig(config); 224 KAddressBookView::readConfig(config);
221 225
222 // costum colors? 226 // costum colors?
223 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 227 if ( config->readBoolEntry( "EnableCustomColors", false ) )
224 { 228 {
225 QPalette p( mCardView->palette() ); 229 QPalette p( mCardView->palette() );
226 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 230 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
227 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 231 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
228 c = p.color(QPalette::Normal, QColorGroup::Text ); 232 c = p.color(QPalette::Normal, QColorGroup::Text );
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index f4b008c..e322473 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -52,29 +52,33 @@ KAddressBookTableView::~KAddressBookTableView()
52{ 52{
53} 53}
54void KAddressBookTableView::setFocusAV() 54void KAddressBookTableView::setFocusAV()
55{ 55{
56 if ( mListView ) 56 if ( mListView )
57 mListView->setFocus(); 57 mListView->setFocus();
58 58
59} 59}
60void KAddressBookTableView::scrollUP() 60void KAddressBookTableView::scrollUP()
61{ 61{
62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
63 QApplication::postEvent( mListView, ev ); 63 QApplication::postEvent( mListView, ev );
64 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
65 QApplication::postEvent( mListView, ev );
64} 66}
65void KAddressBookTableView::scrollDOWN() 67void KAddressBookTableView::scrollDOWN()
66{ 68{
67 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 69 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
68 QApplication::postEvent( mListView, ev ); 70 QApplication::postEvent( mListView, ev );
71 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
72 QApplication::postEvent( mListView, ev );
69} 73}
70void KAddressBookTableView::reconstructListView() 74void KAddressBookTableView::reconstructListView()
71{ 75{
72 if (mListView) 76 if (mListView)
73 { 77 {
74 disconnect(mListView, SIGNAL(selectionChanged()), 78 disconnect(mListView, SIGNAL(selectionChanged()),
75 this, SLOT(addresseeSelected())); 79 this, SLOT(addresseeSelected()));
76 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 80 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
77 this, SLOT(addresseeExecuted(QListViewItem*))); 81 this, SLOT(addresseeExecuted(QListViewItem*)));
78 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 82 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
79 this, SLOT(addresseeExecuted(QListViewItem*))); 83 this, SLOT(addresseeExecuted(QListViewItem*)));
80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 84 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ca35a86..b9ce4f4 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -991,24 +991,25 @@ void MonthViewCell::selection( QListBoxItem *item )
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 );
@@ -1828,27 +1829,43 @@ void KOMonthView::processSelectionChange()
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;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c1ca3d4..88050fe 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -302,19 +302,20 @@ class KOMonthView: public KOEventView
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
@@ -157,25 +157,31 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 }
@@ -184,33 +190,38 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 }
@@ -2401,12 +2412,25 @@ void MainWindow::weekAction()
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
@@ -124,24 +124,25 @@ class MainWindow : public QMainWindow
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;