-rw-r--r-- | kaddressbook/kabcore.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3e578bc..70ab6b7 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -33,326 +33,336 @@ | |||
33 | #include <qapplicaton.h> | 33 | #include <qapplicaton.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | #include <kabc/addresseelist.h> | 37 | #include <kabc/addresseelist.h> |
38 | #include <kabc/errorhandler.h> | 38 | #include <kabc/errorhandler.h> |
39 | #include <kabc/resource.h> | 39 | #include <kabc/resource.h> |
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
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 | 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 | 158 | ||
159 | initGUI(); | 159 | initGUI(); |
160 | 160 | ||
161 | mIncSearchWidget->setFocus(); | 161 | mIncSearchWidget->setFocus(); |
162 | 162 | ||
163 | 163 | ||
164 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 164 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
165 | SLOT( setContactSelected( const QString& ) ) ); | 165 | SLOT( setContactSelected( const QString& ) ) ); |
166 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 166 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
167 | SLOT( editContact( const QString& ) ) ); | 167 | SLOT( editContact( const QString& ) ) ); |
168 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 168 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
169 | SLOT( deleteContacts( ) ) ); | 169 | SLOT( deleteContacts( ) ) ); |
170 | connect( mViewManager, SIGNAL( modified() ), | 170 | connect( mViewManager, SIGNAL( modified() ), |
171 | SLOT( setModified() ) ); | 171 | SLOT( setModified() ) ); |
172 | 172 | ||
173 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 173 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
174 | 174 | ||
175 | connect( mXXPortManager, SIGNAL( modified() ), | 175 | connect( mXXPortManager, SIGNAL( modified() ), |
176 | SLOT( setModified() ) ); | 176 | SLOT( setModified() ) ); |
177 | 177 | ||
178 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 178 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
179 | SLOT( incrementalSearch( const QString& ) ) ); | 179 | SLOT( incrementalSearch( const QString& ) ) ); |
180 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 180 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
181 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 181 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
182 | 182 | ||
183 | #ifndef KAB_EMBEDDED | 183 | #ifndef KAB_EMBEDDED |
184 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 184 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
185 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 185 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
186 | 186 | ||
187 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 187 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
188 | SLOT( sendMail( const QString& ) ) ); | 188 | SLOT( sendMail( const QString& ) ) ); |
189 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 189 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
190 | SLOT( browse( const QString& ) ) ); | 190 | SLOT( browse( const QString& ) ) ); |
191 | 191 | ||
192 | mAddressBookService = new KAddressBookService( this ); | 192 | mAddressBookService = new KAddressBookService( this ); |
193 | 193 | ||
194 | #endif //KAB_EMBEDDED | 194 | #endif //KAB_EMBEDDED |
195 | 195 | ||
196 | setModified( false ); | 196 | setModified( false ); |
197 | } | 197 | } |
198 | 198 | ||
199 | KABCore::~KABCore() | 199 | KABCore::~KABCore() |
200 | { | 200 | { |
201 | // save(); | 201 | // save(); |
202 | //saveSettings(); | 202 | //saveSettings(); |
203 | //KABPrefs::instance()->writeConfig(); | 203 | //KABPrefs::instance()->writeConfig(); |
204 | delete AddresseeConfig::instance(); | 204 | delete AddresseeConfig::instance(); |
205 | mAddressBook = 0; | 205 | mAddressBook = 0; |
206 | KABC::StdAddressBook::close(); | 206 | KABC::StdAddressBook::close(); |
207 | 207 | ||
208 | #ifdef KAB_EMBEDDED | 208 | #ifdef KAB_EMBEDDED |
209 | //US we define here our own global actioncollection. | 209 | //US we define here our own global actioncollection. |
210 | // delete mActionCollection; | 210 | // delete mActionCollection; |
211 | #endif //KAB_EMBEDDED | 211 | #endif //KAB_EMBEDDED |
212 | 212 | ||
213 | } | 213 | } |
214 | 214 | ||
215 | void KABCore::restoreSettings() | 215 | void KABCore::restoreSettings() |
216 | { | 216 | { |
217 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 217 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
218 | 218 | ||
219 | mActionJumpBar->setChecked( state ); | 219 | mActionJumpBar->setChecked( state ); |
220 | setJumpButtonBarVisible( state ); | 220 | setJumpButtonBarVisible( state ); |
221 | 221 | ||
222 | state = KABPrefs::instance()->mDetailsPageVisible; | 222 | state = KABPrefs::instance()->mDetailsPageVisible; |
223 | 223 | ||
224 | mActionDetails->setChecked( state ); | 224 | mActionDetails->setChecked( state ); |
225 | setDetailsVisible( state ); | 225 | setDetailsVisible( state ); |
226 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 226 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
227 | if ( splitterSize.count() == 0 ) { | 227 | if ( splitterSize.count() == 0 ) { |
228 | splitterSize.append( width() / 2 ); | 228 | splitterSize.append( width() / 2 ); |
229 | splitterSize.append( width() / 2 ); | 229 | splitterSize.append( width() / 2 ); |
230 | } | 230 | } |
231 | mMiniSplitter->setSizes( splitterSize ); | 231 | mMiniSplitter->setSizes( splitterSize ); |
232 | if ( mExtensionBarSplitter ) { | ||
233 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | ||
234 | if ( splitterSize.count() == 0 ) { | ||
235 | splitterSize.append( width() / 2 ); | ||
236 | splitterSize.append( width() / 2 ); | ||
237 | } | ||
238 | mExtensionBarSplitter->setSizes( splitterSize ); | ||
239 | |||
240 | } | ||
232 | #ifndef KAB_EMBEDDED | 241 | #ifndef KAB_EMBEDDED |
233 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 242 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
234 | if ( splitterSize.count() == 0 ) { | 243 | if ( splitterSize.count() == 0 ) { |
235 | splitterSize.append( width() / 2 ); | 244 | splitterSize.append( width() / 2 ); |
236 | splitterSize.append( width() / 2 ); | 245 | splitterSize.append( width() / 2 ); |
237 | } | 246 | } |
238 | mExtensionBarSplitter->setSizes( splitterSize ); | 247 | mExtensionBarSplitter->setSizes( splitterSize ); |
239 | 248 | ||
240 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 249 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
241 | if ( splitterSize.count() == 0 ) { | 250 | if ( splitterSize.count() == 0 ) { |
242 | splitterSize.append( height() / 2 ); | 251 | splitterSize.append( height() / 2 ); |
243 | splitterSize.append( height() / 2 ); | 252 | splitterSize.append( height() / 2 ); |
244 | } | 253 | } |
245 | mDetailsSplitter->setSizes( splitterSize ); | 254 | mDetailsSplitter->setSizes( splitterSize ); |
246 | 255 | ||
247 | mExtensionManager->restoreSettings(); | 256 | mExtensionManager->restoreSettings(); |
248 | 257 | ||
249 | #endif //KAB_EMBEDDED | 258 | #endif //KAB_EMBEDDED |
250 | 259 | ||
251 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 260 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
252 | 261 | ||
253 | mViewManager->restoreSettings(); | 262 | mViewManager->restoreSettings(); |
254 | mExtensionManager->restoreSettings(); | 263 | mExtensionManager->restoreSettings(); |
255 | } | 264 | } |
256 | 265 | ||
257 | void KABCore::saveSettings() | 266 | void KABCore::saveSettings() |
258 | { | 267 | { |
259 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 268 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
260 | KABPrefs::instance()->mExtensionsSplitter = mMiniSplitter->sizes(); | 269 | if ( mExtensionBarSplitter ) |
270 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | ||
261 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 271 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
262 | 272 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | |
263 | #ifndef KAB_EMBEDDED | 273 | #ifndef KAB_EMBEDDED |
264 | 274 | ||
265 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 275 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
266 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 276 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
267 | #endif //KAB_EMBEDDED | 277 | #endif //KAB_EMBEDDED |
268 | mExtensionManager->saveSettings(); | 278 | mExtensionManager->saveSettings(); |
269 | mViewManager->saveSettings(); | 279 | mViewManager->saveSettings(); |
270 | 280 | ||
271 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 281 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
272 | 282 | ||
273 | } | 283 | } |
274 | 284 | ||
275 | KABC::AddressBook *KABCore::addressBook() const | 285 | KABC::AddressBook *KABCore::addressBook() const |
276 | { | 286 | { |
277 | return mAddressBook; | 287 | return mAddressBook; |
278 | } | 288 | } |
279 | 289 | ||
280 | KConfig *KABCore::config() | 290 | KConfig *KABCore::config() |
281 | { | 291 | { |
282 | #ifndef KAB_EMBEDDED | 292 | #ifndef KAB_EMBEDDED |
283 | return KABPrefs::instance()->config(); | 293 | return KABPrefs::instance()->config(); |
284 | #else //KAB_EMBEDDED | 294 | #else //KAB_EMBEDDED |
285 | return KABPrefs::instance()->getConfig(); | 295 | return KABPrefs::instance()->getConfig(); |
286 | #endif //KAB_EMBEDDED | 296 | #endif //KAB_EMBEDDED |
287 | } | 297 | } |
288 | 298 | ||
289 | KActionCollection *KABCore::actionCollection() const | 299 | KActionCollection *KABCore::actionCollection() const |
290 | { | 300 | { |
291 | return mGUIClient->actionCollection(); | 301 | return mGUIClient->actionCollection(); |
292 | } | 302 | } |
293 | 303 | ||
294 | KABC::Field *KABCore::currentSearchField() const | 304 | KABC::Field *KABCore::currentSearchField() const |
295 | { | 305 | { |
296 | if (mIncSearchWidget) | 306 | if (mIncSearchWidget) |
297 | return mIncSearchWidget->currentField(); | 307 | return mIncSearchWidget->currentField(); |
298 | else | 308 | else |
299 | return 0; | 309 | return 0; |
300 | } | 310 | } |
301 | 311 | ||
302 | QStringList KABCore::selectedUIDs() const | 312 | QStringList KABCore::selectedUIDs() const |
303 | { | 313 | { |
304 | return mViewManager->selectedUids(); | 314 | return mViewManager->selectedUids(); |
305 | } | 315 | } |
306 | 316 | ||
307 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 317 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
308 | { | 318 | { |
309 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 319 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
310 | 320 | ||
311 | QPtrList<KRES::Resource> kresResources; | 321 | QPtrList<KRES::Resource> kresResources; |
312 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 322 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
313 | KABC::Resource *resource; | 323 | KABC::Resource *resource; |
314 | while ( ( resource = resIt.current() ) != 0 ) { | 324 | while ( ( resource = resIt.current() ) != 0 ) { |
315 | ++resIt; | 325 | ++resIt; |
316 | if ( !resource->readOnly() ) { | 326 | if ( !resource->readOnly() ) { |
317 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 327 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
318 | if ( res ) | 328 | if ( res ) |
319 | kresResources.append( res ); | 329 | kresResources.append( res ); |
320 | } | 330 | } |
321 | } | 331 | } |
322 | 332 | ||
323 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 333 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
324 | return static_cast<KABC::Resource*>( res ); | 334 | return static_cast<KABC::Resource*>( res ); |
325 | } | 335 | } |
326 | 336 | ||
327 | #ifndef KAB_EMBEDDED | 337 | #ifndef KAB_EMBEDDED |
328 | KAboutData *KABCore::createAboutData() | 338 | KAboutData *KABCore::createAboutData() |
329 | #else //KAB_EMBEDDED | 339 | #else //KAB_EMBEDDED |
330 | void KABCore::createAboutData() | 340 | void KABCore::createAboutData() |
331 | #endif //KAB_EMBEDDED | 341 | #endif //KAB_EMBEDDED |
332 | { | 342 | { |
333 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED |
334 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 344 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
335 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 345 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
336 | KAboutData::License_GPL_V2, | 346 | KAboutData::License_GPL_V2, |
337 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 347 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
338 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 348 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
339 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 349 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
340 | about->addAuthor( "Cornelius Schumacher", | 350 | about->addAuthor( "Cornelius Schumacher", |
341 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 351 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
342 | "schumacher@kde.org" ); | 352 | "schumacher@kde.org" ); |
343 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 353 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
344 | "mpilone@slac.com" ); | 354 | "mpilone@slac.com" ); |
345 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 355 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
346 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 356 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
347 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 357 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
348 | "michel@klaralvdalens-datakonsult.se" ); | 358 | "michel@klaralvdalens-datakonsult.se" ); |
349 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 359 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
350 | "hansen@kde.org" ); | 360 | "hansen@kde.org" ); |
351 | 361 | ||
352 | return about; | 362 | return about; |
353 | #endif //KAB_EMBEDDED | 363 | #endif //KAB_EMBEDDED |
354 | 364 | ||
355 | QString version; | 365 | QString version; |
356 | #include <../version> | 366 | #include <../version> |
357 | QMessageBox::about( this, "About KAddressbook/Pi", | 367 | QMessageBox::about( this, "About KAddressbook/Pi", |
358 | "KAddressbook/Platform-independent\n" | 368 | "KAddressbook/Platform-independent\n" |
@@ -1050,211 +1060,225 @@ void KABCore::configurationChanged() | |||
1050 | void KABCore::addressBookChanged() | 1060 | void KABCore::addressBookChanged() |
1051 | { | 1061 | { |
1052 | #ifndef KAB_EMBEDDED | 1062 | #ifndef KAB_EMBEDDED |
1053 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1063 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1054 | while ( it.current() ) { | 1064 | while ( it.current() ) { |
1055 | if ( it.current()->dirty() ) { | 1065 | if ( it.current()->dirty() ) { |
1056 | QString text = i18n( "Data has been changed externally. Unsaved " | 1066 | QString text = i18n( "Data has been changed externally. Unsaved " |
1057 | "changes will be lost." ); | 1067 | "changes will be lost." ); |
1058 | KMessageBox::information( this, text ); | 1068 | KMessageBox::information( this, text ); |
1059 | } | 1069 | } |
1060 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1070 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1061 | ++it; | 1071 | ++it; |
1062 | } | 1072 | } |
1063 | 1073 | ||
1064 | mViewManager->refreshView(); | 1074 | mViewManager->refreshView(); |
1065 | #else //KAB_EMBEDDED | 1075 | #else //KAB_EMBEDDED |
1066 | qDebug("KABCore::addressBookChanged() finsih method"); | 1076 | qDebug("KABCore::addressBookChanged() finsih method"); |
1067 | #endif //KAB_EMBEDDED | 1077 | #endif //KAB_EMBEDDED |
1068 | } | 1078 | } |
1069 | 1079 | ||
1070 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1080 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1071 | const char *name ) | 1081 | const char *name ) |
1072 | { | 1082 | { |
1073 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, | 1083 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, |
1074 | name ? name : "editorDialog" ); | 1084 | name ? name : "editorDialog" ); |
1075 | 1085 | ||
1076 | //US | 1086 | //US |
1077 | dialog->setMaximumSize( 640, 480 ); | 1087 | dialog->setMaximumSize( 640, 480 ); |
1078 | dialog->showMaximized(); | 1088 | dialog->showMaximized(); |
1079 | 1089 | ||
1080 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1090 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1081 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1091 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1082 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), | 1092 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), |
1083 | SLOT( slotEditorDestroyed( const QString& ) ) ); | 1093 | SLOT( slotEditorDestroyed( const QString& ) ) ); |
1084 | 1094 | ||
1085 | return dialog; | 1095 | return dialog; |
1086 | } | 1096 | } |
1087 | 1097 | ||
1088 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1098 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1089 | { | 1099 | { |
1090 | mEditorDict.remove( uid ); | 1100 | mEditorDict.remove( uid ); |
1091 | } | 1101 | } |
1092 | 1102 | ||
1093 | void KABCore::initGUI() | 1103 | void KABCore::initGUI() |
1094 | { | 1104 | { |
1095 | #ifndef KAB_EMBEDDED | 1105 | #ifndef KAB_EMBEDDED |
1096 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1106 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1097 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1107 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1098 | 1108 | ||
1099 | mExtensionBarSplitter = new QSplitter( this ); | 1109 | mExtensionBarSplitter = new QSplitter( this ); |
1100 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1110 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1101 | 1111 | ||
1102 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1112 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1103 | 1113 | ||
1104 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1114 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1105 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1115 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1106 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1116 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1107 | SLOT( incrementalSearch( const QString& ) ) ); | 1117 | SLOT( incrementalSearch( const QString& ) ) ); |
1108 | 1118 | ||
1109 | mViewManager = new ViewManager( this, viewSpace ); | 1119 | mViewManager = new ViewManager( this, viewSpace ); |
1110 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1120 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1111 | 1121 | ||
1112 | mDetails = new ViewContainer( mDetailsSplitter ); | 1122 | mDetails = new ViewContainer( mDetailsSplitter ); |
1113 | 1123 | ||
1114 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1124 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1115 | 1125 | ||
1116 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1126 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1117 | 1127 | ||
1118 | topLayout->addWidget( mExtensionBarSplitter ); | 1128 | topLayout->addWidget( mExtensionBarSplitter ); |
1119 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1129 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1120 | topLayout->addWidget( mJumpButtonBar ); | 1130 | topLayout->addWidget( mJumpButtonBar ); |
1121 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1131 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1122 | 1132 | ||
1123 | mXXPortManager = new XXPortManager( this, this ); | 1133 | mXXPortManager = new XXPortManager( this, this ); |
1124 | 1134 | ||
1125 | #else //KAB_EMBEDDED | 1135 | #else //KAB_EMBEDDED |
1126 | //US initialize viewMenu before settingup viewmanager. | 1136 | //US initialize viewMenu before settingup viewmanager. |
1127 | // Viewmanager needs this menu to plugin submenues. | 1137 | // Viewmanager needs this menu to plugin submenues. |
1128 | viewMenu = new QPopupMenu( this ); | 1138 | viewMenu = new QPopupMenu( this ); |
1129 | settingsMenu = new QPopupMenu( this ); | 1139 | settingsMenu = new QPopupMenu( this ); |
1130 | //filterMenu = new QPopupMenu( this ); | 1140 | //filterMenu = new QPopupMenu( this ); |
1131 | ImportMenu = new QPopupMenu( this ); | 1141 | ImportMenu = new QPopupMenu( this ); |
1132 | ExportMenu = new QPopupMenu( this ); | 1142 | ExportMenu = new QPopupMenu( this ); |
1133 | 1143 | ||
1134 | 1144 | ||
1135 | //US since we have no splitter for the embedded system, setup | 1145 | //US since we have no splitter for the embedded system, setup |
1136 | // a layout with two frames. One left and one right. | 1146 | // a layout with two frames. One left and one right. |
1137 | 1147 | ||
1138 | QBoxLayout *topLayout; | 1148 | QBoxLayout *topLayout; |
1139 | 1149 | ||
1140 | // = new QHBoxLayout( this ); | 1150 | // = new QHBoxLayout( this ); |
1141 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1151 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1142 | 1152 | ||
1143 | // QWidget *mainBox = new QWidget( this ); | 1153 | // QWidget *mainBox = new QWidget( this ); |
1144 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1154 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1145 | 1155 | ||
1146 | 1156 | #ifdef DESKTOP_VERSION | |
1157 | topLayout = new QHBoxLayout( this ); | ||
1158 | |||
1159 | |||
1160 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | ||
1161 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
1162 | |||
1163 | topLayout->addWidget(mMiniSplitter ); | ||
1164 | |||
1165 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | ||
1166 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | ||
1167 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | ||
1168 | mDetails = new ViewContainer( mMiniSplitter ); | ||
1169 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | ||
1170 | #else | ||
1147 | if ( QApplication::desktop()->width() > 480 ) { | 1171 | if ( QApplication::desktop()->width() > 480 ) { |
1148 | topLayout = new QHBoxLayout( this ); | 1172 | topLayout = new QHBoxLayout( this ); |
1149 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1173 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1150 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1174 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1151 | } else { | 1175 | } else { |
1152 | 1176 | ||
1153 | topLayout = new QVBoxLayout( this ); | 1177 | topLayout = new QVBoxLayout( this ); |
1154 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1178 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1155 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1179 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1156 | } | 1180 | } |
1157 | 1181 | ||
1158 | topLayout->addWidget(mMiniSplitter ); | 1182 | topLayout->addWidget(mMiniSplitter ); |
1159 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1183 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1160 | mDetails = new ViewContainer( mMiniSplitter ); | 1184 | mDetails = new ViewContainer( mMiniSplitter ); |
1161 | 1185 | ||
1162 | 1186 | ||
1163 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1187 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1164 | 1188 | #endif | |
1165 | //eh->hide(); | 1189 | //eh->hide(); |
1166 | // topLayout->addWidget(mExtensionManager ); | 1190 | // topLayout->addWidget(mExtensionManager ); |
1167 | 1191 | ||
1168 | 1192 | ||
1169 | /*US | 1193 | /*US |
1170 | #ifndef KAB_NOSPLITTER | 1194 | #ifndef KAB_NOSPLITTER |
1171 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1195 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1172 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1196 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1173 | topLayout->setSpacing( 10 ); | 1197 | topLayout->setSpacing( 10 ); |
1174 | 1198 | ||
1175 | mDetailsSplitter = new QSplitter( this ); | 1199 | mDetailsSplitter = new QSplitter( this ); |
1176 | 1200 | ||
1177 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1201 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1178 | 1202 | ||
1179 | mViewManager = new ViewManager( this, viewSpace ); | 1203 | mViewManager = new ViewManager( this, viewSpace ); |
1180 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1204 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1181 | 1205 | ||
1182 | mDetails = new ViewContainer( mDetailsSplitter ); | 1206 | mDetails = new ViewContainer( mDetailsSplitter ); |
1183 | 1207 | ||
1184 | topLayout->addWidget( mDetailsSplitter ); | 1208 | topLayout->addWidget( mDetailsSplitter ); |
1185 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1209 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1186 | #else //KAB_NOSPLITTER | 1210 | #else //KAB_NOSPLITTER |
1187 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1211 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1188 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1212 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1189 | topLayout->setSpacing( 10 ); | 1213 | topLayout->setSpacing( 10 ); |
1190 | 1214 | ||
1191 | // mDetailsSplitter = new QSplitter( this ); | 1215 | // mDetailsSplitter = new QSplitter( this ); |
1192 | 1216 | ||
1193 | QVBox *viewSpace = new QVBox( this ); | 1217 | QVBox *viewSpace = new QVBox( this ); |
1194 | 1218 | ||
1195 | mViewManager = new ViewManager( this, viewSpace ); | 1219 | mViewManager = new ViewManager( this, viewSpace ); |
1196 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1220 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1197 | 1221 | ||
1198 | mDetails = new ViewContainer( this ); | 1222 | mDetails = new ViewContainer( this ); |
1199 | 1223 | ||
1200 | topLayout->addWidget( viewSpace ); | 1224 | topLayout->addWidget( viewSpace ); |
1201 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1225 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1202 | topLayout->addWidget( mDetails ); | 1226 | topLayout->addWidget( mDetails ); |
1203 | #endif //KAB_NOSPLITTER | 1227 | #endif //KAB_NOSPLITTER |
1204 | */ | 1228 | */ |
1205 | 1229 | ||
1206 | 1230 | ||
1207 | #endif //KAB_EMBEDDED | 1231 | #endif //KAB_EMBEDDED |
1208 | initActions(); | 1232 | initActions(); |
1209 | 1233 | ||
1210 | #ifdef KAB_EMBEDDED | 1234 | #ifdef KAB_EMBEDDED |
1211 | addActionsManually(); | 1235 | addActionsManually(); |
1212 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1236 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1213 | mXXPortManager = new XXPortManager( this, this ); | 1237 | mXXPortManager = new XXPortManager( this, this ); |
1214 | 1238 | ||
1215 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1239 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1216 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1240 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1217 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1241 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1218 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1242 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1219 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1243 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1220 | // mIncSearchWidget->hide(); | 1244 | // mIncSearchWidget->hide(); |
1221 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1245 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1222 | SLOT( incrementalSearch( const QString& ) ) ); | 1246 | SLOT( incrementalSearch( const QString& ) ) ); |
1223 | 1247 | ||
1224 | 1248 | ||
1225 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1249 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1226 | 1250 | ||
1227 | topLayout->addWidget( mJumpButtonBar ); | 1251 | topLayout->addWidget( mJumpButtonBar ); |
1228 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1252 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1229 | 1253 | ||
1230 | // mMainWindow->getIconToolBar()->raise(); | 1254 | // mMainWindow->getIconToolBar()->raise(); |
1231 | 1255 | ||
1232 | #endif //KAB_EMBEDDED | 1256 | #endif //KAB_EMBEDDED |
1233 | 1257 | ||
1234 | } | 1258 | } |
1235 | void KABCore::initActions() | 1259 | void KABCore::initActions() |
1236 | { | 1260 | { |
1237 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1261 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1238 | 1262 | ||
1239 | #ifndef KAB_EMBEDDED | 1263 | #ifndef KAB_EMBEDDED |
1240 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1264 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1241 | SLOT( clipboardDataChanged() ) ); | 1265 | SLOT( clipboardDataChanged() ) ); |
1242 | #endif //KAB_EMBEDDED | 1266 | #endif //KAB_EMBEDDED |
1243 | 1267 | ||
1244 | // file menu | 1268 | // file menu |
1245 | if ( mIsPart ) { | 1269 | if ( mIsPart ) { |
1246 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1270 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1247 | SLOT( sendMail() ), actionCollection(), | 1271 | SLOT( sendMail() ), actionCollection(), |
1248 | "kaddressbook_mail" ); | 1272 | "kaddressbook_mail" ); |
1249 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1273 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1250 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1274 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1251 | 1275 | ||
1252 | } else { | 1276 | } else { |
1253 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1277 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1254 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1278 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1255 | } | 1279 | } |
1256 | 1280 | ||
1257 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1281 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1258 | SLOT( save() ), actionCollection(), "file_sync" ); | 1282 | SLOT( save() ), actionCollection(), "file_sync" ); |
1259 | 1283 | ||
1260 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1284 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
@@ -1393,179 +1417,183 @@ void KABCore::addActionsManually() | |||
1393 | KToolBar* tb = mMainWindow->toolBar(); | 1417 | KToolBar* tb = mMainWindow->toolBar(); |
1394 | 1418 | ||
1395 | #ifdef DESKTOP_VERSION | 1419 | #ifdef DESKTOP_VERSION |
1396 | QMenuBar* mb = mMainWindow->menuBar(); | 1420 | QMenuBar* mb = mMainWindow->menuBar(); |
1397 | 1421 | ||
1398 | //US setup menubar. | 1422 | //US setup menubar. |
1399 | //Disable the following block if you do not want to have a menubar. | 1423 | //Disable the following block if you do not want to have a menubar. |
1400 | mb->insertItem( "&File", fileMenu ); | 1424 | mb->insertItem( "&File", fileMenu ); |
1401 | mb->insertItem( "&Edit", editMenu ); | 1425 | mb->insertItem( "&Edit", editMenu ); |
1402 | mb->insertItem( "&View", viewMenu ); | 1426 | mb->insertItem( "&View", viewMenu ); |
1403 | mb->insertItem( "&Settings", settingsMenu ); | 1427 | mb->insertItem( "&Settings", settingsMenu ); |
1404 | mb->insertItem( "&Help", helpMenu ); | 1428 | mb->insertItem( "&Help", helpMenu ); |
1405 | mIncSearchWidget = new IncSearchWidget( tb ); | 1429 | mIncSearchWidget = new IncSearchWidget( tb ); |
1406 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1430 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1407 | 1431 | ||
1408 | #else | 1432 | #else |
1409 | //US setup toolbar | 1433 | //US setup toolbar |
1410 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1434 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1411 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1435 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1412 | menuBarTB->insertItem( "ME", popupBarTB); | 1436 | menuBarTB->insertItem( "ME", popupBarTB); |
1413 | tb->insertWidget(-1, 0, menuBarTB); | 1437 | tb->insertWidget(-1, 0, menuBarTB); |
1414 | mIncSearchWidget = new IncSearchWidget( tb ); | 1438 | mIncSearchWidget = new IncSearchWidget( tb ); |
1415 | 1439 | ||
1416 | tb->enableMoving(false); | 1440 | tb->enableMoving(false); |
1417 | popupBarTB->insertItem( "&File", fileMenu ); | 1441 | popupBarTB->insertItem( "&File", fileMenu ); |
1418 | popupBarTB->insertItem( "&Edit", editMenu ); | 1442 | popupBarTB->insertItem( "&Edit", editMenu ); |
1419 | popupBarTB->insertItem( "&View", viewMenu ); | 1443 | popupBarTB->insertItem( "&View", viewMenu ); |
1420 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1444 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1421 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1445 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1422 | popupBarTB->insertItem( "&Help", helpMenu ); | 1446 | popupBarTB->insertItem( "&Help", helpMenu ); |
1423 | if (QApplication::desktop()->width() > 320 ) { | 1447 | if (QApplication::desktop()->width() > 320 ) { |
1424 | // mViewManager->getFilterAction()->plug ( tb); | 1448 | // mViewManager->getFilterAction()->plug ( tb); |
1425 | } | 1449 | } |
1426 | #endif | 1450 | #endif |
1427 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1451 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1428 | 1452 | ||
1429 | 1453 | ||
1430 | 1454 | ||
1431 | //US Now connect the actions with the menue entries. | 1455 | //US Now connect the actions with the menue entries. |
1432 | mActionPrint->plug( fileMenu ); | 1456 | mActionPrint->plug( fileMenu ); |
1433 | mActionMail->plug( fileMenu ); | 1457 | mActionMail->plug( fileMenu ); |
1434 | fileMenu->insertSeparator(); | 1458 | fileMenu->insertSeparator(); |
1435 | 1459 | ||
1436 | mActionNewContact->plug( fileMenu ); | 1460 | mActionNewContact->plug( fileMenu ); |
1437 | mActionNewContact->plug( tb ); | 1461 | mActionNewContact->plug( tb ); |
1438 | 1462 | ||
1439 | mActionEditAddressee->plug( fileMenu ); | 1463 | mActionEditAddressee->plug( fileMenu ); |
1440 | fileMenu->insertSeparator(); | 1464 | fileMenu->insertSeparator(); |
1441 | mActionSave->plug( fileMenu ); | 1465 | mActionSave->plug( fileMenu ); |
1442 | fileMenu->insertItem( "&Import", ImportMenu ); | 1466 | fileMenu->insertItem( "&Import", ImportMenu ); |
1443 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1467 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1444 | fileMenu->insertSeparator(); | 1468 | fileMenu->insertSeparator(); |
1445 | mActionMailVCard->plug( fileMenu ); | 1469 | mActionMailVCard->plug( fileMenu ); |
1446 | fileMenu->insertSeparator(); | 1470 | fileMenu->insertSeparator(); |
1447 | mActionQuit->plug( fileMenu ); | 1471 | mActionQuit->plug( fileMenu ); |
1448 | 1472 | ||
1449 | 1473 | ||
1450 | // edit menu | 1474 | // edit menu |
1451 | mActionUndo->plug( editMenu ); | 1475 | mActionUndo->plug( editMenu ); |
1452 | mActionRedo->plug( editMenu ); | 1476 | mActionRedo->plug( editMenu ); |
1453 | editMenu->insertSeparator(); | 1477 | editMenu->insertSeparator(); |
1454 | mActionCut->plug( editMenu ); | 1478 | mActionCut->plug( editMenu ); |
1455 | mActionCopy->plug( editMenu ); | 1479 | mActionCopy->plug( editMenu ); |
1456 | mActionPaste->plug( editMenu ); | 1480 | mActionPaste->plug( editMenu ); |
1457 | mActionDelete->plug( editMenu ); | 1481 | mActionDelete->plug( editMenu ); |
1458 | editMenu->insertSeparator(); | 1482 | editMenu->insertSeparator(); |
1459 | mActionSelectAll->plug( editMenu ); | 1483 | mActionSelectAll->plug( editMenu ); |
1460 | 1484 | ||
1461 | 1485 | ||
1462 | // settings menu | 1486 | // settings menu |
1463 | //US special menuentry to configure the addressbook resources. On KDE | 1487 | //US special menuentry to configure the addressbook resources. On KDE |
1464 | // you do that through the control center !!! | 1488 | // you do that through the control center !!! |
1465 | mActionConfigResources->plug( settingsMenu ); | 1489 | mActionConfigResources->plug( settingsMenu ); |
1466 | settingsMenu->insertSeparator(); | 1490 | settingsMenu->insertSeparator(); |
1467 | 1491 | ||
1468 | mActionConfigKAddressbook->plug( settingsMenu ); | 1492 | mActionConfigKAddressbook->plug( settingsMenu ); |
1469 | 1493 | ||
1470 | if ( mIsPart ) { | 1494 | if ( mIsPart ) { |
1471 | mActionConfigShortcuts->plug( settingsMenu ); | 1495 | mActionConfigShortcuts->plug( settingsMenu ); |
1472 | mActionConfigureToolbars->plug( settingsMenu ); | 1496 | mActionConfigureToolbars->plug( settingsMenu ); |
1473 | 1497 | ||
1474 | } else { | 1498 | } else { |
1475 | mActionKeyBindings->plug( settingsMenu ); | 1499 | mActionKeyBindings->plug( settingsMenu ); |
1476 | } | 1500 | } |
1477 | 1501 | ||
1478 | settingsMenu->insertSeparator(); | 1502 | settingsMenu->insertSeparator(); |
1479 | 1503 | ||
1480 | mActionJumpBar->plug( settingsMenu ); | 1504 | mActionJumpBar->plug( settingsMenu ); |
1481 | mActionDetails->plug( settingsMenu ); | 1505 | mActionDetails->plug( settingsMenu ); |
1482 | settingsMenu->insertSeparator(); | 1506 | settingsMenu->insertSeparator(); |
1483 | 1507 | ||
1484 | mActionWhoAmI->plug( settingsMenu ); | 1508 | mActionWhoAmI->plug( settingsMenu ); |
1485 | mActionCategories->plug( settingsMenu ); | 1509 | mActionCategories->plug( settingsMenu ); |
1486 | 1510 | ||
1487 | mActionAboutKAddressbook->plug( helpMenu ); | 1511 | mActionAboutKAddressbook->plug( helpMenu ); |
1488 | 1512 | ||
1513 | |||
1489 | if (QApplication::desktop()->width() > 320 ) { | 1514 | if (QApplication::desktop()->width() > 320 ) { |
1490 | 1515 | ||
1491 | mActionEditAddressee->plug( tb ); | 1516 | mActionEditAddressee->plug( tb ); |
1492 | mActionSave->plug( tb ); | 1517 | mActionSave->plug( tb ); |
1493 | mViewManager->getFilterAction()->plug ( tb); | 1518 | mViewManager->getFilterAction()->plug ( tb); |
1494 | if (QApplication::desktop()->width() > 480 ) | 1519 | if (QApplication::desktop()->width() > 480 ) { |
1495 | mActionDelete->plug( tb ); | 1520 | mActionUndo->plug( tb ); |
1521 | mActionDelete->plug( tb ); | ||
1522 | mActionRedo->plug( tb ); | ||
1523 | } | ||
1496 | } | 1524 | } |
1497 | mActionQuit->plug ( tb ); | 1525 | //mActionQuit->plug ( tb ); |
1498 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1526 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1499 | 1527 | ||
1500 | //US link the searchwidget first to this. | 1528 | //US link the searchwidget first to this. |
1501 | // The real linkage to the toolbar happens later. | 1529 | // The real linkage to the toolbar happens later. |
1502 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1530 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1503 | //US tb->insertItem( mIncSearchWidget ); | 1531 | //US tb->insertItem( mIncSearchWidget ); |
1504 | /*US | 1532 | /*US |
1505 | mIncSearchWidget = new IncSearchWidget( tb ); | 1533 | mIncSearchWidget = new IncSearchWidget( tb ); |
1506 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1534 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1507 | SLOT( incrementalSearch( const QString& ) ) ); | 1535 | SLOT( incrementalSearch( const QString& ) ) ); |
1508 | 1536 | ||
1509 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1537 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1510 | 1538 | ||
1511 | //US topLayout->addWidget( mJumpButtonBar ); | 1539 | //US topLayout->addWidget( mJumpButtonBar ); |
1512 | this->layout()->add( mJumpButtonBar ); | 1540 | this->layout()->add( mJumpButtonBar ); |
1513 | */ | 1541 | */ |
1514 | 1542 | ||
1515 | #endif //KAB_EMBEDDED | 1543 | #endif //KAB_EMBEDDED |
1516 | } | 1544 | } |
1517 | 1545 | ||
1518 | 1546 | ||
1519 | 1547 | ||
1520 | void KABCore::clipboardDataChanged() | 1548 | void KABCore::clipboardDataChanged() |
1521 | { | 1549 | { |
1522 | 1550 | ||
1523 | if ( mReadWrite ) | 1551 | if ( mReadWrite ) |
1524 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1552 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1525 | 1553 | ||
1526 | } | 1554 | } |
1527 | 1555 | ||
1528 | void KABCore::updateActionMenu() | 1556 | void KABCore::updateActionMenu() |
1529 | { | 1557 | { |
1530 | UndoStack *undo = UndoStack::instance(); | 1558 | UndoStack *undo = UndoStack::instance(); |
1531 | RedoStack *redo = RedoStack::instance(); | 1559 | RedoStack *redo = RedoStack::instance(); |
1532 | 1560 | ||
1533 | if ( undo->isEmpty() ) | 1561 | if ( undo->isEmpty() ) |
1534 | mActionUndo->setText( i18n( "Undo" ) ); | 1562 | mActionUndo->setText( i18n( "Undo" ) ); |
1535 | else | 1563 | else |
1536 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1564 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1537 | 1565 | ||
1538 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1566 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1539 | 1567 | ||
1540 | if ( !redo->top() ) | 1568 | if ( !redo->top() ) |
1541 | mActionRedo->setText( i18n( "Redo" ) ); | 1569 | mActionRedo->setText( i18n( "Redo" ) ); |
1542 | else | 1570 | else |
1543 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1571 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1544 | 1572 | ||
1545 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1573 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1546 | } | 1574 | } |
1547 | 1575 | ||
1548 | void KABCore::configureKeyBindings() | 1576 | void KABCore::configureKeyBindings() |
1549 | { | 1577 | { |
1550 | #ifndef KAB_EMBEDDED | 1578 | #ifndef KAB_EMBEDDED |
1551 | KKeyDialog::configure( actionCollection(), true ); | 1579 | KKeyDialog::configure( actionCollection(), true ); |
1552 | #else //KAB_EMBEDDED | 1580 | #else //KAB_EMBEDDED |
1553 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1581 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1554 | #endif //KAB_EMBEDDED | 1582 | #endif //KAB_EMBEDDED |
1555 | } | 1583 | } |
1556 | 1584 | ||
1557 | #ifdef KAB_EMBEDDED | 1585 | #ifdef KAB_EMBEDDED |
1558 | void KABCore::configureResources() | 1586 | void KABCore::configureResources() |
1559 | { | 1587 | { |
1560 | KRES::KCMKResources dlg( this, "" , 0 ); | 1588 | KRES::KCMKResources dlg( this, "" , 0 ); |
1561 | 1589 | ||
1562 | if ( !dlg.exec() ) | 1590 | if ( !dlg.exec() ) |
1563 | return; | 1591 | return; |
1564 | } | 1592 | } |
1565 | #endif //KAB_EMBEDDED | 1593 | #endif //KAB_EMBEDDED |
1566 | 1594 | ||
1567 | 1595 | ||
1568 | 1596 | ||
1569 | #ifndef KAB_EMBEDDED | 1597 | #ifndef KAB_EMBEDDED |
1570 | #include "kabcore.moc" | 1598 | #include "kabcore.moc" |
1571 | #endif //KAB_EMBEDDED | 1599 | #endif //KAB_EMBEDDED |