-rw-r--r-- | kaddressbook/kaddressbookview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 6 | ||||
-rw-r--r-- | kaddressbook/views/cardview.cpp | 31 | ||||
-rw-r--r-- | kaddressbook/views/cardview.h | 7 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 29 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.h | 4 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 4 |
8 files changed, 83 insertions, 6 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 09859c2..86898e2 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp | |||
@@ -22,49 +22,49 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | 26 | ||
27 | #include <kabc/distributionlistdialog.h> | 27 | #include <kabc/distributionlistdialog.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | 30 | ||
31 | #include "viewmanager.h" | 31 | #include "viewmanager.h" |
32 | 32 | ||
33 | #endif //KAB_EMBEDDED | 33 | #endif //KAB_EMBEDDED |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | 35 | ||
36 | #include <kabc/distributionlistdialog.h> | 36 | #include <kabc/distributionlistdialog.h> |
37 | #include <kabc/addressbook.h> | 37 | #include <kabc/addressbook.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | 39 | ||
40 | #include "kaddressbookview.h" | 40 | #include "kaddressbookview.h" |
41 | 41 | ||
42 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, | 42 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, |
43 | const char *name ) | 43 | const char *name ) |
44 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() | 44 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() |
45 | { | 45 | { |
46 | 46 | ||
47 | initGUI(); | 47 | initGUI(); |
48 | } | 48 | } |
49 | 49 | ||
50 | KAddressBookView::~KAddressBookView() | 50 | KAddressBookView::~KAddressBookView() |
51 | { | 51 | { |
52 | 52 | ||
53 | } | 53 | } |
54 | 54 | ||
55 | QRegExp KAddressBookView::getRegExp( const QString s ) | 55 | QRegExp KAddressBookView::getRegExp( const QString s ) |
56 | { | 56 | { |
57 | QRegExp re; | 57 | QRegExp re; |
58 | 58 | ||
59 | if ( s.length() == 3 && s.mid(1,1) == "-" ) { | 59 | if ( s.length() == 3 && s.mid(1,1) == "-" ) { |
60 | QString pattern = "^[" + s.lower() +"]"; | 60 | QString pattern = "^[" + s.lower() +"]"; |
61 | re.setCaseSensitive(false); | 61 | re.setCaseSensitive(false); |
62 | re.setPattern( pattern ); | 62 | re.setPattern( pattern ); |
63 | } else { | 63 | } else { |
64 | QString pattern = s.lower()+"*"; | 64 | QString pattern = s.lower()+"*"; |
65 | re.setWildcard(true); // most people understand these better. | 65 | re.setWildcard(true); // most people understand these better. |
66 | re.setCaseSensitive(false); | 66 | re.setCaseSensitive(false); |
67 | re.setPattern( pattern ); | 67 | re.setPattern( pattern ); |
68 | } | 68 | } |
69 | return re; | 69 | return re; |
70 | } | 70 | } |
@@ -160,27 +160,29 @@ KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const | |||
160 | } | 160 | } |
161 | 161 | ||
162 | const QString &KAddressBookView::defaultFilterName() const | 162 | const QString &KAddressBookView::defaultFilterName() const |
163 | { | 163 | { |
164 | return mDefaultFilterName; | 164 | return mDefaultFilterName; |
165 | } | 165 | } |
166 | 166 | ||
167 | KABC::AddressBook *KAddressBookView::addressBook() const | 167 | KABC::AddressBook *KAddressBookView::addressBook() const |
168 | { | 168 | { |
169 | return mAddressBook; | 169 | return mAddressBook; |
170 | } | 170 | } |
171 | 171 | ||
172 | QWidget *KAddressBookView::viewWidget() | 172 | QWidget *KAddressBookView::viewWidget() |
173 | { | 173 | { |
174 | return mViewWidget; | 174 | return mViewWidget; |
175 | } | 175 | } |
176 | 176 | ||
177 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, | 177 | ViewConfigureWidget *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 | |||
@@ -209,49 +209,50 @@ class KAddressBookView : public QWidget | |||
209 | This signal should be emitted by a subclass whenever an addressee | 209 | This signal should be emitted by a subclass whenever an addressee |
210 | is executed. This is defined by the KDE system wide config, but it | 210 | is executed. This is defined by the KDE system wide config, but it |
211 | either means single or doubleclicked. | 211 | either means single or doubleclicked. |
212 | 212 | ||
213 | @param ui The uid of the selected addressee | 213 | @param ui The uid of the selected addressee |
214 | 214 | ||
215 | @see KListView | 215 | @see KListView |
216 | */ | 216 | */ |
217 | void executed( const QString &uid ); | 217 | void executed( const QString &uid ); |
218 | 218 | ||
219 | /** | 219 | /** |
220 | This signal is emitted whenever a user attempts to start a drag | 220 | This signal is emitted whenever a user attempts to start a drag |
221 | in the view. The slot connected to this signal would usually want | 221 | in the view. The slot connected to this signal would usually want |
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 |
246 | around the view (ie: search fields, etc). Do not delete this widget! | 247 | around the view (ie: search fields, etc). Do not delete this widget! |
247 | */ | 248 | */ |
248 | QWidget *viewWidget(); | 249 | QWidget *viewWidget(); |
249 | QRegExp getRegExp( const QString ); | 250 | QRegExp getRegExp( const QString ); |
250 | 251 | ||
251 | private: | 252 | private: |
252 | void initGUI(); | 253 | void initGUI(); |
253 | 254 | ||
254 | DefaultFilterType mDefaultFilterType; | 255 | DefaultFilterType mDefaultFilterType; |
255 | Filter mFilter; | 256 | Filter mFilter; |
256 | QString mDefaultFilterName; | 257 | QString mDefaultFilterName; |
257 | KABC::AddressBook *mAddressBook; | 258 | KABC::AddressBook *mAddressBook; |
@@ -283,30 +284,31 @@ class ViewFactory | |||
283 | @return The description of the view. This should be a 3 to | 284 | @return The description of the view. This should be a 3 to |
284 | 4 line string (don't actually use return characters in the string) | 285 | 4 line string (don't actually use return characters in the string) |
285 | describing the features offered by the view. | 286 | describing the features offered by the view. |
286 | */ | 287 | */ |
287 | virtual QString description() const = 0; | 288 | virtual QString description() const = 0; |
288 | 289 | ||
289 | /** | 290 | /** |
290 | Creates a config dialog for the view type. The default | 291 | Creates a config dialog for the view type. The default |
291 | implementation will return a ViewConfigDialog. This default | 292 | implementation will return a ViewConfigDialog. This default |
292 | dialog will allow the user to set the visible fields only. If | 293 | dialog will allow the user to set the visible fields only. If |
293 | you need more config options (as most views will), this method | 294 | you need more config options (as most views will), this method |
294 | can be overloaded to return your sublcass of ViewConfigDialog. | 295 | can be overloaded to return your sublcass of ViewConfigDialog. |
295 | If this method is over loaded the base classes method should | 296 | If this method is over loaded the base classes method should |
296 | <B>not</B> be called. | 297 | <B>not</B> be called. |
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 | } |
309 | |||
308 | 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 | |||
@@ -12,48 +12,49 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
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 | //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 |
47 | class CardViewTip : public QLabel { | 48 | class CardViewTip : public QLabel { |
48 | public: | 49 | public: |
49 | CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name ) | 50 | CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name ) |
50 | { | 51 | { |
51 | setPalette( QToolTip::palette() ); | 52 | setPalette( QToolTip::palette() ); |
52 | setFrameStyle( Panel|Plain ); | 53 | setFrameStyle( Panel|Plain ); |
53 | setMidLineWidth(0); | 54 | setMidLineWidth(0); |
54 | setIndent(1); | 55 | setIndent(1); |
55 | } | 56 | } |
56 | 57 | ||
57 | ~CardViewTip() {}; | 58 | ~CardViewTip() {}; |
58 | protected: | 59 | protected: |
59 | void leaveEvent( QEvent * ) | 60 | void leaveEvent( QEvent * ) |
@@ -618,48 +619,50 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const | |||
618 | if ( iy <= ypos ) | 619 | if ( iy <= ypos ) |
619 | return 0; | 620 | return 0; |
620 | // try find a field | 621 | // try find a field |
621 | bool showEmpty = mView->showEmptyFields(); | 622 | bool showEmpty = mView->showEmptyFields(); |
622 | int fh = mView->d->mFm->height(); | 623 | int fh = mView->d->mFm->height(); |
623 | int maxLines = mView->maxFieldLines(); | 624 | int maxLines = mView->maxFieldLines(); |
624 | Field *f; | 625 | Field *f; |
625 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) | 626 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) |
626 | { | 627 | { |
627 | if ( showEmpty || !f->second.isEmpty() ) | 628 | if ( showEmpty || !f->second.isEmpty() ) |
628 | ypos += ( QMIN( f->second.contains('\n')+1, maxLines ) *fh)+2; | 629 | ypos += ( QMIN( f->second.contains('\n')+1, maxLines ) *fh)+2; |
629 | if ( iy <= ypos ) | 630 | if ( iy <= ypos ) |
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 | ||
638 | CardView::CardView(QWidget *parent, const char *name) | 639 | CardView::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 | ||
654 | viewport()->setMouseTracking( true ); | 657 | viewport()->setMouseTracking( true ); |
655 | viewport()->setFocusProxy(this); | 658 | viewport()->setFocusProxy(this); |
656 | viewport()->setFocusPolicy(WheelFocus); | 659 | viewport()->setFocusPolicy(WheelFocus); |
657 | viewport()->setBackgroundMode(PaletteBase); | 660 | viewport()->setBackgroundMode(PaletteBase); |
658 | 661 | ||
659 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); | 662 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); |
660 | 663 | ||
661 | //US setBackgroundMode(PaletteBackground, PaletteBase); | 664 | //US setBackgroundMode(PaletteBackground, PaletteBase); |
662 | setBackgroundMode(PaletteBackground); | 665 | setBackgroundMode(PaletteBackground); |
663 | 666 | ||
664 | // no reason for a vertical scrollbar | 667 | // no reason for a vertical scrollbar |
665 | setVScrollBarMode(AlwaysOff); | 668 | setVScrollBarMode(AlwaysOff); |
@@ -1330,49 +1333,57 @@ void CardView::focusInEvent( QFocusEvent * ) | |||
1330 | { | 1333 | { |
1331 | if (!d->mCurrentItem && d->mItemList.count() ) | 1334 | if (!d->mCurrentItem && d->mItemList.count() ) |
1332 | { | 1335 | { |
1333 | setCurrentItem( d->mItemList.first() ); | 1336 | setCurrentItem( d->mItemList.first() ); |
1334 | } | 1337 | } |
1335 | else if ( d->mCurrentItem ) | 1338 | else if ( d->mCurrentItem ) |
1336 | { | 1339 | { |
1337 | d->mCurrentItem->repaintCard(); | 1340 | d->mCurrentItem->repaintCard(); |
1338 | } | 1341 | } |
1339 | } | 1342 | } |
1340 | 1343 | ||
1341 | void CardView::focusOutEvent( QFocusEvent * ) | 1344 | 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 | ||
1347 | void CardView::keyPressEvent( QKeyEvent *e ) | 1350 | void 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 | } |
1367 | break; | 1378 | break; |
1368 | case Key_Down: | 1379 | case Key_Down: |
1369 | if ( pos < d->mItemList.count() - 1 ) | 1380 | if ( pos < d->mItemList.count() - 1 ) |
1370 | { | 1381 | { |
1371 | aItem = d->mItemList.at( pos + 1 ); | 1382 | aItem = d->mItemList.at( pos + 1 ); |
1372 | setCurrentItem( aItem ); | 1383 | setCurrentItem( aItem ); |
1373 | } | 1384 | } |
1374 | break; | 1385 | break; |
1375 | case Key_Left: | 1386 | case Key_Left: |
1376 | { | 1387 | { |
1377 | // look for an item in the previous/next column, starting from | 1388 | // look for an item in the previous/next column, starting from |
1378 | // the vertical middle of the current item. | 1389 | // the vertical middle of the current item. |
@@ -1694,29 +1705,47 @@ void CardView::setFont( const QFont &fnt ) | |||
1694 | d->mFm = new QFontMetrics( fnt ); | 1705 | d->mFm = new QFontMetrics( fnt ); |
1695 | } | 1706 | } |
1696 | 1707 | ||
1697 | int CardView::separatorWidth() | 1708 | int CardView::separatorWidth() |
1698 | { | 1709 | { |
1699 | return d->mSepWidth; | 1710 | return d->mSepWidth; |
1700 | } | 1711 | } |
1701 | 1712 | ||
1702 | void CardView::setSeparatorWidth( int width ) | 1713 | void CardView::setSeparatorWidth( int width ) |
1703 | { | 1714 | { |
1704 | d->mSepWidth = width; | 1715 | d->mSepWidth = width; |
1705 | setLayoutDirty( true ); // hmm, actually I could just adjust the x'es... | 1716 | setLayoutDirty( true ); // hmm, actually I could just adjust the x'es... |
1706 | } | 1717 | } |
1707 | 1718 | ||
1708 | int CardView::maxFieldLines() const | 1719 | int CardView::maxFieldLines() const |
1709 | { | 1720 | { |
1710 | return d->mMaxFieldLines; | 1721 | return d->mMaxFieldLines; |
1711 | } | 1722 | } |
1712 | 1723 | ||
1713 | void CardView::setMaxFieldLines( int howmany ) | 1724 | void 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 | |||
1730 | void 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 | |||
@@ -384,88 +384,91 @@ class CardView : public QScrollView | |||
384 | void selectionChanged(CardViewItem *); | 384 | void selectionChanged(CardViewItem *); |
385 | 385 | ||
386 | /** This method is emitted whenever an item is clicked. | 386 | /** This method is emitted whenever an item is clicked. |
387 | */ | 387 | */ |
388 | void clicked(CardViewItem *); | 388 | void clicked(CardViewItem *); |
389 | 389 | ||
390 | /** Emitted whenever the user 'executes' an item. This is dependant on | 390 | /** Emitted whenever the user 'executes' an item. This is dependant on |
391 | * the KDE global config. This could be a single click or a doubleclick. | 391 | * the KDE global config. This could be a single click or a doubleclick. |
392 | * Also emitted when the return key is pressed on an item. | 392 | * Also emitted when the return key is pressed on an item. |
393 | */ | 393 | */ |
394 | void executed(CardViewItem *); | 394 | void executed(CardViewItem *); |
395 | 395 | ||
396 | /** Emitted whenever the user double clicks on an item. | 396 | /** Emitted whenever the user double clicks on an item. |
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); |
421 | 425 | ||
422 | /** Sets the layout to dirty and calls for a repaint. | 426 | /** Sets the layout to dirty and calls for a repaint. |
423 | */ | 427 | */ |
424 | void setLayoutDirty(bool dirty); | 428 | void setLayoutDirty(bool dirty); |
425 | 429 | ||
426 | /** Does the math based on the bounding rect of the cards to properly | 430 | /** Does the math based on the bounding rect of the cards to properly |
427 | * lay the cards out on the screen. This is only done if the layout is | 431 | * lay the cards out on the screen. This is only done if the layout is |
428 | * marked as dirty. | 432 | * marked as dirty. |
429 | */ | 433 | */ |
430 | void calcLayout(); | 434 | void calcLayout(); |
431 | 435 | ||
432 | // virtual void mousePressEvent(QMouseEvent *e); | 436 | // virtual void mousePressEvent(QMouseEvent *e); |
433 | // virtual void mouseReleaseEvent(QMouseEvent *e); | 437 | // virtual void mouseReleaseEvent(QMouseEvent *e); |
434 | // virtual void mouseMoveEvent(QMouseEvent *e); | 438 | // virtual void mouseMoveEvent(QMouseEvent *e); |
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 | */ |
460 | void tryShowFullText(); | 463 | void tryShowFullText(); |
461 | 464 | ||
462 | private: | 465 | private: |
463 | /** draws and erases the rubber bands while columns are resized. | 466 | /** draws and erases the rubber bands while columns are resized. |
464 | * @p pos is the horizontal position inside the viewport to use as | 467 | * @p pos is the horizontal position inside the viewport to use as |
465 | * the anchor. | 468 | * the anchor. |
466 | * If pos is 0, only erase is done. | 469 | * If pos is 0, only erase is done. |
467 | */ | 470 | */ |
468 | void drawRubberBands( int pos ); | 471 | void drawRubberBands( int pos ); |
469 | 472 | ||
470 | CardViewPrivate *d; | 473 | CardViewPrivate *d; |
471 | }; | 474 | }; |
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 | |||
@@ -8,48 +8,49 @@ | |||
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
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" |
44 | 45 | ||
45 | ///////////////////////////////// | 46 | ///////////////////////////////// |
46 | // DynamicTip Methods | 47 | // DynamicTip Methods |
47 | 48 | ||
48 | DynamicTip::DynamicTip( ContactListView *parent) | 49 | DynamicTip::DynamicTip( ContactListView *parent) |
49 | : QToolTip( parent ) | 50 | : QToolTip( parent ) |
50 | { | 51 | { |
51 | } | 52 | } |
52 | 53 | ||
53 | void DynamicTip::maybeTip( const QPoint &pos ) | 54 | void DynamicTip::maybeTip( const QPoint &pos ) |
54 | { | 55 | { |
55 | static bool ishidden = true; | 56 | static bool ishidden = true; |
@@ -227,48 +228,50 @@ void ContactListViewItem::refresh() | |||
227 | { | 228 | { |
228 | // Update our addressee, since it may have changed else were | 229 | // Update our addressee, since it may have changed else were |
229 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 230 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
230 | if (mAddressee.isEmpty()) | 231 | if (mAddressee.isEmpty()) |
231 | return; | 232 | return; |
232 | 233 | ||
233 | int i = 0; | 234 | int i = 0; |
234 | KABC::Field::List::ConstIterator it; | 235 | KABC::Field::List::ConstIterator it; |
235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 236 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
236 | setText( i++, (*it)->value( mAddressee ) ); | 237 | setText( i++, (*it)->value( mAddressee ) ); |
237 | } | 238 | } |
238 | } | 239 | } |
239 | 240 | ||
240 | /////////////////////////////// | 241 | /////////////////////////////// |
241 | // ContactListView | 242 | // ContactListView |
242 | 243 | ||
243 | ContactListView::ContactListView(KAddressBookTableView *view, | 244 | ContactListView::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 ); |
263 | setAllColumnsShowFocus( true ); | 266 | setAllColumnsShowFocus( true ); |
264 | setShowSortIndicator(true); | 267 | setShowSortIndicator(true); |
265 | 268 | ||
266 | setSelectionModeExt( KListView::Extended ); | 269 | setSelectionModeExt( KListView::Extended ); |
267 | setDropVisualizer(false); | 270 | setDropVisualizer(false); |
268 | // setFrameStyle(QFrame::NoFrame); | 271 | // setFrameStyle(QFrame::NoFrame); |
269 | //setLineWidth ( 0 ); | 272 | //setLineWidth ( 0 ); |
270 | //setMidLineWidth ( 0 ); | 273 | //setMidLineWidth ( 0 ); |
271 | //setMargin ( 0 ); | 274 | //setMargin ( 0 ); |
272 | #ifndef KAB_EMBEDDED | 275 | #ifndef KAB_EMBEDDED |
273 | connect(this, SIGNAL(dropped(QDropEvent*)), | 276 | connect(this, SIGNAL(dropped(QDropEvent*)), |
274 | this, SLOT(itemDropped(QDropEvent*))); | 277 | this, SLOT(itemDropped(QDropEvent*))); |
@@ -374,27 +377,53 @@ void ContactListView::setAlternateBackgroundEnabled(bool enabled) | |||
374 | if (mABackground) | 377 | if (mABackground) |
375 | { | 378 | { |
376 | setAlternateBackground(mAlternateColor); | 379 | setAlternateBackground(mAlternateColor); |
377 | } | 380 | } |
378 | else | 381 | else |
379 | { | 382 | { |
380 | setAlternateBackground(QColor()); | 383 | setAlternateBackground(QColor()); |
381 | } | 384 | } |
382 | } | 385 | } |
383 | 386 | ||
384 | void ContactListView::setBackgroundPixmap(const QString &filename) | 387 | void ContactListView::setBackgroundPixmap(const QString &filename) |
385 | { | 388 | { |
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 | |||
402 | void 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 | } | ||
415 | void 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 | |||
@@ -71,48 +71,52 @@ public: | |||
71 | virtual ~ContactListView() {} | 71 | virtual ~ContactListView() {} |
72 | //void resort(); | 72 | //void resort(); |
73 | 73 | ||
74 | /** Returns true if tooltips should be displayed, false otherwise | 74 | /** Returns true if tooltips should be displayed, false otherwise |
75 | */ | 75 | */ |
76 | bool tooltips() const { return mToolTips; } | 76 | bool tooltips() const { return mToolTips; } |
77 | void setToolTipsEnabled(bool enabled) { mToolTips = enabled; } | 77 | void setToolTipsEnabled(bool enabled) { mToolTips = enabled; } |
78 | 78 | ||
79 | bool alternateBackground() const { return mABackground; } | 79 | bool alternateBackground() const { return mABackground; } |
80 | void setAlternateBackgroundEnabled(bool enabled); | 80 | void setAlternateBackgroundEnabled(bool enabled); |
81 | 81 | ||
82 | bool singleLine() const { return mSingleLine; } | 82 | bool singleLine() const { return mSingleLine; } |
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 | ||
94 | protected: | 94 | protected: |
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 | ||
104 | protected slots: | 108 | protected slots: |
105 | void itemDropped(QDropEvent *e); | 109 | void itemDropped(QDropEvent *e); |
106 | 110 | ||
107 | public slots: | 111 | public slots: |
108 | void printMe(); | 112 | void printMe(); |
109 | 113 | ||
110 | signals: | 114 | signals: |
111 | void startAddresseeDrag(); | 115 | void startAddresseeDrag(); |
112 | void addresseeDropped(QDropEvent *); | 116 | void addresseeDropped(QDropEvent *); |
113 | 117 | ||
114 | private: | 118 | private: |
115 | KAddressBookTableView *pabWidget; | 119 | KAddressBookTableView *pabWidget; |
116 | int oldColumn; | 120 | int oldColumn; |
117 | int column; | 121 | int column; |
118 | bool ascending; | 122 | bool ascending; |
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 | |||
@@ -187,54 +187,58 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | |||
187 | this, SLOT(addresseeExecuted(CardViewItem *))); | 187 | this, SLOT(addresseeExecuted(CardViewItem *))); |
188 | connect(mCardView, SIGNAL(selectionChanged()), | 188 | connect(mCardView, SIGNAL(selectionChanged()), |
189 | this, SLOT(addresseeSelected())); | 189 | this, SLOT(addresseeSelected())); |
190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
191 | this, SIGNAL(dropped(QDropEvent*))); | 191 | this, SIGNAL(dropped(QDropEvent*))); |
192 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 192 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
193 | this, SIGNAL(startDrag())); | 193 | this, SIGNAL(startDrag())); |
194 | connect(this, SIGNAL(printView()), | 194 | connect(this, SIGNAL(printView()), |
195 | mCardView , SLOT(printMe())); | 195 | mCardView , SLOT(printMe())); |
196 | } | 196 | } |
197 | 197 | ||
198 | KAddressBookCardView::~KAddressBookCardView() | 198 | KAddressBookCardView::~KAddressBookCardView() |
199 | { | 199 | { |
200 | } | 200 | } |
201 | void KAddressBookCardView::setFocusAV() | 201 | void KAddressBookCardView::setFocusAV() |
202 | { | 202 | { |
203 | if ( mCardView ) | 203 | if ( mCardView ) |
204 | mCardView->setFocus(); | 204 | mCardView->setFocus(); |
205 | 205 | ||
206 | } | 206 | } |
207 | void KAddressBookCardView::scrollUP() | 207 | void 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 | } |
213 | void KAddressBookCardView::scrollDOWN() | 215 | void 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 | } |
218 | void KAddressBookCardView::readConfig(KConfig *config) | 222 | void 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 ); |
229 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 233 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
230 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 234 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
231 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 235 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
232 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 236 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
233 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 237 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
234 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 238 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
235 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 239 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
236 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 240 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
237 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 241 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
238 | mCardView->viewport()->setPalette( p ); | 242 | mCardView->viewport()->setPalette( p ); |
239 | } | 243 | } |
240 | else | 244 | else |
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 | |||
@@ -40,53 +40,57 @@ | |||
40 | 40 | ||
41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | 41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, |
42 | QWidget *parent, const char *name ) | 42 | QWidget *parent, const char *name ) |
43 | : KAddressBookView( ab, parent, name ) | 43 | : KAddressBookView( ab, parent, name ) |
44 | { | 44 | { |
45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); | 45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); |
46 | 46 | ||
47 | // The list view will be created when the config is read. | 47 | // The list view will be created when the config is read. |
48 | mListView = 0; | 48 | mListView = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | KAddressBookTableView::~KAddressBookTableView() | 51 | KAddressBookTableView::~KAddressBookTableView() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | void KAddressBookTableView::setFocusAV() | 54 | void KAddressBookTableView::setFocusAV() |
55 | { | 55 | { |
56 | if ( mListView ) | 56 | if ( mListView ) |
57 | mListView->setFocus(); | 57 | mListView->setFocus(); |
58 | 58 | ||
59 | } | 59 | } |
60 | void KAddressBookTableView::scrollUP() | 60 | void 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 | } |
65 | void KAddressBookTableView::scrollDOWN() | 67 | void 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 | } |
70 | void KAddressBookTableView::reconstructListView() | 74 | void 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, |
81 | SIGNAL(startDrag())); | 85 | SIGNAL(startDrag())); |
82 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 86 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
83 | this, SLOT(addresseeExecuted(QListViewItem*))); | 87 | this, SLOT(addresseeExecuted(QListViewItem*))); |
84 | 88 | ||
85 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 89 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
86 | SIGNAL(dropped(QDropEvent*))); | 90 | SIGNAL(dropped(QDropEvent*))); |
87 | delete mListView; | 91 | delete mListView; |
88 | } | 92 | } |
89 | 93 | ||
90 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 94 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
91 | 95 | ||
92 | connect(this, SIGNAL(printView()), | 96 | connect(this, SIGNAL(printView()), |