-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 1 | ||||
-rw-r--r-- | kaddressbook/details/look_basic.h | 2 | ||||
-rw-r--r-- | kaddressbook/details/look_html.cpp | 10 | ||||
-rw-r--r-- | kaddressbook/details/look_html.h | 8 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 9 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 27 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 29 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 2 |
17 files changed, 107 insertions, 18 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index 229cce0..cee5886 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -17,128 +17,132 @@ | |||
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 <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | 29 | ||
30 | #include <kapplication.h> | 30 | #include <kapplication.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kdialog.h> | 32 | #include <kdialog.h> |
33 | 33 | ||
34 | #include "look_basic.h" | 34 | #include "look_basic.h" |
35 | //#include "look_details.h" | 35 | //#include "look_details.h" |
36 | #include "look_html.h" | 36 | #include "look_html.h" |
37 | 37 | ||
38 | #ifdef KAB_EMBEDDED | 38 | #ifdef KAB_EMBEDDED |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #endif //KAB_EMBEDDED | 40 | #endif //KAB_EMBEDDED |
41 | 41 | ||
42 | 42 | ||
43 | #include "detailsviewcontainer.h" | 43 | #include "detailsviewcontainer.h" |
44 | 44 | ||
45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) | 45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) |
46 | : QWidget( parent, name ), mCurrentLook( 0 ) | 46 | : QWidget( parent, name ), mCurrentLook( 0 ) |
47 | { | 47 | { |
48 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 48 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
49 | //topLayout->setMargin( KDialog::marginHint() ); | 49 | //topLayout->setMargin( KDialog::marginHint() ); |
50 | //topLayout->setSpacing( KDialog::spacingHint() ); | 50 | //topLayout->setSpacing( KDialog::spacingHint() ); |
51 | topLayout->setMargin( 0 ); | 51 | topLayout->setMargin( 0 ); |
52 | topLayout->setSpacing( 0 ); | 52 | topLayout->setSpacing( 0 ); |
53 | 53 | ||
54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); | 54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); |
55 | 55 | ||
56 | QLabel *label = new QLabel( i18n("Style:"), this ); | 56 | QLabel *label = new QLabel( i18n("Style:"), this ); |
57 | styleLayout->addWidget( label ); | 57 | styleLayout->addWidget( label ); |
58 | 58 | ||
59 | mStyleCombo = new QComboBox( this ); | 59 | mStyleCombo = new QComboBox( this ); |
60 | styleLayout->addWidget( mStyleCombo ); | 60 | styleLayout->addWidget( mStyleCombo ); |
61 | 61 | ||
62 | QFrame *frameRuler = new QFrame( this ); | 62 | QFrame *frameRuler = new QFrame( this ); |
63 | //US frameRuler->setFrameShape( QFrame::HLine ); | 63 | //US frameRuler->setFrameShape( QFrame::HLine ); |
64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); | 64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); |
65 | //US topLayout->addWidget( frameRuler ); | 65 | //US topLayout->addWidget( frameRuler ); |
66 | 66 | ||
67 | mDetailsStack = new QWidgetStack( this ); | 67 | mDetailsStack = new QWidgetStack( this ); |
68 | topLayout->addWidget( mDetailsStack, 1 ); | 68 | topLayout->addWidget( mDetailsStack, 1 ); |
69 | 69 | ||
70 | registerLooks(); | 70 | registerLooks(); |
71 | 71 | ||
72 | #if 1 | 72 | #if 1 |
73 | // Hide detailed view selection combo box, because we currently have | 73 | // Hide detailed view selection combo box, because we currently have |
74 | // only one. Reenable it when there are more detailed views. | 74 | // only one. Reenable it when there are more detailed views. |
75 | label->hide(); | 75 | label->hide(); |
76 | mStyleCombo->hide(); | 76 | mStyleCombo->hide(); |
77 | frameRuler->hide(); | 77 | frameRuler->hide(); |
78 | #endif | 78 | #endif |
79 | } | 79 | } |
80 | 80 | ||
81 | void ViewContainer::printView() | ||
82 | { | ||
83 | mCurrentLook->printView(); | ||
84 | } | ||
81 | KABBasicLook *ViewContainer::currentLook() | 85 | KABBasicLook *ViewContainer::currentLook() |
82 | { | 86 | { |
83 | return mCurrentLook; | 87 | return mCurrentLook; |
84 | } | 88 | } |
85 | 89 | ||
86 | void ViewContainer::registerLooks() | 90 | void ViewContainer::registerLooks() |
87 | { | 91 | { |
88 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); | 92 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); |
89 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); | 93 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); |
90 | mStyleCombo->clear(); | 94 | mStyleCombo->clear(); |
91 | 95 | ||
92 | for ( uint i = 0; i < mLookFactories.count(); ++i ) | 96 | for ( uint i = 0; i < mLookFactories.count(); ++i ) |
93 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); | 97 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); |
94 | 98 | ||
95 | if ( !mLookFactories.isEmpty() ) | 99 | if ( !mLookFactories.isEmpty() ) |
96 | slotStyleSelected( 0 ); | 100 | slotStyleSelected( 0 ); |
97 | } | 101 | } |
98 | 102 | ||
99 | void ViewContainer::slotStyleSelected( int index ) | 103 | void ViewContainer::slotStyleSelected( int index ) |
100 | { | 104 | { |
101 | #ifndef KAB_EMBEDDED | 105 | #ifndef KAB_EMBEDDED |
102 | KConfig *config = kapp->config(); | 106 | KConfig *config = kapp->config(); |
103 | #else //KAB_EMBEDDED | 107 | #else //KAB_EMBEDDED |
104 | //US I hope I got the same config object as above expected. | 108 | //US I hope I got the same config object as above expected. |
105 | KConfig *config = KABPrefs::instance()->getConfig(); | 109 | KConfig *config = KABPrefs::instance()->getConfig(); |
106 | #endif //KAB_EMBEDDED | 110 | #endif //KAB_EMBEDDED |
107 | KABC::Addressee addr; | 111 | KABC::Addressee addr; |
108 | 112 | ||
109 | if ( index >= 0 && index < mStyleCombo->count() ) { | 113 | if ( index >= 0 && index < mStyleCombo->count() ) { |
110 | if ( mCurrentLook != 0 ) { | 114 | if ( mCurrentLook != 0 ) { |
111 | mCurrentLook->saveSettings( config ); | 115 | mCurrentLook->saveSettings( config ); |
112 | addr = mCurrentLook->addressee(); | 116 | addr = mCurrentLook->addressee(); |
113 | 117 | ||
114 | delete mCurrentLook; | 118 | delete mCurrentLook; |
115 | mCurrentLook = 0; | 119 | mCurrentLook = 0; |
116 | } | 120 | } |
117 | 121 | ||
118 | KABLookFactory *factory = mLookFactories.at( index ); | 122 | KABLookFactory *factory = mLookFactories.at( index ); |
119 | 123 | ||
120 | mCurrentLook = factory->create(); | 124 | mCurrentLook = factory->create(); |
121 | mDetailsStack->raiseWidget( mCurrentLook ); | 125 | mDetailsStack->raiseWidget( mCurrentLook ); |
122 | 126 | ||
123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, | 127 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, |
124 | SIGNAL( sendEmail( const QString& ) ) ); | 128 | SIGNAL( sendEmail( const QString& ) ) ); |
125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, | 129 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, |
126 | SIGNAL( browse( const QString& ) ) ); | 130 | SIGNAL( browse( const QString& ) ) ); |
127 | } | 131 | } |
128 | 132 | ||
129 | mCurrentLook->restoreSettings( config ); | 133 | mCurrentLook->restoreSettings( config ); |
130 | mCurrentLook->setAddressee( addr ); | 134 | mCurrentLook->setAddressee( addr ); |
131 | } | 135 | } |
132 | 136 | ||
133 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 137 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
134 | { | 138 | { |
135 | if ( mCurrentLook != 0 ) { | 139 | if ( mCurrentLook != 0 ) { |
136 | mCurrentAddressee = addressee; | 140 | mCurrentAddressee = addressee; |
137 | mCurrentLook->setAddressee( mCurrentAddressee ); | 141 | mCurrentLook->setAddressee( mCurrentAddressee ); |
138 | 142 | ||
139 | } | 143 | } |
140 | } | 144 | } |
141 | 145 | ||
142 | KABC::Addressee ViewContainer::addressee() | 146 | KABC::Addressee ViewContainer::addressee() |
143 | { | 147 | { |
144 | static KABC::Addressee empty; // do not use! | 148 | static KABC::Addressee empty; // do not use! |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index 667f0cb..9684736 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -1,102 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | 3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> |
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 | #ifndef DETAILSVIEWCONTAINER_H | 24 | #ifndef DETAILSVIEWCONTAINER_H |
25 | #define DETAILSVIEWCONTAINER_H | 25 | #define DETAILSVIEWCONTAINER_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #include "look_basic.h" | 29 | #include "look_basic.h" |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class QWidgetStack; | 32 | class QWidgetStack; |
33 | 33 | ||
34 | class ViewContainer : public QWidget | 34 | class ViewContainer : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); | 39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | Return the look currently selected. If there is none, it | 42 | Return the look currently selected. If there is none, it |
43 | returns zero. Do not use this pointer to store a reference | 43 | returns zero. Do not use this pointer to store a reference |
44 | to a look, the user might select another one (e.g., create | 44 | to a look, the user might select another one (e.g., create |
45 | a new object) at any time. | 45 | a new object) at any time. |
46 | */ | 46 | */ |
47 | KABBasicLook *currentLook(); | 47 | KABBasicLook *currentLook(); |
48 | /** | 48 | /** |
49 | Return the contact currently displayed. | 49 | Return the contact currently displayed. |
50 | */ | 50 | */ |
51 | KABC::Addressee addressee(); | 51 | KABC::Addressee addressee(); |
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | void printView(); | ||
54 | /** | 55 | /** |
55 | Set the contact currently displayed. | 56 | Set the contact currently displayed. |
56 | */ | 57 | */ |
57 | void setAddressee( const KABC::Addressee& addressee ); | 58 | void setAddressee( const KABC::Addressee& addressee ); |
58 | 59 | ||
59 | /** | 60 | /** |
60 | Set read-write state. | 61 | Set read-write state. |
61 | */ | 62 | */ |
62 | void setReadOnly( bool state ); | 63 | void setReadOnly( bool state ); |
63 | 64 | ||
64 | signals: | 65 | signals: |
65 | /** | 66 | /** |
66 | The contact has been changed. | 67 | The contact has been changed. |
67 | */ | 68 | */ |
68 | void addresseeChanged(); | 69 | void addresseeChanged(); |
69 | 70 | ||
70 | /** | 71 | /** |
71 | The user acticated the email address displayed. This may happen | 72 | The user acticated the email address displayed. This may happen |
72 | by, for example, clicking on the displayed mailto-URL. | 73 | by, for example, clicking on the displayed mailto-URL. |
73 | */ | 74 | */ |
74 | void sendEmail( const QString& ); | 75 | void sendEmail( const QString& ); |
75 | 76 | ||
76 | /** | 77 | /** |
77 | The user activated one of the displayed HTTP URLs. For example | 78 | The user activated one of the displayed HTTP URLs. For example |
78 | by clicking on the displayed homepage address. | 79 | by clicking on the displayed homepage address. |
79 | */ | 80 | */ |
80 | void browse( const QString& ); | 81 | void browse( const QString& ); |
81 | 82 | ||
82 | protected: | 83 | protected: |
83 | /** | 84 | /** |
84 | A style has been selected. Overloaded from base class. | 85 | A style has been selected. Overloaded from base class. |
85 | */ | 86 | */ |
86 | void slotStyleSelected( int ); | 87 | void slotStyleSelected( int ); |
87 | 88 | ||
88 | /** | 89 | /** |
89 | Register the available looks. | 90 | Register the available looks. |
90 | */ | 91 | */ |
91 | void registerLooks(); | 92 | void registerLooks(); |
92 | 93 | ||
93 | private: | 94 | private: |
94 | KABC::Addressee mCurrentAddressee; | 95 | KABC::Addressee mCurrentAddressee; |
95 | KABBasicLook *mCurrentLook; | 96 | KABBasicLook *mCurrentLook; |
96 | QPtrList<KABLookFactory> mLookFactories; | 97 | QPtrList<KABLookFactory> mLookFactories; |
97 | 98 | ||
98 | QComboBox *mStyleCombo; | 99 | QComboBox *mStyleCombo; |
99 | QWidgetStack *mDetailsStack; | 100 | QWidgetStack *mDetailsStack; |
100 | }; | 101 | }; |
101 | 102 | ||
102 | #endif | 103 | #endif |
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h index 7e8baff..a65c99c 100644 --- a/kaddressbook/details/look_basic.h +++ b/kaddressbook/details/look_basic.h | |||
@@ -14,121 +14,123 @@ | |||
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 LOOK_KABBASIC_H | 24 | #ifndef LOOK_KABBASIC_H |
25 | #define LOOK_KABBASIC_H | 25 | #define LOOK_KABBASIC_H |
26 | 26 | ||
27 | #include <kabc/addressbook.h> | 27 | #include <kabc/addressbook.h> |
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | This is a pure virtual base class that defines the | 33 | This is a pure virtual base class that defines the |
34 | interface for how to display and change entries of | 34 | interface for how to display and change entries of |
35 | the KDE addressbook. | 35 | the KDE addressbook. |
36 | 36 | ||
37 | This basic widget does not show anything in its client space. | 37 | This basic widget does not show anything in its client space. |
38 | Derive it and implement its look and how the user may edit the | 38 | Derive it and implement its look and how the user may edit the |
39 | entry. | 39 | entry. |
40 | 40 | ||
41 | The paintEvent() has to paint the whole widget, since repaint() | 41 | The paintEvent() has to paint the whole widget, since repaint() |
42 | calls will not delete the widgets background. | 42 | calls will not delete the widgets background. |
43 | */ | 43 | */ |
44 | class KABBasicLook : public QVBox | 44 | class KABBasicLook : public QVBox |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | /** | 49 | /** |
50 | The constructor. | 50 | The constructor. |
51 | */ | 51 | */ |
52 | KABBasicLook( QWidget *parent = 0, const char *name = 0 ); | 52 | KABBasicLook( QWidget *parent = 0, const char *name = 0 ); |
53 | 53 | ||
54 | /** | 54 | /** |
55 | Set the entry. It will be displayed automatically. | 55 | Set the entry. It will be displayed automatically. |
56 | */ | 56 | */ |
57 | virtual void setAddressee( const KABC::Addressee& addressee ); | 57 | virtual void setAddressee( const KABC::Addressee& addressee ); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | Get the current entry. | 60 | Get the current entry. |
61 | */ | 61 | */ |
62 | virtual KABC::Addressee addressee(); | 62 | virtual KABC::Addressee addressee(); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | Configure the view from the configuration file. | 65 | Configure the view from the configuration file. |
66 | */ | 66 | */ |
67 | virtual void restoreSettings( KConfig* ); | 67 | virtual void restoreSettings( KConfig* ); |
68 | 68 | ||
69 | /** | 69 | /** |
70 | Save the view settings to the configuration file. | 70 | Save the view settings to the configuration file. |
71 | */ | 71 | */ |
72 | virtual void saveSettings( KConfig* ); | 72 | virtual void saveSettings( KConfig* ); |
73 | 73 | ||
74 | /** | 74 | /** |
75 | Retrieve read-write state. | 75 | Retrieve read-write state. |
76 | */ | 76 | */ |
77 | bool isReadOnly() const; | 77 | bool isReadOnly() const; |
78 | void printView(){ emit printMyView();} | ||
78 | 79 | ||
79 | signals: | 80 | signals: |
81 | void printMyView(); | ||
80 | /** | 82 | /** |
81 | This signal is emitted when the user changed the entry. | 83 | This signal is emitted when the user changed the entry. |
82 | */ | 84 | */ |
83 | void entryChanged(); | 85 | void entryChanged(); |
84 | 86 | ||
85 | /** | 87 | /** |
86 | This signal indicates that the entry needs to be changed | 88 | This signal indicates that the entry needs to be changed |
87 | immidiately in the database. This might be due to changes in | 89 | immidiately in the database. This might be due to changes in |
88 | values that are available in menus. | 90 | values that are available in menus. |
89 | */ | 91 | */ |
90 | void saveMe(); | 92 | void saveMe(); |
91 | 93 | ||
92 | /** | 94 | /** |
93 | The user acticated the email address displayed. This may happen | 95 | The user acticated the email address displayed. This may happen |
94 | by, for example, clicking on the displayed mailto-URL. | 96 | by, for example, clicking on the displayed mailto-URL. |
95 | */ | 97 | */ |
96 | void sendEmail( const QString &email ); | 98 | void sendEmail( const QString &email ); |
97 | 99 | ||
98 | /** | 100 | /** |
99 | The user activated one of the displayed HTTP URLs. For example | 101 | The user activated one of the displayed HTTP URLs. For example |
100 | by clicking on the displayed homepage address. | 102 | by clicking on the displayed homepage address. |
101 | */ | 103 | */ |
102 | void browse( const QString &url ); | 104 | void browse( const QString &url ); |
103 | 105 | ||
104 | public slots: | 106 | public slots: |
105 | /** | 107 | /** |
106 | Set read-write state. | 108 | Set read-write state. |
107 | */ | 109 | */ |
108 | virtual void setReadOnly( bool state ); | 110 | virtual void setReadOnly( bool state ); |
109 | 111 | ||
110 | private: | 112 | private: |
111 | KABC::Addressee mAddressee; | 113 | KABC::Addressee mAddressee; |
112 | bool mReadOnly; | 114 | bool mReadOnly; |
113 | }; | 115 | }; |
114 | 116 | ||
115 | class KABLookFactory | 117 | class KABLookFactory |
116 | { | 118 | { |
117 | public: | 119 | public: |
118 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); | 120 | KABLookFactory( QWidget *parent = 0, const char *name = 0 ); |
119 | virtual ~KABLookFactory(); | 121 | virtual ~KABLookFactory(); |
120 | 122 | ||
121 | virtual KABBasicLook *create() = 0; | 123 | virtual KABBasicLook *create() = 0; |
122 | 124 | ||
123 | /** | 125 | /** |
124 | Overload this method to provide a one-liner description | 126 | Overload this method to provide a one-liner description |
125 | for your look. | 127 | for your look. |
126 | */ | 128 | */ |
127 | virtual QString description() = 0; | 129 | virtual QString description() = 0; |
128 | 130 | ||
129 | protected: | 131 | protected: |
130 | QWidget *mParent; | 132 | QWidget *mParent; |
131 | const char* mName; | 133 | const char* mName; |
132 | }; | 134 | }; |
133 | 135 | ||
134 | #endif | 136 | #endif |
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp index 64987b8..bb30650 100644 --- a/kaddressbook/details/look_html.cpp +++ b/kaddressbook/details/look_html.cpp | |||
@@ -1,48 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
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 <addresseeview.h> | 24 | #include <addresseeview.h> |
25 | 25 | ||
26 | #include "look_html.h" | 26 | #include "look_html.h" |
27 | #include <qscrollview.h> | 27 | #include <qscrollview.h> |
28 | #include "kabprefs.h" | 28 | #include "kabprefs.h" |
29 | #include <kabc/addresseeview.h> | ||
29 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | 30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) |
30 | : KABBasicLook( parent, name ) | 31 | : KABBasicLook( parent, name ) |
31 | { | 32 | { |
32 | mView = new KPIM::AddresseeView( this ); | 33 | mView = new KABC::AddresseeView( this ); |
33 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
35 | connect(this, SIGNAL(printMyView()), | ||
36 | this , SLOT(printMe())); | ||
34 | } | 37 | } |
35 | 38 | ||
36 | KABHtmlView::~KABHtmlView() | 39 | KABHtmlView::~KABHtmlView() |
37 | { | 40 | { |
38 | } | 41 | } |
42 | void KABHtmlView::printMe() | ||
43 | { | ||
44 | mView->printMe(); | ||
45 | |||
46 | } | ||
39 | 47 | ||
40 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) | 48 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) |
41 | { | 49 | { |
42 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 50 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
43 | mView->setAddressee( addr ); | 51 | mView->setAddressee( addr ); |
44 | } | 52 | } |
45 | 53 | ||
46 | #ifndef KAB_EMBEDDED | 54 | #ifndef KAB_EMBEDDED |
47 | #include "look_html.moc" | 55 | #include "look_html.moc" |
48 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/look_html.h b/kaddressbook/details/look_html.h index 68a02d9..57eb56f 100644 --- a/kaddressbook/details/look_html.h +++ b/kaddressbook/details/look_html.h | |||
@@ -1,75 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
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 | #ifndef LOOK_HTML_H | 24 | #ifndef LOOK_HTML_H |
25 | #define LOOK_HTML_H | 25 | #define LOOK_HTML_H |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | #include "look_basic.h" | 29 | #include "look_basic.h" |
30 | 30 | ||
31 | namespace KABC { class Addressee; } | 31 | namespace KABC { class Addressee; } |
32 | namespace KPIM { class AddresseeView; } | 32 | namespace KABC { class AddresseeView; } |
33 | 33 | ||
34 | class KABHtmlView : public KABBasicLook | 34 | class KABHtmlView : public KABBasicLook |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | /** | 39 | /** |
40 | The constructor. | 40 | The constructor. |
41 | */ | 41 | */ |
42 | KABHtmlView( QWidget *parent = 0, const char* name = 0 ); | 42 | KABHtmlView( QWidget *parent = 0, const char* name = 0 ); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | The virtual destructor. | 45 | The virtual destructor. |
46 | */ | 46 | */ |
47 | virtual ~KABHtmlView(); | 47 | virtual ~KABHtmlView(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | Set the addressee. | 50 | Set the addressee. |
51 | */ | 51 | */ |
52 | void setAddressee( const KABC::Addressee& ); | 52 | void setAddressee( const KABC::Addressee& ); |
53 | public slots: | ||
54 | void printMe(); | ||
53 | 55 | ||
54 | private: | 56 | private: |
55 | KPIM::AddresseeView *mView; | 57 | KABC::AddresseeView *mView; |
56 | }; | 58 | }; |
57 | 59 | ||
58 | class KABHtmlViewFactory : public KABLookFactory | 60 | class KABHtmlViewFactory : public KABLookFactory |
59 | { | 61 | { |
60 | public: | 62 | public: |
61 | KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 ) | 63 | KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 ) |
62 | : KABLookFactory( parent, name ) {} | 64 | : KABLookFactory( parent, name ) {} |
63 | 65 | ||
64 | KABBasicLook *create() | 66 | KABBasicLook *create() |
65 | { | 67 | { |
66 | return new KABHtmlView( mParent, mName ); | 68 | return new KABHtmlView( mParent, mName ); |
67 | } | 69 | } |
68 | 70 | ||
69 | QString description() | 71 | QString description() |
70 | { | 72 | { |
71 | return i18n( "HTML table style." ); | 73 | return i18n( "HTML table style." ); |
72 | } | 74 | } |
73 | }; | 75 | }; |
74 | 76 | ||
75 | #endif | 77 | #endif |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4098dda..e61f65f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1816,140 +1816,137 @@ void KABCore::initGUI() | |||
1816 | // mDetailsSplitter = new QSplitter( this ); | 1816 | // mDetailsSplitter = new QSplitter( this ); |
1817 | 1817 | ||
1818 | QVBox *viewSpace = new QVBox( this ); | 1818 | QVBox *viewSpace = new QVBox( this ); |
1819 | 1819 | ||
1820 | mViewManager = new ViewManager( this, viewSpace ); | 1820 | mViewManager = new ViewManager( this, viewSpace ); |
1821 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1821 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1822 | 1822 | ||
1823 | mDetails = new ViewContainer( this ); | 1823 | mDetails = new ViewContainer( this ); |
1824 | 1824 | ||
1825 | topLayout->addWidget( viewSpace ); | 1825 | topLayout->addWidget( viewSpace ); |
1826 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1826 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1827 | topLayout->addWidget( mDetails ); | 1827 | topLayout->addWidget( mDetails ); |
1828 | #endif //KAB_NOSPLITTER | 1828 | #endif //KAB_NOSPLITTER |
1829 | */ | 1829 | */ |
1830 | 1830 | ||
1831 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1831 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1832 | syncManager->setBlockSave(false); | 1832 | syncManager->setBlockSave(false); |
1833 | 1833 | ||
1834 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1834 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1835 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1835 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1836 | QString sync_file = sentSyncFile(); | 1836 | QString sync_file = sentSyncFile(); |
1837 | qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1837 | qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1838 | syncManager->setDefaultFileName( sync_file ); | 1838 | syncManager->setDefaultFileName( sync_file ); |
1839 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1839 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1840 | 1840 | ||
1841 | #endif //KAB_EMBEDDED | 1841 | #endif //KAB_EMBEDDED |
1842 | initActions(); | 1842 | initActions(); |
1843 | 1843 | ||
1844 | #ifdef KAB_EMBEDDED | 1844 | #ifdef KAB_EMBEDDED |
1845 | addActionsManually(); | 1845 | addActionsManually(); |
1846 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1846 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1847 | mXXPortManager = new XXPortManager( this, this ); | 1847 | mXXPortManager = new XXPortManager( this, this ); |
1848 | 1848 | ||
1849 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1849 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1850 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1850 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1851 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1851 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1852 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1852 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1853 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1853 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1854 | // mIncSearchWidget->hide(); | 1854 | // mIncSearchWidget->hide(); |
1855 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1855 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1856 | SLOT( incrementalSearch( const QString& ) ) ); | 1856 | SLOT( incrementalSearch( const QString& ) ) ); |
1857 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1857 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1858 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1858 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1859 | 1859 | ||
1860 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1860 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1861 | 1861 | ||
1862 | topLayout->addWidget( mJumpButtonBar ); | 1862 | topLayout->addWidget( mJumpButtonBar ); |
1863 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1863 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1864 | 1864 | ||
1865 | // mMainWindow->getIconToolBar()->raise(); | 1865 | // mMainWindow->getIconToolBar()->raise(); |
1866 | 1866 | ||
1867 | #endif //KAB_EMBEDDED | 1867 | #endif //KAB_EMBEDDED |
1868 | 1868 | ||
1869 | } | 1869 | } |
1870 | void KABCore::initActions() | 1870 | void KABCore::initActions() |
1871 | { | 1871 | { |
1872 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1872 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1873 | 1873 | ||
1874 | #ifndef KAB_EMBEDDED | 1874 | #ifndef KAB_EMBEDDED |
1875 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1875 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1876 | SLOT( clipboardDataChanged() ) ); | 1876 | SLOT( clipboardDataChanged() ) ); |
1877 | #endif //KAB_EMBEDDED | 1877 | #endif //KAB_EMBEDDED |
1878 | 1878 | ||
1879 | // file menu | 1879 | // file menu |
1880 | if ( mIsPart ) { | 1880 | |
1881 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | ||
1882 | SLOT( sendMail() ), actionCollection(), | ||
1883 | "kaddressbook_mail" ); | ||
1884 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | ||
1885 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | ||
1886 | |||
1887 | } else { | ||
1888 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1881 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1889 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1882 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1890 | } | 1883 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1884 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | ||
1885 | |||
1891 | 1886 | ||
1887 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | ||
1888 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | ||
1892 | 1889 | ||
1893 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1890 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1894 | SLOT( save() ), actionCollection(), "file_sync" ); | 1891 | SLOT( save() ), actionCollection(), "file_sync" ); |
1895 | 1892 | ||
1896 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1893 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1897 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1894 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1898 | 1895 | ||
1899 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1896 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1900 | this, SLOT( mailVCard() ), | 1897 | this, SLOT( mailVCard() ), |
1901 | actionCollection(), "file_mail_vcard"); | 1898 | actionCollection(), "file_mail_vcard"); |
1902 | 1899 | ||
1903 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1900 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1904 | SLOT( export2phone() ), actionCollection(), | 1901 | SLOT( export2phone() ), actionCollection(), |
1905 | "kaddressbook_ex2phone" ); | 1902 | "kaddressbook_ex2phone" ); |
1906 | 1903 | ||
1907 | mActionBeamVCard = 0; | 1904 | mActionBeamVCard = 0; |
1908 | mActionBeam = 0; | 1905 | mActionBeam = 0; |
1909 | 1906 | ||
1910 | #ifndef DESKTOP_VERSION | 1907 | #ifndef DESKTOP_VERSION |
1911 | if ( Ir::supported() ) { | 1908 | if ( Ir::supported() ) { |
1912 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1909 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1913 | SLOT( beamVCard() ), actionCollection(), | 1910 | SLOT( beamVCard() ), actionCollection(), |
1914 | "kaddressbook_beam_vcard" ); | 1911 | "kaddressbook_beam_vcard" ); |
1915 | 1912 | ||
1916 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1913 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1917 | SLOT( beamMySelf() ), actionCollection(), | 1914 | SLOT( beamMySelf() ), actionCollection(), |
1918 | "kaddressbook_beam_myself" ); | 1915 | "kaddressbook_beam_myself" ); |
1919 | } | 1916 | } |
1920 | #endif | 1917 | #endif |
1921 | 1918 | ||
1922 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1919 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1923 | this, SLOT( editContact2() ), | 1920 | this, SLOT( editContact2() ), |
1924 | actionCollection(), "file_properties" ); | 1921 | actionCollection(), "file_properties" ); |
1925 | 1922 | ||
1926 | #ifdef KAB_EMBEDDED | 1923 | #ifdef KAB_EMBEDDED |
1927 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1924 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1928 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1925 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1929 | mMainWindow, SLOT( exit() ), | 1926 | mMainWindow, SLOT( exit() ), |
1930 | actionCollection(), "quit" ); | 1927 | actionCollection(), "quit" ); |
1931 | #endif //KAB_EMBEDDED | 1928 | #endif //KAB_EMBEDDED |
1932 | 1929 | ||
1933 | // edit menu | 1930 | // edit menu |
1934 | if ( mIsPart ) { | 1931 | if ( mIsPart ) { |
1935 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1932 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1936 | SLOT( copyContacts() ), actionCollection(), | 1933 | SLOT( copyContacts() ), actionCollection(), |
1937 | "kaddressbook_copy" ); | 1934 | "kaddressbook_copy" ); |
1938 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1935 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1939 | SLOT( cutContacts() ), actionCollection(), | 1936 | SLOT( cutContacts() ), actionCollection(), |
1940 | "kaddressbook_cut" ); | 1937 | "kaddressbook_cut" ); |
1941 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1938 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1942 | SLOT( pasteContacts() ), actionCollection(), | 1939 | SLOT( pasteContacts() ), actionCollection(), |
1943 | "kaddressbook_paste" ); | 1940 | "kaddressbook_paste" ); |
1944 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1941 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1945 | SLOT( selectAllContacts() ), actionCollection(), | 1942 | SLOT( selectAllContacts() ), actionCollection(), |
1946 | "kaddressbook_select_all" ); | 1943 | "kaddressbook_select_all" ); |
1947 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1944 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1948 | SLOT( undo() ), actionCollection(), | 1945 | SLOT( undo() ), actionCollection(), |
1949 | "kaddressbook_undo" ); | 1946 | "kaddressbook_undo" ); |
1950 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1947 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1951 | this, SLOT( redo() ), actionCollection(), | 1948 | this, SLOT( redo() ), actionCollection(), |
1952 | "kaddressbook_redo" ); | 1949 | "kaddressbook_redo" ); |
1953 | } else { | 1950 | } else { |
1954 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1951 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1955 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1952 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
@@ -2078,128 +2075,130 @@ void KABCore::initActions() | |||
2078 | clipboardDataChanged(); | 2075 | clipboardDataChanged(); |
2079 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2076 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2080 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2077 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2081 | } | 2078 | } |
2082 | 2079 | ||
2083 | //US we need this function, to plug all actions into the correct menues. | 2080 | //US we need this function, to plug all actions into the correct menues. |
2084 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2081 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2085 | void KABCore::addActionsManually() | 2082 | void KABCore::addActionsManually() |
2086 | { | 2083 | { |
2087 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2084 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2088 | 2085 | ||
2089 | #ifdef KAB_EMBEDDED | 2086 | #ifdef KAB_EMBEDDED |
2090 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2087 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2091 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2088 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2092 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2089 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2093 | 2090 | ||
2094 | KToolBar* tb = mMainWindow->toolBar(); | 2091 | KToolBar* tb = mMainWindow->toolBar(); |
2095 | 2092 | ||
2096 | #ifndef DESKTOP_VERSION | 2093 | #ifndef DESKTOP_VERSION |
2097 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2094 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2098 | #endif | 2095 | #endif |
2099 | QMenuBar* mb = mMainWindow->menuBar(); | 2096 | QMenuBar* mb = mMainWindow->menuBar(); |
2100 | 2097 | ||
2101 | //US setup menubar. | 2098 | //US setup menubar. |
2102 | //Disable the following block if you do not want to have a menubar. | 2099 | //Disable the following block if you do not want to have a menubar. |
2103 | mb->insertItem( i18n("&File"), fileMenu ); | 2100 | mb->insertItem( i18n("&File"), fileMenu ); |
2104 | mb->insertItem( i18n("&Edit"), editMenu ); | 2101 | mb->insertItem( i18n("&Edit"), editMenu ); |
2105 | mb->insertItem( i18n("&View"), viewMenu ); | 2102 | mb->insertItem( i18n("&View"), viewMenu ); |
2106 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2103 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2107 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2104 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2108 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2105 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2109 | mb->insertItem( i18n("&Help"), helpMenu ); | 2106 | mb->insertItem( i18n("&Help"), helpMenu ); |
2110 | mIncSearchWidget = new IncSearchWidget( tb ); | 2107 | mIncSearchWidget = new IncSearchWidget( tb ); |
2111 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2108 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2112 | #ifndef DESKTOP_VERSION | 2109 | #ifndef DESKTOP_VERSION |
2113 | } else { | 2110 | } else { |
2114 | //US setup toolbar | 2111 | //US setup toolbar |
2115 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2112 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2116 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2113 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2117 | menuBarTB->insertItem( "ME", popupBarTB); | 2114 | menuBarTB->insertItem( "ME", popupBarTB); |
2118 | tb->insertWidget(-1, 0, menuBarTB); | 2115 | tb->insertWidget(-1, 0, menuBarTB); |
2119 | mIncSearchWidget = new IncSearchWidget( tb ); | 2116 | mIncSearchWidget = new IncSearchWidget( tb ); |
2120 | 2117 | ||
2121 | tb->enableMoving(false); | 2118 | tb->enableMoving(false); |
2122 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2119 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2123 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2120 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2124 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2121 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2125 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2122 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2126 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2123 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2127 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2124 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2128 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2125 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2129 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2126 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2130 | if (QApplication::desktop()->width() > 320 ) { | 2127 | if (QApplication::desktop()->width() > 320 ) { |
2131 | // mViewManager->getFilterAction()->plug ( tb); | 2128 | // mViewManager->getFilterAction()->plug ( tb); |
2132 | } | 2129 | } |
2133 | } | 2130 | } |
2134 | #endif | 2131 | #endif |
2135 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2132 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2136 | 2133 | ||
2137 | 2134 | ||
2138 | 2135 | ||
2139 | //US Now connect the actions with the menue entries. | 2136 | //US Now connect the actions with the menue entries. |
2140 | #ifdef DESKTOP_VERSION | 2137 | #ifdef DESKTOP_VERSION |
2141 | mActionPrint->plug( fileMenu ); | 2138 | mActionPrint->plug( fileMenu ); |
2139 | mActionPrintDetails->plug( fileMenu ); | ||
2140 | fileMenu->insertSeparator(); | ||
2142 | #endif | 2141 | #endif |
2143 | mActionMail->plug( fileMenu ); | 2142 | mActionMail->plug( fileMenu ); |
2144 | fileMenu->insertSeparator(); | 2143 | fileMenu->insertSeparator(); |
2145 | 2144 | ||
2146 | mActionNewContact->plug( fileMenu ); | 2145 | mActionNewContact->plug( fileMenu ); |
2147 | mActionNewContact->plug( tb ); | 2146 | mActionNewContact->plug( tb ); |
2148 | 2147 | ||
2149 | mActionEditAddressee->plug( fileMenu ); | 2148 | mActionEditAddressee->plug( fileMenu ); |
2150 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2149 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2151 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2150 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2152 | mActionEditAddressee->plug( tb ); | 2151 | mActionEditAddressee->plug( tb ); |
2153 | 2152 | ||
2154 | fileMenu->insertSeparator(); | 2153 | fileMenu->insertSeparator(); |
2155 | mActionSave->plug( fileMenu ); | 2154 | mActionSave->plug( fileMenu ); |
2156 | fileMenu->insertItem( "&Import", ImportMenu ); | 2155 | fileMenu->insertItem( "&Import", ImportMenu ); |
2157 | fileMenu->insertItem( "&Export", ExportMenu ); | 2156 | fileMenu->insertItem( "&Export", ExportMenu ); |
2158 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2157 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2159 | #ifndef DESKTOP_VERSION | 2158 | #ifndef DESKTOP_VERSION |
2160 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2159 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2161 | #endif | 2160 | #endif |
2162 | #if 0 | 2161 | #if 0 |
2163 | // PENDING fix MailVCard | 2162 | // PENDING fix MailVCard |
2164 | fileMenu->insertSeparator(); | 2163 | fileMenu->insertSeparator(); |
2165 | mActionMailVCard->plug( fileMenu ); | 2164 | mActionMailVCard->plug( fileMenu ); |
2166 | #endif | 2165 | #endif |
2167 | #ifndef DESKTOP_VERSION | 2166 | #ifndef DESKTOP_VERSION |
2168 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2167 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2169 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2168 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2170 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2169 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2171 | #endif | 2170 | #endif |
2172 | fileMenu->insertSeparator(); | 2171 | fileMenu->insertSeparator(); |
2173 | mActionQuit->plug( fileMenu ); | 2172 | mActionQuit->plug( fileMenu ); |
2174 | #ifdef _WIN32_ | 2173 | #ifdef _WIN32_ |
2175 | mActionImportOL->plug( ImportMenu ); | 2174 | mActionImportOL->plug( ImportMenu ); |
2176 | #endif | 2175 | #endif |
2177 | // edit menu | 2176 | // edit menu |
2178 | mActionUndo->plug( editMenu ); | 2177 | mActionUndo->plug( editMenu ); |
2179 | mActionRedo->plug( editMenu ); | 2178 | mActionRedo->plug( editMenu ); |
2180 | editMenu->insertSeparator(); | 2179 | editMenu->insertSeparator(); |
2181 | mActionCut->plug( editMenu ); | 2180 | mActionCut->plug( editMenu ); |
2182 | mActionCopy->plug( editMenu ); | 2181 | mActionCopy->plug( editMenu ); |
2183 | mActionPaste->plug( editMenu ); | 2182 | mActionPaste->plug( editMenu ); |
2184 | mActionDelete->plug( editMenu ); | 2183 | mActionDelete->plug( editMenu ); |
2185 | editMenu->insertSeparator(); | 2184 | editMenu->insertSeparator(); |
2186 | mActionSelectAll->plug( editMenu ); | 2185 | mActionSelectAll->plug( editMenu ); |
2187 | 2186 | ||
2188 | mActionSetFormattedName->plug( changeMenu ); | 2187 | mActionSetFormattedName->plug( changeMenu ); |
2189 | mActionRemoveVoice->plug( changeMenu ); | 2188 | mActionRemoveVoice->plug( changeMenu ); |
2190 | // settings menu | 2189 | // settings menu |
2191 | //US special menuentry to configure the addressbook resources. On KDE | 2190 | //US special menuentry to configure the addressbook resources. On KDE |
2192 | // you do that through the control center !!! | 2191 | // you do that through the control center !!! |
2193 | mActionConfigResources->plug( settingsMenu ); | 2192 | mActionConfigResources->plug( settingsMenu ); |
2194 | settingsMenu->insertSeparator(); | 2193 | settingsMenu->insertSeparator(); |
2195 | 2194 | ||
2196 | mActionConfigKAddressbook->plug( settingsMenu ); | 2195 | mActionConfigKAddressbook->plug( settingsMenu ); |
2197 | 2196 | ||
2198 | if ( mIsPart ) { | 2197 | if ( mIsPart ) { |
2199 | //US not implemented yet | 2198 | //US not implemented yet |
2200 | //mActionConfigShortcuts->plug( settingsMenu ); | 2199 | //mActionConfigShortcuts->plug( settingsMenu ); |
2201 | //mActionConfigureToolbars->plug( settingsMenu ); | 2200 | //mActionConfigureToolbars->plug( settingsMenu ); |
2202 | 2201 | ||
2203 | } else { | 2202 | } else { |
2204 | //US not implemented yet | 2203 | //US not implemented yet |
2205 | //mActionKeyBindings->plug( settingsMenu ); | 2204 | //mActionKeyBindings->plug( settingsMenu ); |
@@ -2707,129 +2706,129 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2707 | 2706 | ||
2708 | } | 2707 | } |
2709 | } | 2708 | } |
2710 | full = true; | 2709 | full = true; |
2711 | if ( mode < SYNC_PREF_ASK ) | 2710 | if ( mode < SYNC_PREF_ASK ) |
2712 | mode = SYNC_PREF_ASK; | 2711 | mode = SYNC_PREF_ASK; |
2713 | } else { | 2712 | } else { |
2714 | if ( localMod == remoteMod ) | 2713 | if ( localMod == remoteMod ) |
2715 | return 0; | 2714 | return 0; |
2716 | 2715 | ||
2717 | } | 2716 | } |
2718 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2717 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2719 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2718 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2720 | //full = true; //debug only | 2719 | //full = true; //debug only |
2721 | if ( full ) { | 2720 | if ( full ) { |
2722 | bool equ = ( (*local) == (*remote) ); | 2721 | bool equ = ( (*local) == (*remote) ); |
2723 | if ( equ ) { | 2722 | if ( equ ) { |
2724 | //qDebug("equal "); | 2723 | //qDebug("equal "); |
2725 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2724 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2726 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2725 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2727 | } | 2726 | } |
2728 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2727 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2729 | return 0; | 2728 | return 0; |
2730 | 2729 | ||
2731 | }//else //debug only | 2730 | }//else //debug only |
2732 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2731 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2733 | } | 2732 | } |
2734 | int result; | 2733 | int result; |
2735 | bool localIsNew; | 2734 | bool localIsNew; |
2736 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2735 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2737 | 2736 | ||
2738 | if ( full && mode < SYNC_PREF_NEWEST ) | 2737 | if ( full && mode < SYNC_PREF_NEWEST ) |
2739 | mode = SYNC_PREF_ASK; | 2738 | mode = SYNC_PREF_ASK; |
2740 | 2739 | ||
2741 | switch( mode ) { | 2740 | switch( mode ) { |
2742 | case SYNC_PREF_LOCAL: | 2741 | case SYNC_PREF_LOCAL: |
2743 | if ( lastSync > remoteMod ) | 2742 | if ( lastSync > remoteMod ) |
2744 | return 1; | 2743 | return 1; |
2745 | if ( lastSync > localMod ) | 2744 | if ( lastSync > localMod ) |
2746 | return 2; | 2745 | return 2; |
2747 | return 1; | 2746 | return 1; |
2748 | break; | 2747 | break; |
2749 | case SYNC_PREF_REMOTE: | 2748 | case SYNC_PREF_REMOTE: |
2750 | if ( lastSync > remoteMod ) | 2749 | if ( lastSync > remoteMod ) |
2751 | return 1; | 2750 | return 1; |
2752 | if ( lastSync > localMod ) | 2751 | if ( lastSync > localMod ) |
2753 | return 2; | 2752 | return 2; |
2754 | return 2; | 2753 | return 2; |
2755 | break; | 2754 | break; |
2756 | case SYNC_PREF_NEWEST: | 2755 | case SYNC_PREF_NEWEST: |
2757 | if ( localMod > remoteMod ) | 2756 | if ( localMod > remoteMod ) |
2758 | return 1; | 2757 | return 1; |
2759 | else | 2758 | else |
2760 | return 2; | 2759 | return 2; |
2761 | break; | 2760 | break; |
2762 | case SYNC_PREF_ASK: | 2761 | case SYNC_PREF_ASK: |
2763 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2762 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2764 | if ( lastSync > remoteMod ) | 2763 | if ( lastSync > remoteMod ) |
2765 | return 1; | 2764 | return 1; |
2766 | if ( lastSync > localMod ) | 2765 | if ( lastSync > localMod ) |
2767 | return 2; | 2766 | return 2; |
2768 | localIsNew = localMod >= remoteMod; | 2767 | localIsNew = localMod >= remoteMod; |
2769 | //qDebug("conflict! ************************************** "); | 2768 | //qDebug("conflict! ************************************** "); |
2770 | { | 2769 | { |
2771 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2770 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2772 | result = acd.executeD(localIsNew); | 2771 | result = acd.executeD(localIsNew); |
2773 | return result; | 2772 | return result; |
2774 | } | 2773 | } |
2775 | break; | 2774 | break; |
2776 | case SYNC_PREF_FORCE_LOCAL: | 2775 | case SYNC_PREF_FORCE_LOCAL: |
2777 | return 1; | 2776 | return 1; |
2778 | break; | 2777 | break; |
2779 | case SYNC_PREF_FORCE_REMOTE: | 2778 | case SYNC_PREF_FORCE_REMOTE: |
2780 | return 2; | 2779 | return 2; |
2781 | break; | 2780 | break; |
2782 | 2781 | ||
2783 | default: | 2782 | default: |
2784 | // SYNC_PREF_TAKE_BOTH not implemented | 2783 | // SYNC_PREF_TAKE_BOTH not implemented |
2785 | break; | 2784 | break; |
2786 | } | 2785 | } |
2787 | return 0; | 2786 | return 0; |
2788 | } | 2787 | } |
2789 | 2788 | ||
2790 | 2789 | ||
2791 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2790 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2792 | { | 2791 | { |
2793 | bool syncOK = true; | 2792 | bool syncOK = true; |
2794 | int addedAddressee = 0; | 2793 | int addedAddressee = 0; |
2795 | int addedAddresseeR = 0; | 2794 | int addedAddresseeR = 0; |
2796 | int deletedAddresseeR = 0; | 2795 | int deletedAddresseeR = 0; |
2797 | int deletedAddresseeL = 0; | 2796 | int deletedAddresseeL = 0; |
2798 | int changedLocal = 0; | 2797 | int changedLocal = 0; |
2799 | int changedRemote = 0; | 2798 | int changedRemote = 0; |
2800 | 2799 | ||
2801 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2800 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2802 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2801 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2803 | 2802 | ||
2804 | //QPtrList<Addressee> el = local->rawAddressees(); | 2803 | //QPtrList<Addressee> el = local->rawAddressees(); |
2805 | Addressee addresseeR; | 2804 | Addressee addresseeR; |
2806 | QString uid; | 2805 | QString uid; |
2807 | int take; | 2806 | int take; |
2808 | Addressee addresseeL; | 2807 | Addressee addresseeL; |
2809 | Addressee addresseeRSync; | 2808 | Addressee addresseeRSync; |
2810 | Addressee addresseeLSync; | 2809 | Addressee addresseeLSync; |
2811 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2810 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2812 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2811 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2813 | bool fullDateRange = false; | 2812 | bool fullDateRange = false; |
2814 | local->resetTempSyncStat(); | 2813 | local->resetTempSyncStat(); |
2815 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2814 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2816 | if ( syncManager->syncWithDesktop() ) { | 2815 | if ( syncManager->syncWithDesktop() ) { |
2817 | // remote->removeSyncInfo( QString());//remove all info | 2816 | // remote->removeSyncInfo( QString());//remove all info |
2818 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2817 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2819 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2818 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2820 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2819 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2821 | } else { | 2820 | } else { |
2822 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2821 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2823 | } | 2822 | } |
2824 | } | 2823 | } |
2825 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2824 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2826 | addresseeLSync = getLastSyncAddressee(); | 2825 | addresseeLSync = getLastSyncAddressee(); |
2827 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2826 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2828 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2827 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2829 | if ( !addresseeR.isEmpty() ) { | 2828 | if ( !addresseeR.isEmpty() ) { |
2830 | addresseeRSync = addresseeR; | 2829 | addresseeRSync = addresseeR; |
2831 | remote->removeAddressee(addresseeR ); | 2830 | remote->removeAddressee(addresseeR ); |
2832 | 2831 | ||
2833 | } else { | 2832 | } else { |
2834 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2833 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2835 | addresseeRSync = addresseeLSync ; | 2834 | addresseeRSync = addresseeLSync ; |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 0d5891e..ecfe6e9 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -369,128 +369,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
369 | void setCaptionBack(); | 369 | void setCaptionBack(); |
370 | void importFromOL(); | 370 | void importFromOL(); |
371 | void extensionModified( const KABC::Addressee::List &list ); | 371 | void extensionModified( const KABC::Addressee::List &list ); |
372 | void extensionChanged( int id ); | 372 | void extensionChanged( int id ); |
373 | void clipboardDataChanged(); | 373 | void clipboardDataChanged(); |
374 | void updateActionMenu(); | 374 | void updateActionMenu(); |
375 | void configureKeyBindings(); | 375 | void configureKeyBindings(); |
376 | void removeVoice(); | 376 | void removeVoice(); |
377 | void setFormattedName(); | 377 | void setFormattedName(); |
378 | #ifdef KAB_EMBEDDED | 378 | #ifdef KAB_EMBEDDED |
379 | void configureResources(); | 379 | void configureResources(); |
380 | #endif //KAB_EMBEDDED | 380 | #endif //KAB_EMBEDDED |
381 | 381 | ||
382 | void slotEditorDestroyed( const QString &uid ); | 382 | void slotEditorDestroyed( const QString &uid ); |
383 | void configurationChanged(); | 383 | void configurationChanged(); |
384 | void addressBookChanged(); | 384 | void addressBookChanged(); |
385 | 385 | ||
386 | private: | 386 | private: |
387 | void resizeEvent(QResizeEvent* e ); | 387 | void resizeEvent(QResizeEvent* e ); |
388 | bool mBRdisabled; | 388 | bool mBRdisabled; |
389 | #ifndef DESKTOP_VERSION | 389 | #ifndef DESKTOP_VERSION |
390 | QCopChannel* infrared; | 390 | QCopChannel* infrared; |
391 | #endif | 391 | #endif |
392 | QTimer *mMessageTimer; | 392 | QTimer *mMessageTimer; |
393 | void initGUI(); | 393 | void initGUI(); |
394 | void initActions(); | 394 | void initActions(); |
395 | QString getPhoneFile(); | 395 | QString getPhoneFile(); |
396 | 396 | ||
397 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 397 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
398 | const char *name = 0 ); | 398 | const char *name = 0 ); |
399 | 399 | ||
400 | KXMLGUIClient *mGUIClient; | 400 | KXMLGUIClient *mGUIClient; |
401 | 401 | ||
402 | KABC::AddressBook *mAddressBook; | 402 | KABC::AddressBook *mAddressBook; |
403 | 403 | ||
404 | ViewManager *mViewManager; | 404 | ViewManager *mViewManager; |
405 | // QSplitter *mDetailsSplitter; | 405 | // QSplitter *mDetailsSplitter; |
406 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 406 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
407 | ViewContainer *mDetails; | 407 | ViewContainer *mDetails; |
408 | KDGanttMinimizeSplitter* mMiniSplitter; | 408 | KDGanttMinimizeSplitter* mMiniSplitter; |
409 | XXPortManager *mXXPortManager; | 409 | XXPortManager *mXXPortManager; |
410 | JumpButtonBar *mJumpButtonBar; | 410 | JumpButtonBar *mJumpButtonBar; |
411 | IncSearchWidget *mIncSearchWidget; | 411 | IncSearchWidget *mIncSearchWidget; |
412 | ExtensionManager *mExtensionManager; | 412 | ExtensionManager *mExtensionManager; |
413 | 413 | ||
414 | KCMultiDialog *mConfigureDialog; | 414 | KCMultiDialog *mConfigureDialog; |
415 | 415 | ||
416 | #ifndef KAB_EMBEDDED | 416 | #ifndef KAB_EMBEDDED |
417 | LDAPSearchDialog *mLdapSearchDialog; | 417 | LDAPSearchDialog *mLdapSearchDialog; |
418 | #endif //KAB_EMBEDDED | 418 | #endif //KAB_EMBEDDED |
419 | // QDict<AddresseeEditorDialog> mEditorDict; | 419 | // QDict<AddresseeEditorDialog> mEditorDict; |
420 | AddresseeEditorDialog *mEditorDialog; | 420 | AddresseeEditorDialog *mEditorDialog; |
421 | bool mReadWrite; | 421 | bool mReadWrite; |
422 | bool mModified; | 422 | bool mModified; |
423 | bool mIsPart; | 423 | bool mIsPart; |
424 | bool mMultipleViewsAtOnce; | 424 | bool mMultipleViewsAtOnce; |
425 | 425 | ||
426 | 426 | ||
427 | //US file menu | 427 | //US file menu |
428 | KAction *mActionMail; | 428 | KAction *mActionMail; |
429 | KAction *mActionBeam; | 429 | KAction *mActionBeam; |
430 | KToggleAction *mActionBR; | 430 | KToggleAction *mActionBR; |
431 | KAction *mActionExport2phone; | 431 | KAction *mActionExport2phone; |
432 | KAction* mActionPrint; | 432 | KAction* mActionPrint; |
433 | KAction* mActionPrintDetails; | ||
433 | KAction* mActionNewContact; | 434 | KAction* mActionNewContact; |
434 | KAction *mActionSave; | 435 | KAction *mActionSave; |
435 | KAction *mActionEditAddressee; | 436 | KAction *mActionEditAddressee; |
436 | KAction *mActionMailVCard; | 437 | KAction *mActionMailVCard; |
437 | KAction *mActionBeamVCard; | 438 | KAction *mActionBeamVCard; |
438 | 439 | ||
439 | KAction *mActionQuit; | 440 | KAction *mActionQuit; |
440 | 441 | ||
441 | //US edit menu | 442 | //US edit menu |
442 | KAction *mActionCopy; | 443 | KAction *mActionCopy; |
443 | KAction *mActionCut; | 444 | KAction *mActionCut; |
444 | KAction *mActionPaste; | 445 | KAction *mActionPaste; |
445 | KAction *mActionSelectAll; | 446 | KAction *mActionSelectAll; |
446 | KAction *mActionUndo; | 447 | KAction *mActionUndo; |
447 | KAction *mActionRedo; | 448 | KAction *mActionRedo; |
448 | KAction *mActionDelete; | 449 | KAction *mActionDelete; |
449 | 450 | ||
450 | //US settings menu | 451 | //US settings menu |
451 | KAction *mActionConfigResources; | 452 | KAction *mActionConfigResources; |
452 | KAction *mActionConfigKAddressbook; | 453 | KAction *mActionConfigKAddressbook; |
453 | KAction *mActionConfigShortcuts; | 454 | KAction *mActionConfigShortcuts; |
454 | KAction *mActionConfigureToolbars; | 455 | KAction *mActionConfigureToolbars; |
455 | KAction *mActionKeyBindings; | 456 | KAction *mActionKeyBindings; |
456 | KToggleAction *mActionJumpBar; | 457 | KToggleAction *mActionJumpBar; |
457 | KToggleAction *mActionDetails; | 458 | KToggleAction *mActionDetails; |
458 | KAction *mActionWhoAmI; | 459 | KAction *mActionWhoAmI; |
459 | KAction *mActionCategories; | 460 | KAction *mActionCategories; |
460 | KAction *mActionEditCategories; | 461 | KAction *mActionEditCategories; |
461 | KAction *mActionManageCategories; | 462 | KAction *mActionManageCategories; |
462 | KAction *mActionAboutKAddressbook; | 463 | KAction *mActionAboutKAddressbook; |
463 | KAction *mActionLicence; | 464 | KAction *mActionLicence; |
464 | KAction *mActionFaq; | 465 | KAction *mActionFaq; |
465 | KAction *mActionWN; | 466 | KAction *mActionWN; |
466 | KAction *mActionSyncHowto; | 467 | KAction *mActionSyncHowto; |
467 | KAction *mActionKdeSyncHowto; | 468 | KAction *mActionKdeSyncHowto; |
468 | KAction *mActionMultiSyncHowto; | 469 | KAction *mActionMultiSyncHowto; |
469 | 470 | ||
470 | KAction *mActionDeleteView; | 471 | KAction *mActionDeleteView; |
471 | 472 | ||
472 | QPopupMenu *viewMenu; | 473 | QPopupMenu *viewMenu; |
473 | QPopupMenu *filterMenu; | 474 | QPopupMenu *filterMenu; |
474 | QPopupMenu *settingsMenu; | 475 | QPopupMenu *settingsMenu; |
475 | QPopupMenu *changeMenu; | 476 | QPopupMenu *changeMenu; |
476 | QPopupMenu *beamMenu; | 477 | QPopupMenu *beamMenu; |
477 | //US QAction *mActionSave; | 478 | //US QAction *mActionSave; |
478 | QPopupMenu *ImportMenu; | 479 | QPopupMenu *ImportMenu; |
479 | QPopupMenu *ExportMenu; | 480 | QPopupMenu *ExportMenu; |
480 | //LR additional methods | 481 | //LR additional methods |
481 | KAction *mActionRemoveVoice; | 482 | KAction *mActionRemoveVoice; |
482 | KAction *mActionSetFormattedName; | 483 | KAction *mActionSetFormattedName; |
483 | KAction * mActionImportOL; | 484 | KAction * mActionImportOL; |
484 | 485 | ||
485 | #ifndef KAB_EMBEDDED | 486 | #ifndef KAB_EMBEDDED |
486 | KAddressBookService *mAddressBookService; | 487 | KAddressBookService *mAddressBookService; |
487 | #endif //KAB_EMBEDDED | 488 | #endif //KAB_EMBEDDED |
488 | 489 | ||
489 | class KABCorePrivate; | 490 | class KABCorePrivate; |
490 | KABCorePrivate *d; | 491 | KABCorePrivate *d; |
491 | //US bool mBlockSaveFlag; | 492 | //US bool mBlockSaveFlag; |
492 | 493 | ||
493 | #ifdef KAB_EMBEDDED | 494 | #ifdef KAB_EMBEDDED |
494 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 495 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
495 | #endif //KAB_EMBEDDED | 496 | #endif //KAB_EMBEDDED |
496 | 497 | ||
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 8646136..8f31910 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -1,242 +1,251 @@ | |||
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 | #ifndef KADDRESSBOOKVIEW_H | 24 | #ifndef KADDRESSBOOKVIEW_H |
25 | #define KADDRESSBOOKVIEW_H | 25 | #define KADDRESSBOOKVIEW_H |
26 | 26 | ||
27 | #ifndef KAB_EMBEDDED | 27 | #ifndef KAB_EMBEDDED |
28 | #include <klibloader.h> | 28 | #include <klibloader.h> |
29 | #endif //KAB_EMBEDDED | 29 | #endif //KAB_EMBEDDED |
30 | 30 | ||
31 | class KConfig; | 31 | class KConfig; |
32 | class QDropEvent; | 32 | class QDropEvent; |
33 | 33 | ||
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
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 | #ifdef DESKTOP_VERSION | ||
42 | #include <qpaintdevicemetrics.h> | ||
43 | #include <qprinter.h> | ||
44 | #include <qpainter.h> | ||
45 | #endif | ||
46 | |||
41 | namespace KABC { class AddressBook; } | 47 | namespace KABC { class AddressBook; } |
42 | 48 | ||
43 | /** | 49 | /** |
44 | Base class for all views in kaddressbook. This class implements | 50 | Base class for all views in kaddressbook. This class implements |
45 | all the common methods needed to provide a view to the user. | 51 | all the common methods needed to provide a view to the user. |
46 | 52 | ||
47 | To implement a specific view (table, card, etc), just inherit from | 53 | To implement a specific view (table, card, etc), just inherit from |
48 | this class and implement all the pure virtuals. | 54 | this class and implement all the pure virtuals. |
49 | 55 | ||
50 | @author Mike Pilone <mpilone@slac.com> | 56 | @author Mike Pilone <mpilone@slac.com> |
51 | */ | 57 | */ |
52 | class KAddressBookView : public QWidget | 58 | class KAddressBookView : public QWidget |
53 | { | 59 | { |
54 | Q_OBJECT | 60 | Q_OBJECT |
55 | 61 | ||
56 | public: | 62 | public: |
57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; | 63 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; |
58 | 64 | ||
59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); | 65 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); |
60 | virtual ~KAddressBookView(); | 66 | virtual ~KAddressBookView(); |
61 | 67 | ||
62 | /** | 68 | /** |
63 | Must be overloaded in subclasses. Should return a list of | 69 | Must be overloaded in subclasses. Should return a list of |
64 | all the uids of selected contacts. | 70 | all the uids of selected contacts. |
65 | */ | 71 | */ |
66 | virtual QStringList selectedUids() = 0; | 72 | virtual QStringList selectedUids() = 0; |
67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; | 73 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; |
68 | virtual void scrollUP() = 0; | 74 | virtual void scrollUP() = 0; |
69 | virtual void scrollDOWN() = 0; | 75 | virtual void scrollDOWN() = 0; |
70 | virtual void setFocusAV() = 0; | 76 | virtual void setFocusAV() = 0; |
71 | 77 | ||
72 | /** | 78 | /** |
73 | Called whenever this view should read the config. This can be used | 79 | Called whenever this view should read the config. This can be used |
74 | as a sign that the config has changed, therefore the view should | 80 | as a sign that the config has changed, therefore the view should |
75 | assume the worst and rebuild itself if necessary. For example, | 81 | assume the worst and rebuild itself if necessary. For example, |
76 | in a table view this method may be called when the user adds or | 82 | in a table view this method may be called when the user adds or |
77 | removes columns from the view. | 83 | removes columns from the view. |
78 | 84 | ||
79 | If overloaded in the subclass, do not forget to call super class's | 85 | If overloaded in the subclass, do not forget to call super class's |
80 | method. | 86 | method. |
81 | 87 | ||
82 | @param config The KConfig object to read from. The group will already | 88 | @param config The KConfig object to read from. The group will already |
83 | be set, so do not change the group. | 89 | be set, so do not change the group. |
84 | */ | 90 | */ |
85 | virtual void readConfig( KConfig *config ); | 91 | virtual void readConfig( KConfig *config ); |
86 | 92 | ||
87 | /** | 93 | /** |
88 | Called whenever this view should write the config. The view should not | 94 | Called whenever this view should write the config. The view should not |
89 | write out information handled by the application, such as which fields | 95 | write out information handled by the application, such as which fields |
90 | are visible. The view should only write out information specific | 96 | are visible. The view should only write out information specific |
91 | to itself (i.e.: All information in the ViewConfigWidget) | 97 | to itself (i.e.: All information in the ViewConfigWidget) |
92 | 98 | ||
93 | If overloaded in the subclass, do not forget to call the super class's | 99 | If overloaded in the subclass, do not forget to call the super class's |
94 | method. | 100 | method. |
95 | 101 | ||
96 | @param config The KConfig object to read from. The group will already | 102 | @param config The KConfig object to read from. The group will already |
97 | be set, so do not change the group. | 103 | be set, so do not change the group. |
98 | */ | 104 | */ |
99 | virtual void writeConfig( KConfig *config ); | 105 | virtual void writeConfig( KConfig *config ); |
100 | 106 | ||
101 | /** | 107 | /** |
102 | Returns a QString with all the selected email addresses concatenated | 108 | Returns a QString with all the selected email addresses concatenated |
103 | together with a ',' seperator. | 109 | together with a ',' seperator. |
104 | */ | 110 | */ |
105 | virtual QString selectedEmails(); | 111 | virtual QString selectedEmails(); |
106 | 112 | ||
107 | /** | 113 | /** |
108 | Return the type of the view: Icon, Table, etc. Please make sure that | 114 | Return the type of the view: Icon, Table, etc. Please make sure that |
109 | this is the same value that ViewWrapper::type() will return for your | 115 | this is the same value that ViewWrapper::type() will return for your |
110 | view. | 116 | view. |
111 | */ | 117 | */ |
112 | virtual QString type() const = 0; | 118 | virtual QString type() const = 0; |
113 | 119 | ||
114 | /** | 120 | /** |
115 | Returns a list of the fields that should be displayed. The list | 121 | Returns a list of the fields that should be displayed. The list |
116 | is composed of the fields proper names (ie: Home Address), so | 122 | is composed of the fields proper names (ie: Home Address), so |
117 | the view may need to translate them in order to get the | 123 | the view may need to translate them in order to get the |
118 | value from the addressee. | 124 | value from the addressee. |
119 | 125 | ||
120 | This list is generated from the config file, so it is advisable to call | 126 | This list is generated from the config file, so it is advisable to call |
121 | this method whenever a readConfig() is called in order to get the newest | 127 | this method whenever a readConfig() is called in order to get the newest |
122 | list of fields. | 128 | list of fields. |
123 | */ | 129 | */ |
124 | KABC::Field::List fields() const; | 130 | KABC::Field::List fields() const; |
125 | 131 | ||
126 | KABC::Field::List allFields() const; | 132 | KABC::Field::List allFields() const; |
127 | 133 | ||
128 | /** | 134 | /** |
129 | Sets the active filter. This filter will be used for filtering | 135 | Sets the active filter. This filter will be used for filtering |
130 | the list of addressees to display. The view will <b>not</b> | 136 | the list of addressees to display. The view will <b>not</b> |
131 | automatically refresh itself, so in most cases you will want to call | 137 | automatically refresh itself, so in most cases you will want to call |
132 | KAddressBookView::refresh() after this method. | 138 | KAddressBookView::refresh() after this method. |
133 | */ | 139 | */ |
134 | void setFilter( const Filter& ); | 140 | void setFilter( const Filter& ); |
135 | 141 | ||
136 | /** | 142 | /** |
137 | @return The default filter type selection. If the selection | 143 | @return The default filter type selection. If the selection |
138 | is SpecificFilter, the name of the filter can be retrieved with | 144 | is SpecificFilter, the name of the filter can be retrieved with |
139 | defaultFilterName() | 145 | defaultFilterName() |
140 | */ | 146 | */ |
141 | DefaultFilterType defaultFilterType() const; | 147 | DefaultFilterType defaultFilterType() const; |
142 | 148 | ||
143 | /** | 149 | /** |
144 | @return The name of the default filter. This string is | 150 | @return The name of the default filter. This string is |
145 | only valid if defaultFilterType() is returning SpecificFilter. | 151 | only valid if defaultFilterType() is returning SpecificFilter. |
146 | */ | 152 | */ |
147 | const QString &defaultFilterName() const; | 153 | const QString &defaultFilterName() const; |
148 | 154 | ||
149 | /** | 155 | /** |
150 | @return The address book. | 156 | @return The address book. |
151 | */ | 157 | */ |
152 | KABC::AddressBook *addressBook() const; | 158 | KABC::AddressBook *addressBook() const; |
159 | void printMyView() { emit printView() ;} | ||
153 | 160 | ||
154 | public slots: | 161 | public slots: |
155 | /** | 162 | /** |
156 | Must be overloaded in subclasses to refresh the view. | 163 | Must be overloaded in subclasses to refresh the view. |
157 | Refreshing includes updating the view to ensure that only items | 164 | Refreshing includes updating the view to ensure that only items |
158 | in the document are visible. If <i>uid</i> is valid, only the | 165 | in the document are visible. If <i>uid</i> is valid, only the |
159 | addressee with uid needs to be refreshed. This is an optimization | 166 | addressee with uid needs to be refreshed. This is an optimization |
160 | only. | 167 | only. |
161 | */ | 168 | */ |
162 | virtual void refresh( QString uid = QString::null ) = 0; | 169 | virtual void refresh( QString uid = QString::null ) = 0; |
163 | 170 | ||
164 | /** | 171 | /** |
165 | This method must be overloaded in subclasses. Select (highlight) | 172 | This method must be overloaded in subclasses. Select (highlight) |
166 | the addressee matching <i>uid</i>. If uid | 173 | the addressee matching <i>uid</i>. If uid |
167 | is equal to QString::null, then all addressees should be selected. | 174 | is equal to QString::null, then all addressees should be selected. |
168 | */ | 175 | */ |
169 | #ifndef KAB_EMBEDDED | 176 | #ifndef KAB_EMBEDDED |
170 | //MOC_SKIP_BEGIN | 177 | //MOC_SKIP_BEGIN |
171 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; | 178 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; |
172 | //MOC_SKIP_END | 179 | //MOC_SKIP_END |
173 | #else //KAB_EMBEDDED | 180 | #else //KAB_EMBEDDED |
174 | //US my moc can not handle the default parameters. Is this a problem ??? | 181 | //US my moc can not handle the default parameters. Is this a problem ??? |
175 | virtual void setSelected( QString uid, bool selected) = 0; | 182 | virtual void setSelected( QString uid, bool selected) = 0; |
176 | #endif //KAB_EMBEDDED | 183 | #endif //KAB_EMBEDDED |
177 | 184 | ||
178 | signals: | 185 | signals: |
186 | |||
187 | void printView(); | ||
179 | /** | 188 | /** |
180 | This signal should be emitted by a subclass whenever an addressee | 189 | This signal should be emitted by a subclass whenever an addressee |
181 | is modified. | 190 | is modified. |
182 | */ | 191 | */ |
183 | void modified(); | 192 | void modified(); |
184 | 193 | ||
185 | /** | 194 | /** |
186 | This signal should be emitted by a subclass whenever an addressee | 195 | This signal should be emitted by a subclass whenever an addressee |
187 | is selected. Selected means that the addressee was given the focus. | 196 | is selected. Selected means that the addressee was given the focus. |
188 | Some widgets may call this 'highlighted'. The view is responsible for | 197 | Some widgets may call this 'highlighted'. The view is responsible for |
189 | emitting this signal multiple times if multiple items are selected, | 198 | emitting this signal multiple times if multiple items are selected, |
190 | with the last item selected being the last emit. | 199 | with the last item selected being the last emit. |
191 | 200 | ||
192 | @param uid The uid of the selected addressee. | 201 | @param uid The uid of the selected addressee. |
193 | 202 | ||
194 | @see KListView | 203 | @see KListView |
195 | */ | 204 | */ |
196 | void selected( const QString &uid ); | 205 | void selected( const QString &uid ); |
197 | void deleteRequest(); | 206 | void deleteRequest(); |
198 | /** | 207 | /** |
199 | This signal should be emitted by a subclass whenever an addressee | 208 | This signal should be emitted by a subclass whenever an addressee |
200 | is executed. This is defined by the KDE system wide config, but it | 209 | is executed. This is defined by the KDE system wide config, but it |
201 | either means single or doubleclicked. | 210 | either means single or doubleclicked. |
202 | 211 | ||
203 | @param ui The uid of the selected addressee | 212 | @param ui The uid of the selected addressee |
204 | 213 | ||
205 | @see KListView | 214 | @see KListView |
206 | */ | 215 | */ |
207 | void executed( const QString &uid ); | 216 | void executed( const QString &uid ); |
208 | 217 | ||
209 | /** | 218 | /** |
210 | This signal is emitted whenever a user attempts to start a drag | 219 | This signal is emitted whenever a user attempts to start a drag |
211 | in the view. The slot connected to this signal would usually want | 220 | in the view. The slot connected to this signal would usually want |
212 | to create a QDragObject. | 221 | to create a QDragObject. |
213 | */ | 222 | */ |
214 | void startDrag(); | 223 | void startDrag(); |
215 | 224 | ||
216 | /** | 225 | /** |
217 | This signal is emitted whenever the user drops something on the | 226 | This signal is emitted whenever the user drops something on the |
218 | view. The individual view should handle checking if the item is | 227 | view. The individual view should handle checking if the item is |
219 | droppable (ie: if it is a vcard). | 228 | droppable (ie: if it is a vcard). |
220 | */ | 229 | */ |
221 | void dropped( QDropEvent* ); | 230 | void dropped( QDropEvent* ); |
222 | 231 | ||
223 | protected: | 232 | protected: |
224 | /** | 233 | /** |
225 | Returns a list of the addressees that should be displayed. This method | 234 | Returns a list of the addressees that should be displayed. This method |
226 | should always be used by the subclass to get a list of addressees. This | 235 | should always be used by the subclass to get a list of addressees. This |
227 | method internally takes many factors into account, including the current | 236 | method internally takes many factors into account, including the current |
228 | filter. | 237 | filter. |
229 | */ | 238 | */ |
230 | KABC::Addressee::List addressees(); | 239 | KABC::Addressee::List addressees(); |
231 | 240 | ||
232 | /** | 241 | /** |
233 | This method returns the widget that should be used as the parent for | 242 | This method returns the widget that should be used as the parent for |
234 | all view components. By using this widget as the parent and not | 243 | all view components. By using this widget as the parent and not |
235 | 'this', the view subclass has the option of placing other widgets | 244 | 'this', the view subclass has the option of placing other widgets |
236 | around the view (ie: search fields, etc). Do not delete this widget! | 245 | around the view (ie: search fields, etc). Do not delete this widget! |
237 | */ | 246 | */ |
238 | QWidget *viewWidget(); | 247 | QWidget *viewWidget(); |
239 | 248 | ||
240 | private: | 249 | private: |
241 | void initGUI(); | 250 | void initGUI(); |
242 | 251 | ||
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 8bf9bb0..3ad2f74 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -96,129 +96,129 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
96 | 96 | ||
97 | // General page | 97 | // General page |
98 | QWidget *generalPage = new QWidget( this ); | 98 | QWidget *generalPage = new QWidget( this ); |
99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
100 | KDialog::spacingHintSmall() ); | 100 | KDialog::spacingHintSmall() ); |
101 | 101 | ||
102 | 102 | ||
103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); |
105 | KPrefsWidFont *detailsFont = | 105 | KPrefsWidFont *detailsFont = |
106 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 106 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
107 | &(KABPrefs::instance()->mDetailsFont),hBox); | 107 | &(KABPrefs::instance()->mDetailsFont),hBox); |
108 | hboxLayout->addWidget(detailsFont->label()); | 108 | hboxLayout->addWidget(detailsFont->label()); |
109 | hboxLayout->addWidget(detailsFont->preview()); | 109 | hboxLayout->addWidget(detailsFont->preview()); |
110 | hboxLayout->addWidget(detailsFont->button()); | 110 | hboxLayout->addWidget(detailsFont->button()); |
111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
113 | //hBox->setBackgroundColor( black); | 113 | //hBox->setBackgroundColor( black); |
114 | layout->addWidget( hBox ); | 114 | layout->addWidget( hBox ); |
115 | 115 | ||
116 | //general groupbox | 116 | //general groupbox |
117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); |
119 | boxLayout->setAlignment( Qt::AlignTop ); | 119 | boxLayout->setAlignment( Qt::AlignTop ); |
120 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 120 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
122 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | 122 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); |
123 | boxLayout->addWidget( mMenuBarBox ); | 123 | boxLayout->addWidget( mMenuBarBox ); |
124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
125 | boxLayout->addWidget( mSearchReturnBox ); | 125 | boxLayout->addWidget( mSearchReturnBox ); |
126 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 126 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
127 | boxLayout->addWidget( mViewsSingleClickBox ); | 127 | boxLayout->addWidget( mViewsSingleClickBox ); |
128 | 128 | ||
129 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 129 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); |
130 | boxLayout->addWidget( mNameParsing ); | 130 | boxLayout->addWidget( mNameParsing ); |
131 | 131 | ||
132 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); | 132 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); |
133 | boxLayout->addWidget( mMultipleViewsAtOnce ); | 133 | boxLayout->addWidget( mMultipleViewsAtOnce ); |
134 | 134 | ||
135 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); | 135 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); |
136 | boxLayout->addWidget( mAskForQuit ); | 136 | boxLayout->addWidget( mAskForQuit ); |
137 | 137 | ||
138 | layout->addWidget( vBox ); | 138 | layout->addWidget( vBox ); |
139 | 139 | ||
140 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 140 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
141 | 141 | ||
142 | // Extension page | 142 | // Extension page |
143 | QWidget *extensionPage = new QWidget( this ); | 143 | QWidget *extensionPage = new QWidget( this ); |
144 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 144 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), |
145 | KDialog::spacingHintSmall() ); | 145 | KDialog::spacingHintSmall() ); |
146 | 146 | ||
147 | //extensions groupbox | 147 | //extensions groupbox |
148 | 148 | ||
149 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 149 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
150 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 150 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
151 | boxLayout->setAlignment( Qt::AlignTop ); | 151 | boxLayout->setAlignment( Qt::AlignTop ); |
152 | boxLayout->setMargin(KDialog::marginHintSmall()); | 152 | boxLayout->setMargin(KDialog::marginHintSmall()); |
153 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 153 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
154 | groupBox->layout()->setMargin(1) ; | 154 | groupBox->layout()->setMargin(1) ; |
155 | groupBox->layout()->setSpacing(0); | 155 | groupBox->layout()->setSpacing(0); |
156 | mExtensionView = new KListView( groupBox ); | 156 | mExtensionView = new KListView( groupBox ); |
157 | mExtensionView->setAllColumnsShowFocus( true ); | 157 | mExtensionView->setAllColumnsShowFocus( true ); |
158 | mExtensionView->addColumn( i18n( "Name" ) ); | 158 | mExtensionView->addColumn( i18n( "Name" ) ); |
159 | mExtensionView->addColumn( i18n( "Description" ) ); | 159 | mExtensionView->addColumn( i18n( "Description" ) ); |
160 | mExtensionView->setMaximumHeight(80); | 160 | //mExtensionView->setMaximumHeight(80); |
161 | 161 | ||
162 | boxLayout->addWidget( mExtensionView ); | 162 | boxLayout->addWidget( mExtensionView ); |
163 | 163 | ||
164 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 164 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
165 | mConfigureButton->setEnabled( false ); | 165 | mConfigureButton->setEnabled( false ); |
166 | boxLayout->addWidget( mConfigureButton ); | 166 | boxLayout->addWidget( mConfigureButton ); |
167 | 167 | ||
168 | extensionLayout->addWidget( groupBox ); | 168 | extensionLayout->addWidget( groupBox ); |
169 | 169 | ||
170 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 170 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
171 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 171 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
172 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 172 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
173 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 173 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
174 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 174 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
175 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 175 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
176 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 176 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
177 | SLOT( selectionChanged( QListViewItem* ) ) ); | 177 | SLOT( selectionChanged( QListViewItem* ) ) ); |
178 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 178 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
179 | SLOT( itemClicked( QListViewItem* ) ) ); | 179 | SLOT( itemClicked( QListViewItem* ) ) ); |
180 | connect( mConfigureButton, SIGNAL( clicked() ), | 180 | connect( mConfigureButton, SIGNAL( clicked() ), |
181 | SLOT( configureExtension() ) ); | 181 | SLOT( configureExtension() ) ); |
182 | 182 | ||
183 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 183 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
184 | 184 | ||
185 | // Addressee page | 185 | // Addressee page |
186 | mAddresseeWidget = new AddresseeWidget( this ); | 186 | mAddresseeWidget = new AddresseeWidget( this ); |
187 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 187 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
188 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 188 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
192 | void KABConfigWidget::usrReadConfig() | 192 | void KABConfigWidget::usrReadConfig() |
193 | { | 193 | { |
194 | KABPrefs* prefs = KABPrefs::instance(); | 194 | KABPrefs* prefs = KABPrefs::instance(); |
195 | 195 | ||
196 | bool blocked = signalsBlocked(); | 196 | bool blocked = signalsBlocked(); |
197 | blockSignals( true ); | 197 | blockSignals( true ); |
198 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); | 198 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); |
199 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 199 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
200 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 200 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
201 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 201 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
202 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 202 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
203 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 203 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
204 | 204 | ||
205 | mAddresseeWidget->restoreSettings(); | 205 | mAddresseeWidget->restoreSettings(); |
206 | 206 | ||
207 | restoreExtensionSettings(); | 207 | restoreExtensionSettings(); |
208 | 208 | ||
209 | blockSignals( blocked ); | 209 | blockSignals( blocked ); |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | void KABConfigWidget::usrWriteConfig() | 213 | void KABConfigWidget::usrWriteConfig() |
214 | { | 214 | { |
215 | KABPrefs* prefs = KABPrefs::instance(); | 215 | KABPrefs* prefs = KABPrefs::instance(); |
216 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); | 216 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); |
217 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 217 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
218 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 218 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
219 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 219 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
220 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 220 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
221 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 221 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
222 | 222 | ||
223 | mAddresseeWidget->saveSettings(); | 223 | mAddresseeWidget->saveSettings(); |
224 | 224 | ||
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 771bec9..1e03dba 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -15,85 +15,86 @@ | |||
15 | #include <kglobal.h> | 15 | #include <kglobal.h> |
16 | #include <stdio.h> | 16 | #include <stdio.h> |
17 | #include <qdir.h> | 17 | #include <qdir.h> |
18 | #include "kabprefs.h" | 18 | #include "kabprefs.h" |
19 | #include "kaddressbookmain.h" | 19 | #include "kaddressbookmain.h" |
20 | #include "externalapphandler.h" | 20 | #include "externalapphandler.h" |
21 | #include <libkdepim/kpimglobalprefs.h> | 21 | #include <libkdepim/kpimglobalprefs.h> |
22 | void dumpMissing(); | 22 | void dumpMissing(); |
23 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
24 | { | 24 | { |
25 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
26 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
27 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
28 | #else | 28 | #else |
29 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
30 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
31 | QString hdir = QDir::homeDirPath(); | 31 | QString hdir = QDir::homeDirPath(); |
32 | // there is a bug when creating dirs for WIN 98 | 32 | // there is a bug when creating dirs for WIN 98 |
33 | // it is difficult to fix, because we have no WIN 98 runnung | 33 | // it is difficult to fix, because we have no WIN 98 runnung |
34 | // such that we try it to create the dirs at startup here | 34 | // such that we try it to create the dirs at startup here |
35 | if ( hdir == "C:\\" ) { // win 98 or ME | 35 | if ( hdir == "C:\\" ) { // win 98 or ME |
36 | QDir app_dir; | 36 | QDir app_dir; |
37 | if ( !app_dir.exists("C:\\kdepim") ) | 37 | if ( !app_dir.exists("C:\\kdepim") ) |
38 | app_dir.mkdir ("C:\\kdepim"); | 38 | app_dir.mkdir ("C:\\kdepim"); |
39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
40 | app_dir.mkdir ("C:\\kdepim\\apps"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps"); |
41 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
42 | app_dir.mkdir ("C:\\kdepim\\config"); | 42 | app_dir.mkdir ("C:\\kdepim\\config"); |
43 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 43 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
44 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 44 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
45 | } | 45 | } |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | bool exitHelp = false; | 48 | bool exitHelp = false; |
49 | if ( argc > 1 ) { | 49 | if ( argc > 1 ) { |
50 | QString command = argv[1]; | 50 | QString command = argv[1]; |
51 | if ( command == "-help" ){ | 51 | if ( command == "-help" ){ |
52 | printf("KA/E command line commands:\n"); | 52 | printf("KA/E command line commands:\n"); |
53 | printf(" no command: Start KA/E in usual way\n"); | 53 | printf(" no command: Start KA/E in usual way\n"); |
54 | printf(" -help: This output\n"); | 54 | printf(" -help: This output\n"); |
55 | printf(" KA/E is exiting now. Bye!\n"); | 55 | printf(" KA/E is exiting now. Bye!\n"); |
56 | exitHelp = true; | 56 | exitHelp = true; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | if ( ! exitHelp ) { | 59 | if ( ! exitHelp ) { |
60 | 60 | ||
61 | KGlobal::setAppName( "kaddressbook" ); | 61 | KGlobal::setAppName( "kaddressbook" ); |
62 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
63 | if ( QApplication::desktop()->width() > 320 ) | 63 | if ( QApplication::desktop()->width() > 320 ) |
64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
65 | else | 65 | else |
66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
67 | #else | 67 | #else |
68 | QString fileName ; | 68 | QString fileName ; |
69 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 69 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
70 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 70 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
71 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 71 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
72 | 72 | ||
73 | #endif | 73 | #endif |
74 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 74 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
75 | // init language | 75 | // init language |
76 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 76 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
77 | KAddressBookMain m ; | 77 | KAddressBookMain m ; |
78 | //US MainWindow m; | 78 | //US MainWindow m; |
79 | #ifndef DESKTOP_VERSION | ||
79 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 80 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
80 | 81 | #endif | |
81 | 82 | ||
82 | 83 | ||
83 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
84 | a.showMainWidget( &m ); | 85 | a.showMainWidget( &m ); |
85 | 86 | ||
86 | #else | 87 | #else |
87 | a.setMainWidget( &m ); | 88 | a.setMainWidget( &m ); |
88 | m.resize (640, 480 ); | 89 | m.resize (640, 480 ); |
89 | m.show(); | 90 | m.show(); |
90 | #endif | 91 | #endif |
91 | a.exec(); | 92 | a.exec(); |
92 | 93 | ||
93 | dumpMissing(); | 94 | dumpMissing(); |
94 | 95 | ||
95 | KPimGlobalPrefs::instance()->writeConfig(); | 96 | KPimGlobalPrefs::instance()->writeConfig(); |
96 | } | 97 | } |
97 | qDebug("KA: Bye! "); | 98 | qDebug("KA: Bye! "); |
98 | } | 99 | } |
99 | 100 | ||
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 272e1b0..dff9998 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -8,128 +8,129 @@ | |||
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 | #ifndef VIEWMANAGER_H | 24 | #ifndef VIEWMANAGER_H |
25 | #define VIEWMANAGER_H | 25 | #define VIEWMANAGER_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <kaddressbookview.h> | 29 | #include <kaddressbookview.h> |
30 | #include <qdict.h> | 30 | #include <qdict.h> |
31 | #include "filter.h" | 31 | #include "filter.h" |
32 | 32 | ||
33 | class KAction; | 33 | class KAction; |
34 | class KSelectAction; | 34 | class KSelectAction; |
35 | 35 | ||
36 | class KABCore; | 36 | class KABCore; |
37 | class QWidgetStack; | 37 | class QWidgetStack; |
38 | class QDropEvent; | 38 | class QDropEvent; |
39 | 39 | ||
40 | namespace KABC { class AddressBook; } | 40 | namespace KABC { class AddressBook; } |
41 | 41 | ||
42 | /** | 42 | /** |
43 | The view manager manages the views and everything related to them. The | 43 | The view manager manages the views and everything related to them. The |
44 | manager will load the views at startup and display a view when told to | 44 | manager will load the views at startup and display a view when told to |
45 | make one active. | 45 | make one active. |
46 | 46 | ||
47 | The view manager will also create and manage all dialogs directly related to | 47 | The view manager will also create and manage all dialogs directly related to |
48 | views (ie: AddView, ConfigureView, DeleteView, etc). | 48 | views (ie: AddView, ConfigureView, DeleteView, etc). |
49 | */ | 49 | */ |
50 | class ViewManager : public QWidget | 50 | class ViewManager : public QWidget |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | public: | 53 | public: |
54 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 54 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
55 | ~ViewManager(); | 55 | ~ViewManager(); |
56 | 56 | ||
57 | void restoreSettings(); | 57 | void restoreSettings(); |
58 | void saveSettings(); | 58 | void saveSettings(); |
59 | void doSearch( const QString& s ,KABC::Field *field ); | 59 | void doSearch( const QString& s ,KABC::Field *field ); |
60 | 60 | ||
61 | void unloadViews(); | 61 | void unloadViews(); |
62 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 62 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
63 | Filter getFilterByName( const QString &name ) const; | 63 | Filter getFilterByName( const QString &name ) const; |
64 | 64 | ||
65 | QStringList selectedUids() const; | 65 | QStringList selectedUids() const; |
66 | QStringList selectedEmails() const; | 66 | QStringList selectedEmails() const; |
67 | KABC::Addressee::List selectedAddressees() const; | 67 | KABC::Addressee::List selectedAddressees() const; |
68 | void setListSelected(QStringList); | 68 | void setListSelected(QStringList); |
69 | void setFocusAV(); | 69 | void setFocusAV(); |
70 | 70 | ||
71 | public slots: | 71 | public slots: |
72 | void printView() { if (mActiveView) mActiveView->printMyView() ;} | ||
72 | void scrollUP(); | 73 | void scrollUP(); |
73 | void scrollDOWN(); | 74 | void scrollDOWN(); |
74 | 75 | ||
75 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 76 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
76 | void setSelected( const QString &uid, bool); | 77 | void setSelected( const QString &uid, bool); |
77 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 78 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
78 | void setSelected(); | 79 | void setSelected(); |
79 | 80 | ||
80 | 81 | ||
81 | 82 | ||
82 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 83 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
83 | void refreshView(); | 84 | void refreshView(); |
84 | void refreshView( const QString &uid); | 85 | void refreshView( const QString &uid); |
85 | 86 | ||
86 | void editView(); | 87 | void editView(); |
87 | void deleteView(); | 88 | void deleteView(); |
88 | void addView(); | 89 | void addView(); |
89 | 90 | ||
90 | protected slots: | 91 | protected slots: |
91 | /** | 92 | /** |
92 | Called whenever the user drops something in the active view. | 93 | Called whenever the user drops something in the active view. |
93 | This method will try to decode what was dropped, and if it was | 94 | This method will try to decode what was dropped, and if it was |
94 | a valid addressee, add it to the addressbook. | 95 | a valid addressee, add it to the addressbook. |
95 | */ | 96 | */ |
96 | void dropped( QDropEvent* ); | 97 | void dropped( QDropEvent* ); |
97 | 98 | ||
98 | /** | 99 | /** |
99 | Called whenever the user attempts to start a drag in the view. | 100 | Called whenever the user attempts to start a drag in the view. |
100 | This method will convert all the selected addressees into text (vcard) | 101 | This method will convert all the selected addressees into text (vcard) |
101 | and create a drag object. | 102 | and create a drag object. |
102 | */ | 103 | */ |
103 | void startDrag(); | 104 | void startDrag(); |
104 | 105 | ||
105 | signals: | 106 | signals: |
106 | /** | 107 | /** |
107 | Emitted whenever the user selects an entry in the view. | 108 | Emitted whenever the user selects an entry in the view. |
108 | */ | 109 | */ |
109 | void selected( const QString &uid ); | 110 | void selected( const QString &uid ); |
110 | void deleteRequest( ); | 111 | void deleteRequest( ); |
111 | 112 | ||
112 | /** | 113 | /** |
113 | Emitted whenever the user activates an entry in the view. | 114 | Emitted whenever the user activates an entry in the view. |
114 | */ | 115 | */ |
115 | void executed( const QString &uid ); | 116 | void executed( const QString &uid ); |
116 | 117 | ||
117 | /** | 118 | /** |
118 | Emitted whenever the address book is modified in some way. | 119 | Emitted whenever the address book is modified in some way. |
119 | */ | 120 | */ |
120 | void modified(); | 121 | void modified(); |
121 | 122 | ||
122 | /** | 123 | /** |
123 | Emitted whenever a url is dragged on a view. | 124 | Emitted whenever a url is dragged on a view. |
124 | */ | 125 | */ |
125 | void urlDropped( const KURL& ); | 126 | void urlDropped( const KURL& ); |
126 | 127 | ||
127 | private slots: | 128 | private slots: |
128 | void setActiveView( const QString &name ); | 129 | void setActiveView( const QString &name ); |
129 | void setActiveFilter( int index ); | 130 | void setActiveFilter( int index ); |
130 | void configureFilters(); | 131 | void configureFilters(); |
131 | 132 | ||
132 | private: | 133 | private: |
133 | void createViewFactories(); | 134 | void createViewFactories(); |
134 | QStringList filterNames() const; | 135 | QStringList filterNames() const; |
135 | int filterPosition( const QString &name ) const; | 136 | int filterPosition( const QString &name ) const; |
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 23b091c..e75810e 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -216,128 +216,155 @@ void ContactListViewItem::paintCell(QPainter * p, | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | ContactListView *ContactListViewItem::parent() | 220 | ContactListView *ContactListViewItem::parent() |
221 | { | 221 | { |
222 | return parentListView; | 222 | return parentListView; |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | void ContactListViewItem::refresh() | 226 | void ContactListViewItem::refresh() |
227 | { | 227 | { |
228 | // Update our addressee, since it may have changed else were | 228 | // Update our addressee, since it may have changed else were |
229 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 229 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
230 | if (mAddressee.isEmpty()) | 230 | if (mAddressee.isEmpty()) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | int i = 0; | 233 | int i = 0; |
234 | KABC::Field::List::ConstIterator it; | 234 | KABC::Field::List::ConstIterator it; |
235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
236 | setText( i++, (*it)->value( mAddressee ) ); | 236 | setText( i++, (*it)->value( mAddressee ) ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | /////////////////////////////// | 240 | /////////////////////////////// |
241 | // ContactListView | 241 | // ContactListView |
242 | 242 | ||
243 | ContactListView::ContactListView(KAddressBookTableView *view, | 243 | ContactListView::ContactListView(KAddressBookTableView *view, |
244 | KABC::AddressBook* /* doc */, | 244 | KABC::AddressBook* /* doc */, |
245 | QWidget *parent, | 245 | QWidget *parent, |
246 | const char *name ) | 246 | const char *name ) |
247 | : KListView( parent, name ), | 247 | : KListView( parent, name ), |
248 | pabWidget( view ), | 248 | pabWidget( view ), |
249 | oldColumn( 0 ) | 249 | oldColumn( 0 ) |
250 | { | 250 | { |
251 | mABackground = true; | 251 | mABackground = true; |
252 | mSingleLine = false; | 252 | mSingleLine = false; |
253 | mToolTips = true; | 253 | mToolTips = true; |
254 | #ifndef KAB_EMBEDDED | 254 | #ifndef KAB_EMBEDDED |
255 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); | 255 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); |
256 | #else //KAB_EMBEDDED | 256 | #else //KAB_EMBEDDED |
257 | mAlternateColor = QColor(240, 240, 240); | 257 | mAlternateColor = QColor(240, 240, 240); |
258 | #endif //KAB_EMBEDDED | 258 | #endif //KAB_EMBEDDED |
259 | 259 | ||
260 | setAlternateBackgroundEnabled(mABackground); | 260 | setAlternateBackgroundEnabled(mABackground); |
261 | setAcceptDrops( true ); | 261 | setAcceptDrops( true ); |
262 | viewport()->setAcceptDrops( true ); | 262 | viewport()->setAcceptDrops( true ); |
263 | setAllColumnsShowFocus( true ); | 263 | setAllColumnsShowFocus( true ); |
264 | setShowSortIndicator(true); | 264 | setShowSortIndicator(true); |
265 | 265 | ||
266 | setSelectionModeExt( KListView::Extended ); | 266 | setSelectionModeExt( KListView::Extended ); |
267 | setDropVisualizer(false); | 267 | setDropVisualizer(false); |
268 | // setFrameStyle(QFrame::NoFrame); | 268 | // setFrameStyle(QFrame::NoFrame); |
269 | //setLineWidth ( 0 ); | 269 | //setLineWidth ( 0 ); |
270 | //setMidLineWidth ( 0 ); | 270 | //setMidLineWidth ( 0 ); |
271 | //setMargin ( 0 ); | 271 | //setMargin ( 0 ); |
272 | #ifndef KAB_EMBEDDED | 272 | #ifndef KAB_EMBEDDED |
273 | connect(this, SIGNAL(dropped(QDropEvent*)), | 273 | connect(this, SIGNAL(dropped(QDropEvent*)), |
274 | this, SLOT(itemDropped(QDropEvent*))); | 274 | this, SLOT(itemDropped(QDropEvent*))); |
275 | #endif //KAB_EMBEDDED | 275 | #endif //KAB_EMBEDDED |
276 | 276 | ||
277 | 277 | ||
278 | new DynamicTip( this ); | 278 | new DynamicTip( this ); |
279 | } | 279 | } |
280 | void ContactListView::printMe() | ||
281 | { | ||
282 | #ifdef DESKTOP_VERSION | ||
283 | QPrinter printer; | ||
284 | if (!printer.setup() ) | ||
285 | return; | ||
286 | QPainter p; | ||
287 | p.begin ( &printer ); | ||
288 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
289 | float dx, dy; | ||
290 | int wid = (m.width() * 9)/10; | ||
291 | dx = (float) wid/(float)contentsWidth (); | ||
292 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
293 | float scale; | ||
294 | // scale to fit the width or height of the paper | ||
295 | if ( dx < dy ) | ||
296 | scale = dx; | ||
297 | else | ||
298 | scale = dy; | ||
299 | p.translate( m.width()/10,0 ); | ||
300 | p.scale( scale, scale ); | ||
301 | qDebug("scale %f ", scale); | ||
302 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
303 | p.end(); | ||
304 | qDebug("Why does it not print??? "); | ||
305 | #endif | ||
306 | } | ||
280 | 307 | ||
281 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) | 308 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) |
282 | { | 309 | { |
283 | mAlternateColor = m_AlternateColor; | 310 | mAlternateColor = m_AlternateColor; |
284 | } | 311 | } |
285 | 312 | ||
286 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | 313 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) |
287 | { | 314 | { |
288 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); | 315 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); |
289 | 316 | ||
290 | // Get the brush, which will have the background pixmap if there is one. | 317 | // Get the brush, which will have the background pixmap if there is one. |
291 | if (b.pixmap()) | 318 | if (b.pixmap()) |
292 | { | 319 | { |
293 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), | 320 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), |
294 | *(b.pixmap()), | 321 | *(b.pixmap()), |
295 | rect.left() + contentsX(), | 322 | rect.left() + contentsX(), |
296 | rect.top() + contentsY() ); | 323 | rect.top() + contentsY() ); |
297 | } | 324 | } |
298 | 325 | ||
299 | else | 326 | else |
300 | { | 327 | { |
301 | // Do a normal paint | 328 | // Do a normal paint |
302 | KListView::paintEmptyArea(p, rect); | 329 | KListView::paintEmptyArea(p, rect); |
303 | } | 330 | } |
304 | } | 331 | } |
305 | 332 | ||
306 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) | 333 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) |
307 | { | 334 | { |
308 | presspos = e->pos(); | 335 | presspos = e->pos(); |
309 | KListView::contentsMousePressEvent(e); | 336 | KListView::contentsMousePressEvent(e); |
310 | } | 337 | } |
311 | 338 | ||
312 | 339 | ||
313 | // To initiate a drag operation | 340 | // To initiate a drag operation |
314 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 341 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
315 | { | 342 | { |
316 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 343 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
317 | emit startAddresseeDrag(); | 344 | emit startAddresseeDrag(); |
318 | } | 345 | } |
319 | else | 346 | else |
320 | KListView::contentsMouseMoveEvent( e ); | 347 | KListView::contentsMouseMoveEvent( e ); |
321 | } | 348 | } |
322 | 349 | ||
323 | bool ContactListView::acceptDrag(QDropEvent *e) const | 350 | bool ContactListView::acceptDrag(QDropEvent *e) const |
324 | { | 351 | { |
325 | #ifndef KAB_EMBEDDED | 352 | #ifndef KAB_EMBEDDED |
326 | return QTextDrag::canDecode(e); | 353 | return QTextDrag::canDecode(e); |
327 | #else //KAB_EMBEDDED | 354 | #else //KAB_EMBEDDED |
328 | qDebug("ContactListView::acceptDrag has to be fixed"); | 355 | qDebug("ContactListView::acceptDrag has to be fixed"); |
329 | return false; | 356 | return false; |
330 | #endif //KAB_EMBEDDED | 357 | #endif //KAB_EMBEDDED |
331 | } | 358 | } |
332 | 359 | ||
333 | void ContactListView::itemDropped(QDropEvent *e) | 360 | void ContactListView::itemDropped(QDropEvent *e) |
334 | { | 361 | { |
335 | contentsDropEvent(e); | 362 | contentsDropEvent(e); |
336 | } | 363 | } |
337 | 364 | ||
338 | void ContactListView::contentsDropEvent( QDropEvent *e ) | 365 | void ContactListView::contentsDropEvent( QDropEvent *e ) |
339 | { | 366 | { |
340 | emit addresseeDropped(e); | 367 | emit addresseeDropped(e); |
341 | } | 368 | } |
342 | 369 | ||
343 | void ContactListView::setAlternateBackgroundEnabled(bool enabled) | 370 | void ContactListView::setAlternateBackgroundEnabled(bool enabled) |
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h index fad7f38..9d1a672 100644 --- a/kaddressbook/views/contactlistview.h +++ b/kaddressbook/views/contactlistview.h | |||
@@ -44,86 +44,87 @@ public: | |||
44 | 44 | ||
45 | /** Adds the border around the cell if the user wants it. | 45 | /** Adds the border around the cell if the user wants it. |
46 | * This is how the single line config option is implemented. | 46 | * This is how the single line config option is implemented. |
47 | */ | 47 | */ |
48 | virtual void paintCell(QPainter * p, const QColorGroup & cg, | 48 | virtual void paintCell(QPainter * p, const QColorGroup & cg, |
49 | int column, int width, int align ); | 49 | int column, int width, int align ); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | KABC::Addressee mAddressee; | 52 | KABC::Addressee mAddressee; |
53 | KABC::Field::List mFields; | 53 | KABC::Field::List mFields; |
54 | ContactListView *parentListView; | 54 | ContactListView *parentListView; |
55 | KABC::AddressBook *mDocument; | 55 | KABC::AddressBook *mDocument; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | 58 | ||
59 | ///////////////////////////////////////////// | 59 | ///////////////////////////////////////////// |
60 | // ContactListView | 60 | // ContactListView |
61 | 61 | ||
62 | class ContactListView : public KListView | 62 | class ContactListView : public KListView |
63 | { | 63 | { |
64 | Q_OBJECT | 64 | Q_OBJECT |
65 | 65 | ||
66 | public: | 66 | public: |
67 | ContactListView(KAddressBookTableView *view, | 67 | ContactListView(KAddressBookTableView *view, |
68 | KABC::AddressBook *doc, | 68 | KABC::AddressBook *doc, |
69 | QWidget *parent, | 69 | QWidget *parent, |
70 | const char *name = 0L ); | 70 | const char *name = 0L ); |
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 | /** Paints the background pixmap in the empty area. This method is needed | 95 | /** Paints the background pixmap in the empty area. This method is needed |
96 | * since Qt::FixedPixmap will not scroll with the list view. | 96 | * since Qt::FixedPixmap will not scroll with the list view. |
97 | */ | 97 | */ |
98 | virtual void paintEmptyArea( QPainter * p, const QRect & rect ); | 98 | virtual void paintEmptyArea( QPainter * p, const QRect & rect ); |
99 | virtual void contentsMousePressEvent(QMouseEvent*); | 99 | virtual void contentsMousePressEvent(QMouseEvent*); |
100 | void contentsMouseMoveEvent( QMouseEvent *e ); | 100 | void contentsMouseMoveEvent( QMouseEvent *e ); |
101 | void contentsDropEvent( QDropEvent *e ); | 101 | void contentsDropEvent( QDropEvent *e ); |
102 | virtual bool acceptDrag(QDropEvent *e) const; | 102 | virtual bool acceptDrag(QDropEvent *e) const; |
103 | 103 | ||
104 | protected slots: | 104 | protected slots: |
105 | void itemDropped(QDropEvent *e); | 105 | void itemDropped(QDropEvent *e); |
106 | 106 | ||
107 | public slots: | 107 | public slots: |
108 | void printMe(); | ||
108 | 109 | ||
109 | signals: | 110 | signals: |
110 | void startAddresseeDrag(); | 111 | void startAddresseeDrag(); |
111 | void addresseeDropped(QDropEvent *); | 112 | void addresseeDropped(QDropEvent *); |
112 | 113 | ||
113 | private: | 114 | private: |
114 | KAddressBookTableView *pabWidget; | 115 | KAddressBookTableView *pabWidget; |
115 | int oldColumn; | 116 | int oldColumn; |
116 | int column; | 117 | int column; |
117 | bool ascending; | 118 | bool ascending; |
118 | 119 | ||
119 | bool mABackground; | 120 | bool mABackground; |
120 | bool mSingleLine; | 121 | bool mSingleLine; |
121 | bool mToolTips; | 122 | bool mToolTips; |
122 | 123 | ||
123 | QColor mAlternateColor; | 124 | QColor mAlternateColor; |
124 | 125 | ||
125 | QPoint presspos; | 126 | QPoint presspos; |
126 | }; | 127 | }; |
127 | 128 | ||
128 | 129 | ||
129 | #endif | 130 | #endif |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2d7ed08..107be59 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -1,230 +1,259 @@ | |||
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 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kabc/addressee.h> | 33 | #include <kabc/addressee.h> |
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | 37 | ||
38 | #include "kabprefs.h" | 38 | #include "kabprefs.h" |
39 | #include "viewmanager.h" | 39 | #include "viewmanager.h" |
40 | 40 | ||
41 | |||
41 | #include "kaddressbookcardview.h" | 42 | #include "kaddressbookcardview.h" |
42 | 43 | ||
43 | #ifndef KAB_EMBEDDED | 44 | #ifndef KAB_EMBEDDED |
44 | extern "C" { | 45 | extern "C" { |
45 | void *init_libkaddrbk_cardview() | 46 | void *init_libkaddrbk_cardview() |
46 | { | 47 | { |
47 | return ( new CardViewFactory ); | 48 | return ( new CardViewFactory ); |
48 | } | 49 | } |
49 | } | 50 | } |
50 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
51 | 52 | ||
52 | //////////////////////////////// | 53 | //////////////////////////////// |
53 | // AddresseeCardViewItem (internal class) | 54 | // AddresseeCardViewItem (internal class) |
54 | class AddresseeCardViewItem : public CardViewItem | 55 | class AddresseeCardViewItem : public CardViewItem |
55 | { | 56 | { |
56 | public: | 57 | public: |
57 | AddresseeCardViewItem(const KABC::Field::List &fields, | 58 | AddresseeCardViewItem(const KABC::Field::List &fields, |
58 | bool showEmptyFields, | 59 | bool showEmptyFields, |
59 | KABC::AddressBook *doc, const KABC::Addressee &a, | 60 | KABC::AddressBook *doc, const KABC::Addressee &a, |
60 | CardView *parent) | 61 | CardView *parent) |
61 | : CardViewItem(parent, a.formattedName()), | 62 | : CardViewItem(parent, a.formattedName()), |
62 | mFields( fields ), mShowEmptyFields(showEmptyFields), | 63 | mFields( fields ), mShowEmptyFields(showEmptyFields), |
63 | mDocument(doc), mAddressee(a) | 64 | mDocument(doc), mAddressee(a) |
64 | { | 65 | { |
65 | if ( mFields.isEmpty() ) { | 66 | if ( mFields.isEmpty() ) { |
66 | mFields = KABC::Field::defaultFields(); | 67 | mFields = KABC::Field::defaultFields(); |
67 | } | 68 | } |
68 | refresh(); | 69 | refresh(); |
69 | } | 70 | } |
70 | 71 | ||
71 | const KABC::Addressee &addressee() const { return mAddressee; } | 72 | const KABC::Addressee &addressee() const { return mAddressee; } |
72 | 73 | ||
73 | void refresh() | 74 | void refresh() |
74 | { | 75 | { |
75 | // Update our addressee, since it may have changed elsewhere | 76 | // Update our addressee, since it may have changed elsewhere |
76 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 77 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
77 | 78 | ||
78 | if (!mAddressee.isEmpty()) | 79 | if (!mAddressee.isEmpty()) |
79 | { | 80 | { |
80 | clearFields(); | 81 | clearFields(); |
81 | 82 | ||
82 | // Try all the selected fields until we find one with text. | 83 | // Try all the selected fields until we find one with text. |
83 | // This will limit the number of unlabeled icons in the view | 84 | // This will limit the number of unlabeled icons in the view |
84 | KABC::Field::List::Iterator iter; | 85 | KABC::Field::List::Iterator iter; |
85 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) | 86 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) |
86 | { | 87 | { |
87 | // insert empty fields or not? not doing so saves a bit of memory and CPU | 88 | // insert empty fields or not? not doing so saves a bit of memory and CPU |
88 | // (during geometry calculations), but prevents having equally | 89 | // (during geometry calculations), but prevents having equally |
89 | // wide label columns in all cards, unless CardViewItem/CardView search | 90 | // wide label columns in all cards, unless CardViewItem/CardView search |
90 | // globally for the widest label. (anders) | 91 | // globally for the widest label. (anders) |
91 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) | 92 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) |
92 | insertField((*iter)->label(), (*iter)->value( mAddressee )); | 93 | insertField((*iter)->label(), (*iter)->value( mAddressee )); |
93 | } | 94 | } |
94 | 95 | ||
95 | // We might want to make this the first field. hmm... -mpilone | 96 | // We might want to make this the first field. hmm... -mpilone |
96 | setCaption( mAddressee.realName() ); | 97 | setCaption( mAddressee.realName() ); |
97 | } | 98 | } |
98 | } | 99 | } |
99 | 100 | ||
100 | private: | 101 | private: |
101 | KABC::Field::List mFields; | 102 | KABC::Field::List mFields; |
102 | bool mShowEmptyFields; | 103 | bool mShowEmptyFields; |
103 | KABC::AddressBook *mDocument; | 104 | KABC::AddressBook *mDocument; |
104 | KABC::Addressee mAddressee; | 105 | KABC::Addressee mAddressee; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | /////////////////////////////// | 108 | /////////////////////////////// |
108 | // AddresseeCardView | 109 | // AddresseeCardView |
109 | 110 | ||
110 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) | 111 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) |
111 | : CardView(parent, name) | 112 | : CardView(parent, name) |
112 | { | 113 | { |
113 | setAcceptDrops(true); | 114 | setAcceptDrops(true); |
114 | } | 115 | } |
115 | 116 | ||
116 | AddresseeCardView::~AddresseeCardView() | 117 | AddresseeCardView::~AddresseeCardView() |
117 | { | 118 | { |
118 | } | 119 | } |
120 | void AddresseeCardView::printMe() | ||
121 | { | ||
122 | #ifdef DESKTOP_VERSION | ||
123 | QPrinter printer; | ||
124 | if (!printer.setup() ) | ||
125 | return; | ||
126 | QPainter p; | ||
127 | p.begin ( &printer ); | ||
128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | ||
129 | float dx, dy; | ||
130 | int wid = (m.width() * 9)/10; | ||
131 | dx = (float) wid/(float)contentsWidth (); | ||
132 | dy = (float)(m.height()) / (float)contentsHeight (); | ||
133 | float scale; | ||
134 | // scale to fit the width or height of the paper | ||
135 | if ( dx < dy ) | ||
136 | scale = dx; | ||
137 | else | ||
138 | scale = dy; | ||
139 | p.translate( m.width()/10,0 ); | ||
140 | p.scale( scale, scale ); | ||
141 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | ||
142 | p.end(); | ||
143 | repaint(); | ||
144 | #endif | ||
145 | } | ||
119 | 146 | ||
120 | 147 | ||
121 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) | 148 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) |
122 | { | 149 | { |
123 | #ifndef KAB_EMBEDDED | 150 | #ifndef KAB_EMBEDDED |
124 | if (QTextDrag::canDecode(e)) | 151 | if (QTextDrag::canDecode(e)) |
125 | e->accept(); | 152 | e->accept(); |
126 | #else //KAB_EMBEDDED | 153 | #else //KAB_EMBEDDED |
127 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); | 154 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); |
128 | #endif //KAB_EMBEDDED | 155 | #endif //KAB_EMBEDDED |
129 | } | 156 | } |
130 | 157 | ||
131 | void AddresseeCardView::dropEvent(QDropEvent *e) | 158 | void AddresseeCardView::dropEvent(QDropEvent *e) |
132 | { | 159 | { |
133 | emit addresseeDropped(e); | 160 | emit addresseeDropped(e); |
134 | } | 161 | } |
135 | 162 | ||
136 | void AddresseeCardView::startDrag() | 163 | void AddresseeCardView::startDrag() |
137 | { | 164 | { |
138 | emit startAddresseeDrag(); | 165 | emit startAddresseeDrag(); |
139 | } | 166 | } |
140 | 167 | ||
141 | 168 | ||
142 | /////////////////////////////// | 169 | /////////////////////////////// |
143 | // KAddressBookCardView | 170 | // KAddressBookCardView |
144 | 171 | ||
145 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 172 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
146 | QWidget *parent, const char *name ) | 173 | QWidget *parent, const char *name ) |
147 | : KAddressBookView( ab, parent, name ) | 174 | : KAddressBookView( ab, parent, name ) |
148 | { | 175 | { |
149 | mShowEmptyFields = false; | 176 | mShowEmptyFields = false; |
150 | 177 | ||
151 | // Init the GUI | 178 | // Init the GUI |
152 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 179 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
153 | 180 | ||
154 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 181 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
155 | mCardView->setSelectionMode(CardView::Extended); | 182 | mCardView->setSelectionMode(CardView::Extended); |
156 | layout->addWidget(mCardView); | 183 | layout->addWidget(mCardView); |
157 | 184 | ||
158 | // Connect up the signals | 185 | // Connect up the signals |
159 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 186 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
160 | this, SLOT(addresseeExecuted(CardViewItem *))); | 187 | this, SLOT(addresseeExecuted(CardViewItem *))); |
161 | connect(mCardView, SIGNAL(selectionChanged()), | 188 | connect(mCardView, SIGNAL(selectionChanged()), |
162 | this, SLOT(addresseeSelected())); | 189 | this, SLOT(addresseeSelected())); |
163 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
164 | this, SIGNAL(dropped(QDropEvent*))); | 191 | this, SIGNAL(dropped(QDropEvent*))); |
165 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 192 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
166 | this, SIGNAL(startDrag())); | 193 | this, SIGNAL(startDrag())); |
194 | connect(this, SIGNAL(printView()), | ||
195 | mCardView , SLOT(printMe())); | ||
167 | } | 196 | } |
168 | 197 | ||
169 | KAddressBookCardView::~KAddressBookCardView() | 198 | KAddressBookCardView::~KAddressBookCardView() |
170 | { | 199 | { |
171 | } | 200 | } |
172 | void KAddressBookCardView::setFocusAV() | 201 | void KAddressBookCardView::setFocusAV() |
173 | { | 202 | { |
174 | if ( mCardView ) | 203 | if ( mCardView ) |
175 | mCardView->setFocus(); | 204 | mCardView->setFocus(); |
176 | 205 | ||
177 | } | 206 | } |
178 | void KAddressBookCardView::scrollUP() | 207 | void KAddressBookCardView::scrollUP() |
179 | { | 208 | { |
180 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 209 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
181 | QApplication::postEvent( mCardView, ev ); | 210 | QApplication::postEvent( mCardView, ev ); |
182 | 211 | ||
183 | } | 212 | } |
184 | void KAddressBookCardView::scrollDOWN() | 213 | void KAddressBookCardView::scrollDOWN() |
185 | { | 214 | { |
186 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 215 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
187 | QApplication::postEvent( mCardView, ev ); | 216 | QApplication::postEvent( mCardView, ev ); |
188 | } | 217 | } |
189 | void KAddressBookCardView::readConfig(KConfig *config) | 218 | void KAddressBookCardView::readConfig(KConfig *config) |
190 | { | 219 | { |
191 | KAddressBookView::readConfig(config); | 220 | KAddressBookView::readConfig(config); |
192 | 221 | ||
193 | // costum colors? | 222 | // costum colors? |
194 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 223 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
195 | { | 224 | { |
196 | QPalette p( mCardView->palette() ); | 225 | QPalette p( mCardView->palette() ); |
197 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 226 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
198 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 227 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
199 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 228 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
200 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 229 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
201 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 230 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
202 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 231 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
203 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 232 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
204 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 233 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
205 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 234 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
206 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 235 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
207 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 236 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
208 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 237 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
209 | mCardView->viewport()->setPalette( p ); | 238 | mCardView->viewport()->setPalette( p ); |
210 | } | 239 | } |
211 | else | 240 | else |
212 | { | 241 | { |
213 | // needed if turned off during a session. | 242 | // needed if turned off during a session. |
214 | mCardView->viewport()->setPalette( mCardView->palette() ); | 243 | mCardView->viewport()->setPalette( mCardView->palette() ); |
215 | } | 244 | } |
216 | 245 | ||
217 | //custom fonts? | 246 | //custom fonts? |
218 | QFont f( font() ); | 247 | QFont f( font() ); |
219 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 248 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
220 | { | 249 | { |
221 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); | 250 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); |
222 | f.setBold( true ); | 251 | f.setBold( true ); |
223 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 252 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
224 | } | 253 | } |
225 | else | 254 | else |
226 | { | 255 | { |
227 | mCardView->setFont( f ); | 256 | mCardView->setFont( f ); |
228 | f.setBold( true ); | 257 | f.setBold( true ); |
229 | mCardView->setHeaderFont( f ); | 258 | mCardView->setHeaderFont( f ); |
230 | } | 259 | } |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 8f22d54..2a71f7e 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -24,97 +24,99 @@ | |||
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #ifndef KAB_EMBEDDED | 28 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 29 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 30 | #else //KAB_EMBEDDED |
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(); | 63 | virtual void scrollUP(); |
64 | virtual void scrollDOWN(); | 64 | virtual void scrollDOWN(); |
65 | virtual void setFocusAV(); | 65 | virtual void setFocusAV(); |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void refresh(QString uid = QString::null); | 68 | void refresh(QString uid = QString::null); |
69 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); | 69 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); |
70 | //US added an additional method without parameter | 70 | //US added an additional method without parameter |
71 | void setSelected(); | 71 | void setSelected(); |
72 | 72 | ||
73 | protected slots: | 73 | protected slots: |
74 | void addresseeExecuted(CardViewItem *item); | 74 | void addresseeExecuted(CardViewItem *item); |
75 | void addresseeSelected(); | 75 | void addresseeSelected(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | AddresseeCardView *mCardView; | 78 | AddresseeCardView *mCardView; |
79 | bool mShowEmptyFields; | 79 | bool mShowEmptyFields; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | class AddresseeCardView : public CardView | 82 | class AddresseeCardView : public CardView |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | AddresseeCardView(QWidget *parent, const char *name = 0); | 86 | AddresseeCardView(QWidget *parent, const char *name = 0); |
87 | ~AddresseeCardView(); | 87 | ~AddresseeCardView(); |
88 | public slots: | ||
89 | void printMe(); | ||
88 | 90 | ||
89 | signals: | 91 | signals: |
90 | void startAddresseeDrag(); | 92 | void startAddresseeDrag(); |
91 | void addresseeDropped(QDropEvent *); | 93 | void addresseeDropped(QDropEvent *); |
92 | 94 | ||
93 | protected: | 95 | protected: |
94 | virtual void dragEnterEvent(QDragEnterEvent *); | 96 | virtual void dragEnterEvent(QDragEnterEvent *); |
95 | virtual void dropEvent(QDropEvent *); | 97 | virtual void dropEvent(QDropEvent *); |
96 | virtual void startDrag(); | 98 | virtual void startDrag(); |
97 | }; | 99 | }; |
98 | 100 | ||
99 | 101 | ||
100 | class CardViewFactory : public ViewFactory | 102 | class CardViewFactory : public ViewFactory |
101 | { | 103 | { |
102 | public: | 104 | public: |
103 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 105 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
104 | { | 106 | { |
105 | return new KAddressBookCardView( ab, parent, name ); | 107 | return new KAddressBookCardView( ab, parent, name ); |
106 | } | 108 | } |
107 | 109 | ||
108 | QString type() const { return "Card"; } | 110 | QString type() const { return "Card"; } |
109 | 111 | ||
110 | QString description() const { return i18n( "Rolodex style cards represent contacts." ); } | 112 | QString description() const { return i18n( "Rolodex style cards represent contacts." ); } |
111 | 113 | ||
112 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, | 114 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, |
113 | const char *name = 0 ) | 115 | const char *name = 0 ) |
114 | { | 116 | { |
115 | return new ConfigureCardViewWidget( ab, parent, name ); | 117 | return new ConfigureCardViewWidget( ab, parent, name ); |
116 | } | 118 | } |
117 | }; | 119 | }; |
118 | 120 | ||
119 | 121 | ||
120 | #endif | 122 | #endif |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 61703ee..ecd6f05 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -28,128 +28,130 @@ | |||
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 | 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 | } | 64 | } |
65 | void KAddressBookTableView::scrollDOWN() | 65 | void KAddressBookTableView::scrollDOWN() |
66 | { | 66 | { |
67 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 67 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
68 | QApplication::postEvent( mListView, ev ); | 68 | QApplication::postEvent( mListView, ev ); |
69 | } | 69 | } |
70 | void KAddressBookTableView::reconstructListView() | 70 | void KAddressBookTableView::reconstructListView() |
71 | { | 71 | { |
72 | if (mListView) | 72 | if (mListView) |
73 | { | 73 | { |
74 | disconnect(mListView, SIGNAL(selectionChanged()), | 74 | disconnect(mListView, SIGNAL(selectionChanged()), |
75 | this, SLOT(addresseeSelected())); | 75 | this, SLOT(addresseeSelected())); |
76 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 76 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), |
77 | this, SLOT(addresseeExecuted(QListViewItem*))); | 77 | this, SLOT(addresseeExecuted(QListViewItem*))); |
78 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 78 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
79 | this, SLOT(addresseeExecuted(QListViewItem*))); | 79 | this, SLOT(addresseeExecuted(QListViewItem*))); |
80 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 80 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
81 | SIGNAL(startDrag())); | 81 | SIGNAL(startDrag())); |
82 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 82 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
83 | this, SLOT(addresseeExecuted(QListViewItem*))); | 83 | this, SLOT(addresseeExecuted(QListViewItem*))); |
84 | 84 | ||
85 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 85 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
86 | SIGNAL(dropped(QDropEvent*))); | 86 | SIGNAL(dropped(QDropEvent*))); |
87 | delete mListView; | 87 | delete mListView; |
88 | } | 88 | } |
89 | 89 | ||
90 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 90 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
91 | 91 | ||
92 | connect(this, SIGNAL(printView()), | ||
93 | mListView , SLOT(printMe())); | ||
92 | //US set singleClick manually, because it is no global configparameter in embedded space | 94 | //US set singleClick manually, because it is no global configparameter in embedded space |
93 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); | 95 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); |
94 | 96 | ||
95 | // Add the columns | 97 | // Add the columns |
96 | KABC::Field::List fieldList = fields(); | 98 | KABC::Field::List fieldList = fields(); |
97 | KABC::Field::List::ConstIterator it; | 99 | KABC::Field::List::ConstIterator it; |
98 | 100 | ||
99 | int c = 0; | 101 | int c = 0; |
100 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 102 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
101 | mListView->addColumn( (*it)->label() ); | 103 | mListView->addColumn( (*it)->label() ); |
102 | mListView->setColumnWidthMode(c++, QListView::Manual); | 104 | mListView->setColumnWidthMode(c++, QListView::Manual); |
103 | //US | 105 | //US |
104 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 106 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
105 | } | 107 | } |
106 | 108 | ||
107 | connect(mListView, SIGNAL(selectionChanged()), | 109 | connect(mListView, SIGNAL(selectionChanged()), |
108 | this, SLOT(addresseeSelected())); | 110 | this, SLOT(addresseeSelected())); |
109 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 111 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
110 | SIGNAL(startDrag())); | 112 | SIGNAL(startDrag())); |
111 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 113 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
112 | SIGNAL(dropped(QDropEvent*))); | 114 | SIGNAL(dropped(QDropEvent*))); |
113 | 115 | ||
114 | if (KABPrefs::instance()->mHonorSingleClick) { | 116 | if (KABPrefs::instance()->mHonorSingleClick) { |
115 | // qDebug("KAddressBookTableView::reconstructListView single"); | 117 | // qDebug("KAddressBookTableView::reconstructListView single"); |
116 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 118 | connect(mListView, SIGNAL(executed(QListViewItem*)), |
117 | this, SLOT(addresseeExecuted(QListViewItem*))); | 119 | this, SLOT(addresseeExecuted(QListViewItem*))); |
118 | } else { | 120 | } else { |
119 | // qDebug("KAddressBookTableView::reconstructListView double"); | 121 | // qDebug("KAddressBookTableView::reconstructListView double"); |
120 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 122 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
121 | this, SLOT(addresseeExecuted(QListViewItem*))); | 123 | this, SLOT(addresseeExecuted(QListViewItem*))); |
122 | } | 124 | } |
123 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 125 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
124 | this, SLOT(addresseeExecuted(QListViewItem*))); | 126 | this, SLOT(addresseeExecuted(QListViewItem*))); |
125 | connect(mListView, SIGNAL(signalDelete()), | 127 | connect(mListView, SIGNAL(signalDelete()), |
126 | this, SLOT(addresseeDeleted())); | 128 | this, SLOT(addresseeDeleted())); |
127 | 129 | ||
128 | //US performceimprovement. Refresh is done from the outside | 130 | //US performceimprovement. Refresh is done from the outside |
129 | //US refresh(); | 131 | //US refresh(); |
130 | 132 | ||
131 | mListView->setSorting( 0, true ); | 133 | mListView->setSorting( 0, true ); |
132 | mainLayout->addWidget( mListView ); | 134 | mainLayout->addWidget( mListView ); |
133 | mainLayout->activate(); | 135 | mainLayout->activate(); |
134 | mListView->show(); | 136 | mListView->show(); |
135 | } | 137 | } |
136 | 138 | ||
137 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 139 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
138 | { | 140 | { |
139 | mListView->clear(); | 141 | mListView->clear(); |
140 | if ( s.isEmpty() || s == "*" ) { | 142 | if ( s.isEmpty() || s == "*" ) { |
141 | refresh(); | 143 | refresh(); |
142 | return; | 144 | return; |
143 | } | 145 | } |
144 | QString pattern = s.lower()+"*"; | 146 | QString pattern = s.lower()+"*"; |
145 | QRegExp re; | 147 | QRegExp re; |
146 | re.setWildcard(true); // most people understand these better. | 148 | re.setWildcard(true); // most people understand these better. |
147 | re.setCaseSensitive(false); | 149 | re.setCaseSensitive(false); |
148 | re.setPattern( pattern ); | 150 | re.setPattern( pattern ); |
149 | if (!re.isValid()) | 151 | if (!re.isValid()) |
150 | return; | 152 | return; |
151 | KABC::Addressee::List addresseeList = addressees(); | 153 | KABC::Addressee::List addresseeList = addressees(); |
152 | KABC::Addressee::List::Iterator it; | 154 | KABC::Addressee::List::Iterator it; |
153 | if ( field ) { | 155 | if ( field ) { |
154 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
155 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 8d40ffe..89a2626 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -167,76 +167,76 @@ void XXPortManager::slotExport( const QString &identifier, const QString &data ) | |||
167 | else | 167 | else |
168 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); | 168 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); |
169 | } | 169 | } |
170 | 170 | ||
171 | void XXPortManager::loadPlugins() | 171 | void XXPortManager::loadPlugins() |
172 | { | 172 | { |
173 | mXXPortObjects.clear(); | 173 | mXXPortObjects.clear(); |
174 | 174 | ||
175 | #ifndef KAB_EMBEDDED | 175 | #ifndef KAB_EMBEDDED |
176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); | 176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); |
177 | KTrader::OfferList::ConstIterator it; | 177 | KTrader::OfferList::ConstIterator it; |
178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
179 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) | 179 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) |
180 | continue; | 180 | continue; |
181 | 181 | ||
182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
183 | if ( !factory ) { | 183 | if ( !factory ) { |
184 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; | 184 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; |
185 | continue; | 185 | continue; |
186 | } | 186 | } |
187 | 187 | ||
188 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 188 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
189 | 189 | ||
190 | if ( !xxportFactory ) { | 190 | if ( !xxportFactory ) { |
191 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; | 191 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; |
192 | continue; | 192 | continue; |
193 | } | 193 | } |
194 | 194 | ||
195 | #else //KAB_EMBEDDED | 195 | #else //KAB_EMBEDDED |
196 | QList<XXPortFactory> factorylist; | 196 | QList<XXPortFactory> factorylist; |
197 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); | 197 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); |
198 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); | 198 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); |
199 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); | 199 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); |
200 | //US factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); | 200 | //US factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); |
201 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); | 201 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); |
202 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); | 202 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); |
203 | 203 | ||
204 | QListIterator<XXPortFactory> it(factorylist); | 204 | QListIterator<XXPortFactory> it(factorylist); |
205 | for ( ; it.current(); ++it ) | 205 | for ( ; it.current(); ++it ) |
206 | { | 206 | { |
207 | XXPortFactory *xxportFactory = it.current(); | 207 | XXPortFactory *xxportFactory = it.current(); |
208 | #endif //KAB_EMBEDDED | 208 | #endif //KAB_EMBEDDED |
209 | 209 | ||
210 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); | 210 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); |
211 | if ( obj ) { | 211 | if ( obj ) { |
212 | mCore->addGUIClient( obj ); | 212 | mCore->addGUIClient( obj ); |
213 | mXXPortObjects.insert( obj->identifier(), obj ); | 213 | mXXPortObjects.insert( obj->identifier(), obj ); |
214 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), | 214 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), |
215 | this, SLOT( slotExport( const QString&, const QString& ) ) ); | 215 | this, SLOT( slotExport( const QString&, const QString& ) ) ); |
216 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), | 216 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), |
217 | this, SLOT( slotImport( const QString&, const QString& ) ) ); | 217 | this, SLOT( slotImport( const QString&, const QString& ) ) ); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | 223 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, |
224 | const char *name ) | 224 | const char *name ) |
225 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, | 225 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, |
226 | name, true, true ) | 226 | name, true, true ) |
227 | { | 227 | { |
228 | QWidget *page = plainPage(); | 228 | QWidget *page = plainPage(); |
229 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); | 229 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); |
230 | 230 | ||
231 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); | 231 | KABC::AddresseeView *view = new KABC::AddresseeView( page ); |
232 | view->setAddressee( addr ); | 232 | view->setAddressee( addr ); |
233 | 233 | ||
234 | layout->addWidget( view ); | 234 | layout->addWidget( view ); |
235 | 235 | ||
236 | resize( 400, 300 ); | 236 | resize( 400, 300 ); |
237 | } | 237 | } |
238 | 238 | ||
239 | #ifndef KAB_EMBEDDED | 239 | #ifndef KAB_EMBEDDED |
240 | #include "xxportmanager.moc" | 240 | #include "xxportmanager.moc" |
241 | #endif //KAB_EMBEDDED | 241 | #endif //KAB_EMBEDDED |
242 | 242 | ||