summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp12
-rw-r--r--korganizer/komonthview.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4aeb20c..8d06040 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -69,32 +69,33 @@ protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mBlockDeselect = false;
85 mWT = new KNOWhatsThis(this); 86 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 87 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 88 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 89 setHScrollBarMode(QScrollView::AlwaysOff);
89} 90}
90KNoScrollListBox::~KNoScrollListBox() 91KNoScrollListBox::~KNoScrollListBox()
91{ 92{
92#if QT_VERSION >= 0x030000 93#if QT_VERSION >= 0x030000
93 94
94#else 95#else
95 delete mWT; 96 delete mWT;
96#endif 97#endif
97} 98}
98 99
99 100
100void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 101void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
@@ -122,40 +123,44 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
122 setVScrollBarMode(QScrollView::Auto); 123 setVScrollBarMode(QScrollView::Auto);
123 if ( ihei *3 > height() ) { 124 if ( ihei *3 > height() ) {
124 setHScrollBarMode(QScrollView::AlwaysOff); 125 setHScrollBarMode(QScrollView::AlwaysOff);
125 } 126 }
126 else { 127 else {
127 setHScrollBarMode(QScrollView::Auto); 128 setHScrollBarMode(QScrollView::Auto);
128 } 129 }
129 } else { 130 } else {
130 setVScrollBarMode(QScrollView::Auto); 131 setVScrollBarMode(QScrollView::Auto);
131 setHScrollBarMode(QScrollView::Auto); 132 setHScrollBarMode(QScrollView::Auto);
132 } 133 }
133 } 134 }
134 } 135 }
135} 136}
136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 137void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
137{ 138{
139 if ( ! mBlockDeselect ) {
138 int i = currentItem (); 140 int i = currentItem ();
139 if ( i >= 0 ) { 141 if ( i >= 0 ) {
140 setSelected ( i, false ); 142 setSelected ( i, false );
141 } 143 }
142 QListBox::focusOutEvent ( e ); 144 QListBox::focusOutEvent ( e );
145 }
143 setVScrollBarMode(QScrollView::AlwaysOff); 146 setVScrollBarMode(QScrollView::AlwaysOff);
144 setHScrollBarMode(QScrollView::AlwaysOff); 147 setHScrollBarMode(QScrollView::AlwaysOff);
145 emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); 148 if ( ! mBlockDeselect )
149 emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
150 mBlockDeselect = false;
146} 151}
147 152
148QString KNoScrollListBox::getWhatsThisText(QPoint p) 153QString KNoScrollListBox::getWhatsThisText(QPoint p)
149{ 154{
150 QListBoxItem* item = itemAt ( p ); 155 QListBoxItem* item = itemAt ( p );
151 if ( ! item ) { 156 if ( ! item ) {
152 return i18n("Click in the cell\nto add an event!"); 157 return i18n("Click in the cell\nto add an event!");
153 } 158 }
154 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 159 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
155 KOPrefs::instance()->mWTshowDetails, 160 KOPrefs::instance()->mWTshowDetails,
156 KOPrefs::instance()->mWTshowCreated, 161 KOPrefs::instance()->mWTshowCreated,
157 KOPrefs::instance()->mWTshowChanged); 162 KOPrefs::instance()->mWTshowChanged);
158} 163}
159void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 164void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
160{ 165{
161 //qDebug("KNoScrollListBox::keyPressEvent "); 166 //qDebug("KNoScrollListBox::keyPressEvent ");
@@ -1097,35 +1102,34 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
1097 } 1102 }
1098 1103
1099} 1104}
1100 1105
1101void MonthViewCell::contextMenu( QListBoxItem *item ) 1106void MonthViewCell::contextMenu( QListBoxItem *item )
1102{ 1107{
1103 mMonthView->setPopupCell( this ); 1108 mMonthView->setPopupCell( this );
1104 if ( !item ) { 1109 if ( !item ) {
1105 mMonthView->showContextMenu( 0 ); 1110 mMonthView->showContextMenu( 0 );
1106 return; 1111 return;
1107 } 1112 }
1108 //selection( item ); 1113 //selection( item );
1109 //qApp->processEvents(); 1114 //qApp->processEvents();
1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1115 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1111 Incidence *incidence = eventItem->incidence(); 1116 Incidence *incidence = eventItem->incidence();
1112 if ( incidence ) { 1117 if ( incidence ) {
1118 mBlockDeselect = true;
1113 mMonthView->showContextMenu( incidence ); 1119 mMonthView->showContextMenu( incidence );
1114 selection( item );
1115 doHighLight( incidence );
1116 } 1120 }
1117} 1121}
1118 1122
1119void MonthViewCell::selection( QListBoxItem *item ) 1123void MonthViewCell::selection( QListBoxItem *item )
1120{ 1124{
1121 if ( !item ) { 1125 if ( !item ) {
1122 emit highlightIncidence( 0 , this, 0 ); 1126 emit highlightIncidence( 0 , this, 0 );
1123 return; 1127 return;
1124 } 1128 }
1125 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1129 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
1126 emit highlightIncidence( it->incidence(), this, it->multiDay() ); 1130 emit highlightIncidence( it->incidence(), this, it->multiDay() );
1127 mMonthView->setSelectedCell( this ); 1131 mMonthView->setSelectedCell( this );
1128} 1132}
1129 1133
1130void MonthViewCell::deHighLight() 1134void MonthViewCell::deHighLight()
1131{ 1135{
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 61a141a..1a9d16d 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -74,33 +74,34 @@ private slots :
74 74
75class KNoScrollListBox: public QListBox 75class KNoScrollListBox: public QListBox
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 public: 78 public:
79 KNoScrollListBox(QWidget *parent=0, const char *name=0); 79 KNoScrollListBox(QWidget *parent=0, const char *name=0);
80 ~KNoScrollListBox(); 80 ~KNoScrollListBox();
81 QString getWhatsThisText(QPoint p) ; 81 QString getWhatsThisText(QPoint p) ;
82 82
83 signals: 83 signals:
84 void shiftDown(); 84 void shiftDown();
85 void shiftUp(); 85 void shiftUp();
86 void rightClick(); 86 void rightClick();
87 void nextCell(); 87 void nextCell();
88 void prevCell(); 88 void prevCell();
89 void highlightIncidence( Incidence * , MonthViewCell*, int ); 89 void highlightIncidence( Incidence * , MonthViewCell*, int );
90 90 protected:
91 bool mBlockDeselect;
91 protected slots: 92 protected slots:
92 void oneDown(); 93 void oneDown();
93 void keyPressEvent(QKeyEvent *); 94 void keyPressEvent(QKeyEvent *);
94 void keyReleaseEvent(QKeyEvent *); 95 void keyReleaseEvent(QKeyEvent *);
95 void mousePressEvent(QMouseEvent *); 96 void mousePressEvent(QMouseEvent *);
96 void focusInEvent ( QFocusEvent * ); 97 void focusInEvent ( QFocusEvent * );
97 void focusOutEvent ( QFocusEvent * ); 98 void focusOutEvent ( QFocusEvent * );
98 99
99 private: 100 private:
100 bool resetOnFocusIn; 101 bool resetOnFocusIn;
101 KNOWhatsThis * mWT; 102 KNOWhatsThis * mWT;
102}; 103};
103 104
104 105
105class MonthViewItem: public QListBoxItem 106class MonthViewItem: public QListBoxItem
106{ 107{