Extended the interface of KNotes with getLastModified method. This

relates to bug 2691.

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Emanoil Kotsev 5 years ago committed by Michele Calgaro
parent 0087f22b73
commit 094f8d9a87
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -34,6 +34,7 @@
#include <tqstring.h> #include <tqstring.h>
#include <tqmap.h> #include <tqmap.h>
#include <tqdatetime.h>
#include <dcopobject.h> #include <dcopobject.h>
@ -210,6 +211,12 @@ k_dcop:
* new as well!) and false if the note is not modified or doesn't exist * new as well!) and false if the note is not modified or doesn't exist
*/ */
virtual bool isModified( const TQString& app, const TQString& noteId ) const = 0; virtual bool isModified( const TQString& app, const TQString& noteId ) const = 0;
/**
* Get the last modified time of a note
* @return the last modified time as a TQDateTime
*/
virtual TQDateTime getLastModified( const TQString& noteId ) const = 0;
}; };
#endif #endif

@ -24,6 +24,7 @@
#include <tqstring.h> #include <tqstring.h>
#include <tqmap.h> #include <tqmap.h>
#include <tqdatetime.h>
#include <dcopobject.h> #include <dcopobject.h>
@ -98,6 +99,12 @@ k_dcop:
* @return the body as a TQString * @return the body as a TQString
*/ */
virtual TQString text( const TQString& noteId ) const = 0; virtual TQString text( const TQString& noteId ) const = 0;
/**
* Get the last modified time of a note
* @return the last modified time as a TQDateTime
*/
virtual TQDateTime getLastModified( const TQString& noteId ) const = 0;
}; };
#endif #endif

@ -453,6 +453,11 @@ TQString KNote::noteId() const
return m_journal->uid(); return m_journal->uid();
} }
TQDateTime KNote::getLastModified() const
{
return m_journal->lastModified();
}
TQString KNote::name() const TQString KNote::name() const
{ {
return m_label->text(); return m_label->text();

@ -77,6 +77,7 @@ public:
void find( const TQString& pattern, long options ); void find( const TQString& pattern, long options );
bool isModified() const; bool isModified() const;
TQDateTime getLastModified() const;
void sync( const TQString& app ); void sync( const TQString& app );
bool isNew( const TQString& app ) const; bool isNew( const TQString& app ) const;

@ -342,6 +342,15 @@ TQMap<TQString,TQString> KNotesApp::notes() const
return notes; return notes;
} }
TQDateTime KNotesApp::getLastModified( const TQString& id ) const
{
KNote* note = m_noteList[id];
TQDateTime d;
if ( note )
d = note->getLastModified();
return d;
}
TQString KNotesApp::name( const TQString& id ) const TQString KNotesApp::name( const TQString& id ) const
{ {
KNote* note = m_noteList[id]; KNote* note = m_noteList[id];

@ -90,6 +90,7 @@ public:
void sync( const TQString& app ); void sync( const TQString& app );
bool isNew( const TQString& app, const TQString& id ) const; bool isNew( const TQString& app, const TQString& id ) const;
bool isModified( const TQString& app, const TQString& id ) const; bool isModified( const TQString& app, const TQString& id ) const;
TQDateTime getLastModified( const TQString& noteId ) const;
bool commitData( TQSessionManager& ); bool commitData( TQSessionManager& );

@ -274,6 +274,14 @@ TQMap<TQString, TQString> KNotesPart::notes() const
return notes; return notes;
} }
TQDateTime KNotesPart::getLastModified( const TQString& id ) const
{
KNotesIconViewItem *note = mNoteList[ id ];
TQDateTime dt;
if ( note )
dt = note->journal()->lastModified();
return dt;
}
// private stuff // private stuff

@ -72,6 +72,8 @@ class KNotesPart : public KParts::ReadOnlyPart, virtual public KNotesIface
TQMap<TQString, TQString> notes() const; TQMap<TQString, TQString> notes() const;
TQDateTime getLastModified( const TQString& id ) const;
private slots: private slots:
void createNote( KCal::Journal *journal ); void createNote( KCal::Journal *journal );
void killNote( KCal::Journal *journal ); void killNote( KCal::Journal *journal );

@ -70,9 +70,10 @@ const TDEAboutData *KNotesPlugin::aboutData()
mAboutData = new TDEAboutData( "knotes", I18N_NOOP( "Notes Management" ), mAboutData = new TDEAboutData( "knotes", I18N_NOOP( "Notes Management" ),
"0.5", I18N_NOOP( "Notes Management" ), "0.5", I18N_NOOP( "Notes Management" ),
TDEAboutData::License_GPL_V2, TDEAboutData::License_GPL_V2,
"(c) 2003-2004 The Kontact developers" ); "(c) 2003-2020 The Kontact developers" );
mAboutData->addAuthor( "Michael Brade", "Current Maintainer", "brade@kde.org" ); mAboutData->addAuthor( "Michael Brade", "", "brade@kde.org" );
mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" ); mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" );
mAboutData->addAuthor( "TDE Team", "", "trinitydesktop.org" );
} }
return mAboutData; return mAboutData;

Loading…
Cancel
Save