Commit a95a1b30 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 178077 - notes are not updated in kontact overview

FIXED-IN: 4.12
BUG: 178077
parent 53df4f4c
......@@ -45,12 +45,12 @@ using namespace KCal;
#include <QMenu>
KNotesPart::KNotesPart( QObject *parent )
KNotesPart::KNotesPart( KNotesResourceManager *manager, QObject *parent )
: KParts::ReadOnlyPart( parent ),
mNotesWidget( new KNotesWidget(this) ),
mNoteTip( new KNoteTip( mNotesWidget->notesView() ) ),
mNoteEditDlg( 0 ),
mManager( new KNotesResourceManager() )
mManager( manager )
{
(void) new KNotesAdaptor( this );
QDBusConnection::sessionBus().registerObject( QLatin1String("/KNotes"), this );
......@@ -146,8 +146,6 @@ KNotesPart::KNotesPart( QObject *parent )
this, SLOT(createNote(KCal::Journal*)) );
connect( mManager, SIGNAL(sigDeregisteredNote(KCal::Journal*)),
this, SLOT(killNote(KCal::Journal*)) );
// read the notes
mManager->load();
}
......@@ -155,9 +153,6 @@ KNotesPart::~KNotesPart()
{
delete mNoteTip;
mNoteTip = 0;
delete mManager;
mManager = 0;
}
void KNotesPart::requestToolTip( const QModelIndex &index )
......
......@@ -43,7 +43,7 @@ class KNotesPart : public KParts::ReadOnlyPart
Q_OBJECT
public:
explicit KNotesPart( QObject *parent = 0 );
explicit KNotesPart(KNotesResourceManager *manager, QObject *parent = 0 );
~KNotesPart();
bool openFile();
......
......@@ -20,6 +20,7 @@
#include "knotes_plugin.h"
#include "knotes_part.h"
#include "knotes/resource/resourcemanager.h"
#include "summarywidget.h"
#include "kdepim-version.h"
......@@ -51,6 +52,7 @@ EXPORT_KONTACT_PLUGIN( KNotesPlugin, knotes )
KNotesPlugin::KNotesPlugin( KontactInterface::Core *core, const QVariantList & )
: KontactInterface::Plugin( core, core, "knotes" ), mAboutData( 0 )
{
mManager = new KNotesResourceManager();
setComponentData( KontactPluginFactory::componentData() );
KAction *action =
......@@ -81,6 +83,7 @@ KNotesPlugin::KNotesPlugin( KontactInterface::Core *core, const QVariantList & )
KNotesPlugin::~KNotesPlugin()
{
delete mManager;
}
QString KNotesPlugin::tipFile() const
......@@ -93,12 +96,12 @@ QString KNotesPlugin::tipFile() const
KParts::ReadOnlyPart *KNotesPlugin::createPart()
{
return new KNotesPart( this );
return new KNotesPart( mManager, this );
}
KontactInterface::Summary *KNotesPlugin::createSummaryWidget( QWidget *parentWidget )
{
return new KNotesSummaryWidget( this, parentWidget );
return new KNotesSummaryWidget( mManager, this, parentWidget );
}
const KAboutData *KNotesPlugin::aboutData() const
......
......@@ -24,7 +24,7 @@
#define KNOTES_PLUGIN_H
#include <KontactInterface/Plugin>
class KNotesResourceManager;
class KNotesPlugin : public KontactInterface::Plugin
{
Q_OBJECT
......@@ -51,6 +51,7 @@ class KNotesPlugin : public KontactInterface::Plugin
private:
mutable KAboutData *mAboutData;
KNotesResourceManager *mManager;
};
#endif
......@@ -23,6 +23,7 @@
*/
#include "summarywidget.h"
#include "knotes_plugin.h"
#include "knotes/resource/resourcemanager.h"
#include <KCal/CalendarLocal>
......@@ -39,8 +40,10 @@
#include <QLabel>
#include <QVBoxLayout>
KNotesSummaryWidget::KNotesSummaryWidget( KontactInterface::Plugin *plugin, QWidget *parent )
: KontactInterface::Summary( parent ), mLayout( 0 ), mPlugin( plugin )
KNotesSummaryWidget::KNotesSummaryWidget(KNotesResourceManager *manager, KNotesPlugin *plugin, QWidget *parent )
: KontactInterface::Summary( parent ),
mLayout( 0 ),
mPlugin( plugin )
{
QVBoxLayout *mainLayout = new QVBoxLayout( this );
mainLayout->setSpacing( 3 );
......@@ -55,20 +58,15 @@ KNotesSummaryWidget::KNotesSummaryWidget( KontactInterface::Plugin *plugin, QWid
mLayout->setRowStretch( 6, 1 );
mCalendar = new CalendarLocal( QString::fromLatin1( "UTC" ) );
mManager = new KNotesResourceManager();
QObject::connect( mManager, SIGNAL(sigRegisteredNote(KCal::Journal*)),
QObject::connect( manager, SIGNAL(sigRegisteredNote(KCal::Journal*)),
this, SLOT(addNote(KCal::Journal*)) );
QObject::connect( mManager, SIGNAL(sigDeregisteredNote(KCal::Journal*)),
QObject::connect( manager, SIGNAL(sigDeregisteredNote(KCal::Journal*)),
this, SLOT(removeNote(KCal::Journal*)) );
mManager->load();
updateView();
}
KNotesSummaryWidget::~KNotesSummaryWidget()
{
delete mManager;
}
void KNotesSummaryWidget::updateView()
......
......@@ -33,10 +33,7 @@ namespace KCal {
}
using namespace KCal;
namespace KontactInterface {
class Plugin;
}
class KNotesPlugin;
class KNotesResourceManager;
class QGridLayout;
class QLabel;
......@@ -45,7 +42,7 @@ class KNotesSummaryWidget : public KontactInterface::Summary
{
Q_OBJECT
public:
KNotesSummaryWidget( KontactInterface::Plugin *plugin, QWidget *parent );
KNotesSummaryWidget(KNotesResourceManager *manager, KNotesPlugin *plugin, QWidget *parent );
~KNotesSummaryWidget();
void updateSummary( bool force = false )
......@@ -70,7 +67,7 @@ class KNotesSummaryWidget : public KontactInterface::Summary
QGridLayout *mLayout;
QList<QLabel *> mLabels;
KontactInterface::Plugin *mPlugin;
KNotesPlugin *mPlugin;
KNotesResourceManager *mManager;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment