From 094f8d9a878ff83db4e3bdd5ca2bcb273f96c7ea Mon Sep 17 00:00:00 2001 From: Emanoil Kotsev Date: Sat, 29 Feb 2020 18:39:20 +0900 Subject: Extended the interface of KNotes with getLastModified method. This relates to bug 2691. Signed-off-by: Emanoil Kotsev Signed-off-by: Michele Calgaro --- knotes/KNotesAppIface.h | 7 +++++++ knotes/KNotesIface.h | 7 +++++++ knotes/knote.cpp | 5 +++++ knotes/knote.h | 1 + knotes/knotesapp.cpp | 9 +++++++++ knotes/knotesapp.h | 1 + kontact/plugins/knotes/knotes_part.cpp | 8 ++++++++ kontact/plugins/knotes/knotes_part.h | 2 ++ kontact/plugins/knotes/knotes_plugin.cpp | 5 +++-- 9 files changed, 43 insertions(+), 2 deletions(-) diff --git a/knotes/KNotesAppIface.h b/knotes/KNotesAppIface.h index ad24a58b..dea2881e 100644 --- a/knotes/KNotesAppIface.h +++ b/knotes/KNotesAppIface.h @@ -34,6 +34,7 @@ #include #include +#include #include @@ -210,6 +211,12 @@ k_dcop: * 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; + + /** + * 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 diff --git a/knotes/KNotesIface.h b/knotes/KNotesIface.h index 1fba1860..62479098 100644 --- a/knotes/KNotesIface.h +++ b/knotes/KNotesIface.h @@ -24,6 +24,7 @@ #include #include +#include #include @@ -98,6 +99,12 @@ k_dcop: * @return the body as a TQString */ 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 diff --git a/knotes/knote.cpp b/knotes/knote.cpp index 4f70848b..e20b52ef 100644 --- a/knotes/knote.cpp +++ b/knotes/knote.cpp @@ -453,6 +453,11 @@ TQString KNote::noteId() const return m_journal->uid(); } +TQDateTime KNote::getLastModified() const +{ + return m_journal->lastModified(); +} + TQString KNote::name() const { return m_label->text(); diff --git a/knotes/knote.h b/knotes/knote.h index 43444b99..201c7f79 100644 --- a/knotes/knote.h +++ b/knotes/knote.h @@ -77,6 +77,7 @@ public: void find( const TQString& pattern, long options ); bool isModified() const; + TQDateTime getLastModified() const; void sync( const TQString& app ); bool isNew( const TQString& app ) const; diff --git a/knotes/knotesapp.cpp b/knotes/knotesapp.cpp index 5cc2635c..2a4e84b1 100644 --- a/knotes/knotesapp.cpp +++ b/knotes/knotesapp.cpp @@ -342,6 +342,15 @@ TQMap KNotesApp::notes() const 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 { KNote* note = m_noteList[id]; diff --git a/knotes/knotesapp.h b/knotes/knotesapp.h index 0888e20b..649b4b0b 100644 --- a/knotes/knotesapp.h +++ b/knotes/knotesapp.h @@ -90,6 +90,7 @@ public: void sync( const TQString& app ); bool isNew( 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& ); diff --git a/kontact/plugins/knotes/knotes_part.cpp b/kontact/plugins/knotes/knotes_part.cpp index 02a4028e..20e8d6c9 100644 --- a/kontact/plugins/knotes/knotes_part.cpp +++ b/kontact/plugins/knotes/knotes_part.cpp @@ -274,6 +274,14 @@ TQMap KNotesPart::notes() const 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 diff --git a/kontact/plugins/knotes/knotes_part.h b/kontact/plugins/knotes/knotes_part.h index 023a78b9..67808bae 100644 --- a/kontact/plugins/knotes/knotes_part.h +++ b/kontact/plugins/knotes/knotes_part.h @@ -72,6 +72,8 @@ class KNotesPart : public KParts::ReadOnlyPart, virtual public KNotesIface TQMap notes() const; + TQDateTime getLastModified( const TQString& id ) const; + private slots: void createNote( KCal::Journal *journal ); void killNote( KCal::Journal *journal ); diff --git a/kontact/plugins/knotes/knotes_plugin.cpp b/kontact/plugins/knotes/knotes_plugin.cpp index fceeb65b..bec6fb5c 100644 --- a/kontact/plugins/knotes/knotes_plugin.cpp +++ b/kontact/plugins/knotes/knotes_plugin.cpp @@ -70,9 +70,10 @@ const TDEAboutData *KNotesPlugin::aboutData() mAboutData = new TDEAboutData( "knotes", I18N_NOOP( "Notes Management" ), "0.5", I18N_NOOP( "Notes Management" ), TDEAboutData::License_GPL_V2, - "(c) 2003-2004 The Kontact developers" ); - mAboutData->addAuthor( "Michael Brade", "Current Maintainer", "brade@kde.org" ); + "(c) 2003-2020 The Kontact developers" ); + mAboutData->addAuthor( "Michael Brade", "", "brade@kde.org" ); mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" ); + mAboutData->addAuthor( "TDE Team", "", "trinitydesktop.org" ); } return mAboutData; -- cgit v1.2.3