-rw-r--r-- | kaddressbook/kabcore.cpp | 38 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
3 files changed, 42 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 9c40142..a4f3579 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -168,788 +168,822 @@ $Id$ | |||
168 | 168 | ||
169 | class KABCatPrefs : public QDialog | 169 | class KABCatPrefs : public QDialog |
170 | { | 170 | { |
171 | public: | 171 | public: |
172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 185 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | class KABFormatPrefs : public QDialog | 201 | class KABFormatPrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Set formatted name") ); | 207 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 212 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 214 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 215 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 219 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 220 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 222 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 224 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 226 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 229 | //resize( 200, 200 ); |
230 | 230 | ||
231 | } | 231 | } |
232 | public: | 232 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 233 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 234 | QCheckBox* setCompany; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | class KAex2phonePrefs : public QDialog | 239 | class KAex2phonePrefs : public QDialog |
240 | { | 240 | { |
241 | public: | 241 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 243 | QDialog( parent, name, true ) |
244 | { | 244 | { |
245 | setCaption( i18n("Export to phone options") ); | 245 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 246 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 247 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 248 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 249 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 251 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 252 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 253 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 256 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 257 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 258 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 259 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 260 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 261 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 262 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 263 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 264 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 266 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 268 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 270 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 272 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 275 | resize( 220, 240 ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | public: | 279 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 281 | QCheckBox* mWriteToSim; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | 284 | ||
285 | bool pasteWithNewUid = true; | 285 | bool pasteWithNewUid = true; |
286 | 286 | ||
287 | #ifdef KAB_EMBEDDED | 287 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 296 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | 301 | mIncSearchWidget = 0; |
302 | mMiniSplitter = 0; | 302 | mMiniSplitter = 0; |
303 | mExtensionBarSplitter = 0; | 303 | mExtensionBarSplitter = 0; |
304 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 304 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
305 | mAddressBook = KABC::StdAddressBook::self(); | 305 | mAddressBook = KABC::StdAddressBook::self(); |
306 | KABC::StdAddressBook::setAutomaticSave( false ); | 306 | KABC::StdAddressBook::setAutomaticSave( false ); |
307 | 307 | ||
308 | #ifndef KAB_EMBEDDED | 308 | #ifndef KAB_EMBEDDED |
309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
310 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
311 | 311 | ||
312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
313 | SLOT( addressBookChanged() ) ); | 313 | SLOT( addressBookChanged() ) ); |
314 | 314 | ||
315 | #if 0 | 315 | #if 0 |
316 | // LR moved to addressbook init method | 316 | // LR moved to addressbook init method |
317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
318 | "X-Department", "KADDRESSBOOK" ); | 318 | "X-Department", "KADDRESSBOOK" ); |
319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
320 | "X-Profession", "KADDRESSBOOK" ); | 320 | "X-Profession", "KADDRESSBOOK" ); |
321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
322 | "X-AssistantsName", "KADDRESSBOOK" ); | 322 | "X-AssistantsName", "KADDRESSBOOK" ); |
323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
324 | "X-ManagersName", "KADDRESSBOOK" ); | 324 | "X-ManagersName", "KADDRESSBOOK" ); |
325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
326 | "X-SpousesName", "KADDRESSBOOK" ); | 326 | "X-SpousesName", "KADDRESSBOOK" ); |
327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
328 | "X-Office", "KADDRESSBOOK" ); | 328 | "X-Office", "KADDRESSBOOK" ); |
329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
330 | "X-IMAddress", "KADDRESSBOOK" ); | 330 | "X-IMAddress", "KADDRESSBOOK" ); |
331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
332 | "X-Anniversary", "KADDRESSBOOK" ); | 332 | "X-Anniversary", "KADDRESSBOOK" ); |
333 | 333 | ||
334 | //US added this field to become compatible with Opie/qtopia addressbook | 334 | //US added this field to become compatible with Opie/qtopia addressbook |
335 | // values can be "female" or "male" or "". An empty field represents undefined. | 335 | // values can be "female" or "male" or "". An empty field represents undefined. |
336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
337 | "X-Gender", "KADDRESSBOOK" ); | 337 | "X-Gender", "KADDRESSBOOK" ); |
338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
339 | "X-Children", "KADDRESSBOOK" ); | 339 | "X-Children", "KADDRESSBOOK" ); |
340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
342 | #endif | 342 | #endif |
343 | initGUI(); | 343 | initGUI(); |
344 | 344 | ||
345 | mIncSearchWidget->setFocus(); | 345 | mIncSearchWidget->setFocus(); |
346 | 346 | ||
347 | 347 | ||
348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
349 | SLOT( setContactSelected( const QString& ) ) ); | 349 | SLOT( setContactSelected( const QString& ) ) ); |
350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
351 | SLOT( executeContact( const QString& ) ) ); | 351 | SLOT( executeContact( const QString& ) ) ); |
352 | 352 | ||
353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
354 | SLOT( deleteContacts( ) ) ); | 354 | SLOT( deleteContacts( ) ) ); |
355 | connect( mViewManager, SIGNAL( modified() ), | 355 | connect( mViewManager, SIGNAL( modified() ), |
356 | SLOT( setModified() ) ); | 356 | SLOT( setModified() ) ); |
357 | 357 | ||
358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
360 | 360 | ||
361 | connect( mXXPortManager, SIGNAL( modified() ), | 361 | connect( mXXPortManager, SIGNAL( modified() ), |
362 | SLOT( setModified() ) ); | 362 | SLOT( setModified() ) ); |
363 | 363 | ||
364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
365 | SLOT( incrementalSearchJump( const QString& ) ) ); | 365 | SLOT( incrementalSearchJump( const QString& ) ) ); |
366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
367 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 367 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
368 | 368 | ||
369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
370 | SLOT( sendMail( const QString& ) ) ); | 370 | SLOT( sendMail( const QString& ) ) ); |
371 | 371 | ||
372 | 372 | ||
373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
378 | 378 | ||
379 | 379 | ||
380 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
383 | 383 | ||
384 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 384 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
385 | SLOT( browse( const QString& ) ) ); | 385 | SLOT( browse( const QString& ) ) ); |
386 | 386 | ||
387 | 387 | ||
388 | mAddressBookService = new KAddressBookService( this ); | 388 | mAddressBookService = new KAddressBookService( this ); |
389 | 389 | ||
390 | #endif //KAB_EMBEDDED | 390 | #endif //KAB_EMBEDDED |
391 | 391 | ||
392 | mMessageTimer = new QTimer( this ); | 392 | mMessageTimer = new QTimer( this ); |
393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
394 | mEditorDialog = 0; | 394 | mEditorDialog = 0; |
395 | createAddresseeEditorDialog( this ); | 395 | createAddresseeEditorDialog( this ); |
396 | setModified( false ); | 396 | setModified( false ); |
397 | mBRdisabled = false; | 397 | mBRdisabled = false; |
398 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
399 | infrared = 0; | 399 | infrared = 0; |
400 | #endif | 400 | #endif |
401 | //toggleBeamReceive( ); | 401 | //toggleBeamReceive( ); |
402 | mMainWindow->toolBar()->show(); | 402 | mMainWindow->toolBar()->show(); |
403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
405 | } | 405 | } |
406 | 406 | ||
407 | void KABCore::updateToolBar() | 407 | void KABCore::updateToolBar() |
408 | { | 408 | { |
409 | static int iii = 0; | 409 | static int iii = 0; |
410 | ++iii; | 410 | ++iii; |
411 | mMainWindow->toolBar()->repaintMe(); | 411 | mMainWindow->toolBar()->repaintMe(); |
412 | if ( iii < 4 ) | 412 | if ( iii < 4 ) |
413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
414 | } | 414 | } |
415 | KABCore::~KABCore() | 415 | KABCore::~KABCore() |
416 | { | 416 | { |
417 | // save(); | 417 | // save(); |
418 | //saveSettings(); | 418 | //saveSettings(); |
419 | //KABPrefs::instance()->writeConfig(); | 419 | //KABPrefs::instance()->writeConfig(); |
420 | delete AddresseeConfig::instance(); | 420 | delete AddresseeConfig::instance(); |
421 | mAddressBook = 0; | 421 | mAddressBook = 0; |
422 | KABC::StdAddressBook::close(); | 422 | KABC::StdAddressBook::close(); |
423 | 423 | ||
424 | delete syncManager; | 424 | delete syncManager; |
425 | #ifndef DESKTOP_VERSION | 425 | #ifndef DESKTOP_VERSION |
426 | if ( infrared ) | 426 | if ( infrared ) |
427 | delete infrared; | 427 | delete infrared; |
428 | #endif | 428 | #endif |
429 | } | 429 | } |
430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
431 | { | 431 | { |
432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
433 | if ( cmsg == "setDocument(QString)" ) { | 433 | if ( cmsg == "setDocument(QString)" ) { |
434 | QDataStream stream( data, IO_ReadOnly ); | 434 | QDataStream stream( data, IO_ReadOnly ); |
435 | QString fileName; | 435 | QString fileName; |
436 | stream >> fileName; | 436 | stream >> fileName; |
437 | recieve( fileName ); | 437 | recieve( fileName ); |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | void KABCore::toggleBeamReceive( ) | 441 | void KABCore::toggleBeamReceive( ) |
442 | { | 442 | { |
443 | if ( mBRdisabled ) | 443 | if ( mBRdisabled ) |
444 | return; | 444 | return; |
445 | #ifndef DESKTOP_VERSION | 445 | #ifndef DESKTOP_VERSION |
446 | if ( infrared ) { | 446 | if ( infrared ) { |
447 | qDebug("KA: AB disable BeamReceive "); | 447 | qDebug("KA: AB disable BeamReceive "); |
448 | delete infrared; | 448 | delete infrared; |
449 | infrared = 0; | 449 | infrared = 0; |
450 | mActionBR->setChecked(false); | 450 | mActionBR->setChecked(false); |
451 | return; | 451 | return; |
452 | } | 452 | } |
453 | qDebug("KA: AB enable BeamReceive "); | 453 | qDebug("KA: AB enable BeamReceive "); |
454 | mActionBR->setChecked(true); | 454 | mActionBR->setChecked(true); |
455 | 455 | ||
456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
458 | #endif | 458 | #endif |
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | void KABCore::disableBR(bool b) | 462 | void KABCore::disableBR(bool b) |
463 | { | 463 | { |
464 | #ifndef DESKTOP_VERSION | 464 | #ifndef DESKTOP_VERSION |
465 | if ( b ) { | 465 | if ( b ) { |
466 | if ( infrared ) { | 466 | if ( infrared ) { |
467 | toggleBeamReceive( ); | 467 | toggleBeamReceive( ); |
468 | } | 468 | } |
469 | mBRdisabled = true; | 469 | mBRdisabled = true; |
470 | } else { | 470 | } else { |
471 | if ( mBRdisabled ) { | 471 | if ( mBRdisabled ) { |
472 | mBRdisabled = false; | 472 | mBRdisabled = false; |
473 | //toggleBeamReceive( ); | 473 | //toggleBeamReceive( ); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | } | 478 | } |
479 | void KABCore::recieve( QString fn ) | 479 | void KABCore::recieve( QString fn ) |
480 | { | 480 | { |
481 | //qDebug("KABCore::recieve "); | 481 | //qDebug("KABCore::recieve "); |
482 | int count = mAddressBook->importFromFile( fn, true ); | 482 | int count = mAddressBook->importFromFile( fn, true ); |
483 | if ( count ) | 483 | if ( count ) |
484 | setModified( true ); | 484 | setModified( true ); |
485 | mViewManager->refreshView(); | 485 | mViewManager->refreshView(); |
486 | message(i18n("%1 contact(s) received!").arg( count )); | 486 | message(i18n("%1 contact(s) received!").arg( count )); |
487 | topLevelWidget()->showMaximized(); | 487 | topLevelWidget()->showMaximized(); |
488 | topLevelWidget()->raise(); | 488 | topLevelWidget()->raise(); |
489 | } | 489 | } |
490 | void KABCore::restoreSettings() | 490 | void KABCore::restoreSettings() |
491 | { | 491 | { |
492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
493 | 493 | ||
494 | bool state; | 494 | bool state; |
495 | 495 | ||
496 | if (mMultipleViewsAtOnce) | 496 | if (mMultipleViewsAtOnce) |
497 | state = KABPrefs::instance()->mDetailsPageVisible; | 497 | state = KABPrefs::instance()->mDetailsPageVisible; |
498 | else | 498 | else |
499 | state = false; | 499 | state = false; |
500 | 500 | ||
501 | mActionDetails->setChecked( state ); | 501 | mActionDetails->setChecked( state ); |
502 | setDetailsVisible( state ); | 502 | setDetailsVisible( state ); |
503 | 503 | ||
504 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 504 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
505 | 505 | ||
506 | mActionJumpBar->setChecked( state ); | 506 | mActionJumpBar->setChecked( state ); |
507 | setJumpButtonBarVisible( state ); | 507 | setJumpButtonBarVisible( state ); |
508 | /*US | 508 | /*US |
509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
510 | if ( splitterSize.count() == 0 ) { | 510 | if ( splitterSize.count() == 0 ) { |
511 | splitterSize.append( width() / 2 ); | 511 | splitterSize.append( width() / 2 ); |
512 | splitterSize.append( width() / 2 ); | 512 | splitterSize.append( width() / 2 ); |
513 | } | 513 | } |
514 | mMiniSplitter->setSizes( splitterSize ); | 514 | mMiniSplitter->setSizes( splitterSize ); |
515 | if ( mExtensionBarSplitter ) { | 515 | if ( mExtensionBarSplitter ) { |
516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
517 | if ( splitterSize.count() == 0 ) { | 517 | if ( splitterSize.count() == 0 ) { |
518 | splitterSize.append( width() / 2 ); | 518 | splitterSize.append( width() / 2 ); |
519 | splitterSize.append( width() / 2 ); | 519 | splitterSize.append( width() / 2 ); |
520 | } | 520 | } |
521 | mExtensionBarSplitter->setSizes( splitterSize ); | 521 | mExtensionBarSplitter->setSizes( splitterSize ); |
522 | 522 | ||
523 | } | 523 | } |
524 | */ | 524 | */ |
525 | mViewManager->restoreSettings(); | 525 | mViewManager->restoreSettings(); |
526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
527 | mExtensionManager->restoreSettings(); | 527 | mExtensionManager->restoreSettings(); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | int wid = width(); | 529 | int wid = width(); |
530 | if ( wid < 10 ) | 530 | if ( wid < 10 ) |
531 | wid = 400; | 531 | wid = 400; |
532 | #else | 532 | #else |
533 | int wid = QApplication::desktop()->width(); | 533 | int wid = QApplication::desktop()->width(); |
534 | if ( wid < 640 ) | 534 | if ( wid < 640 ) |
535 | wid = QApplication::desktop()->height(); | 535 | wid = QApplication::desktop()->height(); |
536 | #endif | 536 | #endif |
537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
538 | if ( true /*splitterSize.count() == 0*/ ) { | 538 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
541 | } | 541 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 542 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 543 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 545 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
548 | } | 548 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 549 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | #ifdef DESKTOP_VERSION | |
553 | 553 | KConfig *config = KABPrefs::instance()->getConfig(); | |
554 | config->setGroup("WidgetLayout"); | ||
555 | QStringList list; | ||
556 | list = config->readListEntry("MainLayout"); | ||
557 | int x,y,w,h; | ||
558 | if ( ! list.isEmpty() ) { | ||
559 | x = list[0].toInt(); | ||
560 | y = list[1].toInt(); | ||
561 | w = list[2].toInt(); | ||
562 | h = list[3].toInt(); | ||
563 | KApplication::testCoords( &x,&y,&w,&h ); | ||
564 | topLevelWidget()->setGeometry(x,y,w,h); | ||
565 | |||
566 | } else { | ||
567 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | ||
568 | } | ||
569 | #endif | ||
554 | } | 570 | } |
555 | 571 | ||
556 | void KABCore::saveSettings() | 572 | void KABCore::saveSettings() |
557 | { | 573 | { |
558 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 574 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
559 | if ( mExtensionBarSplitter ) | 575 | if ( mExtensionBarSplitter ) |
560 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 576 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
561 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 577 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
562 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 578 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
563 | #ifndef KAB_EMBEDDED | 579 | #ifndef KAB_EMBEDDED |
564 | 580 | ||
565 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 581 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
566 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 582 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
567 | #endif //KAB_EMBEDDED | 583 | #endif //KAB_EMBEDDED |
568 | mExtensionManager->saveSettings(); | 584 | mExtensionManager->saveSettings(); |
569 | mViewManager->saveSettings(); | 585 | mViewManager->saveSettings(); |
570 | 586 | ||
571 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 587 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
588 | #ifdef DESKTOP_VERSION | ||
589 | KConfig *config = KABPrefs::instance()->getConfig(); | ||
590 | config->setGroup("WidgetLayout"); | ||
591 | QStringList list ;//= config->readListEntry("MainLayout"); | ||
592 | int x,y,w,h; | ||
593 | QWidget* wid; | ||
594 | wid = topLevelWidget(); | ||
595 | x = wid->geometry().x(); | ||
596 | y = wid->geometry().y(); | ||
597 | w = wid->width(); | ||
598 | h = wid->height(); | ||
599 | list.clear(); | ||
600 | list << QString::number( x ); | ||
601 | list << QString::number( y ); | ||
602 | list << QString::number( w ); | ||
603 | list << QString::number( h ); | ||
604 | config->writeEntry("MainLayout",list ); | ||
605 | #endif | ||
572 | KABPrefs::instance()->writeConfig(); | 606 | KABPrefs::instance()->writeConfig(); |
573 | qDebug("KA: KABCore::saveSettings() "); | 607 | qDebug("KA: KABCore::saveSettings() "); |
574 | } | 608 | } |
575 | 609 | ||
576 | KABC::AddressBook *KABCore::addressBook() const | 610 | KABC::AddressBook *KABCore::addressBook() const |
577 | { | 611 | { |
578 | return mAddressBook; | 612 | return mAddressBook; |
579 | } | 613 | } |
580 | 614 | ||
581 | KConfig *KABCore::config() | 615 | KConfig *KABCore::config() |
582 | { | 616 | { |
583 | #ifndef KAB_EMBEDDED | 617 | #ifndef KAB_EMBEDDED |
584 | return KABPrefs::instance()->config(); | 618 | return KABPrefs::instance()->config(); |
585 | #else //KAB_EMBEDDED | 619 | #else //KAB_EMBEDDED |
586 | return KABPrefs::instance()->getConfig(); | 620 | return KABPrefs::instance()->getConfig(); |
587 | #endif //KAB_EMBEDDED | 621 | #endif //KAB_EMBEDDED |
588 | } | 622 | } |
589 | 623 | ||
590 | KActionCollection *KABCore::actionCollection() const | 624 | KActionCollection *KABCore::actionCollection() const |
591 | { | 625 | { |
592 | return mGUIClient->actionCollection(); | 626 | return mGUIClient->actionCollection(); |
593 | } | 627 | } |
594 | 628 | ||
595 | KABC::Field *KABCore::currentSearchField() const | 629 | KABC::Field *KABCore::currentSearchField() const |
596 | { | 630 | { |
597 | if (mIncSearchWidget) | 631 | if (mIncSearchWidget) |
598 | return mIncSearchWidget->currentField(); | 632 | return mIncSearchWidget->currentField(); |
599 | else | 633 | else |
600 | return 0; | 634 | return 0; |
601 | } | 635 | } |
602 | 636 | ||
603 | QStringList KABCore::selectedUIDs() const | 637 | QStringList KABCore::selectedUIDs() const |
604 | { | 638 | { |
605 | return mViewManager->selectedUids(); | 639 | return mViewManager->selectedUids(); |
606 | } | 640 | } |
607 | 641 | ||
608 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 642 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
609 | { | 643 | { |
610 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 644 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
611 | 645 | ||
612 | QPtrList<KRES::Resource> kresResources; | 646 | QPtrList<KRES::Resource> kresResources; |
613 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 647 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
614 | KABC::Resource *resource; | 648 | KABC::Resource *resource; |
615 | while ( ( resource = resIt.current() ) != 0 ) { | 649 | while ( ( resource = resIt.current() ) != 0 ) { |
616 | ++resIt; | 650 | ++resIt; |
617 | if ( !resource->readOnly() ) { | 651 | if ( !resource->readOnly() ) { |
618 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 652 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
619 | if ( res ) | 653 | if ( res ) |
620 | kresResources.append( res ); | 654 | kresResources.append( res ); |
621 | } | 655 | } |
622 | } | 656 | } |
623 | 657 | ||
624 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 658 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
625 | return static_cast<KABC::Resource*>( res ); | 659 | return static_cast<KABC::Resource*>( res ); |
626 | } | 660 | } |
627 | 661 | ||
628 | #ifndef KAB_EMBEDDED | 662 | #ifndef KAB_EMBEDDED |
629 | KAboutData *KABCore::createAboutData() | 663 | KAboutData *KABCore::createAboutData() |
630 | #else //KAB_EMBEDDED | 664 | #else //KAB_EMBEDDED |
631 | void KABCore::createAboutData() | 665 | void KABCore::createAboutData() |
632 | #endif //KAB_EMBEDDED | 666 | #endif //KAB_EMBEDDED |
633 | { | 667 | { |
634 | 668 | ||
635 | 669 | ||
636 | QString version; | 670 | QString version; |
637 | #include <../version> | 671 | #include <../version> |
638 | QMessageBox::about( this, "About KAddressbook/Pi", | 672 | QMessageBox::about( this, "About KAddressbook/Pi", |
639 | "KAddressbook/Platform-independent\n" | 673 | "KAddressbook/Platform-independent\n" |
640 | "(KA/Pi) " +version + " - " + | 674 | "(KA/Pi) " +version + " - " + |
641 | #ifdef DESKTOP_VERSION | 675 | #ifdef DESKTOP_VERSION |
642 | "Desktop Edition\n" | 676 | "Desktop Edition\n" |
643 | #else | 677 | #else |
644 | "PDA-Edition\n" | 678 | "PDA-Edition\n" |
645 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 679 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
646 | #endif | 680 | #endif |
647 | 681 | ||
648 | "(c) 2004 Ulf Schenk\n" | 682 | "(c) 2004 Ulf Schenk\n" |
649 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" | 683 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" |
650 | "(c) 1997-2003, The KDE PIM Team\n" | 684 | "(c) 1997-2003, The KDE PIM Team\n" |
651 | "Tobias Koenig Maintainer\n" | 685 | "Tobias Koenig Maintainer\n" |
652 | "Don Sanders Original author\n" | 686 | "Don Sanders Original author\n" |
653 | "Cornelius Schumacher Co-maintainer\n" | 687 | "Cornelius Schumacher Co-maintainer\n" |
654 | "Mike Pilone GUI and framework redesign\n" | 688 | "Mike Pilone GUI and framework redesign\n" |
655 | "Greg Stern DCOP interface\n" | 689 | "Greg Stern DCOP interface\n" |
656 | "Mark Westcot Contact pinning\n" | 690 | "Mark Westcot Contact pinning\n" |
657 | "Michel Boyer de la Giroday LDAP Lookup\n" | 691 | "Michel Boyer de la Giroday LDAP Lookup\n" |
658 | "Steffen Hansen LDAP Lookup" | 692 | "Steffen Hansen LDAP Lookup" |
659 | #ifdef _WIN32_ | 693 | #ifdef _WIN32_ |
660 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 694 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
661 | #endif | 695 | #endif |
662 | ); | 696 | ); |
663 | } | 697 | } |
664 | 698 | ||
665 | void KABCore::setContactSelected( const QString &uid ) | 699 | void KABCore::setContactSelected( const QString &uid ) |
666 | { | 700 | { |
667 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 701 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
668 | if ( !mDetails->isHidden() ) | 702 | if ( !mDetails->isHidden() ) |
669 | mDetails->setAddressee( addr ); | 703 | mDetails->setAddressee( addr ); |
670 | 704 | ||
671 | if ( !addr.isEmpty() ) { | 705 | if ( !addr.isEmpty() ) { |
672 | emit contactSelected( addr.formattedName() ); | 706 | emit contactSelected( addr.formattedName() ); |
673 | KABC::Picture pic = addr.photo(); | 707 | KABC::Picture pic = addr.photo(); |
674 | if ( pic.isIntern() ) { | 708 | if ( pic.isIntern() ) { |
675 | //US emit contactSelected( pic.data() ); | 709 | //US emit contactSelected( pic.data() ); |
676 | //US instead use: | 710 | //US instead use: |
677 | QPixmap px; | 711 | QPixmap px; |
678 | if (pic.data().isNull() != true) | 712 | if (pic.data().isNull() != true) |
679 | { | 713 | { |
680 | px.convertFromImage(pic.data()); | 714 | px.convertFromImage(pic.data()); |
681 | } | 715 | } |
682 | 716 | ||
683 | emit contactSelected( px ); | 717 | emit contactSelected( px ); |
684 | } | 718 | } |
685 | } | 719 | } |
686 | 720 | ||
687 | 721 | ||
688 | mExtensionManager->setSelectionChanged(); | 722 | mExtensionManager->setSelectionChanged(); |
689 | 723 | ||
690 | // update the actions | 724 | // update the actions |
691 | bool selected = !uid.isEmpty(); | 725 | bool selected = !uid.isEmpty(); |
692 | 726 | ||
693 | if ( mReadWrite ) { | 727 | if ( mReadWrite ) { |
694 | mActionCut->setEnabled( selected ); | 728 | mActionCut->setEnabled( selected ); |
695 | mActionPaste->setEnabled( selected ); | 729 | mActionPaste->setEnabled( selected ); |
696 | } | 730 | } |
697 | 731 | ||
698 | mActionCopy->setEnabled( selected ); | 732 | mActionCopy->setEnabled( selected ); |
699 | mActionDelete->setEnabled( selected ); | 733 | mActionDelete->setEnabled( selected ); |
700 | mActionEditAddressee->setEnabled( selected ); | 734 | mActionEditAddressee->setEnabled( selected ); |
701 | mActionMail->setEnabled( selected ); | 735 | mActionMail->setEnabled( selected ); |
702 | mActionMailVCard->setEnabled( selected ); | 736 | mActionMailVCard->setEnabled( selected ); |
703 | //if (mActionBeam) | 737 | //if (mActionBeam) |
704 | //mActionBeam->setEnabled( selected ); | 738 | //mActionBeam->setEnabled( selected ); |
705 | mActionWhoAmI->setEnabled( selected ); | 739 | mActionWhoAmI->setEnabled( selected ); |
706 | } | 740 | } |
707 | 741 | ||
708 | void KABCore::sendMail() | 742 | void KABCore::sendMail() |
709 | { | 743 | { |
710 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 744 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
711 | } | 745 | } |
712 | 746 | ||
713 | void KABCore::sendMail( const QString& emaillist ) | 747 | void KABCore::sendMail( const QString& emaillist ) |
714 | { | 748 | { |
715 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 749 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
716 | if (emaillist.contains(",") > 0) | 750 | if (emaillist.contains(",") > 0) |
717 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 751 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
718 | else | 752 | else |
719 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 753 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
720 | } | 754 | } |
721 | 755 | ||
722 | 756 | ||
723 | 757 | ||
724 | void KABCore::mailVCard() | 758 | void KABCore::mailVCard() |
725 | { | 759 | { |
726 | QStringList uids = mViewManager->selectedUids(); | 760 | QStringList uids = mViewManager->selectedUids(); |
727 | if ( !uids.isEmpty() ) | 761 | if ( !uids.isEmpty() ) |
728 | mailVCard( uids ); | 762 | mailVCard( uids ); |
729 | } | 763 | } |
730 | 764 | ||
731 | void KABCore::mailVCard( const QStringList& uids ) | 765 | void KABCore::mailVCard( const QStringList& uids ) |
732 | { | 766 | { |
733 | QStringList urls; | 767 | QStringList urls; |
734 | 768 | ||
735 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 769 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
736 | 770 | ||
737 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 771 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
738 | 772 | ||
739 | 773 | ||
740 | 774 | ||
741 | QDir().mkdir( dirName, true ); | 775 | QDir().mkdir( dirName, true ); |
742 | 776 | ||
743 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 777 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
744 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 778 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
745 | 779 | ||
746 | if ( a.isEmpty() ) | 780 | if ( a.isEmpty() ) |
747 | continue; | 781 | continue; |
748 | 782 | ||
749 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 783 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
750 | 784 | ||
751 | QString fileName = dirName + "/" + name; | 785 | QString fileName = dirName + "/" + name; |
752 | 786 | ||
753 | QFile outFile(fileName); | 787 | QFile outFile(fileName); |
754 | 788 | ||
755 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 789 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
756 | KABC::VCardConverter converter; | 790 | KABC::VCardConverter converter; |
757 | QString vcard; | 791 | QString vcard; |
758 | 792 | ||
759 | converter.addresseeToVCard( a, vcard ); | 793 | converter.addresseeToVCard( a, vcard ); |
760 | 794 | ||
761 | QTextStream t( &outFile ); // use a text stream | 795 | QTextStream t( &outFile ); // use a text stream |
762 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 796 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
763 | t << vcard; | 797 | t << vcard; |
764 | 798 | ||
765 | outFile.close(); | 799 | outFile.close(); |
766 | 800 | ||
767 | urls.append( fileName ); | 801 | urls.append( fileName ); |
768 | } | 802 | } |
769 | } | 803 | } |
770 | 804 | ||
771 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 805 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
772 | 806 | ||
773 | 807 | ||
774 | /*US | 808 | /*US |
775 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 809 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
776 | QString::null, // subject | 810 | QString::null, // subject |
777 | QString::null, // body | 811 | QString::null, // body |
778 | QString::null, | 812 | QString::null, |
779 | urls ); // attachments | 813 | urls ); // attachments |
780 | */ | 814 | */ |
781 | 815 | ||
782 | } | 816 | } |
783 | 817 | ||
784 | /** | 818 | /** |
785 | Beams the "WhoAmI contact. | 819 | Beams the "WhoAmI contact. |
786 | */ | 820 | */ |
787 | void KABCore::beamMySelf() | 821 | void KABCore::beamMySelf() |
788 | { | 822 | { |
789 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 823 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
790 | if (!a.isEmpty()) | 824 | if (!a.isEmpty()) |
791 | { | 825 | { |
792 | QStringList uids; | 826 | QStringList uids; |
793 | uids << a.uid(); | 827 | uids << a.uid(); |
794 | 828 | ||
795 | beamVCard(uids); | 829 | beamVCard(uids); |
796 | } else { | 830 | } else { |
797 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 831 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
798 | 832 | ||
799 | 833 | ||
800 | } | 834 | } |
801 | } | 835 | } |
802 | void KABCore::updateMainWindow() | 836 | void KABCore::updateMainWindow() |
803 | { | 837 | { |
804 | mMainWindow->showMaximized(); | 838 | mMainWindow->showMaximized(); |
805 | mMainWindow->update(); | 839 | mMainWindow->update(); |
806 | } | 840 | } |
807 | void KABCore::resizeEvent(QResizeEvent* e ) | 841 | void KABCore::resizeEvent(QResizeEvent* e ) |
808 | { | 842 | { |
809 | if ( !mMiniSplitter ) | 843 | if ( !mMiniSplitter ) |
810 | return; | 844 | return; |
811 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 845 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); |
812 | if ( QApplication::desktop()->width() >= 480 ) { | 846 | if ( QApplication::desktop()->width() >= 480 ) { |
813 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 847 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
814 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 848 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
815 | mMiniSplitter->setOrientation( Qt::Horizontal); | 849 | mMiniSplitter->setOrientation( Qt::Horizontal); |
816 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 850 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
817 | } | 851 | } |
818 | if ( QApplication::desktop()->width() <= 640 ) { | 852 | if ( QApplication::desktop()->width() <= 640 ) { |
819 | mMainWindow->showMinimized(); | 853 | mMainWindow->showMinimized(); |
820 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 854 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
821 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 855 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
822 | if ( mIncSearchWidget ) | 856 | if ( mIncSearchWidget ) |
823 | mIncSearchWidget->setSize(); | 857 | mIncSearchWidget->setSize(); |
824 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 858 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
825 | } | 859 | } |
826 | 860 | ||
827 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 861 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
828 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 862 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
829 | mMiniSplitter->setOrientation( Qt::Vertical ); | 863 | mMiniSplitter->setOrientation( Qt::Vertical ); |
830 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 864 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
831 | } | 865 | } |
832 | if ( QApplication::desktop()->width() <= 640 ) { | 866 | if ( QApplication::desktop()->width() <= 640 ) { |
833 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 867 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
834 | mMainWindow->showMinimized(); | 868 | mMainWindow->showMinimized(); |
835 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 869 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
836 | if ( mIncSearchWidget ) { | 870 | if ( mIncSearchWidget ) { |
837 | mIncSearchWidget->setSize(); | 871 | mIncSearchWidget->setSize(); |
838 | } | 872 | } |
839 | } else { | 873 | } else { |
840 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 874 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
841 | } | 875 | } |
842 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 876 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
843 | } | 877 | } |
844 | } | 878 | } |
845 | } | 879 | } |
846 | QWidget::resizeEvent( e ); | 880 | QWidget::resizeEvent( e ); |
847 | 881 | ||
848 | } | 882 | } |
849 | void KABCore::export2phone() | 883 | void KABCore::export2phone() |
850 | { | 884 | { |
851 | 885 | ||
852 | QStringList uids; | 886 | QStringList uids; |
853 | XXPortSelectDialog dlg( this, false, this ); | 887 | XXPortSelectDialog dlg( this, false, this ); |
854 | if ( dlg.exec() ) | 888 | if ( dlg.exec() ) |
855 | uids = dlg.uids(); | 889 | uids = dlg.uids(); |
856 | else | 890 | else |
857 | return; | 891 | return; |
858 | if ( uids.isEmpty() ) | 892 | if ( uids.isEmpty() ) |
859 | return; | 893 | return; |
860 | // qDebug("count %d ", uids.count()); | 894 | // qDebug("count %d ", uids.count()); |
861 | 895 | ||
862 | KAex2phonePrefs ex2phone; | 896 | KAex2phonePrefs ex2phone; |
863 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 897 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
864 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 898 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
865 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 899 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
866 | 900 | ||
867 | if ( !ex2phone.exec() ) { | 901 | if ( !ex2phone.exec() ) { |
868 | return; | 902 | return; |
869 | } | 903 | } |
870 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 904 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
871 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 905 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
872 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 906 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
873 | 907 | ||
874 | 908 | ||
875 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 909 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
876 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 910 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
877 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 911 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
878 | 912 | ||
879 | QString fileName = getPhoneFile(); | 913 | QString fileName = getPhoneFile(); |
880 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 914 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
881 | return; | 915 | return; |
882 | 916 | ||
883 | message(i18n("Exporting to phone...")); | 917 | message(i18n("Exporting to phone...")); |
884 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 918 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
885 | 919 | ||
886 | } | 920 | } |
887 | QString KABCore::getPhoneFile() | 921 | QString KABCore::getPhoneFile() |
888 | { | 922 | { |
889 | #ifdef DESKTOP_VERSION | 923 | #ifdef DESKTOP_VERSION |
890 | return locateLocal("tmp", "phonefile.vcf"); | 924 | return locateLocal("tmp", "phonefile.vcf"); |
891 | #else | 925 | #else |
892 | return "/tmp/phonefile.vcf"; | 926 | return "/tmp/phonefile.vcf"; |
893 | #endif | 927 | #endif |
894 | 928 | ||
895 | } | 929 | } |
896 | void KABCore::writeToPhone( ) | 930 | void KABCore::writeToPhone( ) |
897 | { | 931 | { |
898 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 932 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
899 | message(i18n("Export to phone finished!")); | 933 | message(i18n("Export to phone finished!")); |
900 | else | 934 | else |
901 | qDebug(i18n("KA: Error exporting to phone")); | 935 | qDebug(i18n("KA: Error exporting to phone")); |
902 | } | 936 | } |
903 | void KABCore::beamVCard() | 937 | void KABCore::beamVCard() |
904 | { | 938 | { |
905 | QStringList uids; | 939 | QStringList uids; |
906 | XXPortSelectDialog dlg( this, false, this ); | 940 | XXPortSelectDialog dlg( this, false, this ); |
907 | if ( dlg.exec() ) | 941 | if ( dlg.exec() ) |
908 | uids = dlg.uids(); | 942 | uids = dlg.uids(); |
909 | else | 943 | else |
910 | return; | 944 | return; |
911 | if ( uids.isEmpty() ) | 945 | if ( uids.isEmpty() ) |
912 | return; | 946 | return; |
913 | beamVCard( uids ); | 947 | beamVCard( uids ); |
914 | } | 948 | } |
915 | 949 | ||
916 | 950 | ||
917 | void KABCore::beamVCard(const QStringList& uids) | 951 | void KABCore::beamVCard(const QStringList& uids) |
918 | { | 952 | { |
919 | 953 | ||
920 | // LR: we should use the /tmp dir on the Zaurus, | 954 | // LR: we should use the /tmp dir on the Zaurus, |
921 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 955 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
922 | 956 | ||
923 | #ifdef DESKTOP_VERSION | 957 | #ifdef DESKTOP_VERSION |
924 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 958 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
925 | #else | 959 | #else |
926 | QString fileName = "/tmp/kapibeamfile.vcf"; | 960 | QString fileName = "/tmp/kapibeamfile.vcf"; |
927 | #endif | 961 | #endif |
928 | 962 | ||
929 | KABC::VCardConverter converter; | 963 | KABC::VCardConverter converter; |
930 | QString description; | 964 | QString description; |
931 | QString datastream; | 965 | QString datastream; |
932 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 966 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
933 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 967 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
934 | 968 | ||
935 | if ( a.isEmpty() ) | 969 | if ( a.isEmpty() ) |
936 | continue; | 970 | continue; |
937 | 971 | ||
938 | if (description.isEmpty()) | 972 | if (description.isEmpty()) |
939 | description = a.formattedName(); | 973 | description = a.formattedName(); |
940 | 974 | ||
941 | QString vcard; | 975 | QString vcard; |
942 | converter.addresseeToVCard( a, vcard ); | 976 | converter.addresseeToVCard( a, vcard ); |
943 | int start = 0; | 977 | int start = 0; |
944 | int next; | 978 | int next; |
945 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 979 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
946 | int semi = vcard.find(";", next); | 980 | int semi = vcard.find(";", next); |
947 | int dopp = vcard.find(":", next); | 981 | int dopp = vcard.find(":", next); |
948 | int sep; | 982 | int sep; |
949 | if ( semi < dopp && semi >= 0 ) | 983 | if ( semi < dopp && semi >= 0 ) |
950 | sep = semi ; | 984 | sep = semi ; |
951 | else | 985 | else |
952 | sep = dopp; | 986 | sep = dopp; |
953 | datastream +=vcard.mid( start, next - start); | 987 | datastream +=vcard.mid( start, next - start); |
954 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 988 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
955 | start = sep; | 989 | start = sep; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 4366265..30efbf6 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,605 +1,605 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | Parts of the source code have been copied from kdpdatebutton.cpp | 4 | Parts of the source code have been copied from kdpdatebutton.cpp |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source ode for Qt in the source distribution. | 22 | without including the source ode for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #include <libkcal/vcaldrag.h> | 35 | #include <libkcal/vcaldrag.h> |
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/dndfactory.h> | 37 | #include <libkcal/dndfactory.h> |
38 | #include <libkcal/calendarresources.h> | 38 | #include <libkcal/calendarresources.h> |
39 | #include <libkcal/resourcecalendar.h> | 39 | #include <libkcal/resourcecalendar.h> |
40 | #include <kresources/resourceselectdialog.h> | 40 | #include <kresources/resourceselectdialog.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPLUGINS | 44 | #ifndef KORG_NOPLUGINS |
45 | #include "kocore.h" | 45 | #include "kocore.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "koglobals.h" | 48 | #include "koglobals.h" |
49 | 49 | ||
50 | #include "kodaymatrix.h" | 50 | #include "kodaymatrix.h" |
51 | 51 | ||
52 | // ============================================================================ | 52 | // ============================================================================ |
53 | // D Y N A M I C T I P | 53 | // D Y N A M I C T I P |
54 | // ============================================================================ | 54 | // ============================================================================ |
55 | 55 | ||
56 | DynamicTip::DynamicTip( QWidget * parent ) | 56 | DynamicTip::DynamicTip( QWidget * parent ) |
57 | : QToolTip( parent ) | 57 | : QToolTip( parent ) |
58 | { | 58 | { |
59 | matrix = (KODayMatrix*)parent; | 59 | matrix = (KODayMatrix*)parent; |
60 | } | 60 | } |
61 | 61 | ||
62 | class KODaymatrixWhatsThis :public QWhatsThis | 62 | class KODaymatrixWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; | 65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; |
66 | ~KODaymatrixWhatsThis() { ; }; | 66 | ~KODaymatrixWhatsThis() { ; }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p ) | 69 | virtual QString text( const QPoint& p ) |
70 | { | 70 | { |
71 | return _view->getWhatsThisText( p ) ; | 71 | return _view->getWhatsThisText( p ) ; |
72 | } | 72 | } |
73 | private: | 73 | private: |
74 | KODayMatrix * _view; | 74 | KODayMatrix * _view; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void DynamicTip::maybeTip( const QPoint &pos ) | 77 | void DynamicTip::maybeTip( const QPoint &pos ) |
78 | { | 78 | { |
79 | //calculate which cell of the matrix the mouse is in | 79 | //calculate which cell of the matrix the mouse is in |
80 | QRect sz = matrix->frameRect(); | 80 | QRect sz = matrix->frameRect(); |
81 | int dheight = sz.height()*7 / 42; | 81 | int dheight = sz.height()*7 / 42; |
82 | int dwidth = sz.width() / 7; | 82 | int dwidth = sz.width() / 7; |
83 | int row = pos.y()/dheight; | 83 | int row = pos.y()/dheight; |
84 | int col = pos.x()/dwidth; | 84 | int col = pos.x()/dwidth; |
85 | 85 | ||
86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
87 | 87 | ||
88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
89 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 89 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
90 | 90 | ||
91 | //show holiday names only | 91 | //show holiday names only |
92 | QString str = matrix->getHolidayLabel(col+row*7); | 92 | QString str = matrix->getHolidayLabel(col+row*7); |
93 | if (str.isEmpty()) return; | 93 | if (str.isEmpty()) return; |
94 | tip(rct, str); | 94 | tip(rct, str); |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | // ============================================================================ | 98 | // ============================================================================ |
99 | // K O D A Y M A T R I X | 99 | // K O D A Y M A T R I X |
100 | // ============================================================================ | 100 | // ============================================================================ |
101 | 101 | ||
102 | const int KODayMatrix::NOSELECTION = -1000; | 102 | const int KODayMatrix::NOSELECTION = -1000; |
103 | const int KODayMatrix::NUMDAYS = 42; | 103 | const int KODayMatrix::NUMDAYS = 42; |
104 | 104 | ||
105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | 105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) |
106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) | 106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) |
107 | 107 | ||
108 | 108 | ||
109 | { | 109 | { |
110 | mLastView = -1; | 110 | mLastView = -1; |
111 | oldW = 0; | 111 | oldW = 0; |
112 | oldH = 0; | 112 | oldH = 0; |
113 | myPix.resize( 150, 120 ); | 113 | myPix.resize( 150, 120 ); |
114 | mRedrawNeeded = true; | 114 | mRedrawNeeded = true; |
115 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 115 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
116 | mPendingUpdateBeforeRepaint = false; | 116 | mPendingUpdateBeforeRepaint = false; |
117 | mouseDown = false; | 117 | mouseDown = false; |
118 | // initialize dynamic arrays | 118 | // initialize dynamic arrays |
119 | bDays.resize ( NUMDAYS ); | 119 | bDays.resize ( NUMDAYS ); |
120 | pDays.resize ( NUMDAYS ); | 120 | pDays.resize ( NUMDAYS ); |
121 | hDays.resize ( NUMDAYS ); | 121 | hDays.resize ( NUMDAYS ); |
122 | eDays.resize ( NUMDAYS ); | 122 | eDays.resize ( NUMDAYS ); |
123 | days = new QDate[NUMDAYS]; | 123 | days = new QDate[NUMDAYS]; |
124 | daylbls = new QString[NUMDAYS]; | 124 | daylbls = new QString[NUMDAYS]; |
125 | //events = new int[NUMDAYS]; | 125 | //events = new int[NUMDAYS]; |
126 | mToolTip = new DynamicTip(this); | 126 | mToolTip = new DynamicTip(this); |
127 | 127 | ||
128 | // set default values used for drawing the matrix | 128 | // set default values used for drawing the matrix |
129 | mDefaultBackColor = palette().active().base(); | 129 | mDefaultBackColor = palette().active().base(); |
130 | mDefaultTextColor = palette().active().foreground(); | 130 | mDefaultTextColor = palette().active().foreground(); |
131 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 131 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
132 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 132 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
133 | mSelectedDaysColor = QColor("white"); | 133 | mSelectedDaysColor = QColor("white"); |
134 | mTodayMarginWidth = 2; | 134 | mTodayMarginWidth = 2; |
135 | mSelEnd = mSelStart = NOSELECTION; | 135 | mSelEnd = mSelStart = NOSELECTION; |
136 | 136 | ||
137 | setAcceptDrops(true); | 137 | setAcceptDrops(true); |
138 | //setFont( QFont("Arial", 10) ); | 138 | //setFont( QFont("Arial", 10) ); |
139 | 139 | ||
140 | mUpdateTimer = new QTimer( this ); | 140 | mUpdateTimer = new QTimer( this ); |
141 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 141 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
142 | mRepaintTimer = new QTimer( this ); | 142 | mRepaintTimer = new QTimer( this ); |
143 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 143 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
144 | mDayChanged = false; | 144 | mDayChanged = false; |
145 | updateView(); | 145 | updateView(); |
146 | } | 146 | } |
147 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 147 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
148 | { | 148 | { |
149 | 149 | ||
150 | int tmp = getDayIndexFrom(p.x(), p.y()); | 150 | int tmp = getDayIndexFrom(p.x(), p.y()); |
151 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 151 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
152 | return QString(); | 152 | return QString(); |
153 | QDate mDate = days[tmp]; | 153 | QDate mDate = days[tmp]; |
154 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 154 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
155 | Event *event; | 155 | Event *event; |
156 | QStringList mToolTip; | 156 | QStringList mToolTip; |
157 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 157 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
158 | QString mToolTipText; | 158 | QString mToolTipText; |
159 | QString text; | 159 | QString text; |
160 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 160 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
161 | if (event->isMultiDay()) { | 161 | if (event->isMultiDay()) { |
162 | QString prefix = "<->";multiday = 2; | 162 | QString prefix = "<->";multiday = 2; |
163 | QString time; | 163 | QString time; |
164 | if ( event->doesRecur() ) { | 164 | if ( event->doesRecur() ) { |
165 | if ( event->recursOn( mDate) ) { | 165 | if ( event->recursOn( mDate) ) { |
166 | prefix ="->" ;multiday = 1; | 166 | prefix ="->" ;multiday = 1; |
167 | } | 167 | } |
168 | else { | 168 | else { |
169 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 169 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
170 | if ( event->recursOn( mDate.addDays( -days)) ) { | 170 | if ( event->recursOn( mDate.addDays( -days)) ) { |
171 | prefix ="<-" ;multiday = 3; | 171 | prefix ="<-" ;multiday = 3; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } else { | 174 | } else { |
175 | if (mDate == event->dtStart().date()) { | 175 | if (mDate == event->dtStart().date()) { |
176 | prefix ="->" ;multiday = 1; | 176 | prefix ="->" ;multiday = 1; |
177 | } else if (mDate == event->dtEnd().date()) { | 177 | } else if (mDate == event->dtEnd().date()) { |
178 | prefix ="<-" ;multiday = 3; | 178 | prefix ="<-" ;multiday = 3; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | if ( !event->doesFloat() ) { | 181 | if ( !event->doesFloat() ) { |
182 | if ( mDate == event->dtStart().date () ) | 182 | if ( mDate == event->dtStart().date () ) |
183 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 183 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
184 | else if ( mDate == event->dtEnd().date () ) | 184 | else if ( mDate == event->dtEnd().date () ) |
185 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 185 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
186 | 186 | ||
187 | } | 187 | } |
188 | text = time + event->summary(); | 188 | text = time + event->summary(); |
189 | mToolTipText += prefix + text; | 189 | mToolTipText += prefix + text; |
190 | } else { | 190 | } else { |
191 | if (event->doesFloat()) { | 191 | if (event->doesFloat()) { |
192 | text = event->summary(); | 192 | text = event->summary(); |
193 | mToolTipText += text; | 193 | mToolTipText += text; |
194 | } | 194 | } |
195 | else { | 195 | else { |
196 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 196 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
197 | text += " " + event->summary(); | 197 | text += " " + event->summary(); |
198 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 198 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | if ( !event->location().isEmpty() ) | 201 | if ( !event->location().isEmpty() ) |
202 | mToolTipText += " (" + event->location() + ")"; | 202 | mToolTipText += " (" + event->location() + ")"; |
203 | //qDebug("TTT: %s ", mToolTipText.latin1()); | 203 | //qDebug("TTT: %s ", mToolTipText.latin1()); |
204 | mToolTip.append( deTag( mToolTipText ) ); | 204 | mToolTip.append( deTag( mToolTipText ) ); |
205 | } | 205 | } |
206 | mToolTip.sort(); | ||
206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 207 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
207 | QPtrList<Todo> todolist = mCalendar->todos(mDate); | 208 | QPtrList<Todo> todolist = mCalendar->todos(mDate); |
208 | Todo *todo; | 209 | Todo *todo; |
209 | for(todo=todolist.first();todo != 0;todo=todolist.next()) { | 210 | for(todo=todolist.first();todo != 0;todo=todolist.next()) { |
210 | QString mToolTipText; | 211 | QString mToolTipText; |
211 | if ( !todo->doesFloat() ) | 212 | if ( !todo->doesFloat() ) |
212 | mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; | 213 | mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; |
213 | mToolTipText += todo->summary(); | 214 | mToolTipText += todo->summary(); |
214 | if ( !todo->location().isEmpty() ) | 215 | if ( !todo->location().isEmpty() ) |
215 | mToolTipText += " (" + todo->location() + ")"; | 216 | mToolTipText += " (" + todo->location() + ")"; |
216 | mToolTipText = deTag( mToolTipText); | 217 | mToolTipText = deTag( mToolTipText); |
217 | mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; | 218 | mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; |
218 | mToolTip.append( mToolTipText ); | 219 | mToolTip.append( mToolTipText ); |
219 | } | 220 | } |
220 | } | 221 | } |
221 | mToolTip.sort(); | ||
222 | if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 222 | if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
223 | Journal *j = mCalendar->journal( mDate ); | 223 | Journal *j = mCalendar->journal( mDate ); |
224 | if ( j ) { | 224 | if ( j ) { |
225 | QString mToolTipText = j->description().left(100); | 225 | QString mToolTipText = j->description().left(100); |
226 | if ( j->description().length() > 100 ) | 226 | if ( j->description().length() > 100 ) |
227 | mToolTipText += " ..."; | 227 | mToolTipText += " ..."; |
228 | mToolTipText = deTag( mToolTipText); | 228 | mToolTipText = deTag( mToolTipText); |
229 | mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; | 229 | mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; |
230 | mToolTip.append( mToolTipText ); | 230 | mToolTip.append( mToolTipText ); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 233 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
237 | QString KODayMatrix::deTag( QString mToolTipText ) | 237 | QString KODayMatrix::deTag( QString mToolTipText ) |
238 | { | 238 | { |
239 | 239 | ||
240 | #if QT_VERSION >= 0x030000 | 240 | #if QT_VERSION >= 0x030000 |
241 | mToolTipText.replace( '<' , "<" ); | 241 | mToolTipText.replace( '<' , "<" ); |
242 | mToolTipText.replace( '>' , ">" ); | 242 | mToolTipText.replace( '>' , ">" ); |
243 | #else | 243 | #else |
244 | if ( mToolTipText.find ('<') >= 0 ) { | 244 | if ( mToolTipText.find ('<') >= 0 ) { |
245 | mToolTipText.replace( QRegExp("<") , "<" ); | 245 | mToolTipText.replace( QRegExp("<") , "<" ); |
246 | } | 246 | } |
247 | if ( mToolTipText.find ('>') >= 0 ) { | 247 | if ( mToolTipText.find ('>') >= 0 ) { |
248 | mToolTipText.replace( QRegExp(">") , ">" ); | 248 | mToolTipText.replace( QRegExp(">") , ">" ); |
249 | } | 249 | } |
250 | #endif | 250 | #endif |
251 | return mToolTipText; | 251 | return mToolTipText; |
252 | } | 252 | } |
253 | void KODayMatrix::setCalendar( Calendar *cal ) | 253 | void KODayMatrix::setCalendar( Calendar *cal ) |
254 | { | 254 | { |
255 | mCalendar = cal; | 255 | mCalendar = cal; |
256 | 256 | ||
257 | setAcceptDrops( mCalendar ); | 257 | setAcceptDrops( mCalendar ); |
258 | 258 | ||
259 | updateEvents(); | 259 | updateEvents(); |
260 | } | 260 | } |
261 | 261 | ||
262 | QColor KODayMatrix::getShadedColor(QColor color) | 262 | QColor KODayMatrix::getShadedColor(QColor color) |
263 | { | 263 | { |
264 | QColor shaded; | 264 | QColor shaded; |
265 | int h=0; | 265 | int h=0; |
266 | int s=0; | 266 | int s=0; |
267 | int v=0; | 267 | int v=0; |
268 | color.hsv(&h,&s,&v); | 268 | color.hsv(&h,&s,&v); |
269 | s = s/4; | 269 | s = s/4; |
270 | v = 192+v/4; | 270 | v = 192+v/4; |
271 | shaded.setHsv(h,s,v); | 271 | shaded.setHsv(h,s,v); |
272 | 272 | ||
273 | return shaded; | 273 | return shaded; |
274 | } | 274 | } |
275 | 275 | ||
276 | KODayMatrix::~KODayMatrix() | 276 | KODayMatrix::~KODayMatrix() |
277 | { | 277 | { |
278 | #if QT_VERSION >= 0x030000 | 278 | #if QT_VERSION >= 0x030000 |
279 | 279 | ||
280 | #else | 280 | #else |
281 | delete mKODaymatrixWhatsThis; | 281 | delete mKODaymatrixWhatsThis; |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | // delete mKODaymatrixWhatsThis; | 284 | // delete mKODaymatrixWhatsThis; |
285 | delete [] days; | 285 | delete [] days; |
286 | delete [] daylbls; | 286 | delete [] daylbls; |
287 | //delete [] events; | 287 | //delete [] events; |
288 | delete mToolTip; | 288 | delete mToolTip; |
289 | } | 289 | } |
290 | 290 | ||
291 | /* | 291 | /* |
292 | void KODayMatrix::setStartDate(QDate start) | 292 | void KODayMatrix::setStartDate(QDate start) |
293 | { | 293 | { |
294 | updateView(start); | 294 | updateView(start); |
295 | } | 295 | } |
296 | */ | 296 | */ |
297 | 297 | ||
298 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 298 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
299 | { | 299 | { |
300 | 300 | ||
301 | if (mSelStart == NOSELECTION) { | 301 | if (mSelStart == NOSELECTION) { |
302 | return; | 302 | return; |
303 | } | 303 | } |
304 | 304 | ||
305 | //cope with selection being out of matrix limits at top (< 0) | 305 | //cope with selection being out of matrix limits at top (< 0) |
306 | int i0 = mSelStart; | 306 | int i0 = mSelStart; |
307 | if (i0 < 0) { | 307 | if (i0 < 0) { |
308 | for (int i = i0; i < 0; i++) { | 308 | for (int i = i0; i < 0; i++) { |
309 | selDays.append(days[0].addDays(i)); | 309 | selDays.append(days[0].addDays(i)); |
310 | } | 310 | } |
311 | i0 = 0; | 311 | i0 = 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 314 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
315 | if (mSelEnd > NUMDAYS-1) { | 315 | if (mSelEnd > NUMDAYS-1) { |
316 | for (int i = i0; i <= NUMDAYS-1; i++) { | 316 | for (int i = i0; i <= NUMDAYS-1; i++) { |
317 | selDays.append(days[i]); | 317 | selDays.append(days[i]); |
318 | } | 318 | } |
319 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 319 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
320 | selDays.append(days[0].addDays(i)); | 320 | selDays.append(days[0].addDays(i)); |
321 | } | 321 | } |
322 | 322 | ||
323 | // apply normal routine to selection being entirely within matrix limits | 323 | // apply normal routine to selection being entirely within matrix limits |
324 | } else { | 324 | } else { |
325 | for (int i = i0; i <= mSelEnd; i++) { | 325 | for (int i = i0; i <= mSelEnd; i++) { |
326 | selDays.append(days[i]); | 326 | selDays.append(days[i]); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 331 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
332 | { | 332 | { |
333 | mRedrawNeeded = true; | 333 | mRedrawNeeded = true; |
334 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); | 334 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); |
335 | mSelStart = startdate.daysTo(start); | 335 | mSelStart = startdate.daysTo(start); |
336 | if ( mSelStart < 0 ) | 336 | if ( mSelStart < 0 ) |
337 | mSelStart = 0; | 337 | mSelStart = 0; |
338 | mSelEnd = startdate.daysTo(end); | 338 | mSelEnd = startdate.daysTo(end); |
339 | if ( mSelEnd > NUMDAYS-1 ) | 339 | if ( mSelEnd > NUMDAYS-1 ) |
340 | mSelEnd = NUMDAYS-1; | 340 | mSelEnd = NUMDAYS-1; |
341 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { | 341 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { |
342 | clearSelection(); | 342 | clearSelection(); |
343 | if ( noSel ) | 343 | if ( noSel ) |
344 | return false; | 344 | return false; |
345 | } | 345 | } |
346 | 346 | ||
347 | return true; | 347 | return true; |
348 | } | 348 | } |
349 | void KODayMatrix::clearSelection() | 349 | void KODayMatrix::clearSelection() |
350 | { | 350 | { |
351 | mSelEnd = mSelStart = NOSELECTION; | 351 | mSelEnd = mSelStart = NOSELECTION; |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | void KODayMatrix::recalculateToday() | 355 | void KODayMatrix::recalculateToday() |
356 | { | 356 | { |
357 | today = -1; | 357 | today = -1; |
358 | for (int i=0; i<NUMDAYS; i++) { | 358 | for (int i=0; i<NUMDAYS; i++) { |
359 | //events[i] = 0; | 359 | //events[i] = 0; |
360 | days[i] = startdate.addDays(i); | 360 | days[i] = startdate.addDays(i); |
361 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 361 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
362 | 362 | ||
363 | // if today is in the currently displayed month, hilight today | 363 | // if today is in the currently displayed month, hilight today |
364 | if (days[i].year() == QDate::currentDate().year() && | 364 | if (days[i].year() == QDate::currentDate().year() && |
365 | days[i].month() == QDate::currentDate().month() && | 365 | days[i].month() == QDate::currentDate().month() && |
366 | days[i].day() == QDate::currentDate().day()) { | 366 | days[i].day() == QDate::currentDate().day()) { |
367 | today = i; | 367 | today = i; |
368 | } | 368 | } |
369 | } | 369 | } |
370 | // qDebug(QString("Today is visible at %1.").arg(today)); | 370 | // qDebug(QString("Today is visible at %1.").arg(today)); |
371 | } | 371 | } |
372 | 372 | ||
373 | void KODayMatrix::updateView() | 373 | void KODayMatrix::updateView() |
374 | { | 374 | { |
375 | updateView(startdate); | 375 | updateView(startdate); |
376 | } | 376 | } |
377 | void KODayMatrix::repaintViewTimed() | 377 | void KODayMatrix::repaintViewTimed() |
378 | { | 378 | { |
379 | mRedrawNeeded = true; | 379 | mRedrawNeeded = true; |
380 | // bDays.fill( false); | 380 | // bDays.fill( false); |
381 | //pDays.fill( false); | 381 | //pDays.fill( false); |
382 | //hDays.fill( false); | 382 | //hDays.fill( false); |
383 | //eDays.fill( false); | 383 | //eDays.fill( false); |
384 | mRepaintTimer->stop(); | 384 | mRepaintTimer->stop(); |
385 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 385 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
386 | int i; | 386 | int i; |
387 | for(i = 0; i < NUMDAYS; i++) { | 387 | for(i = 0; i < NUMDAYS; i++) { |
388 | if ( ( (i+startDay) % 7 == 0 ) ) { | 388 | if ( ( (i+startDay) % 7 == 0 ) ) { |
389 | pDays.setBit(i); | 389 | pDays.setBit(i); |
390 | } | 390 | } |
391 | } | 391 | } |
392 | repaint(false); | 392 | repaint(false); |
393 | } | 393 | } |
394 | void KODayMatrix::computeEvent(Event *event, int i ) | 394 | void KODayMatrix::computeEvent(Event *event, int i ) |
395 | { | 395 | { |
396 | QString holiStr = mHolidays[i]; | 396 | QString holiStr = mHolidays[i]; |
397 | if ( event->isHoliday()) { | 397 | if ( event->isHoliday()) { |
398 | pDays.setBit(i); | 398 | pDays.setBit(i); |
399 | hDays.setBit(i); | 399 | hDays.setBit(i); |
400 | if ( !holiStr.isEmpty() ) | 400 | if ( !holiStr.isEmpty() ) |
401 | holiStr += "\n"; | 401 | holiStr += "\n"; |
402 | holiStr += event->summary(); | 402 | holiStr += event->summary(); |
403 | if ( !event->location().isEmpty() ) | 403 | if ( !event->location().isEmpty() ) |
404 | holiStr += " (" + event->location() + ")"; | 404 | holiStr += " (" + event->location() + ")"; |
405 | mHolidays[i] =holiStr ; | 405 | mHolidays[i] =holiStr ; |
406 | eDays.setBit(i); | 406 | eDays.setBit(i); |
407 | } | 407 | } |
408 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { | 408 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { |
409 | if ( event->isBirthday()) { | 409 | if ( event->isBirthday()) { |
410 | pDays.setBit(i); | 410 | pDays.setBit(i); |
411 | if ( !holiStr.isEmpty() ) | 411 | if ( !holiStr.isEmpty() ) |
412 | holiStr += "\n"; | 412 | holiStr += "\n"; |
413 | holiStr += i18n("Birthday") + ": "+event->summary(); | 413 | holiStr += i18n("Birthday") + ": "+event->summary(); |
414 | if ( !event->location().isEmpty() ) | 414 | if ( !event->location().isEmpty() ) |
415 | holiStr += " (" + event->location() + ")"; | 415 | holiStr += " (" + event->location() + ")"; |
416 | bDays.setBit(i); | 416 | bDays.setBit(i); |
417 | mHolidays[i] =holiStr ; | 417 | mHolidays[i] =holiStr ; |
418 | } | 418 | } |
419 | } | 419 | } |
420 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) | 420 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) |
421 | eDays.setBit(i); | 421 | eDays.setBit(i); |
422 | } | 422 | } |
423 | void KODayMatrix::updateViewTimed() | 423 | void KODayMatrix::updateViewTimed() |
424 | { | 424 | { |
425 | mUpdateTimer->stop(); | 425 | mUpdateTimer->stop(); |
426 | if ( !mCalendar ) { | 426 | if ( !mCalendar ) { |
427 | qDebug("NOT CAL "); | 427 | qDebug("NOT CAL "); |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | #if 1 | 430 | #if 1 |
431 | 431 | ||
432 | 432 | ||
433 | int i; | 433 | int i; |
434 | int timeSpan = NUMDAYS-1; | 434 | int timeSpan = NUMDAYS-1; |
435 | QPtrList<Event> events = mCalendar->events(); | 435 | QPtrList<Event> events = mCalendar->events(); |
436 | Event *event; | 436 | Event *event; |
437 | QDateTime dt; | 437 | QDateTime dt; |
438 | bool ok; | 438 | bool ok; |
439 | bDays.fill( false); | 439 | bDays.fill( false); |
440 | pDays.fill( false); | 440 | pDays.fill( false); |
441 | hDays.fill( false); | 441 | hDays.fill( false); |
442 | eDays.fill( false); | 442 | eDays.fill( false); |
443 | mHolidays.clear(); | 443 | mHolidays.clear(); |
444 | QDate mStartDate = days[0]; | 444 | QDate mStartDate = days[0]; |
445 | QDate endDate = mStartDate.addDays( timeSpan ); | 445 | QDate endDate = mStartDate.addDays( timeSpan ); |
446 | for( event = events.first(); event; event = events.next() ) { // for event | 446 | for( event = events.first(); event; event = events.next() ) { // for event |
447 | ushort recurType = event->recurrence()->doesRecur(); | 447 | ushort recurType = event->recurrence()->doesRecur(); |
448 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 448 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
449 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 449 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
450 | continue; | 450 | continue; |
451 | } | 451 | } |
452 | if ( event->doesRecur() ) { | 452 | if ( event->doesRecur() ) { |
453 | bool last; | 453 | bool last; |
454 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 454 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
455 | QDateTime incidenceEnd; | 455 | QDateTime incidenceEnd; |
456 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 456 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
457 | bool invalid = false; | 457 | bool invalid = false; |
458 | while( true ) { | 458 | while( true ) { |
459 | if ( incidenceStart.isValid() ) { | 459 | if ( incidenceStart.isValid() ) { |
460 | incidenceEnd = incidenceStart.addDays( eventlen ); | 460 | incidenceEnd = incidenceStart.addDays( eventlen ); |
461 | int st = incidenceStart.date().daysTo( endDate ); | 461 | int st = incidenceStart.date().daysTo( endDate ); |
462 | if ( st >= 0 ) { // start before timeend | 462 | if ( st >= 0 ) { // start before timeend |
463 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 463 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
464 | if ( end >= 0 ) { // end after timestart --- got one! | 464 | if ( end >= 0 ) { // end after timestart --- got one! |
465 | //normalize | 465 | //normalize |
466 | st = timeSpan - st; | 466 | st = timeSpan - st; |
467 | if ( st < 0 ) st = 0; | 467 | if ( st < 0 ) st = 0; |
468 | if ( end > timeSpan ) end = timeSpan; | 468 | if ( end > timeSpan ) end = timeSpan; |
469 | int iii; | 469 | int iii; |
470 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 470 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
471 | for ( iii = st;iii<= end;++iii) { | 471 | for ( iii = st;iii<= end;++iii) { |
472 | computeEvent( event, iii ); | 472 | computeEvent( event, iii ); |
473 | } | 473 | } |
474 | } | 474 | } |
475 | } | 475 | } |
476 | } else { | 476 | } else { |
477 | if ( invalid ) | 477 | if ( invalid ) |
478 | break; | 478 | break; |
479 | invalid = true; | 479 | invalid = true; |
480 | //qDebug("invalid %s", event->summary().latin1()); | 480 | //qDebug("invalid %s", event->summary().latin1()); |
481 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 481 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
482 | } | 482 | } |
483 | if ( last ) | 483 | if ( last ) |
484 | break; | 484 | break; |
485 | bool ok; | 485 | bool ok; |
486 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 486 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
487 | if ( ! ok ) | 487 | if ( ! ok ) |
488 | break; | 488 | break; |
489 | if ( incidenceStart.date() > endDate ) | 489 | if ( incidenceStart.date() > endDate ) |
490 | break; | 490 | break; |
491 | } | 491 | } |
492 | } else { // no recur | 492 | } else { // no recur |
493 | int st = event->dtStart().date().daysTo( endDate ); | 493 | int st = event->dtStart().date().daysTo( endDate ); |
494 | if ( st >= 0 ) { // start before timeend | 494 | if ( st >= 0 ) { // start before timeend |
495 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 495 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
496 | if ( end >= 0 ) { // end after timestart --- got one! | 496 | if ( end >= 0 ) { // end after timestart --- got one! |
497 | //normalize | 497 | //normalize |
498 | st = timeSpan - st; | 498 | st = timeSpan - st; |
499 | if ( st < 0 ) st = 0; | 499 | if ( st < 0 ) st = 0; |
500 | if ( end > timeSpan ) end = timeSpan; | 500 | if ( end > timeSpan ) end = timeSpan; |
501 | int iii; | 501 | int iii; |
502 | for ( iii = st;iii<= end;++iii) | 502 | for ( iii = st;iii<= end;++iii) |
503 | computeEvent( event, iii ); | 503 | computeEvent( event, iii ); |
504 | } | 504 | } |
505 | } | 505 | } |
506 | } | 506 | } |
507 | } | 507 | } |
508 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 508 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
509 | for(i = 0; i < NUMDAYS; i++) { | 509 | for(i = 0; i < NUMDAYS; i++) { |
510 | if ( ( (i+startDay) % 7 == 0 ) ) { | 510 | if ( ( (i+startDay) % 7 == 0 ) ) { |
511 | pDays.setBit(i); | 511 | pDays.setBit(i); |
512 | } | 512 | } |
513 | } | 513 | } |
514 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 514 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
515 | bDays.fill( false); | 515 | bDays.fill( false); |
516 | // insert due todos | 516 | // insert due todos |
517 | QPtrList<Todo> todos = mCalendar->todos( ); | 517 | QPtrList<Todo> todos = mCalendar->todos( ); |
518 | Todo *todo; | 518 | Todo *todo; |
519 | for(todo = todos.first(); todo; todo = todos.next()) { | 519 | for(todo = todos.first(); todo; todo = todos.next()) { |
520 | //insertTodo( todo ); | 520 | //insertTodo( todo ); |
521 | if ( todo->hasDueDate() ) { | 521 | if ( todo->hasDueDate() ) { |
522 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 522 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
523 | if ( day >= 0 && day < timeSpan + 1) { | 523 | if ( day >= 0 && day < timeSpan + 1) { |
524 | int i = day; | 524 | int i = day; |
525 | QString holiStr = mHolidays[i]; | 525 | QString holiStr = mHolidays[i]; |
526 | pDays.setBit(i); | 526 | pDays.setBit(i); |
527 | if ( !holiStr.isEmpty() ) | 527 | if ( !holiStr.isEmpty() ) |
528 | holiStr += "\n"; | 528 | holiStr += "\n"; |
529 | holiStr += i18n("Todo") + ": "+todo->summary(); | 529 | holiStr += i18n("Todo") + ": "+todo->summary(); |
530 | if ( !todo->location().isEmpty() ) | 530 | if ( !todo->location().isEmpty() ) |
531 | holiStr += " (" + todo->location() + ")"; | 531 | holiStr += " (" + todo->location() + ")"; |
532 | bDays.setBit(i); | 532 | bDays.setBit(i); |
533 | mHolidays[i] =holiStr ; | 533 | mHolidays[i] =holiStr ; |
534 | eDays.setBit(i); | 534 | eDays.setBit(i); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | } | 537 | } |
538 | } | 538 | } |
539 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 539 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
540 | bDays.fill( false); | 540 | bDays.fill( false); |
541 | // insert due todos | 541 | // insert due todos |
542 | QPtrList<Journal> todos = mCalendar->journals( ); | 542 | QPtrList<Journal> todos = mCalendar->journals( ); |
543 | Journal *todo; | 543 | Journal *todo; |
544 | for(todo = todos.first(); todo; todo = todos.next()) { | 544 | for(todo = todos.first(); todo; todo = todos.next()) { |
545 | int day = mStartDate.daysTo( todo->dtStart().date() ); | 545 | int day = mStartDate.daysTo( todo->dtStart().date() ); |
546 | if ( day >= 0 && day < timeSpan + 1) { | 546 | if ( day >= 0 && day < timeSpan + 1) { |
547 | int i = day; | 547 | int i = day; |
548 | QString holiStr = mHolidays[i]; | 548 | QString holiStr = mHolidays[i]; |
549 | pDays.setBit(i); | 549 | pDays.setBit(i); |
550 | if ( !holiStr.isEmpty() ) | 550 | if ( !holiStr.isEmpty() ) |
551 | holiStr += "\n"; | 551 | holiStr += "\n"; |
552 | holiStr += i18n("Journal"); | 552 | holiStr += i18n("Journal"); |
553 | bDays.setBit(i); | 553 | bDays.setBit(i); |
554 | mHolidays[i] =holiStr ; | 554 | mHolidays[i] =holiStr ; |
555 | eDays.setBit(i); | 555 | eDays.setBit(i); |
556 | 556 | ||
557 | } | 557 | } |
558 | } | 558 | } |
559 | } | 559 | } |
560 | #else | 560 | #else |
561 | //qDebug("KODayMatrix::updateViewTimed "); | 561 | //qDebug("KODayMatrix::updateViewTimed "); |
562 | for(int i = 0; i < NUMDAYS; i++) { | 562 | for(int i = 0; i < NUMDAYS; i++) { |
563 | // if events are set for the day then remember to draw it bold | 563 | // if events are set for the day then remember to draw it bold |
564 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 564 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
565 | Event *event; | 565 | Event *event; |
566 | int numEvents = eventlist.count(); | 566 | int numEvents = eventlist.count(); |
567 | QString holiStr = ""; | 567 | QString holiStr = ""; |
568 | bDays.clearBit(i); | 568 | bDays.clearBit(i); |
569 | hDays.clearBit(i); | 569 | hDays.clearBit(i); |
570 | eDays.clearBit(i); | 570 | eDays.clearBit(i); |
571 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 571 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
572 | ushort recurType = event->recurrence()->doesRecur(); | 572 | ushort recurType = event->recurrence()->doesRecur(); |
573 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 573 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
574 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 574 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
575 | numEvents--; | 575 | numEvents--; |
576 | } | 576 | } |
577 | if ( event->isHoliday()) { | 577 | if ( event->isHoliday()) { |
578 | hDays.setBit(i); | 578 | hDays.setBit(i); |
579 | if ( !holiStr.isEmpty() ) | 579 | if ( !holiStr.isEmpty() ) |
580 | holiStr += "\n"; | 580 | holiStr += "\n"; |
581 | holiStr += event->summary(); | 581 | holiStr += event->summary(); |
582 | if ( !event->location().isEmpty() ) | 582 | if ( !event->location().isEmpty() ) |
583 | holiStr += " (" + event->location() + ")"; | 583 | holiStr += " (" + event->location() + ")"; |
584 | } | 584 | } |
585 | if ( event->isBirthday()) { | 585 | if ( event->isBirthday()) { |
586 | if ( !holiStr.isEmpty() ) | 586 | if ( !holiStr.isEmpty() ) |
587 | holiStr += "\n"; | 587 | holiStr += "\n"; |
588 | holiStr += i18n("Birthday") + ": "+event->summary(); | 588 | holiStr += i18n("Birthday") + ": "+event->summary(); |
589 | if ( !event->location().isEmpty() ) | 589 | if ( !event->location().isEmpty() ) |
590 | holiStr += " (" + event->location() + ")"; | 590 | holiStr += " (" + event->location() + ")"; |
591 | bDays.setBit(i); | 591 | bDays.setBit(i); |
592 | } | 592 | } |
593 | } | 593 | } |
594 | if ( numEvents ) | 594 | if ( numEvents ) |
595 | eDays.setBit(i); | 595 | eDays.setBit(i); |
596 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 596 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
597 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 597 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
598 | !holiStr.isEmpty()) { | 598 | !holiStr.isEmpty()) { |
599 | mHolidays[i] = holiStr; | 599 | mHolidays[i] = holiStr; |
600 | } else { | 600 | } else { |
601 | mHolidays[i] = QString::null; | 601 | mHolidays[i] = QString::null; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | #endif | 604 | #endif |
605 | mRedrawNeeded = true; | 605 | mRedrawNeeded = true; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index eed023c..3c0259f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,574 +1,574 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "ktoolbar.h" | 60 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 61 | #include "klocale.h" |
62 | #include "kconfig.h" | 62 | #include "kconfig.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | #include <kglobalsettings.h> | 64 | #include <kglobalsettings.h> |
65 | 65 | ||
66 | using namespace KCal; | 66 | using namespace KCal; |
67 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 68 | #include <unistd.h> |
69 | #else | 69 | #else |
70 | #ifdef _OL_IMPORT_ | 70 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 71 | #include "koimportoldialog.h" |
72 | #endif | 72 | #endif |
73 | #endif | 73 | #endif |
74 | #include "mainwindow.h" | 74 | #include "mainwindow.h" |
75 | 75 | ||
76 | 76 | ||
77 | class KOex2phonePrefs : public QDialog | 77 | class KOex2phonePrefs : public QDialog |
78 | { | 78 | { |
79 | public: | 79 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 81 | QDialog( parent, name, true ) |
82 | { | 82 | { |
83 | setCaption( i18n("Export to phone options") ); | 83 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 84 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 85 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 86 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 87 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 89 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 90 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 92 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 93 | mPhoneDevice = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Connection: "), temphb ); | 96 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 97 | mPhoneConnection = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | temphb = new QHBox( this ); | 99 | temphb = new QHBox( this ); |
100 | new QLabel( i18n("Model(opt.): "), temphb ); | 100 | new QLabel( i18n("Model(opt.): "), temphb ); |
101 | mPhoneModel = new QLineEdit( temphb); | 101 | mPhoneModel = new QLineEdit( temphb); |
102 | lay->addWidget( temphb ); | 102 | lay->addWidget( temphb ); |
103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
104 | mWriteBackFuture->setChecked( true ); | 104 | mWriteBackFuture->setChecked( true ); |
105 | lay->addWidget( mWriteBackFuture ); | 105 | lay->addWidget( mWriteBackFuture ); |
106 | temphb = new QHBox( this ); | 106 | temphb = new QHBox( this ); |
107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
109 | mWriteBackFutureWeeks->setValue( 8 ); | 109 | mWriteBackFutureWeeks->setValue( 8 ); |
110 | lay->addWidget( temphb ); | 110 | lay->addWidget( temphb ); |
111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
112 | lab->setAlignment (AlignHCenter ); | 112 | lab->setAlignment (AlignHCenter ); |
113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
114 | lay->addWidget( ok ); | 114 | lay->addWidget( ok ); |
115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
116 | lay->addWidget( cancel ); | 116 | lay->addWidget( cancel ); |
117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
119 | resize( 220, 240 ); | 119 | resize( 220, 240 ); |
120 | qApp->processEvents(); | 120 | qApp->processEvents(); |
121 | int dw = QApplication::desktop()->width(); | 121 | int dw = QApplication::desktop()->width(); |
122 | int dh = QApplication::desktop()->height(); | 122 | int dh = QApplication::desktop()->height(); |
123 | move( (dw-width())/2, (dh - height() )/2 ); | 123 | move( (dw-width())/2, (dh - height() )/2 ); |
124 | } | 124 | } |
125 | 125 | ||
126 | public: | 126 | public: |
127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
128 | QCheckBox* mWriteBackFuture; | 128 | QCheckBox* mWriteBackFuture; |
129 | QSpinBox* mWriteBackFutureWeeks; | 129 | QSpinBox* mWriteBackFutureWeeks; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | int globalFlagBlockStartup; | 132 | int globalFlagBlockStartup; |
133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
134 | QMainWindow( parent, name ) | 134 | QMainWindow( parent, name ) |
135 | { | 135 | { |
136 | 136 | ||
137 | mClosed = false; | 137 | mClosed = false; |
138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
139 | QString confFile = locateLocal("config","korganizerrc"); | 139 | QString confFile = locateLocal("config","korganizerrc"); |
140 | QFileInfo finf ( confFile ); | 140 | QFileInfo finf ( confFile ); |
141 | bool showWarning = !finf.exists(); | 141 | bool showWarning = !finf.exists(); |
142 | setIcon(SmallIcon( "ko24" ) ); | 142 | setIcon(SmallIcon( "ko24" ) ); |
143 | mBlockAtStartup = true; | 143 | mBlockAtStartup = true; |
144 | mFlagKeyPressed = false; | 144 | mFlagKeyPressed = false; |
145 | setCaption("KO/Pi"); | 145 | setCaption("KO/Pi"); |
146 | KOPrefs *p = KOPrefs::instance(); | 146 | KOPrefs *p = KOPrefs::instance(); |
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 147 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
148 | p->mCurrentDisplayedView = 0; | 148 | p->mCurrentDisplayedView = 0; |
149 | if ( p->mHourSize > 22 ) | 149 | if ( p->mHourSize > 22 ) |
150 | p->mHourSize = 22; | 150 | p->mHourSize = 22; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 160 | tbd = Right; |
161 | else | 161 | else |
162 | tbd = Left; | 162 | tbd = Left; |
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | 169 | ||
170 | #ifdef DESKTOP_VERSION | 170 | #ifdef DESKTOP_VERSION |
171 | if ( KOPrefs::instance()->mShowIconFilter ) | 171 | if ( KOPrefs::instance()->mShowIconFilter ) |
172 | #else | 172 | #else |
173 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 173 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | { | 176 | { |
177 | if ( p->mToolBarHorF ) { | 177 | if ( p->mToolBarHorF ) { |
178 | if ( p->mToolBarUpF ) | 178 | if ( p->mToolBarUpF ) |
179 | tbd = Bottom; | 179 | tbd = Bottom; |
180 | else | 180 | else |
181 | tbd = Top; | 181 | tbd = Top; |
182 | } | 182 | } |
183 | else { | 183 | else { |
184 | if ( p->mToolBarUpF ) | 184 | if ( p->mToolBarUpF ) |
185 | tbd = Right; | 185 | tbd = Right; |
186 | else | 186 | else |
187 | tbd = Left; | 187 | tbd = Left; |
188 | } | 188 | } |
189 | filterToolBar = new QPEToolBar ( this ); | 189 | filterToolBar = new QPEToolBar ( this ); |
190 | filterMenubar = new QMenuBar( filterToolBar ); | 190 | filterMenubar = new QMenuBar( 0 ); |
191 | QFontMetrics fm ( filterMenubar->font() ); | 191 | QFontMetrics fm ( filterMenubar->font() ); |
192 | 192 | ||
193 | filterPopupMenu = new QPopupMenu( this ); | 193 | filterPopupMenu = new QPopupMenu( this ); |
194 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 194 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
195 | QString addTest = "A"; | 195 | QString addTest = "A"; |
196 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 196 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
197 | #ifdef DESKTOP_VERSION | 197 | #ifdef DESKTOP_VERSION |
198 | addTest = "AAABBBCCCx"; | 198 | addTest = "AAABBBCCCx"; |
199 | #else | 199 | #else |
200 | addTest = "AAx"; | 200 | addTest = "AAx"; |
201 | #endif | 201 | #endif |
202 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 202 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
203 | addToolBar (filterToolBar , tbd ); | 203 | addToolBar (filterToolBar , tbd ); |
204 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 204 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
205 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 205 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
206 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 206 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
207 | filterToolBar->hide(); | 207 | filterToolBar->hide(); |
208 | } else { | 208 | } else { |
209 | filterToolBar = 0; | 209 | filterToolBar = 0; |
210 | filterMenubar = 0; | 210 | filterMenubar = 0; |
211 | filterPopupMenu = 0; | 211 | filterPopupMenu = 0; |
212 | } | 212 | } |
213 | if ( p->mShowIconOnetoolbar ) { | 213 | if ( p->mShowIconOnetoolbar ) { |
214 | viewToolBar = iconToolBar ; | 214 | viewToolBar = iconToolBar ; |
215 | navigatorToolBar = iconToolBar ; | 215 | navigatorToolBar = iconToolBar ; |
216 | } else { | 216 | } else { |
217 | #ifndef DESKTOP_VERSION | 217 | #ifndef DESKTOP_VERSION |
218 | setToolBarsMovable( false ); | 218 | setToolBarsMovable( false ); |
219 | #endif | 219 | #endif |
220 | if ( p->mToolBarHorV ) { | 220 | if ( p->mToolBarHorV ) { |
221 | if ( p->mToolBarUpV ) | 221 | if ( p->mToolBarUpV ) |
222 | tbd = Bottom; | 222 | tbd = Bottom; |
223 | else | 223 | else |
224 | tbd = Top; | 224 | tbd = Top; |
225 | } | 225 | } |
226 | else { | 226 | else { |
227 | if ( p->mToolBarUpV ) | 227 | if ( p->mToolBarUpV ) |
228 | tbd = Right; | 228 | tbd = Right; |
229 | else | 229 | else |
230 | tbd = Left; | 230 | tbd = Left; |
231 | } | 231 | } |
232 | viewToolBar = new QPEToolBar( this ); | 232 | viewToolBar = new QPEToolBar( this ); |
233 | addToolBar (viewToolBar , tbd ); | 233 | addToolBar (viewToolBar , tbd ); |
234 | if ( p->mToolBarHorN ) { | 234 | if ( p->mToolBarHorN ) { |
235 | if ( p->mToolBarUpN ) | 235 | if ( p->mToolBarUpN ) |
236 | tbd = Bottom; | 236 | tbd = Bottom; |
237 | else | 237 | else |
238 | tbd = Top; | 238 | tbd = Top; |
239 | } | 239 | } |
240 | else { | 240 | else { |
241 | if ( p->mToolBarUpN ) | 241 | if ( p->mToolBarUpN ) |
242 | tbd = Right; | 242 | tbd = Right; |
243 | else | 243 | else |
244 | tbd = Left; | 244 | tbd = Left; |
245 | } | 245 | } |
246 | navigatorToolBar = new QPEToolBar( this ); | 246 | navigatorToolBar = new QPEToolBar( this ); |
247 | addToolBar (navigatorToolBar , tbd ); | 247 | addToolBar (navigatorToolBar , tbd ); |
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | 251 | ||
252 | mCalendarModifiedFlag = false; | 252 | mCalendarModifiedFlag = false; |
253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 253 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
254 | splash->setAlignment ( AlignCenter ); | 254 | splash->setAlignment ( AlignCenter ); |
255 | setCentralWidget( splash ); | 255 | setCentralWidget( splash ); |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | showMaximized(); | 257 | showMaximized(); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 260 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
261 | setDefaultPreferences(); | 261 | setDefaultPreferences(); |
262 | mCalendar = new CalendarLocal(); | 262 | mCalendar = new CalendarLocal(); |
263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 263 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
264 | mView->hide(); | 264 | mView->hide(); |
265 | //mView->resize(splash->size() ); | 265 | //mView->resize(splash->size() ); |
266 | initActions(); | 266 | initActions(); |
267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 267 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
268 | mSyncManager->setBlockSave(false); | 268 | mSyncManager->setBlockSave(false); |
269 | mView->setSyncManager(mSyncManager); | 269 | mView->setSyncManager(mSyncManager); |
270 | #ifndef DESKTOP_VERSION | 270 | #ifndef DESKTOP_VERSION |
271 | iconToolBar->show(); | 271 | iconToolBar->show(); |
272 | qApp->processEvents(); | 272 | qApp->processEvents(); |
273 | #endif | 273 | #endif |
274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 274 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
275 | int vh = height() ; | 275 | int vh = height() ; |
276 | int vw = width(); | 276 | int vw = width(); |
277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 277 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 278 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
279 | vh -= iconToolBar->height(); | 279 | vh -= iconToolBar->height(); |
280 | } else { | 280 | } else { |
281 | vw -= iconToolBar->height(); | 281 | vw -= iconToolBar->height(); |
282 | } | 282 | } |
283 | //mView->setMaximumSize( splash->size() ); | 283 | //mView->setMaximumSize( splash->size() ); |
284 | //mView->resize( splash->size() ); | 284 | //mView->resize( splash->size() ); |
285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 285 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
286 | mView->readSettings(); | 286 | mView->readSettings(); |
287 | bool newFile = false; | 287 | bool newFile = false; |
288 | if( !QFile::exists( defaultFileName() ) ) { | 288 | if( !QFile::exists( defaultFileName() ) ) { |
289 | QFileInfo finfo ( defaultFileName() ); | 289 | QFileInfo finfo ( defaultFileName() ); |
290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 290 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 291 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
292 | finfo.setFile( oldFile ); | 292 | finfo.setFile( oldFile ); |
293 | if (finfo.exists() ) { | 293 | if (finfo.exists() ) { |
294 | KMessageBox::information( this, message); | 294 | KMessageBox::information( this, message); |
295 | mView->openCalendar( oldFile ); | 295 | mView->openCalendar( oldFile ); |
296 | qApp->processEvents(); | 296 | qApp->processEvents(); |
297 | } else { | 297 | } else { |
298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 298 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
299 | finfo.setFile( oldFile ); | 299 | finfo.setFile( oldFile ); |
300 | if (finfo.exists() ) { | 300 | if (finfo.exists() ) { |
301 | KMessageBox::information( this, message); | 301 | KMessageBox::information( this, message); |
302 | mView->openCalendar( oldFile ); | 302 | mView->openCalendar( oldFile ); |
303 | qApp->processEvents(); | 303 | qApp->processEvents(); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | mView->saveCalendar( defaultFileName() ); | 306 | mView->saveCalendar( defaultFileName() ); |
307 | newFile = true; | 307 | newFile = true; |
308 | } | 308 | } |
309 | 309 | ||
310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 310 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
311 | mView->openCalendar( defaultFileName() ); | 311 | mView->openCalendar( defaultFileName() ); |
312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 312 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 313 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
314 | 314 | ||
315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 315 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
316 | KOPrefs::instance()->setAllDefaults(); | 316 | KOPrefs::instance()->setAllDefaults(); |
317 | int count = mView->addCategories(); | 317 | int count = mView->addCategories(); |
318 | } | 318 | } |
319 | processIncidenceSelection( 0 ); | 319 | processIncidenceSelection( 0 ); |
320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 320 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
321 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 321 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 322 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
323 | SLOT( slotModifiedChanged( bool ) ) ); | 323 | SLOT( slotModifiedChanged( bool ) ) ); |
324 | 324 | ||
325 | 325 | ||
326 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 326 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
327 | SLOT( disableBR(bool) ) ); | 327 | SLOT( disableBR(bool) ) ); |
328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 328 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
329 | mView->setModified( false ); | 329 | mView->setModified( false ); |
330 | mBlockAtStartup = false; | 330 | mBlockAtStartup = false; |
331 | mView->setModified( false ); | 331 | mView->setModified( false ); |
332 | setCentralWidget( mView ); | 332 | setCentralWidget( mView ); |
333 | globalFlagBlockStartup = 0; | 333 | globalFlagBlockStartup = 0; |
334 | mView->show(); | 334 | mView->show(); |
335 | delete splash; | 335 | delete splash; |
336 | if ( newFile ) | 336 | if ( newFile ) |
337 | mView->updateConfig(); | 337 | mView->updateConfig(); |
338 | // qApp->processEvents(); | 338 | // qApp->processEvents(); |
339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 339 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
340 | //fillSyncMenu(); | 340 | //fillSyncMenu(); |
341 | 341 | ||
342 | 342 | ||
343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 343 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 344 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 345 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 346 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 347 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
348 | mSyncManager->setDefaultFileName( sentSyncFile()); | 348 | mSyncManager->setDefaultFileName( sentSyncFile()); |
349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 349 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
350 | mSyncManager->fillSyncMenu(); | 350 | mSyncManager->fillSyncMenu(); |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 354 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
355 | if ( showWarning ) { | 355 | if ( showWarning ) { |
356 | KMessageBox::information( this, | 356 | KMessageBox::information( this, |
357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 357 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
358 | qApp->processEvents(); | 358 | qApp->processEvents(); |
359 | mView->dialogManager()->showSyncOptions(); | 359 | mView->dialogManager()->showSyncOptions(); |
360 | } | 360 | } |
361 | 361 | ||
362 | //US listen for result adressed from Ka/Pi | 362 | //US listen for result adressed from Ka/Pi |
363 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 364 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
365 | #endif | 365 | #endif |
366 | #ifndef DESKTOP_VERSION | 366 | #ifndef DESKTOP_VERSION |
367 | infrared = 0; | 367 | infrared = 0; |
368 | #endif | 368 | #endif |
369 | updateFilterToolbar(); | 369 | updateFilterToolbar(); |
370 | updateWeek( mView->startDate() ); | 370 | updateWeek( mView->startDate() ); |
371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 371 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 372 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
373 | mBRdisabled = false; | 373 | mBRdisabled = false; |
374 | //toggleBeamReceive(); | 374 | //toggleBeamReceive(); |
375 | } | 375 | } |
376 | MainWindow::~MainWindow() | 376 | MainWindow::~MainWindow() |
377 | { | 377 | { |
378 | //qDebug("MainWindow::~MainWindow() "); | 378 | //qDebug("MainWindow::~MainWindow() "); |
379 | //save toolbar location | 379 | //save toolbar location |
380 | delete mCalendar; | 380 | delete mCalendar; |
381 | delete mSyncManager; | 381 | delete mSyncManager; |
382 | #ifndef DESKTOP_VERSION | 382 | #ifndef DESKTOP_VERSION |
383 | if ( infrared ) | 383 | if ( infrared ) |
384 | delete infrared; | 384 | delete infrared; |
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | 387 | ||
388 | } | 388 | } |
389 | 389 | ||
390 | void MainWindow::disableBR(bool b) | 390 | void MainWindow::disableBR(bool b) |
391 | { | 391 | { |
392 | #ifndef DESKTOP_VERSION | 392 | #ifndef DESKTOP_VERSION |
393 | if ( b ) { | 393 | if ( b ) { |
394 | if ( infrared ) { | 394 | if ( infrared ) { |
395 | toggleBeamReceive(); | 395 | toggleBeamReceive(); |
396 | mBRdisabled = true; | 396 | mBRdisabled = true; |
397 | } | 397 | } |
398 | mBRdisabled = true; | 398 | mBRdisabled = true; |
399 | } else { | 399 | } else { |
400 | if ( mBRdisabled ) { | 400 | if ( mBRdisabled ) { |
401 | mBRdisabled = false; | 401 | mBRdisabled = false; |
402 | //makes no sense,because other cal ap is probably running | 402 | //makes no sense,because other cal ap is probably running |
403 | // toggleBeamReceive(); | 403 | // toggleBeamReceive(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | } | 408 | } |
409 | bool MainWindow::beamReceiveEnabled() | 409 | bool MainWindow::beamReceiveEnabled() |
410 | { | 410 | { |
411 | #ifndef DESKTOP_VERSION | 411 | #ifndef DESKTOP_VERSION |
412 | return ( infrared != 0 ); | 412 | return ( infrared != 0 ); |
413 | #endif | 413 | #endif |
414 | return false; | 414 | return false; |
415 | } | 415 | } |
416 | 416 | ||
417 | void MainWindow::toggleBeamReceive() | 417 | void MainWindow::toggleBeamReceive() |
418 | { | 418 | { |
419 | if ( mBRdisabled ) | 419 | if ( mBRdisabled ) |
420 | return; | 420 | return; |
421 | #ifndef DESKTOP_VERSION | 421 | #ifndef DESKTOP_VERSION |
422 | if ( infrared ) { | 422 | if ( infrared ) { |
423 | qDebug("KO: Disable BeamReceive "); | 423 | qDebug("KO: Disable BeamReceive "); |
424 | delete infrared; | 424 | delete infrared; |
425 | infrared = 0; | 425 | infrared = 0; |
426 | brAction->setOn(false); | 426 | brAction->setOn(false); |
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | qDebug("KO: Enable BeamReceive "); | 429 | qDebug("KO: Enable BeamReceive "); |
430 | brAction->setOn(true); | 430 | brAction->setOn(true); |
431 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 431 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
432 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 432 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
433 | #endif | 433 | #endif |
434 | } | 434 | } |
435 | void MainWindow::showMaximized () | 435 | void MainWindow::showMaximized () |
436 | { | 436 | { |
437 | #ifndef DESKTOP_VERSION | 437 | #ifndef DESKTOP_VERSION |
438 | if ( ! globalFlagBlockStartup ) | 438 | if ( ! globalFlagBlockStartup ) |
439 | if ( mClosed ) | 439 | if ( mClosed ) |
440 | mView->goToday(); | 440 | mView->goToday(); |
441 | #endif | 441 | #endif |
442 | QWidget::showMaximized () ; | 442 | QWidget::showMaximized () ; |
443 | mClosed = false; | 443 | mClosed = false; |
444 | } | 444 | } |
445 | void MainWindow::closeEvent( QCloseEvent* ce ) | 445 | void MainWindow::closeEvent( QCloseEvent* ce ) |
446 | { | 446 | { |
447 | 447 | ||
448 | 448 | ||
449 | 449 | ||
450 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 450 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
451 | saveOnClose(); | 451 | saveOnClose(); |
452 | mClosed = true; | 452 | mClosed = true; |
453 | ce->accept(); | 453 | ce->accept(); |
454 | return; | 454 | return; |
455 | 455 | ||
456 | } | 456 | } |
457 | 457 | ||
458 | switch( QMessageBox::information( this, "KO/Pi", | 458 | switch( QMessageBox::information( this, "KO/Pi", |
459 | i18n("Do you really want\nto close KO/Pi?"), | 459 | i18n("Do you really want\nto close KO/Pi?"), |
460 | i18n("Close"), i18n("No"), | 460 | i18n("Close"), i18n("No"), |
461 | 0, 0 ) ) { | 461 | 0, 0 ) ) { |
462 | case 0: | 462 | case 0: |
463 | saveOnClose(); | 463 | saveOnClose(); |
464 | mClosed = true; | 464 | mClosed = true; |
465 | ce->accept(); | 465 | ce->accept(); |
466 | break; | 466 | break; |
467 | case 1: | 467 | case 1: |
468 | ce->ignore(); | 468 | ce->ignore(); |
469 | break; | 469 | break; |
470 | case 2: | 470 | case 2: |
471 | 471 | ||
472 | default: | 472 | default: |
473 | break; | 473 | break; |
474 | } | 474 | } |
475 | 475 | ||
476 | 476 | ||
477 | } | 477 | } |
478 | 478 | ||
479 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 479 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
480 | { | 480 | { |
481 | QDataStream stream( data, IO_ReadOnly ); | 481 | QDataStream stream( data, IO_ReadOnly ); |
482 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 482 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
483 | //QString datamess; | 483 | //QString datamess; |
484 | //qDebug("message "); | 484 | //qDebug("message "); |
485 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 485 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
486 | 486 | ||
487 | if ( cmsg == "setDocument(QString)" ) { | 487 | if ( cmsg == "setDocument(QString)" ) { |
488 | QDataStream stream( data, IO_ReadOnly ); | 488 | QDataStream stream( data, IO_ReadOnly ); |
489 | QString fileName; | 489 | QString fileName; |
490 | stream >> fileName; | 490 | stream >> fileName; |
491 | //qDebug("filename %s ", fileName.latin1()); | 491 | //qDebug("filename %s ", fileName.latin1()); |
492 | showMaximized(); | 492 | showMaximized(); |
493 | raise(); | 493 | raise(); |
494 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 494 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
495 | mSyncManager->slotSyncMenu( 1002 ); | 495 | mSyncManager->slotSyncMenu( 1002 ); |
496 | return; | 496 | return; |
497 | } | 497 | } |
498 | 498 | ||
499 | if ( cmsg == "-writeFile" ) { | 499 | if ( cmsg == "-writeFile" ) { |
500 | // I made from the "-writeFile" an "-writeAlarm" | 500 | // I made from the "-writeFile" an "-writeAlarm" |
501 | mView->viewManager()->showWhatsNextView(); | 501 | mView->viewManager()->showWhatsNextView(); |
502 | mCalendar->checkAlarmForIncidence( 0, true); | 502 | mCalendar->checkAlarmForIncidence( 0, true); |
503 | showMaximized(); | 503 | showMaximized(); |
504 | raise(); | 504 | raise(); |
505 | return; | 505 | return; |
506 | 506 | ||
507 | } | 507 | } |
508 | if ( cmsg == "-writeFileSilent" ) { | 508 | if ( cmsg == "-writeFileSilent" ) { |
509 | // I made from the "-writeFile" an "-writeAlarm" | 509 | // I made from the "-writeFile" an "-writeAlarm" |
510 | // mView->viewManager()->showWhatsNextView(); | 510 | // mView->viewManager()->showWhatsNextView(); |
511 | mCalendar->checkAlarmForIncidence( 0, true); | 511 | mCalendar->checkAlarmForIncidence( 0, true); |
512 | //showMaximized(); | 512 | //showMaximized(); |
513 | //raise(); | 513 | //raise(); |
514 | hide(); | 514 | hide(); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | if ( cmsg == "-newCountdown" ) { | 517 | if ( cmsg == "-newCountdown" ) { |
518 | qDebug("newCountdown "); | 518 | qDebug("newCountdown "); |
519 | 519 | ||
520 | } | 520 | } |
521 | QString msg ; | 521 | QString msg ; |
522 | QString allmsg = cmsg; | 522 | QString allmsg = cmsg; |
523 | while ( allmsg.length() > 0 ) { | 523 | while ( allmsg.length() > 0 ) { |
524 | int nextC = allmsg.find( "-", 1 ); | 524 | int nextC = allmsg.find( "-", 1 ); |
525 | if ( nextC == -1 ) { | 525 | if ( nextC == -1 ) { |
526 | msg = allmsg; | 526 | msg = allmsg; |
527 | allmsg = ""; | 527 | allmsg = ""; |
528 | } else{ | 528 | } else{ |
529 | msg = allmsg.left( nextC ); | 529 | msg = allmsg.left( nextC ); |
530 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 530 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
531 | } | 531 | } |
532 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 532 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
533 | if ( msg == "-newEvent" ) { | 533 | if ( msg == "-newEvent" ) { |
534 | mView->newEvent(); | 534 | mView->newEvent(); |
535 | } | 535 | } |
536 | if ( msg == "-newTodo" ) { | 536 | if ( msg == "-newTodo" ) { |
537 | mView->newTodo(); | 537 | mView->newTodo(); |
538 | 538 | ||
539 | } | 539 | } |
540 | if ( msg == "-showWN" ) { | 540 | if ( msg == "-showWN" ) { |
541 | mView->viewManager()->showWhatsNextView(); | 541 | mView->viewManager()->showWhatsNextView(); |
542 | } | 542 | } |
543 | if ( msg == "-showTodo" ) { | 543 | if ( msg == "-showTodo" ) { |
544 | mView->viewManager()->showTodoView(); | 544 | mView->viewManager()->showTodoView(); |
545 | } | 545 | } |
546 | if ( msg == "-showList" ) { | 546 | if ( msg == "-showList" ) { |
547 | mView->viewManager()->showListView(); | 547 | mView->viewManager()->showListView(); |
548 | } | 548 | } |
549 | else if ( msg == "-showDay" ) { | 549 | else if ( msg == "-showDay" ) { |
550 | mView->viewManager()->showDayView(); | 550 | mView->viewManager()->showDayView(); |
551 | } | 551 | } |
552 | else if ( msg == "-showWWeek" ) { | 552 | else if ( msg == "-showWWeek" ) { |
553 | mView->viewManager()->showWorkWeekView(); | 553 | mView->viewManager()->showWorkWeekView(); |
554 | } | 554 | } |
555 | else if ( msg == "-ringSync" ) { | 555 | else if ( msg == "-ringSync" ) { |
556 | mSyncManager->multiSync( false ); | 556 | mSyncManager->multiSync( false ); |
557 | } | 557 | } |
558 | else if ( msg == "-showWeek" ) { | 558 | else if ( msg == "-showWeek" ) { |
559 | mView->viewManager()->showWeekView(); | 559 | mView->viewManager()->showWeekView(); |
560 | } | 560 | } |
561 | else if ( msg == "-showTodo" ) { | 561 | else if ( msg == "-showTodo" ) { |
562 | mView->viewManager()->showTodoView(); | 562 | mView->viewManager()->showTodoView(); |
563 | } | 563 | } |
564 | else if ( msg == "-showJournal" ) { | 564 | else if ( msg == "-showJournal" ) { |
565 | mView->dateNavigator()->selectDates( 1 ); | 565 | mView->dateNavigator()->selectDates( 1 ); |
566 | mView->dateNavigator()->selectToday(); | 566 | mView->dateNavigator()->selectToday(); |
567 | mView->viewManager()->showJournalView(); | 567 | mView->viewManager()->showJournalView(); |
568 | } | 568 | } |
569 | else if ( msg == "-showKO" ) { | 569 | else if ( msg == "-showKO" ) { |
570 | mView->viewManager()->showNextXView(); | 570 | mView->viewManager()->showNextXView(); |
571 | } | 571 | } |
572 | else if ( msg == "-showWNext" ) { | 572 | else if ( msg == "-showWNext" ) { |
573 | mView->viewManager()->showWhatsNextView(); | 573 | mView->viewManager()->showWhatsNextView(); |
574 | } | 574 | } |
@@ -899,770 +899,772 @@ void MainWindow::initActions() | |||
899 | 899 | ||
900 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 900 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
901 | this ); | 901 | this ); |
902 | mNewSubTodoAction->addTo( actionMenu ); | 902 | mNewSubTodoAction->addTo( actionMenu ); |
903 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 903 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
904 | mView, SLOT( newSubTodo() ) ); | 904 | mView, SLOT( newSubTodo() ) ); |
905 | 905 | ||
906 | actionMenu->insertSeparator(); | 906 | actionMenu->insertSeparator(); |
907 | 907 | ||
908 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 908 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
909 | mShowAction->addTo( actionMenu ); | 909 | mShowAction->addTo( actionMenu ); |
910 | connect( mShowAction, SIGNAL( activated() ), | 910 | connect( mShowAction, SIGNAL( activated() ), |
911 | mView, SLOT( showIncidence() ) ); | 911 | mView, SLOT( showIncidence() ) ); |
912 | 912 | ||
913 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 913 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
914 | mEditAction->addTo( actionMenu ); | 914 | mEditAction->addTo( actionMenu ); |
915 | connect( mEditAction, SIGNAL( activated() ), | 915 | connect( mEditAction, SIGNAL( activated() ), |
916 | mView, SLOT( editIncidence() ) ); | 916 | mView, SLOT( editIncidence() ) ); |
917 | 917 | ||
918 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 918 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
919 | mDeleteAction->addTo( actionMenu ); | 919 | mDeleteAction->addTo( actionMenu ); |
920 | connect( mDeleteAction, SIGNAL( activated() ), | 920 | connect( mDeleteAction, SIGNAL( activated() ), |
921 | mView, SLOT( deleteIncidence() ) ); | 921 | mView, SLOT( deleteIncidence() ) ); |
922 | 922 | ||
923 | 923 | ||
924 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 924 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
925 | mCloneAction->addTo( actionMenu ); | 925 | mCloneAction->addTo( actionMenu ); |
926 | connect( mCloneAction, SIGNAL( activated() ), | 926 | connect( mCloneAction, SIGNAL( activated() ), |
927 | mView, SLOT( cloneIncidence() ) ); | 927 | mView, SLOT( cloneIncidence() ) ); |
928 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 928 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
929 | mMoveAction->addTo( actionMenu ); | 929 | mMoveAction->addTo( actionMenu ); |
930 | connect( mMoveAction, SIGNAL( activated() ), | 930 | connect( mMoveAction, SIGNAL( activated() ), |
931 | mView, SLOT( moveIncidence() ) ); | 931 | mView, SLOT( moveIncidence() ) ); |
932 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 932 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
933 | mBeamAction->addTo( actionMenu ); | 933 | mBeamAction->addTo( actionMenu ); |
934 | connect( mBeamAction, SIGNAL( activated() ), | 934 | connect( mBeamAction, SIGNAL( activated() ), |
935 | mView, SLOT( beamIncidence() ) ); | 935 | mView, SLOT( beamIncidence() ) ); |
936 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 936 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
937 | mCancelAction->addTo( actionMenu ); | 937 | mCancelAction->addTo( actionMenu ); |
938 | connect( mCancelAction, SIGNAL( activated() ), | 938 | connect( mCancelAction, SIGNAL( activated() ), |
939 | mView, SLOT( toggleCancelIncidence() ) ); | 939 | mView, SLOT( toggleCancelIncidence() ) ); |
940 | 940 | ||
941 | actionMenu->insertSeparator(); | 941 | actionMenu->insertSeparator(); |
942 | 942 | ||
943 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 943 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
944 | this ); | 944 | this ); |
945 | action->addTo( actionMenu ); | 945 | action->addTo( actionMenu ); |
946 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 946 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
947 | 947 | ||
948 | icon = loadPixmap( pathString + "search" ); | 948 | icon = loadPixmap( pathString + "search" ); |
949 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 949 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
950 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 950 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
951 | search_action->addTo( actionMenu ); | 951 | search_action->addTo( actionMenu ); |
952 | connect( search_action, SIGNAL( activated() ), | 952 | connect( search_action, SIGNAL( activated() ), |
953 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 953 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
954 | 954 | ||
955 | 955 | ||
956 | 956 | ||
957 | if ( KOPrefs::instance()->mShowFullMenu ) { | 957 | if ( KOPrefs::instance()->mShowFullMenu ) { |
958 | actionMenu->insertSeparator(); | 958 | actionMenu->insertSeparator(); |
959 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 959 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
960 | 960 | ||
961 | } | 961 | } |
962 | // actionMenu->insertSeparator(); | 962 | // actionMenu->insertSeparator(); |
963 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 963 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
964 | this ); | 964 | this ); |
965 | action->addTo( importMenu_X ); | 965 | action->addTo( importMenu_X ); |
966 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 966 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
967 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 967 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
968 | this ); | 968 | this ); |
969 | action->addTo( importMenu_X ); | 969 | action->addTo( importMenu_X ); |
970 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 970 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
971 | importMenu_X->insertSeparator(); | 971 | importMenu_X->insertSeparator(); |
972 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 972 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
973 | this ); | 973 | this ); |
974 | action->addTo( importMenu_X ); | 974 | action->addTo( importMenu_X ); |
975 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 975 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
976 | //#ifndef DESKTOP_VERSION | 976 | //#ifndef DESKTOP_VERSION |
977 | importMenu_X->insertSeparator(); | 977 | importMenu_X->insertSeparator(); |
978 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 978 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
979 | this ); | 979 | this ); |
980 | action->addTo( importMenu_X ); | 980 | action->addTo( importMenu_X ); |
981 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 981 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
982 | //#else | 982 | //#else |
983 | #ifdef _OL_IMPORT_ | 983 | #ifdef _OL_IMPORT_ |
984 | importMenu_X->insertSeparator(); | 984 | importMenu_X->insertSeparator(); |
985 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 985 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
986 | this ); | 986 | this ); |
987 | action->addTo( importMenu_X ); | 987 | action->addTo( importMenu_X ); |
988 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 988 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
989 | #endif | 989 | #endif |
990 | //#endif | 990 | //#endif |
991 | 991 | ||
992 | //importMenu->insertSeparator(); | 992 | //importMenu->insertSeparator(); |
993 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 993 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
994 | this ); | 994 | this ); |
995 | action->addTo( importMenu ); | 995 | action->addTo( importMenu ); |
996 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 996 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
997 | 997 | ||
998 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 998 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
999 | this ); | 999 | this ); |
1000 | action->addTo( importMenu ); | 1000 | action->addTo( importMenu ); |
1001 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1001 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1002 | importMenu->insertSeparator(); | 1002 | importMenu->insertSeparator(); |
1003 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1003 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1004 | //importMenu->insertSeparator(); | 1004 | //importMenu->insertSeparator(); |
1005 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1005 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1006 | this ); | 1006 | this ); |
1007 | action->addTo( exportMenu_X ); | 1007 | action->addTo( exportMenu_X ); |
1008 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1008 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1009 | 1009 | ||
1010 | 1010 | ||
1011 | //LR | 1011 | //LR |
1012 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1012 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1013 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1013 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1014 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1014 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1015 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1015 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1016 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1016 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1017 | 1017 | ||
1018 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1018 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1019 | #ifndef DESKTOP_VERSION | 1019 | #ifndef DESKTOP_VERSION |
1020 | //importMenu->insertSeparator(); | 1020 | //importMenu->insertSeparator(); |
1021 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1021 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1022 | this ); | 1022 | this ); |
1023 | brAction->addTo( beamMenu_X ); | 1023 | brAction->addTo( beamMenu_X ); |
1024 | brAction->setToggleAction (true ) ; | 1024 | brAction->setToggleAction (true ) ; |
1025 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1025 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1026 | 1026 | ||
1027 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1027 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1028 | this ); | 1028 | this ); |
1029 | action->addTo( beamMenu_X ); | 1029 | action->addTo( beamMenu_X ); |
1030 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1030 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1031 | 1031 | ||
1032 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1032 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1033 | this ); | 1033 | this ); |
1034 | action->addTo( beamMenu_X ); | 1034 | action->addTo( beamMenu_X ); |
1035 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1035 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1036 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1036 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1037 | #else | 1037 | #else |
1038 | //importMenu->insertSeparator(); | 1038 | //importMenu->insertSeparator(); |
1039 | icon = loadPixmap( pathString + "print" ); | 1039 | icon = loadPixmap( pathString + "print" ); |
1040 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1040 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1041 | action->addTo( beamMenu_X ); | 1041 | action->addTo( beamMenu_X ); |
1042 | connect( action, SIGNAL( activated() ), | 1042 | connect( action, SIGNAL( activated() ), |
1043 | this, SLOT( printCal() ) ); | 1043 | this, SLOT( printCal() ) ); |
1044 | 1044 | ||
1045 | icon = loadPixmap( pathString + "print" ); | 1045 | icon = loadPixmap( pathString + "print" ); |
1046 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1046 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1047 | action->addTo( beamMenu_X ); | 1047 | action->addTo( beamMenu_X ); |
1048 | connect( action, SIGNAL( activated() ), | 1048 | connect( action, SIGNAL( activated() ), |
1049 | this, SLOT( printSel() ) ); | 1049 | this, SLOT( printSel() ) ); |
1050 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1050 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1051 | action->addTo( beamMenu_X ); | 1051 | action->addTo( beamMenu_X ); |
1052 | connect( action, SIGNAL( activated() ), | 1052 | connect( action, SIGNAL( activated() ), |
1053 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1053 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1054 | 1054 | ||
1055 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1055 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1056 | action->addTo( beamMenu_X ); | 1056 | action->addTo( beamMenu_X ); |
1057 | connect( action, SIGNAL( activated() ), | 1057 | connect( action, SIGNAL( activated() ), |
1058 | mView, SLOT( slotprintSelInc() ) ); | 1058 | mView, SLOT( slotprintSelInc() ) ); |
1059 | 1059 | ||
1060 | 1060 | ||
1061 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1061 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1062 | #endif | 1062 | #endif |
1063 | importMenu->insertSeparator(); | 1063 | importMenu->insertSeparator(); |
1064 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1064 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1065 | this ); | 1065 | this ); |
1066 | action->addTo( importMenu ); | 1066 | action->addTo( importMenu ); |
1067 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1067 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1068 | importMenu->insertSeparator(); | 1068 | importMenu->insertSeparator(); |
1069 | action = new QAction( "beam all", i18n("Save"), 0, | 1069 | action = new QAction( "beam all", i18n("Save"), 0, |
1070 | this ); | 1070 | this ); |
1071 | action->addTo( importMenu ); | 1071 | action->addTo( importMenu ); |
1072 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1072 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1073 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1073 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1074 | this ); | 1074 | this ); |
1075 | action->addTo( importMenu ); | 1075 | action->addTo( importMenu ); |
1076 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1076 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1077 | 1077 | ||
1078 | //menuBar->insertItem( "Configure",configureMenu ); | 1078 | //menuBar->insertItem( "Configure",configureMenu ); |
1079 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1079 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1080 | icon = loadPixmap( "korganizer/korganizer" ); | 1080 | icon = loadPixmap( "korganizer/korganizer" ); |
1081 | 1081 | ||
1082 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1082 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1083 | action->addTo( helpMenu ); | 1083 | action->addTo( helpMenu ); |
1084 | connect( action, SIGNAL( activated() ), | 1084 | connect( action, SIGNAL( activated() ), |
1085 | SLOT( whatsNew() ) ); | 1085 | SLOT( whatsNew() ) ); |
1086 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1086 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1087 | action->addTo( helpMenu ); | 1087 | action->addTo( helpMenu ); |
1088 | connect( action, SIGNAL( activated() ), | 1088 | connect( action, SIGNAL( activated() ), |
1089 | SLOT( features() ) ); | 1089 | SLOT( features() ) ); |
1090 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1090 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1091 | action->addTo( helpMenu ); | 1091 | action->addTo( helpMenu ); |
1092 | connect( action, SIGNAL( activated() ), | 1092 | connect( action, SIGNAL( activated() ), |
1093 | SLOT( keyBindings() ) ); | 1093 | SLOT( keyBindings() ) ); |
1094 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1094 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1095 | action->addTo( helpMenu ); | 1095 | action->addTo( helpMenu ); |
1096 | connect( action, SIGNAL( activated() ), | 1096 | connect( action, SIGNAL( activated() ), |
1097 | SLOT( storagehowto() ) ); | 1097 | SLOT( storagehowto() ) ); |
1098 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1098 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1099 | action->addTo( helpMenu ); | 1099 | action->addTo( helpMenu ); |
1100 | connect( action, SIGNAL( activated() ), | 1100 | connect( action, SIGNAL( activated() ), |
1101 | SLOT( timetrackinghowto() ) ); | 1101 | SLOT( timetrackinghowto() ) ); |
1102 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1102 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1103 | action->addTo( helpMenu ); | 1103 | action->addTo( helpMenu ); |
1104 | connect( action, SIGNAL( activated() ), | 1104 | connect( action, SIGNAL( activated() ), |
1105 | SLOT( synchowto() ) ); | 1105 | SLOT( synchowto() ) ); |
1106 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1106 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1107 | action->addTo( helpMenu ); | 1107 | action->addTo( helpMenu ); |
1108 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1109 | SLOT( kdesynchowto() ) ); | 1109 | SLOT( kdesynchowto() ) ); |
1110 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1110 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1111 | action->addTo( helpMenu ); | 1111 | action->addTo( helpMenu ); |
1112 | connect( action, SIGNAL( activated() ), | 1112 | connect( action, SIGNAL( activated() ), |
1113 | SLOT( multisynchowto() ) ); | 1113 | SLOT( multisynchowto() ) ); |
1114 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1114 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1115 | action->addTo( helpMenu ); | 1115 | action->addTo( helpMenu ); |
1116 | connect( action, SIGNAL( activated() ), | 1116 | connect( action, SIGNAL( activated() ), |
1117 | SLOT( aboutAutoSaving() ) ); | 1117 | SLOT( aboutAutoSaving() ) ); |
1118 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1118 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1119 | action->addTo( helpMenu ); | 1119 | action->addTo( helpMenu ); |
1120 | connect( action, SIGNAL( activated() ), | 1120 | connect( action, SIGNAL( activated() ), |
1121 | SLOT( aboutKnownBugs() ) ); | 1121 | SLOT( aboutKnownBugs() ) ); |
1122 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1122 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1123 | action->addTo( helpMenu ); | 1123 | action->addTo( helpMenu ); |
1124 | connect( action, SIGNAL( activated() ), | 1124 | connect( action, SIGNAL( activated() ), |
1125 | SLOT( usertrans() ) ); | 1125 | SLOT( usertrans() ) ); |
1126 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1126 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1127 | action->addTo( helpMenu ); | 1127 | action->addTo( helpMenu ); |
1128 | connect( action, SIGNAL( activated() ), | 1128 | connect( action, SIGNAL( activated() ), |
1129 | SLOT( faq() ) ); | 1129 | SLOT( faq() ) ); |
1130 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1130 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1131 | action->addTo( helpMenu ); | 1131 | action->addTo( helpMenu ); |
1132 | connect( action, SIGNAL( activated() ), | 1132 | connect( action, SIGNAL( activated() ), |
1133 | SLOT( licence() ) ); | 1133 | SLOT( licence() ) ); |
1134 | action = new QAction( "about", i18n("About..."), 0, this ); | 1134 | action = new QAction( "about", i18n("About..."), 0, this ); |
1135 | action->addTo( helpMenu ); | 1135 | action->addTo( helpMenu ); |
1136 | connect( action, SIGNAL( activated() ), | 1136 | connect( action, SIGNAL( activated() ), |
1137 | SLOT( about() ) ); | 1137 | SLOT( about() ) ); |
1138 | //menuBar->insertSeparator(); | 1138 | //menuBar->insertSeparator(); |
1139 | 1139 | ||
1140 | // ****************************************************** | 1140 | // ****************************************************** |
1141 | // menubar icons | 1141 | // menubar icons |
1142 | 1142 | ||
1143 | 1143 | ||
1144 | 1144 | ||
1145 | //menuBar->insertItem( iconToolBar ); | 1145 | //menuBar->insertItem( iconToolBar ); |
1146 | //xdays_action | 1146 | //xdays_action |
1147 | if (p-> mShowIconNewEvent) | 1147 | if (p-> mShowIconNewEvent) |
1148 | ne_action->addTo( iconToolBar ); | 1148 | ne_action->addTo( iconToolBar ); |
1149 | if (p->mShowIconNewTodo ) | 1149 | if (p->mShowIconNewTodo ) |
1150 | nt_action->addTo( iconToolBar ); | 1150 | nt_action->addTo( iconToolBar ); |
1151 | if (p-> mShowIconSearch) | 1151 | if (p-> mShowIconSearch) |
1152 | search_action->addTo( iconToolBar ); | 1152 | search_action->addTo( iconToolBar ); |
1153 | if (p-> mShowIconWhatsThis) | 1153 | if (p-> mShowIconWhatsThis) |
1154 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1154 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1155 | if (p-> mShowIconNext) | 1155 | if (p-> mShowIconNext) |
1156 | whatsnext_action->addTo( viewToolBar ); | 1156 | whatsnext_action->addTo( viewToolBar ); |
1157 | if (p-> mShowIconNextDays) | 1157 | if (p-> mShowIconNextDays) |
1158 | xdays_action->addTo( viewToolBar ); | 1158 | xdays_action->addTo( viewToolBar ); |
1159 | if (p-> mShowIconJournal) | 1159 | if (p-> mShowIconJournal) |
1160 | viewjournal_action->addTo( viewToolBar ); | 1160 | viewjournal_action->addTo( viewToolBar ); |
1161 | if (p-> mShowIconDay1) | 1161 | if (p-> mShowIconDay1) |
1162 | day1_action->addTo( viewToolBar ); | 1162 | day1_action->addTo( viewToolBar ); |
1163 | if (p-> mShowIconDay5) | 1163 | if (p-> mShowIconDay5) |
1164 | day5_action->addTo( viewToolBar ); | 1164 | day5_action->addTo( viewToolBar ); |
1165 | if (p-> mShowIconDay7) | 1165 | if (p-> mShowIconDay7) |
1166 | day7_action->addTo( viewToolBar ); | 1166 | day7_action->addTo( viewToolBar ); |
1167 | if (p-> mShowIconDay6) | 1167 | if (p-> mShowIconDay6) |
1168 | day6_action->addTo( viewToolBar ); | 1168 | day6_action->addTo( viewToolBar ); |
1169 | if (p-> mShowIconMonth) | 1169 | if (p-> mShowIconMonth) |
1170 | month_action->addTo( viewToolBar ); | 1170 | month_action->addTo( viewToolBar ); |
1171 | if (p-> mShowIconList) | 1171 | if (p-> mShowIconList) |
1172 | showlist_action->addTo( viewToolBar ); | 1172 | showlist_action->addTo( viewToolBar ); |
1173 | if (p-> mShowIconTodoview) | 1173 | if (p-> mShowIconTodoview) |
1174 | todoview_action->addTo( viewToolBar ); | 1174 | todoview_action->addTo( viewToolBar ); |
1175 | 1175 | ||
1176 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1176 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1177 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1177 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1178 | if (p-> mShowIconBackFast) { | 1178 | if (p-> mShowIconBackFast) { |
1179 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1179 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1180 | connect( action, SIGNAL( activated() ), | 1180 | connect( action, SIGNAL( activated() ), |
1181 | mView, SLOT( goPreviousMonth() ) ); | 1181 | mView, SLOT( goPreviousMonth() ) ); |
1182 | action->addTo( navigatorToolBar ); | 1182 | action->addTo( navigatorToolBar ); |
1183 | } | 1183 | } |
1184 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1184 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1185 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1185 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1186 | if (p-> mShowIconBack) { | 1186 | if (p-> mShowIconBack) { |
1187 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1187 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1188 | connect( action, SIGNAL( activated() ), | 1188 | connect( action, SIGNAL( activated() ), |
1189 | mView, SLOT( goPrevious() ) ); | 1189 | mView, SLOT( goPrevious() ) ); |
1190 | action->addTo( navigatorToolBar ); | 1190 | action->addTo( navigatorToolBar ); |
1191 | } | 1191 | } |
1192 | icon = loadPixmap( pathString + "today" ); | 1192 | icon = loadPixmap( pathString + "today" ); |
1193 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1193 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1194 | if (p-> mShowIconToday) | 1194 | if (p-> mShowIconToday) |
1195 | today_action->addTo( navigatorToolBar ); | 1195 | today_action->addTo( navigatorToolBar ); |
1196 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1196 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1197 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1197 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1198 | if (p-> mShowIconForward) { | 1198 | if (p-> mShowIconForward) { |
1199 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1199 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1200 | connect( action, SIGNAL( activated() ), | 1200 | connect( action, SIGNAL( activated() ), |
1201 | mView, SLOT( goNext() ) ); | 1201 | mView, SLOT( goNext() ) ); |
1202 | action->addTo( navigatorToolBar ); | 1202 | action->addTo( navigatorToolBar ); |
1203 | } | 1203 | } |
1204 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1204 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1205 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1205 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1206 | if (p-> mShowIconForwardFast) { | 1206 | if (p-> mShowIconForwardFast) { |
1207 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1207 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1208 | connect( action, SIGNAL( activated() ), | 1208 | connect( action, SIGNAL( activated() ), |
1209 | mView, SLOT( goNextMonth() ) ); | 1209 | mView, SLOT( goNextMonth() ) ); |
1210 | action->addTo( navigatorToolBar ); | 1210 | action->addTo( navigatorToolBar ); |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | 1213 | ||
1214 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1214 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1215 | 1215 | ||
1216 | 1216 | ||
1217 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1217 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1218 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1218 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1219 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1219 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1220 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1220 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1221 | 1221 | ||
1222 | if (p-> mShowIconNewEvent) | 1222 | if (p-> mShowIconNewEvent) |
1223 | configureToolBarMenu->setItemChecked( 10, true ); | 1223 | configureToolBarMenu->setItemChecked( 10, true ); |
1224 | if (p->mShowIconNewTodo ) | 1224 | if (p->mShowIconNewTodo ) |
1225 | configureToolBarMenu->setItemChecked( 20, true ); | 1225 | configureToolBarMenu->setItemChecked( 20, true ); |
1226 | if (p-> mShowIconSearch) | 1226 | if (p-> mShowIconSearch) |
1227 | configureToolBarMenu->setItemChecked( 120, true ); | 1227 | configureToolBarMenu->setItemChecked( 120, true ); |
1228 | if (p-> mShowIconList) | 1228 | if (p-> mShowIconList) |
1229 | configureToolBarMenu->setItemChecked( 30, true ); | 1229 | configureToolBarMenu->setItemChecked( 30, true ); |
1230 | if (p-> mShowIconDay1) | 1230 | if (p-> mShowIconDay1) |
1231 | configureToolBarMenu->setItemChecked( 40, true ); | 1231 | configureToolBarMenu->setItemChecked( 40, true ); |
1232 | if (p-> mShowIconDay5) | 1232 | if (p-> mShowIconDay5) |
1233 | configureToolBarMenu->setItemChecked( 50, true ); | 1233 | configureToolBarMenu->setItemChecked( 50, true ); |
1234 | if (p-> mShowIconDay6) | 1234 | if (p-> mShowIconDay6) |
1235 | configureToolBarMenu->setItemChecked( 75, true ); | 1235 | configureToolBarMenu->setItemChecked( 75, true ); |
1236 | if (p-> mShowIconDay7) | 1236 | if (p-> mShowIconDay7) |
1237 | configureToolBarMenu->setItemChecked( 60, true ); | 1237 | configureToolBarMenu->setItemChecked( 60, true ); |
1238 | if (p-> mShowIconMonth) | 1238 | if (p-> mShowIconMonth) |
1239 | configureToolBarMenu->setItemChecked( 70, true ); | 1239 | configureToolBarMenu->setItemChecked( 70, true ); |
1240 | if (p-> mShowIconTodoview) | 1240 | if (p-> mShowIconTodoview) |
1241 | configureToolBarMenu->setItemChecked( 80, true ); | 1241 | configureToolBarMenu->setItemChecked( 80, true ); |
1242 | if (p-> mShowIconBackFast) | 1242 | if (p-> mShowIconBackFast) |
1243 | configureToolBarMenu->setItemChecked( 200, true ); | 1243 | configureToolBarMenu->setItemChecked( 200, true ); |
1244 | if (p-> mShowIconBack) | 1244 | if (p-> mShowIconBack) |
1245 | configureToolBarMenu->setItemChecked( 210, true ); | 1245 | configureToolBarMenu->setItemChecked( 210, true ); |
1246 | if (p-> mShowIconToday) | 1246 | if (p-> mShowIconToday) |
1247 | configureToolBarMenu->setItemChecked( 130, true ); | 1247 | configureToolBarMenu->setItemChecked( 130, true ); |
1248 | if (p-> mShowIconForward) | 1248 | if (p-> mShowIconForward) |
1249 | configureToolBarMenu->setItemChecked( 220, true ); | 1249 | configureToolBarMenu->setItemChecked( 220, true ); |
1250 | if (p-> mShowIconForwardFast) | 1250 | if (p-> mShowIconForwardFast) |
1251 | configureToolBarMenu->setItemChecked( 230, true ); | 1251 | configureToolBarMenu->setItemChecked( 230, true ); |
1252 | if (p-> mShowIconNextDays) | 1252 | if (p-> mShowIconNextDays) |
1253 | configureToolBarMenu->setItemChecked( 100, true ); | 1253 | configureToolBarMenu->setItemChecked( 100, true ); |
1254 | if (p-> mShowIconNext) | 1254 | if (p-> mShowIconNext) |
1255 | configureToolBarMenu->setItemChecked( 110, true ); | 1255 | configureToolBarMenu->setItemChecked( 110, true ); |
1256 | if (p-> mShowIconJournal) | 1256 | if (p-> mShowIconJournal) |
1257 | configureToolBarMenu->setItemChecked( 90, true ); | 1257 | configureToolBarMenu->setItemChecked( 90, true ); |
1258 | if (p-> mShowIconWhatsThis) | 1258 | if (p-> mShowIconWhatsThis) |
1259 | configureToolBarMenu->setItemChecked( 300, true ); | 1259 | configureToolBarMenu->setItemChecked( 300, true ); |
1260 | if (p-> mShowIconWeekNum) | 1260 | if (p-> mShowIconWeekNum) |
1261 | configureToolBarMenu->setItemChecked( 400, true ); | 1261 | configureToolBarMenu->setItemChecked( 400, true ); |
1262 | if (!p-> mShowIconStretch) { | 1262 | if (!p-> mShowIconStretch) { |
1263 | QLabel* dummy = new QLabel( iconToolBar ); | 1263 | QLabel* dummy = new QLabel( iconToolBar ); |
1264 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1264 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1265 | dummy->setMinimumWidth( 0 ); | 1265 | dummy->setMinimumWidth( 0 ); |
1266 | iconToolBar->setStretchableWidget ( dummy ) ; | 1266 | iconToolBar->setStretchableWidget ( dummy ) ; |
1267 | } | 1267 | } |
1268 | else { | 1268 | else { |
1269 | iconToolBar->setHorizontalStretchable (true ); | 1269 | iconToolBar->setHorizontalStretchable (true ); |
1270 | viewToolBar->setHorizontalStretchable (true ); | 1270 | viewToolBar->setHorizontalStretchable (true ); |
1271 | navigatorToolBar->setHorizontalStretchable (true ); | 1271 | navigatorToolBar->setHorizontalStretchable (true ); |
1272 | iconToolBar->setVerticalStretchable (true ); | 1272 | iconToolBar->setVerticalStretchable (true ); |
1273 | viewToolBar->setVerticalStretchable (true ); | 1273 | viewToolBar->setVerticalStretchable (true ); |
1274 | navigatorToolBar->setVerticalStretchable (true ); | 1274 | navigatorToolBar->setVerticalStretchable (true ); |
1275 | configureToolBarMenu->setItemChecked( 5, true ); | 1275 | configureToolBarMenu->setItemChecked( 5, true ); |
1276 | } | 1276 | } |
1277 | if (p-> mShowIconFilter) | 1277 | if (p-> mShowIconFilter) |
1278 | configureToolBarMenu->setItemChecked( 7, true ); | 1278 | configureToolBarMenu->setItemChecked( 7, true ); |
1279 | if (p-> mShowIconOnetoolbar) | 1279 | if (p-> mShowIconOnetoolbar) |
1280 | configureToolBarMenu->setItemChecked( 6, true ); | 1280 | configureToolBarMenu->setItemChecked( 6, true ); |
1281 | 1281 | ||
1282 | 1282 | ||
1283 | if ( filterMenubar ) | 1283 | if ( filterMenubar ) { |
1284 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1284 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1285 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | ||
1286 | } | ||
1285 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1287 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1286 | configureAgenda( p->mHourSize ); | 1288 | configureAgenda( p->mHourSize ); |
1287 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1289 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1288 | } | 1290 | } |
1289 | 1291 | ||
1290 | void MainWindow::exportToPhone( int mode ) | 1292 | void MainWindow::exportToPhone( int mode ) |
1291 | { | 1293 | { |
1292 | 1294 | ||
1293 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1295 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1294 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1296 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1295 | KOex2phonePrefs ex2phone; | 1297 | KOex2phonePrefs ex2phone; |
1296 | 1298 | ||
1297 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1299 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1298 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1300 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1299 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1301 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1300 | if ( mode == 1 ) | 1302 | if ( mode == 1 ) |
1301 | ex2phone.setCaption(i18n("Export complete calendar")); | 1303 | ex2phone.setCaption(i18n("Export complete calendar")); |
1302 | if ( mode == 2 ) | 1304 | if ( mode == 2 ) |
1303 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1305 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1304 | 1306 | ||
1305 | if ( !ex2phone.exec() ) { | 1307 | if ( !ex2phone.exec() ) { |
1306 | return; | 1308 | return; |
1307 | } | 1309 | } |
1308 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1310 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1309 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1311 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1310 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1312 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1311 | 1313 | ||
1312 | int inFuture = 0; | 1314 | int inFuture = 0; |
1313 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1315 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1314 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1316 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1315 | QPtrList<Incidence> delSel; | 1317 | QPtrList<Incidence> delSel; |
1316 | if ( mode == 1 ) | 1318 | if ( mode == 1 ) |
1317 | delSel = mCalendar->rawIncidences(); | 1319 | delSel = mCalendar->rawIncidences(); |
1318 | if ( mode == 2 ) | 1320 | if ( mode == 2 ) |
1319 | delSel = mCalendar->incidences(); | 1321 | delSel = mCalendar->incidences(); |
1320 | CalendarLocal* cal = new CalendarLocal(); | 1322 | CalendarLocal* cal = new CalendarLocal(); |
1321 | cal->setLocalTime(); | 1323 | cal->setLocalTime(); |
1322 | Incidence *incidence = delSel.first(); | 1324 | Incidence *incidence = delSel.first(); |
1323 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1325 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1324 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1326 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1325 | while ( incidence ) { | 1327 | while ( incidence ) { |
1326 | if ( incidence->type() != "Journal" ) { | 1328 | if ( incidence->type() != "Journal" ) { |
1327 | bool add = true; | 1329 | bool add = true; |
1328 | if ( inFuture ) { | 1330 | if ( inFuture ) { |
1329 | QDateTime dt; | 1331 | QDateTime dt; |
1330 | if ( incidence->type() == "Todo" ) { | 1332 | if ( incidence->type() == "Todo" ) { |
1331 | Todo * t = (Todo*)incidence; | 1333 | Todo * t = (Todo*)incidence; |
1332 | if ( t->hasDueDate() ) | 1334 | if ( t->hasDueDate() ) |
1333 | dt = t->dtDue(); | 1335 | dt = t->dtDue(); |
1334 | else | 1336 | else |
1335 | dt = cur.addSecs( 62 ); | 1337 | dt = cur.addSecs( 62 ); |
1336 | } | 1338 | } |
1337 | else { | 1339 | else { |
1338 | bool ok; | 1340 | bool ok; |
1339 | dt = incidence->getNextOccurence( cur, &ok ); | 1341 | dt = incidence->getNextOccurence( cur, &ok ); |
1340 | if ( !ok ) | 1342 | if ( !ok ) |
1341 | dt = cur.addSecs( -62 ); | 1343 | dt = cur.addSecs( -62 ); |
1342 | } | 1344 | } |
1343 | if ( dt < cur || dt > end ) { | 1345 | if ( dt < cur || dt > end ) { |
1344 | add = false; | 1346 | add = false; |
1345 | } | 1347 | } |
1346 | } | 1348 | } |
1347 | if ( add ) { | 1349 | if ( add ) { |
1348 | Incidence *in = incidence->clone(); | 1350 | Incidence *in = incidence->clone(); |
1349 | cal->addIncidence( in ); | 1351 | cal->addIncidence( in ); |
1350 | } | 1352 | } |
1351 | } | 1353 | } |
1352 | incidence = delSel.next(); | 1354 | incidence = delSel.next(); |
1353 | } | 1355 | } |
1354 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1356 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1355 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1357 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1356 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1358 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1357 | 1359 | ||
1358 | setCaption( i18n("Writing to phone...")); | 1360 | setCaption( i18n("Writing to phone...")); |
1359 | if ( PhoneFormat::writeToPhone( cal ) ) | 1361 | if ( PhoneFormat::writeToPhone( cal ) ) |
1360 | setCaption( i18n("Export to phone successful!")); | 1362 | setCaption( i18n("Export to phone successful!")); |
1361 | else | 1363 | else |
1362 | setCaption( i18n("Error exporting to phone!")); | 1364 | setCaption( i18n("Error exporting to phone!")); |
1363 | delete cal; | 1365 | delete cal; |
1364 | } | 1366 | } |
1365 | 1367 | ||
1366 | 1368 | ||
1367 | void MainWindow::setDefaultPreferences() | 1369 | void MainWindow::setDefaultPreferences() |
1368 | { | 1370 | { |
1369 | KOPrefs *p = KOPrefs::instance(); | 1371 | KOPrefs *p = KOPrefs::instance(); |
1370 | 1372 | ||
1371 | p->mCompactDialogs = true; | 1373 | p->mCompactDialogs = true; |
1372 | p->mConfirm = true; | 1374 | p->mConfirm = true; |
1373 | // p->mEnableQuickTodo = false; | 1375 | // p->mEnableQuickTodo = false; |
1374 | 1376 | ||
1375 | } | 1377 | } |
1376 | 1378 | ||
1377 | QString MainWindow::resourcePath() | 1379 | QString MainWindow::resourcePath() |
1378 | { | 1380 | { |
1379 | return KGlobal::iconLoader()->iconPath(); | 1381 | return KGlobal::iconLoader()->iconPath(); |
1380 | } | 1382 | } |
1381 | 1383 | ||
1382 | void MainWindow::displayText( QString text ,QString cap ) | 1384 | void MainWindow::displayText( QString text ,QString cap ) |
1383 | { | 1385 | { |
1384 | QDialog dia( this, "name", true ); ; | 1386 | QDialog dia( this, "name", true ); ; |
1385 | dia.setCaption( cap ); | 1387 | dia.setCaption( cap ); |
1386 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1388 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1387 | lay->setSpacing( 3 ); | 1389 | lay->setSpacing( 3 ); |
1388 | lay->setMargin( 3 ); | 1390 | lay->setMargin( 3 ); |
1389 | QTextBrowser tb ( &dia ); | 1391 | QTextBrowser tb ( &dia ); |
1390 | lay->addWidget( &tb ); | 1392 | lay->addWidget( &tb ); |
1391 | tb.setText( text ); | 1393 | tb.setText( text ); |
1392 | #ifdef DESKTOP_VERSION | 1394 | #ifdef DESKTOP_VERSION |
1393 | dia.resize( 640, 480); | 1395 | dia.resize( 640, 480); |
1394 | #else | 1396 | #else |
1395 | dia.showMaximized(); | 1397 | dia.showMaximized(); |
1396 | #endif | 1398 | #endif |
1397 | dia.exec(); | 1399 | dia.exec(); |
1398 | } | 1400 | } |
1399 | 1401 | ||
1400 | void MainWindow::features() | 1402 | void MainWindow::features() |
1401 | { | 1403 | { |
1402 | 1404 | ||
1403 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1405 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1404 | } | 1406 | } |
1405 | 1407 | ||
1406 | void MainWindow::usertrans() | 1408 | void MainWindow::usertrans() |
1407 | { | 1409 | { |
1408 | 1410 | ||
1409 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1411 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1410 | } | 1412 | } |
1411 | 1413 | ||
1412 | void MainWindow::storagehowto() | 1414 | void MainWindow::storagehowto() |
1413 | { | 1415 | { |
1414 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1416 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1415 | } | 1417 | } |
1416 | void MainWindow::timetrackinghowto() | 1418 | void MainWindow::timetrackinghowto() |
1417 | { | 1419 | { |
1418 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1420 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1419 | } | 1421 | } |
1420 | void MainWindow::kdesynchowto() | 1422 | void MainWindow::kdesynchowto() |
1421 | { | 1423 | { |
1422 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1424 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1423 | } | 1425 | } |
1424 | void MainWindow::multisynchowto() | 1426 | void MainWindow::multisynchowto() |
1425 | { | 1427 | { |
1426 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1428 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1427 | } | 1429 | } |
1428 | void MainWindow::synchowto() | 1430 | void MainWindow::synchowto() |
1429 | { | 1431 | { |
1430 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1432 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1431 | } | 1433 | } |
1432 | void MainWindow::faq() | 1434 | void MainWindow::faq() |
1433 | { | 1435 | { |
1434 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1436 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1435 | 1437 | ||
1436 | } | 1438 | } |
1437 | void MainWindow::whatsNew() | 1439 | void MainWindow::whatsNew() |
1438 | { | 1440 | { |
1439 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1441 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1440 | 1442 | ||
1441 | } | 1443 | } |
1442 | void MainWindow::licence() | 1444 | void MainWindow::licence() |
1443 | { | 1445 | { |
1444 | KApplication::showLicence(); | 1446 | KApplication::showLicence(); |
1445 | 1447 | ||
1446 | } | 1448 | } |
1447 | void MainWindow::about() | 1449 | void MainWindow::about() |
1448 | { | 1450 | { |
1449 | QString version; | 1451 | QString version; |
1450 | #include <../version> | 1452 | #include <../version> |
1451 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1453 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1452 | i18n("KOrganizer/Platform-independent\n") + | 1454 | i18n("KOrganizer/Platform-independent\n") + |
1453 | "(KO/Pi) " + version + " - " + | 1455 | "(KO/Pi) " + version + " - " + |
1454 | 1456 | ||
1455 | #ifdef DESKTOP_VERSION | 1457 | #ifdef DESKTOP_VERSION |
1456 | i18n("Desktop Edition\n") + | 1458 | i18n("Desktop Edition\n") + |
1457 | #else | 1459 | #else |
1458 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1460 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1459 | #endif | 1461 | #endif |
1460 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1462 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1461 | } | 1463 | } |
1462 | void MainWindow::keyBindings() | 1464 | void MainWindow::keyBindings() |
1463 | { | 1465 | { |
1464 | QString cap = i18n("KO/Pi Keys + Colors"); | 1466 | QString cap = i18n("KO/Pi Keys + Colors"); |
1465 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1467 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1466 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1468 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1467 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1469 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1468 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1470 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1469 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1471 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1470 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1472 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1471 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1473 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1472 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1474 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1473 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1475 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1474 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1476 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1475 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1477 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1476 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1478 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1477 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1479 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1478 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1480 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1479 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1481 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1480 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1482 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1481 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1483 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1482 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1484 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1483 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1485 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1484 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1486 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1485 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1487 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1486 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1488 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1487 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1489 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1488 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1490 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1489 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1491 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1490 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1492 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1491 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1493 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1492 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1494 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1493 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1495 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1494 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1496 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1495 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1497 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1496 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1498 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1497 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1499 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1498 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1500 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1499 | i18n("<p><h3>In list view:</h3></p>\n") + | 1501 | i18n("<p><h3>In list view:</h3></p>\n") + |
1500 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1502 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1501 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1503 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1502 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1504 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1503 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1505 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1504 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1506 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1505 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1507 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1506 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1508 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1507 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1509 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1508 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1510 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1509 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1511 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1510 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1512 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1511 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1513 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1512 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1514 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1513 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1515 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1514 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1516 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1515 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1517 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1516 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1518 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1517 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1519 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1518 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1520 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1519 | displayText( text, cap); | 1521 | displayText( text, cap); |
1520 | } | 1522 | } |
1521 | void MainWindow::aboutAutoSaving() | 1523 | void MainWindow::aboutAutoSaving() |
1522 | { | 1524 | { |
1523 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1525 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1524 | 1526 | ||
1525 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1527 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1526 | 1528 | ||
1527 | } | 1529 | } |
1528 | void MainWindow::aboutKnownBugs() | 1530 | void MainWindow::aboutKnownBugs() |
1529 | { | 1531 | { |
1530 | QMessageBox* msg; | 1532 | QMessageBox* msg; |
1531 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1533 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1532 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1534 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1533 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1535 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1534 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1536 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1535 | i18n("\nor report them in the bugtracker on\n") + | 1537 | i18n("\nor report them in the bugtracker on\n") + |
1536 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1538 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1537 | QMessageBox::NoIcon, | 1539 | QMessageBox::NoIcon, |
1538 | QMessageBox::Ok, | 1540 | QMessageBox::Ok, |
1539 | QMessageBox::NoButton, | 1541 | QMessageBox::NoButton, |
1540 | QMessageBox::NoButton); | 1542 | QMessageBox::NoButton); |
1541 | msg->exec(); | 1543 | msg->exec(); |
1542 | delete msg; | 1544 | delete msg; |
1543 | 1545 | ||
1544 | } | 1546 | } |
1545 | 1547 | ||
1546 | QString MainWindow::defaultFileName() | 1548 | QString MainWindow::defaultFileName() |
1547 | { | 1549 | { |
1548 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1550 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1549 | } | 1551 | } |
1550 | QString MainWindow::syncFileName() | 1552 | QString MainWindow::syncFileName() |
1551 | { | 1553 | { |
1552 | #ifdef DESKTOP_VERSION | 1554 | #ifdef DESKTOP_VERSION |
1553 | return locateLocal( "tmp", "synccalendar.ics" ); | 1555 | return locateLocal( "tmp", "synccalendar.ics" ); |
1554 | #else | 1556 | #else |
1555 | return QString( "/tmp/synccalendar.ics" ); | 1557 | return QString( "/tmp/synccalendar.ics" ); |
1556 | #endif | 1558 | #endif |
1557 | } | 1559 | } |
1558 | #include "koglobals.h" | 1560 | #include "koglobals.h" |
1559 | #include <kcalendarsystem.h> | 1561 | #include <kcalendarsystem.h> |
1560 | void MainWindow::updateWeek(QDate seda) | 1562 | void MainWindow::updateWeek(QDate seda) |
1561 | { | 1563 | { |
1562 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1564 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1563 | mWeekPixmap.fill( mWeekBgColor ); | 1565 | mWeekPixmap.fill( mWeekBgColor ); |
1564 | QPainter p ( &mWeekPixmap ); | 1566 | QPainter p ( &mWeekPixmap ); |
1565 | p.setFont( mWeekFont ); | 1567 | p.setFont( mWeekFont ); |
1566 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1568 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1567 | p.end(); | 1569 | p.end(); |
1568 | QIconSet icon3 ( mWeekPixmap ); | 1570 | QIconSet icon3 ( mWeekPixmap ); |
1569 | mWeekAction->setIconSet ( icon3 ); | 1571 | mWeekAction->setIconSet ( icon3 ); |
1570 | 1572 | ||
1571 | } | 1573 | } |
1572 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1574 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1573 | { | 1575 | { |
1574 | updateWeek( selectedDates.first() ); | 1576 | updateWeek( selectedDates.first() ); |
1575 | } | 1577 | } |
1576 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1578 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1577 | { | 1579 | { |
1578 | 1580 | ||
1579 | if ( !incidence ) { | 1581 | if ( !incidence ) { |
1580 | enableIncidenceActions( false ); | 1582 | enableIncidenceActions( false ); |
1581 | 1583 | ||
1582 | mNewSubTodoAction->setEnabled( false ); | 1584 | mNewSubTodoAction->setEnabled( false ); |
1583 | setCaptionToDates(); | 1585 | setCaptionToDates(); |
1584 | return; | 1586 | return; |
1585 | 1587 | ||
1586 | } | 1588 | } |
1587 | 1589 | ||
1588 | //KGlobal::locale()->formatDateTime(nextA, true); | 1590 | //KGlobal::locale()->formatDateTime(nextA, true); |
1589 | QString startString = ""; | 1591 | QString startString = ""; |
1590 | if ( incidence->type() != "Todo" ) { | 1592 | if ( incidence->type() != "Todo" ) { |
1591 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1593 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1592 | if ( incidence->doesFloat() ) { | 1594 | if ( incidence->doesFloat() ) { |
1593 | startString += ": "+incidence->dtStartDateStr( true ); | 1595 | startString += ": "+incidence->dtStartDateStr( true ); |
1594 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1596 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1595 | 1597 | ||
1596 | } else { | 1598 | } else { |
1597 | startString = ": "+incidence->dtStartStr(true); | 1599 | startString = ": "+incidence->dtStartStr(true); |
1598 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1600 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1599 | 1601 | ||
1600 | } | 1602 | } |
1601 | 1603 | ||
1602 | } else { | 1604 | } else { |
1603 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1605 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1604 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1606 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1605 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1607 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1606 | 1608 | ||
1607 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1609 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1608 | bool ok; | 1610 | bool ok; |
1609 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1611 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1610 | if ( ok ) { | 1612 | if ( ok ) { |
1611 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1613 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1612 | startString += i18n(" (%1 y.)"). arg( years ); | 1614 | startString += i18n(" (%1 y.)"). arg( years ); |
1613 | } | 1615 | } |
1614 | } | 1616 | } |
1615 | else | 1617 | else |
1616 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1618 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1617 | } | 1619 | } |
1618 | 1620 | ||
1619 | } | 1621 | } |
1620 | else | 1622 | else |
1621 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1623 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1622 | if ( !incidence->location().isEmpty() ) | 1624 | if ( !incidence->location().isEmpty() ) |
1623 | startString += " (" +incidence->location()+")"; | 1625 | startString += " (" +incidence->location()+")"; |
1624 | setCaption( incidence->summary()+startString); | 1626 | setCaption( incidence->summary()+startString); |
1625 | 1627 | ||
1626 | enableIncidenceActions( true ); | 1628 | enableIncidenceActions( true ); |
1627 | 1629 | ||
1628 | if ( incidence->type() == "Event" ) { | 1630 | if ( incidence->type() == "Event" ) { |
1629 | mShowAction->setText( i18n("Show Event...") ); | 1631 | mShowAction->setText( i18n("Show Event...") ); |
1630 | mEditAction->setText( i18n("Edit Event...") ); | 1632 | mEditAction->setText( i18n("Edit Event...") ); |
1631 | mDeleteAction->setText( i18n("Delete Event...") ); | 1633 | mDeleteAction->setText( i18n("Delete Event...") ); |
1632 | 1634 | ||
1633 | mNewSubTodoAction->setEnabled( false ); | 1635 | mNewSubTodoAction->setEnabled( false ); |
1634 | } else if ( incidence->type() == "Todo" ) { | 1636 | } else if ( incidence->type() == "Todo" ) { |
1635 | mShowAction->setText( i18n("Show Todo...") ); | 1637 | mShowAction->setText( i18n("Show Todo...") ); |
1636 | mEditAction->setText( i18n("Edit Todo...") ); | 1638 | mEditAction->setText( i18n("Edit Todo...") ); |
1637 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1639 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1638 | 1640 | ||
1639 | mNewSubTodoAction->setEnabled( true ); | 1641 | mNewSubTodoAction->setEnabled( true ); |
1640 | } else { | 1642 | } else { |
1641 | mShowAction->setText( i18n("Show...") ); | 1643 | mShowAction->setText( i18n("Show...") ); |
1642 | mShowAction->setText( i18n("Edit...") ); | 1644 | mShowAction->setText( i18n("Edit...") ); |
1643 | mShowAction->setText( i18n("Delete...") ); | 1645 | mShowAction->setText( i18n("Delete...") ); |
1644 | 1646 | ||
1645 | mNewSubTodoAction->setEnabled( false ); | 1647 | mNewSubTodoAction->setEnabled( false ); |
1646 | } | 1648 | } |
1647 | } | 1649 | } |
1648 | 1650 | ||
1649 | void MainWindow::enableIncidenceActions( bool enabled ) | 1651 | void MainWindow::enableIncidenceActions( bool enabled ) |
1650 | { | 1652 | { |
1651 | mShowAction->setEnabled( enabled ); | 1653 | mShowAction->setEnabled( enabled ); |
1652 | mEditAction->setEnabled( enabled ); | 1654 | mEditAction->setEnabled( enabled ); |
1653 | mDeleteAction->setEnabled( enabled ); | 1655 | mDeleteAction->setEnabled( enabled ); |
1654 | 1656 | ||
1655 | mCloneAction->setEnabled( enabled ); | 1657 | mCloneAction->setEnabled( enabled ); |
1656 | mMoveAction->setEnabled( enabled ); | 1658 | mMoveAction->setEnabled( enabled ); |
1657 | mBeamAction->setEnabled( enabled ); | 1659 | mBeamAction->setEnabled( enabled ); |
1658 | mCancelAction->setEnabled( enabled ); | 1660 | mCancelAction->setEnabled( enabled ); |
1659 | } | 1661 | } |
1660 | 1662 | ||
1661 | void MainWindow::importOL() | 1663 | void MainWindow::importOL() |
1662 | { | 1664 | { |
1663 | #ifdef _OL_IMPORT_ | 1665 | #ifdef _OL_IMPORT_ |
1664 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1666 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1665 | id->exec(); | 1667 | id->exec(); |
1666 | delete id; | 1668 | delete id; |
1667 | mView->updateView(); | 1669 | mView->updateView(); |
1668 | #endif | 1670 | #endif |