|
Lines 96-103
KNotesPart::KNotesPart( TQObject *parent, const char *name )
Link Here
|
| 96 |
connect( mManager, TQT_SIGNAL( sigDeregisteredNote( KCal::Journal* ) ), |
96 |
connect( mManager, TQT_SIGNAL( sigDeregisteredNote( KCal::Journal* ) ), |
| 97 |
this, TQT_SLOT( killNote( KCal::Journal* ) ) ); |
97 |
this, TQT_SLOT( killNote( KCal::Journal* ) ) ); |
| 98 |
|
98 |
|
|
|
99 |
|
| 99 |
// read the notes |
100 |
// read the notes |
| 100 |
mManager->load(); |
101 |
mManager->load(); |
|
|
102 |
|
| 103 |
TQDictIterator<KNotesIconViewItem> it( mNoteList ); |
| 104 |
for ( ; it; ++it ) |
| 105 |
mNotesRevisionList.insert( |
| 106 |
static_cast<KNotesIconViewItem *>( it )->journal()->uid(), |
| 107 |
static_cast<KNotesIconViewItem *>( it )->journal()->lastModified()); |
| 101 |
} |
108 |
} |
| 102 |
|
109 |
|
| 103 |
KNotesPart::~KNotesPart() |
110 |
KNotesPart::~KNotesPart() |
|
Lines 190-196
TQString KNotesPart::newNote( const TQString& name, const TQString& text )
Link Here
|
| 190 |
} |
197 |
} |
| 191 |
|
198 |
|
| 192 |
mManager->addNewNote( journal ); |
199 |
mManager->addNewNote( journal ); |
| 193 |
mManager->save(); |
200 |
mNotesRevisionList.insert(journal->uid(), TQDateTime::currentDateTime()); |
|
|
201 |
// mManager->save(); |
| 202 |
saveAll(); |
| 194 |
|
203 |
|
| 195 |
KNotesIconViewItem *note = mNoteList[ journal->uid() ]; |
204 |
KNotesIconViewItem *note = mNoteList[ journal->uid() ]; |
| 196 |
mNotesView->ensureItemVisible( note ); |
205 |
mNotesView->ensureItemVisible( note ); |
|
Lines 222-232
void KNotesPart::killNote( const TQString& id, bool force )
Link Here
|
| 222 |
|| force ) |
231 |
|| force ) |
| 223 |
) |
232 |
) |
| 224 |
{ |
233 |
{ |
|
|
234 |
mNotesRevisionList.remove(id); |
| 225 |
mManager->deleteNote( mNoteList[id]->journal() ); |
235 |
mManager->deleteNote( mNoteList[id]->journal() ); |
| 226 |
mManager->save(); |
236 |
// mManager->save(); |
|
|
237 |
saveAll(); |
| 227 |
} |
238 |
} |
| 228 |
} |
239 |
} |
| 229 |
|
240 |
|
|
|
241 |
void KNotesPart::saveAll() |
| 242 |
{ |
| 243 |
|
| 244 |
TQDictIterator<KNotesIconViewItem> it( mNoteList ); |
| 245 |
for ( ; *it; ++it ) |
| 246 |
(*it)->journal()->setLastModified(mNotesRevisionList[(*it)->journal()->uid()]) ; |
| 247 |
// kdDebug(5500) << "KNotesPart::saveAll() : " << (*it)->journal()->lastModified().toString() << endl; |
| 248 |
|
| 249 |
mManager->save(); |
| 250 |
} |
| 251 |
|
| 230 |
TQString KNotesPart::name( const TQString& id ) const |
252 |
TQString KNotesPart::name( const TQString& id ) const |
| 231 |
{ |
253 |
{ |
| 232 |
KNotesIconViewItem *note = mNoteList[ id ]; |
254 |
KNotesIconViewItem *note = mNoteList[ id ]; |
|
Lines 250-256
void KNotesPart::setName( const TQString& id, const TQString& newName )
Link Here
|
| 250 |
KNotesIconViewItem *note = mNoteList[ id ]; |
272 |
KNotesIconViewItem *note = mNoteList[ id ]; |
| 251 |
if ( note ) { |
273 |
if ( note ) { |
| 252 |
note->setText( newName ); |
274 |
note->setText( newName ); |
| 253 |
mManager->save(); |
275 |
mNotesRevisionList.replace(id, TQDateTime::currentDateTime()); |
|
|
276 |
// mManager->save(); |
| 277 |
saveAll(); |
| 254 |
} |
278 |
} |
| 255 |
} |
279 |
} |
| 256 |
|
280 |
|
|
Lines 259-265
void KNotesPart::setText( const TQString& id, const TQString& newText )
Link Here
|
| 259 |
KNotesIconViewItem *note = mNoteList[ id ]; |
283 |
KNotesIconViewItem *note = mNoteList[ id ]; |
| 260 |
if ( note ) { |
284 |
if ( note ) { |
| 261 |
note->journal()->setDescription( newText ); |
285 |
note->journal()->setDescription( newText ); |
| 262 |
mManager->save(); |
286 |
mNotesRevisionList.replace(id, TQDateTime::currentDateTime()); |
|
|
287 |
// mManager->save(); |
| 288 |
saveAll(); |
| 263 |
} |
289 |
} |
| 264 |
} |
290 |
} |
| 265 |
|
291 |
|
|
Lines 274-279
TQMap<TQString, TQString> KNotesPart::notes() const
Link Here
|
| 274 |
return notes; |
300 |
return notes; |
| 275 |
} |
301 |
} |
| 276 |
|
302 |
|
|
|
303 |
TQDateTime KNotesPart::getLastModified( const TQString& noteId ) const |
| 304 |
{ |
| 305 |
|
| 306 |
// KNotesIconViewItem *note = mNoteList[noteId]; |
| 307 |
// TQDateTime d = mNotesRevisionList[noteId].value(); |
| 308 |
// if ( note ) |
| 309 |
// d = note->journal()->lastModified(); |
| 310 |
// if (!d.isValid()) |
| 311 |
// d.setTime_t(0); |
| 312 |
return mNotesRevisionList[noteId]; |
| 313 |
|
| 314 |
} |
| 277 |
|
315 |
|
| 278 |
// private stuff |
316 |
// private stuff |
| 279 |
|
317 |
|
|
Lines 304-313
void KNotesPart::killSelectedNotes()
Link Here
|
| 304 |
TQPtrListIterator<KNotesIconViewItem> kniviIt( items ); |
342 |
TQPtrListIterator<KNotesIconViewItem> kniviIt( items ); |
| 305 |
while ( (knivi = *kniviIt) ) { |
343 |
while ( (knivi = *kniviIt) ) { |
| 306 |
++kniviIt; |
344 |
++kniviIt; |
|
|
345 |
mNotesRevisionList.remove(knivi->journal()->uid()); |
| 307 |
mManager->deleteNote( knivi->journal() ); |
346 |
mManager->deleteNote( knivi->journal() ); |
| 308 |
} |
347 |
} |
| 309 |
|
348 |
// mManager->save(); |
| 310 |
mManager->save(); |
349 |
saveAll(); |
| 311 |
} |
350 |
} |
| 312 |
} |
351 |
} |
| 313 |
|
352 |
|
|
Lines 358-368
void KNotesPart::createNote( KCal::Journal *journal )
Link Here
|
| 358 |
if ( property.isNull() ) |
397 |
if ( property.isNull() ) |
| 359 |
journal->setCustomProperty( "KNotes", "RichText", "true" ); |
398 |
journal->setCustomProperty( "KNotes", "RichText", "true" ); |
| 360 |
|
399 |
|
|
|
400 |
mNotesRevisionList.insert( journal->uid(), TQDateTime::currentDateTime()); |
| 361 |
mNoteList.insert( journal->uid(), new KNotesIconViewItem( mNotesView, journal ) ); |
401 |
mNoteList.insert( journal->uid(), new KNotesIconViewItem( mNotesView, journal ) ); |
| 362 |
} |
402 |
} |
| 363 |
|
403 |
|
| 364 |
void KNotesPart::killNote( KCal::Journal *journal ) |
404 |
void KNotesPart::killNote( KCal::Journal *journal ) |
| 365 |
{ |
405 |
{ |
|
|
406 |
mNotesRevisionList.remove( journal->uid()); |
| 366 |
mNoteList.remove( journal->uid() ); |
407 |
mNoteList.remove( journal->uid() ); |
| 367 |
} |
408 |
} |
| 368 |
|
409 |
|
|
Lines 380-386
void KNotesPart::editNote( TQIconViewItem *item )
Link Here
|
| 380 |
if ( mNoteEditDlg->exec() == TQDialog::Accepted ) { |
421 |
if ( mNoteEditDlg->exec() == TQDialog::Accepted ) { |
| 381 |
item->setText( mNoteEditDlg->title() ); |
422 |
item->setText( mNoteEditDlg->title() ); |
| 382 |
journal->setDescription( mNoteEditDlg->text() ); |
423 |
journal->setDescription( mNoteEditDlg->text() ); |
| 383 |
mManager->save(); |
424 |
mNotesRevisionList.replace(journal->uid(),TQDateTime::currentDateTime()); |
|
|
425 |
// mManager->save(); |
| 426 |
saveAll(); |
| 384 |
} |
427 |
} |
| 385 |
} |
428 |
} |
| 386 |
|
429 |
|
|
Lines 392-399
void KNotesPart::renameNote()
Link Here
|
| 392 |
|
435 |
|
| 393 |
void KNotesPart::renamedNote( TQIconViewItem* ) |
436 |
void KNotesPart::renamedNote( TQIconViewItem* ) |
| 394 |
{ |
437 |
{ |
| 395 |
if ( mOldName != mNotesView->currentItem()->text() ) |
438 |
if ( mOldName != mNotesView->currentItem()->text() ) { |
| 396 |
mManager->save(); |
439 |
mNotesRevisionList.replace( |
|
|
440 |
static_cast<KNotesIconViewItem *>( mNotesView->currentItem() )->journal()->uid(), |
| 441 |
TQDateTime::currentDateTime()); |
| 442 |
// mManager->save(); |
| 443 |
saveAll(); |
| 444 |
} |
| 397 |
} |
445 |
} |
| 398 |
|
446 |
|
| 399 |
void KNotesPart::slotOnCurrentChanged( TQIconViewItem* ) |
447 |
void KNotesPart::slotOnCurrentChanged( TQIconViewItem* ) |