-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 8 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 17 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 18 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 2 | ||||
-rw-r--r-- | microkde/klineedit.h | 29 |
13 files changed, 108 insertions, 10 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 3533427..78eaf65 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -52,80 +52,86 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | |||
52 | 52 | ||
53 | mSearchText = new KLineEdit( this ); | 53 | mSearchText = new KLineEdit( this ); |
54 | layout->addWidget( mSearchText ); | 54 | layout->addWidget( mSearchText ); |
55 | // #ifdef KAB_EMBEDDED | 55 | // #ifdef KAB_EMBEDDED |
56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) | 56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) |
57 | // mSearchText->setMaximumWidth(30); | 57 | // mSearchText->setMaximumWidth(30); |
58 | // #endif //KAB_EMBEDDED | 58 | // #endif //KAB_EMBEDDED |
59 | 59 | ||
60 | 60 | ||
61 | mFieldCombo = new QComboBox( false, this ); | 61 | mFieldCombo = new QComboBox( false, this ); |
62 | layout->addWidget( mFieldCombo ); | 62 | layout->addWidget( mFieldCombo ); |
63 | mFieldCombo->setMaximumHeight( 34 ); | 63 | mFieldCombo->setMaximumHeight( 34 ); |
64 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); | 64 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); |
65 | 65 | ||
66 | // #ifndef KAB_EMBEDDED | 66 | // #ifndef KAB_EMBEDDED |
67 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); | 67 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); |
68 | // #else //KAB_EMBEDDED | 68 | // #else //KAB_EMBEDDED |
69 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); | 69 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); |
70 | // #endif //KAB_EMBEDDED | 70 | // #endif //KAB_EMBEDDED |
71 | 71 | ||
72 | 72 | ||
73 | // for performance reasons, we do a search on the pda only after return is pressed | 73 | // for performance reasons, we do a search on the pda only after return is pressed |
74 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), | 74 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), |
75 | SLOT( announceDoSearch2() ) ); | 75 | SLOT( announceDoSearch2() ) ); |
76 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 76 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
77 | SLOT( announceDoSearch2() ) ); | 77 | SLOT( announceDoSearch2() ) ); |
78 | 78 | ||
79 | connect( mSearchText, SIGNAL( returnPressed() ), | 79 | connect( mSearchText, SIGNAL( returnPressed() ), |
80 | SLOT( announceDoSearch() ) ); | 80 | SLOT( announceDoSearch() ) ); |
81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
82 | SLOT( announceFieldChanged() ) ); | 82 | SLOT( announceFieldChanged() ) ); |
83 | 83 | ||
84 | |||
85 | |||
86 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); | ||
87 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); | ||
88 | |||
89 | |||
84 | setFocusProxy( mSearchText ); | 90 | setFocusProxy( mSearchText ); |
85 | } | 91 | } |
86 | 92 | ||
87 | IncSearchWidget::~IncSearchWidget() | 93 | IncSearchWidget::~IncSearchWidget() |
88 | { | 94 | { |
89 | 95 | ||
90 | } | 96 | } |
91 | void IncSearchWidget::announceDoSearch2() | 97 | void IncSearchWidget::announceDoSearch2() |
92 | { | 98 | { |
93 | if ( KABPrefs::instance()->mSearchWithReturn ) | 99 | if ( KABPrefs::instance()->mSearchWithReturn ) |
94 | return; | 100 | return; |
95 | emit doSearch( mSearchText->text() ); | 101 | emit doSearch( mSearchText->text() ); |
96 | //qDebug("emit dosreach "); | 102 | //qDebug("emit dosreach "); |
97 | } | 103 | } |
98 | 104 | ||
99 | void IncSearchWidget::announceDoSearch() | 105 | void IncSearchWidget::announceDoSearch() |
100 | { | 106 | { |
101 | 107 | ||
102 | emit doSearch( mSearchText->text() ); | 108 | emit doSearch( mSearchText->text() ); |
103 | // qDebug("emit dosreach "); | 109 | // qDebug("emit dosreach "); |
104 | } | 110 | } |
105 | 111 | ||
106 | void IncSearchWidget::announceFieldChanged() | 112 | void IncSearchWidget::announceFieldChanged() |
107 | { | 113 | { |
108 | emit fieldChanged(); | 114 | emit fieldChanged(); |
109 | } | 115 | } |
110 | 116 | ||
111 | void IncSearchWidget::setFields( const KABC::Field::List &list ) | 117 | void IncSearchWidget::setFields( const KABC::Field::List &list ) |
112 | { | 118 | { |
113 | 119 | ||
114 | mFieldCombo->clear(); | 120 | mFieldCombo->clear(); |
115 | mFieldCombo->insertItem( i18n( "All Fields" ) ); | 121 | mFieldCombo->insertItem( i18n( "All Fields" ) ); |
116 | QFontMetrics fm ( mFieldCombo->font() ); | 122 | QFontMetrics fm ( mFieldCombo->font() ); |
117 | int wid = fm.width(i18n( "All Fields" ) ); | 123 | int wid = fm.width(i18n( "All Fields" ) ); |
118 | int max = wid; | 124 | int max = wid; |
119 | 125 | ||
120 | KABC::Field::List::ConstIterator it; | 126 | KABC::Field::List::ConstIterator it; |
121 | for ( it = list.begin(); it != list.end(); ++it ) { | 127 | for ( it = list.begin(); it != list.end(); ++it ) { |
122 | mFieldCombo->insertItem( (*it)->label() ); | 128 | mFieldCombo->insertItem( (*it)->label() ); |
123 | // wid = fm.width((*it)->label() ); | 129 | // wid = fm.width((*it)->label() ); |
124 | //if ( wid > max ) | 130 | //if ( wid > max ) |
125 | // max = wid; | 131 | // max = wid; |
126 | } | 132 | } |
127 | 133 | ||
128 | mFieldList = list; | 134 | mFieldList = list; |
129 | 135 | ||
130 | announceDoSearch(); | 136 | announceDoSearch(); |
131 | announceFieldChanged(); | 137 | announceFieldChanged(); |
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 5c95438..1546a51 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h | |||
@@ -19,56 +19,58 @@ | |||
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 | #ifndef INCSEARCHWIDGET_H | 24 | #ifndef INCSEARCHWIDGET_H |
25 | #define INCSEARCHWIDGET_H | 25 | #define INCSEARCHWIDGET_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | #include <kabc/field.h> | 29 | #include <kabc/field.h> |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class KLineEdit; | 32 | class KLineEdit; |
33 | 33 | ||
34 | class IncSearchWidget : public QWidget | 34 | class IncSearchWidget : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | IncSearchWidget( QWidget *parent, const char *name = 0 ); | 39 | IncSearchWidget( QWidget *parent, const char *name = 0 ); |
40 | ~IncSearchWidget(); | 40 | ~IncSearchWidget(); |
41 | 41 | ||
42 | void setFields( const KABC::Field::List &list ); | 42 | void setFields( const KABC::Field::List &list ); |
43 | KABC::Field::List fields() const; | 43 | KABC::Field::List fields() const; |
44 | 44 | ||
45 | KABC::Field *currentField() const; | 45 | KABC::Field *currentField() const; |
46 | 46 | ||
47 | void setCurrentItem( int pos ); | 47 | void setCurrentItem( int pos ); |
48 | int currentItem() const; | 48 | int currentItem() const; |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | void scrollUP(); | ||
52 | void scrollDOWN(); | ||
51 | /** | 53 | /** |
52 | This signal is emmited whenever the text in the input | 54 | This signal is emmited whenever the text in the input |
53 | widget is changed. You can get the sorting field by | 55 | widget is changed. You can get the sorting field by |
54 | @ref currentField. | 56 | @ref currentField. |
55 | */ | 57 | */ |
56 | void doSearch( const QString& text ); | 58 | void doSearch( const QString& text ); |
57 | 59 | ||
58 | /** | 60 | /** |
59 | This signal is emmited whenever the search field changes. | 61 | This signal is emmited whenever the search field changes. |
60 | */ | 62 | */ |
61 | void fieldChanged(); | 63 | void fieldChanged(); |
62 | 64 | ||
63 | private slots: | 65 | private slots: |
64 | void announceDoSearch(); | 66 | void announceDoSearch(); |
65 | void announceDoSearch2(); | 67 | void announceDoSearch2(); |
66 | void announceFieldChanged(); | 68 | void announceFieldChanged(); |
67 | 69 | ||
68 | private: | 70 | private: |
69 | QComboBox* mFieldCombo; | 71 | QComboBox* mFieldCombo; |
70 | KLineEdit* mSearchText; | 72 | KLineEdit* mSearchText; |
71 | KABC::Field::List mFieldList; | 73 | KABC::Field::List mFieldList; |
72 | }; | 74 | }; |
73 | 75 | ||
74 | #endif | 76 | #endif |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cd261f6..f2d4cd6 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1644,65 +1644,66 @@ void KABCore::initGUI() | |||
1644 | mDetails = new ViewContainer( this ); | 1644 | mDetails = new ViewContainer( this ); |
1645 | 1645 | ||
1646 | topLayout->addWidget( viewSpace ); | 1646 | topLayout->addWidget( viewSpace ); |
1647 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1647 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1648 | topLayout->addWidget( mDetails ); | 1648 | topLayout->addWidget( mDetails ); |
1649 | #endif //KAB_NOSPLITTER | 1649 | #endif //KAB_NOSPLITTER |
1650 | */ | 1650 | */ |
1651 | 1651 | ||
1652 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1652 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1653 | syncManager->setBlockSave(false); | 1653 | syncManager->setBlockSave(false); |
1654 | 1654 | ||
1655 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1655 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1656 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1656 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1657 | syncManager->setDefaultFileName( sentSyncFile()); | 1657 | syncManager->setDefaultFileName( sentSyncFile()); |
1658 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1658 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1659 | 1659 | ||
1660 | #endif //KAB_EMBEDDED | 1660 | #endif //KAB_EMBEDDED |
1661 | initActions(); | 1661 | initActions(); |
1662 | 1662 | ||
1663 | #ifdef KAB_EMBEDDED | 1663 | #ifdef KAB_EMBEDDED |
1664 | addActionsManually(); | 1664 | addActionsManually(); |
1665 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1665 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1666 | mXXPortManager = new XXPortManager( this, this ); | 1666 | mXXPortManager = new XXPortManager( this, this ); |
1667 | 1667 | ||
1668 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1668 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1669 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1669 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1670 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1670 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1671 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1671 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1672 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1672 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1673 | // mIncSearchWidget->hide(); | 1673 | // mIncSearchWidget->hide(); |
1674 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1674 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1675 | SLOT( incrementalSearch( const QString& ) ) ); | 1675 | SLOT( incrementalSearch( const QString& ) ) ); |
1676 | 1676 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | |
1677 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | ||
1677 | 1678 | ||
1678 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1679 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1679 | 1680 | ||
1680 | topLayout->addWidget( mJumpButtonBar ); | 1681 | topLayout->addWidget( mJumpButtonBar ); |
1681 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1682 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1682 | 1683 | ||
1683 | // mMainWindow->getIconToolBar()->raise(); | 1684 | // mMainWindow->getIconToolBar()->raise(); |
1684 | 1685 | ||
1685 | #endif //KAB_EMBEDDED | 1686 | #endif //KAB_EMBEDDED |
1686 | 1687 | ||
1687 | } | 1688 | } |
1688 | void KABCore::initActions() | 1689 | void KABCore::initActions() |
1689 | { | 1690 | { |
1690 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1691 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1691 | 1692 | ||
1692 | #ifndef KAB_EMBEDDED | 1693 | #ifndef KAB_EMBEDDED |
1693 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1694 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1694 | SLOT( clipboardDataChanged() ) ); | 1695 | SLOT( clipboardDataChanged() ) ); |
1695 | #endif //KAB_EMBEDDED | 1696 | #endif //KAB_EMBEDDED |
1696 | 1697 | ||
1697 | // file menu | 1698 | // file menu |
1698 | if ( mIsPart ) { | 1699 | if ( mIsPart ) { |
1699 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1700 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1700 | SLOT( sendMail() ), actionCollection(), | 1701 | SLOT( sendMail() ), actionCollection(), |
1701 | "kaddressbook_mail" ); | 1702 | "kaddressbook_mail" ); |
1702 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1703 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1703 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1704 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1704 | 1705 | ||
1705 | } else { | 1706 | } else { |
1706 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1707 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1707 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1708 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1708 | } | 1709 | } |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 17106e8..c134e96 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -36,64 +36,66 @@ class QDropEvent; | |||
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | #include "viewconfigurewidget.h" | 38 | #include "viewconfigurewidget.h" |
39 | #include "filter.h" | 39 | #include "filter.h" |
40 | 40 | ||
41 | namespace KABC { class AddressBook; } | 41 | namespace KABC { class AddressBook; } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | Base class for all views in kaddressbook. This class implements | 44 | Base class for all views in kaddressbook. This class implements |
45 | all the common methods needed to provide a view to the user. | 45 | all the common methods needed to provide a view to the user. |
46 | 46 | ||
47 | To implement a specific view (table, card, etc), just inherit from | 47 | To implement a specific view (table, card, etc), just inherit from |
48 | this class and implement all the pure virtuals. | 48 | this class and implement all the pure virtuals. |
49 | 49 | ||
50 | @author Mike Pilone <mpilone@slac.com> | 50 | @author Mike Pilone <mpilone@slac.com> |
51 | */ | 51 | */ |
52 | class KAddressBookView : public QWidget | 52 | class KAddressBookView : public QWidget |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; | 57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; |
58 | 58 | ||
59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); | 59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); |
60 | virtual ~KAddressBookView(); | 60 | virtual ~KAddressBookView(); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | Must be overloaded in subclasses. Should return a list of | 63 | Must be overloaded in subclasses. Should return a list of |
64 | all the uids of selected contacts. | 64 | all the uids of selected contacts. |
65 | */ | 65 | */ |
66 | virtual QStringList selectedUids() = 0; | 66 | virtual QStringList selectedUids() = 0; |
67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; | 67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; |
68 | virtual void scrollUP() = 0; | ||
69 | virtual void scrollDOWN() = 0; | ||
68 | 70 | ||
69 | /** | 71 | /** |
70 | Called whenever this view should read the config. This can be used | 72 | Called whenever this view should read the config. This can be used |
71 | as a sign that the config has changed, therefore the view should | 73 | as a sign that the config has changed, therefore the view should |
72 | assume the worst and rebuild itself if necessary. For example, | 74 | assume the worst and rebuild itself if necessary. For example, |
73 | in a table view this method may be called when the user adds or | 75 | in a table view this method may be called when the user adds or |
74 | removes columns from the view. | 76 | removes columns from the view. |
75 | 77 | ||
76 | If overloaded in the subclass, do not forget to call super class's | 78 | If overloaded in the subclass, do not forget to call super class's |
77 | method. | 79 | method. |
78 | 80 | ||
79 | @param config The KConfig object to read from. The group will already | 81 | @param config The KConfig object to read from. The group will already |
80 | be set, so do not change the group. | 82 | be set, so do not change the group. |
81 | */ | 83 | */ |
82 | virtual void readConfig( KConfig *config ); | 84 | virtual void readConfig( KConfig *config ); |
83 | 85 | ||
84 | /** | 86 | /** |
85 | Called whenever this view should write the config. The view should not | 87 | Called whenever this view should write the config. The view should not |
86 | write out information handled by the application, such as which fields | 88 | write out information handled by the application, such as which fields |
87 | are visible. The view should only write out information specific | 89 | are visible. The view should only write out information specific |
88 | to itself (i.e.: All information in the ViewConfigWidget) | 90 | to itself (i.e.: All information in the ViewConfigWidget) |
89 | 91 | ||
90 | If overloaded in the subclass, do not forget to call the super class's | 92 | If overloaded in the subclass, do not forget to call the super class's |
91 | method. | 93 | method. |
92 | 94 | ||
93 | @param config The KConfig object to read from. The group will already | 95 | @param config The KConfig object to read from. The group will already |
94 | be set, so do not change the group. | 96 | be set, so do not change the group. |
95 | */ | 97 | */ |
96 | virtual void writeConfig( KConfig *config ); | 98 | virtual void writeConfig( KConfig *config ); |
97 | 99 | ||
98 | /** | 100 | /** |
99 | Returns a QString with all the selected email addresses concatenated | 101 | Returns a QString with all the selected email addresses concatenated |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index c6baeac..f4fb08b 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -56,65 +56,74 @@ $Id$ | |||
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
57 | 57 | ||
58 | 58 | ||
59 | #include <kdebug.h> | 59 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 60 | #include <kactionclasses.h> |
61 | 61 | ||
62 | #include <qlayout.h> | 62 | #include <qlayout.h> |
63 | #include <qwidgetstack.h> | 63 | #include <qwidgetstack.h> |
64 | 64 | ||
65 | #include <kabc/addressbook.h> | 65 | #include <kabc/addressbook.h> |
66 | #include "filtereditdialog.h" | 66 | #include "filtereditdialog.h" |
67 | #include "addviewdialog.h" | 67 | #include "addviewdialog.h" |
68 | #include "kabcore.h" | 68 | #include "kabcore.h" |
69 | #include "kabprefs.h" | 69 | #include "kabprefs.h" |
70 | #include "viewmanager.h" | 70 | #include "viewmanager.h" |
71 | 71 | ||
72 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) | 72 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) |
73 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) | 73 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) |
74 | { | 74 | { |
75 | initGUI(); | 75 | initGUI(); |
76 | initActions(); | 76 | initActions(); |
77 | 77 | ||
78 | mViewDict.setAutoDelete( true ); | 78 | mViewDict.setAutoDelete( true ); |
79 | 79 | ||
80 | createViewFactories(); | 80 | createViewFactories(); |
81 | } | 81 | } |
82 | 82 | ||
83 | ViewManager::~ViewManager() | 83 | ViewManager::~ViewManager() |
84 | { | 84 | { |
85 | unloadViews(); | 85 | unloadViews(); |
86 | mViewFactoryDict.clear(); | 86 | mViewFactoryDict.clear(); |
87 | } | 87 | } |
88 | 88 | void ViewManager::scrollUP() | |
89 | { | ||
90 | if ( mActiveView ) | ||
91 | mActiveView->scrollUP(); | ||
92 | } | ||
93 | void ViewManager::scrollDOWN() | ||
94 | { | ||
95 | if ( mActiveView ) | ||
96 | mActiveView->scrollDOWN(); | ||
97 | } | ||
89 | void ViewManager::restoreSettings() | 98 | void ViewManager::restoreSettings() |
90 | { | 99 | { |
91 | mViewNameList = KABPrefs::instance()->mViewNames; | 100 | mViewNameList = KABPrefs::instance()->mViewNames; |
92 | QString activeViewName = KABPrefs::instance()->mCurrentView; | 101 | QString activeViewName = KABPrefs::instance()->mCurrentView; |
93 | 102 | ||
94 | mActionSelectView->setItems( mViewNameList ); | 103 | mActionSelectView->setItems( mViewNameList ); |
95 | 104 | ||
96 | // Filter | 105 | // Filter |
97 | mFilterList = Filter::restore( mCore->config(), "Filter" ); | 106 | mFilterList = Filter::restore( mCore->config(), "Filter" ); |
98 | mActionSelectFilter->setItems( filterNames() ); | 107 | mActionSelectFilter->setItems( filterNames() ); |
99 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 108 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
100 | 109 | ||
101 | // Tell the views to reread their config, since they may have | 110 | // Tell the views to reread their config, since they may have |
102 | // been modified by global settings | 111 | // been modified by global settings |
103 | QString _oldgroup = mCore->config()->group(); | 112 | QString _oldgroup = mCore->config()->group(); |
104 | 113 | ||
105 | QDictIterator<KAddressBookView> it( mViewDict ); | 114 | QDictIterator<KAddressBookView> it( mViewDict ); |
106 | for ( it.toFirst(); it.current(); ++it ) { | 115 | for ( it.toFirst(); it.current(); ++it ) { |
107 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 116 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
108 | it.current()->readConfig( mCore->config() ); | 117 | it.current()->readConfig( mCore->config() ); |
109 | } | 118 | } |
110 | setActiveView( activeViewName ); | 119 | setActiveView( activeViewName ); |
111 | 120 | ||
112 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 121 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
113 | } | 122 | } |
114 | 123 | ||
115 | void ViewManager::saveSettings() | 124 | void ViewManager::saveSettings() |
116 | { | 125 | { |
117 | QString _oldgroup = mCore->config()->group(); | 126 | QString _oldgroup = mCore->config()->group(); |
118 | 127 | ||
119 | QDictIterator<KAddressBookView> it( mViewDict ); | 128 | QDictIterator<KAddressBookView> it( mViewDict ); |
120 | for ( it.toFirst(); it.current(); ++it ) { | 129 | for ( it.toFirst(); it.current(); ++it ) { |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 6def6b6..585f4e9 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -37,64 +37,66 @@ class QWidgetStack; | |||
37 | class QDropEvent; | 37 | class QDropEvent; |
38 | 38 | ||
39 | namespace KABC { class AddressBook; } | 39 | namespace KABC { class AddressBook; } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | The view manager manages the views and everything related to them. The | 42 | The view manager manages the views and everything related to them. The |
43 | manager will load the views at startup and display a view when told to | 43 | manager will load the views at startup and display a view when told to |
44 | make one active. | 44 | make one active. |
45 | 45 | ||
46 | The view manager will also create and manage all dialogs directly related to | 46 | The view manager will also create and manage all dialogs directly related to |
47 | views (ie: AddView, ConfigureView, DeleteView, etc). | 47 | views (ie: AddView, ConfigureView, DeleteView, etc). |
48 | */ | 48 | */ |
49 | class ViewManager : public QWidget | 49 | class ViewManager : public QWidget |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
54 | ~ViewManager(); | 54 | ~ViewManager(); |
55 | 55 | ||
56 | void restoreSettings(); | 56 | void restoreSettings(); |
57 | void saveSettings(); | 57 | void saveSettings(); |
58 | void doSearch( const QString& s ,KABC::Field *field ); | 58 | void doSearch( const QString& s ,KABC::Field *field ); |
59 | 59 | ||
60 | void unloadViews(); | 60 | void unloadViews(); |
61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 61 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
62 | 62 | ||
63 | QStringList selectedUids() const; | 63 | QStringList selectedUids() const; |
64 | QStringList selectedEmails() const; | 64 | QStringList selectedEmails() const; |
65 | KABC::Addressee::List selectedAddressees() const; | 65 | KABC::Addressee::List selectedAddressees() const; |
66 | void setListSelected(QStringList); | 66 | void setListSelected(QStringList); |
67 | 67 | ||
68 | public slots: | 68 | public slots: |
69 | void scrollUP(); | ||
70 | void scrollDOWN(); | ||
69 | 71 | ||
70 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 72 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
71 | void setSelected( const QString &uid, bool); | 73 | void setSelected( const QString &uid, bool); |
72 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 74 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
73 | void setSelected(); | 75 | void setSelected(); |
74 | 76 | ||
75 | 77 | ||
76 | 78 | ||
77 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 79 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
78 | void refreshView(); | 80 | void refreshView(); |
79 | void refreshView( const QString &uid); | 81 | void refreshView( const QString &uid); |
80 | 82 | ||
81 | void editView(); | 83 | void editView(); |
82 | void deleteView(); | 84 | void deleteView(); |
83 | void addView(); | 85 | void addView(); |
84 | 86 | ||
85 | protected slots: | 87 | protected slots: |
86 | /** | 88 | /** |
87 | Called whenever the user drops something in the active view. | 89 | Called whenever the user drops something in the active view. |
88 | This method will try to decode what was dropped, and if it was | 90 | This method will try to decode what was dropped, and if it was |
89 | a valid addressee, add it to the addressbook. | 91 | a valid addressee, add it to the addressbook. |
90 | */ | 92 | */ |
91 | void dropped( QDropEvent* ); | 93 | void dropped( QDropEvent* ); |
92 | 94 | ||
93 | /** | 95 | /** |
94 | Called whenever the user attempts to start a drag in the view. | 96 | Called whenever the user attempts to start a drag in the view. |
95 | This method will convert all the selected addressees into text (vcard) | 97 | This method will convert all the selected addressees into text (vcard) |
96 | and create a drag object. | 98 | and create a drag object. |
97 | */ | 99 | */ |
98 | void startDrag(); | 100 | void startDrag(); |
99 | 101 | ||
100 | signals: | 102 | signals: |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 4babf67..a7bf6c9 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -1,61 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
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 <qdragobject.h> | 24 | #include <qdragobject.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qiconview.h> | 26 | #include <qiconview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | ||
30 | 31 | ||
31 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
32 | #include <kabc/addressee.h> | 33 | #include <kabc/addressee.h> |
33 | #include <kconfig.h> | 34 | #include <kconfig.h> |
34 | #include <kdebug.h> | 35 | #include <kdebug.h> |
35 | #include <klocale.h> | 36 | #include <klocale.h> |
36 | 37 | ||
37 | #include "kabprefs.h" | 38 | #include "kabprefs.h" |
38 | #include "viewmanager.h" | 39 | #include "viewmanager.h" |
39 | 40 | ||
40 | #include "kaddressbookcardview.h" | 41 | #include "kaddressbookcardview.h" |
41 | 42 | ||
42 | #ifndef KAB_EMBEDDED | 43 | #ifndef KAB_EMBEDDED |
43 | extern "C" { | 44 | extern "C" { |
44 | void *init_libkaddrbk_cardview() | 45 | void *init_libkaddrbk_cardview() |
45 | { | 46 | { |
46 | return ( new CardViewFactory ); | 47 | return ( new CardViewFactory ); |
47 | } | 48 | } |
48 | } | 49 | } |
49 | #endif //KAB_EMBEDDED | 50 | #endif //KAB_EMBEDDED |
50 | 51 | ||
51 | //////////////////////////////// | 52 | //////////////////////////////// |
52 | // AddresseeCardViewItem (internal class) | 53 | // AddresseeCardViewItem (internal class) |
53 | class AddresseeCardViewItem : public CardViewItem | 54 | class AddresseeCardViewItem : public CardViewItem |
54 | { | 55 | { |
55 | public: | 56 | public: |
56 | AddresseeCardViewItem(const KABC::Field::List &fields, | 57 | AddresseeCardViewItem(const KABC::Field::List &fields, |
57 | bool showEmptyFields, | 58 | bool showEmptyFields, |
58 | KABC::AddressBook *doc, const KABC::Addressee &a, | 59 | KABC::AddressBook *doc, const KABC::Addressee &a, |
59 | CardView *parent) | 60 | CardView *parent) |
60 | : CardViewItem(parent, a.formattedName()), | 61 | : CardViewItem(parent, a.formattedName()), |
61 | mFields( fields ), mShowEmptyFields(showEmptyFields), | 62 | mFields( fields ), mShowEmptyFields(showEmptyFields), |
@@ -140,64 +141,75 @@ void AddresseeCardView::startDrag() | |||
140 | 141 | ||
141 | /////////////////////////////// | 142 | /////////////////////////////// |
142 | // KAddressBookCardView | 143 | // KAddressBookCardView |
143 | 144 | ||
144 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 145 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
145 | QWidget *parent, const char *name ) | 146 | QWidget *parent, const char *name ) |
146 | : KAddressBookView( ab, parent, name ) | 147 | : KAddressBookView( ab, parent, name ) |
147 | { | 148 | { |
148 | mShowEmptyFields = false; | 149 | mShowEmptyFields = false; |
149 | 150 | ||
150 | // Init the GUI | 151 | // Init the GUI |
151 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 152 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
152 | 153 | ||
153 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 154 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
154 | mCardView->setSelectionMode(CardView::Extended); | 155 | mCardView->setSelectionMode(CardView::Extended); |
155 | layout->addWidget(mCardView); | 156 | layout->addWidget(mCardView); |
156 | 157 | ||
157 | // Connect up the signals | 158 | // Connect up the signals |
158 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 159 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
159 | this, SLOT(addresseeExecuted(CardViewItem *))); | 160 | this, SLOT(addresseeExecuted(CardViewItem *))); |
160 | connect(mCardView, SIGNAL(selectionChanged()), | 161 | connect(mCardView, SIGNAL(selectionChanged()), |
161 | this, SLOT(addresseeSelected())); | 162 | this, SLOT(addresseeSelected())); |
162 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 163 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
163 | this, SIGNAL(dropped(QDropEvent*))); | 164 | this, SIGNAL(dropped(QDropEvent*))); |
164 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 165 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
165 | this, SIGNAL(startDrag())); | 166 | this, SIGNAL(startDrag())); |
166 | } | 167 | } |
167 | 168 | ||
168 | KAddressBookCardView::~KAddressBookCardView() | 169 | KAddressBookCardView::~KAddressBookCardView() |
169 | { | 170 | { |
170 | } | 171 | } |
171 | 172 | ||
173 | void KAddressBookCardView::scrollUP() | ||
174 | { | ||
175 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
176 | QApplication::postEvent( mCardView, ev ); | ||
177 | |||
178 | } | ||
179 | void KAddressBookCardView::scrollDOWN() | ||
180 | { | ||
181 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
182 | QApplication::postEvent( mCardView, ev ); | ||
183 | } | ||
172 | void KAddressBookCardView::readConfig(KConfig *config) | 184 | void KAddressBookCardView::readConfig(KConfig *config) |
173 | { | 185 | { |
174 | KAddressBookView::readConfig(config); | 186 | KAddressBookView::readConfig(config); |
175 | 187 | ||
176 | // costum colors? | 188 | // costum colors? |
177 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 189 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
178 | { | 190 | { |
179 | QPalette p( mCardView->palette() ); | 191 | QPalette p( mCardView->palette() ); |
180 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 192 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
181 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 193 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
182 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 194 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
183 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 195 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
184 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 196 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
185 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 197 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
186 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 198 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
187 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 199 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
188 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 200 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
189 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 201 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
190 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 202 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
191 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 203 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
192 | mCardView->viewport()->setPalette( p ); | 204 | mCardView->viewport()->setPalette( p ); |
193 | } | 205 | } |
194 | else | 206 | else |
195 | { | 207 | { |
196 | // needed if turned off during a session. | 208 | // needed if turned off during a session. |
197 | mCardView->viewport()->setPalette( mCardView->palette() ); | 209 | mCardView->viewport()->setPalette( mCardView->palette() ); |
198 | } | 210 | } |
199 | 211 | ||
200 | //custom fonts? | 212 | //custom fonts? |
201 | QFont f( font() ); | 213 | QFont f( font() ); |
202 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 214 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
203 | { | 215 | { |
@@ -261,66 +273,70 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | |||
261 | KABC::Addressee::List::Iterator it; | 273 | KABC::Addressee::List::Iterator it; |
262 | if ( field ) { | 274 | if ( field ) { |
263 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 275 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
264 | #if QT_VERSION >= 300 | 276 | #if QT_VERSION >= 300 |
265 | if (re.search(field->value( *it ).lower()) != -1) | 277 | if (re.search(field->value( *it ).lower()) != -1) |
266 | #else | 278 | #else |
267 | if (re.match(field->value( *it ).lower()) != -1) | 279 | if (re.match(field->value( *it ).lower()) != -1) |
268 | #endif | 280 | #endif |
269 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 281 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
270 | addressBook(), *it, mCardView); | 282 | addressBook(), *it, mCardView); |
271 | 283 | ||
272 | } | 284 | } |
273 | } else { | 285 | } else { |
274 | KABC::Field::List fieldList = fields(); | 286 | KABC::Field::List fieldList = fields(); |
275 | KABC::Field::List::ConstIterator fieldIt; | 287 | KABC::Field::List::ConstIterator fieldIt; |
276 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 288 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
277 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 289 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
278 | #if QT_VERSION >= 300 | 290 | #if QT_VERSION >= 300 |
279 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 291 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
280 | #else | 292 | #else |
281 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 293 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
282 | #endif | 294 | #endif |
283 | { | 295 | { |
284 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 296 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
285 | addressBook(), *it, mCardView); | 297 | addressBook(), *it, mCardView); |
286 | continue; | 298 | continue; |
287 | } | 299 | } |
288 | } | 300 | } |
289 | } | 301 | } |
290 | } | 302 | } |
291 | mCardView->viewport()->setUpdatesEnabled( true ); | 303 | mCardView->viewport()->setUpdatesEnabled( true ); |
292 | mCardView->viewport()->update(); | 304 | mCardView->viewport()->update(); |
293 | // by default nothing is selected | 305 | if ( mCardView->firstItem() ) { |
294 | emit selected(QString::null); | 306 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
307 | mCardView->setSelected ( mCardView->firstItem() , true ); | ||
308 | } | ||
309 | else | ||
310 | emit selected(QString::null); | ||
295 | } | 311 | } |
296 | QStringList KAddressBookCardView::selectedUids() | 312 | QStringList KAddressBookCardView::selectedUids() |
297 | { | 313 | { |
298 | QStringList uidList; | 314 | QStringList uidList; |
299 | CardViewItem *item; | 315 | CardViewItem *item; |
300 | AddresseeCardViewItem *aItem; | 316 | AddresseeCardViewItem *aItem; |
301 | 317 | ||
302 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 318 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
303 | { | 319 | { |
304 | if (item->isSelected()) | 320 | if (item->isSelected()) |
305 | { | 321 | { |
306 | #ifndef KAB_EMBEDDED | 322 | #ifndef KAB_EMBEDDED |
307 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 323 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
308 | #else //KAB_EMBEDDED | 324 | #else //KAB_EMBEDDED |
309 | aItem = (AddresseeCardViewItem*)(item); | 325 | aItem = (AddresseeCardViewItem*)(item); |
310 | #endif //KAB_EMBEDDED | 326 | #endif //KAB_EMBEDDED |
311 | if (aItem) | 327 | if (aItem) |
312 | uidList << aItem->addressee().uid(); | 328 | uidList << aItem->addressee().uid(); |
313 | } | 329 | } |
314 | } | 330 | } |
315 | 331 | ||
316 | return uidList; | 332 | return uidList; |
317 | } | 333 | } |
318 | 334 | ||
319 | void KAddressBookCardView::refresh(QString uid) | 335 | void KAddressBookCardView::refresh(QString uid) |
320 | { | 336 | { |
321 | CardViewItem *item; | 337 | CardViewItem *item; |
322 | AddresseeCardViewItem *aItem; | 338 | AddresseeCardViewItem *aItem; |
323 | 339 | ||
324 | if (uid.isNull()) | 340 | if (uid.isNull()) |
325 | { | 341 | { |
326 | // Rebuild the view | 342 | // Rebuild the view |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index b8efb01..45a9781 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -31,64 +31,66 @@ | |||
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #endif //KAB_EMBEDDED | 32 | #endif //KAB_EMBEDDED |
33 | 33 | ||
34 | #include "cardview.h" | 34 | #include "cardview.h" |
35 | #include "kaddressbookview.h" | 35 | #include "kaddressbookview.h" |
36 | #include "configurecardviewdialog.h" | 36 | #include "configurecardviewdialog.h" |
37 | 37 | ||
38 | class QDragEnterEvent; | 38 | class QDragEnterEvent; |
39 | class QDragEntryEvent; | 39 | class QDragEntryEvent; |
40 | class QDropEvent; | 40 | class QDropEvent; |
41 | class KConfig; | 41 | class KConfig; |
42 | class AddresseeCardView; | 42 | class AddresseeCardView; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | This view uses the CardView class to create a card view. At some | 45 | This view uses the CardView class to create a card view. At some |
46 | point in the future I think this will be the default view of | 46 | point in the future I think this will be the default view of |
47 | KAddressBook. | 47 | KAddressBook. |
48 | */ | 48 | */ |
49 | class KAddressBookCardView : public KAddressBookView | 49 | class KAddressBookCardView : public KAddressBookView |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | 52 | ||
53 | public: | 53 | public: |
54 | KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, | 54 | KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, |
55 | const char *name = 0 ); | 55 | const char *name = 0 ); |
56 | virtual ~KAddressBookCardView(); | 56 | virtual ~KAddressBookCardView(); |
57 | void doSearch( const QString& s,KABC::Field *field ); | 57 | void doSearch( const QString& s,KABC::Field *field ); |
58 | virtual QStringList selectedUids(); | 58 | virtual QStringList selectedUids(); |
59 | virtual QString type() const { return "Card"; } | 59 | virtual QString type() const { return "Card"; } |
60 | 60 | ||
61 | virtual void readConfig(KConfig *config); | 61 | virtual void readConfig(KConfig *config); |
62 | virtual void writeConfig(KConfig *); | 62 | virtual void writeConfig(KConfig *); |
63 | virtual void scrollUP(); | ||
64 | virtual void scrollDOWN(); | ||
63 | 65 | ||
64 | public slots: | 66 | public slots: |
65 | void refresh(QString uid = QString::null); | 67 | void refresh(QString uid = QString::null); |
66 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); | 68 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); |
67 | //US added an additional method without parameter | 69 | //US added an additional method without parameter |
68 | void setSelected(); | 70 | void setSelected(); |
69 | 71 | ||
70 | protected slots: | 72 | protected slots: |
71 | void addresseeExecuted(CardViewItem *item); | 73 | void addresseeExecuted(CardViewItem *item); |
72 | void addresseeSelected(); | 74 | void addresseeSelected(); |
73 | 75 | ||
74 | private: | 76 | private: |
75 | AddresseeCardView *mCardView; | 77 | AddresseeCardView *mCardView; |
76 | bool mShowEmptyFields; | 78 | bool mShowEmptyFields; |
77 | }; | 79 | }; |
78 | 80 | ||
79 | class AddresseeCardView : public CardView | 81 | class AddresseeCardView : public CardView |
80 | { | 82 | { |
81 | Q_OBJECT | 83 | Q_OBJECT |
82 | public: | 84 | public: |
83 | AddresseeCardView(QWidget *parent, const char *name = 0); | 85 | AddresseeCardView(QWidget *parent, const char *name = 0); |
84 | ~AddresseeCardView(); | 86 | ~AddresseeCardView(); |
85 | 87 | ||
86 | signals: | 88 | signals: |
87 | void startAddresseeDrag(); | 89 | void startAddresseeDrag(); |
88 | void addresseeDropped(QDropEvent *); | 90 | void addresseeDropped(QDropEvent *); |
89 | 91 | ||
90 | protected: | 92 | protected: |
91 | virtual void dragEnterEvent(QDragEnterEvent *); | 93 | virtual void dragEnterEvent(QDragEnterEvent *); |
92 | virtual void dropEvent(QDropEvent *); | 94 | virtual void dropEvent(QDropEvent *); |
93 | virtual void startDrag(); | 95 | virtual void startDrag(); |
94 | }; | 96 | }; |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index fdc0db9..f4c68b8 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -12,64 +12,65 @@ | |||
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 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qiconview.h> | 25 | #include <qiconview.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | #include <kabc/addressee.h> | 28 | #include <kabc/addressee.h> |
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #else //KAB_EMBEDDED | 35 | #else //KAB_EMBEDDED |
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | #include <kabc/addressbook.h> | 38 | #include <kabc/addressbook.h> |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #include "viewmanager.h" | 40 | #include "viewmanager.h" |
41 | #include "kaddressbookiconview.h" | 41 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qapplication.h> | ||
44 | #include <kglobal.h> | 45 | #include <kglobal.h> |
45 | /*US transfered to the headerfile | 46 | /*US transfered to the headerfile |
46 | class IconViewFactory : public ViewFactory | 47 | class IconViewFactory : public ViewFactory |
47 | { | 48 | { |
48 | public: | 49 | public: |
49 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 50 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
50 | { | 51 | { |
51 | return new KAddressBookIconView( ab, parent, name ); | 52 | return new KAddressBookIconView( ab, parent, name ); |
52 | } | 53 | } |
53 | 54 | ||
54 | QString type() const { return "Icon"; } | 55 | QString type() const { return "Icon"; } |
55 | 56 | ||
56 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } | 57 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } |
57 | }; | 58 | }; |
58 | 59 | ||
59 | */ | 60 | */ |
60 | 61 | ||
61 | extern "C" { | 62 | extern "C" { |
62 | void *init_libkaddrbk_iconview() | 63 | void *init_libkaddrbk_iconview() |
63 | { | 64 | { |
64 | return ( new IconViewFactory ); | 65 | return ( new IconViewFactory ); |
65 | } | 66 | } |
66 | } | 67 | } |
67 | 68 | ||
68 | //////////////////////////////// | 69 | //////////////////////////////// |
69 | // AddresseeIconView (internal class) | 70 | // AddresseeIconView (internal class) |
70 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
71 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 72 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
72 | : KIconView(parent, name) | 73 | : KIconView(parent, name) |
73 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
74 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 75 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
75 | : QIconView(parent, name) | 76 | : QIconView(parent, name) |
@@ -182,64 +183,74 @@ class AddresseeIconViewItem : public QIconViewItem | |||
182 | // KAddressBookView | 183 | // KAddressBookView |
183 | 184 | ||
184 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 185 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
185 | QWidget *parent, const char *name) | 186 | QWidget *parent, const char *name) |
186 | : KAddressBookView( ab, parent, name ) | 187 | : KAddressBookView( ab, parent, name ) |
187 | { | 188 | { |
188 | // Init the GUI | 189 | // Init the GUI |
189 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 190 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
190 | 191 | ||
191 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 192 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
192 | layout->addWidget(mIconView); | 193 | layout->addWidget(mIconView); |
193 | 194 | ||
194 | // Connect up the signals | 195 | // Connect up the signals |
195 | 196 | ||
196 | //US method executed is part of KIconView | 197 | //US method executed is part of KIconView |
197 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 198 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
198 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 199 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
199 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 200 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
200 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 201 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
201 | 202 | ||
202 | connect(mIconView, SIGNAL(selectionChanged()), | 203 | connect(mIconView, SIGNAL(selectionChanged()), |
203 | this, SLOT(addresseeSelected())); | 204 | this, SLOT(addresseeSelected())); |
204 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 205 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
205 | this, SIGNAL(dropped(QDropEvent*))); | 206 | this, SIGNAL(dropped(QDropEvent*))); |
206 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 207 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
207 | this, SIGNAL(startDrag())); | 208 | this, SIGNAL(startDrag())); |
208 | } | 209 | } |
209 | 210 | ||
210 | KAddressBookIconView::~KAddressBookIconView() | 211 | KAddressBookIconView::~KAddressBookIconView() |
211 | { | 212 | { |
212 | } | 213 | } |
213 | 214 | ||
215 | void KAddressBookIconView::scrollUP() | ||
216 | { | ||
217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
218 | QApplication::postEvent( mIconView, ev ); | ||
219 | } | ||
220 | void KAddressBookIconView::scrollDOWN() | ||
221 | { | ||
222 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
223 | QApplication::postEvent( mIconView, ev ); | ||
224 | } | ||
214 | void KAddressBookIconView::readConfig(KConfig *config) | 225 | void KAddressBookIconView::readConfig(KConfig *config) |
215 | { | 226 | { |
216 | KAddressBookView::readConfig(config); | 227 | KAddressBookView::readConfig(config); |
217 | 228 | ||
218 | //US method executed is part of KIconView | 229 | //US method executed is part of KIconView |
219 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 230 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 231 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
221 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 232 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
222 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 233 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
223 | 234 | ||
224 | //US method executed is part of KIconView. Use selectionChanged instead | 235 | //US method executed is part of KIconView. Use selectionChanged instead |
225 | /*US | 236 | /*US |
226 | if (KABPrefs::instance()->mHonorSingleClick) | 237 | if (KABPrefs::instance()->mHonorSingleClick) |
227 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 238 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
228 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 239 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
229 | else | 240 | else |
230 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 241 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
231 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 242 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
232 | */ | 243 | */ |
233 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 244 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
234 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 245 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
235 | 246 | ||
236 | } | 247 | } |
237 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 248 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
238 | { | 249 | { |
239 | mIconView->clear(); | 250 | mIconView->clear(); |
240 | mIconList.clear(); | 251 | mIconList.clear(); |
241 | if ( s.isEmpty() || s == "*" ) { | 252 | if ( s.isEmpty() || s == "*" ) { |
242 | refresh(); | 253 | refresh(); |
243 | return; | 254 | return; |
244 | } | 255 | } |
245 | QString pattern = s.lower()+"*"; | 256 | QString pattern = s.lower()+"*"; |
@@ -251,64 +262,70 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
251 | return; | 262 | return; |
252 | KABC::Addressee::List addresseeList = addressees(); | 263 | KABC::Addressee::List addresseeList = addressees(); |
253 | KABC::Addressee::List::Iterator it; | 264 | KABC::Addressee::List::Iterator it; |
254 | if ( field ) { | 265 | if ( field ) { |
255 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 266 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
256 | #if QT_VERSION >= 300 | 267 | #if QT_VERSION >= 300 |
257 | if (re.search(field->value( *it ).lower()) != -1) | 268 | if (re.search(field->value( *it ).lower()) != -1) |
258 | #else | 269 | #else |
259 | if (re.match(field->value( *it ).lower()) != -1) | 270 | if (re.match(field->value( *it ).lower()) != -1) |
260 | #endif | 271 | #endif |
261 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 272 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
262 | 273 | ||
263 | 274 | ||
264 | } | 275 | } |
265 | } else { | 276 | } else { |
266 | KABC::Field::List fieldList = fields(); | 277 | KABC::Field::List fieldList = fields(); |
267 | KABC::Field::List::ConstIterator fieldIt; | 278 | KABC::Field::List::ConstIterator fieldIt; |
268 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
269 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 280 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
270 | #if QT_VERSION >= 300 | 281 | #if QT_VERSION >= 300 |
271 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 282 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
272 | #else | 283 | #else |
273 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 284 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
274 | #endif | 285 | #endif |
275 | { | 286 | { |
276 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 287 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
277 | continue; | 288 | continue; |
278 | } | 289 | } |
279 | } | 290 | } |
280 | } | 291 | } |
281 | } | 292 | } |
282 | mIconView->arrangeItemsInGrid( true ); | 293 | mIconView->arrangeItemsInGrid( true ); |
294 | if ( mIconView->firstItem() ) { | ||
295 | mIconView->setCurrentItem ( mIconView->firstItem() ); | ||
296 | mIconView->setSelected ( mIconView->firstItem() , true ); | ||
297 | } | ||
298 | else | ||
299 | emit selected(QString::null); | ||
283 | } | 300 | } |
284 | QStringList KAddressBookIconView::selectedUids() | 301 | QStringList KAddressBookIconView::selectedUids() |
285 | { | 302 | { |
286 | QStringList uidList; | 303 | QStringList uidList; |
287 | QIconViewItem *item; | 304 | QIconViewItem *item; |
288 | AddresseeIconViewItem *aItem; | 305 | AddresseeIconViewItem *aItem; |
289 | 306 | ||
290 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 307 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
291 | { | 308 | { |
292 | if (item->isSelected()) | 309 | if (item->isSelected()) |
293 | { | 310 | { |
294 | #ifndef KAB_EMBEDDED | 311 | #ifndef KAB_EMBEDDED |
295 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 312 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
296 | #else //KAB_EMBEDDED | 313 | #else //KAB_EMBEDDED |
297 | aItem = (AddresseeIconViewItem*)(item); | 314 | aItem = (AddresseeIconViewItem*)(item); |
298 | #endif //KAB_EMBEDDED | 315 | #endif //KAB_EMBEDDED |
299 | if (aItem) | 316 | if (aItem) |
300 | uidList << aItem->addressee().uid(); | 317 | uidList << aItem->addressee().uid(); |
301 | } | 318 | } |
302 | } | 319 | } |
303 | 320 | ||
304 | return uidList; | 321 | return uidList; |
305 | } | 322 | } |
306 | 323 | ||
307 | void KAddressBookIconView::refresh(QString uid) | 324 | void KAddressBookIconView::refresh(QString uid) |
308 | { | 325 | { |
309 | QIconViewItem *item; | 326 | QIconViewItem *item; |
310 | AddresseeIconViewItem *aItem; | 327 | AddresseeIconViewItem *aItem; |
311 | 328 | ||
312 | if ( uid.isNull() ) { | 329 | if ( uid.isNull() ) { |
313 | // Rebuild the view | 330 | // Rebuild the view |
314 | mIconView->clear(); | 331 | mIconView->clear(); |
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index 963ee7c..acfcd71 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h | |||
@@ -32,64 +32,66 @@ | |||
32 | #include <qptrlist.h> | 32 | #include <qptrlist.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #endif //KAB_EMBEDDED | 34 | #endif //KAB_EMBEDDED |
35 | #include "kaddressbookview.h" | 35 | #include "kaddressbookview.h" |
36 | 36 | ||
37 | class QIconViewItem; | 37 | class QIconViewItem; |
38 | class KConfig; | 38 | class KConfig; |
39 | class AddresseeIconView; | 39 | class AddresseeIconView; |
40 | class AddresseeIconViewItem; | 40 | class AddresseeIconViewItem; |
41 | class QIconDragItem; | 41 | class QIconDragItem; |
42 | class KAddressBookIconView; | 42 | class KAddressBookIconView; |
43 | 43 | ||
44 | namespace KABC { class AddressBook; } | 44 | namespace KABC { class AddressBook; } |
45 | 45 | ||
46 | /** This is an example kaddressbook view that is implemented using | 46 | /** This is an example kaddressbook view that is implemented using |
47 | * KIconView. This view is not the most useful view, but it displays | 47 | * KIconView. This view is not the most useful view, but it displays |
48 | * how simple implementing a new view can be. | 48 | * how simple implementing a new view can be. |
49 | */ | 49 | */ |
50 | class KAddressBookIconView : public KAddressBookView | 50 | class KAddressBookIconView : public KAddressBookView |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, | 55 | KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, |
56 | const char *name = 0 ); | 56 | const char *name = 0 ); |
57 | virtual ~KAddressBookIconView(); | 57 | virtual ~KAddressBookIconView(); |
58 | 58 | ||
59 | virtual QStringList selectedUids(); | 59 | virtual QStringList selectedUids(); |
60 | virtual QString type() const { return "Icon"; } | 60 | virtual QString type() const { return "Icon"; } |
61 | void doSearch( const QString& s ,KABC::Field *field ); | 61 | void doSearch( const QString& s ,KABC::Field *field ); |
62 | 62 | ||
63 | virtual void readConfig(KConfig *config); | 63 | virtual void readConfig(KConfig *config); |
64 | virtual void scrollUP(); | ||
65 | virtual void scrollDOWN(); | ||
64 | 66 | ||
65 | public slots: | 67 | public slots: |
66 | void refresh(QString uid = QString::null); | 68 | void refresh(QString uid = QString::null); |
67 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
68 | //MOC_SKIP_BEGIN | 70 | //MOC_SKIP_BEGIN |
69 | void setSelected(QString uid = QString::null, bool selected = true); | 71 | void setSelected(QString uid = QString::null, bool selected = true); |
70 | //MOC_SKIP_END | 72 | //MOC_SKIP_END |
71 | #else //KAB_EMBEDDED | 73 | #else //KAB_EMBEDDED |
72 | //US my MOC do not like default parameters ??? | 74 | //US my MOC do not like default parameters ??? |
73 | void setSelected(QString uid, bool selected); | 75 | void setSelected(QString uid, bool selected); |
74 | #endif //KAB_EMBEDDED | 76 | #endif //KAB_EMBEDDED |
75 | 77 | ||
76 | protected slots: | 78 | protected slots: |
77 | void addresseeExecuted(QIconViewItem *item); | 79 | void addresseeExecuted(QIconViewItem *item); |
78 | void addresseeSelected(); | 80 | void addresseeSelected(); |
79 | 81 | ||
80 | private: | 82 | private: |
81 | AddresseeIconView *mIconView; | 83 | AddresseeIconView *mIconView; |
82 | QPtrList<AddresseeIconViewItem> mIconList; | 84 | QPtrList<AddresseeIconViewItem> mIconList; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
86 | #ifndef KAB_EMBEDDED | 88 | #ifndef KAB_EMBEDDED |
87 | //MOC_SKIP_BEGIN | 89 | //MOC_SKIP_BEGIN |
88 | class AddresseeIconView : public KIconView | 90 | class AddresseeIconView : public KIconView |
89 | //MOC_SKIP_END | 91 | //MOC_SKIP_END |
90 | #else //KAB_EMBEDDED | 92 | #else //KAB_EMBEDDED |
91 | class AddresseeIconView : public QIconView | 93 | class AddresseeIconView : public QIconView |
92 | #endif //KAB_EMBEDDED | 94 | #endif //KAB_EMBEDDED |
93 | { | 95 | { |
94 | Q_OBJECT | 96 | Q_OBJECT |
95 | 97 | ||
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index fbfddba..2412170 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -22,65 +22,74 @@ | |||
22 | #include <klineedit.h> | 22 | #include <klineedit.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kmessagebox.h> | 24 | #include <kmessagebox.h> |
25 | #include <kurl.h> | 25 | #include <kurl.h> |
26 | #include <kurlrequester.h> | 26 | #include <kurlrequester.h> |
27 | 27 | ||
28 | //US#include "configuretableviewdialog.h" | 28 | //US#include "configuretableviewdialog.h" |
29 | #include "contactlistview.h" | 29 | #include "contactlistview.h" |
30 | #include "kabprefs.h" | 30 | #include "kabprefs.h" |
31 | #include "undocmds.h" | 31 | #include "undocmds.h" |
32 | #include "viewmanager.h" | 32 | #include "viewmanager.h" |
33 | 33 | ||
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qheader.h> | 35 | #include <qheader.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include "kaddressbooktableview.h" | 38 | #include "kaddressbooktableview.h" |
39 | 39 | ||
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 | 54 | void KAddressBookTableView::scrollUP() | |
55 | { | ||
56 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
57 | QApplication::postEvent( mListView, ev ); | ||
58 | } | ||
59 | void KAddressBookTableView::scrollDOWN() | ||
60 | { | ||
61 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
62 | QApplication::postEvent( mListView, ev ); | ||
63 | } | ||
55 | void KAddressBookTableView::reconstructListView() | 64 | void KAddressBookTableView::reconstructListView() |
56 | { | 65 | { |
57 | if (mListView) | 66 | if (mListView) |
58 | { | 67 | { |
59 | disconnect(mListView, SIGNAL(selectionChanged()), | 68 | disconnect(mListView, SIGNAL(selectionChanged()), |
60 | this, SLOT(addresseeSelected())); | 69 | this, SLOT(addresseeSelected())); |
61 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 70 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), |
62 | this, SLOT(addresseeExecuted(QListViewItem*))); | 71 | this, SLOT(addresseeExecuted(QListViewItem*))); |
63 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 72 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
64 | this, SLOT(addresseeExecuted(QListViewItem*))); | 73 | this, SLOT(addresseeExecuted(QListViewItem*))); |
65 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 74 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
66 | SIGNAL(startDrag())); | 75 | SIGNAL(startDrag())); |
67 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 76 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
68 | this, SLOT(addresseeExecuted(QListViewItem*))); | 77 | this, SLOT(addresseeExecuted(QListViewItem*))); |
69 | 78 | ||
70 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 79 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
71 | SIGNAL(dropped(QDropEvent*))); | 80 | SIGNAL(dropped(QDropEvent*))); |
72 | delete mListView; | 81 | delete mListView; |
73 | } | 82 | } |
74 | 83 | ||
75 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 84 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
76 | 85 | ||
77 | // Add the columns | 86 | // Add the columns |
78 | KABC::Field::List fieldList = fields(); | 87 | KABC::Field::List fieldList = fields(); |
79 | KABC::Field::List::ConstIterator it; | 88 | KABC::Field::List::ConstIterator it; |
80 | 89 | ||
81 | int c = 0; | 90 | int c = 0; |
82 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 91 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
83 | mListView->addColumn( (*it)->label() ); | 92 | mListView->addColumn( (*it)->label() ); |
84 | mListView->setColumnWidthMode(c++, QListView::Manual); | 93 | mListView->setColumnWidthMode(c++, QListView::Manual); |
85 | //US | 94 | //US |
86 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 95 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
@@ -130,65 +139,70 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | |||
130 | KABC::Addressee::List addresseeList = addressees(); | 139 | KABC::Addressee::List addresseeList = addressees(); |
131 | KABC::Addressee::List::Iterator it; | 140 | KABC::Addressee::List::Iterator it; |
132 | if ( field ) { | 141 | if ( field ) { |
133 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 142 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
134 | #if QT_VERSION >= 300 | 143 | #if QT_VERSION >= 300 |
135 | if (re.search(field->value( *it ).lower()) != -1) | 144 | if (re.search(field->value( *it ).lower()) != -1) |
136 | #else | 145 | #else |
137 | if (re.match(field->value( *it ).lower()) != -1) | 146 | if (re.match(field->value( *it ).lower()) != -1) |
138 | #endif | 147 | #endif |
139 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 148 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
140 | 149 | ||
141 | } | 150 | } |
142 | } else { | 151 | } else { |
143 | KABC::Field::List fieldList = fields(); | 152 | KABC::Field::List fieldList = fields(); |
144 | KABC::Field::List::ConstIterator fieldIt; | 153 | KABC::Field::List::ConstIterator fieldIt; |
145 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
146 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 155 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
147 | #if QT_VERSION >= 300 | 156 | #if QT_VERSION >= 300 |
148 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 157 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
149 | #else | 158 | #else |
150 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 159 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
151 | #endif | 160 | #endif |
152 | { | 161 | { |
153 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 162 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
154 | break; | 163 | break; |
155 | } | 164 | } |
156 | } | 165 | } |
157 | } | 166 | } |
158 | } | 167 | } |
159 | // Sometimes the background pixmap gets messed up when we add lots | 168 | // Sometimes the background pixmap gets messed up when we add lots |
160 | // of items. | 169 | // of items. |
161 | mListView->repaint(); | 170 | mListView->repaint(); |
162 | emit selected(QString::null); | 171 | if ( mListView->firstChild() ) { |
172 | mListView->setCurrentItem ( mListView->firstChild() ); | ||
173 | mListView->setSelected ( mListView->firstChild(), true ); | ||
174 | } | ||
175 | else | ||
176 | emit selected(QString::null); | ||
163 | 177 | ||
164 | } | 178 | } |
165 | void KAddressBookTableView::writeConfig(KConfig *config) | 179 | void KAddressBookTableView::writeConfig(KConfig *config) |
166 | { | 180 | { |
167 | KAddressBookView::writeConfig(config); | 181 | KAddressBookView::writeConfig(config); |
168 | 182 | ||
169 | mListView->saveLayout(config, config->group()); | 183 | mListView->saveLayout(config, config->group()); |
170 | } | 184 | } |
171 | 185 | ||
172 | void KAddressBookTableView::readConfig(KConfig *config) | 186 | void KAddressBookTableView::readConfig(KConfig *config) |
173 | { | 187 | { |
174 | KAddressBookView::readConfig( config ); | 188 | KAddressBookView::readConfig( config ); |
175 | // The config could have changed the fields, so we need to reconstruct | 189 | // The config could have changed the fields, so we need to reconstruct |
176 | // the listview. | 190 | // the listview. |
177 | reconstructListView(); | 191 | reconstructListView(); |
178 | 192 | ||
179 | // costum colors? | 193 | // costum colors? |
180 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 194 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
181 | { | 195 | { |
182 | QPalette p( mListView->palette() ); | 196 | QPalette p( mListView->palette() ); |
183 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 197 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
184 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 198 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
185 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 199 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
186 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 200 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
187 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 201 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
188 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 202 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
189 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 203 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
190 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 204 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
191 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 205 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
192 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 206 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
193 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 207 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
194 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 208 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index ecfe7a1..865f8d5 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h | |||
@@ -34,64 +34,66 @@ class KConfig; | |||
34 | class ContactListViewItem; | 34 | class ContactListViewItem; |
35 | class ContactListView; | 35 | class ContactListView; |
36 | 36 | ||
37 | 37 | ||
38 | namespace KABC { class AddressBook; } | 38 | namespace KABC { class AddressBook; } |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * This class is the table view for kaddressbook. This view is a KListView | 41 | * This class is the table view for kaddressbook. This view is a KListView |
42 | * with multiple columns for the selected fields. | 42 | * with multiple columns for the selected fields. |
43 | * | 43 | * |
44 | * @short Table View | 44 | * @short Table View |
45 | * @author Don Sanders <dsanders@kde.org> | 45 | * @author Don Sanders <dsanders@kde.org> |
46 | * @version 0.1 | 46 | * @version 0.1 |
47 | */ | 47 | */ |
48 | class KAddressBookTableView : public KAddressBookView | 48 | class KAddressBookTableView : public KAddressBookView |
49 | { | 49 | { |
50 | friend class ContactListView; | 50 | friend class ContactListView; |
51 | 51 | ||
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, | 55 | KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, |
56 | const char *name = 0 ); | 56 | const char *name = 0 ); |
57 | virtual ~KAddressBookTableView(); | 57 | virtual ~KAddressBookTableView(); |
58 | 58 | ||
59 | virtual void refresh(QString uid = QString::null); | 59 | virtual void refresh(QString uid = QString::null); |
60 | virtual QStringList selectedUids(); | 60 | virtual QStringList selectedUids(); |
61 | virtual void setSelected(QString uid = QString::null, bool selected = false); | 61 | virtual void setSelected(QString uid = QString::null, bool selected = false); |
62 | virtual void readConfig(KConfig *config); | 62 | virtual void readConfig(KConfig *config); |
63 | virtual void writeConfig(KConfig *config); | 63 | virtual void writeConfig(KConfig *config); |
64 | virtual QString type() const { return "Table"; } | 64 | virtual QString type() const { return "Table"; } |
65 | void doSearch( const QString& s ,KABC::Field *field ); | 65 | void doSearch( const QString& s ,KABC::Field *field ); |
66 | virtual void scrollUP(); | ||
67 | virtual void scrollDOWN(); | ||
66 | 68 | ||
67 | public slots: | 69 | public slots: |
68 | virtual void reconstructListView(); | 70 | virtual void reconstructListView(); |
69 | 71 | ||
70 | protected slots: | 72 | protected slots: |
71 | /** Called whenever the user selects an addressee in the list view. | 73 | /** Called whenever the user selects an addressee in the list view. |
72 | */ | 74 | */ |
73 | void addresseeSelected(); | 75 | void addresseeSelected(); |
74 | void addresseeDeleted(); | 76 | void addresseeDeleted(); |
75 | 77 | ||
76 | /** Called whenever the user executes an addressee. In terms of the | 78 | /** Called whenever the user executes an addressee. In terms of the |
77 | * list view, this is probably a double click | 79 | * list view, this is probably a double click |
78 | */ | 80 | */ |
79 | void addresseeExecuted(QListViewItem*); | 81 | void addresseeExecuted(QListViewItem*); |
80 | 82 | ||
81 | private: | 83 | private: |
82 | QVBoxLayout *mainLayout; | 84 | QVBoxLayout *mainLayout; |
83 | ContactListView *mListView; | 85 | ContactListView *mListView; |
84 | }; | 86 | }; |
85 | 87 | ||
86 | 88 | ||
87 | class TableViewFactory : public ViewFactory | 89 | class TableViewFactory : public ViewFactory |
88 | { | 90 | { |
89 | public: | 91 | public: |
90 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 92 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
91 | { | 93 | { |
92 | return new KAddressBookTableView( ab, parent, name ); | 94 | return new KAddressBookTableView( ab, parent, name ); |
93 | } | 95 | } |
94 | 96 | ||
95 | QString type() const { return "Table"; } | 97 | QString type() const { return "Table"; } |
96 | 98 | ||
97 | QString description() const { return i18n( "A listing of contacts in a table. Each cell of " | 99 | QString description() const { return i18n( "A listing of contacts in a table. Each cell of " |
diff --git a/microkde/klineedit.h b/microkde/klineedit.h index 65e2f59..70c72d1 100644 --- a/microkde/klineedit.h +++ b/microkde/klineedit.h | |||
@@ -1,24 +1,47 @@ | |||
1 | #ifndef MINIKDE_KLINEEDIT_H | 1 | #ifndef MINIKDE_KLINEEDIT_H |
2 | #define MINIKDE_KLINEEDIT_H | 2 | #define MINIKDE_KLINEEDIT_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | 5 | ||
6 | #ifndef DESKTOP_VERSION | 6 | #ifndef DESKTOP_VERSION |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | 10 | ||
11 | class KLineEdit : public QLineEdit | 11 | class KLineEdit : public QLineEdit |
12 | { | 12 | { |
13 | |||
14 | Q_OBJECT | ||
15 | |||
13 | public: | 16 | public: |
14 | KLineEdit( QWidget *parent=0, const char *name=0 ) : | 17 | KLineEdit( QWidget *parent=0, const char *name=0 ) : |
15 | QLineEdit( parent, name ) { | 18 | QLineEdit( parent, name ) |
19 | { | ||
16 | #ifndef DESKTOP_VERSION | 20 | #ifndef DESKTOP_VERSION |
17 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 21 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
18 | #endif | 22 | #endif |
19 | } | 23 | } |
20 | 24 | void keyPressEvent ( QKeyEvent * e) | |
25 | { | ||
26 | switch ( e->key() ) { | ||
27 | case Qt::Key_Down: | ||
28 | emit scrollDOWN(); | ||
29 | e->accept(); | ||
30 | break; | ||
31 | case Qt::Key_Up: | ||
32 | emit scrollUP(); | ||
33 | e->accept(); | ||
34 | break; | ||
35 | default: | ||
36 | QLineEdit::keyPressEvent ( e ); | ||
37 | break; | ||
38 | } | ||
39 | |||
40 | } | ||
21 | void setTrapReturnKey( bool ) {} | 41 | void setTrapReturnKey( bool ) {} |
42 | signals: | ||
43 | void scrollUP(); | ||
44 | void scrollDOWN(); | ||
22 | }; | 45 | }; |
23 | 46 | ||
24 | #endif | 47 | #endif |