-rw-r--r-- | kaddressbook/kabcore.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 70ab6b7..7bf1a2f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -62,192 +62,198 @@ | |||
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include "KDGanttMinimizeSplitter.h" | 66 | #include "KDGanttMinimizeSplitter.h" |
67 | #include "kaddressbookmain.h" | 67 | #include "kaddressbookmain.h" |
68 | #include "kactioncollection.h" | 68 | #include "kactioncollection.h" |
69 | #include <qapp.h> | 69 | #include <qapp.h> |
70 | #include <qmenubar.h> | 70 | #include <qmenubar.h> |
71 | //#include <qtoolbar.h> | 71 | //#include <qtoolbar.h> |
72 | #include <qmessagebox.h> | 72 | #include <qmessagebox.h> |
73 | #include <kdebug.h> | 73 | #include <kdebug.h> |
74 | #include <kiconloader.h> // needed for SmallIcon | 74 | #include <kiconloader.h> // needed for SmallIcon |
75 | #include <kresources/kcmkresources.h> | 75 | #include <kresources/kcmkresources.h> |
76 | #include <ktoolbar.h> | 76 | #include <ktoolbar.h> |
77 | 77 | ||
78 | #include <kcmkabconfig.h> | 78 | #include <kcmkabconfig.h> |
79 | 79 | ||
80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | 80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap |
81 | //#include <qlabel.h> | 81 | //#include <qlabel.h> |
82 | #endif // KAB_EMBEDDED | 82 | #endif // KAB_EMBEDDED |
83 | #include <kcmkabconfig.h> | 83 | #include <kcmkabconfig.h> |
84 | 84 | ||
85 | 85 | ||
86 | #include <kresources/selectdialog.h> | 86 | #include <kresources/selectdialog.h> |
87 | #include <kmessagebox.h> | 87 | #include <kmessagebox.h> |
88 | 88 | ||
89 | #include <picture.h> | 89 | #include <picture.h> |
90 | #include <resource.h> | 90 | #include <resource.h> |
91 | 91 | ||
92 | //US#include <qsplitter.h> | 92 | //US#include <qsplitter.h> |
93 | #include <qvbox.h> | 93 | #include <qvbox.h> |
94 | #include <qlayout.h> | 94 | #include <qlayout.h> |
95 | #include <qclipboard.h> | 95 | #include <qclipboard.h> |
96 | 96 | ||
97 | #include <libkdepim/categoryselectdialog.h> | 97 | #include <libkdepim/categoryselectdialog.h> |
98 | 98 | ||
99 | #include "addresseeutil.h" | 99 | #include "addresseeutil.h" |
100 | #include "undocmds.h" | 100 | #include "undocmds.h" |
101 | #include "addresseeeditordialog.h" | 101 | #include "addresseeeditordialog.h" |
102 | #include "viewmanager.h" | 102 | #include "viewmanager.h" |
103 | #include "details/detailsviewcontainer.h" | 103 | #include "details/detailsviewcontainer.h" |
104 | #include "kabprefs.h" | 104 | #include "kabprefs.h" |
105 | #include "xxportmanager.h" | 105 | #include "xxportmanager.h" |
106 | #include "incsearchwidget.h" | 106 | #include "incsearchwidget.h" |
107 | #include "jumpbuttonbar.h" | 107 | #include "jumpbuttonbar.h" |
108 | #include "extensionmanager.h" | 108 | #include "extensionmanager.h" |
109 | #include "addresseeconfig.h" | 109 | #include "addresseeconfig.h" |
110 | #include <kcmultidialog.h> | 110 | #include <kcmultidialog.h> |
111 | 111 | ||
112 | 112 | ||
113 | #ifdef KAB_EMBEDDED | 113 | #ifdef KAB_EMBEDDED |
114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
118 | #else //KAB_EMBEDDED | 118 | #else //KAB_EMBEDDED |
119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
122 | mReadWrite( readWrite ), mModified( false ) | 122 | mReadWrite( readWrite ), mModified( false ) |
123 | #endif //KAB_EMBEDDED | 123 | #endif //KAB_EMBEDDED |
124 | { | 124 | { |
125 | #ifdef KAB_EMBEDDED | 125 | #ifdef KAB_EMBEDDED |
126 | //US we define here our own global actioncollection. | 126 | //US we define here our own global actioncollection. |
127 | //mActionCollection = new KActionCollection(this); | 127 | //mActionCollection = new KActionCollection(this); |
128 | #endif //KAB_EMBEDDED | 128 | #endif //KAB_EMBEDDED |
129 | mExtensionBarSplitter = 0; | 129 | mExtensionBarSplitter = 0; |
130 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 130 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
131 | 131 | ||
132 | mAddressBook = KABC::StdAddressBook::self(); | 132 | mAddressBook = KABC::StdAddressBook::self(); |
133 | KABC::StdAddressBook::setAutomaticSave( true ); | 133 | KABC::StdAddressBook::setAutomaticSave( true ); |
134 | 134 | ||
135 | #ifndef KAB_EMBEDDED | 135 | #ifndef KAB_EMBEDDED |
136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
137 | #endif //KAB_EMBEDDED | 137 | #endif //KAB_EMBEDDED |
138 | 138 | ||
139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
140 | SLOT( addressBookChanged() ) ); | 140 | SLOT( addressBookChanged() ) ); |
141 | 141 | ||
142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
143 | "X-Department", "KADDRESSBOOK" ); | 143 | "X-Department", "KADDRESSBOOK" ); |
144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
145 | "X-Profession", "KADDRESSBOOK" ); | 145 | "X-Profession", "KADDRESSBOOK" ); |
146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
147 | "X-AssistantsName", "KADDRESSBOOK" ); | 147 | "X-AssistantsName", "KADDRESSBOOK" ); |
148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
149 | "X-ManagersName", "KADDRESSBOOK" ); | 149 | "X-ManagersName", "KADDRESSBOOK" ); |
150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
151 | "X-SpousesName", "KADDRESSBOOK" ); | 151 | "X-SpousesName", "KADDRESSBOOK" ); |
152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
153 | "X-Office", "KADDRESSBOOK" ); | 153 | "X-Office", "KADDRESSBOOK" ); |
154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
155 | "X-IMAddress", "KADDRESSBOOK" ); | 155 | "X-IMAddress", "KADDRESSBOOK" ); |
156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
157 | "X-Anniversary", "KADDRESSBOOK" ); | 157 | "X-Anniversary", "KADDRESSBOOK" ); |
158 | |||
159 | //US added this field to become compatible with Opie addressbook | ||
160 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | ||
161 | "X-Gender", "KADDRESSBOOK" ); | ||
162 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | ||
163 | "X-Children", "KADDRESSBOOK" ); | ||
158 | 164 | ||
159 | initGUI(); | 165 | initGUI(); |
160 | 166 | ||
161 | mIncSearchWidget->setFocus(); | 167 | mIncSearchWidget->setFocus(); |
162 | 168 | ||
163 | 169 | ||
164 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 170 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
165 | SLOT( setContactSelected( const QString& ) ) ); | 171 | SLOT( setContactSelected( const QString& ) ) ); |
166 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 172 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
167 | SLOT( editContact( const QString& ) ) ); | 173 | SLOT( editContact( const QString& ) ) ); |
168 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 174 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
169 | SLOT( deleteContacts( ) ) ); | 175 | SLOT( deleteContacts( ) ) ); |
170 | connect( mViewManager, SIGNAL( modified() ), | 176 | connect( mViewManager, SIGNAL( modified() ), |
171 | SLOT( setModified() ) ); | 177 | SLOT( setModified() ) ); |
172 | 178 | ||
173 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 179 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
174 | 180 | ||
175 | connect( mXXPortManager, SIGNAL( modified() ), | 181 | connect( mXXPortManager, SIGNAL( modified() ), |
176 | SLOT( setModified() ) ); | 182 | SLOT( setModified() ) ); |
177 | 183 | ||
178 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 184 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
179 | SLOT( incrementalSearch( const QString& ) ) ); | 185 | SLOT( incrementalSearch( const QString& ) ) ); |
180 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 186 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
181 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 187 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
182 | 188 | ||
183 | #ifndef KAB_EMBEDDED | 189 | #ifndef KAB_EMBEDDED |
184 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 190 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
185 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 191 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
186 | 192 | ||
187 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 193 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
188 | SLOT( sendMail( const QString& ) ) ); | 194 | SLOT( sendMail( const QString& ) ) ); |
189 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 195 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
190 | SLOT( browse( const QString& ) ) ); | 196 | SLOT( browse( const QString& ) ) ); |
191 | 197 | ||
192 | mAddressBookService = new KAddressBookService( this ); | 198 | mAddressBookService = new KAddressBookService( this ); |
193 | 199 | ||
194 | #endif //KAB_EMBEDDED | 200 | #endif //KAB_EMBEDDED |
195 | 201 | ||
196 | setModified( false ); | 202 | setModified( false ); |
197 | } | 203 | } |
198 | 204 | ||
199 | KABCore::~KABCore() | 205 | KABCore::~KABCore() |
200 | { | 206 | { |
201 | // save(); | 207 | // save(); |
202 | //saveSettings(); | 208 | //saveSettings(); |
203 | //KABPrefs::instance()->writeConfig(); | 209 | //KABPrefs::instance()->writeConfig(); |
204 | delete AddresseeConfig::instance(); | 210 | delete AddresseeConfig::instance(); |
205 | mAddressBook = 0; | 211 | mAddressBook = 0; |
206 | KABC::StdAddressBook::close(); | 212 | KABC::StdAddressBook::close(); |
207 | 213 | ||
208 | #ifdef KAB_EMBEDDED | 214 | #ifdef KAB_EMBEDDED |
209 | //US we define here our own global actioncollection. | 215 | //US we define here our own global actioncollection. |
210 | // delete mActionCollection; | 216 | // delete mActionCollection; |
211 | #endif //KAB_EMBEDDED | 217 | #endif //KAB_EMBEDDED |
212 | 218 | ||
213 | } | 219 | } |
214 | 220 | ||
215 | void KABCore::restoreSettings() | 221 | void KABCore::restoreSettings() |
216 | { | 222 | { |
217 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 223 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
218 | 224 | ||
219 | mActionJumpBar->setChecked( state ); | 225 | mActionJumpBar->setChecked( state ); |
220 | setJumpButtonBarVisible( state ); | 226 | setJumpButtonBarVisible( state ); |
221 | 227 | ||
222 | state = KABPrefs::instance()->mDetailsPageVisible; | 228 | state = KABPrefs::instance()->mDetailsPageVisible; |
223 | 229 | ||
224 | mActionDetails->setChecked( state ); | 230 | mActionDetails->setChecked( state ); |
225 | setDetailsVisible( state ); | 231 | setDetailsVisible( state ); |
226 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 232 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
227 | if ( splitterSize.count() == 0 ) { | 233 | if ( splitterSize.count() == 0 ) { |
228 | splitterSize.append( width() / 2 ); | 234 | splitterSize.append( width() / 2 ); |
229 | splitterSize.append( width() / 2 ); | 235 | splitterSize.append( width() / 2 ); |
230 | } | 236 | } |
231 | mMiniSplitter->setSizes( splitterSize ); | 237 | mMiniSplitter->setSizes( splitterSize ); |
232 | if ( mExtensionBarSplitter ) { | 238 | if ( mExtensionBarSplitter ) { |
233 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 239 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
234 | if ( splitterSize.count() == 0 ) { | 240 | if ( splitterSize.count() == 0 ) { |
235 | splitterSize.append( width() / 2 ); | 241 | splitterSize.append( width() / 2 ); |
236 | splitterSize.append( width() / 2 ); | 242 | splitterSize.append( width() / 2 ); |
237 | } | 243 | } |
238 | mExtensionBarSplitter->setSizes( splitterSize ); | 244 | mExtensionBarSplitter->setSizes( splitterSize ); |
239 | 245 | ||
240 | } | 246 | } |
241 | #ifndef KAB_EMBEDDED | 247 | #ifndef KAB_EMBEDDED |
242 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 248 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
243 | if ( splitterSize.count() == 0 ) { | 249 | if ( splitterSize.count() == 0 ) { |
244 | splitterSize.append( width() / 2 ); | 250 | splitterSize.append( width() / 2 ); |
245 | splitterSize.append( width() / 2 ); | 251 | splitterSize.append( width() / 2 ); |
246 | } | 252 | } |
247 | mExtensionBarSplitter->setSizes( splitterSize ); | 253 | mExtensionBarSplitter->setSizes( splitterSize ); |
248 | 254 | ||
249 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 255 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
250 | if ( splitterSize.count() == 0 ) { | 256 | if ( splitterSize.count() == 0 ) { |
251 | splitterSize.append( height() / 2 ); | 257 | splitterSize.append( height() / 2 ); |
252 | splitterSize.append( height() / 2 ); | 258 | splitterSize.append( height() / 2 ); |
253 | } | 259 | } |