[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kontact/plugins/knotes
From: Till Adam <adam () kde ! org>
Date: 2004-09-15 21:30:28
Message-ID: 20040915213028.8C65EB67 () office ! kde ! org
[Download RAW message or body]
CVS commit by tilladam:
Forward port of:
CVS commit by tilladam:
Fix proko2 issue 389 by making the knotes summary widget show notes from
all resources, not just the local file one.
M +27 -9 summarywidget.cpp 1.20
M +3 -5 summarywidget.h 1.9
--- kdepim/kontact/plugins/knotes/summarywidget.cpp #1.19:1.20
@@ -22,4 +22,5 @@
*/
+#include <qobject.h>
#include <qlabel.h>
#include <qlayout.h>
@@ -35,4 +36,7 @@
#include <kstandarddirs.h>
+#include <knotes/resourcenotes.h>
+#include <knotes/resourcemanager.h>
+
#include "core.h"
#include "plugin.h"
@@ -42,15 +46,16 @@
KNotesSummaryWidget::KNotesSummaryWidget( Kontact::Plugin *plugin,
QWidget *parent, const char *name )
- : Kontact::Summary( parent, name ),
+ : Kontact::Summary( parent, name ), mMainLayout( 0 ), mLayout( 0 ),
mPlugin( plugin )
{
mMainLayout = new QVBoxLayout( this, 3, 3 );
- mCalendar = new KCal::CalendarResources;
- mResource = new KCal::ResourceLocal( ::locate( "data", "knotes/notes.ics" ) );
- mCalendar->resourceManager()->add( mResource );
- mCalendar->load();
-
- connect( mCalendar, SIGNAL( calendarChanged() ), SLOT( updateView() ) );
+ mCalendar = new KCal::CalendarLocal();
+ KNotesResourceManager *manager = new KNotesResourceManager();
+ QObject::connect( manager, SIGNAL( sigRegisteredNote( KCal::Journal* ) ),
+ this, SLOT( addNote( KCal::Journal* ) ) );
+ QObject::connect( manager, SIGNAL( sigDeregisteredNote( KCal::Journal* ) ),
+ this, SLOT( removeNote( KCal::Journal* ) ) );
+ manager->load();
QPixmap icon = KGlobal::iconLoader()->loadIcon( "kontact_notes", KIcon::Desktop, KIcon::SizeMedium );
@@ -96,3 +101,16 @@ void KNotesSummaryWidget::urlClicked( co
}
+void KNotesSummaryWidget::addNote( KCal::Journal *j )
+{
+ mCalendar->addJournal( j );
+ updateView();
+}
+
+void KNotesSummaryWidget::removeNote( KCal::Journal *j )
+{
+ mCalendar->deleteJournal( j );
+ updateView();
+}
+
+
#include "summarywidget.moc"
--- kdepim/kontact/plugins/knotes/summarywidget.h #1.8:1.9
@@ -34,6 +34,4 @@
#include <libkcal/calendarresources.h>
-typedef QMap<QString, QString> NotesMap;
-
class QGridLayout;
class QLabel;
@@ -58,8 +56,9 @@ class KNotesSummaryWidget : public Konta
void urlClicked( const QString& );
void updateView();
+ void addNote( KCal::Journal* );
+ void removeNote( KCal::Journal* );
private:
- KCal::ResourceLocal *mResource;
- KCal::CalendarResources *mCalendar;
+ KCal::CalendarLocal *mCalendar;
KCal::Journal::List mNotes;
@@ -68,5 +67,4 @@ class KNotesSummaryWidget : public Konta
QPtrList<QLabel> mLabels;
- NotesMap mNotesMap;
Kontact::Plugin *mPlugin;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic