[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kontact/plugins/knotes
From:       Michael Brade <brade () kde ! org>
Date:       2004-08-25 20:48:24
Message-ID: 20040825204824.CC05323DB () office ! kde ! org
[Download RAW message or body]

CVS commit by brade: 

Finished the KNotesIface implementation for the KNotes part, fixed a few
little things and bugs. 

Sorry Adriaan, can't implement the broken dcop methods in Kontact, we
really need to implement this functionality in KPilot for the next 
version already if you want them to work.


  M +36 -9     knotes_part.cpp   1.35


--- kdepim/kontact/plugins/knotes/knotes_part.cpp  #1.34:1.35
@@ -76,5 +76,5 @@ private:
 
 KNotesPart::KNotesPart( QObject *parent, const char *name )
-  : KPIM::Part( parent, name ),
+  : DCOPObject("KNotesIface"), KPIM::Part( parent, name ),
     m_context_menu( 0 )
 {
@@ -173,7 +173,10 @@ QString KNotesPart::newNoteFromClipboard
 void KNotesPart::showNote( const QString& id ) const
 {
-    KNotesIconViewItem *item = m_noteList[id];
-    m_notesView->ensureItemVisible( item );
-    m_notesView->setCurrentItem( item );
+    KNotesIconViewItem *note = m_noteList[id];
+    if ( !note )
+        return;
+
+    m_notesView->ensureItemVisible( note );
+    m_notesView->setCurrentItem( note );
 }
 
@@ -185,28 +188,50 @@ void KNotesPart::hideNote( const QString
 void KNotesPart::killNote( const QString& id )
 {
+    killNote( id, false );
 }
 
 void KNotesPart::killNote( const QString& id, bool force )
 {
+    KNotesIconViewItem *note = m_noteList[id];
+
+    if ( note && !force && KMessageBox::warningContinueCancelList( m_notesView,
+            i18n( "Do you really want to delete this note?" ),
+            m_noteList[id]->text(), i18n("Confirm Delete"),
+            KGuiItem( i18n("Delete"), "editdelete" ) ) == KMessageBox::Continue )
+    {
+        m_manager->deleteNote( m_noteList[id]->journal() );
+    }
 }
 
 QString KNotesPart::name( const QString& id ) const
 {
-    return m_noteList[id]->text();
+    KNotesIconViewItem *note = m_noteList[id];
+    if ( note )
+        return note->text();
+    else
+        return QString::null;
 }
 
 QString KNotesPart::text( const QString& id ) const
 {
-    return m_noteList[id]->journal()->description();
+    KNotesIconViewItem *note = m_noteList[id];
+    if ( note )
+        return note->journal()->description();
+    else
+        return QString::null;
 }
 
 void KNotesPart::setName( const QString& id, const QString& newName )
 {
-    m_noteList[id]->setText( newName );
+    KNotesIconViewItem *note = m_noteList[id];
+    if ( note )
+        return note->setText( newName );
 }
 
 void KNotesPart::setText( const QString& id, const QString& newText )
 {
-    m_noteList[id]->journal()->setDescription( newText );
+    KNotesIconViewItem *note = m_noteList[id];
+    if ( note )
+        return note->journal()->setDescription( newText );
 }
 
@@ -230,8 +255,10 @@ void KNotesPart::sync( const QString& ap
 bool KNotesPart::isNew( const QString& app, const QString& id ) const
 {
+    return true;
 }
 
 bool KNotesPart::isModified( const QString& app, const QString& id ) const
 {
+    return true;
 }
 
@@ -298,5 +325,5 @@ void KNotesPart::popupRMB( QIconViewItem
 void KNotesPart::createNote( KCal::Journal *journal )
 {
-    new KNotesIconViewItem( m_notesView, journal );
+    m_noteList.insert( journal->uid(), new KNotesIconViewItem( m_notesView, journal ) );
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic