author | zautrix <zautrix> | 2004-06-29 11:59:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-29 11:59:46 (UTC) |
commit | da43dbdc6c82453228f34766fc74585615cba938 (patch) (unidiff) | |
tree | 16576932cea08bf117b2d0320b0d5f66ee8ad093 /kaddressbook/kabcore.cpp | |
parent | 627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff) | |
download | kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2 |
New lib ical.Some minor changes as well.
-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 | |||
@@ -81,230 +81,240 @@ | |||
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 | ||
@@ -1098,115 +1108,129 @@ void KABCore::initGUI() | |||
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. |
@@ -1441,105 +1465,109 @@ void KABCore::addActionsManually() | |||
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() ); |